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 |
---|---|---|---|---|---|---|---|---|---|---|---|
c5d4ada6edb46a98d6627772e5a35c132d208f64
|
SQL
|
pavel-voinov/oracle-dba-workspace
|
/scripts/tools/procedures/exec_sql.sql
|
UTF-8
| 1,429 | 2.953125 | 3 |
[
"MIT"
] |
permissive
|
/*
*/
CREATE OR REPLACE PROCEDURE exec_sql (
p_SQL clob)
is
ds_cur pls_integer := dbms_sql.open_cursor;
sql_table dbms_sql.VARCHAR2S;
c_buf_len constant binary_integer := 256;
v_accum integer := 0;
v_beg integer := 1;
v_end integer := 256;
v_loblen pls_integer;
v_retval pls_integer;
-- local function to the execute_plsql_block procedure
function next_row (
clob_in clob,
len_in integer,
off_in integer)
return varchar2
is
begin
return dbms_lob.substr(clob_in, len_in, off_in);
end next_row;
begin
v_loblen := dbms_lob.getLength(p_SQL);
print(lpad('=', 10, '='));
print(p_SQL);
loop
-- Set the length to the remaining size
-- if there are < c_buf_len characters remaining.
if v_accum + c_buf_len > v_loblen then
v_end := v_loblen - v_accum;
end if;
sql_table(nvl(sql_table.last, 0) + 1) := next_row(p_SQL, v_end, v_beg);
v_beg := v_beg + c_buf_len;
v_accum := v_accum + v_end;
if v_accum >= v_loblen then
exit;
end if;
end loop;
-- Parse the pl/sql and execute it
dbms_sql.parse(ds_cur, sql_table, sql_table.first, sql_table.last, false, dbms_sql.native);
begin
v_retval := dbms_sql.execute(ds_cur);
dbms_sql.close_cursor(ds_cur);
exception when others then
print(SQLERRM);
dbms_sql.close_cursor(ds_cur);
raise;
end;
end exec_sql;
/
GRANT EXECUTE ON exec_sql TO PUBLIC;
| true |
fbc7d435dc08483757c197f043e254ff42e0158f
|
SQL
|
dangmengkun/Leetocde-everydaysql
|
/613. Shortest Distance in a Line.sql
|
UTF-8
| 196 | 3.421875 | 3 |
[] |
no_license
|
One trick here is to add the condition in the join to avoid calculating the distance between a point with itself.
select min(abs(p1.x-p2.x)) as shortest
from point p1 join point p2
on p1.x!=p2.x
| true |
ebef2fc706e329a5221907cdc5958f942d8090bc
|
SQL
|
adityasistu/Airline-Reservation-Management
|
/sql/travels (3).sql
|
UTF-8
| 4,489 | 2.828125 | 3 |
[] |
no_license
|
-- phpMyAdmin SQL Dump
-- version 4.9.1
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Nov 11, 2019 at 04:11 PM
-- Server version: 10.4.8-MariaDB
-- PHP Version: 7.3.10
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Database: `airline`
--
-- --------------------------------------------------------
--
-- Table structure for table `travels`
--
CREATE TABLE `travels` (
`flight_id` varchar(10) NOT NULL,
`departure_city` varchar(15) NOT NULL,
`arrival_city` varchar(15) NOT NULL,
`arrival_time` time DEFAULT NULL,
`departure_time` time NOT NULL,
`doj` date NOT NULL,
`available_seats_eco` int(11) DEFAULT NULL,
`class_Economy` varchar(30) DEFAULT NULL,
`available_seats_bus` int(11) DEFAULT NULL,
`class_Business` varchar(30) DEFAULT NULL,
`available_seats_first` int(11) DEFAULT NULL,
`class_First` varchar(30) DEFAULT NULL,
`filled_seats` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `travels`
--
INSERT INTO `travels` (`flight_id`, `departure_city`, `arrival_city`, `arrival_time`, `departure_time`, `doj`, `available_seats_eco`, `class_Economy`, `available_seats_bus`, `class_Business`, `available_seats_first`, `class_First`, `filled_seats`) VALUES
('121', 'bangalore', 'hyderabad', '16:00:00', '09:15:00', '2019-10-29', 32, 'Economy', 3, 'Business', 41, 'First', 52),
('121', 'calicut', 'bangalore', '16:00:00', '09:15:00', '2019-10-29', 32, 'Economy', 3, 'Business', 41, 'First', 52),
('121', 'calicut', 'hyderabad', '16:00:00', '07:15:00', '2019-10-12', 70, 'Economy', 42, 'Business', 44, 'First', 17),
('121', 'calicut', 'hyderabad', '16:00:00', '08:15:00', '2019-04-12', 71, 'Economy', 24, 'Business', 44, 'First', 45),
('121', 'calicut', 'hyderabad', '16:00:00', '11:15:00', '2019-10-29', 71, 'Economy', 24, 'Business', 44, 'First', 55),
('121', 'calicut', 'hyderabad', '16:00:00', '12:15:00', '2019-12-25', 65, 'Economy', 54, 'Business', 44, 'First', 18),
('121', 'calicut', 'vizag', '00:32:00', '00:32:00', '2019-12-12', 12, 'Economy', 34, 'Business', 15, 'First', 0),
('121', 'hyderabad', 'vizag', '15:21:00', '00:22:00', '2019-12-12', 12, 'Economy', 12, 'Business', 12, 'First', 0),
('122', 'calicut', 'bangalore', '10:00:00', '08:15:00', '2019-10-29', 50, 'Economy', 77, 'Business', 44, 'First', 46),
('124', 'hyderabad', 'calicut', '16:25:00', '08:15:00', '2019-10-29', 70, 'Economy', 21, 'Business', 36, 'First', 55),
('124', 'kolkata', 'hyderabad', '18:00:00', '11:15:00', '2019-10-29', 72, 'Economy', 10, 'Business', 42, 'First', 56),
('125', 'hyderabad', 'bangalore', '17:00:00', '10:15:00', '2019-10-29', 75, 'Economy', 43, 'Business', 44, 'First', 42),
('126', 'bangalore', 'vizag', '21:43:00', '07:06:00', '2019-03-12', 43, 'Economy', 34, 'Business', 56, 'First', 0),
('126', 'hyderabad', 'calicut', '05:25:00', '02:15:00', '2019-10-29', 77, 'Economy', 41, 'Business', 44, 'First', 77),
('127', 'delhi', 'hyderabad', '23:00:00', '22:15:00', '2019-10-29', 13, 'Economy', 14, 'Business', 44, 'First', 74),
('555', 'hyderabad', 'mumbai', '23:25:00', '18:15:00', '2019-10-29', 72, 'Economy', 63, 'Business', 44, 'First', 32),
('999', 'mumbai', 'bangalore', '11:00:00', '08:15:00', '2019-10-29', 13, 'Economy', 2, 'Business', 44, 'First', 4);
--
-- Indexes for dumped tables
--
--
-- Indexes for table `travels`
--
ALTER TABLE `travels`
ADD PRIMARY KEY (`flight_id`,`departure_city`,`arrival_city`,`departure_time`),
ADD KEY `arrival_city` (`arrival_city`),
ADD KEY `departure_city` (`departure_city`);
--
-- Constraints for dumped tables
--
--
-- Constraints for table `travels`
--
ALTER TABLE `travels`
ADD CONSTRAINT `travels_ibfk_1` FOREIGN KEY (`flight_id`) REFERENCES `flight` (`flight_id`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `travels_ibfk_2` FOREIGN KEY (`arrival_city`) REFERENCES `city` (`city`) ON DELETE CASCADE,
ADD CONSTRAINT `travels_ibfk_3` FOREIGN KEY (`departure_city`) REFERENCES `city` (`city`) 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 |
fed8e8121105e149fb8ddd005ffdacf4b4b8fa50
|
SQL
|
Eph-It/Automation
|
/src/EphIt/Classlibraries/EphIt.Db/SQL/Trigger/TR_Role_Audit_Update.sql
|
UTF-8
| 386 | 3.09375 | 3 |
[
"MIT"
] |
permissive
|
CREATE OR ALTER TRIGGER dbo.TR_Role_Audit_Update
ON [Role]
AFTER UPDATE
AS BEGIN
INSERT INTO [AUDIT] ( RbacActionId, RbacObjectId, Created, UserId, ObjectId )
SELECT
CASE
WHEN INSERTED.IsDeleted = 1 THEN 3
ELSE 4
END AS 'RbacActionId'
,2 AS 'RbacObjectId'
,GETUTCDATE() AS Created
,INSERTED.ModifiedByUserId AS UserId
,INSERTED.RoleId AS ObjectId
FROM INSERTED
END
| true |
da2c471ca4b805488ddea71fac8b64f1973aed01
|
SQL
|
j7ng/CLFY_SA
|
/SA/Tables/TABLE_N_ATTRIBUTEVALUE.sql
|
UTF-8
| 3,064 | 2.875 | 3 |
[] |
no_license
|
CREATE TABLE sa.table_n_attributevalue (
objid NUMBER,
dev NUMBER,
n_name VARCHAR2(50 BYTE),
n_type NUMBER,
n_focustype NUMBER,
n_focuslowid NUMBER,
n_stringvalue VARCHAR2(255 BYTE),
n_longvalue NUMBER,
n_datevalue DATE,
n_decimalvalue NUMBER(19,4),
n_targettype NUMBER,
n_targetlowid NUMBER,
n_modificationdate DATE,
n_targetfield VARCHAR2(30 BYTE),
n_status NUMBER,
n_required NUMBER,
n_configvalue NUMBER,
value2n_properties NUMBER
);
ALTER TABLE sa.table_n_attributevalue ADD SUPPLEMENTAL LOG GROUP dmtsora786971497_0 (dev, n_configvalue, n_datevalue, n_decimalvalue, n_focuslowid, n_focustype, n_longvalue, n_modificationdate, n_name, n_required, n_status, n_stringvalue, n_targetfield, n_targetlowid, n_targettype, n_type, objid, value2n_properties) ALWAYS;
COMMENT ON TABLE sa.table_n_attributevalue IS 'Contains an instance of a flexible attribute';
COMMENT ON COLUMN sa.table_n_attributevalue.objid IS 'Internal record number';
COMMENT ON COLUMN sa.table_n_attributevalue.dev IS 'Row version number for mobile distribution purposes';
COMMENT ON COLUMN sa.table_n_attributevalue.n_name IS 'Name of the attribute - copied from N_Attribute';
COMMENT ON COLUMN sa.table_n_attributevalue.n_type IS 'See N_Type on N_Attribute';
COMMENT ON COLUMN sa.table_n_attributevalue.n_focustype IS 'The schema type_id of the instance of the attribute; e.g., case=0, subcase=24. etc';
COMMENT ON COLUMN sa.table_n_attributevalue.n_focuslowid IS 'Focus objid of owning object instance';
COMMENT ON COLUMN sa.table_n_attributevalue.n_stringvalue IS 'If a string attribute, the string value';
COMMENT ON COLUMN sa.table_n_attributevalue.n_longvalue IS 'If a long attribute, the long value';
COMMENT ON COLUMN sa.table_n_attributevalue.n_datevalue IS 'If a datetime or dateonly attribute, the datetime or dateonly value';
COMMENT ON COLUMN sa.table_n_attributevalue.n_decimalvalue IS 'If a decimal attribute, the decimal value';
COMMENT ON COLUMN sa.table_n_attributevalue.n_targettype IS 'If a relation type, the schema type_id the target object of the relation; e.g., case=0, subcase=24. etc';
COMMENT ON COLUMN sa.table_n_attributevalue.n_targetlowid IS 'If a relation type the objid of the related object';
COMMENT ON COLUMN sa.table_n_attributevalue.n_modificationdate IS 'Date and time when the information was last modified';
COMMENT ON COLUMN sa.table_n_attributevalue.n_targetfield IS 'This field holds the name of a field used to display data from the related target record';
COMMENT ON COLUMN sa.table_n_attributevalue.n_status IS 'The status of the value for Process Manager. 0 = OK, 1 = Request(s) pending for dependent field, 2 = Requests pending for activation';
COMMENT ON COLUMN sa.table_n_attributevalue.n_required IS '1 = Required field';
COMMENT ON COLUMN sa.table_n_attributevalue.n_configvalue IS 'Set to 1 if the attribute was instantiated by the Configurator';
COMMENT ON COLUMN sa.table_n_attributevalue.value2n_properties IS 'N_Properties that defines the attribute instance';
| true |
efa0dc7dc788939893190d48c6b67277a91c0707
|
SQL
|
drobertadams/Prokope-Server
|
/queries.sql
|
UTF-8
| 3,934 | 3.890625 | 4 |
[] |
no_license
|
CREATE TABLE IF NOT EXISTS `users` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`username` varchar(60) NOT NULL DEFAULT '',
`password` varchar(45) NOT NULL DEFAULT '',
`firstname` varchar(60) NOT NULL DEFAULT '',
`lastname` varchar(60) NOT NULL DEFAULT '',
`professorid` int(11) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `groups` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`title` varchar(20) NOT NULL DEFAULT '',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `group_memberships` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`userid` int(11) NOT NULL,
`groupid` int(11) NOT NULL,
PRIMARY KEY(`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
create table if not exists `authors` (
`id` int(11) not null auto_increment,
`name` varchar(100) not null default '',
`icon` varchar(1024) default '',
`created` datetime not null,
`userid` int(11) not null,
`bio` mediumtext default null,
primary key(`id`)
) engine=myisam default charset=utf8;
create table if not exists `documents` (
`id` int(11) not null auto_increment,
`title` varchar(100) not null default '',
`content` mediumtext default '',
`created` datetime not null,
`userid` int(11) not null,
`authorid` int(11) not null,
`parentid` int(11) default null,
primary key(`id`)
) engine=myisam default charset=utf8;
create table if not exists `comments` (
`id` int(11) not null auto_increment,
`document_id` int(11) not null,
`content` mediumtext default '',
`created` datetime not null,
`userid` int(11) not null,
primary key(`id`)
) engine=myisam default charset=utf8;
create table if not exists `vocabularies` (
`id` int(11) not null auto_increment,
`document_id` int(11) not null,
`content` mediumtext not null default '',
`created` datetime not null,
`userid` int(11) not null,
primary key(`id`)
) engine=myisam default charset=utf8;
create table if not exists `sidebars` (
`id` int(11) not null auto_increment,
`document_id` int(11) not null,
`content` mediumtext not null default '',
`created` datetime not null,
`userid` int(11) not null,
primary key(`id`)
) engine=myisam default charset=utf8;
# Type should be one of "like", "dislike", "click", "media", or "follow".
# like, dislike, and media use comment_id
# click uses word_id
# follow uses url
create table if not exists `events` (
`id` int(11) not null auto_increment,
`type` varchar(50) not null,
`created` datetime not null,
`userid` int(11) not null,
`document_id` int(11) not null,
`comment_id` int(11),
`word_id` varchar(50),
`url` mediumtext,
primary key(`id`)
) engine=myisam default charset=utf8;
# Add support for hierarchical documents.
#alter table documents add column (`parentid` int(11) default null);
#alter table documents change column `content` `content` mediumtext default '';
# Add the root "Document" with id=1.
insert into documents (id, title, created, userid, authorid, parentid) values (1, "Document", now(), -1, -1, NULL);
# Add a user group for professors and normal users.
insert into groups (title) values ('professor');
insert into groups (title) values ('user');
# Add support for author biographical information.
#alter table authors add column (`bio` mediumtext default null);
# Add support for professors.
#alter table users add column (`professorid` int(11) default null);
# Add support for each comment to occupy a row in the the comments table.
#alter table comments add column (`ref` mediumtext not null);
#alter table comments add column (`type` mediumtext default null);
#alter table comments add column (`title` mediumtext default null);
#alter table comments change column `content` `content` mediumtext default '';
#alter table comments add column (`src` mediumtext default null);
# Add support for logging clicks on media and sidebar links.
#alter table events add column (`url` mediumtext default null);
| true |
2ae45b1de14074dce8e58062e7987ac9736696fa
|
SQL
|
phillipjohnson/java-for-the-real-world-code
|
/logging/logback/src/main/resources/data-h2.sql
|
UTF-8
| 1,200 | 3.234375 | 3 |
[] |
no_license
|
insert into ingredient_type(ingredient_type)
select possible.ingredient_type from
(select 'ICE_CREAM' ingredient_type union select 'TOPPING') possible
where possible.ingredient_type not in (select ingredient_type from ingredient_type)
;
insert into ingredient(ingredient, ingredient_type, unit_price)
select possible.ingredient, possible.ingredient_type, possible.unit_price from
(
select 'Vanilla' as ingredient, 'ICE_CREAM' as ingredient_type, 1.5 as unit_price
union select 'Chocolate' as ingredient, 'ICE_CREAM' as ingredient_type, 1.5 as unit_price
union select 'Strawberry' as ingredient, 'ICE_CREAM' as ingredient_type, 1.5 as unit_price
union select 'Caramel' as ingredient, 'TOPPING' as ingredient_type, 0.75 as unit_price
union select 'Cherry' as ingredient, 'TOPPING' as ingredient_type, 0.25 as unit_price
union select 'Chocolate' as ingredient, 'TOPPING' as ingredient_type, 0.50 as unit_price
union select 'Peanuts' as ingredient, 'TOPPING' as ingredient_type, 0.25 as unit_price
union select 'Sprinkles' as ingredient, 'TOPPING' as ingredient_type, 0.25 as unit_price
) possible
where possible.ingredient not in (select ingredient from ingredient)
;
| true |
cbb6663bd775ab6745ec65a52d79d98550e7f617
|
SQL
|
reaniwen/DataBase
|
/original data.sql
|
UTF-8
| 8,753 | 2.78125 | 3 |
[] |
no_license
|
-- User
insert into user values('10001','aaa','123456','Peter','Allen','P.Allen@gmail.com','New York','6461234567',null,null);
insert into user values('10002','tomlee','654321','Tom','Lee','tomlee@yahoo.com','New York','7181234567',null,null);
insert into user values('10003','lovemusic','lovemusic','Alice','Julia','lovemusic@gmail.com','Brooklyn','7185455678',null,null);
insert into user values('10004','user','1234567','Aaron','Joe','joe123@aol.com','Queens','718378265',null,null);
insert into user values('10005','alex123','7654321','Alexander','Thomas','alextom@nyu.edu','New York','7185639825',null,null);
insert into user values('10006','westcoast','wcoast','Allen','James','westcoast@gmail.com','Los Angeles','3267548264',null,null);
insert into user values('10007','catcat','catcat','Catty','Petty','cptty@gmail.com','Los Angeles','3267149478',null,null);
insert into user values('10008','dogdog','doggy123','Dom','Kevin','domkevin@gmail.com','Boston','6738261749',null,null);
insert into user values('10009','newuser','newpass','newFirst','newLast','new@company.com','Brooklyn','7191234576','2014-11-24 15:42:10',null);
-- Arts
insert into art values('90001','linkinpark','12345678','Linkin Park','admin@linkinpark.com','www.linkinpark.com');
insert into art values('90002','jblunt','12345678','James Blunt','jblant@gmail.com','www.jamesblunt.com');
insert into art values('90003','lenka','12345678','Lenka','lenka@sina.com','www.lenkamusic.com');
insert into art values('90004','eminem123','12345678','Eminem','eminem@eminem.com','www.eminem.com');
insert into art values('90005','2hrose','12345678','Second Hand Roses','ershoumeigui@sina.com','http://site.douban.com/ershoumeigui/');
insert into art values('90006','sum14','12345678','Sum41','sum41@myspace.com','www.sum41.com');
insert into art values('90007','oasis1990','12345678','Oasis','oasis1990@gmail.com','www.oasis.com');
insert into art values('90008','backdoor','12345678','Back Door','backdoor@gmail.com','www.facebbok.com/backdoor');
insert into art values('90009','M5','12345678','Maroon5','maroon5@gmail.com','www.maroon');
-- Location
insert into location values('9001','Barkley Center',620,'Atlantic Avenue',NULL,'Brooklyn','NY','11217');
insert into location values('9002','The Way Station',683,'Washington Ave',NULL,'Brooklyn','NY','11238');
insert into location values('9003','Barbès',376,'9th St',NULL,'Brooklyn','NY','11215');
insert into location values('9004','Fat Cat',75,'Christopher St',NULL,'New York','NY','10014');
insert into location values('9005','Bar Nine',807,'9th Ave',NULL,'New York','NY','10019');
insert into location values('9006','Paddy Reillys',519,'2nd Ave',NULL,'New York','NY','10016');
insert into location values('9007','Terraza 7',4019,'Gleane St',NULL,'Queens','NY','11373');
insert into location values('9008','Blue Whale Bar',123,'Astronaut E S Onizuka St',NULL,'Los Angeles','CA','90012');
-- Concert
insert into concert values(100001,'SumSum','2013-10-01 21:00:00',99,9002,300,null);
insert into concert values(100002,'new seccond hand', '2013-11-11 18:00:00', 20, 9007, 150, null);
insert into concert values(100003,'piece green', '2013-12-12 14:00:00', 65, 9006, 500, null);
insert into concert values(100004,'live in newyork', '2013-12-19 15:00:00', 120, 9001, 15000, null);
insert into concert values(100005,'newyear 90003', '2013-12-31 21:00:00', 80, 9004, 200, null);
insert into concert values(100006,'brait music', '2014-03-21 19:15:00', 40, 9005, 150, null);
insert into concert values(100007,'music aint junk', '2014-05-01 23:00:00', 25, 9007, 160, null);
insert into concert values(100008,'open the door', '2014-07-11 20:30:00', 15, 9006, 200, null);
insert into concert values(100009,'not alone', '2014-11-11 11:11:11', 11, 9002, 200, null);
insert into concert values(100010,'newyear 90003 2014', '2014-12-31 18:00:00', 60, 9001, 5000, null);
insert into concert values(100011,'so what', '2015-01-30 21:00:00', 40, 9004, 250, null);
insert into concert values(100012,'old metal back', '2015-03-30 15:00:00', 120, 9001, 12000, null);
insert into concert values(100013,'love braint music?', '2015-04-15 18:00:00', 90, 9005, 300, null);
insert into concert values(100014,'just one last dance', '2015-08-31 17:45:00', 88, 9008, 500, null);
-- Hold
insert into Hold values('90006',100001);
insert into Hold values('90005',100002);
insert into Hold values('90007',100003);
insert into Hold values('90001',100004);
insert into Hold values('90005',100004);
insert into Hold values('90003',100005);
insert into Hold values('90002',100006);
insert into Hold values('90004',100007);
insert into Hold values('90008',100008);
insert into Hold values('90005',100009);
insert into Hold values('90003',100010);
insert into Hold values('90004',100011);
insert into Hold values('90006',100011);
insert into Hold values('90001',100012);
insert into Hold values('90006',100012);
insert into Hold values('90005',100012);
insert into Hold values('90002',100013);
insert into Hold values('90007',100013);
insert into Hold values('90003',100014);
-- Genre gid ggenre
insert into Genre values(1,'pop');
insert into Genre values(2,'rock');
insert into Genre values(3,'rap');
insert into Genre values(4,'funk');
insert into Genre values(5,'punk');
-- Likes
insert into Likes values(10001,1);
insert into Likes values(10001,5);
insert into Likes values(10005,2);
insert into Likes values(10005,5);
insert into Likes values(10007,1);
insert into Likes values(10007,3);
insert into Likes values(10007,4);
insert into Likes values(10008,1);
insert into Likes values(10003,5);
insert into Likes values(10002,2);
insert into Likes values(10002,3);
insert into Likes values(10004,1);
insert into Likes values(10004,5);
insert into Likes values(10006,1);
insert into Likes values(10006,3);
-- Have
insert into Have values('90005',2);
insert into Have values('90008',2);
insert into Have values('90008',3);
insert into Have values('90004',1);
insert into Have values('90004',3);
insert into Have values('90002',1);
insert into Have values('90003',1);
insert into Have values('90001',2);
insert into Have values('90001',1);
insert into Have values('90007',1);
insert into Have values('90007',2);
insert into Have values('90006',2);
insert into Have values('90006',5);
-- Follow
insert into Follow values(10001,10005,'2014-01-01 15:37:29');
insert into Follow values(10001,10007,'2014-01-01 15:38:29');
insert into Follow values(10001,10008,'2014-01-01 15:39:29');
insert into Follow values(10001,10003,'2014-10-01 15:39:29');
insert into Follow values(10001,10002,'2014-10-02 15:39:29');
insert into Follow values(10001,10004,'2014-11-02 15:39:29');
insert into Follow values(10001,10006,'2014-11-08 15:39:29');
-- Fans
insert into Fans values(10001,'90005','2014-01-01 15:37:29');
insert into Fans values(10001,'90008','2014-01-01 15:38:29');
insert into Fans values(10001,'90004','2014-01-01 15:39:29');
insert into Fans values(10001,'90002','2014-10-01 15:39:29');
insert into Fans values(10001,'90003','2014-10-02 15:39:29');
insert into Fans values(10001,'90001','2014-11-02 15:39:29');
insert into Fans values(10001,'90007','2014-11-08 15:39:29');
insert into Fans values(10001,'90006','2014-11-08 15:39:29');
-- Lists
insert into Lists values(6001,10005,NULL);
insert into Lists values(6002, 10008,NULL);
-- Content
insert into Content values(6001, 100001);
insert into Content values(6001, 100011);
insert into Content values(6001, 100004);
insert into Content values(6001, 100005);
insert into Content values(6002, 100002);
insert into Content values(6002, 100008);
insert into Content values(6002, 100007);
insert into Content values(6002, 100013);
insert into Content values(6002, 100004);
insert into Content values(6002, 100009);
-- FollowList
insert into FollowList values(6001,10005,'2014-10-01 18:54:39');
insert into FollowList values(6001,10007,'2014-05-09 09:09:55');
insert into FollowList values(6001,10008,'2014-05-31 10:18:44');
insert into FollowList values(6002,10003,'2014-06-06 18:54:33');
insert into FollowList values(6002,10002,'2014-08-09 14:46:12');
insert into FollowList values(6002,10004,'2014-07-21 19:07:00');
insert into FollowList values(6002,10006,'2014-09-18 21:21:55');
-- Attend
insert into Attend values(10001, 100001, 5, null, null);
insert into Attend values(10005, 100001, null, null, null);
insert into Attend values(10007,100010, 4, 'perfect', '2014-04-04 19:31:31');
insert into Attend values(10008,100008, 4, 'This is the best perform I have ever attend', '2014-05-05 18:41:55');
insert into Attend values(10003,100007,null,null,NULL);
insert into Attend values(10002,100004, null, 'not bad', '2014-06-14 18:53:21');
insert into Attend values(10004, 100010,5, 'guess what! I met my old friend there!amazing!', '2014-01-06 09:22:42');
insert into Attend values(10006,100001, null, null, null);
insert into Attend values(10006, 100007, 5, 'contact me to have fun', '2014-05-05 21:21:34');
| true |
48c657fceb8726828d741ff3ef7d69d8cf0d7a40
|
SQL
|
NZOGPS/nzopengps
|
/scripts/Loopy/Loopy1.sql
|
UTF-8
| 1,184 | 3.546875 | 4 |
[] |
no_license
|
drop table if exists :nodedtable;
CREATE TABLE :nodedtable
(
idx serial PRIMARY KEY,
roadid integer,
label character varying(100),
type character varying(10),
path integer,
geom geometry,
startpt geometry(Point),
endpt geometry(Point),
loop character varying(40)
);
insert into :nodedtable(geom,path,roadid,label,type) select (ST_dump(ST_node(the_geom))).geom, (ST_dump(ST_node(the_geom))).path[1],roadid,label,type from :linestable where not ST_IsSimple(the_geom);
update :nodedtable set startpt = st_pointn(geom,1), endpt = st_pointn(geom,st_npoints(geom));
update :nodedtable set loop = st_y(startpt) || ' ' || st_x(startpt) where startpt = endpt;
-- select count(endp),roadid,st_y(endp) || ' ' || st_x(endp) from ( select roadid, startpt as endp from wellington_noded_loops union all select roadid, endpt as endp from wellington_noded_loops ) as ends group by endp,roadid having count(endp)>2
copy(
select st_x(endp),st_y(endp),label,'Loopy: '
from ( select roadid, label, startpt as endp from :nodedtable union all select roadid, label, endpt as endp from :nodedtable )
as ends group by endp,label, roadid having count(endp)>2 )
to :outfile with CSV;
| true |
b9d3a8afd4c31ed03e8d7e9e74b307c41550a88b
|
SQL
|
Mbackedi/Projet1POO
|
/Projet2.sql
|
UTF-8
| 8,381 | 3.1875 | 3 |
[
"MIT"
] |
permissive
|
-- phpMyAdmin SQL Dump
-- version 4.6.6deb5
-- https://www.phpmyadmin.net/
--
-- Client : localhost:3306
-- Généré le : Lun 01 Juillet 2019 à 09:12
-- Version du serveur : 5.7.26-0ubuntu0.18.04.1
-- Version de PHP : 7.2.19-0ubuntu0.18.04.1
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Base de données : `Projet2`
--
-- --------------------------------------------------------
--
-- Structure de la table `batiment`
--
CREATE TABLE `batiment` (
`id_bati` int(11) NOT NULL,
`nom_bati` varchar(20) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Contenu de la table `batiment`
--
INSERT INTO `batiment` (`id_bati`, `nom_bati`) VALUES
(1, 'PAVION-A'),
(2, 'PAVION-G'),
(3, 'PAVION-M'),
(4, 'PAVION-K'),
(7, 'BATIMENT-E'),
(8, 'BATIMENT-D');
-- --------------------------------------------------------
--
-- Structure de la table `chambre`
--
CREATE TABLE `chambre` (
`id_chambre` int(11) NOT NULL,
`id_bati` int(11) NOT NULL,
`nom_chambre` varchar(30) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Contenu de la table `chambre`
--
INSERT INTO `chambre` (`id_chambre`, `id_bati`, `nom_chambre`) VALUES
(1, 2, '189A'),
(2, 2, '56B'),
(3, 1, '39S'),
(4, 3, '51N'),
(6, 2, 'CH10'),
(7, 2, 'CH9');
-- --------------------------------------------------------
--
-- Structure de la table `etudiants`
--
CREATE TABLE `etudiants` (
`id_etudiant` int(11) NOT NULL,
`matricule` varchar(30) NOT NULL,
`Nom` varchar(20) NOT NULL,
`prenom` varchar(30) NOT NULL,
`tel` int(11) NOT NULL,
`email` text NOT NULL,
`date_naiss` date NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Contenu de la table `etudiants`
--
INSERT INTO `etudiants` (`id_etudiant`, `matricule`, `Nom`, `prenom`, `tel`, `email`, `date_naiss`) VALUES
(1, 'KZF04', 'DIOP', 'Fatou', 772026057, 'diopsecurite@gmail.com', '1993-06-10'),
(3, 'T10ZM', 'NDIAYE', 'Abdou', 773962587, 'ndiayeabdou@gmail.com', '1992-07-05'),
(6, 'WG55Z', 'DIALLO', 'AMY', 775216935, 'minadiallo@gmail.com', '1990-08-11'),
(7, 'AM89P', 'NDIAYE', 'AWA', 773458827, 'ndiayeawa@gmail.com', '1995-12-21'),
(17, 'B557', 'GAYE', 'DMG', 789643798, 'dmg8@gmail.com', '1997-10-23'),
(19, 'BGF77', 'BA', 'RAMA', 774517899, 'barama96@gmail.com', '1996-05-18'),
(32, 'AZ741', 'NDIAYE', 'SEYNABOU', 776335254, 'nabousye@gmail.com', '1992-07-17'),
(35, 'DG520', 'DIOP', 'MBACKE', 777777777, 'diopsecurite@gmail.com', '2019-06-06'),
(37, 'ERG969', 'MENDY', 'JEANS', 8765353, 'hhioik@hjj.com', '2019-06-20'),
(43, 'JKJJH74', 'KANE', 'MARIAMA', 774140213, 'karmarie@gmail.com', '2019-06-01'),
(49, 'g544651', 'diop', 'diana', 78872331, 'hdgagdhaj@com', '2019-07-01'),
(58, 'RT6852', 'GUEYE', 'GANA', 773652588, 'gana@gmail.com', '2019-07-04'),
(59, 'RTY7756', 'COULBALY', 'KALIDOU', 773695241, 'koulibaly@gmail.com', '2019-06-12'),
(67, 'QS014477', 'GUEYE', 'SADIKH', 770362552, 'sadikhu@gmail.com', '2019-06-05'),
(68, 'MOP25', 'SOW', 'MBAYE', 771004411, 'sow@gmail.com', '2019-05-27'),
(69, 'QSM256', 'NDIAYE', 'BABACAR', 783612010, 'babacar@gmail.com', '1997-08-14'),
(70, 'QMP54', 'GNING', 'NDEYE', 776985442, 'gninhg@gmail.com', '1999-02-11'),
(74, 'DEV041', 'SENE', 'DEMBA', 775054125, 'demba@gmail.com', '1992-08-10'),
(75, '0ZA88', 'MBAYE', 'FALLOU', 772051231, 'loufambaye@gmail.com', '1998-11-08'),
(76, '55TYHL', 'NIANG', 'OMAR', 774161824, 'niangomzo@gmail.com', '1996-02-14'),
(78, '788OPM', 'SOKHNA', 'MBAYE', 772312420, 'sokhu@gmail.com', '1994-11-21');
-- --------------------------------------------------------
--
-- Structure de la table `Et_boursier`
--
CREATE TABLE `Et_boursier` (
`id_pension` int(11) NOT NULL,
`id_etudiant` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Contenu de la table `Et_boursier`
--
INSERT INTO `Et_boursier` (`id_pension`, `id_etudiant`) VALUES
(1, 32),
(1, 49),
(1, 59),
(1, 68),
(1, 78),
(2, 3),
(2, 43),
(2, 58),
(2, 67),
(2, 69),
(2, 75),
(8, 74);
-- --------------------------------------------------------
--
-- Structure de la table `Et_loge`
--
CREATE TABLE `Et_loge` (
`id_etudiant` int(11) NOT NULL,
`id_chambre` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Contenu de la table `Et_loge`
--
INSERT INTO `Et_loge` (`id_etudiant`, `id_chambre`) VALUES
(1, 1),
(58, 1),
(74, 1),
(78, 1),
(32, 2),
(69, 2),
(67, 3),
(59, 4),
(68, 4),
(75, 6);
-- --------------------------------------------------------
--
-- Structure de la table `Non_loge`
--
CREATE TABLE `Non_loge` (
`id_etudiant` int(11) NOT NULL,
`addresse` varchar(30) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Contenu de la table `Non_loge`
--
INSERT INTO `Non_loge` (`id_etudiant`, `addresse`) VALUES
(1, 'Grand yoff'),
(17, 'toubatoul'),
(19, 'Dakar'),
(35, 'thiaytou'),
(37, 'dakar'),
(70, 'THIAYTOU'),
(76, 'TOUBA');
-- --------------------------------------------------------
--
-- Structure de la table `Pension`
--
CREATE TABLE `Pension` (
`id_pension` int(11) NOT NULL,
`type` int(20) NOT NULL,
`libelle` varchar(30) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Contenu de la table `Pension`
--
INSERT INTO `Pension` (`id_pension`, `type`, `libelle`) VALUES
(1, 20000, 'DEMIE'),
(2, 40000, 'ENTIERE'),
(3, 40000, 'ENTIERE'),
(7, 40000, 'ENTIERE'),
(8, 20000, 'DEMIE');
--
-- Index pour les tables exportées
--
--
-- Index pour la table `batiment`
--
ALTER TABLE `batiment`
ADD PRIMARY KEY (`id_bati`);
--
-- Index pour la table `chambre`
--
ALTER TABLE `chambre`
ADD PRIMARY KEY (`id_chambre`),
ADD KEY `id_bati` (`id_bati`);
--
-- Index pour la table `etudiants`
--
ALTER TABLE `etudiants`
ADD PRIMARY KEY (`id_etudiant`),
ADD UNIQUE KEY `matricule` (`matricule`),
ADD UNIQUE KEY `tel` (`tel`),
ADD UNIQUE KEY `matricule_2` (`matricule`);
--
-- Index pour la table `Et_boursier`
--
ALTER TABLE `Et_boursier`
ADD PRIMARY KEY (`id_etudiant`),
ADD KEY `id_pension` (`id_pension`),
ADD KEY `matricule` (`id_etudiant`),
ADD KEY `id_pension_2` (`id_pension`);
--
-- Index pour la table `Et_loge`
--
ALTER TABLE `Et_loge`
ADD PRIMARY KEY (`id_etudiant`),
ADD KEY `matricule` (`id_etudiant`),
ADD KEY `id_chambre` (`id_chambre`),
ADD KEY `id_chambre_2` (`id_chambre`),
ADD KEY `id_chambre_3` (`id_chambre`);
--
-- Index pour la table `Non_loge`
--
ALTER TABLE `Non_loge`
ADD PRIMARY KEY (`id_etudiant`),
ADD KEY `id_etudiant` (`id_etudiant`);
--
-- Index pour la table `Pension`
--
ALTER TABLE `Pension`
ADD PRIMARY KEY (`id_pension`);
--
-- AUTO_INCREMENT pour les tables exportées
--
--
-- AUTO_INCREMENT pour la table `batiment`
--
ALTER TABLE `batiment`
MODIFY `id_bati` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=9;
--
-- AUTO_INCREMENT pour la table `chambre`
--
ALTER TABLE `chambre`
MODIFY `id_chambre` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8;
--
-- AUTO_INCREMENT pour la table `etudiants`
--
ALTER TABLE `etudiants`
MODIFY `id_etudiant` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=79;
--
-- AUTO_INCREMENT pour la table `Pension`
--
ALTER TABLE `Pension`
MODIFY `id_pension` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=9;
--
-- Contraintes pour les tables exportées
--
--
-- Contraintes pour la table `chambre`
--
ALTER TABLE `chambre`
ADD CONSTRAINT `chambre_ibfk_1` FOREIGN KEY (`id_bati`) REFERENCES `batiment` (`id_bati`);
--
-- Contraintes pour la table `Et_boursier`
--
ALTER TABLE `Et_boursier`
ADD CONSTRAINT `Et_boursier_ibfk_1` FOREIGN KEY (`id_pension`) REFERENCES `Pension` (`id_pension`),
ADD CONSTRAINT `Et_boursier_ibfk_2` FOREIGN KEY (`id_etudiant`) REFERENCES `etudiants` (`id_etudiant`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Contraintes pour la table `Et_loge`
--
ALTER TABLE `Et_loge`
ADD CONSTRAINT `Et_loge_ibfk_2` FOREIGN KEY (`id_chambre`) REFERENCES `chambre` (`id_chambre`),
ADD CONSTRAINT `Et_loge_ibfk_3` FOREIGN KEY (`id_etudiant`) REFERENCES `etudiants` (`id_etudiant`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Contraintes pour la table `Non_loge`
--
ALTER TABLE `Non_loge`
ADD CONSTRAINT `Non_loge_ibfk_1` FOREIGN KEY (`id_etudiant`) REFERENCES `etudiants` (`id_etudiant`) 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 |
f1bded1e2dc1cf21a2aba645227a197c1c56858a
|
SQL
|
OsetianBoy/PelivsPeli-EB
|
/scripts/script-paso-0-db-tablas.sql
|
UTF-8
| 783 | 3.21875 | 3 |
[] |
no_license
|
USE competencias;
DROP TABLE IF EXISTS competencia;
CREATE TABLE competencia (
id int(11) NOT NULL AUTO_INCREMENT,
nombre varchar(100) NOT NULL ,
actor_id int(11) unsigned ,
director_id int(11) unsigned,
genero_id int(11) unsigned,
PRIMARY KEY (id),
FOREIGN KEY (actor_id) REFERENCES actor(id),
FOREIGN KEY (director_id) REFERENCES director(id),
FOREIGN KEY (genero_id) REFERENCES genero(id)
);
LOCK TABLES competencia WRITE;
INSERT INTO competencia VALUES (1,'Mejor Director',4,3295,1);
UNLOCK TABLES;
CREATE TABLE voto (
id int(11) NOT NULL AUTO_INCREMENT,
competencia_id int(11) ,
pelicula_id int(11) unsigned ,
PRIMARY KEY (id),
FOREIGN KEY (competencia_id) REFERENCES competencia(id),
FOREIGN KEY (pelicula_id) REFERENCES pelicula(id)
);
| true |
3bff1cbf85c33d487c071b22454b4e29d234619a
|
SQL
|
alsyr/Dimensional_Modeling_and_OLAP
|
/Queries/Question-08.sql
|
UTF-8
| 458 | 3.875 | 4 |
[] |
no_license
|
SELECT
Time.week_number_overall AS Week_Number,
Store.sales_district AS District,
Product.brand AS Brand,
SUM(Sales_fact.dollar_sales) AS Sales_Dollars
FROM
Store,
Product,
Sales_fact,
Time
WHERE
Sales_fact.store_key = Store.store_key AND
Sales_fact.product_key = Product.product_key AND
Sales_fact.time_key = Time.time_key
GROUP BY
Store.sales_district,
Product.brand,
Time.week_number_overall;
| true |
92db3ca363da044d29b4eaf56dd719d7a78dcdcf
|
SQL
|
YuriyNik72/Lesson11-Spring-Security
|
/src/main/resources/db/migration/V6__great_table_orders.sql
|
UTF-8
| 612 | 3.453125 | 3 |
[] |
no_license
|
DROP TABLE IF EXISTS orders;
CREATE TABLE orders (
id INT(11) NOT NULL AUTO_INCREMENT,
user_id INT(11) NOT NULL,
status_id INT(11) NOT NULL,
create_at DATETIME NOT NULL,
PRIMARY KEY (id),
CONSTRAINT FK_USER_ID FOREIGN KEY (user_id)
REFERENCES users (id),
CONSTRAINT FK_STATUS_ID FOREIGN KEY (status_id)
REFERENCES orders_statuses (id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
| true |
675b4ad6bc054f106b9eb4d65c78d6dca6b2f64a
|
SQL
|
batuhangoktass/Fobizm
|
/fobizm.sql
|
UTF-8
| 7,169 | 3.359375 | 3 |
[] |
no_license
|
-- phpMyAdmin SQL Dump
-- version 4.9.2
-- https://www.phpmyadmin.net/
--
-- Anamakine: 127.0.0.1:3308
-- Üretim Zamanı: 24 Ara 2019, 10:55:58
-- Sunucu sürümü: 8.0.18
-- PHP Sürümü: 7.4.0
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 */;
--
-- Veritabanı: `fobizm`
--
-- --------------------------------------------------------
--
-- Tablo için tablo yapısı `comment`
--
DROP TABLE IF EXISTS `comment`;
CREATE TABLE IF NOT EXISTS `comment` (
`comment_id` int(11) NOT NULL AUTO_INCREMENT,
`user_id` int(11) NOT NULL,
`mental_issue_id` int(11) NOT NULL,
`comment_text` longtext NOT NULL,
PRIMARY KEY (`comment_id`)
) ENGINE=MyISAM AUTO_INCREMENT=11 DEFAULT CHARSET=utf8;
--
-- Tablo döküm verisi `comment`
--
INSERT INTO `comment` (`comment_id`, `user_id`, `mental_issue_id`, `comment_text`) VALUES
(6, 10, 2, 'Bilişsel - Davranışçı terapi bu tarz fobileri tedavi etmek için en sık kullanılan terapidir. Maruz bırakma teknikleri gibi prosedürler, araştırma ve klinik uygulamalarda uzun ve başarılı bir geleneğe sahiptir. Bu yöntemler, yavaş yavaş akrofobikleri korkularının nesnesine yaklaştırır. Kademeli olarak daha güvenli hale gelirler ve kaygı reaksiyonlarını azaltırlar. Bu terapi sayesinde olumsuz düşüncelerinizi ve kaygılarınızı durdurabilir , korkularınızı yenebilirsiniz. Jeffret E. Young isimli yazarın Hayatı Yeniden Keşfedin isimli kitabını okuyabilirsiniz. Bilişsel-Davranışçı terapiyi uygulayabilmeniz için güzel bir yol.'),
(7, 10, 4, 'Ablanız eniştenizin ölümünü kontrol edemediğinden dolayı her elini yıkayışında her şeyi kontrol altına alıyor olabilir. Bu şekilde ellerine zarar vermektense el işi sanatlarıyla uğraşıp yeni hobiler edinip bu sorunu atlatabilir'),
(10, 11, 5, 'Babanın kıymetini bilmelisin. Onun dışında herkesten ilgi beklemek yerine senin de onlarla ilgilenmen gerekebilir belli bir süre. Ne kadar konuşursan ilgilenirsen geri dönüşü de o şekilde olacaktır. Sevgiler ');
-- --------------------------------------------------------
--
-- Tablo için tablo yapısı `mental_issue`
--
DROP TABLE IF EXISTS `mental_issue`;
CREATE TABLE IF NOT EXISTS `mental_issue` (
`mental_issue_id` int(11) NOT NULL AUTO_INCREMENT,
`issue_name` text NOT NULL,
`issue_type_id` text NOT NULL,
`thumb_img_url` text NOT NULL,
`description` longtext NOT NULL,
PRIMARY KEY (`mental_issue_id`)
) ENGINE=MyISAM AUTO_INCREMENT=6 DEFAULT CHARSET=utf8;
--
-- Tablo döküm verisi `mental_issue`
--
INSERT INTO `mental_issue` (`mental_issue_id`, `issue_name`, `issue_type_id`, `thumb_img_url`, `description`) VALUES
(1, 'Karanlık Fobisi\r\n( Nyctophdoia ) ', '1', 'img/Fobiler/Karanl%C4%B1k.jpg', 'Kendimi bildim bileli karanlıktan korkuyorum. Sinemada kendimi oldukça huzursuz ve tehlikede hissediyorum. Gece uyurken de gece lambası yerine odamın kendi ışığını tercih ediyorum , bu da uyumamı zorlaştırıp her günümü mahvediyor. Ne arkadaşlarımla sinemaya gidebiliyorum ne de rahat uyuyabiliyorum.'),
(2, 'Yükseklik Fobisi\r\n( Acrophdoia )', '1', 'img/Fobiler/y%C3%BCkseklik.jpg', '3.Katın balkonundan bile aşağıya bakamıyorum. Erzurum\'da ailemle beraber yaşıyorum. 2 haftada 1 İstanbul\'a gitmem gerekiyor. Ve her defasında otobüs yolculuğunu seçmek zorunda kalıyorum. Bu da 2 saatte gidebileceğim yolu yaklaşık 17 saate çıkartıyor. Yollarda geçen bunca zamanım beni oldukça rahatsız etmeye başladı. Ne yapabilirim bu korkuyu yenebilmek için ?'),
(3, 'Yoldan Karşıya Geçme Fobisi\r\n( Agirafobi ) ', '1', 'img/Fobiler/yol.jpg', ' Yoldan karşıya geçen insanları izlerken içime sürekli kötü hisler doğuyor. Daha önceden arkadaşlarım yardımıyla yoldan karşıya geçmeye çalıştığımda ne yapacağımı şaşırıp direkt olarak bağırarak geri dönmeyi tercih ettim. Kısa mesafe dahi olsa komşumuz olan bir taksiciyi çağırmam gerekiyor. Her ne kadar indirim yapsa da öğrenci olduğumdan dolayı maddi sorun yaşayabiliyorum. Yaya olarak da gezebilmek ve istediğim yere gidebilmek istiyorum.'),
(4, 'Travmatik Yas', '2', 'img/Travmalar/travma1.png', ' Ablam kocası vefat ettiğinden beri sürekli olarak ellerini yıkayıp duruyor. Elleri yıkanmaktan tahriş olmuş durumda ve psikoloğa ya da psikiyatriye gitmeyi reddediyor. Eşi vefat edesiye kadar böyle bir sorunu yoktu ne yapacağımı bilmiyorum. Eşinin vefatının kendisinde bir travma yarattığını düşünüyorum.'),
(5, 'İlgi Bağımlılığı', '2', 'img/Travmalar/travma2.jpg', ' Babam küçük yaşımdan beri benimle aşırı ilgileniyor. Babamı her şeyden ve herkesten çok seviyorum. Birçok erkek arkadaşım oldu ancak hiçbirinde aradığım ilgiyi göremedim. Bu yüzden hiçbir ilişkimde mutlu olamıyorum. Benimle kimse babam kadar ilgilenmedi ve ilgilenemez de. Her ne kadar babamın bana olan ilgisi hoşuma gidiyor olsa da tüm ilişkilerimde karşı taraftan aşırı ilgi beklememe neden oluyor. Bana babamın gösterdiği bu ilginin travmatik bir etkisi olduğunu düşünüyorum. Ne yapmalıyım sizce ?');
-- --------------------------------------------------------
--
-- Tablo için tablo yapısı `mental_issue_type`
--
DROP TABLE IF EXISTS `mental_issue_type`;
CREATE TABLE IF NOT EXISTS `mental_issue_type` (
`mental_issue_type_id` int(11) NOT NULL AUTO_INCREMENT,
`mental_issue_type_title` text NOT NULL,
PRIMARY KEY (`mental_issue_type_id`)
) ENGINE=MyISAM AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;
--
-- Tablo döküm verisi `mental_issue_type`
--
INSERT INTO `mental_issue_type` (`mental_issue_type_id`, `mental_issue_type_title`) VALUES
(1, 'Fobi'),
(2, 'Travma');
-- --------------------------------------------------------
--
-- Tablo için tablo yapısı `users`
--
DROP TABLE IF EXISTS `users`;
CREATE TABLE IF NOT EXISTS `users` (
`user_id` int(11) NOT NULL AUTO_INCREMENT,
`username` text NOT NULL,
`password` text NOT NULL,
`mail` text NOT NULL,
PRIMARY KEY (`user_id`)
) ENGINE=MyISAM AUTO_INCREMENT=12 DEFAULT CHARSET=utf8;
--
-- Tablo döküm verisi `users`
--
INSERT INTO `users` (`user_id`, `username`, `password`, `mail`) VALUES
(5, 'mabel', '6c14da109e294d1e8155be8aa4b1ce8e', 'gasdas@gmail.com'),
(6, 'ibrahimtatlisex', '81dc9bdb52d04dc20036dbd8313ed055', 'asdasdas@gmail.com'),
(7, 'kokko', '81dc9bdb52d04dc20036dbd8313ed055', 'sds@gmail.com'),
(8, 'dipper', '81dc9bdb52d04dc20036dbd8313ed055', 'xcx@gmail.com'),
(9, 'kahveland', 'bcfa8a783aaf938cdef361634d5f9289', 'esmsofficial@gmail.com'),
(10, 'osman_kaya', '202cb962ac59075b964b07152d234b70', 'sadasdassadsa@fdsdfsdfsdfdds.com'),
(11, 'Peter Griffin', '140f6969d5213fd0ece03148e62e461e', 'pizzaeater@sagopa.com');
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 |
0d7c6b74879c6fbd940f364d56ce74d28ab3dbde
|
SQL
|
CUBRID/cubrid-testcases
|
/sql/_01_object/_10_system_table/_013_db_trig/cases/1003.sql
|
UTF-8
| 466 | 3.234375 | 3 |
[
"BSD-3-Clause"
] |
permissive
|
--Create trigger and retrieve the target_attr_name from virtual class db_trig
create class test_class(col1 integer, col2 varchar(20));
insert into test_class values(999,'nhn');
create trigger test_trigger
before update on test_class(col1)
execute print 'update new record on col1';
select trigger_name,
target_class_name,
target_attr_name
from db_trig
where trigger_name = 'test_trigger';
drop trigger test_trigger;
drop class test_class;
| true |
14560c7dd7e6debbb988404103060952252fe896
|
SQL
|
matheusjustino/prisma-crud-k8s
|
/prisma/migrations/20210925212517_create_tables/migration.sql
|
UTF-8
| 1,895 | 4.25 | 4 |
[] |
no_license
|
-- CreateTable
CREATE TABLE "Product" (
"id" TEXT NOT NULL,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
"name" TEXT NOT NULL,
"description" TEXT,
"price" DECIMAL(65,30) NOT NULL,
"sku" TEXT NOT NULL,
"published" BOOLEAN NOT NULL DEFAULT false,
CONSTRAINT "Product_pkey" PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "Category" (
"id" TEXT NOT NULL,
"name" TEXT NOT NULL,
"description" TEXT,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
CONSTRAINT "Category_pkey" PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "CategoriesOnProducts" (
"productId" TEXT NOT NULL,
"categoryId" TEXT NOT NULL,
CONSTRAINT "CategoriesOnProducts_pkey" PRIMARY KEY ("productId","categoryId")
);
-- CreateTable
CREATE TABLE "_CategoryToProduct" (
"A" TEXT NOT NULL,
"B" TEXT NOT NULL
);
-- CreateIndex
CREATE UNIQUE INDEX "Product_sku_key" ON "Product"("sku");
-- CreateIndex
CREATE UNIQUE INDEX "_CategoryToProduct_AB_unique" ON "_CategoryToProduct"("A", "B");
-- CreateIndex
CREATE INDEX "_CategoryToProduct_B_index" ON "_CategoryToProduct"("B");
-- AddForeignKey
ALTER TABLE "CategoriesOnProducts" ADD CONSTRAINT "CategoriesOnProducts_productId_fkey" FOREIGN KEY ("productId") REFERENCES "Product"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "CategoriesOnProducts" ADD CONSTRAINT "CategoriesOnProducts_categoryId_fkey" FOREIGN KEY ("categoryId") REFERENCES "Category"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "_CategoryToProduct" ADD FOREIGN KEY ("A") REFERENCES "Category"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "_CategoryToProduct" ADD FOREIGN KEY ("B") REFERENCES "Product"("id") ON DELETE CASCADE ON UPDATE CASCADE;
| true |
a9639e8ad2356d85c8135de2a32318cc4c7c044e
|
SQL
|
iusoltsev/sqlplus
|
/bl_create_awr.sql
|
UTF-8
| 3,502 | 3.65625 | 4 |
[] |
no_license
|
-----------------------------------------------------------------------------------------
--
-- Purpose: Creates SQL Plan Baseline for a SQL statement with a plan_hash_value from AWR
-- Based on cr_baseline_awr.sql from Prasanth Kothuri
-- https://www.dropbox.com/sh/zp07y7qv0v06xg8/AABe8z82ZnFjAfoQyFDQxl9ja?dl=0
-- Usage: The script prompts for sql_id, plan_hash_value, fixed and enabled
--
-----------------------------------------------------------------------------------------
accept v_sql_id char prompt 'Enter sql_id: '
accept v_plan_hash_value number prompt 'Enter plan_hash_value: '
accept v_begin_snap number prompt 'Enter begin snap id: '
accept v_end_snap number prompt 'Enter end snap id: '
accept v_fixed char prompt 'Enter fixed (NO): ' default 'NO'
accept v_enabled char prompt 'Enter enabled (YES): ' default 'YES'
accept v_desc char prompt 'Enter SQL Baseline description : '
set serveroutput on
declare
rc integer;
baseline_ref_cur DBMS_SQLTUNE.SQLSET_CURSOR;
v_sql_handle varchar2(30);
v_plan_name varchar2(30);
begin
-- Step 1 : Create SQL Tuning SET
dbms_sqltune.create_sqlset(
sqlset_name => '&v_sql_id'||'_spm',
description => 'SQL Tuning Set to create SQL baseline for '||'&v_sql_id');
-- Step 2 : Select sql_id and plan_hash_value from AWR
open baseline_ref_cur for
select VALUE(p) from table(
DBMS_SQLTUNE.SELECT_WORKLOAD_REPOSITORY(
begin_snap => '&v_begin_snap',
end_snap => '&v_end_snap',
basic_filter => 'sql_id='||CHR(39)||'&v_sql_id'||CHR(39)||' and plan_hash_value=&v_plan_hash_value',
attribute_list => 'ALL')) p;
-- Step 3 : Load the AWR cursor into SQLSET
DBMS_SQLTUNE.LOAD_SQLSET(
sqlset_name=>'&v_sql_id'||'_spm',
populate_cursor=> baseline_ref_cur);
--+ Step 3+: Close cursor and check
close baseline_ref_cur;
select count(*)
into rc
from dba_sqlset_statements
where sqlset_name = '&v_sql_id' || '_spm'
and sql_id = '&v_sql_id'
and plan_hash_value = &v_plan_hash_value;
if rc = 0
then DBMS_SQLTUNE.drop_sqlset('fxgzfhx4fr9rv'||'_spm');
raise NO_DATA_FOUND;
end if;
-- Step 4 : Create baseline; that is loading plans from sqlset into SPM
rc := dbms_spm.load_plans_from_sqlset(
sqlset_name => '&v_sql_id'||'_spm',
basic_filter => 'sql_id='||CHR(39)||'&v_sql_id'||CHR(39)||' and plan_hash_value=&v_plan_hash_value',
fixed => '&v_fixed',
enabled => '&v_enabled');
--+ Step 5: Drop SQL Tuning SET
DBMS_SQLTUNE.drop_sqlset('&v_sql_id'||'_spm');
--+ Step 6: Get baseline names
select sql_handle, plan_name
into v_sql_handle, v_plan_name
from dba_sql_plan_baselines bl, dba_hist_sqltext sa
where DBMS_SQLTUNE.SQLTEXT_TO_SIGNATURE(bl.sql_text) = DBMS_SQLTUNE.SQLTEXT_TO_SIGNATURE(sa.sql_text)
and sa.sql_id = '&v_sql_id'
and origin = 'MANUAL-LOAD'
and created > sysdate - 15/24/60/60;
--+ Step 7: Modify baseline
rc := DBMS_SPM.alter_sql_plan_baseline(v_sql_handle, v_plan_name,'autopurge','no');
rc := DBMS_SPM.alter_sql_plan_baseline(v_sql_handle, v_plan_name,'description','&v_desc');
dbms_output.put_line('');
dbms_output.put_line('Baseline '||v_sql_handle||' '||v_plan_name||' was created from AWR');
dbms_output.put_line('for SQL_ID='||'&v_sql_id'||', SQL_PLAN_HASH='||'&v_plan_hash_value');
end;
/
undef v_sql_id
undef v_plan_hash_value
undef v_fixed
undef v_enabled
undef v_begin_snap
undef v_end_snap
undef v_desc
set serveroutput off
| true |
82309270f5438cf68cd6d30bd196c15b82ccd39c
|
SQL
|
yamanashi-ai-robot-dev/dorepipa
|
/dorepipa/src/main/resources/META-INF/jp/co/ysk/pepper/pac2017/dao/TMistakePointsDao/selectFirstWorsePoint.sql
|
UTF-8
| 532 | 3.890625 | 4 |
[] |
no_license
|
select
mu.measure,
mu.num_in_measure,
mu.key_id,
mp.mistake_cd
from
t_mistake_points mp
inner join m_music mu
on mp.music_id = mu.music_id
and mp.note_id = mu.note_id
where
mp.play_id = /* currPlayId */0
and
mp.user_id = /* userId */0
and
not exists (
select
mp2.mistake_point_id
from
t_mistake_points mp2
where
mp2.play_id = /* lastPlayId */0
and
mp2.user_id = /* userId */0
and
mp2.note_id = mp.note_id
and
mp2.mistake_cd = mp.mistake_cd
)
order by
mp.deducted_point desc
limit
1
| true |
880894762f0ba868939203d32c15c1f97bf4b03e
|
SQL
|
nahmed23/git-github.com-Life-Time-Inc-database_udw
|
/ltdatabaseudw/marketing/Views/v_dim_crm_campaign.sql
|
UTF-8
| 2,603 | 2.765625 | 3 |
[] |
no_license
|
CREATE VIEW [marketing].[v_dim_crm_campaign]
AS select d_crmcloudsync_campaign.dim_crm_campaign_key dim_crm_campaign_key,
d_crmcloudsync_campaign.campaign_id campaign_id,
d_crmcloudsync_campaign.created_by_dim_crm_system_user_key created_by_dim_crm_system_user_key,
d_crmcloudsync_campaign.created_dim_date_key created_dim_date_key,
d_crmcloudsync_campaign.created_dim_time_key created_dim_time_key,
d_crmcloudsync_campaign.created_on created_on,
d_crmcloudsync_campaign.description description,
d_crmcloudsync_campaign.ltf_expiration_type ltf_expiration_type,
d_crmcloudsync_campaign.ltf_issuance_method ltf_issuance_method,
d_crmcloudsync_campaign.ltf_job_id ltf_job_id,
d_crmcloudsync_campaign.ltf_member_referral ltf_member_referral,
d_crmcloudsync_campaign.ltf_pass_days ltf_pass_days,
d_crmcloudsync_campaign.ltf_restricted_by_policy ltf_restricted_by_policy,
d_crmcloudsync_campaign.ltf_restricted_by_policy_flag ltf_restricted_by_policy_flag,
d_crmcloudsync_campaign.ltf_reward_club ltf_reward_club,
d_crmcloudsync_campaign.ltf_reward_lt_bucks ltf_reward_lt_bucks,
d_crmcloudsync_campaign.ltf_reward_type ltf_reward_type,
d_crmcloudsync_campaign.ltf_reward_wait_days ltf_reward_wait_days,
d_crmcloudsync_campaign.ltf_targeted_prospects ltf_targeted_prospects,
d_crmcloudsync_campaign.modified_by_dim_crm_system_user_key modified_by_dim_crm_system_user_key,
d_crmcloudsync_campaign.modified_dim_date_key modified_dim_date_key,
d_crmcloudsync_campaign.modified_dim_time_key modified_dim_time_key,
d_crmcloudsync_campaign.modified_on modified_on,
d_crmcloudsync_campaign.name name,
d_crmcloudsync_campaign.proposed_end proposed_end,
d_crmcloudsync_campaign.proposed_end_dim_date_key proposed_end_dim_date_key,
d_crmcloudsync_campaign.proposed_end_dim_time_key proposed_end_dim_time_key,
d_crmcloudsync_campaign.proposed_start proposed_start,
d_crmcloudsync_campaign.proposed_start_dim_date_key proposed_start_dim_date_key,
d_crmcloudsync_campaign.proposed_start_dim_time_key proposed_start_dim_time_key,
d_crmcloudsync_campaign.state_code state_code,
d_crmcloudsync_campaign.state_code_name state_code_name,
d_crmcloudsync_campaign.status_code status_code,
d_crmcloudsync_campaign.status_code_name status_code_name,
d_crmcloudsync_campaign.type_code type_code,
d_crmcloudsync_campaign.type_code_name type_code_name
from dbo.d_crmcloudsync_campaign;
| true |
3c1e173d292376e5a2090ae7406c39606561cd32
|
SQL
|
axelgabin/Livrable-Swing-JPA
|
/BD/gestionrdv.sql
|
UTF-8
| 1,755 | 3.234375 | 3 |
[] |
no_license
|
/*
SQLyog Ultimate v11.5 (32 bit)
MySQL - 5.6.25 : Database - gestionrdv
*********************************************************************
*/
/*!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*/`gestionrdv` /*!40100 DEFAULT CHARACTER SET utf8 */;
USE `gestionrdv`;
/*Table structure for table `hibernate_sequence` */
DROP TABLE IF EXISTS `hibernate_sequence`;
CREATE TABLE `hibernate_sequence` (
`next_val` bigint(20) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
/*Data for the table `hibernate_sequence` */
insert into `hibernate_sequence`(`next_val`) values (4);
/*Table structure for table `patient` */
DROP TABLE IF EXISTS `patient`;
CREATE TABLE `patient` (
`id` int(11) NOT NULL,
`age` int(11) NOT NULL,
`matricule` varchar(255) DEFAULT NULL,
`nom` varchar(255) DEFAULT NULL,
`poids` double NOT NULL,
`prenom` varchar(255) DEFAULT NULL,
`taille` int(11) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
/*Data for the table `patient` */
insert into `patient`(`id`,`age`,`matricule`,`nom`,`poids`,`prenom`,`taille`) values (1,8,'1555f','z',0,'z',88),(2,25,'2019','AXEL',0,'AXEL',180),(3,7,'1252','X',0,'X',78);
/*!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 |
b5c79d3b73f309f18b0169125ca3c56b6560f475
|
SQL
|
juanco89/posts
|
/db/1. ALTER_POST_ADD_AUTOR.sql
|
UTF-8
| 394 | 3.171875 | 3 |
[
"Apache-2.0"
] |
permissive
|
-- 14-12-2014
-- Agrega la columna AUTOR a la tabla POST.
ALTER TABLE public.post ADD COLUMN autor VARCHAR NOT NULL DEFAULT '';
-- Si la tabla post no está vacía es necesario realizar update.
-- UPDATE public.post SET autor = 'juan' ;
-- Clave foránea de POST a USUARIO.
ALTER TABLE public.post ADD CONSTRAINT post_usuario_fk
FOREIGN KEY (autor) REFERENCES public.usuario (nombre);
| true |
a81099418dfd3182fb56e593de742f46ec3c4a4c
|
SQL
|
zarper/Chim-re
|
/BDD/chimere.sql
|
UTF-8
| 11,861 | 3.125 | 3 |
[] |
no_license
|
-- phpMyAdmin SQL Dump
-- version 4.5.1
-- http://www.phpmyadmin.net
--
-- Client : 127.0.0.1
-- Généré le : Lun 19 Juin 2017 à 15:37
-- Version du serveur : 10.1.16-MariaDB
-- Version de PHP : 5.5.38
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Base de données : `chimere`
--
-- --------------------------------------------------------
--
-- Structure de la table `bijoux`
--
CREATE TABLE `bijoux` (
`id` int(11) NOT NULL,
`nom` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`description` longtext COLLATE utf8_unicode_ci,
`cout` int(11) NOT NULL,
`datedebprev` datetime NOT NULL,
`datefinprev` datetime NOT NULL,
`datedeb` datetime NOT NULL,
`datefin` datetime NOT NULL,
`client_id` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Contenu de la table `bijoux`
--
INSERT INTO `bijoux` (`id`, `nom`, `description`, `cout`, `datedebprev`, `datefinprev`, `datedeb`, `datefin`, `client_id`) VALUES
(6, 'Collier tesla', 'bijou de nicolaï tesla', 100, '2017-05-19 00:00:00', '2017-06-22 00:00:00', '2017-05-19 00:00:00', '2017-06-16 18:33:32', 1),
(8, 'bijoux tolstoï', 'bijou de Leon Tolstoï', 99, '2017-05-19 00:00:00', '2017-05-19 00:00:00', '2017-05-19 00:00:00', '2017-05-19 00:00:00', 3);
-- --------------------------------------------------------
--
-- Structure de la table `client`
--
CREATE TABLE `client` (
`id` int(11) NOT NULL,
`nom` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`prenom` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`telephone` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
`adresse` varchar(500) COLLATE utf8_unicode_ci DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Contenu de la table `client`
--
INSERT INTO `client` (`id`, `nom`, `prenom`, `telephone`, `adresse`) VALUES
(1, 'nicolai', 'tesla', '0752523561', '2 rue jean jaures'),
(3, 'tolstoï', 'leon', '0752741852', '2 rue de la liberté');
-- --------------------------------------------------------
--
-- Structure de la table `etape`
--
CREATE TABLE `etape` (
`id` int(11) NOT NULL,
`heuretravail` int(11) NOT NULL,
`bijou_id_etape` int(11) NOT NULL,
`description` varchar(500) COLLATE utf8_unicode_ci DEFAULT NULL,
`photo` varchar(255) COLLATE utf8_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Contenu de la table `etape`
--
INSERT INTO `etape` (`id`, `heuretravail`, `bijou_id_etape`, `description`, `photo`) VALUES
(1, 5, 6, 'création de l''arceau du colier', 'bijoux_bague.jpg'),
(3, 8, 6, 'confection du diamant', 'bijoux_collier.jpg');
-- --------------------------------------------------------
--
-- Structure de la table `fos_user`
--
CREATE TABLE `fos_user` (
`id` int(11) NOT NULL,
`username` varchar(180) COLLATE utf8_unicode_ci NOT NULL,
`username_canonical` varchar(180) COLLATE utf8_unicode_ci NOT NULL,
`email` varchar(180) COLLATE utf8_unicode_ci NOT NULL,
`email_canonical` varchar(180) COLLATE utf8_unicode_ci NOT NULL,
`enabled` tinyint(1) NOT NULL,
`salt` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
`password` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`last_login` datetime DEFAULT NULL,
`confirmation_token` varchar(180) COLLATE utf8_unicode_ci DEFAULT NULL,
`password_requested_at` datetime DEFAULT NULL,
`roles` longtext COLLATE utf8_unicode_ci NOT NULL COMMENT '(DC2Type:array)',
`nom` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
`prenom` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
`metier_id` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Contenu de la table `fos_user`
--
INSERT INTO `fos_user` (`id`, `username`, `username_canonical`, `email`, `email_canonical`, `enabled`, `salt`, `password`, `last_login`, `confirmation_token`, `password_requested_at`, `roles`, `nom`, `prenom`, `metier_id`) VALUES
(4, 'chef', 'chef', 'chef@chef.com', 'chef@chef.com', 0, NULL, '$2y$13$JLB/BuBhOdcOalZi3LJD0uu9K3cSaBIP5U5a6xxNPqO15MA7irgfm', '2017-06-16 06:03:34', NULL, NULL, 'a:1:{i:0;s:16:"ROLE_SUPER_ADMIN";}', 'chef', 'chef', 2),
(5, 'adrienlg', 'adrienlg', 'adrien.legeldron@gmail.com', 'adrien.legeldron@gmail.com', 1, NULL, '$2y$13$vwV0gxIOfZxyUumNuZXM2eCSV/29VU8tBOORmhQqYd1yL/8Zx3Pbi', '2017-06-19 15:31:45', NULL, NULL, 'a:0:{}', NULL, NULL, NULL),
(6, 'administrateur', 'administrateur', 'administrateur@admin.com', 'administrateur@admin.com', 1, NULL, '$2y$13$Ot7kA1bILBdHc.efoCkRGuJNxM/HC0yiCryTkSBJI94MlTYnTs/wi', '2017-06-19 11:04:12', NULL, NULL, 'a:1:{i:0;s:16:"ROLE_SUPER_ADMIN";}', NULL, NULL, NULL);
-- --------------------------------------------------------
--
-- Structure de la table `incident`
--
CREATE TABLE `incident` (
`id` int(11) NOT NULL,
`description` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`vu` tinyint(1) NOT NULL,
`tache_id_incident` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Contenu de la table `incident`
--
INSERT INTO `incident` (`id`, `description`, `vu`, `tache_id_incident`) VALUES
(3, 'la perceuse doit être changer', 1, 3),
(7, 'RAS', 1, 3);
-- --------------------------------------------------------
--
-- Structure de la table `materiel`
--
CREATE TABLE `materiel` (
`id` int(11) NOT NULL,
`nom` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`quantite` int(11) NOT NULL,
`stock_id_materiel` int(11) NOT NULL,
`tache_id_materiel` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Contenu de la table `materiel`
--
INSERT INTO `materiel` (`id`, `nom`, `quantite`, `stock_id_materiel`, `tache_id_materiel`) VALUES
(1, 'fil de cuivre', 5, 1, 3),
(4, 'barre de fer', 15, 8, 8);
-- --------------------------------------------------------
--
-- Structure de la table `metier`
--
CREATE TABLE `metier` (
`id` int(11) NOT NULL,
`nom` varchar(255) COLLATE utf8_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Contenu de la table `metier`
--
INSERT INTO `metier` (`id`, `nom`) VALUES
(1, 'Tailleur'),
(2, 'Fondeur');
-- --------------------------------------------------------
--
-- Structure de la table `stock`
--
CREATE TABLE `stock` (
`id` int(11) NOT NULL,
`nom` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`prix` double NOT NULL,
`quantitestock` int(11) NOT NULL,
`seuil` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Contenu de la table `stock`
--
INSERT INTO `stock` (`id`, `nom`, `prix`, `quantitestock`, `seuil`) VALUES
(1, 'cuivre', 5, 50, 45),
(8, 'fer', 15, 20, 10);
-- --------------------------------------------------------
--
-- Structure de la table `tache`
--
CREATE TABLE `tache` (
`id` int(11) NOT NULL,
`description` varchar(500) COLLATE utf8_unicode_ci DEFAULT NULL,
`datedebut` datetime DEFAULT NULL,
`datefin` datetime DEFAULT NULL,
`comentaire` varchar(500) COLLATE utf8_unicode_ci DEFAULT NULL,
`etape_id_tache` int(11) NOT NULL,
`user_id_tache` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Contenu de la table `tache`
--
INSERT INTO `tache` (`id`, `description`, `datedebut`, `datefin`, `comentaire`, `etape_id_tache`, `user_id_tache`) VALUES
(3, 'Création du circuit électrique', '2017-06-01 00:00:00', '2017-06-02 23:41:38', 'Ras', 1, 6),
(4, 'Insertion du circuit électrique dans le colier', NULL, NULL, NULL, 1, 6),
(8, 'Création du circuit électrique du collier', '2017-06-14 00:00:00', NULL, NULL, 1, 6);
--
-- Index pour les tables exportées
--
--
-- Index pour la table `bijoux`
--
ALTER TABLE `bijoux`
ADD PRIMARY KEY (`id`),
ADD KEY `IDX_7B5AF50919EB6921` (`client_id`);
--
-- Index pour la table `client`
--
ALTER TABLE `client`
ADD PRIMARY KEY (`id`);
--
-- Index pour la table `etape`
--
ALTER TABLE `etape`
ADD PRIMARY KEY (`id`),
ADD KEY `IDX_285F75DD2A542F9D` (`bijou_id_etape`);
--
-- Index pour la table `fos_user`
--
ALTER TABLE `fos_user`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `UNIQ_957A647992FC23A8` (`username_canonical`),
ADD UNIQUE KEY `UNIQ_957A6479A0D96FBF` (`email_canonical`),
ADD UNIQUE KEY `UNIQ_957A6479C05FB297` (`confirmation_token`),
ADD KEY `IDX_957A6479ED16FA20` (`metier_id`);
--
-- Index pour la table `incident`
--
ALTER TABLE `incident`
ADD PRIMARY KEY (`id`),
ADD KEY `IDX_3D03A11AFED1EAC1` (`tache_id_incident`);
--
-- Index pour la table `materiel`
--
ALTER TABLE `materiel`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `UNIQ_18D2B091DB00FB4A` (`tache_id_materiel`),
ADD KEY `IDX_18D2B09197C7FA30` (`stock_id_materiel`);
--
-- Index pour la table `metier`
--
ALTER TABLE `metier`
ADD PRIMARY KEY (`id`);
--
-- Index pour la table `stock`
--
ALTER TABLE `stock`
ADD PRIMARY KEY (`id`);
--
-- Index pour la table `tache`
--
ALTER TABLE `tache`
ADD PRIMARY KEY (`id`),
ADD KEY `IDX_938720756C5803BA` (`etape_id_tache`),
ADD KEY `IDX_938720759D8F8545` (`user_id_tache`);
--
-- AUTO_INCREMENT pour les tables exportées
--
--
-- AUTO_INCREMENT pour la table `bijoux`
--
ALTER TABLE `bijoux`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=9;
--
-- AUTO_INCREMENT pour la table `client`
--
ALTER TABLE `client`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
--
-- AUTO_INCREMENT pour la table `etape`
--
ALTER TABLE `etape`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
--
-- AUTO_INCREMENT pour la table `fos_user`
--
ALTER TABLE `fos_user`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7;
--
-- AUTO_INCREMENT pour la table `incident`
--
ALTER TABLE `incident`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8;
--
-- AUTO_INCREMENT pour la table `materiel`
--
ALTER TABLE `materiel`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
--
-- AUTO_INCREMENT pour la table `metier`
--
ALTER TABLE `metier`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT pour la table `stock`
--
ALTER TABLE `stock`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=9;
--
-- AUTO_INCREMENT pour la table `tache`
--
ALTER TABLE `tache`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=9;
--
-- Contraintes pour les tables exportées
--
--
-- Contraintes pour la table `bijoux`
--
ALTER TABLE `bijoux`
ADD CONSTRAINT `FK_7B5AF50919EB6921` FOREIGN KEY (`client_id`) REFERENCES `client` (`id`);
--
-- Contraintes pour la table `etape`
--
ALTER TABLE `etape`
ADD CONSTRAINT `FK_285F75DD2A542F9D` FOREIGN KEY (`bijou_id_etape`) REFERENCES `bijoux` (`id`);
--
-- Contraintes pour la table `fos_user`
--
ALTER TABLE `fos_user`
ADD CONSTRAINT `FK_957A6479ED16FA20` FOREIGN KEY (`metier_id`) REFERENCES `metier` (`id`);
--
-- Contraintes pour la table `incident`
--
ALTER TABLE `incident`
ADD CONSTRAINT `FK_3D03A11AFED1EAC1` FOREIGN KEY (`tache_id_incident`) REFERENCES `tache` (`id`);
--
-- Contraintes pour la table `materiel`
--
ALTER TABLE `materiel`
ADD CONSTRAINT `FK_18D2B09197C7FA30` FOREIGN KEY (`stock_id_materiel`) REFERENCES `stock` (`id`),
ADD CONSTRAINT `FK_18D2B091DB00FB4A` FOREIGN KEY (`tache_id_materiel`) REFERENCES `tache` (`id`);
--
-- Contraintes pour la table `tache`
--
ALTER TABLE `tache`
ADD CONSTRAINT `FK_938720756C5803BA` FOREIGN KEY (`etape_id_tache`) REFERENCES `etape` (`id`),
ADD CONSTRAINT `FK_938720759D8F8545` FOREIGN KEY (`user_id_tache`) REFERENCES `fos_user` (`id`);
/*!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 |
5e4a38887f24fb62afb07d3b6df950d21872aca9
|
SQL
|
Rayintu/Spotitube-Ricky-Broers
|
/database/spotitube-DDL.sql
|
UTF-8
| 1,577 | 3.859375 | 4 |
[] |
no_license
|
-- we don't know how to generate schema spotitube (class Schema) :(
create table accounts
(
user varchar(255) not null
primary key,
password varchar(255) null,
full_name varchar(255) null
)
engine = InnoDB
;
create table playlists
(
playlist_id int auto_increment,
name varchar(100) null,
owner varchar(255) null,
constraint all_playlists_playlist_id_uindex
unique (playlist_id),
constraint ownder___fk
foreign key (owner) references accounts (user)
)
engine = InnoDB;
alter table playlists
add primary key (playlist_id)
;
create table tokens
(
user varchar(255) not null
primary key,
token varchar(255) null,
valid_until varchar(255) null,
constraint tokens_accounts_user_fk
foreign key (user) references accounts (user)
)
engine = InnoDB
;
create table tracks
(
track_id int auto_increment
primary key,
title varchar(255) null,
performer varchar(255) null,
duration int null,
album varchar(255) null,
playcount int null,
publicationDate date null,
description varchar(255) null,
offline_available tinyint(1) null
)
engine = InnoDB
;
create table playlist_track_connector
(
playlist_id int not null,
track_id int not null,
primary key (playlist_id, track_id),
constraint playlist_track_connector_playlist_id___fk
foreign key (playlist_id) references playlists (playlist_id),
constraint playlist_track_connector_track_id___fk
foreign key (track_id) references tracks (track_id)
)
engine = InnoDB
;
| true |
6453759f63c90d19823eaa2e690156ca141cfebb
|
SQL
|
gruter/tajo-elasticsearch
|
/tajo-core/src/test/resources/queries/TestSortQuery/testSortWithAlias3.sql
|
UTF-8
| 251 | 3.671875 | 4 |
[
"Apache-2.0",
"PostgreSQL",
"BSD-3-Clause",
"MIT"
] |
permissive
|
select
nation.n_nationkey as n_nationkey,
customer.c_name as c_name,
count(nation.n_nationkey) as cnt
from
nation inner join customer on n_nationkey = c_nationkey
group by
nation.n_nationkey,
customer.c_name
order by
n_nationkey, c_name;
| true |
fea9b88f210aa2ef2c4e658821faf4e0ae64c537
|
SQL
|
bhayyasaheb/Hive
|
/Hive Practicals.sql
|
UTF-8
| 37,110 | 3.8125 | 4 |
[] |
no_license
|
show databases;
use niit;
show tables;
show table structure:-
--------------------
desc formatted customer;
Location: hdfs://localhost:54310/user/hive/warehouse/niit.db/customer
Table Type: MANAGED_TABLE
select * from customer;
turncate will delete data from table & drop will delete data and structure of table.
truncate table customer;
select * from customer;
upload data in hdfs:-
----------------
hadoop fs -put /home/hduser/custs /niit
Load the data into table from hdfs system:-
------------------------------------------
LOAD DATA INPATH '/niit/custs' OVERWRITE INTO TABLE customer;
drop table customer;
-------------------------------------------------------------------------------------------------------------------------------------------------------
Q. Create External Tables
create folder in hdfs:-
hadoop fs -mkdir /user/training
upload data from local system to hdfs:-
hadoop fs -put /home/hduser/custs /user/training
hadoop fs -put /home/hduser/custs_add /user/training
Create External Table:-
---------------------
create external table customer
(
custno string,
firstname string,
lastname string,
age int,
profession string
)
row format delimited
fields terminated by ","
stored as textfile
location "/user/training";
show table stucture:-
-------------------
desc formatted customer;
Location: hdfs://localhost:54310/user/training
Table Type: EXTERNAL_TABLE
select * from customer;
-----------------------------------------------------------------------------------------------------------------------------------------------------
Q. Text data stored in table in different form like textfile(csv),avro,sequence,orc format
create database college;
use college;
students.csv
------------
Bhayyasaheb,Maths,91
Bhayyasaheb,Physics,48
Bhayyasaheb,Chemistry,66
Sayali,Maths,96
Sayali,Physics,64
Sayali,Chemistry,73
---------------------------------------
1. Create Hive table stored as textfile
create table csv_table
(
student_name string,
subject string,
marks int
)
row format delimited
fields terminated by ','
stored as textfile;
---------------------------------------------------------------------------------------
Load csv_table with students.csv
LOAD DATA LOCAL INPATH "/home/hduser/students.csv" OVERWRITE INTO TABLE csv_table;
--------------------------------------------------------------------------------------
in csv_table data is in text format we can check using following command in linux terminal:-
hadoop fs -cat /user/hive/warehouse/college.db/csv_table/* */
Bhayyasaheb,Maths,91
Bhayyasaheb,Physics,48
Bhayyasaheb,Chemistry,66
Sayali,Maths,96
Sayali,Physics,64
Sayali,Chemistry,73
--------------------------------------------------------------------------------------
check data in table using hive terminal:-
select * from csv_table;
output is :-
csv_table.student_name csv_table.subject csv_table.marks
Bhayyasaheb Maths 91
Bhayyasaheb Physics 48
Bhayyasaheb Chemistry 66
Sayali Maths 96
Sayali Physics 64
Sayali Chemistry 73
------------------------------------------------------------------------------------------------
2. Create another Hive table using AvroSerDe
CREATE TABLE avro_table
ROW FORMAT SERDE 'org.apache.hadoop.hive.serde2.avro.AvroSerDe'
STORED AS INPUTFORMAT 'org.apache.hadoop.hive.ql.io.avro.AvroContainerInputFormat'
OUTPUTFORMAT 'org.apache.hadoop.hive.ql.io.avro.AvroContainerOutputFormat'
TBLPROPERTIES
('avro.schema.literal'=
'{
"namespace": "abc",
"name": "student_marks",
"type": "record",
"fields": [{"name":"student_name","type":"string"},{"name":"subject","type":"string"},{"name":"marks","type":"int"}]
}'
);
---------------------------------------------------------------------------------------------------------------------
Load avro_table with data from csv_table
INSERT OVERWRITE TABLE avro_table SELECT student_name, subject, marks FROM csv_table;
------------------------------------------------------------------------------------------
In the avro_table data is in avro form we can check using this command in linux terminal:-
hadoop fs -cat /user/hive/warehouse/college.db/avro_table/* */
output is:-
Objavro.schema�{"type":"record","name":"student_marks","namespace":"abc","fields":[{"name":"student_name","type":"string"},{"name":"subject","type":"string"},{"name":"marks","type":"int"}]}�S=!��+te�:�}
�Bhayyasaheb
Maths�BhayyasahebPhysicsBhayyasahebChemistry�
Sayali
Maths�
SayaliPhysics�
SayaliChemistry��S=!��+te�:�}
---------------------------------------------------------------------------------------------------------------------------------------
also download this file in local system using following command in linux terminal:-
hadoop fs -get /user/hive/warehouse/college.db/avro_table/000000_0
---------------------------------------------------------------------------
check this file using following command in linux terminal:-
nano 000000_0 or gedit 000000_0
output is :-
Objavro.schema\DC{"type":"record","name":"student_marks","namespace":"abc","fields":[{"name":"student_name","type":"string"},{"name":"subject","type":"string"},{"name":"marks","type":"int"}]}\00\F7S=!\FF\B7+te\E4:\DF}\E8Bhayyasaheb
Maths\B6BhayyasahebPhysicsBhayyasahebChemistry\84Sayali
Maths\C0SayaliPhysics\80SayaliChemistry\92\F7S=!\FF\B7+te\E4:\DF}
-----------------------------------------------------------------------------------------------------------------------
actual data in avro_table is avro format but in hive terminal data is getting in text format
check using following command in hive:-
select * from avro_table;
output is :-
avro_table.student_name avro_table.subject avro_table.marks
Bhayyasaheb Maths 91
Bhayyasaheb Physics 48
Bhayyasaheb Chemistry 66
Sayali Maths 96
Sayali Physics 64
Sayali Chemistry 73
-----------------------------------------------------------------------------------------------------------------------------------------------
3. Create Another table orc_table
CREATE TABLE orc_table
(
student_name string,
subject string,
marks int
)
STORED AS ORC;
------------------------------------------------------------------------
Load orc_table with data from csv_table
INSERT OVERWRITE TABLE orc_table SELECT student_name, subject, marks FROM csv_table;
------------------------------------------------------------------------------
actual data in orc_table is ORC format but we are getting in text format in hive terminal
check data in orc_table using following command in hive terminal:-
select * from orc_table;
output is :-
orc_table.student_name orc_table.subject orc_table.marks
Bhayyasaheb Maths 91
Bhayyasaheb Physics 48
Bhayyasaheb Chemistry 66
Sayali Maths 96
Sayali Physics 64
Sayali Chemistry 73
--------------------------------------------------------------------------------------------
check data of orc_table using hduser terminal using following terminal:-
hadoop fs -cat /user/hive/warehouse/college.db/orc_table/* */
output is:-
ORC
PM
$
"
BhayyasahebSayalifPK
#
"
ChemistryPhysicsTP/
`��P F�#BhayyasahebSayali Ba� F�p+ChemistryMathsPhysicsN�`������b�``���ь�`�IBL3KHiF�8;�f�l@�H��ř���HK�ř%���8�X@b`��g��q,�L�����N,I��
�b�`
`���`S��v�H��L,N�HMb
�`X�$���,P&����$��#����,����c�8�3Rs3�K�*��2*�3��%B��|lB %�
!��;3�Y�p�0X�r�)�sq;e$VV&'f�& �'V&�dJ��e��b\������%E�B��ř��!@Y>6!���o��9L����"
(V0��ORC
-------------------------------------------------------------------------------------------------------------------------------------------
4. Create Another table seq_table
CREATE TABLE seq_table
(
student_name string,
subject string,
marks int
)
ROW FORMAT DELIMITED FIELDS TERMINATED BY '\t'
STORED AS SEQUENCEFILE;
-------------------------------------------------------------
Load seq_table with data from csv_table
INSERT OVERWRITE TABLE seq_table SELECT student_name, subject, marks FROM csv_table;
---------------------------------------------------------------------------------------
actual data in sequence format in seq_table but we are getting in text format in hiver terminal
check data of seq_table using following command:-
select * from seq_table;
output is:-
seq_table.student_name seq_table.subject seq_table.marks
Bhayyasaheb Maths 91
Bhayyasaheb Physics 48
Bhayyasaheb Chemistry 66
Sayali Maths 96
Sayali Physics 64
Sayali Chemistry 73
-----------------------------------------------------------------
check data of seq_table in linux terminal using following command:-
hadoop fs -cat /user/hive/warehouse/college.db/seq_table/* */
output is:-
SEQ"org.apache.hadoop.io.BytesWritableorg.apache.hadoop.io.Text_]�aAJ��u�h1w�=7Bhayyasaheb Maths 91Bhayyasaheb Physics 48Bhayyasaheb Chemistry 66Sayali Maths 96Sayali Physics 64Sayali Chemistry 73
--------------------------------------------------------------------------------------------------------------------------------------------------------
show databases;
use niit;
show tables;
#Views:- here We are actually saving query instead of saving the data
-----
Q. Create a view in hive for customers whose age is more than 45 years.
CREATE VIEW age_45plus AS
SELECT * FROM customer WHERE age>45;
select * from age_45plus;
ans:- 5355 records
desc formatted age_45plus;
Table Type: VIRTUAL_VIEW
--------------------------------------------------------------------------
Q. Create a view in hive for top 10 customers.
CREATE VIEW topten AS
select a.custno, b.firstname, b.lastname, b.age, b.profession, round(sum(a.amount),2) as amt
from txnrecords a, customer b where a.custno = b.custno
group by a.custno, b.firstname, b.lastname, b.age, b.profession
order by amt desc limit 10;
select * from topten;
output is:-
topten.custno topten.firstname topten.lastname topten.age topten.profession topten.amt
4009485 Stuart House 58 Teacher 1973.3
4006425 Joe Burns 30 Economist 1732.09
4000221 Glenda Boswell 28 Civil engineer 1671.47
4003228 Elsie Newton 54 Accountant 1640.63
4006606 Jackie Lewis 66 Recreation and fitness worker 1628.94
4006467 Evelyn Monroe 37 Financial analyst 1605.95
4004927 Joan Lowry 30 Librarian 1576.71
4008321 Paul Carey 64 Human resources assistant 1560.79
4000815 Julie Galloway 53 Actor 1557.82
4001051 Arlene Higgins 62 Police officer 1488.67
-------------------------------------------------------------------------------------------------------------------------------------------------------
Q. inserting output of one table into another table ( make sure Airsports table is created beforehand)
create table Airsports:-
-----------------------
CREATE TABLE airsports
(
txnno INT, txndate STRING, custno INT, amount DOUBLE,
category STRING, product STRING, city STRING, state STRING, spendby STRING
)
ROW FORMAT DELIMITED FIELDS TERMINATED BY ','
STORED AS TEXTFILE;
Load data in Airsports table From txnrecords table:-
---------------------------------------------------
INSERT OVERWRITE TABLE airsports select * from txnrecords where category = 'Air Sports';
Select * from airsports;
ans:-960 records
-------------------------------------------------------------------------------------------------------------------------------------------
Q. find sales done in each payment mode and their percentage:-
--------------------------------------------------------------
CREATE TABLE totalsales
(total bigint)
ROW FORMAT DELIMITED FIELDS TERMINATED BY ','
STORED AS TEXTFILE;
Load data in totalsales table:-
----------------------------
INSERT OVERWRITE TABLE totalsales SELECT sum(amount) FROM txnrecords;
select * from totalsales;
totalsales.total
5110820
SELECT a.spendby, ROUND(SUM(a.amount),2) AS typesales, ROUND((SUM(a.amount)/b.total*100),2) AS salespercent
FROM txnrecords a, totalsales b GROUP BY a.spendby, b.total;
a.spendby typesales salespercent
cash 187685.61 3.67
credit 4923134.93 96.33
-------------------------------------------------------------------------------------------------------------------------------------------------
Q. find sales based on age group with the % on totalsales:-
----------------------------------------------------------
Create table out1:-
------------------
CREATE TABLE out1
(
custno int,
firstname string,
age int,
profession string,
amount double,
product string
)
ROW FORMAT DELIMITED FIELDS TERMINATED BY ','
STORED AS TEXTFILE;
---------------------------------------------------
load data in out1:-
-----------------
INSERT OVERWRITE TABLE out1
SELECT a.custno, a.firstname, a.age, a.profession, b.amount, b.product
FROM customer a JOIN txnrecords b ON a.custno = b.custno;
select * from out1;
ans:- 49997 records
------------------------------------------------
Create table out2:-
-----------------
CREATE TABLE out2
(
custno int,
firstname string,
age int,
profession string,
amount double,
product string,
level string
)
ROW FORMAT DELIMITED FIELDS TERMINATED BY ','
STORED AS TEXTFILE;
-------------------------------------------------------
Load data in out2:-
-----------------
INSERT OVERWRITE TABLE out2
SELECT * , case
when age<30 then 'low'
when age>=30 and age<50 then 'middle'
when age >=50 then 'old'
else 'others' end
from out1;
select * from out2;
ans:- 49997 records
desc out2;
custno int
firstname string
age int
profession string
amount double
product string
---------------------------------------------------
Create table out3:-
-----------------
CREATE TABLE out3
(
level string,
amount double,
salespercent double
)
ROW FORMAT DELIMITED FIELDS TERMINATED BY ','
STORED AS TEXTFILE;
-----------------------------------------------------
Load data in out3:-
-----------------
INSERT OVERWRITE TABLE out3
SELECT a.level, ROUND(SUM(a.amount),2) as totalspent, ROUND((SUM(a.amount)/total*100),2) as salespercent
FROM out2 a, totalsales b
GROUP BY a.level, b.total;
select * from out3;
level amount salespercent
low 725221.34 14.19
middle 1855861.67 36.31
old 2529287.65 49.49
----------------------------------------------------------------------------
Q. find sales based on profession group with the % on totalsales:-
------------------------------------------------------------------
Create Table out4:-
-----------------
CREATE TABLE out4
(
profession string,
amount double,
salespercent double
)
ROW FORMAT DELIMITED FIELDS TERMINATED BY ','
STORED AS TEXTFILE;
----------------------------------------------------
Load data in out4:-
-----------------
INSERT OVERWRITE table out4
SELECT a.profession, ROUND(SUM(a.amount),2) as totalspent, ROUND((SUM(a.amount)/total*100),2) as salespercent
FROM out1 a, totalsales b
GROUP BY a.profession, b.total
ORDER BY salespercent desc;
select * from out4 limit 10;
out4.profession out4.amount out4.salespercent
Firefighter 116516.99 2.28
Computer support specialist 114138.49 2.23
Librarian 114152.24 2.23
Politician 114030.35 2.23
Human resources assistant 112682.97 2.2
Photographer 111930.18 2.19
Pilot 111549.02 2.18
Police officer 110918.46 2.17
Loan officer 110836.27 2.17
Pharmacist 110087.46 2.15
------------------------------------------------------------------------------------------------------------------------------------------------
Partitioning:- segregating data physically into seperate block with some criteria.
Dynamic Partitioning:- Partitioning data on particular column for all category
--------------------
Q. Create Partitioned table (Single bucket):-
--------------------------------------------
CREATE TABLE txnrecsByCat
(
txnno INT,
txndate STRING,
custno INT,
amount DOUBLE,
product STRING,
city STRING,
state STRING,
spendby STRING
)
PARTITIONED BY (category STRING)
ROW FORMAT DELIMITED
FIELDS TERMINATED BY ','
STORED AS TEXTFILE;
-------------------------------------------------
set properties:-
--------------
set hive.exec.dynamic.partition.mode=nonstrict;
set hive.exec.dynamic.partition=true;
------------------------------------------------------------------------
Q. Loading data into Partition table txnrecsByCat (single bucket):-
------------------------------------------------------------------
FROM txnrecords txn INSERT OVERWRITE TABLE txnrecsByCat PARTITION(category)
SELECT txn.txnno, txn.txndate, txn.custno, txn.amount, txn.product, txn.city, txn.state, txn.spendby, txn.category
DISTRIBUTE BY category;
select sum(amount) from txnrecords where category='Air Sports';
ans:- 99316.89999999994
It is 64 kb file
select sum(amount) from txnrecsbycat where category='Air Sports';
ans:- 99316.90000000005
It is 4.21 Mb file
--------------------------------------------------------------------------------------------------------------------------------------
Q. Create Partitioned table (single bucket) on a derived column:-
----------------------------------------------------------------
CREATE TABLE txnrecsByCat3
(
txnno INT,
txndate STRING,
custno INT,
amount DOUBLE,
category STRING,
product STRING,
city STRING,
state STRING,
spendby STRING
)
PARTITIONED BY (month STRING)
ROW FORMAT DELIMITED
FIELDS TERMINATED BY ','
STORED AS TEXTFILE;
--------------------------------------------------------------------------------------------------------
Q. Load data into partition table (single bucket) using a derived partition column
-----------------------------------------------------------------------------------
FROM txnrecords txn INSERT OVERWRITE TABLE txnrecsByCat3 PARTITION(month)
SELECT txn.txnno, txn.txndate, txn.custno, txn.amount, txn.category, txn.product, txn.city, txn.state, txn.spendby,
SUBSTRING(txn.txndate,1,2) as month
DISTRIBUTE BY SUBSTRING(txndate,1,2);
-------------------------------------------------------------------------------------------------------------------------------------------------
Q. Create partitioned table (single bucket) on multiple columns:-
----------------------------------------------------------------
CREATE TABLE txnrecsByCat4
(
txnno INT,
txndate STRING,
custno INT,
amount DOUBLE,
product STRING,
city STRING,
state STRING
)
PARTITIONED BY (category STRING, spendby STRING)
ROW FORMAT DELIMITED
FIELDS TERMINATED BY ','
STORED AS TEXTFILE;
--------------------------------------------------------------------------------------
Q. Load data into partition table (single bucket) using multiple partition columns:-
-----------------------------------------------------------------------------------
FROM txnrecords txn INSERT OVERWRITE TABLE txnrecsByCat4 PARTITION(category,spendby)
SELECT txn.txnno, txn.txndate, txn.custno, txn.amount, txn.product, txn.city, txn.state, txn.category, txn.spendby
DISTRIBUTE BY category, spendby;
--------------------------------------------------------------------------------------------------------------------------------------------------------
Static Partitioning:- Partitioning data on particular column for one specific category
-------------------- - When you want work on particular column then you go for static partitioner
Q. Create a Partition table on category:-
---------------------------------------
CREATE TABLE txnrecsByCat5
(
txnno INT,
txndate STRING,
custno INT,
amount DOUBLE,
product STRING,
city STRING,
state STRING,
spendby STRING
)
PARTITIONED BY (category STRING)
ROW FORMAT DELIMITED
FIELDS TERMINATED BY ','
STORED AS TEXTFILE;
-----------------------------------------------------------
Loading data into Partition table txnrecsByCat5 (single bucket) for a particular category like Air sports, Gymnastics, Team Sports statically:-
----------------------------------------------------------------------------------------------------------------------------------------------
It is for category = 'Gymnastics':-
FROM txnrecords txn INSERT OVERWRITE TABLE txnrecsByCat5 PARTITION(category='Gymnastics')
SELECT txn.txnno, txn.txndate, txn.custno, txn.amount, txn.product, txn.city, txn.state, txn.spendby
WHERE txn.category='Gymnastics';
It is for category = 'Team Sports':-
FROM txnrecords txn INSERT OVERWRITE TABLE txnrecsByCat5 PARTITION(category='Team Sports')
SELECT txn.txnno, txn.txndate, txn.custno, txn.amount, txn.product, txn.city, txn.state, txn.spendby
WHERE txn.category='Team Sports';
select * from txnrecsbycat5;
-------------------------------------------------------------------------------------------------------------------------------------------------------
Bucketing :- Bucketting creates different groups & each group contains some data.
-------- - all common hash key falls in that bucket
clustering the data into various groups
select sum(amount) from txnrecords where category = 'Exercise & Fitness' and (state = 'California' or state = 'New Jesery');
Q. Create partitioned table (with multiple buckets):-
-----------------------------------------------------
CREATE TABLE txnrecsByCat2
(
txnno INT,
txndate STRING,
custno INT,
amount DOUBLE,
product STRING,
city STRING,
state STRING,
spendby STRING
)
PARTITIONED BY (category STRING)
CLUSTERED BY (state) into 10 buckets
ROW FORMAT DELIMITED
FIELDS TERMINATED BY ','
STORED AS TEXTFILE;
---------------------------------------------------------------------------------
set hive.enforce.bucketing=true;
------------------------------------------------------------------------------------
Q. Load data into partition table (with multiple buckets)
----------------------------------------------------------
FROM txnrecords txn INSERT OVERWRITE TABLE txnrecsByCat2 PARTITION(category)
SELECT txn.txnno, txn.txndate, txn.custno, txn.amount, txn.product, txn.city, txn.state, txn.spendby, txn.category
DISTRIBUTE BY category;
-------------------------------------------------------------------------------------------------------------------------------------------------------
Q. create an index on customer:-
------------------------------
use niit;
show tables;
***deferred rebuild will create an empty index:-
CREATE INDEX prof_index ON TABLE customer(profession) AS 'compact' WITH deferred rebuild;
--------------------------------------------------------------------------------------------
***alter index will actually create the index
ALTER INDEX prof_index ON customer rebuild;
---------------------------------------------------------------------------------------------
******list all the indexes on the table
show indexes on customer;
output is:-
idx_name tab_name col_names idx_tab_name idx_type
prof_index customer profession niit__customer_prof_index__ compact
---------------------------------------------------------------------------------------------
*****schema of the index
describe niit__customer_prof_index__;
output is:-
col_name data_type
profession string
_bucketname string
_offsets array<bigint>
----------------------------------------------------------------------------------------------
select * from niit__customer_prof_index__ where profession = "Pilot";
output is:-
niit__customer_prof_index__.profession niit__customer_prof_index__._bucketname niit__customer_prof_index__._offsets
Pilot hdfs://localhost:54310/user/training/custs [0,226,9027,9057,.....]
Pilot hdfs://localhost:54310/user/training/custs_add [0]
-----------------------------------------------------------------------------------------------------------------------------------
****Time taken without index
-----------------------------
select profession, count(*) as total from customer group by profession;
list of all the profession and the count of customers
output is:-
profession total
83
Accountant 197
Actor 196
Agricultural and food scientist 195
Architect 202
Artist 175
Athlete 196
Automotive mechanic 193
Carpenter 180
Chemist 206
Childcare worker 207
Civil engineer 193
Coach 199
Computer hardware engineer 204
Computer software engineer 216
Computer support specialist 222
Dancer 178
Designer 204
Doctor 189
Economist 189
Electrical engineer 192
Electrician 194
Engineering technician 204
Environmental scientist 176
Farmer 196
Financial analyst 198
Firefighter 217
Human resources assistant 212
Judge 189
Lawyer 201
Librarian 218
Loan officer 221
Musician 204
Nurse 191
Pharmacist 213
Photographer 222
Physicist 201
Pilot 210
Police officer 209
Politician 227
Psychologist 194
Real estate agent 191
Recreation and fitness worker 210
Reporter 199
Secretary 200
Social worker 212
Statistician 196
Teacher 189
Therapist 187
Veterinarian 208
Writer 95
Time taken: 1.24 seconds, Fetched: 51 row(s)
--------------------------------------------------------------------------
****Time taken with index
--------------------------
select profession, SIZE(`_offsets`) as total from niit__customer_prof_index__;
list of all the profession and the count of customers
output is:-
profession total
83
Accountant 197
Actor 196
Agricultural and food scientist 195
Architect 202
Artist 175
Athlete 196
Automotive mechanic 193
Carpenter 180
Chemist 206
Childcare worker 207
Civil engineer 193
Coach 199
Computer hardware engineer 204
Computer software engineer 216
Computer support specialist 222
Dancer 178
Designer 204
Doctor 189
Economist 189
Electrical engineer 192
Electrician 194
Engineering technician 204
Environmental scientist 176
Farmer 196
Financial analyst 198
Firefighter 217
Human resources assistant 212
Judge 189
Lawyer 201
Librarian 218
Loan officer 221
Musician 204
Nurse 191
Pharmacist 213
Photographer 222
Physicist 201
Pilot 209
Pilot 1
Police officer 209
Politician 227
Psychologist 194
Real estate agent 191
Recreation and fitness worker 210
Reporter 199
Secretary 200
Social worker 212
Statistician 196
Teacher 189
Therapist 187
Veterinarian 208
Writer 95
Time taken: 0.047 seconds, Fetched: 52 row(s)
here 52 rows because in external table 1 records for Pilot coming from custs_add and 51 from custs thats why for Pilot fields comes 2 times in output
-------------------------------------------------------------------------------------------------------------------------------------------------------
Q.Join in Hive:-
--------------
emp.txt:-
-------
swetha,250000,Chennai
anamika,200000,Kanyakumari
tarun,300000,Pondi
anita,250000,Selam
---------------------------------
email.txt:-
---------
swetha,swetha@gmail.com
tarun,tarun@edureka.in
nagesh,nagesh@yahoo.com
venkatesh,venki@gmail.com
--------------------------------
CREATE TABLE employee
(
name string,
salary float,
city string
)
ROW FORMAT DELIMITED
FIELDS TERMINATED BY ',';
LOAD DATA LOCAL INPATH '/home/hduser/emp.txt' INTO TABLE employee;
select * from employee;
output is:-
employee.name employee.salary employee.city
swetha 250000.0 Chennai
anamika 200000.0 Kanyakumari
tarun 300000.0 Pondi
anita 250000.0 Selam
---------------------------------------------------------------------
CREATE TABLE mailid
(
name string,
email string
)
ROW FORMAT DELIMITED
FIELDS TERMINATED BY ',';
LOAD DATA LOCAL INPATH '/home/hduser/email.txt' INTO TABLE mailid;
select * from mailid;
output is:-
mailid.name mailid.email
swetha swetha@gmail.com
tarun tarun@edureka.in
nagesh nagesh@yahoo.com
venkatesh venki@gmail.com
------------------------------------------------------------------------
INNER JOIN:- Fetch only matching records from both table
----------
SELECT a.name, a.city,a.salary,b.email
FROM employee a
JOIN mailid b
ON a.name=b.name;
output is:-
a.name a.city a.salary b.email
swetha Chennai 250000.0 swetha@gmail.com
tarun Pondi 300000.0 tarun@edureka.in
-------------------------------------------------------------------------
OUTER JOIN:-
-----------
LEFT OUTER JOIN:- Fetch Matching records from both table and non-matching record from L.H.S table
---------------
SELECT a.name,a.city,a.salary,b.email
FROM employee a
LEFT OUTER JOIN mailid b
ON a.name=b.name;
output is:-
a.name a.city a.salary b.email
swetha Chennai 250000.0 swetha@gmail.com
anamika Kanyakumari 200000.0 NULL
tarun Pondi 300000.0 tarun@edureka.in
anita Selam 250000.0 NULL
SELECT * FROM txnrecords a
LEFT OUTER JOIN customer b
ON a.custno=b.custno
WHERE b.firstname is NULL;
output is:-
a.txnno a.txndate a.custno a.amount a.category a.product a.city a.state a.spendby b.custno b.firstname b.lastname b.age b.profession
5483 07-17-2011 4000000 103.79 Indoor Games Bowling Flint Michigancredit NULL NULL NULL NULL NULL
19041 08-01-2011 4000000 175.28 Games Portable Electronic Games Irvine California credit NULL NULL NULL NULL NULL
19757 10-30-2011 4000000 19.96 Outdoor Recreation Running St. Petersburg Florida cash NULL NULL NULL NULL NULL
44544 06-08-2011 4000000 150.06 Outdoor Recreation Riding ScootersNewark New Jersey credit NULL NULL NULL NULL NULL
49461 07-12-2011 4000000 188.13 Winter Sports Cross-Country Skiing El Paso Texas credit NULL NULL NULL NULL NULL
----------------------------------------------------------------------------------------------------------------------------------------------------
RIGHT OUTER JOIN:- Fetch Matching records from both table and non-matching record from R.H.S table
----------------
SELECT A.name,a.city,a.salary,b.email
FROM employee a
RIGHT OUTER JOIN mailid b
ON a.name=b.name;
output is:-
a.name a.city a.salary b.email
swetha Chennai 250000.0 swetha@gmail.com
tarun Pondi 300000.0 tarun@edureka.in
NULL NULL NULL nagesh@yahoo.com
NULL NULL NULL venki@gmail.com
------------------------------------------------------------------------------
FULL OUTER JOIN:- Fetch Matching records one time and non-matching records from both table
---------------
SELECT a.name,a.city,a.salary,b.email
FROM employee a
FULL OUTER JOIN mailid b
ON a.name=b.name;
output is:-
a.name a.city a.salary b.email
anamika Kanyakumari 200000.0 NULL
anita Selam 250000.0 NULL
NULL NULL NULL nagesh@yahoo.com
swetha Chennai 250000.0 swetha@gmail.com
tarun Pondi 300000.0 tarun@edureka.in
NULL NULL NULL venki@gmail.com
-----------------------------------------------------------------------------------------------------------------------------------------------------
Q. To execute script from linux terminal:-
----------------------------------------
hive -f filename.sql
hive -f professioncount.sql
9568 records
professioncount.sql:-
-------------------
use niit;
set myage=45;
--select profession,count(*) from customer where age >={hiveconf:myage} group by profession order by profession;
--select profession,count(*) from customer where age >=45 group by profession order by profession;
select * from customer where age >= ${hiveconf:myage};
------------------------------------------------------------------------------------------------------------------------------
Q. To execute command from linux terminal:-
-----------------------------------------
hive -hiveconf myage=25 -f professioncount.sql
9568 records
professioncount.sql:-
-------------------
use niit;
--set myage=45;
--select profession,count(*) from customer where age >={hiveconf:myage} group by profession order by profession;
--select profession,count(*) from customer where age >=45 group by profession order by profession;
select * from customer where age >= ${hiveconf:myage};
-----------------------------------------------------------------------------------------------------------------------------
Q. To execute command from linux terminal:-
-----------------------------------------
hive -e "select * from niit.customer"
10000 records
----------------------------------------------------------------------------------------------------
Q. Setting up local variables and parameters in hive:-
-----------------------------------------------------
set myage=25;
select * from customer where age >= ${hiveconf:myage};
9568 records
-------------------------------------------------------------------------------------
Q.To see all the available variables, from the linux terminal, run:-
------------------------------------------------------------------
hive -e 'set;'
or from the hive terminal, run:-
------------------------------
set;
-----------------------------------------------------------------------------------
one can use hivevar variables as well, putting them into sql snippets or can be included from hive CLI using the source command (or pass as -i option from command line). The benefit here is that the variable can then be used with or without the hivevar prefix, and allow something akin to global vs local use.
So, assume have some setup.sql which sets a tablename variable:
--------------------------------------------------------------------------------------------------------------------------------------------------
In hive terminal:-
----------------
set hivevar:tablename=customer;
then, I can bring into hive:
source /home/hduser/customer.sql;
customer.sql
------------
select * from ${tablename};
or
select * from ${hivevar:tablename};
-----------------------------------------------------------------------------------------------------------
Q.Could also set a "local" tablename, which would affect the use of ${tablename}, but not ${hivevar:tablename}
In hive terminal:-
set tablename1=txnrecords;
set hivevar:tablename=txnrecords;
hive> select * from ${tablename1};
vs
hive> select * from ${hivevar:tablename};
---------------------------------------------------------------------------------------------------------------------------------------------------
Q.Control of number of mappers in hive
------------------------------------
set mapreduce.input.fileinputformat.split.minsize=134217728;
Q. if you want to combine multiple small files
-------------------------------------------
set mapreduce.input.fileinputformat.split.maxsize=134217728;
-------------------------------------------------------------------------------------------------------------------------------------------------
Q. User Define Functions:- In hive terminal
-------------------------
show databases;
use niit;
CREATE TABLE testing
(
id string,
unixtime string
)
ROW FORMAT DELIMITED
FIELDS TERMINATED BY ',';
LOAD DATA LOCAL INPATH '/home/hduser/counter.txt' INTO TABLE testing;
-----------------------------------------------------------------------
select * from testing;
output is:-
testing.id testing.unixtime
one 1386023259550
two 1389523259550
three 1389523259550
four 1389523259550
Add the jar in the hive:-
-----------------------
add jar /home/hduser/udfhive.jar;
To display the jar files in hive:-
--------------------------------
list jars;
Define user function:-
--------------------
create temporary function userdate as 'com.niit.udfhive.UnixtimeToDate';
Then use function 'userdate'
---------------------------
select id, userdate(unixtime) as datetime from testing;
output is:-
id datetime
one 3/12/13 3:57 AM
two 12/1/14 4:10 PM
three 12/1/14 4:10 PM
four 12/1/14 4:10 PM
-------------------------------------------------------------------------------------------
Q.Processing Unstructured data using hive for Word count:-
---------------------------------------------------------
file.txt
--------
we are learning hadoop
hadoop has two main components
hdfs and mapreduce
hdfs is storage
mapreduce is a processing framework
----------------------------------------------
CREATE TABLE input(line string);
LOAD DATA LOCAL INPATH '/home/hduser/file.txt' OVERWRITE INTO TABLE input;
--------------------------------------------------------------------------
select split(line,' ') as word from input;
output is:-
["we","are","learning","hadoop"]
["hadoop","has","two","main","components"]
["hdfs","and","mapreduce"]
["hdfs","is","storage"]
["mapreduce","is","a","processing","framework"]
----------------------------------------------------------------------------
select explode(split(line,' ')) as word from input;
output is:-
word
we
are
learning
hadoop
hadoop
has
two
main
components
hdfs
and
mapreduce
hdfs
is
storage
mapreduce
is
a
processing
framework
---------------------------------------------------------------------------------------------------------------------------
select word,count(*) as count from(select explode(split(line,' ')) as word from input) a group by word order by count desc;
output is:-
word count
hdfs 2
mapreduce 2
hadoop 2
is 2
we 1
two 1
storage 1
processing 1
main 1
learning 1
has 1
framework 1
components 1
are 1
and 1
a 1
------------------------------------------------------------------------------------------------------------------------------------------------------
| true |
5b7541616f2189d9f25f1c0dcf3bd1c620ccd4fb
|
SQL
|
ast-developers/thewallreport
|
/App/Database/db.sql
|
UTF-8
| 10,220 | 3.53125 | 4 |
[
"MIT",
"LicenseRef-scancode-free-unknown"
] |
permissive
|
/* 11 Sept 2017 */
DROP TABLE IF EXISTS `roles`;
CREATE TABLE `roles` (
`id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
`name` VARCHAR(255) NOT NULL,
`status` ENUM('0','1') NOT NULL DEFAULT '0',
`created_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` TIMESTAMP NULL DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `name` (`name`)
) ENGINE=INNODB DEFAULT CHARSET=utf8;
insert into `roles`(`id`,`name`,`status`,`created_at`,`updated_at`) values (1,'Admin','1','2017-09-11 15:26:14','2017-09-11 15:26:14'),(2,'Editors','1','2017-09-11 15:26:14','2017-09-11 15:26:14');
DROP TABLE IF EXISTS `users`;
CREATE TABLE `users` (
`id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
`username` VARCHAR(255) NOT NULL,
`password` VARCHAR(255) NOT NULL,
`email` VARCHAR(255) NOT NULL,
`first_name` VARCHAR(255) DEFAULT NULL,
`last_name` VARCHAR(255) DEFAULT NULL,
`nick_name` VARCHAR(255) DEFAULT NULL,
`role_id` INT(11) UNSIGNED NOT NULL,
`avatar_image_id` INT(11) UNSIGNED DEFAULT NULL,
`created_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` TIMESTAMP NULL DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `username` (`username`),
UNIQUE KEY `email` (`email`),
KEY `role_id` (`role_id`),
CONSTRAINT `users_ibfk_1` FOREIGN KEY (`role_id`) REFERENCES `roles` (`id`)
) ENGINE=INNODB DEFAULT CHARSET=utf8;
insert into `users`(`id`,`username`,`password`,`email`,`first_name`,`last_name`,`nick_name`,`role_id`,`avatar_image_id`,`created_at`,`updated_at`) values (1,'thewall','e10adc3949ba59abbe56e057f20f883e','admin@thewall.com','admin',NULL,NULL,1,NULL,'2017-09-11 15:42:14','2017-09-11 16:05:20');
/* 13 Sept 2017 */
DROP TABLE IF EXISTS `password_reminders`;
CREATE TABLE `password_reminders` (
`email` varchar(255) CHARACTER SET latin1 NOT NULL,
`token` varchar(255) CHARACTER SET latin1 NOT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/* 14 Sept 2017 */
ALTER TABLE `users` ADD `profile_image` VARCHAR(255) NULL DEFAULT NULL AFTER `role_id`;
/* 20 Sept 2017 */
CREATE TABLE `posts` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(255) NOT NULL,
`description` text,
`status` enum('pending','draft') NOT NULL,
`slug` varchar(255) NOT NULL,
`created_by` int(11) unsigned DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
KEY `created_by` (`created_by`),
CONSTRAINT `posts_ibfk_2` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `tag` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(255) NOT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `categories` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`parent_id` int(11) NOT NULL,
`name` varchar(255) NOT NULL,
`slug` varchar(255) NOT NULL,
`description` text NOT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8
CREATE TABLE `post_category` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`post_id` int(11) NOT NULL,
`category_id` int(11) NOT NULL,
PRIMARY KEY (`id`),
KEY `post_id` (`post_id`),
KEY `category_id` (`category_id`),
CONSTRAINT `post_category_ibfk_1` FOREIGN KEY (`post_id`) REFERENCES `posts` (`id`) ON DELETE CASCADE,
CONSTRAINT `post_category_ibfk_2` FOREIGN KEY (`category_id`) REFERENCES `categories` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `post_tag` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`post_id` int(11) NOT NULL,
`tag_id` int(11) NOT NULL,
PRIMARY KEY (`id`),
KEY `post_id` (`post_id`),
KEY `tag_id` (`tag_id`),
CONSTRAINT `post_tag_ibfk_1` FOREIGN KEY (`post_id`) REFERENCES `posts` (`id`) ON DELETE CASCADE,
CONSTRAINT `post_tag_ibfk_2` FOREIGN KEY (`tag_id`) REFERENCES `tag` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/* 21 Sep 2017 */
CREATE TABLE `pages` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(255) NOT NULL,
`description` text,
`status` enum('pending','draft') NOT NULL,
`slug` varchar(255) NOT NULL,
`created_by` int(11) unsigned DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
KEY `created_by` (`created_by`),
CONSTRAINT `pages_ibfk_1` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/* 22 Sep 2017 */
CREATE TABLE `menu` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(255) NOT NULL,
`type` enum('1','2','3') NOT NULL,
`link` varchar(255) NOT NULL,
`sort_order` int(11) NOT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
ALTER TABLE `menu` ADD COLUMN `status` ENUM('active','inactive') DEFAULT 'active' NOT NULL AFTER `sort_order`;
ALTER TABLE `menu` ADD `new_tab` ENUM('0','1') NOT NULL DEFAULT '0' AFTER `status`;
/* 25 Sept 2017 */
ALTER TABLE `pages` CHANGE `status` `status` ENUM('pending','draft','publish') CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL;
ALTER TABLE `pages` ADD `featured_image` VARCHAR(255) NULL AFTER `slug`, ADD `views` INT(11) NOT NULL DEFAULT '0' AFTER `featured_image`;
ALTER TABLE `pages` ADD `published_at` DATETIME NULL AFTER `updated_at`;
ALTER TABLE `posts` CHANGE `status` `status` ENUM('pending','draft','publish') CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL;
ALTER TABLE `posts` ADD `featured_image` VARCHAR(255) NULL AFTER `slug`, ADD `views` INT(11) NOT NULL DEFAULT '0' AFTER `featured_image`;
ALTER TABLE `posts` ADD `published_at` DATETIME NULL AFTER `updated_at`;
/*
* 3 Oct 2017
* Add featured and is_active flags for the feed posts in flow flow
*/
ALTER TABLE `ff_posts` ADD `featured` BOOLEAN NULL DEFAULT 0 AFTER `post_additional`, ADD `is_active` BOOLEAN NULL DEFAULT 1 AFTER `featured`;
/*
* 4 Oct 2017
* Roles and Permission
*/
DROP TABLE IF EXISTS `permissions`;
CREATE TABLE `permissions` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`section` varchar(255) NOT NULL,
`name` varchar(255) NOT NULL,
`value` varbinary(255) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*Data for the table `permissions` */
insert into `permissions`(`id`,`section`,`name`,`value`) values (1,'user','Add User','add_user'),(2,'user','Edit User','edit_user'),(3,'user','Delete User','delete_user'),(4,'user','List User','list_user'),(5,'post','Add Post','add_post'),(6,'post','Edit Post','edit_post'),(7,'post','Delete Post','delete_post'),(8,'post','List Post','list_post'),(9,'post_category','Add Category','add_category'),(10,'post_category','Edit Category','edit_category'),(11,'post_category','Delete Category','delete_category'),(12,'post_category','List Category','list_category'),(13,'page','Add Page','add_page'),(14,'page','Edit Page','edit_page'),(15,'page','Delete Page','delete_page'),(16,'page','List Page','list_page'),(17,'menu','Add Menu','add_menu'),(18,'menu','Edit Menu','edit_menu'),(19,'menu','Delete Menu','delete_menu'),(20,'menu','List Menu','list_menu'),(21,'flow_flow','Manage Flow Flow Plugin','manage_flow_flow');
/*Table structure for table `role_permission` */
DROP TABLE IF EXISTS `role_permission`;
CREATE TABLE `role_permission` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`role_id` int(11) unsigned NOT NULL,
`permission_id` int(11) unsigned NOT NULL,
PRIMARY KEY (`id`),
KEY `role_id` (`role_id`),
KEY `permission_id` (`permission_id`),
CONSTRAINT `role_permission_ibfk_1` FOREIGN KEY (`role_id`) REFERENCES `roles` (`id`) ON DELETE CASCADE,
CONSTRAINT `role_permission_ibfk_2` FOREIGN KEY (`permission_id`) REFERENCES `permissions` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*Data for the table `role_permission` */
insert into `role_permission`(`id`,`role_id`,`permission_id`) values (1,1,1),(2,1,2),(3,1,3),(4,1,4),(5,1,5),(6,1,6),(7,1,7),(8,1,8),(9,1,9),(10,1,10),(12,1,11),(13,1,12),(14,1,13),(15,1,14),(16,1,15),(17,1,16),(18,1,17),(19,1,18),(20,1,19),(21,1,20),(22,1,21),(23,2,5),(24,2,6),(26,2,8),(27,2,13),(28,2,14),(30,2,16);
/* 4 Oct 2017
Add Advertisement table
*/
CREATE TABLE `advertise` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(255) NOT NULL,
`type` enum('banner','adsense') NOT NULL,
`banner_image` varchar(255) DEFAULT NULL,
`adsense_code` text,
`status` enum('active','inactive') NOT NULL,
`position` enum('left','right','center') NOT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/* 06 Oct 2017 */
INSERT INTO `permissions` (`section`, `name`, `value`) VALUES ('advertise', 'Add Advertise', 'add_advertise');
INSERT INTO `permissions` (`section`, `name`, `value`) VALUES ('advertise', 'Edit Advertise', 'edit_advertise');
INSERT INTO `permissions` (`section`, `name`, `value`) VALUES ('advertise', 'Delete Advertise', 'delete_advertise');
INSERT INTO `permissions` (`section`, `name`, `value`) VALUES ('advertise', 'List Advertise', 'list_advertise');
INSERT INTO `role_permission` (`role_id`, `permission_id`) VALUES ('1', '22');
INSERT INTO `role_permission` (`role_id`, `permission_id`) VALUES ('1', '23');
INSERT INTO `role_permission` (`role_id`, `permission_id`) VALUES ('1', '24');
INSERT INTO `role_permission` (`role_id`, `permission_id`) VALUES ('1', '25');
/* 10 Oct 2017 */
ALTER TABLE pages CHANGE views views int DEFAULT NULL;
ALTER TABLE pages ADD show_title enum('0','1') NOT NULL DEFAULT '0' AFTER views;
ALTER TABLE pages ADD show_featured_sidebar enum('0','1') NOT NULL DEFAULT '0' AFTER views;
/* 11 Oct 2017 */
ALTER TABLE ff_posts ADD views int(11) DEFAULT '0'
| true |
9ad17647182eeb73be3b1ade377db20c8b844a66
|
SQL
|
JoshuaCMorgan/ls180
|
/sql_exercises/03_ddl/02.sql
|
UTF-8
| 919 | 3.96875 | 4 |
[] |
no_license
|
-- Relating Stars and Planets
-- You may have noticed that, when we created the stars and planets tables, we did not do anything to establish a relationship between the two tables. They are simply standalone tables that are related only by the fact that they both belong to the extrasolar database. However, there is no relationship between the rows of each table.
-- To correct this problem, add a star_id column to the planets table; this column will be used to relate each planet in the planets table to its home star in the stars table. Make sure the column is defined in such a way that it is required and must have a value that is present as an id in the stars table.
ALTER TABLE planets
ADD COLUMN star_id integer NOT NULL REFERENCES stars (id);
-- alternative statements
ALTER TABLE planets
ADD COLUMN star_id integer NOT NULL;
ALTER TABLE planets
ADD FOREIGN KEY (star_id)
REFERENCES stars(id);
| true |
ab67eb2f77bbc4c5dda1c2c65dd36fe24e4b36a5
|
SQL
|
ahmetaykutay/mini_blog
|
/create_tables.sql
|
UTF-8
| 455 | 3.765625 | 4 |
[] |
no_license
|
-- create articles table
CREATE TABLE users (
id int NOT NULL AUTO_INCREMENT,
user_name varchar(90) NOT NULL,
email varchar(90) NOT NULL,
password varchar(90) NOT NULL,
PRIMARY KEY (id)
);
-- create articles table
CREATE TABLE articles (
id int NOT NULL AUTO_INCREMENT,
title varchar(90) NOT NULL,
body varchar(90) NOT NULL,
author int NOT NULL,
created_at DATETIME,
PRIMARY KEY (id),
FOREIGN KEY (author) REFERENCES users(id)
);
| true |
335da9560856da82d1ef35927277d70833e793bc
|
SQL
|
wkrzywiec/Library-API
|
/src/main/resources/delete-inserted-user.sql
|
UTF-8
| 157 | 2.546875 | 3 |
[
"Apache-2.0"
] |
permissive
|
DELETE FROM `user_role` WHERE `user_id` = (
SELECT `id`
FROM `user`
WHERE `username` = "wojtek")
;
DELETE FROM `user` WHERE `username` = "wojtek";
| true |
3f0c22a34097efa12fc97b9936e1468dc6e97f5d
|
SQL
|
Marcus-V-Freitas/SQL_Utils
|
/Administração/Scripts Configurações das Bases de Dados.sql
|
WINDOWS-1252
| 2,430 | 3.65625 | 4 |
[
"MIT"
] |
permissive
|
----------------------------------------------------------
-- Script Configuraes Databases
----------------------------------------------------------
SELECT
database_id,
CONVERT(VARCHAR(1000), DB.name) AS dbName,
state_desc,
(SELECT SUM((size*8)/1024) FROM sys.master_files WHERE DB_NAME(database_id) = DB.name AND type_desc = 'rows') AS [Data MB],
(SELECT SUM((size*8)/1024) FROM sys.master_files WHERE DB_NAME(database_id) = DB.name AND type_desc = 'log') AS [Log MB],
page_verify_option_desc AS [page verify option],
recovery_model_desc AS [Recovery model],
-- last backup
ISNULL((SELECT TOP 1
CASE type WHEN 'D' THEN 'Full' WHEN 'I' THEN 'Differential' WHEN 'L' THEN 'Transaction log' END + ' ' +
LTRIM(ISNULL(STR(ABS(DATEDIFF(DAY, GETDATE(),backup_finish_date))) + ' days ago', 'NEVER')) + ' ' +
CONVERT(VARCHAR(20), backup_start_date, 103) + ' ' + CONVERT(VARCHAR(20), backup_start_date, 108) + ' ' +
CONVERT(VARCHAR(20), backup_finish_date, 103) + ' ' + CONVERT(VARCHAR(20), backup_finish_date, 108) +
' (' + CAST(DATEDIFF(second, BK.backup_start_date,
BK.backup_finish_date) AS VARCHAR(4)) + ' '
+ 'seconds)'
FROM msdb..backupset BK WHERE BK.database_name = DB.name ORDER BY backup_set_id DESC),'-') AS [Last backup],
CASE WHEN is_auto_close_on = 1 THEN 'autoclose' ELSE '' END AS [autoclose],
CASE WHEN is_auto_shrink_on = 1 THEN 'autoshrink' ELSE '' END AS [autoshrink],
CASE WHEN is_auto_create_stats_on = 1 THEN 'auto create statistics' ELSE '' END AS [auto create statistics],
CASE WHEN is_auto_update_stats_on = 1 THEN 'auto update statistics' ELSE '' END AS [auto update statistics],
CASE compatibility_level
WHEN 60 THEN '60 (SQL Server 6.0)'
WHEN 65 THEN '65 (SQL Server 6.5)'
WHEN 70 THEN '70 (SQL Server 7.0)'
WHEN 80 THEN '80 (SQL Server 2000)'
WHEN 90 THEN '90 (SQL Server 2005)'
WHEN 100 THEN '100 (SQL Server 2008)'
WHEN 110 THEN '110 (SQL Server 2012)'
WHEN 120 THEN '120 (SQL Server 2014)'
WHEN 130 THEN '130 (SQL Server 2016)'
WHEN 140 THEN '140 (SQL Server 2017)'
WHEN 150 THEN '150 (SQL Server 2019)'
END AS [compatibility level],
user_access_desc AS [User access],
CONVERT(VARCHAR(20), create_date, 103) + ' ' + CONVERT(VARCHAR(20), create_date, 108) AS [Creation date],
CASE WHEN is_fulltext_enabled = 1 THEN 'Fulltext enabled' ELSE '' END AS [fulltext]
FROM sys.databases DB
ORDER BY [Data MB] DESC, dbName, [Last backup] DESC, NAME
| true |
aa9abd28a3487248cc89319969c029f948521982
|
SQL
|
gambo94/mysql_estructura
|
/Pizzeria/script.sql
|
UTF-8
| 2,407 | 3.890625 | 4 |
[] |
no_license
|
DROP DATABASE IF EXISTS pizzeria;
CREATE DATABASE pizzeria CHARACTER SET utf8mb4;
USE pizzeria;
CREATE TABLE provincia (
id_provincia INT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
nombre_prov VARCHAR(20) NOT NULL
);
CREATE TABLE localidad (
id_localidad INT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
nombre_loc VARCHAR(20) NOT NULL,
id_provincia INT UNSIGNED,
FOREIGN KEY (id_provincia) REFERENCES provincia(id_provincia)
);
CREATE TABLE cliente (
id_cliente INT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
nombre_cl VARCHAR(20) NOT NULL,
apellido_cl VARCHAR(20) NOT NULL,
dir VARCHAR(50) NOT NULL,
cp INT NOT NULL,
telefono_cl VARCHAR(9) NOT NULL,
provincia VARCHAR(20) NOT NULL,
localidad INT UNSIGNED NOT NULL,
FOREIGN KEY (localidad) REFERENCES localidad(id_localidad)
);
CREATE TABLE restaurante (
id_rest INT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
dir_rest VARCHAR(50) NOT NULL,
dir_cp INT NOT NULL,
loc_rest VARCHAR(20) NOT NULL,
prov_rest VARCHAR(20) NOT NULL
);
CREATE TABLE empleado (
id_empl INT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
tipo_empl ENUM('cocinero', 'repartidor') NOT NULL,
id_rest INT UNSIGNED NOT NULL,
FOREIGN KEY (id_rest) REFERENCES restaurante(id_rest)
);
CREATE TABLE order_cl (
id_order INT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
fecha_pedido TIMESTAMP NOT NULL,
tipo_order ENUM ('domicilio', 'recoger') NOT NULL,
precio_total int,
id_cl INT UNSIGNED NOT NULL,
id_res INT UNSIGNED NOT NULL,
empl_id INT UNSIGNED,
FOREIGN KEY (empl_id) REFERENCES empleado(id_empl),
FOREIGN KEY (id_res) REFERENCES restaurante(id_rest),
FOREIGN KEY (id_cl) REFERENCES cliente (id_cliente)
);
CREATE TABLE categoria (
cat_id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
nombre_cat VARCHAR(10)
);
CREATE TABLE producto (
prod_id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
nombre_prod VARCHAR(25) NOT NULL,
desc_prod VARCHAR(100) NOT NULL,
img LONGBLOB,
precio_individual FLOAT NOT NULL,
id_cat INT UNSIGNED,
FOREIGN KEY (id_cat) REFERENCES categoria(cat_id)
);
CREATE TABLE order_has_products (
order_prod_id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
order_id INT UNSIGNED,
prod_id INT UNSIGNED,
cantidad INT,
FOREIGN KEY (order_id) REFERENCES order_cl(id_order),
FOREIGN KEY (prod_id) REFERENCES producto(prod_id)
);
| true |
6652284e9cb24fd15feb2105e92521bda8102bfc
|
SQL
|
othmanedendane/Php-LaBonneBouffe
|
/bonnebouffe.sql
|
UTF-8
| 3,046 | 3.390625 | 3 |
[] |
no_license
|
-- phpMyAdmin SQL Dump
-- version 4.9.2
-- https://www.phpmyadmin.net/
--
-- Hôte : 127.0.0.1
-- Généré le : lun. 12 avr. 2021 à 03:58
-- Version du serveur : 10.4.11-MariaDB
-- Version de PHP : 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 */;
--
-- Base de données : `bonnebouffe`
--
-- --------------------------------------------------------
--
-- Structure de la table `admin`
--
CREATE TABLE `admin` (
`login` varchar(100) NOT NULL,
`password` varchar(100) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Déchargement des données de la table `admin`
--
INSERT INTO `admin` (`login`, `password`) VALUES
('admin', '12345');
-- --------------------------------------------------------
--
-- Structure de la table `membre`
--
CREATE TABLE `membre` (
`idmembre` varchar(100) NOT NULL,
`nom` varchar(100) NOT NULL,
`prenom` varchar(100) NOT NULL,
`telephone` varchar(100) NOT NULL,
`adresse` varchar(100) NOT NULL,
`naissance` date NOT NULL,
`login` varchar(100) NOT NULL,
`password` varchar(100) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Déchargement des données de la table `membre`
--
INSERT INTO `membre` (`idmembre`, `nom`, `prenom`, `telephone`, `adresse`, `naissance`, `login`, `password`) VALUES
('denot', 'dendane', 'othmane', '5149432650', '420 copernic laval', '2020-05-01', 'mazgiti', 'ismail'),
('M100', 'dendane', 'othmane', '(514)943-2650', '420 av.Copernic app2 Laval', '1999-07-18', 'othmane', '123'),
('othde', 'othmanil', 'dendane', '(514)9432650', '420 av Copernic', '1999-07-18', 'oth', 'zobal');
-- --------------------------------------------------------
--
-- Structure de la table `recettes`
--
CREATE TABLE `recettes` (
`numero` varchar(100) NOT NULL,
`nom` varchar(100) NOT NULL,
`ingredient` varchar(100) NOT NULL,
`photo` varchar(100) NOT NULL,
`dateinscrite` date NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Déchargement des données de la table `recettes`
--
INSERT INTO `recettes` (`numero`, `nom`, `ingredient`, `photo`, `dateinscrite`) VALUES
('R100', 'Burger', 'Viande + Sauce + Tomate', 'burger.jpg', '2019-10-21'),
('R200', 'Poutine', 'Frites + Sauce + Fromage', 'poutine.jpg', '2019-10-27');
--
-- Index pour les tables déchargées
--
--
-- Index pour la table `admin`
--
ALTER TABLE `admin`
ADD PRIMARY KEY (`login`);
--
-- Index pour la table `membre`
--
ALTER TABLE `membre`
ADD PRIMARY KEY (`idmembre`);
--
-- Index pour la table `recettes`
--
ALTER TABLE `recettes`
ADD PRIMARY KEY (`numero`);
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 |
ad6e8ef31d8b9aff652e26bc737b13f8f370ede3
|
SQL
|
vpoletaev11/avitoParser
|
/init.sql
|
UTF-8
| 289 | 2.671875 | 3 |
[] |
no_license
|
CREATE DATABASE IF NOT EXISTS avitoParser;
USE avitoParser;
CREATE TABLE IF NOT EXISTS link (
PRIMARY KEY(link),
link VARCHAR(500) NOT NULL,
price INT NOT NULL
);
CREATE TABLE IF NOT EXISTS email (
PRIMARY KEY(email),
email VARCHAR(500) NOT NULL,
link VARCHAR(500) NOT NULL
);
| true |
a73306ebb38e68583d1290f27951a31b9f17d7c9
|
SQL
|
peterlegrand/StudentUnion0105
|
/StudentUnion0105/MasterDataScripts/StoredProcedures/ContentTypeIndexGet.sql
|
UTF-8
| 386 | 3.390625 | 3 |
[] |
no_license
|
CREATE PROCEDURE ContentTypeIndexGet (@LanguageId int)
AS
SELECT
dbContentType.Id
, ISNULL(Name, '') Name
, ISNULL(Description,'') Description
, ISNULL(MouseOver,'') MouseOver
, ISNULL(MenuName,'') MenuName
FROM dbContentType
JOIN dbContentTypeLanguage
ON dbContentType.Id = dbContentTypeLanguage.ContentTypeId
WHERE dbContentTypeLanguage.LanguageId = @LanguageId
ORDER BY Name
| true |
67c36a25f87944daf8d629f06870312f1ec8c8c2
|
SQL
|
RayDarar/med-share.db
|
/src/queries/triggers.sql
|
UTF-8
| 573 | 3.125 | 3 |
[
"MIT"
] |
permissive
|
create trigger users_add_trigger
after insert on users
referencing new as new
for each row
begin
insert into users_log(user_id, datetime) values(:new.id, sysdate);
end;
create trigger posts_add_trigger
after insert on posts
referencing new as new
for each row
begin
insert into posts_log(post_id, datetime, action) values(:new.id, sysdate, 'insert');
end;
create trigger posts_update_trigger
after update on posts
referencing new as new
for each row
begin
insert into posts_log(post_id, datetime, action) values(:new.id, sysdate, 'update');
end;
| true |
cc0c918b51086779abc3864c47ffa665cb4096ad
|
SQL
|
maratimaev/job4j
|
/chapter_008/src/main/java/ru/job4j/sql/script.sql
|
UTF-8
| 1,027 | 3.125 | 3 |
[] |
no_license
|
create table users (
id serial primary key,
name varchar(2000)
)
create table roles (
id serial primary key,
role varchar(2000)
)
alter table users add column roles_id int references roles(id);
create table rules (
id serial primary key,
rule varchar(2000)
)
create table items (
id serial primary key,
item varchar(2000),
users_id int references users(id)
)
create table comments (
id serial primary key,
comments_desc varchar(2000),
items_id int references items(id)
)
create table attachs (
id serial primary key,
attach varchar(2000),
items_id int references items(id)
)
create table roles_rules_compose (
id serial primary key,
roles_id int references roles(id),
rules_id int references rules(id)
)
create table categories (
id serial primary key,
category varchar(2000)
)
alter table items add column categories_id int references categories(id);
create table states (
id serial primary key,
state varchar(2000)
)
alter table items add column states_id int references states(id);
| true |
7f4190d5164508545590a34f81735c37014e9122
|
SQL
|
bugybunny/hsr_modules
|
/Db1_Uebungen/src/ch/hsr/modules/db1/w14/db/0_runAllScripts.sql
|
UTF-8
| 1,149 | 3.078125 | 3 |
[] |
no_license
|
\echo \conninfo
\echo
\echo -n 'client encoding: '\encoding
\echo
SET client_min_messages = ERROR;
\set user bankuser
\set password '\'bankpw\''
\set database bank
\set promptvar ''
\prompt 'DROP USER [':user'] and DROP DATABASE [':database'] if existing (\\q or Ctrl-C to abort)?' promptvar
:promptvar
DROP DATABASE if exists :database;
DROP USER if exists :user;
\echo -------------------------------------
\echo passwort for user :user = :password
\echo -------------------------------------
\echo
\prompt 'CREATE USER [':user'] and DATABASE [':database'] (\\q or Ctrl-C to abort)?' promptvar
:promptvar
DROP DATABASE if exists :database;
DROP USER if exists :user;
CREATE USER :user WITH PASSWORD :password;
CREATE DATABASE :database WITH OWNER :user ENCODING 'UTF8';
\c :database :user
-- specify encoding to match your files encoding, usually UTF8
-- valid values are: 'UTF8', 'LATIN1', 'WIN1252'
\encoding 'UTF8'
-- create extensions
\ir 1_extensions.sql
-- create schema
\ir 2_schema.sql
-- insert data in slo-mo or use COPY for speedup
\ir 3_inserts.sql
-- create primary keys, constraints, indexes
\ir 4_constraints.sql
| true |
e9debf17c008919793a2c09d99ea173135a63b1a
|
SQL
|
tamtadam/gherkin_editor
|
/sql/project_template.sql
|
UTF-8
| 284 | 2.859375 | 3 |
[] |
no_license
|
DROP table IF EXISTS project_template;
CREATE TABLE project_template (
Project_templateID int(10) unsigned NOT NULL AUTO_INCREMENT,
ProjectID int(10) NOT NULL,
SentenceTemplateID int(10) NOT NULL,
PRIMARY KEY (Project_templateID)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
| true |
ad0347c7836ab00e7b1748a81a4621c7d6f93b7e
|
SQL
|
fllencina/Programacion-3
|
/producto.sql
|
UTF-8
| 2,555 | 3.015625 | 3 |
[] |
no_license
|
-- phpMyAdmin SQL Dump
-- version 5.1.0
-- https://www.phpmyadmin.net/
--
-- Servidor: 127.0.0.1
-- Tiempo de generación: 19-04-2021 a las 03:03:04
-- Versión del servidor: 10.4.18-MariaDB
-- Versión de PHP: 8.0.3
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Base de datos: `clase5`
--
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `producto`
--
CREATE TABLE `producto` (
`id` int(11) NOT NULL,
`codBarras` varchar(6) COLLATE utf8_spanish2_ci NOT NULL,
`nombre` varchar(20) COLLATE utf8_spanish2_ci NOT NULL,
`tipo` varchar(20) COLLATE utf8_spanish2_ci NOT NULL,
`stock` int(11) NOT NULL,
`precio` float NOT NULL,
`fecha_de_creacion` date NOT NULL,
`fecha_de_modificacion` date NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_spanish2_ci;
--
-- Volcado de datos para la tabla `producto`
--
INSERT INTO `producto` (`id`, `codBarras`, `nombre`, `tipo`, `stock`, `precio`, `fecha_de_creacion`, `fecha_de_modificacion`) VALUES
(1, '779003', 'Westmacott', 'liquido', 33, 15.87, '2021-02-09', '2020-09-26'),
(2, '779003', 'Spirit', 'solido', 45, 66.6, '2020-09-18', '2020-04-14'),
(3, '779003', 'Newgrosh', 'polvo', 0, 68.19, '2020-11-29', '2020-02-11'),
(4, '779003', 'McNickle', 'polvo', 0, 53.51, '2020-11-28', '2020-04-17'),
(5, '779003', 'Hudd', 'solido', 68, 66.6, '2020-12-19', '2020-06-19'),
(6, '779003', 'Schrader', 'polvo', 0, 96.54, '2020-08-02', '2020-04-18'),
(7, '779003', 'Bachellier', 'solido', 59, 66.6, '2021-01-30', '2020-06-07'),
(8, '779003', 'Fleming', 'solido', 38, 66.6, '2020-10-26', '2020-10-03'),
(9, '779003', 'Hurry', 'solido', 44, 66.6, '2020-07-04', '2020-05-30'),
(11, '123456', 'chocolate', 'solido', 0, 66.6, '2021-04-18', '2021-04-18');
--
-- Índices para tablas volcadas
--
--
-- Indices de la tabla `producto`
--
ALTER TABLE `producto`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT de las tablas volcadas
--
--
-- AUTO_INCREMENT de la tabla `producto`
--
ALTER TABLE `producto`
MODIFY `id` int(11) 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 |
dcb172f17e940083099a3ebd32df54cc1ad3cc5a
|
SQL
|
doitrightway/parking-ticketing-system
|
/sql/create.sql
|
UTF-8
| 2,168 | 3.796875 | 4 |
[] |
no_license
|
create table users (
uid varchar(10) primary key,
name varchar(20),
phone varchar(10),
class integer not null);
create table wallet (
uid varchar(10) not null,
amount numeric(8,2) check (amount >=0),
foreign key (uid) references users
on delete cascade,
primary key (uid)
);
create table password (
uid varchar(10) not null,
password varchar(20) not null,
foreign key (uid) references users
on delete cascade,
primary key (uid)
);
create table car (
cid varchar(10) not null,
password varchar(20),
primary key (cid)
);
create table owns (
cid varchar(10) not null,
uid varchar(10) not null,
foreign key (uid) references users on delete cascade,
foreign key (cid) references car on delete cascade,
primary key (uid, cid)
);
create table payer (
cid varchar(10) not null,
uid varchar(10) not null,
start_time timestamp not null default now(),
last_payed timestamp not null default now()+interval '-1' hour,
foreign key (cid) references car on delete restrict,
foreign key (uid) references users on delete restrict,
primary key (cid)
);
create table parking_mall (
pid varchar(10) primary key,
uid varchar(10),
latitude numeric(13,10) not null,
longitude numeric(13,10) not null,
price numeric(6,2) not null,
name varchar(20),
is_street varchar(2),
foreign key (uid) references users
on delete cascade
);
create table notifications(
person_uid varchar(10),
police_uid varchar(10),
cid varchar(10),
balance numeric(8,2),
type varchar(2),
time timestamp default now(),
read integer,
foreign key (person_uid) references users(uid),
foreign key (police_uid) references users(uid)
);
create table parking_floor (
pid varchar(10),
floor_number varchar(10),
total_space numeric(10),
free_space numeric(10),
primary key (pid, floor_number),
foreign key (pid) references parking_mall
on delete cascade);
create table parks (
cid varchar(10) not null,
pid varchar(10) not null,
floor_number varchar(10),
entry_time timestamp not null default now(),
primary key (cid),
foreign key (cid) references car on delete restrict,
foreign key (pid, floor_number) references parking_floor on delete restrict
);
| true |
2d8dbfc815601efd8865b75341b808ed0fc6df11
|
SQL
|
paulovieira/h2optimum-app
|
/database/1_tables/1040_t_triggers.sql
|
UTF-8
| 1,385 | 3.453125 | 3 |
[] |
no_license
|
DO $$
DECLARE
patch_exists int := _v.register_patch('create_table_triggers', '');
BEGIN
IF patch_exists THEN
RETURN;
END IF;
/*** BEGIN CODE FOR CHANGES ***/
-- note: these triggers are NOT related to database triggers
create table t_triggers(
id serial primary key,
user_id int references t_users(id) on delete set null,
installation_id int references t_installations(id) on delete set null,
device_id int references t_devices(id) on delete set null,
trigger_type_code text references t_trigger_types(code) on delete set null,
trigger_config jsonb default '{}',
action_type_code text references t_action_types(code) on delete set null,
action_config jsonb default '{}',
created_at timestamptz not null default now(), -- TODO: we should be recording all changes to a given trigger, to show the history
active bool default true
);
/*** END CODE FOR CHANGES ***/
END;
$$;
DO $$
DECLARE
patch_exists int := _v.register_patch('insert_initial_triggers', '');
BEGIN
IF patch_exists THEN
RETURN;
END IF;
/*** BEGIN CODE FOR CHANGES ***/
insert into t_triggers(user_id, installation_id, device_id, trigger_type_code, trigger_config, action_type_code, action_config) values
(1, 1, 1, 'trigger_water_potential', '{ "abc": "Demo" }', 'action_email', '{ "def": "Demo" }');
/*** END CODE FOR CHANGES ***/
END;
$$;
| true |
8a762d09d49dd8e8ced7e9eeee282a9aac33167e
|
SQL
|
dafthor/MinTic_G2
|
/SQL/minticg2.sql
|
UTF-8
| 1,863 | 2.984375 | 3 |
[] |
no_license
|
-- phpMyAdmin SQL Dump
-- version 5.1.1
-- https://www.phpmyadmin.net/
--
-- Servidor: 127.0.0.1
-- Tiempo de generación: 06-10-2021 a las 03:41:09
-- Versión del servidor: 8.0.26
-- Versión de PHP: 8.0.10
SET
SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET
time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Base de datos: `minticg2`
--
CREATE DATABASE IF NOT EXISTS `minticg2`;
USE `minticg2`;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `usuarios`
--
CREATE TABLE `usuarios` (
`id` int NOT NULL,
`username` varchar(45) NOT NULL,
`correo` varchar(45) DEFAULT NULL,
`contrasena` varchar(45) DEFAULT NULL
) ENGINE = InnoDB;
--
-- Volcado de datos para la tabla `usuarios`
--
INSERT INTO
`usuarios` (`id`, `username`, `correo`, `contrasena`)
VALUES
(1, 'Carlos1', 'carlos@gmail.com', 'Segura123'),
(2, 'Carlos1', 'carlos@gmail.com', 'Segura123'),
(3, 'Mateo', 'mateo@hotmail.com', 'Segura024'),
(4, 'Camilo3', 'camilo@hotmail.com', 'Segura357'),
(5, 'Cesar4', 'cesar@gmail.com', 'Segura468'),
(6, 'Pipe', 'pipe@hotmail.com', 'Segura975');
--
-- Índices para tablas volcadas
--
--
-- Indices de la tabla `usuarios`
--
ALTER TABLE
`usuarios`
ADD
PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT de las tablas volcadas
--
--
-- AUTO_INCREMENT de la tabla `usuarios`
--
ALTER TABLE
`usuarios`
MODIFY
`id` int NOT NULL AUTO_INCREMENT,
AUTO_INCREMENT = 7;
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
| true |
b19468b5105894ecec1060bab71a65ecf23e0b25
|
SQL
|
matheuslipk/agencia_turismo
|
/agencia_turismo.sql
|
UTF-8
| 4,921 | 3.09375 | 3 |
[] |
no_license
|
-- phpMyAdmin SQL Dump
-- version 4.7.4
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: 02-Abr-2018 às 22:35
-- Versão do servidor: 10.1.28-MariaDB
-- PHP Version: 7.1.11
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Database: `agencia_turismo`
--
-- --------------------------------------------------------
--
-- Estrutura da tabela `arquivo`
--
CREATE TABLE `arquivo` (
`idArquivo` varchar(50) NOT NULL,
`link` varchar(250) NOT NULL,
`descricao` varchar(200) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Estrutura da tabela `arquivo_produto`
--
CREATE TABLE `arquivo_produto` (
`idProduto` int(11) NOT NULL,
`idArquivo` varchar(50) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Estrutura da tabela `cliente`
--
CREATE TABLE `cliente` (
`idCliente` int(11) NOT NULL,
`nome` varchar(100) NOT NULL,
`email` varchar(100) NOT NULL,
`senha` varchar(40) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Estrutura da tabela `produto`
--
CREATE TABLE `produto` (
`idProduto` int(11) NOT NULL,
`idTipoProduto` int(11) NOT NULL,
`nome` varchar(100) NOT NULL,
`quantDisponivel` int(11) NOT NULL,
`preco` double(6,2) NOT NULL,
`descricao` varchar(500) NOT NULL,
`incluso` varchar(500) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Extraindo dados da tabela `produto`
--
INSERT INTO `produto` (`idProduto`, `idTipoProduto`, `nome`, `quantDisponivel`, `preco`, `descricao`, `incluso`) VALUES
(2, 1, 'Canoa Quebrada', 20, 199.00, 'aaaaaaaaaaaaaaaaaaaaáaaaaaaaaaa', '# ÔNIBUS COM AR, SOM, BANHEIRO;\r\n# PASSEIO A SETE CIDADES;\r\n# GUIA TURÍSTICO;\r\n# ALMOÇO (NÃO INCLUSO)\r\n# HOSPEDAGEM EM HOTEL OU HOSTEL (A SER INFORMADO PELO CLIENTE NA COMPRA DO PACOTE, COM VALORES FIFERENCIADOS);\r\n# PASSEIO AO PORTO DAS BARCAS(PARNAÍBA-PI), CONHECENDO A CIDADE QUE É PORTA DE ENTRADA PARA O DELTA.\r\n# PASSEIO AO DELTA DO PARNAÍBA (LANCHE DE FRUTAS, ALMOÇO, CARANGUEJADA).'),
(3, 1, 'Porto de Galinhas', 20, 199.90, 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', '# ÔNIBUS COM AR, SOM, BANHEIRO;\r\n# PASSEIO NA CIDADE DE PEDRO II;\r\n# PASSEIO AO MORRO DO GRITADOR;\r\n# PASSEIO AO SÍTIO DO BURITIZINHO;\r\n# PASSEIO AO MUSEU DA ROÇA;\r\n# ALMOÇO (NÃO INCLUSO).');
-- --------------------------------------------------------
--
-- Estrutura da tabela `tipo_produto`
--
CREATE TABLE `tipo_produto` (
`idTipoProduro` int(11) NOT NULL,
`nome` varchar(50) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Extraindo dados da tabela `tipo_produto`
--
INSERT INTO `tipo_produto` (`idTipoProduro`, `nome`) VALUES
(1, 'Pacote de viagens'),
(2, 'Passagens');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `arquivo`
--
ALTER TABLE `arquivo`
ADD PRIMARY KEY (`idArquivo`);
--
-- Indexes for table `arquivo_produto`
--
ALTER TABLE `arquivo_produto`
ADD PRIMARY KEY (`idProduto`,`idArquivo`),
ADD KEY `idArquivo` (`idArquivo`);
--
-- Indexes for table `cliente`
--
ALTER TABLE `cliente`
ADD PRIMARY KEY (`idCliente`);
--
-- Indexes for table `produto`
--
ALTER TABLE `produto`
ADD PRIMARY KEY (`idProduto`),
ADD KEY `idTipoProduto` (`idTipoProduto`);
--
-- Indexes for table `tipo_produto`
--
ALTER TABLE `tipo_produto`
ADD PRIMARY KEY (`idTipoProduro`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `cliente`
--
ALTER TABLE `cliente`
MODIFY `idCliente` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `produto`
--
ALTER TABLE `produto`
MODIFY `idProduto` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
--
-- AUTO_INCREMENT for table `tipo_produto`
--
ALTER TABLE `tipo_produto`
MODIFY `idTipoProduro` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- Constraints for dumped tables
--
--
-- Limitadores para a tabela `arquivo_produto`
--
ALTER TABLE `arquivo_produto`
ADD CONSTRAINT `arquivo_produto_ibfk_1` FOREIGN KEY (`idProduto`) REFERENCES `produto` (`idProduto`),
ADD CONSTRAINT `arquivo_produto_ibfk_2` FOREIGN KEY (`idArquivo`) REFERENCES `arquivo` (`idArquivo`);
--
-- Limitadores para a tabela `produto`
--
ALTER TABLE `produto`
ADD CONSTRAINT `produto_ibfk_1` FOREIGN KEY (`idTipoProduto`) REFERENCES `tipo_produto` (`idTipoProduro`);
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 |
ad9356fccba776dad0077fe2cff529e950443dd3
|
SQL
|
tectronics/blooddonorsdocuments
|
/ blooddonorsdocuments/database/datadump_aug_2012.sql
|
UTF-8
| 32,097 | 2.703125 | 3 |
[] |
no_license
|
-- MySQL Administrator dump 1.4
--
-- ------------------------------------------------------
-- Server version 5.5.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 blood_donation
--
CREATE DATABASE IF NOT EXISTS blood_donation;
USE blood_donation;
--
-- Definition of table `blood_donationrecord`
--
DROP TABLE IF EXISTS `blood_donationrecord`;
CREATE TABLE `blood_donationrecord` (
`blood_donationrecord_uuid` varchar(45) NOT NULL,
`patient_name` varchar(45) DEFAULT NULL,
`donation_place` varchar(45) DEFAULT NULL,
`hospital_name` varchar(45) DEFAULT NULL,
`blood_donationdate` datetime DEFAULT NULL,
`creation_date` datetime NOT NULL,
`last_updated` datetime NOT NULL,
`donor_uuid` varchar(45) NOT NULL,
PRIMARY KEY (`blood_donationrecord_uuid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `blood_donationrecord`
--
/*!40000 ALTER TABLE `blood_donationrecord` DISABLE KEYS */;
INSERT INTO `blood_donationrecord` (`blood_donationrecord_uuid`,`patient_name`,`donation_place`,`hospital_name`,`blood_donationdate`,`creation_date`,`last_updated`,`donor_uuid`) VALUES
('40288182389a22c101389a3750510000','lalu','delhi','AIIMS','2012-01-01 00:00:00','2012-07-18 18:41:52','2012-08-06 23:09:19','4028945e3850bcd2013850e1aae50027'),
('40288182390f5d5f01390f5ed1e90000','chalu','Delhi','AIIMA','2012-08-01 00:00:00','2012-08-10 12:40:36','2012-08-10 12:40:36','4028945e3850bcd2013850e1aae50027'),
('40288182390fc03301390fc3300b0000','chalu','Delhi','AIIMA','2012-08-28 00:00:00','2012-08-10 14:30:13','2012-08-10 14:30:13','4028945e3850bcd2013850e1aae50027'),
('40288182390fc03301390fc3a5bc0001','chalu','Delhi','AIIMA','2012-08-28 00:00:00','2012-08-10 14:30:43','2012-08-10 14:30:43','4028945e3850bcd2013850e1aae50027'),
('4028945e38fb5d880138fb5f73b60000','q','q','w','2012-08-06 00:00:00','2012-08-06 15:28:53','2012-08-06 15:28:53','4028945e3850bcd2013850e1aae50027'),
('4028945e38fb5d880138fba7fc960001','q','a','a','2012-08-26 00:00:00','2012-08-06 16:48:06','2012-08-06 16:48:06','4028945e3850bcd2013850e1aae50027');
/*!40000 ALTER TABLE `blood_donationrecord` ENABLE KEYS */;
--
-- Definition of table `blood_request`
--
DROP TABLE IF EXISTS `blood_request`;
CREATE TABLE `blood_request` (
`uuid` varchar(45) NOT NULL,
`name` varchar(60) NOT NULL,
`age` int(10) NOT NULL,
`mobile_number` varchar(20) NOT NULL,
`secondary_contact` varchar(20) DEFAULT NULL,
`gender` char(1) CHARACTER SET latin1 NOT NULL,
`blood_group` varchar(20) NOT NULL,
`unit_needed` int(3) NOT NULL,
`hospital_name` varchar(40) NOT NULL,
`state` varchar(40) NOT NULL,
`district` varchar(40) DEFAULT NULL,
`location` varchar(50) NOT NULL,
`postal_code` int(10) DEFAULT NULL,
`creation_date` datetime NOT NULL,
`last_updated` datetime NOT NULL,
`patient_name` varchar(60) NOT NULL,
`purpose` varchar(100) NOT NULL,
`verification_flag` tinyint(1) NOT NULL,
PRIMARY KEY (`uuid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `blood_request`
--
/*!40000 ALTER TABLE `blood_request` DISABLE KEYS */;
INSERT INTO `blood_request` (`uuid`,`name`,`age`,`mobile_number`,`secondary_contact`,`gender`,`blood_group`,`unit_needed`,`hospital_name`,`state`,`district`,`location`,`postal_code`,`creation_date`,`last_updated`,`patient_name`,`purpose`,`verification_flag`) VALUES
('1','Umesh',25,'9971100563','9876543245','M','B-',2,'ulla','DL','East Delhi','Dau',201012,'2012-08-10 00:51:46','2012-08-10 01:13:47','kuka','hello ji i need this for sure ',1),
('2','Umesh',56,'9945678765','9876543245','M','A+',2,'taaya mal','GJ','Panchmahals','daalu',123456,'2012-08-10 01:32:16','2012-08-10 01:32:16','challu','i need it for sure',1),
('3','paalu',25,'9945678765','9876543245','M','A+',2,'taaya mal','KL','Idukki','daalu',201012,'2012-08-11 21:40:08','2012-08-12 16:38:50','kuka','hello ',1),
('4','Abc',25,'5205154658','5205154658','M','A+',2,'Apollo','GJ','Patan','adsfas',302458,'2012-08-14 12:22:41','2012-08-17 21:12:51','aaa','adsfasdf',1),
('5','paalu',56,'9945678765','9876543245','M','A+',21,'taaya mal','AR','Alog( West Siang )','daalu',201012,'2012-08-17 21:19:01','2012-08-18 12:18:20','kuka','humko maagta hai',1);
/*!40000 ALTER TABLE `blood_request` ENABLE KEYS */;
--
-- Definition of table `donor_credential`
--
DROP TABLE IF EXISTS `donor_credential`;
CREATE TABLE `donor_credential` (
`uuid` varchar(45) NOT NULL,
`donor_email` varchar(45) NOT NULL,
`donor_password` varchar(45) DEFAULT NULL,
`donor_id` varchar(45) NOT NULL,
`creation_date` datetime NOT NULL,
`last_updated` datetime NOT NULL,
PRIMARY KEY (`uuid`),
UNIQUE KEY `donor_email` (`donor_email`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `donor_credential`
--
/*!40000 ALTER TABLE `donor_credential` DISABLE KEYS */;
INSERT INTO `donor_credential` (`uuid`,`donor_email`,`donor_password`,`donor_id`,`creation_date`,`last_updated`) VALUES
('40288182389a861f01389a95223a0001','hulla@hulla.com','PhBmMPnsJ9o=','40288182389a861f01389a9522290000','2012-07-18 20:24:21','2012-07-18 20:24:21'),
('4028945e3850bcd2013850d56ad80001','abc@abc.com','PhBmMPnsJ9o=','4028945e3850bcd2013850d56ab20000','2012-07-04 12:42:40','2012-07-04 12:42:40'),
('4028945e3850bcd2013850d757f6000a','abc1@abc.com','PhBmMPnsJ9o=','4028945e3850bcd2013850d757f40009','2012-07-04 12:44:46','2012-07-04 12:44:46'),
('4028945e3850bcd2013850d9284a0010','abc2@abc.com','PhBmMPnsJ9o=','4028945e3850bcd2013850d9284a000f','2012-07-04 12:46:45','2012-07-04 12:46:45'),
('4028945e3850bcd2013850d9c3830013','abc3@abc.com','PhBmMPnsJ9o=','4028945e3850bcd2013850d9c3820012','2012-07-04 12:47:24','2012-07-04 12:47:24'),
('4028945e3850bcd2013850da7d220016','abc4@abc.com','PhBmMPnsJ9o=','4028945e3850bcd2013850da7d200015','2012-07-04 12:48:12','2012-07-04 12:48:12'),
('4028945e3850bcd2013850de4b9c0019','abc5@abc.com','PhBmMPnsJ9o=','4028945e3850bcd2013850de4b9b0018','2012-07-04 12:52:21','2012-07-04 12:52:21'),
('4028945e3850bcd2013850dee445001c','abc6@abc.com','PhBmMPnsJ9o=','4028945e3850bcd2013850dee444001b','2012-07-04 12:53:01','2012-07-04 12:53:01'),
('4028945e3850bcd2013850dfa3f0001f','abc7@abc.com','PhBmMPnsJ9o=','4028945e3850bcd2013850dfa3f0001e','2012-07-04 12:53:50','2012-07-04 12:53:50'),
('4028945e3850bcd2013850e05f5e0022','ab8@abc.com','PhBmMPnsJ9o=','4028945e3850bcd2013850e05f5d0021','2012-07-04 12:54:38','2012-07-04 12:54:38'),
('4028945e3850bcd2013850e0ee5d0025','abc8@abc.com','PhBmMPnsJ9o=','4028945e3850bcd2013850e0ee5c0024','2012-07-04 12:55:14','2012-07-04 12:55:14'),
('4028945e3850bcd2013850e1aae60028','abc9@abc.com','PhBmMPnsJ9o=','4028945e3850bcd2013850e1aae50027','2012-07-04 12:56:02','2012-07-04 12:56:02'),
('4028945e3850bcd2013850e24abd002b','abc10@abc.com','PhBmMPnsJ9o=','4028945e3850bcd2013850e24abb002a','2012-07-04 12:56:43','2012-07-04 12:56:43'),
('f0440355365a7e4401365a7f09b40001','durgapal.mca@gmail.com',NULL,'f0440355365a7e4401365a7f09a10000','2012-03-28 23:38:56','2012-03-28 23:38:56');
/*!40000 ALTER TABLE `donor_credential` ENABLE KEYS */;
--
-- Definition of table `donor_preferences`
--
DROP TABLE IF EXISTS `donor_preferences`;
CREATE TABLE `donor_preferences` (
`donor_id` varchar(45) NOT NULL,
`sms_alert` char(1) DEFAULT NULL,
`hide_phonenumbers` char(1) DEFAULT NULL,
`prefered_contact_time` varchar(45) NOT NULL,
`donor_availability` char(1) DEFAULT NULL,
`creation_date` datetime NOT NULL,
`last_updated` datetime NOT NULL,
PRIMARY KEY (`donor_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `donor_preferences`
--
/*!40000 ALTER TABLE `donor_preferences` DISABLE KEYS */;
INSERT INTO `donor_preferences` (`donor_id`,`sms_alert`,`hide_phonenumbers`,`prefered_contact_time`,`donor_availability`,`creation_date`,`last_updated`) VALUES
('40288182389a861f01389a9522290000',NULL,'s','OnlyDay','y','2012-07-18 20:24:21','2012-07-18 20:24:21'),
('4028945e3850bcd2013850d56ab20000',NULL,'s','AnyTime','y','2012-07-04 12:42:40','2012-07-04 12:42:40'),
('4028945e3850bcd2013850d757f40009',NULL,'h','AnyTime','y','2012-07-04 12:44:46','2012-07-04 12:44:46'),
('4028945e3850bcd2013850d9284a000f',NULL,'h','AnyTime','y','2012-07-04 12:46:45','2012-07-04 12:46:45'),
('4028945e3850bcd2013850d9c3820012',NULL,'h','AnyTime','y','2012-07-04 12:47:24','2012-07-04 12:47:24'),
('4028945e3850bcd2013850da7d200015',NULL,'h','AnyTime','y','2012-07-04 12:48:12','2012-07-04 12:48:12'),
('4028945e3850bcd2013850de4b9b0018',NULL,'s','AnyTime','y','2012-07-04 12:52:21','2012-07-04 12:52:21'),
('4028945e3850bcd2013850dee444001b',NULL,'s','AnyTime','y','2012-07-04 12:53:01','2012-07-04 12:53:01'),
('4028945e3850bcd2013850dfa3f0001e',NULL,'s','AnyTime','y','2012-07-04 12:53:50','2012-07-04 12:53:50'),
('4028945e3850bcd2013850e05f5d0021',NULL,'s','AnyTime','y','2012-07-04 12:54:38','2012-07-04 12:54:38'),
('4028945e3850bcd2013850e0ee5c0024',NULL,'s','AnyTime','y','2012-07-04 12:55:14','2012-07-04 12:55:14'),
('4028945e3850bcd2013850e1aae50027',NULL,'s','AnyTime','y','2012-07-04 12:56:02','2012-07-04 12:56:02'),
('4028945e3850bcd2013850e24abb002a',NULL,'s','AnyTime','y','2012-07-04 12:56:43','2012-07-04 12:56:43'),
('f044030b364b125a01364b1bd4220000',NULL,'h','OnlyDay','y','2012-03-25 23:56:16','2012-03-25 23:56:16'),
('f0440355365a763901365a77a30c0000',NULL,'s','OnlyDay','y','2012-03-28 23:30:51','2012-03-28 23:30:51'),
('f0440355365a7d1b01365a7dcf330000',NULL,'h','OnlyDay','y','2012-03-28 23:37:36','2012-03-28 23:37:36'),
('f0440355365a7e4401365a7f09a10000',NULL,'s','OnlyDay','y','2012-03-28 23:38:56','2012-03-28 23:38:56'),
('f044041e3645dee8013645e019270000',NULL,'h','OnlyDay','y','2012-03-24 23:32:55','2012-03-24 23:32:55'),
('f0440486364f87d601364f8869e40000',NULL,'s','OnlyDay','y','2012-03-26 20:33:21','2012-03-26 20:33:21');
/*!40000 ALTER TABLE `donor_preferences` ENABLE KEYS */;
--
-- Definition of table `donor_profile`
--
DROP TABLE IF EXISTS `donor_profile`;
CREATE TABLE `donor_profile` (
`donor_uuid` varchar(45) NOT NULL,
`name` varchar(45) DEFAULT NULL,
`date_of_birth` datetime DEFAULT NULL,
`gender` varchar(45) CHARACTER SET latin1 DEFAULT NULL,
`weight` int(10) unsigned DEFAULT NULL,
`email` varchar(45) NOT NULL,
`secondary_contact_number` varchar(20) DEFAULT NULL,
`state` varchar(40) NOT NULL,
`location` varchar(40) DEFAULT NULL,
`blood_group` varchar(20) NOT NULL,
`district` varchar(40) NOT NULL,
`postalcode` varchar(20) DEFAULT NULL,
`mobile` varchar(20) NOT NULL,
`creation_date` datetime NOT NULL,
`last_updated` datetime DEFAULT NULL,
`last_donated` datetime NOT NULL,
`last_login` datetime DEFAULT NULL,
`oauth` tinyint(1) DEFAULT NULL,
`activated_flag` tinyint(1) NOT NULL,
`last_sms_date` datetime DEFAULT NULL,
`last_email_date` datetime DEFAULT NULL,
PRIMARY KEY (`donor_uuid`),
UNIQUE KEY `email` (`email`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `donor_profile`
--
/*!40000 ALTER TABLE `donor_profile` DISABLE KEYS */;
INSERT INTO `donor_profile` (`donor_uuid`,`name`,`date_of_birth`,`gender`,`weight`,`email`,`secondary_contact_number`,`state`,`location`,`blood_group`,`district`,`postalcode`,`mobile`,`creation_date`,`last_updated`,`last_donated`,`last_login`,`oauth`,`activated_flag`,`last_sms_date`,`last_email_date`) VALUES
('40288182389a861f01389a9522290000','Hulla','1980-05-06 00:00:00','Male',67,'hulla@hulla.com','9971100563','KL','alomora','B-','Ernakulam','201012','9971100563','2012-07-18 20:24:21','2012-07-18 20:24:21','1970-01-01 05:30:00','2012-07-18 20:24:21',0,1,'1970-01-01 05:30:00','1970-01-01 05:30:00'),
('4028945e3850bcd2013850d56ab20000','Umesh','1980-07-05 00:00:00','Male',67,'abc@abc.com','9971100563','UK','alomora','B-','Almora','201012','9971100563','2012-07-04 12:42:40','2012-07-04 12:42:40','1970-01-01 05:30:00','2012-07-04 12:42:40',0,1,'1970-01-01 05:30:00','2012-08-18 14:06:18'),
('4028945e3850bcd2013850d757f40009','Umesh','1980-07-05 00:00:00','Male',67,'abc1@abc.com','9971100563','UK','alomora','B-','Almora','201012','9971100563','2012-07-04 12:44:46','2012-07-04 12:44:46','1970-01-01 05:30:00','2012-07-04 12:44:46',0,1,'1970-01-01 05:30:00','2012-07-04 16:56:08'),
('4028945e3850bcd2013850d9284a000f','Umesh','1980-07-05 00:00:00','Male',67,'abc2@abc.com','9971100563','UK','alomora','B-','Almora','201012','9971100563','2012-07-04 12:46:45','2012-07-04 12:46:45','1970-01-01 05:30:00','2012-07-04 12:46:45',0,1,'1970-01-01 05:30:00','2012-07-04 15:06:16'),
('4028945e3850bcd2013850d9c3820012','Umesh','1980-07-05 00:00:00','Male',67,'abc3@abc.com','9971100563','UK','alomora','B-','Almora','201012','9971100563','2012-07-04 12:47:24','2012-07-04 12:47:24','1970-01-01 05:30:00','2012-07-04 12:47:24',0,1,'1970-01-01 05:30:00','2011-07-18 21:56:30'),
('4028945e3850bcd2013850da7d200015','Umesh','1980-07-05 00:00:00','Male',67,'abc4@abc.com','9971100563','UK','alomora','B-','Almora','201012','9971100563','2012-07-04 12:48:12','2012-07-04 12:48:12','1970-01-01 05:30:00','2012-07-04 12:48:12',0,1,'1970-01-01 05:30:00','2011-07-04 16:56:24'),
('4028945e3850bcd2013850de4b9b0018','Umesh','1980-07-05 00:00:00','Male',67,'abc5@abc.com','9971100563','UK','alomora','B-','Almora','201012','9971100563','2012-07-04 12:52:21','2012-07-04 12:52:21','1970-01-01 05:30:00','2012-07-04 12:52:21',0,1,'1970-01-01 05:30:00','2012-07-04 15:03:42'),
('4028945e3850bcd2013850dee444001b','Umesh','1980-07-05 00:00:00','Male',67,'abc6@abc.com','9971100563','UK','alomora','B-','Almora','201012','9971100563','2012-07-04 12:53:01','2012-07-04 12:53:01','1970-01-01 05:30:00','2012-07-04 12:53:01',0,1,'1970-01-01 05:30:00','2011-07-04 14:52:31'),
('4028945e3850bcd2013850dfa3f0001e','Umesh','1980-07-05 00:00:00','Male',67,'abc7@abc.com','9971100563','UK','alomora','B-','Almora','201012','9971100563','2012-07-04 12:53:50','2012-07-04 12:53:50','1970-01-01 05:30:00','2012-07-04 12:53:50',0,1,'1970-01-01 05:30:00','2011-07-04 14:52:31'),
('4028945e3850bcd2013850e05f5d0021','Umesh','1980-07-05 00:00:00','Male',67,'ab8@abc.com','9971100563','UK','alomora','B-','Almora','201012','9971100563','2012-07-04 12:54:38','2012-07-04 12:54:38','1970-01-01 05:30:00','2012-07-04 12:54:38',0,1,'1970-01-01 05:30:00','2012-07-04 15:03:42'),
('4028945e3850bcd2013850e0ee5c0024','Umesh','1980-07-05 00:00:00','Male',67,'abc8@abc.com','9971100563','UK','alomora','B-','Almora','201012','9971100563','2012-07-04 12:55:14','2012-07-04 12:55:14','1970-01-01 05:30:00','2012-07-04 12:55:14',0,1,'1970-01-01 05:30:00','2011-07-04 14:52:31'),
('4028945e3850bcd2013850e1aae50027','Umesh','1980-06-05 00:00:00','Male',67,'abc9@abc.com','9971100563','UK','alomora','B-','Almora','201012','9971100563','2012-07-04 12:56:02','2012-07-04 12:56:02','1970-01-01 05:30:00','2012-07-04 12:56:02',0,1,'1970-01-01 05:30:00','2012-07-04 18:49:34'),
('4028945e3850bcd2013850e24abb002a','Umesh','1980-07-05 00:00:00','Male',67,'abc10@abc.com','9971100563','UK','alomora','B-','Almora','201012','9971100563','2012-07-04 12:56:43','2012-07-04 12:56:43','1970-01-01 05:30:00','2012-07-04 12:56:43',0,1,'1970-01-01 05:30:00','2012-07-04 15:06:50'),
('f0440355365a7e4401365a7f09a10000','himanshu durgapal','1986-03-22 00:00:00','Male',68,'durgapal.mca@gmail.com','8777787878','UK','almora','B-','Almora','201012','97171741830','2012-03-28 23:38:56','2012-03-28 23:38:56','1970-01-01 05:30:00','2012-03-28 23:38:56',1,1,'1970-01-01 05:30:00','2012-07-04 15:08:26');
/*!40000 ALTER TABLE `donor_profile` ENABLE KEYS */;
--
-- Definition of table `donor_roles`
--
DROP TABLE IF EXISTS `donor_roles`;
CREATE TABLE `donor_roles` (
`donor_id` varchar(45) CHARACTER SET latin1 NOT NULL,
`donor_role` varchar(45) CHARACTER SET latin1 NOT NULL,
`creation_date` datetime NOT NULL,
`last_updated` datetime NOT NULL,
`user_enabled` tinyint(1) DEFAULT NULL COMMENT '0 for false\r\nand 1\nfor true',
`account_expired` tinyint(1) DEFAULT NULL COMMENT '0 for\nfalse\r\nand 1 for true',
`credential_expired` tinyint(1) DEFAULT NULL COMMENT '0 for\nfalse\r\nand 1 for true',
`account_locked` tinyint(1) DEFAULT NULL COMMENT '0 for false\r\nand\n1 for true',
PRIMARY KEY (`donor_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `donor_roles`
--
/*!40000 ALTER TABLE `donor_roles` DISABLE KEYS */;
INSERT INTO `donor_roles` (`donor_id`,`donor_role`,`creation_date`,`last_updated`,`user_enabled`,`account_expired`,`credential_expired`,`account_locked`) VALUES
('40288182389a861f01389a9522290000','ROLE_USER','2012-07-18 20:24:21','2012-07-18 20:24:21',1,1,1,1),
('4028945e3850bcd2013850d56ab20000','ROLE_USER','2012-07-04 12:42:40','2012-07-04 12:42:40',1,1,1,1),
('4028945e3850bcd2013850d757f40009','ROLE_USER','2012-07-04 12:44:46','2012-07-04 12:44:46',1,1,1,1),
('4028945e3850bcd2013850d9284a000f','ROLE_USER','2012-07-04 12:46:45','2012-07-04 12:46:45',1,1,1,1),
('4028945e3850bcd2013850d9c3820012','ROLE_USER','2012-07-04 12:47:24','2012-07-04 12:47:24',1,1,1,1),
('4028945e3850bcd2013850da7d200015','ROLE_USER','2012-07-04 12:48:12','2012-07-04 12:48:12',1,1,1,1),
('4028945e3850bcd2013850de4b9b0018','ROLE_USER','2012-07-04 12:52:21','2012-07-04 12:52:21',1,1,1,1),
('4028945e3850bcd2013850dee444001b','ROLE_USER','2012-07-04 12:53:01','2012-07-04 12:53:01',1,1,1,1),
('4028945e3850bcd2013850dfa3f0001e','ROLE_USER','2012-07-04 12:53:50','2012-07-04 12:53:50',1,1,1,1),
('4028945e3850bcd2013850e05f5d0021','ROLE_USER','2012-07-04 12:54:38','2012-07-04 12:54:38',1,1,1,1),
('4028945e3850bcd2013850e0ee5c0024','ROLE_USER','2012-07-04 12:55:14','2012-07-04 12:55:14',1,1,1,1),
('4028945e3850bcd2013850e1aae50027','ROLE_USER','2012-07-04 12:56:02','2012-07-04 12:56:02',1,1,1,1),
('4028945e3850bcd2013850e24abb002a','ROLE_USER','2012-07-04 12:56:43','2012-07-04 12:56:43',1,1,1,1),
('f0440355365a7e4401365a7f09a10000','ROLE_USER','2012-03-28 23:38:56','2012-03-28 23:38:56',1,1,1,1);
/*!40000 ALTER TABLE `donor_roles` ENABLE KEYS */;
--
-- Definition of table `email_verification`
--
DROP TABLE IF EXISTS `email_verification`;
CREATE TABLE `email_verification` (
`token_id` varchar(45) NOT NULL,
`email` varchar(45) NOT NULL,
PRIMARY KEY (`token_id`),
UNIQUE KEY `email` (`email`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `email_verification`
--
/*!40000 ALTER TABLE `email_verification` DISABLE KEYS */;
INSERT INTO `email_verification` (`token_id`,`email`) VALUES
('4028945e3850bcd2013850e05f650023','ab8@abc.com'),
('4028945e3850bcd2013850e24abf002c','abc10@abc.com'),
('4028945e3850bcd2013850d757fd000b','abc1@abc.com'),
('4028945e3850bcd2013850d9284f0011','abc2@abc.com'),
('4028945e3850bcd2013850d9c3890014','abc3@abc.com'),
('4028945e3850bcd2013850da7d270017','abc4@abc.com'),
('4028945e3850bcd2013850de4ba4001a','abc5@abc.com'),
('4028945e3850bcd2013850dee44c001d','abc6@abc.com'),
('4028945e3850bcd2013850dfa3f70020','abc7@abc.com'),
('4028945e3850bcd2013850e0ee5f0026','abc8@abc.com'),
('4028945e3850bcd2013850e1aae90029','abc9@abc.com'),
('4028945e3850bcd2013850d56ada0002','abc@abc.com'),
('40288182389a861f01389a95223a0002','hulla@hulla.com');
/*!40000 ALTER TABLE `email_verification` ENABLE KEYS */;
--
-- Definition of table `feedback`
--
DROP TABLE IF EXISTS `feedback`;
CREATE TABLE `feedback` (
`uuid` varchar(45) NOT NULL,
`donorName` varchar(45) NOT NULL,
`email` varchar(45) NOT NULL,
`contactNo` varchar(15) NOT NULL,
`message` varchar(3000) NOT NULL,
`feedbackTime` datetime NOT NULL,
`verified` tinyint(1) unsigned NOT NULL,
PRIMARY KEY (`uuid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `feedback`
--
/*!40000 ALTER TABLE `feedback` DISABLE KEYS */;
INSERT INTO `feedback` (`uuid`,`donorName`,`email`,`contactNo`,`message`,`feedbackTime`,`verified`) VALUES
('4028945e38fb5d880138fbb1f2f10002','Vivek Gupta','vivekgupta@gmail.com','vivekgupta','vivekguptavivekguptavivekguptavivekguptavivekguptavivekguptavivekguptavivekguptavivekguptavivekguptavivekgupta','2012-08-06 16:58:59',0),
('4028945e38fb5d880138fbb2338c0003','Vivek Gupta','vivekgupta@gmail.com','vivekgupta','vivekguptavivekguptavivekguptavivekguptavivekguptavivekguptavivekguptavivekguptavivekguptavivekguptavivekgupta','2012-08-06 16:59:16',0),
('4028945e38fb5d880138fbb260cd0004','Vivek Gupta','vivekgupta@gmail.com','vivekgupta','vivekguptavivekguptavivekguptavivekguptavivekguptavivekguptavivekguptavivekguptavivekguptavivekguptavivekgupta','2012-08-06 16:59:27',1),
('4028945e39240096013924e02b2a0000','Vivek Gupta','vivekgupta@gmail.com','9858658954','vivekgupta@gmail.com vivekgupta@gmail.com','2012-08-14 16:53:54',1);
/*!40000 ALTER TABLE `feedback` ENABLE KEYS */;
--
-- Definition of table `qrtz_blob_triggers`
--
DROP TABLE IF EXISTS `qrtz_blob_triggers`;
CREATE TABLE `qrtz_blob_triggers` (
`SCHED_NAME` varchar(120) NOT NULL,
`TRIGGER_NAME` varchar(200) NOT NULL,
`TRIGGER_GROUP` varchar(200) NOT NULL,
`BLOB_DATA` blob,
PRIMARY KEY (`SCHED_NAME`,`TRIGGER_NAME`,`TRIGGER_GROUP`),
KEY `SCHED_NAME` (`SCHED_NAME`,`TRIGGER_NAME`,`TRIGGER_GROUP`),
CONSTRAINT `qrtz_blob_triggers_ibfk_1` FOREIGN KEY (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`) REFERENCES `qrtz_triggers` (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `qrtz_blob_triggers`
--
/*!40000 ALTER TABLE `qrtz_blob_triggers` DISABLE KEYS */;
/*!40000 ALTER TABLE `qrtz_blob_triggers` ENABLE KEYS */;
--
-- Definition of table `qrtz_calendars`
--
DROP TABLE IF EXISTS `qrtz_calendars`;
CREATE TABLE `qrtz_calendars` (
`SCHED_NAME` varchar(120) NOT NULL,
`CALENDAR_NAME` varchar(200) NOT NULL,
`CALENDAR` blob NOT NULL,
PRIMARY KEY (`SCHED_NAME`,`CALENDAR_NAME`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `qrtz_calendars`
--
/*!40000 ALTER TABLE `qrtz_calendars` DISABLE KEYS */;
/*!40000 ALTER TABLE `qrtz_calendars` ENABLE KEYS */;
--
-- Definition of table `qrtz_cron_triggers`
--
DROP TABLE IF EXISTS `qrtz_cron_triggers`;
CREATE TABLE `qrtz_cron_triggers` (
`SCHED_NAME` varchar(120) NOT NULL,
`TRIGGER_NAME` varchar(200) NOT NULL,
`TRIGGER_GROUP` varchar(200) NOT NULL,
`CRON_EXPRESSION` varchar(120) NOT NULL,
`TIME_ZONE_ID` varchar(80) DEFAULT NULL,
PRIMARY KEY (`SCHED_NAME`,`TRIGGER_NAME`,`TRIGGER_GROUP`),
KEY `SCHED_NAME` (`SCHED_NAME`,`TRIGGER_NAME`,`TRIGGER_GROUP`),
CONSTRAINT `qrtz_cron_triggers_ibfk_1` FOREIGN KEY (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`) REFERENCES `qrtz_triggers` (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `qrtz_cron_triggers`
--
/*!40000 ALTER TABLE `qrtz_cron_triggers` DISABLE KEYS */;
/*!40000 ALTER TABLE `qrtz_cron_triggers` ENABLE KEYS */;
--
-- Definition of table `qrtz_fired_triggers`
--
DROP TABLE IF EXISTS `qrtz_fired_triggers`;
CREATE TABLE `qrtz_fired_triggers` (
`SCHED_NAME` varchar(120) NOT NULL,
`ENTRY_ID` varchar(95) NOT NULL,
`TRIGGER_NAME` varchar(200) NOT NULL,
`TRIGGER_GROUP` varchar(200) NOT NULL,
`INSTANCE_NAME` varchar(200) NOT NULL,
`FIRED_TIME` bigint(13) NOT NULL,
`PRIORITY` int(11) NOT NULL,
`STATE` varchar(16) NOT NULL,
`JOB_NAME` varchar(200) DEFAULT NULL,
`JOB_GROUP` varchar(200) DEFAULT NULL,
`IS_NONCONCURRENT` varchar(1) DEFAULT NULL,
`REQUESTS_RECOVERY` varchar(1) DEFAULT NULL,
PRIMARY KEY (`SCHED_NAME`,`ENTRY_ID`),
KEY `IDX_QRTZ_FT_TG` (`SCHED_NAME`,`TRIGGER_GROUP`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `qrtz_fired_triggers`
--
/*!40000 ALTER TABLE `qrtz_fired_triggers` DISABLE KEYS */;
/*!40000 ALTER TABLE `qrtz_fired_triggers` ENABLE KEYS */;
--
-- Definition of table `qrtz_job_details`
--
DROP TABLE IF EXISTS `qrtz_job_details`;
CREATE TABLE `qrtz_job_details` (
`SCHED_NAME` varchar(120) NOT NULL,
`JOB_NAME` varchar(200) NOT NULL,
`JOB_GROUP` varchar(200) NOT NULL,
`DESCRIPTION` varchar(250) DEFAULT NULL,
`JOB_CLASS_NAME` varchar(250) NOT NULL,
`IS_DURABLE` varchar(1) NOT NULL,
`IS_NONCONCURRENT` varchar(1) NOT NULL,
`IS_UPDATE_DATA` varchar(1) NOT NULL,
`REQUESTS_RECOVERY` varchar(1) NOT NULL,
`JOB_DATA` blob,
PRIMARY KEY (`SCHED_NAME`,`JOB_NAME`,`JOB_GROUP`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `qrtz_job_details`
--
/*!40000 ALTER TABLE `qrtz_job_details` DISABLE KEYS */;
INSERT INTO `qrtz_job_details` (`SCHED_NAME`,`JOB_NAME`,`JOB_GROUP`,`DESCRIPTION`,`JOB_CLASS_NAME`,`IS_DURABLE`,`IS_NONCONCURRENT`,`IS_UPDATE_DATA`,`REQUESTS_RECOVERY`,`JOB_DATA`) VALUES
('QuartzScheduler','Job1','Group1','asdasadsf','com.raisonne.quartz.scheduler.job.GenericJob','1','1','1','1',0xACED0005737200156F72672E71756172747A2E4A6F62446174614D61709FB083E8BFA9B0CB020000787200266F72672E71756172747A2E7574696C732E537472696E674B65794469727479466C61674D61708208E8C3FBC55D280200015A0013616C6C6F77735472616E7369656E74446174617872001D6F72672E71756172747A2E7574696C732E4469727479466C61674D617013E62EAD28760ACE0200025A000564697274794C00036D617074000F4C6A6176612F7574696C2F4D61703B787001737200116A6176612E7574696C2E486173684D61700507DAC1C31660D103000246000A6C6F6164466163746F724900097468726573686F6C6478703F4000000000000C77080000001000000002740009636C6173734E616D6574000568656C6C6F74000A6D6574686F644E616D6574000568656C6C6F7800);
/*!40000 ALTER TABLE `qrtz_job_details` ENABLE KEYS */;
--
-- Definition of table `qrtz_locks`
--
DROP TABLE IF EXISTS `qrtz_locks`;
CREATE TABLE `qrtz_locks` (
`SCHED_NAME` varchar(120) NOT NULL,
`LOCK_NAME` varchar(40) NOT NULL,
PRIMARY KEY (`SCHED_NAME`,`LOCK_NAME`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `qrtz_locks`
--
/*!40000 ALTER TABLE `qrtz_locks` DISABLE KEYS */;
/*!40000 ALTER TABLE `qrtz_locks` ENABLE KEYS */;
--
-- Definition of table `qrtz_paused_trigger_grps`
--
DROP TABLE IF EXISTS `qrtz_paused_trigger_grps`;
CREATE TABLE `qrtz_paused_trigger_grps` (
`SCHED_NAME` varchar(120) NOT NULL,
`TRIGGER_GROUP` varchar(200) NOT NULL,
PRIMARY KEY (`SCHED_NAME`,`TRIGGER_GROUP`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `qrtz_paused_trigger_grps`
--
/*!40000 ALTER TABLE `qrtz_paused_trigger_grps` DISABLE KEYS */;
/*!40000 ALTER TABLE `qrtz_paused_trigger_grps` ENABLE KEYS */;
--
-- Definition of table `qrtz_scheduler_state`
--
DROP TABLE IF EXISTS `qrtz_scheduler_state`;
CREATE TABLE `qrtz_scheduler_state` (
`SCHED_NAME` varchar(120) NOT NULL,
`INSTANCE_NAME` varchar(200) NOT NULL,
`LAST_CHECKIN_TIME` bigint(13) NOT NULL,
`CHECKIN_INTERVAL` bigint(13) NOT NULL,
PRIMARY KEY (`SCHED_NAME`,`INSTANCE_NAME`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `qrtz_scheduler_state`
--
/*!40000 ALTER TABLE `qrtz_scheduler_state` DISABLE KEYS */;
/*!40000 ALTER TABLE `qrtz_scheduler_state` ENABLE KEYS */;
--
-- Definition of table `qrtz_simple_triggers`
--
DROP TABLE IF EXISTS `qrtz_simple_triggers`;
CREATE TABLE `qrtz_simple_triggers` (
`SCHED_NAME` varchar(120) NOT NULL,
`TRIGGER_NAME` varchar(200) NOT NULL,
`TRIGGER_GROUP` varchar(200) NOT NULL,
`REPEAT_COUNT` bigint(7) NOT NULL,
`REPEAT_INTERVAL` bigint(12) NOT NULL,
`TIMES_TRIGGERED` bigint(10) NOT NULL,
PRIMARY KEY (`SCHED_NAME`,`TRIGGER_NAME`,`TRIGGER_GROUP`),
KEY `SCHED_NAME` (`SCHED_NAME`,`TRIGGER_NAME`,`TRIGGER_GROUP`),
CONSTRAINT `qrtz_simple_triggers_ibfk_1` FOREIGN KEY (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`) REFERENCES `qrtz_triggers` (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `qrtz_simple_triggers`
--
/*!40000 ALTER TABLE `qrtz_simple_triggers` DISABLE KEYS */;
/*!40000 ALTER TABLE `qrtz_simple_triggers` ENABLE KEYS */;
--
-- Definition of table `qrtz_simprop_triggers`
--
DROP TABLE IF EXISTS `qrtz_simprop_triggers`;
CREATE TABLE `qrtz_simprop_triggers` (
`SCHED_NAME` varchar(120) NOT NULL,
`TRIGGER_NAME` varchar(200) NOT NULL,
`TRIGGER_GROUP` varchar(200) NOT NULL,
`STR_PROP_1` varchar(512) DEFAULT NULL,
`STR_PROP_2` varchar(512) DEFAULT NULL,
`STR_PROP_3` varchar(512) DEFAULT NULL,
`INT_PROP_1` int(11) DEFAULT NULL,
`INT_PROP_2` int(11) DEFAULT NULL,
`LONG_PROP_1` bigint(20) DEFAULT NULL,
`LONG_PROP_2` bigint(20) DEFAULT NULL,
`DEC_PROP_1` decimal(13,4) DEFAULT NULL,
`DEC_PROP_2` decimal(13,4) DEFAULT NULL,
`BOOL_PROP_1` varchar(1) DEFAULT NULL,
`BOOL_PROP_2` varchar(1) DEFAULT NULL,
PRIMARY KEY (`SCHED_NAME`,`TRIGGER_NAME`,`TRIGGER_GROUP`),
CONSTRAINT `qrtz_simprop_triggers_ibfk_1` FOREIGN KEY (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`) REFERENCES `qrtz_triggers` (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `qrtz_simprop_triggers`
--
/*!40000 ALTER TABLE `qrtz_simprop_triggers` DISABLE KEYS */;
INSERT INTO `qrtz_simprop_triggers` (`SCHED_NAME`,`TRIGGER_NAME`,`TRIGGER_GROUP`,`STR_PROP_1`,`STR_PROP_2`,`STR_PROP_3`,`INT_PROP_1`,`INT_PROP_2`,`LONG_PROP_1`,`LONG_PROP_2`,`DEC_PROP_1`,`DEC_PROP_2`,`BOOL_PROP_1`,`BOOL_PROP_2`) VALUES
('QuartzScheduler','Job1','Group1','DAY','Asia/Calcutta',NULL,1,0,0,0,NULL,NULL,'0','0');
/*!40000 ALTER TABLE `qrtz_simprop_triggers` ENABLE KEYS */;
--
-- Definition of table `qrtz_triggers`
--
DROP TABLE IF EXISTS `qrtz_triggers`;
CREATE TABLE `qrtz_triggers` (
`SCHED_NAME` varchar(120) NOT NULL,
`TRIGGER_NAME` varchar(200) NOT NULL,
`TRIGGER_GROUP` varchar(200) NOT NULL,
`JOB_NAME` varchar(200) NOT NULL,
`JOB_GROUP` varchar(200) NOT NULL,
`DESCRIPTION` varchar(250) DEFAULT NULL,
`NEXT_FIRE_TIME` bigint(13) DEFAULT NULL,
`PREV_FIRE_TIME` bigint(13) DEFAULT NULL,
`PRIORITY` int(11) DEFAULT NULL,
`TRIGGER_STATE` varchar(16) NOT NULL,
`TRIGGER_TYPE` varchar(8) NOT NULL,
`START_TIME` bigint(13) NOT NULL,
`END_TIME` bigint(13) DEFAULT NULL,
`CALENDAR_NAME` varchar(200) DEFAULT NULL,
`MISFIRE_INSTR` smallint(2) DEFAULT NULL,
`JOB_DATA` blob,
PRIMARY KEY (`SCHED_NAME`,`TRIGGER_NAME`,`TRIGGER_GROUP`),
KEY `SCHED_NAME` (`SCHED_NAME`,`JOB_NAME`,`JOB_GROUP`),
CONSTRAINT `qrtz_triggers_ibfk_1` FOREIGN KEY (`SCHED_NAME`, `JOB_NAME`, `JOB_GROUP`) REFERENCES `qrtz_job_details` (`SCHED_NAME`, `JOB_NAME`, `JOB_GROUP`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `qrtz_triggers`
--
/*!40000 ALTER TABLE `qrtz_triggers` DISABLE KEYS */;
INSERT INTO `qrtz_triggers` (`SCHED_NAME`,`TRIGGER_NAME`,`TRIGGER_GROUP`,`JOB_NAME`,`JOB_GROUP`,`DESCRIPTION`,`NEXT_FIRE_TIME`,`PREV_FIRE_TIME`,`PRIORITY`,`TRIGGER_STATE`,`TRIGGER_TYPE`,`START_TIME`,`END_TIME`,`CALENDAR_NAME`,`MISFIRE_INSTR`,`JOB_DATA`) VALUES
('QuartzScheduler','Job1','Group1','Job1','Group1',NULL,1346146560000,-1,5,'WAITING','CAL_INT',1346146560000,0,NULL,0,'');
/*!40000 ALTER TABLE `qrtz_triggers` ENABLE KEYS */;
--
-- Definition of table `scheduler_group`
--
DROP TABLE IF EXISTS `scheduler_group`;
CREATE TABLE `scheduler_group` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`group_name` varchar(70) NOT NULL,
`group_description` varchar(120) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `group_name` (`group_name`)
) ENGINE=InnoDB AUTO_INCREMENT=12 DEFAULT CHARSET=latin1;
--
-- Dumping data for table `scheduler_group`
--
/*!40000 ALTER TABLE `scheduler_group` DISABLE KEYS */;
INSERT INTO `scheduler_group` (`id`,`group_name`,`group_description`) VALUES
(11,'Group1','Group1 ');
/*!40000 ALTER TABLE `scheduler_group` 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 |
b10d7507c97a0ff8f1379480efd67cdbe31adf11
|
SQL
|
mfrench71/DAT504
|
/Timebank SQL/timebank_031116_02.sql
|
UTF-8
| 3,914 | 3.640625 | 4 |
[] |
no_license
|
-- phpMyAdmin SQL Dump
-- version 4.6.4
-- https://www.phpmyadmin.net/
--
-- Host: localhost:8889
-- Generation Time: Nov 03, 2016 at 09:44 PM
-- Server version: 5.6.33
-- PHP Version: 7.0.12
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Database: `timebank`
--
-- --------------------------------------------------------
--
-- Table structure for table `skills`
--
CREATE TABLE `skills` (
`id` int(11) NOT NULL,
`skillname` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `skills`
--
INSERT INTO `skills` (`id`, `skillname`) VALUES
(1, 'Gardening'),
(2, 'Painting & Decorating'),
(3, 'Information Technology');
-- --------------------------------------------------------
--
-- Table structure for table `users`
--
CREATE TABLE `users` (
`id` int(11) NOT NULL,
`username` varchar(255) NOT NULL,
`password` varchar(255) NOT NULL,
`firstname` varchar(255) NOT NULL,
`lastname` varchar(255) NOT NULL,
`timeBalance` smallint(6) NOT NULL DEFAULT '0' COMMENT 'Running total of user''s available time',
`creditBalance` smallint(6) NOT NULL DEFAULT '0' COMMENT 'Running total of user''s accrued time credit'
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `users`
--
INSERT INTO `users` (`id`, `username`, `password`, `firstname`, `lastname`, `timeBalance`, `creditBalance`) VALUES
(1, 'matthew@timebank.com', 'password', 'Matthew', 'French', 0, 0),
(2, 'chris@timebank.com', 'password', 'Chris', 'Maycock', 0, 0),
(3, 'ryan@timebank.com', 'password', 'Ryan', 'Curnow', 0, 0),
(4, 'ged@timebank.com', 'password', 'Ged', 'Kauri', 0, 0);
-- --------------------------------------------------------
--
-- Table structure for table `userskills`
--
CREATE TABLE `userskills` (
`id` int(11) NOT NULL,
`user_id` int(11) NOT NULL,
`skill_id` int(11) NOT NULL,
`skillRequested` tinyint(1) NOT NULL COMMENT 'Is user requesting this skill? (1=Yes, 0=No)',
`skillOffered` tinyint(1) NOT NULL COMMENT 'Is user offering this skill? (1=Yes, 0=No)'
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `userskills`
--
INSERT INTO `userskills` (`id`, `user_id`, `skill_id`, `skillRequested`, `skillOffered`) VALUES
(1, 1, 2, 0, 1),
(2, 2, 1, 1, 0),
(3, 3, 3, 0, 1),
(4, 4, 3, 0, 1),
(5, 2, 2, 0, 1);
--
-- Indexes for dumped tables
--
--
-- Indexes for table `skills`
--
ALTER TABLE `skills`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `users`
--
ALTER TABLE `users`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `username` (`username`);
--
-- Indexes for table `userskills`
--
ALTER TABLE `userskills`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `userskillsIndex` (`user_id`,`skill_id`),
ADD KEY `user_id` (`user_id`),
ADD KEY `skill_id` (`skill_id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `skills`
--
ALTER TABLE `skills`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
--
-- AUTO_INCREMENT for table `users`
--
ALTER TABLE `users`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;
--
-- AUTO_INCREMENT for table `userskills`
--
ALTER TABLE `userskills`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7;
--
-- Constraints for dumped tables
--
--
-- Constraints for table `userskills`
--
ALTER TABLE `userskills`
ADD CONSTRAINT `userskills_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`),
ADD CONSTRAINT `userskills_ibfk_2` FOREIGN KEY (`skill_id`) REFERENCES `skills` (`id`);
/*!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 |
37be17bdd037618a3f2af8fe3305e75107bcad36
|
SQL
|
andre12001/fecebook-clone-socialkit
|
/MySQL/fb.sql
|
UTF-8
| 19,804 | 3.078125 | 3 |
[] |
no_license
|
-- phpMyAdmin SQL Dump
-- version 5.0.2
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Waktu pembuatan: 26 Nov 2020 pada 06.15
-- Versi server: 10.4.11-MariaDB
-- Versi PHP: 7.4.5
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Database: `fb`
--
-- --------------------------------------------------------
--
-- Struktur dari tabel `accounts`
--
CREATE TABLE `accounts` (
`id` int(255) NOT NULL,
`about` text COLLATE utf8_unicode_ci NOT NULL,
`active` int(1) NOT NULL DEFAULT 0,
`avatar_id` int(255) NOT NULL DEFAULT 0,
`cover_id` int(255) NOT NULL DEFAULT 0,
`cover_position` int(255) NOT NULL DEFAULT 0,
`email` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`email_verification_key` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`email_verified` int(1) NOT NULL DEFAULT 0,
`language` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`last_logged` int(255) NOT NULL,
`name` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
`password` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`time` int(255) NOT NULL DEFAULT 0,
`timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
`timezone` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`type` varchar(5) COLLATE utf8_unicode_ci NOT NULL DEFAULT 'none',
`username` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
`verified` int(1) NOT NULL DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- --------------------------------------------------------
--
-- Struktur dari tabel `blocks`
--
CREATE TABLE `blocks` (
`id` int(255) NOT NULL,
`active` int(1) NOT NULL DEFAULT 0,
`blocked_id` int(255) NOT NULL,
`blocker_id` int(255) NOT NULL,
`time` int(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- --------------------------------------------------------
--
-- Struktur dari tabel `configurations`
--
CREATE TABLE `configurations` (
`admin_username` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`admin_password` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`captcha` int(1) NOT NULL DEFAULT 1,
`censored_words` text COLLATE utf8_unicode_ci NOT NULL,
`chat` int(1) NOT NULL DEFAULT 0,
`email` varchar(255) COLLATE utf8_unicode_ci NOT NULL DEFAULT 'no-reply@website.com',
`email_verification` int(1) NOT NULL DEFAULT 0,
`language` varchar(255) COLLATE utf8_unicode_ci NOT NULL DEFAULT 'english',
`site_name` varchar(255) COLLATE utf8_unicode_ci NOT NULL DEFAULT 'Sitename',
`site_title` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`smooth_links` int(1) NOT NULL,
`theme` varchar(255) COLLATE utf8_unicode_ci NOT NULL DEFAULT 'amaze',
`ad_place_home` text COLLATE utf8_unicode_ci NOT NULL,
`ad_place_messages` text COLLATE utf8_unicode_ci NOT NULL,
`ad_place_timeline` text COLLATE utf8_unicode_ci NOT NULL,
`ad_place_hashtag` text COLLATE utf8_unicode_ci NOT NULL,
`ad_place_search` text COLLATE utf8_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Dumping data untuk tabel `configurations`
--
INSERT INTO `configurations` (`admin_username`, `admin_password`, `captcha`, `censored_words`, `chat`, `email`, `email_verification`, `language`, `site_name`, `site_title`, `smooth_links`, `theme`, `ad_place_home`, `ad_place_messages`, `ad_place_timeline`, `ad_place_hashtag`, `ad_place_search`) VALUES
('admin', '21232f297a57a5a743894a0e4a801fc3', 0, 'racist,retard', 1, 'no-reply@website.com', 0, 'english', 'Review', 'Review', 0, 'marvel', '', '', '', '', '');
-- --------------------------------------------------------
--
-- Struktur dari tabel `followers`
--
CREATE TABLE `followers` (
`id` int(255) NOT NULL,
`active` int(1) NOT NULL DEFAULT 0,
`is_chatting` int(1) NOT NULL DEFAULT 0,
`follower_id` int(255) NOT NULL,
`following_id` int(255) NOT NULL,
`time` int(255) NOT NULL,
`timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- --------------------------------------------------------
--
-- Struktur dari tabel `groups`
--
CREATE TABLE `groups` (
`id` int(255) NOT NULL,
`add_privacy` varchar(255) COLLATE utf8_unicode_ci NOT NULL DEFAULT 'members',
`group_privacy` varchar(255) COLLATE utf8_unicode_ci NOT NULL DEFAULT 'open',
`timeline_post_privacy` varchar(255) COLLATE utf8_unicode_ci NOT NULL DEFAULT 'members'
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- --------------------------------------------------------
--
-- Struktur dari tabel `group_admins`
--
CREATE TABLE `group_admins` (
`id` int(255) NOT NULL,
`active` int(1) NOT NULL,
`admin_id` int(255) NOT NULL,
`group_id` int(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- --------------------------------------------------------
--
-- Struktur dari tabel `hashtags`
--
CREATE TABLE `hashtags` (
`id` int(255) NOT NULL,
`hash` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`tag` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`last_trend_time` int(255) NOT NULL,
`trend_use_num` int(255) NOT NULL DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- --------------------------------------------------------
--
-- Struktur dari tabel `media`
--
CREATE TABLE `media` (
`id` int(255) NOT NULL,
`active` int(1) NOT NULL DEFAULT 0,
`album_id` int(255) NOT NULL DEFAULT 0,
`extension` varchar(4) COLLATE utf8_unicode_ci NOT NULL DEFAULT 'none',
`name` text COLLATE utf8_unicode_ci NOT NULL,
`post_id` int(255) NOT NULL,
`temp` int(1) NOT NULL DEFAULT 1,
`timeline_id` int(255) NOT NULL,
`type` varchar(255) COLLATE utf8_unicode_ci NOT NULL DEFAULT 'none',
`url` text COLLATE utf8_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Dumping data untuk tabel `media`
--
INSERT INTO `media` (`id`, `active`, `album_id`, `extension`, `name`, `post_id`, `temp`, `timeline_id`, `type`, `url`) VALUES
(1, 1, 0, 'jpg', '3a85965b-c124-48ec-b27c-d060db176343.jpg', 0, 0, 0, 'photo', 'photos/2020/11/wHmCW_1_c4ca4238a0b923820dcc509a6f75849b'),
(2, 1, 0, 'jpg', '3a85965b-c124-48ec-b27c-d060db176343.jpg', 0, 0, 0, 'photo', 'photos/2020/11/cwIfK_2_c81e728d9d4c2f636f067f89cc14862c'),
(3, 1, 0, 'jpg', '3a85965b-c124-48ec-b27c-d060db176343.jpg', 0, 0, 0, 'photo', 'photos/2020/11/JQkH2_3_eccbc87e4b5ce2fe28308fd9f2a7baf3');
-- --------------------------------------------------------
--
-- Struktur dari tabel `notifications`
--
CREATE TABLE `notifications` (
`id` int(255) NOT NULL,
`active` int(1) NOT NULL,
`notifier_id` int(255) NOT NULL,
`post_id` int(255) NOT NULL,
`seen` int(255) NOT NULL,
`text` text COLLATE utf8_unicode_ci NOT NULL,
`time` int(255) NOT NULL,
`timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
`timeline_id` int(255) NOT NULL,
`type` varchar(255) COLLATE utf8_unicode_ci NOT NULL DEFAULT 'none',
`url` varchar(255) COLLATE utf8_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- --------------------------------------------------------
--
-- Struktur dari tabel `pages`
--
CREATE TABLE `pages` (
`id` int(255) NOT NULL,
`address` text COLLATE utf8_unicode_ci NOT NULL,
`awards` text COLLATE utf8_unicode_ci NOT NULL,
`category_id` int(255) NOT NULL,
`message_privacy` varchar(255) COLLATE utf8_unicode_ci NOT NULL DEFAULT 'everyone',
`phone` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`products` text COLLATE utf8_unicode_ci NOT NULL,
`timeline_post_privacy` varchar(255) COLLATE utf8_unicode_ci NOT NULL DEFAULT 'everyone',
`website` varchar(255) COLLATE utf8_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- --------------------------------------------------------
--
-- Struktur dari tabel `page_admins`
--
CREATE TABLE `page_admins` (
`id` int(255) NOT NULL,
`active` int(1) NOT NULL,
`admin_id` int(255) NOT NULL,
`page_id` int(255) NOT NULL,
`role` varchar(255) COLLATE utf8_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- --------------------------------------------------------
--
-- Struktur dari tabel `page_categories`
--
CREATE TABLE `page_categories` (
`id` int(255) NOT NULL,
`active` int(1) NOT NULL,
`category_id` int(255) NOT NULL,
`name` text COLLATE utf8_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Dumping data untuk tabel `page_categories`
--
INSERT INTO `page_categories` (`id`, `active`, `category_id`, `name`) VALUES
(1, 1, 0, 'Local Business or Place'),
(2, 1, 1, 'Airport'),
(3, 1, 1, 'Arts/Entertainment/Nightlife'),
(4, 1, 1, 'Attractions/Things to Do'),
(5, 1, 1, 'Automotive'),
(6, 1, 1, 'Bank/Financial Services'),
(7, 1, 1, 'Bar'),
(8, 1, 1, 'Book Store'),
(9, 1, 1, 'Business Services'),
(10, 1, 1, 'Church/Religious Organization'),
(11, 1, 1, 'Club'),
(12, 1, 1, 'Community/Government'),
(13, 1, 1, 'Concert Venue'),
(14, 1, 1, 'Doctor'),
(15, 1, 1, 'Education'),
(16, 1, 1, 'Event Planning/Event Services'),
(17, 1, 1, 'Food/Grocery'),
(18, 1, 1, 'Health/Medical/Pharmacy'),
(19, 1, 1, 'Home Improvement'),
(20, 1, 1, 'Hospital/Clinic'),
(21, 1, 1, 'Hotel'),
(22, 1, 1, 'Landmark'),
(23, 1, 1, 'Lawyer'),
(24, 1, 1, 'Library'),
(25, 1, 1, 'Local Business'),
(26, 1, 1, 'Middle School'),
(27, 1, 1, 'Movie Theater'),
(28, 1, 1, 'Museum/Art Gallery'),
(29, 1, 1, 'Outdoor Gear/Sporting Goods'),
(30, 1, 1, 'Pet Services'),
(31, 1, 1, 'Professional Services'),
(32, 1, 1, 'Public Places'),
(33, 1, 1, 'Real Estate'),
(34, 1, 1, 'Restaurant/Cafe'),
(35, 1, 1, 'School'),
(36, 1, 1, 'Shopping/Retail'),
(37, 1, 1, 'Spas/Beauty/Personal Care'),
(38, 1, 1, 'Sports Venue'),
(39, 1, 1, 'Sports/Recreation/Activities'),
(40, 1, 1, 'Tours/Sightseeing'),
(41, 1, 1, 'Transportation'),
(42, 1, 1, 'University'),
(43, 1, 0, 'Company, Organization or Institution'),
(44, 1, 43, 'Aerospace/Defense'),
(45, 1, 43, 'Automobiles and Parts'),
(46, 1, 43, 'Bank/Financial Institution'),
(47, 1, 43, 'Biotechnology'),
(48, 1, 43, 'Cause'),
(49, 1, 43, 'Chemicals'),
(50, 1, 43, 'Church/Religious Organization'),
(51, 1, 43, 'Community Organization'),
(52, 1, 43, 'Company'),
(53, 1, 43, 'Computers/Technology'),
(54, 1, 43, 'Consulting/Business Services'),
(55, 1, 43, 'Education'),
(56, 1, 43, 'Energy/Utility'),
(57, 1, 43, 'Engineering/Construction'),
(58, 1, 43, 'Farming/Agriculture'),
(59, 1, 43, 'Food/Beverages'),
(60, 1, 43, 'Government Organization'),
(61, 1, 43, 'Health/Beauty'),
(62, 1, 43, 'Health/Medical/Pharmaceuticals'),
(63, 1, 43, 'Industrials'),
(64, 1, 43, 'Insurance Company'),
(65, 1, 43, 'Internet/Software'),
(66, 1, 43, 'Legal/Law'),
(67, 1, 43, 'Media/News/Publishing'),
(68, 1, 43, 'Middle School'),
(69, 1, 43, 'Mining/Materials'),
(70, 1, 43, 'Non-Governmental Organization (NGO)'),
(71, 1, 43, 'Non-Profit Organization'),
(72, 1, 43, 'Organization'),
(73, 1, 43, 'Political Organization'),
(74, 1, 43, 'Political Party'),
(75, 1, 43, 'Retail and Consumer Merchandise'),
(76, 1, 43, 'School'),
(77, 1, 43, 'Small Business'),
(78, 1, 43, 'Telecommunication'),
(79, 1, 43, 'Transport/Freight'),
(80, 1, 43, 'Travel/Leisure'),
(81, 1, 43, 'University'),
(82, 1, 0, 'Brand or Product'),
(83, 1, 82, 'Appliances'),
(84, 1, 82, 'Baby Goods/Kids Goods'),
(85, 1, 82, 'Bags/Luggage'),
(86, 1, 82, 'Board Game'),
(87, 1, 82, 'Building Materials'),
(88, 1, 82, 'Camera/Photo'),
(89, 1, 82, 'Cars'),
(90, 1, 82, 'Clothing'),
(91, 1, 82, 'Commercial Equipment'),
(92, 1, 82, 'Computers'),
(93, 1, 82, 'Drugs'),
(94, 1, 82, 'Electronics'),
(95, 1, 82, 'Food/Beverages'),
(96, 1, 82, 'Furniture'),
(97, 1, 82, 'Games/Toys'),
(98, 1, 82, 'Health/Beauty'),
(99, 1, 82, 'Home Decor'),
(100, 1, 82, 'Household Supplies'),
(101, 1, 82, 'Jewelry/Watches'),
(102, 1, 82, 'Kitchen/Cooking'),
(103, 1, 82, 'Office Supplies'),
(104, 1, 82, 'Outdoor Gear/Sporting Goods'),
(105, 1, 82, 'Patio/Garden'),
(106, 1, 82, 'Pet Supplies'),
(107, 1, 82, 'Phone/Tablet'),
(108, 1, 82, 'Product/Service'),
(109, 1, 82, 'Software'),
(110, 1, 82, 'Tools/Equipment'),
(111, 1, 82, 'Video Game'),
(112, 1, 82, 'Vitamins/Supplements'),
(113, 1, 82, 'Website'),
(114, 1, 82, 'Wine/Spirits'),
(115, 1, 0, 'Artist, Band or Public Figure'),
(116, 1, 115, 'Actor/Director'),
(117, 1, 115, 'Artist'),
(118, 1, 115, 'Athlete'),
(119, 1, 115, 'Author'),
(120, 1, 115, 'Business Person'),
(121, 1, 115, 'Chef'),
(122, 1, 115, 'Coach'),
(123, 1, 115, 'Comedian'),
(124, 1, 115, 'Dancer'),
(125, 1, 115, 'Designer'),
(126, 1, 115, 'Entertainer'),
(127, 1, 115, 'Entrepreneur'),
(128, 1, 115, 'Fictional Character'),
(129, 1, 115, 'Government Official'),
(130, 1, 115, 'Journalist'),
(131, 1, 115, 'Movie Character'),
(132, 1, 115, 'Musician/Band'),
(133, 1, 115, 'News Personality'),
(134, 1, 115, 'Pet'),
(135, 1, 115, 'Photographer'),
(136, 1, 115, 'Politician'),
(137, 1, 115, 'Producer'),
(138, 1, 115, 'Public Figure'),
(139, 1, 115, 'Teacher'),
(140, 1, 115, 'Writer'),
(141, 1, 0, 'Entertainment'),
(142, 1, 141, 'Album'),
(143, 1, 141, 'Amateur Sports Team'),
(144, 1, 141, 'Book'),
(145, 1, 141, 'Book Series'),
(146, 1, 141, 'Book Store'),
(147, 1, 141, 'Concert Tour'),
(148, 1, 141, 'Concert Venue'),
(149, 1, 141, 'Fictional Character'),
(150, 1, 141, 'Library'),
(151, 1, 141, 'Magazine'),
(152, 1, 141, 'Movie'),
(153, 1, 141, 'Movie Character'),
(154, 1, 141, 'Movie Theater'),
(155, 1, 141, 'Music Award'),
(156, 1, 141, 'Music Chart'),
(157, 1, 141, 'Music Video'),
(158, 1, 141, 'Professional Sports Team'),
(159, 1, 141, 'Radio Station'),
(160, 1, 141, 'Record Label'),
(161, 1, 141, 'School Sports Team'),
(162, 1, 141, 'Song'),
(163, 1, 141, 'Sports League'),
(164, 1, 141, 'Sports Venue'),
(165, 1, 141, 'Studio'),
(166, 1, 141, 'TV Channel'),
(167, 1, 141, 'TV Network'),
(168, 1, 141, 'TV Show'),
(169, 1, 141, 'TV/Movie Award');
-- --------------------------------------------------------
--
-- Struktur dari tabel `posts`
--
CREATE TABLE `posts` (
`id` int(255) NOT NULL,
`active` int(1) NOT NULL DEFAULT 0,
`google_map_name` text COLLATE utf8_unicode_ci NOT NULL,
`hidden` int(1) NOT NULL DEFAULT 0,
`link_title` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`link_url` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`media_id` int(255) NOT NULL DEFAULT 0,
`post_id` int(255) NOT NULL DEFAULT 0,
`recipient_id` int(255) NOT NULL DEFAULT 0,
`soundcloud_title` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`soundcloud_uri` text COLLATE utf8_unicode_ci NOT NULL,
`seen` int(255) NOT NULL DEFAULT 0,
`text` text COLLATE utf8_unicode_ci NOT NULL,
`time` int(255) NOT NULL,
`timeline_id` int(255) NOT NULL,
`timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
`type1` varchar(255) COLLATE utf8_unicode_ci NOT NULL DEFAULT 'none',
`type2` varchar(255) COLLATE utf8_unicode_ci NOT NULL DEFAULT 'none',
`youtube_video_id` text COLLATE utf8_unicode_ci NOT NULL,
`youtube_title` text COLLATE utf8_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- --------------------------------------------------------
--
-- Struktur dari tabel `reports`
--
CREATE TABLE `reports` (
`id` int(255) NOT NULL,
`active` int(1) NOT NULL,
`post_id` int(255) NOT NULL,
`reporter_id` int(255) NOT NULL,
`status` int(1) NOT NULL DEFAULT 0,
`timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- --------------------------------------------------------
--
-- Struktur dari tabel `users`
--
CREATE TABLE `users` (
`id` int(255) NOT NULL,
`birthday` varchar(10) COLLATE utf8_unicode_ci NOT NULL DEFAULT '1-1-1990',
`comment_privacy` varchar(255) COLLATE utf8_unicode_ci NOT NULL DEFAULT 'everyone',
`confirm_followers` int(11) NOT NULL DEFAULT 0,
`current_city` text COLLATE utf8_unicode_ci NOT NULL,
`follow_privacy` varchar(255) COLLATE utf8_unicode_ci NOT NULL DEFAULT 'everyone',
`gender` varchar(6) COLLATE utf8_unicode_ci NOT NULL DEFAULT 'male',
`hometown` text COLLATE utf8_unicode_ci NOT NULL,
`message_privacy` varchar(255) COLLATE utf8_unicode_ci NOT NULL DEFAULT 'everyone',
`timeline_post_privacy` varchar(255) COLLATE utf8_unicode_ci NOT NULL DEFAULT 'everyone'
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Indexes for dumped tables
--
--
-- Indeks untuk tabel `accounts`
--
ALTER TABLE `accounts`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `email` (`email`),
ADD UNIQUE KEY `username` (`username`);
--
-- Indeks untuk tabel `blocks`
--
ALTER TABLE `blocks`
ADD PRIMARY KEY (`id`);
--
-- Indeks untuk tabel `followers`
--
ALTER TABLE `followers`
ADD PRIMARY KEY (`id`);
--
-- Indeks untuk tabel `groups`
--
ALTER TABLE `groups`
ADD PRIMARY KEY (`id`);
--
-- Indeks untuk tabel `group_admins`
--
ALTER TABLE `group_admins`
ADD PRIMARY KEY (`id`);
--
-- Indeks untuk tabel `hashtags`
--
ALTER TABLE `hashtags`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `hash` (`hash`);
--
-- Indeks untuk tabel `media`
--
ALTER TABLE `media`
ADD PRIMARY KEY (`id`);
--
-- Indeks untuk tabel `notifications`
--
ALTER TABLE `notifications`
ADD PRIMARY KEY (`id`);
--
-- Indeks untuk tabel `pages`
--
ALTER TABLE `pages`
ADD PRIMARY KEY (`id`);
--
-- Indeks untuk tabel `page_admins`
--
ALTER TABLE `page_admins`
ADD PRIMARY KEY (`id`);
--
-- Indeks untuk tabel `page_categories`
--
ALTER TABLE `page_categories`
ADD PRIMARY KEY (`id`);
--
-- Indeks untuk tabel `posts`
--
ALTER TABLE `posts`
ADD PRIMARY KEY (`id`);
--
-- Indeks untuk tabel `reports`
--
ALTER TABLE `reports`
ADD PRIMARY KEY (`id`);
--
-- Indeks untuk tabel `users`
--
ALTER TABLE `users`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT untuk tabel yang dibuang
--
--
-- AUTO_INCREMENT untuk tabel `accounts`
--
ALTER TABLE `accounts`
MODIFY `id` int(255) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT untuk tabel `blocks`
--
ALTER TABLE `blocks`
MODIFY `id` int(255) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT untuk tabel `followers`
--
ALTER TABLE `followers`
MODIFY `id` int(255) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
--
-- AUTO_INCREMENT untuk tabel `group_admins`
--
ALTER TABLE `group_admins`
MODIFY `id` int(255) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT untuk tabel `hashtags`
--
ALTER TABLE `hashtags`
MODIFY `id` int(255) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT untuk tabel `media`
--
ALTER TABLE `media`
MODIFY `id` int(255) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
--
-- AUTO_INCREMENT untuk tabel `notifications`
--
ALTER TABLE `notifications`
MODIFY `id` int(255) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
--
-- AUTO_INCREMENT untuk tabel `page_admins`
--
ALTER TABLE `page_admins`
MODIFY `id` int(255) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT untuk tabel `page_categories`
--
ALTER TABLE `page_categories`
MODIFY `id` int(255) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=170;
--
-- AUTO_INCREMENT untuk tabel `posts`
--
ALTER TABLE `posts`
MODIFY `id` int(255) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=15;
--
-- AUTO_INCREMENT untuk tabel `reports`
--
ALTER TABLE `reports`
MODIFY `id` int(255) NOT NULL AUTO_INCREMENT;
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 |
7eeb28fbca03038ab6b8c859ed7443be8151c32c
|
SQL
|
nathancirillo/SQL-Server
|
/SQL Server - Consultas avançadas/INNER JOIN.sql
|
ISO-8859-1
| 1,337 | 3.890625 | 4 |
[] |
no_license
|
SELECT * FROM [TABELA DE VENDEDORES]
SELECT * FROM [NOTAS FISCAIS]
--Juntando as duas tabelas (new school)
SELECT * FROM [TABELA DE VENDEDORES] V INNER JOIN [NOTAS FISCAIS]N
ON V.MATRICULA = N.MATRICULA
--Juntando as duas tabelas (old school)
SELECT * FROM [TABELA DE VENDEDORES], [NOTAS FISCAIS]
WHERE dbo.[TABELA DE VENDEDORES].MATRICULA = dbo.[NOTAS FISCAIS].MATRICULA
--Tambm possvel usar o nome da prpria tabela
SELECT * FROM [TABELA DE VENDEDORES] INNER JOIN [NOTAS FISCAIS]
ON dbo.[TABELA DE VENDEDORES].MATRICULA = dbo.[NOTAS FISCAIS].MATRICULA
--Definindo o nmero de notas fiscais por vendedor
SELECT V.MATRICULA, V.NOME, COUNT(*) AS QTDNOTAS FROM [TABELA DE VENDEDORES] V INNER JOIN [NOTAS FISCAIS]N
ON V.MATRICULA = N.MATRICULA GROUP BY V.MATRICULA, V.NOME
--Definindo o nmero de notas fiscais por ano e vendedor
SELECT YEAR(N.DATA) AS ANO, V.MATRICULA, V.NOME, COUNT(*) AS QTDNOTAS FROM [TABELA DE VENDEDORES] V INNER JOIN [NOTAS FISCAIS] N
ON V.MATRICULA = N.MATRICULA GROUP BY YEAR(N.DATA), V.MATRICULA, V.NOME
--Definindo o nmero de notas fiscais por ano e vendedor ordernados por ano
SELECT YEAR(N.DATA) AS ANO, V.MATRICULA, V.NOME, COUNT(*) AS QTDNOTAS FROM [TABELA DE VENDEDORES] V INNER JOIN [NOTAS FISCAIS] N
ON V.MATRICULA = N.MATRICULA GROUP BY YEAR(N.DATA), V.MATRICULA, V.NOME ORDER BY ANO
| true |
dcce4c9262ddab936112e66ad053a7227a241d3a
|
SQL
|
paulalcabasa/Oracle-SQL-Files
|
/Accounting Books/AR Receipts sUMMARY.sql
|
UTF-8
| 1,442 | 3.5 | 4 |
[] |
no_license
|
SELECT to_char(acra.receipt_number) receipt_number,
acra.amount receipt_amount,
acra.doc_sequence_value,
to_char(acra.receipt_date,'DD-MON-YYYY') or_date,
NVL(party.party_name,ACRA.MISC_PAYMENT_SOURCE) payee,
ARPT_SQL_FUNC_UTIL.get_lookup_meaning ('CHECK_STATUS', ACRA.STATUS) status,
to_char(nvl(apsa.gl_date,APRHA.gl_date),'DD-MON-YYYY') gl_date,
to_char(acra.creation_date,'DD-MON-YYYY') creation_date,
fu.description created_by
FROM ar_cash_receipts_all acra
LEFT JOIN hz_cust_accounts cust
ON acra.pay_from_customer = cust.cust_account_id
LEFT JOIN hz_cust_site_uses_all site_uses
ON site_uses.site_use_id = acra.customer_site_use_id
LEFT JOIN hz_parties party
ON cust.party_id = party.party_id
LEFT JOIN ar_payment_schedules_all apsa
ON apsa.cash_receipt_id = acra.cash_receipt_id
LEFT JOIN AR_CASH_RECEIPT_HISTORY_ALL APRHA
ON aprha.cash_receipt_id = acra.cash_receipt_id
AND aprha.current_record_flag = 'Y'
LEFT JOIN fnd_user fu
ON fu.user_id = acra.created_by
WHERE 1 = 1
AND TO_DATE(acra.receipt_date) between TO_DATE (:P_START_DATE, 'yyyy/mm/dd hh24:mi:ss') and TO_DATE (:P_END_DATE, 'yyyy/mm/dd hh24:mi:ss')
ORDER BY acra.doc_sequence_value;
| true |
899bf9c056f00e99585f44328e7ef37e4c061198
|
SQL
|
furkantokac/Swamp-server
|
/SwampDatabase/autoSetup.sql
|
UTF-8
| 1,220 | 3.3125 | 3 |
[
"MIT"
] |
permissive
|
# CREATE DB
CREATE DATABASE swamp;
# DROP TABLES
DROP TABLE User;
DROP TABLE User_Account;
DROP TABLE Bin;
DROP TABLE Collected_Waste;
DROP TABLE User_Bin;
# CREATE TABLES
CREATE TABLE User (
uname VARCHAR(255) NOT NULL,
passwd VARCHAR(255) NOT NULL,
PRIMARY KEY (uname)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
CREATE TABLE User_Account (
uname VARCHAR(255) NOT NULL,
name VARCHAR(255) NOT NULL,
surname VARCHAR(255) NOT NULL,
email VARCHAR(255) NOT NULL,
pp_loc VARCHAR(255) NOT NULL,
PRIMARY KEY (uname)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
CREATE TABLE Bin (
id int(11) NOT NULL,
loc_x DOUBLE NOT NULL,
loc_y DOUBLE NOT NULL,
PRIMARY KEY (id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
CREATE TABLE Collected_Waste (
bin_id int(11) NOT NULL,
user_uname VARCHAR(255) NOT NULL,
amount DOUBLE NOT NULL,
dt DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (bin_id, user_uname, dt)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
CREATE TABLE User_Bin (
user_uname VARCHAR(255) NOT NULL,
bin_id int(11) NOT NULL,
PRIMARY KEY (user_uname)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
| true |
0c0ac839afbbc9a6db7df51dccfbe79b4458935a
|
SQL
|
Mini0n/PeopleOneAPI
|
/sqlfiles/areas.sql
|
UTF-8
| 2,452 | 3.046875 | 3 |
[] |
no_license
|
-- phpMyAdmin SQL Dump
-- version 4.5.4.1deb2ubuntu2
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Nov 26, 2017 at 11:56 PM
-- Server version: 5.7.20-0ubuntu0.16.04.1
-- PHP Version: 7.0.22-0ubuntu0.16.04.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: `PeopleOneAPI_development`
--
-- --------------------------------------------------------
--
-- Table structure for table `areas`
--
CREATE TABLE `areas` (
`id` bigint(20) NOT NULL,
`name` varchar(255) DEFAULT NULL,
`catalog_id` bigint(20) DEFAULT NULL,
`created_at` datetime NOT NULL,
`updated_at` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `areas`
--
INSERT INTO `areas` (`id`, `name`, `catalog_id`, `created_at`, `updated_at`) VALUES
(1, 'CPU', 1, '2017-11-01 00:00:00', '2017-11-01 00:00:00'),
(2, 'Perifericos', 1, '2017-11-01 00:00:00', '2017-11-01 00:00:00'),
(5, 'Applications', 2, '2017-11-01 00:00:00', '2017-11-01 00:00:00'),
(6, 'Networking', 2, '2017-11-01 00:00:00', '2017-11-01 00:00:00'),
(7, 'Red', 3, '2017-11-01 00:00:00', '2017-11-01 00:00:00'),
(8, 'Aplicationes', 3, '2017-11-01 00:00:00', '2017-11-01 00:00:00'),
(9, 'Assessment', 4, '2017-11-01 00:00:00', '2017-11-01 00:00:00'),
(10, 'Hardware', 4, '2017-11-01 00:00:00', '2017-11-01 00:00:00'),
(11, 'Servicios', 5, '2017-11-01 00:00:00', '2017-11-01 00:00:00'),
(12, 'Fabricantes', 5, '2017-11-01 00:00:00', '2017-11-01 00:00:00');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `areas`
--
ALTER TABLE `areas`
ADD PRIMARY KEY (`id`),
ADD KEY `index_areas_on_catalog_id` (`catalog_id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `areas`
--
ALTER TABLE `areas`
MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=13;
--
-- Constraints for dumped tables
--
--
-- Constraints for table `areas`
--
ALTER TABLE `areas`
ADD CONSTRAINT `fk_rails_538c6a075f` FOREIGN KEY (`catalog_id`) REFERENCES `catalogs` (`id`);
/*!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 |
ab7cd9613b3ef2d46586d90836c0822700672bc8
|
SQL
|
anhlu8/choose_your_predator
|
/models/schema.sql
|
UTF-8
| 573 | 2.96875 | 3 |
[] |
no_license
|
DROP DATABASE IF EXISTS trivia_db;
CREATE DATABASE trivia_db;
USE trivia_db;
CREATE TABLE questions (
id INT NOT NULL AUTO_INCREMENT,
category VARCHAR(255) NOT NULL,
difficulty VARCHAR(255) NOT NULL,
question VARCHAR(1000) NOT NULL,
correctAnswer VARCHAR(255) NOT NULL,
incorrect1 VARCHAR(255) NOT NULL,
incorrect2 VARCHAR(255) NOT NULL,
incorrect3 VARCHAR(255) NOT NULL,
incorrect4 VARCHAR(255) NOT NULL,
PRIMARY KEY (id)
);
-- you will need to import the results.csv file
DROP DATABASE IF EXISTS testdb;
CREATE DATABASE testdb;
| true |
67784905b0a0685d8ea1f735186e57fb9a767f95
|
SQL
|
peterhychan/OracleSQL
|
/AcmeBooks_inserts.sql
|
UTF-8
| 94,763 | 2.828125 | 3 |
[] |
no_license
|
delete from bk_order_details;
delete from bk_order_headers;
delete from bk_customers ;
delete from bk_handling_fees;
delete from bk_book_authors ;
delete from bk_authors;
delete from bk_book_topics;
delete from bk_topics;
delete from bk_books;
delete from bk_publishers;
insert into bk_handling_fees(low_limit, high_limit, handling_fee) values ( 0, 5, 5.00);
insert into bk_handling_fees(low_limit, high_limit, handling_fee) values ( 6, 15, 7.00);
insert into bk_handling_fees(low_limit, high_limit, handling_fee) values ( 16, 25, 9.00);
insert into bk_handling_fees(low_limit, high_limit, handling_fee) values ( 26, 50, 12.00);
insert into bk_handling_fees(low_limit, high_limit, handling_fee) values ( 51, 100, 15.00);
insert into bk_handling_fees(low_limit, high_limit, handling_fee) values (101, 999, 20.00);
-- publishers
Insert into bk_publishers values (9000, 'Microsoft Press') ;
Insert into bk_publishers values (9456, 'New Directions') ;
Insert into bk_publishers values (9102, 'Alfred A. Knopf') ;
Insert into bk_publishers values (9325, 'Addison Wesley') ;
Insert into bk_publishers values (9745, 'Morgan Kaufmann') ;
Insert into bk_publishers values (9521, 'Benjamin/Cummings') ;
Insert into bk_publishers values (9822, 'O''Reilly') ;
Insert into bk_publishers values (9030, 'McGraw Hill') ;
Insert into bk_publishers values (9444, 'APress') ;
Insert into bk_publishers values (9020, 'Princeton Univer Press') ;
Insert into bk_publishers values (9021, 'Yale University Press') ;
Insert into bk_publishers values (9022, 'Havard University Press') ;
Insert into bk_publishers values (9528, 'Manning');
Insert into bk_publishers values (9507, 'J.Q. Vanderbildt');
Insert into bk_publishers values (9664, 'WROX') ;
Insert into bk_publishers values (9825, 'MySQL Press') ;
Insert into bk_publishers values (9623, 'Prentice Hall') ;
Insert into bk_publishers values (9725, 'Springer') ;
Insert into bk_publishers values (9561, 'Houghton Mifflin');
Insert into bk_publishers values (9902, 'W.W. Norton ') ;
Insert into bk_publishers values (9023, 'Holt Paperbacks') ;
Insert into bk_publishers values (9024, 'Univ of California Press') ;
Insert into bk_publishers values (9776, 'Simon and Schuster') ;
-- topics
Insert into bk_topics values ('ADO', 'ADO');
Insert into bk_topics values ('CMP', 'Computer Science');
Insert into bk_topics values ('DB', 'Database Systems');
Insert into bk_topics values ('FCT', 'Fiction');
Insert into bk_topics values ('HIST', 'History');
Insert into bk_topics values ('MYSQL', 'MySQL Database');
Insert into bk_topics values ('NET', '.NET Technologies');
Insert into bk_topics values ('NOSQL', 'Alternate Data Storage');
Insert into bk_topics values ('ORA', 'Oracle Database');
Insert into bk_topics values ('POE', 'Poetry');
Insert into bk_topics values ('PGM', 'General Programming');
Insert into bk_topics values ('SCI', 'Science');
Insert into bk_topics values ('SQL', 'SQL');
Insert into bk_topics values ('SSRV', 'SQL Server Database');
Insert into bk_topics values ('VB', 'Visual Basic');
Insert into bk_topics values ('XML', 'XML Techniques');
Insert into bk_topics values ('ART', 'Arts, Photography');
-- books
insert into bk_books values (1101, 'Programming SQL Server with VB.NET', 9000, 2002, '0735615357', 300, 59.99);
insert into bk_books values (1102, 'Practical Standards for VB.NET', 9000, 2003, '0735613568', 250, 49.99);
insert into bk_books values (1103, 'Selected Poems', 9456, 1949, null, 125, 12.00);
insert into bk_books values (1104, 'Sibley Guide to Bird Life and Behavior', 9102, 2001, '0679451234', 604, 45.00);
insert into bk_books values (1105, 'SQL:1999 Relational Language Concepts', 9745, 2002, '1558604561', 450, 59.95);
insert into bk_books values (1106, 'SQL for Smarties', 9745, 1995, '1558603239', 250, 29.00);
insert into bk_books values (1107, 'SQL Puzzles and Answers', 9745, 1997, '1558604537', 325, 25.00);
insert into bk_books values (1108, 'Database Systems', 9325, 1996, null, 680, 39.95);
insert into bk_books values (1109, 'Intro to DB Systems-7th Ed', 9325, 2000, '0201385902', 650, 80.00);
insert into bk_books values (1110, 'Adv SQL:1999 Object_Relational Features', 9745, 2002, '1558606077', 520, 59.95);
insert into bk_books values (1128, 'Temporal Data and the Relational Model', 9325, 2003, 'na', 275, 49.95);
insert into bk_books values (1133, 'Leaves of Grass', 9623, 1902, null, 125, 19.95);
insert into bk_books values (1142, 'Relational Database Theory', 9521, 1993, null, 879, 95.00);
insert into bk_books values (1161, 'SQL Programming Style', 9745, 2005, '0120887975', 780, 35.00);
insert into bk_books values (1162, 'Trees and Hierarchies', 9745, 2004, '1558609202', 350, 35.00);
insert into bk_books values (1180, 'MySQL Database Design and Tuning', 9825, 2005, '9780672234650', 400, 49.99);
insert into bk_books values (1175, 'MySQL in a Nutshell', 9822, 2008, '9780596514331', 538, 34.99);
insert into bk_books values (1182, 'MySQL Cookbook', 9822, 2007, '9780596527082', 918, 49.99);
insert into bk_books values (1185, 'MySQL Stored Procedures', 9822, 2007, '9780596100896', 595, 49.99);
insert into bk_books values (1184, 'MySQL Developer''s Library', 9325, 2009, '9780672329388', 650, 49.99);
insert into bk_books values (1301, 'ADO and Oracle Workbook', 9000, 2002, '0265615357', 0, 59.99);
insert into bk_books values (1302, 'ADO: the ebook', 9000, 2002, '0852515358', null, 49.99);
insert into bk_books values (1303, 'Rainbows and Rainbows', 9521, 2002, '0657895157', null, 59.99);
insert into bk_books values (1304, 'Stories of Discoveries', 9325, 2002, '0777788887', 300, 59.99);
insert into bk_books values (1305, 'Journeys Through Flatland', 9325, 1958, '0387515357', 100, 9.99);
insert into bk_books values (1306, 'Myths of SQL', 9664, 2000, '0454615027', 2895,259.99);
insert into bk_books values (1188, 'SQL for MySQL Developers', 9325, 2007, '9780314973851', 105, 49.99);
insert into bk_books values (1199, 'SQL is Fun', null, 2007, null, 98, 19.99);
insert into bk_books values (2002, 'SQL Server 2012 A Beginner''s Guide', 9030, 2012, '978-0071761604',832, 24.92);
insert into bk_books values (2005, 'Developer''s Guide to SQL Server 2005', 9325, 2006, '0321382188', 894, 59.99);
insert into bk_books values (2006, 'T_SQL Programming (Inside series)', 9000, 2006, '9780756978', 390, 44.99);
insert into bk_books values (2007, 'T_SQL Querying (Inside series)', 9000, 2006, '9780733132', 391, 44.99);
insert into bk_books values (2008, 'SQL Server T_Sql Recipies', 9444, 2015, '978-1484200629', 972, 48.99);
insert into bk_books values (2009, 'SQL Server 2012 for Developers', null, 2012, '78-1890774691', 814, 34.42);
insert into bk_books values (1258, '.Net Development for Microsoft Office', 9000, 2005, '0735621322', 500, 49.99);
insert into bk_books values (1278, 'Beginning VB 2008 Databases', 9444, 2008, '9781590599471', 408, 44.99);
insert into bk_books values (1279, 'Data-Driven Services with Silverlight 2', 9822, 2009, '9780596523091', 336, 44.99);
insert into bk_books values (1948, 'Framework Design Guidelines', 9325, 2006, '0321246756', 346, 44.99);
insert into bk_books values (1077, 'Programming for Poets', 9456, 2009, null, 401, 40.25);
insert into bk_books values (1835, 'Data Binding with Windows Forms 2.0', 9325, 2006, '032126892X', 634, 49.99);
insert into bk_books values (1677, 'Windows Forms 2.0 Programming', 9325, 2006, '0321267966', 982, 74.99);
insert into bk_books values (1670, 'Applied .NET Framework Programming VB.NET', 9000, 2003, '0735678772', 608, 49.99);
insert into bk_books values (2029, 'The Forgotten Bird Strikes Back ', 9030, 2010, '9091599594487', 5, 1.99);
insert into bk_books values (2031, 'Comparative SQL', 9444, 2013, '9781599591237', 750, 99.99);
insert into bk_books values (2032, 'Oracle and the rest of the world', 9030, 2013, '9091599593217', 250, 55.99);
insert into bk_books values (2622, 'Outstanding Bryophytes', 9021, 2013, null,956, 89.99);
insert into bk_books values (2623, 'Hornworts and Liverworts in your Garden ', 9021, 2013, null,501, 29.99);
insert into bk_books values (1541, 'Freethinkers: A History of American Secularism', 9023, 2004, '9780805077766', 448, 12.79);
insert into bk_books values (1542, 'The Great Agnostic: Robert Ingersoll and American Freethought',
9021, 2013, '9780300137255', 256, 16.99);
insert into bk_books values (1543, 'Ties That Bind:The Story of an Afro-Cherokee Family in Slavery and Freedom',
9024, 2006, '9780520250024', 327, 26.96);
insert into bk_books values (1544, 'The House on Diamond Hill: A Cherokee Plantation Story',
9024, 2012, '9780807872673', 336, 17.76);
insert into bk_books values (1545, 'Team of Rivals: The Political Genius of Abraham Lincoln',
9776, 2006, '9780739469767', 944, 13.96);
insert into bk_books values (1546, 'The Johnstown Flood', 9776, 1987, '9780671207144', 304, 10.39);
insert into bk_books values (1401, 'Visual Studio Tools for Office', 9325, 2006, '0321334884', 976, 54.99);
insert into bk_books values (1537, 'The BedSide Book of Birds', 9725, 2005, '0385514832', 68, 29.95);
insert into bk_books values (1357, 'Why Birds Sing', 9725, 2005, '046507135X', 240, 26.00);
insert into bk_books values (1609, 'In the Company of Crows and Ravens', 9725, 2005, '0300100760', 376, 18.95);
insert into bk_books values (1979, 'Pro VB 2008 and the .NET 3.5 Platform', 9444, 2008, '9781590598221',1368, 59.99);
insert into bk_books values (1457, 'Visual Basic 2008 Recipes', 9444, 2008, '9781590599709', 300, 79.99);
insert into bk_books values (1425, 'The Singing Life of Birds', 9561, 2005, '0618405682', 468, 28.09);
insert into bk_books values (1978, 'Acoustic Communication in Birds Vol1', 9561, 1983, '9780124268012', 360,103.91);
insert into bk_books values (1621, 'The Unfeathered Bird', 9020, 2013, '9780691151342', 304, 31.29);
insert into bk_books values (1622, 'Bird Sense', 9020, 2012, '9780802779663', 265, 25.00);
insert into bk_books values (1623, 'Lichens of North America', 9021, 2001, '9780300082494', 828,135.00);
insert into bk_books values (1624, 'Outstanding Mosses and Liverworts of Pennsylvania and Nearby States',
9021, 2006, '9780976092575', 89, 19.99);
insert into bk_books values (1626, 'Bark: A Field Guide to Trees of the Northeast', 9021, 2011, '9781584658528', 280, 25.95);
insert into bk_books values (1625, 'Winter Weed Finder: A Guide to Dry Plants in Winter (Nature Study Guides)',
9021, 1989, '9780912550176', 64, 4.95);
insert into bk_books values (1627, 'The Ants', 9022, 1990, '9780674040755', 732,120.18);
insert into bk_books values (1628, 'The Superorganism:The Beauty, Elegance, and Strangeness of Insect Societies',
9902, 2008, '9780393067040', 544, 34.65);
insert into bk_books values (1629, 'The Leafcutter Ants: Civilization by Instinct', 9022, 1990, '9780393338683', 160, 19.95);
insert into bk_books values (1630, 'The Social Conquest of Earth', 9022, 2012, '9780871404138', 352, 27.95);
insert into bk_books values (1602, 'Goblin Market and Other Poems', 9022, 2012, '9780486280554', 68, 2.95);
insert into bk_books values (1448, 'Backyard Birdsong Guide: Western North America', 9561, 2008, '9780811863971',3192, 29.99);
insert into bk_books values (1877, 'High Performance MySQL', 9822, 2008, '9780596101718', 708, 49.99);
insert into bk_books values (1200, 'The Mismeasure of Man', 9902, 1996, '9780393314250', 488, 17.95);
insert into bk_books values (1245, 'A Scientific Approach to SQL Testing', 9902, 2010, '9780366214250', 488, 52.95);
insert into bk_books values (1774, 'Ever Since Darwin', 9902, 1992, '9780393308181', 288, 15.95);
insert into bk_books values (1234, 'Hen''s Teeth and Horse''s Toes ', 9902, 1994, '9780393311037', 416, 17.95);
insert into bk_books values (1269, 'Querying XML', 9745, 2006, '9781558607118', 848, 63.95);
insert into bk_books values (1525, 'Interface-Oriented Design', 9725, 2006, '0976697050', 213, 29.99);
insert into bk_books values (1619, 'The Oject-Oriented Thought Process', 9725, 2004, '9780672326110', 158, 29.99);
insert into bk_books values (1483, 'Programming with XML', 9745, 2008, null, 125, 19.99);
insert into bk_books values (2017, 'Functional Programming', 9528, 2010, '9781933988924', 528, 49.99);
insert into bk_books values (2018, 'Oracle Database 11g SQL', 9030, 2008, '9780071498500', 650, 49.99);
insert into bk_books values (2025, 'Oracle SQL Fundamentals I Exam Guide', 9030, 2008, '9780071597869', 572, 59.99);
insert into bk_books values (2027, 'Mastering Oracle SQL and SQL-Plus', 9444, 2005, '9781590594487', 464, 39.99);
insert into bk_books values (2028, 'Mastering Oracle Databases', 9444, 2010, '9781599594487', 464, 59.99);
-- book topics
Insert into bk_book_topics values (1602, 'POE');
Insert into bk_book_topics values (2018, 'ORA');
Insert into bk_book_topics values (2018, 'SQL');
Insert into bk_book_topics values (2025, 'ORA');
Insert into bk_book_topics values (2025, 'SQL');
Insert into bk_book_topics values (2027, 'ORA');
Insert into bk_book_topics values (2027, 'SQL');
Insert into bk_book_topics values (1101, 'VB');
Insert into bk_book_topics values (1101, 'SSRV');
Insert into bk_book_topics values (1101, 'NET');
Insert into bk_book_topics values (1102, 'VB');
Insert into bk_book_topics values (1102, 'NET');
Insert into bk_book_topics values (1103, 'POE');
Insert into bk_book_topics values (1104, 'SCI');
Insert into bk_book_topics values (1105, 'SQL');
Insert into bk_book_topics values (1105, 'DB');
Insert into bk_book_topics values (1106, 'SQL');
Insert into bk_book_topics values (1107, 'SQL');
Insert into bk_book_topics values (1108, 'DB');
Insert into bk_book_topics values (1109, 'DB');
Insert into bk_book_topics values (1110, 'SQL');
Insert into bk_book_topics values (1110, 'DB');
Insert into bk_book_topics values (1128, 'DB');
Insert into bk_book_topics values (1128, 'SQL');
Insert into bk_book_topics values (1133, 'POE');
Insert into bk_book_topics values (1142, 'DB');
Insert into bk_book_topics values (1161, 'SQL');
Insert into bk_book_topics values (1301, 'ORA');
Insert into bk_book_topics values (1301, 'ADO');
Insert into bk_book_topics values (1302, 'ADO');
Insert into bk_book_topics values (1303, 'SCI');
Insert into bk_book_topics values (1303, 'POE');
Insert into bk_book_topics values (1304, 'SCI');
Insert into bk_book_topics values (1304, 'FCT');
Insert into bk_book_topics values (1304, 'POE');
Insert into bk_book_topics values (1306, 'FCT');
Insert into bk_book_topics values (1306, 'SQL');
Insert into bk_book_topics values (1162, 'SQL');
Insert into bk_book_topics values (1180, 'DB');
Insert into bk_book_topics values (1180, 'MYSQL');
Insert into bk_book_topics values (1175, 'MYSQL');
Insert into bk_book_topics values (1175, 'SQL');
Insert into bk_book_topics values (1182, 'MYSQL');
Insert into bk_book_topics values (1182, 'SQL');
Insert into bk_book_topics values (1185, 'MYSQL');
Insert into bk_book_topics values (1185, 'SQL');
Insert into bk_book_topics values (1184, 'MYSQL');
Insert into bk_book_topics values (1184, 'SQL');
Insert into bk_book_topics values (1188, 'MYSQL');
Insert into bk_book_topics values (1188, 'SQL');
Insert into bk_book_topics values (2002, 'SSRV');
Insert into bk_book_topics values (2002, 'SQL');
Insert into bk_book_topics values (2006, 'SSRV');
Insert into bk_book_topics values (2006, 'SQL');
Insert into bk_book_topics values (2007, 'SSRV');
Insert into bk_book_topics values (2007, 'SQL');
Insert into bk_book_topics values (2008, 'SSRV');
Insert into bk_book_topics values (2008, 'SQL');
Insert into bk_book_topics values (1245, 'SQL');
Insert into bk_book_topics values (1245, 'DB');
Insert into bk_book_topics values (1234, 'SCI');
Insert into bk_book_topics values (1774, 'SCI');
Insert into bk_book_topics values (1200, 'SCI');
Insert into bk_book_topics values (1877, 'MYSQL');
Insert into bk_book_topics values (1269, 'XML');
Insert into bk_book_topics values (1483, 'SQL');
Insert into bk_book_topics values (1483, 'XML');
Insert into bk_book_topics values (1483, 'PGM');
Insert into bk_book_topics values (1619, 'PGM');
Insert into bk_book_topics values (1525, 'PGM');
Insert into bk_book_topics values (1258, 'NET');
Insert into bk_book_topics values (1278, 'NET');
Insert into bk_book_topics values (1278, 'SSRV');
Insert into bk_book_topics values (1278, 'DB');
Insert into bk_book_topics values (1278, 'VB');
Insert into bk_book_topics values (1279, 'NET');
Insert into bk_book_topics values (1279, 'VB');
Insert into bk_book_topics values (1948, 'NET');
Insert into bk_book_topics values (1835, 'NET');
Insert into bk_book_topics values (1677, 'NET');
Insert into bk_book_topics values (1670, 'NET');
Insert into bk_book_topics values (1670, 'VB');
Insert into bk_book_topics values (1401, 'NET');
Insert into bk_book_topics values (1077, 'PGM');
Insert into bk_book_topics values (1077, 'POE');
Insert into bk_book_topics values (1457, 'VB');
Insert into bk_book_topics values (1979, 'VB');
Insert into bk_book_topics values (1979, 'NET');
Insert into bk_book_topics values (1630, 'SCI');
Insert into bk_book_topics values (1629, 'SCI');
Insert into bk_book_topics values (1609, 'SCI');
Insert into bk_book_topics values (1357, 'SCI');
Insert into bk_book_topics values (1537, 'SCI');
Insert into bk_book_topics values (1425, 'SCI');
Insert into bk_book_topics values (1978, 'SCI');
Insert into bk_book_topics values (1448, 'SCI');
Insert into bk_book_topics values (2029, 'FCT');
Insert into bk_book_topics values (2029, 'HIST');
Insert into bk_book_topics values (2028, 'ORA');
Insert into bk_book_topics values (2028, 'MYSQL');
Insert into bk_book_topics values (1628, 'SCI');
Insert into bk_book_topics values (1627, 'SCI');
Insert into bk_book_topics values (1626, 'SCI');
Insert into bk_book_topics values (1625, 'SCI');
Insert into bk_book_topics values (1624, 'SCI');
Insert into bk_book_topics values (1623, 'SCI');
Insert into bk_book_topics values (1622, 'SCI');
Insert into bk_book_topics values (1621, 'SCI');
Insert into bk_book_topics values (1621, 'ART');
Insert into bk_book_topics values (2031, 'ORA');
Insert into bk_book_topics values (2031, 'SQL');
Insert into bk_book_topics values (2031, 'SSRV');
Insert into bk_book_topics values (2032, 'ORA');
Insert into bk_book_topics values (2032, 'DB');
Insert into bk_book_topics values (1541, 'HIST');
Insert into bk_book_topics values (1542, 'HIST');
Insert into bk_book_topics values (1543, 'HIST');
Insert into bk_book_topics values (1544, 'HIST');
Insert into bk_book_topics values (1545, 'HIST');
Insert into bk_book_topics values (1546, 'HIST');
-- authors
insert into bk_authors values ('Paolo', 'Atzeni', 'A0110');
insert into bk_authors values ('Francesco', 'Balena', 'B2010');
insert into bk_authors values ('Joe', 'Celko', 'C0030');
insert into bk_authors values ('C.J.', 'Date', 'D0030');
insert into bk_authors values ('Valeria', 'Deantonellis', 'D0050');
insert into bk_authors values ('Alligator', 'Descartes', 'D0070');
insert into bk_authors values ('High', 'Darwin', 'D2340');
insert into bk_authors values ('Rick', 'Dobson', 'D3040');
insert into bk_authors values ('Hermann', 'Hesse', 'H0070');
insert into bk_authors values ('Michael', 'Irwin', 'I0010');
insert into bk_authors values ('Nikos', 'Lorentzos', 'L0040');
insert into bk_authors values ('Audre', 'Lorde', 'L0130');
insert into bk_authors values ('Alden', 'Lorents', 'L0140');
insert into bk_authors values ('Jim', 'Melton', 'M0053');
insert into bk_authors values ('James', 'Morgan', 'M0110');
insert into bk_authors values ('Joline', 'Morrison', 'M0150');
insert into bk_authors values ('Jeffrey', 'Richter', 'R2040');
insert into bk_authors values ('David Allen', 'Sibley', 'S0025');
insert into bk_authors values ('Walt', 'Whitman', 'W0030');
insert into bk_authors values ('William Carlos', 'Williams', 'W0060');
insert into bk_authors values ('Katrina','van Grouw','V1144');
insert into bk_authors values ('Tim','Birkhead','B1144');
insert into bk_authors values ('Susan','Munch','M2475');
insert into bk_authors values ('Irwin','Brodo','B1244');
insert into bk_authors values ('Sylvia','Sharnoff','S2144');
insert into bk_authors values ('Stephan','Sharnoff','S2145');
insert into bk_authors values ('Michael','Wojtech','W5145');
insert into bk_authors values ('Dorcas','Miller','M3145');
insert into bk_authors values ('Joseph', 'Sack','S0205');
insert into bk_authors values ('Itzik','Ben-Gan','B1112');
insert into bk_authors values ('Lubor','Kollar','K2002');
insert into bk_authors values (null,'Prince','P3002');
insert into bk_authors values ('Dejan','Sarka','S2178');
insert into bk_authors values ('Bob','Beauchemin','B2078');
insert into bk_authors values ('Dusan','Petkovic','P2308');
insert into bk_authors values ('Cruela', 'de Vil', 'D2110');
insert into bk_authors values ('Willie', 'Mammoth', 'M3110');
insert into bk_authors values ('Bill', 'Shredder', 'S3110');
insert into bk_authors values ('Pete', 'Moss', 'M4540');
insert into bk_authors values ('Terry', 'Incognito', 'I5110');
insert into bk_authors values ('Joseph', 'Sack','S0250');
insert into bk_authors values ('Rajesh', 'George','G4040');
insert into bk_authors values ('Robert', 'Schneider', 'S1164');
insert into bk_authors values ('Russel', 'Dyer', 'D8902');
insert into bk_authors values ('Jason', 'Price', 'P6030');
insert into bk_authors values ('Lex', 'de Haan', 'D6290');
insert into bk_authors values ('Roopesh', 'Ramklass', 'R0700');
insert into bk_authors values ('John', 'Watson', 'W4512');
insert into bk_authors values ('Paul','DuBois','D8956');
insert into bk_authors values ('Guy','Harrison','H0202');
insert into bk_authors values ('Steven','Feuerstein','F2987');
insert into bk_authors values ('Rick','van der Lans','L0453');
insert into bk_authors values ('Andrew', 'Whitechapel', 'W0078');
insert into bk_authors values ('Matthew', 'MacDonald', 'M0157');
insert into bk_authors values ('Vidya Vrat', 'Agarwal', 'A5748');
insert into bk_authors values ('James', 'Huddleston', 'H8972');
insert into bk_authors values ('John', 'Papa', 'P0500');
insert into bk_authors values ('Krzysztof', 'Cwalina', 'C8794');
insert into bk_authors values ('Brad', 'Abrams', 'A0094');
insert into bk_authors values ('Debra', 'Kutata', 'K7845');
insert into bk_authors values ('Brain', 'Noyes', 'N6457');
insert into bk_authors values ('Chris', 'Sells', 'S2548');
insert into bk_authors values ('Michael', 'Weinhardt', 'W2388');
insert into bk_authors values ('Eric', 'Lippert', 'L3001');
insert into bk_authors values ('Rakesh', 'Rajan', 'R0040');
insert into bk_authors values ('Allen', 'Jones', 'J6700');
insert into bk_authors values ('Todd', 'Herman', 'H0187');
insert into bk_authors values ('Eric', 'Carter', 'C0844');
insert into bk_authors values ('David', 'Rothenberg', 'R5858');
insert into bk_authors values ('Christina', 'Rossetti', 'R5808');
insert into bk_authors values ('Susan','Jackoby','J8845');
insert into bk_authors values ('Tiya','Miles','M0295');
insert into bk_authors values ('David','McCullough','M3200');
insert into bk_authors values ('Doris Kearns','Goodwin','G8495');
insert into bk_authors values ('John', 'Marzluff', 'M0024');
insert into bk_authors values ('Tony', 'Angell', 'A7745');
insert into bk_authors values ('Andrew', 'Troelsen', 'T6789');
insert into bk_authors values ('Donald', 'Kroodsma', 'K7620');
insert into bk_authors values ('Stephen Jay', 'Gould', 'G5050');
insert into bk_authors values ('Peter', 'Zaitsev', 'Z0878');
insert into bk_authors values ('Vadim', 'Tkaechenko', 'T6748');
insert into bk_authors values ('Jeremy', 'Zawodny', 'Z0897');
insert into bk_authors values ('Arjen', 'Lentz', 'L2444');
insert into bk_authors values ('Derek', 'Balling', 'B0056');
insert into bk_authors values ('Ken', 'Pugh', 'P7477');
insert into bk_authors values ('Matt', 'Weisfeld', 'W3433');
insert into bk_authors values ('Baron', 'Schwartz', 'S1900');
insert into bk_authors values ('Graeme', 'Gibson', 'G4748');
insert into bk_authors values ('Bert','Holldobler','H3145');
insert into bk_authors values ('E.O.','Wilson','W3145');
insert into bk_authors values ('Bryan','Syverson','S5145');
insert into bk_authors values ('Joel','Murach','M5145');
-- book_authors
insert into bk_book_authors values (1101, 'D3040', 1);
insert into bk_book_authors values (1102, 'B2010', 1);
insert into bk_book_authors values (1102, 'R2040', 2);
insert into bk_book_authors values (1104, 'S0025', 1);
insert into bk_book_authors values (1105, 'M0053', 1);
insert into bk_book_authors values (1106, 'C0030', 1);
insert into bk_book_authors values (1107, 'C0030', 1);
insert into bk_book_authors values (1108, 'L0140', 1);
insert into bk_book_authors values (1108, 'M0110', 2);
insert into bk_book_authors values (1109, 'D0030', 1);
insert into bk_book_authors values (1109, 'I0010', 2);
insert into bk_book_authors values (1109, 'W0060', 3);
insert into bk_book_authors values (1110, 'M0053', 1);
insert into bk_book_authors values (1128, 'D0030', 1);
insert into bk_book_authors values (1128, 'D2340', 2);
insert into bk_book_authors values (1128, 'L0040', 3);
insert into bk_book_authors values (1128, 'M0150', 4);
insert into bk_book_authors values (1133, 'W0030', 1);
insert into bk_book_authors values (1142, 'A0110', 1);
insert into bk_book_authors values (1142, 'D0050', 2);
insert into bk_book_authors values (1161, 'C0030', 1);
insert into bk_book_authors values (1162, 'C0030', 1);
insert into bk_book_authors values (1175, 'D8956', 1);
insert into bk_book_authors values (1180, 'S1164', 1);
insert into bk_book_authors values (1182, 'D8902', 1);
insert into bk_book_authors values (1184, 'D8956', 1);
insert into bk_book_authors values (1185, 'H0202', 1);
insert into bk_book_authors values (1185, 'F2987', 2);
insert into bk_book_authors values (1301, 'D2110', 1);
insert into bk_book_authors values (1302, 'M3110', 1);
insert into bk_book_authors values (1303, 'M3110', 1);
insert into bk_book_authors values (1304, 'D2110', 1);
insert into bk_book_authors values (1305, 'S3110', 1);
insert into bk_book_authors values (1306, 'S3110', 1);
insert into bk_book_authors values (1188, 'L0453', 1);
insert into bk_book_authors values (2009, 'S5145', 1);
insert into bk_book_authors values (2009, 'M5145', 2);
insert into bk_book_authors values (2008, 'S0205', 1);
insert into bk_book_authors values (2007, 'B1112', 1);
insert into bk_book_authors values (2007, 'K2002', 2);
insert into bk_book_authors values (2007, 'S2178', 3);
insert into bk_book_authors values (2006, 'B1112', 1);
insert into bk_book_authors values (2006, 'K2002', 3);
insert into bk_book_authors values (2006, 'S2178', 2);
insert into bk_book_authors values (2002, 'P2308', 1);
insert into bk_book_authors values (1602, 'R5808', 1);
insert into bk_book_authors values (1258, 'W0078', 1);
insert into bk_book_authors values (1278, 'A5748', 1);
insert into bk_book_authors values (1278, 'H8972', 2);
insert into bk_book_authors values (1279, 'P0500', 1);
insert into bk_book_authors values (1279, 'K7845', 2);
insert into bk_book_authors values (1948, 'C8794', 1);
insert into bk_book_authors values (1948, 'A0094', 2);
insert into bk_book_authors values (1835, 'N6457', 1);
insert into bk_book_authors values (1677, 'S2548', 1);
insert into bk_book_authors values (1677, 'W2388', 2);
insert into bk_book_authors values (1670, 'R2040', 1);
insert into bk_book_authors values (1670, 'B2010', 2);
insert into bk_book_authors values (1401, 'C0844', 1);
insert into bk_book_authors values (1401, 'L3001', 2);
insert into bk_book_authors values (1457, 'H0187', 1);
insert into bk_book_authors values (1457, 'J6700', 2);
insert into bk_book_authors values (1457, 'M0157', 3);
insert into bk_book_authors values (1457, 'R0040', 4);
insert into bk_book_authors values (1979, 'T6789', 1);
insert into bk_book_authors values (1609, 'M0024', 1);
insert into bk_book_authors values (1609, 'A7745', 2);
insert into bk_book_authors values (1357, 'R5858', 1);
insert into bk_book_authors values (1537, 'G4748', 1);
insert into bk_book_authors values (1541, 'J8845', 1);
insert into bk_book_authors values (1542, 'J8845', 1);
insert into bk_book_authors values (1543, 'M0295', 1);
insert into bk_book_authors values (1544, 'M0295', 1);
insert into bk_book_authors values (1545, 'G8495', 1);
insert into bk_book_authors values (1546, 'M3200', 1);
insert into bk_book_authors values (1425, 'K7620', 1);
insert into bk_book_authors values (1448, 'K7620', 1);
insert into bk_book_authors values (1978, 'K7620', 1);
insert into bk_book_authors values (1200, 'G5050', 1);
insert into bk_book_authors values (1774, 'G5050', 1);
insert into bk_book_authors values (1234, 'G5050', 1);
insert into bk_book_authors values (1877, 'S1900', 1);
insert into bk_book_authors values (1877, 'Z0878', 2);
insert into bk_book_authors values (1877, 'T6748', 3);
insert into bk_book_authors values (1877, 'Z0897', 4);
insert into bk_book_authors values (1877, 'L2444', 5);
insert into bk_book_authors values (1877, 'B0056', 6);
insert into bk_book_authors values (1269, 'M0053', 1);
insert into bk_book_authors values (1619, 'W3433', 1);
insert into bk_book_authors values (1525, 'P7477', 1);
insert into bk_book_authors values (2018, 'P6030', 1);
insert into bk_book_authors values (2025, 'D6290', 1);
insert into bk_book_authors values (2025, 'R0700', 2);
insert into bk_book_authors values (2027, 'W4512', 1);
insert into bk_book_authors values (1627, 'H3145', 1);
insert into bk_book_authors values (1627, 'W3145', 2);
insert into bk_book_authors values (1628, 'H3145', 1);
insert into bk_book_authors values (1628, 'W3145', 2);
insert into bk_book_authors values (1629, 'H3145', 1);
insert into bk_book_authors values (1629, 'W3145', 2);
insert into bk_book_authors values (1630, 'W3145', 1);
insert into bk_book_authors values (1626, 'M3145', 1);
insert into bk_book_authors values (1625, 'W5145', 1);
insert into bk_book_authors values (1623, 'B1244', 1);
insert into bk_book_authors values (1623, 'S2144', 2);
insert into bk_book_authors values (1623, 'S2145', 3);
insert into bk_book_authors values (1624, 'M2475', 1);
insert into bk_book_authors values (1622, 'B1144', 1);
insert into bk_book_authors values (1621, 'V1144', 1);
insert into bk_book_authors values (2031, 'I5110', 1);
insert into bk_book_authors values (2032, 'I5110', 1);
insert into bk_book_authors values (2622, 'M4540', 1);
insert into bk_book_authors values (2623, 'M4540', 1);
-- customers
insert into bk_customers values (208950, 'Adams', 'Samuel', 'MA', '02106', date '1996-04-15' );
insert into bk_customers values (200368, 'Blake', 'William', 'CA', '95959', date '1997-07-15' );
insert into bk_customers values (258595, 'Jobs', 'Peter', 'MA', '02575', date '1997-01-09' );
insert into bk_customers values (263119, 'Jones', null, 'IL', '62979', date '1997-03-02' );
insert into bk_customers values (224038, 'Austin', 'Pat', 'CA', '95900', date '1997-08-02' );
insert into bk_customers values (255919, 'Milton', 'John', 'NJ', '08235', date '2012-05-31' );
insert into bk_customers values (211483, 'Carroll', 'Lewis', 'CA', '94203', date '1998-08-08' );
insert into bk_customers values (221297, 'Dodgson', 'Charles', 'MI', '49327', date '2001-05-06' );
insert into bk_customers values (261502, 'Hawthorne', 'Nathaniel', 'MA', '02297', date '2001-10-12' );
insert into bk_customers values (212921, 'Books on Tap', NULL, 'CA', '94112', date '2002-01-06' );
insert into bk_customers values (260368, 'Muller', 'Jonathan', 'IL', '62885', date '2005-12-15' );
insert into bk_customers values (259969, 'Carlsen', 'Benny', 'NJ', '08505', date '2012-07-12' );
insert into bk_customers values (239427, 'Marksa', 'Anna', 'NJ', '08495', date '2012-02-28' );
insert into bk_customers values (296598, 'Collins', 'Douglas', 'MO', '65836', date '2005-04-25' );
insert into bk_customers values (276381, 'Collins', 'Douglas', 'OH', '22451', date '2005-02-08' );
insert into bk_customers values (234138, 'Keats', 'John', 'IL', '61500', date '2006-04-30' );
insert into bk_customers values (267780, 'Shelly', 'Mary', 'CA', '94100', date '2010-10-02' );
insert into bk_customers values (290298, 'Swift', 'Jonathan', 'MI', '49201', date '2010-10-12' );
insert into bk_customers values (226656, 'Randall', 'Randell', 'NJ', '08251', date '2012-08-08' );
insert into bk_customers values (222477, 'Rossetti', 'Christina', 'MI', '49742', date '2012-07-11' );
insert into bk_customers values (227105, 'Kafka', 'Franz', 'MA', '02297', date '2010-12-31' );
insert into bk_customers values (202958, 'Denver', null, 'IL', '60405', date '2012-01-15' );
insert into bk_customers values (218709, 'Bonnard', 'Paul', 'MA', '02558', date '2005-11-15' );
insert into bk_customers values (217796, 'Anders', null, 'IL', '62505', date '2012-03-30' );
insert into bk_customers values (272787, 'Carlson', 'Ben', 'IL', '62505', date '2012-05-05' );
insert into bk_customers values (234709, 'Brahms', 'Johnnie', 'MA', '02558', date '2014-08-15' );
insert into bk_customers values (217002, 'Grieg', 'Edvard', 'IL', '62329', date '2014-06-28' );
insert into bk_customers values (272611, 'Jarrett', 'Keith', 'IL', '62329', date '2014-07-11' );
insert into bk_customers values (299099, 'Sam', 'Dave', 'CA', '94141', date '2012-01-01' );
insert into bk_customers values (259906, 'Capybara', 'Wile E.', 'CA', '94132', date '2014-08-05' );
insert into bk_customers values (259907, 'Hedge', 'Mr.', 'CA', '94132', date '2012-09-05' );
insert into bk_customers values (282716, 'Biederbecke','Dwight', 'PA', '18106', date '2014-01-01' );
insert into bk_customers values (287261, 'Biederbecke','Bix', 'PA', '18106', date '2014-08-01' );
insert into bk_customers values (226275, 'Dalrymple','Jack', 'SD', '57216', date '2014-01-01' );
insert into bk_customers values (228175, 'Cardin','Benjamin', 'MD', '20609', date '2014-04-02' );
insert into bk_customers values (228275, 'Mikulski','Barbara', 'MD', '21203', date '2014-04-04' );
insert into bk_customers values (228352, 'Edwards','Donna', 'MD', '21205', date'2014-06-08' );
-- ------------------------------------------------------------------
-- orders and order_details
-- ------------------------------------------------------------------
/* Jan 2015 */
Insert into bk_order_headers values(12900, date '2015-01-25', 226656);
Insert into bk_order_details values(12900, 1, 1401, 20, 50.00);
Insert into bk_order_details values(12900, 2, 1305, 125, 5.00);
Insert into bk_order_headers values(12901, date '2015-01-26', 259906);
Insert into bk_order_details values(12901, 1, 1401, 50, 49.00);
Insert into bk_order_headers values(12354, date '2015-01-20', 290298);
Insert into bk_order_headers values(12855, date '2015-01-18', 221297);
Insert into bk_order_details values(12855, 1, 1101, 5, 59.99);
Insert into bk_order_details values(12855, 2, 1142, 5, 39.00);
Insert into bk_order_details values(12855, 3, 1162, 2, 35.00);
Insert into bk_order_headers values(12961, date '2015-01-22', 222477);
Insert into bk_order_details values(12961, 1, 1142, 1, 34.95);
Insert into bk_order_details values(12961, 2, 1128, 5, 46.95);
Insert into bk_order_details values(12961, 3, 2002, 1, 39.00);
Insert into bk_order_headers values(12962, date '2015-01-28', 267780);
Insert into bk_order_details values(12962, 1, 2009, 5, 34.95);
Insert into bk_order_details values(12962, 2, 2008, 1, 46.95);
Insert into bk_order_details values(12962, 3, 2007, 1, 39.00);
Insert into bk_order_details values(12962, 4, 2002, 1, 39.00);
/* Feb 2015 */
Insert into bk_order_headers values(12914, date '2015-02-15', 272787);
Insert into bk_order_details values(12914, 1, 1103, 23, 12.00);
Insert into bk_order_headers values(12936, date '2015-02-20', 258595);
Insert into bk_order_details values(12936, 1, 2008, 2, 12.50);
Insert into bk_order_headers values(12911, date '2015-02-12', 221297);
Insert into bk_order_details values(12911, 1, 2007, 1, 40.49);
Insert into bk_order_details values(12911, 2, 1357, 2, 23.40);
Insert into bk_order_details values(12911, 3, 1537, 3, 28.19);
Insert into bk_order_headers values(12812, date '2015-02-12', 227105);
Insert into bk_order_details values(12812, 1, 2009, 1, 26.99);
Insert into bk_order_headers values(12814, date '2015-02-15', 290298);
Insert into bk_order_details values(12814, 1, 1258, 1, 45.99);
Insert into bk_order_headers values(13142, date '2015-02-12', 227105);
Insert into bk_order_details values(13142, 1, 1279, 1, 26.99);
Insert into bk_order_headers values(13144, date '2015-02-15', 290298);
Insert into bk_order_details values(13144, 1, 1304, 1, 45.99);
Insert into bk_order_headers values(13145, date '2015-02-15', 222477);
Insert into bk_order_details values(13145, 1, 1602, 1, 2.75);
Insert into bk_order_details values(13145, 2, 1077, 2, 40.75);
/* Mar 2015 */
Insert into bk_order_headers values(13840, date '2015-03-01', 267780);
Insert into bk_order_details values(13840, 1, 1103, 2, 12.00);
Insert into bk_order_headers values(13841, date '2015-03-02', 272787);
Insert into bk_order_details values(13841, 1, 1448, 50, 25.00);
Insert into bk_order_headers values(13850, date '2015-03-02', 234138);
Insert into bk_order_details values(13850, 1, 1279, 1, 40.49);
Insert into bk_order_headers values(13224, date '2015-03-08', 218709);
Insert into bk_order_details values(13224, 1, 1101, 8, 55.19);
Insert into bk_order_headers values(13852, date '2015-03-08', 261502);
Insert into bk_order_details values(13852, 1, 1279, 1, 40.49);
Insert into bk_order_headers values(13001, date '2015-03-04', 282716);
Insert into bk_order_details values(13001, 1, 1109, 3, 25.00);
Insert into bk_order_details values(13001, 2, 1161, 3, 35.00);
Insert into bk_order_headers values(13002, date '2015-03-12', 282716);
Insert into bk_order_details values(13002, 1, 1258, 1, 44.99);
Insert into bk_order_details values(13002, 2, 1619, 2, 35.00);
Insert into bk_order_details values(13002, 3, 1948, 1, 40.94);
Insert into bk_order_details values(13002, 4, 1162, 1, 35.00);
Insert into bk_order_details values(13002, 5, 1128, 1, 46.20);
Insert into bk_order_headers values(13005, date '2015-03-13', 282716);
Insert into bk_order_details values(13005, 1, 1628, 1, 32.00);
Insert into bk_order_details values(13005, 2, 1629, 1, 19.95);
Insert into bk_order_headers values(13006, date '2015-03-13', 272787 );
Insert into bk_order_details values(13006, 1, 1628, 1, 32.00);
Insert into bk_order_details values(13006, 2, 1629, 1, 19.95);
Insert into bk_order_headers values(13007, date '2015-03-12', 272787);
Insert into bk_order_details values(13007, 1, 1258, 1, 44.99);
Insert into bk_order_details values(13007, 2, 1619, 2, 35.00);
Insert into bk_order_details values(13007, 3, 1128, 1, 46.20);
Insert into bk_order_headers values(15013, date '2015-03-20', 282716);
Insert into bk_order_details values(15013, 1, 1305, 49, 6.00);
Insert into bk_order_details values(15013, 2, 1401, 100, 65.00);
Insert into bk_order_headers values(15014, date '2015-03-21', 282716);
Insert into bk_order_details values(15014, 1, 1628, 10, 32.00);
Insert into bk_order_details values(15014, 2, 1629, 10, 19.95);
Insert into bk_order_headers values(15022, date '2015-03-22', 282716);
Insert into bk_order_details values(15022, 1, 1627, 1, 199.95);
Insert into bk_order_headers values(15023, date '2015-03-23', 282716);
Insert into bk_order_details values(15023, 1, 1978, 5, 92.00);
Insert into bk_order_headers values(15025, date '2015-03-23', 282716);
Insert into bk_order_details values(15025, 1, 1602, 300, 2.50);
Insert into bk_order_details values(15025, 3, 1602, 97, 2.00);
Insert into bk_order_headers values(15034, date '2015-03-24', 282716);
Insert into bk_order_details values(15034, 1, 1619, 1, 29.99);
Insert into bk_order_details values(15034, 2, 1619, 2, 15.95);
Insert into bk_order_headers values(15035, date '2015-03-25', 282716);
Insert into bk_order_details values(15035, 1, 1142, 2, 90.00);
Insert into bk_order_headers values(15040, date '2015-03-26', 282716);
Insert into bk_order_details values(15040, 1, 1162, 1, 32.00);
Insert into bk_order_details values(15040, 2, 1626, 1 , 19.95);
Insert into bk_order_headers values(15017, date '2015-03-26', 282716);
Insert into bk_order_details values(15017, 1, 1625, 1, 4.00);
Insert into bk_order_headers values(15008, date '2015-03-23', 282716);
Insert into bk_order_details values(15008, 1, 1628, 2, 32.00);
Insert into bk_order_details values(15008, 2, 1448, 5, 25.00);
Insert into bk_order_headers values(15009, date '2015-03-22', 282716);
Insert into bk_order_details values(15009, 2, 1142, 5, 39.00);
Insert into bk_order_headers values(14007, date '2015-03-03', 276381);
Insert into bk_order_details values(14007, 1, 1448, 50, 25.00);
Insert into bk_order_headers values(14002, date '2015-03-08', 234138);
Insert into bk_order_details values(14002, 1, 1107, 11, 25.00);
Insert into bk_order_details values(14002, 2, 1106, 12, 25.50);
Insert into bk_order_headers values(14003, date '2015-03-08', 200368);
Insert into bk_order_details values(14003, 1, 1104, 5, 45.00);
/* Apr 2015 */
Insert into bk_order_headers values(16853, date '2015-04-02', 234138);
Insert into bk_order_details values(16853, 1, 1448, 10, 30.00);
Insert into bk_order_details values(16853, 2, 1162, 20, 34.95);
Insert into bk_order_headers values(16455, date '2015-04-05', 212921);
Insert into bk_order_details values(16455, 1, 1279, 1, 40.49);
Insert into bk_order_headers values(16560, date '2015-04-15', 276381);
Insert into bk_order_details values(16560, 1, 1279, 1, 40.49);
Insert into bk_order_headers values(16256, date '2015-04-08', 272787);
Insert into bk_order_details values(16256, 1, 1103, 2, 12.00);
Insert into bk_order_details values(16256, 2, 1104, 1, 45.00);
/* May 2015 */
Insert into bk_order_headers values(23890, date '2015-05-01', 212921);
Insert into bk_order_details values(23890, 1, 1103, 11, 15.00);
Insert into bk_order_headers values(25803, date '2015-05-02', 224038);
Insert into bk_order_details values(25803, 1, 1128, 25, 45.00);
Insert into bk_order_details values(25803, 2, 1301, 15, 45.50);
Insert into bk_order_details values(25803, 3, 1304, 5, 59.99);
Insert into bk_order_headers values(22774, date '2015-05-04', 239427);
Insert into bk_order_details values(22774, 1, 1304, 50, 45.00);
Insert into bk_order_details values(22774, 2, 1305, 50, 9.99);
Insert into bk_order_headers values(22812, date '2015-05-05', 260368);
Insert into bk_order_details values(22812, 1, 1128, 1, 49.95);
Insert into bk_order_headers values(24802, date '2015-05-06', 228175);
Insert into bk_order_details values(24802, 1, 1103, 3, 15.00);
Insert into bk_order_details values(24802, 2, 1306, 5, 250.12);
Insert into bk_order_headers values(22891, date '2015-05-05', 228175);
Insert into bk_order_details values(22891, 1, 1142, 1, 15.00);
Insert into bk_order_headers values(22345, date '2015-05-26', 224038);
Insert into bk_order_details values(22345, 1, 1104, 5, 45.00);
Insert into bk_order_details values(22345, 2, 1306, 5, 250.12);
Insert into bk_order_headers values(22331, date '2015-05-24', 212921);
Insert into bk_order_details values(22331, 1, 1142, 5, 15.00);
/* June 2015 */
Insert into bk_order_headers values(32903, date '2015-06-02', 226656);
Insert into bk_order_details values(32903, 1, 1401, 1, 58.00);
Insert into bk_order_headers values(32904, date '2015-06-04', 259906);
Insert into bk_order_details values(32904, 1, 1305, 450, 5.19);
Insert into bk_order_details values(32904, 2, 1448, 4, 29.69);
Insert into bk_order_headers values(32553, date '2015-06-12', 227105);
Insert into bk_order_details values(32553, 1, 1103, 200, 12.00);
Insert into bk_order_details values(32553, 2, 1104, 100, 45.00);
Insert into bk_order_headers values(32554, date '2015-06-20', 290298);
Insert into bk_order_headers values(32555, date '2015-06-18', 221297);
Insert into bk_order_details values(32555, 1, 1101, 5, 59.99);
Insert into bk_order_details values(32555, 2, 1142, 5, 39.00);
Insert into bk_order_details values(32555, 3, 1162, 2, 35.00);
Insert into bk_order_headers values(32561, date '2015-06-22', 222477);
Insert into bk_order_details values(32561, 1, 1142, 1, 34.95);
Insert into bk_order_details values(32561, 2, 1128, 5, 46.95);
Insert into bk_order_details values(32561, 3, 2002, 1, 39.00);
Insert into bk_order_headers values(32562, date '2015-06-28', 267780);
Insert into bk_order_details values(32562, 1, 2009, 5, 34.95);
Insert into bk_order_details values(32562, 2, 2008, 1, 46.95);
Insert into bk_order_details values(32562, 3, 2007, 1, 39.00);
Insert into bk_order_details values(32562, 4, 2002, 1, 39.00);
Insert into bk_order_headers values(30814, date '2015-06-15', 272787);
Insert into bk_order_details values(30814, 1, 1103, 23, 12.00);
Insert into bk_order_headers values(30815, date '2015-06-16', 272787);
Insert into bk_order_details values(30815, 1, 1448, 155, 25.00);
Insert into bk_order_headers values(32254, date '2015-06-23', 263119);
Insert into bk_order_details values(32254, 2, 2008, 10, 46.95);
Insert into bk_order_details values(32254, 3, 2007, 10, 39.00);
Insert into bk_order_headers values(18255, date '2015-06-28', 267780);
Insert into bk_order_details values(18255, 1, 1101, 5, 59.99);
Insert into bk_order_details values(18255, 2, 1142, 5, 39.00);
Insert into bk_order_details values(18255, 3, 1162, 2, 35.00);
Insert into bk_order_headers values(18261, date '2015-06-28', 200368);
Insert into bk_order_details values(18261, 1, 1142, 100, 34.95);
Insert into bk_order_details values(18261, 2, 1128, 50, 46.95);
Insert into bk_order_details values(18261, 3, 2002, 100, 39.00);
Insert into bk_order_headers values(32905, date '2015-06-02', 259906);
Insert into bk_order_details values(32905, 1, 2028, 1, 58.00);
Insert into bk_order_headers values(21841, date '2015-06-02', 267780);
Insert into bk_order_details values(21841, 1, 1448, 50, 25.00);
Insert into bk_order_headers values(21850, date '2015-06-02', 261502);
Insert into bk_order_details values(21850, 1, 1162, 1, 30.49);
Insert into bk_order_details values(21850, 2, 1109, 1, 25.00);
Insert into bk_order_headers values(28045, date '2015-06-18', 267780);
Insert into bk_order_details values(28045, 1, 1128, 1, 35.99);
Insert into bk_order_headers values(2200, date '2015-06-18', 261502);
Insert into bk_order_details values(2200, 1, 1200, 5, 16.33);
Insert into bk_order_details values(2200, 2, 1180, 5, 45.99);
Insert into bk_order_details values(2200, 3, 1128, 5, 46.20);
/* July 2015 */
Insert into bk_order_headers values(51262, date '2015-07-02', 272787);
Insert into bk_order_details values(51262, 1, 2009, 5, 34.95);
Insert into bk_order_details values(51262, 4, 2002, 1, 39.00);
Insert into bk_order_headers values(51300, date '2015-07-05', 261502);
Insert into bk_order_headers values(51302, date '2015-07-05', 222477);
Insert into bk_order_details values(51302, 1, 1258, 1, 44.99);
Insert into bk_order_headers values(51310, date '2015-07-09', 218709);
Insert into bk_order_details values(51310, 1, 1774, 1, 14.67);
Insert into bk_order_details values(51310, 2, 1619, 1, 26.99);
Insert into bk_order_details values(51310, 3, 1269, 1, 58.83);
Insert into bk_order_headers values(51321, date '2015-07-29', 261502);
Insert into bk_order_details values(51321, 1, 2008, 20, 54.59);
Insert into bk_order_details values(51321, 2, 1978, 10, 95.60);
Insert into bk_order_headers values(51328, date '2015-07-30', 290298);
Insert into bk_order_details values(51328, 1, 1182, 70, 44.99);
Insert into bk_order_headers values(51345, date '2015-07-30', 227105);
Insert into bk_order_details values(51345, 1, 1105, 40, 55.15);
Insert into bk_order_headers values(32906, date '2015-07-04', 259906);
Insert into bk_order_details values(32906, 1, 2028, 2, 58.50);
Insert into bk_order_details values(32906, 2, 1103, 11, 15.00);
Insert into bk_order_details values(32906, 3, 1103, 1, 5.75);
Insert into bk_order_headers values(22909, date '2015-07-25', 239427);
Insert into bk_order_details values(22909, 1, 1104, 5, 45.00);
Insert into bk_order_headers values(22910, date '2015-07-25', 218709);
Insert into bk_order_details values(22910, 1, 1105, 5, 49.99);
Insert into bk_order_details values(22910, 2, 1162, 5, 35.00);
Insert into bk_order_headers values(32997, date '2015-07-22', 239427);
Insert into bk_order_details values(32997, 1, 1948, 5, 40.94);
Insert into bk_order_details values(32997, 2, 1199, 5, 18.39);
Insert into bk_order_details values(32997, 3, 1457, 5, 53.99);
Insert into bk_order_details values(32997, 4, 1133, 5, 18.15);
Insert into bk_order_details values(32997, 5, 1162, 5, 36.79);
Insert into bk_order_headers values(32998, date '2015-07-22', 261502);
Insert into bk_order_details values(32998, 1, 2006, 3, 20.00);
Insert into bk_order_headers values(41005, date '2015-07-28', 290298);
Insert into bk_order_details values(41005, 1, 1142, 2, 42.45);
Insert into bk_order_details values(41005, 2, 1107, 4, 21.50);
Insert into bk_order_headers values(41006, date '2015-07-28', 267780);
Insert into bk_order_details values(41006, 1, 1142, 10, 42.95);
Insert into bk_order_headers values(42899, date '2015-07-29', 261502);
Insert into bk_order_details values(42899, 1, 1128, 5, 25.00);
Insert into bk_order_details values(42899, 2, 1103, 1 , 10.95);
/* August 2015 */
Insert into bk_order_headers values(32907, date '2015-08-04', 259906);
Insert into bk_order_details values(32907, 1, 2028, 3, 58.00);
Insert into bk_order_details values(32907, 2, 1142, 10, 11.14);
Insert into bk_order_headers values(81346, date '2015-08-03', 227105);
Insert into bk_order_details values(81346, 1, 1619, 100, 26.99);
Insert into bk_order_details values(81346, 2, 1401, 200, 50.04);
Insert into bk_order_details values(81346, 3, 1108, 600, 27.60);
Insert into bk_order_headers values(18347, date '2015-08-03', 218709);
Insert into bk_order_details values(18347, 1, 1258, 1, 44.99);
Insert into bk_order_details values(18347, 2, 1619, 2, 35.00);
Insert into bk_order_details values(18347, 3, 1948, 1, 40.94);
Insert into bk_order_details values(18347, 4, 1162, 1, 35.00);
Insert into bk_order_details values(18347, 5, 1128, 1, 46.20);
Insert into bk_order_headers values(18409, date '2015-08-07', 267780);
Insert into bk_order_headers values(18410, date '2015-08-07', 261502);
Insert into bk_order_details values(18410, 1, 2006, 35, 20.00);
Insert into bk_order_headers values(21254, date '2015-08-23', 263119);
Insert into bk_order_details values(21254, 2, 2008, 10, 46.95);
Insert into bk_order_details values(21254, 3, 2007, 10, 39.00);
Insert into bk_order_headers values(21255, date '2015-08-28', 267780);
Insert into bk_order_details values(21255, 1, 1101, 5, 59.99);
Insert into bk_order_details values(21255, 2, 1142, 5, 39.00);
Insert into bk_order_details values(21255, 3, 1162, 2, 35.00);
Insert into bk_order_headers values(21261, date '2015-08-28', 200368);
Insert into bk_order_details values(21261, 1, 1142, 100, 34.95);
Insert into bk_order_details values(21261, 2, 1128, 50, 46.95);
Insert into bk_order_details values(21261, 3, 2002, 100, 39.00);
Insert into bk_order_headers values(14011, date '2015-08-12', 227105);
Insert into bk_order_details values(14011, 1, 1128, 50, 25.00);
Insert into bk_order_headers values(14020, date '2015-08-12', 227105);
Insert into bk_order_details values(14020, 1, 1109, 30, 25.00);
Insert into bk_order_details values(14020, 2, 1161, 30, 35.00);
Insert into bk_order_headers values(14042, date '2015-08-18', 267780);
Insert into bk_order_details values(14042, 1, 1128, 25, 12.50);
Insert into bk_order_details values(14042, 2, 2008, 40, 34.95);
Insert into bk_order_details values(14042, 3, 2007, 25, 35.00);
Insert into bk_order_headers values(14083, date '2015-08-11', 267780);
Insert into bk_order_details values(14083, 1, 1162, 1, 32.45);
Insert into bk_order_details values(14083, 2, 1161, 3, 35.00);
Insert into bk_order_headers values(14091, date '2015-08-12', 222477);
Insert into bk_order_details values(14091, 1, 1128, 1, 49.95);
Insert into bk_order_details values(14091, 2, 1161, 1, 35.00);
Insert into bk_order_details values(14091, 3, 2002, 1, 39.00);
Insert into bk_order_headers values(15052, date '2015-08-12', 227105);
Insert into bk_order_details values(15052, 1, 1102, 2, 49.99);
Insert into bk_order_headers values(32900, date '2015-08-25', 226656);
Insert into bk_order_details values(32900, 1, 1401, 20, 50.00);
Insert into bk_order_details values(32900, 2, 1305, 125, 5.00);
Insert into bk_order_headers values(32901, date '2015-08-26', 259906);
Insert into bk_order_details values(32901, 1, 1401, 50, 49.00);
Insert into bk_order_headers values(32902, date '2015-08-27', 259906);
Insert into bk_order_details values(32902, 1, 1305, 49, 6.00);
Insert into bk_order_details values(32902, 2, 1401, 100, 65.00);
/* September 2015 */
Insert into bk_order_headers values(30835, date '2015-09-17', 211483);
Insert into bk_order_details values(30835, 1, 1103, 25, 10.95);
Insert into bk_order_headers values(30836, date '2015-09-20', 258595);
Insert into bk_order_details values(30836, 1, 2008, 2, 12.50);
Insert into bk_order_headers values(61811, date '2015-09-12', 221297);
Insert into bk_order_details values(61811, 1, 2007, 1, 40.49);
Insert into bk_order_details values(61811, 2, 1357, 2, 23.40);
Insert into bk_order_details values(61811, 3, 1537, 3, 28.19);
Insert into bk_order_headers values(61812, date '2015-09-12', 227105);
Insert into bk_order_details values(61812, 1, 2009, 1, 26.99);
Insert into bk_order_headers values(61814, date '2015-09-15', 290298);
Insert into bk_order_details values(61814, 1, 1258, 1, 45.99);
Insert into bk_order_headers values(61818, date '2015-09-16', 212921);
Insert into bk_order_details values(61818, 1, 1106, 30, 20.00);
Insert into bk_order_details values(61818, 2, 1537, 2, 25.00);
Insert into bk_order_details values(61818, 3, 1180, 1, 46.99);
Insert into bk_order_details values(61818, 4, 1979, 1, 53.99);
Insert into bk_order_headers values(51710, date '2015-09-08', 261502);
Insert into bk_order_details values(51710, 1, 2009, 99, 245.49);
Insert into bk_order_headers values(51712, date '2015-09-09', 290298);
Insert into bk_order_details values(51712, 1, 1835, 1, 45.99);
Insert into bk_order_details values(51712, 2, 1162, 99, 30.00);
Insert into bk_order_headers values(52004, date '2015-09-22', 272787);
Insert into bk_order_details values(52004, 2, 1161, 1, 35.00);
Insert into bk_order_headers values(52005, date '2015-09-30', 272787);
Insert into bk_order_details values(52005, 1, 1448, 50, 25.00);
Insert into bk_order_headers values(52012, date '2015-09-22', 272787);
Insert into bk_order_details values(52012, 1, 1448, 50, 25.00);
Insert into bk_order_headers values(52013, date '2015-09-22', 272787);
Insert into bk_order_details values(52013, 1, 2009, 2, 12.50);
Insert into bk_order_headers values(50847, date '2015-09-20', 296598);
Insert into bk_order_details values(50847, 1, 1103, 2, 12.00);
Insert into bk_order_headers values(50848, date '2015-09-21', 263119);
Insert into bk_order_details values(50848, 1, 2007, 2, 12.50);
Insert into bk_order_headers values(50849, date '2015-09-22', 217796);
Insert into bk_order_details values(50849, 1, 1448, 50, 25.00);
Insert into bk_order_headers values(51833, date '2015-09-08', 218709);
Insert into bk_order_details values(51833, 1, 1101, 8, 55.19);
Insert into bk_order_details values(51833, 2, 1104, 1, 45.00);
Insert into bk_order_details values(51833, 3, 1162, 20, 34.95);
Insert into bk_order_details values(51833, 4, 1279, 1, 40.49);
Insert into bk_order_headers values(51850, date '2015-09-08', 299099);
Insert into bk_order_details values(51850, 1, 1677, 1, 70.00);
Insert into bk_order_headers values(51851, date '2015-09-12', 259969);
Insert into bk_order_details values(51851, 1, 1162, 1, 35.00);
Insert into bk_order_details values(51851, 2, 1269, 1, 63.95);
Insert into bk_order_details values(51851, 3, 2017, 1, 49.99);
Insert into bk_order_headers values(51852, date '2015-09-12', 259969);
Insert into bk_order_details values(51852, 1, 2032, 1, 0.00);
Insert into bk_order_details values(51852, 3, 2017, 1, 0.00);
Insert into bk_order_headers values(51853, date '2015-09-25', 218709);
Insert into bk_order_details values(51853, 4, 1161, 100, 25.25);
Insert into bk_order_headers values(51854, date '2015-09-26', 239427);
Insert into bk_order_details values(51854, 3, 1537, 15, 15.37);
Insert into bk_order_headers values(51855, date '2015-09-26', 260368);
Insert into bk_order_details values(51855, 4, 1200, 2, 17.00);
Insert into bk_order_details values(51855, 1, 1200, 4, 16.00);
Insert into bk_order_details values(51855, 2, 1200, 2, 16.00);
Insert into bk_order_details values(51855, 3, 1200, 3, 17.00);
Insert into bk_order_headers values(51856, date '2015-09-28', 272611);
Insert into bk_order_details values(51856, 4, 1546, 2, 10.39);
Insert into bk_order_details values(51856, 1, 1545, 2, 13.00);
Insert into bk_order_headers values(72820, date '2015-09-19', 227105);
Insert into bk_order_details values(72820, 1, 1628, 6, 32.00);
Insert into bk_order_details values(72820, 2, 1629, 6, 19.95);
Insert into bk_order_headers values(72821, date '2015-09-19', 222477);
Insert into bk_order_details values(72821, 1, 1258, 1, 44.99);
Insert into bk_order_headers values(72812, date '2015-09-30', 239427);
Insert into bk_order_details values(72812, 1, 1357, 40, 26.00);
Insert into bk_order_details values(72812, 2, 1425, 40, 28.09);
Insert into bk_order_headers values(72813, date '2015-09-30', 239427);
Insert into bk_order_details values(72813, 1, 1175, 1, 45.00);
Insert into bk_order_details values(72813, 2, 1180, 1, 49.99);
Insert into bk_order_details values(72813, 3, 1182, 1, 45.00);
/* October 2015 */
/* November 2015 */
Insert into bk_order_headers values(30816, date '2015-11-06', 272787);
Insert into bk_order_details values(30816, 1, 1448, 50, 25.00);
Insert into bk_order_headers values(30820, date '2015-11-10', 234138);
Insert into bk_order_details values(30820, 1, 1448, 50, 25.00);
Insert into bk_order_headers values(30821, date '2015-11-10', 217796);
Insert into bk_order_details values(30821, 1, 1103, 2, 10.95);
Insert into bk_order_headers values(30822, date '2015-11-12', 211483);
Insert into bk_order_details values(30822, 1, 1128, 10, 49.95);
Insert into bk_order_headers values(30855, date '2015-11-23', 282716);
Insert into bk_order_details values(30855, 1, 1602, 500, 2.00);
Insert into bk_order_headers values(51840, date '2015-11-01', 267780);
Insert into bk_order_details values(51840, 1, 1103, 2, 12.00);
Insert into bk_order_headers values(51841, date '2015-11-02', 272787);
Insert into bk_order_details values(51841, 1, 1448, 50, 25.00);
Insert into bk_order_details values(51841, 2, 1279, 1, 40.49);
Insert into bk_order_headers values(51842, date '2015-11-18', 222477);
Insert into bk_order_details values(51842, 1, 1162, 1, 35.99);
Insert into bk_order_details values(51842, 2, 1199, 5, 18.39);
Insert into bk_order_details values(51842, 4, 1133, 5, 18.15);
Insert into bk_order_headers values(30824, date '2015-11-05', 222477);
Insert into bk_order_details values(30824, 1, 1670, 10, 40.00);
Insert into bk_order_details values(30824, 4, 2005, 20, 45.00);
Insert into bk_order_headers values(20019, date '2015-11-02', 272787);
Insert into bk_order_details values(20019, 1, 1448, 50, 25.00);
Insert into bk_order_headers values(20029, date '2015-11-12', 272787);
Insert into bk_order_details values(20029, 1, 1103, 20, 10.95);
Insert into bk_order_headers values(20038, date '2015-11-12', 272787);
Insert into bk_order_details values(20038, 1, 1103, 2, 12.00);
Insert into bk_order_headers values(15648, date '2015-11-18', 227105);
Insert into bk_order_details values(15648, 1, 1106, 50, 34.95);
Insert into bk_order_details values(15648, 2, 1107, 50, 20.95);
Insert into bk_order_details values(15648, 3, 2002, 50, 39.00);
Insert into bk_order_headers values(18003, date '2015-11-12', 217796);
Insert into bk_order_details values(18003, 1, 2009, 5, 34.95);
Insert into bk_order_details values(18003, 2, 2008, 1, 46.95);
Insert into bk_order_headers values(18013, date '2015-11-13', 217796);
Insert into bk_order_details values(18013, 1, 1103, 2, 10.95);
Insert into bk_order_details values(18013, 2, 1106, 1, 29.00);
Insert into bk_order_headers values(30825, date '2015-11-21', 221297);
Insert into bk_order_details values(30825, 1, 1128, 4, 45.49);
Insert into bk_order_headers values(30826, date '2015-11-24', 211483);
Insert into bk_order_details values(30826, 2, 1161, 16, 35.00);
Insert into bk_order_headers values(30833, date '2015-11-14', 211483);
Insert into bk_order_details values(30833, 1, 1448, 50, 25.00);
Insert into bk_order_headers values(30834, date '2015-11-17', 211483);
Insert into bk_order_details values(30834, 1, 1128, 1, 49.95);
Insert into bk_order_headers values(82897, date '2015-11-22', 261502);
Insert into bk_order_details values(82897, 1, 1128, 10, 49.95);
Insert into bk_order_details values(82897, 2, 1161, 10, 35.00);
Insert into bk_order_details values(82897, 3, 2002, 10, 39.00);
Insert into bk_order_headers values(82898, date '2015-11-22', 261502);
Insert into bk_order_details values(82898, 1, 2006, 3, 20.00);
Insert into bk_order_details values(82898, 4, 1188, 3, 49.99);
Insert into bk_order_details values(82898, 3, 1877, 3, 45.00);
Insert into bk_order_details values(82898, 2, 1629, 1, 19.95);
Insert into bk_order_headers values(81005, date '2015-11-28', 290298);
Insert into bk_order_details values(81005, 1, 1142, 2, 42.45);
Insert into bk_order_details values(81005, 2, 1107, 4, 21.50);
Insert into bk_order_headers values(81006, date '2015-11-28', 208950);
Insert into bk_order_details values(81006, 1, 1103, 10, 10.95);
Insert into bk_order_headers values(82899, date '2015-11-29', 261502);
Insert into bk_order_details values(82899, 1, 1128, 50, 25.00);
Insert into bk_order_details values(82899, 2, 1184, 5, 49.99);
Insert into bk_order_details values(82899, 3, 1185, 5, 49.99);
Insert into bk_order_details values(82899, 4, 1175, 5, 34.90);
Insert into bk_order_details values(82899, 5, 1425, 5, 25.90);
/* December 2015 */
Insert into bk_order_headers values(60002, date '2015-12-03', 222477);
Insert into bk_order_details values(60002, 1, 1103, 2, 10.95);
Insert into bk_order_details values(60002, 2, 1106, 1, 29.00);
Insert into bk_order_headers values(60005, date '2015-12-06', 227105);
Insert into bk_order_details values(60005, 1, 1110, 2, 50.00);
Insert into bk_order_details values(60005, 2, 1161, 100, 44.99);
Insert into bk_order_details values(60005, 3, 1128, 400, 41.40);
Insert into bk_order_headers values(60009, date '2015-12-11', 267780);
Insert into bk_order_details values(60009, 1, 1162, 1, 32.45);
Insert into bk_order_details values(60009, 2, 1161, 3, 35.00);
Insert into bk_order_details values(60009, 3, 1142, 100, 34.95);
Insert into bk_order_details values(60009, 4, 1128, 50, 46.95);
Insert into bk_order_details values(60009, 5, 2002, 100, 39.00);
Insert into bk_order_headers values(60011, date '2015-12-02', 272787);
Insert into bk_order_details values(60011, 1, 1162, 1, 32.45);
Insert into bk_order_details values(60011, 2, 1161, 3, 35.00);
Insert into bk_order_details values(60011, 3, 2028, 1, 58.00);
Insert into bk_order_headers values(60012, date '2015-12-11', 267780);
Insert into bk_order_details values(60012, 1, 1162, 1, 32.45);
Insert into bk_order_details values(60012, 2, 1161, 3, 35.00);
Insert into bk_order_headers values(60018, date '2015-12-12', 222477);
Insert into bk_order_details values(60018, 1, 1128, 1, 49.95);
Insert into bk_order_details values(60018, 2, 1161, 1, 35.00);
Insert into bk_order_details values(60018, 3, 2002, 1, 39.00);
Insert into bk_order_headers values(60019, date '2015-12-12', 227105);
Insert into bk_order_details values(60019, 1, 1101, 5, 59.99);
Insert into bk_order_details values(60019, 2, 1142, 5, 39.00);
Insert into bk_order_details values(60019, 3, 1162, 2, 35.00);
Insert into bk_order_headers values(60029, date '2015-12-22', 222477);
Insert into bk_order_details values(60029, 1, 1628, 1, 32.00);
Insert into bk_order_details values(60029, 2, 1629, 1, 19.95);
Insert into bk_order_details values(60029, 3, 1258, 1, 44.99);
Insert into bk_order_details values(60029, 4, 1619, 2, 35.00);
Insert into bk_order_details values(60029, 5, 1128, 1, 46.20);
Insert into bk_order_headers values(60025, date '2015-12-28', 267780);
Insert into bk_order_details values(60025, 1, 1627, 1, 199.95);
Insert into bk_order_headers values(60030, date '2015-12-24', 221297);
Insert into bk_order_details values(60030, 1, 1627, 1, 199.95);
Insert into bk_order_headers values(60039, date '2015-12-12', 227105);
Insert into bk_order_details values(60039, 1, 2009, 1, 26.99);
Insert into bk_order_details values(60039, 3, 1602, 97, 2.00);
Insert into bk_order_details values(60039, 2, 1448, 5, 25.00);
Insert into bk_order_details values(60039, 4, 1305, 50, 9.99);
Insert into bk_order_headers values(60032, date '2015-12-31', 290298);
Insert into bk_order_details values(60032, 1, 1101, 5, 59.99);
Insert into bk_order_details values(60032, 2, 1142, 5, 39.00);
Insert into bk_order_details values(60032, 3, 1162, 2, 35.00);
Insert into bk_order_details values(60032, 4, 1401, 50, 46.95);
Insert into bk_order_details values(60032, 6, 2002, 100, 39.00);
Insert into bk_order_details values(60032, 7, 1128, 5, 25.00);
Insert into bk_order_details values(60032, 8, 1103, 1 , 10.95);
Insert into bk_order_headers values(60027, date '2015-12-31', 227105);
Insert into bk_order_details values(60027, 1, 2032, 1, 0.00);
Insert into bk_order_details values(60027, 3, 2017, 1, 0.00);
Insert into bk_order_details values(60027, 4, 1161, 100, 25.25);
Insert into bk_order_details values(60027, 6, 1537, 15, 15.37);
-- ---------------------------------------------------------------
/* January 2016 */
Insert into bk_order_headers values(31840, date '2016-01-01', 267780);
Insert into bk_order_details values(31840, 1, 1103, 2, 12.00);
Insert into bk_order_headers values(31841, date '2016-01-02', 272787);
Insert into bk_order_details values(31841, 1, 1448, 50, 25.00);
Insert into bk_order_headers values(31850, date '2016-01-02', 234138);
Insert into bk_order_details values(31850, 1, 1279, 1, 40.49);
Insert into bk_order_headers values(1200, date '2016-01-18', 212921);
Insert into bk_order_details values(1200, 1, 1200, 5, 16.33);
Insert into bk_order_details values(1200, 2, 1199, 5, 18.39);
Insert into bk_order_details values(1200, 3, 1457, 5, 53.99);
Insert into bk_order_details values(1200, 4, 1133, 5, 18.15);
Insert into bk_order_details values(1200, 5, 1448, 5, 36.79);
Insert into bk_order_details values(1200, 6, 1948, 5, 40.94);
Insert into bk_order_details values(1200, 7, 1180, 5, 45.99);
Insert into bk_order_details values(1200, 8, 1128, 5, 46.20);
Insert into bk_order_headers values(12005, date '2016-01-20', 212921);
Insert into bk_order_details values(12005, 1, 1448, 1, 27.29);
Insert into bk_order_headers values(51845, date '2016-01-01', 212921);
Insert into bk_order_details values(51845, 1, 1103, 11, 15.00);
Insert into bk_order_details values(51845, 2, 1301, 15, 45.50);
Insert into bk_order_details values(51845, 3, 1304, 5, 59.99);
Insert into bk_order_details values(51845, 4, 1541, 5, 12.00);
Insert into bk_order_details values(51845, 5, 1545, 5, 13.96);
Insert into bk_order_headers values(51846, date '2016-01-08', 234138);
Insert into bk_order_details values(51846, 1, 1107, 11, 25.00);
Insert into bk_order_details values(51846, 2, 1546, 12, 10.39);
Insert into bk_order_details values(51846, 3, 2002, 5, 39.00);
Insert into bk_order_details values(51846, 4, 1103, 2, 12.00);
Insert into bk_order_details values(51846, 5, 1541, 2, 12.00);
Insert into bk_order_headers values(51857, date '2016-01-08', 259969);
Insert into bk_order_details values(51857, 2, 1425, 2, 28.09);
Insert into bk_order_details values(51857, 3, 1609, 1, 18.95);
Insert into bk_order_details values(51857, 4, 1109, 1, 80.00);
Insert into bk_order_details values(51857, 5, 2009, 1, 29.99);
Insert into bk_order_headers values(51858, date '2016-01-08', 259969);
Insert into bk_order_details values(51858, 2, 1133, 3, 19.95);
Insert into bk_order_details values(51858, 3, 1609, 3, 18.95);
Insert into bk_order_headers values(51859, date '2016-01-08', 272611);
Insert into bk_order_details values(51859, 2, 1128, 1, 49.99);
Insert into bk_order_details values(51859, 1, 1269, 1, 63.95);
Insert into bk_order_headers values(51860, date '2016-01-08', 299099);
Insert into bk_order_details values(51860, 4, 2032, 1, 55.99);
/* February 2016 */
Insert into bk_order_headers values(19224, date '2016-02-08', 218709);
Insert into bk_order_details values(19224, 1, 1101, 8, 55.19);
Insert into bk_order_headers values(19253, date '2016-02-08', 272787);
Insert into bk_order_details values(19253, 1, 1103, 2, 12.00);
Insert into bk_order_details values(19253, 2, 1104, 1, 45.00);
Insert into bk_order_headers values(31852, date '2016-02-08', 261502);
Insert into bk_order_details values(31852, 1, 1279, 1, 40.49);
Insert into bk_order_headers values(31853, date '2016-02-02', 234138);
Insert into bk_order_details values(31853, 1, 1448, 10, 30.00);
Insert into bk_order_details values(31853, 2, 1162, 20, 34.95);
Insert into bk_order_headers values(31855, date '2016-02-05', 212921);
Insert into bk_order_details values(31855, 1, 1279, 1, 40.49);
Insert into bk_order_headers values(91307, date '2016-02-12', 272787);
Insert into bk_order_details values(91307, 1, 1258, 1, 44.99);
Insert into bk_order_details values(91307, 2, 1619, 2, 35.00);
Insert into bk_order_headers values(31860, date '2016-02-15', 276381);
Insert into bk_order_details values(31860, 1, 1279, 1, 40.49);
Insert into bk_order_headers values(51847, date '2016-02-04', 217796);
Insert into bk_order_details values(51847, 1, 1541, 2, 10.95);
Insert into bk_order_details values(51847, 2, 1542, 1, 16.99);
Insert into bk_order_headers values(51848, date '2016-02-05', 276381);
Insert into bk_order_details values(51848, 1, 1544, 50, 17.76);
Insert into bk_order_headers values(51849, date '2016-02-08', 218709);
Insert into bk_order_details values(51849, 1, 1543, 50, 25.00);
Insert into bk_order_details values(51849, 2, 1544, 50, 17.76);
Insert into bk_order_headers values(51861, date '2016-02-01', 260368);
Insert into bk_order_details values(51861, 1, 2032, 1, 57.99);
Insert into bk_order_details values(51861, 2, 2032, 2, 59.99);
Insert into bk_order_headers values(51862, date '2016-02-02', 272611);
Insert into bk_order_details values(51862, 1, 1627, 4, 120.18);
Insert into bk_order_headers values(51863, date '2016-02-03', 239427);
Insert into bk_order_details values(51863, 1, 1629, 42, 19.95);
Insert into bk_order_headers values(51864, date '2016-02-03', 299099);
Insert into bk_order_details values(51864, 2, 1628, 3, 34.65);
Insert into bk_order_details values(51864, 3, 1108, 342,34.65);
Insert into bk_order_details values(51864, 4, 1628, 4, 34.65);
Insert into bk_order_headers values(91013, date '2016-02-20', 282716);
Insert into bk_order_details values(91013, 1, 1619, 49, 6.00);
Insert into bk_order_details values(91013, 2, 1128, 100, 65.00);
Insert into bk_order_headers values(91014, date '2016-02-21', 282716);
Insert into bk_order_details values(91014, 1, 1628, 10, 32.00);
Insert into bk_order_details values(91014, 2, 1629, 10, 19.95);
Insert into bk_order_headers values(94106, date '2016-02-28', 267780);
Insert into bk_order_details values(94106, 1, 1142, 10, 42.95);
Insert into bk_order_headers values(94299, date '2016-02-29', 261502);
Insert into bk_order_details values(94299, 1, 1128, 5, 25.00);
Insert into bk_order_details values(94299, 2, 1103, 1 , 10.95);
Insert into bk_order_details values(94299, 3, 1128, 1, 46.20);
Insert into bk_order_headers values(92812, date '2016-02-19', 260368);
Insert into bk_order_details values(92812, 1, 1142, 1, 49.95);
Insert into bk_order_headers values(94802, date '2016-02-20', 228175);
Insert into bk_order_details values(94802, 1, 1103, 3, 15.00);
Insert into bk_order_details values(94802, 2, 1306, 5, 250.12);
Insert into bk_order_headers values(92905, date '2016-02-22', 259906);
Insert into bk_order_details values(92905, 1, 2028, 1, 58.00);
Insert into bk_order_headers values(91841, date '2016-02-22', 267780);
Insert into bk_order_details values(91841, 1, 1142, 150, 25.00);
Insert into bk_order_headers values(91850, date '2016-02-22', 261502);
Insert into bk_order_details values(91850, 1, 1162, 1, 30.49);
Insert into bk_order_details values(91850, 2, 1109, 1, 25.00);
/* March 2016 */
Insert into bk_order_headers values(44890, date '2016-03-01', 212921);
Insert into bk_order_details values(44890, 1, 1103, 11, 15.00);
Insert into bk_order_headers values(44803, date '2016-03-02', 224038);
Insert into bk_order_details values(44803, 1, 1128, 25, 45.00);
Insert into bk_order_details values(44803, 2, 1301, 15, 45.50);
Insert into bk_order_details values(44803, 3, 1304, 5, 59.99);
Insert into bk_order_headers values(44804, date '2016-03-04', 239427);
Insert into bk_order_details values(44804, 1, 1304, 50, 45.00);
Insert into bk_order_details values(44804, 2, 1305, 50, 9.99);
Insert into bk_order_headers values(41012, date '2016-03-05', 260368);
Insert into bk_order_details values(41012, 1, 1128, 1, 49.95);
Insert into bk_order_headers values(44805, date '2016-03-06', 224038);
Insert into bk_order_details values(44805, 1, 1104, 5, 45.00);
Insert into bk_order_details values(44805, 2, 1306, 5, 250.12);
Insert into bk_order_headers values(44891, date '2016-03-05', 212921);
Insert into bk_order_details values(44891, 1, 1142, 5, 15.00);
Insert into bk_order_headers values(41007, date '2016-03-03', 276381);
Insert into bk_order_details values(41007, 1, 1448, 50, 25.00);
Insert into bk_order_headers values(41002, date '2016-03-08', 234138);
Insert into bk_order_details values(41002, 1, 1107, 11, 25.00);
Insert into bk_order_details values(41002, 2, 1106, 12, 25.50);
Insert into bk_order_headers values(41003, date '2016-03-08', 200368);
Insert into bk_order_details values(41003, 1, 1104, 5, 45.00);
Insert into bk_order_headers values(44606, date '2016-03-14', 217796);
Insert into bk_order_details values(44606, 1, 1106, 5, 34.95);
Insert into bk_order_details values(44606, 2, 1107, 5, 20.95);
Insert into bk_order_details values(44606, 3, 2002, 5, 39.00);
Insert into bk_order_headers values(44610, date '2016-03-15', 263119);
Insert into bk_order_details values(44610, 1, 1103, 2, 12.00);
Insert into bk_order_headers values(44615, date '2016-03-15', 261502);
Insert into bk_order_details values(44615, 1, 1103, 2, 12.00);
Insert into bk_order_headers values(1602, date '2016-03-14', 217796);
Insert into bk_order_details values(1602, 1, 1103, 2, 10.95);
Insert into bk_order_details values(1602, 2, 1106, 1, 29.00);
Insert into bk_order_headers values(1008, date '2016-03-10', 276381);
Insert into bk_order_details values(1008, 1, 1670, 50, 40.00);
Insert into bk_order_headers values(1010, date '2016-03-10', 218709);
Insert into bk_order_details values(1010, 1, 1537, 50, 25.00);
Insert into bk_order_headers values(1011, date '2016-03-10', 261502);
Insert into bk_order_details values(1011, 1, 1103, 2, 10.95);
Insert into bk_order_headers values(1603, date '2016-03-10', 261502);
Insert into bk_order_details values(1603, 1, 2009, 5, 34.95);
Insert into bk_order_details values(1603, 3, 2007, 1, 39.00);
Insert into bk_order_details values(1603, 4, 2002, 1, 39.00);
Insert into bk_order_headers values(1604, date '2016-03-10', 217796);
Insert into bk_order_details values(1604, 1, 1103, 25, 10.95);
Insert into bk_order_details values(1604, 2, 1106, 15, 29.00);
Insert into bk_order_headers values(32892, date '2016-03-10', 272611);
Insert into bk_order_details values(32892, 1, 2002, 5, 15.00);
Insert into bk_order_headers values(1027, date '2016-03-18', 234709);
Insert into bk_order_details values(1027, 1, 2002, 21, 49.99);
Insert into bk_order_details values(1027, 2, 1077, 22, 10.99);
Insert into bk_order_headers values(1004, date '2016-03-18', 221297);
Insert into bk_order_details values(1004, 1, 1106, 2, 18.25);
Insert into bk_order_headers values(32896, date '2016-03-18', 218709);
Insert into bk_order_details values(32896, 1, 1162, 1, 35.99);
Insert into bk_order_headers values(1028, date '2016-03-20', 234709);
Insert into bk_order_details values(1028, 1, 2002, 1, 19.78);
Insert into bk_order_details values(1028, 2, 2002, 22, 40.00);
Insert into bk_order_details values(1028, 3, 2009, 1, 19.95);
Insert into bk_order_details values(1028, 4, 2006, 1, 46.95);
Insert into bk_order_headers values(1661, date '2016-03-15', 261502);
Insert into bk_order_details values(1661, 1, 1103, 97, 2.00);
Insert into bk_order_headers values(1030, date '2016-03-22', 234709);
Insert into bk_order_details values(1030, 1, 1279, 1, 40.49);
Insert into bk_order_headers values(1039, date '2016-03-22', 212921);
Insert into bk_order_details values(1039, 1, 1448, 1, 30.00);
Insert into bk_order_details values(1039, 2, 1162, 2, 34.95);
Insert into bk_order_headers values(1040, date '2016-03-28', 263119);
Insert into bk_order_details values(1040, 1, 2025, 560, 39.00);
Insert into bk_order_details values(1040, 2, 2018, 2, 49.99);
Insert into bk_order_headers values(31884, date '2016-03-22', 290298);
Insert into bk_order_details values(31884, 1, 1278, 1, 48.00);
Insert into bk_order_details values(31884, 2, 1199, 9, 17.99);
Insert into bk_order_headers values(31885, date '2016-03-22', 217796);
Insert into bk_order_details values(31885, 1, 1448, 50, 25.00);
Insert into bk_order_headers values(31889, date '2016-03-22', 227105);
Insert into bk_order_details values(31889, 1, 1109, 18, 50.60);
Insert into bk_order_headers values(22806, date '2016-03-23', 239427);
Insert into bk_order_details values(22806, 1, 1107, 1, 25.00);
Insert into bk_order_headers values(22807, date '2016-03-23', 224038);
Insert into bk_order_details values(22807, 1, 1175, 1, 34.99);
Insert into bk_order_headers values(22808, date '2016-03-24', 290298);
Insert into bk_order_details values(22808, 1, 1182, 1, 45.00);
Insert into bk_order_headers values(22809, date '2016-03-25', 239427);
Insert into bk_order_details values(22809, 1, 1104, 5, 45.00);
Insert into bk_order_headers values(22810, date '2016-03-25', 218709);
Insert into bk_order_details values(22810, 1, 1182, 5, 49.99);
Insert into bk_order_details values(22810, 2, 1162, 5, 35.00);
Insert into bk_order_headers values(32897, date '2016-03-22', 261502);
Insert into bk_order_details values(32897, 1, 1110, 2, 50.00);
Insert into bk_order_headers values(32898, date '2016-03-22', 261502);
Insert into bk_order_details values(32898, 1, 2006, 3, 20.00);
Insert into bk_order_headers values(1005, date '2016-03-28', 290298);
Insert into bk_order_details values(1005, 1, 1142, 2, 42.45);
Insert into bk_order_details values(1005, 2, 1107, 4, 21.50);
Insert into bk_order_headers values(1006, date '2016-03-28', 208950);
Insert into bk_order_details values(1006, 1, 1103, 10, 10.95);
Insert into bk_order_headers values(32899, date '2016-03-29', 261502);
Insert into bk_order_details values(32899, 1, 1128, 50, 25.00);
Insert into bk_order_headers values(32800, date '2016-03-29', 217796);
Insert into bk_order_details values(32800, 1, 1128, 50, 25.00);
Insert into bk_order_headers values(22312, date '2016-03-31', 239427);
Insert into bk_order_details values(22312, 1, 1357, 50, 26.00);
Insert into bk_order_details values(22312, 2, 1425, 50, 28.09);
Insert into bk_order_headers values(22813, date '2016-03-31', 239427);
Insert into bk_order_details values(22813, 1, 1175, 1, 45.00);
Insert into bk_order_details values(22813, 2, 1180, 1, 49.99);
Insert into bk_order_details values(22813, 3, 1182, 1, 45.00);
Insert into bk_order_details values(22813, 4, 1184, 1, 49.99);
Insert into bk_order_details values(22813, 5, 1185, 1, 49.99);
Insert into bk_order_details values(22813, 6, 1188, 1, 49.99);
Insert into bk_order_details values(22813, 7, 1877, 1, 45.00);
Insert into bk_order_details values(22813, 8, 1175, 1, 34.90);
Insert into bk_order_details values(22813, 9, 1425, 1, 25.90);
Insert into bk_order_headers values(22820, date '2016-03-19', 227105);
Insert into bk_order_details values(22820, 1, 1628, 1, 32.00);
Insert into bk_order_details values(22820, 2, 1629, 1, 19.95);
Insert into bk_order_headers values(22821, date '2016-03-19', 222477);
Insert into bk_order_details values(22821, 1, 1258, 1, 44.99);
Insert into bk_order_headers values(22825, date '2016-03-21', 267780);
Insert into bk_order_details values(22825, 1, 1619, 2, 35.00);
Insert into bk_order_details values(22825, 2, 1128, 1, 46.20);
Insert into bk_order_details values(22825, 3, 1162, 1, 32.45);
Insert into bk_order_headers values(31830, date '2016-03-21', 227105);
Insert into bk_order_details values(31830, 1, 1161, 3, 35.00);
Insert into bk_order_details values(31830, 2, 1142, 100, 34.95);
Insert into bk_order_headers values(31837, date '2016-03-21', 222477);
Insert into bk_order_details values(31837, 1, 1128, 50, 46.95);
Insert into bk_order_headers values(31866, date '2016-03-26', 290298);
Insert into bk_order_details values(31866, 1, 2028, 2, 58.50);
Insert into bk_order_details values(31866, 2, 1103, 11, 15.00);
Insert into bk_order_details values(31866, 3, 1103, 1, 5.75);
Insert into bk_order_headers values(32845, date '2016-03-27', 227105);
Insert into bk_order_details values(32845, 1, 1162, 2, 35.00);
Insert into bk_order_headers values(32849, date '2016-03-27', 290298);
Insert into bk_order_details values(32849, 1, 1401, 50, 46.95);
Insert into bk_order_details values(32849, 2, 2002, 100, 39.00);
Insert into bk_order_details values(32849, 3, 1128, 5, 25.00);
Insert into bk_order_details values(32849, 4, 1103, 1 , 10.95);
/* April 2016 */
Insert into bk_order_headers values(62905, date '2016-04-2', 259906);
Insert into bk_order_details values(62905, 1, 2028, 1, 58.00);
Insert into bk_order_headers values(62906, date '2016-04-04', 259906);
Insert into bk_order_details values(62906, 1, 2028, 2, 58.50);
Insert into bk_order_details values(62906, 2, 1103, 11, 15.00);
Insert into bk_order_details values(62906, 3, 1103, 1, 5.75);
Insert into bk_order_headers values(66409, date '2016-04-07', 267780);
Insert into bk_order_details values(66409, 1, 2002, 100, 39.00);
Insert into bk_order_details values(66409, 2, 1101, 5, 59.99);
Insert into bk_order_details values(66409, 3, 1142, 5, 39.00);
Insert into bk_order_headers values(66483, date '2016-04-11', 267780);
Insert into bk_order_details values(66483, 1, 1162, 1, 32.45);
Insert into bk_order_details values(66483, 2, 1161, 3, 35.00);
Insert into bk_order_headers values(65491, date '2016-04-12', 222477);
Insert into bk_order_details values(65491, 1, 1128, 1, 49.95);
Insert into bk_order_details values(65491, 2, 1161, 1, 35.00);
Insert into bk_order_details values(65491, 3, 2002, 1, 39.00);
Insert into bk_order_headers values(65552, date '2016-04-12', 227105);
Insert into bk_order_details values(65552, 1, 1102, 2, 49.99);
Insert into bk_order_details values(65552, 2, 2002, 100, 39.00);
/* May 2016 */
Insert into bk_order_headers values(61871, date '2016-05-03', 276381);
Insert into bk_order_details values(61871, 1, 1448, 1, 30.00);
Insert into bk_order_details values(61871, 2, 1162, 2, 34.95);
Insert into bk_order_headers values(61872, date '2016-05-03', 200368);
Insert into bk_order_details values(61872, 1, 1448, 100, 30.00);
Insert into bk_order_headers values(61563, date '2016-05-03', 222477);
Insert into bk_order_details values(61563, 1, 1103, 2, 10.95);
Insert into bk_order_details values(61563, 2, 1106, 1, 29.00);
Insert into bk_order_headers values(61601, date '2016-05-06', 221297);
Insert into bk_order_details values(61601, 1, 1107, 1, 22.50);
Insert into bk_order_details values(61601, 2, 1483, 5, 18.19);
Insert into bk_order_details values(61601, 4, 1448, 5, 26.99);
Insert into bk_order_headers values(61702, date '2016-05-06', 227105);
Insert into bk_order_details values(61702, 1, 1110, 2, 50.00);
Insert into bk_order_headers values(61705, date '2016-05-06', 261502);
Insert into bk_order_details values(61705, 1, 1483, 100, 44.99);
Insert into bk_order_details values(61705, 2, 1128, 400, 41.40);
Insert into bk_order_headers values(64873, date '2016-05-11', 267780);
Insert into bk_order_details values(64873, 1, 1162, 1, 32.45);
Insert into bk_order_details values(64873, 2, 1161, 3, 35.00);
Insert into bk_order_headers values(61605, date '2016-05-06', 217796);
Insert into bk_order_details values(61605, 1, 1106, 5, 34.95);
/* Jun 2016 */
Insert into bk_order_headers values(75261, date '2016-06-28', 200368);
Insert into bk_order_details values(75261, 1, 1142, 100, 34.95);
Insert into bk_order_details values(75261, 2, 1128, 50, 46.95);
Insert into bk_order_details values(75261, 3, 2002, 100, 39.00);
Insert into bk_order_headers values(75262, date '2016-06-02', 272787);
Insert into bk_order_details values(75262, 1, 2009, 5, 34.95);
Insert into bk_order_details values(75262, 4, 2002, 1, 39.00);
Insert into bk_order_details values(75262, 2, 1107, 5, 20.95);
Insert into bk_order_details values(75262, 3, 2002, 5, 39.00);
Insert into bk_order_headers values(75300, date '2016-06-05', 261502);
Insert into bk_order_headers values(75321, date '2016-06-29', 261502);
Insert into bk_order_details values(75321, 1, 2008, 20, 54.59);
Insert into bk_order_details values(75321, 2, 1978, 10, 95.60);
Insert into bk_order_headers values(75328, date '2016-06-30', 290298);
Insert into bk_order_details values(75328, 1, 1182, 70, 44.99);
Insert into bk_order_headers values(75345, date '2016-06-30', 227105);
Insert into bk_order_details values(75345, 1, 1105, 40, 55.15);
Insert into bk_order_details values(75345, 4, 2007, 1, 39.00);
Insert into bk_order_details values(75345, 5, 2008, 1, 39.00);
Insert into bk_order_headers values(74883, date '2016-06-11', 267780);
Insert into bk_order_details values(74883, 1, 1162, 1, 32.45);
Insert into bk_order_details values(74883, 2, 1161, 3, 35.00);
/* Jul 2016 */
Insert into bk_order_headers values(78144, date '2016-07-15', 290298);
Insert into bk_order_details values(78144, 1, 1304, 1, 45.99);
Insert into bk_order_details values(78144, 2, 2009, 5, 34.95);
Insert into bk_order_details values(78144, 3, 1101, 8, 55.95);
Insert into bk_order_details values(78144, 4, 1103, 5, 10.00);
Insert into bk_order_headers values(78145, date '2016-07-15', 222477);
Insert into bk_order_details values(78145, 1, 1602, 1, 2.75);
Insert into bk_order_details values(78145, 2, 1077, 2, 40.75);
Insert into bk_order_headers values(75281, date '2016-07-28', 200368);
Insert into bk_order_details values(75281, 1, 1142, 100, 34.95);
Insert into bk_order_details values(75281, 2, 1128, 50, 46.95);
Insert into bk_order_details values(75281, 3, 2002, 100, 39.00);
Insert into bk_order_headers values(75561, date '2016-07-22', 222477);
Insert into bk_order_details values(75561, 1, 1142, 1, 34.95);
Insert into bk_order_details values(75561, 2, 1128, 5, 46.95);
Insert into bk_order_details values(75561, 3, 2002, 1, 39.00);
/* Aug 2016 */
Insert into bk_order_headers values(75483, date '2016-08-11', 267780);
Insert into bk_order_details values(75483, 1, 1162, 1, 32.45);
Insert into bk_order_details values(75483, 2, 1161, 3, 35.00);
Insert into bk_order_headers values(75491, date '2016-08-12', 222477);
Insert into bk_order_details values(75491, 1, 1110, 2, 50.00);
Insert into bk_order_details values(75491, 2, 1629, 1, 19.95);
Insert into bk_order_headers values(73005, date '2016-08-13', 282716);
Insert into bk_order_details values(73005, 1, 1628, 1, 32.00);
Insert into bk_order_details values(73005, 2, 1629, 1, 19.95);
Insert into bk_order_headers values(73006, date '2016-08-13', 272787 );
Insert into bk_order_details values(73006, 1, 1628, 1, 32.00);
Insert into bk_order_details values(73006, 2, 1629, 1, 19.95);
commit;
| true |
9f4a857fdc72de31090f2309f3e4eebc5512968d
|
SQL
|
php-service-bus/sagas
|
/src/Store/Sql/schema/indexes.sql
|
UTF-8
| 149 | 2.65625 | 3 |
[
"LicenseRef-scancode-unknown-license-reference",
"MIT"
] |
permissive
|
CREATE INDEX IF NOT EXISTS sagas_state ON sagas_store (state_id);
CREATE INDEX IF NOT EXISTS saga_closed_index ON sagas_store (state_id, closed_at);
| true |
9669590977cc4aa495affb306edfb1fa99613748
|
SQL
|
M4th3m4tic4l/wow-emulator-archive
|
/WoWD - 03.2006/wowd-sql/char_actions.sql
|
UTF-8
| 496 | 2.53125 | 3 |
[] |
no_license
|
SET FOREIGN_KEY_CHECKS=0;
#----------------------------
# Table structure for char_actions
#----------------------------
CREATE TABLE `char_actions` (
`charId` int(6) NOT NULL default '0',
`button` int(2) unsigned NOT NULL default '0',
`action` int(6) unsigned NOT NULL default '0',
`type` int(3) unsigned NOT NULL default '0',
`misc` int(3) NOT NULL default '0'
) TYPE=MyISAM;
#----------------------------
# No records for table char_actions
#----------------------------
| true |
eb6f0a68b3ffdb6b5287166658e4d621ff15beca
|
SQL
|
Evisas/EvisasTurismo
|
/src/main/resources/data/sql/create.sql
|
UTF-8
| 1,814 | 3.359375 | 3 |
[] |
no_license
|
/*
DROP DATABASE IF EXISTS evisas;
CREATE DATABASE evisas COLLATE utf8mb4_unicode_ci;
USE evisas;
*/
CREATE TABLE usuarios
(
id bigint NOT NULL AUTO_INCREMENT PRIMARY KEY,
nome varchar(80) NOT NULL,
email varchar(40) NOT NULL UNIQUE,
telefone numeric(11),
senha varchar(15) NOT NULL
);
CREATE TABLE funcionarios
(
id bigint NOT NULL AUTO_INCREMENT PRIMARY KEY,
nome varchar(80) NOT NULL,
email varchar(40) NOT NULL UNIQUE,
matricula numeric(4) NOT NULL UNIQUE,
senha varchar(15) NOT NULL
);
CREATE TABLE solicitacoesPassaporte
(
id bigint NOT NULL AUTO_INCREMENT PRIMARY KEY,
nomeSolicitante varchar(80) NOT NULL,
cpfSolicitante numeric(11) NOT NULL,
rgSolicitante numeric(20) NOT NULL,
dataSolicitacao datetime NOT NULL,
status enum('PENDENTE', 'ACEITA', 'RECUSADA', 'CANCELADA') NOT NULL,
observacao varchar(100),
motivoRecusa varchar(100),
previsaoSaida date NOT NULL,
idUsuario bigint,
CONSTRAINT FOREIGN KEY (idUsuario) REFERENCES usuarios(id) ON DELETE SET NULL
);
CREATE TABLE solicitacoesVisto
(
id bigint NOT NULL AUTO_INCREMENT PRIMARY KEY,
nomeSolicitante varchar(80) NOT NULL,
cpfSolicitante numeric(11) NOT NULL,
paisResidencia varchar(30) NOT NULL,
paisAVisitar varchar(30) NOT NULL,
possuiPassaporte boolean NOT NULL,
dataNascimentoSolicitante date NOT NULL,
-- documento
dataSolicitacao datetime NOT NULL,
status enum('PENDENTE', 'ACEITA', 'RECUSADA', 'CANCELADA') NOT NULL,
observacao varchar(100),
motivoRecusa varchar(100),
idUsuario bigint,
CONSTRAINT FOREIGN KEY (idUsuario) REFERENCES usuarios(id) ON DELETE SET NULL
);
| true |
3abc18d47f13923e766be3a977ada438189d6390
|
SQL
|
TechieFrogs-Achievers/JavaBasics
|
/Ramya Kondapalli/src/SQL/useSelectStatements.sql
|
UTF-8
| 4,934 | 3.375 | 3 |
[] |
no_license
|
USE SelectStatements
CREATE TABLE Books_Details
(
book_Id VARCHAR(50) NOT NULL,
book_title VARCHAR(100) NOT NULL,
book_author varchar(100) NOT NULL,
Totalbooks_count int NULL,
Available_books INT,
book_issueDate DATETIME,
book_returnDate DATETIME,
pay_fine FLOAT,
book_student VARCHAR(100) NOT NULL,
Duration int NULL,
);
CREATE TABLE Student_Details
(
stu_Id INT NOT NULL,
stu_Name VARCHAR(50) NOT NULL,
stu_Stream VARCHAR(50) NULL,
books_count INT NULL,
fine FLOAT,
);
--Few records for book details table
INSERT into Books_Details
(book_Id,book_title,book_author,Totalbooks_count,Available_books,book_issueDate,
book_returnDate,pay_fine,book_student,Duration)
values('1872F','C-langauge','BalaGuruswamy',42,14,'12-mar-2019','21-mar-2019',0.0,'Joel',10);
INSERT into Books_Details
(book_Id,book_title,book_author,Totalbooks_count,Available_books, book_issueDate,
book_returnDate,pay_fine,book_student,Duration)
values('2624J','java programming langauge','Nageswara rao',55,9,'7-Nov-2019','21-Nov-2019',15.0,'Manish',14);
INSERT into Books_Details
(book_Id,book_title,book_author,Totalbooks_count,Available_books, book_issueDate,
book_returnDate,pay_fine,book_student,Duration)
values('4251A','Analog electronics','L.K.Maheswari',36,10,'26-Apr-2019','11-May-2019',5.0,'Sai',16);
INSERT into Books_Details
(book_Id,book_title,book_author,Totalbooks_count,Available_books, book_issueDate,
book_returnDate,pay_fine,book_student,Duration)
values('2431M','Micro Processors','D.A.Godse',20,10,'18-Jan-2019','21-Feb-2019',80.0,'Harsha',28);
INSERT into Books_Details
(book_Id,book_title,book_author,Totalbooks_count,Available_books, book_issueDate,
book_returnDate,pay_fine,book_student,Duration)
values('8261X','Surveying','N.N.Basak',17,6,'12-Mar-2019','25-Mar-2019',0.0,'Darwin',15);
INSERT into Books_Details
(book_Id,book_title,book_author,Totalbooks_count,Available_books, book_issueDate,
book_returnDate,pay_fine,book_student,Duration)
values('645B','Engineering Drawing','P.s.Gill',60,17,'11-Mar-2019','22-Mar-2019',0.0,'Adhi',11);
INSERT into Books_Details
(book_Id,book_title,book_author,Totalbooks_count,Available_books, book_issueDate,
book_returnDate,pay_fine,book_student,Duration)
values('645M','Engineering Drawing','P.s.Gill',60,15,'5-July-2019','25-July-2019',25.0,'Lovely',20);
INSERT into Books_Details
(book_Id,book_title,book_author,Totalbooks_count,Available_books, book_issueDate,
book_returnDate,pay_fine,book_student,Duration)
values('2431A','Micro Processors','D.A.Godse',20,12,'20-jan-2019','10-Feb-2019',35.0,'Harsha',22);
INSERT into Books_Details
(book_Id,book_title,book_author,Totalbooks_count,Available_books,book_issueDate,
book_returnDate,pay_fine,book_student,Duration)
values('1872O','C-langauge','BalaGuruswamy',42,5,'12-Aug-2019','20-Aug-2019',0.0,'Yamini',8);
INSERT into Books_Details
(book_Id,book_title,book_author,Totalbooks_count,Available_books, book_issueDate,
book_returnDate,pay_fine,book_student,Duration)
values('2624P','java programming langauge','Nageswara rao',55,18,'1-Dec-2019','21-Dec-2019',30.0,'Manish',21);
--few records for students details table
INSERT into Student_Details
(stu_Id,stu_Name,stu_Stream,books_count,fine)
VALUES (407,'Ramya','ECE',4,12.0)
INSERT into Student_Details
(stu_Id,stu_Name,stu_Stream,books_count,fine)
VALUES (512,'Priyanka','CSE',6,46.0)
INSERT into Student_Details
(stu_Id,stu_Name,stu_Stream,books_count,fine)
VALUES (347,'Swathi','AGRI',6,23.0)
INSERT into Student_Details
(stu_Id,stu_Name,stu_Stream,books_count,fine)
VALUES (424,'Mohana','ECE',1,0.0)
INSERT into Student_Details
(stu_Id,stu_Name,stu_Stream,books_count,fine)
VALUES (506,'jameema','CSE',3,8.0)
INSERT into Student_Details
(stu_Id,stu_Name,stu_Stream,books_count,fine)
VALUES (577,'Yamini','CSE',4,14.0)
INSERT into Student_Details
(stu_Id,stu_Name,stu_Stream,books_count,fine)
VALUES (332,'Divya','AGRI',6,37.0)
INSERT into Student_Details
(stu_Id,stu_Name,stu_Stream,books_count,fine)
VALUES (589,'Alkehya','CSE',4,8.0)
INSERT into Student_Details
(stu_Id,stu_Name,stu_Stream,books_count,fine)
VALUES (410,'Neeraja','ECE',6,13.0)
INSERT into Student_Details
(stu_Id,stu_Name,stu_Stream,books_count,fine)
VALUES (550,'Bindhu','CSE',3,12.0)
INSERT into Student_Details
(stu_Id,stu_Name,stu_Stream,books_count,fine)
VALUES (490,'Sasi','ECE',4,6.0)
INSERT into Student_Details
(stu_Id,stu_Name,stu_Stream,books_count,fine)
VALUES (333,'Mounika','AGRI',2,4.0)
INSERT into Student_Details
(stu_Id,stu_Name,stu_Stream,books_count,fine)
VALUES (476,'Satya','ECE',1,0.0)
INSERT into Student_Details
(stu_Id,stu_Name,stu_Stream,books_count,fine)
VALUES (555,'Shirin','CSE',2,0.0)
INSERT into Student_Details
(stu_Id,stu_Name,stu_Stream,books_count,fine)
VALUES (598,'Teja','CSE',5,11.0)
INSERT into Student_Details
(stu_Id,stu_Name,stu_Stream,books_count,fine)
VALUES (534,'Prasanthi','CSE',3,5.0)
| true |
e3ffd7a929f17be1cc3961456139bad8cf4ac72a
|
SQL
|
Shirleyxxy/lc-sql-database
|
/exchange-seats.SQL
|
UTF-8
| 658 | 4.40625 | 4 |
[] |
no_license
|
-- CASE WHEN + mod + subquery for different cases
-- Logic:
-- odd id (not the last id) --> id + 1
-- odd id (last id) --> id
-- even id --> id - 1
-- IF
SELECT IF(id % 2 = 0, id-1, IF(id = (SELECT COUNT(*) FROM seat), id, id+1) ) AS id, student
FROM seat
ORDER BY id ASC
-- IF (My preferred solution)
SELECT IF(id % 2 = 1, IF(id = (SELECT MAX(id) FROM seat), id, id+1), id-1) AS id,
student
FROM seat
ORDER BY id ASC
-- CASE WHEN
SELECT (CASE WHEN id % 2 != 0 AND id != cnt THEN id + 1
WHEN id % 2 != 0 AND id = cnt THEN id
ELSE id - 1 END) AS id, student
FROM seat, (SELECT COUNT(*) AS cnt FROM seat) AS t
ORDER BY id ASC
| true |
1cc66fafa5981a368188d363b23269d599862ac3
|
SQL
|
j7ng/CLFY_SA
|
/SA/Indexes/PRODUCTBIN_NAME_IND.sql
|
UTF-8
| 96 | 2.6875 | 3 |
[] |
no_license
|
CREATE UNIQUE INDEX sa.productbin_name_ind ON sa.table_productbin(parent_type,parent_id,"NAME");
| true |
0dbb297362aa462e9a0f5c8158ec0089a586a81e
|
SQL
|
MarceloSilvarolla/YFM-Database-and-Fusion-Guide
|
/Test preliminarily general fusions/SwordArmOfDragon.sql
|
UTF-8
| 3,278 | 3.875 | 4 |
[] |
no_license
|
-- Test Sword Arm of Dragon fusions
--[Dragon] + [Warrior] = Dragon Statue (1100/900)
-- = Dragoness the Wicked Knight (1200/900)
-- < Flame Swordsman (1800/1600)
-- = D. Human (1300/1100)
-- = Sword Arm of Dragon (1750/2030)
-- < Skelgon (1700/1900),
-- Flame Swordsman (1800/1600),
-- Dark Elf (2000/800)
DROP TABLE IF EXISTS PredictedFusionsForSwordArmOfDragon;
DROP TABLE IF EXISTS FusionsForSwordArmOfDragon;
DROP TABLE IF EXISTS IncorrectPredictedFusionsForSwordArmOfDragon;
DROP TABLE IF EXISTS IncorrectPredictedFusionsForSwordArmOfDragonPlus;
DROP TABLE IF EXISTS MissingPredictedFusionsForSwordArmOfDragon;
-- Create table with predicted fusions resulting in Sword Arm of Dragon
CREATE TEMPORARY TABLE PredictedFusionsForSwordArmOfDragon AS
SELECT C1.CardName AS Material1Name, C1.CardType AS Material1Type, C1.CardSecTypes AS Material1SecTypes, C1.Attack as Material1Attack,
C2.CardName AS Material2Name, C2.CardType AS Material2Type, C2.CardSecTypes AS Material2SecTypes, C2.Attack as Material2Attack
FROM Cards AS C1
JOIN Cards AS C2
WHERE
C1.IsDragon = 1 AND C2.CardType = 'Warrior' AND
C1.Attack < 1750 AND C2.Attack < 1750 AND
(C1.Attack >= 1300 OR C2.Attack >= 1300);
INSERT INTO PredictedFusionsForSwordArmOfDragon
SELECT Material2Name, Material2Type, Material2SecTypes, Material2Attack,
Material1Name, Material1Type, Material1SecTypes, Material1Attack
FROM PredictedFusionsForSwordArmOfDragon;
-- Create table with actual fusions for Sword Arm of Dragon
CREATE TEMPORARY TABLE FusionsForSwordArmOfDragon AS
SELECT Material1Name, Material1Type, Material1SecTypes, Material1Attack,
Material2Name, Material2Type, Material2SecTypes, Material2Attack
FROM FusionsPlus
WHERE ResultName = 'Sword Arm of Dragon';
-- Compare predictions with actual Fusions
CREATE TEMPORARY TABLE IncorrectPredictedFusionsForSwordArmOfDragon AS
SELECT * FROM PredictedFusionsForSwordArmOfDragon
EXCEPT
SELECT * FROM FusionsForSwordArmOfDragon;
CREATE TEMPORARY TABLE IncorrectPredictedFusionsForSwordArmOfDragonPlus AS
SELECT IncorrectPredictedFusionsForSwordArmOfDragon.Material1Name,
IncorrectPredictedFusionsForSwordArmOfDragon.Material1Type,
IncorrectPredictedFusionsForSwordArmOfDragon.Material1SecTypes,
IncorrectPredictedFusionsForSwordArmOfDragon.Material1Attack,
IncorrectPredictedFusionsForSwordArmOfDragon.Material2Name,
IncorrectPredictedFusionsForSwordArmOfDragon.Material2Type,
IncorrectPredictedFusionsForSwordArmOfDragon.Material2SecTypes,
IncorrectPredictedFusionsForSwordArmOfDragon.Material2Attack,
FusionsPlus.ResultName, FusionsPlus.ResultType,
FusionsPlus.ResultSecTypes, FusionsPlus.ResultAttack
FROM IncorrectPredictedFusionsForSwordArmOfDragon
LEFT JOIN FusionsPlus
ON IncorrectPredictedFusionsForSwordArmOfDragon.Material1Name = FusionsPlus.Material1Name
AND IncorrectPredictedFusionsForSwordArmOfDragon.Material2Name = FusionsPlus.Material2Name;
CREATE TEMPORARY TABLE MissingPredictedFusionsForSwordArmOfDragon AS
SELECT * FROM FusionsForSwordArmOfDragon
EXCEPT
SELECT * FROM PredictedFusionsForSwordArmOfDragon;
| true |
80ea2eba8bdbac8f9b5b0f5e9e43edc99ba9e515
|
SQL
|
thorwbm/lixiera_sql
|
/organizar/academico/CURRICULOS/PROMOCAO_CURRICULO/processo/34-VW_ACD_ALUNOS_MATRICULADOS_POR_TURMA_DISCIPLINA.sql
|
UTF-8
| 367 | 3.1875 | 3 |
[] |
no_license
|
CREATE VIEW VW_ACD_ALUNOS_MATRICULADOS_POR_TURMA_DISCIPLINA AS
SELECT TURMA_ID, turma_nome, DISCIPLINA_ID, disciplina_nome, CURRICULO_ID, curriculo_nome, COUNT(ALUNO_ID) AS QTD_MATRICULADO
FROM vw_curriculo_curso_turma_disciplina_aluno_grade GRA
WHERE status_mat_dis_id = 14
GROUP BY TURMA_ID, turma_nome, DISCIPLINA_ID, disciplina_nome, CURRICULO_ID, curriculo_nome
| true |
f979fd00b42070add38badc20bb48b9aa0cbd337
|
SQL
|
iyangming/aric-springboot-samples
|
/aric-springboot-samples-tomcat-dbcp/src/files/springboot.sql
|
UTF-8
| 3,687 | 3.484375 | 3 |
[
"MIT"
] |
permissive
|
/*
SQLyog Ultimate v10.00 Beta1
MySQL - 5.7.11-log : Database - springboot
*********************************************************************
*/
/*!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*/`springboot` /*!40100 DEFAULT CHARACTER SET utf8 */;
USE `springboot`;
/*Table structure for table `t_course` */
DROP TABLE IF EXISTS `t_course`;
CREATE TABLE `t_course` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(50) NOT NULL,
`description` varchar(56) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8;
/*Data for the table `t_course` */
insert into `t_course`(`id`,`name`,`description`) values (1,'线性代数','数学'),(2,'几何','数学'),(3,'计算机基础','计算机');
/*Table structure for table `t_course_major` */
DROP TABLE IF EXISTS `t_course_major`;
CREATE TABLE `t_course_major` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`major_id` int(11) DEFAULT NULL,
`course_id` int(11) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `major_id` (`major_id`),
KEY `course_id` (`course_id`),
CONSTRAINT `t_course_major_ibfk_1` FOREIGN KEY (`major_id`) REFERENCES `t_major` (`id`),
CONSTRAINT `t_course_major_ibfk_2` FOREIGN KEY (`course_id`) REFERENCES `t_course` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8;
/*Data for the table `t_course_major` */
insert into `t_course_major`(`id`,`major_id`,`course_id`) values (1,1,3),(2,1,1),(3,2,1);
/*Table structure for table `t_major` */
DROP TABLE IF EXISTS `t_major`;
CREATE TABLE `t_major` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(50) NOT NULL,
`description` varchar(56) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;
/*Data for the table `t_major` */
insert into `t_major`(`id`,`name`,`description`) values (1,'计算机科学与技术','hot'),(2,'清洁能源','low');
/*Table structure for table `t_student` */
DROP TABLE IF EXISTS `t_student`;
CREATE TABLE `t_student` (
`id` int(8) NOT NULL AUTO_INCREMENT,
`student_no` int(8) DEFAULT NULL,
`name` varchar(50) DEFAULT NULL,
`major_id` int(8) DEFAULT NULL,
`course_id` int(8) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `major_id` (`major_id`),
KEY `course_id` (`course_id`),
CONSTRAINT `t_student_ibfk_1` FOREIGN KEY (`major_id`) REFERENCES `t_major` (`id`),
CONSTRAINT `t_student_ibfk_2` FOREIGN KEY (`course_id`) REFERENCES `t_course` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
/*Data for the table `t_student` */
insert into `t_student`(`id`,`student_no`,`name`,`major_id`,`course_id`) values (1,10001,'tom',1,2);
/*Table structure for table `t_user` */
DROP TABLE IF EXISTS `t_user`;
CREATE TABLE `t_user` (
`id` int(8) NOT NULL AUTO_INCREMENT,
`username` varchar(50) DEFAULT NULL,
`password` varchar(50) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8;
/*Data for the table `t_user` */
insert into `t_user`(`id`,`username`,`password`) values (1,'tom','123456'),(3,'jack','123456');
/*!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 |
99bc5e6c8b530e9a190cb0e09b3c34f9d65947a5
|
SQL
|
Anna-Myzukina/SQL-ZOO
|
/JOIN.sql
|
UTF-8
| 2,531 | 4.71875 | 5 |
[
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] |
permissive
|
# Modify it to show the matchid and player name for all goals scored by Germany. To identify German players, check for: teamid = 'GER'
SELECT matchid, player FROM goal
WHERE teamid = 'GER'
# Show id, stadium, team1, team2 for just game 1012
SELECT id,stadium,team1,team2
FROM game
WHERE id = 1012
# Modify it to show the player, teamid, stadium and mdate for every German goal.
SELECT player, teamid, stadium, mdate
FROM game JOIN goal ON (id=matchid)
WHERE teamid = 'GER'
# Show the team1, team2 and player for every goal scored by a player called Mario player LIKE 'Mario%'
SELECT team1, team2, player
FROM game JOIN goal ON (id=matchid)
WHERE player LIKE 'Mario%'
# Show player, teamid, coach, gtime for all goals scored in the first 10 minutes gtime<=10
SELECT player, teamid, coach, gtime
FROM goal JOIN eteam ON (teamid=id)
WHERE gtime<=10
# List the the dates of the matches and the name of the team in which 'Fernando Santos' was the team1 coach.
SELECT mdate, teamname
FROM game JOIN eteam ON (team1 = eteam.id)
WHERE coach = 'Fernando Santos'
# List the player for every goal scored in a game where the stadium was 'National Stadium, Warsaw'
SELECT player
FROM game JOIN goal ON (id=matchid)
WHERE stadium = 'National Stadium, Warsaw'
# Instead show the name of all players who scored a goal against Germany.
SELECT DISTINCT player
FROM game JOIN goal ON matchid = id
WHERE (team1='GER' OR team2='GER')
AND teamid != 'GER'
# Show teamname and the total number of goals scored.
SELECT teamname, COUNT(gtime)
FROM eteam JOIN goal ON id=teamid
GROUP BY teamname
# Show the stadium and the number of goals scored in each stadium.
SELECT stadium, COUNT(gtime)
FROM game JOIN goal ON id = matchid
GROUP BY stadium
# For every match involving 'POL', show the matchid, date and the number of goals scored.
SELECT matchid, mdate, COUNT(gtime) AS goals_POL
FROM game JOIN goal ON (id = matchid)
WHERE team1 = 'POL' OR team2 = 'POL'
GROUP BY matchid, mdate
# For every match where 'GER' scored, show matchid, match date and the number of goals scored by 'GER'
SELECT matchid, mdate, COUNT(gtime) AS goals_GER
FROM game JOIN goal ON (id = matchid)
WHERE teamid = 'GER'
GROUP BY matchid, mdate
# Sort your result by mdate, matchid, team1 and team2.
SELECT mdate,
team1,
SUM(CASE WHEN teamid=team1 THEN 1 ELSE 0 END) AS score1,
team2,
SUM(CASE WHEN teamid=team2 THEN 1 ELSE 0 END) AS score2
FROM game LEFT JOIN goal ON matchid = id
GROUP BY mdate, matchid, team1, team2
| true |
952a1926f22224a0c6855febffc9d8b5b08129a6
|
SQL
|
srayner/CivAccess
|
/data/zfcuser_rules.sql
|
UTF-8
| 1,158 | 2.71875 | 3 |
[] |
no_license
|
-- zfcUser resources.
insert into access_resource(resource_id, resource, display_name) values (5, 'zfcuser', 'User Account');
-- zfcUser privileges.
insert into access_privilege(resource_id, privilege, display_name) values (5, 'index', 'View');
insert into access_privilege(resource_id, privilege, display_name) values (5, 'login', 'Login');
insert into access_privilege(resource_id, privilege, display_name) values (5, 'changepassword', 'Change Password');
insert into access_privilege(resource_id, privilege, display_name) values (5, 'changeemail', 'Change Email Address');
insert into access_privilege(resource_id, privilege, display_name) values (5, 'logout', 'Logout');
insert into access_privilege(resource_id, privilege, display_name) values (5, 'register', 'Register');
-- zfcUser rules.
insert into access_rule(role, resource, privilege) values ('guest', 'zfcuser', 'index');
insert into access_rule(role, resource, privilege) values ('guest', 'zfcuser', 'register');
insert into access_rule(role, resource, privilege) values ('guest', 'zfcuser', 'login');
insert into access_rule(role, resource, privilege) values ('user', 'zfcuser', 'logout');
| true |
88cda3b4bc8fd765907fa77b0526657f6abd9eeb
|
SQL
|
rudgjs8080/2021_04_DBMS
|
/Oracle/빛고을고교(2021-05-04_01).sql
|
UTF-8
| 4,343 | 4.4375 | 4 |
[] |
no_license
|
-- 2021-05-04 빛고을 고교
drop table tbl_student;
create table tbl_student(
st_num char(5) primary key,
st_name nvarchar2(10) not null,
st_tel varchar2(20) not null,
st_addr nvarchar2(125),
st_grade number not null,
st_dpcode char(4) not null
);
create table tbl_dept(
dp_code char(4) primary key,
dp_name nvarchar2(20) not null,
dp_pro nvarchar2(20) not null,
dp_tel varchar2(5)
);
create table tbl_subject(
sb_code char(5) primary key,
sb_name nvarchar2(20) not null,
sb_prof nvarchar2(20)
);
create table tbl_score(
sc_seq number primary key,
sc_stnum char(5) not null,
sc_sbcode char(5) not null,
sc_score number
);
select count(*) from tbl_subject;
-- LEFT JOIN을 하여 import 된 두 테이블간의 데이터 유효성 검증
-- 학생 table에 없는 학과 코드가 있는지 검증하기
-- 학생 table과 학과 table 간의 FK 설정을 하기 위한 검증
-- 결과 LIST에서 절대 NULL 값이 없어야 한다
select ST.st_num as 학번,
ST.st_name as 이름,
ST.st_dpcode as 학과코드,
DP.dp_name as 학과명,
ST.st_tel as 연락처,
ST.st_addr as 주소
from tbl_student ST
left join tbl_dept DP
on ST.st_dpcode = DP.dp_code;
drop view view_성적정보;
create view view_성적정보 as
(
select SC.sc_seq 일련번호,
SC.sc_stnum 학번,
ST.st_name 학생이름,
ST.st_tel 전화번호,
SC.sc_sbcode 과목코드,
SB.sb_name 과목명,
SC.sc_score 점수,
SB.sb_prof 담당교수
from tbl_score SC
left join tbl_student ST
on SC.sc_stnum = ST.st_num
left join tbl_subject SB
on SC.sc_sbcode = SB.sb_code);
select * from view_성적정보;
-- 학생별 총점
-- 학번, 과목, 점수 형태로 저장된 제2정규화 테이블
-- 제2정규화 된 테이블에는 통계함수를 적용할 수 있다
select 학번, 학생이름, sum(점수) as 총점, round(avg(점수),1) as 평균
from view_성적정보
group by 학번, 학생이름
order by 총점 desc;
-- DECODE() IF와 유사한 조건검색함수
-- DECODE(칼럼명,값,return)
-- 칼럼명에 '값'이 담겨있으면 return명령을 수행하라
-- 과목명 칼럼에 국어 문자열이 담겨 있으면 해당 레코드의
-- 점수 칼럼 값을 표시하고
-- 그렇지 않으면 null값으로 표시하라
select 학번,
decode(과목명,'국어',점수) as 국어점수,
decode(과목명,'영어',점수) as 영어점수,
decode(과목명,'수학',점수) as 수학점수
from view_성적정보;
-- 위의 SQL을 학번으로 Grouping 하고
-- 각 점수를 합산(SUM())하면
-- DBMS의 SQL에서는 (null) + 숫자 = 0 + 숫자와 같다
-- SUM(null, null, null, null, 63, null, null) = 63
create view view_성적보고서 as(
select 학번,
sum(decode(과목명,'국어',점수)) as 국어점수,
sum(decode(과목명,'영어',점수)) as 영어점수,
sum(decode(과목명,'수학',점수)) as 수학점수,
sum(decode(과목명,'미술',점수)) as 미술점수,
sum(decode(과목명,'음악',점수)) as 음악점수,
sum(decode(과목명,'소프트웨어공학',점수)) as SW점수,
sum(decode(과목명,'데이터베이스',점수)) as DB점수,
sum(점수) as 총점,
round(avg(점수),1) as 평균
from view_성적정보
group by 학번);
--order by 학번;
drop view view_성적보고서;
-- 위와 같은 view를 피벗 view라고 한다
-- 제2정규화가 되어있는 Table의 데이터를
-- Pivot하여 일반적인 보고서 LIST를 만드는 형태
select * from view_성적보고서
order by 학번;
select SC.학번,
ST.st_name as 학생이름,
ST.st_tel as 전화번호,
SC.국어점수,
SC.영어점수,
SC.수학점수
from view_성적보고서 SC
Left join tbl_student ST
on SC.학번 = ST.st_num;
-- table 과 view의 join
alter table tbl_score
drop constraint fk_stnum;
alter table tbl_score
add constraint fk_stnum
foreign key (sc_stnum)
references tbl_student(st_num);
alter table tbl_score
add constraint fk_sbcode
foreign key(sc_sbcode)
REFERENCES tbl_subject(sb_code);
create SEQUENCE seq_score
start with 1
INCREMENT by 1;
| true |
6bd28ad07287f96ff5ff95350d56be0a491dd17e
|
SQL
|
CUBRID/cubrid-testcases
|
/sql/_01_object/_03_virtual_class/_002_constrains/cases/1014.sql
|
UTF-8
| 264 | 2.984375 | 3 |
[
"BSD-3-Clause"
] |
permissive
|
-- create vclass using default and not null keyword
create CLASS snack (serving_hours string);
create vclass vsnack
class attribute (meal_type string DEFAULT 'snack' NOT NULL)
(serving_hours string)
as
select serving_hours from snack;
drop vsnack;
drop snack;
| true |
cd2457eed9624da6a6659e1cc3480dd3760e0f51
|
SQL
|
BancoDatosNaturaleza/Listas_IEPNB
|
/Sentencias_SQL/Sentencias_LC/LC_RESEL_Medida.sql
|
UTF-8
| 1,304 | 2.609375 | 3 |
[] |
no_license
|
CREATE TABLE "LC_RESEL_MEDIDA"
( "ID_MEDIDA" NUMBER(2) NOT NULL,
"DS_MEDIDA" VARCHAR2(250) NULL,
CONSTRAINT "PK_LC_RESEL_MEDIDA" PRIMARY KEY ("ID_MEDIDA")
)
;
/*Insert "LC_RESEL_MEDIDA"*/
Insert into LC_RESEL_MEDIDA
(ID_MEDIDA,DS_MEDIDA)
values
('1',null);
Insert into LC_RESEL_MEDIDA
(ID_MEDIDA,DS_MEDIDA)
values
('2','Balance hídrico');
Insert into LC_RESEL_MEDIDA
(ID_MEDIDA,DS_MEDIDA)
values
('3','Clima');
Insert into LC_RESEL_MEDIDA
(ID_MEDIDA,DS_MEDIDA)
values
('4','Edafológicos');
Insert into LC_RESEL_MEDIDA
(ID_MEDIDA,DS_MEDIDA)
values
('5','Escorrentía');
Insert into LC_RESEL_MEDIDA
(ID_MEDIDA,DS_MEDIDA)
values
('6','Hidrología superficial');
Insert into LC_RESEL_MEDIDA
(ID_MEDIDA,DS_MEDIDA)
values
('7','Infiltración');
Insert into LC_RESEL_MEDIDA
(ID_MEDIDA,DS_MEDIDA)
values
('8','Macronutrientes');
Insert into LC_RESEL_MEDIDA
(ID_MEDIDA,DS_MEDIDA)
values
('9','Producción de sedimentos');
Insert into LC_RESEL_MEDIDA
(ID_MEDIDA,DS_MEDIDA)
values
('10','Química');
Insert into LC_RESEL_MEDIDA
(ID_MEDIDA,DS_MEDIDA)
values
('11','Tasas de erosión');
Insert into LC_RESEL_MEDIDA
(ID_MEDIDA,DS_MEDIDA)
values
('12','Vegetación');
| true |
ebe9aaee0e9a31ad64a9bd8b8875b6536c5a6a65
|
SQL
|
jonas-colas/SPA-Vuejs-Laravel-5.7
|
/vue.sql
|
UTF-8
| 9,092 | 2.78125 | 3 |
[
"MIT"
] |
permissive
|
-- phpMyAdmin SQL Dump
-- version 4.8.3
-- https://www.phpmyadmin.net/
--
-- Servidor: 127.0.0.1
-- Tiempo de generación: 08-01-2019 a las 21:33:05
-- Versión del servidor: 10.1.37-MariaDB
-- Versión de PHP: 7.2.12
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Base de datos: `vue`
--
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `customers`
--
CREATE TABLE `customers` (
`id` int(10) UNSIGNED NOT NULL,
`name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`email` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`phone` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`website` 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;
--
-- Volcado de datos para la tabla `customers`
--
INSERT INTO `customers` (`id`, `name`, `email`, `phone`, `website`, `created_at`, `updated_at`) VALUES
(1, 'Titus Reinger', 'hreichel@example.net', '315-280-7591 x80597', 'http://www.treutel.com/distinctio-sed-quibusdam-quos-sit-mollitia-qui-aut', '2019-01-08 20:50:32', '2019-01-08 20:50:32'),
(2, 'Tyree Casper', 'simonis.elissa@example.net', '931.368.9541 x9237', 'http://www.mckenzie.com/', '2019-01-08 20:50:32', '2019-01-08 20:50:32'),
(3, 'Eulah Heller', 'ralph.orn@example.net', '938.843.4319 x55453', 'http://wintheiser.net/', '2019-01-08 20:50:32', '2019-01-08 20:50:32'),
(4, 'Greta Jacobs', 'eliza06@example.net', '395.869.4533 x5431', 'http://www.collier.info/aut-qui-ipsum-rerum-consequatur', '2019-01-08 20:50:33', '2019-01-08 20:50:33'),
(5, 'Prof. Deshawn White', 'lamar.thiel@example.net', '(312) 894-6263 x322', 'http://gaylord.com/id-et-provident-non.html', '2019-01-08 20:50:33', '2019-01-08 20:50:33'),
(6, 'June Kihn', 'dulce.towne@example.com', '(298) 795-8544 x0686', 'http://www.kovacek.biz/dolorem-iste-cum-quidem-illum-voluptates.html', '2019-01-08 20:50:33', '2019-01-08 20:50:33'),
(7, 'Osvaldo Denesik', 'gilberto.morar@example.com', '760.424.3162', 'http://www.schmidt.com/incidunt-praesentium-architecto-eum-omnis-consequatur-enim-impedit', '2019-01-08 20:50:33', '2019-01-08 20:50:33'),
(8, 'Kristoffer Heaney PhD', 'isabella05@example.com', '(816) 960-7762 x80837', 'http://okeefe.info/', '2019-01-08 20:50:33', '2019-01-08 20:50:33'),
(9, 'Dr. Rick Braun', 'ggottlieb@example.com', '1-354-649-9814 x77225', 'http://www.lowe.com/', '2019-01-08 20:50:33', '2019-01-08 20:50:33'),
(10, 'Michale Ankunding', 'donnie.goyette@example.net', '+14268831393', 'http://denesik.com/et-unde-ut-numquam-porro-rem-tenetur-dignissimos', '2019-01-08 20:50:33', '2019-01-08 20:50:33'),
(11, 'Prof. Lexi Bernier', 'alberta.purdy@example.net', '1-786-343-6603 x674', 'http://orn.com/est-adipisci-dolorem-quasi-ducimus-neque-officia.html', '2019-01-08 20:50:33', '2019-01-08 20:50:33'),
(12, 'Dr. Jalyn Brekke', 'irogahn@example.org', '+1-390-977-8040', 'http://www.rosenbaum.info/est-molestias-culpa-voluptatibus', '2019-01-08 20:50:33', '2019-01-08 20:50:33'),
(13, 'Junius Lubowitz', 'megane.mueller@example.org', '(652) 734-1256 x4955', 'http://www.mohr.com/magnam-aut-voluptates-et', '2019-01-08 20:50:33', '2019-01-08 20:50:33'),
(14, 'Daren Heidenreich', 'julianne91@example.net', '1-353-849-8736 x4144', 'http://www.fritsch.com/ipsam-ex-expedita-atque-quis-exercitationem-aut-laudantium.html', '2019-01-08 20:50:33', '2019-01-08 20:50:33'),
(15, 'Hobart Hackett III', 'malachi55@example.net', '745-407-9600', 'http://www.barton.org/asperiores-molestiae-et-repellat-qui-omnis-voluptatibus', '2019-01-08 20:50:33', '2019-01-08 20:50:33'),
(16, 'Garnet Kemmer', 'dayana.harvey@example.org', '1-808-359-9069 x94144', 'http://goldner.org/', '2019-01-08 20:50:33', '2019-01-08 20:50:33'),
(17, 'Felipe Schaefer', 'daisy30@example.net', '1-629-645-2588', 'http://shanahan.com/', '2019-01-08 20:50:33', '2019-01-08 20:50:33'),
(18, 'Tracy Bartell', 'smith.clifford@example.com', '892.996.0654 x442', 'http://jerde.com/veniam-optio-tempora-nesciunt-dolores-suscipit.html', '2019-01-08 20:50:33', '2019-01-08 20:50:33'),
(19, 'Idella Huels', 'davonte.runolfsdottir@example.net', '1-696-697-0224', 'https://farrell.biz/velit-ut-repellat-eveniet-sed-voluptas-optio-sunt.html', '2019-01-08 20:50:33', '2019-01-08 20:50:33'),
(20, 'Prof. Branson Block', 'bernhard97@example.org', '+19326808286', 'http://cummerata.com/ex-quam-corporis-quasi-blanditiis-provident-sed-et-et', '2019-01-08 20:50:33', '2019-01-08 20:50:33'),
(21, 'Carlo Baumbach', 'watson.rath@example.org', '(778) 748-6587 x561', 'http://renner.biz/quia-quasi-officia-quo-itaque-vel-maxime.html', '2019-01-08 20:50:33', '2019-01-08 20:50:33'),
(22, 'Reggie Cartwright MD', 'cormier.norene@example.com', '618-293-0502 x61607', 'http://kshlerin.com/ipsam-qui-necessitatibus-omnis-provident-ipsam-aperiam-corrupti-ad', '2019-01-08 20:50:33', '2019-01-08 20:50:33'),
(23, 'Arno Brakus', 'bernhard.porter@example.net', '828.624.3130 x350', 'http://buckridge.com/', '2019-01-08 20:50:33', '2019-01-08 20:50:33'),
(24, 'Luciano Marvin II', 'west.darryl@example.org', '+1-573-651-5060', 'http://russel.info/molestiae-aliquid-autem-aut-quos', '2019-01-08 20:50:33', '2019-01-08 20:50:33'),
(25, 'Eulalia Stiedemann', 'herman.travis@example.com', '710.233.8480', 'https://corkery.org/tempore-voluptatem-vel-dolor.html', '2019-01-08 20:50:33', '2019-01-08 20:50:33'),
(26, 'Jeffrey Jacobi', 'yvette.johnston@example.net', '376-410-4375 x44667', 'http://mayer.com/rerum-saepe-eius-sunt-sint', '2019-01-08 20:50:34', '2019-01-08 20:50:34'),
(27, 'Mr. Narciso Bayer', 'amir49@example.com', '(942) 326-7828 x467', 'http://www.jerde.com/expedita-earum-iste-dolores-explicabo-voluptas', '2019-01-08 20:50:34', '2019-01-08 20:50:34'),
(28, 'Dr. Maxine Ledner DDS', 'wroberts@example.net', '761.283.9205', 'http://kautzer.org/quia-velit-explicabo-expedita-aut-doloremque-enim-earum', '2019-01-08 20:50:34', '2019-01-08 20:50:34'),
(29, 'Akeem Davis II', 'ritchie.christy@example.com', '+1.342.595.2925', 'https://www.berge.com/ipsam-sunt-praesentium-temporibus-nihil-recusandae-est-eius-sunt', '2019-01-08 20:50:34', '2019-01-08 20:50:34'),
(30, 'Shyanne Murphy', 'wziemann@example.org', '1-831-684-4271 x12671', 'http://kunze.org/', '2019-01-08 20:50:34', '2019-01-08 20:50:34');
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `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;
--
-- Volcado de datos para la tabla `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_01_08_134713_customers', 1);
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `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;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `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
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Volcado de datos para la tabla `users`
--
INSERT INTO `users` (`id`, `name`, `email`, `email_verified_at`, `password`, `remember_token`, `created_at`, `updated_at`) VALUES
(1, 'test', 'test@gmail.com', NULL, '$2y$10$n71E1Lc9nri0pOrgvFvoTe76JnSI2QxIRYctRCLJvdLA7shVpcO5e', NULL, '2019-01-08 17:01:15', '2019-01-08 17:01:15');
--
-- Índices para tablas volcadas
--
--
-- Indices de la tabla `customers`
--
ALTER TABLE `customers`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `customers_email_unique` (`email`);
--
-- Indices de la tabla `migrations`
--
ALTER TABLE `migrations`
ADD PRIMARY KEY (`id`);
--
-- Indices de la tabla `password_resets`
--
ALTER TABLE `password_resets`
ADD KEY `password_resets_email_index` (`email`);
--
-- Indices de la tabla `users`
--
ALTER TABLE `users`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `users_email_unique` (`email`);
--
-- AUTO_INCREMENT de las tablas volcadas
--
--
-- AUTO_INCREMENT de la tabla `customers`
--
ALTER TABLE `customers`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=31;
--
-- AUTO_INCREMENT de la tabla `migrations`
--
ALTER TABLE `migrations`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
--
-- AUTO_INCREMENT de la tabla `users`
--
ALTER TABLE `users`
MODIFY `id` int(10) UNSIGNED 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 |
79ae8342cb8c93a2691c17671d90e103659d6871
|
SQL
|
jiwonjulietyoon/Database_Notes
|
/SQL_Tableau/Pt02_Ch04_Practice.sql
|
UHC
| 2,152 | 4.5 | 4 |
[] |
no_license
|
/* 4-1 ȸ (SELECT) */
/* 1. Order ̺ ȸ */
SELECT *
FROM [Order];
/* 2. [shop_code] 30 ̻θ */
SELECT *
FROM [Order]
WHERE [shop_code] >= 30;
/* 3. [mem_no] [sales_amt] հ ϱ */
SELECT [mem_no], SUM(sales_amt) AS tot_amt
FROM [Order]
WHERE [shop_code] >= 30
GROUP BY [mem_no];
/* 4. [sales_amt] հ谡 100000 ̻θ */
SELECT [mem_no], SUM(sales_amt) AS tot_amt
FROM [Order]
WHERE [shop_code] >= 30
GROUP BY [mem_no]
HAVING SUM(sales_amt) >= 100000;
/* 5. [sales_amt] հ谡 */
SELECT [mem_no], SUM(sales_amt) AS tot_amt
FROM [Order]
WHERE [shop_code] >= 30
GROUP BY [mem_no]
ORDER BY [tot_amt] DESC;
/* 4-2 ȸ (SELECT) + (JOIN) + (Subquery) */
/* 1. Order ̺ Member ̺ left join */
SELECT *
FROM [Order] AS Ord
LEFT JOIN [Member] AS Mem
ON Ord.Mem_no = Mem.Mem_no;
/* 2. [gender] [sales_amt] հ ϱ */
SELECT Mem.gender, SUM(Ord.sales_amt) AS tot_amt
FROM [Order] AS Ord
LEFT JOIN [Member] AS Mem
ON Ord.Mem_no = Mem.Mem_no
GROUP BY Mem.gender;
/* 3. [gender], [addr] [sales_amt] հ ϱ */
SELECT Mem.gender, Mem.addr, SUM(Ord.sales_amt) AS tot_amt
FROM [Order] AS Ord
LEFT JOIN [Member] AS Mem
ON Ord.Mem_no = Mem.Mem_no
GROUP BY Mem.gender, Mem.addr;
/* * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* 1. [Order] ̺ [mem_no] [sales_amt] հ ϱ */
SELECT [mem_no], SUM(sales_amt) AS tot_amt
FROM [Order]
GROUP BY [mem_no];
/* 2. (1) FROM Ͽ, [Member] ̺ Left Join ϱ */
SELECT *
FROM (
SELECT [mem_no], SUM(sales_amt) AS tot_amt
FROM [Order]
GROUP BY [mem_no]
) AS tbl_tot_amt
LEFT JOIN [Member] AS Mem
ON tbl_tot_amt.mem_no = Mem.mem_no;
/* 3. [gender], [addr] [tot_amt] հ ϱ */
SELECT Mem.gender, Mem.addr, SUM(tot_amt) AS հ
FROM (
SELECT [mem_no], SUM(sales_amt) AS tot_amt
FROM [Order]
GROUP BY [mem_no]
) AS tmp
LEFT JOIN [Member] AS Mem
ON Mem.mem_no = tmp.mem_no
GROUP BY Mem.gender, Mem.addr;
| true |
e980f9341f80cf1c499fc35c8dba5fad825592e6
|
SQL
|
DrashtiSabhaya/Event-Management-System
|
/Database/classic_events.sql
|
UTF-8
| 9,308 | 2.96875 | 3 |
[] |
no_license
|
-- phpMyAdmin SQL Dump
-- version 4.7.0
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: May 05, 2020 at 08:58 AM
-- Server version: 10.1.25-MariaDB
-- PHP Version: 7.1.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: `classic_events`
--
-- --------------------------------------------------------
--
-- Table structure for table `admin`
--
CREATE TABLE `admin` (
`id` int(11) NOT NULL,
`nm` varchar(10) NOT NULL,
`pswd` varchar(10) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `admin`
--
INSERT INTO `admin` (`id`, `nm`, `pswd`) VALUES
(1, 'Drashti', 'sabhaya');
-- --------------------------------------------------------
--
-- Table structure for table `anniversary`
--
CREATE TABLE `anniversary` (
`id` int(11) NOT NULL,
`img` varchar(1000) NOT NULL,
`nm` varchar(20) NOT NULL,
`price` int(10) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `anniversary`
--
INSERT INTO `anniversary` (`id`, `img`, `nm`, `price`) VALUES
(1, 'IMG_9909.JPG', 'Balloon Decoration w', 210000),
(2, 'cs_anniversary1.jpg', 'Table Decoration1', 48000),
(3, 'cs_anniversary3.jpg', 'Anniversary Cake', 2000);
-- --------------------------------------------------------
--
-- Table structure for table `birthday`
--
CREATE TABLE `birthday` (
`id` int(11) NOT NULL,
`img` varchar(1000) NOT NULL,
`nm` varchar(20) NOT NULL,
`price` int(10) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `birthday`
--
INSERT INTO `birthday` (`id`, `img`, `nm`, `price`) VALUES
(1, 'cs_birthday1.jpg', 'Baby Pink balloon bi', 80000),
(2, 'cs_minion.jpg', 'Minion birthday them', 120000),
(3, '13164198_965117990250248_2782481749866692985_n.jpg', 'Birthday decoration ', 130000),
(4, 'cs_birthday3.jpg', 'Birthday Cake', 1200),
(5, 'birthday1.jpg', 'Balloon', 100000);
-- --------------------------------------------------------
--
-- Table structure for table `booking`
--
CREATE TABLE `booking` (
`id` int(11) NOT NULL,
`nm` varchar(20) NOT NULL,
`email` varchar(20) NOT NULL,
`mo` int(10) NOT NULL,
`theme` varchar(1000) NOT NULL,
`thm_nm` varchar(20) NOT NULL,
`price` int(10) NOT NULL,
`date` varchar(20) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `booking`
--
INSERT INTO `booking` (`id`, `nm`, `email`, `mo`, `theme`, `thm_nm`, `price`, `date`) VALUES
(2, 'abc', 'abc', 4873, 'cs_wedding7 - Copy.jpg', 'Rajwadi th', 505000, '21/09/2018'),
(10, 'abc', 'abc', 4738, '1795470_933513173385633_6804003732512774959_n.jpg', 'white wedd', 480000, '27/09/2017'),
(11, 'Khushali', 'kg@gmail.com`', 2147483647, 'cs_dj-sound.jpg', 'Wedding Dh', 15000, '22/09/2017'),
(12, 'shruti', 'spatel@yahoo.cpm', 2147483647, 'cs_wedding7 - Copy.jpg', 'Rajwadi th', 505000, '22/09/2017'),
(13, 'Drashti', 'drashti@gmail.com', 2147483647, 'cs_wedding1.jpg', 'Yellow Rajwadi', 500000, '2020-05-02');
-- --------------------------------------------------------
--
-- Table structure for table `feedback`
--
CREATE TABLE `feedback` (
`id` int(11) NOT NULL,
`unm` varchar(20) NOT NULL,
`email` varchar(30) NOT NULL,
`comment` varchar(5000) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `feedback`
--
INSERT INTO `feedback` (`id`, `unm`, `email`, `comment`) VALUES
(3, 'shruti', 'shrutipatel@gmail.com', 'its very nice site.');
-- --------------------------------------------------------
--
-- Table structure for table `login`
--
CREATE TABLE `login` (
`id` int(11) NOT NULL,
`unm` varchar(39) NOT NULL,
`pswd` varchar(20) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `login`
--
INSERT INTO `login` (`id`, `unm`, `pswd`) VALUES
(1, 'abc', 'abc'),
(2, 'c', 'e'),
(3, 'b', 'abc'),
(4, 'abc', 'abc');
-- --------------------------------------------------------
--
-- Table structure for table `otherevent`
--
CREATE TABLE `otherevent` (
`id` int(11) NOT NULL,
`img` varchar(1000) NOT NULL,
`nm` varchar(2000) NOT NULL,
`price` int(10) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `otherevent`
--
INSERT INTO `otherevent` (`id`, `img`, `nm`, `price`) VALUES
(1, 'cs_dj1.jpg', 'Dj parties in club', 90000),
(2, 'cs_dj-sound1.jpg', 'Wedding enjoyment', 60000),
(3, 'cs_eno2.JPG', 'Inoguration of new shop', 30000),
(4, 'cs_gift.jpg', 'Gift for function', 30000),
(5, 'IMG_9871.JPG', 'Selfy Zone', 85000),
(6, 'cs_dj-sound.jpg', 'Wedding Dhol', 15000),
(7, '11707822_846071408796477_7148431446458227749_n.jpg', 'asjdgjsagdj', 2565372);
-- --------------------------------------------------------
--
-- Table structure for table `registration`
--
CREATE TABLE `registration` (
`id` int(11) NOT NULL,
`nm` varchar(20) NOT NULL,
`surnm` varchar(20) NOT NULL,
`unm` varchar(30) NOT NULL,
`email` varchar(30) NOT NULL,
`pswd` varchar(30) NOT NULL,
`mo` int(11) NOT NULL,
`gen` tinyint(1) NOT NULL,
`adrs` varchar(60) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `registration`
--
INSERT INTO `registration` (`id`, `nm`, `surnm`, `unm`, `email`, `pswd`, `mo`, `gen`, `adrs`) VALUES
(1, 'abc', 'a', 'b', 'c', 'abc', 687688, 0, 'mbjaj'),
(2, 'abc', 'abc', 'abc', 'abc', 'abc', 2801909, 0, 'abc');
-- --------------------------------------------------------
--
-- Table structure for table `temp`
--
CREATE TABLE `temp` (
`id` int(11) NOT NULL,
`img` varchar(500) NOT NULL,
`nm` varchar(200) NOT NULL,
`price` int(10) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `temp`
--
INSERT INTO `temp` (`id`, `img`, `nm`, `price`) VALUES
(3, 'cs_eno2.JPG', 'Inoguration of new shop', 30000);
-- --------------------------------------------------------
--
-- Table structure for table `wedding`
--
CREATE TABLE `wedding` (
`id` int(11) NOT NULL,
`img` varchar(1000) NOT NULL,
`nm` varchar(200) NOT NULL,
`price` int(10) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `wedding`
--
INSERT INTO `wedding` (`id`, `img`, `nm`, `price`) VALUES
(1, 'cs_wedding1.jpg', 'Yellow Rajwadi', 500000),
(5, 'cs_wedding4.jpg', 'Snow white theme', 450000),
(6, 'cs_wedding7 - Copy.jpg', 'Rajwadi theme', 505000),
(7, 'cs_dj-sound.jpg', 'Enjoyment', 5000),
(8, 'cs_wedding_mandap.jpg', 'Wedding mandap', 10000),
(9, 'cs_wedding_flower.jpg', 'Flower Decoration', 20000),
(10, '1795470_933513173385633_6804003732512774959_n.jpg', 'white wedding theme', 480000),
(12, '14191925_1227924543944493_6325969755918013020_n.jpg', 'Red flower decoratio', 460000),
(13, 'cs_sofa.jpg', 'Lighting & sofa', 70000);
--
-- Indexes for dumped tables
--
--
-- Indexes for table `admin`
--
ALTER TABLE `admin`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `anniversary`
--
ALTER TABLE `anniversary`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `birthday`
--
ALTER TABLE `birthday`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `booking`
--
ALTER TABLE `booking`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `feedback`
--
ALTER TABLE `feedback`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `login`
--
ALTER TABLE `login`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `otherevent`
--
ALTER TABLE `otherevent`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `registration`
--
ALTER TABLE `registration`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `temp`
--
ALTER TABLE `temp`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `wedding`
--
ALTER TABLE `wedding`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `anniversary`
--
ALTER TABLE `anniversary`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
--
-- AUTO_INCREMENT for table `birthday`
--
ALTER TABLE `birthday`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;
--
-- AUTO_INCREMENT for table `booking`
--
ALTER TABLE `booking`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=14;
--
-- AUTO_INCREMENT for table `feedback`
--
ALTER TABLE `feedback`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
--
-- AUTO_INCREMENT for table `login`
--
ALTER TABLE `login`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
--
-- AUTO_INCREMENT for table `otherevent`
--
ALTER TABLE `otherevent`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=9;
--
-- AUTO_INCREMENT for table `registration`
--
ALTER TABLE `registration`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT for table `temp`
--
ALTER TABLE `temp`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
--
-- AUTO_INCREMENT for table `wedding`
--
ALTER TABLE `wedding`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=14;COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
| true |
15f63a7576a7136f3d7e098d73652c0457bcf9fa
|
SQL
|
abham916/APkyc
|
/5.1.3.sql
|
UTF-8
| 291 | 3.796875 | 4 |
[] |
no_license
|
SELECT log.email, log.password, stud.name, stud.phone, maj.name AS major_name, maj.credits, group_concat(t.name) AS teacher_name
FROM logins AS log
JOIN students AS stud
ON stud.login_id = log.id
JOIN majors AS maj
ON stud.major_id = maj.id
JOIN teachers AS t
ON t.major_id = maj.id
| true |
af1945447e7f0f8c425612e01899cdb9fd21bbb0
|
SQL
|
wasantos/dlkbigdata
|
/dl-scala/src/main/resources/pe/com/belcorp/datalake/resources/analytics/dwh/DMatrizCampana/update.sql
|
UTF-8
| 2,882 | 2.609375 | 3 |
[] |
no_license
|
INSERT INTO ?tableName
SELECT
sicc_dmatrizcampana.ANIOCAMPANA,
sicc_dmatrizcampana.CODCANALVENTA,
sicc_dmatrizcampana.CODCATALOGO,
sicc_dmatrizcampana.CODESTRATEGIA,
sicc_dmatrizcampana.CODTIPOOFERTA,
sicc_dmatrizcampana.CODVENTA,
sicc_dmatrizcampana.DESCATALOGO,
sicc_dmatrizcampana.DESTIPOOFERTA,
CAST(sicc_dmatrizcampana.NROPAGINA AS BIGINT),
CAST(sicc_dmatrizcampana.NUMOFERTA AS BIGINT),
CAST(sicc_dmatrizcampana.PRECIONORMALMN AS DECIMAL(15,5)),
CAST(sicc_dmatrizcampana.PRECIOOFERTA AS DECIMAL(15,5)),
CAST(sicc_dmatrizcampana.PrecioVtaPropuesto AS DECIMAL(15,5)),
planit_dmatrizcampana.CODTIPOCATALOGO,
planit_dmatrizcampana.DESARGVENTA,
planit_dmatrizcampana.DESEXPOSICION,
planit_dmatrizcampana.DESLADOPAG,
planit_dmatrizcampana.DESTIPOCATALOGO,
planit_dmatrizcampana.DESUBICACIONCATALOGO,
CAST(COALESCE(planit_dmatrizcampana.FOTOMODELO, '') != '' AS SMALLINT) AS FLAGFOTOMODELO,
CAST(COALESCE(planit_dmatrizcampana.FOTOPRODUCTO, '') != '' AS SMALLINT) AS FLAGFOTOPRODUCTO,
CAST(planit_dmatrizcampana.NROPAGINAS AS BIGINT),
CAST(planit_dmatrizcampana.PAGINACATALOGO AS BIGINT),
planit_dmatrizcampana.DESOBSERVACIONES,
bi_dcatalogovehiculo.VEHICULOVENTA,
sicc_dmatrizcampana.PT_COUNTRY,
sicc_dmatrizcampana.CODPRODUCTO,
sicc_dmatrizcampana.CODTIPOMEDIOVENTA,
CAST(planit_dmatrizcampana.DEMANDAANORMALNPLAN AS DECIMAL(15,5)),
sicc_dmatrizcampana.DESESTRATEGIA,
planit_dmatrizcampana.DESTIPODIAGRAMACION,
sicc_dmatrizcampana.FACTORCUADRE,
sicc_dmatrizcampana.FACTORREPETICION,
planit_dmatrizcampana.FLAGDISCOVER,
sicc_dmatrizcampana.FLAGESTADISTICABLE,
sicc_dmatrizcampana.FLAGPRODUCTOSEBE,
sicc_dmatrizcampana.INDCUADRE,
sicc_dmatrizcampana.INDPADRE,
CAST(planit_dmatrizcampana.PRECIONORMALDOLPLAN AS DECIMAL(15,5)) AS PRECIONORMALDOLPLAN,
CAST(planit_dmatrizcampana.PRECIONORMALMNPLAN AS DECIMAL(15,5)) AS PRECIONORMALMNPLAN,
CAST(planit_dmatrizcampana.PRECIOOFERTADOLPLAN AS DECIMAL(15,5)) AS PRECIOOFERTADOLPLAN,
CAST(planit_dmatrizcampana.PRECIOOFERTAMNPLAN AS DECIMAL(15,5)) AS PRECIOOFERTAMNPLAN
FROM
?landingSchema.tbpq_sicc_dmatrizcampana sicc_dmatrizcampana
LEFT JOIN ?landingSchema.tbpq_planit_dmatrizcampana planit_dmatrizcampana
ON sicc_dmatrizcampana.ANIOCAMPANA = planit_dmatrizcampana.ANIOCAMPANA
AND sicc_dmatrizcampana.CODTIPOOFERTA = planit_dmatrizcampana.CODTIPOOFERTA
AND sicc_dmatrizcampana.CODPRODUCTO = planit_dmatrizcampana.CODPRODUCTO
AND sicc_dmatrizcampana.PT_COUNTRY = planit_dmatrizcampana.PT_COUNTRY
LEFT JOIN ?landingSchema.tbpq_bi_dcatalogovehiculo bi_dcatalogovehiculo
ON sicc_dmatrizcampana.CODCATALOGO = bi_dcatalogovehiculo.CODCATALOGO
AND sicc_dmatrizcampana.PT_COUNTRY = bi_dcatalogovehiculo.PT_COUNTRY
WHERE
sicc_dmatrizcampana.PT_COUNTRY = :country
AND sicc_dmatrizcampana.ANIOCAMPANA IN (:campaign)
| true |
d48fc7fc4261091f091787a9868a73b8b14df892
|
SQL
|
vikksa/project
|
/src/main/resources/queries/plantree/search_query.sql
|
UTF-8
| 2,796 | 4.28125 | 4 |
[] |
no_license
|
WITH RECURSIVE children AS (
SELECT root.id, root.parent_id, root.name, root.version, root.type, root.active, root.last_activity, root.last_modified, root.plan_type, root.current_revision_id, root.bimplus AS "bimplus"
FROM (
SELECT f.id, f.parent_id, f.name, NULL as "version", 'Folder' as "type", f.active, NULL as "last_activity", f.last_modified as "last_modified", NULL as "plan_type", NULL as "current_revision_id", NULL AS "bimplus"
FROM plan_folders f
WHERE f.parent_id = :parentId
UNION
SELECT p.id, p.parent_id, p.name, r.version, 'Plan' as "type", p.active, p.last_activity, p.last_modified, r.type AS "plan_type", p.current_revision_id, p.bimplus_plan_state AS "bimplus"
FROM plans p INNER JOIN plan_revisions r ON p.current_revision_id = r.id
WHERE p.parent_id = :parentId
) root
UNION
SELECT child.id, child.parent_id, child.name, child.version, child.type, child.active, child.last_activity, child.last_modified, child.plan_type, child.current_revision_id, child.bimplus AS "bimplus"
FROM (
SELECT f.id, f.parent_id, f.name, NULL as "version", 'Folder' as "type", f.active, NULL as "last_activity", f.last_modified as "last_modified", NULL as "plan_type", NULL as "current_revision_id", NULL AS "bimplus"
FROM plan_folders f
UNION
SELECT p.id, p.parent_id, p.name, r.version, 'Plan' as "type", p.active, p.last_activity, p.last_modified, r.type AS "plan_type", p.current_revision_id, p.bimplus_plan_state AS "bimplus"
FROM plans p INNER JOIN plan_revisions r ON p.current_revision_id = r.id
) child
JOIN children c ON child.parent_id = c.id
)
SELECT c.id, c.parent_id, c.name, c.version, c.type, c.active, c.plan_type, c.current_revision_id, c.bimplus AS "bimplus",
(SELECT COUNT(su.id) FROM
( SELECT id, 'Plan' as "type" FROM plans p WHERE p.parent_id = c.id AND p.active IN (:stateFilterActive,:stateFilterInactive)
UNION
SELECT id, 'Folder' as "type" FROM plan_folders f WHERE f.parent_id = c.id AND f.active IN (true,:stateFilterInactive)
) su where su.type = ANY (:typeFilter)) as "items",
CASE WHEN c.last_modified IS NULL THEN c.last_activity
WHEN c.last_activity IS NULL THEN c.last_modified
WHEN c.last_activity < c.last_modified THEN c.last_modified ELSE c.last_activity END as actual_last_activity
FROM children c
WHERE c.name ILIKE :search AND c.active IN (:stateFilterActive,:stateFilterInactive) AND ((c.last_activity IS NULL AND c.last_modified IS NULL) OR (c.last_activity > :sinceFilter OR c.last_modified > :sinceFilter)) AND c.type = ANY (:typeFilter)
ORDER BY c.type, %s %s OFFSET :offsetValue LIMIT :limitValue
| true |
6dd2a636c9de762561b8d13bab472de7ea36b731
|
SQL
|
joyboukaram/OLX
|
/db/olx.sql
|
UTF-8
| 3,954 | 3.078125 | 3 |
[] |
no_license
|
-- phpMyAdmin SQL Dump
-- version 4.7.4
-- https://www.phpmyadmin.net/
--
-- Host: localhost
-- Generation Time: Dec 13, 2018 at 06:03 PM
-- Server version: 10.1.26-MariaDB
-- PHP Version: 7.1.9
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: `olx`
--
-- --------------------------------------------------------
--
-- Table structure for table `adminusers`
--
CREATE TABLE `adminusers` (
`idadminusers` int(11) NOT NULL,
`username` varchar(45) DEFAULT NULL,
`password` varchar(255) DEFAULT NULL,
`name` varchar(45) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `adminusers`
--
INSERT INTO `adminusers` (`idadminusers`, `username`, `password`, `name`) VALUES
(1, 'joy', '123', 'joy');
-- --------------------------------------------------------
--
-- Table structure for table `ads`
--
CREATE TABLE `ads` (
`idads` int(11) NOT NULL,
`name` varchar(45) DEFAULT NULL,
`price` int(11) DEFAULT NULL,
`description` text,
`location` varchar(45) DEFAULT NULL,
`categorie` varchar(45) DEFAULT NULL,
`image` text,
`seller` varchar(45) DEFAULT NULL,
`delivery` tinyint(4) NOT NULL,
`status` tinyint(4) NOT NULL,
`approved` tinyint(4) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `ads`
--
INSERT INTO `ads` (`idads`, `name`, `price`, `description`, `location`, `categorie`, `image`, `seller`, `delivery`, `status`, `approved`) VALUES
(6, 'charbel', 1000, 'description', 'ew', 'accessories', 'uploads/charbel.png ', 'joy@mail.com', 1, 0, 1),
(7, 'joy', 1000, 'wew', 'loc', 'accessories', 'uploads/laptop.png ', 'joy@mail.com', 0, 0, 1),
(8, 'karim', 1000, 'karim', 'Beirut', 'children', 'uploads/anonymous.jpg ', 'karim@mail.com', 0, 0, 1);
-- --------------------------------------------------------
--
-- Table structure for table `users`
--
CREATE TABLE `users` (
`idusers` int(11) NOT NULL,
`firstName` varchar(45) DEFAULT NULL,
`lastName` varchar(45) DEFAULT NULL,
`email` varchar(45) DEFAULT NULL,
`password` varchar(255) DEFAULT NULL,
`gender` tinyint(4) DEFAULT NULL,
`address` varchar(45) DEFAULT NULL,
`birthdate` varchar(45) DEFAULT NULL,
`cart` varchar(45) DEFAULT NULL,
`image` varchar(255) DEFAULT NULL,
`delivery` text NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `users`
--
INSERT INTO `users` (`idusers`, `firstName`, `lastName`, `email`, `password`, `gender`, `address`, `birthdate`, `cart`, `image`, `delivery`) VALUES
(5, 'joy', 'Bou Karam', 'joy@mail.com', 'b113405b6f9114b2abac7676f6868df33b0dde53f2e0ddd0f5340392563ab5f3', 1, 'jounieh', '1998-02-17', NULL, 'uploads/carou1.jpg ', ''),
(6, 'karim', 'majed', 'karim@mail.com', 'be879f7549cc80c04241dcfd933c6278c3a711ddc530961071f62c57324d6a9e', 0, 'beirut', '1999-01-08', ' charbel', 'uploads/dress.jpg ', ''),
(7, 'ramy', 'ziade', 'ramy@mail.com', '4b489bcbed7850549b713014e2e9c602d23e2657c73c4f1b453d42f3c27d3b44', 0, 'jounieh', '1998-04-29', ' charbel', 'uploads/military.jpg ', ' charbel charbel');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `adminusers`
--
ALTER TABLE `adminusers`
ADD PRIMARY KEY (`idadminusers`);
--
-- Indexes for table `ads`
--
ALTER TABLE `ads`
ADD PRIMARY KEY (`idads`);
--
-- Indexes for table `users`
--
ALTER TABLE `users`
ADD PRIMARY KEY (`idusers`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `ads`
--
ALTER TABLE `ads`
MODIFY `idads` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=9;
--
-- AUTO_INCREMENT for table `users`
--
ALTER TABLE `users`
MODIFY `idusers` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8;
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
| true |
6670419d9e44b035d218b86f6454c3fe111e6192
|
SQL
|
nss-evening-cohort-12/chinook-nathanieltylerowens
|
/tracks_no_id.sql
|
UTF-8
| 190 | 3.515625 | 4 |
[] |
no_license
|
SELECT Track.Name as 'Track Name', Album.Title as 'Album Title', Genre.Name as 'Genre Name'
FROM Track
JOIN Album ON Track.AlbumId = Album.AlbumId
JOIN Genre ON Track.GenreId = Genre.GenreId
| true |
0bca23a20b01a53fa051eb49b6221be41b4b8023
|
SQL
|
xSooDx/Database-Tool
|
/ECELLDB.sql
|
UTF-8
| 23,033 | 3.234375 | 3 |
[] |
no_license
|
-- phpMyAdmin SQL Dump
-- version 4.4.12
-- http://www.phpmyadmin.net
--
-- Host: 127.0.0.1
-- Generation Time: Apr 25, 2016 at 03:34 PM
-- Server version: 5.6.25
-- PHP Version: 5.6.11
# Privileges for `sood`@`localhost`
GRANT ALL PRIVILEGES ON *.* TO 'sood'@'localhost' IDENTIFIED BY PASSWORD '*A4B6157319038724E3560894F7F932C8886EBFCF' WITH GRANT OPTION;
GRANT ALL PRIVILEGES ON `mysql`.* TO 'sood'@'localhost' WITH GRANT OPTION;
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: `ecelldb`
--
-- --------------------------------------------------------
--
-- Table structure for table `assigned_to_task`
--
CREATE TABLE IF NOT EXISTS `assigned_to_task` (
`USN` varchar(16) DEFAULT NULL,
`Task_ID` varchar(16) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `assigned_to_task`
--
INSERT INTO `assigned_to_task` (`USN`, `Task_ID`) VALUES
('01FB14ECS215', 'DBMT-1'),
('01FB14ECS215', 'DBMT-2');
-- --------------------------------------------------------
--
-- Table structure for table `collaborators`
--
CREATE TABLE IF NOT EXISTS `collaborators` (
`Name` varchar(64) NOT NULL,
`Phone` varchar(10) NOT NULL,
`Email` varchar(64) NOT NULL,
`P_ID` varchar(16) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `collaborators`
--
INSERT INTO `collaborators` (`Name`, `Phone`, `Email`, `P_ID`) VALUES
('Rohan N Kanuri', '8970047065', 'hazard.rohan@gmail.com', '3'),
('Shreyaa Giridhar', '9449056064', 'findshryaagirigir@gmail.com', '10'),
('Hazard Uchiha', '9999999999', 'hazrdbeast.uchiha@gmail.com', '6'),
('Shrek Shetty', '9559669778', 'shrekshetty@gmail.com', '5'),
('Itachi Uchiha', '9779339449', 'itachib/osasuke@gmail.com', '3'),
('Konahamaru', '9886797054', 'chidori.naruto@gmail.com', '6'),
('Akarsh Bolar', '9556677345', 'wheere.man@gmail.com', '12');
-- --------------------------------------------------------
--
-- Table structure for table `departments`
--
CREATE TABLE IF NOT EXISTS `departments` (
`ID` varchar(16) NOT NULL,
`Name` varchar(45) DEFAULT NULL,
`Description` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `departments`
--
INSERT INTO `departments` (`ID`, `Name`, `Description`) VALUES
('DEP-DD', 'Design & Development', 'In charge of design and development of different tools,websites,etc'),
('DEP-EV', 'Events', 'Responsible for event management'),
('DEP-MR', 'Marketing', 'Market different products '),
('DEP-PB', 'Publications', 'Spread awareness about startups,clubs,etc'),
('DEP-PR', 'Public Relations', 'In charge of public relations'),
('DEP-RS', 'Resources', 'Manage and maintain resources'),
('DEP-SP', 'Sponsorship', 'Find companies to sponsor for startups');
-- --------------------------------------------------------
--
-- Table structure for table `events`
--
CREATE TABLE IF NOT EXISTS `events` (
`ID` varchar(16) NOT NULL,
`Title` varchar(45) DEFAULT NULL,
`Description` varchar(255) DEFAULT NULL,
`Dep_ID` varchar(16) DEFAULT NULL,
`Venue` varchar(45) DEFAULT NULL,
`Time` varchar(10) DEFAULT NULL,
`Date` varchar(10) DEFAULT NULL,
`Tag` varchar(45) DEFAULT NULL,
`Status` varchar(45) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `events`
--
INSERT INTO `events` (`ID`, `Title`, `Description`, `Dep_ID`, `Venue`, `Time`, `Date`, `Tag`, `Status`) VALUES
('1', 'Endeavour', 'Think of an idea, build it, pitch it, sell it.', 'DEP-RS', 'MRD Block, PES University', '10:30:00', '2016-04-30', 'Marketing, Prototyping, Sales Pitch', 'Inactive'),
('10', 'Meditation', 'Calm your nerves', 'DEP-PR', 'Mrd auditorium', '02:00:00', '2016-09-23', 'Marketing', 'Inactive'),
('1234567', 'qwerty', 'qwertyuiolkjhgfdsa', 'DEP-DD', 'LOL', '00:30', '2016-11-12', 'FASDKASDM', 'Active'),
('2', 'Comic con', 'The best place for all comic heads and movie maniacs to come together and party', 'DEP-EV', 'PES university', '13:12:08', '2016-04-07', 'Marketing,Sponsors', 'Active'),
('3', 'Year end party', 'Place to get together and enjoy', 'DEP-RS', 'Mrd auditorium', '07:28:14', '2016-06-22', 'Resources ', 'Inactive'),
('4', 'Anime fest', 'Anime fans get together', 'DEP-EV', 'pi r cube', '11:21:00', '2016-08-24', 'Resources,Marketing', 'Selectively Active'),
('5', 'PB ESOC meeting', 'A discussion for e society //like munsoc', 'DEP-PB', 'Mechanical Block', '03:08:00', '2016-05-06', 'Marketing,Publications,Events', 'Active'),
('6', 'fundraiser', 'Createawareness for ecell', 'DEP-MR', 'Student Lounge', '07:09:00', '2016-04-08', 'Event,Marketing', 'Complete'),
('7', 'Startup Mela', 'A place for all new startups to come together and show off their products', 'DEP-MR', 'OAT', '06:02:00', '2016-05-27', 'Marketing,PR', 'Selectively Active'),
('8', 'Market strategy seminar ', 'Lecture by IIT student Eden Hazard', 'DEP-EV', 'Mrd auditorium', '19:59:00', '2016-04-06', 'PB', 'Complete'),
('9', 'Recritment', 'Recruiting new interested members', 'DEP-MR', 'PES University', '14:00:00', '2016-08-15', 'Marketing,PR', 'Inactive'),
('EV-01', 'Test', 'This is a test', 'DEP-DD', 'LOL', '12:30', '12/4/2016', 'qweqwe', 'Active'),
('P-1', 'Party', 'PARTAAAAAAYYY!!!', 'DEP-DD', 'MRD', '12:30', '2016-04-21', 'LOL', 'Active');
-- --------------------------------------------------------
--
-- Table structure for table `heads`
--
CREATE TABLE IF NOT EXISTS `heads` (
`USN` varchar(16) NOT NULL,
`Dep_ID` varchar(16) DEFAULT NULL,
`Head_Level` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `heads`
--
INSERT INTO `heads` (`USN`, `Dep_ID`, `Head_Level`) VALUES
('01FB14EBT024', 'DEP-PR', 2),
('01FB14ECS074', 'DEP-MR', 1),
('01FB14ECS182', NULL, 1),
('01FB14ECS215', 'DEP-DD', 1),
('01FB14ECS247', 'DEP-PR', 1),
('01FB15ECS116', 'DEP-EV', 2),
('01FB15ECS187', 'DEP-DD', 2),
('01FB15ECS245', 'DEP-MR', 2),
('01FB15EME035', 'DEP-EV', 1),
('1PI13CS035', 'DEP-RS', 1),
('1PI14IS082', 'DEP-SP', 1),
('1PI14ME102', 'DEP-SP', 2);
-- --------------------------------------------------------
--
-- Table structure for table `members`
--
CREATE TABLE IF NOT EXISTS `members` (
`USN` varchar(16) NOT NULL,
`F_Name` varchar(45) DEFAULT NULL,
`L_Name` varchar(45) DEFAULT NULL,
`Ph_No` varchar(45) DEFAULT NULL,
`Email` varchar(45) DEFAULT NULL,
`password` varchar(255) NOT NULL,
`Department` varchar(16) DEFAULT NULL,
`Status` varchar(45) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `members`
--
INSERT INTO `members` (`USN`, `F_Name`, `L_Name`, `Ph_No`, `Email`, `password`, `Department`, `Status`) VALUES
('01FB14EBT024', 'Parthvi', 'Gyan', '9902535735', 'parthvigyan@gmail.com', '', 'DEP-PR', 'Active'),
('01FB14ECS042', 'Apoorva', 'Jarmale', '9611375566', 'apoorvajarmale@gmail.com', '', 'DEP-MR', 'Inactive'),
('01FB14ECS066', 'Naveen Reddy', 'Desanur', '8861631807', 'dnaveen356@gmail.com', '', 'DEP-MR', 'Active'),
('01FB14ECS074', 'Gautham', 'B', '7411714781', 'gautham1996@gmail.com', '', 'DEP-MR', 'Active'),
('01FB14ECS102', 'Kushal', 'Mehta', '9019757097', 'kushalmehta13@gmail.com', '', 'DEP-DD', 'Active'),
('01FB14ECS133', 'Nilisha', 'Maheshwari', '9480613950', 'nilishamaheshwari18@gmail.com', '', 'DEP-DD', 'Active'),
('01FB14ECS182', 'Rajath', 'Nandan', '7259137196', 'rjtnndn@gmail.com', 'qwer', 'DEP-RS', 'Active'),
('01FB14ECS203', 'Sai Neeraj', 'Kanuri', '8105687890', 'neerajkanuri@gmail.com', '', 'DEP-DD', 'Active'),
('01FB14ECS215', 'Saurabh', 'Sood', '8147531591', 'soodsaurabh95@gmail.com', 'qwer', 'DEP-DD', 'Active'),
('01FB14ECS230', 'Shreyank', 'Shetty', '9591309688', 'Shreyankshetty007@gmail.com', 'qwer', 'DEP-MR', 'Active'),
('01FB14ECS243', 'Smaran', 'Mahesh', '9742725674', 'smaran.mr@gmail.com', '', 'DEP-PR', 'Active'),
('01FB14ECS247', 'Sreedhar', 'Radhakrishnan', '7022260737', 'sreedhar1895@gmail.com', '', 'DEP-PR', 'Active'),
('01FB14EEE051', 'Nithisha', 'Venu', '9482011333', 'nithishavenu@gmail.com', '', 'DEP-DD', 'Active'),
('01FB14EME023', 'Amruth', 'Chinnappa', '9686246659', 'amruthchinnappa@gmail.com', '', 'DEP-MR', 'Active'),
('01FB14EME059', 'Goutham', 'T', '9845233376', 'goutham.thirumalesh@gmail.com', '', 'DEP-MR', 'Active'),
('01FB14EME081', 'Niranjan', 'M', '9066179191', 'niranjanm9191@gmail.com', '', 'DEP-MR', 'Active'),
('01FB14EME092', 'Mukunth', 'Sudarsanan', '7022364054', 'iammukunth@gmail.com', '', 'DEP-MR', 'Active'),
('01FB15EBT003', 'Akhila', 'Parthasarathy', '8861294373', 'akhilap19@gmail.com', '', 'DEP-PB', 'Active'),
('01FB15EBT024', 'Karishma', 'Mehta', '9663705500', 'karishma17mehta@gmail.com', '', 'DEP-EV', 'Active'),
('01FB15EBT025', 'Priyaa', 'Velayutham', '9739244408', 'velasan2010@gmail.com', '', 'DEP-PR', 'Active'),
('01FB15ECS005', 'Abhijay', 'Gupta', '8971203084', 'abhijayvgupta@gmail.com', '', 'DEP-DD', 'Active'),
('01FB15ECS057', 'Athul', 'Pai', '8951211546', 'athulpai@outlook.com', '', 'DEP-PB', 'Active'),
('01FB15ECS076', 'Chetna', 'Sureka', '8884746830', 'chetnasureka1501@gmail.com', '', 'DEP-SP', 'Active'),
('01FB15ECS082', 'Suhaas', 'Chitturi', '8897378787', 'suhaaschitturi@gmail.com', '', 'DEP-MR', 'Active'),
('01FB15ECS093', 'Devika', 'Mishra', '9741329988', 'mishra.devika23@gmail.com', '', 'DEP-DD', 'Active'),
('01FB15ECS116', 'Hardik', 'Surana', '9739620417', 'hardiksurana01@gmail.com', '', 'DEP-EV', 'Active'),
('01FB15ECS118', 'Harsh', 'Garg', '9108287414', 'harshagarwal76@gmail.com', '', 'DEP-EV', 'Active'),
('01FB15ECS122', 'Harshit', 'Sinha', '9686509397', 'harshitsinha123@gmail.com', '', 'DEP-PR', 'Active'),
('01FB15ECS123', 'Harshita', 'Singh', '9845633122', 'harshitasingh.selena13@gmail.com', '', 'DEP-EV', 'Active'),
('01FB15ECS141', 'Karthik', 'Nishant', '9444217876', 'Karthiknishant@yahoo.co.in', '', 'DEP-MR', 'Active'),
('01FB15ECS148', 'Khalandar Nawal', 'Sheikh', '9972998999', 'sunseema@gmail.com', '', 'DEP-DD', 'Active'),
('01FB15ECS170', 'Medha', 'Parigi', '9738089703', 'pmedhavi88@gmail.com', '', 'DEP-DD', 'Active'),
('01FB15ECS185', 'Niharika', 'Misra', '9900255220', 'niharika.misra97@gmail.com', '', 'DEP-DD', 'Active'),
('01FB15ECS187', 'Nikhil', 'Khatri', '9620577985', 'nikhilkhatri97@gmail.com', '', 'DEP-DD', 'Active'),
('01FB15ECS189', 'Nikhil', 'Singh', '9471717072', 'singhnikhil97@gmail.com', '', 'DEP-DD', 'Active'),
('01FB15ECS210', 'Pranit', 'Dutta', '7795322114', 'pranitdutta17@gmail.com', '', 'DEP-SP', 'Active'),
('01FB15ECS215', 'Priya', 'Bagaria', '8697089394', 'priyabagaria4@gmail.com', '', 'DEP-MR', 'Active'),
('01FB15ECS216', 'Priyank', 'Bhandia', '9945894746', 'priyankbhandia@hotmail.com', '', 'DEP-PR', 'Active'),
('01FB15ECS222', 'Rahul', 'Mohan', '9535440912', 'rahul.16.mohan@gmail.com', '', 'DEP-DD', 'Active'),
('01FB15ECS234', 'Ravi Shreyas', 'Anupindi', '8277136791', 'Shreyasanupindi356@gmail.com', '', 'DEP-PR', 'Active'),
('01FB15ECS235', 'Reshma', 'Bhat', '9481752578', 'rgbhat2060@gmail.com', '', 'DEP-PR', 'Active'),
('01FB15ECS245', 'Roopesh', 'S J', '9483964026', 'roopeshnravi@gmail.com', '', 'DEP-MR', 'Active'),
('01FB15ECS248', 'Ruthwik', 'Ganesh', '8722366444', 'ruthwikganesh@gmail.com', '', 'DEP-DD', 'Active'),
('01FB15ECS291', 'Siddharth', 'Suresh', '9985971997', 'sidd.suresh97@gmail.com', '', 'DEP-RS', 'Active'),
('01FB15ECS337', 'Varsha', 'R', '9035230972', 'varsha.ambu@gmail.com', '', 'DEP-PB', 'Active'),
('01FB15EEC024', 'Aman Anjan', 'Bhat', '8197955212', 'Amananjanbhat3@gmail.com', '', 'DEP-EV', 'Active'),
('01FB15EEC081', 'Gayatri', 'Aniruddha', '9741900252', 'Gayatri0397@gmail.com', '', 'DEP-MR', 'Active'),
('01FB15EEC082', 'Gowri', 'Joshi', '7676913126', 'gowrijoshi@gmail.com', '', 'DEP-PR', 'Active'),
('01FB15EEC091', 'Joyce', 'Avrel', '7760574400', 'joyceavrel@gmail.com', '', 'DEP-MR', 'Active'),
('01FB15EEC104', 'Lakshmi', 'Krishnan', '8884400172', 'uma.krishnaswamy@gmail.com', '', 'DEP-EV', 'Active'),
('01FB15EEC105', 'Lakshmi Nikita', 'Anand', '9741972170', 'lakshminikita@gmail.com', '', 'DEP-SP', 'Active'),
('01FB15EEC123', 'Asif', 'Kharadi', '9611559455', 'asifkharadi075@gmail.com', '', 'DEP-DD', 'Active'),
('01FB15EEC125', 'Mohan', 'R', '8792521942', 'mohan1bng@gmail.com', '', 'DEP-DD', 'Active'),
('01FB15EEC137', 'Neema', 'N', '8892423759', 'neemanayak6@gmail.com', '', 'DEP-PR', 'Active'),
('01FB15EEC161', 'Prateek', 'K', '9611919613', 'prateekkonduru2001@gmail.com', '', 'DEP-DD', 'Active'),
('01FB15EEC162', 'Pratik', 'R', '8892787870', 'pratiksiyal@gmail.com', '', 'DEP-PR', 'Active'),
('01FB15EEC190', 'Sagar', 'Belavadi', '8762733652', 'sagar28.05.1997@gmail.com', '', 'DEP-SP', 'Active'),
('01FB15EEC204', 'sanket', 'saxena', '9743119496', 'sanketsaxena33@gmail.com', '', 'DEP-MR', 'Active'),
('01FB15EEC236', 'Shreya', 'Suresh', '9591769942', 'shreya.suresh37@gmail.com', '', 'DEP-PR', 'Active'),
('01FB15EEC237', 'Shubham', '.', '9738641300', 'shubham250396@gmail.com', '', 'DEP-MR', 'Selectively Active'),
('01FB15EEC243', 'Smriti', '.', '7899011050', 'smriti12320@gmail.com', '', 'DEP-PR', 'Active'),
('01FB15EEC266', 'Tejaswi', 'Raj', '9663252327', 'Tejaswiraj.187@gmail.com', '', 'DEP-DD', 'Active'),
('01FB15EEE050', 'Nilesh', 'Pattanayak', '9738646330', 'pattanayaknilesh2015@gmail.com', '', 'DEP-DD', 'Active'),
('01FB15EME005', 'Abhigyan', 'Nath', '9502923892', 'nebula2035@gmail.com', '', 'DEP-DD', 'Active'),
('01FB15EME023', 'Anmol', 'Shekar', '8147620155', 'anmol_shek@rediffmail.com', '', 'DEP-PR', 'Active'),
('01FB15EME035', 'Chaithanya', 'Premkumar', '7760001404', 'chinthu97@live.com', '', 'DEP-EV', 'Active'),
('01FB15EME037', 'Charanpreet', 'Sandhu', '9066184077', 'sandhu.champ19@gmail.com', '', 'DEP-EV', 'Active'),
('01FB15EME047', 'Harish', 'Krishnan', '7795346116', 'harishfooty@gmail.com', '', 'DEP-EV', 'Active'),
('1PI13BT040', 'Sai Preethi', 'Nakkina', '9886492605', 'preethi.165@gmail.com', '', 'DEP-PB', 'Active'),
('1PI13BT046', 'Shraddha', 'Subramanian', '9663879290', 'shraddhasubramanian@gmail.com', '', 'DEP-PB', 'Active'),
('1PI13CS007', 'Abhishek', 'P', '9481908988', 'abhijnvb@gmail.com', '', 'DEP-PB', 'Active'),
('1PI13CS035', 'Areeb', 'Sanadi', '9535272420', 'areebsanadi@gmail.com', '', 'DEP-PR', 'Active'),
('1PI14CV035', 'Namrata', 'Tenjarla', '9964821203', 'namratakishan2013@gmail.com', '', 'DEP-MR', 'Active'),
('1PI14CV052', 'Rishika', 'Naik', '9880525034', 'rishikanaik@yahoo.in', '', 'DEP-MR', 'Active'),
('1PI14EC075', 'Tanmaya', 'Prakash', '9739122806', 'tanmayaprakash3@gmail.com', '', 'DEP-PB', 'Active'),
('1PI14IS052', 'Samarth', 'Bannur', '9538130611', 'samarth.bannur.96@gmail.com', '', 'DEP-RS', 'Inactive'),
('1PI14IS082', 'Varun', 'Kotak', '9739272969', 'varun11796@gmail.com', '', 'DEP-MR', 'Active'),
('1PI14ME100', 'Shubham', 'Sinha', '9901810875', 'Shubham290596@gmail.com', '', 'DEP-MR', 'Active'),
('1PI14ME102', 'Sravan Kumar M', 'Sindagi', '8105094546', 'sravanmsindagi@gmail.com', '', 'DEP-SP', 'Active');
-- --------------------------------------------------------
--
-- Table structure for table `projects`
--
CREATE TABLE IF NOT EXISTS `projects` (
`ID` varchar(16) NOT NULL,
`Dep_ID` varchar(16) DEFAULT NULL,
`Title` varchar(45) DEFAULT NULL,
`Description` varchar(255) DEFAULT NULL,
`Leader_USN` varchar(16) DEFAULT NULL,
`Status` varchar(45) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `projects`
--
INSERT INTO `projects` (`ID`, `Dep_ID`, `Title`, `Description`, `Leader_USN`, `Status`) VALUES
('1', 'DEP-DD', 'Database and Management Tool', 'A Database and a management tool to make E-Cell more efficient and coordinated.', '01FB14ECS215', 'Active'),
('10', 'DEP-DD', 'Cover design', 'Design cover page for e-mag the ecell magazine', '01FB14ECS102', 'Active'),
('11', 'DEP-EV', 'Managing upcoming events', NULL, '01FB15EEC123', 'Inactive'),
('12', 'DEP-DD', 'App design ', 'Create fully functional app for ecell', '01FB15ECS082', 'Active'),
('123', 'DEP-DD', 'qqew', 'asdxcdv dsf', '01FB14ECS215', 'Active'),
('2', 'DEP-PR', 'Summer Market Research Project', NULL, '01FB14ECS247', 'Active'),
('3', 'DEP-DD', 'Web design ', 'Creating a functional and sophisticated website for ecell', '01FB14ECS215', 'Active'),
('4', 'DEP-DD', 'Poster Design', 'Design posters for the upcoming events', '01FB14EBT024', 'Inactive'),
('5', 'DEP-PR', 'Investors for hitch-a-ride', 'Find suitable investors for the startup hitch-a-ride', '01FB14EME081', 'Selectively Active'),
('6', 'DEP-PB', 'Publications for endeavour', 'Publish papers for endeavour', '01FB15EME035', 'Active'),
('7', 'DEP-MR', 'Marketing for endeavour', 'Spread awareness for enedeavour', '01FB15ECS141', 'Inactive'),
('8', 'DEP-RS', 'Resource Tally', 'Keep in check the resources used', '01FB14ECS230', 'Inactive'),
('9', 'DEP-SP', 'Sponsors for byakugan', 'Get sponsors for the startup byakugan', '01FB14EBT024', 'Complete');
-- --------------------------------------------------------
--
-- Table structure for table `statuses`
--
CREATE TABLE IF NOT EXISTS `statuses` (
`Status` varchar(64) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `statuses`
--
INSERT INTO `statuses` (`Status`) VALUES
('Active'),
('Complete'),
('Inactive'),
('Selectively Active');
-- --------------------------------------------------------
--
-- Table structure for table `tasks`
--
CREATE TABLE IF NOT EXISTS `tasks` (
`ID` varchar(16) NOT NULL,
`Title` varchar(45) DEFAULT NULL,
`Description` varchar(255) DEFAULT NULL,
`Deadline` date DEFAULT NULL,
`Status` varchar(45) DEFAULT NULL,
`P_ID` varchar(16) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `tasks`
--
INSERT INTO `tasks` (`ID`, `Title`, `Description`, `Deadline`, `Status`, `P_ID`) VALUES
('DBMT-1', 'Build DB', 'Build the database.', '2016-04-18', 'Complete', '1'),
('DBMT-10', 'creating resource spending spredsheet', 'maintaing a spreadsheet of all the resourses used ', '2016-04-22', 'Selectively Active', '8'),
('DBMT-11', 'getting a tech company onboard', 'getting a sponsership from tech company', '2016-04-30', 'Inactive', '9'),
('DBMT-12', 'making a blueprint ', 'creatinng a bluprint of the cover for the e-cell mag.', '2016-04-28', 'Selectively Active', '10'),
('DBMT-14', 'generate algorithm,', 'generate the algorithm', '2016-04-25', 'Selectively Active', '12'),
('DBMT-2', 'Build front end client for DB', 'Build a web based front end client for the database.', '2016-04-21', 'Active', '1'),
('DBMT-3', 'styling using css', 'using css to enhance the visuals of the website', '2016-04-29', 'Active', '3'),
('DBMT-4', 'creating javascripts ', 'using javascripts to add functionality to the site ', '2016-04-29', 'Active', '3'),
('DBMT-5', 'getting art material ', 'brinng the required materials to create the poster .', '2016-04-25', 'Inactive', '4'),
('DBMT-6', 'collecting investor details ', 'getting the details of all possible investors and storing it for future reference ', '2016-06-30', 'Selectively Active', '5'),
('DBMT-7', 'startup visists', 'getting information about startups and their investors ', '2016-05-12', 'Active', '5'),
('DBMT-8', 'setting up endevour team ', 'creating a sepcical publications team for endevour .', '2016-05-05', 'Complete', '6'),
('DBMT-9', 'entrepreneurship quiz ', 'a open quiz on entrepreneurship, and startups .', '2016-04-26', 'Active', '7'),
('DMBT-13', 'distribute flyers ', 'distribute flyers with details of the event', '2016-04-23', 'Active', '11'),
('erwundefined', '123', 'qwead', '2100-01-01', 'Active', '1');
-- --------------------------------------------------------
--
-- Table structure for table `works_on_project`
--
CREATE TABLE IF NOT EXISTS `works_on_project` (
`USN` varchar(16) DEFAULT NULL,
`Project_ID` varchar(16) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `works_on_project`
--
INSERT INTO `works_on_project` (`USN`, `Project_ID`) VALUES
('01FB14ECS215', '1'),
('01FB14ECS215', '2'),
('01FB14ECS247', '2'),
('01FB14ECS215', '3'),
('01FB14EBT024', '9'),
('01FB14ECS230', '8');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `assigned_to_task`
--
ALTER TABLE `assigned_to_task`
ADD KEY `Task_idx` (`Task_ID`),
ADD KEY `USN_idx` (`USN`);
--
-- Indexes for table `collaborators`
--
ALTER TABLE `collaborators`
ADD KEY `P_ID` (`P_ID`);
--
-- Indexes for table `departments`
--
ALTER TABLE `departments`
ADD PRIMARY KEY (`ID`),
ADD UNIQUE KEY `Name_UNIQUE` (`Name`);
--
-- Indexes for table `events`
--
ALTER TABLE `events`
ADD PRIMARY KEY (`ID`),
ADD KEY `Status` (`Status`),
ADD KEY `events_ibfk_1` (`Dep_ID`);
--
-- Indexes for table `heads`
--
ALTER TABLE `heads`
ADD PRIMARY KEY (`USN`),
ADD KEY `heads_ibfk_2` (`Dep_ID`);
--
-- Indexes for table `members`
--
ALTER TABLE `members`
ADD PRIMARY KEY (`USN`),
ADD KEY `Status` (`Status`),
ADD KEY `members_ibfk_1` (`Department`);
--
-- Indexes for table `projects`
--
ALTER TABLE `projects`
ADD PRIMARY KEY (`ID`),
ADD KEY `Status` (`Status`),
ADD KEY `projects_ibfk_1` (`Leader_USN`),
ADD KEY `projects_ibfk_2` (`Dep_ID`);
--
-- Indexes for table `statuses`
--
ALTER TABLE `statuses`
ADD PRIMARY KEY (`Status`),
ADD KEY `Status` (`Status`);
--
-- Indexes for table `tasks`
--
ALTER TABLE `tasks`
ADD PRIMARY KEY (`ID`),
ADD KEY `Status` (`Status`),
ADD KEY `tasks_ibfk_1` (`P_ID`);
--
-- Indexes for table `works_on_project`
--
ALTER TABLE `works_on_project`
ADD KEY `USN_idx` (`USN`),
ADD KEY `Project_ID_idx` (`Project_ID`);
--
-- Constraints for dumped tables
--
--
-- Constraints for table `assigned_to_task`
--
ALTER TABLE `assigned_to_task`
ADD CONSTRAINT `assigned_to_task_ibfk_1` FOREIGN KEY (`USN`) REFERENCES `members` (`USN`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `assigned_to_task_ibfk_2` FOREIGN KEY (`Task_ID`) REFERENCES `tasks` (`ID`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Constraints for table `collaborators`
--
ALTER TABLE `collaborators`
ADD CONSTRAINT `collaborators_fk_1` FOREIGN KEY (`P_ID`) REFERENCES `projects` (`ID`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Constraints for table `events`
--
ALTER TABLE `events`
ADD CONSTRAINT `events_ibfk_1` FOREIGN KEY (`Dep_ID`) REFERENCES `departments` (`ID`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `events_ibfk_2` FOREIGN KEY (`Status`) REFERENCES `statuses` (`Status`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Constraints for table `heads`
--
ALTER TABLE `heads`
ADD CONSTRAINT `heads_ibfk_1` FOREIGN KEY (`USN`) REFERENCES `members` (`USN`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `heads_ibfk_2` FOREIGN KEY (`Dep_ID`) REFERENCES `departments` (`ID`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Constraints for table `members`
--
ALTER TABLE `members`
ADD CONSTRAINT `member_ibfk_2` FOREIGN KEY (`Status`) REFERENCES `statuses` (`Status`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `members_ibfk_1` FOREIGN KEY (`Department`) REFERENCES `departments` (`ID`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Constraints for table `projects`
--
ALTER TABLE `projects`
ADD CONSTRAINT `projects_ibfk_1` FOREIGN KEY (`Leader_USN`) REFERENCES `members` (`USN`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `projects_ibfk_2` FOREIGN KEY (`Dep_ID`) REFERENCES `departments` (`ID`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `projects_ibfk_3` FOREIGN KEY (`Status`) REFERENCES `statuses` (`Status`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Constraints for table `tasks`
--
ALTER TABLE `tasks`
ADD CONSTRAINT `tasks_ibfk_1` FOREIGN KEY (`P_ID`) REFERENCES `projects` (`ID`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `tasks_ibfk_2` FOREIGN KEY (`Status`) REFERENCES `statuses` (`Status`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Constraints for table `works_on_project`
--
ALTER TABLE `works_on_project`
ADD CONSTRAINT `works_on_project_ibfk_1` FOREIGN KEY (`USN`) REFERENCES `members` (`USN`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `works_on_project_ibfk_2` FOREIGN KEY (`Project_ID`) REFERENCES `projects` (`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 |
c2ecb72c5fc22b5602315a478c44fab7b0e064c1
|
SQL
|
gechang90/sql-challenge
|
/EmployeeSQL/q1-8_query.sql
|
UTF-8
| 1,647 | 4.09375 | 4 |
[] |
no_license
|
--Q1 answer:
SELECT employees.emp_no,employees.last_name, employees.first_name,employees.gender,salaries.salary
FROM employees
INNER JOIN salaries on
employees.emp_no= salaries.emp_no;
--Q2 answer:
SELECT * FROM employees
WHERE hire_date BETWEEN '1986-01-01' AND '1986-12-31';
--Q3 answer:
SELECT employees.emp_no,dept_manager.dept_no,departments.dept_name,employees.first_name,employees.last_name,dept_manager.from_date,dept_manager.to_date
FROM dept_manager
INNER JOIN employees ON
dept_manager.emp_no = employees.emp_no
INNER JOIN departments ON
dept_manager.dept_no = departments.dept_no;
--Q4 answer
SELECT employees.emp_no,employees.last_name,employees.first_name,departments.dept_name
FROM dept_emp
INNER JOIN employees ON
dept_emp.emp_no = employees.emp_no
INNER JOIN departments ON
dept_emp.dept_no = departments.dept_no;
--Q5 answer
SELECT employees.first_name,employees.last_name
FROM employees
WHERE first_name = 'Hercules' AND last_name LIKE 'B%'
--Q6 answer
SELECT employees.emp_no,employees.last_name,employees.first_name,departments.dept_name
FROM dept_emp
INNER JOIN employees ON
dept_emp.emp_no = employees.emp_no
INNER JOIN departments ON
dept_emp.dept_no = departments.dept_no
WHERE dept_name = 'Sales';
--Q7 answer
SELECT employees.emp_no,employees.last_name,employees.first_name,departments.dept_name
FROM dept_emp
INNER JOIN employees ON
dept_emp.emp_no = employees.emp_no
INNER JOIN departments ON
dept_emp.dept_no = departments.dept_no
WHERE dept_name = 'Sales' OR dept_name = 'Development';
--Q8 answer
SELECT COUNT(last_name), last_name
FROM employees
GROUP BY last_name
ORDER BY COUNT(last_name) DESC;
| true |
2578dcdaf652ce2a9d4790c915d7e0a7f7ed6cb2
|
SQL
|
gurpreet19/ec198392_wht
|
/Database/configuration/03_02_headless_tool/Delta_WST/TargetPackageDefinitions/UE_STORAGE_PROC_PLANT_HEAD.sql
|
UTF-8
| 2,468 | 2.84375 | 3 |
[] |
no_license
|
CREATE OR REPLACE PACKAGE ue_storage_proc_plant IS
/****************************************************************
** Package : ue_storage_proc_plant; head part
**
** $Revision: 1.2 $
**
** Purpose : This package is used by calling from EcBp_Storage_Proc_plant when predefined functions supplied by EC does not cover the requirements.
**
** Documentation : www.energy-components.com
**
** Created : 05.04.2011 Sarojini Rajaretnam
**
** Modification history:
**
** Date Whom Change description:
** ---------- ----- -------------------------------------------
** 05.04.2011 rajarsar ECPD-17066:Initial version
** 30.01.2012 choonshu ECPD-18622:Added getContentDensity
*************************************************************************/
FUNCTION getStorageDayGrsOpeningVol(p_object_id storage.object_id%TYPE, p_daytime DATE)
RETURN NUMBER;
PRAGMA RESTRICT_REFERENCES (getStorageDayGrsOpeningVol, WNDS, WNPS, RNPS);
FUNCTION getStorageDayGrsClosingVol(p_object_id storage.object_id%TYPE, p_daytime DATE)
RETURN NUMBER;
PRAGMA RESTRICT_REFERENCES (getStorageDayGrsClosingVol, WNDS, WNPS, RNPS);
FUNCTION getProdDayGrsOpeningVol (
p_object_id storage.object_id%TYPE,
p_product_id product.object_id%TYPE,
p_daytime DATE)
RETURN NUMBER;
PRAGMA RESTRICT_REFERENCES(getProdDayGrsOpeningVol, WNDS, WNPS, RNPS);
FUNCTION getProdDayGrsClosingVol (
p_object_id storage.object_id%TYPE,
p_product_id product.object_id%TYPE,
p_daytime DATE,
p_to_daytime DATE DEFAULT NULL)
RETURN NUMBER;
PRAGMA RESTRICT_REFERENCES(getProdDayGrsClosingVol, WNDS, WNPS, RNPS);
FUNCTION getCompDayGrsOpeningVol (
p_object_id product.object_id%TYPE,
p_company_id company.object_id%TYPE,
p_daytime DATE)
RETURN NUMBER;
PRAGMA RESTRICT_REFERENCES(getCompDayGrsOpeningVol, WNDS, WNPS, RNPS);
FUNCTION getCompDayGrsClosingVol (
p_object_id product.object_id%TYPE,
p_company_id company.object_id%TYPE,
p_daytime DATE,
p_to_daytime DATE DEFAULT NULL )
RETURN NUMBER;
PRAGMA RESTRICT_REFERENCES(getCompDayGrsClosingVol, WNDS, WNPS, RNPS);
Procedure createGainLossTransaction(p_object_id VARCHAR2,p_daytime DATE);
Procedure createRegradeOwnship(p_event_no NUMBER);
FUNCTION getContentDensity (
p_object_id product.object_id%TYPE,
p_daytime DATE)
RETURN NUMBER;
PRAGMA RESTRICT_REFERENCES(getContentDensity, WNDS, WNPS, RNPS);
END ue_storage_proc_plant;
| true |
81b2403c6a74ab579a1079367d98711831b7bcdc
|
SQL
|
benjajaja/pingpongwinners
|
/sql/bd.sql
|
UTF-8
| 1,365 | 3.109375 | 3 |
[] |
no_license
|
-- phpMyAdmin SQL Dump
-- version 4.1.9
-- http://www.phpmyadmin.net
--
-- Host: localhost:8889
-- Generation Time: 09-04-2014 a les 14:23:22
-- Server version: 5.5.34
-- PHP Version: 5.5.10
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
--
-- Database: `idkpong`
--
-- --------------------------------------------------------
--
-- Estructura de la taula `matches`
--
CREATE TABLE `matches` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`winner` int(11) NOT NULL,
`loser` int(11) NOT NULL,
`date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`winnerpoints` int(11) NOT NULL,
`loserpoints` int(11) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `id` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=4 ;
-- --------------------------------------------------------
--
-- Estructura de la taula `players`
--
CREATE TABLE `players` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` text NOT NULL,
`fullName` text NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=5 ;
-- --------------------------------------------------------
--
-- Estructura de la taula `results`
--
CREATE TABLE `results` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`winnerpoints` int(11) NOT NULL,
`loserpoints` int(11) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
| true |
24f1390938967727042af3b35f4a50174511d92e
|
SQL
|
valdipietro/sabretooth
|
/sql/upgrade/1.1.0/phone_call.sql
|
UTF-8
| 1,169 | 3.8125 | 4 |
[] |
no_license
|
-- add the new index to the start_datetime and end_datetime columns
-- we need to create a procedure which only alters the phone_call table if the
-- start_datetime or end_datetime column indices are missing
DROP PROCEDURE IF EXISTS patch_phone_call;
DELIMITER //
CREATE PROCEDURE patch_phone_call()
BEGIN
DECLARE test INT;
SET @test =
( SELECT COUNT(*)
FROM information_schema.COLUMNS
WHERE TABLE_SCHEMA = ( SELECT DATABASE() )
AND TABLE_NAME = "phone_call"
AND COLUMN_NAME = "start_datetime"
AND COLUMN_KEY = "" );
IF @test = 1 THEN
ALTER TABLE phone_call
ADD INDEX dk_start_datetime (start_datetime ASC);
END IF;
SET @test =
( SELECT COUNT(*)
FROM information_schema.COLUMNS
WHERE TABLE_SCHEMA = ( SELECT DATABASE() )
AND TABLE_NAME = "phone_call"
AND COLUMN_NAME = "end_datetime"
AND COLUMN_KEY = "" );
IF @test = 1 THEN
ALTER TABLE phone_call
ADD INDEX dk_end_datetime (end_datetime ASC);
END IF;
END //
DELIMITER ;
-- now call the procedure and remove the procedure
CALL patch_phone_call();
DROP PROCEDURE IF EXISTS patch_phone_call;
| true |
90ad73141db33327deec7f2c530b97723c3a1912
|
SQL
|
paultag/caseflow
|
/doc/queries/mpr/d_mpr7_org_pending_asof_date.sql
|
UTF-8
| 685 | 3.765625 | 4 |
[
"CC0-1.0",
"LicenseRef-scancode-public-domain"
] |
permissive
|
-- MPR / MPR7 - Originals Certified as of date
WITH cases AS (
SELECT
brieff.bfcurloc,
brieff.bfmpro,
brieff.bfregoff,
brieff.bf41stat,
brieff.bfdtb,
brieff.bfha,
brieff.bfhr,
brieff.bfdocind,
brieff.bfac,
to_date(:start_date, 'MM/DD/YY') - brieff.bf41stat AS date_to_certified
FROM brieff
WHERE
brieff.bfac = '1' AND
brieff.bf41stat <= to_date(:start_date, 'MM/DD/YY') AND
(brieff.bfddec >= to_date(:start_date, 'MM/DD/YY') OR brieff.bfddec IS NULL)
)
SELECT
cases.bfac AS "Type Action",
count(bfmpro) AS "Certified",
to_char(avg(cases.date_to_certified), '9999.99') AS "Average Days from Cert"
FROM cases
GROUP BY cases.bfac
ORDER BY cases.bfac ASC
| true |
63ca36e044ca10e8d0b4723f26a268b319ef7193
|
SQL
|
mateotherock/utah-trails
|
/db/get_new_users.sql
|
UTF-8
| 55 | 2.640625 | 3 |
[] |
no_license
|
select *
from users
order by date_joined desc
limit 10;
| true |
c0fb4375f0654f5ed9d6f5b2d16b7056a1e7ed26
|
SQL
|
josethec/unipostgresql2020
|
/cte.sql
|
UTF-8
| 967 | 4.21875 | 4 |
[] |
no_license
|
select film_id, title, case when length<30 then 'Short'
when length>50 then 'Medium'
end as length
from film
select * from (
select payment_date, count(amount) as grp
from payment
group by payment_date
) grupo where grupo.grp>1
with fecha_duplicada as (
select payment_date, count(amount) as grp
from payment
group by payment_date
)
select * from fecha_duplicada where fecha_duplicada.grp>1
with cte_staff as (
select staff_id,count(rental_id) as conteo
from rental
group by staff_id
)
select s.staff_id,s.first_name,s.last_name, cs.conteo from staff s
inner join cte_staff as cs on (s.staff_id=cs.staff_id)
with cte_payment_1 as (
select * from payment where customer_id=107 and payment_date::date between '20070220' and '20070228'
), cte_payment_2 as (
select * from payment where customer_id=107 and payment_date::date between '20070220' and '20070310'
)
select count(*) from cte_payment_1 union all select count(*) from cte_payment_2
| true |
5948d960b3169cf60c85c1f033c816f8ffcd921e
|
SQL
|
LightCake/chat
|
/tables.sql
|
UTF-8
| 583 | 3.53125 | 4 |
[] |
no_license
|
CREATE DATABASE chat;
CREATE TABLE users (
ID SERIAL PRIMARY KEY,
name VARCHAR(100),
password VARCHAR(100),
created TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
CREATE TABLE rooms (
ID SERIAL PRIMARY KEY,
user_id INT,
name VARCHAR(100),
created TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (user_id) REFERENCES users(ID)
);
CREATE TABLE messages (
ID SERIAL PRIMARY KEY,
user_id INT,
room_id INT,
text VARCHAR(100),
created TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (user_id) REFERENCES users(ID),
FOREIGN KEY (room_id) REFERENCES rooms(ID)
);
| true |
c458bed5063e1d817126a1c2e2f19ac05b0ed9b7
|
SQL
|
baobeta/ToiecOnline
|
/ToiecOnline/ApplicationFile/Database/4. create_table_comment.sql
|
UTF-8
| 456 | 3 | 3 |
[] |
no_license
|
use toieconline;
create table comment(
commentid bigint not null primary key auto_increment,
context text null,
userid bigint null ,
listenguidelineid bigint null,
createddate timestamp null
);
alter table comment add constraint fk_user_comment foreign key (userid) references user(userid);
alter table comment add constraint fk_listenguideline_comment foreign key (listenguidelineid) references listenguideline(listenguidelineid);
| true |
dd666add5e8516a3e1ee042616361163c9cd71a1
|
SQL
|
belal55/Virtual-Judge-Panel-Laravel
|
/virtualjudgedb.sql
|
UTF-8
| 10,611 | 2.953125 | 3 |
[
"Apache-2.0",
"MIT"
] |
permissive
|
-- phpMyAdmin SQL Dump
-- version 4.7.0
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Jan 28, 2018 at 02:01 PM
-- Server version: 10.1.24-MariaDB
-- PHP Version: 7.1.6
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Database: `virtualjudgedb`
--
-- --------------------------------------------------------
--
-- Table structure for table `comments`
--
CREATE TABLE `comments` (
`id` int(11) NOT NULL,
`uid` int(11) NOT NULL,
`project_id` int(11) NOT NULL,
`comment_text` varchar(500) NOT NULL,
`time` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `comments`
--
INSERT INTO `comments` (`id`, `uid`, `project_id`, `comment_text`, `time`) VALUES
(14, 4, 3, 'nice project ... carry on :)', '2018-01-15 18:16:30'),
(15, 4, 4, 'brilliant !!!!', '2018-01-15 18:17:11'),
(16, 5, 4, 'Nice one ... :)', '2018-01-15 18:19:57'),
(17, 2, 3, 'Thanks for comment :)', '2018-01-15 18:20:43'),
(18, 6, 4, 'Thanks you all :)', '2018-01-15 18:21:31'),
(19, 4, 3, 'wlc...', '2018-01-16 23:10:27'),
(20, 4, 3, 'best of luck :)', '2018-01-16 23:30:14'),
(21, 4, 4, 'best of luck ..... :)', '2018-01-16 23:44:59'),
(22, 2, 3, 'thanks :)', '2018-01-16 23:47:18'),
(23, 10, 5, 'nice project.. you can update it if u wish...', '2018-01-23 19:58:57'),
(24, 9, 5, 'thanks for cmnt.. i will up date it as soon as possible', '2018-01-23 20:00:45'),
(25, 4, 5, 'nice project', '2018-01-23 20:09:50');
-- --------------------------------------------------------
--
-- Table structure for table `eventcategory`
--
CREATE TABLE `eventcategory` (
`id` int(11) NOT NULL,
`category_name` varchar(150) NOT NULL,
`event_id` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `eventcategory`
--
INSERT INTO `eventcategory` (`id`, `category_name`, `event_id`) VALUES
(6, 'Android', 2),
(7, 'IOS', 2),
(8, 'Android App', 5),
(9, 'Ios App', 5),
(10, 'Web app', 5),
(11, 'Android', 8),
(12, 'Des', 8),
(13, 'Desktop', 8),
(14, 'Android', 9),
(15, 'Desktop', 9),
(16, 'Android', 10),
(17, 'Desktop', 10),
(18, 'IOS APP', 10);
-- --------------------------------------------------------
--
-- Table structure for table `events`
--
CREATE TABLE `events` (
`id` int(11) NOT NULL,
`title` varchar(250) NOT NULL,
`short_desc` varchar(500) NOT NULL,
`start_date` datetime NOT NULL,
`end_date` datetime NOT NULL,
`judgement_Datetime` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `events`
--
INSERT INTO `events` (`id`, `title`, `short_desc`, `start_date`, `end_date`, `judgement_Datetime`) VALUES
(2, 'DIU App contest 2k18', 'short description goes here...', '2018-01-08 18:00:00', '2018-01-13 22:00:00', '2018-01-08 21:00:00'),
(5, 'Dhaka app contest', 'Short description will be here...........', '2018-01-13 15:18:00', '2018-01-13 15:20:00', '2018-01-11 10:00:00'),
(8, 'BD App Contest 2018', 'Description and terms of this event will be here........', '2018-01-15 12:00:00', '2018-01-17 12:00:00', '2018-01-16 23:43:00'),
(9, 'New event 2018', 'description will be here..', '2018-01-17 00:00:00', '2018-01-19 00:00:00', '2018-01-18 20:00:00'),
(10, 'Dhaka 24 Hour App contest', 'jsdfljsdlfk lkjsddflksjldfjslkdjf\r\nsdjfslkdjflsjflskdjfls dflkjsdlfkjasldkjflskjdflsdk\r\ndkkjfsldfkjlsdjflaskjd flksdjff\r\nsadffjsdlkfjalsjdfflskjdf kjflfskjdlfksjdlfkjk ljl', '2018-01-23 19:50:00', '2018-01-25 22:00:00', '2018-01-23 20:05:00');
-- --------------------------------------------------------
--
-- Table structure for table `projects`
--
CREATE TABLE `projects` (
`id` int(11) NOT NULL,
`title` varchar(150) NOT NULL,
`short_desc` varchar(500) NOT NULL,
`video_path` varchar(500) NOT NULL,
`file_path` varchar(500) NOT NULL,
`student_id` int(11) NOT NULL,
`event_id` int(11) NOT NULL,
`category_id` int(11) NOT NULL,
`avg_rate` double NOT NULL,
`upload_date` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `projects`
--
INSERT INTO `projects` (`id`, `title`, `short_desc`, `video_path`, `file_path`, `student_id`, `event_id`, `category_id`, `avg_rate`, `upload_date`) VALUES
(3, 'VAT Chacker Android App', 'Short description goes here.....................', '20180115181129Dil Diyan Gallan Song _ Tiger Zinda Hai _ Salman Khan _ Katrina Kaif _ Atif Aslam.mp4', '20180115181129151-15-4720.zip', 2, 8, 11, 4.25, '2018-01-15 18:11:29'),
(4, 'Library Management System', 'Project description in details will be here..', '20180115181516Happy Ukulele Royalty Free Music For Youtube Videos - YouTube.mp4', '2018011518151615-28808-1_Sec-F_labxm.zip', 6, 8, 13, 4.45, '2018-01-15 18:15:16'),
(5, 'E-votting android app', 'sjdlkfjslfd lj4', '20180123195344Happy Ukulele Royalty Free Music For Youtube Videos - YouTube.mp4', '20180123195344problem.zip', 9, 10, 16, 4.95, '2018-01-23 20:01:59');
-- --------------------------------------------------------
--
-- Table structure for table `ratings`
--
CREATE TABLE `ratings` (
`id` int(11) NOT NULL,
`uid` int(11) NOT NULL,
`project_id` int(11) NOT NULL,
`rate` double NOT NULL,
`time` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `ratings`
--
INSERT INTO `ratings` (`id`, `uid`, `project_id`, `rate`, `time`) VALUES
(6, 4, 3, 4.5, '2018-01-17 01:46:19'),
(7, 4, 4, 4.4, '2018-01-15 18:17:30'),
(8, 5, 3, 4, '2018-01-15 18:18:45'),
(9, 5, 4, 4.5, '2018-01-15 18:19:38'),
(10, 10, 5, 4.9, '2018-01-25 00:20:41'),
(11, 4, 5, 5, '2018-01-23 20:10:21');
-- --------------------------------------------------------
--
-- Table structure for table `users`
--
CREATE TABLE `users` (
`id` int(11) NOT NULL,
`name` varchar(50) NOT NULL,
`email` varchar(70) NOT NULL,
`gender` varchar(10) NOT NULL,
`password` varchar(50) NOT NULL,
`img_path` varchar(100) DEFAULT NULL,
`user_type_id` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `users`
--
INSERT INTO `users` (`id`, `name`, `email`, `gender`, `password`, `img_path`, `user_type_id`) VALUES
(1, 'Administrator', 'admin@gmail.com', 'Male', '123456', '20180106180456index5.jpg', 1),
(2, 'Belal Khan', 'belal@gmail.com', 'Male', '123456', '2018011223522220171111124333index.jpg', 3),
(4, 'Jhon smith', 'jhon@gmail.com', 'Male', '123456789', '20180115155022images6.jpg', 2),
(5, 'Mr. Rock', 'rock@gmail.com', 'Male', '123456', NULL, 2),
(6, 'Mohona', 'mohona@gmail.com', 'Female', '123456', NULL, 3),
(7, 'Jhon Cena', 'jhon.cena@gmail.com', 'Male', '123456', NULL, 2),
(8, 'Anne', 'anne@gmail.com', 'Male', '123456', NULL, 2),
(9, 'Md Helal', 'helal@gmail.com', 'Male', '123456', '20180123194634index2.jpg', 3),
(10, 'Jack', 'jack@gmail.com', 'Male', '123456', NULL, 2);
-- --------------------------------------------------------
--
-- Table structure for table `user_types`
--
CREATE TABLE `user_types` (
`id` int(11) NOT NULL,
`type_name` varchar(50) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `user_types`
--
INSERT INTO `user_types` (`id`, `type_name`) VALUES
(1, 'admin'),
(2, 'judge'),
(3, 'student');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `comments`
--
ALTER TABLE `comments`
ADD PRIMARY KEY (`id`),
ADD KEY `userFk` (`uid`),
ADD KEY `projectFk` (`project_id`);
--
-- Indexes for table `eventcategory`
--
ALTER TABLE `eventcategory`
ADD PRIMARY KEY (`id`),
ADD KEY `eventFk` (`event_id`);
--
-- Indexes for table `events`
--
ALTER TABLE `events`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `projects`
--
ALTER TABLE `projects`
ADD PRIMARY KEY (`id`),
ADD KEY `CategoryFk` (`category_id`);
--
-- Indexes for table `ratings`
--
ALTER TABLE `ratings`
ADD PRIMARY KEY (`id`),
ADD KEY `RatingUserFk` (`uid`),
ADD KEY `RatingProjectFk` (`project_id`);
--
-- Indexes for table `users`
--
ALTER TABLE `users`
ADD PRIMARY KEY (`id`),
ADD KEY `userTypeFK` (`user_type_id`);
--
-- Indexes for table `user_types`
--
ALTER TABLE `user_types`
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=26;
--
-- AUTO_INCREMENT for table `eventcategory`
--
ALTER TABLE `eventcategory`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=19;
--
-- AUTO_INCREMENT for table `events`
--
ALTER TABLE `events`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=11;
--
-- AUTO_INCREMENT for table `projects`
--
ALTER TABLE `projects`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;
--
-- AUTO_INCREMENT for table `ratings`
--
ALTER TABLE `ratings`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=12;
--
-- AUTO_INCREMENT for table `users`
--
ALTER TABLE `users`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=11;
--
-- AUTO_INCREMENT for table `user_types`
--
ALTER TABLE `user_types`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
--
-- Constraints for dumped tables
--
--
-- Constraints for table `comments`
--
ALTER TABLE `comments`
ADD CONSTRAINT `projectFk` FOREIGN KEY (`project_id`) REFERENCES `projects` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `userFk` FOREIGN KEY (`uid`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Constraints for table `eventcategory`
--
ALTER TABLE `eventcategory`
ADD CONSTRAINT `eventFk` FOREIGN KEY (`event_id`) REFERENCES `events` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Constraints for table `projects`
--
ALTER TABLE `projects`
ADD CONSTRAINT `CategoryFk` FOREIGN KEY (`category_id`) REFERENCES `eventcategory` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Constraints for table `ratings`
--
ALTER TABLE `ratings`
ADD CONSTRAINT `RatingProjectFk` FOREIGN KEY (`project_id`) REFERENCES `projects` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `RatingUserFk` FOREIGN KEY (`uid`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Constraints for table `users`
--
ALTER TABLE `users`
ADD CONSTRAINT `userTypeFK` FOREIGN KEY (`user_type_id`) REFERENCES `user_types` (`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 |
84351b5164fd508485aa2654212942c62fcd16cb
|
SQL
|
grvgoel81/leetcode
|
/queries-quality-and-percentage.sql
|
UTF-8
| 210 | 3.21875 | 3 |
[] |
no_license
|
SELECT
query_name,
ROUND(AVG(CAST(rating AS DECIMAL(10, 6)) / position), 2) AS quality,
ROUND(SUM(IF(rating < 3, 1, 0)) / COUNT(*) * 100, 2) AS poor_query_percentage
FROM Queries
GROUP BY query_name
| true |
cb171ef218234682a0c675f7d05e0f7e32c15032
|
SQL
|
roufiq/fenomenom
|
/sql/bps1101_db_phenomenom.sql
|
UTF-8
| 44,060 | 3.265625 | 3 |
[
"BSD-3-Clause"
] |
permissive
|
-- --------------------------------------------------------
-- Host: localhost
-- Server version: 5.7.9 - MySQL Community Server (GPL)
-- Server OS: Win64
-- HeidiSQL Version: 9.4.0.5170
-- --------------------------------------------------------
/*!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' */;
-- Dumping database structure for bps1101_db_phenomenom
DROP DATABASE IF EXISTS `bps1101_db_phenomenom`;
CREATE DATABASE IF NOT EXISTS `bps1101_db_phenomenom` /*!40100 DEFAULT CHARACTER SET latin1 */;
USE `bps1101_db_phenomenom`;
-- Dumping structure for table bps1101_db_phenomenom.auth_assignment
DROP TABLE IF EXISTS `auth_assignment`;
CREATE TABLE IF NOT EXISTS `auth_assignment` (
`item_name` varchar(64) COLLATE utf8_unicode_ci NOT NULL,
`user_id` varchar(64) COLLATE utf8_unicode_ci NOT NULL,
`created_at` int(11) DEFAULT NULL,
PRIMARY KEY (`item_name`,`user_id`),
CONSTRAINT `auth_assignment_ibfk_1` FOREIGN KEY (`item_name`) REFERENCES `auth_item` (`name`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- Dumping data for table bps1101_db_phenomenom.auth_assignment: ~5 rows (approximately)
/*!40000 ALTER TABLE `auth_assignment` DISABLE KEYS */;
INSERT INTO `auth_assignment` (`item_name`, `user_id`, `created_at`) VALUES
('Administrator', '1', 1492859041),
('Member', '11', 1493190584),
('Member', '4', 1492859247),
('Pemantau', '19', 1493300484);
/*!40000 ALTER TABLE `auth_assignment` ENABLE KEYS */;
-- Dumping structure for table bps1101_db_phenomenom.auth_item
DROP TABLE IF EXISTS `auth_item`;
CREATE TABLE IF NOT EXISTS `auth_item` (
`name` varchar(64) COLLATE utf8_unicode_ci NOT NULL,
`type` smallint(6) NOT NULL,
`description` text COLLATE utf8_unicode_ci,
`rule_name` varchar(64) COLLATE utf8_unicode_ci DEFAULT NULL,
`data` blob,
`created_at` int(11) DEFAULT NULL,
`updated_at` int(11) DEFAULT NULL,
PRIMARY KEY (`name`),
KEY `rule_name` (`rule_name`),
KEY `idx-auth_item-type` (`type`),
CONSTRAINT `auth_item_ibfk_1` FOREIGN KEY (`rule_name`) REFERENCES `auth_rule` (`name`) ON DELETE SET NULL ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- Dumping data for table bps1101_db_phenomenom.auth_item: ~40 rows (approximately)
/*!40000 ALTER TABLE `auth_item` DISABLE KEYS */;
INSERT INTO `auth_item` (`name`, `type`, `description`, `rule_name`, `data`, `created_at`, `updated_at`) VALUES
('/*', 2, NULL, NULL, NULL, 1492813780, 1492813780),
('/fenomena/*', 2, NULL, NULL, NULL, 1492813818, 1492813818),
('/fenomena/create', 2, NULL, NULL, NULL, 1492859232, 1492859232),
('/fenomena/delete', 2, NULL, NULL, NULL, 1492859233, 1492859233),
('/fenomena/index', 2, NULL, NULL, NULL, 1492859225, 1492859225),
('/fenomena/update', 2, NULL, NULL, NULL, 1492859235, 1492859235),
('/fenomena/upload', 2, NULL, NULL, NULL, 1492859236, 1492859236),
('/fenomena/view', 2, NULL, NULL, NULL, 1492859227, 1492859227),
('/m-kategori-pdrb/index', 2, NULL, NULL, NULL, 1492867683, 1492867683),
('/m-kategori-pdrb/view', 2, NULL, NULL, NULL, 1492867685, 1492867685),
('/m-pdrb/index', 2, NULL, NULL, NULL, 1492867683, 1492867683),
('/m-pdrb/view', 2, NULL, NULL, NULL, 1492867685, 1492867685),
('/m-sub-kategori/index', 2, NULL, NULL, NULL, 1492867684, 1492867684),
('/m-sub-kategori/view', 2, NULL, NULL, NULL, 1492867685, 1492867685),
('/m-subkategori/index', 2, NULL, NULL, NULL, 1493364080, 1493364080),
('/m-subkategori/view', 2, NULL, NULL, NULL, 1493364040, 1493364040),
('/mimin/*', 2, NULL, NULL, NULL, 1492813838, 1492813838),
('/mimin/role/*', 2, NULL, NULL, NULL, 1492813839, 1492813839),
('/mimin/role/index', 2, NULL, NULL, NULL, 1492952678, 1492952678),
('/mimin/role/view', 2, NULL, NULL, NULL, 1493300957, 1493300957),
('/mimin/route/*', 2, NULL, NULL, NULL, 1492813840, 1492813840),
('/mimin/route/view', 2, NULL, NULL, NULL, 1493300959, 1493300959),
('/mimin/user/*', 2, NULL, NULL, NULL, 1492813841, 1492813841),
('/mimin/user/index', 2, NULL, NULL, NULL, 1492952679, 1492952679),
('/mimin/user/view', 2, NULL, NULL, NULL, 1493300961, 1493300961),
('/mkategori-pdrb/*', 2, NULL, NULL, NULL, 1492813842, 1492813842),
('/mkategori-pdrb/index', 2, NULL, NULL, NULL, 1492867098, 1492867098),
('/mkategori-pdrb/view', 2, NULL, NULL, NULL, 1492867100, 1492867100),
('/mpdrb/*', 2, NULL, NULL, NULL, 1492813842, 1492813842),
('/mpdrb/index', 2, NULL, NULL, NULL, 1492867100, 1492867100),
('/mpdrb/view', 2, NULL, NULL, NULL, 1492867101, 1492867101),
('/msub-kategori/*', 2, NULL, NULL, NULL, 1492813843, 1492813843),
('/msub-kategori/index', 2, NULL, NULL, NULL, 1492867101, 1492867101),
('/msub-kategori/view', 2, NULL, NULL, NULL, 1492867102, 1492867102),
('/rekap-fenomena/*', 2, NULL, NULL, NULL, 1492813844, 1492813844),
('/rekap-fenomena/index', 2, NULL, NULL, NULL, 1492867108, 1492867108),
('/rekap-fenomena/tabulasi', 2, NULL, NULL, NULL, 1492867767, 1492867767),
('/rekap-fenomena/view', 2, NULL, NULL, NULL, 1492867115, 1492867115),
('/site/*', 2, NULL, NULL, NULL, 1492813845, 1492813845),
('/site/error', 2, NULL, NULL, NULL, 1493776004, 1493776004),
('/site/index', 2, NULL, NULL, NULL, 1492952684, 1492952684),
('/site/login', 2, NULL, NULL, NULL, 1493776064, 1493776064),
('/site/logout', 2, NULL, NULL, NULL, 1493776011, 1493776011),
('/user-profil/*', 2, NULL, NULL, NULL, 1492813846, 1492813846),
('/user-profil/index', 2, NULL, NULL, NULL, 1492952692, 1492952692),
('/user-profil/update', 2, NULL, NULL, NULL, 1493776073, 1493776073),
('/user-profil/view', 2, NULL, NULL, NULL, 1493776074, 1493776074),
('Administrator', 1, NULL, NULL, NULL, 1492858889, 1492859025),
('Member', 1, NULL, NULL, NULL, 1492859220, 1493301007),
('Pemantau', 1, NULL, NULL, NULL, 1492952667, 1493776021);
/*!40000 ALTER TABLE `auth_item` ENABLE KEYS */;
-- Dumping structure for table bps1101_db_phenomenom.auth_item_child
DROP TABLE IF EXISTS `auth_item_child`;
CREATE TABLE IF NOT EXISTS `auth_item_child` (
`parent` varchar(64) COLLATE utf8_unicode_ci NOT NULL,
`child` varchar(64) COLLATE utf8_unicode_ci NOT NULL,
PRIMARY KEY (`parent`,`child`),
KEY `child` (`child`),
CONSTRAINT `auth_item_child_ibfk_1` FOREIGN KEY (`parent`) REFERENCES `auth_item` (`name`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `auth_item_child_ibfk_2` FOREIGN KEY (`child`) REFERENCES `auth_item` (`name`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- Dumping data for table bps1101_db_phenomenom.auth_item_child: ~51 rows (approximately)
/*!40000 ALTER TABLE `auth_item_child` DISABLE KEYS */;
INSERT INTO `auth_item_child` (`parent`, `child`) VALUES
('Administrator', '/*'),
('Administrator', '/fenomena/*'),
('Member', '/fenomena/create'),
('Member', '/fenomena/delete'),
('Member', '/fenomena/index'),
('Pemantau', '/fenomena/index'),
('Member', '/fenomena/update'),
('Member', '/fenomena/upload'),
('Member', '/fenomena/view'),
('Member', '/m-kategori-pdrb/index'),
('Pemantau', '/m-kategori-pdrb/index'),
('Member', '/m-kategori-pdrb/view'),
('Member', '/m-pdrb/index'),
('Pemantau', '/m-pdrb/index'),
('Member', '/m-pdrb/view'),
('Member', '/m-sub-kategori/index'),
('Pemantau', '/m-sub-kategori/index'),
('Member', '/m-sub-kategori/view'),
('Member', '/m-subkategori/index'),
('Pemantau', '/m-subkategori/index'),
('Member', '/m-subkategori/view'),
('Administrator', '/mimin/*'),
('Administrator', '/mimin/role/*'),
('Pemantau', '/mimin/role/index'),
('Member', '/mimin/role/view'),
('Administrator', '/mimin/route/*'),
('Member', '/mimin/route/view'),
('Administrator', '/mimin/user/*'),
('Pemantau', '/mimin/user/index'),
('Member', '/mimin/user/view'),
('Administrator', '/mkategori-pdrb/*'),
('Member', '/mkategori-pdrb/index'),
('Member', '/mkategori-pdrb/view'),
('Administrator', '/mpdrb/*'),
('Member', '/mpdrb/index'),
('Member', '/mpdrb/view'),
('Administrator', '/msub-kategori/*'),
('Member', '/msub-kategori/index'),
('Member', '/msub-kategori/view'),
('Administrator', '/rekap-fenomena/*'),
('Pemantau', '/rekap-fenomena/index'),
('Administrator', '/site/*'),
('Member', '/site/index'),
('Pemantau', '/site/index'),
('Member', '/site/login'),
('Member', '/site/logout'),
('Pemantau', '/site/logout'),
('Administrator', '/user-profil/*'),
('Member', '/user-profil/index'),
('Pemantau', '/user-profil/index'),
('Member', '/user-profil/update'),
('Member', '/user-profil/view');
/*!40000 ALTER TABLE `auth_item_child` ENABLE KEYS */;
-- Dumping structure for table bps1101_db_phenomenom.auth_rule
DROP TABLE IF EXISTS `auth_rule`;
CREATE TABLE IF NOT EXISTS `auth_rule` (
`name` varchar(64) COLLATE utf8_unicode_ci NOT NULL,
`data` blob,
`created_at` int(11) DEFAULT NULL,
`updated_at` int(11) DEFAULT NULL,
PRIMARY KEY (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- Dumping data for table bps1101_db_phenomenom.auth_rule: ~0 rows (approximately)
/*!40000 ALTER TABLE `auth_rule` DISABLE KEYS */;
/*!40000 ALTER TABLE `auth_rule` ENABLE KEYS */;
-- Dumping structure for table bps1101_db_phenomenom.migration
DROP TABLE IF EXISTS `migration`;
CREATE TABLE IF NOT EXISTS `migration` (
`version` varchar(180) NOT NULL,
`apply_time` int(11) DEFAULT NULL,
PRIMARY KEY (`version`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-- Dumping data for table bps1101_db_phenomenom.migration: 4 rows
/*!40000 ALTER TABLE `migration` DISABLE KEYS */;
INSERT INTO `migration` (`version`, `apply_time`) VALUES
('m000000_000000_base', 1492263694),
('m130524_201442_init', 1492265555),
('m151024_072453_create_route_table', 1492812836),
('m140506_102106_rbac_init', 1492813382);
/*!40000 ALTER TABLE `migration` ENABLE KEYS */;
-- Dumping structure for table bps1101_db_phenomenom.m_kategori_pdrb
DROP TABLE IF EXISTS `m_kategori_pdrb`;
CREATE TABLE IF NOT EXISTS `m_kategori_pdrb` (
`id_kategori` int(2) NOT NULL AUTO_INCREMENT,
`id_pdrb` int(1) NOT NULL,
`kategori_pdrb` varchar(255) DEFAULT NULL,
`kode_kategori` varchar(10) DEFAULT NULL,
PRIMARY KEY (`id_kategori`)
) ENGINE=InnoDB AUTO_INCREMENT=24 DEFAULT CHARSET=latin1;
-- Dumping data for table bps1101_db_phenomenom.m_kategori_pdrb: ~23 rows (approximately)
/*!40000 ALTER TABLE `m_kategori_pdrb` DISABLE KEYS */;
INSERT INTO `m_kategori_pdrb` (`id_kategori`, `id_pdrb`, `kategori_pdrb`, `kode_kategori`) VALUES
(1, 1, 'Pertanian, Kehutanan dan Perikanan', 'A'),
(2, 1, 'Pertambangan dan Penggalian', 'B'),
(3, 1, 'Industri Pengolahan', 'C'),
(4, 1, 'Pengadaan Listrik dan Gas', 'D'),
(5, 1, 'Pengadaan Air, Pengelolaan Sampah, Limbah', 'E'),
(6, 1, 'Konstruksi', 'F'),
(7, 1, 'Perdagangan Besar dan Eceran; Reparasi Mobil dan Sepeda Motor', 'G'),
(8, 1, 'Transportasi dan Pergudangan', 'H'),
(9, 1, 'Penyediaan Akomodasi dan Makan Minum', 'I'),
(10, 1, 'Informasi dan Komunikasi', 'J'),
(11, 1, 'Jasa Keuangan dan Asuransi', 'K'),
(12, 1, 'Real Estate', 'L'),
(13, 1, 'Jasa Perusahaan', 'M,N'),
(14, 1, 'Administrasi Pemerintahan, Pertahanan dan Jaminan Sosial Wajib', 'O'),
(15, 1, 'Jasa Pendidikan', 'P'),
(16, 1, 'Jasa Kesehatan dan Kegiatan Sosial', 'Q'),
(17, 1, 'Jasa Lainnya', 'R,S,T,U'),
(18, 2, 'a. Konsumsi Rumah Tangga', 'a'),
(19, 2, 'b. Pengeluaran Konsumsi Lembaga Swasta Nirlaba', 'b'),
(20, 2, 'c. Pengeluaran Konsumsi Pemerintah', 'c'),
(21, 2, 'd. Pembentukan Modal Tetap Bruto', 'd'),
(22, 2, 'e. Perubahan Inventori', 'e'),
(23, 2, 'h. Net Ekspor Antar Daerah', 'h');
/*!40000 ALTER TABLE `m_kategori_pdrb` ENABLE KEYS */;
-- Dumping structure for table bps1101_db_phenomenom.m_pdrb
DROP TABLE IF EXISTS `m_pdrb`;
CREATE TABLE IF NOT EXISTS `m_pdrb` (
`id_pdrb` int(1) NOT NULL AUTO_INCREMENT,
`uraian_pdrb` varchar(50) DEFAULT NULL,
PRIMARY KEY (`id_pdrb`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1;
-- Dumping data for table bps1101_db_phenomenom.m_pdrb: ~2 rows (approximately)
/*!40000 ALTER TABLE `m_pdrb` DISABLE KEYS */;
INSERT INTO `m_pdrb` (`id_pdrb`, `uraian_pdrb`) VALUES
(1, 'PDRB Menurut Lapangan Usaha'),
(2, 'PDRB Menurut Pengeluaran');
/*!40000 ALTER TABLE `m_pdrb` ENABLE KEYS */;
-- Dumping structure for table bps1101_db_phenomenom.m_subkategori
DROP TABLE IF EXISTS `m_subkategori`;
CREATE TABLE IF NOT EXISTS `m_subkategori` (
`id_sub` int(2) NOT NULL AUTO_INCREMENT,
`id_pdrb` int(1) DEFAULT NULL,
`id_kategori` int(2) DEFAULT NULL,
`nama_sub` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id_sub`)
) ENGINE=InnoDB AUTO_INCREMENT=24 DEFAULT CHARSET=latin1;
-- Dumping data for table bps1101_db_phenomenom.m_subkategori: ~21 rows (approximately)
/*!40000 ALTER TABLE `m_subkategori` DISABLE KEYS */;
INSERT INTO `m_subkategori` (`id_sub`, `id_pdrb`, `id_kategori`, `nama_sub`) VALUES
(1, 1, 1, ' Pertanian, Peternakan, Perburuan dan Jasa Pertanian'),
(2, 1, 1, ' Kehutanan dan Penebangan Kayu'),
(3, 1, 1, 'Perikanan'),
(4, 1, 2, 'Pertambangan Minyak dan Gas Bumi'),
(5, 1, 2, 'Pertambangan Batubara dan Lignit'),
(6, 1, 2, 'Pertambangan Bijih Logam'),
(7, 1, 2, 'Pertambangan dan Penggalian Lainnya'),
(8, 2, 18, '1. Makanan dan Minuman Non Beralkohol'),
(9, 2, 18, '2. Minuman Beralkohol dan Rokok'),
(10, 2, 18, '3. Pakaian'),
(11, 2, 18, '4. Perumahan, Air, Listrik, Gas dan Bahan Bakar Lainnya'),
(12, 2, 18, '5. Perabot, Peralatan rumahtangga dan Pemeliharaan Rutin Rumah'),
(13, 2, 18, '6. Kesehatan'),
(14, 2, 18, '7. Transportasi/Angkutan'),
(15, 2, 18, '8. Komunikasi'),
(16, 2, 18, '9. Rekreasi dan Budaya'),
(17, 2, 18, '10. Pendidikan'),
(18, 2, 18, '11. Penginapan dan Hotel'),
(19, 2, 18, '12. Barang Pribadi dan Jasa Perorangan'),
(20, 2, 21, '1. Bangunan'),
(21, 2, 21, '2. Non Bangunan'),
(22, 2, 23, '1. Ekspor'),
(23, 2, 23, '2. Impor');
/*!40000 ALTER TABLE `m_subkategori` ENABLE KEYS */;
-- Dumping structure for table bps1101_db_phenomenom.m_tag
DROP TABLE IF EXISTS `m_tag`;
CREATE TABLE IF NOT EXISTS `m_tag` (
`id-tag` int(11) NOT NULL AUTO_INCREMENT,
`nama_tag` varchar(50) DEFAULT '0',
PRIMARY KEY (`id-tag`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='Daftar tag';
-- Dumping data for table bps1101_db_phenomenom.m_tag: ~0 rows (approximately)
/*!40000 ALTER TABLE `m_tag` DISABLE KEYS */;
/*!40000 ALTER TABLE `m_tag` ENABLE KEYS */;
-- Dumping structure for table bps1101_db_phenomenom.m_tahun
DROP TABLE IF EXISTS `m_tahun`;
CREATE TABLE IF NOT EXISTS `m_tahun` (
`id_tahun` int(11) NOT NULL AUTO_INCREMENT,
`tahun_data` year(4) DEFAULT NULL,
`is_active` int(1) DEFAULT NULL,
PRIMARY KEY (`id_tahun`)
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=latin1 COMMENT='Master Tahun';
-- Dumping data for table bps1101_db_phenomenom.m_tahun: ~8 rows (approximately)
/*!40000 ALTER TABLE `m_tahun` DISABLE KEYS */;
INSERT INTO `m_tahun` (`id_tahun`, `tahun_data`, `is_active`) VALUES
(1, '2010', 0),
(2, '2011', 0),
(3, '2012', 0),
(4, '2013', 0),
(5, '2014', 0),
(6, '2015', 1),
(7, '2016', 1),
(8, '2017', 1);
/*!40000 ALTER TABLE `m_tahun` ENABLE KEYS */;
-- Dumping structure for table bps1101_db_phenomenom.rekap_fenomena
DROP TABLE IF EXISTS `rekap_fenomena`;
CREATE TABLE IF NOT EXISTS `rekap_fenomena` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`tahun` year(4) DEFAULT NULL,
`triwulan` int(11) DEFAULT NULL,
`id_pdrb` int(11) DEFAULT NULL,
`id_kategori` int(11) DEFAULT NULL,
`id_subkategori` int(11) DEFAULT NULL,
`series` int(1) DEFAULT NULL COMMENT '1 ''q to q'' 2 ''y on y'' 3 ''laju implisit''',
`pertumbuhan` int(1) DEFAULT '1' COMMENT '0 ''turun'' 1''tetap'' 2 ''naik''',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=499 DEFAULT CHARSET=latin1 COMMENT='Tabel tabulasi daftar fenomena';
-- Dumping data for table bps1101_db_phenomenom.rekap_fenomena: ~498 rows (approximately)
/*!40000 ALTER TABLE `rekap_fenomena` DISABLE KEYS */;
INSERT INTO `rekap_fenomena` (`id`, `tahun`, `triwulan`, `id_pdrb`, `id_kategori`, `id_subkategori`, `series`, `pertumbuhan`) VALUES
(1, '2017', 1, 2, 18, 8, NULL, 1),
(2, '2017', 1, 2, 18, 9, NULL, 1),
(3, '2017', 1, 2, 18, 10, NULL, 1),
(4, '2017', 1, 2, 18, 11, NULL, 1),
(5, '2017', 1, 2, 18, 12, NULL, 1),
(6, '2017', 1, 2, 18, 13, NULL, 1),
(7, '2017', 1, 2, 18, 14, NULL, 1),
(8, '2017', 1, 2, 18, 15, NULL, 1),
(9, '2017', 1, 2, 18, 16, NULL, 1),
(10, '2017', 1, 2, 18, 17, NULL, 1),
(11, '2017', 1, 2, 18, 18, NULL, 1),
(12, '2017', 1, 2, 18, 19, NULL, 1),
(13, '2017', 1, 2, 21, 20, NULL, 1),
(14, '2017', 1, 2, 21, 21, NULL, 1),
(15, '2017', 1, 2, 23, 22, NULL, 1),
(16, '2017', 1, 2, 23, 23, NULL, 1),
(17, '2017', 1, 2, 18, NULL, NULL, 1),
(18, '2017', 1, 2, 19, NULL, NULL, 2),
(19, '2017', 1, 2, 20, NULL, NULL, 1),
(20, '2017', 1, 2, 21, NULL, NULL, 1),
(21, '2017', 1, 2, 22, NULL, NULL, 1),
(22, '2017', 1, 2, 23, NULL, NULL, 1),
(23, '2017', 2, 2, 18, 8, NULL, 1),
(24, '2017', 2, 2, 18, 9, NULL, 1),
(25, '2017', 2, 2, 18, 10, NULL, 1),
(26, '2017', 2, 2, 18, 11, NULL, 1),
(27, '2017', 2, 2, 18, 12, NULL, 1),
(28, '2017', 2, 2, 18, 13, NULL, 1),
(29, '2017', 2, 2, 18, 14, NULL, 1),
(30, '2017', 2, 2, 18, 15, NULL, 1),
(31, '2017', 2, 2, 18, 16, NULL, 1),
(32, '2017', 2, 2, 18, 17, NULL, 1),
(33, '2017', 2, 2, 18, 18, NULL, 1),
(34, '2017', 2, 2, 18, 19, NULL, 1),
(35, '2017', 2, 2, 21, 20, NULL, 1),
(36, '2017', 2, 2, 21, 21, NULL, 1),
(37, '2017', 2, 2, 23, 22, NULL, 1),
(38, '2017', 2, 2, 23, 23, NULL, 1),
(39, '2017', 2, 2, 18, NULL, NULL, 1),
(40, '2017', 2, 2, 19, NULL, NULL, 1),
(41, '2017', 2, 2, 20, NULL, NULL, 1),
(42, '2017', 2, 2, 21, NULL, NULL, 1),
(43, '2017', 2, 2, 22, NULL, NULL, 1),
(44, '2017', 2, 2, 23, NULL, NULL, 1),
(45, '2017', 2, 1, 1, 1, 3, 1),
(46, '2017', 2, 1, 1, 2, 3, 2),
(47, '2017', 2, 1, 1, 3, 3, 1),
(48, '2017', 2, 1, 2, 4, 3, 1),
(49, '2017', 2, 1, 2, 5, 3, 1),
(50, '2017', 2, 1, 2, 6, 3, 1),
(51, '2017', 2, 1, 2, 7, 3, 1),
(52, '2017', 2, 1, 1, NULL, 3, 1),
(53, '2017', 2, 1, 2, NULL, 3, 1),
(54, '2017', 2, 1, 3, NULL, 3, 1),
(55, '2017', 2, 1, 4, NULL, 3, 1),
(56, '2017', 2, 1, 5, NULL, 3, 1),
(57, '2017', 2, 1, 6, NULL, 3, 1),
(58, '2017', 2, 1, 7, NULL, 3, 1),
(59, '2017', 2, 1, 8, NULL, 3, 1),
(60, '2017', 2, 1, 9, NULL, 3, 1),
(61, '2017', 2, 1, 10, NULL, 3, 1),
(62, '2017', 2, 1, 11, NULL, 3, 1),
(63, '2017', 2, 1, 12, NULL, 3, 1),
(64, '2017', 2, 1, 13, NULL, 3, 1),
(65, '2017', 2, 1, 14, NULL, 3, 1),
(66, '2017', 2, 1, 15, NULL, 3, 1),
(67, '2017', 2, 1, 16, NULL, 3, 1),
(68, '2017', 2, 1, 17, NULL, 3, 1),
(69, '2017', 2, 1, 1, 1, 2, 1),
(70, '2017', 2, 1, 1, 2, 2, 1),
(71, '2017', 2, 1, 1, 3, 2, 1),
(72, '2017', 2, 1, 2, 4, 2, 1),
(73, '2017', 2, 1, 2, 5, 2, 1),
(74, '2017', 2, 1, 2, 6, 2, 1),
(75, '2017', 2, 1, 2, 7, 2, 1),
(76, '2017', 2, 1, 1, NULL, 2, 1),
(77, '2017', 2, 1, 2, NULL, 2, 1),
(78, '2017', 2, 1, 3, NULL, 2, 1),
(79, '2017', 2, 1, 4, NULL, 2, 1),
(80, '2017', 2, 1, 5, NULL, 2, 1),
(81, '2017', 2, 1, 6, NULL, 2, 1),
(82, '2017', 2, 1, 7, NULL, 2, 1),
(83, '2017', 2, 1, 8, NULL, 2, 1),
(84, '2017', 2, 1, 9, NULL, 2, 1),
(85, '2017', 2, 1, 10, NULL, 2, 1),
(86, '2017', 2, 1, 11, NULL, 2, 1),
(87, '2017', 2, 1, 12, NULL, 2, 1),
(88, '2017', 2, 1, 13, NULL, 2, 1),
(89, '2017', 2, 1, 14, NULL, 2, 1),
(90, '2017', 2, 1, 15, NULL, 2, 1),
(91, '2017', 2, 1, 16, NULL, 2, 1),
(92, '2017', 2, 1, 17, NULL, 2, 1),
(93, '2017', 2, 1, 1, 1, 1, 1),
(94, '2017', 2, 1, 1, 2, 1, 1),
(95, '2017', 2, 1, 1, 3, 1, 1),
(96, '2017', 2, 1, 2, 4, 1, 1),
(97, '2017', 2, 1, 2, 5, 1, 1),
(98, '2017', 2, 1, 2, 6, 1, 1),
(99, '2017', 2, 1, 2, 7, 1, 1),
(100, '2017', 2, 1, 1, NULL, 1, 1),
(101, '2017', 2, 1, 2, NULL, 1, 1),
(102, '2017', 2, 1, 3, NULL, 1, 1),
(103, '2017', 2, 1, 4, NULL, 1, 1),
(104, '2017', 2, 1, 5, NULL, 1, 1),
(105, '2017', 2, 1, 6, NULL, 1, 1),
(106, '2017', 2, 1, 7, NULL, 1, 1),
(107, '2017', 2, 1, 8, NULL, 1, 1),
(108, '2017', 2, 1, 9, NULL, 1, 1),
(109, '2017', 2, 1, 10, NULL, 1, 1),
(110, '2017', 2, 1, 11, NULL, 1, 1),
(111, '2017', 2, 1, 12, NULL, 1, 1),
(112, '2017', 2, 1, 13, NULL, 1, 1),
(113, '2017', 2, 1, 14, NULL, 1, 1),
(114, '2017', 2, 1, 15, NULL, 1, 1),
(115, '2017', 2, 1, 16, NULL, 1, 1),
(116, '2017', 2, 1, 17, NULL, 1, 1),
(117, '2017', 4, 1, 1, 1, 3, 1),
(118, '2017', 4, 1, 1, 2, 3, 1),
(119, '2017', 4, 1, 1, 3, 3, 1),
(120, '2017', 4, 1, 2, 4, 3, 1),
(121, '2017', 4, 1, 2, 5, 3, 1),
(122, '2017', 4, 1, 2, 6, 3, 1),
(123, '2017', 4, 1, 2, 7, 3, 1),
(124, '2017', 4, 1, 1, NULL, 3, 1),
(125, '2017', 4, 1, 2, NULL, 3, 1),
(126, '2017', 4, 1, 3, NULL, 3, 1),
(127, '2017', 4, 1, 4, NULL, 3, 1),
(128, '2017', 4, 1, 5, NULL, 3, 1),
(129, '2017', 4, 1, 6, NULL, 3, 1),
(130, '2017', 4, 1, 7, NULL, 3, 1),
(131, '2017', 4, 1, 8, NULL, 3, 1),
(132, '2017', 4, 1, 9, NULL, 3, 1),
(133, '2017', 4, 1, 10, NULL, 3, 1),
(134, '2017', 4, 1, 11, NULL, 3, 1),
(135, '2017', 4, 1, 12, NULL, 3, 1),
(136, '2017', 4, 1, 13, NULL, 3, 1),
(137, '2017', 4, 1, 14, NULL, 3, 1),
(138, '2017', 4, 1, 15, NULL, 3, 1),
(139, '2017', 4, 1, 16, NULL, 3, 1),
(140, '2017', 4, 1, 17, NULL, 3, 1),
(141, '2017', 4, 1, 1, 1, 2, 1),
(142, '2017', 4, 1, 1, 2, 2, 1),
(143, '2017', 4, 1, 1, 3, 2, 1),
(144, '2017', 4, 1, 2, 4, 2, 1),
(145, '2017', 4, 1, 2, 5, 2, 1),
(146, '2017', 4, 1, 2, 6, 2, 1),
(147, '2017', 4, 1, 2, 7, 2, 1),
(148, '2017', 4, 1, 1, NULL, 2, 1),
(149, '2017', 4, 1, 2, NULL, 2, 1),
(150, '2017', 4, 1, 3, NULL, 2, 1),
(151, '2017', 4, 1, 4, NULL, 2, 1),
(152, '2017', 4, 1, 5, NULL, 2, 1),
(153, '2017', 4, 1, 6, NULL, 2, 1),
(154, '2017', 4, 1, 7, NULL, 2, 1),
(155, '2017', 4, 1, 8, NULL, 2, 1),
(156, '2017', 4, 1, 9, NULL, 2, 1),
(157, '2017', 4, 1, 10, NULL, 2, 1),
(158, '2017', 4, 1, 11, NULL, 2, 1),
(159, '2017', 4, 1, 12, NULL, 2, 1),
(160, '2017', 4, 1, 13, NULL, 2, 1),
(161, '2017', 4, 1, 14, NULL, 2, 1),
(162, '2017', 4, 1, 15, NULL, 2, 1),
(163, '2017', 4, 1, 16, NULL, 2, 1),
(164, '2017', 4, 1, 17, NULL, 2, 1),
(165, '2017', 4, 1, 1, 1, 1, 1),
(166, '2017', 4, 1, 1, 2, 1, 1),
(167, '2017', 4, 1, 1, 3, 1, 1),
(168, '2017', 4, 1, 2, 4, 1, 1),
(169, '2017', 4, 1, 2, 5, 1, 1),
(170, '2017', 4, 1, 2, 6, 1, 1),
(171, '2017', 4, 1, 2, 7, 1, 1),
(172, '2017', 4, 1, 1, NULL, 1, 0),
(173, '2017', 4, 1, 2, NULL, 1, 1),
(174, '2017', 4, 1, 3, NULL, 1, 1),
(175, '2017', 4, 1, 4, NULL, 1, 1),
(176, '2017', 4, 1, 5, NULL, 1, 1),
(177, '2017', 4, 1, 6, NULL, 1, 1),
(178, '2017', 4, 1, 7, NULL, 1, 1),
(179, '2017', 4, 1, 8, NULL, 1, 1),
(180, '2017', 4, 1, 9, NULL, 1, 1),
(181, '2017', 4, 1, 10, NULL, 1, 1),
(182, '2017', 4, 1, 11, NULL, 1, 1),
(183, '2017', 4, 1, 12, NULL, 1, 1),
(184, '2017', 4, 1, 13, NULL, 1, 1),
(185, '2017', 4, 1, 14, NULL, 1, 1),
(186, '2017', 4, 1, 15, NULL, 1, 1),
(187, '2017', 4, 1, 16, NULL, 1, 1),
(188, '2017', 4, 1, 17, NULL, 1, 1),
(189, '2017', 1, 1, 1, 1, 3, 1),
(190, '2017', 1, 1, 1, 2, 3, 1),
(191, '2017', 1, 1, 1, 3, 3, 1),
(192, '2017', 1, 1, 2, 4, 3, 1),
(193, '2017', 1, 1, 2, 5, 3, 1),
(194, '2017', 1, 1, 2, 6, 3, 1),
(195, '2017', 1, 1, 2, 7, 3, 1),
(196, '2017', 1, 1, 1, NULL, 3, 1),
(197, '2017', 1, 1, 2, NULL, 3, 1),
(198, '2017', 1, 1, 3, NULL, 3, 0),
(199, '2017', 1, 1, 4, NULL, 3, 1),
(200, '2017', 1, 1, 5, NULL, 3, 1),
(201, '2017', 1, 1, 6, NULL, 3, 1),
(202, '2017', 1, 1, 7, NULL, 3, 1),
(203, '2017', 1, 1, 8, NULL, 3, 1),
(204, '2017', 1, 1, 9, NULL, 3, 1),
(205, '2017', 1, 1, 10, NULL, 3, 1),
(206, '2017', 1, 1, 11, NULL, 3, 1),
(207, '2017', 1, 1, 12, NULL, 3, 1),
(208, '2017', 1, 1, 13, NULL, 3, 1),
(209, '2017', 1, 1, 14, NULL, 3, 1),
(210, '2017', 1, 1, 15, NULL, 3, 1),
(211, '2017', 1, 1, 16, NULL, 3, 1),
(212, '2017', 1, 1, 17, NULL, 3, 1),
(213, '2017', 1, 1, 1, 1, 2, 1),
(214, '2017', 1, 1, 1, 2, 2, 1),
(215, '2017', 1, 1, 1, 3, 2, 1),
(216, '2017', 1, 1, 2, 4, 2, 1),
(217, '2017', 1, 1, 2, 5, 2, 1),
(218, '2017', 1, 1, 2, 6, 2, 1),
(219, '2017', 1, 1, 2, 7, 2, 1),
(220, '2017', 1, 1, 1, NULL, 2, 1),
(221, '2017', 1, 1, 2, NULL, 2, 1),
(222, '2017', 1, 1, 3, NULL, 2, 1),
(223, '2017', 1, 1, 4, NULL, 2, 1),
(224, '2017', 1, 1, 5, NULL, 2, 1),
(225, '2017', 1, 1, 6, NULL, 2, 1),
(226, '2017', 1, 1, 7, NULL, 2, 1),
(227, '2017', 1, 1, 8, NULL, 2, 1),
(228, '2017', 1, 1, 9, NULL, 2, 1),
(229, '2017', 1, 1, 10, NULL, 2, 1),
(230, '2017', 1, 1, 11, NULL, 2, 1),
(231, '2017', 1, 1, 12, NULL, 2, 1),
(232, '2017', 1, 1, 13, NULL, 2, 1),
(233, '2017', 1, 1, 14, NULL, 2, 1),
(234, '2017', 1, 1, 15, NULL, 2, 1),
(235, '2017', 1, 1, 16, NULL, 2, 1),
(236, '2017', 1, 1, 17, NULL, 2, 1),
(237, '2017', 1, 1, 1, 1, 1, 1),
(238, '2017', 1, 1, 1, 2, 1, 1),
(239, '2017', 1, 1, 1, 3, 1, 1),
(240, '2017', 1, 1, 2, 4, 1, 1),
(241, '2017', 1, 1, 2, 5, 1, 1),
(242, '2017', 1, 1, 2, 6, 1, 1),
(243, '2017', 1, 1, 2, 7, 1, 1),
(244, '2017', 1, 1, 1, NULL, 1, 1),
(245, '2017', 1, 1, 2, NULL, 1, 1),
(246, '2017', 1, 1, 3, NULL, 1, 1),
(247, '2017', 1, 1, 4, NULL, 1, 1),
(248, '2017', 1, 1, 5, NULL, 1, 1),
(249, '2017', 1, 1, 6, NULL, 1, 1),
(250, '2017', 1, 1, 7, NULL, 1, 1),
(251, '2017', 1, 1, 8, NULL, 1, 1),
(252, '2017', 1, 1, 9, NULL, 1, 1),
(253, '2017', 1, 1, 10, NULL, 1, 1),
(254, '2017', 1, 1, 11, NULL, 1, 1),
(255, '2017', 1, 1, 12, NULL, 1, 1),
(256, '2017', 1, 1, 13, NULL, 1, 1),
(257, '2017', 1, 1, 14, NULL, 1, 1),
(258, '2017', 1, 1, 15, NULL, 1, 1),
(259, '2017', 1, 1, 16, NULL, 1, 1),
(260, '2017', 1, 1, 17, NULL, 1, 1),
(261, '2017', 3, 1, 1, 1, 3, 1),
(262, '2017', 3, 1, 1, 2, 3, 1),
(263, '2017', 3, 1, 1, 3, 3, 1),
(264, '2017', 3, 1, 2, 4, 3, 1),
(265, '2017', 3, 1, 2, 5, 3, 1),
(266, '2017', 3, 1, 2, 6, 3, 1),
(267, '2017', 3, 1, 2, 7, 3, 1),
(268, '2017', 3, 1, 1, NULL, 3, 1),
(269, '2017', 3, 1, 2, NULL, 3, 1),
(270, '2017', 3, 1, 3, NULL, 3, 1),
(271, '2017', 3, 1, 4, NULL, 3, 1),
(272, '2017', 3, 1, 5, NULL, 3, 1),
(273, '2017', 3, 1, 6, NULL, 3, 1),
(274, '2017', 3, 1, 7, NULL, 3, 1),
(275, '2017', 3, 1, 8, NULL, 3, 1),
(276, '2017', 3, 1, 9, NULL, 3, 1),
(277, '2017', 3, 1, 10, NULL, 3, 1),
(278, '2017', 3, 1, 11, NULL, 3, 1),
(279, '2017', 3, 1, 12, NULL, 3, 1),
(280, '2017', 3, 1, 13, NULL, 3, 1),
(281, '2017', 3, 1, 14, NULL, 3, 1),
(282, '2017', 3, 1, 15, NULL, 3, 1),
(283, '2017', 3, 1, 16, NULL, 3, 1),
(284, '2017', 3, 1, 17, NULL, 3, 1),
(285, '2017', 3, 1, 1, 1, 2, 1),
(286, '2017', 3, 1, 1, 2, 2, 1),
(287, '2017', 3, 1, 1, 3, 2, 1),
(288, '2017', 3, 1, 2, 4, 2, 1),
(289, '2017', 3, 1, 2, 5, 2, 1),
(290, '2017', 3, 1, 2, 6, 2, 1),
(291, '2017', 3, 1, 2, 7, 2, 1),
(292, '2017', 3, 1, 1, NULL, 2, 1),
(293, '2017', 3, 1, 2, NULL, 2, 1),
(294, '2017', 3, 1, 3, NULL, 2, 1),
(295, '2017', 3, 1, 4, NULL, 2, 1),
(296, '2017', 3, 1, 5, NULL, 2, 1),
(297, '2017', 3, 1, 6, NULL, 2, 1),
(298, '2017', 3, 1, 7, NULL, 2, 1),
(299, '2017', 3, 1, 8, NULL, 2, 1),
(300, '2017', 3, 1, 9, NULL, 2, 1),
(301, '2017', 3, 1, 10, NULL, 2, 1),
(302, '2017', 3, 1, 11, NULL, 2, 1),
(303, '2017', 3, 1, 12, NULL, 2, 1),
(304, '2017', 3, 1, 13, NULL, 2, 1),
(305, '2017', 3, 1, 14, NULL, 2, 1),
(306, '2017', 3, 1, 15, NULL, 2, 1),
(307, '2017', 3, 1, 16, NULL, 2, 1),
(308, '2017', 3, 1, 17, NULL, 2, 1),
(309, '2017', 3, 1, 1, 1, 1, 1),
(310, '2017', 3, 1, 1, 2, 1, 1),
(311, '2017', 3, 1, 1, 3, 1, 1),
(312, '2017', 3, 1, 2, 4, 1, 1),
(313, '2017', 3, 1, 2, 5, 1, 1),
(314, '2017', 3, 1, 2, 6, 1, 1),
(315, '2017', 3, 1, 2, 7, 1, 1),
(316, '2017', 3, 1, 1, NULL, 1, 1),
(317, '2017', 3, 1, 2, NULL, 1, 1),
(318, '2017', 3, 1, 3, NULL, 1, 1),
(319, '2017', 3, 1, 4, NULL, 1, 1),
(320, '2017', 3, 1, 5, NULL, 1, 1),
(321, '2017', 3, 1, 6, NULL, 1, 1),
(322, '2017', 3, 1, 7, NULL, 1, 1),
(323, '2017', 3, 1, 8, NULL, 1, 1),
(324, '2017', 3, 1, 9, NULL, 1, 1),
(325, '2017', 3, 1, 10, NULL, 1, 1),
(326, '2017', 3, 1, 11, NULL, 1, 1),
(327, '2017', 3, 1, 12, NULL, 1, 1),
(328, '2017', 3, 1, 13, NULL, 1, 1),
(329, '2017', 3, 1, 14, NULL, 1, 1),
(330, '2017', 3, 1, 15, NULL, 1, 1),
(331, '2017', 3, 1, 16, NULL, 1, 1),
(332, '2017', 3, 1, 17, NULL, 1, 1),
(333, '2015', 1, 1, 1, 1, 3, 1),
(334, '2015', 1, 1, 1, 2, 3, 1),
(335, '2015', 1, 1, 1, 3, 3, 1),
(336, '2015', 1, 1, 2, 4, 3, 1),
(337, '2015', 1, 1, 2, 5, 3, 1),
(338, '2015', 1, 1, 2, 6, 3, 1),
(339, '2015', 1, 1, 2, 7, 3, 1),
(340, '2015', 1, 1, 1, NULL, 3, 1),
(341, '2015', 1, 1, 2, NULL, 3, 1),
(342, '2015', 1, 1, 3, NULL, 3, 1),
(343, '2015', 1, 1, 4, NULL, 3, 1),
(344, '2015', 1, 1, 5, NULL, 3, 1),
(345, '2015', 1, 1, 6, NULL, 3, 1),
(346, '2015', 1, 1, 7, NULL, 3, 1),
(347, '2015', 1, 1, 8, NULL, 3, 1),
(348, '2015', 1, 1, 9, NULL, 3, 1),
(349, '2015', 1, 1, 10, NULL, 3, 1),
(350, '2015', 1, 1, 11, NULL, 3, 1),
(351, '2015', 1, 1, 12, NULL, 3, 1),
(352, '2015', 1, 1, 13, NULL, 3, 1),
(353, '2015', 1, 1, 14, NULL, 3, 1),
(354, '2015', 1, 1, 15, NULL, 3, 1),
(355, '2015', 1, 1, 16, NULL, 3, 1),
(356, '2015', 1, 1, 17, NULL, 3, 1),
(357, '2015', 1, 1, 1, 1, 2, 1),
(358, '2015', 1, 1, 1, 2, 2, 1),
(359, '2015', 1, 1, 1, 3, 2, 1),
(360, '2015', 1, 1, 2, 4, 2, 1),
(361, '2015', 1, 1, 2, 5, 2, 1),
(362, '2015', 1, 1, 2, 6, 2, 1),
(363, '2015', 1, 1, 2, 7, 2, 1),
(364, '2015', 1, 1, 1, NULL, 2, 1),
(365, '2015', 1, 1, 2, NULL, 2, 1),
(366, '2015', 1, 1, 3, NULL, 2, 1),
(367, '2015', 1, 1, 4, NULL, 2, 1),
(368, '2015', 1, 1, 5, NULL, 2, 1),
(369, '2015', 1, 1, 6, NULL, 2, 1),
(370, '2015', 1, 1, 7, NULL, 2, 1),
(371, '2015', 1, 1, 8, NULL, 2, 1),
(372, '2015', 1, 1, 9, NULL, 2, 1),
(373, '2015', 1, 1, 10, NULL, 2, 1),
(374, '2015', 1, 1, 11, NULL, 2, 1),
(375, '2015', 1, 1, 12, NULL, 2, 1),
(376, '2015', 1, 1, 13, NULL, 2, 1),
(377, '2015', 1, 1, 14, NULL, 2, 1),
(378, '2015', 1, 1, 15, NULL, 2, 1),
(379, '2015', 1, 1, 16, NULL, 2, 1),
(380, '2015', 1, 1, 17, NULL, 2, 1),
(381, '2015', 1, 1, 1, 1, 1, 1),
(382, '2015', 1, 1, 1, 2, 1, 1),
(383, '2015', 1, 1, 1, 3, 1, 1),
(384, '2015', 1, 1, 2, 4, 1, 1),
(385, '2015', 1, 1, 2, 5, 1, 1),
(386, '2015', 1, 1, 2, 6, 1, 1),
(387, '2015', 1, 1, 2, 7, 1, 1),
(388, '2015', 1, 1, 1, NULL, 1, 0),
(389, '2015', 1, 1, 2, NULL, 1, 1),
(390, '2015', 1, 1, 3, NULL, 1, 1),
(391, '2015', 1, 1, 4, NULL, 1, 1),
(392, '2015', 1, 1, 5, NULL, 1, 1),
(393, '2015', 1, 1, 6, NULL, 1, 1),
(394, '2015', 1, 1, 7, NULL, 1, 1),
(395, '2015', 1, 1, 8, NULL, 1, 1),
(396, '2015', 1, 1, 9, NULL, 1, 1),
(397, '2015', 1, 1, 10, NULL, 1, 1),
(398, '2015', 1, 1, 11, NULL, 1, 1),
(399, '2015', 1, 1, 12, NULL, 1, 1),
(400, '2015', 1, 1, 13, NULL, 1, 1),
(401, '2015', 1, 1, 14, NULL, 1, 1),
(402, '2015', 1, 1, 15, NULL, 1, 1),
(403, '2015', 1, 1, 16, NULL, 1, 1),
(404, '2015', 1, 1, 17, NULL, 1, 1),
(405, '2017', 4, 2, 18, 8, NULL, 1),
(406, '2017', 4, 2, 18, 9, NULL, 1),
(407, '2017', 4, 2, 18, 10, NULL, 1),
(408, '2017', 4, 2, 18, 11, NULL, 1),
(409, '2017', 4, 2, 18, 12, NULL, 1),
(410, '2017', 4, 2, 18, 13, NULL, 1),
(411, '2017', 4, 2, 18, 14, NULL, 1),
(412, '2017', 4, 2, 18, 15, NULL, 1),
(413, '2017', 4, 2, 18, 16, NULL, 1),
(414, '2017', 4, 2, 18, 17, NULL, 1),
(415, '2017', 4, 2, 18, 18, NULL, 1),
(416, '2017', 4, 2, 18, 19, NULL, 1),
(417, '2017', 4, 2, 21, 20, NULL, 1),
(418, '2017', 4, 2, 21, 21, NULL, 1),
(419, '2017', 4, 2, 23, 22, NULL, 1),
(420, '2017', 4, 2, 23, 23, NULL, 1),
(421, '2017', 4, 2, 18, NULL, NULL, 1),
(422, '2017', 4, 2, 19, NULL, NULL, 1),
(423, '2017', 4, 2, 20, NULL, NULL, 1),
(424, '2017', 4, 2, 21, NULL, NULL, 1),
(425, '2017', 4, 2, 22, NULL, NULL, 1),
(426, '2017', 4, 2, 23, NULL, NULL, 1),
(427, '2016', 2, 1, 1, 1, 3, 1),
(428, '2016', 2, 1, 1, 2, 3, 1),
(429, '2016', 2, 1, 1, 3, 3, 1),
(430, '2016', 2, 1, 2, 4, 3, 1),
(431, '2016', 2, 1, 2, 5, 3, 1),
(432, '2016', 2, 1, 2, 6, 3, 1),
(433, '2016', 2, 1, 2, 7, 3, 1),
(434, '2016', 2, 1, 1, NULL, 3, 1),
(435, '2016', 2, 1, 2, NULL, 3, 1),
(436, '2016', 2, 1, 3, NULL, 3, 1),
(437, '2016', 2, 1, 4, NULL, 3, 1),
(438, '2016', 2, 1, 5, NULL, 3, 1),
(439, '2016', 2, 1, 6, NULL, 3, 1),
(440, '2016', 2, 1, 7, NULL, 3, 1),
(441, '2016', 2, 1, 8, NULL, 3, 1),
(442, '2016', 2, 1, 9, NULL, 3, 1),
(443, '2016', 2, 1, 10, NULL, 3, 1),
(444, '2016', 2, 1, 11, NULL, 3, 1),
(445, '2016', 2, 1, 12, NULL, 3, 1),
(446, '2016', 2, 1, 13, NULL, 3, 1),
(447, '2016', 2, 1, 14, NULL, 3, 1),
(448, '2016', 2, 1, 15, NULL, 3, 1),
(449, '2016', 2, 1, 16, NULL, 3, 1),
(450, '2016', 2, 1, 17, NULL, 3, 1),
(451, '2016', 2, 1, 1, 1, 2, 1),
(452, '2016', 2, 1, 1, 2, 2, 1),
(453, '2016', 2, 1, 1, 3, 2, 1),
(454, '2016', 2, 1, 2, 4, 2, 1),
(455, '2016', 2, 1, 2, 5, 2, 1),
(456, '2016', 2, 1, 2, 6, 2, 1),
(457, '2016', 2, 1, 2, 7, 2, 1),
(458, '2016', 2, 1, 1, NULL, 2, 1),
(459, '2016', 2, 1, 2, NULL, 2, 1),
(460, '2016', 2, 1, 3, NULL, 2, 1),
(461, '2016', 2, 1, 4, NULL, 2, 1),
(462, '2016', 2, 1, 5, NULL, 2, 1),
(463, '2016', 2, 1, 6, NULL, 2, 1),
(464, '2016', 2, 1, 7, NULL, 2, 1),
(465, '2016', 2, 1, 8, NULL, 2, 1),
(466, '2016', 2, 1, 9, NULL, 2, 1),
(467, '2016', 2, 1, 10, NULL, 2, 1),
(468, '2016', 2, 1, 11, NULL, 2, 1),
(469, '2016', 2, 1, 12, NULL, 2, 1),
(470, '2016', 2, 1, 13, NULL, 2, 1),
(471, '2016', 2, 1, 14, NULL, 2, 1),
(472, '2016', 2, 1, 15, NULL, 2, 1),
(473, '2016', 2, 1, 16, NULL, 2, 1),
(474, '2016', 2, 1, 17, NULL, 2, 1),
(475, '2016', 2, 1, 1, 1, 1, 1),
(476, '2016', 2, 1, 1, 2, 1, 1),
(477, '2016', 2, 1, 1, 3, 1, 1),
(478, '2016', 2, 1, 2, 4, 1, 1),
(479, '2016', 2, 1, 2, 5, 1, 1),
(480, '2016', 2, 1, 2, 6, 1, 1),
(481, '2016', 2, 1, 2, 7, 1, 1),
(482, '2016', 2, 1, 1, NULL, 1, 1),
(483, '2016', 2, 1, 2, NULL, 1, 1),
(484, '2016', 2, 1, 3, NULL, 1, 1),
(485, '2016', 2, 1, 4, NULL, 1, 1),
(486, '2016', 2, 1, 5, NULL, 1, 1),
(487, '2016', 2, 1, 6, NULL, 1, 1),
(488, '2016', 2, 1, 7, NULL, 1, 1),
(489, '2016', 2, 1, 8, NULL, 1, 1),
(490, '2016', 2, 1, 9, NULL, 1, 1),
(491, '2016', 2, 1, 10, NULL, 1, 1),
(492, '2016', 2, 1, 11, NULL, 1, 1),
(493, '2016', 2, 1, 12, NULL, 1, 1),
(494, '2016', 2, 1, 13, NULL, 1, 1),
(495, '2016', 2, 1, 14, NULL, 1, 1),
(496, '2016', 2, 1, 15, NULL, 1, 1),
(497, '2016', 2, 1, 16, NULL, 1, 1),
(498, '2016', 2, 1, 17, NULL, 1, 1);
/*!40000 ALTER TABLE `rekap_fenomena` ENABLE KEYS */;
-- Dumping structure for table bps1101_db_phenomenom.route
DROP TABLE IF EXISTS `route`;
CREATE TABLE IF NOT EXISTS `route` (
`name` varchar(64) COLLATE utf8_unicode_ci NOT NULL,
`alias` varchar(64) COLLATE utf8_unicode_ci NOT NULL,
`type` varchar(64) COLLATE utf8_unicode_ci NOT NULL,
`status` smallint(6) NOT NULL DEFAULT '1',
PRIMARY KEY (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- Dumping data for table bps1101_db_phenomenom.route: ~69 rows (approximately)
/*!40000 ALTER TABLE `route` DISABLE KEYS */;
INSERT INTO `route` (`name`, `alias`, `type`, `status`) VALUES
('/*', '*', '', 1),
('/fenomena/*', '*', 'fenomena', 1),
('/fenomena/create', 'create', 'fenomena', 1),
('/fenomena/delete', 'delete', 'fenomena', 1),
('/fenomena/index', 'index', 'fenomena', 1),
('/fenomena/update', 'update', 'fenomena', 1),
('/fenomena/upload', 'upload', 'fenomena', 1),
('/fenomena/verifikasi', 'verifikasi', 'fenomena', 1),
('/fenomena/view', 'view', 'fenomena', 1),
('/m-kategori-pdrb/*', '*', 'm-kategori-pdrb', 1),
('/m-kategori-pdrb/create', 'create', 'm-kategori-pdrb', 1),
('/m-kategori-pdrb/delete', 'delete', 'm-kategori-pdrb', 1),
('/m-kategori-pdrb/index', 'index', 'm-kategori-pdrb', 1),
('/m-kategori-pdrb/update', 'update', 'm-kategori-pdrb', 1),
('/m-kategori-pdrb/view', 'view', 'm-kategori-pdrb', 1),
('/m-pdrb/*', '*', 'm-pdrb', 1),
('/m-pdrb/create', 'create', 'm-pdrb', 1),
('/m-pdrb/delete', 'delete', 'm-pdrb', 1),
('/m-pdrb/index', 'index', 'm-pdrb', 1),
('/m-pdrb/update', 'update', 'm-pdrb', 1),
('/m-pdrb/view', 'view', 'm-pdrb', 1),
('/m-subkategori/*', '*', 'm-subkategori', 1),
('/m-subkategori/create', 'create', 'm-subkategori', 1),
('/m-subkategori/delete', 'delete', 'm-subkategori', 1),
('/m-subkategori/index', 'index', 'm-subkategori', 1),
('/m-subkategori/update', 'update', 'm-subkategori', 1),
('/m-subkategori/view', 'view', 'm-subkategori', 1),
('/mimin/*', '*', 'mimin', 1),
('/mimin/role/*', '*', 'mimin/role', 1),
('/mimin/role/create', 'create', 'mimin/role', 1),
('/mimin/role/delete', 'delete', 'mimin/role', 1),
('/mimin/role/index', 'index', 'mimin/role', 1),
('/mimin/role/permission', 'permission', 'mimin/role', 1),
('/mimin/role/update', 'update', 'mimin/role', 1),
('/mimin/role/view', 'view', 'mimin/role', 1),
('/mimin/route/*', '*', 'mimin/route', 1),
('/mimin/route/create', 'create', 'mimin/route', 1),
('/mimin/route/delete', 'delete', 'mimin/route', 1),
('/mimin/route/generate', 'generate', 'mimin/route', 1),
('/mimin/route/index', 'index', 'mimin/route', 1),
('/mimin/route/update', 'update', 'mimin/route', 1),
('/mimin/route/view', 'view', 'mimin/route', 1),
('/mimin/user/*', '*', 'mimin/user', 1),
('/mimin/user/create', 'create', 'mimin/user', 1),
('/mimin/user/delete', 'delete', 'mimin/user', 1),
('/mimin/user/index', 'index', 'mimin/user', 1),
('/mimin/user/update', 'update', 'mimin/user', 1),
('/mimin/user/view', 'view', 'mimin/user', 1),
('/rekap-fenomena/*', '*', 'rekap-fenomena', 1),
('/rekap-fenomena/create', 'create', 'rekap-fenomena', 1),
('/rekap-fenomena/delete', 'delete', 'rekap-fenomena', 1),
('/rekap-fenomena/index', 'index', 'rekap-fenomena', 1),
('/rekap-fenomena/tabulasi', 'tabulasi', 'rekap-fenomena', 1),
('/rekap-fenomena/update', 'update', 'rekap-fenomena', 1),
('/rekap-fenomena/view', 'view', 'rekap-fenomena', 1),
('/site/*', '*', 'site', 1),
('/site/about', 'about', 'site', 1),
('/site/captcha', 'captcha', 'site', 1),
('/site/contact', 'contact', 'site', 1),
('/site/error', 'error', 'site', 1),
('/site/index', 'index', 'site', 1),
('/site/login', 'login', 'site', 1),
('/site/logout', 'logout', 'site', 1),
('/site/signup', 'signup', 'site', 1),
('/user-profil/*', '*', 'user-profil', 1),
('/user-profil/create', 'create', 'user-profil', 1),
('/user-profil/delete', 'delete', 'user-profil', 1),
('/user-profil/index', 'index', 'user-profil', 1),
('/user-profil/update', 'update', 'user-profil', 1),
('/user-profil/view', 'view', 'user-profil', 1);
/*!40000 ALTER TABLE `route` ENABLE KEYS */;
-- Dumping structure for table bps1101_db_phenomenom.t_fenomena
DROP TABLE IF EXISTS `t_fenomena`;
CREATE TABLE IF NOT EXISTS `t_fenomena` (
`id_fenomena` int(11) NOT NULL AUTO_INCREMENT,
`date_created` date DEFAULT NULL,
`author` int(11) DEFAULT NULL,
`judul` varchar(255) DEFAULT NULL,
`summary` text,
`berkas` varchar(255) DEFAULT NULL,
`tag` varchar(255) DEFAULT NULL,
`is_verified` int(1) DEFAULT NULL,
`date_verified` date DEFAULT NULL,
`judul_rev` varchar(255) DEFAULT NULL,
`summary_rev` text,
`triwulan` int(1) DEFAULT NULL,
`tahun` year(4) DEFAULT NULL,
`id_pdrb` int(1) DEFAULT NULL,
`id_kategori_pdrb` int(2) DEFAULT NULL,
`id_subkategori` int(2) DEFAULT NULL,
PRIMARY KEY (`id_fenomena`)
) ENGINE=InnoDB AUTO_INCREMENT=72 DEFAULT CHARSET=latin1 COMMENT='Tabel transaksi daftar fenomena';
-- Dumping data for table bps1101_db_phenomenom.t_fenomena: ~2 rows (approximately)
/*!40000 ALTER TABLE `t_fenomena` DISABLE KEYS */;
INSERT INTO `t_fenomena` (`id_fenomena`, `date_created`, `author`, `judul`, `summary`, `berkas`, `tag`, `is_verified`, `date_verified`, `judul_rev`, `summary_rev`, `triwulan`, `tahun`, `id_pdrb`, `id_kategori_pdrb`, `id_subkategori`) VALUES
(69, '2017-04-18', 1, 'Output Pertanian naik', '<p><i>sumber data: SIMTP pada triwulan 1 tahun 2017</i></p><hr><p><i>Isi Terjadi peningkatan luas panen pada triwulan 1 tahun 2017 dibanding triwulan 4 tahun 2016</i></p>', NULL, 'padi', 1, '2017-04-25', 'Output Pertanian naik', '<p><i>sumber data: SIMTP pada triwulan 1 tahun 2017</i></p><hr><p><i>Isi Terjadi peningkatan luas panen pada triwulan 1 tahun 2017 dibanding triwulan 4 tahun 2016</i></p>', 1, '2017', 1, 1, 1),
(70, '2017-04-18', 1, 'konsumsi LNPRT naik', '<p><i>sumber data: SKLNPRT</i></p><hr><p><i>Isi Pemilihan Kepala Daerah pada triwulan 1 tahun 2017 meningkatkan konsumsi komponen LNPRT</i></p>', NULL, 'LNPRT', 1, '2017-05-25', 'konsumsi LNPRT naik', '<p><i>sumber data: SKLNPRT</i></p><hr><p><i>Isi Pemilihan Kepala Daerah pada triwulan 1 tahun 2017 meningkatkan konsumsi komponen LNPRT</i></p>', 1, '2017', 2, 19, NULL),
(71, '2017-05-07', 4, 'PDAM mengalami permasalahan ', '<p><i>sumber data: Pengamatan Langsung</i></p><hr><p><i>PDAM menunggak listrik</i></p>', NULL, '', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
/*!40000 ALTER TABLE `t_fenomena` ENABLE KEYS */;
-- Dumping structure for table bps1101_db_phenomenom.user
DROP TABLE IF EXISTS `user`;
CREATE TABLE IF NOT EXISTS `user` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`username` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`auth_key` varchar(32) COLLATE utf8_unicode_ci DEFAULT NULL,
`password_hash` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`password_reset_token` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
`email` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`status` smallint(6) NOT NULL DEFAULT '10',
`created_at` int(11) NOT NULL,
`updated_at` int(11) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `username` (`username`),
UNIQUE KEY `email` (`email`),
UNIQUE KEY `password_reset_token` (`password_reset_token`)
) ENGINE=InnoDB AUTO_INCREMENT=20 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- Dumping data for table bps1101_db_phenomenom.user: ~3 rows (approximately)
/*!40000 ALTER TABLE `user` DISABLE KEYS */;
INSERT INTO `user` (`id`, `username`, `auth_key`, `password_hash`, `password_reset_token`, `email`, `status`, `created_at`, `updated_at`) VALUES
(1, 'admin', 'UOGugWr4naCBl2ohBh6no9SEL8sFZ3Ky', '$2y$13$GRFIuqhdONnOvZfSSUUblOHR0Qukm6q0c8W/WMsQulVgSc4XD2ZBC', NULL, 'bps1101@bps.go.id', 10, 1492858761, 1492865897),
(4, 'roufiq', 'qmS1J0p5x6sB9jHTNZ9Z3a4M6kKDj5k_', '$2y$13$aAa/QuD67i0n2OBmX1v1hO46aQN9XECHPzfEHxaDvG3T5BE5SYOKC', NULL, 'roufiq@bps.go.id', 10, 1492859191, 1492969065),
(11, 'djamal', 'LzkB8yv2al4kZL0Bfafrjjx-i4zUAfzY', '$2y$13$/.MIE8OnqIzzOHyR3Hgnj.ojcS7s2TavlcnadULz492qznkIfz7bm', NULL, 'keboy@mail.com', 10, 1493134082, 1493190579),
(19, 'andi', 'QcKRNyZY0S_hWw_Hd6XJwigm-cE9vuLu', '$2y$13$Lwslcu1DqniEVT53mUDaK.sVTaP/ZQN2JjuGoOhH1nCNggGgehhNu', NULL, 'andi@bps.go.id', 10, 1493300466, 1493790602);
/*!40000 ALTER TABLE `user` ENABLE KEYS */;
-- Dumping structure for table bps1101_db_phenomenom.user_profil
DROP TABLE IF EXISTS `user_profil`;
CREATE TABLE IF NOT EXISTS `user_profil` (
`nip` varchar(50) NOT NULL,
`nama` varchar(255) DEFAULT NULL,
`jabatan` varchar(255) DEFAULT NULL,
`username` varchar(50) DEFAULT NULL,
`photo` varchar(255) DEFAULT NULL,
PRIMARY KEY (`nip`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='Profil Detail User ';
-- Dumping data for table bps1101_db_phenomenom.user_profil: ~3 rows (approximately)
/*!40000 ALTER TABLE `user_profil` DISABLE KEYS */;
INSERT INTO `user_profil` (`nip`, `nama`, `jabatan`, `username`, `photo`) VALUES
('1234567890', 'Administrator', 'Admin', 'admin', 'admin1.jpg'),
('197605281999011001', 'Andi Hardiyanto', 'Kepala BPS Kabupaten Simeulue', 'andi', 'KaQDSsu7T4nCdSD4Q7LgaSYSn5qgfkP3.jpg'),
('199103182013111001', 'Moh. Roufiq Azmy', 'Staf Seksi IPDS', 'roufiq', '08.5726_MOH.jpg'),
('9823789173981739837983', 'Djamaluddin', 'Seksi Sosial', 'djamal', 'Ng-64zxXiFhQWRxY8iSRuJeLqDy1nyOh.jpg');
/*!40000 ALTER TABLE `user_profil` 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 |
7dd6e0e6998006d90e2fad5229bde5dfa7f9871a
|
SQL
|
kiriakivel/SpellCheckProject
|
/Greekwords.sql
|
UTF-8
| 2,845 | 4.6875 | 5 |
[] |
no_license
|
/*dictionary is a schema created in the schemas section..
----- create schema `dictionary` default CHAR SET utf8; ----*/
use dictionary;
DROP table IF EXISTS `greekwords`;
CREATE TABLE greekwords (
id int auto_increment,
words varchar(27) NOT NULL,
length int,
PRIMARY KEY (id)
);
/* drop index WordIndex ON GreekWords; */
LOAD DATA LOCAL INFILE 'C:/Users/georg/Desktop/Working Dictionaries/greekdictionary.txt' INTO TABLE greekwords
CHARACTER SET utf8
FIELDS TERMINATED BY '\t'
LINES TERMINATED BY '\n'(words, length);
CREATE INDEX WordIndex ON GreekWords (length,words);
/*procedure existsindictionary searches the dictionary in
order to check the spelling of the word given when called,
and returns the id of the given word*/
DROP procedure IF EXISTS `existsindictionary`;
DELIMITER $$
USE `dictionary`$$
CREATE DEFINER=`root`@`localhost` PROCEDURE `existsindictionary`(IN word varchar(27))
BEGIN
declare wlen int;
SET wlen = CHAR_LENGTH(word);
SELECT id
FROM greekwords
WHERE wlen = length and binary word =words ;
END$$
DELIMITER ;
/*function levesteindist returns the levenstein distance of two strings
acccording to the relative levenshtein distance algorithm*/
DELIMITER $$
DROP FUNCTION IF EXISTS levenshteindist $$
USE `dictionary`$$
CREATE FUNCTION levenshteindist(w1 VARCHAR(27), w2 VARCHAR(27))
RETURNS INT
DETERMINISTIC
BEGIN
DECLARE w1len, w2len, d, i, j, temp, cost INT;
DECLARE w1char CHAR;
DECLARE cv0, cv1 VARBINARY(28);
SET w1len = CHAR_LENGTH(w1),
w2len = CHAR_LENGTH(w2),
j = 1,
i = 1,
d = 0;
WHILE (j <= w2len) DO
SET cv1 = CONCAT(cv1, CHAR(j)),
j = j + 1;
END WHILE;
WHILE (i <= w1len) DO
SET w1char = SUBSTRING(w1, i, 1),
d = i,
cv0 = CHAR(i),
j = 1;
WHILE (j <= w2len) DO
SET d = d + 1,
cost = IF(w1char = SUBSTRING(w2, j, 1), 0, 1);
SET temp = ORD(SUBSTRING(cv1, j, 1)) + cost;
IF (d > temp) THEN
SET d = temp;
END IF;
SET temp = ORD(SUBSTRING(cv1, j+1, 1)) + 1;
IF (d > temp) THEN
SET d = temp;
END IF;
SET cv0 = CONCAT(cv0, CHAR(d)),
j = j + 1;
END WHILE;
SET cv1 = cv0,
i = i + 1;
END WHILE;
RETURN (d);
END $$
DELIMITER ;
/*procedure findsuggestions returns the three closer suggestions
to the word given when called using the levenshteindist fuction
that was created above*/
drop procedure IF EXISTS `findsuggestions`;
DELIMITER $$
USE `dictionary`$$
CREATE DEFINER=`root`@`localhost` PROCEDURE `findsuggestions`(IN word varchar(28))
BEGIN
declare wlen int;
SET wlen = CHAR_LENGTH(word);
select words
from greekwords
where length = wlen
order by levenshteindist(word, words)
limit 1,3;
END$$
DELIMITER ;
| true |
b25c00d0f032b76e6d083b1ee820e272d0c240f9
|
SQL
|
adeshas/transitmedia
|
/protected/db_new_schema.sql
|
UTF-8
| 100,410 | 2.875 | 3 |
[] |
no_license
|
--
-- PostgreSQL database dump
--
-- Dumped from database version 11.2
-- Dumped by pg_dump version 11.2
-- Started on 2020-12-09 11:57:19
SET statement_timeout = 0;
SET lock_timeout = 0;
SET idle_in_transaction_session_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SELECT pg_catalog.set_config('search_path', '', false);
SET check_function_bodies = false;
SET client_min_messages = warning;
SET row_security = off;
SET default_tablespace = '';
SET default_with_oids = false;
--
-- TOC entry 308 (class 1259 OID 54392)
-- Name: __main_buses; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.__main_buses (
id integer,
number character varying,
operator_id integer,
platform_id integer,
exterior_campaign_id integer,
interior_campaign_id integer,
bus_status_id integer,
ts_created timestamp with time zone,
ts_last_update timestamp with time zone,
bus_depot_id integer,
bus_size_id integer
);
ALTER TABLE public.__main_buses OWNER TO postgres;
--
-- TOC entry 309 (class 1259 OID 54398)
-- Name: __main_campaigns; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.__main_campaigns (
id integer,
inventory_id integer,
platform_id integer,
bus_size_id integer,
price_id integer,
quantity integer,
start_date date,
end_date date,
created_by integer,
vendor_id integer,
ts_created timestamp with time zone,
ts_last_update timestamp with time zone,
name character varying,
renewal_stage_id integer
);
ALTER TABLE public.__main_campaigns OWNER TO postgres;
--
-- TOC entry 310 (class 1259 OID 54405)
-- Name: __main_transactions; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.__main_transactions (
id integer,
campaign_id integer,
operator_id integer,
quantity integer,
status_id integer,
print_status_id integer,
payment_status_id integer,
created_by integer,
ts_created timestamp with time zone,
ts_last_update timestamp with time zone,
payment_date date,
start_date date,
end_date date,
price_id integer
);
ALTER TABLE public.__main_transactions OWNER TO postgres;
--
-- TOC entry 311 (class 1259 OID 54408)
-- Name: __main_users; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.__main_users (
id integer,
name text,
reportsto integer,
username text,
password text,
email character varying(250),
user_type integer,
vendor_id integer
);
ALTER TABLE public.__main_users OWNER TO postgres;
--
-- TOC entry 198 (class 1259 OID 51412)
-- Name: bus_depot; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.bus_depot (
id integer NOT NULL,
name text NOT NULL
);
ALTER TABLE public.bus_depot OWNER TO postgres;
--
-- TOC entry 199 (class 1259 OID 51418)
-- Name: bus_depot_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE public.bus_depot_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.bus_depot_id_seq OWNER TO postgres;
--
-- TOC entry 3475 (class 0 OID 0)
-- Dependencies: 199
-- Name: bus_depot_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE public.bus_depot_id_seq OWNED BY public.bus_depot.id;
--
-- TOC entry 201 (class 1259 OID 51429)
-- Name: bus_status; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.bus_status (
id integer NOT NULL,
name character varying NOT NULL,
availability boolean NOT NULL
);
ALTER TABLE public.bus_status OWNER TO postgres;
--
-- TOC entry 202 (class 1259 OID 51435)
-- Name: bus_status_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE public.bus_status_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.bus_status_id_seq OWNER TO postgres;
--
-- TOC entry 3476 (class 0 OID 0)
-- Dependencies: 202
-- Name: bus_status_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE public.bus_status_id_seq OWNED BY public.bus_status.id;
--
-- TOC entry 200 (class 1259 OID 51420)
-- Name: buses; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.buses (
id integer NOT NULL,
number character varying NOT NULL,
service_provider_id integer,
exterior_campaign_id integer,
interior_campaign_id integer,
bus_status_id integer DEFAULT 1 NOT NULL,
ts_created timestamp with time zone DEFAULT now() NOT NULL,
ts_last_update timestamp with time zone DEFAULT now() NOT NULL,
bus_depot_id integer
);
ALTER TABLE public.buses OWNER TO postgres;
--
-- TOC entry 205 (class 1259 OID 51456)
-- Name: buses_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE public.buses_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.buses_id_seq OWNER TO postgres;
--
-- TOC entry 3477 (class 0 OID 0)
-- Dependencies: 205
-- Name: buses_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE public.buses_id_seq OWNED BY public.buses.id;
--
-- TOC entry 206 (class 1259 OID 51458)
-- Name: campaign_status; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.campaign_status (
id integer NOT NULL,
name character varying NOT NULL
);
ALTER TABLE public.campaign_status OWNER TO postgres;
--
-- TOC entry 207 (class 1259 OID 51464)
-- Name: campaign_status_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE public.campaign_status_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.campaign_status_id_seq OWNER TO postgres;
--
-- TOC entry 3478 (class 0 OID 0)
-- Dependencies: 207
-- Name: campaign_status_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE public.campaign_status_id_seq OWNED BY public.campaign_status.id;
--
-- TOC entry 208 (class 1259 OID 51466)
-- Name: core_settings; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.core_settings (
id integer NOT NULL,
name character varying NOT NULL,
value character varying NOT NULL
);
ALTER TABLE public.core_settings OWNER TO postgres;
--
-- TOC entry 209 (class 1259 OID 51472)
-- Name: core_settings_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE public.core_settings_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.core_settings_id_seq OWNER TO postgres;
--
-- TOC entry 3479 (class 0 OID 0)
-- Dependencies: 209
-- Name: core_settings_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE public.core_settings_id_seq OWNED BY public.core_settings.id;
--
-- TOC entry 210 (class 1259 OID 51474)
-- Name: discounts; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.discounts (
id integer NOT NULL,
minimum integer,
maximum integer,
amount bigint,
primero_fee integer
);
ALTER TABLE public.discounts OWNER TO postgres;
--
-- TOC entry 211 (class 1259 OID 51477)
-- Name: discounts_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE public.discounts_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.discounts_id_seq OWNER TO postgres;
--
-- TOC entry 3480 (class 0 OID 0)
-- Dependencies: 211
-- Name: discounts_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE public.discounts_id_seq OWNED BY public.discounts.id;
--
-- TOC entry 212 (class 1259 OID 51479)
-- Name: email_settings; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.email_settings (
id integer NOT NULL,
name character varying(60) NOT NULL,
description text,
to_value text,
cc_value text,
bcc_value text
);
ALTER TABLE public.email_settings OWNER TO postgres;
--
-- TOC entry 213 (class 1259 OID 51485)
-- Name: email_settings_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE public.email_settings_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.email_settings_id_seq OWNER TO postgres;
--
-- TOC entry 3481 (class 0 OID 0)
-- Dependencies: 213
-- Name: email_settings_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE public.email_settings_id_seq OWNED BY public.email_settings.id;
--
-- TOC entry 203 (class 1259 OID 51437)
-- Name: exterior_campaigns; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.exterior_campaigns (
id integer NOT NULL,
name character varying NOT NULL,
brand_id integer,
start_date date NOT NULL,
end_date date NOT NULL,
quantity integer NOT NULL,
created_by integer NOT NULL,
vendor_id integer,
status_id integer DEFAULT 1 NOT NULL,
print_status_id integer DEFAULT 1 NOT NULL,
payment_status_id integer DEFAULT 1 NOT NULL,
ts_created timestamp with time zone DEFAULT now() NOT NULL,
ts_last_update timestamp with time zone DEFAULT now() NOT NULL,
renewal boolean DEFAULT false
);
ALTER TABLE public.exterior_campaigns OWNER TO postgres;
--
-- TOC entry 214 (class 1259 OID 51487)
-- Name: exterior_campaigns_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE public.exterior_campaigns_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.exterior_campaigns_id_seq OWNER TO postgres;
--
-- TOC entry 3482 (class 0 OID 0)
-- Dependencies: 214
-- Name: exterior_campaigns_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE public.exterior_campaigns_id_seq OWNED BY public.exterior_campaigns.id;
--
-- TOC entry 215 (class 1259 OID 51489)
-- Name: exterior_reports; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.exterior_reports (
id integer NOT NULL,
date date NOT NULL,
image text,
video text,
comments text,
vendor_id integer NOT NULL,
ref_bus_id integer,
campaign_id integer NOT NULL,
ts_created timestamp with time zone DEFAULT now() NOT NULL,
type_id integer
);
ALTER TABLE public.exterior_reports OWNER TO postgres;
--
-- TOC entry 216 (class 1259 OID 51496)
-- Name: exterior_reports_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE public.exterior_reports_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.exterior_reports_id_seq OWNER TO postgres;
--
-- TOC entry 3483 (class 0 OID 0)
-- Dependencies: 216
-- Name: exterior_reports_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE public.exterior_reports_id_seq OWNED BY public.exterior_reports.id;
--
-- TOC entry 232 (class 1259 OID 53877)
-- Name: main_buses; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.main_buses (
id integer NOT NULL,
number character varying NOT NULL,
operator_id integer,
platform_id integer,
exterior_campaign_id integer,
interior_campaign_id integer,
bus_status_id integer DEFAULT 1 NOT NULL,
ts_created timestamp with time zone DEFAULT now() NOT NULL,
ts_last_update timestamp with time zone DEFAULT now() NOT NULL,
bus_depot_id integer,
bus_size_id integer
);
ALTER TABLE public.main_buses OWNER TO postgres;
--
-- TOC entry 233 (class 1259 OID 53886)
-- Name: main_buses_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE public.main_buses_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.main_buses_id_seq OWNER TO postgres;
--
-- TOC entry 3484 (class 0 OID 0)
-- Dependencies: 233
-- Name: main_buses_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE public.main_buses_id_seq OWNED BY public.main_buses.id;
--
-- TOC entry 234 (class 1259 OID 53888)
-- Name: main_campaigns; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.main_campaigns (
id integer NOT NULL,
inventory_id integer,
platform_id integer,
bus_size_id integer,
price_id integer,
quantity integer,
start_date date NOT NULL,
end_date date NOT NULL,
user_id integer NOT NULL,
vendor_id integer,
ts_created timestamp with time zone DEFAULT now() NOT NULL,
ts_last_update timestamp with time zone DEFAULT now() NOT NULL,
name text,
renewal_stage_id integer DEFAULT 1
);
ALTER TABLE public.main_campaigns OWNER TO postgres;
--
-- TOC entry 235 (class 1259 OID 53897)
-- Name: main_campaigns_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE public.main_campaigns_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.main_campaigns_id_seq OWNER TO postgres;
--
-- TOC entry 3485 (class 0 OID 0)
-- Dependencies: 235
-- Name: main_campaigns_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE public.main_campaigns_id_seq OWNED BY public.main_campaigns.id;
--
-- TOC entry 236 (class 1259 OID 53899)
-- Name: main_print_orders; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.main_print_orders (
id integer NOT NULL,
campaign_id integer,
printer_id integer,
ts_created timestamp with time zone DEFAULT now() NOT NULL,
link text DEFAULT 'click here'::text,
approved boolean DEFAULT false,
quantity integer NOT NULL,
comments text,
bus_codes text
);
ALTER TABLE public.main_print_orders OWNER TO postgres;
--
-- TOC entry 237 (class 1259 OID 53908)
-- Name: main_print_orders_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE public.main_print_orders_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.main_print_orders_id_seq OWNER TO postgres;
--
-- TOC entry 3486 (class 0 OID 0)
-- Dependencies: 237
-- Name: main_print_orders_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE public.main_print_orders_id_seq OWNED BY public.main_print_orders.id;
--
-- TOC entry 238 (class 1259 OID 53910)
-- Name: main_reports; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.main_reports (
id integer NOT NULL,
date date NOT NULL,
image text,
video text,
comments text,
vendor_id integer NOT NULL,
ref_bus_id integer,
campaign_id integer NOT NULL,
ts_created timestamp with time zone DEFAULT now() NOT NULL,
type_id integer
);
ALTER TABLE public.main_reports OWNER TO postgres;
--
-- TOC entry 239 (class 1259 OID 53917)
-- Name: main_reports_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE public.main_reports_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.main_reports_id_seq OWNER TO postgres;
--
-- TOC entry 3487 (class 0 OID 0)
-- Dependencies: 239
-- Name: main_reports_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE public.main_reports_id_seq OWNED BY public.main_reports.id;
--
-- TOC entry 240 (class 1259 OID 53919)
-- Name: main_transactions; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.main_transactions (
id integer NOT NULL,
campaign_id integer NOT NULL,
operator_id integer NOT NULL,
quantity integer NOT NULL,
status_id integer DEFAULT 1 NOT NULL,
print_status_id integer DEFAULT 1 NOT NULL,
payment_status_id integer DEFAULT 1 NOT NULL,
created_by integer NOT NULL,
ts_created timestamp with time zone DEFAULT now() NOT NULL,
ts_last_update timestamp with time zone DEFAULT now() NOT NULL,
payment_date date,
start_date date,
end_date date,
price_id integer
);
ALTER TABLE public.main_transactions OWNER TO postgres;
--
-- TOC entry 241 (class 1259 OID 53927)
-- Name: main_transactions_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE public.main_transactions_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.main_transactions_id_seq OWNER TO postgres;
--
-- TOC entry 3488 (class 0 OID 0)
-- Dependencies: 241
-- Name: main_transactions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE public.main_transactions_id_seq OWNED BY public.main_transactions.id;
--
-- TOC entry 242 (class 1259 OID 53929)
-- Name: main_users; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.main_users (
id integer NOT NULL,
name text NOT NULL,
reportsto integer,
username text NOT NULL,
password text NOT NULL,
email character varying(250),
user_type integer,
vendor_id integer,
ts timestamp with time zone DEFAULT now()
);
ALTER TABLE public.main_users OWNER TO postgres;
--
-- TOC entry 243 (class 1259 OID 53935)
-- Name: main_users_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE public.main_users_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.main_users_id_seq OWNER TO postgres;
--
-- TOC entry 3489 (class 0 OID 0)
-- Dependencies: 243
-- Name: main_users_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE public.main_users_id_seq OWNED BY public.main_users.id;
--
-- TOC entry 218 (class 1259 OID 51504)
-- Name: payment_status; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.payment_status (
id integer NOT NULL,
name character varying NOT NULL
);
ALTER TABLE public.payment_status OWNER TO postgres;
--
-- TOC entry 219 (class 1259 OID 51510)
-- Name: payment_status_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE public.payment_status_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.payment_status_id_seq OWNER TO postgres;
--
-- TOC entry 3490 (class 0 OID 0)
-- Dependencies: 219
-- Name: payment_status_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE public.payment_status_id_seq OWNED BY public.payment_status.id;
--
-- TOC entry 221 (class 1259 OID 51518)
-- Name: print_orders; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.print_orders (
id integer NOT NULL,
campaign_id integer,
printer_id integer,
ts_created timestamp with time zone DEFAULT now() NOT NULL,
link text DEFAULT 'click here'::text,
approved boolean DEFAULT false,
quantity integer NOT NULL,
comments text,
bus_codes text
);
ALTER TABLE public.print_orders OWNER TO postgres;
--
-- TOC entry 222 (class 1259 OID 51527)
-- Name: print_orders_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE public.print_orders_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.print_orders_id_seq OWNER TO postgres;
--
-- TOC entry 3491 (class 0 OID 0)
-- Dependencies: 222
-- Name: print_orders_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE public.print_orders_id_seq OWNED BY public.print_orders.id;
--
-- TOC entry 220 (class 1259 OID 51512)
-- Name: print_status; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.print_status (
id integer NOT NULL,
name character varying NOT NULL
);
ALTER TABLE public.print_status OWNER TO postgres;
--
-- TOC entry 223 (class 1259 OID 51529)
-- Name: print_status_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE public.print_status_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.print_status_id_seq OWNER TO postgres;
--
-- TOC entry 3492 (class 0 OID 0)
-- Dependencies: 223
-- Name: print_status_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE public.print_status_id_seq OWNED BY public.print_status.id;
--
-- TOC entry 224 (class 1259 OID 51531)
-- Name: printers; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.printers (
id integer NOT NULL,
name text,
passcode character varying(5),
email text
);
ALTER TABLE public.printers OWNER TO postgres;
--
-- TOC entry 225 (class 1259 OID 51537)
-- Name: printers_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE public.printers_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.printers_id_seq OWNER TO postgres;
--
-- TOC entry 3493 (class 0 OID 0)
-- Dependencies: 225
-- Name: printers_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE public.printers_id_seq OWNED BY public.printers.id;
--
-- TOC entry 226 (class 1259 OID 51539)
-- Name: report_types; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.report_types (
id integer NOT NULL,
name text
);
ALTER TABLE public.report_types OWNER TO postgres;
--
-- TOC entry 227 (class 1259 OID 51545)
-- Name: report_types_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE public.report_types_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.report_types_id_seq OWNER TO postgres;
--
-- TOC entry 3494 (class 0 OID 0)
-- Dependencies: 227
-- Name: report_types_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE public.report_types_id_seq OWNED BY public.report_types.id;
--
-- TOC entry 244 (class 1259 OID 53937)
-- Name: sub_media_allocation; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.sub_media_allocation (
id integer NOT NULL,
bus_id integer,
campaign_id integer,
active boolean DEFAULT false NOT NULL,
created_by integer,
ts_created timestamp with time zone DEFAULT now(),
ts_last_update timestamp with time zone
);
ALTER TABLE public.sub_media_allocation OWNER TO postgres;
--
-- TOC entry 245 (class 1259 OID 53942)
-- Name: sub_media_allocation_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE public.sub_media_allocation_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.sub_media_allocation_id_seq OWNER TO postgres;
--
-- TOC entry 3495 (class 0 OID 0)
-- Dependencies: 245
-- Name: sub_media_allocation_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE public.sub_media_allocation_id_seq OWNED BY public.sub_media_allocation.id;
--
-- TOC entry 246 (class 1259 OID 53944)
-- Name: sub_renewal_requests; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.sub_renewal_requests (
id integer NOT NULL,
campaign_id integer,
created_by integer,
ts_created timestamp with time zone,
ts_last_update timestamp with time zone
);
ALTER TABLE public.sub_renewal_requests OWNER TO postgres;
--
-- TOC entry 247 (class 1259 OID 53947)
-- Name: sub_renewal_requests_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE public.sub_renewal_requests_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.sub_renewal_requests_id_seq OWNER TO postgres;
--
-- TOC entry 3496 (class 0 OID 0)
-- Dependencies: 247
-- Name: sub_renewal_requests_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE public.sub_renewal_requests_id_seq OWNED BY public.sub_renewal_requests.id;
--
-- TOC entry 248 (class 1259 OID 53949)
-- Name: sub_transaction_details; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.sub_transaction_details (
id integer NOT NULL,
transaction_id integer NOT NULL,
bus_id integer NOT NULL,
created_by integer NOT NULL,
ts_created timestamp with time zone DEFAULT now() NOT NULL,
ts_last_update timestamp with time zone DEFAULT now() NOT NULL
);
ALTER TABLE public.sub_transaction_details OWNER TO postgres;
--
-- TOC entry 249 (class 1259 OID 53954)
-- Name: sub_transaction_details_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE public.sub_transaction_details_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.sub_transaction_details_id_seq OWNER TO postgres;
--
-- TOC entry 3497 (class 0 OID 0)
-- Dependencies: 249
-- Name: sub_transaction_details_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE public.sub_transaction_details_id_seq OWNED BY public.sub_transaction_details.id;
--
-- TOC entry 228 (class 1259 OID 51547)
-- Name: user_types; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.user_types (
id integer NOT NULL,
name character varying NOT NULL
);
ALTER TABLE public.user_types OWNER TO postgres;
--
-- TOC entry 229 (class 1259 OID 51553)
-- Name: user_types_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE public.user_types_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.user_types_id_seq OWNER TO postgres;
--
-- TOC entry 3498 (class 0 OID 0)
-- Dependencies: 229
-- Name: user_types_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE public.user_types_id_seq OWNED BY public.user_types.id;
--
-- TOC entry 204 (class 1259 OID 51449)
-- Name: users; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.users (
id integer NOT NULL,
email character varying NOT NULL,
name character varying NOT NULL,
username character varying NOT NULL,
password character varying NOT NULL,
user_type integer NOT NULL,
vendor_id integer NOT NULL,
ts timestamp with time zone DEFAULT now() NOT NULL,
reports_to integer
);
ALTER TABLE public.users OWNER TO postgres;
--
-- TOC entry 230 (class 1259 OID 51555)
-- Name: users_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE public.users_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.users_id_seq OWNER TO postgres;
--
-- TOC entry 3499 (class 0 OID 0)
-- Dependencies: 230
-- Name: users_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE public.users_id_seq OWNED BY public.users.id;
--
-- TOC entry 217 (class 1259 OID 51498)
-- Name: vendors; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.vendors (
id integer NOT NULL,
name character varying NOT NULL
);
ALTER TABLE public.vendors OWNER TO postgres;
--
-- TOC entry 231 (class 1259 OID 51557)
-- Name: vendors_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE public.vendors_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.vendors_id_seq OWNER TO postgres;
--
-- TOC entry 3500 (class 0 OID 0)
-- Dependencies: 231
-- Name: vendors_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE public.vendors_id_seq OWNED BY public.vendors.id;
--
-- TOC entry 250 (class 1259 OID 53956)
-- Name: x_bus_depot; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.x_bus_depot (
id integer NOT NULL,
name text NOT NULL
);
ALTER TABLE public.x_bus_depot OWNER TO postgres;
--
-- TOC entry 251 (class 1259 OID 53962)
-- Name: x_bus_sizes; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.x_bus_sizes (
id integer NOT NULL,
name text
);
ALTER TABLE public.x_bus_sizes OWNER TO postgres;
--
-- TOC entry 252 (class 1259 OID 53968)
-- Name: x_bus_status; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.x_bus_status (
id integer NOT NULL,
name character varying NOT NULL,
availability boolean NOT NULL
);
ALTER TABLE public.x_bus_status OWNER TO postgres;
--
-- TOC entry 253 (class 1259 OID 53974)
-- Name: y_operators; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.y_operators (
id integer NOT NULL,
name character varying(50),
shortname character varying(50),
platform_id integer,
email character varying,
contact_name character varying
);
ALTER TABLE public.y_operators OWNER TO postgres;
--
-- TOC entry 254 (class 1259 OID 53980)
-- Name: y_platforms; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.y_platforms (
id integer NOT NULL,
name character varying(50),
shortname character varying(50),
email character varying
);
ALTER TABLE public.y_platforms OWNER TO postgres;
--
-- TOC entry 255 (class 1259 OID 53986)
-- Name: y_vendors; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.y_vendors (
id integer NOT NULL,
name character varying NOT NULL
);
ALTER TABLE public.y_vendors OWNER TO postgres;
--
-- TOC entry 256 (class 1259 OID 53992)
-- Name: view_all_buses; Type: VIEW; Schema: public; Owner: postgres
--
CREATE VIEW public.view_all_buses AS
SELECT main_buses.id,
main_buses.number,
( SELECT y.name
FROM public.y_platforms y
WHERE (y.id = main_buses.platform_id)) AS platform,
( SELECT o.name
FROM public.y_operators o
WHERE (o.id = main_buses.operator_id)) AS operator,
( SELECT c.name
FROM public.main_campaigns c
WHERE (c.id = main_buses.exterior_campaign_id)) AS exterior_campaign,
( SELECT v.name
FROM public.y_vendors v
WHERE (v.id = ( SELECT c.vendor_id
FROM public.main_campaigns c
WHERE (c.id = main_buses.exterior_campaign_id)))) AS exterior_campaign_vendor,
( SELECT c.name
FROM public.main_campaigns c
WHERE (c.id = main_buses.interior_campaign_id)) AS interior_campaign,
( SELECT v.name
FROM public.y_vendors v
WHERE (v.id = ( SELECT c.vendor_id
FROM public.main_campaigns c
WHERE (c.id = main_buses.interior_campaign_id)))) AS interior_campaign_vendor,
( SELECT b.name
FROM public.x_bus_status b
WHERE (b.id = main_buses.bus_status_id)) AS bus_status,
( SELECT b.name
FROM public.x_bus_sizes b
WHERE (b.id = main_buses.bus_size_id)) AS bus_size,
( SELECT b.name
FROM public.x_bus_depot b
WHERE (b.id = main_buses.bus_depot_id)) AS bus_depot,
main_buses.ts_created,
main_buses.ts_last_update,
main_buses.bus_status_id,
main_buses.bus_size_id,
main_buses.bus_depot_id,
main_buses.platform_id,
main_buses.operator_id,
main_buses.exterior_campaign_id,
main_buses.interior_campaign_id
FROM public.main_buses;
ALTER TABLE public.view_all_buses OWNER TO postgres;
--
-- TOC entry 257 (class 1259 OID 53997)
-- Name: view_bus_depot_summary; Type: VIEW; Schema: public; Owner: postgres
--
CREATE VIEW public.view_bus_depot_summary AS
SELECT
CASE
WHEN (main_buses.bus_depot_id IS NULL) THEN '<< NO DEPOT ASSIGNED >>'::text
ELSE ( SELECT x_bus_depot.name
FROM public.x_bus_depot
WHERE (x_bus_depot.id = main_buses.bus_depot_id))
END AS depot,
count(*) AS total_buses,
string_agg((main_buses.number)::text, ', '::text) AS bus_codes,
string_agg((
CASE
WHEN (main_buses.bus_status_id = 1) THEN main_buses.number
ELSE NULL::character varying
END)::text, ', '::text) AS good_bus_codes,
string_agg((
CASE
WHEN (main_buses.bus_status_id <> 1) THEN main_buses.number
ELSE NULL::character varying
END)::text, ', '::text) AS bad_bus_codes
FROM public.main_buses
GROUP BY main_buses.bus_depot_id;
ALTER TABLE public.view_bus_depot_summary OWNER TO postgres;
--
-- TOC entry 258 (class 1259 OID 54002)
-- Name: view_bus_ext_summary_at_a_glance; Type: VIEW; Schema: public; Owner: postgres
--
CREATE VIEW public.view_bus_ext_summary_at_a_glance AS
SELECT
CASE
WHEN (main_buses.exterior_campaign_id IS NOT NULL) THEN 'BUSES - BRANDED'::text
ELSE 'BUSES - NOT BRANDED'::text
END AS brand_status,
count(
CASE
WHEN (main_buses.bus_status_id = 1) THEN 1
ELSE NULL::integer
END) AS active,
count(
CASE
WHEN (main_buses.bus_status_id <> 1) THEN 1
ELSE NULL::integer
END) AS maintenance,
count(*) AS total,
to_char(max(main_buses.ts_last_update), 'DD Mon YYYY'::text) AS last_updated_at
FROM public.main_buses
GROUP BY
CASE
WHEN (main_buses.exterior_campaign_id IS NOT NULL) THEN 'BUSES - BRANDED'::text
ELSE 'BUSES - NOT BRANDED'::text
END;
ALTER TABLE public.view_bus_ext_summary_at_a_glance OWNER TO postgres;
--
-- TOC entry 259 (class 1259 OID 54007)
-- Name: view_bus_int_summary_at_a_glance; Type: VIEW; Schema: public; Owner: postgres
--
CREATE VIEW public.view_bus_int_summary_at_a_glance AS
SELECT
CASE
WHEN (main_buses.interior_campaign_id IS NOT NULL) THEN 'BUSES - BRANDED'::text
ELSE 'BUSES - NOT BRANDED'::text
END AS brand_status,
count(
CASE
WHEN (main_buses.bus_status_id = 1) THEN 1
ELSE NULL::integer
END) AS active,
count(
CASE
WHEN (main_buses.bus_status_id <> 1) THEN 1
ELSE NULL::integer
END) AS maintenance,
count(*) AS total,
to_char(max(main_buses.ts_last_update), 'DD Mon YYYY'::text) AS last_updated_at
FROM public.main_buses
GROUP BY
CASE
WHEN (main_buses.interior_campaign_id IS NOT NULL) THEN 'BUSES - BRANDED'::text
ELSE 'BUSES - NOT BRANDED'::text
END;
ALTER TABLE public.view_bus_int_summary_at_a_glance OWNER TO postgres;
--
-- TOC entry 260 (class 1259 OID 54012)
-- Name: view_bus_summary; Type: VIEW; Schema: public; Owner: postgres
--
CREATE VIEW public.view_bus_summary AS
SELECT b.exterior_campaign_id,
( SELECT main_campaigns.name
FROM public.main_campaigns
WHERE (main_campaigns.id = b.exterior_campaign_id)) AS campaign_name,
( SELECT ((main_campaigns.start_date || ' - '::text) || main_campaigns.end_date)
FROM public.main_campaigns
WHERE (main_campaigns.id = b.exterior_campaign_id)) AS period,
count(b.number) AS buses,
count(
CASE
WHEN (b.bus_status_id = 1) THEN 1
ELSE NULL::integer
END) AS active_working,
count(
CASE
WHEN (b.bus_status_id <> 1) THEN 1
ELSE NULL::integer
END) AS requires_maintenance,
string_agg(DISTINCT (( SELECT x_bus_status.name
FROM public.x_bus_status
WHERE ((x_bus_status.id = b.bus_status_id) AND (x_bus_status.id <> 1))))::text, chr(10)) AS issues,
string_agg((
CASE
WHEN (b.bus_status_id = 1) THEN b.number
ELSE NULL::character varying
END)::text, ', '::text) AS good_bus_codes,
string_agg((
CASE
WHEN (b.bus_status_id <> 1) THEN b.number
ELSE NULL::character varying
END)::text, ', '::text) AS bad_bus_codes,
string_agg((b.number)::text, ', '::text) AS bus_codes,
to_char(max(b.ts_last_update), 'DD Mon YYYY'::text) AS last_updated_at
FROM public.main_buses b
GROUP BY b.exterior_campaign_id
ORDER BY (b.exterior_campaign_id IS NULL), ( SELECT ((main_campaigns.start_date || ' - '::text) || main_campaigns.end_date)
FROM public.main_campaigns
WHERE (main_campaigns.id = b.exterior_campaign_id)) DESC;
ALTER TABLE public.view_bus_summary OWNER TO postgres;
--
-- TOC entry 261 (class 1259 OID 54017)
-- Name: view_bus_trans_options; Type: VIEW; Schema: public; Owner: postgres
--
CREATE VIEW public.view_bus_trans_options AS
SELECT b.id AS bus_id,
t.id AS transaction_id,
b.number,
b.platform_id,
( SELECT y_platforms.name
FROM public.y_platforms
WHERE (y_platforms.id = b.platform_id)) AS platform,
b.operator_id,
( SELECT y_operators.name
FROM public.y_operators
WHERE (y_operators.id = b.operator_id)) AS operator,
b.bus_status_id,
( SELECT x_bus_status.name
FROM public.x_bus_status
WHERE (x_bus_status.id = b.bus_status_id)) AS bus_status,
t.quantity,
b.exterior_campaign_id,
( SELECT main_campaigns.name
FROM public.main_campaigns
WHERE (main_campaigns.id = b.exterior_campaign_id)) AS exterior_campaign,
b.interior_campaign_id,
( SELECT main_campaigns.name
FROM public.main_campaigns
WHERE (main_campaigns.id = b.interior_campaign_id)) AS interior_campaign
FROM public.main_transactions t,
public.main_buses b
WHERE (b.operator_id = t.operator_id);
ALTER TABLE public.view_bus_trans_options OWNER TO postgres;
--
-- TOC entry 262 (class 1259 OID 54022)
-- Name: view_buses_assigned; Type: VIEW; Schema: public; Owner: postgres
--
CREATE VIEW public.view_buses_assigned AS
SELECT d.id,
d.transaction_id,
('BUS '::text || (b.number)::text) AS bus
FROM public.sub_transaction_details d,
public.main_buses b
WHERE (b.id = d.bus_id);
ALTER TABLE public.view_buses_assigned OWNER TO postgres;
--
-- TOC entry 263 (class 1259 OID 54026)
-- Name: view_buses_exterior; Type: VIEW; Schema: public; Owner: postgres
--
CREATE VIEW public.view_buses_exterior AS
SELECT main_buses.id,
main_buses.number,
main_buses.platform_id,
main_buses.operator_id,
main_buses.exterior_campaign_id,
main_buses.exterior_campaign_id AS campaign_id,
main_buses.bus_status_id,
main_buses.bus_depot_id,
main_buses.ts_created,
main_buses.ts_last_update,
( SELECT c.vendor_id
FROM public.main_campaigns c
WHERE (c.id = main_buses.exterior_campaign_id)) AS vendor_id
FROM public.main_buses;
ALTER TABLE public.view_buses_exterior OWNER TO postgres;
--
-- TOC entry 264 (class 1259 OID 54030)
-- Name: view_buses_interior; Type: VIEW; Schema: public; Owner: postgres
--
CREATE VIEW public.view_buses_interior AS
SELECT main_buses.id,
main_buses.number,
main_buses.platform_id,
main_buses.operator_id,
main_buses.interior_campaign_id,
main_buses.interior_campaign_id AS campaign_id,
main_buses.bus_status_id,
main_buses.bus_depot_id,
main_buses.ts_created,
main_buses.ts_last_update,
( SELECT c.vendor_id
FROM public.main_campaigns c
WHERE (c.id = main_buses.interior_campaign_id)) AS vendor_id
FROM public.main_buses;
ALTER TABLE public.view_buses_interior OWNER TO postgres;
--
-- TOC entry 265 (class 1259 OID 54034)
-- Name: view_campaign_status; Type: VIEW; Schema: public; Owner: postgres
--
CREATE VIEW public.view_campaign_status AS
SELECT
NULL::integer AS id,
NULL::text AS name,
NULL::bigint AS pending,
NULL::bigint AS approved,
NULL::bigint AS denied,
NULL::text AS status,
NULL::text AS status_matrix,
NULL::text AS status_json;
ALTER TABLE public.view_campaign_status OWNER TO postgres;
--
-- TOC entry 266 (class 1259 OID 54038)
-- Name: x_payment_status; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.x_payment_status (
id integer NOT NULL,
name character varying NOT NULL
);
ALTER TABLE public.x_payment_status OWNER TO postgres;
--
-- TOC entry 267 (class 1259 OID 54044)
-- Name: x_print_stage; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.x_print_stage (
id integer NOT NULL,
name text
);
ALTER TABLE public.x_print_stage OWNER TO postgres;
--
-- TOC entry 268 (class 1259 OID 54050)
-- Name: x_transaction_status; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.x_transaction_status (
id integer NOT NULL,
name character varying NOT NULL,
admin_name character varying,
operator_name character varying
);
ALTER TABLE public.x_transaction_status OWNER TO postgres;
--
-- TOC entry 269 (class 1259 OID 54056)
-- Name: y_inventory; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.y_inventory (
id integer NOT NULL,
name text
);
ALTER TABLE public.y_inventory OWNER TO postgres;
--
-- TOC entry 270 (class 1259 OID 54062)
-- Name: z_price_settings; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.z_price_settings (
id integer NOT NULL,
platform_id integer NOT NULL,
inventory_id integer NOT NULL,
print_stage_id integer,
bus_size_id integer,
details text,
max_limit integer,
min_limit integer,
price bigint,
operator_fee bigint,
agency_fee bigint,
lamata_fee bigint,
lasaa_fee bigint,
printers_fee bigint,
active boolean DEFAULT false NOT NULL,
ts_created timestamp with time zone DEFAULT now() NOT NULL
);
ALTER TABLE public.z_price_settings OWNER TO postgres;
--
-- TOC entry 271 (class 1259 OID 54070)
-- Name: view_campaigns_pending; Type: VIEW; Schema: public; Owner: postgres
--
CREATE VIEW public.view_campaigns_pending AS
SELECT t.payment_date,
t.start_date,
t.end_date,
i.name AS inventory,
p.shortname AS platform,
o.shortname AS operator,
bs.name AS bus_size,
pr.name AS print_stage,
c.name AS campaign,
v.name AS vendor,
t.quantity,
ps.price,
ps.operator_fee,
ps.lamata_fee,
ps.agency_fee,
ps.lasaa_fee,
ps.printers_fee,
ts.name AS transaction_status,
xps.name AS payment_status,
t.id AS transaction_id,
t.payment_status_id,
t.status_id,
c.vendor_id,
ps.inventory_id,
ps.platform_id,
t.operator_id,
ps.bus_size_id
FROM public.main_campaigns c,
public.main_transactions t,
public.z_price_settings ps,
public.y_inventory i,
public.y_platforms p,
public.y_operators o,
public.x_bus_sizes bs,
public.x_print_stage pr,
public.y_vendors v,
public.x_transaction_status ts,
public.x_payment_status xps
WHERE ((c.id = t.campaign_id) AND (t.price_id = ps.id) AND (ps.inventory_id = i.id) AND (ps.platform_id = p.id) AND (ps.bus_size_id = bs.id) AND (ps.print_stage_id = pr.id) AND (t.operator_id = o.id) AND (c.vendor_id = v.id) AND (t.status_id = ts.id) AND (t.payment_status_id = xps.id) AND (t.payment_status_id = 2) AND (t.status_id = 4))
ORDER BY t.id DESC;
ALTER TABLE public.view_campaigns_pending OWNER TO postgres;
--
-- TOC entry 272 (class 1259 OID 54075)
-- Name: x_user_types; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.x_user_types (
id integer NOT NULL,
name character varying NOT NULL
);
ALTER TABLE public.x_user_types OWNER TO postgres;
--
-- TOC entry 273 (class 1259 OID 54081)
-- Name: view_operators; Type: VIEW; Schema: public; Owner: postgres
--
CREATE VIEW public.view_operators AS
SELECT u.id AS user_id,
u.name,
u.email,
u.vendor_id,
ut.id AS operator_id,
ut.name AS operator
FROM public.main_users u,
public.x_user_types ut
WHERE ((u.user_type = ut.id) AND (ut.id = 5));
ALTER TABLE public.view_operators OWNER TO postgres;
--
-- TOC entry 274 (class 1259 OID 54085)
-- Name: view_operators_platforms; Type: VIEW; Schema: public; Owner: postgres
--
CREATE VIEW public.view_operators_platforms WITH (security_barrier='false') AS
SELECT c.id AS campaign_id,
c.platform_id AS campaign_platform_id,
o.id AS operator_id,
o.name AS operator_name
FROM public.main_campaigns c,
public.y_operators o
WHERE (o.platform_id = c.platform_id);
ALTER TABLE public.view_operators_platforms OWNER TO postgres;
--
-- TOC entry 275 (class 1259 OID 54089)
-- Name: x_print_status; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.x_print_status (
id integer NOT NULL,
name character varying NOT NULL
);
ALTER TABLE public.x_print_status OWNER TO postgres;
--
-- TOC entry 276 (class 1259 OID 54095)
-- Name: view_payments_pending; Type: VIEW; Schema: public; Owner: postgres
--
CREATE VIEW public.view_payments_pending AS
SELECT t.id AS transaction_id,
c.id AS campaign_id,
c.name AS campaign_name,
t.quantity,
xta.name AS transaction_status,
xpr.name AS print_status,
xpa.name AS payment_status,
t.start_date,
t.end_date,
v.name AS vendor,
o.name AS operator,
p.name AS platform,
i.name AS inventory,
bs.name AS bus_size,
pst.name AS print_stage,
ps.price,
ps.operator_fee,
ps.agency_fee,
ps.lamata_fee,
ps.lasaa_fee,
ps.printers_fee,
ps.details AS price_details
FROM public.main_transactions t,
public.y_operators o,
public.main_campaigns c,
public.y_platforms p,
public.y_inventory i,
public.y_vendors v,
public.z_price_settings ps,
public.x_print_status xpr,
public.x_payment_status xpa,
public.x_transaction_status xta,
public.x_bus_sizes bs,
public.x_print_stage pst
WHERE ((t.campaign_id = c.id) AND (t.operator_id = o.id) AND (c.inventory_id = i.id) AND (c.platform_id = p.id) AND (t.price_id = ps.id) AND (c.vendor_id = v.id) AND (t.payment_status_id = xpa.id) AND (t.print_status_id = xpr.id) AND (t.status_id = xta.id) AND (c.bus_size_id = bs.id) AND (ps.print_stage_id = pst.id) AND (t.payment_status_id = 1) AND (((now())::date - (t.ts_created)::date) < 60))
ORDER BY t.id DESC;
ALTER TABLE public.view_payments_pending OWNER TO postgres;
--
-- TOC entry 277 (class 1259 OID 54100)
-- Name: view_pricing_all; Type: VIEW; Schema: public; Owner: postgres
--
CREATE VIEW public.view_pricing_all AS
SELECT p.id,
p.platform_id,
( SELECT y_platforms.name
FROM public.y_platforms
WHERE (y_platforms.id = p.platform_id)) AS platform,
p.inventory_id,
( SELECT y_inventory.name
FROM public.y_inventory
WHERE (y_inventory.id = p.inventory_id)) AS inventory,
p.print_stage_id,
( SELECT x_print_stage.name
FROM public.x_print_stage
WHERE (x_print_stage.id = p.print_stage_id)) AS print_stage,
p.bus_size_id,
( SELECT x_bus_sizes.name
FROM public.x_bus_sizes
WHERE (x_bus_sizes.id = p.bus_size_id)) AS bus_size,
p.details,
p.max_limit,
p.min_limit,
p.price,
p.operator_fee,
p.agency_fee,
p.lamata_fee,
p.lasaa_fee,
p.printers_fee,
p.active
FROM public.z_price_settings p;
ALTER TABLE public.view_pricing_all OWNER TO postgres;
--
-- TOC entry 278 (class 1259 OID 54105)
-- Name: view_pricing_initial; Type: VIEW; Schema: public; Owner: postgres
--
CREATE VIEW public.view_pricing_initial AS
SELECT p.id,
p.platform_id,
( SELECT y_platforms.name
FROM public.y_platforms
WHERE (y_platforms.id = p.platform_id)) AS platform,
p.inventory_id,
( SELECT y_inventory.name
FROM public.y_inventory
WHERE (y_inventory.id = p.inventory_id)) AS inventory,
p.print_stage_id,
( SELECT x_print_stage.name
FROM public.x_print_stage
WHERE (x_print_stage.id = p.print_stage_id)) AS print_stage,
p.bus_size_id,
( SELECT x_bus_sizes.name
FROM public.x_bus_sizes
WHERE (x_bus_sizes.id = p.bus_size_id)) AS bus_size,
p.details,
p.max_limit,
p.min_limit,
p.price,
p.operator_fee,
p.agency_fee,
p.lamata_fee,
p.lasaa_fee,
p.printers_fee,
p.active
FROM public.z_price_settings p
WHERE (p.print_stage_id = 1);
ALTER TABLE public.view_pricing_initial OWNER TO postgres;
--
-- TOC entry 279 (class 1259 OID 54110)
-- Name: view_pricing_options; Type: VIEW; Schema: public; Owner: postgres
--
CREATE VIEW public.view_pricing_options AS
SELECT p.id AS price_id,
c.price_id AS requested_price_id,
c.id AS campaign_id,
(((p.platform)::text || ' | '::text) || p.inventory) AS platform_inventory,
((((((('N '::text || to_char(p.price, '999,999.99'::text)) || ' | '::text) || p.bus_size) || ' | '::text) || p.print_stage) || ' | '::text) || p.details) AS price_details
FROM public.main_campaigns c,
public.view_pricing_all p
WHERE ((p.inventory_id = c.inventory_id) AND (p.platform_id = c.platform_id) AND (p.active = true))
ORDER BY (p.id <> c.price_id);
ALTER TABLE public.view_pricing_options OWNER TO postgres;
--
-- TOC entry 280 (class 1259 OID 54115)
-- Name: view_transactions_all; Type: VIEW; Schema: public; Owner: postgres
--
CREATE VIEW public.view_transactions_all WITH (security_barrier='false') AS
SELECT t.payment_date,
t.start_date,
t.end_date,
i.name AS inventory,
p.shortname AS platform,
o.shortname AS operator,
bs.name AS bus_size,
pr.name AS print_stage,
c.name AS campaign,
v.name AS vendor,
t.quantity,
ps.price,
ps.operator_fee,
ps.lamata_fee,
ps.agency_fee,
ps.lasaa_fee,
ps.printers_fee,
ts.name AS transaction_status,
t.id AS transaction_id,
t.status_id,
c.vendor_id,
ps.inventory_id,
ps.platform_id,
t.operator_id,
ps.bus_size_id
FROM public.main_campaigns c,
public.main_transactions t,
public.z_price_settings ps,
public.y_inventory i,
public.y_platforms p,
public.y_operators o,
public.x_bus_sizes bs,
public.x_print_stage pr,
public.y_vendors v,
public.x_transaction_status ts
WHERE ((c.id = t.campaign_id) AND (t.price_id = ps.id) AND (ps.inventory_id = i.id) AND (ps.platform_id = p.id) AND (ps.bus_size_id = bs.id) AND (ps.print_stage_id = pr.id) AND (t.operator_id = o.id) AND (c.vendor_id = v.id) AND (t.status_id = ts.id))
ORDER BY t.id DESC;
ALTER TABLE public.view_transactions_all OWNER TO postgres;
--
-- TOC entry 281 (class 1259 OID 54120)
-- Name: w_vendors_operators; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.w_vendors_operators (
id integer NOT NULL,
vendor_id integer,
operator_id integer
);
ALTER TABLE public.w_vendors_operators OWNER TO postgres;
--
-- TOC entry 282 (class 1259 OID 54123)
-- Name: view_vendors_operators; Type: VIEW; Schema: public; Owner: postgres
--
CREATE VIEW public.view_vendors_operators AS
SELECT u.vendor_id,
vo.operator_id,
v.name
FROM public.main_users u,
public.w_vendors_operators vo,
public.y_operators o,
public.y_vendors v
WHERE ((vo.vendor_id = u.vendor_id) AND (vo.vendor_id = v.id) AND (vo.operator_id = o.id))
GROUP BY u.vendor_id, vo.operator_id, v.name;
ALTER TABLE public.view_vendors_operators OWNER TO postgres;
--
-- TOC entry 283 (class 1259 OID 54127)
-- Name: view_transactions_per_operator; Type: VIEW; Schema: public; Owner: postgres
--
CREATE VIEW public.view_transactions_per_operator AS
SELECT t.transaction_id,
t.campaign,
t.payment_date,
t.inventory,
t.bus_size,
t.print_stage,
t.quantity,
t.operator_fee,
t.start_date,
t.end_date,
t.vendor,
t.operator,
t.platform,
t.transaction_status,
t.status_id,
t.vendor_id,
t.inventory_id,
t.platform_id,
t.operator_id,
t.bus_size_id,
v.vendor_id AS vendor_search_id,
v.name AS vendor_search_name
FROM public.view_transactions_all t,
public.view_vendors_operators v
WHERE (t.operator_id = v.operator_id);
ALTER TABLE public.view_transactions_per_operator OWNER TO postgres;
--
-- TOC entry 284 (class 1259 OID 54132)
-- Name: view_transactions_per_platform; Type: VIEW; Schema: public; Owner: postgres
--
CREATE VIEW public.view_transactions_per_platform AS
SELECT t.transaction_id,
t.campaign,
t.payment_date,
t.inventory,
t.bus_size,
t.print_stage,
t.quantity,
t.lamata_fee,
t.start_date,
t.end_date,
t.vendor,
t.operator,
t.platform,
t.transaction_status,
t.status_id,
t.vendor_id,
t.inventory_id,
t.platform_id,
t.operator_id,
t.bus_size_id,
v.vendor_id AS vendor_search_id,
v.name AS vendor_search_name
FROM public.view_transactions_all t,
public.view_vendors_operators v
WHERE ((t.operator_id = v.operator_id) AND (v.vendor_id = 18));
ALTER TABLE public.view_transactions_per_platform OWNER TO postgres;
--
-- TOC entry 285 (class 1259 OID 54137)
-- Name: w_vendors_operators_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE public.w_vendors_operators_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.w_vendors_operators_id_seq OWNER TO postgres;
--
-- TOC entry 3501 (class 0 OID 0)
-- Dependencies: 285
-- Name: w_vendors_operators_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE public.w_vendors_operators_id_seq OWNED BY public.w_vendors_operators.id;
--
-- TOC entry 286 (class 1259 OID 54139)
-- Name: x_bus_depot_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE public.x_bus_depot_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.x_bus_depot_id_seq OWNER TO postgres;
--
-- TOC entry 3502 (class 0 OID 0)
-- Dependencies: 286
-- Name: x_bus_depot_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE public.x_bus_depot_id_seq OWNED BY public.x_bus_depot.id;
--
-- TOC entry 287 (class 1259 OID 54141)
-- Name: x_bus_sizes_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE public.x_bus_sizes_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.x_bus_sizes_id_seq OWNER TO postgres;
--
-- TOC entry 3503 (class 0 OID 0)
-- Dependencies: 287
-- Name: x_bus_sizes_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE public.x_bus_sizes_id_seq OWNED BY public.x_bus_sizes.id;
--
-- TOC entry 288 (class 1259 OID 54143)
-- Name: x_bus_status_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE public.x_bus_status_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.x_bus_status_id_seq OWNER TO postgres;
--
-- TOC entry 3504 (class 0 OID 0)
-- Dependencies: 288
-- Name: x_bus_status_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE public.x_bus_status_id_seq OWNED BY public.x_bus_status.id;
--
-- TOC entry 289 (class 1259 OID 54145)
-- Name: x_payment_status_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE public.x_payment_status_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.x_payment_status_id_seq OWNER TO postgres;
--
-- TOC entry 3505 (class 0 OID 0)
-- Dependencies: 289
-- Name: x_payment_status_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE public.x_payment_status_id_seq OWNED BY public.x_payment_status.id;
--
-- TOC entry 290 (class 1259 OID 54147)
-- Name: x_print_stage_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE public.x_print_stage_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.x_print_stage_id_seq OWNER TO postgres;
--
-- TOC entry 3506 (class 0 OID 0)
-- Dependencies: 290
-- Name: x_print_stage_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE public.x_print_stage_id_seq OWNED BY public.x_print_stage.id;
--
-- TOC entry 291 (class 1259 OID 54149)
-- Name: x_print_status_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE public.x_print_status_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.x_print_status_id_seq OWNER TO postgres;
--
-- TOC entry 3507 (class 0 OID 0)
-- Dependencies: 291
-- Name: x_print_status_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE public.x_print_status_id_seq OWNED BY public.x_print_status.id;
--
-- TOC entry 292 (class 1259 OID 54151)
-- Name: x_renewal_stage; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.x_renewal_stage (
id integer NOT NULL,
name text NOT NULL
);
ALTER TABLE public.x_renewal_stage OWNER TO postgres;
--
-- TOC entry 293 (class 1259 OID 54157)
-- Name: x_renewal_stage_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE public.x_renewal_stage_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.x_renewal_stage_id_seq OWNER TO postgres;
--
-- TOC entry 3508 (class 0 OID 0)
-- Dependencies: 293
-- Name: x_renewal_stage_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE public.x_renewal_stage_id_seq OWNED BY public.x_renewal_stage.id;
--
-- TOC entry 294 (class 1259 OID 54159)
-- Name: x_report_types; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.x_report_types (
id integer NOT NULL,
name text
);
ALTER TABLE public.x_report_types OWNER TO postgres;
--
-- TOC entry 295 (class 1259 OID 54165)
-- Name: x_transaction_status_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE public.x_transaction_status_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.x_transaction_status_id_seq OWNER TO postgres;
--
-- TOC entry 3509 (class 0 OID 0)
-- Dependencies: 295
-- Name: x_transaction_status_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE public.x_transaction_status_id_seq OWNED BY public.x_transaction_status.id;
--
-- TOC entry 296 (class 1259 OID 54167)
-- Name: x_user_types_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE public.x_user_types_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.x_user_types_id_seq OWNER TO postgres;
--
-- TOC entry 3510 (class 0 OID 0)
-- Dependencies: 296
-- Name: x_user_types_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE public.x_user_types_id_seq OWNED BY public.x_user_types.id;
--
-- TOC entry 297 (class 1259 OID 54169)
-- Name: y_inventory_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE public.y_inventory_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.y_inventory_id_seq OWNER TO postgres;
--
-- TOC entry 3511 (class 0 OID 0)
-- Dependencies: 297
-- Name: y_inventory_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE public.y_inventory_id_seq OWNED BY public.y_inventory.id;
--
-- TOC entry 298 (class 1259 OID 54171)
-- Name: y_operators_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE public.y_operators_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.y_operators_id_seq OWNER TO postgres;
--
-- TOC entry 3512 (class 0 OID 0)
-- Dependencies: 298
-- Name: y_operators_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE public.y_operators_id_seq OWNED BY public.y_operators.id;
--
-- TOC entry 299 (class 1259 OID 54173)
-- Name: y_platforms_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE public.y_platforms_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.y_platforms_id_seq OWNER TO postgres;
--
-- TOC entry 3513 (class 0 OID 0)
-- Dependencies: 299
-- Name: y_platforms_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE public.y_platforms_id_seq OWNED BY public.y_platforms.id;
--
-- TOC entry 300 (class 1259 OID 54175)
-- Name: y_printers; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.y_printers (
id integer NOT NULL,
name text,
passcode character varying(5),
email text
);
ALTER TABLE public.y_printers OWNER TO postgres;
--
-- TOC entry 301 (class 1259 OID 54181)
-- Name: y_printers_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE public.y_printers_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.y_printers_id_seq OWNER TO postgres;
--
-- TOC entry 3514 (class 0 OID 0)
-- Dependencies: 301
-- Name: y_printers_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE public.y_printers_id_seq OWNED BY public.y_printers.id;
--
-- TOC entry 302 (class 1259 OID 54183)
-- Name: y_vendors_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE public.y_vendors_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.y_vendors_id_seq OWNER TO postgres;
--
-- TOC entry 3515 (class 0 OID 0)
-- Dependencies: 302
-- Name: y_vendors_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE public.y_vendors_id_seq OWNED BY public.y_vendors.id;
--
-- TOC entry 303 (class 1259 OID 54185)
-- Name: z_core_settings; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.z_core_settings (
id integer NOT NULL,
name character varying NOT NULL,
value character varying NOT NULL
);
ALTER TABLE public.z_core_settings OWNER TO postgres;
--
-- TOC entry 304 (class 1259 OID 54191)
-- Name: z_core_settings_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE public.z_core_settings_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.z_core_settings_id_seq OWNER TO postgres;
--
-- TOC entry 3516 (class 0 OID 0)
-- Dependencies: 304
-- Name: z_core_settings_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE public.z_core_settings_id_seq OWNED BY public.z_core_settings.id;
--
-- TOC entry 305 (class 1259 OID 54193)
-- Name: z_email_settings; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.z_email_settings (
id integer NOT NULL,
name character varying(60) NOT NULL,
description text,
to_value text,
cc_value text,
bcc_value text
);
ALTER TABLE public.z_email_settings OWNER TO postgres;
--
-- TOC entry 306 (class 1259 OID 54199)
-- Name: z_email_settings_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE public.z_email_settings_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.z_email_settings_id_seq OWNER TO postgres;
--
-- TOC entry 3517 (class 0 OID 0)
-- Dependencies: 306
-- Name: z_email_settings_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE public.z_email_settings_id_seq OWNED BY public.z_email_settings.id;
--
-- TOC entry 307 (class 1259 OID 54201)
-- Name: z_price_settings_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE public.z_price_settings_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.z_price_settings_id_seq OWNER TO postgres;
--
-- TOC entry 3518 (class 0 OID 0)
-- Dependencies: 307
-- Name: z_price_settings_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE public.z_price_settings_id_seq OWNED BY public.z_price_settings.id;
--
-- TOC entry 3091 (class 2604 OID 51559)
-- Name: bus_depot id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.bus_depot ALTER COLUMN id SET DEFAULT nextval('public.bus_depot_id_seq'::regclass);
--
-- TOC entry 3096 (class 2604 OID 51560)
-- Name: bus_status id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.bus_status ALTER COLUMN id SET DEFAULT nextval('public.bus_status_id_seq'::regclass);
--
-- TOC entry 3095 (class 2604 OID 51561)
-- Name: buses id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.buses ALTER COLUMN id SET DEFAULT nextval('public.buses_id_seq'::regclass);
--
-- TOC entry 3106 (class 2604 OID 51562)
-- Name: campaign_status id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.campaign_status ALTER COLUMN id SET DEFAULT nextval('public.campaign_status_id_seq'::regclass);
--
-- TOC entry 3107 (class 2604 OID 51563)
-- Name: core_settings id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.core_settings ALTER COLUMN id SET DEFAULT nextval('public.core_settings_id_seq'::regclass);
--
-- TOC entry 3108 (class 2604 OID 51564)
-- Name: discounts id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.discounts ALTER COLUMN id SET DEFAULT nextval('public.discounts_id_seq'::regclass);
--
-- TOC entry 3109 (class 2604 OID 51565)
-- Name: email_settings id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.email_settings ALTER COLUMN id SET DEFAULT nextval('public.email_settings_id_seq'::regclass);
--
-- TOC entry 3103 (class 2604 OID 51566)
-- Name: exterior_campaigns id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.exterior_campaigns ALTER COLUMN id SET DEFAULT nextval('public.exterior_campaigns_id_seq'::regclass);
--
-- TOC entry 3111 (class 2604 OID 51567)
-- Name: exterior_reports id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.exterior_reports ALTER COLUMN id SET DEFAULT nextval('public.exterior_reports_id_seq'::regclass);
--
-- TOC entry 3125 (class 2604 OID 54203)
-- Name: main_buses id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.main_buses ALTER COLUMN id SET DEFAULT nextval('public.main_buses_id_seq'::regclass);
--
-- TOC entry 3129 (class 2604 OID 54204)
-- Name: main_campaigns id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.main_campaigns ALTER COLUMN id SET DEFAULT nextval('public.main_campaigns_id_seq'::regclass);
--
-- TOC entry 3133 (class 2604 OID 54205)
-- Name: main_print_orders id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.main_print_orders ALTER COLUMN id SET DEFAULT nextval('public.main_print_orders_id_seq'::regclass);
--
-- TOC entry 3135 (class 2604 OID 54206)
-- Name: main_reports id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.main_reports ALTER COLUMN id SET DEFAULT nextval('public.main_reports_id_seq'::regclass);
--
-- TOC entry 3141 (class 2604 OID 54207)
-- Name: main_transactions id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.main_transactions ALTER COLUMN id SET DEFAULT nextval('public.main_transactions_id_seq'::regclass);
--
-- TOC entry 3142 (class 2604 OID 54208)
-- Name: main_users id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.main_users ALTER COLUMN id SET DEFAULT nextval('public.main_users_id_seq'::regclass);
--
-- TOC entry 3113 (class 2604 OID 51568)
-- Name: payment_status id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.payment_status ALTER COLUMN id SET DEFAULT nextval('public.payment_status_id_seq'::regclass);
--
-- TOC entry 3118 (class 2604 OID 51569)
-- Name: print_orders id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.print_orders ALTER COLUMN id SET DEFAULT nextval('public.print_orders_id_seq'::regclass);
--
-- TOC entry 3114 (class 2604 OID 51570)
-- Name: print_status id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.print_status ALTER COLUMN id SET DEFAULT nextval('public.print_status_id_seq'::regclass);
--
-- TOC entry 3119 (class 2604 OID 51571)
-- Name: printers id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.printers ALTER COLUMN id SET DEFAULT nextval('public.printers_id_seq'::regclass);
--
-- TOC entry 3120 (class 2604 OID 51572)
-- Name: report_types id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.report_types ALTER COLUMN id SET DEFAULT nextval('public.report_types_id_seq'::regclass);
--
-- TOC entry 3146 (class 2604 OID 54209)
-- Name: sub_media_allocation id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.sub_media_allocation ALTER COLUMN id SET DEFAULT nextval('public.sub_media_allocation_id_seq'::regclass);
--
-- TOC entry 3147 (class 2604 OID 54210)
-- Name: sub_renewal_requests id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.sub_renewal_requests ALTER COLUMN id SET DEFAULT nextval('public.sub_renewal_requests_id_seq'::regclass);
--
-- TOC entry 3150 (class 2604 OID 54211)
-- Name: sub_transaction_details id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.sub_transaction_details ALTER COLUMN id SET DEFAULT nextval('public.sub_transaction_details_id_seq'::regclass);
--
-- TOC entry 3121 (class 2604 OID 51573)
-- Name: user_types id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.user_types ALTER COLUMN id SET DEFAULT nextval('public.user_types_id_seq'::regclass);
--
-- TOC entry 3105 (class 2604 OID 51574)
-- Name: users id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.users ALTER COLUMN id SET DEFAULT nextval('public.users_id_seq'::regclass);
--
-- TOC entry 3112 (class 2604 OID 51575)
-- Name: vendors id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.vendors ALTER COLUMN id SET DEFAULT nextval('public.vendors_id_seq'::regclass);
--
-- TOC entry 3166 (class 2604 OID 54212)
-- Name: w_vendors_operators id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.w_vendors_operators ALTER COLUMN id SET DEFAULT nextval('public.w_vendors_operators_id_seq'::regclass);
--
-- TOC entry 3151 (class 2604 OID 54213)
-- Name: x_bus_depot id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.x_bus_depot ALTER COLUMN id SET DEFAULT nextval('public.x_bus_depot_id_seq'::regclass);
--
-- TOC entry 3152 (class 2604 OID 54214)
-- Name: x_bus_sizes id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.x_bus_sizes ALTER COLUMN id SET DEFAULT nextval('public.x_bus_sizes_id_seq'::regclass);
--
-- TOC entry 3153 (class 2604 OID 54215)
-- Name: x_bus_status id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.x_bus_status ALTER COLUMN id SET DEFAULT nextval('public.x_bus_status_id_seq'::regclass);
--
-- TOC entry 3157 (class 2604 OID 54216)
-- Name: x_payment_status id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.x_payment_status ALTER COLUMN id SET DEFAULT nextval('public.x_payment_status_id_seq'::regclass);
--
-- TOC entry 3158 (class 2604 OID 54217)
-- Name: x_print_stage id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.x_print_stage ALTER COLUMN id SET DEFAULT nextval('public.x_print_stage_id_seq'::regclass);
--
-- TOC entry 3165 (class 2604 OID 54218)
-- Name: x_print_status id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.x_print_status ALTER COLUMN id SET DEFAULT nextval('public.x_print_status_id_seq'::regclass);
--
-- TOC entry 3167 (class 2604 OID 54219)
-- Name: x_renewal_stage id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.x_renewal_stage ALTER COLUMN id SET DEFAULT nextval('public.x_renewal_stage_id_seq'::regclass);
--
-- TOC entry 3159 (class 2604 OID 54220)
-- Name: x_transaction_status id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.x_transaction_status ALTER COLUMN id SET DEFAULT nextval('public.x_transaction_status_id_seq'::regclass);
--
-- TOC entry 3164 (class 2604 OID 54221)
-- Name: x_user_types id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.x_user_types ALTER COLUMN id SET DEFAULT nextval('public.x_user_types_id_seq'::regclass);
--
-- TOC entry 3160 (class 2604 OID 54222)
-- Name: y_inventory id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.y_inventory ALTER COLUMN id SET DEFAULT nextval('public.y_inventory_id_seq'::regclass);
--
-- TOC entry 3154 (class 2604 OID 54223)
-- Name: y_operators id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.y_operators ALTER COLUMN id SET DEFAULT nextval('public.y_operators_id_seq'::regclass);
--
-- TOC entry 3155 (class 2604 OID 54224)
-- Name: y_platforms id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.y_platforms ALTER COLUMN id SET DEFAULT nextval('public.y_platforms_id_seq'::regclass);
--
-- TOC entry 3168 (class 2604 OID 54225)
-- Name: y_printers id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.y_printers ALTER COLUMN id SET DEFAULT nextval('public.y_printers_id_seq'::regclass);
--
-- TOC entry 3156 (class 2604 OID 54226)
-- Name: y_vendors id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.y_vendors ALTER COLUMN id SET DEFAULT nextval('public.y_vendors_id_seq'::regclass);
--
-- TOC entry 3169 (class 2604 OID 54227)
-- Name: z_core_settings id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.z_core_settings ALTER COLUMN id SET DEFAULT nextval('public.z_core_settings_id_seq'::regclass);
--
-- TOC entry 3170 (class 2604 OID 54228)
-- Name: z_email_settings id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.z_email_settings ALTER COLUMN id SET DEFAULT nextval('public.z_email_settings_id_seq'::regclass);
--
-- TOC entry 3163 (class 2604 OID 54229)
-- Name: z_price_settings id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.z_price_settings ALTER COLUMN id SET DEFAULT nextval('public.z_price_settings_id_seq'::regclass);
--
-- TOC entry 3243 (class 2606 OID 54231)
-- Name: sub_media_allocation allocation_bus_campaign_uk; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.sub_media_allocation
ADD CONSTRAINT allocation_bus_campaign_uk UNIQUE (bus_id, campaign_id);
--
-- TOC entry 3172 (class 2606 OID 51577)
-- Name: bus_depot bus_depot_pk; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.bus_depot
ADD CONSTRAINT bus_depot_pk PRIMARY KEY (id);
--
-- TOC entry 3174 (class 2606 OID 51579)
-- Name: bus_depot bus_depot_unique; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.bus_depot
ADD CONSTRAINT bus_depot_unique UNIQUE (name);
--
-- TOC entry 3180 (class 2606 OID 51581)
-- Name: bus_status bus_status_name_key; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.bus_status
ADD CONSTRAINT bus_status_name_key UNIQUE (name);
--
-- TOC entry 3182 (class 2606 OID 51583)
-- Name: bus_status bus_status_pk; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.bus_status
ADD CONSTRAINT bus_status_pk PRIMARY KEY (id);
--
-- TOC entry 3176 (class 2606 OID 51585)
-- Name: buses buses_number_key; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.buses
ADD CONSTRAINT buses_number_key UNIQUE (number);
--
-- TOC entry 3178 (class 2606 OID 51587)
-- Name: buses buses_pk; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.buses
ADD CONSTRAINT buses_pk PRIMARY KEY (id);
--
-- TOC entry 3194 (class 2606 OID 51589)
-- Name: campaign_status campaign_status_name_key; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.campaign_status
ADD CONSTRAINT campaign_status_name_key UNIQUE (name);
--
-- TOC entry 3196 (class 2606 OID 51591)
-- Name: campaign_status campaign_status_pk; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.campaign_status
ADD CONSTRAINT campaign_status_pk PRIMARY KEY (id);
--
-- TOC entry 3198 (class 2606 OID 51593)
-- Name: discounts discounts_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.discounts
ADD CONSTRAINT discounts_pkey PRIMARY KEY (id);
--
-- TOC entry 3200 (class 2606 OID 51595)
-- Name: email_settings email_settings_name_uk; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.email_settings
ADD CONSTRAINT email_settings_name_uk UNIQUE (name);
--
-- TOC entry 3202 (class 2606 OID 51597)
-- Name: email_settings email_settings_pk; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.email_settings
ADD CONSTRAINT email_settings_pk PRIMARY KEY (id);
--
-- TOC entry 3184 (class 2606 OID 51599)
-- Name: exterior_campaigns exterior_campaigns_pk; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.exterior_campaigns
ADD CONSTRAINT exterior_campaigns_pk PRIMARY KEY (id);
--
-- TOC entry 3204 (class 2606 OID 51601)
-- Name: exterior_reports exterior_reports_pk; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.exterior_reports
ADD CONSTRAINT exterior_reports_pk PRIMARY KEY (id);
--
-- TOC entry 3229 (class 2606 OID 54233)
-- Name: main_buses main_buses_id_pk; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.main_buses
ADD CONSTRAINT main_buses_id_pk PRIMARY KEY (id);
--
-- TOC entry 3231 (class 2606 OID 54235)
-- Name: main_buses main_buses_number_uk; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.main_buses
ADD CONSTRAINT main_buses_number_uk UNIQUE (number);
--
-- TOC entry 3233 (class 2606 OID 54237)
-- Name: main_campaigns main_campaigns_id_pk; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.main_campaigns
ADD CONSTRAINT main_campaigns_id_pk PRIMARY KEY (id);
--
-- TOC entry 3237 (class 2606 OID 54239)
-- Name: main_reports main_exterior_reports_id_pk; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.main_reports
ADD CONSTRAINT main_exterior_reports_id_pk PRIMARY KEY (id);
--
-- TOC entry 3235 (class 2606 OID 54241)
-- Name: main_print_orders main_print_orders_pk; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.main_print_orders
ADD CONSTRAINT main_print_orders_pk PRIMARY KEY (id);
--
-- TOC entry 3239 (class 2606 OID 54243)
-- Name: main_transactions main_transactions_id_pk; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.main_transactions
ADD CONSTRAINT main_transactions_id_pk PRIMARY KEY (id);
--
-- TOC entry 3241 (class 2606 OID 54245)
-- Name: main_users main_users_id_pk; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.main_users
ADD CONSTRAINT main_users_id_pk PRIMARY KEY (id);
--
-- TOC entry 3210 (class 2606 OID 51603)
-- Name: payment_status payment_status_name_key; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.payment_status
ADD CONSTRAINT payment_status_name_key UNIQUE (name);
--
-- TOC entry 3212 (class 2606 OID 51605)
-- Name: payment_status payment_status_pk; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.payment_status
ADD CONSTRAINT payment_status_pk PRIMARY KEY (id);
--
-- TOC entry 3218 (class 2606 OID 51607)
-- Name: print_orders print_orders_pk0; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.print_orders
ADD CONSTRAINT print_orders_pk0 PRIMARY KEY (id);
--
-- TOC entry 3220 (class 2606 OID 51609)
-- Name: print_orders print_orders_uk0; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.print_orders
ADD CONSTRAINT print_orders_uk0 UNIQUE (campaign_id, printer_id);
--
-- TOC entry 3214 (class 2606 OID 51611)
-- Name: print_status print_status_name_key; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.print_status
ADD CONSTRAINT print_status_name_key UNIQUE (name);
--
-- TOC entry 3216 (class 2606 OID 51613)
-- Name: print_status print_status_pk; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.print_status
ADD CONSTRAINT print_status_pk PRIMARY KEY (id);
--
-- TOC entry 3222 (class 2606 OID 51615)
-- Name: printers printers_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.printers
ADD CONSTRAINT printers_pkey PRIMARY KEY (id);
--
-- TOC entry 3224 (class 2606 OID 51617)
-- Name: report_types report_types_pk; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.report_types
ADD CONSTRAINT report_types_pk PRIMARY KEY (id);
--
-- TOC entry 3245 (class 2606 OID 54247)
-- Name: sub_media_allocation sub_media_allocation_id_pk; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.sub_media_allocation
ADD CONSTRAINT sub_media_allocation_id_pk PRIMARY KEY (id);
--
-- TOC entry 3247 (class 2606 OID 54249)
-- Name: sub_renewal_requests sub_renewal_requests_id_pk; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.sub_renewal_requests
ADD CONSTRAINT sub_renewal_requests_id_pk PRIMARY KEY (id);
--
-- TOC entry 3249 (class 2606 OID 54251)
-- Name: sub_transaction_details sub_transaction_details_id_pk; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.sub_transaction_details
ADD CONSTRAINT sub_transaction_details_id_pk PRIMARY KEY (id);
--
-- TOC entry 3226 (class 2606 OID 51619)
-- Name: user_types user_types_pk; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.user_types
ADD CONSTRAINT user_types_pk PRIMARY KEY (id);
--
-- TOC entry 3186 (class 2606 OID 51621)
-- Name: users users_email_key; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.users
ADD CONSTRAINT users_email_key UNIQUE (email);
--
-- TOC entry 3188 (class 2606 OID 51623)
-- Name: users users_name_key; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.users
ADD CONSTRAINT users_name_key UNIQUE (name);
--
-- TOC entry 3190 (class 2606 OID 51625)
-- Name: users users_pk; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.users
ADD CONSTRAINT users_pk PRIMARY KEY (id);
--
-- TOC entry 3192 (class 2606 OID 51627)
-- Name: users users_username_key; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.users
ADD CONSTRAINT users_username_key UNIQUE (username);
--
-- TOC entry 3206 (class 2606 OID 51629)
-- Name: vendors vendors_name_key; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.vendors
ADD CONSTRAINT vendors_name_key UNIQUE (name);
--
-- TOC entry 3208 (class 2606 OID 51631)
-- Name: vendors vendors_pk; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.vendors
ADD CONSTRAINT vendors_pk PRIMARY KEY (id);
--
-- TOC entry 3285 (class 2606 OID 54253)
-- Name: w_vendors_operators w_vendors_operators_id_pk; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.w_vendors_operators
ADD CONSTRAINT w_vendors_operators_id_pk PRIMARY KEY (id);
--
-- TOC entry 3251 (class 2606 OID 54255)
-- Name: x_bus_depot x_bus_depot_pk; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.x_bus_depot
ADD CONSTRAINT x_bus_depot_pk PRIMARY KEY (id);
--
-- TOC entry 3253 (class 2606 OID 54257)
-- Name: x_bus_depot x_bus_depot_unique; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.x_bus_depot
ADD CONSTRAINT x_bus_depot_unique UNIQUE (name);
--
-- TOC entry 3255 (class 2606 OID 54259)
-- Name: x_bus_sizes x_bus_sizes_id_pk; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.x_bus_sizes
ADD CONSTRAINT x_bus_sizes_id_pk PRIMARY KEY (id);
--
-- TOC entry 3257 (class 2606 OID 54261)
-- Name: x_bus_status x_bus_status_name_key; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.x_bus_status
ADD CONSTRAINT x_bus_status_name_key UNIQUE (name);
--
-- TOC entry 3259 (class 2606 OID 54263)
-- Name: x_bus_status x_bus_status_pk; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.x_bus_status
ADD CONSTRAINT x_bus_status_pk PRIMARY KEY (id);
--
-- TOC entry 3273 (class 2606 OID 54265)
-- Name: x_transaction_status x_campaign_status_pk; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.x_transaction_status
ADD CONSTRAINT x_campaign_status_pk PRIMARY KEY (id);
--
-- TOC entry 3267 (class 2606 OID 54267)
-- Name: x_payment_status x_payment_status_name_key; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.x_payment_status
ADD CONSTRAINT x_payment_status_name_key UNIQUE (name);
--
-- TOC entry 3269 (class 2606 OID 54269)
-- Name: x_payment_status x_payment_status_pk; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.x_payment_status
ADD CONSTRAINT x_payment_status_pk PRIMARY KEY (id);
--
-- TOC entry 3271 (class 2606 OID 54271)
-- Name: x_print_stage x_print_stage_id_pk; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.x_print_stage
ADD CONSTRAINT x_print_stage_id_pk PRIMARY KEY (id);
--
-- TOC entry 3281 (class 2606 OID 54273)
-- Name: x_print_status x_print_status_name_key; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.x_print_status
ADD CONSTRAINT x_print_status_name_key UNIQUE (name);
--
-- TOC entry 3283 (class 2606 OID 54275)
-- Name: x_print_status x_print_status_pk; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.x_print_status
ADD CONSTRAINT x_print_status_pk PRIMARY KEY (id);
--
-- TOC entry 3287 (class 2606 OID 54277)
-- Name: x_renewal_stage x_renewal_stage_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.x_renewal_stage
ADD CONSTRAINT x_renewal_stage_pkey PRIMARY KEY (id);
--
-- TOC entry 3289 (class 2606 OID 54279)
-- Name: x_report_types x_report_types_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.x_report_types
ADD CONSTRAINT x_report_types_pkey PRIMARY KEY (id);
--
-- TOC entry 3279 (class 2606 OID 54281)
-- Name: x_user_types x_user_types_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.x_user_types
ADD CONSTRAINT x_user_types_pkey PRIMARY KEY (id);
--
-- TOC entry 3275 (class 2606 OID 54283)
-- Name: y_inventory y_inventory_id_pk; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.y_inventory
ADD CONSTRAINT y_inventory_id_pk PRIMARY KEY (id);
--
-- TOC entry 3261 (class 2606 OID 54285)
-- Name: y_operators y_operator_id_pk; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.y_operators
ADD CONSTRAINT y_operator_id_pk PRIMARY KEY (id);
--
-- TOC entry 3263 (class 2606 OID 54287)
-- Name: y_platforms y_platform_id_pk; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.y_platforms
ADD CONSTRAINT y_platform_id_pk PRIMARY KEY (id);
--
-- TOC entry 3291 (class 2606 OID 54289)
-- Name: y_printers y_printers_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.y_printers
ADD CONSTRAINT y_printers_pkey PRIMARY KEY (id);
--
-- TOC entry 3265 (class 2606 OID 54291)
-- Name: y_vendors y_vendors_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.y_vendors
ADD CONSTRAINT y_vendors_pkey PRIMARY KEY (id);
--
-- TOC entry 3293 (class 2606 OID 54293)
-- Name: z_core_settings z_core_settings_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.z_core_settings
ADD CONSTRAINT z_core_settings_pkey PRIMARY KEY (id);
--
-- TOC entry 3295 (class 2606 OID 54295)
-- Name: z_email_settings z_email_settings_name_uk; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.z_email_settings
ADD CONSTRAINT z_email_settings_name_uk UNIQUE (name);
--
-- TOC entry 3297 (class 2606 OID 54297)
-- Name: z_email_settings z_email_settings_pk; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.z_email_settings
ADD CONSTRAINT z_email_settings_pk PRIMARY KEY (id);
--
-- TOC entry 3277 (class 2606 OID 54299)
-- Name: z_price_settings z_pricing_id_pk; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.z_price_settings
ADD CONSTRAINT z_pricing_id_pk PRIMARY KEY (id);
--
-- TOC entry 3227 (class 1259 OID 54300)
-- Name: fki_main_buses_depot_fk; Type: INDEX; Schema: public; Owner: postgres
--
CREATE INDEX fki_main_buses_depot_fk ON public.main_buses USING btree (bus_depot_id);
--
-- TOC entry 3458 (class 2618 OID 54037)
-- Name: view_campaign_status _RETURN; Type: RULE; Schema: public; Owner: postgres
--
CREATE OR REPLACE VIEW public.view_campaign_status AS
SELECT v.id,
v.name,
v.pending,
v.approved,
v.denied,
CASE
WHEN ((v.pending > 0) OR ((v.denied + v.approved) = 0)) THEN 'PENDING'::text
ELSE
CASE
WHEN ((v.denied > 0) AND (v.approved = 0)) THEN 'DENIED'::text
WHEN ((v.denied = 0) AND (v.approved > 0)) THEN 'APPROVED'::text
ELSE 'APPROVED'::text
END
END AS status,
array_to_string(ARRAY[v.approved, v.pending, v.denied], ','::text, '*'::text) AS status_matrix,
(((((('{"approved":'::text || v.approved) || ',"pending":'::text) || v.pending) || ',"denied":'::text) || v.denied) || '}'::text) AS status_json
FROM ( SELECT c.id,
c.name,
count(
CASE
WHEN (t.status_id = ANY (ARRAY[1, 4])) THEN 1
ELSE NULL::integer
END) AS pending,
count(
CASE
WHEN (t.status_id = ANY (ARRAY[2, 5])) THEN 1
ELSE NULL::integer
END) AS approved,
count(
CASE
WHEN (t.status_id = 3) THEN 1
ELSE NULL::integer
END) AS denied
FROM (public.main_campaigns c
LEFT JOIN public.main_transactions t ON ((c.id = t.campaign_id)))
GROUP BY c.id) v
ORDER BY v.pending DESC;
--
-- TOC entry 3325 (class 2606 OID 54302)
-- Name: sub_media_allocation allocation_bus_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.sub_media_allocation
ADD CONSTRAINT allocation_bus_id_fk FOREIGN KEY (bus_id) REFERENCES public.main_buses(id);
--
-- TOC entry 3326 (class 2606 OID 54307)
-- Name: sub_media_allocation allocation_campaign_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.sub_media_allocation
ADD CONSTRAINT allocation_campaign_id_fk FOREIGN KEY (campaign_id) REFERENCES public.main_campaigns(id);
--
-- TOC entry 3319 (class 2606 OID 54312)
-- Name: main_campaigns bus_size_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.main_campaigns
ADD CONSTRAINT bus_size_id_fk FOREIGN KEY (bus_size_id) REFERENCES public.x_bus_sizes(id);
--
-- TOC entry 3298 (class 2606 OID 51632)
-- Name: buses buses_depot_fk; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.buses
ADD CONSTRAINT buses_depot_fk FOREIGN KEY (bus_depot_id) REFERENCES public.bus_depot(id);
--
-- TOC entry 3299 (class 2606 OID 51637)
-- Name: buses buses_fk1; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.buses
ADD CONSTRAINT buses_fk1 FOREIGN KEY (exterior_campaign_id) REFERENCES public.exterior_campaigns(id) ON DELETE SET NULL;
--
-- TOC entry 3300 (class 2606 OID 51642)
-- Name: buses buses_fk3; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.buses
ADD CONSTRAINT buses_fk3 FOREIGN KEY (bus_status_id) REFERENCES public.bus_status(id);
--
-- TOC entry 3311 (class 2606 OID 51647)
-- Name: print_orders exterior_campaign_fk0; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.print_orders
ADD CONSTRAINT exterior_campaign_fk0 FOREIGN KEY (campaign_id) REFERENCES public.exterior_campaigns(id);
--
-- TOC entry 3301 (class 2606 OID 51652)
-- Name: exterior_campaigns exterior_campaigns_fk1; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.exterior_campaigns
ADD CONSTRAINT exterior_campaigns_fk1 FOREIGN KEY (created_by) REFERENCES public.users(id);
--
-- TOC entry 3302 (class 2606 OID 51657)
-- Name: exterior_campaigns exterior_campaigns_fk2; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.exterior_campaigns
ADD CONSTRAINT exterior_campaigns_fk2 FOREIGN KEY (vendor_id) REFERENCES public.vendors(id);
--
-- TOC entry 3303 (class 2606 OID 51662)
-- Name: exterior_campaigns exterior_campaigns_fk3; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.exterior_campaigns
ADD CONSTRAINT exterior_campaigns_fk3 FOREIGN KEY (status_id) REFERENCES public.campaign_status(id);
--
-- TOC entry 3304 (class 2606 OID 51667)
-- Name: exterior_campaigns exterior_campaigns_fk4; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.exterior_campaigns
ADD CONSTRAINT exterior_campaigns_fk4 FOREIGN KEY (print_status_id) REFERENCES public.print_status(id);
--
-- TOC entry 3305 (class 2606 OID 51672)
-- Name: exterior_campaigns exterior_campaigns_fk5; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.exterior_campaigns
ADD CONSTRAINT exterior_campaigns_fk5 FOREIGN KEY (payment_status_id) REFERENCES public.payment_status(id);
--
-- TOC entry 3308 (class 2606 OID 51677)
-- Name: exterior_reports exterior_reports_fk0; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.exterior_reports
ADD CONSTRAINT exterior_reports_fk0 FOREIGN KEY (vendor_id) REFERENCES public.vendors(id);
--
-- TOC entry 3309 (class 2606 OID 51682)
-- Name: exterior_reports exterior_reports_fk1; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.exterior_reports
ADD CONSTRAINT exterior_reports_fk1 FOREIGN KEY (ref_bus_id) REFERENCES public.buses(id);
--
-- TOC entry 3323 (class 2606 OID 54317)
-- Name: main_reports exterior_reports_fk1; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.main_reports
ADD CONSTRAINT exterior_reports_fk1 FOREIGN KEY (ref_bus_id) REFERENCES public.main_buses(id);
--
-- TOC entry 3310 (class 2606 OID 51687)
-- Name: exterior_reports exterior_reports_fk2; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.exterior_reports
ADD CONSTRAINT exterior_reports_fk2 FOREIGN KEY (campaign_id) REFERENCES public.exterior_campaigns(id);
--
-- TOC entry 3324 (class 2606 OID 54322)
-- Name: main_reports exterior_reports_fk2; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.main_reports
ADD CONSTRAINT exterior_reports_fk2 FOREIGN KEY (campaign_id) REFERENCES public.main_campaigns(id);
--
-- TOC entry 3320 (class 2606 OID 54327)
-- Name: main_campaigns inventory_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.main_campaigns
ADD CONSTRAINT inventory_id_fk FOREIGN KEY (inventory_id) REFERENCES public.y_inventory(id);
--
-- TOC entry 3313 (class 2606 OID 54332)
-- Name: main_buses main_buses_depot_fk; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.main_buses
ADD CONSTRAINT main_buses_depot_fk FOREIGN KEY (bus_depot_id) REFERENCES public.x_bus_depot(id);
--
-- TOC entry 3314 (class 2606 OID 54337)
-- Name: main_buses main_buses_fk0; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.main_buses
ADD CONSTRAINT main_buses_fk0 FOREIGN KEY (operator_id) REFERENCES public.y_operators(id);
--
-- TOC entry 3315 (class 2606 OID 54342)
-- Name: main_buses main_buses_fk1; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.main_buses
ADD CONSTRAINT main_buses_fk1 FOREIGN KEY (exterior_campaign_id) REFERENCES public.main_campaigns(id) ON DELETE SET NULL;
--
-- TOC entry 3316 (class 2606 OID 54347)
-- Name: main_buses main_buses_fk2; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.main_buses
ADD CONSTRAINT main_buses_fk2 FOREIGN KEY (interior_campaign_id) REFERENCES public.main_campaigns(id);
--
-- TOC entry 3317 (class 2606 OID 54352)
-- Name: main_buses main_buses_fk3; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.main_buses
ADD CONSTRAINT main_buses_fk3 FOREIGN KEY (bus_status_id) REFERENCES public.x_bus_status(id);
--
-- TOC entry 3318 (class 2606 OID 54357)
-- Name: main_buses main_buses_fk4; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.main_buses
ADD CONSTRAINT main_buses_fk4 FOREIGN KEY (operator_id) REFERENCES public.y_operators(id);
--
-- TOC entry 3327 (class 2606 OID 54362)
-- Name: y_operators operator_platorm_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.y_operators
ADD CONSTRAINT operator_platorm_id_fk FOREIGN KEY (platform_id) REFERENCES public.y_platforms(id);
--
-- TOC entry 3321 (class 2606 OID 54367)
-- Name: main_campaigns platform_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.main_campaigns
ADD CONSTRAINT platform_id_fk FOREIGN KEY (platform_id) REFERENCES public.y_platforms(id);
--
-- TOC entry 3322 (class 2606 OID 54372)
-- Name: main_campaigns pricing_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.main_campaigns
ADD CONSTRAINT pricing_id_fk FOREIGN KEY (price_id) REFERENCES public.z_price_settings(id);
--
-- TOC entry 3312 (class 2606 OID 51692)
-- Name: print_orders printer_id_fk0; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.print_orders
ADD CONSTRAINT printer_id_fk0 FOREIGN KEY (printer_id) REFERENCES public.printers(id);
--
-- TOC entry 3306 (class 2606 OID 51697)
-- Name: users users_fk0; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.users
ADD CONSTRAINT users_fk0 FOREIGN KEY (user_type) REFERENCES public.user_types(id);
--
-- TOC entry 3307 (class 2606 OID 51702)
-- Name: users users_fk1; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.users
ADD CONSTRAINT users_fk1 FOREIGN KEY (vendor_id) REFERENCES public.vendors(id);
-- Completed on 2020-12-09 11:57:25
--
-- PostgreSQL database dump complete
--
| true |
22b7583aef104f974dd9e2bb7836692e3748f72f
|
SQL
|
tomyqg/knxBase
|
/apps/erm/shop/rsrc/sql/views.sql
|
UTF-8
| 356 | 3.359375 | 3 |
[
"MIT"
] |
permissive
|
#
#
#
DROP VIEW IF EXISTS v_ArticleSalesPriceCacheForShop ;
CREATE VIEW v_ArticleSalesPriceCacheForShop AS
SELECT ASPC.*, ROUND( ASPC.Price * (100.0 + T.Percentage) / 100.0, 2) AS SalesPriceTaxIn FROM ArticleSalesPriceCache AS ASPC
LEFT JOIN Article AS A ON A.ArticleNo = ASPC.ArticleNo
LEFT JOIN Tax AS T ON T.TaxClass = A.TaxClass
;
| true |
212d77123e76690e2adba696321b623de31f133d
|
SQL
|
danilov-v/schedule
|
/backend/src/main/resources/db/migrations/changes/initSchema.h2.sql
|
UTF-8
| 3,309 | 3.78125 | 4 |
[] |
no_license
|
--liquibase formatted sql logicalFilePath:initSchema.h2.sql
--changeset gonchar:EVENT-1
CREATE TABLE EVENT (EVENT_ID BIGINT AUTO_INCREMENT NOT NULL, DATE_FROM date NOT NULL, NOTE VARCHAR(10000), UNIT_ID BIGINT NOT NULL, EVENT_TYPE_ID BIGINT NOT NULL, DATE_TO date NOT NULL, CONSTRAINT CONSTRAINT_3 PRIMARY KEY (EVENT_ID));
--changeset gonchar:EVENT_DURATION-2
CREATE TABLE EVENT_DURATION (DURATION INT, UNIT_ID BIGINT NOT NULL, EVENT_TYPE_ID BIGINT NOT NULL);
--changeset gonchar:EVENT_TYPE-3
CREATE TABLE EVENT_TYPE (TYPE_ID BIGINT AUTO_INCREMENT NOT NULL, COLOR VARCHAR(255) NOT NULL, DESCRIPTION VARCHAR(255) NOT NULL, TYPE_CODE VARCHAR(255), CONSTRAINT CONSTRAINT_5 PRIMARY KEY (TYPE_ID));
--changeset gonchar:PERIOD-4
CREATE TABLE PERIOD (PERIOD_ID BIGINT AUTO_INCREMENT NOT NULL, NAME VARCHAR(255) NOT NULL, START_DATE date NOT NULL, END_DATE date NOT NULL, CONSTRAINT CONSTRAINT_8 PRIMARY KEY (PERIOD_ID));
--changeset gonchar:UNIT-5
CREATE TABLE UNIT (UNIT_ID BIGINT AUTO_INCREMENT NOT NULL, PARENT_ID BIGINT, TITLE VARCHAR(255) NOT NULL, UNIT_LEVEL INT, CONSTRAINT CONSTRAINT_2 PRIMARY KEY (UNIT_ID));
--changeset gonchar:USER-6
CREATE TABLE USER (LOGIN VARCHAR(255) NOT NULL, PASSWORD VARCHAR(255) NOT NULL, ROLE VARCHAR(255) NOT NULL, CONSTRAINT USER_PK PRIMARY KEY (LOGIN));
--changeset gonchar:EVENT_DURATION__EVENT_TYPE_ID_FK_INDEX-7
CREATE INDEX EVENT_DURATION__EVENT_TYPE_ID_FK_INDEX ON EVENT_DURATION(EVENT_TYPE_ID);
--changeset gonchar:EVENT_DURATION__UNIT_ID_FK_INDEX-8
CREATE INDEX EVENT_DURATION__UNIT_ID_FK_INDEX ON EVENT_DURATION(UNIT_ID);
--changeset gonchar:EVENT__EVENT_TYPE_ID_FK_INDEX-9
CREATE INDEX EVENT__EVENT_TYPE_ID_FK_INDEX ON EVENT(EVENT_TYPE_ID);
--changeset gonchar:EVENT__UNIT_ID_FK_INDEX-10
CREATE INDEX EVENT__UNIT_ID_FK_INDEX ON EVENT(UNIT_ID);
--changeset gonchar:UNIT__PARENT_ID_FK_INDEX-11
CREATE INDEX UNIT__PARENT_ID_FK_INDEX ON UNIT(PARENT_ID);
--changeset gonchar:EVENT_DURATION__EVENT_TYPE__CONSTRAINT-12
ALTER TABLE EVENT_DURATION ADD CONSTRAINT EVENT_DURATION__EVENT_TYPE__CONSTRAINT FOREIGN KEY (EVENT_TYPE_ID) REFERENCES EVENT_TYPE (TYPE_ID) ON UPDATE CASCADE ON DELETE CASCADE;
--changeset gonchar:EVENT_DURATION__UNIT__CONSTRAINT-13
ALTER TABLE EVENT_DURATION ADD CONSTRAINT EVENT_DURATION__UNIT__CONSTRAINT FOREIGN KEY (UNIT_ID) REFERENCES UNIT (UNIT_ID) ON UPDATE CASCADE ON DELETE CASCADE;
--changeset gonchar:EVENT__UNIT__CONSTRAINT-14
ALTER TABLE EVENT ADD CONSTRAINT EVENT__UNIT__CONSTRAINT FOREIGN KEY (UNIT_ID) REFERENCES UNIT (UNIT_ID) ON UPDATE CASCADE ON DELETE CASCADE;
--changeset gonchar:EVENT__EVENT_TYPE__CONSTRAINT-15
ALTER TABLE EVENT ADD CONSTRAINT EVENT__EVENT_TYPE__CONSTRAINT FOREIGN KEY (EVENT_TYPE_ID) REFERENCES EVENT_TYPE (TYPE_ID) ON UPDATE CASCADE ON DELETE CASCADE;
--changeset gonchar:UNIT__UNIT__CONSTRAINT-16
ALTER TABLE UNIT ADD CONSTRAINT UNIT__UNIT__CONSTRAINT FOREIGN KEY (PARENT_ID) REFERENCES UNIT (UNIT_ID) ON UPDATE CASCADE ON DELETE CASCADE;
--changeset gonchar:CALENDAR-17
create table CALENDAR(NAME varchar(255) not null, SHIFT int default 0 not null, IS_ASTRONOMICAL boolean default true not null,
constraint CALENDAR_PK
primary key (NAME));
comment on column CALENDAR.shift is 'Сдвиг оперативного времени относительно астрономического';
| true |
e9ce0d2fb511c1f88c1374b25d0214a5bb781b9c
|
SQL
|
MukolaKUN/DB
|
/MySql/createDB.sql
|
UTF-8
| 4,781 | 3.546875 | 4 |
[] |
no_license
|
drop database bike_rent;
create database bike_rent;
USE bike_rent ;
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS bike_rent.client (
id_client INT NOT NULL AUTO_INCREMENT,
name VARCHAR(45) NULL,
surname VARCHAR(45) NULL,
addres VARCHAR(45) NULL,
phone VARCHAR(45) NULL,
email VARCHAR(45) NULL,
date_of_birthd DATE NULL,
sex VARCHAR(45) NULL,
PRIMARY KEY (id_client));
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS bike_rent.worker (
id_worker INT NOT NULL AUTO_INCREMENT,
Name VARCHAR(45) NULL,
Surname VARCHAR(45) NULL,
date_birthday DATE NULL,
PRIMARY KEY (id_worker));
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS bike_rent.rent (
id_rent INT NOT NULL AUTO_INCREMENT,
date_start DATE NULL,
date_finish DATE NULL,
date_payment DATE NULL,
reservation_status varchar(40) NULL,
rent_status varchar(40) NULL,
client_id_client INT NOT NULL,
worker_id_worker INT NOT NULL,
PRIMARY KEY (id_rent),
FOREIGN KEY (client_id_client)
REFERENCES bike_rent.client (id_client)
ON DELETE cascade
ON UPDATE cascade,
FOREIGN KEY (worker_id_worker)
REFERENCES bike_rent.worker (id_worker)
ON DELETE cascade
ON UPDATE cascade);
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS bike_rent.insurance (
id_insurance INT NOT NULL AUTO_INCREMENT,
policy_number VARCHAR(45) NULL,
date_start DATE NULL,
date_end VARCHAR(45) NULL,
rent_id_rent INT NOT NULL,
PRIMARY KEY (id_insurance),
FOREIGN KEY (rent_id_rent)
REFERENCES bike_rent.rent (id_rent)
ON DELETE cascade
ON UPDATE cascade);
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS bike_rent.bike_producer (
id_bike_producer INT NOT NULL AUTO_INCREMENT,
name VARCHAR(45) NULL,
phone VARCHAR(45) NULL,
email VARCHAR(45) NULL,
coutry VARCHAR(45) NULL,
PRIMARY KEY (id_bike_producer));
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS bike_rent.bike (
id_bike INT NOT NULL AUTO_INCREMENT,
mark VARCHAR(45) NULL,
type VARCHAR(45) NULL,
day_price DECIMAL(10) NULL,
deposit_amount DECIMAL(10) NULL,
replacement_cost DECIMAL(10) NULL,
bike_count INT NULL,
bike_producer_id_bike_producer INT NOT NULL,
PRIMARY KEY (id_bike),
FOREIGN KEY (bike_producer_id_bike_producer)
REFERENCES bike_rent.bike_producer (id_bike_producer)
ON DELETE CASCADE
ON UPDATE CASCADE);
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS bike_rent.damage (
id_damage INT NOT NULL AUTO_INCREMENT,
work_status VARCHAR(45) NULL,
damage_date DATE NULL,
sum DECIMAL(10) NULL,
rent_id_rent INT NOT NULL,
bike_id_bike INT NOT NULL,
client_id_client INT NOT NULL,
PRIMARY KEY (id_damage),
FOREIGN KEY (rent_id_rent)
REFERENCES bike_rent.rent (id_rent)
ON DELETE cascade
ON UPDATE cascade,
FOREIGN KEY (bike_id_bike)
REFERENCES bike_rent.bike (id_bike)
ON DELETE cascade
ON UPDATE cascade,
FOREIGN KEY (client_id_client)
REFERENCES bike_rent.client (id_client)
ON DELETE NO ACTION
ON UPDATE NO ACTION);
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS bike_rent.accessory (
id_accessory INT NOT NULL AUTO_INCREMENT,
mark VARCHAR(45) NULL,
type VARCHAR(45) NULL,
day_price DECIMAL(10) NULL,
deposit_amount DECIMAL(10) NULL,
PRIMARY KEY (id_accessory));
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS bike_rent.role (
id_role INT NOT NULL AUTO_INCREMENT,
name_role VARCHAR(45) NULL,
worker_id_worker INT NOT NULL,
PRIMARY KEY (id_role),
FOREIGN KEY (worker_id_worker)
REFERENCES bike_rent.worker (id_worker)
ON DELETE cascade
ON UPDATE cascade);
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS bike_rent.rent_has_accessory (
rent_id_rent INT NOT NULL,
accessory_id_accessory INT NOT NULL,
FOREIGN KEY (rent_id_rent)
REFERENCES bike_rent.rent (id_rent)
ON DELETE cascade
ON UPDATE cascade,
FOREIGN KEY (accessory_id_accessory)
REFERENCES bike_rent.accessory (id_accessory)
ON DELETE cascade
ON UPDATE cascade);
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS bike_rent.bike_has_rent (
bike_id_bike INT NOT NULL,
rent_id_rent INT NOT NULL,
FOREIGN KEY (bike_id_bike)
REFERENCES bike_rent.bike (id_bike)
ON DELETE cascade
ON UPDATE cascade,
FOREIGN KEY (rent_id_rent)
REFERENCES bike_rent.rent (id_rent)
ON DELETE cascade
ON UPDATE cascade);
| true |
315af71bb7a8baae544c1c1827e9e4fb4e7be9c9
|
SQL
|
yngcan/PatentsView-DB
|
/Scripts/Website_Database_Generator/generate_database.sql
|
UTF-8
| 115,022 | 3.84375 | 4 |
[] |
no_license
|
# Use these to ease global replace:
# source database: `patent_20150826`
# destination database: `PatentsView_20150826_v1`
# Figures above each query (N,NNN @ N:NN) are row and time estimates for each query based on server
# settings at the time the query was run and are just used for sanity checking purposes. Server settings,
# load, data, and a million other things can affect these values. Take them with a grain of salt.
drop database if exists `PatentsView_20150826_v1`;
create database if not exists `PatentsView_20150826_v1` default character set=utf8 default collate=utf8_general_ci;
# BEGIN assignee id mapping ###################################################################################################################################
# We need this early for firstnamed stuff.
drop table if exists `PatentsView_20150826_v1`.`temp_id_mapping_assignee`;
create table `PatentsView_20150826_v1`.`temp_id_mapping_assignee`
(
`old_assignee_id` varchar(36) not null,
`new_assignee_id` int unsigned not null auto_increment,
primary key (`old_assignee_id`),
unique index `ak_temp_id_mapping_assignee` (`new_assignee_id`)
)
engine=InnoDB;
# There are assignees in the raw data that are not linked to anything so we will take our
# assignee ids from the patent_assignee table to ensure we don't copy any unused assignees over.
# 345,185 @ 0:23
insert into
`PatentsView_20150826_v1`.`temp_id_mapping_assignee` (`old_assignee_id`)
select distinct
pa.`assignee_id`
from
`patent_20150826`.`patent_assignee` pa;
# END assignee id mapping #####################################################################################################################################
# BEGIN inventor id mapping ###################################################################################################################################
# We need this early for firstnamed stuff.
drop table if exists `PatentsView_20150826_v1`.`temp_id_mapping_inventor`;
create table `PatentsView_20150826_v1`.`temp_id_mapping_inventor`
(
`old_inventor_id` varchar(36) not null,
`new_inventor_id` int unsigned not null auto_increment,
primary key (`old_inventor_id`),
unique index `ak_temp_id_mapping_inventor` (`new_inventor_id`)
)
engine=InnoDB;
# There are inventors in the raw data that are not linked to anything so we will take our
# inventor ids from the patent_inventor table to ensure we don't copy any unused inventors over.
# 3,572,763 @ 1:08
insert into
`PatentsView_20150826_v1`.`temp_id_mapping_inventor` (`old_inventor_id`)
select distinct
`inventor_id`
from
`patent_20150826`.`patent_inventor`;
# END inventor id mapping #####################################################################################################################################
# BEGIN location id mapping ###################################################################################################################################
# This bit has changed. Prior to February 2015, there were many locations that were the same but had
# slightly different lat-longs. As of February, locations that shared a city, state, and country have
# been forced to use the same lag-long. The algorithm used to determine which lat-long is outside of
# the scope of this discussion.
#
# So how does this affect PatentsView? Well, for starters, we need to use the new location_update
# table instead of the old location table. Additionally, we need to use the new
# rawlocation.location_id_transformed column instead of the old rawlocation.location_id column. The
# problem, though, is that we have denormalized so much location data that these changes affect many,
# many tables. In an effort to minimize changes to this script and, HOPEFULLY, minimize impact to
# performance, we are going to map new_location_id to location_id_transformed and then map location_id
# to location_id_transformed which will give us a direct pathway from location_id to new_location_id
# rather than having to drag rawlocation into all queries.
drop table if exists `PatentsView_20150826_v1`.`temp_id_mapping_location_transformed`;
create table `PatentsView_20150826_v1`.`temp_id_mapping_location_transformed`
(
`old_location_id_transformed` varchar(128) not null,
`new_location_id` int unsigned not null auto_increment,
primary key (`old_location_id_transformed`),
unique index `ak_temp_id_mapping_location_transformed` (`new_location_id`)
)
engine=InnoDB;
# 97,725 @ 0:02
insert into
`PatentsView_20150826_v1`.`temp_id_mapping_location_transformed` (`old_location_id_transformed`)
select distinct
`location_id_transformed`
from
`patent_20150826`.`rawlocation_update`
where
`location_id_transformed` is not null and `location_id_transformed` != '';
drop table if exists `PatentsView_20150826_v1`.`temp_id_mapping_location`;
create table `PatentsView_20150826_v1`.`temp_id_mapping_location`
(
`old_location_id` varchar(128) not null,
`new_location_id` int unsigned not null,
primary key (`old_location_id`),
index `ak_temp_id_mapping_location` (`new_location_id`)
)
engine=InnoDB;
# 120,449 @ 3:27
insert into
`PatentsView_20150826_v1`.`temp_id_mapping_location` (`old_location_id`, `new_location_id`)
select distinct
rl.`location_id`,
t.`new_location_id`
from
(select distinct `location_id`, `location_id_transformed` from `patent_20150826`.`rawlocation_update` where `location_id` is not null and `location_id` != '') rl
inner join `PatentsView_20150826_v1`.`temp_id_mapping_location_transformed` t on
t.`old_location_id_transformed` = rl.`location_id_transformed`;
# END location id mapping #####################################################################################################################################
# BEGIN patent ################################################################################################################################################
drop table if exists `PatentsView_20150826_v1`.`temp_patent_firstnamed_assignee`;
create table `PatentsView_20150826_v1`.`temp_patent_firstnamed_assignee`
(
`patent_id` varchar(20) not null,
`assignee_id` int unsigned null,
`persistent_assignee_id` varchar(36) null,
`location_id` int unsigned null,
`persistent_location_id` varchar(128) null,
`city` varchar(128) null,
`state` varchar(20) null,
`country` varchar(10) null,
`latitude` float null,
`longitude` float null,
primary key (`patent_id`)
)
engine=InnoDB;
# 4,694,651 @ 2:22
insert into `PatentsView_20150826_v1`.`temp_patent_firstnamed_assignee`
(
`patent_id`, `assignee_id`, `persistent_assignee_id`, `location_id`,
`persistent_location_id`, `city`, `state`, `country`, `latitude`, `longitude`
)
select
p.`id`,
ta.`new_assignee_id`,
ta.`old_assignee_id`,
tl.`new_location_id`,
tl.`old_location_id_transformed`,
nullif(l.`city`, ''),
nullif(l.`state`, ''),
nullif(l.`country`, ''),
l.`latitude`,
l.`longitude`
from
`patent_20150826`.`patent` p
left outer join `patent_20150826`.`rawassignee` ra on ra.`patent_id` = p.`id` and ra.`sequence` = 0
left outer join `PatentsView_20150826_v1`.`temp_id_mapping_assignee` ta on ta.`old_assignee_id` = ra.`assignee_id`
left outer join `patent_20150826`.`rawlocation_update` rl on rl.`id` = ra.`rawlocation_id`
left outer join `patent_20150826`.`location_update2` l on l.`id` = rl.`location_id`
left outer join `PatentsView_20150826_v1`.`temp_id_mapping_location_transformed` tl on tl.`old_location_id_transformed` = rl.`location_id_transformed`
where
ta.`new_assignee_id` is not null or
tl.`new_location_id` is not null;
drop table if exists `PatentsView_20150826_v1`.`temp_patent_firstnamed_inventor`;
create table `PatentsView_20150826_v1`.`temp_patent_firstnamed_inventor`
(
`patent_id` varchar(20) not null,
`inventor_id` int unsigned null,
`persistent_inventor_id` varchar(36) null,
`location_id` int unsigned null,
`persistent_location_id` varchar(128) null,
`city` varchar(128) null,
`state` varchar(20) null,
`country` varchar(10) null,
`latitude` float null,
`longitude` float null,
primary key (`patent_id`)
)
engine=InnoDB;
# 5,425,008 @ 6:03
insert into `PatentsView_20150826_v1`.`temp_patent_firstnamed_inventor`
(
`patent_id`, `inventor_id`, `persistent_inventor_id`, `location_id`,
`persistent_location_id`, `city`, `state`, `country`, `latitude`, `longitude`
)
select
p.`id`,
ti.`new_inventor_id`,
ti.`old_inventor_id`,
tl.`new_location_id`,
tl.`old_location_id_transformed`,
nullif(l.`city`, ''),
nullif(l.`state`, ''),
nullif(l.`country`, ''),
l.`latitude`,
l.`longitude`
from
`patent_20150826`.`patent` p
left outer join `patent_20150826`.`rawinventor` ri on ri.`patent_id` = p.`id` and ri.`sequence` = 0
left outer join `PatentsView_20150826_v1`.`temp_id_mapping_inventor` ti on ti.`old_inventor_id` = ri.`inventor_id`
left outer join `patent_20150826`.`rawlocation_update` rl on rl.`id` = ri.`rawlocation_id`
left outer join `patent_20150826`.`location_update2` l on l.`id` = rl.`location_id`
left outer join `PatentsView_20150826_v1`.`temp_id_mapping_location_transformed` tl on tl.`old_location_id_transformed` = rl.`location_id_transformed`
where
ti.`new_inventor_id` is not null or
tl.`new_location_id` is not null;
drop table if exists `PatentsView_20150826_v1`.`temp_num_foreign_documents_cited`;
create table `PatentsView_20150826_v1`.`temp_num_foreign_documents_cited`
(
`patent_id` varchar(20) not null,
`num_foreign_documents_cited` int unsigned not null,
primary key (`patent_id`)
)
engine=InnoDB;
# The number of foreign documents cited.
# 2,751,072 @ 1:52
insert into `PatentsView_20150826_v1`.`temp_num_foreign_documents_cited`
(`patent_id`, `num_foreign_documents_cited`)
select
`patent_id`, count(*)
from
`patent_20150826`.`foreigncitation`
group by
`patent_id`;
drop table if exists `PatentsView_20150826_v1`.`temp_num_us_applications_cited`;
create table `PatentsView_20150826_v1`.`temp_num_us_applications_cited`
(
`patent_id` varchar(20) not null,
`num_us_applications_cited` int unsigned not null,
primary key (`patent_id`)
)
engine=InnoDB;
# The number of U.S. patent applications cited.
# 1,534,484 @ 0:21
insert into `PatentsView_20150826_v1`.`temp_num_us_applications_cited`
(`patent_id`, `num_us_applications_cited`)
select
`patent_id`, count(*)
from
`patent_20150826`.`usapplicationcitation`
group by
`patent_id`;
drop table if exists `PatentsView_20150826_v1`.`temp_num_us_patents_cited`;
create table `PatentsView_20150826_v1`.`temp_num_us_patents_cited`
(
`patent_id` varchar(20) not null,
`num_us_patents_cited` int unsigned not null,
primary key (`patent_id`)
)
engine=InnoDB;
# The number of U.S. patents cited.
# 5,231,893 @ 7:17
insert into `PatentsView_20150826_v1`.`temp_num_us_patents_cited`
(`patent_id`, `num_us_patents_cited`)
select
`patent_id`, count(*)
from
`patent_20150826`.`uspatentcitation`
group by
`patent_id`;
drop table if exists `PatentsView_20150826_v1`.`temp_num_times_cited_by_us_patents`;
create table `PatentsView_20150826_v1`.`temp_num_times_cited_by_us_patents`
(
`patent_id` varchar(20) not null,
`num_times_cited_by_us_patents` int unsigned not null,
primary key (`patent_id`)
)
engine=InnoDB;
# The number of times a U.S. patent was cited.
# 6,333,277 @ 7:27
insert into `PatentsView_20150826_v1`.`temp_num_times_cited_by_us_patents`
(`patent_id`, `num_times_cited_by_us_patents`)
select
`citation_id`, count(*)
from
`patent_20150826`.`uspatentcitation`
where
`citation_id` is not null and `citation_id` != ''
group by
`citation_id`;
drop table if exists `PatentsView_20150826_v1`.`temp_patent_aggregations`;
create table `PatentsView_20150826_v1`.`temp_patent_aggregations`
(
`patent_id` varchar(20) not null,
`num_foreign_documents_cited` int unsigned not null,
`num_us_applications_cited` int unsigned not null,
`num_us_patents_cited` int unsigned not null,
`num_total_documents_cited` int unsigned not null,
`num_times_cited_by_us_patents` int unsigned not null,
primary key (`patent_id`)
)
engine=InnoDB;
# Combine all of our patent aggregations.
# 5,425,879 @ 2:14
insert into `PatentsView_20150826_v1`.`temp_patent_aggregations`
(
`patent_id`, `num_foreign_documents_cited`, `num_us_applications_cited`,
`num_us_patents_cited`, `num_total_documents_cited`, `num_times_cited_by_us_patents`
)
select
p.`id`,
ifnull(t1.num_foreign_documents_cited, 0),
ifnull(t2.num_us_applications_cited, 0),
ifnull(t3.num_us_patents_cited, 0),
ifnull(t1.num_foreign_documents_cited, 0) + ifnull(t2.num_us_applications_cited, 0) + ifnull(t3.num_us_patents_cited, 0),
ifnull(t4.num_times_cited_by_us_patents, 0)
from
`patent_20150826`.`patent` p
left outer join `PatentsView_20150826_v1`.`temp_num_foreign_documents_cited` t1 on t1.`patent_id` = p.`id`
left outer join `PatentsView_20150826_v1`.`temp_num_us_applications_cited` t2 on t2.`patent_id` = p.`id`
left outer join `PatentsView_20150826_v1`.`temp_num_us_patents_cited` t3 on t3.`patent_id` = p.`id`
left outer join `PatentsView_20150826_v1`.`temp_num_times_cited_by_us_patents` t4 on t4.`patent_id` = p.`id`;
drop table if exists `PatentsView_20150826_v1`.`temp_patent_earliest_application_date`;
create table `PatentsView_20150826_v1`.`temp_patent_earliest_application_date`
(
`patent_id` varchar(20) not null,
`earliest_application_date` date not null,
primary key (`patent_id`)
)
engine=InnoDB;
# Find the earliest application date for each patent.
# 5,425,837 @ 1:35
insert into `PatentsView_20150826_v1`.`temp_patent_earliest_application_date`
(`patent_id`, `earliest_application_date`)
select
a.`patent_id`, min(a.`date`)
from
`patent_20150826`.`application` a
where
a.`date` is not null and a.`date` > date('1899-12-31') and a.`date` < date_add(current_date, interval 10 year)
group by
a.`patent_id`;
drop table if exists `PatentsView_20150826_v1`.`temp_patent_date`;
create table `PatentsView_20150826_v1`.`temp_patent_date`
(
`patent_id` varchar(20) not null,
`date` date null,
primary key (`patent_id`)
)
engine=InnoDB;
# Eliminate obviously bad patent dates.
# 5,425,875 @ 0:37
insert into `PatentsView_20150826_v1`.`temp_patent_date`
(`patent_id`, `date`)
select
p.`id`, p.`date`
from
`patent_20150826`.`patent` p
where
p.`date` is not null and p.`date` > date('1899-12-31') and p.`date` < date_add(current_date, interval 10 year);
drop table if exists `PatentsView_20150826_v1`.`patent`;
create table `PatentsView_20150826_v1`.`patent`
(
`patent_id` varchar(20) not null,
`type` varchar(100) null,
`number` varchar(64) not null,
`country` varchar(20) null,
`date` date null,
`year` smallint unsigned null,
`abstract` text null,
`title` text null,
`kind` varchar(10) null,
`num_claims` smallint unsigned null,
`firstnamed_assignee_id` int unsigned null,
`firstnamed_assignee_persistent_id` varchar(36) null,
`firstnamed_assignee_location_id` int unsigned null,
`firstnamed_assignee_persistent_location_id` varchar(128) null,
`firstnamed_assignee_city` varchar(128) null,
`firstnamed_assignee_state` varchar(20) null,
`firstnamed_assignee_country` varchar(10) null,
`firstnamed_assignee_latitude` float null,
`firstnamed_assignee_longitude` float null,
`firstnamed_inventor_id` int unsigned null,
`firstnamed_inventor_persistent_id` varchar(36) null,
`firstnamed_inventor_location_id` int unsigned null,
`firstnamed_inventor_persistent_location_id` varchar(128) null,
`firstnamed_inventor_city` varchar(128) null,
`firstnamed_inventor_state` varchar(20) null,
`firstnamed_inventor_country` varchar(10) null,
`firstnamed_inventor_latitude` float null,
`firstnamed_inventor_longitude` float null,
`num_foreign_documents_cited` int unsigned not null,
`num_us_applications_cited` int unsigned not null,
`num_us_patents_cited` int unsigned not null,
`num_total_documents_cited` int unsigned not null,
`num_times_cited_by_us_patents` int unsigned not null,
`earliest_application_date` date null,
`patent_processing_days` int unsigned null,
`uspc_current_mainclass_average_patent_processing_days` int unsigned null, # This will have to be updated once we've calculated the value in the uspc_current section below.
primary key (`patent_id`)
)
engine=InnoDB;
# 5,425,879 @ 6:45
insert into `PatentsView_20150826_v1`.`patent`
(
`patent_id`, `type`, `number`, `country`, `date`, `year`,
`abstract`, `title`, `kind`, `num_claims`,
`firstnamed_assignee_id`, `firstnamed_assignee_persistent_id`,
`firstnamed_assignee_location_id`, `firstnamed_assignee_persistent_location_id`,
`firstnamed_assignee_city`, `firstnamed_assignee_state`,
`firstnamed_assignee_country`, `firstnamed_assignee_latitude`,
`firstnamed_assignee_longitude`, `firstnamed_inventor_id`,
`firstnamed_inventor_persistent_id`, `firstnamed_inventor_location_id`,
`firstnamed_inventor_persistent_location_id`, `firstnamed_inventor_city`,
`firstnamed_inventor_state`, `firstnamed_inventor_country`,
`firstnamed_inventor_latitude`, `firstnamed_inventor_longitude`,
`num_foreign_documents_cited`, `num_us_applications_cited`,
`num_us_patents_cited`, `num_total_documents_cited`,
`num_times_cited_by_us_patents`,
`earliest_application_date`, `patent_processing_days`
)
select
p.`id`, case when ifnull(p.`type`, '') = 'sir' then 'statutory invention registration' else nullif(trim(p.`type`), '') end,
`number`, nullif(trim(p.`country`), ''), tpd.`date`, year(tpd.`date`),
nullif(trim(p.`abstract`), ''), nullif(trim(p.`title`), ''), nullif(trim(p.`kind`), ''), p.`num_claims`,
tpfna.`assignee_id`, tpfna.`persistent_assignee_id`, tpfna.`location_id`,
tpfna.`persistent_location_id`, tpfna.`city`,
tpfna.`state`, tpfna.`country`, tpfna.`latitude`, tpfna.`longitude`,
tpfni.`inventor_id`, tpfni.`persistent_inventor_id`, tpfni.`location_id`,
tpfni.`persistent_location_id`, tpfni.`city`,
tpfni.`state`, tpfni.`country`, tpfni.`latitude`, tpfni.`longitude`,
tpa.`num_foreign_documents_cited`, tpa.`num_us_applications_cited`,
tpa.`num_us_patents_cited`, tpa.`num_total_documents_cited`,
tpa.`num_times_cited_by_us_patents`,
tpead.`earliest_application_date`,
case when tpead.`earliest_application_date` <= p.`date` then timestampdiff(day, tpead.`earliest_application_date`, tpd.`date`) else null end
from
`patent_20150826`.`patent` p
left outer join `PatentsView_20150826_v1`.`temp_patent_date` tpd on tpd.`patent_id` = p.`id`
left outer join `PatentsView_20150826_v1`.`temp_patent_firstnamed_assignee` tpfna on tpfna.`patent_id` = p.`id`
left outer join `PatentsView_20150826_v1`.`temp_patent_firstnamed_inventor` tpfni on tpfni.`patent_id` = p.`id`
left outer join `PatentsView_20150826_v1`.`temp_patent_aggregations` tpa on tpa.`patent_id` = p.`id`
left outer join `PatentsView_20150826_v1`.`temp_patent_earliest_application_date` tpead on tpead.`patent_id` = p.`id`;
# END patent ##################################################################################################################################################
# BEGIN application ###########################################################################################################################################
drop table if exists `PatentsView_20150826_v1`.`application`;
create table `PatentsView_20150826_v1`.`application`
(
`application_id` varchar(36) not null,
`patent_id` varchar(20) not null,
`type` varchar(20) null,
`number` varchar(64) null,
`country` varchar(20) null,
`date` date null,
primary key (`application_id`, `patent_id`)
)
engine=InnoDB;
# 5,425,879 @ 1:11
insert into `PatentsView_20150826_v1`.`application`
(`application_id`, `patent_id`, `type`, `number`, `country`, `date`)
select
`id_transformed`, `patent_id`, nullif(trim(`type`), ''),
nullif(trim(`number_transformed`), ''), nullif(trim(`country`), ''),
case when `date` > date('1899-12-31') and `date` < date_add(current_date, interval 10 year) then `date` else null end
from
`patent_20150826`.`application`;
# END application #############################################################################################################################################
# BEGIN location ##############################################################################################################################################
drop table if exists `PatentsView_20150826_v1`.`temp_location_num_assignees`;
create table `PatentsView_20150826_v1`.`temp_location_num_assignees`
(
`location_id` int unsigned not null,
`num_assignees` int unsigned not null,
primary key (`location_id`)
)
engine=InnoDB;
# 34,018 @ 0:02
insert into `PatentsView_20150826_v1`.`temp_location_num_assignees`
(`location_id`, `num_assignees`)
select
timl.`new_location_id`,
count(distinct la.`assignee_id`)
from
`PatentsView_20150826_v1`.`temp_id_mapping_location_transformed` timl
inner join `patent_20150826`.`location_assignee_update2` la on la.`location_id` = timl.`old_location_id_transformed`
group by
timl.`new_location_id`;
drop table if exists `PatentsView_20150826_v1`.`temp_location_num_inventors`;
create table `PatentsView_20150826_v1`.`temp_location_num_inventors`
(
`location_id` int unsigned not null,
`num_inventors` int unsigned not null,
primary key (`location_id`)
)
engine=InnoDB;
# 94,350 @ 0:50
insert into `PatentsView_20150826_v1`.`temp_location_num_inventors`
(`location_id`, `num_inventors`)
select
timl.`new_location_id`,
count(distinct li.`inventor_id`)
from
`PatentsView_20150826_v1`.`temp_id_mapping_location_transformed` timl
inner join `patent_20150826`.`location_inventor_update2` li on li.`location_id` = timl.`old_location_id_transformed`
group by
timl.`new_location_id`;
/*
So after many, many attempts, the fastest way I found to calculate patents per location was the following:
1) Remap IDs to integers
2) Insert location_id and patent_id in a temp table with no primary key
3) Build a non-unique index on this new table
4) Run the calculation
The total run time of this method is in the neighborhood of 18 minutes. The original "straightforward"
calculation whereby I ran the query directly against the source data using a "union all" between inventor
and assignee locations ran well over 2 hours.
*/
drop table if exists `PatentsView_20150826_v1`.`temp_location_patent`;
create table `PatentsView_20150826_v1`.`temp_location_patent`
(
`location_id` int unsigned not null,
`patent_id` varchar(20) not null
)
engine=InnoDB;
# 11,867,513 @ 3:41
insert into `PatentsView_20150826_v1`.`temp_location_patent`
(`location_id`, `patent_id`)
select
timl.`new_location_id`,
ri.`patent_id`
from
`PatentsView_20150826_v1`.`temp_id_mapping_location` timl
inner join `patent_20150826`.`rawlocation_update` rl on rl.`location_id` = timl.`old_location_id`
inner join `patent_20150826`.`rawinventor` ri on ri.`rawlocation_id` = rl.`id`;
# 4,457,955 @ 2:54
insert into `PatentsView_20150826_v1`.`temp_location_patent`
(`location_id`, `patent_id`)
select
timl.`new_location_id`,
ra.`patent_id`
from
`PatentsView_20150826_v1`.`temp_id_mapping_location` timl
inner join `patent_20150826`.`rawlocation_update` rl on rl.`location_id` = timl.`old_location_id`
inner join `patent_20150826`.`rawassignee` ra on ra.`rawlocation_id` = rl.`id`;
# 15:00
alter table `PatentsView_20150826_v1`.`temp_location_patent` add index (`location_id`, `patent_id`);
alter table `PatentsView_20150826_v1`.`temp_location_patent` add index (`patent_id`, `location_id`);
drop table if exists `PatentsView_20150826_v1`.`temp_location_num_patents`;
create table `PatentsView_20150826_v1`.`temp_location_num_patents`
(
`location_id` int unsigned not null,
`num_patents` int unsigned not null,
primary key (`location_id`)
)
engine=InnoDB;
# 121,475 @ 1:10
insert into `PatentsView_20150826_v1`.`temp_location_num_patents`
(`location_id`, `num_patents`)
select
`location_id`,
count(distinct patent_id)
from
`PatentsView_20150826_v1`.`temp_location_patent`
group by
`location_id`;
drop table if exists `PatentsView_20150826_v1`.`location`;
create table `PatentsView_20150826_v1`.`location`
(
`location_id` int unsigned not null,
`city` varchar(128) null,
`state` varchar(20) null,
`country` varchar(10) null,
`latitude` float null,
`longitude` float null,
`num_assignees` int unsigned not null,
`num_inventors` int unsigned not null,
`num_patents` int unsigned not null,
`persistent_location_id` varchar(128) not null,
primary key (`location_id`)
)
engine=InnoDB;
# 121,477 @ 0:02
insert into `PatentsView_20150826_v1`.`location`
(
`location_id`, `city`, `state`, `country`,
`latitude`, `longitude`, `num_assignees`, `num_inventors`,
`num_patents`, `persistent_location_id`
)
select
timl.`new_location_id`,
nullif(trim(l.`city`), ''), nullif(trim(l.`state`), ''), nullif(trim(l.`country`), ''),
l.`latitude`, l.`longitude`, ifnull(tlna.`num_assignees`, 0), ifnull(tlni.`num_inventors`, 0),
ifnull(tlnp.`num_patents`, 0), l.`id`
from
`patent_20150826`.`location_update2` l
inner join `PatentsView_20150826_v1`.`temp_id_mapping_location` timl on timl.`old_location_id` = l.`id`
left outer join `PatentsView_20150826_v1`.`temp_location_num_assignees` tlna on tlna.`location_id` = timl.`new_location_id`
left outer join `PatentsView_20150826_v1`.`temp_location_num_inventors` tlni on tlni.`location_id` = timl.`new_location_id`
left outer join `PatentsView_20150826_v1`.`temp_location_num_patents` tlnp on tlnp.`location_id` = timl.`new_location_id`;
# END location ################################################################################################################################################
# BEGIN assignee ##############################################################################################################################################
drop table if exists `PatentsView_20150826_v1`.`temp_assignee_lastknown_location`;
create table `PatentsView_20150826_v1`.`temp_assignee_lastknown_location`
(
`assignee_id` varchar(36) not null,
`location_id` int unsigned null,
`persistent_location_id` varchar(128) null,
`city` varchar(128) null,
`state` varchar(20) null,
`country` varchar(10) null,
`latitude` float null,
`longitude` float null,
primary key (`assignee_id`)
)
engine=InnoDB;
# Populate temp_assignee_lastknown_location table. The goal here is to grab the location associated
# with the most recent patent associated with the assignee. It is possible for a patent/assignee
# combination not to have a location, so we will grab the most recent KNOWN location.
# 320,156 @ 3:51
insert into `PatentsView_20150826_v1`.`temp_assignee_lastknown_location`
(
`assignee_id`, `location_id`, `persistent_location_id`, `city`, `state`, `country`, `latitude`, `longitude`
)
select
t.`assignee_id`,
tl.`new_location_id`,
tl.`old_location_id_transformed`,
nullif(trim(l.`city`), ''),
nullif(trim(l.`state`), ''),
nullif(trim(l.`country`), ''),
l.`latitude`,
l.`longitude`
from
(
select
t.`assignee_id`,
t.`location_id`,
t.`location_id_transformed`
from
(
select
@rownum := case when @assignee_id = t.`assignee_id` then @rownum + 1 else 1 end `rownum`,
@assignee_id := t.`assignee_id` `assignee_id`,
t.`location_id`,
t.`location_id_transformed`
from
(
select
ra.`assignee_id`,
rl.`location_id`,
rl.`location_id_transformed`
from
`patent_20150826`.`rawassignee` ra
inner join `patent_20150826`.`patent` p on p.`id` = ra.`patent_id`
inner join `patent_20150826`.`rawlocation_update` rl on rl.`id` = ra.`rawlocation_id`
where
rl.`location_id_transformed` is not null and
ra.`assignee_id` is not null
order by
ra.`assignee_id`,
p.`date` desc,
p.`id` desc
) t,
(select @rownum := 0, @assignee_id := '') r
) t
where
t.`rownum` < 2
) t
left outer join `patent_20150826`.`location_update2` l on l.`id` = t.`location_id`
left outer join `PatentsView_20150826_v1`.`temp_id_mapping_location_transformed` tl on tl.`old_location_id_transformed` = t.`location_id_transformed`;
drop table if exists `PatentsView_20150826_v1`.`temp_assignee_num_patents`;
create table `PatentsView_20150826_v1`.`temp_assignee_num_patents`
(
`assignee_id` varchar(36) not null,
`num_patents` int unsigned not null,
primary key (`assignee_id`)
)
engine=InnoDB;
#
insert into `PatentsView_20150826_v1`.`temp_assignee_num_patents`
(`assignee_id`, `num_patents`)
select
`assignee_id`,
count(distinct `patent_id`)
from
`patent_20150826`.`patent_assignee`
group by
`assignee_id`;
drop table if exists `PatentsView_20150826_v1`.`temp_assignee_num_inventors`;
create table `PatentsView_20150826_v1`.`temp_assignee_num_inventors`
(
`assignee_id` varchar(36) not null,
`num_inventors` int unsigned not null,
primary key (`assignee_id`)
)
engine=InnoDB;
# 0:15
insert into `PatentsView_20150826_v1`.`temp_assignee_num_inventors`
(`assignee_id`, `num_inventors`)
select
aa.`assignee_id`,
count(distinct ii.`inventor_id`)
from
`patent_20150826`.`patent_assignee` aa
join `patent_20150826`.`patent_inventor` ii on ii.patent_id = aa.patent_id
group by
aa.`assignee_id`;
drop table if exists `PatentsView_20150826_v1`.`temp_assignee_years_active`;
create table `PatentsView_20150826_v1`.`temp_assignee_years_active`
(
`assignee_id` varchar(36) not null,
`first_seen_date` date null,
`last_seen_date` date null,
`actual_years_active` smallint unsigned not null,
primary key (`assignee_id`)
)
engine=InnoDB;
# Years active is essentially the number of years difference between first associated patent and last.
# 1:15
insert into `PatentsView_20150826_v1`.`temp_assignee_years_active`
(`assignee_id`, `first_seen_date`, `last_seen_date`, `actual_years_active`)
select
pa.`assignee_id`, min(p.`date`), max(p.`date`),
ifnull(round(timestampdiff(day, min(p.`date`), max(p.`date`)) / 365), 0)
from
`patent_20150826`.`patent_assignee` pa
inner join `PatentsView_20150826_v1`.`patent` p on p.`patent_id`= pa.`patent_id`
where
p.`date` is not null
group by
pa.`assignee_id`;
drop table if exists `PatentsView_20150826_v1`.`patent_assignee`;
create table `PatentsView_20150826_v1`.`patent_assignee`
(
`patent_id` varchar(20) not null,
`assignee_id` int unsigned not null,
`location_id` int unsigned null,
`sequence` smallint unsigned not null,
primary key (`patent_id`, `assignee_id`),
unique index ak_patent_assignee (`assignee_id`, `patent_id`)
)
engine=InnoDB;
# 4,825,748 @ 7:20
insert into `PatentsView_20150826_v1`.`patent_assignee`
(
`patent_id`, `assignee_id`, `location_id`, `sequence`
)
select distinct
pa.`patent_id`, t.`new_assignee_id`, tl.`new_location_id`, ra.`sequence`
from
`patent_20150826`.`patent_assignee` pa
inner join `PatentsView_20150826_v1`.`temp_id_mapping_assignee` t on t.`old_assignee_id` = pa.`assignee_id`
left outer join (select patent_id, assignee_id, min(sequence) sequence from `patent_20150826`.`rawassignee` group by patent_id, assignee_id) t on t.`patent_id` = pa.`patent_id` and t.`assignee_id` = pa.`assignee_id`
left outer join `patent_20150826`.`rawassignee` ra on ra.`patent_id` = t.`patent_id` and ra.`assignee_id` = t.`assignee_id` and ra.`sequence` = t.`sequence`
left outer join `patent_20150826`.`rawlocation_update` rl on rl.`id` = ra.`rawlocation_id`
left outer join `PatentsView_20150826_v1`.`temp_id_mapping_location` tl on tl.`old_location_id` = rl.`location_id`;
drop table if exists `PatentsView_20150826_v1`.`location_assignee`;
create table `PatentsView_20150826_v1`.`location_assignee`
(
`location_id` int unsigned not null,
`assignee_id` int unsigned not null,
`num_patents` int unsigned,
primary key (`location_id`, `assignee_id`)
)
engine=InnoDB;
# 438,452 @ 0:07
insert into `PatentsView_20150826_v1`.`location_assignee`
(`location_id`, `assignee_id`, `num_patents`)
select distinct
timl.`new_location_id`,
tima.`new_assignee_id`,
null
from
`patent_20150826`.`location_assignee_update2` la
inner join `PatentsView_20150826_v1`.`temp_id_mapping_location_transformed` timl on timl.`old_location_id_transformed` = la.`location_id`
inner join `PatentsView_20150826_v1`.`temp_id_mapping_assignee` tima on tima.`old_assignee_id` = la.`assignee_id`;
drop table if exists `PatentsView_20150826_v1`.`assignee`;
create table `PatentsView_20150826_v1`.`assignee`
(
`assignee_id` int unsigned not null,
`type` varchar(10) null,
`name_first` varchar(64) null,
`name_last` varchar(64) null,
`organization` varchar(256) null,
`num_patents` int unsigned not null,
`num_inventors` int unsigned not null,
`lastknown_location_id` int unsigned null,
`lastknown_persistent_location_id` varchar(128) null,
`lastknown_city` varchar(128) null,
`lastknown_state` varchar(20) null,
`lastknown_country` varchar(10) null,
`lastknown_latitude` float null,
`lastknown_longitude` float null,
`first_seen_date` date null,
`last_seen_date` date null,
`years_active` smallint unsigned not null,
`persistent_assignee_id` varchar(36) not null,
primary key (`assignee_id`)
)
engine=InnoDB;
# 345,185 @ 0:15
insert into `PatentsView_20150826_v1`.`assignee`
(
`assignee_id`, `type`, `name_first`, `name_last`, `organization`,
`num_patents`, `num_inventors`, `lastknown_location_id`, `lastknown_persistent_location_id`, `lastknown_city`,
`lastknown_state`, `lastknown_country`, `lastknown_latitude`, `lastknown_longitude`,
`first_seen_date`, `last_seen_date`, `years_active`, `persistent_assignee_id`
)
select
t.`new_assignee_id`, trim(leading '0' from nullif(trim(a.`type`), '')), nullif(trim(a.`name_first`), ''),
nullif(trim(a.`name_last`), ''), nullif(trim(a.`organization`), ''),
tanp.`num_patents`, ifnull(tani.`num_inventors`, 0), talkl.`location_id`, talkl.`persistent_location_id`, talkl.`city`, talkl.`state`,
talkl.`country`, talkl.`latitude`, talkl.`longitude`,
tafls.`first_seen_date`, tafls.`last_seen_date`,
ifnull(case when tafls.`actual_years_active` < 1 then 1 else tafls.`actual_years_active` end, 0),
a.`id`
from
`patent_20150826`.`assignee` a
inner join `PatentsView_20150826_v1`.`temp_id_mapping_assignee` t on t.`old_assignee_id` = a.`id`
left outer join `PatentsView_20150826_v1`.`temp_assignee_lastknown_location` talkl on talkl.`assignee_id` = a.`id`
inner join `PatentsView_20150826_v1`.`temp_assignee_num_patents` tanp on tanp.`assignee_id` = a.`id`
left outer join `PatentsView_20150826_v1`.`temp_assignee_years_active` tafls on tafls.`assignee_id` = a.`id`
left outer join `PatentsView_20150826_v1`.`temp_assignee_num_inventors` tani on tani.`assignee_id` = a.`id`;
# END assignee ################################################################################################################################################
# BEGIN inventor ##############################################################################################################################################
drop table if exists `PatentsView_20150826_v1`.`temp_inventor_lastknown_location`;
create table `PatentsView_20150826_v1`.`temp_inventor_lastknown_location`
(
`inventor_id` varchar(36) not null,
`location_id` int unsigned null,
`persistent_location_id` varchar(128) null,
`city` varchar(128) null,
`state` varchar(20) null,
`country` varchar(10) null,
`latitude` float null,
`longitude` float null,
primary key (`inventor_id`)
)
engine=InnoDB;
# Populate temp_inventor_lastknown_location table. The goal here is to grab the location associated
# with the most recent patent associated with the inventor. It is possible for a patent/inventor
# combination not to have a location, so we will grab the most recent KNOWN location.
# 3,437,668 @ 22:05
insert into `PatentsView_20150826_v1`.`temp_inventor_lastknown_location`
(
`inventor_id`, `location_id`, `persistent_location_id`, `city`, `state`, `country`, `latitude`, `longitude`
)
select
t.`inventor_id`,
tl.`new_location_id`,
tl.`old_location_id_transformed`,
nullif(trim(l.`city`), ''),
nullif(trim(l.`state`), ''),
nullif(trim(l.`country`), ''),
l.`latitude`,
l.`longitude`
from
(
select
t.`inventor_id`,
t.`location_id`,
t.`location_id_transformed`
from
(
select
@rownum := case when @inventor_id = t.`inventor_id` then @rownum + 1 else 1 end `rownum`,
@inventor_id := t.`inventor_id` `inventor_id`,
t.`location_id`,
t.`location_id_transformed`
from
(
select
ri.`inventor_id`,
rl.`location_id`,
rl.`location_id_transformed`
from
`patent_20150826`.`rawinventor` ri
inner join `patent_20150826`.`patent` p on p.`id` = ri.`patent_id`
inner join `patent_20150826`.`rawlocation_update` rl on rl.`id` = ri.`rawlocation_id`
where
ri.`inventor_id` is not null and
rl.`location_id` is not null
order by
ri.`inventor_id`,
p.`date` desc,
p.`id` desc
) t,
(select @rownum := 0, @inventor_id := '') r
) t
where
t.`rownum` < 2
) t
left outer join `patent_20150826`.`location_update2` l on l.`id` = t.`location_id`
left outer join `PatentsView_20150826_v1`.`temp_id_mapping_location_transformed` tl on tl.`old_location_id_transformed` = t.`location_id_transformed`;
drop table if exists `PatentsView_20150826_v1`.`temp_inventor_num_patents`;
create table `PatentsView_20150826_v1`.`temp_inventor_num_patents`
(
`inventor_id` varchar(36) not null,
`num_patents` int unsigned not null,
primary key (`inventor_id`)
)
engine=InnoDB;
# 2:06
insert into `PatentsView_20150826_v1`.`temp_inventor_num_patents`
(`inventor_id`, `num_patents`)
select
`inventor_id`, count(distinct `patent_id`)
from
`patent_20150826`.`patent_inventor`
group by
`inventor_id`;
drop table if exists `PatentsView_20150826_v1`.`temp_inventor_num_assignees`;
create table `PatentsView_20150826_v1`.`temp_inventor_num_assignees`
(
`inventor_id` varchar(36) not null,
`num_assignees` int unsigned not null,
primary key (`inventor_id`)
)
engine=InnoDB;
# 0:15
insert into `PatentsView_20150826_v1`.`temp_inventor_num_assignees`
(`inventor_id`, `num_assignees`)
select
ii.`inventor_id`, count(distinct aa.`assignee_id`)
from
`patent_20150826`.`patent_inventor` ii
join `patent_20150826`.`patent_assignee` aa
on aa.`patent_id` = ii.`patent_id`
group by
ii.`inventor_id`;
drop table if exists `PatentsView_20150826_v1`.`temp_inventor_years_active`;
create table `PatentsView_20150826_v1`.`temp_inventor_years_active`
(
`inventor_id` varchar(36) not null,
`first_seen_date` date null,
`last_seen_date` date null,
`actual_years_active` smallint unsigned not null,
primary key (`inventor_id`)
)
engine=InnoDB;
# 5:42
insert into `PatentsView_20150826_v1`.`temp_inventor_years_active`
(`inventor_id`, `first_seen_date`, `last_seen_date`, `actual_years_active`)
select
pa.`inventor_id`, min(p.`date`), max(p.`date`),
ifnull(round(timestampdiff(day, min(p.`date`), max(p.`date`)) / 365), 0)
from
`patent_20150826`.`patent_inventor` pa
inner join `PatentsView_20150826_v1`.`patent` p on p.`patent_id`= pa.`patent_id`
where
p.`date` is not null
group by
pa.`inventor_id`;
drop table if exists `PatentsView_20150826_v1`.`patent_inventor`;
create table `PatentsView_20150826_v1`.`patent_inventor`
(
`patent_id` varchar(20) not null,
`inventor_id` int unsigned not null,
`location_id` int unsigned null,
`sequence` smallint unsigned not null,
primary key (`patent_id`, `inventor_id`),
unique index ak_patent_inventor (`inventor_id`, `patent_id`)
)
engine=InnoDB;
# 12,389,559 @ 29:50
insert into `PatentsView_20150826_v1`.`patent_inventor`
(
`patent_id`, `inventor_id`, `location_id`, `sequence`
)
select distinct
pii.`patent_id`, t.`new_inventor_id`, tl.`new_location_id`, ri.`sequence`
from
`patent_20150826`.`patent_inventor` pii
inner join `PatentsView_20150826_v1`.`temp_id_mapping_inventor` t on t.`old_inventor_id` = pii.`inventor_id`
left outer join (select patent_id, inventor_id, min(sequence) sequence from `patent_20150826`.`rawinventor` group by patent_id, inventor_id) t on t.`patent_id` = pii.`patent_id` and t.`inventor_id` = pii.`inventor_id`
left outer join `patent_20150826`.`rawinventor` ri on ri.`patent_id` = t.`patent_id` and ri.`inventor_id` = t.`inventor_id` and ri.`sequence` = t.`sequence`
left outer join `patent_20150826`.`rawlocation_update` rl on rl.`id` = ri.`rawlocation_id`
left outer join `PatentsView_20150826_v1`.`temp_id_mapping_location` tl on tl.`old_location_id` = rl.`location_id`;
drop table if exists `PatentsView_20150826_v1`.`location_inventor`;
create table `PatentsView_20150826_v1`.`location_inventor`
(
`location_id` int unsigned not null,
`inventor_id` int unsigned not null,
`num_patents` int unsigned,
primary key (`location_id`, `inventor_id`)
)
engine=InnoDB;
# 4,188,507 @ 0:50
insert into `PatentsView_20150826_v1`.`location_inventor`
(`location_id`, `inventor_id`, `num_patents`)
select distinct
timl.`new_location_id`,
timi.`new_inventor_id`,
null
from
`patent_20150826`.`location_inventor_update2` la
inner join `PatentsView_20150826_v1`.`temp_id_mapping_location_transformed` timl on timl.`old_location_id_transformed` = la.`location_id`
inner join `PatentsView_20150826_v1`.`temp_id_mapping_inventor` timi on timi.`old_inventor_id` = la.`inventor_id`;
drop table if exists `PatentsView_20150826_v1`.`inventor`;
create table `PatentsView_20150826_v1`.`inventor`
(
`inventor_id` int unsigned not null,
`name_first` varchar(64) null,
`name_last` varchar(64) null,
`num_patents` int unsigned not null,
`num_assignees` int unsigned not null,
`lastknown_location_id` int unsigned null,
`lastknown_persistent_location_id` varchar(128) null,
`lastknown_city` varchar(128) null,
`lastknown_state` varchar(20) null,
`lastknown_country` varchar(10) null,
`lastknown_latitude` float null,
`lastknown_longitude` float null,
`first_seen_date` date null,
`last_seen_date` date null,
`years_active` smallint unsigned not null,
`persistent_inventor_id` varchar(36) not null,
primary key (`inventor_id`)
)
engine=InnoDB;
# 3,572,763 @ 1:57
insert into `PatentsView_20150826_v1`.`inventor`
(
`inventor_id`, `name_first`, `name_last`, `num_patents`, `num_assignees`,
`lastknown_location_id`, `lastknown_persistent_location_id`, `lastknown_city`,
`lastknown_state`, `lastknown_country`, `lastknown_latitude`, `lastknown_longitude`,
`first_seen_date`, `last_seen_date`, `years_active`, `persistent_inventor_id`
)
select
t.`new_inventor_id`, nullif(trim(i.`name_first`), ''), nullif(trim(i.`name_last`), ''),
tinp.`num_patents`, ifnull(tina.`num_assignees`, 0), tilkl.`location_id`, tilkl.`persistent_location_id`, tilkl.`city`, tilkl.`state`,
tilkl.`country`, tilkl.`latitude`, tilkl.`longitude`, tifls.`first_seen_date`, tifls.`last_seen_date`,
ifnull(case when tifls.`actual_years_active` < 1 then 1 else tifls.`actual_years_active` end, 0),
i.`id`
from
`patent_20150826`.`inventor` i
inner join `PatentsView_20150826_v1`.`temp_id_mapping_inventor` t on t.`old_inventor_id` = i.`id`
left outer join `PatentsView_20150826_v1`.`temp_inventor_lastknown_location` tilkl on tilkl.`inventor_id` = i.`id`
inner join `PatentsView_20150826_v1`.`temp_inventor_num_patents` tinp on tinp.`inventor_id` = i.`id`
left outer join `PatentsView_20150826_v1`.`temp_inventor_years_active` tifls on tifls.`inventor_id` = i.`id`
left outer join `PatentsView_20150826_v1`.`temp_inventor_num_assignees` tina on tina.`inventor_id` = i.`id`;
# END inventor ################################################################################################################################################
# BEGIN usapplicationcitation #################################################################################################################################
drop table if exists `PatentsView_20150826_v1`.`usapplicationcitation`;
create table `PatentsView_20150826_v1`.`usapplicationcitation`
(
`citing_patent_id` varchar(20) not null,
`sequence` int not null,
`cited_application_id` varchar(20) null,
`date` date null,
`name` varchar(64) null,
`kind` varchar(10) null,
`category` varchar(20) null,
primary key (`citing_patent_id`, `sequence`)
)
engine=InnoDB;
# 13,617,656 @ 8:22
insert into `PatentsView_20150826_v1`.`usapplicationcitation`
(
`citing_patent_id`, `sequence`, `cited_application_id`,
`date`, `name`, `kind`, `category`
)
select
ac.`patent_id`, ac.`sequence`, ac.`application_id_transformed`,
case when ac.`date` > date('1899-12-31') and ac.`date` < date_add(current_date, interval 10 year) then ac.`date` else null end,
nullif(trim(ac.`name`), ''),
nullif(trim(ac.`kind`), ''),
nullif(trim(ac.`category`), '')
from
`PatentsView_20150826_v1`.`patent` p
inner join `patent_20150826`.`usapplicationcitation` ac on ac.`patent_id` = p.`patent_id`;
# END usapplicationcitation ###################################################################################################################################
# BEGIN uspatentcitation ######################################################################################################################################
drop table if exists `PatentsView_20150826_v1`.`uspatentcitation`;
create table `PatentsView_20150826_v1`.`uspatentcitation`
(
`citing_patent_id` varchar(20) not null,
`sequence` int not null,
`cited_patent_id` varchar(20) null,
`category` varchar(20) null,
primary key (`citing_patent_id`, `sequence`)
)
engine=InnoDB;
# 71,126,097 @ 32:52
insert into `PatentsView_20150826_v1`.`uspatentcitation`
(`citing_patent_id`, `sequence`, `cited_patent_id`, `category`)
select
pc.`patent_id`, pc.`sequence`, nullif(trim(pc.`citation_id`), ''), nullif(trim(pc.`category`), '')
from
`PatentsView_20150826_v1`.`patent` p
inner join `patent_20150826`.`uspatentcitation` pc on pc.`patent_id` = p.`patent_id`;
# END uspatentcitation ########################################################################################################################################
# BEGIN cpc_current ###########################################################################################################################################
drop table if exists `PatentsView_20150826_v1`.`temp_cpc_current_subsection_aggregate_counts`;
create table `PatentsView_20150826_v1`.`temp_cpc_current_subsection_aggregate_counts`
(
`subsection_id` varchar(20) not null,
`num_assignees` int unsigned not null,
`num_inventors` int unsigned not null,
`num_patents` int unsigned not null,
`first_seen_date` date null,
`last_seen_date` date null,
`actual_years_active` smallint unsigned not null,
primary key (`subsection_id`)
)
engine=InnoDB;
# 29:37
insert into `PatentsView_20150826_v1`.`temp_cpc_current_subsection_aggregate_counts`
(
`subsection_id`, `num_assignees`, `num_inventors`, `num_patents`,
`first_seen_date`, `last_seen_date`, `actual_years_active`
)
select
c.`subsection_id`,
count(distinct pa.`assignee_id`) num_assignees,
count(distinct pii.`inventor_id`) num_inventors,
count(distinct c.`patent_id`) num_patents,
min(p.`date`), max(p.`date`),
ifnull(round(timestampdiff(day, min(p.`date`), max(p.`date`)) / 365), 0)
from
`patent_20150826`.`cpc_current` c
left outer join `patent_20150826`.`patent_assignee` pa on pa.`patent_id` = c.`patent_id`
left outer join `patent_20150826`.`patent_inventor` pii on pii.`patent_id` = c.`patent_id`
left outer join `PatentsView_20150826_v1`.`patent` p on p.`patent_id` = c.`patent_id`
group by
c.`subsection_id`;
drop table if exists `PatentsView_20150826_v1`.`temp_cpc_subsection_title`;
create table `PatentsView_20150826_v1`.`temp_cpc_subsection_title`
(
`id` varchar(20) not null,
`title` varchar(256) null,
primary key (`id`)
)
engine=InnoDB;
# 0.125 sec
insert into `PatentsView_20150826_v1`.`temp_cpc_subsection_title`
(`id`, `title`)
select
`id`,
case when binary replace(`title`, 'e.g.', 'E.G.') = binary ucase(`title`)
then concat(ucase(substring(trim(`title`), 1, 1)), lcase(substring(trim(nullif(`title`, '')), 2)))
else `title`
end
from
`patent_20150826`.`cpc_subsection`;
drop table if exists `PatentsView_20150826_v1`.`temp_cpc_group_title`;
create table `PatentsView_20150826_v1`.`temp_cpc_group_title`
(
`id` varchar(20) not null,
`title` varchar(256) null,
primary key (`id`)
)
engine=InnoDB;
# 0.156
insert into `PatentsView_20150826_v1`.`temp_cpc_group_title`
(`id`, `title`)
select
`id`,
case when binary replace(`title`, 'e.g.', 'E.G.') = binary ucase(`title`)
then concat(ucase(substring(trim(`title`), 1, 1)), lcase(substring(trim(nullif(`title`, '')), 2)))
else `title`
end
from
`patent_20150826`.`cpc_group`;
drop table if exists `PatentsView_20150826_v1`.`temp_cpc_subgroup_title`;
create table `PatentsView_20150826_v1`.`temp_cpc_subgroup_title`
(
`id` varchar(20) not null,
`title` varchar(512) null,
primary key (`id`)
)
engine=InnoDB;
# 0:07
insert into `PatentsView_20150826_v1`.`temp_cpc_subgroup_title`
(`id`, `title`)
select
`id`,
case when binary replace(`title`, 'e.g.', 'E.G.') = binary ucase(`title`)
then concat(ucase(substring(trim(`title`), 1, 1)), lcase(substring(trim(nullif(`title`, '')), 2)))
else `title`
end
from
`patent_20150826`.`cpc_subgroup`;
drop table if exists `PatentsView_20150826_v1`.`cpc_current`;
create table `PatentsView_20150826_v1`.`cpc_current`
(
`patent_id` varchar(20) not null,
`sequence` int unsigned not null,
`section_id` varchar(10) null,
`subsection_id` varchar(20) null,
`subsection_title` varchar(512) null,
`group_id` varchar(20) null,
`group_title` varchar(256) null,
`subgroup_id` varchar(20) null,
`subgroup_title` varchar(512) null,
`category` varchar(36) null,
`num_assignees` int unsigned null,
`num_inventors` int unsigned null,
`num_patents` int unsigned null,
`first_seen_date` date null,
`last_seen_date` date null,
`years_active` smallint unsigned null,
primary key (`patent_id`, `sequence`)
)
engine=InnoDB;
# 23,151,381 @ 1:29:48
# 23,151,381 @ 36:32
insert into `PatentsView_20150826_v1`.`cpc_current`
(
`patent_id`, `sequence`, `section_id`, `subsection_id`,
`subsection_title`, `group_id`, `group_title`, `subgroup_id`,
`subgroup_title`, `category`,
`num_assignees`, `num_inventors`, `num_patents`,
`first_seen_date`, `last_seen_date`, `years_active`
)
select
p.`patent_id`, c.`sequence`,
nullif(trim(c.`section_id`), ''),
nullif(trim(c.`subsection_id`), ''),
nullif(trim(s.`title`), ''),
nullif(trim(c.`group_id`), ''),
nullif(trim(g.`title`), ''),
nullif(trim(c.`subgroup_id`), ''),
nullif(trim(sg.`title`), ''),
c.`category`, tccsac.`num_assignees`, tccsac.`num_inventors`,
tccsac.`num_patents`, tccsac.`first_seen_date`, tccsac.`last_seen_date`,
case when tccsac.`actual_years_active` < 1 then 1 else tccsac.`actual_years_active` end
from
`PatentsView_20150826_v1`.`patent` p
inner join `patent_20150826`.`cpc_current` c on p.`patent_id` = c.`patent_id`
left outer join `PatentsView_20150826_v1`.`temp_cpc_subsection_title` s on s.`id` = c.`subsection_id`
left outer join `PatentsView_20150826_v1`.`temp_cpc_group_title` g on g.`id` = c.`group_id`
left outer join `PatentsView_20150826_v1`.`temp_cpc_subgroup_title` sg on sg.`id` = c.`subgroup_id`
left outer join `PatentsView_20150826_v1`.`temp_cpc_current_subsection_aggregate_counts` tccsac on tccsac.`subsection_id` = c.`subsection_id`;
drop table if exists `PatentsView_20150826_v1`.`cpc_current_subsection`;
create table `PatentsView_20150826_v1`.`cpc_current_subsection`
(
`patent_id` varchar(20) not null,
`section_id` varchar(10) null,
`subsection_id` varchar(20) null,
`subsection_title` varchar(512) null,
`num_assignees` int unsigned null,
`num_inventors` int unsigned null,
`num_patents` int unsigned null,
`first_seen_date` date null,
`last_seen_date` date null,
`years_active` smallint unsigned null,
primary key (`patent_id`, `subsection_id`)
)
engine=InnoDB;
# 7,240,381 @ 19:00
insert into `PatentsView_20150826_v1`.`cpc_current_subsection`
(
`patent_id`, `section_id`, `subsection_id`, `subsection_title`,
`num_assignees`, `num_inventors`, `num_patents`,
`first_seen_date`, `last_seen_date`, `years_active`
)
select
c.`patent_id`,
c.`section_id`,
c.`subsection_id`,
nullif(trim(s.`title`), ''),
tccsac.`num_assignees`, tccsac.`num_inventors`,
tccsac.`num_patents`, tccsac.`first_seen_date`, tccsac.`last_seen_date`,
case when tccsac.`actual_years_active` < 1 then 1 else tccsac.`actual_years_active` end
from
(select distinct `patent_id`, `section_id`, `subsection_id` from `PatentsView_20150826_v1`.`cpc_current`) c
left outer join `PatentsView_20150826_v1`.`temp_cpc_subsection_title` s on s.`id` = c.`subsection_id`
left outer join `PatentsView_20150826_v1`.`temp_cpc_current_subsection_aggregate_counts` tccsac on tccsac.`subsection_id` = c.`subsection_id`;
# END cpc_current #############################################################################################################################################
# BEGIN cpc_current_subsection_patent_year ####################################################################################################################
drop table if exists `PatentsView_20150826_v1`.`cpc_current_subsection_patent_year`;
create table `PatentsView_20150826_v1`.`cpc_current_subsection_patent_year`
(
`subsection_id` varchar(20) not null,
`patent_year` smallint unsigned not null,
`num_patents` int unsigned not null,
primary key (`subsection_id`, `patent_year`)
)
engine=InnoDB;
# 13:24
insert into `PatentsView_20150826_v1`.`cpc_current_subsection_patent_year`
(`subsection_id`, `patent_year`, `num_patents`)
select
c.`subsection_id`, year(p.`date`), count(distinct c.`patent_id`)
from
`patent_20150826`.`cpc_current` c
inner join `PatentsView_20150826_v1`.`patent` p on p.`patent_id` = c.`patent_id` and p.`date` is not null
where
c.`subsection_id` is not null and c.`subsection_id` != ''
group by
c.`subsection_id`, year(p.`date`);
# END cpc_current_subsection_patent_year ######################################################################################################################
# BEGIN ipcr ##################################################################################################################################################
drop table if exists `PatentsView_20150826_v1`.`temp_ipcr_aggregations`;
create table `PatentsView_20150826_v1`.`temp_ipcr_aggregations`
(
`section` varchar(20) null,
`ipc_class` varchar(20) null,
`subclass` varchar(20) null,
`num_assignees` int unsigned not null,
`num_inventors` int unsigned not null,
primary key (`section`, `ipc_class`, `subclass`)
)
engine=InnoDB;
# 11:53
insert into `PatentsView_20150826_v1`.`temp_ipcr_aggregations`
(`section`, `ipc_class`, `subclass`, `num_assignees`, `num_inventors`)
select
i.`section`, i.`ipc_class`, i.`subclass`,
count(distinct pa.`assignee_id`),
count(distinct pii.`inventor_id`)
from
`patent_20150826`.`ipcr` i
left outer join `patent_20150826`.`patent_assignee` pa on pa.`patent_id` = i.`patent_id`
left outer join `patent_20150826`.`patent_inventor` pii on pii.`patent_id` = i.`patent_id`
group by
i.`section`, i.`ipc_class`, i.`subclass`;
drop table if exists `PatentsView_20150826_v1`.`temp_ipcr_years_active`;
create table `PatentsView_20150826_v1`.`temp_ipcr_years_active`
(
`section` varchar(20) null,
`ipc_class` varchar(20) null,
`subclass` varchar(20) null,
`first_seen_date` date null,
`last_seen_date` date null,
`actual_years_active` smallint unsigned not null,
primary key (`section`, `ipc_class`, `subclass`)
)
engine=InnoDB;
# 2:17
insert into `PatentsView_20150826_v1`.`temp_ipcr_years_active`
(
`section`, `ipc_class`, `subclass`, `first_seen_date`,
`last_seen_date`, `actual_years_active`
)
select
i.`section`, i.`ipc_class`, i.`subclass`,
min(p.`date`), max(p.`date`),
ifnull(round(timestampdiff(day, min(p.`date`), max(p.`date`)) / 365), 0)
from
`patent_20150826`.`ipcr` i
inner join `PatentsView_20150826_v1`.`patent` p on p.`patent_id`= i.`patent_id`
where
p.`date` is not null
group by
i.`section`, i.`ipc_class`, i.`subclass`;
drop table if exists `PatentsView_20150826_v1`.`ipcr`;
create table `PatentsView_20150826_v1`.`ipcr`
(
`patent_id` varchar(20) not null,
`sequence` int not null,
`section` varchar(20) null,
`ipc_class` varchar(20) null,
`subclass` varchar(20) null,
`main_group` varchar(20) null,
`subgroup` varchar(20) null,
`symbol_position` varchar(20) null,
`classification_value` varchar(20) null,
`classification_data_source` varchar(20) null,
`action_date` date null,
`ipc_version_indicator` date null,
`num_assignees` int unsigned null,
`num_inventors` int unsigned null,
`first_seen_date` date null,
`last_seen_date` date null,
`years_active` smallint unsigned null,
primary key (`patent_id`, `sequence`)
)
engine=InnoDB;
# 7,702,885 @ 6:38
insert into `PatentsView_20150826_v1`.`ipcr`
(
`patent_id`, `sequence`, `section`, `ipc_class`, `subclass`, `main_group`, `subgroup`,
`symbol_position`, `classification_value`, `classification_data_source`,
`action_date`, `ipc_version_indicator`, `num_assignees`, `num_inventors`,
`first_seen_date`, `last_seen_date`, `years_active`
)
select
p.`patent_id`, i.`sequence`, nullif(trim(i.`section`), ''), nullif(trim(i.`ipc_class`), ''), nullif(trim(i.`subclass`), ''),
nullif(trim(i.`main_group`), ''), nullif(trim(i.`subgroup`), ''), nullif(trim(i.`symbol_position`), ''),
nullif(trim(i.`classification_value`), ''), nullif(trim(i.`classification_data_source`), ''),
case when `action_date` > date('1899-12-31') and `action_date` < date_add(current_date, interval 10 year) then `action_date` else null end,
case when `ipc_version_indicator` > date('1899-12-31') and `ipc_version_indicator` < date_add(current_date, interval 10 year) then `ipc_version_indicator` else null end,
tia.`num_assignees`, tia.`num_inventors`, tiya.`first_seen_date`, tiya.`last_seen_date`,
ifnull(case when tiya.`actual_years_active` < 1 then 1 else tiya.`actual_years_active` end, 0)
from
`PatentsView_20150826_v1`.`patent` p
inner join `patent_20150826`.`ipcr` i on i.`patent_id` = p.`patent_id`
left outer join `PatentsView_20150826_v1`.`temp_ipcr_aggregations` tia on tia.`section` = i.`section` and tia.`ipc_class` = i.`ipc_class` and tia.`subclass` = i.`subclass`
left outer join `PatentsView_20150826_v1`.`temp_ipcr_years_active` tiya on tiya.`section` = i.`section` and tiya.`ipc_class` = i.`ipc_class` and tiya.`subclass` = i.`subclass`;
# END ipcr ####################################################################################################################################################
# BEGIN nber ##################################################################################################################################################
drop table if exists `PatentsView_20150826_v1`.`temp_nber_subcategory_aggregate_counts`;
create table `PatentsView_20150826_v1`.`temp_nber_subcategory_aggregate_counts`
(
`subcategory_id` varchar(20) not null,
`num_assignees` int unsigned not null,
`num_inventors` int unsigned not null,
`num_patents` int unsigned not null,
`first_seen_date` date null,
`last_seen_date` date null,
`actual_years_active` smallint unsigned not null,
primary key (`subcategory_id`)
)
engine=InnoDB;
# 38 @ 4:45
insert into `PatentsView_20150826_v1`.`temp_nber_subcategory_aggregate_counts`
(
`subcategory_id`, `num_assignees`, `num_inventors`, `num_patents`,
`first_seen_date`, `last_seen_date`, `actual_years_active`
)
select
n.`subcategory_id`,
count(distinct pa.`assignee_id`) num_assignees,
count(distinct pii.`inventor_id`) num_inventors,
count(distinct n.`patent_id`) num_patents,
min(p.`date`), max(p.`date`),
ifnull(round(timestampdiff(day, min(p.`date`), max(p.`date`)) / 365), 0)
from
`patent_20150826`.`nber` n
left outer join `patent_20150826`.`patent_assignee` pa on pa.`patent_id` = n.`patent_id`
left outer join `patent_20150826`.`patent_inventor` pii on pii.`patent_id` = n.`patent_id`
left outer join `PatentsView_20150826_v1`.`patent` p on p.`patent_id` = n.`patent_id`
group by
n.`subcategory_id`;
drop table if exists `PatentsView_20150826_v1`.`nber`;
create table `PatentsView_20150826_v1`.`nber`
(
`patent_id` varchar(20) not null,
`category_id` varchar(20) null,
`category_title` varchar(512) null,
`subcategory_id` varchar(20) null,
`subcategory_title` varchar(512) null,
`num_assignees` int unsigned null,
`num_inventors` int unsigned null,
`num_patents` int unsigned null,
`first_seen_date` date null,
`last_seen_date` date null,
`years_active` smallint unsigned null,
primary key (`patent_id`)
)
engine=InnoDB;
# 4,927,287 @ 1:47
insert into `PatentsView_20150826_v1`.`nber`
(
`patent_id`, `category_id`, `category_title`, `subcategory_id`,
`subcategory_title`,
`num_assignees`, `num_inventors`, `num_patents`,
`first_seen_date`, `last_seen_date`, `years_active`
)
select
p.`patent_id`,
nullif(trim(n.`category_id`), ''),
nullif(trim(c.`title`), ''),
nullif(trim(n.`subcategory_id`), ''),
nullif(trim(s.`title`), ''),
tnsac.`num_assignees`, tnsac.`num_inventors`, tnsac.`num_patents`,
tnsac.`first_seen_date`, tnsac.`last_seen_date`,
case when tnsac.`actual_years_active` < 1 then 1 else tnsac.`actual_years_active` end
from
`PatentsView_20150826_v1`.`patent` p
inner join `patent_20150826`.`nber` n on p.`patent_id` = n.`patent_id`
left outer join `patent_20150826`.`nber_category` c on c.`id` = n.`category_id`
left outer join `patent_20150826`.`nber_subcategory` s on s.`id` = n.`subcategory_id`
left outer join `PatentsView_20150826_v1`.`temp_nber_subcategory_aggregate_counts` tnsac on tnsac.`subcategory_id` = n.`subcategory_id`;
# END nber ####################################################################################################################################################
# BEGIN nber_subcategory_patent_year ##########################################################################################################################
drop table if exists `PatentsView_20150826_v1`.`nber_subcategory_patent_year`;
create table `PatentsView_20150826_v1`.`nber_subcategory_patent_year`
(
`subcategory_id` varchar(20) not null,
`patent_year` smallint unsigned not null,
`num_patents` int unsigned not null,
primary key (`subcategory_id`, `patent_year`)
)
engine=InnoDB;
# 1,483 @ 1:01
insert into `PatentsView_20150826_v1`.`nber_subcategory_patent_year`
(`subcategory_id`, `patent_year`, `num_patents`)
select
n.`subcategory_id`, year(p.`date`), count(distinct n.`patent_id`)
from
`patent_20150826`.`nber` n
inner join `PatentsView_20150826_v1`.`patent` p on p.`patent_id` = n.`patent_id` and p.`date` is not null
where
n.`subcategory_id` is not null and n.`subcategory_id` != ''
group by
n.`subcategory_id`, year(p.`date`);
# END nber_subcategory_patent_year ############################################################################################################################
# BEGIN uspc_current ##########################################################################################################################################
drop table if exists `PatentsView_20150826_v1`.`temp_mainclass_current_aggregate_counts`;
create table `PatentsView_20150826_v1`.`temp_mainclass_current_aggregate_counts`
(
`mainclass_id` varchar(20) not null,
`num_assignees` int unsigned not null,
`num_inventors` int unsigned not null,
`num_patents` int unsigned not null,
`first_seen_date` date null,
`last_seen_date` date null,
`actual_years_active` smallint unsigned not null,
primary key (`mainclass_id`)
)
engine=InnoDB;
# 24:52
insert into `PatentsView_20150826_v1`.`temp_mainclass_current_aggregate_counts`
(
`mainclass_id`, `num_assignees`, `num_inventors`, `num_patents`,
`first_seen_date`, `last_seen_date`, `actual_years_active`
)
select
u.`mainclass_id`,
count(distinct pa.`assignee_id`),
count(distinct pii.`inventor_id`),
count(distinct u.`patent_id`),
min(p.`date`), max(p.`date`),
ifnull(round(timestampdiff(day, min(p.`date`), max(p.`date`)) / 365), 0)
from
`patent_20150826`.`uspc_current` u
left outer join `patent_20150826`.`patent_assignee` pa on pa.`patent_id` = u.`patent_id`
left outer join `patent_20150826`.`patent_inventor` pii on pii.`patent_id` = u.`patent_id`
left outer join `PatentsView_20150826_v1`.`patent` p on p.`patent_id` = u.`patent_id` and p.`date` is not null
where
u.`mainclass_id` is not null and u.`mainclass_id` != ''
group by
u.`mainclass_id`;
drop table if exists `PatentsView_20150826_v1`.`temp_mainclass_current_title`;
create table `PatentsView_20150826_v1`.`temp_mainclass_current_title`
(
`id` varchar(20) not null,
`title` varchar(512) null,
primary key (`id`)
)
engine=InnoDB;
# "Fix" casing where necessary.
# 0.125 sec
insert into `PatentsView_20150826_v1`.`temp_mainclass_current_title`
(`id`, `title`)
select
`id`,
case when binary replace(`title`, 'e.g.', 'E.G.') = binary ucase(`title`)
then concat(ucase(substring(trim(`title`), 1, 1)), lcase(substring(trim(nullif(`title`, '')), 2)))
else `title`
end
from
`patent_20150826`.`mainclass_current`;
# Fix casing of subclass_current.
drop table if exists `PatentsView_20150826_v1`.`temp_subclass_current_title`;
create table `PatentsView_20150826_v1`.`temp_subclass_current_title`
(
`id` varchar(20) not null,
`title` varchar(512) null,
primary key (`id`)
)
engine=InnoDB;
# "Fix" casing where necessary.
# 1.719 sec
insert into `PatentsView_20150826_v1`.`temp_subclass_current_title`
(`id`, `title`)
select
`id`,
case when binary replace(`title`, 'e.g.', 'E.G.') = binary ucase(`title`)
then concat(ucase(substring(trim(`title`), 1, 1)), lcase(substring(trim(nullif(`title`, '')), 2)))
else `title`
end
from
`patent_20150826`.`subclass_current`;
drop table if exists `PatentsView_20150826_v1`.`uspc_current`;
create table `PatentsView_20150826_v1`.`uspc_current`
(
`patent_id` varchar(20) not null,
`sequence` int unsigned not null,
`mainclass_id` varchar(20) null,
`mainclass_title` varchar(256) null,
`subclass_id` varchar(20) null,
`subclass_title` varchar(512) null,
`num_assignees` int unsigned null,
`num_inventors` int unsigned null,
`num_patents` int unsigned null,
`first_seen_date` date null,
`last_seen_date` date null,
`years_active` smallint unsigned null,
primary key (`patent_id`, `sequence`)
)
engine=InnoDB;
# 21,191,230 @ 16:54
# 21,175,812 @ 1:02:06
# 21,175,812 @ 11:36
insert into `PatentsView_20150826_v1`.`uspc_current`
(
`patent_id`, `sequence`, `mainclass_id`,
`mainclass_title`, `subclass_id`, `subclass_title`,
`num_assignees`, `num_inventors`, `num_patents`,
`first_seen_date`, `last_seen_date`, `years_active`
)
select
p.`patent_id`, u.`sequence`,
nullif(trim(u.`mainclass_id`), ''),
nullif(trim(m.`title`), ''),
nullif(trim(u.`subclass_id`), ''),
nullif(trim(s.`title`), ''),
tmcac.`num_assignees`, tmcac.`num_inventors`, tmcac.`num_patents`,
tmcac.`first_seen_date`, tmcac.`last_seen_date`,
ifnull(case when tmcac.`actual_years_active` < 1 then 1 else tmcac.`actual_years_active` end, 0)
from
`PatentsView_20150826_v1`.`patent` p
inner join `patent_20150826`.`uspc_current` u on u.`patent_id` = p.`patent_id`
left outer join `PatentsView_20150826_v1`.`temp_mainclass_current_title` m on m.`id` = u.`mainclass_id`
left outer join `PatentsView_20150826_v1`.`temp_subclass_current_title` s on s.`id` = u.`subclass_id`
left outer join `PatentsView_20150826_v1`.`temp_mainclass_current_aggregate_counts` tmcac on tmcac.`mainclass_id` = u.`mainclass_id`;
drop table if exists `PatentsView_20150826_v1`.`uspc_current_mainclass`;
create table `PatentsView_20150826_v1`.`uspc_current_mainclass`
(
`patent_id` varchar(20) not null,
`mainclass_id` varchar(20) null,
`mainclass_title` varchar(256) null,
`num_assignees` int unsigned null,
`num_inventors` int unsigned null,
`num_patents` int unsigned null,
`first_seen_date` date null,
`last_seen_date` date null,
`years_active` smallint unsigned null,
primary key (`patent_id`, `mainclass_id`)
)
engine=InnoDB;
# 9,054,003 @ 9:27
insert into `PatentsView_20150826_v1`.`uspc_current_mainclass`
(
`patent_id`, `mainclass_id`, `mainclass_title`,
`num_assignees`, `num_inventors`, `num_patents`,
`first_seen_date`, `last_seen_date`, `years_active`
)
select
u.`patent_id`,
u.`mainclass_id`,
nullif(trim(m.`title`), ''),
tmcac.`num_assignees`, tmcac.`num_inventors`, tmcac.`num_patents`,
tmcac.`first_seen_date`, tmcac.`last_seen_date`,
ifnull(case when tmcac.`actual_years_active` < 1 then 1 else tmcac.`actual_years_active` end, 0)
from
(select distinct `patent_id`, `mainclass_id` from `PatentsView_20150826_v1`.`uspc_current`) u
left outer join `PatentsView_20150826_v1`.`temp_mainclass_current_title` m on m.`id` = u.`mainclass_id`
left outer join `PatentsView_20150826_v1`.`temp_mainclass_current_aggregate_counts` tmcac on tmcac.`mainclass_id` = u.`mainclass_id`;
# END uspc_current ############################################################################################################################################
# BEGIN uspc_current_mainclass_application_year ###############################################################################################################
drop table if exists `PatentsView_20150826_v1`.`uspc_current_mainclass_application_year`;
create table `PatentsView_20150826_v1`.`uspc_current_mainclass_application_year`
(
`mainclass_id` varchar(20) not null,
`application_year` smallint unsigned not null,
`sample_size` int unsigned not null,
`average_patent_processing_days` int unsigned null,
primary key (`mainclass_id`, `application_year`)
)
engine=InnoDB;
# 20,241 @ 0:56
insert into `PatentsView_20150826_v1`.`uspc_current_mainclass_application_year`
(`mainclass_id`, `application_year`, `sample_size`, `average_patent_processing_days`)
select
u.`mainclass_id`,
year(p.`earliest_application_date`),
count(*),
round(avg(p.`patent_processing_days`))
from
`PatentsView_20150826_v1`.`patent` p
inner join `PatentsView_20150826_v1`.`uspc_current` u on u.`patent_id` = p.`patent_id`
where
p.`patent_processing_days` is not null and u.`sequence` = 0
group by
u.`mainclass_id`, year(p.`earliest_application_date`);
# 5,406,673 @ 32:45
# Update the patent with the average mainclass processing days.
update
`PatentsView_20150826_v1`.`patent` p
inner join `PatentsView_20150826_v1`.`uspc_current` u on
u.`patent_id` = p.`patent_id` and u.`sequence` = 0
inner join `PatentsView_20150826_v1`.`uspc_current_mainclass_application_year` c on
c.`mainclass_id` = u.`mainclass_id` and c.`application_year` = year(p.`earliest_application_date`)
set
p.`uspc_current_mainclass_average_patent_processing_days` = c.`average_patent_processing_days`;
# END uspc_current_mainclass_application_year #################################################################################################################
# BEGIN uspc_current_mainclass_patent_year ####################################################################################################################
drop table if exists `PatentsView_20150826_v1`.`uspc_current_mainclass_patent_year`;
create table `PatentsView_20150826_v1`.`uspc_current_mainclass_patent_year`
(
`mainclass_id` varchar(20) not null,
`patent_year` smallint unsigned not null,
`num_patents` int unsigned not null,
primary key (`mainclass_id`, `patent_year`)
)
engine=InnoDB;
# 18,316 @ 12:56
insert into `PatentsView_20150826_v1`.`uspc_current_mainclass_patent_year`
(`mainclass_id`, `patent_year`, `num_patents`)
select
u.`mainclass_id`, year(p.`date`), count(distinct u.`patent_id`)
from
`patent_20150826`.`uspc_current` u
inner join `PatentsView_20150826_v1`.`patent` p on p.`patent_id` = u.`patent_id` and p.`date` is not null
where
u.`mainclass_id` is not null and u.`mainclass_id` != ''
group by
u.`mainclass_id`, year(p.`date`);
# END uspc_current_mainclass_patent_year ######################################################################################################################
# BEGIN assignee_inventor ######################################################################################################################
drop table if exists `PatentsView_20150826_v1`.`assignee_inventor`;
create table `PatentsView_20150826_v1`.`assignee_inventor`
(
`assignee_id` int unsigned not null,
`inventor_id` int unsigned not null,
`num_patents` int unsigned not null
)
engine=InnoDB;
# 4,352,502 @ 1:52
insert into `PatentsView_20150826_v1`.`assignee_inventor`
(`assignee_id`, `inventor_id`, `num_patents`)
select
pa.assignee_id, pi.inventor_id, count(distinct pa.patent_id)
from
`PatentsView_20150826_v1`.`patent_assignee` pa
inner join `PatentsView_20150826_v1`.`patent_inventor` pi using(patent_id)
group by
pa.assignee_id, pi.inventor_id;
# END assignee_inventor ######################################################################################################################
# BEGIN inventor_coinventor ######################################################################################################################
drop table if exists `PatentsView_20150826_v1`.`inventor_coinventor`;
create table `PatentsView_20150826_v1`.`inventor_coinventor`
(
`inventor_id` int unsigned not null,
`coinventor_id` int unsigned not null,
`num_patents` int unsigned not null
)
engine=InnoDB;
# 16,742,248 @ 11:55
insert into `PatentsView_20150826_v1`.`inventor_coinventor`
(`inventor_id`, `coinventor_id`, `num_patents`)
select
pi.inventor_id, copi.inventor_id, count(distinct copi.patent_id)
from
`PatentsView_20150826_v1`.`patent_inventor` pi
inner join `PatentsView_20150826_v1`.`patent_inventor` copi on pi.patent_id=copi.patent_id and pi.inventor_id<>copi.inventor_id
group by
pi.inventor_id, copi.inventor_id;
# END inventor_coinventor ######################################################################################################################
# BEGIN inventor_cpc_subsection ######################################################################################################################
drop table if exists `PatentsView_20150826_v1`.`inventor_cpc_subsection`;
create table `PatentsView_20150826_v1`.`inventor_cpc_subsection`
(
`inventor_id` int unsigned not null,
`subsection_id` varchar(20) not null,
`num_patents` int unsigned not null
)
engine=InnoDB;
# 7,171,415 @ 11:55
insert into `PatentsView_20150826_v1`.`inventor_cpc_subsection`
(`inventor_id`, `subsection_id`, `num_patents`)
select
pi.inventor_id, c.subsection_id, count(distinct c.patent_id)
from
`PatentsView_20150826_v1`.`patent_inventor` pi
inner join `PatentsView_20150826_v1`.`cpc_current_subsection` c using(patent_id)
where
c.subsection_id is not null and c.subsection_id != ''
group by
pi.inventor_id, c.subsection_id;
# END inventor_cpc_subsection ######################################################################################################################
# BEGIN inventor_nber_subcategory ######################################################################################################################
drop table if exists `PatentsView_20150826_v1`.`inventor_nber_subcategory`;
create table `PatentsView_20150826_v1`.`inventor_nber_subcategory`
(
`inventor_id` int unsigned not null,
`subcategory_id` varchar(20) not null,
`num_patents` int unsigned not null
)
engine=InnoDB;
#
insert into `PatentsView_20150826_v1`.`inventor_nber_subcategory`
(`inventor_id`, `subcategory_id`, `num_patents`)
select
pi.inventor_id, n.subcategory_id, count(distinct n.patent_id)
from
`PatentsView_20150826_v1`.`nber` n
inner join `PatentsView_20150826_v1`.`patent_inventor` pi using(patent_id)
where
n.subcategory_id is not null and n.subcategory_id != ''
group by
pi.inventor_id, n.subcategory_id;
# END inventor_nber_subcategory ######################################################################################################################
# BEGIN inventor_uspc_mainclass ######################################################################################################################
drop table if exists `PatentsView_20150826_v1`.`inventor_uspc_mainclass`;
create table `PatentsView_20150826_v1`.`inventor_uspc_mainclass`
(
`inventor_id` int unsigned not null,
`mainclass_id` varchar(20) not null,
`num_patents` int unsigned not null
)
engine=InnoDB;
# 10,350,577 @ 14:44
insert into `PatentsView_20150826_v1`.`inventor_uspc_mainclass`
(`inventor_id`, `mainclass_id`, `num_patents`)
select
pi.inventor_id, u.mainclass_id, count(distinct pi.patent_id)
from
`PatentsView_20150826_v1`.`patent_inventor` pi
inner join `PatentsView_20150826_v1`.`uspc_current_mainclass` u on pi.patent_id=u.patent_id
group by
pi.inventor_id, u.mainclass_id;
# END inventor_uspc_mainclass ######################################################################################################################
# BEGIN inventor_year ######################################################################################################################
drop table if exists `PatentsView_20150826_v1`.`inventor_year`;
create table `PatentsView_20150826_v1`.`inventor_year`
(
`inventor_id` int unsigned not null,
`patent_year` smallint not null,
`num_patents` int unsigned not null
)
engine=InnoDB;
# 8,140,017 @ 2:19
insert into `PatentsView_20150826_v1`.`inventor_year`
(`inventor_id`, `patent_year`, `num_patents`)
select
pi.inventor_id, p.year, count(distinct pi.patent_id)
from
`PatentsView_20150826_v1`.`patent_inventor` pi
inner join `PatentsView_20150826_v1`.`patent` p using(patent_id)
group by
pi.inventor_id, p.year;
# END inventor_year ######################################################################################################################
# BEGIN assignee_cpc_subsection ######################################################################################################################
drop table if exists `PatentsView_20150826_v1`.`assignee_cpc_subsection`;
create table `PatentsView_20150826_v1`.`assignee_cpc_subsection`
(
`assignee_id` int unsigned not null,
`subsection_id` varchar(20) not null,
`num_patents` int unsigned not null
)
engine=InnoDB;
# 933,903 @ 2:22
insert into `PatentsView_20150826_v1`.`assignee_cpc_subsection`
(`assignee_id`, `subsection_id`, `num_patents`)
select
pa.assignee_id, c.subsection_id, count(distinct c.patent_id)
from
`PatentsView_20150826_v1`.`patent_assignee` pa
inner join `PatentsView_20150826_v1`.`cpc_current_subsection` c using(patent_id)
where
c.subsection_id is not null and c.subsection_id != ''
group by
pa.assignee_id, c.subsection_id;
# END assignee_cpc_subsection ######################################################################################################################
# BEGIN assignee_nber_subcategory ######################################################################################################################
drop table if exists `PatentsView_20150826_v1`.`assignee_nber_subcategory`;
create table `PatentsView_20150826_v1`.`assignee_nber_subcategory`
(
`assignee_id` int unsigned not null,
`subcategory_id` varchar(20) not null,
`num_patents` int unsigned not null
)
engine=InnoDB;
# 618,873 @ 0:48
insert into `PatentsView_20150826_v1`.`assignee_nber_subcategory`
(`assignee_id`, `subcategory_id`, `num_patents`)
select
pa.assignee_id, n.subcategory_id, count(distinct n.patent_id)
from
`PatentsView_20150826_v1`.`patent_assignee` pa
inner join `PatentsView_20150826_v1`.`nber` n using(patent_id)
where
n.subcategory_id is not null and n.subcategory_id != ''
group by
pa.assignee_id, n.subcategory_id;
# END assignee_nber_subcategory ######################################################################################################################
# BEGIN assignee_uspc_mainclass ######################################################################################################################
drop table if exists `PatentsView_20150826_v1`.`assignee_uspc_mainclass`;
create table `PatentsView_20150826_v1`.`assignee_uspc_mainclass`
(
`assignee_id` int unsigned not null,
`mainclass_id` varchar(20) not null,
`num_patents` int unsigned not null
)
engine=InnoDB;
# 1,534,644 @ 3:30
insert into `PatentsView_20150826_v1`.`assignee_uspc_mainclass`
(`assignee_id`, `mainclass_id`, `num_patents`)
select
pa.assignee_id, u.mainclass_id, count(distinct pa.patent_id)
from
`PatentsView_20150826_v1`.`patent_assignee` pa
inner join `PatentsView_20150826_v1`.`uspc_current_mainclass` u on pa.patent_id=u.patent_id
group by
pa.assignee_id, u.mainclass_id;
# END assignee_uspc_mainclass ######################################################################################################################
# BEGIN assignee_year ######################################################################################################################
drop table if exists `PatentsView_20150826_v1`.`assignee_year`;
create table `PatentsView_20150826_v1`.`assignee_year`
(
`assignee_id` int unsigned not null,
`patent_year` smallint not null,
`num_patents` int unsigned not null
)
engine=InnoDB;
# 931,856 @ 2:00
insert into `PatentsView_20150826_v1`.`assignee_year`
(`assignee_id`, `patent_year`, `num_patents`)
select
pa.assignee_id, p.year, count(distinct pa.patent_id)
from
`PatentsView_20150826_v1`.`patent_assignee` pa
inner join `PatentsView_20150826_v1`.`patent` p using(patent_id)
group by
pa.assignee_id, p.year;
# END assignee_year ######################################################################################################################
# BEGIN location_assignee update num_patents ###################################################################################################################################
# 434,823 @ 0:17
update
`PatentsView_20150826_v1`.`location_assignee` la
inner join
(
select
`location_id`, `assignee_id`, count(distinct `patent_id`) num_patents
from
`PatentsView_20150826_v1`.`patent_assignee`
group by
`location_id`, `assignee_id`
) pa on pa.`location_id` = la.`location_id` and pa.`assignee_id` = la.`assignee_id`
set
la.`num_patents` = pa.`num_patents`;
# END location_assignee update num_patents ###################################################################################################################################
# BEGIN location_inventor update num_patents ###################################################################################################################################
# 4,167,939 @ 2:33
update
`PatentsView_20150826_v1`.`location_inventor` li
inner join
(
select
`location_id`, `inventor_id`, count(distinct `patent_id`) num_patents
from
`PatentsView_20150826_v1`.`patent_inventor`
group by
`location_id`, `inventor_id`
) pii on pii.`location_id` = li.`location_id` and pii.`inventor_id` = li.`inventor_id`
set
li.`num_patents` = pii.`num_patents`;
# END location_assignee update num_patents ###################################################################################################################################
# BEGIN location_cpc_subsection ######################################################################################################################
drop table if exists `PatentsView_20150826_v1`.`location_cpc_subsection`;
create table `PatentsView_20150826_v1`.`location_cpc_subsection`
(
`location_id` int unsigned not null,
`subsection_id` varchar(20) not null,
`num_patents` int unsigned not null
)
engine=InnoDB;
# 1,077,971 @ 6:19
insert into `PatentsView_20150826_v1`.`location_cpc_subsection`
(`location_id`, `subsection_id`, `num_patents`)
select
tlp.`location_id`, cpc.`subsection_id`, count(distinct tlp.`patent_id`)
from
`PatentsView_20150826_v1`.`temp_location_patent` tlp
inner join `PatentsView_20150826_v1`.`cpc_current_subsection` cpc using(`patent_id`)
group by
tlp.`location_id`, cpc.`subsection_id`;
# END location_cpc_subsection ######################################################################################################################
# BEGIN location_uspc_mainclass ######################################################################################################################
drop table if exists `PatentsView_20150826_v1`.`location_uspc_mainclass`;
create table `PatentsView_20150826_v1`.`location_uspc_mainclass`
(
`location_id` int unsigned not null,
`mainclass_id` varchar(20) not null,
`num_patents` int unsigned not null
)
engine=InnoDB;
# 2,260,351 @ 7:47
insert into `PatentsView_20150826_v1`.`location_uspc_mainclass`
(`location_id`, `mainclass_id`, `num_patents`)
select
tlp.`location_id`, uspc.`mainclass_id`, count(distinct tlp.`patent_id`)
from
`PatentsView_20150826_v1`.`temp_location_patent` tlp
inner join `PatentsView_20150826_v1`.`uspc_current_mainclass` uspc using(`patent_id`)
group by
tlp.`location_id`, uspc.`mainclass_id`;
# END location_uspc_mainclass ######################################################################################################################
# BEGIN location_nber_subcategory ######################################################################################################################
drop table if exists `PatentsView_20150826_v1`.`location_nber_subcategory`;
create table `PatentsView_20150826_v1`.`location_nber_subcategory`
(
`location_id` int unsigned not null,
`subcategory_id` varchar(20) not null,
`num_patents` int unsigned not null
)
engine=InnoDB;
#
insert into `PatentsView_20150826_v1`.`location_nber_subcategory`
(`location_id`, `subcategory_id`, `num_patents`)
select
tlp.`location_id`, nber.`subcategory_id`, count(distinct tlp.`patent_id`)
from
`PatentsView_20150826_v1`.`temp_location_patent` tlp
inner join `PatentsView_20150826_v1`.`nber` nber using(`patent_id`)
group by
tlp.`location_id`, nber.`subcategory_id`;
# END location_nber_subcategory ######################################################################################################################
# BEGIN location_year ######################################################################################################################
drop table if exists `PatentsView_20150826_v1`.`location_year`;
create table `PatentsView_20150826_v1`.`location_year`
(
`location_id` int unsigned not null,
`year` smallint not null,
`num_patents` int unsigned not null
)
engine=InnoDB;
# 867,942 @ 1:19
insert into `PatentsView_20150826_v1`.`location_year`
(`location_id`, `year`, `num_patents`)
select
tlp.`location_id`, p.`year`, count(distinct tlp.`patent_id`)
from
`PatentsView_20150826_v1`.`temp_location_patent` tlp
inner join `PatentsView_20150826_v1`.`patent` p using(`patent_id`)
group by
tlp.`location_id`, p.`year`;
# END location_year ######################################################################################################################
# BEGIN additional indexing ###################################################################################################################################
# 1:53:23
alter table `PatentsView_20150826_v1`.`application` add index `ix_application_number` (`number`);
alter table `PatentsView_20150826_v1`.`application` add index `ix_application_patent_id` (`patent_id`);
alter table `PatentsView_20150826_v1`.`assignee` add index `ix_assignee_name_first` (`name_first`);
alter table `PatentsView_20150826_v1`.`assignee` add index `ix_assignee_name_last` (`name_last`);
alter table `PatentsView_20150826_v1`.`assignee` add index `ix_assignee_organization` (`organization`);
alter table `PatentsView_20150826_v1`.`assignee` add index `ix_assignee_persistent_assignee_id` (`persistent_assignee_id`);
alter table `PatentsView_20150826_v1`.`assignee_cpc_subsection` add index `ix_assignee_cpc_subsection_assignee_id` (`assignee_id`);
alter table `PatentsView_20150826_v1`.`assignee_cpc_subsection` add index `ix_assignee_cpc_subsection_subsection_id` (`subsection_id`);
alter table `PatentsView_20150826_v1`.`assignee_inventor` add index `ix_assignee_inventor_assignee_id` (`assignee_id`);
alter table `PatentsView_20150826_v1`.`assignee_inventor` add index `ix_assignee_inventor_inventor_id` (`inventor_id`);
alter table `PatentsView_20150826_v1`.`assignee_nber_subcategory` add index `ix_assignee_nber_subcategory_assignee_id` (`assignee_id`);
alter table `PatentsView_20150826_v1`.`assignee_nber_subcategory` add index `ix_assignee_nber_subcategory_subcategory_id` (`subcategory_id`);
alter table `PatentsView_20150826_v1`.`assignee_uspc_mainclass` add index `ix_assignee_uspc_mainclass_assignee_id` (`assignee_id`);
alter table `PatentsView_20150826_v1`.`assignee_uspc_mainclass` add index `ix_assignee_uspc_mainclass_mainclass_id` (`mainclass_id`);
alter table `PatentsView_20150826_v1`.`assignee_year` add index `ix_assignee_year_assignee_id` (`assignee_id`);
alter table `PatentsView_20150826_v1`.`assignee_year` add index `ix_assignee_year_year` (`patent_year`);
alter table `PatentsView_20150826_v1`.`cpc_current_subsection` add index `ix_cpc_current_subsection_subsection_id` (`subsection_id`);
alter table `PatentsView_20150826_v1`.`cpc_current_subsection` add index `ix_cpc_current_subsection_title` (`subsection_title`);
alter table `PatentsView_20150826_v1`.`cpc_current` add index `ix_cpc_current_group_id` (`group_id`);
alter table `PatentsView_20150826_v1`.`cpc_current` add index `ix_cpc_current_subgroup_id` (`subgroup_id`);
alter table `PatentsView_20150826_v1`.`cpc_current` add index `ix_cpc_current_subsection_id` (`subsection_id`);
alter table `PatentsView_20150826_v1`.`inventor` add index `ix_inventor_name_first` (`name_first`);
alter table `PatentsView_20150826_v1`.`inventor` add index `ix_inventor_name_last` (`name_last`);
alter table `PatentsView_20150826_v1`.`inventor` add index `ix_inventor_persistent_inventor_id` (`persistent_inventor_id`);
alter table `PatentsView_20150826_v1`.`inventor_coinventor` add index `ix_inventor_coinventor_inventor_id` (`inventor_id`);
alter table `PatentsView_20150826_v1`.`inventor_coinventor` add index `ix_inventor_coinventor_coinventor_id` (`coinventor_id`);
alter table `PatentsView_20150826_v1`.`inventor_cpc_subsection` add index `ix_inventor_cpc_subsection_inventor_id` (`inventor_id`);
alter table `PatentsView_20150826_v1`.`inventor_cpc_subsection` add index `ix_inventor_cpc_subsection_subsection_id` (`subsection_id`);
alter table `PatentsView_20150826_v1`.`inventor_nber_subcategory` add index `ix_inventor_nber_subcategory_inventor_id` (`inventor_id`);
alter table `PatentsView_20150826_v1`.`inventor_nber_subcategory` add index `ix_inventor_nber_subcategory_subcategory_id` (`subcategory_id`);
alter table `PatentsView_20150826_v1`.`inventor_uspc_mainclass` add index `ix_inventor_uspc_mainclass_inventor_id` (`inventor_id`);
alter table `PatentsView_20150826_v1`.`inventor_uspc_mainclass` add index `ix_inventor_uspc_mainclass_mainclass_id` (`mainclass_id`);
alter table `PatentsView_20150826_v1`.`inventor_year` add index `ix_inventor_year_inventor_id` (`inventor_id`);
alter table `PatentsView_20150826_v1`.`inventor_year` add index `ix_inventor_year_year` (`patent_year`);
alter table `PatentsView_20150826_v1`.`ipcr` add index `ix_ipcr_ipc_class` (`ipc_class`);
alter table `PatentsView_20150826_v1`.`location_assignee` add index `ix_location_assignee_assignee_id` (`assignee_id`);
alter table `PatentsView_20150826_v1`.`location_inventor` add index `ix_location_inventor_inventor_id` (`inventor_id`);
alter table `PatentsView_20150826_v1`.`location` add index `ix_location_city` (`city`);
alter table `PatentsView_20150826_v1`.`location` add index `ix_location_country` (`country`);
alter table `PatentsView_20150826_v1`.`location` add index `ix_location_persistent_location_id` (`persistent_location_id`);
alter table `PatentsView_20150826_v1`.`location` add index `ix_location_state` (`state`);
alter table `PatentsView_20150826_v1`.`location_cpc_subsection` add index `ix_location_cpc_subsection_location_id` (`location_id`);
alter table `PatentsView_20150826_v1`.`location_cpc_subsection` add index `ix_location_cpc_subsection_subsection_id` (`subsection_id`);
alter table `PatentsView_20150826_v1`.`location_nber_subcategory` add index `ix_location_nber_subcategory_location_id` (`location_id`);
alter table `PatentsView_20150826_v1`.`location_nber_subcategory` add index `ix_location_nber_subcategory_mainclass_id` (`subcategory_id`);
alter table `PatentsView_20150826_v1`.`location_uspc_mainclass` add index `ix_location_uspc_mainclass_location_id` (`location_id`);
alter table `PatentsView_20150826_v1`.`location_uspc_mainclass` add index `ix_location_uspc_mainclass_mainclass_id` (`mainclass_id`);
alter table `PatentsView_20150826_v1`.`location_year` add index `ix_location_year_location_id` (`location_id`);
alter table `PatentsView_20150826_v1`.`location_year` add index `ix_location_year_year` (`year`);
alter table `PatentsView_20150826_v1`.`nber` add index `ix_nber_subcategory_id` (`subcategory_id`);
alter table `PatentsView_20150826_v1`.`nber` add index `ix_nber_subcategory_title` (`subcategory_title`);
alter table `PatentsView_20150826_v1`.`patent_assignee` add index `ix_patent_assignee_location_id` (`location_id`);
alter table `PatentsView_20150826_v1`.`patent_inventor` add index `ix_patent_inventor_location_id` (`location_id`);
alter table `PatentsView_20150826_v1`.`patent` add index `ix_patent_date` (`date`);
alter table `PatentsView_20150826_v1`.`patent` add index `ix_patent_number` (`number`);
alter table `PatentsView_20150826_v1`.`patent` add index `ix_patent_title` (`title`(128));
alter table `PatentsView_20150826_v1`.`patent` add index `ix_patent_type` (`type`);
alter table `PatentsView_20150826_v1`.`patent` add index `ix_patent_year` (`year`);
alter table `PatentsView_20150826_v1`.`usapplicationcitation` add index `ix_usapplicationcitation_cited_application_id` (`cited_application_id`);
alter table `PatentsView_20150826_v1`.`uspatentcitation` add index `ix_uspatentcitation_cited_patent_id` (`cited_patent_id`);
alter table `PatentsView_20150826_v1`.`uspc_current_mainclass` add index `ix_uspc_current_mainclass_mainclass_id` (`mainclass_id`);
alter table `PatentsView_20150826_v1`.`uspc_current_mainclass` add index `ix_uspc_current_mainclass_mainclass_title` (`mainclass_title`);
alter table `PatentsView_20150826_v1`.`uspc_current` add index `ix_uspc_current_mainclass_id` (`mainclass_id`);
alter table `PatentsView_20150826_v1`.`uspc_current` add index `ix_uspc_current_subclass_id` (`subclass_id`);
alter table `PatentsView_20150826_v1`.`uspc_current` add index `ix_uspc_current_mainclass_title` (`mainclass_title`);
alter table `PatentsView_20150826_v1`.`uspc_current` add index `ix_uspc_current_subclass_title` (`subclass_title`);
alter table `PatentsView_20150826_v1`.`assignee` add index `ix_assignee_num_patents` (`num_patents`);
alter table `PatentsView_20150826_v1`.`assignee` add index `ix_assignee_num_inventors` (`num_inventors`);
alter table `PatentsView_20150826_v1`.`assignee_cpc_subsection` add index `ix_assignee_cpc_subsection_num_patents` (`num_patents`);
alter table `PatentsView_20150826_v1`.`assignee_inventor` add index `ix_assignee_inventor_num_patents` (`num_patents`);
alter table `PatentsView_20150826_v1`.`assignee_nber_subcategory` add index `ix_assignee_nber_subcategory_num_patents` (`num_patents`);
alter table `PatentsView_20150826_v1`.`assignee_uspc_mainclass` add index `ix_assignee_uspc_mainclass_num_patents` (`num_patents`);
alter table `PatentsView_20150826_v1`.`assignee_year` add index `ix_assignee_year_num_patents` (`num_patents`);
alter table `PatentsView_20150826_v1`.`cpc_current` add index `ix_cpc_current_num_patents` (`num_patents`);
alter table `PatentsView_20150826_v1`.`cpc_current` add index `ix_cpc_current_num_inventors` (`num_inventors`);
alter table `PatentsView_20150826_v1`.`cpc_current` add index `ix_cpc_current_num_assignees` (`num_assignees`);
alter table `PatentsView_20150826_v1`.`cpc_current_subsection` add index `ix_cpc_current_subsection_num_patents` (`num_patents`);
alter table `PatentsView_20150826_v1`.`cpc_current_subsection` add index `ix_cpc_current_subsection_num_inventors` (`num_inventors`);
alter table `PatentsView_20150826_v1`.`cpc_current_subsection` add index `ix_cpc_current_subsection_num_assignees` (`num_assignees`);
alter table `PatentsView_20150826_v1`.`cpc_current_subsection_patent_year` add index `ix_cpc_current_subsection_patent_year_num_patents` (`num_patents`);
alter table `PatentsView_20150826_v1`.`inventor` add index `ix_inventor_num_patents` (`num_patents`);
alter table `PatentsView_20150826_v1`.`inventor` add index `ix_inventor_num_assignees` (`num_assignees`);
alter table `PatentsView_20150826_v1`.`inventor_coinventor` add index `ix_inventor_coinventor_num_patents` (`num_patents`);
alter table `PatentsView_20150826_v1`.`inventor_cpc_subsection` add index `ix_inventor_cpc_subsection_num_patents` (`num_patents`);
alter table `PatentsView_20150826_v1`.`inventor_nber_subcategory` add index `ix_inventor_nber_subcategory_num_patents` (`num_patents`);
alter table `PatentsView_20150826_v1`.`inventor_uspc_mainclass` add index `ix_inventor_uspc_mainclass_num_patents` (`num_patents`);
alter table `PatentsView_20150826_v1`.`inventor_year` add index `ix_inventor_year_num_patents` (`num_patents`);
alter table `PatentsView_20150826_v1`.`ipcr` add index `ix_ipcr_num_inventors` (`num_inventors`);
alter table `PatentsView_20150826_v1`.`ipcr` add index `ix_ipcr_num_assignees` (`num_assignees`);
alter table `PatentsView_20150826_v1`.`location` add index `ix_location_num_patents` (`num_patents`);
alter table `PatentsView_20150826_v1`.`location` add index `ix_location_num_inventors` (`num_inventors`);
alter table `PatentsView_20150826_v1`.`location` add index `ix_location_num_assignees` (`num_assignees`);
alter table `PatentsView_20150826_v1`.`location_assignee` add index `ix_location_assignee_num_patents` (`num_patents`);
alter table `PatentsView_20150826_v1`.`location_cpc_subsection` add index `ix_location_cpc_subsection_num_patents` (`num_patents`);
alter table `PatentsView_20150826_v1`.`location_inventor` add index `ix_location_inventor_num_patents` (`num_patents`);
alter table `PatentsView_20150826_v1`.`location_nber_subcategory` add index `ix_location_nber_subcategory_num_patents` (`num_patents`);
alter table `PatentsView_20150826_v1`.`location_uspc_mainclass` add index `ix_location_uspc_mainclass_num_patents` (`num_patents`);
alter table `PatentsView_20150826_v1`.`location_year` add index `ix_location_year_num_patents` (`num_patents`);
alter table `PatentsView_20150826_v1`.`nber` add index `ix_nber_num_patents` (`num_patents`);
alter table `PatentsView_20150826_v1`.`nber` add index `ix_nber_num_inventors` (`num_inventors`);
alter table `PatentsView_20150826_v1`.`nber` add index `ix_nber_num_assignees` (`num_assignees`);
alter table `PatentsView_20150826_v1`.`nber_subcategory_patent_year` add index `ix_nber_subcategory_patent_year_num_patents` (`num_patents`);
alter table `PatentsView_20150826_v1`.`uspc_current` add index `ix_uspc_current_num_patents` (`num_patents`);
alter table `PatentsView_20150826_v1`.`uspc_current` add index `ix_uspc_current_num_inventors` (`num_inventors`);
alter table `PatentsView_20150826_v1`.`uspc_current` add index `ix_uspc_current_num_assignees` (`num_assignees`);
alter table `PatentsView_20150826_v1`.`uspc_current_mainclass` add index `ix_uspc_current_mainclass_num_patents` (`num_patents`);
alter table `PatentsView_20150826_v1`.`uspc_current_mainclass` add index `ix_uspc_current_mainclass_num_inventors` (`num_inventors`);
alter table `PatentsView_20150826_v1`.`uspc_current_mainclass` add index `ix_uspc_current_mainclass_num_assignees` (`num_assignees`);
alter table `PatentsView_20150826_v1`.`uspc_current_mainclass_patent_year` add index `ix_uspc_current_mainclass_patent_year_num_patents` (`num_patents`);
alter table `PatentsView_20150826_v1`.`inventor` add index `ix_inventor_lastknown_location_id` (`lastknown_location_id`);
alter table `PatentsView_20150826_v1`.`inventor` add index `ix_inventor_lastknown_persistent_location_id` (`lastknown_persistent_location_id`);
alter table `PatentsView_20150826_v1`.`inventor` add index `ix_inventor_first_seen_date` (`first_seen_date`);
alter table `PatentsView_20150826_v1`.`inventor` add index `ix_inventor_last_seen_date` (`last_seen_date`);
alter table `PatentsView_20150826_v1`.`nber` add index `ix_nber_category_id` (`category_id`);
alter table `PatentsView_20150826_v1`.`assignee` add index `ix_assignee_lastknown_location_id` (`lastknown_location_id`);
alter table `PatentsView_20150826_v1`.`assignee` add index `ix_assignee_lastknown_persistent_location_id` (`lastknown_persistent_location_id`);
alter table `PatentsView_20150826_v1`.`assignee` add index `ix_assignee_last_seen_date` (`last_seen_date`);
alter table `PatentsView_20150826_v1`.`assignee` add index `ix_assignee_first_seen_date` (`first_seen_date`);
alter table `PatentsView_20150826_v1`.`patent` add index `ix_patent_country` (`country`);
alter table `PatentsView_20150826_v1`.`patent` add index `ix_patent_num_claims` (`num_claims`);
alter table `PatentsView_20150826_v1`.`patent` add index `ix_patent_firstnamed_assignee_id` (`firstnamed_assignee_id`);
alter table `PatentsView_20150826_v1`.`patent` add index `ix_patent_firstnamed_assignee_persistent_id` (`firstnamed_assignee_persistent_id`);
alter table `PatentsView_20150826_v1`.`patent` add index `ix_patent_firstnamed_assignee_persistent_location_id` (`firstnamed_assignee_persistent_location_id`)
;
alter table `PatentsView_20150826_v1`.`patent` add index `ix_patent_firstnamed_assignee_location_id` (`firstnamed_assignee_location_id`);
alter table `PatentsView_20150826_v1`.`patent` add index `ix_patent_firstnamed_inventor_persistent_id` (`firstnamed_inventor_persistent_id`);
alter table `PatentsView_20150826_v1`.`patent` add index `ix_patent_firstnamed_inventor_persistent_location_id` (`firstnamed_inventor_persistent_location_id`);
alter table `PatentsView_20150826_v1`.`patent` add index `ix_patent_firstnamed_inventor_id` (`firstnamed_inventor_id`);
alter table `PatentsView_20150826_v1`.`patent` add index `ix_patent_firstnamed_inventor_location_id` (`firstnamed_inventor_location_id`);
# END additional indexing #####################################################################################################################################
# BEGIN new class table creation
#####################################################################################################################################
create table if not exists `PatentsView_20150826_v1`.`cpc_subsection` (id varchar(20) primary key,title varchar(256), num_patents int(10) unsigned, num_inventors int(10) unsigned, num_assignees int(10) unsigned,first_seen_date date,last_seen_date date,years_active smallint(5) unsigned);
create table if not exists `PatentsView_20150826_v1`.`cpc_subgroup` (id varchar(20) primary key,title varchar(512));
create table if not exists `PatentsView_20150826_v1`.`cpc_group` (id varchar(20) primary key,title varchar(256));
create table if not exists `PatentsView_20150826_v1`.`nber_category` (id varchar(20) primary key,title varchar(512));
create table if not exists `PatentsView_20150826_v1`.nber_subcategory (id varchar(20) primary key,title varchar(512), num_patents int(10) unsigned, num_inventors int(10) unsigned, num_assignees int(10) unsigned,first_seen_date date,last_seen_date date,years_active smallint(5) unsigned);
create table if not exists `PatentsView_20150826_v1`.uspc_mainclass (id varchar(20) primary key,title varchar(256), num_patents int(10) unsigned, num_inventors int(10) unsigned, num_assignees int(10) unsigned,first_seen_date date,last_seen_date date,years_active smallint(5) unsigned);
create table if not exists `PatentsView_20150826_v1`.uspc_subclass (id varchar(20) primary key,title varchar(512));
CREATE TABLE if not exists `PatentsView_20150826_v1`.`nber_copy` ( `patent_id` varchar(20) NOT NULL, `category_id` varchar(20) DEFAULT NULL, `subcategory_id` varchar(20) DEFAULT NULL,PRIMARY KEY (`patent_id`),KEY `ix_nber_subcategory_id` (`subcategory_id`),KEY `ix_nber_category_id` (`category_id`));
CREATE TABLE if not exists `PatentsView_20150826_v1`.`cpc_current_copy` ( `patent_id` varchar(20) NOT NULL, `sequence` int(10) unsigned NOT NULL, `section_id` varchar(10) DEFAULT NULL, `subsection_id` varchar(20) DEFAULT NULL, `group_id` varchar(20) DEFAULT NULL, `subgroup_id` varchar(20) DEFAULT NULL, `category` varchar(36) DEFAULT NULL, PRIMARY KEY (`patent_id`,`sequence`), KEY `ix_cpc_current_group_id` (`group_id`), KEY `ix_cpc_current_subgroup_id` (`subgroup_id`), KEY `ix_cpc_current_subsection_id` (`subsection_id`), KEY `ix_cpc_current_section_id` (`section_id`), KEY `ix_cpc_current_sequence` (`sequence`));
CREATE TABLE if not exists `PatentsView_20150826_v1`.`cpc_current_subsection_copy` ( `patent_id` varchar(20) NOT NULL, `section_id` varchar(10) DEFAULT NULL, `subsection_id` varchar(20) NOT NULL DEFAULT '', PRIMARY KEY (`patent_id`,`subsection_id`), KEY `ix_cpc_current_subsection_subsection_id` (`subsection_id`), KEY `ix_cpc_current_subsection_section_id` (`section_id`));
CREATE TABLE if not exists `PatentsView_20150826_v1`.`uspc_current_mainclass_copy` ( `patent_id` varchar(20) NOT NULL, `mainclass_id` varchar(20) NOT NULL DEFAULT '', PRIMARY KEY (`patent_id`,`mainclass_id`), KEY `ix_uspc_current_mainclass_mainclass_id` (`mainclass_id`));
CREATE TABLE if not exists `PatentsView_20150826_v1`.`uspc_current_copy` ( `patent_id` varchar(20) NOT NULL, `sequence` int(10) unsigned NOT NULL, `mainclass_id` varchar(20) DEFAULT NULL, `subclass_id` varchar(20) DEFAULT NULL, PRIMARY KEY (`patent_id`,`sequence`), KEY `ix_uspc_current_mainclass_id` (`mainclass_id`), KEY `ix_uspc_current_subclass_id` (`subclass_id`), KEY `ix_uspc_current_sequence` (`sequence`));
# END new class table creation
#####################################################################################################################################
# BEGIN new class table population
#####################################################################################################################################
insert into `PatentsView_20150826_v1`.cpc_subsection select subsection_id,subsection_title,num_patents,num_inventors,num_assignees,first_seen_date,last_seen_date,years_active from `PatentsView_20150826_v1`.cpc_current group by subsection_id;
insert into `PatentsView_20150826_v1`.cpc_group select group_id,group_title from `PatentsView_20150826_v1`.cpc_current group by group_id;
insert into `PatentsView_20150826_v1`.cpc_subgroup select subgroup_id,subgroup_title from `PatentsView_20150826_v1`.cpc_current group by subgroup_id;
insert into `PatentsView_20150826_v1`.nber_category select category_id,category_title from `PatentsView_20150826_v1`.nber group by category_id;
insert into `PatentsView_20150826_v1`.nber_subcategory select subcategory_id,subcategory_title,num_patents,num_inventors,num_assignees,first_seen_date,last_seen_date,years_active from `PatentsView_20150826_v1`.nber group by subcategory_id;
insert into `PatentsView_20150826_v1`.uspc_mainclass select mainclass_id,mainclass_title,num_patents, num_inventors, num_assignees,first_seen_date,last_seen_date,years_active from `PatentsView_20150826_v1`.uspc_current group by mainclass_id;
insert into `PatentsView_20150826_v1`.uspc_subclass select subclass_id,subclass_title from `PatentsView_20150826_v1`.uspc_current group by subclass_id;
insert into `PatentsView_20150826_v1`.uspc_current_mainclass_copy select distinct patent_id,mainclass_id from `PatentsView_20150826_v1`.uspc_current_mainclass;
insert into `PatentsView_20150826_v1`.cpc_current_subsection_copy select distinct patent_id,section_id,subsection_id from `PatentsView_20150826_v1`.cpc_current_subsection;
insert into `PatentsView_20150826_v1`.uspc_current_copy select distinct patent_id,sequence,mainclass_id,subclass_id from `PatentsView_20150826_v1`.uspc_current;
insert into `PatentsView_20150826_v1`.cpc_current_copy select distinct patent_id,sequence,section_id,subsection_id,group_id,subgroup_id,category from `PatentsView_20150826_v1`.cpc_current;
insert into `PatentsView_20150826_v1`.nber_copy select distinct patent_id,category_id,subcategory_id from `PatentsView_20150826_v1`.nber;
# END new class table population
#####################################################################################################################################
# BEGIN new class table indexing
#####################################################################################################################################
alter table `PatentsView_20150826_v1`.`cpc_subsection` add index `ix_cpc_subsection_num_patents` (`num_patents`);
alter table `PatentsView_20150826_v1`.`nber_subcategory` add index `ix_nber_subcategory_num_patents` (`num_patents`);
alter table `PatentsView_20150826_v1`.`uspc_mainclass` add index `ix_uspc_mainclass_num_patents` (`num_patents`);
alter table `PatentsView_20150826_v1`.`uspc_mainclass` add index `ix_uspc_mainclass_num_inventors` (`num_inventors`);
alter table `PatentsView_20150826_v1`.`uspc_mainclass` add index `ix_uspc_mainclass_num_assignees` (`num_assignees`);
alter table `PatentsView_20150826_v1`.`nber_subcategory` add index `ix_nber_subcategory_num_inventors` (`num_inventors`);
alter table `PatentsView_20150826_v1`.`nber_subcategory` add index `ix_nber_subcategory_num_assignees` (`num_assignees`);
alter table `PatentsView_20150826_v1`.`cpc_subsection` add index `ix_cpc_subsection_num_inventors` (`num_inventors`);
alter table `PatentsView_20150826_v1`.`cpc_subsection` add index `ix_cpc_subsection_num_assignees` (`num_assignees`);
# END new class table indexing
#####################################################################################################################################
# BEGIN temporary table removal ###############################################################################################################################
# select concat('drop table if exists `', `table_schema`, '`.`', `table_name`, '`;') from `information_schema`.`tables` where `table_schema` = 'PatentsView_20150826_v1' and `table_name` like 'temp\_%' order by `table_name`;
drop table if exists `PatentsView_20150826_v1`.`temp_assignee_lastknown_location`;
drop table if exists `PatentsView_20150826_v1`.`temp_assignee_num_patents`;
drop table if exists `PatentsView_20150826_v1`.`temp_assignee_years_active`;
drop table if exists `PatentsView_20150826_v1`.`temp_cpc_current_subsection_aggregate_counts`;
drop table if exists `PatentsView_20150826_v1`.`temp_cpc_group_title`;
drop table if exists `PatentsView_20150826_v1`.`temp_cpc_subgroup_title`;
drop table if exists `PatentsView_20150826_v1`.`temp_cpc_subsection_title`;
drop table if exists `PatentsView_20150826_v1`.`temp_id_mapping_assignee`;
drop table if exists `PatentsView_20150826_v1`.`temp_id_mapping_inventor`;
drop table if exists `PatentsView_20150826_v1`.`temp_id_mapping_location`;
drop table if exists `PatentsView_20150826_v1`.`temp_id_mapping_location_transformed`;
drop table if exists `PatentsView_20150826_v1`.`temp_inventor_lastknown_location`;
drop table if exists `PatentsView_20150826_v1`.`temp_inventor_num_patents`;
drop table if exists `PatentsView_20150826_v1`.`temp_inventor_years_active`;
drop table if exists `PatentsView_20150826_v1`.`temp_ipcr_aggregations`;
drop table if exists `PatentsView_20150826_v1`.`temp_ipcr_years_active`;
drop table if exists `PatentsView_20150826_v1`.`temp_location_num_assignees`;
drop table if exists `PatentsView_20150826_v1`.`temp_location_num_inventors`;
drop table if exists `PatentsView_20150826_v1`.`temp_location_num_patents`;
drop table if exists `PatentsView_20150826_v1`.`temp_location_patent`;
drop table if exists `PatentsView_20150826_v1`.`temp_mainclass_current_aggregate_counts`;
drop table if exists `PatentsView_20150826_v1`.`temp_mainclass_current_title`;
drop table if exists `PatentsView_20150826_v1`.`temp_nber_subcategory_aggregate_counts`;
drop table if exists `PatentsView_20150826_v1`.`temp_num_foreign_documents_cited`;
drop table if exists `PatentsView_20150826_v1`.`temp_num_times_cited_by_us_patents`;
drop table if exists `PatentsView_20150826_v1`.`temp_num_us_applications_cited`;
drop table if exists `PatentsView_20150826_v1`.`temp_num_us_patents_cited`;
drop table if exists `PatentsView_20150826_v1`.`temp_patent_aggregations`;
drop table if exists `PatentsView_20150826_v1`.`temp_patent_date`;
drop table if exists `PatentsView_20150826_v1`.`temp_patent_earliest_application_date`;
drop table if exists `PatentsView_20150826_v1`.`temp_patent_firstnamed_assignee`;
drop table if exists `PatentsView_20150826_v1`.`temp_patent_firstnamed_inventor`;
drop table if exists `PatentsView_20150826_v1`.`temp_subclass_current_title`;
drop table if exists `PatentsView_20150826_v1`.`temp_assignee_num_inventors`;
drop table if exists `PatentsView_20150826_v1`.`temp_inventor_num_assignees`;
# END temporary table removal #################################################################################################################################
# Run UnencodeHTMLEntities Python script followed by add_full_text_indexes SQL script.
| true |
c81e9a0105c4f040c072985a77ab7d91cf3e1451
|
SQL
|
DouglasUnisystem/BI
|
/CH 62715 - Balancete Gerencial - Ceres/VW_SALDO_BALANCETE.sql
|
UTF-8
| 1,708 | 3.515625 | 4 |
[] |
no_license
|
CREATE MATERIALIZED VIEW VW_SALDO_BALANCETE REFRESH FORCE ON DEMAND START WITH SYSDATE NEXT SYSDATE + 10/24/60 AS
SELECT RPAD(PC.COD_CONTA,8,' ') AS CTB_CONTA,
PC.TAMANHO,
PC.GRAU,
PC.NOME_CONTA,
TRUNC(CM.DATA_MVTO) AS DATA_MVTO,
CM.COD_EMPRESA,
CM.COD_FILIAL,
CM.COD_SAFRA,
SUM(CASE WHEN (TRUNC(FM.DATA_DOCUM)>= TO_DATE('01/01/2000','DD/MM/YYYY') AND TRUNC(FM.DATA_DOCUM)<= TRUNC(SYSDATE)) THEN Round(DECODE(CM.SEQ_PLA_PAGAR,NULL,DECODE(CM.SEQ_PLA_MOV_FIN,NULL,0,DECODE(FH.Deb_Cred,'D',CM.VALOR_REAL,0)),CM.VALOR_REAL),2) ELSE 0 END) AS TOTAL_DEBITO,
SUM(CASE WHEN (TRUNC(FM.DATA_DOCUM)>= TO_DATE('01/01/2000','DD/MM/YYYY') AND TRUNC(FM.DATA_DOCUM)<= TRUNC(SYSDATE)) THEN Round(DECODE(CM.SEQ_PLA_RECEBER,NULL,DECODE(CM.SEQ_PLA_MOV_FIN,NULL,0,DECODE(FH.Deb_Cred,'C',CM.VALOR_REAL,0)),CM.VALOR_REAL),2) ELSE 0 END) AS TOTAL_CREDITO,
COUNT(FM.SEQ_PLA_MOV_FIN) QTD_MOVI
FROM AGRICOLA.GER_PLANO_CONTAS PC,
AGRICOLA.GER_MOVIMENTO CM,
AGRICOLA.FIN_MOVIMENTO FM,
AGRICOLA.FIN_HISTORICOS FH
WHERE PC.COD_TABELA = (SELECT COD_TABELA_GERENCIAL FROM AGRICOLA.EMPRESAS WHERE ROWNUM = 1)
AND PC.COD_TABELA = CM.COD_TABELA
AND PC.COD_CONTA = CM.COD_CONTA
AND CM.COD_TABELA IN (SELECT COD_TABELA_GERENCIAL FROM AGRICOLA.EMPRESAS)
AND CM.SEQ_PLA_MOV_FIN IS NOT NULL
AND CM.SEQ_PLA_MOV_FIN = FM.SEQ_PLA_MOV_FIN
AND FM.SEQ_PLA_FIN_HIST = FH.SEQ_PLA_FIN_HIST
AND DECODE(FM.CANCELADO,NULL,'N',FM.CANCELADO) <> 'S'
GROUP BY PC.COD_CONTA,
PC.TAMANHO,
PC.GRAU,
PC.NOME_CONTA,
CM.DATA_MVTO,
CM.COD_EMPRESA,
CM.COD_FILIAL,
CM.COD_SAFRA;
| true |
f5af62218303d6e1643c6312009026ce1977c59a
|
SQL
|
vmejiaec/setimimpq
|
/KCG/xDB/Schema Objects/Schemas/dbo/Programmability/Stored Procedures/Procs1/Apu_Oferta_Equipo_Indice_Delete.proc.sql
|
UTF-8
| 654 | 3.015625 | 3 |
[] |
no_license
|
CREATE PROCEDURE dbo.Apu_Oferta_Equipo_Indice_Delete
(
@Original_Id varchar(17),
@Original_Codigo varchar(200),
@Original_Apu_Oferta_Equipo_Id varchar(17),
@Original_Apu_Indice_Id varchar(17),
@Original_Porcentaje numeric(5, 2),
@IsNull_Estado Int,
@Original_Estado char(3)
)
AS
SET NOCOUNT OFF;
DELETE FROM [Apu_Oferta_Equipo_Indice] WHERE (([Id] = @Original_Id) AND ([Codigo] = @Original_Codigo) AND ([Apu_Oferta_Equipo_Id] = @Original_Apu_Oferta_Equipo_Id) AND ([Apu_Indice_Id] = @Original_Apu_Indice_Id) AND ([Porcentaje] = @Original_Porcentaje) AND ((@IsNull_Estado = 1 AND [Estado] IS NULL) OR ([Estado] = @Original_Estado)))
| true |
798ddeac572353f20948979aa1a864576f1b35e9
|
SQL
|
HyoungUk/spring
|
/관련자료/springSrc2/shopping3/shopping3.sql
|
UTF-8
| 571 | 2.65625 | 3 |
[] |
no_license
|
create table user1 (
userId varchar2(20) primary key,
userName varchar2(20),
password varchar2(20),
postCode varchar2(8),
address VARCHAR2(50),
email VARCHAR2(50),
job VARCHAR2(30),
birthday DATE
);
select * from member3;
insert into user1 values
('kk1','길동1','ps1','111-111','서울시 서초구','kk1@korea.net','사회인','1979-01-01');
insert into user1 values
('kk2','길동2','ps2','222-222','부산시 남구','kk2@korea.net','사회인','1979-06-30');
insert into user1 values
('kk3','길동3','ps3','333-333','인천시 북구','kk3@korea.net','학생','1985-12-31');
| true |
25901369f57222a6d48e0b9e4db688a0142f1f5c
|
SQL
|
Web-Programmer-B-P/data-art-servlets
|
/src/main/resources/migration.sql
|
UTF-8
| 521 | 3.34375 | 3 |
[] |
no_license
|
create table users
(
id serial not null
constraint user_pk
primary key,
login varchar(100),
password varchar(200)
);
create table ticket
(
id serial not null
constraint ticket_pk
primary key,
name varchar(100),
description text,
status boolean default true,
user_id integer
constraint ticket_users_id_fk
references users
);
comment on table ticket is 'Заметки пользователя';
| true |
789f5973a707aeb069523837299170baca5566a2
|
SQL
|
MohammadRasool-Shaik/FastFood
|
/src/main/resources/schema.sql
|
UTF-8
| 992 | 3.359375 | 3 |
[] |
no_license
|
drop table item if exists;
create table item (item_id int generated by default as identity (start with 1) PRIMARY KEY, item_name varchar(50),
item_type varchar(10) not null, quantity integer, item_price double);
drop table user if exists;
create table user (user_id int generated by default as identity (start with 1) PRIMARY KEY, user_name varchar(50),
email varchar(50) not null, mobile_number BIGINT not null );
drop table cart if exists;
create table cart (cart_id integer generated by default as identity (start with 1), user_id integer,item_id integer);
drop table coupon if exists;
create table coupon (coupon_id integer generated by default as identity (start with 1), coupon_name varchar(50),discount double)
--drop table cart_items if exists;
--create table cart_items (cart_id integer not null, item_id integer not null, primary key (cart_id, item_id))
| true |
1b34c4c2bba954adadc67d182550ae987124ffe8
|
SQL
|
CDRobinsonIII/employee-tracker-node-mysql
|
/db/seed.sql
|
UTF-8
| 787 | 3.125 | 3 |
[
"MIT"
] |
permissive
|
USE employees_DB;
INSERT INTO department
(name)
VALUES
('Sales'),
('Engineering'),
('Finance'),
('Legal');
INSERT INTO role
(title, salary, department_id)
VALUES
('Sales Lead', 100000,1),
('Salesperson', 80000,1),
('Lead Engineer', 150000, 2),
('Software Engineer', 120000, 2),
('Account Manager', 160000, 3),
('Accountant', 125000, 3),
('Legal Team Lead', 250000, 4),
('Lawyer', 190000, 4);
INSERT INTO employee
(first_name, last_name, role_id, manager_id)
VALUES
('Ryan', 'Day', 1, NULL),
('Justin', 'Fields', 2,1),
('Kaitlyn','Stephens',3,NULL),
('Julius','Jones',4,3),
('Tray','Sermon',5, NULL),
('Chris','Olave',6,5),
('Master','Teague', 7, NULL),
('Cindy ', 'Gungerson', 8, 7);
| true |
cb8e2cd3c43be77f74bf2fe34cd0183b9da4bcea
|
SQL
|
RazwanTanvir/SocialSitePHPPractice
|
/socialsite.sql
|
UTF-8
| 3,019 | 3.015625 | 3 |
[] |
no_license
|
-- phpMyAdmin SQL Dump
-- version 4.6.5.2
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Aug 04, 2017 at 10:27 AM
-- Server version: 10.1.21-MariaDB
-- PHP Version: 5.6.30
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Database: `socialsite`
--
-- --------------------------------------------------------
--
-- Table structure for table `user`
--
CREATE TABLE `user` (
`id` int(11) NOT NULL,
`username` varchar(40) NOT NULL,
`email` varchar(40) NOT NULL,
`name` varchar(40) NOT NULL,
`phone` varchar(20) NOT NULL,
`password` varchar(64) NOT NULL,
`register_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `user`
--
INSERT INTO `user` (`id`, `username`, `email`, `name`, `phone`, `password`, `register_time`) VALUES
(1, 'razwantanvir8050@gmail.com', 'razwantanvir8050@gmail.com', 'Razwan Ahmed Tanvir', '1675008050', 'tanvir', '2017-08-01 21:19:39'),
(2, 'darul@gmail.com', 'darul@gmail.com', 'Darul Khan', '1978665443', 'darul', '2017-08-01 21:27:15'),
(3, 'sakib@gmail.com', 'sakib@gmail.com', 'Nazmus Sakib', '1683525977', 'sakib', '2017-08-04 00:37:26'),
(4, 'rahim@gmail.com', 'rahim@gmail.com', 'Rahim Sarkar', '1765332765', 'rahim', '2017-08-04 00:40:03');
-- --------------------------------------------------------
--
-- Table structure for table `user_post`
--
CREATE TABLE `user_post` (
`id` int(11) NOT NULL,
`user_id` int(11) NOT NULL,
`post_content` text NOT NULL,
`post_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `user_post`
--
INSERT INTO `user_post` (`id`, `user_id`, `post_content`, `post_time`) VALUES
(2, 1, 'hghfhgf', '2017-08-04 00:19:29'),
(3, 1, 'hgfhgfhgfghfh', '2017-08-04 00:19:42'),
(4, 1, 'bchgcbvcbv', '2017-08-04 00:20:17'),
(6, 1, 'Hello', '2017-08-04 00:27:23'),
(8, 2, 'hjgfhjghj', '2017-08-04 00:34:03'),
(10, 4, 'I am Rahim Sarker', '2017-08-04 00:40:32'),
(11, 3, 'I am sakib', '2017-08-04 00:41:04'),
(12, 2, 'Hello friends!', '2017-08-04 01:07:15');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `user`
--
ALTER TABLE `user`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `username` (`username`),
ADD UNIQUE KEY `email` (`email`);
--
-- Indexes for table `user_post`
--
ALTER TABLE `user_post`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `user`
--
ALTER TABLE `user`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
--
-- AUTO_INCREMENT for table `user_post`
--
ALTER TABLE `user_post`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=13;
/*!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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.