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
9f16ad91b34aef55edeae869ed840ae845c73384
SQL
bbajra/Gerrymanderin_ICS449
/Data/Queries/select_All_Total_Votes_BasedOnPrecint.sql
UTF-8
219
2.515625
3
[]
no_license
--Created by Vizeng Lee --all total votes based on precint --This script alone will tell us all total votes select countyname,pctname ,totvoting,usprstotal,USrepTOTAL, MNSENTOTAL, MNLEGTOTAL from results where pctname = var
true
f079cf9abd50a97ddc4eae0b7b3070ed909b97d7
SQL
novakdr/burger
/db/schema.sql
UTF-8
230
3.171875
3
[ "MIT" ]
permissive
/* MYSQL DATABASE & TABLE SCHEMA */ CREATE DATABASE burgers_db USE burgers_db CREATE TABLE burgers ( id INT AUTO_INCREMENT NOT NULL, burger_name VARCHAR(100) NOT NULL, devoured BOOLEAN NOT NULL, PRIMARY KEY (id) )
true
77d530b28e704ffba14a7a38021bf4b148fa6d84
SQL
GreyHumanBeing/Oracle_SQL
/8-Practica_AND_OR.sql
UTF-8
607
3.609375
4
[]
no_license
select first_name, hire_date, job_id from employees where job_id='IT_PROG' and salary < 6000; select * from employees where first_name like 'S%' and salary > 3000 and (department_id=50 or department_id=80) --Otra alternativa --minus select * from employees where first_name like 'S%' and salary > 3000 and department_id in(50,80); select * from employees where job_id='IT_PROG' and phone_number like '5%' and hire_date between '01-JAN-2007' and '31-DEC-2007';
true
106126eb6426587c9fc161c70f5fcd73b0978255
SQL
gregorovitz/formation_front-end_developpeur
/sql/DBSlide_LoadData_OK.sql
UTF-8
4,309
3.171875
3
[]
no_license
Begin transaction use DBSlide delete from course delete from professor delete from student delete from section delete from grade INSERT INTO section VALUES (1010, 'BSc Management', 12); INSERT INTO section VALUES (1020, 'MSc Management', 9); INSERT INTO section VALUES (1110, 'BSc Economics', 15); INSERT INTO section VALUES (1120, 'MSc Economics', 6); INSERT INTO section VALUES (1310, 'BA Sociology', 23); INSERT INTO section VALUES (1320, 'MA Sociology', 6); INSERT INTO professor VALUES (1, 'zidda', 'pietro', 1020, 402, 'pzidda', '2004-12-11', 1900); INSERT INTO professor VALUES (2, 'decrop', 'alain', 1120, 403, 'adecrop', '2003-05-09', 1950); INSERT INTO professor VALUES (3, 'giot', 'pierre', 1310, 404, 'pgiot', '2002-12-21', 2100); INSERT INTO professor VALUES (4, 'lecourt', 'christelle', 1310, 406, 'clecourt', '2003-05-07', 1750); INSERT INTO professor VALUES (5, 'scheppens', 'georges', 1020, 410, 'gscheppens', '1986-10-09', 2450); INSERT INTO professor VALUES (6, 'louveaux', 'francois', 1110, 407, 'flouveaux', '1990-05-07', 2200); INSERT INTO course VALUES ('EING2234', 'Derivatives', 3.0, 3); INSERT INTO course VALUES ('ECGE2184', 'Marketing management', 3.5, 2); INSERT INTO course VALUES ('EING2283', 'Marketing engineering', 4.0, 1); INSERT INTO course VALUES ('ECGE2183', 'Financial Management', 4.0, 3); INSERT INTO course VALUES ('EING2383', 'Supply chain management et e-business', 2.5, 5); INSERT INTO student VALUES (1, 'Georges', 'Lucas', '1944-05-17 00:00:00', 'glucas', 1320, 10, 'EG2210'); INSERT INTO student VALUES (2, 'Clint', 'Eastwood', '1930-05-31 00:00:00', 'ceastwoo', 1010, 4, 'EG2210'); INSERT INTO student VALUES (3, 'Sean', 'Connery', '1930-08-25 00:00:00', 'sconnery', 1020, 12, 'EG2110'); INSERT INTO student VALUES (4, 'Robert', 'De Niro', '1943-08-17 00:00:00', 'rde niro', 1110, 3, 'EG2210'); INSERT INTO student VALUES (5, 'Kevin', 'Bacon', '1958-07-08 00:00:00', 'kbacon', 1120, 16, '0'); INSERT INTO student VALUES (6, 'Kim', 'Basinger', '1953-12-08 00:00:00', 'kbasinge', 1310, 19, '0'); INSERT INTO student VALUES (7, 'Johnny', 'Depp', '1963-06-09 00:00:00', 'jdepp', 1110, 11, 'EG2210'); INSERT INTO student VALUES (8, 'Julia', 'Roberts', '1967-10-28 00:00:00', 'jroberts', 1120, 17, '0'); INSERT INTO student VALUES (9, 'Natalie', 'Portman', '1981-06-09 00:00:00', 'nportman', 1010, 4, 'EG2210'); INSERT INTO student VALUES (10, 'Georges', 'Clooney', '1961-05-06 00:00:00', 'gclooney', 1020, 4, 'EG2110'); INSERT INTO student VALUES (11, 'Andy', 'Garcia', '1956-04-12 00:00:00', 'agarcia', 1110, 19, '0'); INSERT INTO student VALUES (12, 'Bruce', 'Willis', '1955-03-19 00:00:00', 'bwillis', 1010, 6, 'EG2210'); INSERT INTO student VALUES (13, 'Tom', 'Cruise', '1962-07-03 00:00:00', 'tcruise', 1020, 4, 'EG2110'); INSERT INTO student VALUES (14, 'Reese', 'Witherspoon', '1976-03-22 00:00:00', 'rwithers', 1020, 7, 'EG1020'); INSERT INTO student VALUES (15, 'Sophie', 'Marceau', '1966-11-17 00:00:00', 'smarceau', 1110, 6, '0'); INSERT INTO student VALUES (16, 'Sarah', 'Michelle Gellar', '1977-04-14 00:00:00', 'smichell', 1020, 7, 'EG2110'); INSERT INTO student VALUES (17, 'Alyssa', 'Milano', '1972-12-19 00:00:00', 'amilano', 1110, 7, '0'); INSERT INTO student VALUES (18, 'Jennifer', 'Garner', '1972-04-17 00:00:00', 'jgarner', 1120, 18, '0'); INSERT INTO student VALUES (19, 'Michael J.', 'Fox', '1969-06-20 00:00:00', 'mfox', 1310, 3, '0'); INSERT INTO student VALUES (20, 'Tom', 'Hanks', '1956-07-09 00:00:00', 'thanks', 1020, 8, 'EG2110'); INSERT INTO student VALUES (21, 'David', 'Morse', '1953-10-11 00:00:00', 'dmorse', 1110, 2, '0'); INSERT INTO student VALUES (22, 'Sandra', 'Bullock', '1964-07-26 00:00:00', 'sbullock', 1010, 2, 'EG1020'); INSERT INTO student VALUES (23, 'Keanu', 'Reeves', '1964-09-02 00:00:00', 'kreeves', 1020, 10, 'EG2210'); INSERT INTO student VALUES (24, 'Shannen', 'Doherty', '1971-04-12 00:00:00', 'sdoherty', 1320, 2, 'EG2120'); INSERT INTO student VALUES (25, 'Halle', 'Berry', '1966-08-14 00:00:00', 'hberry', 1320, 18, 'EG2210'); INSERT INTO grade VALUES ('IG', 0, 7); INSERT INTO grade VALUES ('I', 8, 9); INSERT INTO grade VALUES ('F', 10, 11); INSERT INTO grade VALUES ('S', 12, 13); INSERT INTO grade VALUES ('B', 14, 15); INSERT INTO grade VALUES ('TB', 16, 17); INSERT INTO grade VALUES ('E', 18, 20); commit
true
d874a1d9429b91a124852fdf67eddc31d5f0923b
SQL
gitRobV/DojoAssignments
/Python/MySQL/mysql_countries/world.sql
UTF-8
2,925
4.46875
4
[]
no_license
-- What query would you run to get all the countries that speak Slovene? -- Your query should return the name of the country, language and language percentage. -- Your query should arrange the result by language percentage in descending order. (1) SELECT countries.name as country_name, languages.language as language, languages.percentage as lang_percent FROM countries LEFT JOIN languages ON countries.id = languages.country_id WHERE languages.language = "Slovene" ORDER BY languages.percentage DESC; -- What query would you run to display the total number of cities for each country? -- Your query should return the name of the country and the total number of cities. -- Your query should arrange the result by the number of cities in descending order. (3) select countries.name, count(cities.id) from countries left join cities on countries.id = cities.country_id group by countries.name order by count(cities.id) desc; -- What query would you run to get all the cities in Mexico with a population of greater than 500,000? -- Your query should arrange the result by population in descending order. (1) select cities.name, cities.population from cities join countries on cities.country_id = countries.id where countries.name = "Mexico" and cities.population > 500000 order by cities.population DESC; -- What query would you run to get all languages in each country with a percentage greater than 89%? -- Your query should arrange the result by percentage in descending order. (1) select countries.name as country, languages.language, languages.percentage from countries join languages on countries.id = languages.country_id where languages.percentage > 89.0 group by countries.name order by languages.percentage desc; -- What query would you run to get all the countries with Surface Area below 501 and Population greater than 100,000? (2) select countries.name, countries.surface_area, countries.population from countries where countries.surface_area < 501 and countries.population > 100000 order by countries.surface_area desc; -- What query would you run to get countries with only Constitutional Monarchy with a capital greater than 200 and a life expectancy greater than 75 years? select countries.name, countries.government_form , countries.capital, countries.life_expectancy from countries where countries.government_form like "Constitutional Monarchy%" and countries.capital > 200 and countries.life_expectancy > 75 order by countries.capital desc; -- What query would you run to get all the cities of Argentina inside the Buenos Aires district and have the population greater than 500, 000? -- The query should return the Country Name, City Name, District and Population. (2) select countries.name, cities.name, cities.district, cities.population from countries left join cities on countries.id = cities.country_id where cities.country_code = "ARG" and cities.population > 500000;
true
feec23ae54dda96e04511392fab04d79cac0f6b0
SQL
musec/clowder
/migrations/00000000000001_clowder_init_schema/up.sql
UTF-8
2,290
3.34375
3
[]
no_license
create table architectures ( id serial primary key not null, name varchar not null ); insert into architectures (name) values ('i386'), ('x86_64'); create table microarchitectures ( id serial primary key not null, arch_id integer not null, name varchar not null, url varchar, foreign key (arch_id) references architectures(id) ); create table processors ( id serial primary key not null, microarch_id integer not null, name varchar not null, cores integer not null, threads integer not null, freq_ghz float not null, url varchar, foreign key (microarch_id) references microarchitectures(id) ); create table machines ( id serial primary key not null, name varchar not null, processor_id integer not null, memory_gb integer not null, foreign key (processor_id) references processors(id) ); create table disks ( id serial primary key not null, machine_id integer not null, vendor text, model text, capacity_gb integer not null, ssd boolean not null, foreign key (machine_id) references machines(id) ); create table nics ( id serial primary key not null, machine_id integer not null, vendor text, model text, mac_address char(12) not null, speed_gbps integer not null, foreign key (machine_id) references machines(id) ); create table users ( id serial primary key not null, username varchar not null, name text not null ); create table emails ( id serial primary key not null, user_id integer not null, email text not null, foreign key (user_id) references users(id) ); create table roles ( id serial primary key not null, name text not null, can_alter_users boolean not null default false, can_view_users boolean not null default false ); create table role_assignments ( id serial primary key not null, user_id integer not null, role_id integer not null, foreign key (user_id) references users(id), foreign key (role_id) references roles(id) ); create table reservations ( id serial primary key not null, user_id integer not null, machine_id integer not null, scheduled_start timestamp with time zone not null, scheduled_end timestamp with time zone, actual_end timestamp with time zone, pxe_path text, nfs_root text, foreign key (user_id) references users(id), foreign key (machine_id) references machines(id) );
true
7a39be1b7e6692daa4a752c041accc454fc93332
SQL
dklykov/repo1
/cake/dreams.sql
UTF-8
765
2.59375
3
[]
no_license
-- phpMyAdmin SQL Dump -- version 2.11.4 -- http://www.phpmyadmin.net -- -- Хост: localhost -- Время создания: Май 30 2012 г., 14:33 -- Версия сервера: 5.1.28 -- Версия PHP: 5.4.3 SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO"; -- -- База данных: `cake` -- -- -------------------------------------------------------- -- -- Структура таблицы `dreams` -- CREATE TABLE IF NOT EXISTS `dreams` ( `id` int(10) NOT NULL, `Title` varchar(1000) NOT NULL, `Descr` varchar(4000) NOT NULL, `userid` decimal(10,0) NOT NULL, `created` date NOT NULL, `fullfilled` date NOT NULL, `Votes` decimal(10,0) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Дамп данных таблицы `dreams` --
true
eecf9a293bba937585c0c3e5e7b8c393620270e9
SQL
Shyamswami/toolbox
/df_details_pre_9.sql
UTF-8
606
3.28125
3
[]
no_license
select A.tablespace_name, file_name, bytes/1024/1024 curr_mb, autoextensible, maxbytes/1024/1024 max_mb, (increment_by * (select value from v$parameter where name='db_block_size'))/1024/1024 incr_mb from ( select tablespace_name, file_name, bytes, autoextensible, maxbytes, increment_by from dba_data_files union all select tablespace_name, file_name, bytes, autoextensible, maxbytes, increment_by from dba_temp_files ) A, dba_tablespaces B where A.tablespace_name = B.tablespace_name order by A.tablespace_name, file_name /
true
01997088c10a682391ccb94ebeeb7779c53dbe17
SQL
Spand0x/SoftUni
/MySQL/10 Exercises Table Relations/09 Peaks In Rila.sql
UTF-8
214
3.453125
3
[]
no_license
USE geography; SELECT mountain_range, peak_name, elevation AS 'peak_elevation' FROM peaks JOIN mountains ON peaks.mountain_id = mountains.id WHERE mountain_range = 'Rila' ORDER BY peak_elevation DESC;
true
809afeefbf6824880fe6aae0e5744c3ff9c74da4
SQL
abiais/Data-Warehouse
/example_analytics_queries.sql
UTF-8
800
4.3125
4
[]
no_license
-- Here are some example queries that could be run on the database -- Top 10 artists by number of songplays SELECT dim_artist.name, count(fact_songplay.id) FROM fact_songplay JOIN dim_artist ON fact_songplay.artist_id = dim_artist.id GROUP BY dim_artist.name LIMIT 10 -- Year of origin of the most played song SELECT dim_song.year, count(fact_songplay.id) FROM fact_songplay JOIN dim_song ON fact_songplay.song_id = dim_song.id GROUP BY dim_song.year LIMIT 1 -- Average number of songplay per weekday SELECT dim_time.weekday, count(fact_songplay.id)::FLOAT/count(distinct dim_time.day) AS average_nb_of_sonplays_per_dow FROM fact_songplay JOIN dim_time ON fact_songplay.start_time = dim_time.start_time GROUP BY dim_time.weekday ORDER BY weekday
true
c056a6a2209fcf97338b5739e25d7bba27503de2
SQL
frede122/vehicle-api
/Scripts/init-db.sql
UTF-8
6,114
4.15625
4
[]
no_license
-- USERS DATABASE ------------------------------------- create user 'questor'@'%' identified by '123'; grant all privileges on *.* to 'questor'@'%' with grant option; -- DATABASES ------------------------------------------ create database questor_vehicle; use questor_vehicle; /* create database questor_vehicle_test; use questor_vehicle_test; */ -- FUNCTIONS ----------------------------------------- DELIMITER $$ CREATE FUNCTION new_id() RETURNS CHAR(8) DETERMINISTIC BEGIN return (select LEFT(UUID(), 8)); end$$ -- TABLES -------------------------------------------- -- Usuários create table users( id char(8) not null, name varchar(150) not null, login varchar(50) not null, password varchar(80) not null, constraint PK_users primary key(id) ); alter table users add unique index UQ_users_login(login); -- Marcas create table brands( id char(8) not null, name varchar(200) not null, constraint PK_brands primary key(id) ); alter table brands add unique index UQ_brands_name(name); -- Modelos create table models ( id char(8) not null, id_brand char(8) not null, name varchar(200) not null, constraint PK_models primary key(id), constraint FK_models_id_brand foreign key(id_brand) references brands(id) on delete cascade ); alter table models add unique index UQ_models_name(name); -- Cores: Enum create table colors ( id int not null auto_increment, name varchar(50) not null, hex char(7) not null, constraint PK_colors primary key(id) ); alter table colors add unique index UQ_colors_name(name); -- Combustíveis: Enum create table fuels( id int not null auto_increment, name varchar(50) not null, constraint PK_fuels primary key(id) ); alter table fuels add unique index UQ_fuels_name(name); -- Veículos create table vehicles( id char(8) not null, year int not null, id_fuel int not null, id_color int not null, id_model char(8) not null, photo_date datetime null, date_creation datetime default current_timestamp, constraint PK_vehicles primary key(id), constraint FK_vehicles_id_model foreign key(id_model) references models(id) on delete cascade, constraint FK_vehicles_id_color foreign key(id_color) references colors(id) on delete cascade, constraint FK_vehicles_id_fuel foreign key(id_fuel) references fuels(id) on delete cascade ); -- Anuncios create table announcements( id char(8) not null, price_purchase decimal(8, 2) not null, price_sale decimal(8, 2) not null, date_sale date null, id_vehicle char(8) not null, date_creation datetime default current_timestamp, constraint PK_announcements primary key(id), constraint FK_announcements_id_vehicle foreign key(id_vehicle) references vehicles(id) on delete cascade ); alter table announcements add index IDX_announcements_date_sale(date_sale); create table contacts ( id char(8) not null, name varchar(150) not null, phone varchar(15) not null, constraint PK_contacts primary key(id) ); alter table contacts add index IDX_contacts_name(name); alter table contacts add constraint unique index UQ_contacts_phone(phone); create table reservations ( id char(8) not null, id_announcement char(8) not null, id_contact char(8) not null, date_sale date null, date_creation datetime default current_timestamp, constraint PK_reservations primary key(id), constraint FK_reservations_id_announcement foreign key (id_announcement) references announcements(id) on delete cascade, constraint FK_reservations_id_contact foreign key (id_contact) references contacts(id) on delete cascade ); alter table reservations add index IDX_reservations_date_sale(date_sale); -- DEFAULT VALUES ------------------------------------ insert into users(id, login, name, password) values (new_id(), 'joão', 'João', 'InddsksGcJidlvfsjkvTdg=='); insert into colors(id, name, hex) values (1, 'Branco', '#ffffff'), (2, 'Prata', '#bdbec0'), (3, 'Preto', '#000000'), (4, 'Cinza', '#939598'), (5, 'Marrom', '#b18457'), (6, 'Vermelho', '#cc1e2b'), (7, 'Azul', '#264599'), (8, 'Verde', '#00a651'); insert into fuels(id, name) values (1, 'Álcool'), (2, 'Gasolina'), (3, 'Álcool / Gasolina'); -- VIEWS --------------------------------------------- -- Não materializadas create view view_vehicles_list as select v.id, concat(v.year, ' | ', c.name, ' | ', f.name) as name, v.year, v.date_creation, c.id as color_id, c.name as color_name, c.hex as color_hex, f.id as fuel_id, f.name as fuel_name, b.id as brand_id, b.name as brand_name, m.id as model_id, m.name as model_name, v.photo_date from vehicles v join fuels f on f.id=v.id_fuel join colors c on c.id=v.id_color join models m on m.id=v.id_model join brands b on b.id=m.id_brand; create view view_announcements_list as select a.id, a.date_sale, a.date_creation, a.price_purchase, a.price_sale, c.id as color_id, b.id as brand_id, m.id as model_id, f.name as vehicle_fuel_name, v.id as vehicle_id, concat(v.year, ' | ', c.name, ' | ', f.name) as vehicle_name, v.year as vehicle_year, m.name as vehicle_model_name, b.name as vehicle_brand_name, c.name as vehicle_color_name, c.hex as vehicle_color_hex, (a.price_sale - a.price_purchase) as profit, v.photo_date from announcements a join vehicles v on v.id=a.id_vehicle join models m on m.id=v.id_model join brands b on b.id=m.id_brand join colors c on c.id=v.id_color join fuels f on f.id=v.id_fuel; create view view_reservations_list as select r.id, r.date_sale, r.date_creation, c.name as contact_name, c.phone as contact_phone, m.name as vehicle_model_name, b.name as vehicle_brand_name, a.id as announcement_id, concat(v.year, ' | ', co.name, ' | ', f.name) as announcement_name from reservations r join contacts c on c.id=r.id_contact join announcements a on a.id=r.id_announcement join vehicles v on v.id=a.id_vehicle join models m on m.id=v.id_model join brands b on b.id=m.id_brand join colors co on co.id=v.id_color join fuels f on f.id=v.id_fuel; -- Materializadas (Não é suportado nativamente pelo MYSQL) -- TRIGGERS ------------------------------------------
true
eca77747cc17dd12d2b78a7a7640372e1c10265f
SQL
paulcollet/CS420_SQL
/CS420_Lab5/CS420_Lab5/database1/Data.sql
UTF-8
777
2.609375
3
[]
no_license
 INSERT INTO shipping(ID, company, [time], price) VALUES (123456, 'FEDEX', 12, 1200.00), (123475, 'USPS' , 03, 100.00), (123568, 'USPS' , 03, 20.00), (125232, 'USPS' , 03, 12.00); INSERT INTO product(ID, name, quantity) VALUES (342123, 'sail boat', 01), (234553, 'sail', 01), (356334, 'life vest', 04), (234252, 'GPS', 01); INSERT INTO customer(custID, name) VALUES (104567, 'John' ), (103453, 'Sue' ), (110034, 'Hank' ), (101212, 'Brandy'); INSERT INTO price(productID, [from], price) VALUES (342123, '2014-01-20', 23,000.00), (234553, '2014-02-15', 1,000.00), (356334, '2014-02-10', 20.00), (234252, '2014-02-04', 85.00);
true
63b549e17aab13108be46453a1eeea7c487e7ff3
SQL
AlexandraGalindoCante/SIControlCapacitaciones
/bases de datos/dbcontrolcapacitacion_contrato.sql
UTF-8
2,693
3.171875
3
[]
no_license
CREATE DATABASE IF NOT EXISTS `dbcontrolcapacitacion` /*!40100 DEFAULT CHARACTER SET latin1 */; USE `dbcontrolcapacitacion`; -- MySQL dump 10.13 Distrib 5.7.17, for Win64 (x86_64) -- -- Host: localhost Database: dbcontrolcapacitacion -- ------------------------------------------------------ -- Server version 5.7.14 /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8 */; /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; /*!40103 SET TIME_ZONE='+00:00' */; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; -- -- Table structure for table `contrato` -- DROP TABLE IF EXISTS `contrato`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `contrato` ( `idContrato` int(11) NOT NULL AUTO_INCREMENT, `numContrato` varchar(45) NOT NULL, `fechaInicioLaboral` date NOT NULL, `fechaTerminacionContrato` date DEFAULT NULL, `tipoContrato_idtipoContrato` int(10) NOT NULL, `empresa` varchar(45) NOT NULL, `visibilidad` tinyint(1) NOT NULL, PRIMARY KEY (`idContrato`), UNIQUE KEY `numContrato` (`numContrato`), KEY `fk_Contrato_tipoContrato1_idx` (`tipoContrato_idtipoContrato`), CONSTRAINT `fk_Contrato_tipoContrato1` FOREIGN KEY (`tipoContrato_idtipoContrato`) REFERENCES `tipocontrato` (`idtipoContrato`) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `contrato` -- LOCK TABLES `contrato` WRITE; /*!40000 ALTER TABLE `contrato` DISABLE KEYS */; INSERT INTO `contrato` VALUES (2,'194000','2012-01-17','2012-06-17',1,'GF',1),(4,'109447425','2018-06-17','2001-06-18',1,'CyCP',1),(5,'0000100','2018-04-17','2001-11-17',2,'GF',1); /*!40000 ALTER TABLE `contrato` ENABLE KEYS */; UNLOCK TABLES; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; -- Dump completed on 2017-08-11 17:15:32
true
148f125714ce08810971b27117d23eeae2debeb5
SQL
smora17/Emelytours
/application/modules/setup/sql/016_1.5.0.sql
UTF-8
608
3.1875
3
[ "LicenseRef-scancode-unknown-license-reference", "MIT" ]
permissive
# Add column custom_field_type to table ip_custom_fields ALTER TABLE `ip_custom_fields` ADD COLUMN `custom_field_type` VARCHAR(64) NOT NULL AFTER `custom_field_table`; # Feature IP-162 # Allow invoice item to refer to a table `products` or to table `tasks` ALTER TABLE `ip_invoice_items` ADD COLUMN `item_task_id` INT(11) DEFAULT NULL AFTER `item_date_added`; # Add default hourly rate for tasks INSERT INTO `ip_settings` (`setting_key`, `setting_value`) VALUES ('default_hourly_rate', '0.00'); # Add tax rate to tasks ALTER TABLE `ip_tasks` ADD COLUMN `tax_rate_id` INT(11) NOT NULL AFTER `task_status`;
true
340009903f7310294a2232e29b88ca56ec117047
SQL
CahHjl/C---Cmbap
/Documentatie/SQL-files/DS_Licentie_controle.sql
UTF-8
659
2.703125
3
[]
no_license
CREATE TABLE Licentie_controle ( Licctrl_Id INTEGER NOT NULL PRIMARY KEY Autoincrement, Licctrl_StatusId INTEGER DEFAULT 175009, Licctrl_DispStatus VARCHAR(75) DEFAULT 'Licctrl-record is leeg / Tabelinitrecord', Licctrl_Programma VARCHAR(10) DEFAULT 'Cmbap'NOT NULL, Licctrl_Nr INTEGER DEFAULT 0 NOT NULL, Licctrl_Code VARCHAR(30), Licctrl_Type BYTE DEFAULT 1 NOT NULL, Licctrl_Usermode INTEGER DEFAULT 1 NOT NULL, Licctrl_ControleCode VARCHAR(30) DEFAULT '12345', FOREIGN KEY(LICCTRL_STATUSID) REFERENCES STATUS(STATUS_CODE) ON UPDATE CASCADE ON DELETE CASCADE ); CREATE UNIQUE INDEX "IdxLicctrl_Nr" ON Licentie_controle (Licctrl_Nr ASC);
true
2c33fd3c31d7e2b5e45f972b3ae43868d4bd6ba0
SQL
xxseric/allocine-de
/database/film_favoris.sql
UTF-8
1,452
3.234375
3
[]
no_license
-- phpMyAdmin SQL Dump -- version 3.4.5 -- http://www.phpmyadmin.net -- -- Client: localhost -- Généré le : Mer 16 Mai 2012 à 15:48 -- Version du serveur: 5.5.16 -- Version de PHP: 5.3.8 SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO"; SET time_zone = "+00:00"; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8 */; -- -- Base de données: `allocine` -- -- -------------------------------------------------------- -- -- Structure de la table `film_favoris` -- CREATE TABLE IF NOT EXISTS `film_favoris` ( `film_favoris_id` int(11) NOT NULL AUTO_INCREMENT, `film_id` int(11) NOT NULL, `user_id` int(11) NOT NULL, PRIMARY KEY (`film_favoris_id`), KEY `film_id` (`film_id`), KEY `user_id` (`user_id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ; -- -- Contraintes pour les tables exportées -- -- -- Contraintes pour la table `film_favoris` -- ALTER TABLE `film_favoris` ADD CONSTRAINT `film_favoris_ibfk_2` FOREIGN KEY (`user_id`) REFERENCES `user` (`user_id`), ADD CONSTRAINT `film_favoris_ibfk_1` FOREIGN KEY (`film_id`) REFERENCES `film` (`film_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
4bf609e76e6ee4aadcaf0ad693a537cccecbd9b8
SQL
w01f/VolgaTeam.SalesLibrary
/WebSalesLibraries/protected/data/tables/wallbin/tbl_link_bundle.sql
UTF-8
456
2.859375
3
[]
no_license
DROP TABLE IF EXISTS `tbl_link_bundle`; CREATE TABLE IF NOT EXISTS `tbl_link_bundle` ( `id` varchar(36) NOT NULL, `id_bundle` varchar(36) NOT NULL, `id_link` varchar(36) NOT NULL, `id_library` varchar(36) NOT NULL, `order` int(11) NOT NULL, `use_as_thumbnail` tinyint(1) NOT NULL, PRIMARY KEY (`id`), KEY `id_bundle` (`id_bundle`), KEY `id_link` (`id_link`), KEY `id_link_order` (`id_link`,`order`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
true
7b9f3f46ee928507fcc6fe008f6d942f90fa99ef
SQL
signature-opensource/CK-DB-Twitter
/CK.DB.User.UserTwitter/Res/Model.CK.UserTwitterTable.Install.2.0.1.sql
UTF-8
594
3.25
3
[ "MIT" ]
permissive
--[beginscript] create table CK.tUserTwitter ( UserId int not null, -- The Twitter account identifier is the key to identify a Twitter user. TwitterAccountId varchar(36) collate Latin1_General_100_BIN2 not null, LastLoginTime datetime2(2) not null, constraint PK_CK_UserTwitter primary key (UserId), constraint FK_CK_UserTwitter_UserId foreign key (UserId) references CK.tUser(UserId), constraint UK_CK_UserTwitter_TwitterAccountId unique( TwitterAccountId ) ); insert into CK.tUserTwitter( UserId, TwitterAccountId, LastLoginTime ) values( 0, '', sysutcdatetime() ); --[endscript]
true
c3f492f00d5c8e646e58d1fe4dde67164d1d88b2
SQL
fandashtic/arc_chennai
/Sivabalan-SQL/SQL_STORED_PROCEDURE/sp_update_TargetMeasure.sql
UTF-8
302
2.953125
3
[]
no_license
CREATE PROCEDURE [sp_update_TargetMeasure] (@MeasureID_1 [int], @MeasureID_2 [int], @Description_3 [nvarchar](128), @Active_4 [int]) AS UPDATE [TargetMeasure] SET [Description] = @Description_3, [Active] = @Active_4 WHERE ( [MeasureID] = @MeasureID_1)
true
d5bec0de19344776f905205945cac8cac0cb1e07
SQL
SeanCreagan/raceresults
/Create_JN_U18U20_Ranking.sql
UTF-8
532
2.578125
3
[]
no_license
CREATE TABLE `nensa_results_2017`.`JN_U18U20_RANKING` ( `Rank` INT NOT NULL, `USSA_Num` INT NOT NULL, `NENSA_Num` INT NOT NULL, `Season` INT NOT NULL, `Athlete_Name` VARCHAR(45) NOT NULL, `Num_Races` INT NULL, `1stBest_Race_Pts` DECIMAL(5,2) NULL, `2ndBest_Race_Pts` DECIMAL(5,2) NULL, `3rdBest_Race_Pts` DECIMAL(5,2) NULL, `4thBest_Race_Pts` DECIMAL(5,2) NULL, `Best2_Avg_Pts` DECIMAL(5,4) NULL, `Best3_Avg_Pts` DECIMAL(5,4) NULL, `Best4_Avg_Pts` DECIMAL(5,4) NULL, PRIMARY KEY (`NENSA_Num`, `Season`));
true
312b805914e4eb61170e1453e5739df885508af1
SQL
katshamai/sql-challenge
/Bonus/Bonus and Epilogue.sql
UTF-8
822
4.1875
4
[]
no_license
-- Bonus: Create View for Employee Salary and titles -- Join Salaries and Employees SELECT public."Salaries".emp_no, salary FROM public."Salaries" INNER JOIN public."Employees" ON public."Salaries".emp_no=public."Employees".emp_no; -- Join Employees and Titles SELECT public."Titles".title_id, title FROM public."Titles" INNER JOIN public."Employees" ON public."Titles".title_id=public."Employees".emp_title_id; -- Display Employee and Salaries Create View salary_title as Select til.title, sal.salary From public."Titles" as til, public."Salaries" as sal, public."Employees" as emp Where emp.emp_no= sal.emp_no AND emp.emp_title_id = til.title_id; SELECT * FROM salary_title; -- Epilogue: Search your ID number - 499942 SELECT first_name, last_name FROM public."Employees" WHERE emp_no = 499942;
true
10e1d4615e876180c815c78c3d277029151104fb
SQL
Kosmachevskiy/enterprise-patterns-training
/src/main/resources/init.sql
UTF-8
1,964
3.78125
4
[]
no_license
DROP TABLE IF EXISTS product_category; DROP TABLE IF EXISTS product; DROP TABLE IF EXISTS orders; DROP TABLE IF EXISTS product_item; DROP TABLE IF EXISTS user; CREATE TABLE product_category ( id IDENTITY AUTO_INCREMENT, name VARCHAR(50) ); CREATE TABLE product ( id IDENTITY AUTO_INCREMENT, name VARCHAR(50), price FLOAT, category_id BIGINT, count BIGINT, FOREIGN KEY (category_id) REFERENCES PUBLIC.PRODUCT_CATEGORY (id) ); CREATE TABLE user ( id IDENTITY AUTO_INCREMENT, name VARCHAR(50), password VARCHAR(50) ); CREATE TABLE orders ( id IDENTITY AUTO_INCREMENT, user_id BIGINT, date DATETIME, FOREIGN KEY (user_id) REFERENCES PUBLIC.USER (id) ); CREATE TABLE product_item ( id IDENTITY AUTO_INCREMENT, product_id BIGINT, order_id BIGINT, count INT, FOREIGN KEY (product_id) REFERENCES PUBLIC.PRODUCT (id), FOREIGN KEY (order_id) REFERENCES PUBLIC.ORDERS (id) ); INSERT INTO user (name, password) VALUES ('someUser', '!@#$%^&*()'); INSERT INTO product_category (name) VALUES ('Sneakers'); INSERT INTO product_category (name) VALUES ('Shoes'); INSERT INTO product_category (name) VALUES ('Stools'); INSERT INTO product (name, price, category_id, count) VALUES ('Reebok', 59.99, 1, 100500); INSERT INTO product (name, price, category_id, count) VALUES ('Reebok Shoes', 9.99, 2, 100501); INSERT INTO product (name, price, category_id, count) VALUES ('Nike', 69.69, 1, 100502); INSERT INTO product (name, price, category_id, count) VALUES ('Nike Shoes', 59.99, 2, 100503); INSERT INTO product (name, price, category_id, count) VALUES ('Nike Super', 899.99, 1, 100504); INSERT INTO product (name, price, category_id, count) VALUES ('New Nike', 999.99, 1, 100504); INSERT INTO product (name, price, category_id, count) VALUES ('Stool of Devil', 0.01, 3, 100505); INSERT INTO product (name, price, category_id, count) VALUES ('Holy Stool', 9999.99, 3, 100506);
true
6b50a04f92b942c012705a871d360920c28a9e04
SQL
RobertoAffonso/SGBD_Scripts
/Create_Database.sql
UTF-8
15,620
3.453125
3
[]
no_license
-- MySQL Workbench Forward Engineering SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0; SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0; SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL,ALLOW_INVALID_DATES'; -- ----------------------------------------------------- -- Schema mydb -- ----------------------------------------------------- DROP SCHEMA IF EXISTS `mydb` ; -- ----------------------------------------------------- -- Schema mydb -- ----------------------------------------------------- CREATE SCHEMA IF NOT EXISTS `mydb` DEFAULT CHARACTER SET utf8 ; USE `mydb` ; -- ----------------------------------------------------- -- Table `mydb`.`tb_usuario` -- ----------------------------------------------------- DROP TABLE IF EXISTS `mydb`.`tb_usuario` ; CREATE TABLE IF NOT EXISTS `mydb`.`tb_usuario` ( `idt_usuario` INT NOT NULL AUTO_INCREMENT, `usr_usuario` VARCHAR(30) NOT NULL, `eml_usuario` VARCHAR(50) NOT NULL, `pwd_usuario` VARCHAR(128) NOT NULL, `nme_usuario` VARCHAR(45) NOT NULL, `dta_usuario` DATE NOT NULL, `cel_usuario` VARCHAR(20) NOT NULL, `cpf_usuario` CHAR(11) NOT NULL, `rg_usuario` VARCHAR(7) NOT NULL, PRIMARY KEY (`idt_usuario`)) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `mydb`.`td_unidade_federativa` -- ----------------------------------------------------- DROP TABLE IF EXISTS `mydb`.`td_unidade_federativa` ; CREATE TABLE IF NOT EXISTS `mydb`.`td_unidade_federativa` ( `idt_estado` INT NOT NULL AUTO_INCREMENT, `nme_estado` VARCHAR(50) NOT NULL, `sgl_estado` VARCHAR(30) NOT NULL, PRIMARY KEY (`idt_estado`)) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `mydb`.`td_cidade` -- ----------------------------------------------------- DROP TABLE IF EXISTS `mydb`.`td_cidade` ; CREATE TABLE IF NOT EXISTS `mydb`.`td_cidade` ( `idt_cidade` INT NOT NULL AUTO_INCREMENT, `nme_cidade` VARCHAR(50) NOT NULL, `sts_capital_cidade` CHAR(1) NOT NULL, `cod_unidade_federativa` INT NOT NULL, PRIMARY KEY (`idt_cidade`), INDEX `fk_tb_cidade_tb_unidadeFederativa1_idx` (`cod_unidade_federativa` ASC), CONSTRAINT `fk_tb_cidade_tb_unidadeFederativa1` FOREIGN KEY (`cod_unidade_federativa`) REFERENCES `mydb`.`td_unidade_federativa` (`idt_estado`) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `mydb`.`td_tipo_espaco` -- ----------------------------------------------------- DROP TABLE IF EXISTS `mydb`.`td_tipo_espaco` ; CREATE TABLE IF NOT EXISTS `mydb`.`td_tipo_espaco` ( `idt_tipo_imovel` INT NOT NULL AUTO_INCREMENT, `nme_tipo_imovel` VARCHAR(45) NOT NULL, PRIMARY KEY (`idt_tipo_imovel`)) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `mydb`.`tb_espaco` -- ----------------------------------------------------- DROP TABLE IF EXISTS `mydb`.`tb_espaco` ; CREATE TABLE IF NOT EXISTS `mydb`.`tb_espaco` ( `idt_area` INT NOT NULL AUTO_INCREMENT, `area_espaco` FLOAT NOT NULL, `cep_espaco` CHAR(9) NOT NULL COMMENT '70,372-090', `qtd_hospedes_espaco` INT NOT NULL, `end_espaco` TEXT NOT NULL, `cod_tipo_espaco` INT NOT NULL, `cod_cidade` INT NOT NULL, PRIMARY KEY (`idt_area`), INDEX `fk_tb_espaco_td_tipo_espaco1_idx` (`cod_tipo_espaco` ASC), INDEX `fk_tb_espaco_td_cidade1_idx` (`cod_cidade` ASC), CONSTRAINT `fk_tb_espaco_td_tipo_espaco1` FOREIGN KEY (`cod_tipo_espaco`) REFERENCES `mydb`.`td_tipo_espaco` (`idt_tipo_imovel`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_tb_espaco_td_cidade1` FOREIGN KEY (`cod_cidade`) REFERENCES `mydb`.`td_cidade` (`idt_cidade`) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `mydb`.`tb_reserva` -- ----------------------------------------------------- DROP TABLE IF EXISTS `mydb`.`tb_reserva` ; CREATE TABLE IF NOT EXISTS `mydb`.`tb_reserva` ( `idt_reserva` INT NOT NULL AUTO_INCREMENT, `dta_inicio_reserva` DATE NOT NULL, `dta_fim_reserva` DATE NOT NULL, `vlr_reserva` DECIMAL(12,2) NOT NULL, `qtd_pessoa_reserva` INT NOT NULL, `cod_usuario` INT NOT NULL, `cod_espaco` INT NOT NULL, PRIMARY KEY (`idt_reserva`), INDEX `fk_tb_reserva_tb_usuario1_idx` (`cod_usuario` ASC), INDEX `fk_tb_reserva_tb_espaco1_idx` (`cod_espaco` ASC), CONSTRAINT `fk_tb_reserva_tb_usuario1` FOREIGN KEY (`cod_usuario`) REFERENCES `mydb`.`tb_usuario` (`idt_usuario`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_tb_reserva_tb_espaco1` FOREIGN KEY (`cod_espaco`) REFERENCES `mydb`.`tb_espaco` (`idt_area`) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `mydb`.`td_forma_pagamento` -- ----------------------------------------------------- DROP TABLE IF EXISTS `mydb`.`td_forma_pagamento` ; CREATE TABLE IF NOT EXISTS `mydb`.`td_forma_pagamento` ( `idt_forma_pagamento` INT NOT NULL AUTO_INCREMENT, `nme_forma_pagamento` VARCHAR(45) NOT NULL, PRIMARY KEY (`idt_forma_pagamento`)) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `mydb`.`tb_anuncio` -- ----------------------------------------------------- DROP TABLE IF EXISTS `mydb`.`tb_anuncio` ; CREATE TABLE IF NOT EXISTS `mydb`.`tb_anuncio` ( `idt_anuncio` INT NOT NULL AUTO_INCREMENT, `nme_anuncio` VARCHAR(50) NOT NULL, `dta_criacao_anuncio` DATE NOT NULL, `dsc_anuncio` VARCHAR(200) NULL, `cod_usuario` INT NOT NULL, `cod_imovel` INT NOT NULL, PRIMARY KEY (`idt_anuncio`), INDEX `fk_ta_anuncio_tb_usuario1_idx` (`cod_usuario` ASC), INDEX `fk_ta_anuncio_tb_imovel1_idx` (`cod_imovel` ASC), CONSTRAINT `fk_ta_anuncio_tb_usuario1` FOREIGN KEY (`cod_usuario`) REFERENCES `mydb`.`tb_usuario` (`idt_usuario`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_ta_anuncio_tb_imovel1` FOREIGN KEY (`cod_imovel`) REFERENCES `mydb`.`td_tipo_espaco` (`idt_tipo_imovel`) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `mydb`.`ta_pagamento` -- ----------------------------------------------------- DROP TABLE IF EXISTS `mydb`.`ta_pagamento` ; CREATE TABLE IF NOT EXISTS `mydb`.`ta_pagamento` ( `idt_pagamento` INT NOT NULL AUTO_INCREMENT, `dta_pagamento` DATE NOT NULL, `num_cartao_cred_pagamento` VARCHAR(16) NULL, `num_boleto_pagamento` VARCHAR(45) NULL, `id_transacao_pagamento` VARCHAR(45) NULL, `cod_forma_pagamento` INT NOT NULL, `cod_reserva` INT NOT NULL, `cod_usuario` INT NOT NULL, PRIMARY KEY (`idt_pagamento`), INDEX `fk_ta_pagamento_tb_forma_pagamento1_idx` (`cod_forma_pagamento` ASC), INDEX `fk_ta_pagamento_tb_reserva1_idx` (`cod_reserva` ASC), INDEX `fk_ta_pagamento_tb_usuario1_idx` (`cod_usuario` ASC), CONSTRAINT `fk_ta_pagamento_tb_forma_pagamento1` FOREIGN KEY (`cod_forma_pagamento`) REFERENCES `mydb`.`td_forma_pagamento` (`idt_forma_pagamento`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_ta_pagamento_tb_reserva1` FOREIGN KEY (`cod_reserva`) REFERENCES `mydb`.`tb_reserva` (`idt_reserva`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_ta_pagamento_tb_usuario1` FOREIGN KEY (`cod_usuario`) REFERENCES `mydb`.`tb_usuario` (`idt_usuario`) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `mydb`.`td_tipo_subespaco` -- ----------------------------------------------------- DROP TABLE IF EXISTS `mydb`.`td_tipo_subespaco` ; CREATE TABLE IF NOT EXISTS `mydb`.`td_tipo_subespaco` ( `idt_tipo_subespaco` INT NOT NULL AUTO_INCREMENT, `nme_tipo_subespaco` VARCHAR(45) NOT NULL, `cod_tipo_espaco` INT NOT NULL, PRIMARY KEY (`idt_tipo_subespaco`), INDEX `fk_td_tipo_subespaco_td_tipo_espaco1_idx` (`cod_tipo_espaco` ASC), CONSTRAINT `fk_td_tipo_subespaco_td_tipo_espaco1` FOREIGN KEY (`cod_tipo_espaco`) REFERENCES `mydb`.`td_tipo_espaco` (`idt_tipo_imovel`) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `mydb`.`tb_sub_espaco` -- ----------------------------------------------------- DROP TABLE IF EXISTS `mydb`.`tb_sub_espaco` ; CREATE TABLE IF NOT EXISTS `mydb`.`tb_sub_espaco` ( `idt_sub_espaco` INT NOT NULL AUTO_INCREMENT, `dsc_sub_espaco` VARCHAR(200) NOT NULL, `cod_tipo_subespaco` INT NOT NULL, `cod_espaco` INT NOT NULL, PRIMARY KEY (`idt_sub_espaco`), INDEX `fk_tb_sub_espaco_td_tipo_subespaco1_idx` (`cod_tipo_subespaco` ASC), INDEX `fk_tb_sub_espaco_tb_espaco1_idx` (`cod_espaco` ASC), CONSTRAINT `fk_tb_sub_espaco_td_tipo_subespaco1` FOREIGN KEY (`cod_tipo_subespaco`) REFERENCES `mydb`.`td_tipo_subespaco` (`idt_tipo_subespaco`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_tb_sub_espaco_tb_espaco1` FOREIGN KEY (`cod_espaco`) REFERENCES `mydb`.`tb_espaco` (`idt_area`) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `mydb`.`tb_imagem` -- ----------------------------------------------------- DROP TABLE IF EXISTS `mydb`.`tb_imagem` ; CREATE TABLE IF NOT EXISTS `mydb`.`tb_imagem` ( `idt_imagem` INT NOT NULL AUTO_INCREMENT, `img_imagem` BLOB NOT NULL, `cod_espaco` INT NULL, `cod_sub_espaco` INT NULL, PRIMARY KEY (`idt_imagem`), INDEX `fk_td_imagem_tb_espaco1_idx` (`cod_espaco` ASC), INDEX `fk_tb_imagem_tb_sub_espaco1_idx` (`cod_sub_espaco` ASC), CONSTRAINT `fk_td_imagem_tb_espaco1` FOREIGN KEY (`cod_espaco`) REFERENCES `mydb`.`tb_espaco` (`idt_area`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_tb_imagem_tb_sub_espaco1` FOREIGN KEY (`cod_sub_espaco`) REFERENCES `mydb`.`tb_sub_espaco` (`idt_sub_espaco`) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `mydb`.`ta_comentarios` -- ----------------------------------------------------- DROP TABLE IF EXISTS `mydb`.`ta_comentarios` ; CREATE TABLE IF NOT EXISTS `mydb`.`ta_comentarios` ( `idt_comentarios` INT NOT NULL AUTO_INCREMENT, `cmt_comentarios` TEXT NOT NULL, `cod_usuario` INT NOT NULL, `cod_anuncio` INT NOT NULL, PRIMARY KEY (`idt_comentarios`), INDEX `fk_tb_comentarios_tb_usuario1_idx` (`cod_usuario` ASC), INDEX `fk_tb_comentarios_tb_anuncio1_idx` (`cod_anuncio` ASC), CONSTRAINT `fk_tb_comentarios_tb_usuario1` FOREIGN KEY (`cod_usuario`) REFERENCES `mydb`.`tb_usuario` (`idt_usuario`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_tb_comentarios_tb_anuncio1` FOREIGN KEY (`cod_anuncio`) REFERENCES `mydb`.`tb_anuncio` (`idt_anuncio`) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `mydb`.`tb_avaliacao` -- ----------------------------------------------------- DROP TABLE IF EXISTS `mydb`.`tb_avaliacao` ; CREATE TABLE IF NOT EXISTS `mydb`.`tb_avaliacao` ( `idt_avaliacao` INT NOT NULL AUTO_INCREMENT, `vlr_nota_avaliacao` INT NOT NULL, `cmt_avaliacao` TEXT NULL, `cod_usuario` INT NOT NULL, `cod_reserva` INT NOT NULL, PRIMARY KEY (`idt_avaliacao`), INDEX `fk_tb_avaliacao_tb_usuario1_idx` (`cod_usuario` ASC), INDEX `fk_tb_avaliacao_tb_reserva1_idx` (`cod_reserva` ASC), CONSTRAINT `fk_tb_avaliacao_tb_usuario1` FOREIGN KEY (`cod_usuario`) REFERENCES `mydb`.`tb_usuario` (`idt_usuario`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_tb_avaliacao_tb_reserva1` FOREIGN KEY (`cod_reserva`) REFERENCES `mydb`.`tb_reserva` (`idt_reserva`) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `mydb`.`td_comodidades` -- ----------------------------------------------------- DROP TABLE IF EXISTS `mydb`.`td_comodidades` ; CREATE TABLE IF NOT EXISTS `mydb`.`td_comodidades` ( `idt_comodidades` INT NOT NULL AUTO_INCREMENT, `nme_comodidades` VARCHAR(45) NOT NULL, `cod_espaco` INT NOT NULL, PRIMARY KEY (`idt_comodidades`), INDEX `fk_td_comodidades_tb_espaco1_idx` (`cod_espaco` ASC), CONSTRAINT `fk_td_comodidades_tb_espaco1` FOREIGN KEY (`cod_espaco`) REFERENCES `mydb`.`tb_espaco` (`idt_area`) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `mydb`.`tb_periodo_disponibilidade` -- ----------------------------------------------------- DROP TABLE IF EXISTS `mydb`.`tb_periodo_disponibilidade` ; CREATE TABLE IF NOT EXISTS `mydb`.`tb_periodo_disponibilidade` ( `idt_disponibilidade` INT NOT NULL AUTO_INCREMENT, `dta_inicio_disponibilidade` DATE NOT NULL, `dta_fim_disponibilidade` DATE NOT NULL, `cod_espaco` INT NOT NULL, PRIMARY KEY (`idt_disponibilidade`), INDEX `fk_tb_disponibilidade_tb_espaco1_idx` (`cod_espaco` ASC), CONSTRAINT `fk_tb_disponibilidade_tb_espaco1` FOREIGN KEY (`cod_espaco`) REFERENCES `mydb`.`tb_espaco` (`idt_area`) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `mydb`.`td_bairro` -- ----------------------------------------------------- DROP TABLE IF EXISTS `mydb`.`td_bairro` ; CREATE TABLE IF NOT EXISTS `mydb`.`td_bairro` ( `idt_bairro` INT NOT NULL AUTO_INCREMENT, `nme_bairro` VARCHAR(45) NOT NULL, PRIMARY KEY (`idt_bairro`)) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `mydb`.`td_rua` -- ----------------------------------------------------- DROP TABLE IF EXISTS `mydb`.`td_rua` ; CREATE TABLE IF NOT EXISTS `mydb`.`td_rua` ( `idt_rua_quadra` INT NOT NULL AUTO_INCREMENT, `nme_rua` VARCHAR(45) NOT NULL, `ref_rua` VARCHAR(60) NULL, `cod_bairro` INT NOT NULL, PRIMARY KEY (`idt_rua_quadra`), INDEX `fk_td_rua_quadra_td_bairro1_idx` (`cod_bairro` ASC), CONSTRAINT `fk_td_rua_quadra_td_bairro1` FOREIGN KEY (`cod_bairro`) REFERENCES `mydb`.`td_bairro` (`idt_bairro`) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `mydb`.`td_num_casa` -- ----------------------------------------------------- DROP TABLE IF EXISTS `mydb`.`td_num_casa` ; CREATE TABLE IF NOT EXISTS `mydb`.`td_num_casa` ( `idt_casa` INT NOT NULL AUTO_INCREMENT, `id_casa` VARCHAR(5) NOT NULL, `ref_casa` VARCHAR(50) NULL, `cod_rua` INT NOT NULL, PRIMARY KEY (`idt_casa`), INDEX `fk_td_casa_td_rua1_idx` (`cod_rua` ASC), CONSTRAINT `fk_td_casa_td_rua1` FOREIGN KEY (`cod_rua`) REFERENCES `mydb`.`td_rua` (`idt_rua_quadra`) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB; SET SQL_MODE=@OLD_SQL_MODE; SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS; SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;
true
ef106e225816f873aebd8fa55e43907324e039db
SQL
olegivo/olegivo-mm
/Oleg_ivo.MeloManager.Database/dbo/Functions/GetFullFulename.sql
UTF-8
495
2.59375
3
[]
no_license
-- ============================================= -- Author: <Author,,Name> -- Create date: <Create Date, ,> -- Description: <Description, ,> -- ============================================= CREATE FUNCTION dbo.GetFullFulename ( -- Add the parameters for the function here @Path NVARCHAR(255), @FileNameWithoutExtension NVARCHAR(255), @Extention NVARCHAR(10) ) RETURNS NVARCHAR(521) WITH SCHEMABINDING AS BEGIN RETURN @Path+'\'+@FileNameWithoutExtension+@Extention END
true
3b8ecb5b01bb12a796f77e821714bb2650f2044e
SQL
Jackfrost04/CMPT308
/cmpt 308 hw 2 answers.sql
UTF-8
1,249
3.78125
4
[]
no_license
--Mason Crane --Question set 2. --9/22/13 --Question One select distinct city from Agents where aid in (select aid from Orders where cid = 'c002' ) --Question Two select distinct pid from Products where pid in (select pid from Orders where aid in (select aid from Orders where aid in (select aid from Agents where cid in (select cid from Customers where city = 'Kyoto') ) ) ) --Question Three select distinct cid, name from Customers where cid not in (select cid from Orders where aid in (select aid from Orders where aid = 'a03') ) -- Question Four select distinct cid, name from Customers where cid in (select cid from Orders o1 where pid = 'p07' AND cid in (select cid from Orders o2 where pid = 'p01') ) -- Question Five select pid from Orders o1 where cid in (select cid from Orders o2 where aid ='a03') --Question Six select distinct name, discount from Customers where cid in (select cid from Orders where aid in (select aid from Agents where city = 'Duluth' OR city = 'Dallas') ) --Question Seven select name from Customers c1 where discount in (select discount from Customers c2 where city = 'Kyoto' OR city = 'Dallas')
true
26d1c7d9b8e415a68ce61c0cb74c383af29b3773
SQL
Onk24/Leetcode_Solutions
/#601_Human_Traffic_of_Stadium.sql
UTF-8
1,675
4.125
4
[]
no_license
# Write your MySQL query statement below with new_t as (Select id, visit_date, people, lag(people,2) over(order by visit_date) as prev2, lag(people,1) over(order by visit_date) as prev1, lead(people,1) over(order by visit_date) as next1, lead(people,2) over(order by visit_date) as next2 from stadium) Select id, visit_date, people from new_t where ((prev2>=100 and prev1>=100 and people >=100) or (prev1>=100 and people >=100 and next1>=100) or (people>=100 and next1>=100 and next2>=100)) order by id -- Another longer but faster solution # Write your MySQL query statement below with new_t as (Select id-2 as id2, id-1 as id1, id, (case when @prevp2>=100 and @prevp1>=100 and people>=100 then @prevd2 else null end) as Day2, (case when @prevp2>=100 and @prevp1>=100 and people>=100 then @prevd1 else null end) as Day1, (case when @prevp2>=100 and @prevp1>=100 and people>=100 then visit_date else null end) as Day0, @prevp2 as people2, @prevp2:=@prevp1 as people1, @prevp1:=people as people0, @prevd2:=@prevd1 as new_date2, @prevd1:=visit_date as new_date1 from stadium, (Select @prevp1:=0, @prevp2:=0, @prevd1:=curdate(), @prevd2:=curdate()) as intials) Select id, visit_date, cast(people as unsigned) as people from ((select id2 as id, day2 as visit_date, people2 as people from new_t where day2 is not null) union (select id1 as id, day1 as visit_date, people1 as people from new_t where day1 is not null) union (select id as id, day0 as visit_date, people0 as people from new_t where day0 is not null)) as a order by id
true
2a8f7e56f0e3af1ec131e516c7ae7613d3d84271
SQL
nour-KARRI/UGA-App-theatre-JEE
/sql/datasets/nds1.sql
UTF-8
8,966
3.046875
3
[]
no_license
--========================================================================= -- MyTheatre --========================================================================= --------------------------------------------------------------------------- -- This negative dataset tests all constraints defined in the schema --------------------------------------------------------------------------- --------------------------------------------------------------------------- -- Prolog for sqlite --------------------------------------------------------------------------- PRAGMA foreign_keys = ON; --------------------------------------------------------------------------- -- LesCategoriesZones --------------------------------------------------------------------------- INSERT INTO LesCategoriesZones VALUES ('Orchestre',25); INSERT INTO LesCategoriesZones VALUES ('Balcon',20); INSERT INTO LesCategoriesZones VALUES ('Poulailler',15); --@ violates LesCategoriesZones.PK INSERT INTO LesCategoriesZones VALUES ('Poulailler',15); --------------------------------------------------------------------------- -- LesPublics --------------------------------------------------------------------------- INSERT INTO LesPublics VALUES ('Adultes'); INSERT INTO LesPublics VALUES ('Tout public'); INSERT INTO LesPublics VALUES ('Enfants'); --@ violates LesPublics.PK INSERT INTO LesPublics VALUES ('Enfants'); --------------------------------------------------------------------------- -- LesReductionsProfilsSpectateurs --------------------------------------------------------------------------- INSERT INTO LesReductionsProfilsSpectateurs VALUES ('Plein tarif',0); INSERT INTO LesReductionsProfilsSpectateurs VALUES ('Etudiant',0.2); --@ violates LesReductionsProfilsSpectateurs.CK.tauxReductionProfil INSERT INTO LesReductionsProfilsSpectateurs VALUES ('Famille nombreuse',2); INSERT INTO LesReductionsProfilsSpectateurs VALUES ('Adherent',0.4); --@ violates LesReductionsProfilsSpectateurs.PK INSERT INTO LesReductionsProfilsSpectateurs VALUES ('Adherent',0.4); --------------------------------------------------------------------------- -- LesGenres --------------------------------------------------------------------------- INSERT INTO LesGenres VALUES ('Musical'); INSERT INTO LesGenres VALUES ('Improvisation'); INSERT INTO LesGenres VALUES ('Tragedie'); INSERT INTO LesGenres VALUES ('Intrigue'); --@ violates LesGenres.PK INSERT INTO LesGenres VALUES ('Intrigue'); --------------------------------------------------------------------------- -- LesSpectacles --------------------------------------------------------------------------- -- le numero est en AUTO_INCREMENT -- pas besoin de tester la PK car on est en AUTOINCREMENT INSERT INTO LesSpectacles (nomSpec,nomGenre,synopsis,typePublic) VALUES ('Romeo et Juliette','Tragedie','Une femme aime un homme, un homme aime une femme, c est beau','Adultes'); INSERT INTO LesSpectacles (nomSpec,nomGenre,synopsis,typePublic) VALUES ('Antigone','Tragedie','Antigone est la fille d Œdipe et de Jocaste, souverains de Thèbes','Adultes'); --@ violates LesSpectacles.fk_spec_typePublic INSERT INTO LesSpectacles (nomSpec,nomGenre,synopsis,typePublic) VALUES ('Hamlet','Intrigue','Le roi du Danemark, père dHamlet, est mort récemment','Gamins'); --@ violates LesSpectacles.fk_spec_genre INSERT INTO LesSpectacles (nomSpec,nomGenre,synopsis,typePublic) VALUES ('Asterix ET Obelix','Animation','Obelix n est pas GROS','Adultes'); --------------------------------------------------------------------------- -- LesZones --------------------------------------------------------------------------- -- le numero est en AUTO_INCREMENT -- pas besoin de tester la PK car on est en AUTOINCREMENT INSERT INTO LesZones (nomCat) VALUES ('Poulailler'); --@ violates LesZones.fk_nomCat INSERT INTO LesZones (nomCat) VALUES ('toto'); INSERT INTO LesZones (nomCat) VALUES ('Balcon'); INSERT INTO LesZones (nomCat) VALUES ('Balcon'); INSERT INTO LesZones (nomCat) VALUES ('Orchestre'); INSERT INTO LesZones (nomCat) VALUES ('Orchestre'); --------------------------------------------------------------------------- -- LesPlaces --------------------------------------------------------------------------- INSERT INTO LesPlaces VALUES(1,2,1); INSERT INTO LesPlaces VALUES(2,3,1); INSERT INTO LesPlaces VALUES(2,4,1); INSERT INTO LesPlaces VALUES(1,1,2); INSERT INTO LesPlaces VALUES(1,2,2); INSERT INTO LesPlaces VALUES(1,3,2); INSERT INTO LesPlaces VALUES(1,1,1); --@ violates LesPlaces.PK INSERT INTO LesPlaces VALUES(1,1,1); --@ violates LesPlaces.FK_lesPlaces_Zones INSERT INTO LesPlaces VALUES(1,2,8); --------------------------------------------------------------------------- -- LesRepresentations_base --------------------------------------------------------------------------- INSERT INTO LesRepresentations_base VALUES (1,'20/03/2019','15h00',0,1); INSERT INTO LesRepresentations_base VALUES (1,'21/03/2019','20h00',0,1); --@ violates LesRepresentations_base.PK INSERT INTO LesRepresentations_base VALUES (2,'20/03/2019','15h00',0,1); --@ violates LesRepresentations_base.FK_numeroSpec INSERT INTO LesRepresentations_base VALUES (4,'29/03/2019','22h00',0,1); --@ violates LesRepresentations_base.ck.preReservation INSERT INTO LesRepresentations_base VALUES (2,'20/03/2019','22h00',0,2); INSERT INTO LesRepresentations_base VALUES (2,'21/03/2019','16h00',0,1); --@ violates LesRepresentations_base.uk_lesRep INSERT INTO LesRepresentations_base VALUES (3,'21/03/2019','16h00',0,1); --@ violates LesRepresentations_base.ck.tauxReductionRepr INSERT INTO LesRepresentations_base VALUES (3,'22/03/2019','21h00',2,1); --------------------------------------------------------------------------- -- LesDossierAchats_base --------------------------------------------------------------------------- -- le numero est en AUTO_INCREMENT INSERT INTO LesDossiersAchats_base (dateCreationDossier,eMailDoss) VALUES ('07-03-2019 10:00:00','mail1@domain.com'); INSERT INTO LesDossiersAchats_base (dateCreationDossier,eMailDoss) VALUES ('08-03-2019 11:00:00','mail2@domain.com'); INSERT INTO LesDossiersAchats_base (dateCreationDossier,eMailDoss) VALUES ('08-03-2019 12:00:00','mail3@domain.com'); INSERT INTO LesDossiersAchats_base (dateCreationDossier,eMailDoss) VALUES ('09-03-2019 10:00:00','mail4@domain.com'); INSERT INTO LesDossiersAchats_base (dateCreationDossier,eMailDoss) VALUES ('10-03-2019 17:00:00','mail5@domain.com'); --------------------------------------------------------------------------- -- LesTickets --------------------------------------------------------------------------- INSERT INTO LesTickets (dateAchatTick,numeroRang,numeroPlace,numeroZone,dateRepr,heureRepr,numeroDossier,numeroSpec,profilSpectateur) VALUES ('2019-15-02 15:00:00',1,1,1,'20/03/2019','15h00',1,1,'Plein tarif'); INSERT INTO LesTickets (dateAchatTick,numeroRang,numeroPlace,numeroZone,dateRepr,heureRepr,numeroDossier,numeroSpec,profilSpectateur) VALUES ('2019-15-02 15:00:00',1,2,1,'21/03/2019','20h00',1,1,'Plein tarif'); INSERT INTO LesTickets (dateAchatTick,numeroRang,numeroPlace,numeroZone,dateRepr,heureRepr,numeroDossier,numeroSpec,profilSpectateur) VALUES ('2019-14-02 14:00:00',1,3,2,'20/03/2019','15h00',3,1,'Plein tarif'); INSERT INTO LesTickets (dateAchatTick,numeroRang,numeroPlace,numeroZone,dateRepr,heureRepr,numeroDossier,numeroSpec,profilSpectateur) VALUES ('2019-15-02 10:00:00',2,3,1,'20/03/2019','22h00',2,2,'Plein tarif'); --@ violates LesTickets.FK_profilSpectateur INSERT INTO LesTickets (dateAchatTick,numeroRang,numeroPlace,numeroZone,dateRepr,heureRepr,numeroDossier,numeroSpec,profilSpectateur) VALUES ('2019-16-02 10:00:00',2,4,1,'21/03/2019','16h00',2,2,'Unijambiste'); --@ violates LesTickets.UK_places INSERT INTO LesTickets (dateAchatTick,numeroRang,numeroPlace,numeroZone,dateRepr,heureRepr,numeroDossier,numeroSpec,profilSpectateur) VALUES ('2019-15-02 15:00:00',1,2,1,'21/03/2019','20h00',1,1,'Plein tarif'); --@ violates LesTickets.FK_numeroRang_numeroPlace INSERT INTO LesTickets (dateAchatTick,numeroRang,numeroPlace,numeroZone,dateRepr,heureRepr,numeroDossier,numeroSpec,profilSpectateur) VALUES ('2019-14-02 14:00:00',1,99,1,'20/03/2019','15h00',3,1,'Plein tarif'); --@ violates LesTickets.FK_dateRepr_heureRepr INSERT INTO LesTickets (dateAchatTick,numeroRang,numeroPlace,numeroZone,dateRepr,heureRepr,numeroDossier,numeroSpec,profilSpectateur) VALUES ('2019-15-02 15:00:00',1,2,1,'21/03/2019','19h00',1,1,'Plein tarif'); --@ violates LesTickets.FK_numeroDossier INSERT INTO LesTickets (dateAchatTick,numeroRang,numeroPlace,numeroZone,dateRepr,heureRepr,numeroDossier,numeroSpec,profilSpectateur) VALUES ('2019-16-02 10:00:00',2,3,1,'21/03/2019','16h00',6,1,'Plein tarif'); --@ violates LesTickets.AttributNOTNULL INSERT INTO LesTickets (dateAchatTick,numeroRang,numeroPlace,numeroZone,dateRepr,heureRepr,numeroDossier,numeroSpec,profilSpectateur) VALUES ('2019-16-02 10:00:00',NULL,4,2,'21/03/2019','16h00',1,1,'pleinTarif');
true
ef38caf1331559a46e9936d02af21c7a6d793b34
SQL
Jovan-Petrovic/ProjektovanjeSoftveraIspiti
/Jul16Zajednicki/prosoftjul16g1.sql
UTF-8
2,416
3.46875
3
[]
no_license
/* SQLyog Ultimate v9.50 MySQL - 5.6.20 : Database - prosoftjul16g1 ********************************************************************* */ /*!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*/`prosoftjul16g1` /*!40100 DEFAULT CHARACTER SET utf8 */; USE `prosoftjul16g1`; /*Table structure for table `reprezentacija` */ DROP TABLE IF EXISTS `reprezentacija`; CREATE TABLE `reprezentacija` ( `ReprezentacijaID` int(11) NOT NULL, `Naziv` varchar(255) DEFAULT NULL, PRIMARY KEY (`ReprezentacijaID`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*Data for the table `reprezentacija` */ insert into `reprezentacija`(`ReprezentacijaID`,`Naziv`) values (1,'Italija'),(2,'Belgija'),(3,'Irska'),(4,'Svedska'),(5,'Madjarska'),(6,'Island'),(7,'Portugal'),(8,'Austrija'); /*Table structure for table `utakmica` */ DROP TABLE IF EXISTS `utakmica`; CREATE TABLE `utakmica` ( `UtakmicaID` int(11) NOT NULL, `Grupa` varchar(1) DEFAULT NULL, `DomacinID` int(11) DEFAULT NULL, `GostID` int(11) DEFAULT NULL, `GolovaDomacin` int(11) DEFAULT NULL, `GolovaGost` int(11) DEFAULT NULL, PRIMARY KEY (`UtakmicaID`), KEY `DomacinID` (`DomacinID`), KEY `GostID` (`GostID`), CONSTRAINT `utakmica_ibfk_1` FOREIGN KEY (`DomacinID`) REFERENCES `reprezentacija` (`ReprezentacijaID`), CONSTRAINT `utakmica_ibfk_2` FOREIGN KEY (`GostID`) REFERENCES `reprezentacija` (`ReprezentacijaID`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*Data for the table `utakmica` */ insert into `utakmica`(`UtakmicaID`,`Grupa`,`DomacinID`,`GostID`,`GolovaDomacin`,`GolovaGost`) values (1,'E',3,4,NULL,NULL),(2,'E',2,1,NULL,NULL),(3,'E',1,4,NULL,NULL),(4,'E',2,3,NULL,NULL),(5,'E',1,3,NULL,NULL),(6,'E',4,2,NULL,NULL),(7,'F',8,5,NULL,NULL),(8,'F',7,6,NULL,NULL),(9,'F',6,5,NULL,NULL),(10,'F',7,8,NULL,NULL),(11,'F',6,8,NULL,NULL),(12,'F',5,7,NULL,NULL); /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
true
2d751451110b613f11142637a13ce59ac5ba37f6
SQL
elmer7186/back-demo-hexagonal-multiproject-netflix
/cinema/infrastructure/build/resources/main/data.sql
UTF-8
1,349
3.59375
4
[]
no_license
CREATE TABLE IF NOT EXISTS category ( category_id int NOT NULL AUTO_INCREMENT, name varchar(100) NOT NULL, description varchar(5000), PRIMARY KEY (category_id) ); CREATE TABLE IF NOT EXISTS movie ( movie_id int NOT NULL AUTO_INCREMENT, name varchar(100) NOT NULL, description varchar(5000), category_id int NOT NULL, active boolean NOT NULL, deleted boolean NOT NULL, PRIMARY KEY (movie_id), FOREIGN KEY (category_id) REFERENCES category(category_id) ); INSERT INTO category (name, description) VALUES ('Science Fiction', 'is a film genre that uses speculative, fictional science-based depictions of phenomena that are not fully accepted by mainstream science, such as extraterrestrial lifeforms, alien worlds, extrasensory perception and time travel'); INSERT INTO category (name, description) VALUES ('Action', 'is a film genre in which the protagonist or protagonists are thrust into a series of events that typically include violence, extended fighting, physical feats'); INSERT INTO movie (name, description, category_id, active, deleted) VALUES('Matrix', 'is a 1999 science fiction action film written and directed by the Wachowskis. It stars Keanu Reeves, Laurence Fishburne, Carrie-Anne Moss, Hugo Weaving, and Joe Pantoliano and is the first installment in the Matrix franchise.', (SELECT category_id FROM category WHERE name = 'Science Fiction'), true, false);
true
4058a11fb789f649775dbb0a971eb306ad687c00
SQL
namitabhat/airline-database
/add_reservations_procedure.sql
UTF-8
4,394
4.03125
4
[]
no_license
DELIMITER // CREATE PROCEDURE addReservation ( IN departure_airport_code VARCHAR(3), IN arrival_airport_code VARCHAR(3), IN ryear INTEGER, IN rweek INTEGER, IN rday VARCHAR(10), IN dep_time TIME, IN number_of_passengers INTEGER, OUT output_reservation_nr INTEGER ) BEGIN SET @sched_id = (SELECT schedule_id FROM weeklyschedule WHERE d_code=departure_airport_code AND a_code=arrival_airport_code AND year=ryear AND day=rday AND departure_time=dep_time); IF (@sched_id IS NULL) THEN SIGNAL SQLSTATE '45000' SET MYSQL_ERRNO = 30001, MESSAGE_TEXT = 'There exist no flight for the given route, date and time'; END IF; SET @fno=(SELECT flight_no FROM flight WHERE week_no=rweek AND schedule_id=@sched_id ); IF (@fno IS NULL) THEN SIGNAL SQLSTATE '45000' SET MYSQL_ERRNO = 30001, MESSAGE_TEXT = 'There exist no flight for the given route, date and time'; END IF; SET @freeseats = calculateFreeSeats(@fno); IF @freeseats >= number_of_passengers THEN INSERT INTO reservation(no_of_ppl, final_price, flight_no) VALUES (number_of_passengers, calculatePrice(@fno)*number_of_passengers, @fno); SELECT LAST_INSERT_ID() INTO output_reservation_nr; ELSE SIGNAL SQLSTATE '45000' SET MYSQL_ERRNO = 30001, MESSAGE_TEXT = 'There are not enough seats available on the chosen flight'; END IF; END; // DELIMITER ; DELIMITER // CREATE PROCEDURE addContact( reservation_nr INTEGER, passport_number VARCHAR(40), cemail VARCHAR(30), cphone BIGINT) BEGIN SET @rno = (SELECT reservation_no FROM reservation WHERE reservation_no=reservation_nr); IF (@rno IS NULL) THEN SIGNAL SQLSTATE '45000' SET MYSQL_ERRNO = 30001, MESSAGE_TEXT = 'The given reservation number does not exist'; END IF; SET @pid = (SELECT pid FROM passenger WHERE passport_no=passport_number); SET @prid = (SELECT pid FROM reservation_passenger WHERE reservation_no=reservation_nr AND pid=@pid); IF (@prid IS NULL) THEN SIGNAL SQLSTATE '45000' SET MYSQL_ERRNO = 30001, MESSAGE_TEXT = 'The person is not a passenger of the reservation'; END IF; INSERT INTO contact(email, phone, passport_no) VALUES (cemail, cphone, passport_number); SET @cid = LAST_INSERT_ID(); UPDATE reservation set contact_id=LAST_INSERT_ID() WHERE reservation_no=@rno; END; // DELIMITER ; DELIMITER // CREATE PROCEDURE addPassenger( IN reservation_nr INTEGER, IN passport_number varchar(40), IN name varchar(30)) BEGIN SET @rno = (SELECT reservation_no FROM reservation WHERE reservation_no=reservation_nr); IF (@rno IS NULL) THEN SIGNAL SQLSTATE '45000' SET MYSQL_ERRNO = 30001, MESSAGE_TEXT = 'The given reservation number does not exist'; END IF; SET @pno = (SELECT payment_id FROM payment WHERE reservation_no=reservation_nr); IF (@pno IS NOT NULL) THEN SIGNAL SQLSTATE '45000' SET MYSQL_ERRNO = 30001, MESSAGE_TEXT = 'The booking has already been payed and no futher passengers can be added'; END IF; INSERT IGNORE INTO passenger(passport_no, name) VALUES (passport_number, name); SET @pid = (SELECT pid FROM passenger WHERE passport_no=passport_number); INSERT INTO reservation_passenger(reservation_no, pid) VALUES (@rno, @pid); END; // DELIMITER ; DELIMITER // CREATE PROCEDURE addPayment ( IN reservation_nr INTEGER, IN cardholder_name varchar(30), IN credit_card_number BIGINT ) BEGIN SET @rno = (SELECT reservation_no FROM reservation WHERE reservation_no=reservation_nr); IF (@rno IS NULL) THEN SIGNAL SQLSTATE '45000' SET MYSQL_ERRNO = 30001, MESSAGE_TEXT = 'The given reservation number does not exist'; END IF; SET @cno = (SELECT contact_id FROM reservation WHERE reservation_no=reservation_nr); IF (@cno IS NULL) THEN SIGNAL SQLSTATE '45000' SET MYSQL_ERRNO = 30001, MESSAGE_TEXT = 'The reservation has no contact yet'; END IF; SET @fno = (SELECT flight_no FROM reservation WHERE reservation_no=@rno); SET @freeseats = calculateFreeSeats(@fno); SET @nops = (SELECT COUNT(pid) FROM reservation_passenger WHERE reservation_no=@rno); SELECT sleep(5); IF @freeseats >= @nops THEN INSERT INTO payment(creditcard_no, creditcard_name, reservation_no) VALUES (credit_card_number, creditcard_name, @rno); ELSE SIGNAL SQLSTATE '45000' SET MYSQL_ERRNO = 3001, MESSAGE_TEXT = 'There are not enough seats available on the flight anymore, deleting reservation'; END IF; END; // DELIMITER ;
true
37984bc9f10969aa2941a768c81d42b6b537bac8
SQL
Allan-Sanchez/SQL_Oracle
/Funciones_SQL/Funicion_cadena_manimulacion.sql
UTF-8
2,153
3.515625
4
[]
no_license
/*FUNCION DE CARACTERES FUNCION DE MANIPULACION ( CONCAT ) ( SUBSTR ) ( LENGTH ) ( INSTR ) ( LPAD ) ( RPAD ) ( REPLACE ) ( TRIM ) */ --CONCAT concadenacion entre cadena muy parecido a ( || ) --solo podemos concatenar dos cadena de palabras SELECT CONCAT('Bienvenidos ','Oracle') from dual; --SUBSTR de alguna manera formatear la salida de una cadena de caracteres --la cual esta formada de esta manera ('String',1_inicio,11_final ). SELECT SUBSTR('BienvenidosOracle',1,11) from dual; SELECT SUBSTR('BienvenidosOracle',12) from dual; --LENGTH nos dise la longitud de caracteres que tiene un string Select LENGTH('Bienvenidos')from dual; Select LENGTH('BienvenidosOracle')from dual; --INSTR es para saber la posicion exacta de un caracter --si este caracter aparece varias veces en una palabra simplemente devolvera --la posicion del primer caracter igual que encuentre SELECT INSTR('BienvenidosOracle','O')from dual; --LPAD se ultilza para formatiar la salida de los espacios en las columnas --el formateo lo realiza asi la derecha select lpad(salary,10,'*')from employees; --DPAD al igual que lpad este realiza un formateo --pero este es a la izquierda select rpad(salary,10,'*') from employees; --replace como su nombre lo indica remplaza una o mas palabras select replace('jack and jue','j','B') from dual; --TRIM el mina los espacios en blanco en una cadena SELECT trim(' Bienvinidos Oracle ') from dual; --consulta usando la mayoria de sentencias select employee_id, concat(first_name,last_name)as nombre, job_id, length(last_name),instr(last_name,'a')as "Contiene a" from employees where substr(job_id,4)='REP'; select * from employees;
true
7bd36111fba04bc80af37a05af45b76f40da1899
SQL
MiracleOluwaseyi/Database-Excercise-
/Assignment Query.sql
UTF-8
1,609
4.46875
4
[]
no_license
-- Write a query in SQL to find the name and year of the movies SELECT mov_title, mov_year FROM movie; -- Write a query in SQL to find the year when the movie American Beauty released select mov_year from movie where mov_title = 'American Beauty'; -- Write a query in SQL to find the movie which was released in the year 1999 select mov_title from movie where mov_year = 1999; -- Write a query in SQL to find the movies which was released before 1998 select mov_title from movie where mov_year < 1998; -- Write a query in SQL to return the name of all reviewers and name of movies together in a single list select rev_name from reviewer union select mov_title from movie; -- Write a query in SQL to find the name of all reviewers who have rated 7 or more stars to their rating select reviewer.rev_name from reviewer, rating where rating.rev_id = reviewer.rev_id and rating.rev_stars>=7 and reviewer.rev_name IS NOT NULL; -- Write a query in SQL to find the titles of all movies that have no ratings select mov_title from movie where mov_id NOT IN ( select mov_id from rating); -- Write a query in SQL to find the name of all reviewers who have rated their ratings with a NULL value select rev_name from reviewer inner join rating USING(rev_id) where rev_stars IS NULL; -- Write a query in SQL to find the name of movie and director (first and last names) who directed a movie that casted a role for 'Eyes Wide Shut' select dir_fname, dir_lname, mov_title from director natural join movie_direction natural join movie natural join movie_cast where role IS NOT NULL and mov_title='Eyes Wide Shut';
true
c0c70f5b37347e4c76a13c2ab490e6ee13e7562d
SQL
rupertoss/RefuellingsTracker
/src/test/resources/beforeTest.sql
UTF-8
1,747
3.328125
3
[]
no_license
DROP TABLE IF EXISTS `refuellings`; DROP TABLE IF EXISTS `users`; DROP TABLE IF EXISTS `users_vehicles`; DROP TABLE IF EXISTS `vehicles`; CREATE TABLE `refuellings` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `fuel_type` int(11) NOT NULL, `mileage` int(11) NOT NULL, `price` decimal(19,2) NOT NULL, `quantity` decimal(6,2) NOT NULL, `timestamp` datetime DEFAULT NULL, `user_id` bigint(20) NOT NULL, `vehicle_id` bigint(20) NOT NULL, PRIMARY KEY (`id`), KEY `FK4ldb98brdnv0xxb7gq2u15tb0` (`user_id`), KEY `FKpmstvg63bqno8h7x3fi2njhm` (`vehicle_id`) ) ENGINE=MyISAM AUTO_INCREMENT=6 DEFAULT CHARSET=utf8; CREATE TABLE `users` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `name` varchar(255) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM AUTO_INCREMENT=3 DEFAULT CHARSET=utf8; CREATE TABLE `users_vehicles` ( `user_id` bigint(20) NOT NULL, `vehicle_id` bigint(20) NOT NULL, PRIMARY KEY (`user_id`,`vehicle_id`), KEY `FKfamokmwi5l2oaqog49d0xtbq` (`vehicle_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; CREATE TABLE `vehicles` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `mileage` int(10) unsigned NOT NULL DEFAULT '0', `plate_number` varchar(255) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM AUTO_INCREMENT=3 DEFAULT CHARSET=utf8; INSERT INTO `refuellings` VALUES (1,2,124578,174.53,42.12,'2018-05-01 12:00:00',1,1),(2,0,78456,150.00,30.00,'2018-05-02 13:05:00',2,2),(3,2,125108,121.78,27.34,'2018-05-04 14:50:00',1,1),(4,0,78994,185.94,37.61,'2018-05-05 22:15:00',2,2),(5,0,79621,61.02,12.02,'2018-05-08 08:20:30',1,2); INSERT INTO `users` VALUES (1,'user1'),(2,'user2'); INSERT INTO `users_vehicles` VALUES (1,1),(1,2),(2,2); INSERT INTO `vehicles` VALUES (1,123456,'RZ01234'),(2,78001,'RZE45678');
true
dd58117d773e5d247a06c8bde79fcd57a78b61dd
SQL
rakib1521/Production-Prediction-
/Site F/insert_employee.sql
UTF-8
472
3.203125
3
[]
no_license
SET SERVEROUTPUT ON; DECLARE ID INTEGER; EMP_NAME VARCHAR2(9):='&Employee_Name'; POSITION VARCHAR2(10):='&Position'; SALARY int:=&SALARY; NEG_VALUE EXCEPTION ; BEGIN IF SALARY<=0 THEN RAISE NEG_VALUE; END IF; select count(ID) into ID from EMP_F; ID:= ID +1; insert into EMP_F (ID,EMP_NAME,POSITION,SALARY,OFFICE) values (ID,EMP_NAME,POSITION,SALARY,'FACTORY'); EXCEPTION WHEN NEG_VALUE THEN DBMS_OUTPUT.PUT_LINE('SALARY CAN NOT BE NEGETIVE'); END; / COMMIT;
true
700de8dcc15f63b171ffde934265912efb47b34e
SQL
Kudusov/DB_API_Project
/db-project/src/main/resources/db/migration/V1__init.sql
UTF-8
2,541
4.0625
4
[]
no_license
DROP TABLE IF EXISTS Users CASCADE; DROP TABLE IF EXISTS Forums CASCADE; DROP TABLE IF EXISTS Threads CASCADE; DROP TABLE IF EXISTS Posts CASCADE; DROP TABLE IF EXISTS Votes CASCADE ; CREATE EXTENSION IF NOT EXISTS CITEXT; DROP INDEX IF EXISTS forums_user_id_idx; DROP INDEX IF EXISTS threads_user_id_idx; DROP INDEX IF EXISTS threads_forums_id_idx; DROP INDEX IF EXISTS posts_forum_id_idx; DROP INDEX IF EXISTS posts_user_id_idx; DROP INDEX IF EXISTS posts_path_thread_id_idx; DROP INDEX IF EXISTS posts_threads_id_idx; SET LOCAL SYNCHRONOUS_COMMIT = OFF; CREATE TABLE IF NOT EXISTS Users ( id SERIAL PRIMARY KEY, about TEXT DEFAULT NULL, fullname TEXT DEFAULT NULL, nickname CITEXT UNIQUE , email CITEXT UNIQUE ); CREATE TABLE IF NOT EXISTS Forums ( id SERIAL PRIMARY KEY, posts INTEGER DEFAULT 0, threads INTEGER DEFAULT 0, title TEXT, slug CITEXT UNIQUE NOT NULL, user_id INTEGER REFERENCES Users(id) ON DELETE CASCADE NOT NULL ); CREATE TABLE IF NOT EXISTS Threads ( id SERIAL PRIMARY KEY, user_id INTEGER REFERENCES Users(id) ON DELETE CASCADE NOT NULL, created TIMESTAMPTZ DEFAULT NOW(), forum_id INTEGER REFERENCES Forums(id) ON DELETE CASCADE NOT NULL, message TEXT, slug CITEXT UNIQUE DEFAULT NULL, title TEXT, votes INTEGER DEFAULT 0 ); CREATE TABLE IF NOT EXISTS Posts ( user_id INTEGER REFERENCES Users(id) ON DELETE CASCADE NOT NULL, created TIMESTAMPTZ DEFAULT NOW(), forum_id INTEGER REFERENCES Forums(id) ON DELETE CASCADE NOT NULL, id SERIAL PRIMARY KEY, is_edited BOOLEAN NOT NULL DEFAULT FALSE, message TEXT, parent INTEGER DEFAULT 0, thread_id INTEGER REFERENCES Threads(id) ON DELETE CASCADE NOT NULL, path INTEGER [] NOT NULL, root_id INTEGER ); CREATE TABLE IF NOT EXISTS Votes ( user_id INTEGER REFERENCES Users(id) ON DELETE CASCADE NOT NULL, thread_id INTEGER REFERENCES Threads(id) ON DELETE CASCADE NOT NULL, voice INTEGER DEFAULT 0, CONSTRAINT unique_pair UNIQUE (user_id, thread_id) ); CREATE INDEX IF NOT EXISTS forums_user_id_idx ON Forums (user_id); CREATE INDEX IF NOT EXISTS threads_user_id_idx ON Threads (user_id); CREATE INDEX IF NOT EXISTS threads_forums_id_idx ON Threads (forum_id); CREATE INDEX IF NOT EXISTS posts_user_id_idx ON Posts (user_id); CREATE INDEX IF NOT EXISTS posts_forum_id_idx ON Posts (forum_id); CREATE INDEX IF NOT EXISTS posts_threads_id_idx ON Posts (thread_id); CREATE INDEX IF NOT EXISTS posts_path_idx ON Posts (path); CREATE INDEX IF NOT EXISTS posts_path_thread_id_idx ON posts (thread_id, path);
true
bc3ce13cd937b29adef364b470041d171e2fc2fd
SQL
SINHASantos/users
/migrations/2018-11-21-150207_add_uuid/up.sql
UTF-8
244
2.6875
3
[]
no_license
ALTER TABLE reset_tokens ADD COLUMN uuid uuid; UPDATE reset_tokens SET uuid = uuid_generate_v4(); CREATE UNIQUE INDEX IF NOT EXISTS users_reset_tokens_uuid_idx ON reset_tokens (uuid); ALTER TABLE reset_tokens ALTER COLUMN uuid SET NOT NULL;
true
1f97b0bc473e053da9b37c42bfec1a4170df34b5
SQL
stuartMelville/dashboards
/scripts/dashboards.sql
UTF-8
1,871
2.640625
3
[]
no_license
INSERT INTO dashboards (id,created_at,title,updated_at) VALUES(1,'2018-11-01 8:23:12',"Title 1",'2018-11-01 8:23:12'); INSERT INTO dashboards (id,created_at,title,updated_at) VALUES(2,'2018-11-02 8:23:12',"Title 2",'2018-11-02 8:23:12'); INSERT INTO dashboards (id,created_at,title,updated_at) VALUES(3,'2018-11-03 8:23:12',"Title 3",'2018-11-03 8:23:12'); INSERT INTO dashboards (id,created_at,title,updated_at) VALUES(4,'2018-11-04 8:23:12',"Title 4",'2018-11-04 8:23:12'); INSERT INTO dashboards (id,created_at,title,updated_at) VALUES(5,'2018-11-05 8:23:12',"Title 5",'2018-11-05 8:23:12'); INSERT INTO dashboards (id,created_at,title,updated_at) VALUES(6,'2018-11-06 8:23:12',"Title 6",'2018-11-06 8:23:12'); INSERT INTO dashboards (id,created_at,title,updated_at) VALUES(7,'2018-11-07 8:23:12',"Title 7",'2018-11-07 8:23:12'); INSERT INTO dashboards (id,created_at,title,updated_at) VALUES(8,'2018-11-08 8:23:12',"Title 8",'2018-11-08 8:23:12'); INSERT INTO dashboards (id,created_at,title,updated_at) VALUES(9,'2018-11-09 8:23:12',"Title 9",'2018-11-09 8:23:12'); INSERT INTO dashboards (id,created_at,title,updated_at) VALUES(10,'2018-11-10 8:23:12',"Title 10",'2018-11-10 8:23:12'); INSERT INTO dashboards (id,created_at,title,updated_at) VALUES(12,'2018-11-11 8:23:12',"Title 11",'2018-11-11 8:23:12'); INSERT INTO dashboards (id,created_at,title,updated_at) VALUES(13,'2018-11-12 8:23:12',"Title 12",'2018-11-12 8:23:12'); select * from SELECT * FROM dashboards; DELETE FROM dashboards where id = '13'; DROP TABLE dashboards; use definitions; CREATE TABLE IF NOT EXISTS dashboards ( id int(11) NOT NULL AUTO_INCREMENT, createdAt TIMESTAMP NOT NULL DEFAULT NOW(), updatedAt TIMESTAMP NOT NULL DEFAULT NOW() ON UPDATE NOW(), title varchar(100) NOT NULL, PRIMARY KEY (id) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
true
72ad55bd8125c8f99b1517a22270168560c3e85a
SQL
klme1998/HelloWorld
/2020264283_任杰/record.sql
UTF-8
1,335
2.96875
3
[]
no_license
/* Navicat MySQL Data Transfer Source Server : localhost_3306 Source Server Version : 50615 Source Host : localhost:3306 Source Database : test1 Target Server Type : MYSQL Target Server Version : 50615 File Encoding : 65001 Date: 2020-09-19 20:26:02 */ SET FOREIGN_KEY_CHECKS=0; -- ---------------------------- -- Table structure for `record` -- ---------------------------- DROP TABLE IF EXISTS `record`; CREATE TABLE `record` ( `code` varchar(255) NOT NULL, `title` varchar(255) DEFAULT NULL, `publishDate` varchar(255) DEFAULT NULL, `performer` varchar(255) DEFAULT NULL, `format` varchar(255) DEFAULT NULL, PRIMARY KEY (`code`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- ---------------------------- -- Records of record -- ---------------------------- INSERT INTO `record` VALUES ('R001', 'Getz/Gilberto', '1963-03-15', 'Stan Getz and Joao Gilberto', 'CD'); INSERT INTO `record` VALUES ('R002', 'Kind of Blue', '1997-04-09', 'Miles Davis', 'CD'); INSERT INTO `record` VALUES ('R003', 'Supernatural', '1999-09-09', 'Santana', 'Tape'); INSERT INTO `record` VALUES ('R004', 'Private Collection', '1983-08-07', 'Jon & Vangelis', 'Tape'); INSERT INTO `record` VALUES ('R005', 'Abbey Road', '1969-12-23', 'Beatles', 'CD'); INSERT INTO `record` VALUES ('R006', 'Joshua Tree', '1990-11-17', 'U2', 'CD');
true
2122c6c365aca87d8ceb51f01fb2472c53bcb7d4
SQL
oscarmmi/Suplos
/bd/intelcost_bienes.sql
UTF-8
2,411
3.140625
3
[ "MIT" ]
permissive
-- phpMyAdmin SQL Dump -- version 5.0.2 -- https://www.phpmyadmin.net/ -- -- Servidor: 127.0.0.1 -- Tiempo de generación: 22-02-2021 a las 04:09:57 -- Versión del servidor: 10.4.14-MariaDB -- Versión de PHP: 7.4.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: `intelcost_bienes` -- -- -------------------------------------------------------- -- -- Estructura de tabla para la tabla `savedgoods` -- CREATE TABLE `savedgoods` ( `savedgood_id` int(11) NOT NULL, `Ciudad` varchar(100) NOT NULL, `Codigo_Postal` varchar(10) NOT NULL, `Direccion` varchar(100) NOT NULL, `good_id` int(11) NOT NULL, `Precio` int(11) NOT NULL, `Telefono` varchar(20) NOT NULL, `Tipo` varchar(100) NOT NULL, `user_id` int(11) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Volcado de datos para la tabla `savedgoods` -- INSERT INTO `savedgoods` (`savedgood_id`, `Ciudad`, `Codigo_Postal`, `Direccion`, `good_id`, `Precio`, `Telefono`, `Tipo`, `user_id`) VALUES (40, 'Los Angeles', '94526-134', '347-866 Laoreet Road', 4, 16048, '997-640-8188', 'Casa de Campo', NULL), (42, 'Orlando', '210020', '672-9576 Consectetuer Road', 6, 64370, '355-601-5749', 'Casa de Campo', NULL), (43, 'Orlando', '16794', '549-5766 Sodales St.', 7, 2846, '557-228-6918', 'Casa', NULL), (44, 'Washington', '70689', 'P.O. Box 847, 2589 In Av.', 8, 60951, '390-713-8687', 'Apartamento', NULL), (45, 'Orlando', 'P0C 0G3', '175-4344 Nec, Ave', 9, 58902, '578-170-6179', 'Casa de Campo', NULL), (46, 'New York', '85328', 'Ap #549-7395 Ut Rd.', 1, 30746, '334-052-0954', 'Casa', NULL); -- -- Índices para tablas volcadas -- -- -- Indices de la tabla `savedgoods` -- ALTER TABLE `savedgoods` ADD PRIMARY KEY (`savedgood_id`); -- -- AUTO_INCREMENT de las tablas volcadas -- -- -- AUTO_INCREMENT de la tabla `savedgoods` -- ALTER TABLE `savedgoods` MODIFY `savedgood_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=47; 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
0f86c903f7c738a1e90e2ad34d2106ac9c97bdfb
SQL
aeroshev/SQL_course
/create_tables.sql
UTF-8
3,892
4
4
[]
no_license
CREATE TABLE client ( user_id serial NOT NULL PRIMARY KEY, type character varying(12) NOT NULL ); CREATE TABLE individual ( user_id serial NOT NULL, name character varying(20) NOT NULL, number_id int NOT NULL UNIQUE CHECK(number_id > 0), place_residence character varying(200) NOT NULL, PRIMARY KEY (user_id), FOREIGN KEY (user_id) REFERENCES client ON DELETE CASCADE ); CREATE TABLE organization ( user_id serial NOT NULL, name_org character varying(100) NOT NULL UNIQUE, address_org character varying(200) NOT NULL, PRIMARY KEY (user_id), FOREIGN KEY (user_id) REFERENCES client ON DELETE CASCADE ); CREATE TABLE paydoc ( paydoc_id serial NOT NULL PRIMARY KEY, user_id serial NOT NULL, pay_date date NOT NULL DEFAULT current_date, FOREIGN KEY (user_id) REFERENCES client ON DELETE NO ACTION ); CREATE TABLE premises ( premises_id serial NOT NULL PRIMARY KEY, type character varying(20) NOT NULL, address character varying(40) NOT NULL UNIQUE, square numeric(5, 2) NOT NULL, name character varying(40) NOT NULL, price money NOT NULL CHECK (price >= 0.0::money) ); CREATE TABLE event ( event_id serial NOT NULL PRIMARY KEY, premises_id serial NULL, type character varying (40) NOT NULL, rent_cost money NOT NULL CHECK (rent_cost >= 0.0::money) ); CREATE TABLE rental_agreement ( event_id serial NOT NULL, premises_id serial NOT NULL, PRIMARY KEY (event_id, premises_id), FOREIGN KEY (event_id) REFERENCES event ON DELETE CASCADE, FOREIGN KEY (premises_id) REFERENCES premises ON DELETE CASCADE ); CREATE TABLE contract ( contract_id serial NOT NULL PRIMARY KEY, user_id serial NOT NULL, event_id serial NOT NULL, quantity_guest smallint NOT NULL CHECK (quantity_guest >= 0), date_contract date NOT NULL DEFAULT current_date, date_dissolve date NOT NULL CHECK (date_dissolve > date_contract), FOREIGN KEY (user_id) REFERENCES client ON DELETE NO ACTION, FOREIGN KEY (event_id) REFERENCES event ON DELETE NO ACTION ); CREATE TABLE payment ( paydoc_id serial NOT NULL, contract_id serial NOT NULL, payed money NOT NULL CHECK (payed >= 0.0::money), PRIMARY KEY (paydoc_id, contract_id), FOREIGN KEY (paydoc_id) REFERENCES paydoc ON DELETE CASCADE, FOREIGN KEY (contract_id) REFERENCES contract ON DELETE CASCADE ); CREATE TABLE service ( service_id serial NOT NULL PRIMARY KEY, description character varying(100) NULL, price money NOT NULL CHECK (price >= 0.0::money) ); CREATE TABLE possible_service ( service_id serial NOT NULL, event_id serial NOT NULL, PRIMARY KEY (service_id, event_id), FOREIGN KEY (service_id) REFERENCES service ON DELETE CASCADE, FOREIGN KEY (event_id) REFERENCES event ON DELETE CASCADE ); CREATE TABLE contract_service ( string_id serial NOT NULL PRIMARY KEY, contract_id serial NOT NULL, service_id serial NOT NULL, event_id serial NOT NULL, FOREIGN KEY (contract_id) REFERENCES contract ON DELETE CASCADE, FOREIGN KEY (service_id, event_id) REFERENCES possible_service ON DELETE CASCADE ); CREATE TABLE star ( star_id serial NOT NULL PRIMARY KEY, real_name character varying(20) NOT NULL, nick_name character varying(20) NULL, fee money NOT NULL CHECK (fee >= 0.0::money), contacts character varying(40) NOT NULL ); CREATE TABLE subsidiary_agreement ( event_id serial NOT NULL, star_id serial NOT NULL, PRIMARY KEY (event_id, star_id), FOREIGN KEY (event_id) REFERENCES event ON DELETE CASCADE, FOREIGN KEY (star_id) REFERENCES star ON DELETE CASCADE ); CREATE TABLE invite ( star_id serial NOT NULL PRIMARY KEY, last_update_date date NOT NULL DEFAULT current_date, qty_events integer NOT NULL DEFAULT 0, total_payments money NOT NULL DEFAULT 0.0::money );
true
e779e547bf7fbf2dd25bd2d4019dbf082b5d46c7
SQL
antoniofurone/cy-bss-core
/cy-bss-core/DataBase/Mercury/MySql/views/cr_vw_05_OBJECT.sql
UTF-8
957
3.484375
3
[ "MIT" ]
permissive
drop view BSSV_ATTRIBUTE; create view BSSV_ATTRIBUTE (ID,NAME,TYPE_ID,TYPE,OBJ_ID,OBJECT,ENTITY) as select a.ATT_N_ATTRIBUTE_ID,a.ATT_S_NAME, b.ATY_N_ATTR_TYPE_ID,b.ATY_S_NAME, c.OBJ_N_OBJECT_ID,c.OBJ_S_NAME,c.OBJ_S_ENTITY_NAME from BSST_ATT_ATTRIBUTE a join BSST_ATY_ATTR_TYPE b on a.ATY_N_ATTR_TYPE_ID=b.ATY_N_ATTR_TYPE_ID join BSST_OBJ_OBJECT c on c.OBJ_N_OBJECT_ID=a.OBJ_N_OBJECT_ID; drop view BSSV_ATTRIBUTE_VALUE; create view BSSV_ATTRIBUTE_VALUE (ID,NAME,TYPE_ID,TYPE,OBJ_ID,OBJECT,ENTITY,OBJINST_ID,VALUE) as select a.ATT_N_ATTRIBUTE_ID,a.ATT_S_NAME, b.ATY_N_ATTR_TYPE_ID,b.ATY_S_NAME, c.OBJ_N_OBJECT_ID,c.OBJ_S_NAME,c.OBJ_S_ENTITY_NAME, d.ATV_N_OBJ_INST_ID,d.ATV_S_VALUE from BSST_ATT_ATTRIBUTE a join BSST_ATY_ATTR_TYPE b on a.ATY_N_ATTR_TYPE_ID=b.ATY_N_ATTR_TYPE_ID join BSST_OBJ_OBJECT c on c.OBJ_N_OBJECT_ID=a.OBJ_N_OBJECT_ID join BSST_ATV_ATTR_VALUE d on a.ATT_N_ATTRIBUTE_ID=d.ATT_N_ATTRIBUTE_ID;
true
43c8a156f61a8acfd0659301e3a3685188bead0f
SQL
advocaite/legacy
/game.sql
UTF-8
89,072
2.828125
3
[ "MIT", "LicenseRef-scancode-warranty-disclaimer", "LicenseRef-scancode-unknown-license-reference" ]
permissive
-- MySQL dump 10.13 Distrib 5.7.4-m14, for Linux (x86_64) -- -- Host: db.hackerexperience.com Database: game -- ------------------------------------------------------ -- Server version 5.7.4-m14 /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8 */; /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; /*!40103 SET TIME_ZONE='+00:00' */; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; -- -- Table structure for table `admin` -- DROP TABLE IF EXISTS `admin`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `admin` ( `id` tinyint(2) NOT NULL AUTO_INCREMENT, `user` varchar(50) NOT NULL, `email` varchar(50) NOT NULL, `password` varchar(36) NOT NULL, `lastLogin` datetime NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `admin` -- LOCK TABLES `admin` WRITE; /*!40000 ALTER TABLE `admin` DISABLE KEYS */; /*!40000 ALTER TABLE `admin` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `admin_reports` -- DROP TABLE IF EXISTS `admin_reports`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `admin_reports` ( `id` int(5) NOT NULL AUTO_INCREMENT, `errorID` int(5) NOT NULL, `userID` int(5) NOT NULL, `report` text NOT NULL, `critical` tinyint(1) NOT NULL, `time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `read` tinyint(1) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `admin_reports` -- LOCK TABLES `admin_reports` WRITE; /*!40000 ALTER TABLE `admin_reports` DISABLE KEYS */; /*!40000 ALTER TABLE `admin_reports` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `badges_clans` -- DROP TABLE IF EXISTS `badges_clans`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `badges_clans` ( `badgeID` tinyint(3) NOT NULL, `priority` int(5) NOT NULL, PRIMARY KEY (`badgeID`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `badges_clans` -- LOCK TABLES `badges_clans` WRITE; /*!40000 ALTER TABLE `badges_clans` DISABLE KEYS */; /*!40000 ALTER TABLE `badges_clans` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `badges_users` -- DROP TABLE IF EXISTS `badges_users`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `badges_users` ( `badgeID` tinyint(3) NOT NULL, `priority` smallint(3) NOT NULL, PRIMARY KEY (`badgeID`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `badges_users` -- LOCK TABLES `badges_users` WRITE; /*!40000 ALTER TABLE `badges_users` DISABLE KEYS */; /*!40000 ALTER TABLE `badges_users` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `bankAccounts` -- DROP TABLE IF EXISTS `bankAccounts`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `bankAccounts` ( `id` int(12) NOT NULL AUTO_INCREMENT, `bankAcc` bigint(12) NOT NULL, `bankPass` varchar(6) NOT NULL, `bankID` int(5) NOT NULL, `bankUser` int(5) NOT NULL, `cash` bigint(15) NOT NULL, `dateCreated` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`id`), KEY `id` (`bankUser`), KEY `bankUser` (`bankUser`,`bankAcc`,`bankID`), KEY `bankAcc` (`bankAcc`) ) ENGINE=InnoDB AUTO_INCREMENT=12716004 DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `bankAccounts` -- LOCK TABLES `bankAccounts` WRITE; /*!40000 ALTER TABLE `bankAccounts` DISABLE KEYS */; /*!40000 ALTER TABLE `bankAccounts` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `bankaccounts_expire` -- DROP TABLE IF EXISTS `bankaccounts_expire`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `bankaccounts_expire` ( `accID` int(30) unsigned NOT NULL, `expireDate` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, KEY `expireDate` (`expireDate`), KEY `accID` (`accID`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `bankaccounts_expire` -- LOCK TABLES `bankaccounts_expire` WRITE; /*!40000 ALTER TABLE `bankaccounts_expire` DISABLE KEYS */; /*!40000 ALTER TABLE `bankaccounts_expire` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `bitcoin_wallets` -- DROP TABLE IF EXISTS `bitcoin_wallets`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `bitcoin_wallets` ( `address` varchar(34) NOT NULL, `userID` int(5) unsigned NOT NULL, `npcID` int(5) unsigned NOT NULL, `key` varchar(64) NOT NULL, `amount` decimal(12,7) unsigned NOT NULL, `createdAt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`address`), KEY `userID` (`userID`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `bitcoin_wallets` -- LOCK TABLES `bitcoin_wallets` WRITE; /*!40000 ALTER TABLE `bitcoin_wallets` DISABLE KEYS */; /*!40000 ALTER TABLE `bitcoin_wallets` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `bugreports` -- DROP TABLE IF EXISTS `bugreports`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `bugreports` ( `id` int(11) NOT NULL AUTO_INCREMENT, `dateCreated` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `bugText` text NOT NULL, `reportedBy` int(5) unsigned NOT NULL, `sessionContent` text NOT NULL, `serverContent` text NOT NULL, `follow` tinyint(1) NOT NULL DEFAULT '0', `solved` tinyint(1) NOT NULL DEFAULT '0', PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=4289 DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `bugreports` -- LOCK TABLES `bugreports` WRITE; /*!40000 ALTER TABLE `bugreports` DISABLE KEYS */; /*!40000 ALTER TABLE `bugreports` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `cache` -- DROP TABLE IF EXISTS `cache`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `cache` ( `userID` int(5) unsigned NOT NULL, `reputation` int(6) unsigned NOT NULL DEFAULT '0', PRIMARY KEY (`userID`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `cache` -- LOCK TABLES `cache` WRITE; /*!40000 ALTER TABLE `cache` DISABLE KEYS */; /*!40000 ALTER TABLE `cache` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `cache_profile` -- DROP TABLE IF EXISTS `cache_profile`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `cache_profile` ( `userID` int(5) unsigned NOT NULL, `expireDate` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, UNIQUE KEY `userID` (`userID`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `cache_profile` -- LOCK TABLES `cache_profile` WRITE; /*!40000 ALTER TABLE `cache_profile` DISABLE KEYS */; /*!40000 ALTER TABLE `cache_profile` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `certifications` -- DROP TABLE IF EXISTS `certifications`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `certifications` ( `userID` int(5) NOT NULL, `certLevel` tinyint(1) NOT NULL, PRIMARY KEY (`userID`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `certifications` -- LOCK TABLES `certifications` WRITE; /*!40000 ALTER TABLE `certifications` DISABLE KEYS */; /*!40000 ALTER TABLE `certifications` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `changelog` -- DROP TABLE IF EXISTS `changelog`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `changelog` ( `id` int(11) NOT NULL AUTO_INCREMENT, `description` varchar(100) NOT NULL, `text` text NOT NULL, `dateCreated` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `author` varchar(50) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `changelog` -- LOCK TABLES `changelog` WRITE; /*!40000 ALTER TABLE `changelog` DISABLE KEYS */; /*!40000 ALTER TABLE `changelog` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `clan` -- DROP TABLE IF EXISTS `clan`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `clan` ( `clanID` int(5) NOT NULL AUTO_INCREMENT, `clanIP` int(11) unsigned NOT NULL, `name` varchar(25) NOT NULL, `nick` varchar(3) NOT NULL, `desc` text NOT NULL, `slotsUsed` smallint(3) NOT NULL, `slotsTotal` smallint(3) NOT NULL, `createdOn` datetime NOT NULL, `createdBy` int(5) NOT NULL, `powerTax` tinyint(2) NOT NULL, `moneyTax` tinyint(2) NOT NULL, `money` int(10) NOT NULL, `power` int(10) NOT NULL, `corp` tinyint(1) NOT NULL, PRIMARY KEY (`clanID`) ) ENGINE=InnoDB AUTO_INCREMENT=23259 DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `clan` -- LOCK TABLES `clan` WRITE; /*!40000 ALTER TABLE `clan` DISABLE KEYS */; /*!40000 ALTER TABLE `clan` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `clan_badge` -- DROP TABLE IF EXISTS `clan_badge`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `clan_badge` ( `clanID` int(5) NOT NULL, `badgeID` smallint(3) NOT NULL, `round` tinyint(3) NOT NULL DEFAULT '0', `dateAdd` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, KEY `userID` (`clanID`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `clan_badge` -- LOCK TABLES `clan_badge` WRITE; /*!40000 ALTER TABLE `clan_badge` DISABLE KEYS */; /*!40000 ALTER TABLE `clan_badge` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `clan_ddos` -- DROP TABLE IF EXISTS `clan_ddos`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `clan_ddos` ( `attackerClan` int(5) NOT NULL, `victimClan` int(5) NOT NULL, `ddosID` int(5) NOT NULL, `displayAttacker` tinyint(1) NOT NULL DEFAULT '1', `displayVictim` tinyint(1) NOT NULL DEFAULT '1', KEY `attackerClan` (`attackerClan`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `clan_ddos` -- LOCK TABLES `clan_ddos` WRITE; /*!40000 ALTER TABLE `clan_ddos` DISABLE KEYS */; /*!40000 ALTER TABLE `clan_ddos` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `clan_ddos_history` -- DROP TABLE IF EXISTS `clan_ddos_history`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `clan_ddos_history` ( `attackerClan` int(5) NOT NULL, `victimClan` int(5) NOT NULL, `ddosID` int(5) NOT NULL, `warID` int(5) NOT NULL, KEY `attackerClan` (`attackerClan`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `clan_ddos_history` -- LOCK TABLES `clan_ddos_history` WRITE; /*!40000 ALTER TABLE `clan_ddos_history` DISABLE KEYS */; /*!40000 ALTER TABLE `clan_ddos_history` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `clan_defcon` -- DROP TABLE IF EXISTS `clan_defcon`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `clan_defcon` ( `id` int(5) NOT NULL AUTO_INCREMENT, `attackerID` int(5) NOT NULL, `attackerClanID` int(4) NOT NULL, `victimID` int(5) NOT NULL, `victimClanID` int(4) NOT NULL, `attackDate` datetime NOT NULL, `clanServer` tinyint(1) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=29249 DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `clan_defcon` -- LOCK TABLES `clan_defcon` WRITE; /*!40000 ALTER TABLE `clan_defcon` DISABLE KEYS */; /*!40000 ALTER TABLE `clan_defcon` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `clan_requests` -- DROP TABLE IF EXISTS `clan_requests`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `clan_requests` ( `id` int(5) NOT NULL AUTO_INCREMENT, `clanID` int(5) unsigned NOT NULL, `userID` int(5) NOT NULL, `adminID` int(5) NOT NULL, `type` tinyint(1) NOT NULL, `askedDate` datetime NOT NULL, `msg` text NOT NULL, PRIMARY KEY (`id`), KEY `clanID` (`clanID`) ) ENGINE=InnoDB AUTO_INCREMENT=63154 DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `clan_requests` -- LOCK TABLES `clan_requests` WRITE; /*!40000 ALTER TABLE `clan_requests` DISABLE KEYS */; /*!40000 ALTER TABLE `clan_requests` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `clan_stats` -- DROP TABLE IF EXISTS `clan_stats`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `clan_stats` ( `cid` int(5) NOT NULL, `totalMemberPower` int(11) NOT NULL, `averageMemberPower` int(10) NOT NULL, `averageMemberRanking` int(5) NOT NULL, `totalMoneyEarned` int(11) NOT NULL, `averageMoneyEarned` int(11) NOT NULL, `servers` smallint(3) NOT NULL, `members` int(5) NOT NULL, `pageClicks` int(5) NOT NULL, `won` int(4) NOT NULL, `lost` int(4) NOT NULL, PRIMARY KEY (`cid`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `clan_stats` -- LOCK TABLES `clan_stats` WRITE; /*!40000 ALTER TABLE `clan_stats` DISABLE KEYS */; /*!40000 ALTER TABLE `clan_stats` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `clan_users` -- DROP TABLE IF EXISTS `clan_users`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `clan_users` ( `id` int(5) NOT NULL AUTO_INCREMENT, `clanID` int(5) NOT NULL, `userID` int(5) NOT NULL, `memberSince` date NOT NULL, `authLevel` tinyint(1) NOT NULL, `hierarchy` tinyint(2) NOT NULL, PRIMARY KEY (`id`), KEY `clanID` (`clanID`), KEY `userID` (`userID`) ) ENGINE=InnoDB AUTO_INCREMENT=48282 DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `clan_users` -- LOCK TABLES `clan_users` WRITE; /*!40000 ALTER TABLE `clan_users` DISABLE KEYS */; /*!40000 ALTER TABLE `clan_users` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `clan_war` -- DROP TABLE IF EXISTS `clan_war`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `clan_war` ( `id` int(5) NOT NULL AUTO_INCREMENT, `clanID1` int(5) NOT NULL, `clanID2` int(5) NOT NULL, `score1` int(10) NOT NULL, `score2` int(10) NOT NULL, `startDate` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', `endDate` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', `bounty` int(10) NOT NULL, PRIMARY KEY (`id`), KEY `clanID1` (`clanID1`,`clanID2`) ) ENGINE=InnoDB AUTO_INCREMENT=4764 DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `clan_war` -- LOCK TABLES `clan_war` WRITE; /*!40000 ALTER TABLE `clan_war` DISABLE KEYS */; /*!40000 ALTER TABLE `clan_war` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `clan_war_history` -- DROP TABLE IF EXISTS `clan_war_history`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `clan_war_history` ( `id` int(5) unsigned NOT NULL AUTO_INCREMENT, `idWinner` int(5) unsigned NOT NULL, `idLoser` int(5) unsigned NOT NULL, `scoreWinner` int(10) unsigned NOT NULL, `scoreLoser` int(10) unsigned NOT NULL, `startDate` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `endDate` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', `bounty` int(10) unsigned NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=4494 DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `clan_war_history` -- LOCK TABLES `clan_war_history` WRITE; /*!40000 ALTER TABLE `clan_war_history` DISABLE KEYS */; /*!40000 ALTER TABLE `clan_war_history` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `debug_pagarme` -- DROP TABLE IF EXISTS `debug_pagarme`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `debug_pagarme` ( `debug_id` int(5) unsigned NOT NULL AUTO_INCREMENT, `id` int(10) NOT NULL, `post` text NOT NULL, PRIMARY KEY (`debug_id`), KEY `id` (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=481 DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `debug_pagarme` -- LOCK TABLES `debug_pagarme` WRITE; /*!40000 ALTER TABLE `debug_pagarme` DISABLE KEYS */; /*!40000 ALTER TABLE `debug_pagarme` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `doom_abort` -- DROP TABLE IF EXISTS `doom_abort`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `doom_abort` ( `doomID` int(5) unsigned NOT NULL, `abortedBy` int(5) unsigned NOT NULL, `abortDate` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`doomID`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `doom_abort` -- LOCK TABLES `doom_abort` WRITE; /*!40000 ALTER TABLE `doom_abort` DISABLE KEYS */; /*!40000 ALTER TABLE `doom_abort` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `email_delete` -- DROP TABLE IF EXISTS `email_delete`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `email_delete` ( `userID` int(5) NOT NULL, `code` varchar(13) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `email_delete` -- LOCK TABLES `email_delete` WRITE; /*!40000 ALTER TABLE `email_delete` DISABLE KEYS */; /*!40000 ALTER TABLE `email_delete` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `email_reset` -- DROP TABLE IF EXISTS `email_reset`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `email_reset` ( `userID` int(5) NOT NULL, `code` varchar(32) NOT NULL, `requestDate` timestamp NULL DEFAULT CURRENT_TIMESTAMP, KEY `userID` (`userID`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `email_reset` -- LOCK TABLES `email_reset` WRITE; /*!40000 ALTER TABLE `email_reset` DISABLE KEYS */; /*!40000 ALTER TABLE `email_reset` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `email_verification` -- DROP TABLE IF EXISTS `email_verification`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `email_verification` ( `userID` int(5) unsigned NOT NULL, `email` varchar(60) NOT NULL, `code` varchar(25) NOT NULL, `creationDate` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`userID`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `email_verification` -- LOCK TABLES `email_verification` WRITE; /*!40000 ALTER TABLE `email_verification` DISABLE KEYS */; /*!40000 ALTER TABLE `email_verification` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `fbi` -- DROP TABLE IF EXISTS `fbi`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `fbi` ( `ip` bigint(11) NOT NULL, `reason` tinyint(1) NOT NULL, `bounty` bigint(15) NOT NULL, `dateAdd` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', `dateEnd` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', KEY `ip` (`ip`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `fbi` -- LOCK TABLES `fbi` WRITE; /*!40000 ALTER TABLE `fbi` DISABLE KEYS */; /*!40000 ALTER TABLE `fbi` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `friend_requests` -- DROP TABLE IF EXISTS `friend_requests`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `friend_requests` ( `id` int(5) NOT NULL AUTO_INCREMENT, `userID` int(5) NOT NULL, `requestedBy` int(5) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=95891 DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `friend_requests` -- LOCK TABLES `friend_requests` WRITE; /*!40000 ALTER TABLE `friend_requests` DISABLE KEYS */; /*!40000 ALTER TABLE `friend_requests` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `hardware` -- DROP TABLE IF EXISTS `hardware`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `hardware` ( `serverID` int(5) NOT NULL AUTO_INCREMENT, `userID` int(5) NOT NULL, `name` varchar(15) NOT NULL, `cpu` float NOT NULL DEFAULT '500', `hdd` float NOT NULL DEFAULT '100', `ram` float NOT NULL DEFAULT '256', `net` float NOT NULL DEFAULT '1', `isNPC` tinyint(1) NOT NULL DEFAULT '0', PRIMARY KEY (`serverID`), KEY `IndiceComNPC` (`userID`,`isNPC`) ) ENGINE=InnoDB AUTO_INCREMENT=6593993 DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `hardware` -- LOCK TABLES `hardware` WRITE; /*!40000 ALTER TABLE `hardware` DISABLE KEYS */; /*!40000 ALTER TABLE `hardware` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `hardware_external` -- DROP TABLE IF EXISTS `hardware_external`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `hardware_external` ( `serverID` int(5) NOT NULL AUTO_INCREMENT, `userID` int(5) NOT NULL, `name` varchar(15) NOT NULL, `size` int(4) NOT NULL DEFAULT '100', UNIQUE KEY `serverID` (`serverID`), KEY `userID` (`userID`) ) ENGINE=InnoDB AUTO_INCREMENT=329611 DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `hardware_external` -- LOCK TABLES `hardware_external` WRITE; /*!40000 ALTER TABLE `hardware_external` DISABLE KEYS */; /*!40000 ALTER TABLE `hardware_external` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `hist_clans` -- DROP TABLE IF EXISTS `hist_clans`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `hist_clans` ( `id` int(5) NOT NULL AUTO_INCREMENT, `cid` int(5) NOT NULL, `rank` int(5) NOT NULL, `name` varchar(50) NOT NULL, `nick` varchar(4) NOT NULL, `reputation` bigint(10) NOT NULL, `members` tinyint(3) NOT NULL, `round` tinyint(3) NOT NULL, `won` int(4) NOT NULL, `lost` int(4) NOT NULL, `rate` float NOT NULL, `clicks` smallint(5) NOT NULL, PRIMARY KEY (`id`), KEY `cid` (`cid`), KEY `reputation` (`reputation`) ) ENGINE=InnoDB AUTO_INCREMENT=67957 DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `hist_clans` -- LOCK TABLES `hist_clans` WRITE; /*!40000 ALTER TABLE `hist_clans` DISABLE KEYS */; /*!40000 ALTER TABLE `hist_clans` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `hist_clans_current` -- DROP TABLE IF EXISTS `hist_clans_current`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `hist_clans_current` ( `id` int(5) NOT NULL AUTO_INCREMENT, `cid` int(5) NOT NULL, `name` varchar(50) NOT NULL, `nick` varchar(4) NOT NULL, `clanIP` bigint(12) NOT NULL, `reputation` bigint(10) NOT NULL, `members` tinyint(3) NOT NULL, `won` smallint(4) NOT NULL, `lost` smallint(4) NOT NULL, `rate` double NOT NULL, `clicks` smallint(5) NOT NULL, PRIMARY KEY (`id`), KEY `cid` (`cid`), KEY `reputation` (`reputation`) ) ENGINE=InnoDB AUTO_INCREMENT=23259 DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `hist_clans_current` -- LOCK TABLES `hist_clans_current` WRITE; /*!40000 ALTER TABLE `hist_clans_current` DISABLE KEYS */; /*!40000 ALTER TABLE `hist_clans_current` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `hist_clans_war` -- DROP TABLE IF EXISTS `hist_clans_war`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `hist_clans_war` ( `id` int(5) unsigned NOT NULL AUTO_INCREMENT, `idWinner` int(5) unsigned NOT NULL, `idLoser` int(5) unsigned NOT NULL, `scoreWinner` int(10) unsigned NOT NULL, `scoreLoser` int(10) unsigned NOT NULL, `startDate` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `endDate` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', `bounty` int(10) unsigned NOT NULL, `round` tinyint(2) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=1958 DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `hist_clans_war` -- LOCK TABLES `hist_clans_war` WRITE; /*!40000 ALTER TABLE `hist_clans_war` DISABLE KEYS */; /*!40000 ALTER TABLE `hist_clans_war` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `hist_ddos` -- DROP TABLE IF EXISTS `hist_ddos`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `hist_ddos` ( `id` int(5) NOT NULL AUTO_INCREMENT, `rank` int(4) NOT NULL, `round` tinyint(2) NOT NULL, `attID` int(5) NOT NULL, `attUser` varchar(35) NOT NULL, `vicID` int(5) NOT NULL, `vicUser` varchar(35) NOT NULL, `power` int(10) NOT NULL, `servers` int(3) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=159502 DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `hist_ddos` -- LOCK TABLES `hist_ddos` WRITE; /*!40000 ALTER TABLE `hist_ddos` DISABLE KEYS */; /*!40000 ALTER TABLE `hist_ddos` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `hist_doom` -- DROP TABLE IF EXISTS `hist_doom`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `hist_doom` ( `round` tinyint(3) NOT NULL, `doomCreatorID` int(5) unsigned NOT NULL, `doomClanID` int(5) unsigned NOT NULL, `status` tinyint(1) NOT NULL, KEY `round` (`round`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `hist_doom` -- LOCK TABLES `hist_doom` WRITE; /*!40000 ALTER TABLE `hist_doom` DISABLE KEYS */; /*!40000 ALTER TABLE `hist_doom` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `hist_mails` -- DROP TABLE IF EXISTS `hist_mails`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `hist_mails` ( `id` int(5) unsigned NOT NULL AUTO_INCREMENT, `from` int(5) unsigned NOT NULL, `to` int(5) unsigned NOT NULL, `subject` varchar(50) NOT NULL, `text` varchar(1000) NOT NULL, `dateSent` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `round` smallint(3) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `hist_mails` -- LOCK TABLES `hist_mails` WRITE; /*!40000 ALTER TABLE `hist_mails` DISABLE KEYS */; /*!40000 ALTER TABLE `hist_mails` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `hist_missions` -- DROP TABLE IF EXISTS `hist_missions`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `hist_missions` ( `id` int(5) unsigned NOT NULL AUTO_INCREMENT, `userID` int(5) unsigned NOT NULL, `type` tinyint(2) NOT NULL, `hirerID` int(5) unsigned NOT NULL, `prize` int(6) NOT NULL, `missionEnd` datetime NOT NULL, `completed` tinyint(1) NOT NULL, `round` tinyint(3) NOT NULL, PRIMARY KEY (`id`), KEY `userID` (`userID`) ) ENGINE=InnoDB AUTO_INCREMENT=486196 DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `hist_missions` -- LOCK TABLES `hist_missions` WRITE; /*!40000 ALTER TABLE `hist_missions` DISABLE KEYS */; /*!40000 ALTER TABLE `hist_missions` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `hist_software` -- DROP TABLE IF EXISTS `hist_software`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `hist_software` ( `id` int(5) NOT NULL AUTO_INCREMENT, `rank` int(5) NOT NULL, `softName` varchar(50) NOT NULL, `softType` tinyint(2) NOT NULL, `softVersion` double NOT NULL, `owner` varchar(50) NOT NULL, `ownerID` int(5) NOT NULL, `round` tinyint(3) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=543259 DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `hist_software` -- LOCK TABLES `hist_software` WRITE; /*!40000 ALTER TABLE `hist_software` DISABLE KEYS */; /*!40000 ALTER TABLE `hist_software` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `hist_users` -- DROP TABLE IF EXISTS `hist_users`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `hist_users` ( `id` int(5) NOT NULL AUTO_INCREMENT, `rank` int(5) NOT NULL, `userID` int(5) NOT NULL, `user` varchar(30) NOT NULL, `reputation` bigint(10) NOT NULL, `bestSoft` varchar(50) NOT NULL, `bestSoftVersion` float NOT NULL, `clanName` varchar(30) NOT NULL, `age` int(5) NOT NULL, `timePlaying` double NOT NULL, `bitcoinSent` double unsigned NOT NULL, `spamSent` int(15) unsigned NOT NULL, `warezSent` float unsigned NOT NULL, `profileViews` int(5) unsigned NOT NULL, `researchCount` int(5) unsigned NOT NULL, `missionCount` int(5) NOT NULL, `hackCount` int(5) NOT NULL, `ddosCount` int(4) NOT NULL, `ipResets` int(4) NOT NULL, `moneyEarned` bigint(15) NOT NULL, `moneyTransfered` bigint(15) NOT NULL, `moneyHardware` bigint(15) NOT NULL, `moneyResearch` bigint(15) NOT NULL, `round` tinyint(3) NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `userID_2` (`userID`,`round`), KEY `userID` (`userID`) ) ENGINE=InnoDB AUTO_INCREMENT=446252 DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `hist_users` -- LOCK TABLES `hist_users` WRITE; /*!40000 ALTER TABLE `hist_users` DISABLE KEYS */; /*!40000 ALTER TABLE `hist_users` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `hist_users_current` -- DROP TABLE IF EXISTS `hist_users_current`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `hist_users_current` ( `id` int(5) NOT NULL AUTO_INCREMENT, `userID` int(5) NOT NULL, `user` varchar(50) NOT NULL, `reputation` bigint(15) NOT NULL, `age` int(4) NOT NULL, `clanID` int(5) NOT NULL, `clanName` varchar(50) NOT NULL, `timePlaying` double NOT NULL, `missionCount` int(5) NOT NULL, `hackCount` int(5) NOT NULL, `ddosCount` int(5) NOT NULL, `ipResets` int(4) NOT NULL, `moneyEarned` bigint(15) NOT NULL, `moneyTransfered` bigint(15) NOT NULL, `moneyHardware` bigint(15) NOT NULL, `moneyResearch` bigint(15) NOT NULL, `warezSent` int(20) unsigned NOT NULL, `spamSent` int(20) unsigned NOT NULL, `bitcoinSent` double unsigned NOT NULL, `profileViews` int(10) unsigned NOT NULL, PRIMARY KEY (`id`), KEY `userID` (`userID`), KEY `reputation` (`reputation`) ) ENGINE=InnoDB AUTO_INCREMENT=750474 DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `hist_users_current` -- LOCK TABLES `hist_users_current` WRITE; /*!40000 ALTER TABLE `hist_users_current` DISABLE KEYS */; /*!40000 ALTER TABLE `hist_users_current` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `internet_connections` -- DROP TABLE IF EXISTS `internet_connections`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `internet_connections` ( `userID` int(5) NOT NULL, `ip` bigint(14) NOT NULL, `expires` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`userID`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `internet_connections` -- LOCK TABLES `internet_connections` WRITE; /*!40000 ALTER TABLE `internet_connections` DISABLE KEYS */; /*!40000 ALTER TABLE `internet_connections` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `internet_home` -- DROP TABLE IF EXISTS `internet_home`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `internet_home` ( `userID` int(5) unsigned NOT NULL, `homeIP` bigint(11) unsigned NOT NULL, PRIMARY KEY (`userID`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `internet_home` -- LOCK TABLES `internet_home` WRITE; /*!40000 ALTER TABLE `internet_home` DISABLE KEYS */; /*!40000 ALTER TABLE `internet_home` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `internet_important` -- DROP TABLE IF EXISTS `internet_important`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `internet_important` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `userID` int(5) unsigned NOT NULL, `ip` bigint(11) unsigned NOT NULL, `name` varchar(15) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=970151 DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `internet_important` -- LOCK TABLES `internet_important` WRITE; /*!40000 ALTER TABLE `internet_important` DISABLE KEYS */; /*!40000 ALTER TABLE `internet_important` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `internet_webserver` -- DROP TABLE IF EXISTS `internet_webserver`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `internet_webserver` ( `id` int(5) NOT NULL, `webDesc` text NOT NULL, `active` tinyint(1) NOT NULL, UNIQUE KEY `id` (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `internet_webserver` -- LOCK TABLES `internet_webserver` WRITE; /*!40000 ALTER TABLE `internet_webserver` DISABLE KEYS */; /*!40000 ALTER TABLE `internet_webserver` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `lists` -- DROP TABLE IF EXISTS `lists`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `lists` ( `id` int(5) NOT NULL AUTO_INCREMENT, `userID` int(5) NOT NULL, `ip` bigint(11) NOT NULL, `user` varchar(8) NOT NULL, `pass` varchar(9) NOT NULL, `hackedTime` datetime NOT NULL, `virusID` bigint(20) NOT NULL, PRIMARY KEY (`id`), KEY `userID` (`userID`), KEY `ip` (`ip`), KEY `virusID` (`virusID`) ) ENGINE=InnoDB AUTO_INCREMENT=4620175 DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `lists` -- LOCK TABLES `lists` WRITE; /*!40000 ALTER TABLE `lists` DISABLE KEYS */; /*!40000 ALTER TABLE `lists` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `lists_bankAccounts` -- DROP TABLE IF EXISTS `lists_bankAccounts`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `lists_bankAccounts` ( `id` int(5) NOT NULL AUTO_INCREMENT, `userID` int(5) NOT NULL, `bankID` int(5) NOT NULL, `bankAcc` int(6) NOT NULL, `bankPass` varchar(6) NOT NULL, `bankIP` int(11) NOT NULL, `hackedDate` datetime NOT NULL, `lastMoney` int(10) NOT NULL, `lastMoneyDate` datetime NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=1511488 DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `lists_bankAccounts` -- LOCK TABLES `lists_bankAccounts` WRITE; /*!40000 ALTER TABLE `lists_bankAccounts` DISABLE KEYS */; /*!40000 ALTER TABLE `lists_bankAccounts` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `lists_collect` -- DROP TABLE IF EXISTS `lists_collect`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `lists_collect` ( `userID` int(5) unsigned NOT NULL, `collectText` text NOT NULL, `date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`userID`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `lists_collect` -- LOCK TABLES `lists_collect` WRITE; /*!40000 ALTER TABLE `lists_collect` DISABLE KEYS */; /*!40000 ALTER TABLE `lists_collect` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `lists_notifications` -- DROP TABLE IF EXISTS `lists_notifications`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `lists_notifications` ( `userID` int(5) NOT NULL, `ip` bigint(11) NOT NULL, `notificationType` tinyint(1) NOT NULL, `virusName` varchar(30) NOT NULL, KEY `userID` (`userID`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `lists_notifications` -- LOCK TABLES `lists_notifications` WRITE; /*!40000 ALTER TABLE `lists_notifications` DISABLE KEYS */; /*!40000 ALTER TABLE `lists_notifications` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `lists_specs` -- DROP TABLE IF EXISTS `lists_specs`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `lists_specs` ( `listID` int(5) unsigned NOT NULL, `spec_net` int(5) NOT NULL DEFAULT '1', `spec_hdd` int(5) NOT NULL DEFAULT '1000', PRIMARY KEY (`listID`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `lists_specs` -- LOCK TABLES `lists_specs` WRITE; /*!40000 ALTER TABLE `lists_specs` DISABLE KEYS */; /*!40000 ALTER TABLE `lists_specs` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `lists_specs_analyzed` -- DROP TABLE IF EXISTS `lists_specs_analyzed`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `lists_specs_analyzed` ( `listID` int(5) unsigned NOT NULL, `minCPU` int(5) unsigned NOT NULL, `maxCPU` int(5) unsigned NOT NULL, `minRAM` int(5) unsigned NOT NULL, `maxRAM` int(5) unsigned NOT NULL, PRIMARY KEY (`listID`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `lists_specs_analyzed` -- LOCK TABLES `lists_specs_analyzed` WRITE; /*!40000 ALTER TABLE `lists_specs_analyzed` DISABLE KEYS */; /*!40000 ALTER TABLE `lists_specs_analyzed` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `log` -- DROP TABLE IF EXISTS `log`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `log` ( `userID` int(5) NOT NULL AUTO_INCREMENT, `text` text NOT NULL, `isNPC` tinyint(1) NOT NULL, KEY `userID` (`userID`) ) ENGINE=InnoDB AUTO_INCREMENT=897198 DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `log` -- LOCK TABLES `log` WRITE; /*!40000 ALTER TABLE `log` DISABLE KEYS */; /*!40000 ALTER TABLE `log` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `log_edit` -- DROP TABLE IF EXISTS `log_edit`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `log_edit` ( `id` int(5) unsigned NOT NULL AUTO_INCREMENT, `vicID` int(5) NOT NULL, `isNPC` tinyint(1) NOT NULL, `editorID` int(5) NOT NULL, `logText` text NOT NULL, PRIMARY KEY (`id`), KEY `vicID` (`vicID`,`isNPC`), KEY `editorID` (`editorID`) ) ENGINE=InnoDB AUTO_INCREMENT=13490282 DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `log_edit` -- LOCK TABLES `log_edit` WRITE; /*!40000 ALTER TABLE `log_edit` DISABLE KEYS */; /*!40000 ALTER TABLE `log_edit` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `mails` -- DROP TABLE IF EXISTS `mails`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `mails` ( `id` int(10) NOT NULL AUTO_INCREMENT, `from` int(5) NOT NULL, `to` int(5) NOT NULL, `type` tinyint(1) NOT NULL, `subject` varchar(40) NOT NULL, `text` text NOT NULL, `dateSent` datetime NOT NULL, `isRead` tinyint(1) NOT NULL, `isDeleted` tinyint(1) NOT NULL, PRIMARY KEY (`id`), KEY `from` (`from`), KEY `to` (`to`), KEY `type` (`type`) ) ENGINE=InnoDB AUTO_INCREMENT=4016487 DEFAULT CHARSET=utf8mb4; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `mails` -- LOCK TABLES `mails` WRITE; /*!40000 ALTER TABLE `mails` DISABLE KEYS */; /*!40000 ALTER TABLE `mails` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `mails_history` -- DROP TABLE IF EXISTS `mails_history`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `mails_history` ( `mid` int(15) unsigned NOT NULL, `infoDate` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `info1` varchar(15) NOT NULL, PRIMARY KEY (`mid`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `mails_history` -- LOCK TABLES `mails_history` WRITE; /*!40000 ALTER TABLE `mails_history` DISABLE KEYS */; /*!40000 ALTER TABLE `mails_history` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `missions` -- DROP TABLE IF EXISTS `missions`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `missions` ( `id` int(5) NOT NULL AUTO_INCREMENT, `type` tinyint(2) NOT NULL, `status` tinyint(1) NOT NULL, `hirer` bigint(11) unsigned NOT NULL, `victim` bigint(11) unsigned NOT NULL, `info` bigint(11) unsigned NOT NULL, `newInfo` int(6) NOT NULL, `info2` bigint(11) NOT NULL, `newInfo2` int(11) unsigned NOT NULL, `missionStart` date NOT NULL, `missionEnd` date NOT NULL, `prize` int(6) NOT NULL, `userID` int(5) NOT NULL, `level` tinyint(4) NOT NULL, `dateGenerated` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`id`), KEY `userID` (`userID`), KEY `status` (`status`) ) ENGINE=InnoDB AUTO_INCREMENT=13887278 DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `missions` -- LOCK TABLES `missions` WRITE; /*!40000 ALTER TABLE `missions` DISABLE KEYS */; /*!40000 ALTER TABLE `missions` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `missions_history` -- DROP TABLE IF EXISTS `missions_history`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `missions_history` ( `id` int(5) NOT NULL AUTO_INCREMENT, `type` tinyint(2) NOT NULL, `hirer` bigint(11) NOT NULL, `missionEnd` date NOT NULL, `prize` int(6) NOT NULL, `userID` int(5) NOT NULL, `completed` tinyint(1) NOT NULL, PRIMARY KEY (`id`), KEY `userID` (`userID`), KEY `completed` (`completed`), KEY `missionEnd` (`missionEnd`), KEY `hirer` (`hirer`) ) ENGINE=InnoDB AUTO_INCREMENT=13887173 DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `missions_history` -- LOCK TABLES `missions_history` WRITE; /*!40000 ALTER TABLE `missions_history` DISABLE KEYS */; /*!40000 ALTER TABLE `missions_history` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `missions_seed` -- DROP TABLE IF EXISTS `missions_seed`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `missions_seed` ( `missionID` int(5) unsigned NOT NULL, `greeting` tinyint(1) NOT NULL, `intro` tinyint(1) NOT NULL, `victim_call` tinyint(1) NOT NULL, `payment` tinyint(1) NOT NULL, `victim_location` tinyint(1) NOT NULL, `warning` tinyint(1) NOT NULL, `action` tinyint(1) NOT NULL DEFAULT '0', PRIMARY KEY (`missionID`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `missions_seed` -- LOCK TABLES `missions_seed` WRITE; /*!40000 ALTER TABLE `missions_seed` DISABLE KEYS */; /*!40000 ALTER TABLE `missions_seed` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `news` -- DROP TABLE IF EXISTS `news`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `news` ( `id` int(5) NOT NULL AUTO_INCREMENT, `author` varchar(30) NOT NULL, `title` varchar(100) NOT NULL, `content` text NOT NULL, `date` datetime NOT NULL, `type` tinyint(2) NOT NULL, `info1` varchar(15) NOT NULL, `info2` varchar(15) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM AUTO_INCREMENT=35359 DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `news` -- LOCK TABLES `news` WRITE; /*!40000 ALTER TABLE `news` DISABLE KEYS */; /*!40000 ALTER TABLE `news` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `news_history` -- DROP TABLE IF EXISTS `news_history`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `news_history` ( `newsID` int(5) unsigned NOT NULL AUTO_INCREMENT, `info1` varchar(15) NOT NULL, `info2` varchar(15) NOT NULL, `infoDate` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`newsID`) ) ENGINE=InnoDB AUTO_INCREMENT=35359 DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `news_history` -- LOCK TABLES `news_history` WRITE; /*!40000 ALTER TABLE `news_history` DISABLE KEYS */; /*!40000 ALTER TABLE `news_history` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `npc` -- DROP TABLE IF EXISTS `npc`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `npc` ( `id` int(5) NOT NULL AUTO_INCREMENT, `npcType` tinyint(2) NOT NULL, `npcIP` bigint(11) NOT NULL, `npcPass` varchar(8) NOT NULL, `downUntil` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`id`), KEY `npcIP` (`npcIP`) ) ENGINE=InnoDB AUTO_INCREMENT=897198 DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `npc` -- LOCK TABLES `npc` WRITE; /*!40000 ALTER TABLE `npc` DISABLE KEYS */; /*!40000 ALTER TABLE `npc` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `npc_down` -- DROP TABLE IF EXISTS `npc_down`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `npc_down` ( `npcID` int(5) unsigned NOT NULL, `downDate` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `downUntil` datetime NOT NULL, PRIMARY KEY (`npcID`), KEY `downUntil` (`downUntil`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `npc_down` -- LOCK TABLES `npc_down` WRITE; /*!40000 ALTER TABLE `npc_down` DISABLE KEYS */; /*!40000 ALTER TABLE `npc_down` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `npc_expire` -- DROP TABLE IF EXISTS `npc_expire`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `npc_expire` ( `npcID` int(5) unsigned NOT NULL, `expireDate` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`npcID`), KEY `expireDate` (`expireDate`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `npc_expire` -- LOCK TABLES `npc_expire` WRITE; /*!40000 ALTER TABLE `npc_expire` DISABLE KEYS */; /*!40000 ALTER TABLE `npc_expire` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `npc_info_en` -- DROP TABLE IF EXISTS `npc_info_en`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `npc_info_en` ( `npcID` int(5) unsigned NOT NULL, `name` varchar(50) NOT NULL, `web` text NOT NULL, PRIMARY KEY (`npcID`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `npc_info_en` -- LOCK TABLES `npc_info_en` WRITE; /*!40000 ALTER TABLE `npc_info_en` DISABLE KEYS */; /*!40000 ALTER TABLE `npc_info_en` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `npc_info_pt` -- DROP TABLE IF EXISTS `npc_info_pt`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `npc_info_pt` ( `npcID` int(5) unsigned NOT NULL, `name` varchar(50) NOT NULL, `web` text NOT NULL, PRIMARY KEY (`npcID`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `npc_info_pt` -- LOCK TABLES `npc_info_pt` WRITE; /*!40000 ALTER TABLE `npc_info_pt` DISABLE KEYS */; /*!40000 ALTER TABLE `npc_info_pt` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `npc_key` -- DROP TABLE IF EXISTS `npc_key`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `npc_key` ( `npcID` int(5) unsigned NOT NULL, `key` varchar(15) NOT NULL, PRIMARY KEY (`npcID`), KEY `key` (`key`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `npc_key` -- LOCK TABLES `npc_key` WRITE; /*!40000 ALTER TABLE `npc_key` DISABLE KEYS */; /*!40000 ALTER TABLE `npc_key` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `npc_reset` -- DROP TABLE IF EXISTS `npc_reset`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `npc_reset` ( `npcID` int(5) NOT NULL, `nextScan` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`npcID`), KEY `nextScan` (`nextScan`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `npc_reset` -- LOCK TABLES `npc_reset` WRITE; /*!40000 ALTER TABLE `npc_reset` DISABLE KEYS */; /*!40000 ALTER TABLE `npc_reset` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `payments` -- DROP TABLE IF EXISTS `payments`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `payments` ( `id` int(15) NOT NULL AUTO_INCREMENT, `userID` int(5) NOT NULL, `info` text NOT NULL, `paid` double NOT NULL, `original_amount` double NOT NULL, `plan` varchar(15) NOT NULL, PRIMARY KEY (`id`), KEY `userID` (`userID`) ) ENGINE=MyISAM AUTO_INCREMENT=137918 DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `payments` -- LOCK TABLES `payments` WRITE; /*!40000 ALTER TABLE `payments` DISABLE KEYS */; /*!40000 ALTER TABLE `payments` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `payments_history` -- DROP TABLE IF EXISTS `payments_history`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `payments_history` ( `id` int(5) NOT NULL AUTO_INCREMENT, `userID` int(5) NOT NULL, `valid` tinyint(1) NOT NULL DEFAULT '1', `info` text NOT NULL, `paid` double NOT NULL, `plan` varchar(15) NOT NULL, `confirmation` text NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM AUTO_INCREMENT=359 DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `payments_history` -- LOCK TABLES `payments_history` WRITE; /*!40000 ALTER TABLE `payments_history` DISABLE KEYS */; /*!40000 ALTER TABLE `payments_history` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `premium_history` -- DROP TABLE IF EXISTS `premium_history`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `premium_history` ( `id` int(5) unsigned NOT NULL AUTO_INCREMENT, `userID` int(5) NOT NULL, `boughtDate` datetime NOT NULL, `premiumUntil` datetime NOT NULL, `paid` double NOT NULL, PRIMARY KEY (`id`), KEY `userID` (`userID`) ) ENGINE=InnoDB AUTO_INCREMENT=891 DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `premium_history` -- LOCK TABLES `premium_history` WRITE; /*!40000 ALTER TABLE `premium_history` DISABLE KEYS */; /*!40000 ALTER TABLE `premium_history` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `processes` -- DROP TABLE IF EXISTS `processes`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `processes` ( `pid` int(32) NOT NULL AUTO_INCREMENT, `pCreatorID` int(5) NOT NULL, `pVictimID` int(5) NOT NULL, `pAction` smallint(3) NOT NULL, `pSoftID` int(32) NOT NULL, `pInfo` varchar(30) NOT NULL, `pInfoStr` text NOT NULL, `pTimeStart` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', `pTimePause` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', `pTimeEnd` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', `pTimeIdeal` int(5) NOT NULL, `pTimeWorked` int(11) NOT NULL, `cpuUsage` double NOT NULL, `netUsage` double NOT NULL, `pLocal` tinyint(1) NOT NULL, `pNPC` tinyint(1) NOT NULL, `isPaused` tinyint(1) NOT NULL, PRIMARY KEY (`pid`), KEY `pCreatorID` (`pCreatorID`), KEY `pNPC` (`pNPC`), KEY `pVictimID` (`pVictimID`), KEY `pTimeEnd` (`pTimeEnd`) ) ENGINE=InnoDB AUTO_INCREMENT=48831552 DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `processes` -- LOCK TABLES `processes` WRITE; /*!40000 ALTER TABLE `processes` DISABLE KEYS */; /*!40000 ALTER TABLE `processes` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `processes_paused` -- DROP TABLE IF EXISTS `processes_paused`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `processes_paused` ( `pid` int(30) NOT NULL, `timeLeft` int(6) NOT NULL, `timePaused` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `userID` int(5) NOT NULL, PRIMARY KEY (`pid`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `processes_paused` -- LOCK TABLES `processes_paused` WRITE; /*!40000 ALTER TABLE `processes_paused` DISABLE KEYS */; /*!40000 ALTER TABLE `processes_paused` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `profile` -- DROP TABLE IF EXISTS `profile`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `profile` ( `id` int(5) NOT NULL, `premium` tinyint(1) NOT NULL, `active` tinyint(1) NOT NULL DEFAULT '0', `reputation` bigint(15) NOT NULL, `rank` int(5) NOT NULL, `age` date NOT NULL, `timePlaying` float NOT NULL, `missionCount` int(5) NOT NULL, `hackCount` int(5) NOT NULL, `ipResets` smallint(4) NOT NULL, `ddosCount` smallint(5) NOT NULL, `warezSent` double NOT NULL, `spamSent` bigint(15) NOT NULL, `mailSent` int(5) NOT NULL, `moneyEarned` bigint(11) NOT NULL, `moneyTransfered` bigint(11) NOT NULL, `moneyHardware` bigint(11) NOT NULL, `moneyResearch` bigint(11) NOT NULL, `profileViews` int(5) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `profile` -- LOCK TABLES `profile` WRITE; /*!40000 ALTER TABLE `profile` DISABLE KEYS */; /*!40000 ALTER TABLE `profile` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `puzzle_solved` -- DROP TABLE IF EXISTS `puzzle_solved`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `puzzle_solved` ( `puzzleID` int(5) unsigned NOT NULL, `userID` int(5) unsigned NOT NULL, `solvedDate` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, KEY `userID` (`userID`), KEY `puzzleID` (`puzzleID`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `puzzle_solved` -- LOCK TABLES `puzzle_solved` WRITE; /*!40000 ALTER TABLE `puzzle_solved` DISABLE KEYS */; /*!40000 ALTER TABLE `puzzle_solved` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `ranking_clan` -- DROP TABLE IF EXISTS `ranking_clan`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `ranking_clan` ( `clanID` int(5) NOT NULL, `rank` int(5) NOT NULL, UNIQUE KEY `clanID` (`clanID`), KEY `rank` (`rank`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `ranking_clan` -- LOCK TABLES `ranking_clan` WRITE; /*!40000 ALTER TABLE `ranking_clan` DISABLE KEYS */; /*!40000 ALTER TABLE `ranking_clan` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `ranking_ddos` -- DROP TABLE IF EXISTS `ranking_ddos`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `ranking_ddos` ( `ddosID` int(5) NOT NULL, `rank` int(5) NOT NULL DEFAULT '-1', KEY `rank` (`rank`), KEY `ddosID` (`ddosID`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `ranking_ddos` -- LOCK TABLES `ranking_ddos` WRITE; /*!40000 ALTER TABLE `ranking_ddos` DISABLE KEYS */; /*!40000 ALTER TABLE `ranking_ddos` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `ranking_software` -- DROP TABLE IF EXISTS `ranking_software`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `ranking_software` ( `softID` int(5) NOT NULL, `rank` int(5) NOT NULL DEFAULT '-1', KEY `rank` (`rank`), KEY `softID` (`softID`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `ranking_software` -- LOCK TABLES `ranking_software` WRITE; /*!40000 ALTER TABLE `ranking_software` DISABLE KEYS */; /*!40000 ALTER TABLE `ranking_software` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `ranking_user` -- DROP TABLE IF EXISTS `ranking_user`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `ranking_user` ( `userID` int(5) NOT NULL, `rank` int(5) NOT NULL, KEY `rank` (`rank`), KEY `userID` (`userID`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `ranking_user` -- LOCK TABLES `ranking_user` WRITE; /*!40000 ALTER TABLE `ranking_user` DISABLE KEYS */; /*!40000 ALTER TABLE `ranking_user` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `round` -- DROP TABLE IF EXISTS `round`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `round` ( `id` smallint(3) NOT NULL AUTO_INCREMENT, `name` varchar(50) NOT NULL, `startDate` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `endDate` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', `status` tinyint(1) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=12 DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `round` -- LOCK TABLES `round` WRITE; /*!40000 ALTER TABLE `round` DISABLE KEYS */; /*!40000 ALTER TABLE `round` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `round_ddos` -- DROP TABLE IF EXISTS `round_ddos`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `round_ddos` ( `id` int(5) NOT NULL AUTO_INCREMENT, `attID` int(5) NOT NULL, `attUser` varchar(15) NOT NULL, `vicID` int(5) NOT NULL, `power` int(10) NOT NULL, `servers` int(3) NOT NULL, `date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `vicNPC` tinyint(1) NOT NULL, PRIMARY KEY (`id`), KEY `attID` (`attID`), KEY `attUser` (`attUser`), KEY `vicID` (`vicID`), KEY `power` (`power`) ) ENGINE=InnoDB AUTO_INCREMENT=290530 DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `round_ddos` -- LOCK TABLES `round_ddos` WRITE; /*!40000 ALTER TABLE `round_ddos` DISABLE KEYS */; /*!40000 ALTER TABLE `round_ddos` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `round_stats` -- DROP TABLE IF EXISTS `round_stats`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `round_stats` ( `id` tinyint(1) NOT NULL, `totalUsers` int(6) NOT NULL, `activeUsers` int(5) NOT NULL, `warezSent` double NOT NULL, `spamSent` bigint(15) NOT NULL, `bitcoinSent` double unsigned NOT NULL, `mailSent` int(6) NOT NULL, `ddosCount` int(6) NOT NULL, `hackCount` int(5) NOT NULL, `clans` int(4) NOT NULL, `timePlaying` bigint(15) NOT NULL, `totalListed` int(6) NOT NULL, `totalVirus` int(5) NOT NULL, `totalMoney` bigint(20) NOT NULL, `researchCount` int(5) NOT NULL, `moneyResearch` int(20) unsigned NOT NULL, `moneyHardware` int(20) unsigned NOT NULL, `moneyEarned` int(20) unsigned NOT NULL, `moneyTransfered` int(20) unsigned NOT NULL, `usersClicks` int(10) unsigned NOT NULL, `missionCount` int(10) unsigned NOT NULL, `totalConnections` int(10) unsigned NOT NULL, `totalTasks` int(10) unsigned NOT NULL, `totalSoftware` int(10) unsigned NOT NULL, `totalRunning` int(10) unsigned NOT NULL, `totalServers` int(10) unsigned NOT NULL, `clansWar` int(10) unsigned NOT NULL, `clansMembers` int(5) unsigned NOT NULL, `clansClicks` int(10) unsigned NOT NULL, `onlineUsers` int(5) unsigned NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `round_stats` -- LOCK TABLES `round_stats` WRITE; /*!40000 ALTER TABLE `round_stats` DISABLE KEYS */; /*!40000 ALTER TABLE `round_stats` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `safeNet` -- DROP TABLE IF EXISTS `safeNet`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `safeNet` ( `IP` bigint(11) NOT NULL, `reason` tinyint(1) NOT NULL, `startTime` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', `endTime` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', `count` tinyint(3) NOT NULL DEFAULT '1', `onFBI` tinyint(1) NOT NULL, KEY `IP` (`IP`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `safeNet` -- LOCK TABLES `safeNet` WRITE; /*!40000 ALTER TABLE `safeNet` DISABLE KEYS */; /*!40000 ALTER TABLE `safeNet` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `server_stats` -- DROP TABLE IF EXISTS `server_stats`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `server_stats` ( `id` tinyint(1) NOT NULL, `totalUsers` int(6) NOT NULL, `activeUsers` int(5) NOT NULL, `warezSent` double NOT NULL, `spamSent` bigint(15) NOT NULL, `mailSent` int(6) NOT NULL, `ddosCount` int(6) NOT NULL, `hackCount` int(5) NOT NULL, `clans` int(4) NOT NULL, `timePlaying` bigint(15) NOT NULL, `totalListed` int(5) NOT NULL, `totalVirus` int(6) NOT NULL, `totalMoney` bigint(20) NOT NULL, `researchCount` int(5) NOT NULL, `researchMoney` bigint(11) unsigned NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `server_stats` -- LOCK TABLES `server_stats` WRITE; /*!40000 ALTER TABLE `server_stats` DISABLE KEYS */; /*!40000 ALTER TABLE `server_stats` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `software` -- DROP TABLE IF EXISTS `software`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `software` ( `id` int(32) NOT NULL AUTO_INCREMENT, `userID` int(5) NOT NULL, `softName` varchar(25) NOT NULL, `softVersion` int(5) NOT NULL, `softSize` int(8) NOT NULL, `softRam` int(9) NOT NULL, `softType` smallint(2) NOT NULL, `softLastEdit` datetime NOT NULL, `softHidden` tinyint(1) NOT NULL, `softHiddenWith` bigint(20) NOT NULL, `isNPC` tinyint(1) NOT NULL, `originalFrom` bigint(20) NOT NULL, `licensedTo` int(5) NOT NULL, `isFolder` tinyint(1) NOT NULL DEFAULT '0', PRIMARY KEY (`id`), KEY `userID` (`userID`,`isNPC`) ) ENGINE=InnoDB AUTO_INCREMENT=13662031 DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `software` -- LOCK TABLES `software` WRITE; /*!40000 ALTER TABLE `software` DISABLE KEYS */; /*!40000 ALTER TABLE `software` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `software_external` -- DROP TABLE IF EXISTS `software_external`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `software_external` ( `id` bigint(20) NOT NULL, `userID` int(5) NOT NULL, `softName` varchar(50) NOT NULL, `softVersion` int(5) NOT NULL, `softSize` int(5) NOT NULL, `softRam` int(5) NOT NULL, `softType` tinyint(3) NOT NULL, `uploadDate` datetime NOT NULL, `licensedTo` int(5) NOT NULL, PRIMARY KEY (`id`), KEY `userID` (`userID`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `software_external` -- LOCK TABLES `software_external` WRITE; /*!40000 ALTER TABLE `software_external` DISABLE KEYS */; /*!40000 ALTER TABLE `software_external` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `software_folders` -- DROP TABLE IF EXISTS `software_folders`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `software_folders` ( `folderID` int(30) NOT NULL, `softID` bigint(20) NOT NULL, KEY `folderID` (`folderID`), KEY `softID` (`softID`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `software_folders` -- LOCK TABLES `software_folders` WRITE; /*!40000 ALTER TABLE `software_folders` DISABLE KEYS */; /*!40000 ALTER TABLE `software_folders` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `software_original` -- DROP TABLE IF EXISTS `software_original`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `software_original` ( `id` int(30) NOT NULL AUTO_INCREMENT, `npcID` int(5) NOT NULL, `softName` varchar(20) NOT NULL, `softVersion` int(5) NOT NULL, `softSize` int(6) NOT NULL, `softRam` int(9) NOT NULL, `softType` smallint(2) NOT NULL, `running` tinyint(1) NOT NULL, `licensedTo` tinyint(1) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=9886 DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `software_original` -- LOCK TABLES `software_original` WRITE; /*!40000 ALTER TABLE `software_original` DISABLE KEYS */; /*!40000 ALTER TABLE `software_original` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `software_research` -- DROP TABLE IF EXISTS `software_research`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `software_research` ( `researched_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `id` int(30) unsigned NOT NULL AUTO_INCREMENT, `userID` int(5) unsigned NOT NULL, `softID` int(10) unsigned NOT NULL, `softwareType` tinyint(2) unsigned NOT NULL, `newVersion` int(5) unsigned NOT NULL, `softwareName` varchar(30) NOT NULL, PRIMARY KEY (`id`), KEY `userID` (`userID`), KEY `softID` (`softID`) ) ENGINE=InnoDB AUTO_INCREMENT=767171 DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `software_research` -- LOCK TABLES `software_research` WRITE; /*!40000 ALTER TABLE `software_research` DISABLE KEYS */; /*!40000 ALTER TABLE `software_research` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `software_running` -- DROP TABLE IF EXISTS `software_running`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `software_running` ( `id` int(30) NOT NULL AUTO_INCREMENT, `softID` int(30) NOT NULL, `userID` int(5) NOT NULL, `ramUsage` int(5) NOT NULL, `isNPC` tinyint(1) NOT NULL, PRIMARY KEY (`id`), KEY `userID_isNPC` (`userID`,`isNPC`), KEY `softID` (`softID`) ) ENGINE=InnoDB AUTO_INCREMENT=4803691 DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `software_running` -- LOCK TABLES `software_running` WRITE; /*!40000 ALTER TABLE `software_running` DISABLE KEYS */; /*!40000 ALTER TABLE `software_running` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `software_texts` -- DROP TABLE IF EXISTS `software_texts`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `software_texts` ( `creator` bigint(20) DEFAULT NULL, `id` bigint(20) NOT NULL, `userID` int(5) NOT NULL, `isNPC` tinyint(1) NOT NULL, `text` text NOT NULL, `lastEdit` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `ddos` tinyint(1) NOT NULL DEFAULT '0', PRIMARY KEY (`id`), KEY `userID_isNPC` (`userID`,`isNPC`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `software_texts` -- LOCK TABLES `software_texts` WRITE; /*!40000 ALTER TABLE `software_texts` DISABLE KEYS */; /*!40000 ALTER TABLE `software_texts` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `stats_login` -- DROP TABLE IF EXISTS `stats_login`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `stats_login` ( `id` int(11) NOT NULL AUTO_INCREMENT, `userID` int(5) unsigned NOT NULL, `loginTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`id`), KEY `userID` (`userID`) ) ENGINE=InnoDB AUTO_INCREMENT=4585265 DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `stats_login` -- LOCK TABLES `stats_login` WRITE; /*!40000 ALTER TABLE `stats_login` DISABLE KEYS */; /*!40000 ALTER TABLE `stats_login` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `stats_register` -- DROP TABLE IF EXISTS `stats_register`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `stats_register` ( `userID` int(5) unsigned NOT NULL, `registrationDate` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `ip` varchar(15) NOT NULL, PRIMARY KEY (`userID`), KEY `ip` (`ip`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `stats_register` -- LOCK TABLES `stats_register` WRITE; /*!40000 ALTER TABLE `stats_register` DISABLE KEYS */; /*!40000 ALTER TABLE `stats_register` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `users` -- DROP TABLE IF EXISTS `users`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `users` ( `id` int(5) NOT NULL AUTO_INCREMENT, `login` varchar(15) NOT NULL, `password` varchar(60) NOT NULL, `email` varchar(50) NOT NULL, `gamePass` varchar(8) NOT NULL, `gameIP` bigint(11) NOT NULL, `realIP` bigint(11) NOT NULL, `homeIP` bigint(11) NOT NULL, `learning` tinyint(1) NOT NULL DEFAULT '0', `premium` tinyint(1) NOT NULL, `lastLogin` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`id`), KEY `gameIP` (`gameIP`), KEY `lastLogin` (`lastLogin`) ) ENGINE=InnoDB AUTO_INCREMENT=750703 DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `users` -- LOCK TABLES `users` WRITE; /*!40000 ALTER TABLE `users` DISABLE KEYS */; /*!40000 ALTER TABLE `users` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `users_admin` -- DROP TABLE IF EXISTS `users_admin`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `users_admin` ( `userID` int(5) unsigned NOT NULL, PRIMARY KEY (`userID`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `users_admin` -- LOCK TABLES `users_admin` WRITE; /*!40000 ALTER TABLE `users_admin` DISABLE KEYS */; /*!40000 ALTER TABLE `users_admin` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `users_badge` -- DROP TABLE IF EXISTS `users_badge`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `users_badge` ( `userID` int(5) NOT NULL, `badgeID` smallint(3) NOT NULL, `round` tinyint(3) NOT NULL DEFAULT '0', `dateAdd` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `priority` tinyint(5) NOT NULL, KEY `userID` (`userID`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `users_badge` -- LOCK TABLES `users_badge` WRITE; /*!40000 ALTER TABLE `users_badge` DISABLE KEYS */; /*!40000 ALTER TABLE `users_badge` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `users_banned` -- DROP TABLE IF EXISTS `users_banned`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `users_banned` ( `user_id` bigint(11) NOT NULL, PRIMARY KEY (`user_id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `users_banned` -- LOCK TABLES `users_banned` WRITE; /*!40000 ALTER TABLE `users_banned` DISABLE KEYS */; /*!40000 ALTER TABLE `users_banned` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `users_expire` -- DROP TABLE IF EXISTS `users_expire`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `users_expire` ( `userID` int(5) unsigned NOT NULL, `expireDate` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`userID`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `users_expire` -- LOCK TABLES `users_expire` WRITE; /*!40000 ALTER TABLE `users_expire` DISABLE KEYS */; /*!40000 ALTER TABLE `users_expire` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `users_facebook` -- DROP TABLE IF EXISTS `users_facebook`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `users_facebook` ( `gameID` int(5) NOT NULL, `userID` bigint(20) NOT NULL, PRIMARY KEY (`userID`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `users_facebook` -- LOCK TABLES `users_facebook` WRITE; /*!40000 ALTER TABLE `users_facebook` DISABLE KEYS */; /*!40000 ALTER TABLE `users_facebook` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `users_friends` -- DROP TABLE IF EXISTS `users_friends`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `users_friends` ( `userID` int(5) NOT NULL, `friendID` int(5) NOT NULL, `dateAdd` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`userID`,`friendID`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `users_friends` -- LOCK TABLES `users_friends` WRITE; /*!40000 ALTER TABLE `users_friends` DISABLE KEYS */; /*!40000 ALTER TABLE `users_friends` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `users_language` -- DROP TABLE IF EXISTS `users_language`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `users_language` ( `userID` int(5) unsigned NOT NULL, `lang` varchar(2) NOT NULL DEFAULT 'en', PRIMARY KEY (`userID`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `users_language` -- LOCK TABLES `users_language` WRITE; /*!40000 ALTER TABLE `users_language` DISABLE KEYS */; /*!40000 ALTER TABLE `users_language` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `users_learning` -- DROP TABLE IF EXISTS `users_learning`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `users_learning` ( `userID` int(5) unsigned NOT NULL, `learning` tinyint(1) NOT NULL DEFAULT '1', PRIMARY KEY (`userID`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `users_learning` -- LOCK TABLES `users_learning` WRITE; /*!40000 ALTER TABLE `users_learning` DISABLE KEYS */; /*!40000 ALTER TABLE `users_learning` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `users_online` -- DROP TABLE IF EXISTS `users_online`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `users_online` ( `id` int(5) NOT NULL, `loginTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `token` varchar(200) NOT NULL DEFAULT '0000-00-00 00:00:00', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `users_online` -- LOCK TABLES `users_online` WRITE; /*!40000 ALTER TABLE `users_online` DISABLE KEYS */; /*!40000 ALTER TABLE `users_online` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `users_premium` -- DROP TABLE IF EXISTS `users_premium`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `users_premium` ( `id` int(5) unsigned NOT NULL, `boughtDate` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `premiumUntil` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', `totalPaid` double NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `users_premium` -- LOCK TABLES `users_premium` WRITE; /*!40000 ALTER TABLE `users_premium` DISABLE KEYS */; /*!40000 ALTER TABLE `users_premium` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `users_puzzle` -- DROP TABLE IF EXISTS `users_puzzle`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `users_puzzle` ( `userID` int(5) unsigned NOT NULL, `puzzleID` int(5) unsigned NOT NULL DEFAULT '0', PRIMARY KEY (`userID`), KEY `puzzleID` (`puzzleID`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `users_puzzle` -- LOCK TABLES `users_puzzle` WRITE; /*!40000 ALTER TABLE `users_puzzle` DISABLE KEYS */; /*!40000 ALTER TABLE `users_puzzle` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `users_stats` -- DROP TABLE IF EXISTS `users_stats`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `users_stats` ( `uid` int(5) NOT NULL, `dateJoined` datetime NOT NULL, `exp` int(10) NOT NULL, `certifications` varchar(30) NOT NULL, `awards` varchar(50) NOT NULL, `timePlaying` float NOT NULL, `missionCount` int(5) NOT NULL, `hackCount` int(5) NOT NULL, `ddosCount` int(5) NOT NULL, `warezSent` double NOT NULL, `spamSent` bigint(15) NOT NULL, `bitcoinSent` double unsigned NOT NULL, `ipResets` int(5) NOT NULL, `lastIpReset` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `pwdResets` mediumint(4) NOT NULL, `lastPwdReset` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', `moneyEarned` bigint(15) NOT NULL, `moneyTransfered` bigint(15) NOT NULL, `moneyHardware` bigint(15) NOT NULL, `moneyResearch` bigint(15) NOT NULL, `profileViews` int(10) NOT NULL, PRIMARY KEY (`uid`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `users_stats` -- LOCK TABLES `users_stats` WRITE; /*!40000 ALTER TABLE `users_stats` DISABLE KEYS */; /*!40000 ALTER TABLE `users_stats` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `users_twitter` -- DROP TABLE IF EXISTS `users_twitter`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `users_twitter` ( `gameID` int(5) NOT NULL, `userID` int(20) unsigned NOT NULL, PRIMARY KEY (`userID`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `users_twitter` -- LOCK TABLES `users_twitter` WRITE; /*!40000 ALTER TABLE `users_twitter` DISABLE KEYS */; /*!40000 ALTER TABLE `users_twitter` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `virus` -- DROP TABLE IF EXISTS `virus`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `virus` ( `installedIp` bigint(11) NOT NULL, `installedBy` int(5) NOT NULL, `virusID` bigint(20) NOT NULL, `virusVersion` smallint(5) NOT NULL, `originalID` bigint(20) NOT NULL, `virusType` tinyint(2) NOT NULL, `lastCollect` varchar(19) NOT NULL, `active` tinyint(1) NOT NULL DEFAULT '1', PRIMARY KEY (`virusID`), KEY `por_instalacao` (`installedIp`,`installedBy`), KEY `installedIp` (`installedIp`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `virus` -- LOCK TABLES `virus` WRITE; /*!40000 ALTER TABLE `virus` DISABLE KEYS */; /*!40000 ALTER TABLE `virus` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `virus_ddos` -- DROP TABLE IF EXISTS `virus_ddos`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `virus_ddos` ( `userID` int(5) NOT NULL, `ip` bigint(11) NOT NULL, `ddosID` bigint(5) NOT NULL, `ddosName` varchar(30) NOT NULL, `ddosVersion` smallint(4) NOT NULL, `cpu` int(5) NOT NULL, `active` tinyint(1) NOT NULL DEFAULT '1', PRIMARY KEY (`userID`,`ip`), KEY `ip` (`ip`), KEY `ddosID` (`ddosID`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `virus_ddos` -- LOCK TABLES `virus_ddos` WRITE; /*!40000 ALTER TABLE `virus_ddos` DISABLE KEYS */; /*!40000 ALTER TABLE `virus_ddos` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `virus_doom` -- DROP TABLE IF EXISTS `virus_doom`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `virus_doom` ( `doomID` bigint(20) NOT NULL, `doomIP` bigint(12) NOT NULL, `creatorID` int(5) NOT NULL, `clanID` int(5) NOT NULL, `releaseDate` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `doomDate` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', `status` tinyint(1) NOT NULL, KEY `doomID` (`doomID`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `virus_doom` -- LOCK TABLES `virus_doom` WRITE; /*!40000 ALTER TABLE `virus_doom` DISABLE KEYS */; /*!40000 ALTER TABLE `virus_doom` ENABLE KEYS */; UNLOCK TABLES; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; -- Dump completed on 2019-05-15 8:30:50
true
f6fa59c107643b58d18d32972d91ba7c70299ed8
SQL
WillTorres10/BlogComQuestionarioEmLaravel
/banco.sql
UTF-8
6,736
2.921875
3
[ "MIT" ]
permissive
-- MySQL dump 10.13 Distrib 5.7.22, for Linux (x86_64) -- -- Host: localhost Database: avaliacao -- ------------------------------------------------------ -- Server version 5.7.22-0ubuntu0.16.04.1 /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8 */; /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; /*!40103 SET TIME_ZONE='+00:00' */; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; -- -- Table structure for table `migrations` -- DROP TABLE IF EXISTS `migrations`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `migrations` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `migration` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `batch` int(11) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Table structure for table `password_resets` -- DROP TABLE IF EXISTS `password_resets`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `password_resets` ( `email` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `token` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `created_at` timestamp NULL DEFAULT NULL, KEY `password_resets_email_index` (`email`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Table structure for table `perguntas` -- DROP TABLE IF EXISTS `perguntas`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `perguntas` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `tituloPergunta` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `id_quiz` int(10) unsigned NOT NULL, PRIMARY KEY (`id`), KEY `perguntas_id_quiz_foreign` (`id_quiz`), CONSTRAINT `perguntas_id_quiz_foreign` FOREIGN KEY (`id_quiz`) REFERENCES `quiz` (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=18 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Table structure for table `postagens` -- DROP TABLE IF EXISTS `postagens`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `postagens` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `titulo` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `conteudo` longtext COLLATE utf8mb4_unicode_ci NOT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Table structure for table `quiz` -- DROP TABLE IF EXISTS `quiz`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `quiz` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `titulo` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Table structure for table `respostas` -- DROP TABLE IF EXISTS `respostas`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `respostas` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `idPergunta` int(10) unsigned NOT NULL, `respostas` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `votos` int(11) NOT NULL DEFAULT '0', PRIMARY KEY (`id`), KEY `respostas_idpergunta_foreign` (`idPergunta`), CONSTRAINT `respostas_idpergunta_foreign` FOREIGN KEY (`idPergunta`) REFERENCES `perguntas` (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=165 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Table structure for table `users` -- DROP TABLE IF EXISTS `users`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `users` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `email` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `password` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `remember_token` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL, `Admin` tinyint(1) DEFAULT '0', PRIMARY KEY (`id`), UNIQUE KEY `users_email_unique` (`email`) ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Table structure for table `visualizou` -- DROP TABLE IF EXISTS `visualizou`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `visualizou` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `id_quiz` int(10) unsigned NOT NULL, `id_user` int(10) unsigned NOT NULL, `vezes` int(11) NOT NULL DEFAULT '0', `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL, PRIMARY KEY (`id`), KEY `visualizou_id_quiz_foreign` (`id_quiz`), KEY `visualizou_id_user_foreign` (`id_user`), CONSTRAINT `visualizou_id_quiz_foreign` FOREIGN KEY (`id_quiz`) REFERENCES `quiz` (`id`), CONSTRAINT `visualizou_id_user_foreign` FOREIGN KEY (`id_user`) REFERENCES `users` (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; -- Dump completed on 2018-07-25 17:06:47
true
903535faa0f4b9e595f0d3ab3fc86eefacbbc67c
SQL
andrewpugliese/Our-Framework
/SourceCode/Database/Db2/Tables/B1.AppConfigParameters.sql
UTF-8
740
3.484375
3
[]
no_license
--#SET TERMINATOR / -- -- This table is used for testing and demoing the functionality -- of the DataAccessMgr class and the UniqueIds table and stored procedure. -- CREATE TABLE B1.AppConfigParameters( ParameterName Varchar(48) not null, ParameterValue Varchar(256) not null, ParameterNameUPPER generated always as (Upper(ParameterName)), -- used for case insensitive uniqueness CONSTRAINT PK_AppConfigParameters PRIMARY KEY(ParameterName) ) in B1Core index in B1CoreIdx / -- sample case insensitve index on uniqueidkey create unique index B1.UX_AppConfigParameters_ParamName on B1.AppConfigParameters (ParameterNameUPPER) / GRANT REFERENCES ON B1.AppConfigParameters TO PUBLIC / GRANT ALL ON B1.AppConfigParameters TO PUBLIC /
true
a22784a2aad0b037966b9c899b1e4a56d3ac2421
SQL
Dadagum/cinema-booking
/src/main/resources/sql/creat_table.sql
UTF-8
746
3.578125
4
[]
no_license
# film table CREATE TABLE film ( fid INT AUTO_INCREMENT, name VARCHAR(30), director VARCHAR (30), actors VARCHAR (100), price DOUBLE , last_len DOUBLE , type VARCHAR(30), introduction VARCHAR(800), PRIMARY KEY (fid) )ENGINE=INNODB # film_period table CREATE TABLE film_period ( fid INT , pid INT AUTO_INCREMENT, start_time TIMESTAMP , video_hall INT , PRIMARY KEY (pid) , FOREIGN KEY (fid) REFERENCES film(fid) )ENGINE=INNODB # order_ table CREATE TABLE order_( oid INT AUTO_INCREMENT, pid INT , PRIMARY KEY (oid), FOREIGN KEY (pid) REFERENCES film_period(pid) )ENGINE=INNODB # order_seat table CREATE TABLE order_seat( oid INT , num INT , FOREIGN KEY (oid) REFERENCES order_(oid) )ENGINE=INNODB
true
d734f664e550ac7ffbf65b6b8fd13954be9335fd
SQL
DomWeldon/nyutalk
/cypher_queries/03_import_comments.cql
UTF-8
645
3.34375
3
[]
no_license
USING PERIODIC COMMIT LOAD CSV WITH HEADERS FROM 'file:///output-comments-0031.csv' AS line WITH line // find the pub it refers to MATCH (pl:PubListing) WHERE pl.source_pub_id = toInteger(line.source_pub_id) // ensure the comment node is created MERGE (bc:BiteComment { source_comment_id: toInteger(line.source_comment_id) }) SET bc += line, bc.source_pub_id = toInteger(line.source_pub_id), bc.source_comment_id = toInteger(line.source_comment_id), bc.created_timestamp = toInteger(line.created_timestamp) // link the comment to the user MERGE (u:BiteUser {username: bc.username }) MERGE (u)-[:USER_MADE_COMMENT]->(bc) WITH bc RETURN *
true
2cd954d6768a73ce7988bb9da33d3ef7c3df480f
SQL
zachariahyoung/virtualaltnet
/db/DbSchema.sql
UTF-8
4,306
3.125
3
[]
no_license
if exists (select 1 from sys.objects where object_id = OBJECT_ID(N'[FK1A2E670F582CE0D1]') AND parent_object_id = OBJECT_ID('Roles')) alter table Roles drop constraint FK1A2E670F582CE0D1 if exists (select 1 from sys.objects where object_id = OBJECT_ID(N'[FK73A69973186756F6]') AND parent_object_id = OBJECT_ID('Speakers')) alter table Speakers drop constraint FK73A69973186756F6 if exists (select 1 from sys.objects where object_id = OBJECT_ID(N'[FKF7153E89F3556EA9]') AND parent_object_id = OBJECT_ID('VirtualGroups')) alter table VirtualGroups drop constraint FKF7153E89F3556EA9 if exists (select 1 from sys.objects where object_id = OBJECT_ID(N'[FK757E8B2652015D4E]') AND parent_object_id = OBJECT_ID('UpcomingEvents')) alter table UpcomingEvents drop constraint FK757E8B2652015D4E if exists (select * from dbo.sysobjects where id = object_id(N'Recordings') and OBJECTPROPERTY(id, N'IsUserTable') = 1) drop table Recordings if exists (select * from dbo.sysobjects where id = object_id(N'Blogs') and OBJECTPROPERTY(id, N'IsUserTable') = 1) drop table Blogs if exists (select * from dbo.sysobjects where id = object_id(N'Users') and OBJECTPROPERTY(id, N'IsUserTable') = 1) drop table Users if exists (select * from dbo.sysobjects where id = object_id(N'Roles') and OBJECTPROPERTY(id, N'IsUserTable') = 1) drop table Roles if exists (select * from dbo.sysobjects where id = object_id(N'Speakers') and OBJECTPROPERTY(id, N'IsUserTable') = 1) drop table Speakers if exists (select * from dbo.sysobjects where id = object_id(N'VirtualGroups') and OBJECTPROPERTY(id, N'IsUserTable') = 1) drop table VirtualGroups if exists (select * from dbo.sysobjects where id = object_id(N'Categories') and OBJECTPROPERTY(id, N'IsUserTable') = 1) drop table Categories if exists (select * from dbo.sysobjects where id = object_id(N'UpcomingEvents') and OBJECTPROPERTY(id, N'IsUserTable') = 1) drop table UpcomingEvents create table Recordings ( Id INT IDENTITY NOT NULL, Title NVARCHAR(255) null, Url NVARCHAR(255) null, Date DATETIME null, Duration NVARCHAR(255) null, Speaker NVARCHAR(255) null, UserGroup NVARCHAR(255) null, LiveMeetingUrl NVARCHAR(255) null, Description NVARCHAR(255) null, primary key (Id) ) create table Blogs ( Id INT IDENTITY NOT NULL, Name NVARCHAR(255) null, Url NVARCHAR(255) null, Rss NVARCHAR(255) null, primary key (Id) ) create table Users ( Id INT IDENTITY NOT NULL, UserName NVARCHAR(255) null, Password NVARCHAR(255) null, primary key (Id) ) create table Roles ( Id INT IDENTITY NOT NULL, RoleName NVARCHAR(255) null, UserFk INT null, primary key (Id) ) create table Speakers ( Id INT IDENTITY NOT NULL, FirstName NVARCHAR(255) null, LastName NVARCHAR(255) null, Email NVARCHAR(255) null, Website NVARCHAR(255) null, PresentationFk INT null, primary key (Id) ) create table VirtualGroups ( Id INT IDENTITY NOT NULL, GroupName NVARCHAR(255) null, Website NVARCHAR(255) null, ManagerFk INT null, primary key (Id) ) create table Categories ( Id INT IDENTITY NOT NULL, Description NVARCHAR(255) null, primary key (Id) ) create table UpcomingEvents ( Id INT IDENTITY NOT NULL, Title NVARCHAR(255) null, EventDate DATETIME null, FullDescription NVARCHAR(255) null, ShortDescription NVARCHAR(255) null, Approved BIT null, PresenterFk INT null, primary key (Id) ) alter table Roles add constraint FK1A2E670F582CE0D1 foreign key (UserFk) references Users alter table Speakers add constraint FK73A69973186756F6 foreign key (PresentationFk) references Recordings alter table VirtualGroups add constraint FKF7153E89F3556EA9 foreign key (ManagerFk) references Users alter table UpcomingEvents add constraint FK757E8B2652015D4E foreign key (PresenterFk) references Speakers
true
5e2a370d34a7001dd8060826744cd2b0ad471b87
SQL
rbryant/BetterOfficeOld
/demodb.sql
UTF-8
53,252
3.640625
4
[]
no_license
SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0; SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0; SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL,ALLOW_INVALID_DATES'; CREATE SCHEMA IF NOT EXISTS `better-office` DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ; USE `better-office` ; -- ----------------------------------------------------- -- Table `better-office`.`address` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `better-office`.`address` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `address1` VARCHAR(128) CHARACTER SET 'utf8' COLLATE 'utf8_unicode_ci' NOT NULL, `address2` VARCHAR(128) CHARACTER SET 'utf8' COLLATE 'utf8_unicode_ci' NULL DEFAULT NULL, `city` VARCHAR(50) CHARACTER SET 'utf8' COLLATE 'utf8_unicode_ci' NULL DEFAULT NULL, `state` VARCHAR(2) CHARACTER SET 'utf8' COLLATE 'utf8_unicode_ci' NULL DEFAULT NULL, `zip` VARCHAR(10) CHARACTER SET 'utf8' COLLATE 'utf8_unicode_ci' NULL DEFAULT NULL, `module` VARCHAR(20) CHARACTER SET 'utf8' COLLATE 'utf8_unicode_ci' NOT NULL, `ref_id` INT(11) NOT NULL, `primary_address` CHAR(1) CHARACTER SET 'utf8' COLLATE 'utf8_unicode_ci' NULL DEFAULT NULL, PRIMARY KEY (`id`)) ENGINE = InnoDB AUTO_INCREMENT = 2 DEFAULT CHARACTER SET = utf8 COLLATE = utf8_unicode_ci; -- ----------------------------------------------------- -- Table `better-office`.`authitem` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `better-office`.`authitem` ( `name` VARCHAR(64) NOT NULL, `type` INT(11) NOT NULL, `description` TEXT NULL DEFAULT NULL, `bizrule` TEXT NULL DEFAULT NULL, `data` TEXT NULL DEFAULT NULL, PRIMARY KEY (`name`)) ENGINE = InnoDB DEFAULT CHARACTER SET = latin1; -- ----------------------------------------------------- -- Table `better-office`.`authassignment` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `better-office`.`authassignment` ( `itemname` VARCHAR(64) NOT NULL, `userid` VARCHAR(64) NOT NULL, `bizrule` TEXT NULL DEFAULT NULL, `data` TEXT NULL DEFAULT NULL, PRIMARY KEY (`itemname`, `userid`), CONSTRAINT `authassignment_ibfk_1` FOREIGN KEY (`itemname`) REFERENCES `better-office`.`authitem` (`name`) ON DELETE CASCADE ON UPDATE CASCADE) ENGINE = InnoDB DEFAULT CHARACTER SET = latin1; -- ----------------------------------------------------- -- Table `better-office`.`authitemchild` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `better-office`.`authitemchild` ( `parent` VARCHAR(64) NOT NULL, `child` VARCHAR(64) NOT NULL, PRIMARY KEY (`parent`, `child`), INDEX `child` (`child` ASC), CONSTRAINT `authitemchild_ibfk_1` FOREIGN KEY (`parent`) REFERENCES `better-office`.`authitem` (`name`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `authitemchild_ibfk_2` FOREIGN KEY (`child`) REFERENCES `better-office`.`authitem` (`name`) ON DELETE CASCADE ON UPDATE CASCADE) ENGINE = InnoDB DEFAULT CHARACTER SET = latin1; -- ----------------------------------------------------- -- Table `better-office`.`catalog` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `better-office`.`catalog` ( `id` INT(11) NOT NULL, `name` VARCHAR(20) NULL DEFAULT NULL, `description` VARCHAR(128) NULL DEFAULT NULL, `price` DOUBLE NULL DEFAULT NULL, `cost` DOUBLE NULL DEFAULT NULL, `category` INT(11) NULL DEFAULT NULL, `catalog` INT(11) NULL DEFAULT NULL, PRIMARY KEY (`id`)) ENGINE = InnoDB DEFAULT CHARACTER SET = latin1; -- ----------------------------------------------------- -- Table `better-office`.`comment` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `better-office`.`comment` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `content` TEXT NOT NULL, `status` INT(11) NOT NULL, `create_time` DATETIME NOT NULL, `userId` INT(11) NOT NULL, `ref_id` INT(11) NOT NULL, `module` VARCHAR(20) NULL DEFAULT NULL, PRIMARY KEY (`id`), INDEX `fk_comment_post` (`ref_id` ASC)) ENGINE = InnoDB DEFAULT CHARACTER SET = latin1 AUTO_INCREMENT = 35; -- ----------------------------------------------------- -- Table `better-office`.`social` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `better-office`.`social` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `account` VARCHAR(20) NOT NULL, `type` INT(11) NOT NULL, `module` VARCHAR(20) NOT NULL, `ref_id` INT(11) NOT NULL, PRIMARY KEY (`id`)) ENGINE = InnoDB DEFAULT CHARACTER SET = latin1; -- ----------------------------------------------------- -- Table `better-office`.`websites` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `better-office`.`websites` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `url` VARCHAR(128) NOT NULL, `module` VARCHAR(20) NOT NULL, `ref_id` INT(11) NOT NULL, PRIMARY KEY (`id`)) ENGINE = InnoDB DEFAULT CHARACTER SET = latin1; -- ----------------------------------------------------- -- Table `better-office`.`users` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `better-office`.`users` ( `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT, `user_name` VARCHAR(45) NOT NULL, `email` VARCHAR(60) NOT NULL DEFAULT 'noEmail@noEmail.com', `pass` VARCHAR(150) NOT NULL, `salt` VARCHAR(45) NOT NULL, `name` VARCHAR(45) NULL DEFAULT NULL, `surname` VARCHAR(45) NULL DEFAULT NULL, `active` TINYINT(1) NOT NULL DEFAULT '0', `status` TINYINT(4) NOT NULL DEFAULT '0', `date_of_creation` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `date_of_update` TIMESTAMP NULL DEFAULT NULL, `date_of_last_access` TIMESTAMP NULL DEFAULT NULL, `date_of_password_last_change` TIMESTAMP NULL DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE INDEX `users_user_name_UNIQUE` (`user_name` ASC), UNIQUE INDEX `users_email_UNIQUE` (`email` ASC)) ENGINE = InnoDB AUTO_INCREMENT = 3 DEFAULT CHARACTER SET = latin1; -- ----------------------------------------------------- -- Table `better-office`.`company` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `better-office`.`company` ( `id` INT(11) NOT NULL, `name` VARCHAR(128) NOT NULL, `description` TEXT NULL DEFAULT NULL, `address` INT(11) NULL DEFAULT NULL, `social` INT(11) NULL DEFAULT NULL, `website` INT(11) NULL DEFAULT NULL, `manager` BIGINT(20) UNSIGNED NULL, `create_date` DATE NULL DEFAULT NULL, PRIMARY KEY (`id`), INDEX `company_address_idx` (`address` ASC), INDEX `company_social_idx` (`social` ASC), INDEX `company_websites_idx` (`website` ASC), INDEX `company_users_idx` (`manager` ASC), CONSTRAINT `fk_company_address` FOREIGN KEY (`address`) REFERENCES `better-office`.`address` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_company_social` FOREIGN KEY (`social`) REFERENCES `better-office`.`social` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_company_websites` FOREIGN KEY (`website`) REFERENCES `better-office`.`websites` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_company_users` FOREIGN KEY (`manager`) REFERENCES `better-office`.`users` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB AUTO_INCREMENT = 3; -- ----------------------------------------------------- -- Table `better-office`.`im` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `better-office`.`im` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `account` VARCHAR(20) NOT NULL, `type` INT(11) NOT NULL, `location` INT(11) NOT NULL, `module` VARCHAR(20) NOT NULL, `ref_id` INT(11) NOT NULL, PRIMARY KEY (`id`)) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `better-office`.`email` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `better-office`.`email` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `email` VARCHAR(128) NOT NULL, `type` INT(11) NOT NULL, `module` VARCHAR(20) NOT NULL, `ref_id` INT(11) NOT NULL, PRIMARY KEY (`id`)) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `better-office`.`contact` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `better-office`.`contact` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `firstname` VARCHAR(128) NOT NULL, `lastname` VARCHAR(128) NOT NULL, `title` VARCHAR(128) NULL DEFAULT NULL, `company` INT(11) NOT NULL, `description` TEXT NULL DEFAULT NULL, `im` INT NULL, `email` INT NULL, PRIMARY KEY (`id`), INDEX `contact_company` (`company` ASC), INDEX `contact__im_idx` (`im` ASC), INDEX `contact__email_idx` (`email` ASC), CONSTRAINT `fk_contact_company` FOREIGN KEY (`company`) REFERENCES `better-office`.`company` (`id`) ON DELETE CASCADE ON UPDATE RESTRICT, CONSTRAINT `fk_contact_im` FOREIGN KEY (`im`) REFERENCES `better-office`.`im` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_contact_email` FOREIGN KEY (`email`) REFERENCES `better-office`.`email` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB AUTO_INCREMENT = 3; -- ----------------------------------------------------- -- Table `better-office`.`dashboard_page` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `better-office`.`dashboard_page` ( `id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, `user_id` INT(10) UNSIGNED NOT NULL, `title` VARCHAR(1000) NULL DEFAULT NULL, `path` VARCHAR(1000) NULL DEFAULT NULL, `weight` INT(10) UNSIGNED NULL DEFAULT NULL, PRIMARY KEY (`id`)) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `better-office`.`dashboard_portlet` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `better-office`.`dashboard_portlet` ( `id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, `dashboard` INT(10) UNSIGNED NOT NULL DEFAULT '0', `uid` INT(10) UNSIGNED NULL DEFAULT NULL, `settings` TEXT NULL DEFAULT NULL, PRIMARY KEY (`id`)) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `better-office`.`emails` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `better-office`.`emails` ( `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT, `id_user` BIGINT(20) UNSIGNED NOT NULL, `name` VARCHAR(60) NULL DEFAULT NULL, `verified` TINYINT(1) NOT NULL DEFAULT '0', `verification_code` VARCHAR(40) NULL DEFAULT NULL, `date_of_creation` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `visible` TINYINT(1) NULL DEFAULT '0', PRIMARY KEY (`id`), UNIQUE INDEX `emails_user_emails_UNIQUE` (`id_user` ASC, `name` ASC), CONSTRAINT `emails_ibfk_1` FOREIGN KEY (`id_user`) REFERENCES `better-office`.`users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE) ENGINE = InnoDB AUTO_INCREMENT = 4 DEFAULT CHARACTER SET = latin1; -- ----------------------------------------------------- -- Table `better-office`.`invitations` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `better-office`.`invitations` ( `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT, `id_user` BIGINT(20) UNSIGNED NOT NULL, `id_user_invited` BIGINT(20) UNSIGNED NULL DEFAULT NULL, `email` VARCHAR(60) NOT NULL, `note` TEXT NULL DEFAULT NULL, `invitation_code` VARCHAR(10) NOT NULL, `date_of_invitation_send` TIMESTAMP NULL DEFAULT NULL, `date_of_invitation_accepted` TIMESTAMP NULL DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE INDEX `invitations_email_code_UNIQUE` (`email` ASC, `invitation_code` ASC), INDEX `id_user` (`id_user` ASC), INDEX `id_user_invited` (`id_user_invited` ASC), CONSTRAINT `invitations_ibfk_1` FOREIGN KEY (`id_user`) REFERENCES `better-office`.`users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `invitations_ibfk_2` FOREIGN KEY (`id_user_invited`) REFERENCES `better-office`.`users` (`id`) ON DELETE SET NULL ON UPDATE CASCADE) ENGINE = InnoDB DEFAULT CHARACTER SET = latin1; -- ----------------------------------------------------- -- Table `better-office`.`invoice` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `better-office`.`invoice` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `name` VARCHAR(50) DEFAULT NULL, `description` VARCHAR(100) DEFAULT NULL, `customer` INT(11) DEFAULT NULL, `invoicedate` DATE DEFAULT NULL, PRIMARY KEY (`id`), INDEX `invoice_company_idx` (`customer` ASC), CONSTRAINT `fk_invoice_company` FOREIGN KEY (`customer`) REFERENCES `better-office`.`company` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE = InnoDB DEFAULT CHARACTER SET = latin1; -- ----------------------------------------------------- -- Table `better-office`.`text` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `better-office`.`text` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `text` TEXT NULL DEFAULT NULL, `ref` INT(11) NULL DEFAULT NULL, `module` INT(11) NULL DEFAULT NULL, `name` VARCHAR(45) NULL DEFAULT NULL, PRIMARY KEY (`id`)) ENGINE = InnoDB DEFAULT CHARACTER SET = latin1; -- ----------------------------------------------------- -- Table `better-office`.`valuelist` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `better-office`.`valuelist` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `value` INT(11) NULL DEFAULT NULL, `name` VARCHAR(20) NULL DEFAULT NULL, `module` VARCHAR(20) NULL DEFAULT NULL, `field` VARCHAR(20) NULL DEFAULT NULL, PRIMARY KEY (`id`)) ENGINE = InnoDB AUTO_INCREMENT = 10 DEFAULT CHARACTER SET = latin1; -- ----------------------------------------------------- -- Table `better-office`.`proposal` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `better-office`.`proposal` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `name` VARCHAR(128) NULL DEFAULT NULL, `description` VARCHAR(128) NULL DEFAULT NULL, `company` INT(11) NULL DEFAULT NULL, `total` DOUBLE NULL DEFAULT NULL, `cover` INT(11) NULL DEFAULT NULL, `pdf` CHAR(1) NULL DEFAULT NULL, `sendto` INT(11) NULL DEFAULT NULL, `message` VARCHAR(256) NULL DEFAULT NULL, `status` INT(11) NULL DEFAULT NULL, `project` INT(11) NULL DEFAULT NULL, `opportunity` INT(11) NULL DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE INDEX `id_UNIQUE` (`id` ASC), INDEX `proposal_company_idx` (`company` ASC), INDEX `proposal_cover_idx` (`cover` ASC), INDEX `proposal_sendto_idx` (`sendto` ASC), INDEX `proposal_status_idx` (`status` ASC), INDEX `proposal_project_idx` (`project` ASC), CONSTRAINT `fk_proposal_company` FOREIGN KEY (`company`) REFERENCES `better-office`.`company` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_proposal_cover` FOREIGN KEY (`cover`) REFERENCES `better-office`.`text` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_proposal_sendto` FOREIGN KEY (`sendto`) REFERENCES `better-office`.`contact` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_proposal_status` FOREIGN KEY (`status`) REFERENCES `better-office`.`valuelist` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_proposal_project` FOREIGN KEY (`project`) REFERENCES `better-office`.`project` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE = InnoDB AUTO_INCREMENT = 2; -- ----------------------------------------------------- -- Table `better-office`.`project` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `better-office`.`project` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `name` VARCHAR(128) NULL DEFAULT NULL, `description` VARCHAR(256) NULL DEFAULT NULL, `user` INT(11) NULL DEFAULT NULL, `total` DOUBLE NOT NULL DEFAULT '0', `startdate` DATETIME NULL DEFAULT NULL, `enddate` DATETIME NULL DEFAULT NULL, `company` INT(11) NULL DEFAULT NULL, `budget` DOUBLE NOT NULL DEFAULT '0', `percent_complete` DOUBLE NOT NULL DEFAULT '0', `status` INT(11) NULL DEFAULT NULL, `proposal` INT NULL, PRIMARY KEY (`id`), INDEX `project_company_idx` (`company` ASC), INDEX `project_proposal_idx` (`proposal` ASC), CONSTRAINT `fk_project_company` FOREIGN KEY (`company`) REFERENCES `better-office`.`company` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_project_proposal` FOREIGN KEY (`proposal`) REFERENCES `better-office`.`proposal` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB AUTO_INCREMENT = 2; -- ----------------------------------------------------- -- Table `better-office`.`task` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `better-office`.`task` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `name` VARCHAR(128) NULL DEFAULT NULL, `project` INT(11) NULL DEFAULT NULL, `startdate` DATETIME NULL DEFAULT NULL, `enddate` DATETIME NULL DEFAULT NULL, `assignedto` INT(11) NULL DEFAULT NULL, `quantity` DOUBLE NULL DEFAULT '0', `time` INT(11) NULL DEFAULT NULL, `module` VARCHAR(20) NULL DEFAULT NULL, `ref_id` INT(11) NULL DEFAULT NULL, `status` INT(11) NULL DEFAULT NULL, `percent_complete` DOUBLE NULL DEFAULT NULL, PRIMARY KEY (`id`), INDEX `task_project_idx` (`project` ASC), INDEX `task_time_idx` (`time` ASC), CONSTRAINT `fk_task_project` FOREIGN KEY (`project`) REFERENCES `better-office`.`project` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_task_time` FOREIGN KEY (`time`) REFERENCES `better-office`.`valuelist` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB AUTO_INCREMENT = 7 DEFAULT CHARACTER SET = latin1; -- ----------------------------------------------------- -- Table `better-office`.`invoice_line` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `better-office`.`invoice_line` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `name` VARCHAR(45) CHARACTER SET 'utf8' COLLATE 'utf8_unicode_ci' NULL DEFAULT NULL, `description` VARCHAR(100) CHARACTER SET 'utf8' COLLATE 'utf8_unicode_ci' NULL DEFAULT NULL, `product` INT(11) NULL DEFAULT NULL, `project` INT(11) NULL DEFAULT NULL, `quantity` DOUBLE NULL DEFAULT NULL, `unit` INT(11) NULL DEFAULT NULL, `price` DOUBLE NULL DEFAULT NULL, `linecost` DOUBLE NULL DEFAULT NULL, `task` INT(11) NULL DEFAULT NULL, `invoice` INT NULL, PRIMARY KEY (`id`), INDEX `fk_invoice_line_invoice_idx` (`invoice` ASC), INDEX `fk_invoice_line_project_idx` (`project` ASC), INDEX `fk_invoice_line_task_idx` (`task` ASC), INDEX `fk_invoice_line_catalog_idx` (`product` ASC), CONSTRAINT `fk_invoice_line_invoice` FOREIGN KEY (`invoice`) REFERENCES `better-office`.`invoice` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_invoice_line_project` FOREIGN KEY (`project`) REFERENCES `better-office`.`project` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_invoice_line_task` FOREIGN KEY (`task`) REFERENCES `better-office`.`task` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_invoice_line_catalog` FOREIGN KEY (`product`) REFERENCES `better-office`.`catalog` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `better-office`.`issue` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `better-office`.`issue` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `title` VARCHAR(128) CHARACTER SET 'utf8' COLLATE 'utf8_unicode_ci' NOT NULL, `description` TEXT CHARACTER SET 'utf8' COLLATE 'utf8_unicode_ci' NULL DEFAULT NULL, `company_id` INT(11) NOT NULL, `assignedto` BIGINT(20) UNSIGNED NULL DEFAULT NULL, `owner` BIGINT(20) UNSIGNED NULL DEFAULT NULL, `status` INT(11) NULL DEFAULT NULL, `create_date` DATE NULL DEFAULT NULL, `due_date` DATE NULL DEFAULT NULL, PRIMARY KEY (`id`), INDEX `fk_issue_company` (`company_id` ASC), INDEX `fk_issue_assignedto_idx` (`assignedto` ASC), INDEX `fk_issue_owner_idx` (`owner` ASC), CONSTRAINT `fk_issue_company` FOREIGN KEY (`company_id`) REFERENCES `better-office`.`company` (`id`) ON DELETE CASCADE ON UPDATE RESTRICT, CONSTRAINT `fk_issue_assignedto` FOREIGN KEY (`assignedto`) REFERENCES `better-office`.`users` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_issue_owner` FOREIGN KEY (`owner`) REFERENCES `better-office`.`users` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB AUTO_INCREMENT = 6; -- ----------------------------------------------------- -- Table `better-office`.`meeting` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `better-office`.`meeting` ( `id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT, `name` VARCHAR(64) CHARACTER SET 'utf8' COLLATE 'utf8_unicode_ci' NULL DEFAULT NULL, `location` VARCHAR(64) CHARACTER SET 'utf8' COLLATE 'utf8_unicode_ci' NULL DEFAULT NULL, `activity_id` INT(11) UNSIGNED NULL DEFAULT NULL, `category_id` INT(11) UNSIGNED NULL DEFAULT NULL, `description` TEXT CHARACTER SET 'utf8' COLLATE 'utf8_unicode_ci' NULL DEFAULT NULL, `startdatetime` DATETIME NULL DEFAULT NULL, `enddatetime` DATETIME NULL DEFAULT NULL, `url` VARCHAR(100) CHARACTER SET 'utf8' COLLATE 'utf8_unicode_ci' NULL DEFAULT NULL, `attendee` BIGINT(20) UNSIGNED NULL DEFAULT NULL, `company` INT(11) NULL DEFAULT NULL, `project` INT(11) NULL DEFAULT NULL, PRIMARY KEY (`id`), INDEX `fk_meeting_company_idx` (`company` ASC), INDEX `fk_meeting_project_idx` (`project` ASC), INDEX `fk_meeting_users_idx` (`attendee` ASC), CONSTRAINT `fk_meeting_company` FOREIGN KEY (`company`) REFERENCES `better-office`.`company` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_meeting_project` FOREIGN KEY (`project`) REFERENCES `better-office`.`project` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_meeting_users` FOREIGN KEY (`attendee`) REFERENCES `better-office`.`users` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `better-office`.`opportunity` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `better-office`.`opportunity` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `name` VARCHAR(128) NULL DEFAULT NULL, `description` TEXT NULL DEFAULT NULL, `amount` DOUBLE NULL DEFAULT '0', `type` INT(11) NULL DEFAULT NULL, `category` INT(11) NULL DEFAULT NULL, `owner` BIGINT(20) UNSIGNED NULL DEFAULT NULL, `status` INT(11) NULL DEFAULT NULL, `change_date` DATETIME NULL DEFAULT NULL, `change_by` INT(11) NULL DEFAULT NULL, `company` INT(11) NULL DEFAULT NULL, `probability` INT(11) NULL DEFAULT NULL, PRIMARY KEY (`id`), INDEX `opportunity_type_idx` (`type` ASC), INDEX `opportunity_category_idx` (`category` ASC), INDEX `opportunity_owner_idx` (`owner` ASC), INDEX `opportunity_status_idx` (`status` ASC), INDEX `opportunity_change_by_idx` (`change_by` ASC), INDEX `opportunity_company_idx` (`company` ASC), CONSTRAINT `fk_opportunity_company` FOREIGN KEY (`company`) REFERENCES `better-office`.`company` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_opportunity_owner` FOREIGN KEY (`owner`) REFERENCES `better-office`.`users` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB AUTO_INCREMENT = 3; -- ----------------------------------------------------- -- Table `better-office`.`phone` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `better-office`.`phone` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `number` VARCHAR(128) CHARACTER SET 'utf8' COLLATE 'utf8_unicode_ci' NOT NULL, `type` INT(11) NOT NULL, `module` VARCHAR(20) CHARACTER SET 'utf8' COLLATE 'utf8_unicode_ci' NOT NULL, `ref_id` INT(11) NOT NULL, `contact` INT(11) NULL DEFAULT NULL, PRIMARY KEY (`id`), INDEX `phone_contact_idx` (`contact` ASC), INDEX `phone_type_idx` (`type` ASC), CONSTRAINT `fk_phone_contact` FOREIGN KEY (`contact`) REFERENCES `better-office`.`contact` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_phone_type` FOREIGN KEY (`type`) REFERENCES `better-office`.`valuelist` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB AUTO_INCREMENT = 4; -- ----------------------------------------------------- -- Table `better-office`.`proposal_line` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `better-office`.`proposal_line` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `catnum` INT(11) NULL DEFAULT NULL, `description` VARCHAR(128) NULL DEFAULT NULL, `quantity` DOUBLE NULL DEFAULT NULL, `price` DOUBLE NULL DEFAULT NULL, `time` INT(11) NULL DEFAULT NULL, `linecost` DOUBLE NULL DEFAULT NULL, `taxable` CHAR(1) NULL DEFAULT NULL, `proposal` INT(11) NOT NULL, PRIMARY KEY (`id`, `proposal`), INDEX `proposal_line_catnum_idx` (`catnum` ASC), INDEX `proposal_line_proposal_idx` (`proposal` ASC), UNIQUE INDEX `id_UNIQUE` (`id` ASC), CONSTRAINT `fk_proposal_line_catnum` FOREIGN KEY (`catnum`) REFERENCES `better-office`.`catalog` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_proposal_line_proposal` FOREIGN KEY (`proposal`) REFERENCES `better-office`.`proposal` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `better-office`.`resource` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `better-office`.`resource` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `name` VARCHAR(45) NULL DEFAULT NULL, `company` INT(11) NULL DEFAULT NULL, `email` INT(11) NULL DEFAULT NULL, `payrate` DOUBLE NULL DEFAULT NULL, `userid` BIGINT(20) UNSIGNED NULL DEFAULT NULL, `billrate` DOUBLE NULL DEFAULT NULL, PRIMARY KEY (`id`), INDEX `resource_users_idx` (`userid` ASC), INDEX `resource_company_idx` (`company` ASC), CONSTRAINT `fk_resource_users` FOREIGN KEY (`userid`) REFERENCES `better-office`.`users` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_resource_company` FOREIGN KEY (`company`) REFERENCES `better-office`.`company` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB AUTO_INCREMENT = 5; -- ----------------------------------------------------- -- Table `better-office`.`settings` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `better-office`.`settings` ( `id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, `name` VARCHAR(45) NOT NULL, `value` VARCHAR(45) NOT NULL, `label` VARCHAR(80) NOT NULL, `description` TEXT NULL DEFAULT NULL, `date_of_update` TIMESTAMP NULL DEFAULT NULL, `setting_order` INT(11) NULL DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE INDEX `settings_name_UNIQUE` (`name` ASC)) ENGINE = InnoDB AUTO_INCREMENT = 12 DEFAULT CHARACTER SET = latin1; -- ----------------------------------------------------- -- Table `better-office`.`users_data` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `better-office`.`users_data` ( `id` BIGINT(20) UNSIGNED NOT NULL, `description` TEXT NULL DEFAULT NULL, `obs` TEXT NULL DEFAULT NULL, `site` VARCHAR(1500) NULL DEFAULT NULL, `facebook_address` VARCHAR(60) NULL DEFAULT NULL, `twitter_address` VARCHAR(60) NULL DEFAULT NULL, `activation_code` VARCHAR(45) NULL DEFAULT NULL, `date_of_update` TIMESTAMP NULL DEFAULT NULL, `invitations_left` SMALLINT(6) NOT NULL DEFAULT '-1', PRIMARY KEY (`id`), CONSTRAINT `users_data_ibfk_1` FOREIGN KEY (`id`) REFERENCES `better-office`.`users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE) ENGINE = InnoDB DEFAULT CHARACTER SET = latin1; -- ----------------------------------------------------- -- Table `better-office`.`worklog` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `better-office`.`worklog` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `task` INT(11) NULL DEFAULT NULL, `resource` INT(11) NULL DEFAULT NULL, `hours` DOUBLE NULL DEFAULT NULL, `workdate` DATETIME NULL DEFAULT NULL, `log` TEXT CHARACTER SET 'utf8' COLLATE 'utf8_unicode_ci' NULL DEFAULT NULL, PRIMARY KEY (`id`), INDEX `worklog_task_idx` (`task` ASC), INDEX `worklog_resource_idx` (`resource` ASC), CONSTRAINT `fk_worklog_task` FOREIGN KEY (`task`) REFERENCES `better-office`.`task` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_worklog_resource` FOREIGN KEY (`resource`) REFERENCES `better-office`.`resource` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB AUTO_INCREMENT = 6; USE `better-office` ; -- ----------------------------------------------------- -- procedure test_multi_sets -- ----------------------------------------------------- DELIMITER $$ USE `better-office`$$ CREATE DEFINER=`root`@`localhost` PROCEDURE `test_multi_sets`() DETERMINISTIC begin select user() as first_col; select user() as first_col, now() as second_col; select user() as first_col, now() as second_col, now() as third_col; end$$ DELIMITER ; SET SQL_MODE=@OLD_SQL_MODE; SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS; SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS; -- ----------------------------------------------------- -- Data for table `better-office`.`authitem` -- ----------------------------------------------------- START TRANSACTION; USE `better-office`; INSERT INTO `better-office`.`authitem` (`name`, `type`, `description`, `bizrule`, `data`) VALUES ('AccountPortal_Access', 1, 'Access to the Accounts Portal', NULL, 'N;'); INSERT INTO `better-office`.`authitem` (`name`, `type`, `description`, `bizrule`, `data`) VALUES ('Comment_Access', 1, 'Access to Comments, Call Log, etc.', NULL, 'N;'); INSERT INTO `better-office`.`authitem` (`name`, `type`, `description`, `bizrule`, `data`) VALUES ('Company.Create', 0, 'Create Company', NULL, 'N;'); INSERT INTO `better-office`.`authitem` (`name`, `type`, `description`, `bizrule`, `data`) VALUES ('Company.Index', 0, 'View Companies', NULL, 'N;'); INSERT INTO `better-office`.`authitem` (`name`, `type`, `description`, `bizrule`, `data`) VALUES ('Company_Access', 1, 'Show Company Module', NULL, 'N;'); INSERT INTO `better-office`.`authitem` (`name`, `type`, `description`, `bizrule`, `data`) VALUES ('Contact_Access', 1, 'Access to Contacts Module', NULL, 'N;'); INSERT INTO `better-office`.`authitem` (`name`, `type`, `description`, `bizrule`, `data`) VALUES ('emails_all_view', 0, 'View all emais.', NULL, 'N;'); INSERT INTO `better-office`.`authitem` (`name`, `type`, `description`, `bizrule`, `data`) VALUES ('emails_create', 0, 'Create a secondary email.', NULL, 'N;'); INSERT INTO `better-office`.`authitem` (`name`, `type`, `description`, `bizrule`, `data`) VALUES ('emails_delete', 0, 'Delete a secondary email.', NULL, 'N;'); INSERT INTO `better-office`.`authitem` (`name`, `type`, `description`, `bizrule`, `data`) VALUES ('emails_verificationLink_resend', 0, 'Resend the verification link.', NULL, 'N;'); INSERT INTO `better-office`.`authitem` (`name`, `type`, `description`, `bizrule`, `data`) VALUES ('Issue_Access', 1, 'Access to Issues', NULL, 'N;'); INSERT INTO `better-office`.`authitem` (`name`, `type`, `description`, `bizrule`, `data`) VALUES ('Leads_Access', 1, 'Access to Leads', NULL, 'N;'); INSERT INTO `better-office`.`authitem` (`name`, `type`, `description`, `bizrule`, `data`) VALUES ('Meetings_Access', 1, 'Access to Meetings', NULL, 'N;'); INSERT INTO `better-office`.`authitem` (`name`, `type`, `description`, `bizrule`, `data`) VALUES ('Opportunity_Access', 1, 'Access to Opportunities', NULL, 'N;'); INSERT INTO `better-office`.`authitem` (`name`, `type`, `description`, `bizrule`, `data`) VALUES ('password_change', 0, 'With this right user can change the password without knowing the old password.', NULL, 'N;'); INSERT INTO `better-office`.`authitem` (`name`, `type`, `description`, `bizrule`, `data`) VALUES ('ProjectPortal_Access', 1, 'Access to the Project Portal', NULL, 'N;'); INSERT INTO `better-office`.`authitem` (`name`, `type`, `description`, `bizrule`, `data`) VALUES ('Project_Access', 1, 'Access to Projects', NULL, 'N;'); INSERT INTO `better-office`.`authitem` (`name`, `type`, `description`, `bizrule`, `data`) VALUES ('ProposalAccess', 1, 'Access to Proposals', NULL, 'N;'); INSERT INTO `better-office`.`authitem` (`name`, `type`, `description`, `bizrule`, `data`) VALUES ('Resource_Access', 1, 'Access to Resources', NULL, 'N;'); INSERT INTO `better-office`.`authitem` (`name`, `type`, `description`, `bizrule`, `data`) VALUES ('SalePortal_Access', 1, 'Access to the Sales Portal', NULL, 'N;'); INSERT INTO `better-office`.`authitem` (`name`, `type`, `description`, `bizrule`, `data`) VALUES ('SalesManager', 2, 'Sales Manager', NULL, 'N;'); INSERT INTO `better-office`.`authitem` (`name`, `type`, `description`, `bizrule`, `data`) VALUES ('SuperAdmin', 2, 'The most powerful admin!', NULL, 'N;'); INSERT INTO `better-office`.`authitem` (`name`, `type`, `description`, `bizrule`, `data`) VALUES ('SupportPortal_Access', 1, 'Access to the Support Portal', NULL, 'N;'); INSERT INTO `better-office`.`authitem` (`name`, `type`, `description`, `bizrule`, `data`) VALUES ('Task_Access', 1, 'Access to Tasks', NULL, 'N;'); INSERT INTO `better-office`.`authitem` (`name`, `type`, `description`, `bizrule`, `data`) VALUES ('users_admin', 0, 'View all users + options.', NULL, 'N;'); INSERT INTO `better-office`.`authitem` (`name`, `type`, `description`, `bizrule`, `data`) VALUES ('users_all_privateProfile_view', 0, 'View a user private profile.', NULL, 'N;'); INSERT INTO `better-office`.`authitem` (`name`, `type`, `description`, `bizrule`, `data`) VALUES ('users_all_view', 0, 'View all users.', NULL, 'N;'); INSERT INTO `better-office`.`authitem` (`name`, `type`, `description`, `bizrule`, `data`) VALUES ('users_create', 0, 'Create a user.', NULL, 'N;'); INSERT INTO `better-office`.`authitem` (`name`, `type`, `description`, `bizrule`, `data`) VALUES ('users_delete', 0, 'Delete a user.', NULL, 'N;'); INSERT INTO `better-office`.`authitem` (`name`, `type`, `description`, `bizrule`, `data`) VALUES ('users_profile_update', 0, 'Update a user profile.', NULL, 'N;'); COMMIT; -- ----------------------------------------------------- -- Data for table `better-office`.`authassignment` -- ----------------------------------------------------- START TRANSACTION; USE `better-office`; INSERT INTO `better-office`.`authassignment` (`itemname`, `userid`, `bizrule`, `data`) VALUES ('Company.Create', '2', NULL, 'N;'); INSERT INTO `better-office`.`authassignment` (`itemname`, `userid`, `bizrule`, `data`) VALUES ('Company.Index', '2', NULL, 'N;'); INSERT INTO `better-office`.`authassignment` (`itemname`, `userid`, `bizrule`, `data`) VALUES ('Company_Access', '2', NULL, 'N;'); INSERT INTO `better-office`.`authassignment` (`itemname`, `userid`, `bizrule`, `data`) VALUES ('SuperAdmin', '1', NULL, NULL); COMMIT; -- ----------------------------------------------------- -- Data for table `better-office`.`authitemchild` -- ----------------------------------------------------- START TRANSACTION; USE `better-office`; INSERT INTO `better-office`.`authitemchild` (`parent`, `child`) VALUES ('SalesManager', 'Company_Access'); COMMIT; -- ----------------------------------------------------- -- Data for table `better-office`.`comment` -- ----------------------------------------------------- START TRANSACTION; USE `better-office`; INSERT INTO `better-office`.`comment` (`id`, `content`, `status`, `create_time`, `userId`, `ref_id`, `module`) VALUES (1, 'This is a test comment.', 2, '2013-04-07 00:00:00', 1, 1, 'company'); INSERT INTO `better-office`.`comment` (`id`, `content`, `status`, `create_time`, `userId`, `ref_id`, `module`) VALUES (2, 'Had a discussion to plan future work', 2, '2013-04-19 22:28:14', 1, 1, 'company'); INSERT INTO `better-office`.`comment` (`id`, `content`, `status`, `create_time`, `userId`, `ref_id`, `module`) VALUES (3, 'testing comments from the dashboard', 2, '2013-04-07 00:00:00', 1, 1, 'comment'); INSERT INTO `better-office`.`comment` (`id`, `content`, `status`, `create_time`, `userId`, `ref_id`, `module`) VALUES (30, 'tes', 2, '2013-04-21 08:04:35', 1, 1, 'comment'); INSERT INTO `better-office`.`comment` (`id`, `content`, `status`, `create_time`, `userId`, `ref_id`, `module`) VALUES (31, 'test', 2, '2013-04-21 08:04:35', 1, 1, 'comment'); INSERT INTO `better-office`.`comment` (`id`, `content`, `status`, `create_time`, `userId`, `ref_id`, `module`) VALUES (32, 'testing', 2, '2013-04-21 08:04:35', 1, 1, 'comment'); INSERT INTO `better-office`.`comment` (`id`, `content`, `status`, `create_time`, `userId`, `ref_id`, `module`) VALUES (33, 'testing', 2, '2013-04-21 08:04:35', 1, 1, 'comment'); INSERT INTO `better-office`.`comment` (`id`, `content`, `status`, `create_time`, `userId`, `ref_id`, `module`) VALUES (34, 'testing', 2, '2013-04-21 08:04:35', 1, 1, 'comment'); COMMIT; -- ----------------------------------------------------- -- Data for table `better-office`.`users` -- ----------------------------------------------------- START TRANSACTION; USE `better-office`; INSERT INTO `better-office`.`users` (`id`, `user_name`, `email`, `pass`, `salt`, `name`, `surname`, `active`, `status`, `date_of_creation`, `date_of_update`, `date_of_last_access`, `date_of_password_last_change`) VALUES (1, 'admin', 'ron@radcg.net', '$6$rounds=12587$ 515f497c2d16b2.$l/2BYRJTw5CNnZUpylDds77.vyrP1Q9DMAfaaEUeERJH7nGnjLCRaapj6UbLe9m5o0.Qcs2foEWaiS6p402Y..', '515f497c2d16b2.83362435', 'Admin', 'User', 1, 10, '2014-01-13 20:38:15', '2013-04-19 21:04:18', '2014-01-13 20:38:15', '2013-04-05 17:00:28'); INSERT INTO `better-office`.`users` (`id`, `user_name`, `email`, `pass`, `salt`, `name`, `surname`, `active`, `status`, `date_of_creation`, `date_of_update`, `date_of_last_access`, `date_of_password_last_change`) VALUES (2, 'demo', 'demo@noEmail.com', '$6$rounds=12587$ 515f497ca09ed2.$Pi.XaGbB/5wADch9pWHtEPi1i9NkNpPTVdUAW7e7On9t6po41LZGl/LPMsLdiH4iIvw4vaYPmmTWzqFPVRR.o0', '515f497ca09ed2.55644107', 'Demo', 'Demo', 1, 0, '2014-01-13 17:00:17', '2013-04-19 13:58:18', '2014-01-13 17:00:17', '2013-04-05 17:00:28'); COMMIT; -- ----------------------------------------------------- -- Data for table `better-office`.`company` -- ----------------------------------------------------- START TRANSACTION; USE `better-office`; INSERT INTO `better-office`.`company` (`id`, `name`, `description`, `address`, `social`, `website`, `manager`, `create_date`) VALUES (1, 'RAD Consulting Group', 'The best!', NULL, NULL, NULL, 1, NULL); INSERT INTO `better-office`.`company` (`id`, `name`, `description`, `address`, `social`, `website`, `manager`, `create_date`) VALUES (2, 'Tiger Safety', 'Tiger Safety Supply Company', NULL, NULL, NULL, 2, NULL); COMMIT; -- ----------------------------------------------------- -- Data for table `better-office`.`contact` -- ----------------------------------------------------- START TRANSACTION; USE `better-office`; INSERT INTO `better-office`.`contact` (`id`, `firstname`, `lastname`, `title`, `company`, `description`, `im`, `email`) VALUES (1, 'Ron', 'Bryant', 'Co-Owner', 1, 'Fearless Leader!', NULL, NULL); INSERT INTO `better-office`.`contact` (`id`, `firstname`, `lastname`, `title`, `company`, `description`, `im`, `email`) VALUES (2, 'Donald', 'Dartez', 'Co-Owner', 1, '', NULL, NULL); COMMIT; -- ----------------------------------------------------- -- Data for table `better-office`.`emails` -- ----------------------------------------------------- START TRANSACTION; USE `better-office`; INSERT INTO `better-office`.`emails` (`id`, `id_user`, `name`, `verified`, `verification_code`, `date_of_creation`, `visible`) VALUES (1, 1, 'admin@noEmail.com', 0, NULL, '2013-04-05 17:00:28', 0); INSERT INTO `better-office`.`emails` (`id`, `id_user`, `name`, `verified`, `verification_code`, `date_of_creation`, `visible`) VALUES (2, 2, 'demo@noEmail.com', 0, NULL, '2013-04-05 17:00:28', 0); COMMIT; -- ----------------------------------------------------- -- Data for table `better-office`.`valuelist` -- ----------------------------------------------------- START TRANSACTION; USE `better-office`; INSERT INTO `better-office`.`valuelist` (`id`, `value`, `name`, `module`, `field`) VALUES (1, 1, 'Business', 'phone', 'type'); INSERT INTO `better-office`.`valuelist` (`id`, `value`, `name`, `module`, `field`) VALUES (2, 2, 'Home', 'phone', 'type'); INSERT INTO `better-office`.`valuelist` (`id`, `value`, `name`, `module`, `field`) VALUES (3, 1, 'Pending', 'comment', 'status'); INSERT INTO `better-office`.`valuelist` (`id`, `value`, `name`, `module`, `field`) VALUES (4, 2, 'Approved', 'comment', 'status'); INSERT INTO `better-office`.`valuelist` (`id`, `value`, `name`, `module`, `field`) VALUES (5, 1, 'Pending', 'project', 'status'); INSERT INTO `better-office`.`valuelist` (`id`, `value`, `name`, `module`, `field`) VALUES (6, 2, 'Approved', 'project', 'status'); INSERT INTO `better-office`.`valuelist` (`id`, `value`, `name`, `module`, `field`) VALUES (7, 3, 'In Progress', 'project', 'status'); INSERT INTO `better-office`.`valuelist` (`id`, `value`, `name`, `module`, `field`) VALUES (8, 4, 'Complete', 'project', 'status'); INSERT INTO `better-office`.`valuelist` (`id`, `value`, `name`, `module`, `field`) VALUES (9, 5, 'Closed', 'project', 'status'); COMMIT; -- ----------------------------------------------------- -- Data for table `better-office`.`proposal` -- ----------------------------------------------------- START TRANSACTION; USE `better-office`; INSERT INTO `better-office`.`proposal` (`id`, `name`, `description`, `company`, `total`, `cover`, `pdf`, `sendto`, `message`, `status`, `project`, `opportunity`) VALUES (1, 'Proposal', 'test', 1, 1000, NULL, NULL, NULL, NULL, 2, 1, NULL); COMMIT; -- ----------------------------------------------------- -- Data for table `better-office`.`project` -- ----------------------------------------------------- START TRANSACTION; USE `better-office`; INSERT INTO `better-office`.`project` (`id`, `name`, `description`, `user`, `total`, `startdate`, `enddate`, `company`, `budget`, `percent_complete`, `status`, `proposal`) VALUES (1, 'Tiger Safety', 'Tiger Safety SEO Project', 1, 1500, '2013-04-01 00:00:00', '2013-04-30 00:00:00', 1, 5000, 20, 3, 1); COMMIT; -- ----------------------------------------------------- -- Data for table `better-office`.`task` -- ----------------------------------------------------- START TRANSACTION; USE `better-office`; INSERT INTO `better-office`.`task` (`id`, `name`, `project`, `startdate`, `enddate`, `assignedto`, `quantity`, `time`, `module`, `ref_id`, `status`, `percent_complete`) VALUES (1, 'Est Marina site', 1, NULL, NULL, 1, 4, NULL, 'company', 1, 2, NULL); INSERT INTO `better-office`.`task` (`id`, `name`, `project`, `startdate`, `enddate`, `assignedto`, `quantity`, `time`, `module`, `ref_id`, `status`, `percent_complete`) VALUES (2, 'Est Port of Delcambre Graphic Update', 1, NULL, NULL, 1, 3, NULL, 'company', 1, 2, NULL); INSERT INTO `better-office`.`task` (`id`, `name`, `project`, `startdate`, `enddate`, `assignedto`, `quantity`, `time`, `module`, `ref_id`, `status`, `percent_complete`) VALUES (3, 'Complete NuNus', 1, NULL, NULL, 1, 6, NULL, 'company', 1, 2, NULL); INSERT INTO `better-office`.`task` (`id`, `name`, `project`, `startdate`, `enddate`, `assignedto`, `quantity`, `time`, `module`, `ref_id`, `status`, `percent_complete`) VALUES (4, 'Complete Touchard\'s Marine', 1, NULL, NULL, 1, 2, NULL, 'company', 1, 2, NULL); INSERT INTO `better-office`.`task` (`id`, `name`, `project`, `startdate`, `enddate`, `assignedto`, `quantity`, `time`, `module`, `ref_id`, `status`, `percent_complete`) VALUES (5, 'Follow up with eBrandz about video', 1, '2013-04-17 11:00:00', '2013-04-19 14:00:00', 1, 2, NULL, 'company', 1, 2, NULL); INSERT INTO `better-office`.`task` (`id`, `name`, `project`, `startdate`, `enddate`, `assignedto`, `quantity`, `time`, `module`, `ref_id`, `status`, `percent_complete`) VALUES (6, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, NULL, 0, NULL); COMMIT; -- ----------------------------------------------------- -- Data for table `better-office`.`issue` -- ----------------------------------------------------- START TRANSACTION; USE `better-office`; INSERT INTO `better-office`.`issue` (`id`, `title`, `description`, `company_id`, `assignedto`, `owner`, `status`, `create_date`, `due_date`) VALUES (1, 'Test Issue', 'Testing adding issues', 1, NULL, NULL, 1, NULL, NULL); INSERT INTO `better-office`.`issue` (`id`, `title`, `description`, `company_id`, `assignedto`, `owner`, `status`, `create_date`, `due_date`) VALUES (2, 'New Issue', 'testing', 1, NULL, NULL, 2, NULL, NULL); INSERT INTO `better-office`.`issue` (`id`, `title`, `description`, `company_id`, `assignedto`, `owner`, `status`, `create_date`, `due_date`) VALUES (3, 'New Issue', 'testing', 2, NULL, NULL, 2, NULL, NULL); INSERT INTO `better-office`.`issue` (`id`, `title`, `description`, `company_id`, `assignedto`, `owner`, `status`, `create_date`, `due_date`) VALUES (4, 'New Issue', 'testing', 2, NULL, NULL, 1, NULL, NULL); INSERT INTO `better-office`.`issue` (`id`, `title`, `description`, `company_id`, `assignedto`, `owner`, `status`, `create_date`, `due_date`) VALUES (5, 'New Issue', 'what a mess!', 2, NULL, NULL, 2, NULL, NULL); COMMIT; -- ----------------------------------------------------- -- Data for table `better-office`.`opportunity` -- ----------------------------------------------------- START TRANSACTION; USE `better-office`; INSERT INTO `better-office`.`opportunity` (`id`, `name`, `description`, `amount`, `type`, `category`, `owner`, `status`, `change_date`, `change_by`, `company`, `probability`) VALUES (1, 'Coffee Shop web site', '', 7500, 1, 1, 1, 2, '2013-04-18 00:00:00', 1, 1, NULL); INSERT INTO `better-office`.`opportunity` (`id`, `name`, `description`, `amount`, `type`, `category`, `owner`, `status`, `change_date`, `change_by`, `company`, `probability`) VALUES (2, 'Test Record', NULL, 5000, 1, 1, 2, 2, '2013-04-18 00:00:00', 1, 1, NULL); COMMIT; -- ----------------------------------------------------- -- Data for table `better-office`.`phone` -- ----------------------------------------------------- START TRANSACTION; USE `better-office`; INSERT INTO `better-office`.`phone` (`id`, `number`, `type`, `module`, `ref_id`, `contact`) VALUES (1, '612-801-7658', 1, '', 0, 1); INSERT INTO `better-office`.`phone` (`id`, `number`, `type`, `module`, `ref_id`, `contact`) VALUES (2, '337-856-2044', 1, '', 0, 2); INSERT INTO `better-office`.`phone` (`id`, `number`, `type`, `module`, `ref_id`, `contact`) VALUES (3, '337-291-2881', 1, 'company', 1, NULL); COMMIT; -- ----------------------------------------------------- -- Data for table `better-office`.`resource` -- ----------------------------------------------------- START TRANSACTION; USE `better-office`; INSERT INTO `better-office`.`resource` (`id`, `name`, `company`, `email`, `payrate`, `userid`, `billrate`) VALUES (1, 'Ron Bryant', 1, 0, 0, 1, 100); INSERT INTO `better-office`.`resource` (`id`, `name`, `company`, `email`, `payrate`, `userid`, `billrate`) VALUES (2, 'Donald Dartez', 1, NULL, 0, 2, 100); INSERT INTO `better-office`.`resource` (`id`, `name`, `company`, `email`, `payrate`, `userid`, `billrate`) VALUES (3, 'Leslie Davis', 3, NULL, 60, 3, 75); INSERT INTO `better-office`.`resource` (`id`, `name`, `company`, `email`, `payrate`, `userid`, `billrate`) VALUES (4, 'Elizabeth Bell', 4, NULL, 75, 4, 90); COMMIT; -- ----------------------------------------------------- -- Data for table `better-office`.`settings` -- ----------------------------------------------------- START TRANSACTION; USE `better-office`; INSERT INTO `better-office`.`settings` (`id`, `name`, `value`, `label`, `description`, `date_of_update`, `setting_order`) VALUES (1, 'logInIfNotVerified', '0', 'Allow users to LogIn if they are not active?', '', '2013-04-05 16:57:51', 100); INSERT INTO `better-office`.`settings` (`id`, `name`, `value`, `label`, `description`, `date_of_update`, `setting_order`) VALUES (2, 'enabledSignUp', '0', 'SignUp is enabled?', 'If SignUp is disabled, no SignUps are allowed, in any case!', '2013-04-05 16:57:51', 200); INSERT INTO `better-office`.`settings` (`id`, `name`, `value`, `label`, `description`, `date_of_update`, `setting_order`) VALUES (3, 'invitationBasedSignUp', '0', 'Only invited users are allowed to SignUp?', 'If SignUp is disabled, no user can SignUp, even invited ones!', '2013-04-05 16:57:51', 300); INSERT INTO `better-office`.`settings` (`id`, `name`, `value`, `label`, `description`, `date_of_update`, `setting_order`) VALUES (4, 'invitationButtonDisplay', '0', 'Display the invitation button to all users?', '', '2013-04-05 16:57:51', 400); INSERT INTO `better-office`.`settings` (`id`, `name`, `value`, `label`, `description`, `date_of_update`, `setting_order`) VALUES (5, 'invitationDefaultNumber', '5', 'Default number of invitations per user? (if <0 = infinit number)', '', '2013-04-05 16:57:51', 500); INSERT INTO `better-office`.`settings` (`id`, `name`, `value`, `label`, `description`, `date_of_update`, `setting_order`) VALUES (6, 'invitationEmail', 'webmaster@localhost', 'Invitation email is sent from:', '', '2013-04-05 16:57:51', 600); INSERT INTO `better-office`.`settings` (`id`, `name`, `value`, `label`, `description`, `date_of_update`, `setting_order`) VALUES (7, 'hoursInvitationLinkIsActive', '144', 'How many hours the invitation link is active? (if <0 = forever)', '', '2013-04-05 16:57:51', 700); INSERT INTO `better-office`.`settings` (`id`, `name`, `value`, `label`, `description`, `date_of_update`, `setting_order`) VALUES (8, 'hoursActivationLinkIsActive', '72', 'How many hours the activation link is active? (if <0 = forever)', '', '2013-04-05 16:57:51', 900); INSERT INTO `better-office`.`settings` (`id`, `name`, `value`, `label`, `description`, `date_of_update`, `setting_order`) VALUES (9, 'notificationSignUpEmail', 'webmaster@localhost', 'Activation email is sent from:', '', '2013-04-05 16:57:51', 800); INSERT INTO `better-office`.`settings` (`id`, `name`, `value`, `label`, `description`, `date_of_update`, `setting_order`) VALUES (10, 'hoursVerificationLinkIsActive', '144', 'How many hours the email verification link is active? (if <0 = forever)', 'How many hours the email verification link is active? (when user associates a new email address to his/hers account)', '2013-04-05 16:57:51', 1000); INSERT INTO `better-office`.`settings` (`id`, `name`, `value`, `label`, `description`, `date_of_update`, `setting_order`) VALUES (11, 'notificationVerificationEmail', 'webmaster@localhost', 'Verification email is sent from:', '', '2013-04-05 16:57:51', 1100); COMMIT; -- ----------------------------------------------------- -- Data for table `better-office`.`users_data` -- ----------------------------------------------------- START TRANSACTION; USE `better-office`; INSERT INTO `better-office`.`users_data` (`id`, `description`, `obs`, `site`, `facebook_address`, `twitter_address`, `activation_code`, `date_of_update`, `invitations_left`) VALUES (1, 'The default SuperAdmin user!', '', '', '', '', '398f509a78cf7880f3712b85c6beb12d69000338', '2013-04-06 19:55:34', -1); INSERT INTO `better-office`.`users_data` (`id`, `description`, `obs`, `site`, `facebook_address`, `twitter_address`, `activation_code`, `date_of_update`, `invitations_left`) VALUES (2, 'The default regular user!', NULL, NULL, NULL, NULL, '9a67add8d8bde84f465136b6c741175fd9fec5f5', '2013-04-05 17:00:28', -1); COMMIT; -- ----------------------------------------------------- -- Data for table `better-office`.`worklog` -- ----------------------------------------------------- START TRANSACTION; USE `better-office`; INSERT INTO `better-office`.`worklog` (`id`, `task`, `resource`, `hours`, `workdate`, `log`) VALUES (1, 5, 1, 3, '2013-04-13 00:00:00', 'did something'); INSERT INTO `better-office`.`worklog` (`id`, `task`, `resource`, `hours`, `workdate`, `log`) VALUES (2, 1, 1, 4, NULL, NULL); INSERT INTO `better-office`.`worklog` (`id`, `task`, `resource`, `hours`, `workdate`, `log`) VALUES (3, 3, 2, 5, NULL, NULL); INSERT INTO `better-office`.`worklog` (`id`, `task`, `resource`, `hours`, `workdate`, `log`) VALUES (4, 4, 3, 10, NULL, NULL); INSERT INTO `better-office`.`worklog` (`id`, `task`, `resource`, `hours`, `workdate`, `log`) VALUES (5, 2, 1, 4, NULL, NULL); COMMIT;
true
781355dde83837408c60158e192202b18b25a27c
SQL
ninton/ShuffleSim
/Config/Schema/shuffle_sims.sql
UTF-8
1,254
2.75
3
[ "MIT" ]
permissive
-- phpMyAdmin SQL Dump -- version 4.1.12 -- http://www.phpmyadmin.net -- -- Host: 127.0.0.1 -- Generation Time: Jun 25, 2014 at 06:47 PM -- Server version: 5.6.16 -- PHP Version: 5.5.11 SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; SET time_zone = "+00:00"; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8 */; -- -------------------------------------------------------- -- -- Table structure for table `shuffle_sims` -- CREATE TABLE IF NOT EXISTS `shuffle_sims` ( `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `created` datetime NOT NULL, `trial_num` int(11) NOT NULL, `shuffle_name` varchar(100) NOT NULL, `shuffle_params` text NOT NULL, `data` text NOT NULL, `img1` longblob NOT NULL, `shuffle_index` text NOT NULL, `img2` longblob NOT NULL, `img3` longblob NOT NULL, `img4` longblob NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 ; /*!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
5ac805ad6607b7d5d9c6cb8f6263cf23212ecc42
SQL
ALMLAMBO/SUBD
/2019-02-08-intro-to-SQL/students.sql
UTF-8
506
3.578125
4
[]
no_license
/*create database school;*/ use school; /*create table students ( Id integer auto_increment primary key, Name varchar(150) not null, EGN char(10) not null, Birthday date ); insert into students values (null, 'Aleksander Marinov', '1111111110', '2000-11-02'), (null, 'Aleksander Petrov', '1234567890', '1999-02-01'), (null, 'Boris Georgiev', '0134567801', '1992-06-08'), (null, 'Georgi Demirev', '2143658709', '1932-09-01'); */ select * from students where Birthday < '2000-01-01' order by Birthday; /*drop database school;*/
true
36f718d4d8043980fa24f100d2d5dc22878c164f
SQL
edwintorok/jira
/projectTrend/C+.sql
UTF-8
1,221
3.765625
4
[]
no_license
-- -- list jira issues created for a given IssueVersion and matching a given project, priority, team, start date -- Using the jira SQL interface, ref: -- https://developer.atlassian.com/display/JIRADEV/Database+Schema -- https://confluence.atlassian.com/display/JIRA041/Example+SQL+queries+for+JIRA -- philippeg jul2014 -- select to_char(j.created, 'YYYY-MM-DD","YY"wk"IW'),:'LOG',concat(project.pkey,'-',j.issuenum),priority.pname,j.assignee from jiraissue j,project,issuetype,priority where j.project=project.id and project.pkey in (:PROJECTS) and j.priority=priority.id and priority.pname in (:PRIORITY) and j.issuetype=issuetype.id and issuetype.pname='Bug' and j.created > :'STARTDATE' and j.id in (select label.issue from label where label.label in (:TEAM)) and j.id in (select nain.SOURCE_NODE_ID from nodeassociation nain,projectversion pvin where nain.ASSOCIATION_TYPE='IssueVersion' and pvin.id=nain.SINK_NODE_ID and pvin.vname=:'RELIN') /*Exclude issues whose version was changed after creation*/ and j.id not in (select changegroup.issueid from changeitem,changegroup where changegroup.id=changeitem.groupid and changeitem.field = 'Version' and changeitem.newstring=:'RELIN') order by j.created DESC;
true
02022e66e5f7d6f8fcff1f4f5effdf6818665154
SQL
wcig/spring-study-demo
/dao-demo/SQL/test.sql
UTF-8
5,035
3.9375
4
[]
no_license
-- 1.数据库 CREATE DATABASE `spring_study_demo` DEFAULT CHARACTER SET utf8mb4 DEFAULT COLLATE utf8mb4_unicode_ci; -- 2.用户信息表 CREATE TABLE `spring_study_demo`.`user` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键id', `name` varchar(60) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '昵称', `phone` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '手机号', `password` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '密码', `create_time` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='用户信息表'; -- 3.连表映射 -- 一对一映射 student-card -- 一对多映射 grade-student -- 多对多映射 student-course -- 学生信息表 CREATE TABLE `spring_study_demo`.`student` ( `student_id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键id', `name` varchar(60) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '姓名', `card_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '身份证id', `grade_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '班级id', PRIMARY KEY (`student_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='学生信息表'; -- 身份证信息表 CREATE TABLE `spring_study_demo`.`card` ( `card_id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键id', `num` varchar(60) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '身份证号', PRIMARY KEY (`card_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='身份证信息表'; -- 班级信息表 CREATE TABLE `spring_study_demo`.`grade` ( `grade_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '主键id', `name` varchar(60) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '班级名称', PRIMARY KEY (`grade_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='班级信息表'; -- 课程信息表 CREATE TABLE `spring_study_demo`.`course` ( `course_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '主键id', `name` varchar(60) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '课程名称', PRIMARY KEY (`course_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='课程信息表'; -- 学生课程映射表 CREATE TABLE `spring_study_demo`.`student_course_mapping` ( `student_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '主键id', `course_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '主键id', PRIMARY KEY (`student_id`, `course_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='学生课程映射表'; -- 插入记录 insert into student (student_id, name, card_id, grade_id) values ('1', 'tom', '1', '1'); insert into student (student_id, name, card_id, grade_id) values ('2', 'jerry', '2', '1'); insert into card (card_id, num) values ('1', '001'); insert into card (card_id, num) values ('2', '002'); insert into grade (grade_id, name) values ('1', '一班'); insert into course (course_id, name) value ('1', '数学'); insert into course (course_id, name) value ('2', '语文'); insert into student_course_mapping (student_id, course_id) value ('1', '1'); insert into student_course_mapping (student_id, course_id) value ('1', '2'); insert into student_course_mapping (student_id, course_id) value ('2', '1'); insert into student_course_mapping (student_id, course_id) value ('2', '2'); -- 4.类型测试表 CREATE TABLE `spring_study_demo`.`int_type_test` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键id', tinyint_t tinyint, smallint_t smallint, middleint_t middleint, int_t int, bigint_t bigint, float_t float, double_t double, decimal_t decimal(6,2), PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='数字类型测试表'; CREATE TABLE `spring_study_demo`.`string_type_test` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键id', char_t char(32), varchar_t varchar(32), tinytext_t tinytext, text_t text, mediumtext_t mediumtext, longtext_t longtext, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='字符串类型测试表'; CREATE TABLE `spring_study_demo`.`time_type_test` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键id', year_t year, date_t date, time_t time, datetime_t datetime, timestamp_t timestamp, bigint_t bigint, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='时间类型测试表'; CREATE TABLE `spring_study_demo`.`enum_type_test` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键id', enum_t enum('f', 'm'), PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='枚举类型测试表';
true
ab3d5760b93b3eba4445a9d216f9337687872394
SQL
hejiaz1/fastbase
/application/admin/command/Install/fastadmin.sql
UTF-8
60,302
3.265625
3
[ "Apache-2.0" ]
permissive
/* SQLyog Ultimate v13.1.1 (64 bit) MySQL - 5.7.26 : Database - fastadmin ********************************************************************* */ /*!40101 SET NAMES utf8 */; /*!40101 SET SQL_MODE=''*/; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; /*Table structure for table `fa_admin` */ DROP TABLE IF EXISTS `fa_admin`; CREATE TABLE `fa_admin` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'ID', `username` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '用户名', `nickname` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '昵称', `password` varchar(32) COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '密码', `salt` varchar(30) COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '密码盐', `avatar` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '头像', `email` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '电子邮箱', `loginfailure` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '失败次数', `logintime` int(10) DEFAULT NULL COMMENT '登录时间', `loginip` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '登录IP', `createtime` int(10) DEFAULT NULL COMMENT '创建时间', `updatetime` int(10) DEFAULT NULL COMMENT '更新时间', `token` varchar(59) COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT 'Session标识', `status` varchar(30) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'normal' COMMENT '状态', PRIMARY KEY (`id`), UNIQUE KEY `username` (`username`) USING BTREE ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='管理员表'; /*Data for the table `fa_admin` */ insert into `fa_admin`(`id`,`username`,`nickname`,`password`,`salt`,`avatar`,`email`,`loginfailure`,`logintime`,`loginip`,`createtime`,`updatetime`,`token`,`status`) values (1,'admin','Admin','9054ab357507063a474af7b2ce8883c4','4b9d01','/assets/img/avatar.png','admin@admin.com',0,1619334512,'127.0.0.1',1491635035,1619334512,'068afa2c-dffe-4d58-9d83-513f8eb662d2','normal'); /*Table structure for table `fa_admin_log` */ DROP TABLE IF EXISTS `fa_admin_log`; CREATE TABLE `fa_admin_log` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'ID', `admin_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '管理员ID', `username` varchar(30) COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '管理员名字', `url` varchar(1500) COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '操作页面', `title` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '日志标题', `content` text COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '内容', `ip` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT 'IP', `useragent` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT 'User-Agent', `createtime` int(10) DEFAULT NULL COMMENT '操作时间', PRIMARY KEY (`id`), KEY `name` (`username`) ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='管理员日志表'; /*Data for the table `fa_admin_log` */ insert into `fa_admin_log`(`id`,`admin_id`,`username`,`url`,`title`,`content`,`ip`,`useragent`,`createtime`) values (1,1,'admin','/oEwQfxDlzk.php/index/login?url=%2FoEwQfxDlzk.php','登录','{\"url\":\"\\/oEwQfxDlzk.php\",\"__token__\":\"***\",\"username\":\"admin\",\"password\":\"***\",\"captcha\":\"5cnz\"}','127.0.0.1','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:87.0) Gecko/20100101 Firefox/87.0',1619334512); /*Table structure for table `fa_area` */ DROP TABLE IF EXISTS `fa_area`; CREATE TABLE `fa_area` ( `id` int(10) NOT NULL AUTO_INCREMENT COMMENT 'ID', `pid` int(10) DEFAULT NULL COMMENT '父id', `shortname` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '简称', `name` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '名称', `mergename` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '全称', `level` tinyint(4) DEFAULT NULL COMMENT '层级 0 1 2 省市区县', `pinyin` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '拼音', `code` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '长途区号', `zip` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '邮编', `first` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '首字母', `lng` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '经度', `lat` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '纬度', PRIMARY KEY (`id`), KEY `pid` (`pid`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='地区表'; /*Data for the table `fa_area` */ /*Table structure for table `fa_attachment` */ DROP TABLE IF EXISTS `fa_attachment`; CREATE TABLE `fa_attachment` ( `id` int(20) unsigned NOT NULL AUTO_INCREMENT COMMENT 'ID', `admin_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '管理员ID', `user_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '会员ID', `url` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '物理路径', `imagewidth` varchar(30) COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '宽度', `imageheight` varchar(30) COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '高度', `imagetype` varchar(30) COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '图片类型', `imageframes` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '图片帧数', `filename` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '文件名称', `filesize` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '文件大小', `mimetype` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT 'mime类型', `extparam` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '透传数据', `createtime` int(10) DEFAULT NULL COMMENT '创建日期', `updatetime` int(10) DEFAULT NULL COMMENT '更新时间', `uploadtime` int(10) DEFAULT NULL COMMENT '上传时间', `storage` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'local' COMMENT '存储位置', `sha1` varchar(40) COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '文件 sha1编码', PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='附件表'; /*Data for the table `fa_attachment` */ insert into `fa_attachment`(`id`,`admin_id`,`user_id`,`url`,`imagewidth`,`imageheight`,`imagetype`,`imageframes`,`filename`,`filesize`,`mimetype`,`extparam`,`createtime`,`updatetime`,`uploadtime`,`storage`,`sha1`) values (1,1,0,'/assets/img/qrcode.png','150','150','png',0,'qrcode.png',21859,'image/png','',1491635035,1491635035,1491635035,'local','17163603d0263e4838b9387ff2cd4877e8b018f6'); /*Table structure for table `fa_auth_group` */ DROP TABLE IF EXISTS `fa_auth_group`; CREATE TABLE `fa_auth_group` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `pid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '父组别', `name` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '组名', `rules` text COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '规则ID', `createtime` int(10) DEFAULT NULL COMMENT '创建时间', `updatetime` int(10) DEFAULT NULL COMMENT '更新时间', `status` varchar(30) COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '状态', PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='分组表'; /*Data for the table `fa_auth_group` */ insert into `fa_auth_group`(`id`,`pid`,`name`,`rules`,`createtime`,`updatetime`,`status`) values (1,0,'Admin group','*',1491635035,1491635035,'normal'); insert into `fa_auth_group`(`id`,`pid`,`name`,`rules`,`createtime`,`updatetime`,`status`) values (2,1,'Second group','13,14,16,15,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,40,41,42,43,44,45,46,47,48,49,50,55,56,57,58,59,60,61,62,63,64,65,1,9,10,11,7,6,8,2,4,5',1491635035,1491635035,'normal'); insert into `fa_auth_group`(`id`,`pid`,`name`,`rules`,`createtime`,`updatetime`,`status`) values (3,2,'Third group','1,4,9,10,11,13,14,15,16,17,40,41,42,43,44,45,46,47,48,49,50,55,56,57,58,59,60,61,62,63,64,65,5',1491635035,1491635035,'normal'); insert into `fa_auth_group`(`id`,`pid`,`name`,`rules`,`createtime`,`updatetime`,`status`) values (4,1,'Second group 2','1,4,13,14,15,16,17,55,56,57,58,59,60,61,62,63,64,65',1491635035,1491635035,'normal'); insert into `fa_auth_group`(`id`,`pid`,`name`,`rules`,`createtime`,`updatetime`,`status`) values (5,2,'Third group 2','1,2,6,7,8,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34',1491635035,1491635035,'normal'); /*Table structure for table `fa_auth_group_access` */ DROP TABLE IF EXISTS `fa_auth_group_access`; CREATE TABLE `fa_auth_group_access` ( `uid` int(10) unsigned NOT NULL COMMENT '会员ID', `group_id` int(10) unsigned NOT NULL COMMENT '级别ID', UNIQUE KEY `uid_group_id` (`uid`,`group_id`), KEY `uid` (`uid`), KEY `group_id` (`group_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='权限分组表'; /*Data for the table `fa_auth_group_access` */ insert into `fa_auth_group_access`(`uid`,`group_id`) values (1,1); /*Table structure for table `fa_auth_rule` */ DROP TABLE IF EXISTS `fa_auth_rule`; CREATE TABLE `fa_auth_rule` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `type` enum('menu','file') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'file' COMMENT 'menu为菜单,file为权限节点', `pid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '父ID', `name` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '规则名称', `title` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '规则名称', `icon` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '图标', `url` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '规则URL', `condition` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '条件', `remark` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '备注', `ismenu` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '是否为菜单', `menutype` enum('addtabs','blank','dialog','ajax') COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '菜单类型', `extend` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '扩展属性', `createtime` int(10) DEFAULT NULL COMMENT '创建时间', `updatetime` int(10) DEFAULT NULL COMMENT '更新时间', `weigh` int(10) NOT NULL DEFAULT '0' COMMENT '权重', `status` varchar(30) COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '状态', PRIMARY KEY (`id`), UNIQUE KEY `name` (`name`) USING BTREE, KEY `pid` (`pid`), KEY `weigh` (`weigh`) ) ENGINE=InnoDB AUTO_INCREMENT=85 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='节点表'; /*Data for the table `fa_auth_rule` */ insert into `fa_auth_rule`(`id`,`type`,`pid`,`name`,`title`,`icon`,`url`,`condition`,`remark`,`ismenu`,`menutype`,`extend`,`createtime`,`updatetime`,`weigh`,`status`) values (1,'file',0,'dashboard','Dashboard','fa fa-dashboard','','','Dashboard tips',1,NULL,'',1491635035,1491635035,143,'normal'); insert into `fa_auth_rule`(`id`,`type`,`pid`,`name`,`title`,`icon`,`url`,`condition`,`remark`,`ismenu`,`menutype`,`extend`,`createtime`,`updatetime`,`weigh`,`status`) values (2,'file',0,'general','General','fa fa-cogs','','','',1,NULL,'',1491635035,1491635035,137,'normal'); insert into `fa_auth_rule`(`id`,`type`,`pid`,`name`,`title`,`icon`,`url`,`condition`,`remark`,`ismenu`,`menutype`,`extend`,`createtime`,`updatetime`,`weigh`,`status`) values (3,'file',0,'category','Category','fa fa-leaf','','','Category tips',1,NULL,'',1491635035,1491635035,119,'normal'); insert into `fa_auth_rule`(`id`,`type`,`pid`,`name`,`title`,`icon`,`url`,`condition`,`remark`,`ismenu`,`menutype`,`extend`,`createtime`,`updatetime`,`weigh`,`status`) values (4,'file',0,'addon','Addon','fa fa-rocket','','','Addon tips',1,NULL,'',1491635035,1491635035,0,'normal'); insert into `fa_auth_rule`(`id`,`type`,`pid`,`name`,`title`,`icon`,`url`,`condition`,`remark`,`ismenu`,`menutype`,`extend`,`createtime`,`updatetime`,`weigh`,`status`) values (5,'file',0,'auth','Auth','fa fa-group','','','',1,NULL,'',1491635035,1491635035,99,'normal'); insert into `fa_auth_rule`(`id`,`type`,`pid`,`name`,`title`,`icon`,`url`,`condition`,`remark`,`ismenu`,`menutype`,`extend`,`createtime`,`updatetime`,`weigh`,`status`) values (6,'file',2,'general/config','Config','fa fa-cog','','','Config tips',1,NULL,'',1491635035,1491635035,60,'normal'); insert into `fa_auth_rule`(`id`,`type`,`pid`,`name`,`title`,`icon`,`url`,`condition`,`remark`,`ismenu`,`menutype`,`extend`,`createtime`,`updatetime`,`weigh`,`status`) values (7,'file',2,'general/attachment','Attachment','fa fa-file-image-o','','','Attachment tips',1,NULL,'',1491635035,1491635035,53,'normal'); insert into `fa_auth_rule`(`id`,`type`,`pid`,`name`,`title`,`icon`,`url`,`condition`,`remark`,`ismenu`,`menutype`,`extend`,`createtime`,`updatetime`,`weigh`,`status`) values (8,'file',2,'general/profile','Profile','fa fa-user','','','',1,NULL,'',1491635035,1491635035,34,'normal'); insert into `fa_auth_rule`(`id`,`type`,`pid`,`name`,`title`,`icon`,`url`,`condition`,`remark`,`ismenu`,`menutype`,`extend`,`createtime`,`updatetime`,`weigh`,`status`) values (9,'file',5,'auth/admin','Admin','fa fa-user','','','Admin tips',1,NULL,'',1491635035,1491635035,118,'normal'); insert into `fa_auth_rule`(`id`,`type`,`pid`,`name`,`title`,`icon`,`url`,`condition`,`remark`,`ismenu`,`menutype`,`extend`,`createtime`,`updatetime`,`weigh`,`status`) values (10,'file',5,'auth/adminlog','Admin log','fa fa-list-alt','','','Admin log tips',1,NULL,'',1491635035,1491635035,113,'normal'); insert into `fa_auth_rule`(`id`,`type`,`pid`,`name`,`title`,`icon`,`url`,`condition`,`remark`,`ismenu`,`menutype`,`extend`,`createtime`,`updatetime`,`weigh`,`status`) values (11,'file',5,'auth/group','Group','fa fa-group','','','Group tips',1,NULL,'',1491635035,1491635035,109,'normal'); insert into `fa_auth_rule`(`id`,`type`,`pid`,`name`,`title`,`icon`,`url`,`condition`,`remark`,`ismenu`,`menutype`,`extend`,`createtime`,`updatetime`,`weigh`,`status`) values (12,'file',5,'auth/rule','Rule','fa fa-bars','','','Rule tips',1,NULL,'',1491635035,1491635035,104,'normal'); insert into `fa_auth_rule`(`id`,`type`,`pid`,`name`,`title`,`icon`,`url`,`condition`,`remark`,`ismenu`,`menutype`,`extend`,`createtime`,`updatetime`,`weigh`,`status`) values (13,'file',1,'dashboard/index','View','fa fa-circle-o','','','',0,NULL,'',1491635035,1491635035,136,'normal'); insert into `fa_auth_rule`(`id`,`type`,`pid`,`name`,`title`,`icon`,`url`,`condition`,`remark`,`ismenu`,`menutype`,`extend`,`createtime`,`updatetime`,`weigh`,`status`) values (14,'file',1,'dashboard/add','Add','fa fa-circle-o','','','',0,NULL,'',1491635035,1491635035,135,'normal'); insert into `fa_auth_rule`(`id`,`type`,`pid`,`name`,`title`,`icon`,`url`,`condition`,`remark`,`ismenu`,`menutype`,`extend`,`createtime`,`updatetime`,`weigh`,`status`) values (15,'file',1,'dashboard/del','Delete','fa fa-circle-o','','','',0,NULL,'',1491635035,1491635035,133,'normal'); insert into `fa_auth_rule`(`id`,`type`,`pid`,`name`,`title`,`icon`,`url`,`condition`,`remark`,`ismenu`,`menutype`,`extend`,`createtime`,`updatetime`,`weigh`,`status`) values (16,'file',1,'dashboard/edit','Edit','fa fa-circle-o','','','',0,NULL,'',1491635035,1491635035,134,'normal'); insert into `fa_auth_rule`(`id`,`type`,`pid`,`name`,`title`,`icon`,`url`,`condition`,`remark`,`ismenu`,`menutype`,`extend`,`createtime`,`updatetime`,`weigh`,`status`) values (17,'file',1,'dashboard/multi','Multi','fa fa-circle-o','','','',0,NULL,'',1491635035,1491635035,132,'normal'); insert into `fa_auth_rule`(`id`,`type`,`pid`,`name`,`title`,`icon`,`url`,`condition`,`remark`,`ismenu`,`menutype`,`extend`,`createtime`,`updatetime`,`weigh`,`status`) values (18,'file',6,'general/config/index','View','fa fa-circle-o','','','',0,NULL,'',1491635035,1491635035,52,'normal'); insert into `fa_auth_rule`(`id`,`type`,`pid`,`name`,`title`,`icon`,`url`,`condition`,`remark`,`ismenu`,`menutype`,`extend`,`createtime`,`updatetime`,`weigh`,`status`) values (19,'file',6,'general/config/add','Add','fa fa-circle-o','','','',0,NULL,'',1491635035,1491635035,51,'normal'); insert into `fa_auth_rule`(`id`,`type`,`pid`,`name`,`title`,`icon`,`url`,`condition`,`remark`,`ismenu`,`menutype`,`extend`,`createtime`,`updatetime`,`weigh`,`status`) values (20,'file',6,'general/config/edit','Edit','fa fa-circle-o','','','',0,NULL,'',1491635035,1491635035,50,'normal'); insert into `fa_auth_rule`(`id`,`type`,`pid`,`name`,`title`,`icon`,`url`,`condition`,`remark`,`ismenu`,`menutype`,`extend`,`createtime`,`updatetime`,`weigh`,`status`) values (21,'file',6,'general/config/del','Delete','fa fa-circle-o','','','',0,NULL,'',1491635035,1491635035,49,'normal'); insert into `fa_auth_rule`(`id`,`type`,`pid`,`name`,`title`,`icon`,`url`,`condition`,`remark`,`ismenu`,`menutype`,`extend`,`createtime`,`updatetime`,`weigh`,`status`) values (22,'file',6,'general/config/multi','Multi','fa fa-circle-o','','','',0,NULL,'',1491635035,1491635035,48,'normal'); insert into `fa_auth_rule`(`id`,`type`,`pid`,`name`,`title`,`icon`,`url`,`condition`,`remark`,`ismenu`,`menutype`,`extend`,`createtime`,`updatetime`,`weigh`,`status`) values (23,'file',7,'general/attachment/index','View','fa fa-circle-o','','','Attachment tips',0,NULL,'',1491635035,1491635035,59,'normal'); insert into `fa_auth_rule`(`id`,`type`,`pid`,`name`,`title`,`icon`,`url`,`condition`,`remark`,`ismenu`,`menutype`,`extend`,`createtime`,`updatetime`,`weigh`,`status`) values (24,'file',7,'general/attachment/select','Select attachment','fa fa-circle-o','','','',0,NULL,'',1491635035,1491635035,58,'normal'); insert into `fa_auth_rule`(`id`,`type`,`pid`,`name`,`title`,`icon`,`url`,`condition`,`remark`,`ismenu`,`menutype`,`extend`,`createtime`,`updatetime`,`weigh`,`status`) values (25,'file',7,'general/attachment/add','Add','fa fa-circle-o','','','',0,NULL,'',1491635035,1491635035,57,'normal'); insert into `fa_auth_rule`(`id`,`type`,`pid`,`name`,`title`,`icon`,`url`,`condition`,`remark`,`ismenu`,`menutype`,`extend`,`createtime`,`updatetime`,`weigh`,`status`) values (26,'file',7,'general/attachment/edit','Edit','fa fa-circle-o','','','',0,NULL,'',1491635035,1491635035,56,'normal'); insert into `fa_auth_rule`(`id`,`type`,`pid`,`name`,`title`,`icon`,`url`,`condition`,`remark`,`ismenu`,`menutype`,`extend`,`createtime`,`updatetime`,`weigh`,`status`) values (27,'file',7,'general/attachment/del','Delete','fa fa-circle-o','','','',0,NULL,'',1491635035,1491635035,55,'normal'); insert into `fa_auth_rule`(`id`,`type`,`pid`,`name`,`title`,`icon`,`url`,`condition`,`remark`,`ismenu`,`menutype`,`extend`,`createtime`,`updatetime`,`weigh`,`status`) values (28,'file',7,'general/attachment/multi','Multi','fa fa-circle-o','','','',0,NULL,'',1491635035,1491635035,54,'normal'); insert into `fa_auth_rule`(`id`,`type`,`pid`,`name`,`title`,`icon`,`url`,`condition`,`remark`,`ismenu`,`menutype`,`extend`,`createtime`,`updatetime`,`weigh`,`status`) values (29,'file',8,'general/profile/index','View','fa fa-circle-o','','','',0,NULL,'',1491635035,1491635035,33,'normal'); insert into `fa_auth_rule`(`id`,`type`,`pid`,`name`,`title`,`icon`,`url`,`condition`,`remark`,`ismenu`,`menutype`,`extend`,`createtime`,`updatetime`,`weigh`,`status`) values (30,'file',8,'general/profile/update','Update profile','fa fa-circle-o','','','',0,NULL,'',1491635035,1491635035,32,'normal'); insert into `fa_auth_rule`(`id`,`type`,`pid`,`name`,`title`,`icon`,`url`,`condition`,`remark`,`ismenu`,`menutype`,`extend`,`createtime`,`updatetime`,`weigh`,`status`) values (31,'file',8,'general/profile/add','Add','fa fa-circle-o','','','',0,NULL,'',1491635035,1491635035,31,'normal'); insert into `fa_auth_rule`(`id`,`type`,`pid`,`name`,`title`,`icon`,`url`,`condition`,`remark`,`ismenu`,`menutype`,`extend`,`createtime`,`updatetime`,`weigh`,`status`) values (32,'file',8,'general/profile/edit','Edit','fa fa-circle-o','','','',0,NULL,'',1491635035,1491635035,30,'normal'); insert into `fa_auth_rule`(`id`,`type`,`pid`,`name`,`title`,`icon`,`url`,`condition`,`remark`,`ismenu`,`menutype`,`extend`,`createtime`,`updatetime`,`weigh`,`status`) values (33,'file',8,'general/profile/del','Delete','fa fa-circle-o','','','',0,NULL,'',1491635035,1491635035,29,'normal'); insert into `fa_auth_rule`(`id`,`type`,`pid`,`name`,`title`,`icon`,`url`,`condition`,`remark`,`ismenu`,`menutype`,`extend`,`createtime`,`updatetime`,`weigh`,`status`) values (34,'file',8,'general/profile/multi','Multi','fa fa-circle-o','','','',0,NULL,'',1491635035,1491635035,28,'normal'); insert into `fa_auth_rule`(`id`,`type`,`pid`,`name`,`title`,`icon`,`url`,`condition`,`remark`,`ismenu`,`menutype`,`extend`,`createtime`,`updatetime`,`weigh`,`status`) values (35,'file',3,'category/index','View','fa fa-circle-o','','','Category tips',0,NULL,'',1491635035,1491635035,142,'normal'); insert into `fa_auth_rule`(`id`,`type`,`pid`,`name`,`title`,`icon`,`url`,`condition`,`remark`,`ismenu`,`menutype`,`extend`,`createtime`,`updatetime`,`weigh`,`status`) values (36,'file',3,'category/add','Add','fa fa-circle-o','','','',0,NULL,'',1491635035,1491635035,141,'normal'); insert into `fa_auth_rule`(`id`,`type`,`pid`,`name`,`title`,`icon`,`url`,`condition`,`remark`,`ismenu`,`menutype`,`extend`,`createtime`,`updatetime`,`weigh`,`status`) values (37,'file',3,'category/edit','Edit','fa fa-circle-o','','','',0,NULL,'',1491635035,1491635035,140,'normal'); insert into `fa_auth_rule`(`id`,`type`,`pid`,`name`,`title`,`icon`,`url`,`condition`,`remark`,`ismenu`,`menutype`,`extend`,`createtime`,`updatetime`,`weigh`,`status`) values (38,'file',3,'category/del','Delete','fa fa-circle-o','','','',0,NULL,'',1491635035,1491635035,139,'normal'); insert into `fa_auth_rule`(`id`,`type`,`pid`,`name`,`title`,`icon`,`url`,`condition`,`remark`,`ismenu`,`menutype`,`extend`,`createtime`,`updatetime`,`weigh`,`status`) values (39,'file',3,'category/multi','Multi','fa fa-circle-o','','','',0,NULL,'',1491635035,1491635035,138,'normal'); insert into `fa_auth_rule`(`id`,`type`,`pid`,`name`,`title`,`icon`,`url`,`condition`,`remark`,`ismenu`,`menutype`,`extend`,`createtime`,`updatetime`,`weigh`,`status`) values (40,'file',9,'auth/admin/index','View','fa fa-circle-o','','','Admin tips',0,NULL,'',1491635035,1491635035,117,'normal'); insert into `fa_auth_rule`(`id`,`type`,`pid`,`name`,`title`,`icon`,`url`,`condition`,`remark`,`ismenu`,`menutype`,`extend`,`createtime`,`updatetime`,`weigh`,`status`) values (41,'file',9,'auth/admin/add','Add','fa fa-circle-o','','','',0,NULL,'',1491635035,1491635035,116,'normal'); insert into `fa_auth_rule`(`id`,`type`,`pid`,`name`,`title`,`icon`,`url`,`condition`,`remark`,`ismenu`,`menutype`,`extend`,`createtime`,`updatetime`,`weigh`,`status`) values (42,'file',9,'auth/admin/edit','Edit','fa fa-circle-o','','','',0,NULL,'',1491635035,1491635035,115,'normal'); insert into `fa_auth_rule`(`id`,`type`,`pid`,`name`,`title`,`icon`,`url`,`condition`,`remark`,`ismenu`,`menutype`,`extend`,`createtime`,`updatetime`,`weigh`,`status`) values (43,'file',9,'auth/admin/del','Delete','fa fa-circle-o','','','',0,NULL,'',1491635035,1491635035,114,'normal'); insert into `fa_auth_rule`(`id`,`type`,`pid`,`name`,`title`,`icon`,`url`,`condition`,`remark`,`ismenu`,`menutype`,`extend`,`createtime`,`updatetime`,`weigh`,`status`) values (44,'file',10,'auth/adminlog/index','View','fa fa-circle-o','','','Admin log tips',0,NULL,'',1491635035,1491635035,112,'normal'); insert into `fa_auth_rule`(`id`,`type`,`pid`,`name`,`title`,`icon`,`url`,`condition`,`remark`,`ismenu`,`menutype`,`extend`,`createtime`,`updatetime`,`weigh`,`status`) values (45,'file',10,'auth/adminlog/detail','Detail','fa fa-circle-o','','','',0,NULL,'',1491635035,1491635035,111,'normal'); insert into `fa_auth_rule`(`id`,`type`,`pid`,`name`,`title`,`icon`,`url`,`condition`,`remark`,`ismenu`,`menutype`,`extend`,`createtime`,`updatetime`,`weigh`,`status`) values (46,'file',10,'auth/adminlog/del','Delete','fa fa-circle-o','','','',0,NULL,'',1491635035,1491635035,110,'normal'); insert into `fa_auth_rule`(`id`,`type`,`pid`,`name`,`title`,`icon`,`url`,`condition`,`remark`,`ismenu`,`menutype`,`extend`,`createtime`,`updatetime`,`weigh`,`status`) values (47,'file',11,'auth/group/index','View','fa fa-circle-o','','','Group tips',0,NULL,'',1491635035,1491635035,108,'normal'); insert into `fa_auth_rule`(`id`,`type`,`pid`,`name`,`title`,`icon`,`url`,`condition`,`remark`,`ismenu`,`menutype`,`extend`,`createtime`,`updatetime`,`weigh`,`status`) values (48,'file',11,'auth/group/add','Add','fa fa-circle-o','','','',0,NULL,'',1491635035,1491635035,107,'normal'); insert into `fa_auth_rule`(`id`,`type`,`pid`,`name`,`title`,`icon`,`url`,`condition`,`remark`,`ismenu`,`menutype`,`extend`,`createtime`,`updatetime`,`weigh`,`status`) values (49,'file',11,'auth/group/edit','Edit','fa fa-circle-o','','','',0,NULL,'',1491635035,1491635035,106,'normal'); insert into `fa_auth_rule`(`id`,`type`,`pid`,`name`,`title`,`icon`,`url`,`condition`,`remark`,`ismenu`,`menutype`,`extend`,`createtime`,`updatetime`,`weigh`,`status`) values (50,'file',11,'auth/group/del','Delete','fa fa-circle-o','','','',0,NULL,'',1491635035,1491635035,105,'normal'); insert into `fa_auth_rule`(`id`,`type`,`pid`,`name`,`title`,`icon`,`url`,`condition`,`remark`,`ismenu`,`menutype`,`extend`,`createtime`,`updatetime`,`weigh`,`status`) values (51,'file',12,'auth/rule/index','View','fa fa-circle-o','','','Rule tips',0,NULL,'',1491635035,1491635035,103,'normal'); insert into `fa_auth_rule`(`id`,`type`,`pid`,`name`,`title`,`icon`,`url`,`condition`,`remark`,`ismenu`,`menutype`,`extend`,`createtime`,`updatetime`,`weigh`,`status`) values (52,'file',12,'auth/rule/add','Add','fa fa-circle-o','','','',0,NULL,'',1491635035,1491635035,102,'normal'); insert into `fa_auth_rule`(`id`,`type`,`pid`,`name`,`title`,`icon`,`url`,`condition`,`remark`,`ismenu`,`menutype`,`extend`,`createtime`,`updatetime`,`weigh`,`status`) values (53,'file',12,'auth/rule/edit','Edit','fa fa-circle-o','','','',0,NULL,'',1491635035,1491635035,101,'normal'); insert into `fa_auth_rule`(`id`,`type`,`pid`,`name`,`title`,`icon`,`url`,`condition`,`remark`,`ismenu`,`menutype`,`extend`,`createtime`,`updatetime`,`weigh`,`status`) values (54,'file',12,'auth/rule/del','Delete','fa fa-circle-o','','','',0,NULL,'',1491635035,1491635035,100,'normal'); insert into `fa_auth_rule`(`id`,`type`,`pid`,`name`,`title`,`icon`,`url`,`condition`,`remark`,`ismenu`,`menutype`,`extend`,`createtime`,`updatetime`,`weigh`,`status`) values (55,'file',4,'addon/index','View','fa fa-circle-o','','','Addon tips',0,NULL,'',1491635035,1491635035,0,'normal'); insert into `fa_auth_rule`(`id`,`type`,`pid`,`name`,`title`,`icon`,`url`,`condition`,`remark`,`ismenu`,`menutype`,`extend`,`createtime`,`updatetime`,`weigh`,`status`) values (56,'file',4,'addon/add','Add','fa fa-circle-o','','','',0,NULL,'',1491635035,1491635035,0,'normal'); insert into `fa_auth_rule`(`id`,`type`,`pid`,`name`,`title`,`icon`,`url`,`condition`,`remark`,`ismenu`,`menutype`,`extend`,`createtime`,`updatetime`,`weigh`,`status`) values (57,'file',4,'addon/edit','Edit','fa fa-circle-o','','','',0,NULL,'',1491635035,1491635035,0,'normal'); insert into `fa_auth_rule`(`id`,`type`,`pid`,`name`,`title`,`icon`,`url`,`condition`,`remark`,`ismenu`,`menutype`,`extend`,`createtime`,`updatetime`,`weigh`,`status`) values (58,'file',4,'addon/del','Delete','fa fa-circle-o','','','',0,NULL,'',1491635035,1491635035,0,'normal'); insert into `fa_auth_rule`(`id`,`type`,`pid`,`name`,`title`,`icon`,`url`,`condition`,`remark`,`ismenu`,`menutype`,`extend`,`createtime`,`updatetime`,`weigh`,`status`) values (59,'file',4,'addon/downloaded','Local addon','fa fa-circle-o','','','',0,NULL,'',1491635035,1491635035,0,'normal'); insert into `fa_auth_rule`(`id`,`type`,`pid`,`name`,`title`,`icon`,`url`,`condition`,`remark`,`ismenu`,`menutype`,`extend`,`createtime`,`updatetime`,`weigh`,`status`) values (60,'file',4,'addon/state','Update state','fa fa-circle-o','','','',0,NULL,'',1491635035,1491635035,0,'normal'); insert into `fa_auth_rule`(`id`,`type`,`pid`,`name`,`title`,`icon`,`url`,`condition`,`remark`,`ismenu`,`menutype`,`extend`,`createtime`,`updatetime`,`weigh`,`status`) values (63,'file',4,'addon/config','Setting','fa fa-circle-o','','','',0,NULL,'',1491635035,1491635035,0,'normal'); insert into `fa_auth_rule`(`id`,`type`,`pid`,`name`,`title`,`icon`,`url`,`condition`,`remark`,`ismenu`,`menutype`,`extend`,`createtime`,`updatetime`,`weigh`,`status`) values (64,'file',4,'addon/refresh','Refresh','fa fa-circle-o','','','',0,NULL,'',1491635035,1491635035,0,'normal'); insert into `fa_auth_rule`(`id`,`type`,`pid`,`name`,`title`,`icon`,`url`,`condition`,`remark`,`ismenu`,`menutype`,`extend`,`createtime`,`updatetime`,`weigh`,`status`) values (65,'file',4,'addon/multi','Multi','fa fa-circle-o','','','',0,NULL,'',1491635035,1491635035,0,'normal'); insert into `fa_auth_rule`(`id`,`type`,`pid`,`name`,`title`,`icon`,`url`,`condition`,`remark`,`ismenu`,`menutype`,`extend`,`createtime`,`updatetime`,`weigh`,`status`) values (66,'file',0,'user','User','fa fa-list','','','',1,NULL,'',1491635035,1491635035,0,'normal'); insert into `fa_auth_rule`(`id`,`type`,`pid`,`name`,`title`,`icon`,`url`,`condition`,`remark`,`ismenu`,`menutype`,`extend`,`createtime`,`updatetime`,`weigh`,`status`) values (67,'file',66,'user/user','User','fa fa-user','','','',1,NULL,'',1491635035,1491635035,0,'normal'); insert into `fa_auth_rule`(`id`,`type`,`pid`,`name`,`title`,`icon`,`url`,`condition`,`remark`,`ismenu`,`menutype`,`extend`,`createtime`,`updatetime`,`weigh`,`status`) values (68,'file',67,'user/user/index','View','fa fa-circle-o','','','',0,NULL,'',1491635035,1491635035,0,'normal'); insert into `fa_auth_rule`(`id`,`type`,`pid`,`name`,`title`,`icon`,`url`,`condition`,`remark`,`ismenu`,`menutype`,`extend`,`createtime`,`updatetime`,`weigh`,`status`) values (69,'file',67,'user/user/edit','Edit','fa fa-circle-o','','','',0,NULL,'',1491635035,1491635035,0,'normal'); insert into `fa_auth_rule`(`id`,`type`,`pid`,`name`,`title`,`icon`,`url`,`condition`,`remark`,`ismenu`,`menutype`,`extend`,`createtime`,`updatetime`,`weigh`,`status`) values (70,'file',67,'user/user/add','Add','fa fa-circle-o','','','',0,NULL,'',1491635035,1491635035,0,'normal'); insert into `fa_auth_rule`(`id`,`type`,`pid`,`name`,`title`,`icon`,`url`,`condition`,`remark`,`ismenu`,`menutype`,`extend`,`createtime`,`updatetime`,`weigh`,`status`) values (71,'file',67,'user/user/del','Del','fa fa-circle-o','','','',0,NULL,'',1491635035,1491635035,0,'normal'); insert into `fa_auth_rule`(`id`,`type`,`pid`,`name`,`title`,`icon`,`url`,`condition`,`remark`,`ismenu`,`menutype`,`extend`,`createtime`,`updatetime`,`weigh`,`status`) values (72,'file',67,'user/user/multi','Multi','fa fa-circle-o','','','',0,NULL,'',1491635035,1491635035,0,'normal'); insert into `fa_auth_rule`(`id`,`type`,`pid`,`name`,`title`,`icon`,`url`,`condition`,`remark`,`ismenu`,`menutype`,`extend`,`createtime`,`updatetime`,`weigh`,`status`) values (73,'file',66,'user/group','User group','fa fa-users','','','',1,NULL,'',1491635035,1491635035,0,'normal'); insert into `fa_auth_rule`(`id`,`type`,`pid`,`name`,`title`,`icon`,`url`,`condition`,`remark`,`ismenu`,`menutype`,`extend`,`createtime`,`updatetime`,`weigh`,`status`) values (74,'file',73,'user/group/add','Add','fa fa-circle-o','','','',0,NULL,'',1491635035,1491635035,0,'normal'); insert into `fa_auth_rule`(`id`,`type`,`pid`,`name`,`title`,`icon`,`url`,`condition`,`remark`,`ismenu`,`menutype`,`extend`,`createtime`,`updatetime`,`weigh`,`status`) values (75,'file',73,'user/group/edit','Edit','fa fa-circle-o','','','',0,NULL,'',1491635035,1491635035,0,'normal'); insert into `fa_auth_rule`(`id`,`type`,`pid`,`name`,`title`,`icon`,`url`,`condition`,`remark`,`ismenu`,`menutype`,`extend`,`createtime`,`updatetime`,`weigh`,`status`) values (76,'file',73,'user/group/index','View','fa fa-circle-o','','','',0,NULL,'',1491635035,1491635035,0,'normal'); insert into `fa_auth_rule`(`id`,`type`,`pid`,`name`,`title`,`icon`,`url`,`condition`,`remark`,`ismenu`,`menutype`,`extend`,`createtime`,`updatetime`,`weigh`,`status`) values (77,'file',73,'user/group/del','Del','fa fa-circle-o','','','',0,NULL,'',1491635035,1491635035,0,'normal'); insert into `fa_auth_rule`(`id`,`type`,`pid`,`name`,`title`,`icon`,`url`,`condition`,`remark`,`ismenu`,`menutype`,`extend`,`createtime`,`updatetime`,`weigh`,`status`) values (78,'file',73,'user/group/multi','Multi','fa fa-circle-o','','','',0,NULL,'',1491635035,1491635035,0,'normal'); insert into `fa_auth_rule`(`id`,`type`,`pid`,`name`,`title`,`icon`,`url`,`condition`,`remark`,`ismenu`,`menutype`,`extend`,`createtime`,`updatetime`,`weigh`,`status`) values (79,'file',66,'user/rule','User rule','fa fa-circle-o','','','',1,NULL,'',1491635035,1491635035,0,'normal'); insert into `fa_auth_rule`(`id`,`type`,`pid`,`name`,`title`,`icon`,`url`,`condition`,`remark`,`ismenu`,`menutype`,`extend`,`createtime`,`updatetime`,`weigh`,`status`) values (80,'file',79,'user/rule/index','View','fa fa-circle-o','','','',0,NULL,'',1491635035,1491635035,0,'normal'); insert into `fa_auth_rule`(`id`,`type`,`pid`,`name`,`title`,`icon`,`url`,`condition`,`remark`,`ismenu`,`menutype`,`extend`,`createtime`,`updatetime`,`weigh`,`status`) values (81,'file',79,'user/rule/del','Del','fa fa-circle-o','','','',0,NULL,'',1491635035,1491635035,0,'normal'); insert into `fa_auth_rule`(`id`,`type`,`pid`,`name`,`title`,`icon`,`url`,`condition`,`remark`,`ismenu`,`menutype`,`extend`,`createtime`,`updatetime`,`weigh`,`status`) values (82,'file',79,'user/rule/add','Add','fa fa-circle-o','','','',0,NULL,'',1491635035,1491635035,0,'normal'); insert into `fa_auth_rule`(`id`,`type`,`pid`,`name`,`title`,`icon`,`url`,`condition`,`remark`,`ismenu`,`menutype`,`extend`,`createtime`,`updatetime`,`weigh`,`status`) values (83,'file',79,'user/rule/edit','Edit','fa fa-circle-o','','','',0,NULL,'',1491635035,1491635035,0,'normal'); insert into `fa_auth_rule`(`id`,`type`,`pid`,`name`,`title`,`icon`,`url`,`condition`,`remark`,`ismenu`,`menutype`,`extend`,`createtime`,`updatetime`,`weigh`,`status`) values (84,'file',79,'user/rule/multi','Multi','fa fa-circle-o','','','',0,NULL,'',1491635035,1491635035,0,'normal'); /*Table structure for table `fa_category` */ DROP TABLE IF EXISTS `fa_category`; CREATE TABLE `fa_category` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `pid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '父ID', `type` varchar(30) COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '栏目类型', `name` varchar(30) COLLATE utf8mb4_unicode_ci DEFAULT '', `nickname` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT '', `flag` set('hot','index','recommend') COLLATE utf8mb4_unicode_ci DEFAULT '', `image` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '图片', `keywords` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '关键字', `description` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '描述', `diyname` varchar(30) COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '自定义名称', `createtime` int(10) DEFAULT NULL COMMENT '创建时间', `updatetime` int(10) DEFAULT NULL COMMENT '更新时间', `weigh` int(10) NOT NULL DEFAULT '0' COMMENT '权重', `status` varchar(30) COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '状态', PRIMARY KEY (`id`), KEY `weigh` (`weigh`,`id`), KEY `pid` (`pid`) ) ENGINE=InnoDB AUTO_INCREMENT=14 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='分类表'; /*Data for the table `fa_category` */ insert into `fa_category`(`id`,`pid`,`type`,`name`,`nickname`,`flag`,`image`,`keywords`,`description`,`diyname`,`createtime`,`updatetime`,`weigh`,`status`) values (1,0,'page','官方新闻','news','recommend','/assets/img/qrcode.png','','','news',1491635035,1491635035,1,'normal'); insert into `fa_category`(`id`,`pid`,`type`,`name`,`nickname`,`flag`,`image`,`keywords`,`description`,`diyname`,`createtime`,`updatetime`,`weigh`,`status`) values (2,0,'page','移动应用','mobileapp','hot','/assets/img/qrcode.png','','','mobileapp',1491635035,1491635035,2,'normal'); insert into `fa_category`(`id`,`pid`,`type`,`name`,`nickname`,`flag`,`image`,`keywords`,`description`,`diyname`,`createtime`,`updatetime`,`weigh`,`status`) values (3,2,'page','微信公众号','wechatpublic','index','/assets/img/qrcode.png','','','wechatpublic',1491635035,1491635035,3,'normal'); insert into `fa_category`(`id`,`pid`,`type`,`name`,`nickname`,`flag`,`image`,`keywords`,`description`,`diyname`,`createtime`,`updatetime`,`weigh`,`status`) values (4,2,'page','Android开发','android','recommend','/assets/img/qrcode.png','','','android',1491635035,1491635035,4,'normal'); insert into `fa_category`(`id`,`pid`,`type`,`name`,`nickname`,`flag`,`image`,`keywords`,`description`,`diyname`,`createtime`,`updatetime`,`weigh`,`status`) values (5,0,'page','软件产品','software','recommend','/assets/img/qrcode.png','','','software',1491635035,1491635035,5,'normal'); insert into `fa_category`(`id`,`pid`,`type`,`name`,`nickname`,`flag`,`image`,`keywords`,`description`,`diyname`,`createtime`,`updatetime`,`weigh`,`status`) values (6,5,'page','网站建站','website','recommend','/assets/img/qrcode.png','','','website',1491635035,1491635035,6,'normal'); insert into `fa_category`(`id`,`pid`,`type`,`name`,`nickname`,`flag`,`image`,`keywords`,`description`,`diyname`,`createtime`,`updatetime`,`weigh`,`status`) values (7,5,'page','企业管理软件','company','index','/assets/img/qrcode.png','','','company',1491635035,1491635035,7,'normal'); insert into `fa_category`(`id`,`pid`,`type`,`name`,`nickname`,`flag`,`image`,`keywords`,`description`,`diyname`,`createtime`,`updatetime`,`weigh`,`status`) values (8,6,'page','PC端','website-pc','recommend','/assets/img/qrcode.png','','','website-pc',1491635035,1491635035,8,'normal'); insert into `fa_category`(`id`,`pid`,`type`,`name`,`nickname`,`flag`,`image`,`keywords`,`description`,`diyname`,`createtime`,`updatetime`,`weigh`,`status`) values (9,6,'page','移动端','website-mobile','recommend','/assets/img/qrcode.png','','','website-mobile',1491635035,1491635035,9,'normal'); insert into `fa_category`(`id`,`pid`,`type`,`name`,`nickname`,`flag`,`image`,`keywords`,`description`,`diyname`,`createtime`,`updatetime`,`weigh`,`status`) values (10,7,'page','CRM系统 ','company-crm','recommend','/assets/img/qrcode.png','','','company-crm',1491635035,1491635035,10,'normal'); insert into `fa_category`(`id`,`pid`,`type`,`name`,`nickname`,`flag`,`image`,`keywords`,`description`,`diyname`,`createtime`,`updatetime`,`weigh`,`status`) values (11,7,'page','SASS平台软件','company-sass','recommend','/assets/img/qrcode.png','','','company-sass',1491635035,1491635035,11,'normal'); insert into `fa_category`(`id`,`pid`,`type`,`name`,`nickname`,`flag`,`image`,`keywords`,`description`,`diyname`,`createtime`,`updatetime`,`weigh`,`status`) values (12,0,'test','测试1','test1','recommend','/assets/img/qrcode.png','','','test1',1491635035,1491635035,12,'normal'); insert into `fa_category`(`id`,`pid`,`type`,`name`,`nickname`,`flag`,`image`,`keywords`,`description`,`diyname`,`createtime`,`updatetime`,`weigh`,`status`) values (13,0,'test','测试2','test2','recommend','/assets/img/qrcode.png','','','test2',1491635035,1491635035,13,'normal'); /*Table structure for table `fa_config` */ DROP TABLE IF EXISTS `fa_config`; CREATE TABLE `fa_config` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(30) COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '变量名', `group` varchar(30) COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '分组', `title` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '变量标题', `tip` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '变量描述', `type` varchar(30) COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '类型:string,text,int,bool,array,datetime,date,file', `value` text COLLATE utf8mb4_unicode_ci COMMENT '变量值', `content` text COLLATE utf8mb4_unicode_ci COMMENT '变量字典数据', `rule` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '验证规则', `extend` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '扩展属性', `setting` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '配置', PRIMARY KEY (`id`), UNIQUE KEY `name` (`name`) ) ENGINE=InnoDB AUTO_INCREMENT=18 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='系统配置'; /*Data for the table `fa_config` */ insert into `fa_config`(`id`,`name`,`group`,`title`,`tip`,`type`,`value`,`content`,`rule`,`extend`,`setting`) values (1,'name','basic','Site name','请填写站点名称','string','我的网站','','required','',''); insert into `fa_config`(`id`,`name`,`group`,`title`,`tip`,`type`,`value`,`content`,`rule`,`extend`,`setting`) values (2,'beian','basic','Beian','粤ICP备15000000号-1','string','','','','',''); insert into `fa_config`(`id`,`name`,`group`,`title`,`tip`,`type`,`value`,`content`,`rule`,`extend`,`setting`) values (3,'cdnurl','basic','Cdn url','如果全站静态资源使用第三方云储存请配置该值','string','','','','',''); insert into `fa_config`(`id`,`name`,`group`,`title`,`tip`,`type`,`value`,`content`,`rule`,`extend`,`setting`) values (4,'version','basic','Version','如果静态资源有变动请重新配置该值','string','1.0.1','','required','',''); insert into `fa_config`(`id`,`name`,`group`,`title`,`tip`,`type`,`value`,`content`,`rule`,`extend`,`setting`) values (5,'timezone','basic','Timezone','','string','Asia/Shanghai','','required','',''); insert into `fa_config`(`id`,`name`,`group`,`title`,`tip`,`type`,`value`,`content`,`rule`,`extend`,`setting`) values (6,'forbiddenip','basic','Forbidden ip','一行一条记录','text','','','','',''); insert into `fa_config`(`id`,`name`,`group`,`title`,`tip`,`type`,`value`,`content`,`rule`,`extend`,`setting`) values (7,'languages','basic','Languages','','array','{\"backend\":\"zh-cn\",\"frontend\":\"zh-cn\"}','','required','',''); insert into `fa_config`(`id`,`name`,`group`,`title`,`tip`,`type`,`value`,`content`,`rule`,`extend`,`setting`) values (8,'fixedpage','basic','Fixed page','请尽量输入左侧菜单栏存在的链接','string','dashboard','','required','',''); insert into `fa_config`(`id`,`name`,`group`,`title`,`tip`,`type`,`value`,`content`,`rule`,`extend`,`setting`) values (9,'categorytype','dictionary','Category type','','array','{\"default\":\"Default\",\"page\":\"Page\",\"article\":\"Article\",\"test\":\"Test\"}','','','',''); insert into `fa_config`(`id`,`name`,`group`,`title`,`tip`,`type`,`value`,`content`,`rule`,`extend`,`setting`) values (10,'configgroup','dictionary','Config group','','array','{\"basic\":\"Basic\",\"email\":\"Email\",\"dictionary\":\"Dictionary\",\"user\":\"User\",\"example\":\"Example\"}','','','',''); insert into `fa_config`(`id`,`name`,`group`,`title`,`tip`,`type`,`value`,`content`,`rule`,`extend`,`setting`) values (11,'mail_type','email','Mail type','选择邮件发送方式','select','1','[\"请选择\",\"SMTP\"]','','',''); insert into `fa_config`(`id`,`name`,`group`,`title`,`tip`,`type`,`value`,`content`,`rule`,`extend`,`setting`) values (12,'mail_smtp_host','email','Mail smtp host','错误的配置发送邮件会导致服务器超时','string','smtp.qq.com','','','',''); insert into `fa_config`(`id`,`name`,`group`,`title`,`tip`,`type`,`value`,`content`,`rule`,`extend`,`setting`) values (13,'mail_smtp_port','email','Mail smtp port','(不加密默认25,SSL默认465,TLS默认587)','string','465','','','',''); insert into `fa_config`(`id`,`name`,`group`,`title`,`tip`,`type`,`value`,`content`,`rule`,`extend`,`setting`) values (14,'mail_smtp_user','email','Mail smtp user','(填写完整用户名)','string','10000','','','',''); insert into `fa_config`(`id`,`name`,`group`,`title`,`tip`,`type`,`value`,`content`,`rule`,`extend`,`setting`) values (15,'mail_smtp_pass','email','Mail smtp password','(填写您的密码或授权码)','string','password','','','',''); insert into `fa_config`(`id`,`name`,`group`,`title`,`tip`,`type`,`value`,`content`,`rule`,`extend`,`setting`) values (16,'mail_verify_type','email','Mail vertify type','(SMTP验证方式[推荐SSL])','select','2','[\"无\",\"TLS\",\"SSL\"]','','',''); insert into `fa_config`(`id`,`name`,`group`,`title`,`tip`,`type`,`value`,`content`,`rule`,`extend`,`setting`) values (17,'mail_from','email','Mail from','','string','10000@qq.com','','','',''); /*Table structure for table `fa_ems` */ DROP TABLE IF EXISTS `fa_ems`; CREATE TABLE `fa_ems` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'ID', `event` varchar(30) COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '事件', `email` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '邮箱', `code` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '验证码', `times` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '验证次数', `ip` varchar(30) COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT 'IP', `createtime` int(10) DEFAULT NULL COMMENT '创建时间', PRIMARY KEY (`id`) USING BTREE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='邮箱验证码表'; /*Data for the table `fa_ems` */ /*Table structure for table `fa_sms` */ DROP TABLE IF EXISTS `fa_sms`; CREATE TABLE `fa_sms` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'ID', `event` varchar(30) COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '事件', `mobile` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '手机号', `code` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '验证码', `times` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '验证次数', `ip` varchar(30) COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT 'IP', `createtime` int(10) unsigned DEFAULT '0' COMMENT '创建时间', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='短信验证码表'; /*Data for the table `fa_sms` */ /*Table structure for table `fa_test` */ DROP TABLE IF EXISTS `fa_test`; CREATE TABLE `fa_test` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'ID', `admin_id` int(10) NOT NULL DEFAULT '0' COMMENT '管理员ID', `category_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '分类ID(单选)', `category_ids` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '分类ID(多选)', `week` enum('monday','tuesday','wednesday') COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '星期(单选):monday=星期一,tuesday=星期二,wednesday=星期三', `flag` set('hot','index','recommend') COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '标志(多选):hot=热门,index=首页,recommend=推荐', `genderdata` enum('male','female') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'male' COMMENT '性别(单选):male=男,female=女', `hobbydata` set('music','reading','swimming') COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '爱好(多选):music=音乐,reading=读书,swimming=游泳', `title` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '标题', `content` text COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '内容', `image` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '图片', `images` varchar(1500) COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '图片组', `attachfile` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '附件', `keywords` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '关键字', `description` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '描述', `city` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '省市', `json` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '配置:key=名称,value=值', `price` float(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '价格', `views` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '点击', `startdate` date DEFAULT NULL COMMENT '开始日期', `activitytime` datetime DEFAULT NULL COMMENT '活动时间(datetime)', `year` year(4) DEFAULT NULL COMMENT '年', `times` time DEFAULT NULL COMMENT '时间', `refreshtime` int(10) DEFAULT NULL COMMENT '刷新时间(int)', `createtime` int(10) DEFAULT NULL COMMENT '创建时间', `updatetime` int(10) DEFAULT NULL COMMENT '更新时间', `deletetime` int(10) DEFAULT NULL COMMENT '删除时间', `weigh` int(10) NOT NULL DEFAULT '0' COMMENT '权重', `switch` tinyint(1) NOT NULL DEFAULT '0' COMMENT '开关', `status` enum('normal','hidden') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'normal' COMMENT '状态', `state` enum('0','1','2') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '1' COMMENT '状态值:0=禁用,1=正常,2=推荐', PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='测试表'; /*Data for the table `fa_test` */ insert into `fa_test`(`id`,`admin_id`,`category_id`,`category_ids`,`week`,`flag`,`genderdata`,`hobbydata`,`title`,`content`,`image`,`images`,`attachfile`,`keywords`,`description`,`city`,`json`,`price`,`views`,`startdate`,`activitytime`,`year`,`times`,`refreshtime`,`createtime`,`updatetime`,`deletetime`,`weigh`,`switch`,`status`,`state`) values (1,0,12,'12,13','monday','hot,index','male','music,reading','我是一篇测试文章','<p>我是测试内容</p>','/assets/img/avatar.png','/assets/img/avatar.png,/assets/img/qrcode.png','/assets/img/avatar.png','关键字','描述','广西壮族自治区/百色市/平果县','{\"a\":\"1\",\"b\":\"2\"}',0.00,0,'2017-07-10','2017-07-10 18:24:45',2017,'18:24:45',1491635035,1491635035,1491635035,NULL,0,1,'normal','1'); /*Table structure for table `fa_user` */ DROP TABLE IF EXISTS `fa_user`; CREATE TABLE `fa_user` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'ID', `group_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '组别ID', `username` varchar(32) COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '用户名', `nickname` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '昵称', `password` varchar(32) COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '密码', `salt` varchar(30) COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '密码盐', `email` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '电子邮箱', `mobile` varchar(11) COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '手机号', `avatar` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '头像', `level` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '等级', `gender` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '性别', `birthday` date DEFAULT NULL COMMENT '生日', `bio` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '格言', `money` decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT '余额', `score` int(10) NOT NULL DEFAULT '0' COMMENT '积分', `successions` int(10) unsigned NOT NULL DEFAULT '1' COMMENT '连续登录天数', `maxsuccessions` int(10) unsigned NOT NULL DEFAULT '1' COMMENT '最大连续登录天数', `prevtime` int(10) DEFAULT NULL COMMENT '上次登录时间', `logintime` int(10) DEFAULT NULL COMMENT '登录时间', `loginip` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '登录IP', `loginfailure` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '失败次数', `joinip` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '加入IP', `jointime` int(10) DEFAULT NULL COMMENT '加入时间', `createtime` int(10) DEFAULT NULL COMMENT '创建时间', `updatetime` int(10) DEFAULT NULL COMMENT '更新时间', `token` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT 'Token', `status` varchar(30) COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '状态', `verification` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '验证', PRIMARY KEY (`id`), KEY `username` (`username`), KEY `email` (`email`), KEY `mobile` (`mobile`) ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='会员表'; /*Data for the table `fa_user` */ insert into `fa_user`(`id`,`group_id`,`username`,`nickname`,`password`,`salt`,`email`,`mobile`,`avatar`,`level`,`gender`,`birthday`,`bio`,`money`,`score`,`successions`,`maxsuccessions`,`prevtime`,`logintime`,`loginip`,`loginfailure`,`joinip`,`jointime`,`createtime`,`updatetime`,`token`,`status`,`verification`) values (1,1,'admin','admin','53c2750b1d106f9a4ac21f90bd93e371','f1587d','admin@163.com','13888888888','',0,0,'2017-04-08','',0.00,0,1,1,1491635035,1491635035,'127.0.0.1',0,'127.0.0.1',1491635035,0,1491635035,'','normal',''); /*Table structure for table `fa_user_group` */ DROP TABLE IF EXISTS `fa_user_group`; CREATE TABLE `fa_user_group` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '组名', `rules` text COLLATE utf8mb4_unicode_ci COMMENT '权限节点', `createtime` int(10) DEFAULT NULL COMMENT '添加时间', `updatetime` int(10) DEFAULT NULL COMMENT '更新时间', `status` enum('normal','hidden') COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '状态', PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='会员组表'; /*Data for the table `fa_user_group` */ insert into `fa_user_group`(`id`,`name`,`rules`,`createtime`,`updatetime`,`status`) values (1,'默认组','1,2,3,4,5,6,7,8,9,10,11,12',1491635035,1491635035,'normal'); /*Table structure for table `fa_user_money_log` */ DROP TABLE IF EXISTS `fa_user_money_log`; CREATE TABLE `fa_user_money_log` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `user_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '会员ID', `money` decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT '变更余额', `before` decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT '变更前余额', `after` decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT '变更后余额', `memo` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '备注', `createtime` int(10) DEFAULT NULL COMMENT '创建时间', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='会员余额变动表'; /*Data for the table `fa_user_money_log` */ /*Table structure for table `fa_user_rule` */ DROP TABLE IF EXISTS `fa_user_rule`; CREATE TABLE `fa_user_rule` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `pid` int(10) DEFAULT NULL COMMENT '父ID', `name` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '名称', `title` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '标题', `remark` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '备注', `ismenu` tinyint(1) DEFAULT NULL COMMENT '是否菜单', `createtime` int(10) DEFAULT NULL COMMENT '创建时间', `updatetime` int(10) DEFAULT NULL COMMENT '更新时间', `weigh` int(10) DEFAULT '0' COMMENT '权重', `status` enum('normal','hidden') COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '状态', PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='会员规则表'; /*Data for the table `fa_user_rule` */ insert into `fa_user_rule`(`id`,`pid`,`name`,`title`,`remark`,`ismenu`,`createtime`,`updatetime`,`weigh`,`status`) values (1,0,'index','Frontend','',1,1491635035,1491635035,1,'normal'); insert into `fa_user_rule`(`id`,`pid`,`name`,`title`,`remark`,`ismenu`,`createtime`,`updatetime`,`weigh`,`status`) values (2,0,'api','API Interface','',1,1491635035,1491635035,2,'normal'); insert into `fa_user_rule`(`id`,`pid`,`name`,`title`,`remark`,`ismenu`,`createtime`,`updatetime`,`weigh`,`status`) values (3,1,'user','User Module','',1,1491635035,1491635035,12,'normal'); insert into `fa_user_rule`(`id`,`pid`,`name`,`title`,`remark`,`ismenu`,`createtime`,`updatetime`,`weigh`,`status`) values (4,2,'user','User Module','',1,1491635035,1491635035,11,'normal'); insert into `fa_user_rule`(`id`,`pid`,`name`,`title`,`remark`,`ismenu`,`createtime`,`updatetime`,`weigh`,`status`) values (5,3,'index/user/login','Login','',0,1491635035,1491635035,5,'normal'); insert into `fa_user_rule`(`id`,`pid`,`name`,`title`,`remark`,`ismenu`,`createtime`,`updatetime`,`weigh`,`status`) values (6,3,'index/user/register','Register','',0,1491635035,1491635035,7,'normal'); insert into `fa_user_rule`(`id`,`pid`,`name`,`title`,`remark`,`ismenu`,`createtime`,`updatetime`,`weigh`,`status`) values (7,3,'index/user/index','User Center','',0,1491635035,1491635035,9,'normal'); insert into `fa_user_rule`(`id`,`pid`,`name`,`title`,`remark`,`ismenu`,`createtime`,`updatetime`,`weigh`,`status`) values (8,3,'index/user/profile','Profile','',0,1491635035,1491635035,4,'normal'); insert into `fa_user_rule`(`id`,`pid`,`name`,`title`,`remark`,`ismenu`,`createtime`,`updatetime`,`weigh`,`status`) values (9,4,'api/user/login','Login','',0,1491635035,1491635035,6,'normal'); insert into `fa_user_rule`(`id`,`pid`,`name`,`title`,`remark`,`ismenu`,`createtime`,`updatetime`,`weigh`,`status`) values (10,4,'api/user/register','Register','',0,1491635035,1491635035,8,'normal'); insert into `fa_user_rule`(`id`,`pid`,`name`,`title`,`remark`,`ismenu`,`createtime`,`updatetime`,`weigh`,`status`) values (11,4,'api/user/index','User Center','',0,1491635035,1491635035,10,'normal'); insert into `fa_user_rule`(`id`,`pid`,`name`,`title`,`remark`,`ismenu`,`createtime`,`updatetime`,`weigh`,`status`) values (12,4,'api/user/profile','Profile','',0,1491635035,1491635035,3,'normal'); /*Table structure for table `fa_user_score_log` */ DROP TABLE IF EXISTS `fa_user_score_log`; CREATE TABLE `fa_user_score_log` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `user_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '会员ID', `score` int(10) NOT NULL DEFAULT '0' COMMENT '变更积分', `before` int(10) NOT NULL DEFAULT '0' COMMENT '变更前积分', `after` int(10) NOT NULL DEFAULT '0' COMMENT '变更后积分', `memo` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '备注', `createtime` int(10) DEFAULT NULL COMMENT '创建时间', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='会员积分变动表'; /*Data for the table `fa_user_score_log` */ /*Table structure for table `fa_user_token` */ DROP TABLE IF EXISTS `fa_user_token`; CREATE TABLE `fa_user_token` ( `token` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'Token', `user_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '会员ID', `createtime` int(10) DEFAULT NULL COMMENT '创建时间', `expiretime` int(10) DEFAULT NULL COMMENT '过期时间', PRIMARY KEY (`token`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='会员Token表'; /*Data for the table `fa_user_token` */ /*Table structure for table `fa_version` */ DROP TABLE IF EXISTS `fa_version`; CREATE TABLE `fa_version` ( `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'ID', `oldversion` varchar(30) COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '旧版本号', `newversion` varchar(30) COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '新版本号', `packagesize` varchar(30) COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '包大小', `content` varchar(500) COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '升级内容', `downloadurl` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '下载地址', `enforce` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '强制更新', `createtime` int(10) DEFAULT NULL COMMENT '创建时间', `updatetime` int(10) DEFAULT NULL COMMENT '更新时间', `weigh` int(10) NOT NULL DEFAULT '0' COMMENT '权重', `status` varchar(30) COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '状态', PRIMARY KEY (`id`) USING BTREE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='版本表'; /*Data for the table `fa_version` */ /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
true
296781b25d0f83b7186347bffee0b475059b766f
SQL
ian-deans/angry-taco
/angry-taco/schema.sql
UTF-8
940
3.171875
3
[ "MIT" ]
permissive
DROP TABLE IF EXISTS books; CREATE TABLE books ( id SERIAL PRIMARY KEY, title VARCHAR(256) NOT NULL, year VARCHAR(16), publisher VARCHAR(256), img_url VARCHAR(512), summary TEXT ); DROP TABLE IF EXISTS authors; CREATE TABLE authors ( id SERIAL PRIMARY KEY, name VARCHAR(256) NOT NULL, bio TEXT DEFAULT '', img_url VARCHAR(512) ); DROP TABLE IF EXISTS book_authors; CREATE TABLE book_authors ( book_id INT NOT NULL, author_id INT NOT NULL ); DROP TABLE IF EXISTS genres; CREATE TABLE genres ( id SERIAL PRIMARY KEY, name VARCHAR(256) NOT NULL ); DROP TABLE IF EXISTS book_genres; CREATE TABLE book_genres ( book_id INT NOT NULL, genre_id INT NOT NULL ); DROP TABLE IF EXISTS publishers; CREATE TABLE publishers ( id SERIAL PRIMARY KEY, name VARCHAR(256) NOT NULL ); DROP TABLE IF EXISTS book_publishers; CREATE TABLE book_publishers ( book_id INT NOT NULL, publisher_id INT NOT NULL );
true
048511e4decb03407431f0865d1257ff51ee99b8
SQL
popovdenis/source_it_project
/sql/OnlineTest2.sql
UTF-8
9,037
2.65625
3
[]
no_license
-- phpMyAdmin SQL Dump -- version 4.4.13.1deb1 -- http://www.phpmyadmin.net -- -- Хост: localhost -- Время создания: Окт 30 2015 г., 21:11 -- Версия сервера: 5.6.27-0ubuntu1 -- Версия PHP: 5.6.11-1ubuntu3.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 */; -- -- База данных: `OnlineTest` -- -- -------------------------------------------------------- -- -- Структура таблицы `answer` -- CREATE TABLE IF NOT EXISTS `answer` ( `id` int(5) NOT NULL, `answer` text NOT NULL, `trueAnswer` int(11) DEFAULT NULL ) ENGINE=InnoDB AUTO_INCREMENT=190 DEFAULT CHARSET=utf8; -- -- Дамп данных таблицы `answer` -- -- INSERT INTO `answer` (`id`, `answer`, `trueAnswer`) VALUES -- (146, 'echo $arr;', 0), -- (147, 'print_r($arr);', 1), -- (148, 'Это возможно сделать только через цикл.', 0), -- (149, 'print $arr;', 0), -- (150, 'var_dump($arr);', 1), -- (154, '/', 0), -- (155, '.', 1), -- (156, '@', 0), -- (157, '&', 0), -- (158, '""', 0), -- (159, ' integer, float, string, boolean,object, resource, NULL', 0), -- (160, '4 скалярных типа, 2 комплексных (составных) типа, 2 специальных типа.', 1), -- (161, 'boolean, object, integer, float, string, function, resource, NULL.', 0), -- (162, 'string, array, constant, resource, boolean, integer, float, NULL.', 0), -- (163, 'boolean, integer, float, string, array, object, resource, NULL.', 1), -- (164, 'Конструктор – это метод __construct(), вызываемый при создании экземпляра класса при помощи ключевого слова this.', 0), -- (165, 'Конструктор – это метод __construction(), вызываемый при создании экземпляра класса при помощи ключевого слова this.', 0), -- (166, 'Конструктор – это метод __construct(), вызываемый при создании экземпляра класса при помощи ключевого слова new.', 1), -- (167, 'Конструктор – это класс __construct(), вызываемый при создании экземпляра класса при помощи ключевого слова new.', 0), -- (168, 'Конструктор – это метод __construction(), вызываемый при создании экземпляра класса при помощи ключевого слова new.', 0), -- (169, 'Ð’ PHP 4 и PHP 5 обязательно.', 0), -- (170, 'Не обязательно во всех версиях PHP.', 0), -- (171, 'Обязательно.', 0), -- (172, 'С версии PHP 4 не обязательно.', 0), -- (173, 'Ð’ PHP 4 – было обязательно. Ð’ PHP 5 не обязательно.', 1), -- (179, 'Инкапсуляция. ', 1), -- (180, ' Полиморфизм. ', 1), -- (181, 'Абстракция.', 0), -- (182, 'Наследование.', 1), -- (183, 'Клонирование.', 0), -- (188, 'Класс – это тип данных, а объект – экземпляр типа класс. ', 1), -- (189, 'Объект – это тип данных, а класс – экземпляр типа объект. ', 0); -- -------------------------------------------------------- -- -- Структура таблицы `question` -- CREATE TABLE IF NOT EXISTS `question` ( `id` int(5) NOT NULL, `question` varchar(150) NOT NULL ) ENGINE=InnoDB AUTO_INCREMENT=57 DEFAULT CHARSET=utf8; -- -- Дамп данных таблицы `question` -- -- INSERT INTO `question` (`id`, `question`) VALUES -- (48, 'Есть массив $arr. Как вывести все элементы массива $arr?'), -- (49, 'Какой из следующих операторов используется для конкатенации строк?'), -- (50, 'Назовите типы данных в PHP.'), -- (51, ' Что такое конструктор?'), -- (52, 'Обязательно ли писать закрывающий тег ?> в конце скрипта?'), -- (54, 'Основные принципы ООП.'), -- (56, ' Чем отличается класс от объекта?'); -- -------------------------------------------------------- -- -- Структура таблицы `question_answer` -- CREATE TABLE IF NOT EXISTS `question_answer` ( `question_id` int(5) DEFAULT NULL, `answer_id` int(5) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Дамп данных таблицы `question_answer` -- -- INSERT INTO `question_answer` (`question_id`, `answer_id`) VALUES -- (48, 146), -- (48, 147), -- (48, 148), -- (48, 149), -- (48, 150), -- (49, 154), -- (49, 155), -- (49, 156), -- (49, 157), -- (49, 158), -- (50, 159), -- (50, 160), -- (50, 161), -- (50, 162), -- (50, 163), -- (51, 164), -- (51, 165), -- (51, 166), -- (51, 167), -- (51, 168), -- (52, 169), -- (52, 170), -- (52, 171), -- (52, 172), -- (52, 173), -- (54, 179), -- (54, 180), -- (54, 181), -- (54, 182), -- (54, 183), -- (56, 188), -- (56, 189); -- -- Индексы сохранённых таблиц -- -- -- Индексы таблицы `answer` -- ALTER TABLE `answer` ADD PRIMARY KEY (`id`); -- -- Индексы таблицы `question` -- ALTER TABLE `question` ADD PRIMARY KEY (`id`); -- -- Индексы таблицы `question_answer` -- ALTER TABLE `question_answer` ADD KEY `question_id` (`question_id`), ADD KEY `answer_id` (`answer_id`); -- -- AUTO_INCREMENT для сохранённых таблиц -- -- -- AUTO_INCREMENT для таблицы `answer` -- ALTER TABLE `answer` MODIFY `id` int(5) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=190; -- -- AUTO_INCREMENT для таблицы `question` -- ALTER TABLE `question` MODIFY `id` int(5) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=57; -- -- Ограничения внешнего ключа сохраненных таблиц -- -- -- Ограничения внешнего ключа таблицы `question_answer` -- ALTER TABLE `question_answer` ADD CONSTRAINT `question_answer_ibfk_1` FOREIGN KEY (`question_id`) REFERENCES `question` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, ADD CONSTRAINT `question_answer_ibfk_2` FOREIGN KEY (`answer_id`) REFERENCES `answer` (`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
335293200996c4486cf0aa4378ea5b5823521502
SQL
dyisdog/SpringAll
/19.Spring-Boot-Testing/src/main/resources/init.sql
UTF-8
886
3.265625
3
[ "MIT" ]
permissive
-- ---------------------------- -- Table structure for T_USER -- ---------------------------- CREATE TABLE T_USER ( ID NUMBER NOT NULL , USERNAME VARCHAR2(20 BYTE) NOT NULL , PASSWD VARCHAR2(128 BYTE) NOT NULL , CREATE_TIME DATE NULL , STATUS CHAR(1 BYTE) NOT NULL ); COMMENT ON COLUMN T_USER.USERNAME IS '用户名'; COMMENT ON COLUMN T_USER.PASSWD IS '密码'; COMMENT ON COLUMN T_USER.CREATE_TIME IS '创建时间'; COMMENT ON COLUMN T_USER.STATUS IS '是否有效 1:有效 0:锁定'; -- ---------------------------- -- Records of T_USER -- ---------------------------- INSERT INTO T_USER VALUES ('2', 'tester', '243e29429b340192700677d48c09d992', TO_DATE('2017-12-11 17:20:21', 'YYYY-MM-DD HH24:MI:SS'), '1'); INSERT INTO T_USER VALUES ('1', 'mrbird', '42ee25d1e43e9f57119a00d0a39e5250', TO_DATE('2017-12-11 10:52:48', 'YYYY-MM-DD HH24:MI:SS'), '1'); create sequence seq_user start with 1 INCREMENT by 1;
true
9276172afdf169a7c8e7dc9c4a8f2ccea19dd5e0
SQL
sgwilbur/database-scripts
/oracle/refresh_temp.sql
UTF-8
832
2.96875
3
[]
no_license
-- Simple script to refresh the temp file, if it starts to get very large. -- -- ref: -- http://www.idevelopment.info/data/Oracle/DBA_tips/Tablespaces/TBS_3.shtml -- set echo on CREATE TEMPORARY TABLESPACE temp2 TEMPFILE 'C:\OPT\ORACLE\PRODUCT\10.2.0\ORADATA\ORA10\TEMP02.DBF' SIZE 5M REUSE AUTOEXTEND ON NEXT 1M MAXSIZE unlimited EXTENT MANAGEMENT LOCAL UNIFORM SIZE 1M; ALTER DATABASE DEFAULT TEMPORARY TABLESPACE temp2; DROP TABLESPACE temp INCLUDING CONTENTS AND DATAFILES; CREATE TEMPORARY TABLESPACE temp TEMPFILE 'C:\OPT\ORACLE\PRODUCT\10.2.0\ORADATA\ORA10\TEMP01.DBF' SIZE 512M REUSE AUTOEXTEND ON NEXT 64M MAXSIZE unlimited EXTENT MANAGEMENT LOCAL UNIFORM SIZE 1M; ALTER DATABASE DEFAULT TEMPORARY TABLESPACE temp; DROP TABLESPACE temp2 INCLUDING CONTENTS AND DATAFILES; set echo off
true
7c489f3c29d8d3f29d62decf99caa0c768fcbc58
SQL
MishaVernik/LeetCode
/Database/Duplicate Emails/solution.sql
UTF-8
892
4.4375
4
[ "MIT" ]
permissive
/* Write a SQL query to find all duplicate emails in a table named Person. Create table If Not Exists Person (Id int, Email varchar(255)) Truncate table Person insert into Person (Id, Email) values ('1', 'a@b.com') insert into Person (Id, Email) values ('2', 'c@d.com') insert into Person (Id, Email) values ('3', 'a@b.com') +----+---------+ | Id | Email | +----+---------+ | 1 | a@b.com | | 2 | c@d.com | | 3 | a@b.com | +----+---------+ For example, your query should return the following for the above table: +---------+ | Email | +---------+ | a@b.com | +---------+ Note: All emails are in lowercase.*/ # Write your MySQL query statement below # SOLUTION 1 # SELECT Email # FROM Person # GROUP BY Email # HAVING COUNT(EMail) > 1 # SOLUTION 2 SELECT Email FROM ( SELECT Email, COUNT(Email) as number FROM Person GROUP BY Email ) as STATISTIC WHERE number > 1 ;
true
1bf50e846eee92063a96e1beccd0f4c84ba291d3
SQL
R3alloc/Database_CourseDesign
/sql_scripts/book_storeinfo.sql
UTF-8
612
2.578125
3
[]
no_license
-- ---------------------------- -- Table structure for `book_storeinfo` -- ---------------------------- DROP TABLE IF EXISTS `book_storeinfo`; CREATE TABLE `book_storeinfo` ( `loc_barcode` varchar(20) NOT NULL, `loc_callNo` varchar(50) NOT NULL, `loc_voliss` varchar(50) DEFAULT NULL, `loc_rom` varchar(20) DEFAULT NULL, `loc_status` varchar(10) DEFAULT NULL, `loc_location` varchar(20) DEFAULT NULL, `book_left` int(11) DEFAULT NULL, PRIMARY KEY (`loc_barcode`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of book_storeinfo -- ----------------------------
true
6bfb8513b2cfcbbbbc935f53d5202b8973266777
SQL
jiacong1123/lss_mgd
/sql/20190522_gdyhwx.sql
UTF-8
10,874
3.546875
4
[]
no_license
/*==============================================================*/ /* DBMS name: MySQL 5.0 */ /* Created on: 2019/5/8 星期三 16:56:38 */ /*==============================================================*/ /*==============================================================*/ /* Table: ls_call_event */ /*==============================================================*/ create table lssdb.ls_call_event ( id int not null auto_increment comment 'id', record_id varchar(40) comment '话单唯一标识', type varchar(30) comment '电话事件类型与场景(DIALING_OUTBOUND, 外呼去电拨打事件;DIALING_UNKNOWNOUTCALL, 陌生去电拨打事件;DIALING_INBOUND, 客户来电拨打事件;DIALING_CHANNEL, 渠道来电拨打事件;DIALING_UNKNOWN, 陌生来电拨打事件)', time varchar(20) comment '发生时间', transfer_no varchar(20) comment '小号', show_no varchar(20) comment '被叫显示号码', call_info varchar(200) comment '扩展信息 JSON', emp_id varchar(40) comment '顾问编号', emp_no varchar(20) comment '顾问号码', emp_info varchar(200) comment '顾问扩展信息 JSON', cus_id varchar(40) comment '客户编号', cus_no varchar(20) comment '客户号码', cus_info varchar(200) comment '客户扩展信息 JSON', create_time datetime comment '创建时间', update_date datetime comment '修改时间', primary key (id) ); alter table lssdb.ls_call_event comment '电话事件'; /*==============================================================*/ /* Table: ls_call_record */ /*==============================================================*/ create table lssdb.ls_call_record ( id int not null auto_increment comment 'id', record_id varchar(40) comment '话单唯一标识', type varchar(40) comment '记录类型 OutBound_Call, 外呼电话;OutBound_Unkown, 陌生去电; InBound_Call, 客户电话; InBound_Call_Channel, 渠道电话; Unknow_Call, 陌生电话;', transfer_no varchar(20) comment '小号', show_no varchar(20) comment '被叫显示号码', ll_result varchar(20) comment '通话状态 ANSWERED(通话成功) ;BUSY(被叫忙);NO_ANSWER(被叫无应答);REJECT(被叫拒接);HANGUP(主叫提前挂机);INVALID_NUMBER(空号, 连连后台使用 信号异常);POWER_OFF(关机);UNAVAILABLE(暂时无法接听, 连连后台使用 信号异常);SUSPEND(停机);BLACK(黑名单号码);OTHER(其他失败情形, 连连后台使用信号异常)', start_time varchar(20) comment '通话开始时间', end_time varchar(20) comment '通话结束时间', duration int comment '通话时长, 大于 0 已接通, 否则未接通', recording_url varchar(128) comment '录音地址, HTTP 地址, MP3 格式', call_info varchar(200) comment '通话扩展信息 JSON,', emp_id varchar(40) comment '顾问编号', emp_no varchar(20) comment '顾问号码,', emp_no_area varchar(40) comment '顾问号码归属地', emp_info varchar(200) comment '顾问扩展信息 JSON', cus_id varchar(40) comment '客户编号', cus_no varchar(20) comment '客户号码', cus_no_area varchar(40) comment '客户号码归属地', cus_info varchar(200) comment '客户扩展信息', process_status varchar(10) comment '数据处理状态(INIT:初始 ;PROCESSED:已处理 )', admin_id int comment '管理员ID', admin_name varchar(64) comment '管理员名称', admin_phone varchar(20) comment '管理员手机', user_id int comment '用户ID', user_name varchar(64) comment '用户名称', workrecord_id int comment '工单进度ID', orderno varchar(32) comment '工单号', lss_record_url varchar(128) comment '自存录音URL', create_time datetime comment '创建时间', update_date datetime comment '修改时间', primary key (id) ); alter table lssdb.ls_call_record comment '通话记录'; /*==============================================================*/ /* Table: ls_org */ /*==============================================================*/ create table lssdb.ls_org ( id int not null auto_increment comment 'id', org_name varchar(100) comment '机构名称', parent_id int comment '上级机构', parent_ids varchar(2000) comment '所有上级机构(英文逗号分割)', grade varchar(20) comment '机构级别', remark varchar(200) comment '备注', index_no int comment '排序', create_date datetime comment '创建时间', update_date timestamp comment '修改时间', primary key (id) ); alter table lssdb.ls_org comment '机构'; /*==============================================================*/ /* Table: ls_sms_record */ /*==============================================================*/ create table lssdb.ls_sms_record ( id int not null auto_increment comment 'id', record_id varchar(40) comment '话单唯一标识', type varchar(40) comment '记录类型记录类型 OUTBOUND, 外发短信;OUTBOUND_UNKNOWN, 陌生外发短信;INBOUND, 客户回复短信;INBOUND_CHANNEL, 渠道短信;INBOUND_UNKNOWN, 陌生短信', transfer_no varchar(20) comment '小号', show_no varchar(20) comment '被叫显示号码', ll_result varchar(20) comment '短信状态 SENT, 成功发送 ;INVALID_SHOW_NUMBER, 显示号码不合法;INVALID_RECEIVER_NUMBER, 接收号码非手机号;OTHER, 其他失败', transfer_time varchar(20) comment '短信发送时间', content varchar(256) comment '短信内容', sms_info varchar(200) comment '短信扩展信息 JSON', emp_id varchar(40) comment '顾问编号', emp_no varchar(20) comment '顾问号码,', emp_no_area varchar(40) comment '顾问号码归属地', emp_info varchar(200) comment '顾问扩展信息 JSON', cus_id varchar(40) comment '客户编号', cus_no varchar(20) comment '客户号码', cus_no_area varchar(40) comment '客户号码归属地', cus_info varchar(200) comment '客户扩展信息', process_status varchar(10) comment '数据处理状态(INIT:初始 ;PROCESSED:已处理 )', admin_id int comment '管理员ID', admin_name varchar(64) comment '管理员名称', admin_phone varchar(20) comment '管理员手机', user_id int comment '用户ID', user_name varchar(64) comment '用户名称', workrecord_id int comment '工单进度ID', orderno varchar(32) comment '工单号', lss_record_url varchar(128) comment '自存录音URL', create_time datetime comment '创建时间', update_date datetime comment '修改时间', primary key (id) ); alter table lssdb.ls_sms_record comment '短信记录'; # 跟踪记录 新增通话相关状态 ok ALTER TABLE lssdb.`ls_workrecord` ADD COLUMN `status` int(11) NULL COMMENT '状态(1成功 0失败)' AFTER `createtime`, ADD COLUMN `remark` varchar(200) NULL COMMENT '备注' AFTER `status`, ADD COLUMN `record_url` varchar(128) NULL COMMENT '录音地址'; # 员工登记话机号码 ok ALTER TABLE lssdb.`ls_admin` ADD COLUMN `caller_nos` varchar(160) NULL COMMENT '话机号码,多个英文逗号分割, 电话号码, 固话带区号' AFTER `logintime`, ADD COLUMN `transfer_no` varchar(160) NULL COMMENT '小号'; # 客户添加微信,如果直通车已加了起微信则关联该字段 不使用 #ALTER TABLE lssdb.`ls_user` #ADD COLUMN `shop_wx` varchar(50) NULL COMMENT '客户直通车终端微信' AFTER `notes`, #ADD COLUMN `member_no` varchar(40) NULL COMMENT '客户直通车客户编号' AFTER `shop_wx`; # 帐号关联部门 ok 2019.05.21 ALTER TABLE lssdb.`ls_admin` ADD COLUMN `org_id` int NULL COMMENT '所属部门id', ADD COLUMN `org_name` varchar(32) NULL COMMENT '所属部门名称', ADD COLUMN `no_wx` varchar(50) NULL COMMENT '微信号' ; # 微信昵称长度修改 ok ALTER TABLE lssdb.`ls_user` MODIFY COLUMN `wechat` varchar(50) NULL DEFAULT NULL COMMENT '微信昵称'; # 工单成交金额 ok ALTER TABLE lssdb.`ls_workorder` ADD COLUMN `amount` bigint NULL COMMENT '成交金额(分为单位)' AFTER `visitingtime`; # 工单新增菜单 ok INSERT INTO lssdb.`ls_popedom` (`popeid`, `name`, `icon`, `url`, `level`, `parentid`) VALUES (28, '(外)呼叫记录', NULL, '/worktaskmanagement/callrecord', 2, 4); # 工单新增 客户直通车 API访问地址 /结尾 ,不用拼接api-os/api ok 测试环境http://rw.kehuzhitongche.com/ ,线上http://juke.leshasha.com/ INSERT INTO lssdb.`ls_worktag` (`type`, `tagname`) VALUES (6, 'http://juke.leshasha.com/'); # 工单地址配置,用于校验登录是否合法 /结尾 ok 测试环境http://rw.kehuzhitongche.com/lss-admin/,线上http://adminapi.lesasa.com/ INSERT INTO confcenter.`cc_system_params` (`SYS_PARAM_NAME`, `GROUP_NAME`, `SYS_PARAM_VALUE`, `REMARK`, `SYSTEM_ALIAS_NAME`, `ONLY_ADMIN_MODIFY`) VALUES ('gdHost', 'lssgd', 'http://adminapi.lesasa.com/', '乐莎莎工单_URL配置', 'lss', '1'); # 跟踪记录 新增通话相关状态 ok 2019-05-14 19:17:25 ALTER TABLE lssdb.`ls_workrecord` ADD COLUMN `remark2` varchar(2000) NULL COMMENT '备注2,微信聊天时则记录终端及客户微信信息' ; # 帐号关联部门 ok 2019.05.21 INSERT INTO lssdb.`ls_org` (`id`, `org_name`, `parent_id`, `parent_ids`, `grade`, `remark`, `index_no`, `create_date`, `update_date`) VALUES (1, '深圳乐莎莎科技有限公司', 0, ',0,', NULL, '顶级机构', 0, '2019-5-21 11:42:40', '2019-5-21 11:43:02'); # 帐号 ok 2019.05.21 INSERT INTO lssdb.`ls_role` (`roleid`, `rolename`) VALUES (9, '电销组长'); # 工单新增菜单 ok INSERT INTO lssdb.`ls_popedom` (`popeid`, `name`, `icon`, `url`, `level`, `parentid`) VALUES (29, '组织结构', NULL, '/systemsetting/organization', 2, 1);
true
4ef21f16809786d4c0165b1b8d380249ccced146
SQL
tomkowz/anonymous-discussions
/schema-triggers.sql
UTF-8
674
3.328125
3
[]
no_license
create trigger entries_insert before insert on entries for each row set NEW.created_at = CURRENT_TIMESTAMP, NEW.updated_at = CURRENT_TIMESTAMP; create trigger entries_update before update on entries for each row set NEW.updated_at = CURRENT_TIMESTAMP; create trigger comments_insert before insert on comments for each row set NEW.created_at = CURRENT_TIMESTAMP, NEW.updated_at = CURRENT_TIMESTAMP; create trigger comments_update before update on comments for each row set NEW.updated_at = CURRENT_TIMESTAMP; DELIMITER // CREATE TRIGGER tokens_insert AFTER INSERT ON tokens FOR EACH ROW BEGIN INSERT INTO user_settings (token) VALUES (NEW.value); END; // DELIMITER ;
true
b8508f242c6cf7601a178b824f665cf28dc67b13
SQL
mylearning-gourav/LibraryUserService
/src/main/resources/new_db.sql
UTF-8
699
3.09375
3
[]
no_license
CREATE DATABASE `library_users`; CREATE TABLE `library_users`.`user` ( `id` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, `name` VARCHAR(100) NOT NULL DEFAULT '', `email` VARCHAR(100) NOT NULL DEFAULT '', `password` VARCHAR(100) NOT NULL DEFAULT '', `active` BOOLEAN NOT NULL DEFAULT 1, `role_id` INTEGER NOT NULL, PRIMARY KEY(`id`) ) ENGINE = InnoDB; CREATE TABLE `library_users`.`roles` ( `id` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, `role` VARCHAR(45) NOT NULL DEFAULT '', PRIMARY KEY(`id`) ) ENGINE = InnoDB; INSERT INTO `library_users`.`roles` (`id`, `role`) VALUES ('1', 'User'); INSERT INTO `library_users`.`roles` (`id`, `role`) VALUES ('2', 'Admin');
true
7c986675771f781fde9eedc2021c783523cd3188
SQL
yakiris/20200213_Database
/05_dz/08.sql
UTF-8
158
2.53125
3
[]
no_license
#3. Подсчитайте произведение чисел в столбце id таблицы users SELECT ROUND(EXP(SUM(LN(id)))) AS result FROM users;
true
039d1bd01d3ae9d1ec590abbc7013abd25ed0bfd
SQL
yuz835/weindex
/weindex.dao/src/main/resources/sql/offer_comment.sql
UTF-8
394
2.859375
3
[]
no_license
CREATE TABLE offer_comment ( id INT NOT NULL AUTO_INCREMENT, offer_id INT NOT NULL, title VARCHAR(256) NOT NULL, content VARCHAR(512), visible INT default 0, creator_id INT NOT NULL, creator_name varchar(256), trace_comment_id INT, create_time DATETIME, update_time DATETIME, PRIMARY KEY (id), FOREIGN KEY (offer_id) REFERENCES offer(id) on delete cascade ) ENGINE=InnoDB default charset=utf8;
true
7e63e13ac76c3d115f082a07fd076cf9a4d6eca2
SQL
ASherstobitov/EssentialCommandsForPostgresql
/Controller.sql
UTF-8
7,366
4.25
4
[]
no_license
-- order by select * from person order by first_name, last_name asc select country_of_birth from person order by country_of_birth desc select country_of_birth from person order by country_of_birth --distinct select distinct country_of_birth from person order by country_of_birth select distinct country_of_birth from person order by country_of_birth desc -- where (something or something) and something select * from person where gender= 'Female' select * from person where gender='Male' and country_of_birth='Russia' select * from person where gender='Male' and (country_of_birth='Russia' or country_of_birth='China') and last_name='Brea' and gender='Male' select 1 > 2; -- limit, offset , fetch first number row only select * from person limit 10 select * from person offset 995 limit 3 select * from person offset 5 fetch first 2 row only select * from person offset 5 fetch first row only --or select * from person where country_of_birth ='Russia' or country_of_birth='Poland' or country_of_birth='France' select * from person where country_of_birth in ('Russia', 'France', 'Italy') order by country_of_birth desc --between select * from person where date_of_birth between '2020-05-01' and '2020-05-30' --like and ilike select * from person where email like '%google.com%' select * from person where email like '______@%' select * from person where country_of_birth like 'R%' select * from person where country_of_birth ilike 'r%' --group by select country_of_birth from person group by country_of_birth select distinct country_of_birth from person select country_of_birth, count (*) from person group by country_of_birth select country_of_birth, count (*) from person group by country_of_birth order by country_of_birth desc --group by having select country_of_birth, count (*) from person group by country_of_birth having count (*) > 30 order by country_of_birth --max(), min(), avr() select max(price) from car select min(price) from car select round(avg(price)) from car select make, model, min(price) from car group by make, model select make, min(price) from car group by make, model --sum() select make, sum(price) from car group by make select model, sum(price) from car group by model --Basic Arithmetic operators select 10 + 2; select 10 - 2; select 10 * 2; select 10 / 2; --select 10 ^ 2 don't work here -- Arithmetic operation(round) select id, make, model, price, price * .10 from car select id, make, model, price, round (price * .10, 2) from car select id, make, model, price, round (price * .10, 2), round (price - (price * .10),2) from car --rename column select id, make, price as original_price, round (price * .10, 2) as ten_percent , round (price - (price * .10),2) as discount_after_10_percent from car --fill empty spaces select coalesce(email, 'Email not provided') from person select coalesce email from person --nullif select 10 / nullif(2, 0); select coalesce(10 / nullif(0,0), 2); --timestamps select now()::date select now()::time select now()::timestamp select now() --take items with same values select first_name, count(*) from person group by first_name having count(*) > 2 select first_name, count(*) from person group by first_name select * from person where first_name ='Jaime' --constraint values in a column update person set email='sayl3@latimes.com' where id=2 --alter table person add constraint unique_email_address unique (email) this don't work in idea --alter table person drop constraint unique_email_address this don't work in idea -- alter table person add unique (email) --alter table person drop constraint person_email_key select email, count(*) from person group by email having count(*) > 1 select email, count(*) from person group by email --drop primary key --alter table person drop constraint person_pkey - don't work in the idea --add primary key --alter table person add primary key (id) don't work in idea --Adding and subtracting with dates|course --select now() - interval "10 years" don't work in intellij --extract needed information --select*, extract(day from date_of_birth) as days from person this code does't work in idea --age function select first_name, last_name, gender, country_of_birth, date_of_birth from person --select first_name, last_name, gender, country_of_birth, date_of_birth,age(now(), date_of_birth) from person don't work in idea --Check Constraints select distinct gender from person -- alter table person add constraint gender_constraint check (gender='Female' or gender = 'Male') don't work in idea --alter table person drop constraint gender_constraint don't work in idea update person set gender='hello' where id=1 -- How to delete records delete from person where gender='Female' and country_of_birth='Nigeria' --How to update records update person set first_name='Ruslan', last_name='Rovnushkin',country_of_birth='Russia' where id=10 --On Conflict () Do nothing --insert into person (id, first_name, last_name, country_of_birth, gender, date_of_birth) don't work in idea --values (1, 'Andrey', 'Shishkin', 'Russia', 'Male', '1998-11-16') on conflict (id) do nothing --insert or update -- insert into person (id, first_name, last_name, country_of_birth, gender, date_of_birth) don't work in idea -- values (10, 'Roman' , 'Dibenko', 'Russia', 'Female', '1992-10-2') on conflict (id) do update set first_name = excluded.first_name, -- last_name=excluded.last_name, gender=excluded.gender don't work in idea --references car_id bigint references car, unique (car_id) --Update foreign key columns update person_car set car_id= null where id = 3 update person_car set car_id= 1 where id = 3 select * from person_car where id = 3 --Inner Joins select * from person_car join car on person_car.car_id = car.id where car_id > 995 select person_car.first_name, person_car.last_name, car.id, car.make, car.model, car.price from person_car join car on person_car.car_id = car.id where person_car.id between 10 and 20 --Left Joins select * from person_car left join car on person_car.car_id = car."id" order by person_car."id" select * from person_car where car_id is null order by person_car."id" select * from person_car left join car on car.* is null --Deleting records with foreign keys --Exporting Query results to csv copy(select * from person_car left join car on car.id = person_car.car_id where person_car.id between 1 and 5) to 'C:\Exports\result.sql' delimiter ',' csv header; -- Serial & Sequen select * from person_car_id_seq --alter sequence person_car_id_seq restart with 9 --Extensions select * from pg_available_extensions --Universally unique identifier UUID select * from pg_availablr_extansions; --create extension if not exist "uuid-ossp"; don't work in idea select uuid_generate_v4() select uuid_generate_v4() select * from person_car_2 select * from car_2 --UUID As primary key update person_car_2 set car_uuid='d63b8719-7b7a-4928-86f4-5db1f0a23afd' where person_uuid='78178abf-5bea-49e9-bf08-e125b8dfaf13' select * from person_car_2 join car_2 on car_2.car_2_uuid = person_car_2.car_uuid --Using replace on in join select * from person_car_2 join car_2 using (car_uuid) select * from person_car_2 left join car_2 using (car_uuid) where car_2.* is null
true
454359cae37147c01b5f7be90faacc16c071384b
SQL
Wang-Yann/LeetCodeMe
/MySQL/1393_capital-gainloss.sql
UTF-8
3,448
4.09375
4
[]
no_license
-- @Author : Rock Wayne -- @Created : 2020-08-06 21:43:33 -- @Last Modified : 2020-08-06 21:43:33 -- -- #Stocks 表: -- # -- # +---------------+---------+ -- #| Column Name | Type | -- #+---------------+---------+ -- #| stock_name | varchar | -- #| operation | enum | -- #| operation_day | int | -- #| price | int | -- #+---------------+---------+ -- #(stock_name, day) 是这张表的主键 -- #operation 列使用的是一种枚举类型,包括:('Sell','Buy') -- #此表的每一行代表了名为 stock_name 的某支股票在 operation_day 这一天的操作价格。 -- #保证股票的每次'Sell'操作前,都有相应的'Buy'操作。 -- # -- # -- # -- # -- # 编写一个SQL查询来报告每支股票的资本损益。 -- # -- # 股票的资本损益是一次或多次买卖股票后的全部收益或损失。 -- # -- # 以任意顺序返回结果即可。 -- # -- # SQL查询结果的格式如下例所示: -- # -- # Stocks 表: -- #+---------------+-----------+---------------+--------+ -- #| stock_name | operation | operation_day | price | -- #+---------------+-----------+---------------+--------+ -- #| Leetcode | Buy | 1 | 1000 | -- #| Corona Masks | Buy | 2 | 10 | -- #| Leetcode | Sell | 5 | 9000 | -- #| Handbags | Buy | 17 | 30000 | -- #| Corona Masks | Sell | 3 | 1010 | -- #| Corona Masks | Buy | 4 | 1000 | -- #| Corona Masks | Sell | 5 | 500 | -- #| Corona Masks | Buy | 6 | 1000 | -- #| Handbags | Sell | 29 | 7000 | -- #| Corona Masks | Sell | 10 | 10000 | -- #+---------------+-----------+---------------+--------+ -- # -- #Result 表: -- #+---------------+-------------------+ -- #| stock_name | capital_gain_loss | -- #+---------------+-------------------+ -- #| Corona Masks | 9500 | -- #| Leetcode | 8000 | -- #| Handbags | -23000 | -- #+---------------+-------------------+ -- #Leetcode 股票在第一天以1000美元的价格买入,在第五天以9000美元的价格卖出。资本收益=9000-1000=8000美元。 -- #Handbags 股票在第17天以30000美元的价格买入,在第29天以7000美元的价格卖出。资本损失=7000-30000=-23000美元。 -- #Corona Masks 股票在第1天以10美元的价格买入,在第3天以1010美元的价格卖出。在第4天以1000美元的价格再次购买,在第5天以500美元的价格 -- #出售。最后,它在第6天以1000美元的价格被买走,在第10天以10000美元的价格被卖掉。资本损益是每次(’Buy'->'Sell')操作资本收益或损失的和=( -- #1010-10)+(500-1000)+(10000-1000)=1000-500+9000=9500美元。 -- # -- # 👍 2 👎 0 -- -- -- -- #leetcode submit region begin(Prohibit modification and deletion) -- # Write your MySQL query statement below select stock_name, sum(sign(if(s.operation='Buy',-1,1))*s.price) as capital_gain_loss from Stocks as s group by s.stock_name order by s.operation_day; -- #leetcode submit region end(Prohibit modification and deletion) select stock_name, sum(case when s.operation = 'Buy' then -1 * s.price else s.price end) as capital_gain_loss from Stocks as s group by s.stock_name order by s.operation_day;
true
fcd05e8894201f255ebeba7c27f44e63832ebfef
SQL
JoelBondurant/RandomCodeSamples
/sql/Functions/iso_year.sql
UTF-8
203
2.78125
3
[ "Apache-2.0" ]
permissive
DELIMITER $$ DROP FUNCTION IF EXISTS iso_year$$ CREATE DEFINER=`root`@`localhost` FUNCTION iso_year (adate DATE) RETURNS INT DETERMINISTIC BEGIN RETURN date_format(adate, "%x"); END$$ DELIMITER ;
true
55fe7848e1687e931095e0fa3907597f90039e1c
SQL
amazon-archives/aws-ohdsi-automated-deployment
/Achilles/inst/sql/sql_server/ConceptHierarchy_v5.sql
UTF-8
18,177
3.625
4
[ "Apache-2.0" ]
permissive
{DEFAULT @results_database_schema = 'webapi.dbo'} {DEFAULT @vocab_database_schema = 'omopcdm.dbo'} /*********************************************************************/ /***** Create hierarchy lookup table for the treemap hierarchies *****/ /*********************************************************************/ IF OBJECT_ID('@results_database_schema.concept_hierarchy', 'U') IS NOT NULL DROP TABLE @results_database_schema.concept_hierarchy; CREATE TABLE @results_database_schema.concept_hierarchy ( concept_id INT, concept_name VARCHAR(400), treemap VARCHAR(20), concept_hierarchy_type VARCHAR(20), level1_concept_name VARCHAR(255), level2_concept_name VARCHAR(255), level3_concept_name VARCHAR(255), level4_concept_name VARCHAR(255) ); /***********************************************************/ /***** Populate the hierarchy lookup table per treemap *****/ /***********************************************************/ /********** CONDITION/CONDITION_ERA **********/ INSERT INTO @results_database_schema.concept_hierarchy (concept_id, concept_name, treemap, level1_concept_name, level2_concept_name, level3_concept_name, level4_concept_name) SELECT snomed.concept_id, snomed.concept_name AS snomed_concept_name, 'Condition' AS treemap, pt_to_hlt.pt_concept_name, hlt_to_hlgt.hlt_concept_name, hlgt_to_soc.hlgt_concept_name, soc.concept_name AS soc_concept_name FROM ( SELECT concept_id, concept_name FROM @vocab_database_schema.concept WHERE domain_id = 'Condition' ) snomed LEFT JOIN (SELECT c1.concept_id AS snomed_concept_id, max(c2.concept_id) AS pt_concept_id FROM @vocab_database_schema.concept c1 INNER JOIN @vocab_database_schema.concept_ancestor ca1 ON c1.concept_id = ca1.descendant_concept_id AND c1.domain_id = 'Condition' AND ca1.min_levels_of_separation = 1 INNER JOIN @vocab_database_schema.concept c2 ON ca1.ancestor_concept_id = c2.concept_id AND c2.vocabulary_id = 'MedDRA' GROUP BY c1.concept_id ) snomed_to_pt ON snomed.concept_id = snomed_to_pt.snomed_concept_id LEFT JOIN (SELECT c1.concept_id AS pt_concept_id, c1.concept_name AS pt_concept_name, max(c2.concept_id) AS hlt_concept_id FROM @vocab_database_schema.concept c1 INNER JOIN @vocab_database_schema.concept_ancestor ca1 ON c1.concept_id = ca1.descendant_concept_id AND c1.vocabulary_id = 'MedDRA' AND ca1.min_levels_of_separation = 1 INNER JOIN @vocab_database_schema.concept c2 ON ca1.ancestor_concept_id = c2.concept_id AND c2.vocabulary_id = 'MedDRA' GROUP BY c1.concept_id, c1.concept_name ) pt_to_hlt ON snomed_to_pt.pt_concept_id = pt_to_hlt.pt_concept_id LEFT JOIN (SELECT c1.concept_id AS hlt_concept_id, c1.concept_name AS hlt_concept_name, max(c2.concept_id) AS hlgt_concept_id FROM @vocab_database_schema.concept c1 INNER JOIN @vocab_database_schema.concept_ancestor ca1 ON c1.concept_id = ca1.descendant_concept_id AND c1.vocabulary_id = 'MedDRA' AND ca1.min_levels_of_separation = 1 INNER JOIN @vocab_database_schema.concept c2 ON ca1.ancestor_concept_id = c2.concept_id AND c2.vocabulary_id = 'MedDRA' GROUP BY c1.concept_id, c1.concept_name ) hlt_to_hlgt ON pt_to_hlt.hlt_concept_id = hlt_to_hlgt.hlt_concept_id LEFT JOIN (SELECT c1.concept_id AS hlgt_concept_id, c1.concept_name AS hlgt_concept_name, max(c2.concept_id) AS soc_concept_id FROM @vocab_database_schema.concept c1 INNER JOIN @vocab_database_schema.concept_ancestor ca1 ON c1.concept_id = ca1.descendant_concept_id AND c1.vocabulary_id = 'MedDRA' AND ca1.min_levels_of_separation = 1 INNER JOIN @vocab_database_schema.concept c2 ON ca1.ancestor_concept_id = c2.concept_id AND c2.vocabulary_id = 'MedDRA' GROUP BY c1.concept_id, c1.concept_name ) hlgt_to_soc ON hlt_to_hlgt.hlgt_concept_id = hlgt_to_soc.hlgt_concept_id LEFT JOIN @vocab_database_schema.concept soc ON hlgt_to_soc.soc_concept_id = soc.concept_id; /********** DRUG **********/ INSERT INTO @results_database_schema.concept_hierarchy (concept_id, concept_name, treemap, level1_concept_name, level2_concept_name, level3_concept_name, level4_concept_name) SELECT rxnorm.concept_id, rxnorm.concept_name AS rxnorm_concept_name, 'Drug' AS treemap, rxnorm.rxnorm_ingredient_concept_name, atc5_to_atc3.atc5_concept_name, atc3_to_atc1.atc3_concept_name, atc1.concept_name AS atc1_concept_name FROM ( SELECT c1.concept_id, c1.concept_name, c2.concept_id AS rxnorm_ingredient_concept_id, c2.concept_name AS RxNorm_ingredient_concept_name FROM @vocab_database_schema.concept c1 INNER JOIN @vocab_database_schema.concept_ancestor ca1 ON c1.concept_id = ca1.descendant_concept_id AND c1.domain_id = 'Drug' INNER JOIN @vocab_database_schema.concept c2 ON ca1.ancestor_concept_id = c2.concept_id AND c2.domain_id = 'Drug' AND c2.concept_class_id = 'Ingredient' ) rxnorm LEFT JOIN (SELECT c1.concept_id AS rxnorm_ingredient_concept_id, max(c2.concept_id) AS atc5_concept_id FROM @vocab_database_schema.concept c1 INNER JOIN @vocab_database_schema.concept_ancestor ca1 ON c1.concept_id = ca1.descendant_concept_id AND c1.domain_id = 'Drug' AND c1.concept_class_id = 'Ingredient' INNER JOIN @vocab_database_schema.concept c2 ON ca1.ancestor_concept_id = c2.concept_id AND c2.vocabulary_id = 'ATC' AND c2.concept_class_id = 'ATC 4th' GROUP BY c1.concept_id ) rxnorm_to_atc5 ON rxnorm.rxnorm_ingredient_concept_id = rxnorm_to_atc5.rxnorm_ingredient_concept_id LEFT JOIN (SELECT c1.concept_id AS atc5_concept_id, c1.concept_name AS atc5_concept_name, max(c2.concept_id) AS atc3_concept_id FROM @vocab_database_schema.concept c1 INNER JOIN @vocab_database_schema.concept_ancestor ca1 ON c1.concept_id = ca1.descendant_concept_id AND c1.vocabulary_id = 'ATC' AND c1.concept_class_id = 'ATC 4th' INNER JOIN @vocab_database_schema.concept c2 ON ca1.ancestor_concept_id = c2.concept_id AND c2.vocabulary_id = 'ATC' AND c2.concept_class_id = 'ATC 2nd' GROUP BY c1.concept_id, c1.concept_name ) atc5_to_atc3 ON rxnorm_to_atc5.atc5_concept_id = atc5_to_atc3.atc5_concept_id LEFT JOIN (SELECT c1.concept_id AS atc3_concept_id, c1.concept_name AS atc3_concept_name, max(c2.concept_id) AS atc1_concept_id FROM @vocab_database_schema.concept c1 INNER JOIN @vocab_database_schema.concept_ancestor ca1 ON c1.concept_id = ca1.descendant_concept_id AND c1.vocabulary_id = 'ATC' AND c1.concept_class_id = 'ATC 2nd' INNER JOIN @vocab_database_schema.concept c2 ON ca1.ancestor_concept_id = c2.concept_id AND c2.vocabulary_id = 'ATC' AND c2.concept_class_id = 'ATC 1st' GROUP BY c1.concept_id, c1.concept_name ) atc3_to_atc1 ON atc5_to_atc3.atc3_concept_id = atc3_to_atc1.atc3_concept_id LEFT JOIN @vocab_database_schema.concept atc1 ON atc3_to_atc1.atc1_concept_id = atc1.concept_id; /********** DRUG_ERA **********/ INSERT INTO @results_database_schema.concept_hierarchy (concept_id, concept_name, treemap, level1_concept_name, level2_concept_name, level3_concept_name) SELECT rxnorm.rxnorm_ingredient_concept_id, rxnorm.rxnorm_ingredient_concept_name, 'Drug Era' AS treemap, atc5_to_atc3.atc5_concept_name, atc3_to_atc1.atc3_concept_name, atc1.concept_name AS atc1_concept_name FROM ( SELECT c2.concept_id AS rxnorm_ingredient_concept_id, c2.concept_name AS RxNorm_ingredient_concept_name FROM @vocab_database_schema.concept c2 WHERE c2.domain_id = 'Drug' AND c2.concept_class_id = 'Ingredient' ) rxnorm LEFT JOIN (SELECT c1.concept_id AS rxnorm_ingredient_concept_id, max(c2.concept_id) AS atc5_concept_id FROM @vocab_database_schema.concept c1 INNER JOIN @vocab_database_schema.concept_ancestor ca1 ON c1.concept_id = ca1.descendant_concept_id AND c1.domain_id = 'Drug' AND c1.concept_class_id = 'Ingredient' INNER JOIN @vocab_database_schema.concept c2 ON ca1.ancestor_concept_id = c2.concept_id AND c2.vocabulary_id = 'ATC' AND c2.concept_class_id = 'ATC 4th' GROUP BY c1.concept_id ) rxnorm_to_atc5 ON rxnorm.rxnorm_ingredient_concept_id = rxnorm_to_atc5.rxnorm_ingredient_concept_id LEFT JOIN (SELECT c1.concept_id AS atc5_concept_id, c1.concept_name AS atc5_concept_name, max(c2.concept_id) AS atc3_concept_id FROM @vocab_database_schema.concept c1 INNER JOIN @vocab_database_schema.concept_ancestor ca1 ON c1.concept_id = ca1.descendant_concept_id AND c1.vocabulary_id = 'ATC' AND c1.concept_class_id = 'ATC 4th' INNER JOIN @vocab_database_schema.concept c2 ON ca1.ancestor_concept_id = c2.concept_id AND c2.vocabulary_id = 'ATC' AND c2.concept_class_id = 'ATC 2nd' GROUP BY c1.concept_id, c1.concept_name ) atc5_to_atc3 ON rxnorm_to_atc5.atc5_concept_id = atc5_to_atc3.atc5_concept_id LEFT JOIN (SELECT c1.concept_id AS atc3_concept_id, c1.concept_name AS atc3_concept_name, max(c2.concept_id) AS atc1_concept_id FROM @vocab_database_schema.concept c1 INNER JOIN @vocab_database_schema.concept_ancestor ca1 ON c1.concept_id = ca1.descendant_concept_id AND c1.vocabulary_id = 'ATC' AND c1.concept_class_id = 'ATC 2nd' INNER JOIN @vocab_database_schema.concept c2 ON ca1.ancestor_concept_id = c2.concept_id AND c2.vocabulary_id = 'ATC' AND c2.concept_class_id = 'ATC 1st' GROUP BY c1.concept_id, c1.concept_name ) atc3_to_atc1 ON atc5_to_atc3.atc3_concept_id = atc3_to_atc1.atc3_concept_id LEFT JOIN @vocab_database_schema.concept atc1 ON atc3_to_atc1.atc1_concept_id = atc1.concept_id; /********** MEASUREMENT **********/ INSERT INTO @results_database_schema.concept_hierarchy (concept_id, concept_name, treemap, level1_concept_name, level2_concept_name, level3_concept_name) SELECT m.concept_id, m.concept_name, 'Measurement' AS treemap, max(c1.concept_name) AS level1_concept_name, max(c2.concept_name) AS level2_concept_name, max(c3.concept_name) AS level3_concept_name FROM ( SELECT DISTINCT concept_id, concept_name FROM @vocab_database_schema.concept c WHERE domain_id = 'Measurement' ) m LEFT JOIN @vocab_database_schema.concept_ancestor ca1 ON M.concept_id = ca1.DESCENDANT_CONCEPT_ID AND ca1.min_levels_of_separation = 1 LEFT JOIN @vocab_database_schema.concept c1 ON ca1.ANCESTOR_CONCEPT_ID = c1.concept_id LEFT JOIN @vocab_database_schema.concept_ancestor ca2 ON c1.concept_id = ca2.DESCENDANT_CONCEPT_ID AND ca2.min_levels_of_separation = 1 LEFT JOIN @vocab_database_schema.concept c2 ON ca2.ANCESTOR_CONCEPT_ID = c2.concept_id LEFT JOIN @vocab_database_schema.concept_ancestor ca3 ON c2.concept_id = ca3.DESCENDANT_CONCEPT_ID AND ca3.min_levels_of_separation = 1 LEFT JOIN @vocab_database_schema.concept c3 ON ca3.ANCESTOR_CONCEPT_ID = c3.concept_id GROUP BY M.concept_id, M.concept_name; /********** OBSERVATION **********/ INSERT INTO @results_database_schema.concept_hierarchy (concept_id, concept_name, treemap, level1_concept_name, level2_concept_name, level3_concept_name) SELECT obs.concept_id, obs.concept_name, 'Observation' AS treemap, max(c1.concept_name) AS level1_concept_name, max(c2.concept_name) AS level2_concept_name, max(c3.concept_name) AS level3_concept_name FROM ( SELECT concept_id, concept_name FROM @vocab_database_schema.concept WHERE domain_id = 'Observation' ) obs LEFT JOIN @vocab_database_schema.concept_ancestor ca1 ON obs.concept_id = ca1.DESCENDANT_CONCEPT_ID AND ca1.min_levels_of_separation = 1 LEFT JOIN @vocab_database_schema.concept c1 ON ca1.ANCESTOR_CONCEPT_ID = c1.concept_id LEFT JOIN @vocab_database_schema.concept_ancestor ca2 ON c1.concept_id = ca2.DESCENDANT_CONCEPT_ID AND ca2.min_levels_of_separation = 1 LEFT JOIN @vocab_database_schema.concept c2 ON ca2.ANCESTOR_CONCEPT_ID = c2.concept_id LEFT JOIN @vocab_database_schema.concept_ancestor ca3 ON c2.concept_id = ca3.DESCENDANT_CONCEPT_ID AND ca3.min_levels_of_separation = 1 LEFT JOIN @vocab_database_schema.concept c3 ON ca3.ANCESTOR_CONCEPT_ID = c3.concept_id GROUP BY obs.concept_id, obs.concept_name; /********** PROCEDURE **********/ INSERT INTO @results_database_schema.concept_hierarchy (concept_id, concept_name, treemap, level1_concept_name, level2_concept_name, level3_concept_name) SELECT procs.concept_id, procs.proc_concept_name, 'Procedure' AS treemap, max(proc_hierarchy.os3_concept_name) AS level2_concept_name, max(proc_hierarchy.os2_concept_name) AS level3_concept_name, max(proc_hierarchy.os1_concept_name) AS level4_concept_name FROM ( SELECT c1.concept_id, v1.vocabulary_name + ' ' + c1.concept_code + ': ' + c1.concept_name AS proc_concept_name FROM @vocab_database_schema.concept c1 INNER JOIN @vocab_database_schema.vocabulary v1 ON c1.vocabulary_id = v1.vocabulary_id WHERE c1.domain_id = 'Procedure' ) procs LEFT JOIN (SELECT ca0.DESCENDANT_CONCEPT_ID, max(ca0.ancestor_concept_id) AS ancestor_concept_id FROM @vocab_database_schema.concept_ancestor ca0 INNER JOIN (SELECT DISTINCT c2.concept_id AS os3_concept_id FROM @vocab_database_schema.concept_ancestor ca1 INNER JOIN @vocab_database_schema.concept c1 ON ca1.DESCENDANT_CONCEPT_ID = c1.concept_id INNER JOIN @vocab_database_schema.concept_ancestor ca2 ON c1.concept_id = ca2.ANCESTOR_CONCEPT_ID INNER JOIN @vocab_database_schema.concept c2 ON ca2.DESCENDANT_CONCEPT_ID = c2.concept_id WHERE ca1.ancestor_concept_id = 4040390 AND ca1.Min_LEVELS_OF_SEPARATION = 2 AND ca2.MIN_LEVELS_OF_SEPARATION = 1 ) t1 ON ca0.ANCESTOR_CONCEPT_ID = t1.os3_concept_id GROUP BY ca0.descendant_concept_id ) ca1 ON procs.concept_id = ca1.DESCENDANT_CONCEPT_ID LEFT JOIN ( SELECT proc_by_os1.os1_concept_name, proc_by_os2.os2_concept_name, proc_by_os3.os3_concept_name, proc_by_os3.os3_concept_id FROM (SELECT DESCENDANT_CONCEPT_ID AS os1_concept_id, concept_name AS os1_concept_name FROM @vocab_database_schema.concept_ancestor ca1 INNER JOIN @vocab_database_schema.concept c1 ON ca1.DESCENDANT_CONCEPT_ID = c1.concept_id WHERE ancestor_concept_id = 4040390 AND Min_LEVELS_OF_SEPARATION = 1 ) proc_by_os1 INNER JOIN (SELECT max(c1.CONCEPT_ID) AS os1_concept_id, c2.concept_id AS os2_concept_id, c2.concept_name AS os2_concept_name FROM @vocab_database_schema.concept_ancestor ca1 INNER JOIN @vocab_database_schema.concept c1 ON ca1.DESCENDANT_CONCEPT_ID = c1.concept_id INNER JOIN @vocab_database_schema.concept_ancestor ca2 ON c1.concept_id = ca2.ANCESTOR_CONCEPT_ID INNER JOIN @vocab_database_schema.concept c2 ON ca2.DESCENDANT_CONCEPT_ID = c2.concept_id WHERE ca1.ancestor_concept_id = 4040390 AND ca1.Min_LEVELS_OF_SEPARATION = 1 AND ca2.MIN_LEVELS_OF_SEPARATION = 1 GROUP BY c2.concept_id, c2.concept_name ) proc_by_os2 ON proc_by_os1.os1_concept_id = proc_by_os2.os1_concept_id INNER JOIN (SELECT max(c1.CONCEPT_ID) AS os2_concept_id, c2.concept_id AS os3_concept_id, c2.concept_name AS os3_concept_name FROM @vocab_database_schema.concept_ancestor ca1 INNER JOIN @vocab_database_schema.concept c1 ON ca1.DESCENDANT_CONCEPT_ID = c1.concept_id INNER JOIN @vocab_database_schema.concept_ancestor ca2 ON c1.concept_id = ca2.ANCESTOR_CONCEPT_ID INNER JOIN @vocab_database_schema.concept c2 ON ca2.DESCENDANT_CONCEPT_ID = c2.concept_id WHERE ca1.ancestor_concept_id = 4040390 AND ca1.Min_LEVELS_OF_SEPARATION = 2 AND ca2.MIN_LEVELS_OF_SEPARATION = 1 GROUP BY c2.concept_id, c2.concept_name ) proc_by_os3 ON proc_by_os2.os2_concept_id = proc_by_os3.os2_concept_id ) proc_hierarchy ON ca1.ancestor_concept_id = proc_hierarchy.os3_concept_id GROUP BY procs.concept_id, procs.proc_concept_name;
true
4f9b084e987d8d35dde36176ede43fcf70e1b77b
SQL
amadecode/skateshop
/skateshop.sql
UTF-8
4,587
3.109375
3
[]
no_license
-- phpMyAdmin SQL Dump -- version 4.1.12 -- http://www.phpmyadmin.net -- -- Host: 127.0.0.1 -- Generation Time: Mar 25, 2018 at 12:05 PM -- Server version: 5.6.16 -- PHP Version: 5.5.11 SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; SET time_zone = "+00:00"; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8 */; -- -- Database: `skateshop` -- -- -------------------------------------------------------- -- -- Table structure for table `brand` -- CREATE TABLE IF NOT EXISTS `brand` ( `id` int(11) NOT NULL AUTO_INCREMENT, `brand` varchar(255) COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=11 ; -- -- Dumping data for table `brand` -- INSERT INTO `brand` (`id`, `brand`) VALUES (6, 'Birdhouse'), (7, 'Globe'), (8, 'Almost'), (9, 'Blind'), (10, 'Darkstar'); -- -------------------------------------------------------- -- -- Table structure for table `categories` -- CREATE TABLE IF NOT EXISTS `categories` ( `id` int(11) NOT NULL AUTO_INCREMENT, `category` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `parent` int(11) NOT NULL DEFAULT '0', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=53 ; -- -- Dumping data for table `categories` -- INSERT INTO `categories` (`id`, `category`, `parent`) VALUES (29, 'Deck', 0), (30, 'Shortboard', 29), (31, 'Cruiser', 29), (32, 'Old School', 29), (33, 'Longboard', 29), (34, 'Trucks', 0), (35, 'Wheels', 0), (36, 'Bearings', 0), (37, 'Hardware', 0), (38, 'Griptape', 0), (39, 'Low Trucks', 34), (40, 'Mid Trucks', 34), (41, 'High Trucks', 34), (42, '50-53mm', 35), (43, '54-59mm', 35), (44, '60mm+', 35), (45, 'Steal', 36), (46, 'Ceramic', 36), (47, 'No riser', 37), (48, '1/8&quot; Riser', 37), (49, '1/4&quot; Riser', 37), (50, '1/2&quot; Riser', 37), (51, 'Skateboard', 38), (52, 'Longboard', 38); -- -------------------------------------------------------- -- -- Table structure for table `products` -- CREATE TABLE IF NOT EXISTS `products` ( `id` int(11) NOT NULL AUTO_INCREMENT, `title` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `price` decimal(10,2) NOT NULL, `list_price` decimal(10,2) NOT NULL, `brand` int(11) NOT NULL, `categories` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `image` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `description` text COLLATE utf8_unicode_ci NOT NULL, `featured` tinyint(4) NOT NULL DEFAULT '0', `sizes` text COLLATE utf8_unicode_ci NOT NULL, `deleted` tinyint(4) NOT NULL DEFAULT '0', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=5 ; -- -- Dumping data for table `products` -- INSERT INTO `products` (`id`, `title`, `price`, `list_price`, `brand`, `categories`, `image`, `description`, `featured`, `sizes`, `deleted`) VALUES (1, 'Levis Jeans', '29.99', '39.99', 1, '6', '/skateshop/images/products/men4.png', 'These jeans are amazing. They are super comfy and sexy! Buy them.', 0, '28:3,32:5,36:1', 0), (2, 'Beautiful Shirt', '19.99', '24.99', 1, '5', '/skateshop/images/products/men1.png', 'What a beautiful blue colored polo-shirt.', 0, 'Small:3,Medium:6,Large:9', 0), (3, 'Generic Shirt', '20.00', '15.00', 3, '13', '/skateshop/images/products/fbc3afb68d2b1f3203f3c1056879d2d5.png', 'This is a generic polo shirt for boys.', 0, 'Small:2,Medium:4,Large:6,', 0), (4, 'Globe Bantam Evo Black Maple Cruiser Complete Skateboard - 6.75&quot; x 24&quot;', '0.00', '0.00', 7, '31', '/skateshop/images/products/31f002f4a1086317bb5bbce1b218468b.jpg', 'Globe Bantam Evo Black Maple Cruiser Complete Skateboard - 6.75&quot; x 24&quot;', 1, '6.75&quot; x 24&quot;:10,6.75&quot; x 24&quot;:5,', 0); -- -------------------------------------------------------- -- -- Table structure for table `users` -- CREATE TABLE IF NOT EXISTS `users` ( `id` int(11) NOT NULL AUTO_INCREMENT, `username` varchar(100) NOT NULL, `password` varchar(100) NOT NULL, `type` varchar(10) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ; -- -- Dumping data for table `users` -- INSERT INTO `users` (`id`, `username`, `password`, `type`) VALUES (1, 'admin', '21232f297a57a5a743894a0e4a801fc3', 'admin'); /*!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
bd3acc67a861a9d2f0789b2b782aa2e771f2fe86
SQL
kt5007/sql_study
/scripts/chapter8.sql
UTF-8
1,714
3.578125
4
[]
no_license
SELECT shohin_mei, shohin_bunrui, hanbai_tanka, RANK () OVER ( PARTITION BY shohin_bunrui ORDER BY hanbai_tanka ) AS ranking FROM Shohin; -- 順位付け SELECT shohin_mei, shohin_bunrui, hanbai_tanka, RANK () OVER ( ORDER BY hanbai_tanka ) AS ranking, DENSE_RANK () OVER ( ORDER BY hanbai_tanka ) AS dense_ranking, ROW_NUMBER () OVER ( ORDER BY hanbai_tanka ) AS row_num FROM Shohin; -- 累計 SELECT shohin_id, shohin_mei, hanbai_tanka, SUM(hanbai_tanka) OVER (ORDER BY shohin_id) AS current_sum FROM Shohin; -- 移動平均 SELECT shohin_id, shohin_mei, hanbai_tanka, AVG(hanbai_tanka) OVER (ORDER BY shohin_id ROWS 2 PRECEDING) AS moving_sum FROM Shohin; SELECT shohin_id, shohin_mei, hanbai_tanka, AVG(hanbai_tanka) OVER (ORDER BY shohin_id ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING) AS moving_avg FROM Shohin; -- rollup SELECT shohin_bunrui, SUM(hanbai_tanka) AS sum_tanka FROM Shohin GROUP BY shohin_bunrui WITH ROLLUP; SELECT shohin_bunrui, torokubi, SUM(hanbai_tanka) AS sum_tanka FROM Shohin GROUP BY shohin_bunrui, torokubi WITH ROLLUP; SELECT CASE WHEN GROUPING(shohin_bunrui) = 1 THEN '商品分類 合計' ELSE shohin_bunrui END AS shohin_bunrui, CASE WHEN GROUPING(torokubi) = 1 THEN '登録日 合計' ELSE CAST(torokubi AS VARCHAR(16)) END AS torokubi, SUM(hanbai_tanka) AS sum_tanka FROM Shohin GROUP BY shohin_bunrui, torokubi WITH ROLLUP ; /* 1000 1000 4000 4000 6800 以降6800 */ SELECT shohin_id, shohin_mei, hanbai_tanka, MAX(hanbai_tanka) OVER(ORDER BY shohin_id) AS current_max_tanka FROM Shohin; -- 8.2 SELECT torokubi FROM Shohin GROUP BY GROUPING SETS (torokubi, shohin_mei);
true
57c197e8ca8eb5a08c5bbe4c82ec7983425025be
SQL
FChenebit/CryptoWallet
/databaseScript/createTable.sql
UTF-8
498
3.21875
3
[ "MIT" ]
permissive
-- Table: public.currency_rate -- DROP TABLE public."currency_rate"; CREATE TABLE public."currency_rate" ( "rate_id" serial PRIMARY KEY, "rate_date" date NOT NULL, "currency_code" character varying(10) COLLATE pg_catalog."default" NOT NULL, "rate_value" numeric ) TABLESPACE pg_default; ALTER TABLE public."currency_rate" OWNER to francoischenebit; CREATE INDEX idx_rate_date on currency_rate(rate_date); CREATE INDEX idx_currency_code on currency_rate(currency_code);
true
1e73365d85a34aff2b9e45ac57666716ba35ea7f
SQL
GlinZachariah/ARMS
/arms.sql
UTF-8
2,933
3.28125
3
[]
no_license
-- phpMyAdmin SQL Dump -- version 4.5.4.1deb2ubuntu2 -- http://www.phpmyadmin.net -- -- Host: localhost -- Generation Time: Nov 22, 2017 at 07:21 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: `arms` -- -- -------------------------------------------------------- -- -- Table structure for table `firstofficial` -- CREATE TABLE `firstofficial` ( `Staffid` int(8) NOT NULL, `Sem` int(11) DEFAULT NULL, `Branch` varchar(5) NOT NULL, `Section` varchar(5) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -------------------------------------------------------- -- -- Table structure for table `staffinfo` -- CREATE TABLE `staffinfo` ( `StaffID` int(8) NOT NULL, `Name` varchar(20) NOT NULL, `Job` varchar(20) NOT NULL, `Department` varchar(20) NOT NULL, `Priority` int(2) NOT NULL, `Password` varchar(15) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -------------------------------------------------------- -- -- Table structure for table `studinfo` -- CREATE TABLE `studinfo` ( `CollegeID` int(7) NOT NULL, `fullname` varchar(30) NOT NULL, `Branch` varchar(5) NOT NULL, `Section` varchar(5) DEFAULT NULL, `Sem` int(2) NOT NULL, `Password` varchar(12) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -------------------------------------------------------- -- -- Table structure for table `studreq` -- CREATE TABLE `studreq` ( `CollegeID` int(7) NOT NULL, `Date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `RequestCount` varchar(11) NOT NULL, `Attachment` varchar(50) DEFAULT NULL, `Reqsub` varchar(30) NOT NULL, `curstatus` varchar(8) NOT NULL, `Officer1` int(8) DEFAULT '0', `status1` int(2) DEFAULT '0', `Officer2` int(8) DEFAULT '0', `status2` int(2) DEFAULT '0', `Officer3` int(8) DEFAULT '0', `status3` int(2) DEFAULT '0' ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Indexes for dumped tables -- -- -- Indexes for table `firstofficial` -- ALTER TABLE `firstofficial` ADD PRIMARY KEY (`Staffid`); -- -- Indexes for table `staffinfo` -- ALTER TABLE `staffinfo` ADD PRIMARY KEY (`StaffID`); -- -- Indexes for table `studinfo` -- ALTER TABLE `studinfo` ADD PRIMARY KEY (`CollegeID`); -- -- Constraints for dumped tables -- -- -- Constraints for table `firstofficial` -- ALTER TABLE `firstofficial` ADD CONSTRAINT `fkey` FOREIGN KEY (`Staffid`) REFERENCES `staffinfo` (`StaffID`); /*!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
30378a79978997de3b97eb6a542b228a0feb4f5c
SQL
RickChuck/gitReady
/db/get_post.sql
UTF-8
259
3.40625
3
[]
no_license
-- SELECT * -- FROM blog_posts -- ORDER BY id DESC; SELECT blog_posts.id as post_id, post, user_id, user_name, movie_title, movie_poster FROM blog_posts JOIN users ON blog_posts.user_id = users.id -- WHERE blog_posts.user_id = $1 ORDER BY blog_posts.id DESC;
true
87a7dfe52e4c45f300c7516bc3e142da9037e1cc
SQL
rrighetti/cscripts
/sql/segments.sql
UTF-8
2,027
3.78125
4
[]
no_license
SET HEA ON LIN 500 PAGES 100 TAB OFF FEED OFF ECHO OFF VER OFF TRIMS ON TRIM ON TI OFF TIMI OFF; SELECT tablespace_name FROM dba_tablespaces ORDER BY 1; PRO PRO 1. Enter TABLESPACE_NAME (required) DEF tablespace_name = '&1.'; PRO COL size_gb FOR 999,990.000 HEA 'SIZE (GBs)'; COL percent FOR 990.0; COL segment_type HEA 'TYPE'; COL owner FOR A30; COL segment_name FOR A30; COL table_name FOR A30; COL column_name FOR A30; CLE BRE; BRE ON segment_type SKIP 1; COMP SUM LAB 'TOTAL' OF size_gb percent ON segment_type; COL current_time NEW_V current_time FOR A15; SELECT 'current_time: ' x, TO_CHAR(SYSDATE, 'YYYYMMDD_HH24MISS') current_time FROM DUAL; COL x_host_name NEW_V x_host_name; SELECT host_name x_host_name FROM v$instance; COL x_db_name NEW_V x_db_name; SELECT name x_db_name FROM v$database; COL x_container NEW_V x_container; SELECT 'NONE' x_container FROM DUAL; SELECT SYS_CONTEXT('USERENV', 'CON_NAME') x_container FROM DUAL; SPO segments_&&tablespace_name._&&current_time..txt; PRO TABLESPACE: &&tablespace_name. PRO HOST: &&x_host_name. PRO DATABASE: &&x_db_name. PRO PDB: &&x_container. SELECT v.segment_type, v.owner, v.segment_name, v.size_gb, v.percent, v.table_name, v.column_name FROM ( SELECT s.segment_type, s.owner, s.segment_name, SUM(s.bytes) / POWER(2, 30) size_gb, RANK() OVER (ORDER BY SUM(s.bytes) DESC) rank, ROUND(100 * SUM(s.bytes) / SUM(SUM(s.bytes)) OVER (), 1) percent, l.table_name, l.column_name FROM dba_segments s, dba_lobs l WHERE s.tablespace_name = UPPER(TRIM('&&tablespace_name.')) --AND s.segment_name NOT LIKE 'BIN$%' AND l.owner(+) = s.owner AND l.segment_name(+) = s.segment_name AND l.tablespace_name(+) = s.tablespace_name GROUP BY s.segment_type, s.owner, s.segment_name, l.table_name, l.column_name ) v WHERE v.rank <= 20 OR v.percent >= 1 ORDER BY v.segment_type DESC, v.rank / SPO OFF; CL BRE COMP;
true
4951e2da9df34bc006dfc9779f4d3122b4a9d5b0
SQL
NetwerkOorlogsBronnen/pilot-geocoderen
/scripts/nob.sql
UTF-8
3,722
3.203125
3
[]
no_license
-- phpMyAdmin SQL Dump -- version 4.4.10 -- http://www.phpmyadmin.net -- -- Host: localhost:8889 -- Generation Time: Jun 22, 2016 at 09:27 AM -- Server version: 5.5.42 -- PHP Version: 5.6.10 SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; SET time_zone = "+00:00"; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8mb4 */; -- -- Database: `niod_nob` -- -- -------------------------------------------------------- -- -- Table structure for table `oai_harvest` -- CREATE TABLE `oai_harvest` ( `id` int(11) NOT NULL, `identifier` char(255) NOT NULL, `datestamp` datetime DEFAULT NULL, `recordxml` text, `title` text, `dates` text, `subject` text, `coverage` text, `provenance` varchar(50) DEFAULT NULL, `dc_id` varchar(255) DEFAULT NULL, `json` text, `description` text, `thumb` varchar(255) NOT NULL, `is_shown_at` varchar(255) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -------------------------------------------------------- -- -- Table structure for table `o_x_t` -- CREATE TABLE `o_x_t` ( `id` int(11) NOT NULL, `term_id` int(11) NOT NULL, `identifier` varchar(25) NOT NULL, `collection` varchar(25) NOT NULL, `found_in` varchar(20) NOT NULL, `in_title` int(11) NOT NULL, `in_description` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -------------------------------------------------------- -- -- Table structure for table `terms` -- CREATE TABLE `terms` ( `id` int(11) NOT NULL, `term` varchar(255) NOT NULL, `found_in` varchar(20) NOT NULL, `geocoded` enum('no','yes') NOT NULL, `gn_geocoded` enum('no','yes') NOT NULL, `result` enum('none','one','multiple','rejected') NOT NULL COMMENT 'rejected = false pos (former one)', `normalized` varchar(255) NOT NULL, `identifier` varchar(255) NOT NULL, `type` varchar(40) NOT NULL, `lat` float NOT NULL, `lon` float NOT NULL, `rec_count` int(11) NOT NULL, `rec_count_txt` int(11) NOT NULL, `rec_count_cov` int(11) NOT NULL, `rec_count_sub` int(11) NOT NULL, `h_place_name` varchar(255) NOT NULL, `h_place_uri` varchar(255) NOT NULL, `h_municipality_name` varchar(255) NOT NULL, `h_municipality_uri` varchar(255) NOT NULL, `h_province_name` varchar(255) NOT NULL, `h_province_uri` varchar(255) NOT NULL, `h_country_name` varchar(255) NOT NULL, `h_country_uri` varchar(255) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Indexes for dumped tables -- -- -- Indexes for table `oai_harvest` -- ALTER TABLE `oai_harvest` ADD PRIMARY KEY (`id`), ADD KEY `identifier` (`identifier`), ADD KEY `provenance` (`provenance`); -- -- Indexes for table `o_x_t` -- ALTER TABLE `o_x_t` ADD PRIMARY KEY (`id`), ADD KEY `identifier` (`identifier`), ADD KEY `found_in` (`found_in`), ADD KEY `term_id` (`term_id`); -- -- Indexes for table `terms` -- ALTER TABLE `terms` ADD PRIMARY KEY (`id`), ADD KEY `term` (`term`), ADD KEY `h_place_uri` (`h_place_uri`), ADD KEY `rec_count_txt` (`rec_count_txt`); -- -- AUTO_INCREMENT for dumped tables -- -- -- AUTO_INCREMENT for table `oai_harvest` -- ALTER TABLE `oai_harvest` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT; -- -- AUTO_INCREMENT for table `o_x_t` -- ALTER TABLE `o_x_t` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT; -- -- AUTO_INCREMENT for table `terms` -- ALTER TABLE `terms` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT; /*!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
885d018a7c988a9cffdb00b72e1e24ae4101c3d1
SQL
UltraJag214/UserManagerPostgress
/users.sql
UTF-8
1,259
3.296875
3
[]
no_license
create table users ( user_id serial PRIMARY KEY, first_name text, last_name text, email text, age int ); create index concurrently "idx_first_name" on users using btree (first_name); create index concurrently "idx_last_name" on users using btree (last_name); insert into users (first_name, last_name, email, age) values ('Hayden', 'Gibbons', 'hayden.c.gibbons@gmail.com', 18); insert into users (first_name, last_name, email, age) values ('Chris', 'Gibbons', 'chris.gibbons@gmail.com', 50); insert into users (first_name, last_name, email, age) values ('Logan', 'Anderson', 'logan.anderson@gmail.com', 17); insert into users (first_name, last_name, email, age) values ('Karlie', 'Rawlings', 'karlie.rawlings@gmail.com', 18); insert into users (first_name, last_name, email, age) values ('Amanda', 'Keller', 'amanda.keller@gmail.com', 18); insert into users (first_name, last_name, email, age) values ('Jaxon', 'Keller', 'jaxon.keller@gmail.com', 18); insert into users (first_name, last_name, email, age) values ('Mason', 'Keller', 'mason.keller@gmail.com', 18); insert into users (first_name, last_name, email, age) values ('Carson', 'Keller', 'carson.keller@gmail.com', 18); insert into users (first_name, last_name, email, age) values ('Nate', 'Hadlock', 'nate.hadlock@gmail.com', 18); insert into users (first_name, last_name, email, age) values ('Sarah', 'Holt', 'sarah.holt@gmail.com', 18);
true
07a796ba083e01a3d6048a1de02537dea6b120ab
SQL
sangyoonlee019/ITE2038_DataBaseSystems
/project1/21.sql
UTF-8
150
3.515625
4
[]
no_license
select distinct t.name,count(*) ccount from Trainer t,CatchedPokemon c,Gym g where t.id=c.owner_id and g.leader_id=t.id group by t.id order by t.name;
true
6eb9e76a7929d863db5dd2b3ec64603ba8ae15c2
SQL
chrisjamesr/sql-library-lab-v-000
/lib/insert.sql
UTF-8
1,289
3.046875
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
INSERT INTO series (id, title, author_id, subgenre_id) VALUES (1, "Southern Reach", 1, 1), (2, "The Lord of the Rings", 2, 2); INSERT INTO subgenres (id, name) VALUES (1, "The New Weird"), (2, "Epic Fantasy"); INSERT INTO authors (id, name) VALUES (1, "Jeff VanderMeer"), (2, "J.R.R. Tolkien"); INSERT INTO books (id, title, year, series_id) VALUES (1, "Annihilation", 2014, 1), (2, "Authority", 2014, 1), (3, "Acceptance", 2014, 1), (4, "The Fellowship of the Ring", 1954, 2), (5, "The Two Towers", 1954, 2), (6, "The Return of the King", 1955, 2); INSERT INTO characters (id, name, motto, species, author_id, series_id) VALUES (1, "Biologist", "Where am i", "clone", 1, 1), (2, "Control", "Uh-oh", "human", 1, 1), (3, "Psychologist", "You have no idea", "human", 1, 1), (4, "Saul Evans", "Where lies the strangling fruit...", "monster", 1, 1), (5, "Samwise", "But Mr Frodo...", "hobbit", 2, 2), (6, "Gollum", "My Precious", "hobbit", 2, 2), (7, "Tom", "Giddyup", "deity", 2, 2), (8, "Sharky", "Hello friends", "wizard", 2, 2); INSERT INTO character_books(id, character_id, book_id) VALUES (1, 1, 1), (2, 1, 2), (3, 1, 3), (4, 2, 2), (5, 3, 1), (6, 4, 1), (7, 4, 2), (8, 4, 3), (9, 5, 4), (10, 5, 5), (11, 5, 6), (12, 6, 4), (13, 6, 5), (14, 6, 6), (15, 7, 4), (16, 8, 6);
true
12988b9bb3cb8a12483276c3f2a1cd5082f8a71b
SQL
sulgy0928/dbSql
/191104pr.sql
UTF-8
6,159
3.609375
4
[]
no_license
SELECT TO_CHAR(hiredate,'YYYYMM') hiredate_yyyymm,count(*) cnt FROM emp GROUP BY TO_CHAR(hiredate, 'YYYYMM'); SELECT DISTINCT TO_CHAR(hiredate,'YYYYMM') hiredate_yyyymm,count(*) cnt FROM emp GROUP BY TO_CHAR(hiredate, 'YYYYMM'); SELECT TO_CHAR(hiredate, 'YYYY') hiredate_yyyy, count(*) cnt FROM emp GROUP BY TO_CHAR(hiredate, 'YYYY') ORDER BY TO_CHAR(hiredate, 'YYYY'); SELECT * FROM emp ORDER BY empno; SELECT COUNT(deptno) cnt FROM dept; SELECT dept.dname, emp.ename, emp.job FROM emp NATURAL JOIN dept; --oracle�� �������� SELECT dept.dname, emp.ename, emp.job FROM emp, dept WHERE emp.deptno = dept.deptno; SELECT b.dname, a.ename, a.job FROM emp a, dept b WHERE a.deptno = b.deptno; SELECT dept.dname, emp.ename, emp.job FROM emp JOIN dept USING (deptno); SELECT dept.dname, emp.ename, emp.job FROM emp, dept WHERE emp.deptno = dept.deptno; SELECT emp.empno, emp.ename, emp.deptno, dept.dname FROM emp JOIN dept ON (emp.deptno = dept.deptno); --�ǽ�(JOIN 0) ppt 180p SELECT emp.empno, emp.ename, emp.deptno, dept.dname FROM emp JOIN dept ON(emp.deptno = dept.deptno ); SELECT * FROM emp; --empno, ename, job, mgr, hiredate, sal, comm, deptno SELECT * FROM dept; --deptno, dname, loc SELECT emp.empno, emp.ename, emp.deptno, dept.dname FROM emp JOIN dept ON (emp.deptno = dept.deptno) WHERE emp.deptno IN (10, 30); SELECT emp.empno, emp.ename, emp.deptno, dept.dname FROM emp JOIN dept ON(emp.deptno = dept.deptno ) WHERE emp.deptno = 10 OR emp.deptno = 30; SELECT emp.empno, emp.ename, sal, emp.deptno, dept.dname FROM emp JOIN dept ON(emp.deptno = dept.deptno) WHERE sal > 2500; --183p SELECT emp.empno, emp.ename, sal, emp.deptno, dept.dname FROM emp JOIN dept ON (emp.deptno = dept.deptno) WHERE sal > 2500 AND empno > 7600; --184p SELECT empno, ename, sal, emp.deptno, dname FROM emp JOIN dept ON (emp.deptno = dept.deptno) WHERE sal > 2500 AND dname = 'RESEARCH'; --185p SELECT lprod_gu, lprod_nm, prod_id, prod.prod_name FROM lprod JOIN prod ON(lprod.lprod_gu = prod.prod_lgu); SELECT * FROM buyer; --buyer_id,buyer_name, buyer_gu SELECT * FROM prod; --prod_id, prod_name --186p JOIN�� �ǽ� SELECT buyer_id, buyer_name, prod_id, prod_name FROM buyer JOIN prod ON (buyer_id = prod_buyer); --187p SELECT mem_id, mem_name, prod_id, prod_name, cart_qty FROM member JOIN cart ON (mem_id = cart_member) JOIN prod ON(prod_id = cart_prod); SELECT mem_id, mem_name, prod_id, prod_name, cart_qty FROM member JOIN cart ON (mem_id = cart_member) JOIN prod ON(prod_id = cart_prod); SELECT * FROM cart; --189p SELECT customer.cid, customer.cnm, pid, day, cnt FROM customer JOIN cycle ON (customer.cid = cycle.cid) AND customer.cid < 3; --190P SELECT customer.cid, customer.cnm, product.pid, product.pnm,cycle.day, cycle.cnt FROM cycle JOIN product ON (cycle.pid = product.pid) JOIN customer ON(customer.cid = cycle.cid) AND customer.cnm IN('brown', 'sally'); SELECT * FROM product; --��ǰ. pidǰ��, pnmǰ�� SELECT * FROM cycle; --�����ֱ�. cid������ȣ, pidǰ��, day����, cnt���� SELECT * FROM customer; --����. cid������ȣ, cnm������ --cycle�� cid, + product�� pid, pnm --191p SELECT customer.cid, cnm, cycle.pid, pnm, sum(cnt) cnt FROM customer, cycle, product WHERE customer.cid = cycle.cid AND cycle.pid = product.pid GROUP BY customer.cid, cnm, cycle.pid, pnm; SELECT cycle.pid,product.pnm, sum(cycle.cnt)cnt FROM cycle JOIN product ON (cycle.pid = product.pid) GROUP BY cycle.pid, product.pnm; SELECT * FROM cycle; SELECT * FROM product; SELECT cycle.pid, product.pnm , SUM(cycle.cnt) cnt FROM cycle JOIN product ON(cycle.pid = product.pid) GROUP BY cycle.pid, pnm; --194p SELECT *--region_id, region_name, country_name FROM countries, regions; SELECT deptno --20 FROM emp WHERE ename = 'SMITH'; SELECT * FROM emp WHERE deptno = 20; --SALES SELECT * FROM emp WHERE sal > (SELECT AVG(sal) FROM emp); SELECT * FROM emp WHERE sal > (SELECT AVG(sal) FROM emp); SELECT * FROM emp WHERE deptno IN(SELECT deptno FROM emp WHERE ename IN('SMITH', 'WARD')); SELECT * FROM emp WHERE deptno IN(SELECT deptno FROM emp WHERE ename IN('SMITH', 'WARD')); --SALES SELECT * FROM sales; SELECT * FROM emp WHERE (mgr, deptno) IN (SELECT mgr, deptno FROM emp WHERE empno IN (7499, 7782)); --��ó�� ���Ϸ��� �Ʒ�ó�� �� �� �� ������ ¥����. --��������� �ð����� ��� SELECT * FROM emp WHERE mgr IN (SELECT mgr FROM emp WHERE empno IN (7499, 7782)); SELECT * FROM emp WHERE deptno IN (SELECT deptno FROM emp WHERE empno IN (7499, 7782)); SELECT (SELECT SYSDATE FROM dual) sdt FROM dual; SELECT (SELECT dname FROM dept WHERE deptno = emp.deptno) dname, emp.empno, ename FROM emp; SELECT * FROM emp WHERE empno IN (SELECT mgr FROM emp); SELECT * FROM (SELECT AVG(sal) sal_avg FROM emp); SELECT * FROM emp a WHERE sal > (SELECT AVG(sal) FROM emp b WHERE deptno = a.deptno); --224p ���� �μ��� �޿� ��պ��� ���� ���� ��ȸ.(��ȣ������������) SELECT * FROM emp WHERE sal > (SELECT AVG(sal) FROM emp WHERE deptno = deptno); SELECT * FROM emp a; SELECT * FROM emp b;
true
b6e29e1278c12126e709b9ad7d1eef8abe6a3977
SQL
favorbob/qklproject
/token-mj/src/main/sql/update.sql
UTF-8
1,070
3.109375
3
[]
no_license
ALTER TABLE eth_trade_record CHANGE `flow_type` `from_flow_type` TINYINT(2) DEFAULT 1 NOT NULL COMMENT '流水类型,1:lockedbalance,2:balance,3积分', CHANGE `trade_no` `trade_no` VARCHAR(64) CHARSET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' NOT NULL COMMENT '交易订单号', ADD COLUMN `to_flow_type` TINYINT(2) DEFAULT 1 NOT NULL COMMENT '流水类型,1:lockedbalance,2:balance,3积分' AFTER `trade_no`; ALTER TABLE eth_asset_flow CHANGE `trade_no` `trade_no` VARCHAR(64) CHARSET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '交易号'; ALTER TABLE eth_asset_flow CHANGE `trade_type` `trade_type` INT(11) NOT NULL COMMENT '流水类型_flow_type'; ALTER TABLE eth_asset_flow ADD column `opt_type` INT(11) NOT NULL COMMENT '0:系统兑换,1:用户兑换 '; ALTER TABLE eth_trade_record CHANGE `remark` `from_remark` VARCHAR(1024) CHARSET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' NULL COMMENT 'from交易备注', ADD COLUMN `to_remark` VARCHAR(1024) DEFAULT '' NULL COMMENT 'to交易备注' AFTER `to_flow_type`;
true
3f78778c315a838ea1c6a248e86d638e1cd9413c
SQL
hgolaszewski/jokebox-backend
/src/db/db_changelog.sql
UTF-8
2,530
3.25
3
[]
no_license
--liquibase formatted sql; --changeset hubert:1 CREATE TABLE Category ( id INT PRIMARY KEY AUTO_INCREMENT, name VARCHAR(64) NOT NULL UNIQUE, requestparam VARCHAR(64) NOT NULL UNIQUE, address VARCHAR(255) NOT NULL UNIQUE ); CREATE TABLE Joke ( id INT PRIMARY KEY AUTO_INCREMENT, category_id INT, content MEDIUMTEXT NOT NULL ); ALTER TABLE joke ADD FOREIGN KEY (category_id) REFERENCES Category(id) ON DELETE SET NULL ON UPDATE CASCADE; --changeset hubert:2 INSERT INTO Category (id, name, requestparam, address) VALUES (1, 'Alkohol', 'alkohol', 'http://alkohol.dowcipy.pl'); INSERT INTO Category (id, name, requestparam, address) VALUES (2, 'Apteka', 'apteka', 'http://apteka.dowcipy.pl'); INSERT INTO Category (id, name, requestparam, address) VALUES (3, 'Baca', 'baca', 'http://o-bacy.dowcipy.pl'); INSERT INTO Category (id, name, requestparam, address) VALUES (4, 'Dresiarze', 'dresiarze', 'http://dresiarze.dowcipy.pl'); INSERT INTO Category (id, name, requestparam, address) VALUES (5, 'Kobiety', 'kobiety', 'http://kobiety.dowcipy.pl'); INSERT INTO Category (id, name, requestparam, address) VALUES (6, 'Mężczyźni', 'mezczyzni', 'http://mezczyzni.dowcipy.pl'); INSERT INTO Category (id, name, requestparam, address) VALUES (7, 'Putin', 'putin', 'http://putin.dowcipy.pl'); INSERT INTO Category (id, name, requestparam, address) VALUES (8, 'Jasiu', 'o-jasiu', 'http://o-jasiu.dowcipy.pl'); --changeset hubert:3 INSERT INTO Category (id, name, requestparam, address) VALUES (9, 'Dzieci', 'dzieci', 'http://dzieci.dowcipy.pl'); INSERT INTO Category (id, name, requestparam, address) VALUES (10, 'Lotto', 'lotto', 'http://lotto.dowcipy.pl'); INSERT INTO Category (id, name, requestparam, address) VALUES (11, 'Zajączek', 'zajaczek', 'http://zajaczek.dowcipy.pl'); INSERT INTO Category (id, name, requestparam, address) VALUES (12, 'Chuck Norris', 'chuck', 'http://chuck-norris.dowcipy.pl'); --changeset hubert:4 INSERT INTO Category (id, name, requestparam, address) VALUES (13, 'Naukowcy', 'naukowcy', 'http://naukowcy.dowcipy.pl'); INSERT INTO Category (id, name, requestparam, address) VALUES (14, 'Puchatek', 'puchatek', 'http://kubus-puchatek.dowcipy.pl'); INSERT INTO Category (id, name, requestparam, address) VALUES (15, 'Stalin', 'stalin', 'http://stalin.dowcipy.pl'); INSERT INTO Category (id, name, requestparam, address) VALUES (16, 'Zoo', 'zoo', 'http://zoo.dowcipy.pl'); --changset adam:5 ALTER TABLE Joke ADD like_number INT; ALTER TABLE Joke ADD unlike_number INT;
true
34007633c32042529cc3d99050dc409d03ac9e45
SQL
mrprompt/mailing
/application/configs/schema/tables/email.sql
UTF-8
903
3.15625
3
[]
no_license
CREATE TABLE `email` ( `id_email` int(11) unsigned NOT NULL AUTO_INCREMENT, `id_email_grupo` int(11) unsigned NOT NULL, `id_empresa` int(11) unsigned NOT NULL, `str_nome` varchar(160) DEFAULT NULL, `str_email` varchar(255) NOT NULL, `str_hash` varchar(200) NOT NULL, `dat_log` datetime DEFAULT '0000-00-00 00:00:00', `int_status` set('0','1','2','3') DEFAULT '0', PRIMARY KEY (`id_email`,`id_empresa`,`id_email_grupo`), UNIQUE KEY `str_hash_UNIQUE` (`str_hash`), KEY `fk_email_empresa` (`id_empresa`), KEY `fk_email_grupo` (`id_email_grupo`), CONSTRAINT `fk_email_grupo` FOREIGN KEY (`id_email_grupo`) REFERENCES `email_grupo` (`id_email_grupo`) ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT `fk_email_empresa` FOREIGN KEY (`id_empresa`) REFERENCES `empresa` (`id_empresa`) ON DELETE CASCADE ON UPDATE NO ACTION ) ENGINE=InnoDB AUTO_INCREMENT=7277582 DEFAULT CHARSET=utf8
true
7c85463718bb390e701b6231a9c898958b61aa6b
SQL
haikalazhar197/citra-iium-membership_system-sql
/citramembershipsystem_data.sql
UTF-8
9,663
2.53125
3
[]
no_license
--Users INSERT INTO USERS(displayname, email, userpassword) VALUES('samsuladry', 'samsul@example.com', '$2a$10$DsAmJSdmbHSoHpcaul09A.d./Wxf9i/caUKP9ggO86tr8kmMEVUzG'); INSERT INTO USERS(displayname, email, userpassword) VALUES('haikalazhar197', 'haikalazhar197@gmail.com', '$2a$10$3/oz8Neqk0/A5gub7427KuXRT.uBwRlG.LDA9q7tnqJdw9ArIKFF6'); INSERT INTO USERS(displayname, email, userpassword) VALUES('apipguitar', 'afifguitar@example.com', '$2a$10$jxDHicMpKbZn4QCNuG2X8e/AsqwXjWzWIZz9GUGaZnBxXg9/RM6hO'); INSERT INTO USERS(displayname, email, userpassword) VALUES('lisanorosmi97', 'lisanorosmi97@example.com', '$2a$10$FQ2BLN02fd8nCMnTyl5VSuasvXONqdqZNCFTW1orxdsia6boxhPem'); INSERT INTO USERS(displayname, email, userpassword) VALUES('haikal97', 'haikal97@gmail.com', '$2a$10$RZRznkqTBxRmWYi2GwcFOe4IUlSYDuVhAh6TIVAmE2zt0NblgX6sC'); INSERT INTO USERS(displayname, email, userpassword) VALUES('shah', 'shah@example.com', '$2a$10$DW57jgKqHaRZ05nOysSqIuT634GjsjyyXIk1Eh.K1E3xwmemEhrK6'); INSERT INTO USERS(displayname, email, userpassword) VALUES('mujahid', 'mujahid@example.com', '$2a$10$fO5VwXuBV9UrgZZykL7I3uh.CAJgwdZXpRFce.ijD41fOz4JhipQ6'); INSERT INTO USERS(displayname, email, userpassword) VALUES('hisyam98', 'hisyam98@example.com', '$2a$10$qKkrsQ/X.nI0Y6wlgOBPX.9S41B2uEVfX0DGixkWkmEy3GmAtTNbS'); INSERT INTO USERS(displayname, email, userpassword) VALUES('amirasyakirah', 'amirasyakirah@example.com', '$2a$10$VEqZ5qswBgVpwLSQrsgmv.ynXaqH4iY2LCJOBjo54CE5bBfKqIXZa'); INSERT INTO USERS(displayname, email, userpassword) VALUES('faiz', 'faiz@example.com', '$2a$10$QRXGOIYRlXFt9XFZmjeJiemFaL8Vs1jL4DPLZ6w1AP7UHEVC6X5a6'); INSERT INTO USERS(displayname, email, userpassword) VALUES('farismazlan', 'farismzln@example.com', '$2a$10$inoJqYRSuI6f3Lats9RsZuQJ914Ep4E8iWF6b0k/WlJcfuvSWQwUq'); INSERT INTO USERS(displayname, email, userpassword) VALUES('marha3697', 'marha3697@gmail.com', '$2a$10$kS.bL6HaRD8CZEFSGgOz0e1y7eWtsp5STi7pkbvrvJ.9ibx4yq196'); INSERT INTO USERS(displayname, email, userpassword) VALUES('uzairdaumi', 'uzairdaumi@example.com', '$2a$10$kjAhPSqnMn9OBdfrL316o.4fy1jOF7KGfxWvZM3D39ayJxOZWJ2D6'); INSERT INTO USERS(displayname, email, userpassword) VALUES('awangku', 'awangkufikri@example.com', '$2a$10$mug/yMcRhjMWLXknke8f3exyhUTkNP.pU0qfYdUY.mlXp8Fv0Rug.'); INSERT INTO USERS(displayname, email, userpassword) VALUES('fiqrishuib', 'fiqrishuib@example.com', '$2a$10$zgNcQLmBEAtboHHRy8kgEukgW.dvYN7ld2pLvaBaB76GCmRS/MOiK'); INSERT INTO USERS(displayname, email, userpassword) VALUES('dayangsorfina', 'sorfina@example.com', '$2a$10$QodKnkeqfMjKle144jhQc.X2W3xyQZqBngYSnwo1Q/.LsP4qwpjI.'); INSERT INTO USERS(displayname, email, userpassword) VALUES('hilmarina', 'hilmarina@example.com', '$2a$10$lsEchXW5DvrxZIvtfNTGLe2SjJJPZRcRAc5dg1L8DD5CtR5HqosYS'); INSERT INTO USERS(displayname, email, userpassword) VALUES('sabrina', 'sabrina@example.com', '$2a$10$MwZ8MgGlyPuuaWP.AU6mSOpSSvOOElS027f/niwHdaI5YONpMBQhe'); INSERT INTO USERS(displayname, email, userpassword) VALUES('syahirahisham', 'syahirahisham@example.com', '$2a$10$C6QilxTUv1PEf8Dvxrtj1uEYRFE1.c8diXoIrsP3W3iU62ua4gl4m'); INSERT INTO USERS(displayname, email, userpassword) VALUES('faridrahman', 'faridrahman@example.com', '$2a$10$G5fVHssQ3WkUcbpQGcgM.OaiJQbz.XTbsDc5uoyyLf6IR66bT3QOy'); --Clubs INSERT INTO CLUBS(clubname, niche) VALUES('IIUM Acousstic Band', 'Band'); INSERT INTO CLUBS(clubname, niche) VALUES('Andeka Caklempong', 'Traditional'); INSERT INTO CLUBS(clubname, niche) VALUES('Gamelan Gema Gangsa', 'Traditional'); INSERT INTO CLUBS(clubname, niche) VALUES('IIUM Angklong Club', 'Traditional'); INSERT INTO CLUBS(clubname, niche) VALUES('IIUM Theatre Club', 'Performance'); INSERT INTO CLUBS(clubname, niche) VALUES('IIUM Percussion Club', 'Traditional'); INSERT INTO CLUBS(clubname, niche) VALUES('IIUM Nafastari Dance Club', 'Dance'); INSERT INTO CLUBS(clubname, niche) VALUES('IIUM Film and Creative Production Club', 'Production'); INSERT INTO CLUBS(clubname, niche) VALUES('IIUM Nasyeed Club', 'Voice'); INSERT INTO CLUBS(clubname, niche) VALUES('IIUM Poetry Club', 'Poetry'); --Staffs INSERT INTO STAFFS(USERID, FULLNAME, POSITION) VALUES(8, 'Hisyam', 'Staff'); INSERT INTO STAFFS(USERID, FULLNAME, POSITION) VALUES(11, 'Faris Mazlan', 'Trainer'); INSERT INTO STAFFS(USERID, FULLNAME, POSITION) VALUES(13, 'Uzair Daumi', 'Trainer'); INSERT INTO STAFFS(USERID, FULLNAME, POSITION) VALUES(14, 'Awangku Mohamad Fikri', 'Staff'); INSERT INTO STAFFS(USERID, FULLNAME, POSITION) VALUES(15, 'Fiqri Shuib', 'Staff'); INSERT INTO STAFFS(USERID, FULLNAME, POSITION) VALUES(16, 'Dayang Sorfina', 'Trainer'); INSERT INTO STAFFS(USERID, FULLNAME, POSITION) VALUES(17, 'Hilma Rina', 'Staff'); INSERT INTO STAFFS(USERID, FULLNAME, POSITION) VALUES(18, 'Sabrina', 'Clerk'); INSERT INTO STAFFS(USERID, FULLNAME, POSITION) VALUES(19, 'Syahirah Hisham', 'Finance'); INSERT INTO STAFFS(USERID, FULLNAME, POSITION) VALUES(20, 'Farid Rahman', 'Staff'); --Members INSERT INTO MEMBERS(USERID, CLUBID, FULLNAME, AGE, MATRICNO, COURSE, KULLIYAH, STATUS, DESIGNATION, POSITION) VALUES(1, 1, 'Samsul Adry', 23, 171389, 'Computer Science', 'KICT', 'active', 'Guitar', 'Vice President 1'); INSERT INTO MEMBERS(USERID, CLUBID, FULLNAME, AGE, MATRICNO, COURSE, KULLIYAH, STATUS, DESIGNATION, POSITION) VALUES(1, 3, 'Samsul Adry', 23, 171389, 'Computer Science', 'KICT', 'active', 'Member', 'None'); INSERT INTO MEMBERS(USERID, CLUBID, FULLNAME, AGE, MATRICNO, COURSE, KULLIYAH, STATUS, DESIGNATION, POSITION) VALUES(2, 1, 'Mohamad Haikal Bin Mohamad Azhar', 23, 1626675, 'Computer Science', 'KICT', 'active', 'Guitar', 'Head Librarian'); INSERT INTO MEMBERS(USERID, CLUBID, FULLNAME, AGE, MATRICNO, COURSE, KULLIYAH, STATUS, DESIGNATION, POSITION) VALUES(3, 1, 'Afif', 23, 172000, 'Psychology', 'Human Science', 'active', 'Guitar', 'President'); INSERT INTO MEMBERS(USERID, CLUBID, FULLNAME, AGE, MATRICNO, COURSE, KULLIYAH, STATUS, DESIGNATION, POSITION) VALUES(4, 1, 'Lisa Norosmi', 23, 171000, 'Psychology', 'Human Science', 'active', 'Management', 'Vice President 2'); INSERT INTO MEMBERS(USERID, CLUBID, FULLNAME, AGE, MATRICNO, COURSE, KULLIYAH, STATUS, DESIGNATION, POSITION) VALUES(4, 2, 'Lisa Norosmi', 23, 171000, 'Psychology', 'Human Science', 'active', 'Management', 'Vice President 2'); INSERT INTO MEMBERS(USERID, CLUBID, FULLNAME, AGE, MATRICNO, COURSE, KULLIYAH, STATUS, DESIGNATION, POSITION) VALUES(9, 1, 'Amira Syakirah', 22, 172001, 'Economics', 'Econs', 'active', 'Musician', 'None'); INSERT INTO MEMBERS(USERID, CLUBID, FULLNAME, AGE, MATRICNO, COURSE, KULLIYAH, STATUS, DESIGNATION, POSITION) VALUES(5, 1, 'Rafiq Haikal Rosdin', 23, 162000, 'Engineering', 'KOE', 'active', 'Drummer', 'None'); INSERT INTO MEMBERS(USERID, CLUBID, FULLNAME, AGE, MATRICNO, COURSE, KULLIYAH, STATUS, DESIGNATION, POSITION) VALUES(6, 1, 'Shah', 23, 172002, 'Literature', 'Celpad', 'active', 'Violin', 'Treasurer'); INSERT INTO MEMBERS(USERID, CLUBID, FULLNAME, AGE, MATRICNO, COURSE, KULLIYAH, STATUS, DESIGNATION, POSITION) VALUES(7, 1, 'Mujahid', 23, 162001, 'Hs', 'Human Science', 'active', 'Flute', 'None'); INSERT INTO MEMBERS(USERID, CLUBID, FULLNAME, AGE, MATRICNO, COURSE, KULLIYAH, STATUS, DESIGNATION, POSITION) VALUES(10, 1, 'Faiz Bass', 23, 172003, 'Engineering', 'KOE', 'active', 'Bass', 'None'); INSERT INTO MEMBERS(USERID, CLUBID, FULLNAME, AGE, MATRICNO, COURSE, KULLIYAH, STATUS, DESIGNATION, POSITION) VALUES(12, 1, 'Marha Batrisyia', 23, 1626789, 'Economics', 'Econs', 'active', 'Trumpet', 'None'); --Club Staff Management INSERT INTO club_staff_management VALUES(1, 1); INSERT INTO club_staff_management VALUES(2, 1); INSERT INTO club_staff_management VALUES(2, 3); INSERT INTO club_staff_management VALUES(3, 1); INSERT INTO club_staff_management VALUES(4, 1); INSERT INTO club_staff_management VALUES(4, 3); INSERT INTO club_staff_management VALUES(5, 1); INSERT INTO club_staff_management VALUES(5, 9); INSERT INTO club_staff_management VALUES(5, 7); INSERT INTO club_staff_management VALUES(6, 1); INSERT INTO club_staff_management VALUES(6, 2); INSERT INTO club_staff_management VALUES(7, 4); INSERT INTO club_staff_management VALUES(7, 6); INSERT INTO club_staff_management VALUES(8, 3); INSERT INTO club_staff_management VALUES(8, 9); INSERT INTO club_staff_management VALUES(8, 10); INSERT INTO club_staff_management VALUES(9, 5); INSERT INTO club_staff_management VALUES(9, 1); INSERT INTO club_staff_management VALUES(10, 4); INSERT INTO club_staff_management VALUES(10, 8); INSERT INTO club_staff_management VALUES(4, 9); --Applications INSERT INTO USER_APPLICATION(FULLNAME, EMAIL, AGE, MATRICNO, COURSE, KULLIYAH, CLUBID, application_status) VALUES('Zana Safwan', 'zana@example.com', 22, 172033, 'Economics', 'Econs', 1, 'processing'); INSERT INTO USER_APPLICATION(FULLNAME, EMAIL, AGE, MATRICNO, COURSE, KULLIYAH, CLUBID, application_status) VALUES('Suhaimi Samsudin', 'suhaimi@example.com', 19, 172004, 'Computer Science', 'KICT', 3, 'rejected'); INSERT INTO USER_APPLICATION(FULLNAME, EMAIL, AGE, MATRICNO, COURSE, KULLIYAH, CLUBID, application_status) VALUES('Amin Aiman', 'aminaiman@example.com', 19, 181000, 'Hs', 'Human Science', 1, 'processing'); INSERT INTO USER_APPLICATION(FULLNAME, EMAIL, AGE, MATRICNO, COURSE, KULLIYAH, CLUBID, application_status) VALUES('Izzat', 'izzat@example.com', 25, 152000, 'Information Technology', 'KICT', 1, 'accepted'); INSERT INTO USER_APPLICATION(FULLNAME, EMAIL, AGE, MATRICNO, COURSE, KULLIYAH, CLUBID, application_status) VALUES('Megat Haikal', 'mehathaikal@example.com', 23, 162008, 'Computer Science', 'KICT', 1, 'accepted'); INSERT INTO USER_APPLICATION(FULLNAME, EMAIL, AGE, MATRICNO, COURSE, KULLIYAH, CLUBID, application_status) VALUES('Amrin', 'amrin@example.com', 28, 141000, 'Computer Science', 'KICT', 3, 'rejected'); INSERT INTO USER_APPLICATION(FULLNAME, EMAIL, AGE, MATRICNO, COURSE, KULLIYAH, CLUBID, application_status) VALUES('Hafiz Zulhilmi', 'hafizzulhilmi@example.com', 20, 181001, 'Architecture', 'KAED', 5, 'rejected'); INSERT INTO USER_APPLICATION(FULLNAME, EMAIL, AGE, MATRICNO, COURSE, KULLIYAH, CLUBID, application_status) VALUES('Saidatul Akhyar Azizi', 'saad@example.com', 22, 172008, 'Hs', 'Human Science', 8, 'processing'); INSERT INTO USER_APPLICATION(FULLNAME, EMAIL, AGE, MATRICNO, COURSE, KULLIYAH, CLUBID, application_status) VALUES('Aif Suhayl', 'afif@example.com', 20, 182800, 'Hs', 'Human Science', 4, 'processing'); INSERT INTO USER_APPLICATION(FULLNAME, EMAIL, AGE, MATRICNO, COURSE, KULLIYAH, CLUBID, application_status) VALUES('Hairul Asri', 'hairul@example.com', 24, 172009, 'Engineering', 'KOE', 3, 'rejected'); SELECT * FROM MEMBERS; SELECT * FROM USERS; SELECT * FROM CLUBS; SELECT * FROM STAFFS; SELECT * FROM CLUB_STAFF_MANAGEMENT WHERE STAFFID = 7; SELECT * FROM USER_APPLICATION;
true
5a52e63dac58b9ce00b37d47985a105cb0ebed2b
SQL
barend-erasmus/world-of-rations-db
/scripts/insertUser.sql
UTF-8
381
3.5
4
[ "MIT" ]
permissive
DELIMITER // CREATE PROCEDURE insertUser ( p_username CHAR(128), p_lastLoginTimestamp BIGINT ) BEGIN INSERT INTO worldofrations.users (`id`, `username`, `lastLoginTimestamp`) SELECT uuid(), p_username, p_lastLoginTimestamp FROM worldofrations.users WHERE NOT EXISTS ( SELECT * FROM worldofrations.users WHERE `username` = p_username); END; // DELIMITER ;
true
28ddbe7ebebea27cf7a07ad2b9cc0a6a75ad5b02
SQL
NMDSdevopsServiceAdm/SopraSteria-SFC
/resources/db/jobs.sql
UTF-8
2,104
3
3
[ "MIT" ]
permissive
-- Table: cqc."Job" -- DROP TABLE cqc."Job"; CREATE TABLE cqc."Job" ( "JobID" integer NOT NULL, "JobName" text COLLATE pg_catalog."default", CONSTRAINT "Job_pkey" PRIMARY KEY ("JobID") ) WITH ( OIDS = FALSE ) TABLESPACE pg_default; ALTER TABLE cqc."Job" OWNER to sfcadmin; insert into cqc."Job" ("JobID", "JobName") values (1, 'Senior Care Worker'); insert into cqc."Job" ("JobID", "JobName") values (2, 'Care Worker'); insert into cqc."Job" ("JobID", "JobName") values (3, 'Community Support and Outreach Work'); insert into cqc."Job" ("JobID", "JobName") values (4, 'Advice Guidance and Advocacy'); insert into cqc."Job" ("JobID", "JobName") values (5, 'Other care-providing job role'); insert into cqc."Job" ("JobID", "JobName") values (6, 'Senior Management'); insert into cqc."Job" ("JobID", "JobName") values (7, 'Middle Management'); insert into cqc."Job" ("JobID", "JobName") values (8, 'First Line Manager'); insert into cqc."Job" ("JobID", "JobName") values (9, 'Registered Manager'); insert into cqc."Job" ("JobID", "JobName") values (10, 'Supervisor'); insert into cqc."Job" ("JobID", "JobName") values (11, 'Managers and staff in care-related but not care-providing roles'); insert into cqc."Job" ("JobID", "JobName") values (12, 'Social Worker'); insert into cqc."Job" ("JobID", "JobName") values (13, 'Occupational Therapist'); insert into cqc."Job" ("JobID", "JobName") values (14, 'Registered Nurse'); insert into cqc."Job" ("JobID", "JobName") values (15, 'Allied Health Professional'); insert into cqc."Job" ("JobID", "JobName") values (15, 'Safeguarding and reviewing officer'); insert into cqc."Job" ("JobID", "JobName") values (16, 'Administrative or office staff not care-providing'); insert into cqc."Job" ("JobID", "JobName") values (17, 'Ancillary staff not care-providing'); insert into cqc."Job" ("JobID", "JobName") values (18, 'Activities worker or co-ordinator'); insert into cqc."Job" ("JobID", "JobName") values (19, 'Occupational therapist assistant'); insert into cqc."Job" ("JobID", "JobName") values (20, 'Other non-care-providing job roles');
true
0340ba0c3b45eb7bef3a7f6aabdc8e529ea687a3
SQL
PauGuirao/LSPIANO
/BaseDeDades/BBDD.sql
UTF-8
2,042
3.5625
4
[]
no_license
-- Creacio base de dades DROP DATABASE IF EXISTS DB; CREATE DATABASE DB; USE DB; DROP USER IF EXISTS 'admin'@'localhost'; CREATE USER 'admin'@'localhost' IDENTIFIED BY '1234'; GRANT ALL PRIVILEGES ON * . * TO 'admin'@'localhost'; -- Creacio de taules DROP TABLE IF EXISTS Usuari CASCADE; CREATE TABLE Usuari ( codiAmic VARCHAR(9), password VARCHAR(255), email VARCHAR(255), nickname VARCHAR(255), key_bindings VARCHAR(25), PRIMARY KEY(codiAmic) ); DROP TABLE IF EXISTS Canco CASCADE; CREATE TABLE Canco ( id_canco VARCHAR(255), public BOOLEAN, nom VARCHAR(255), durada INTEGER, creador VARCHAR(9), data_creacio TIME, PRIMARY KEY(id_canco) ); DROP TABLE IF EXISTS Reprodueix CASCADE; CREATE TABLE Reprodueix ( id_reprodueix SERIAL, id_canco VARCHAR(255), data_reproduccio VARCHAR(255), temps_reproduccio INTEGER, PRIMARY KEY(id_reprodueix) ); DROP TABLE IF EXISTS Amics CASCADE; CREATE TABLE Amics ( codiAmic1 VARCHAR(9), codiAmic2 VARCHAR(9), sender VARCHAR(9), pending BOOLEAN, PRIMARY KEY(codiAmic1, codiAmic2) ); DROP TABLE IF EXISTS Nota CASCADE; CREATE TABLE Nota ( id_nota VARCHAR(255), nom VARCHAR(255), inici INTEGER, final INTEGER, PRIMARY KEY(id_nota) ); DROP TABLE IF EXISTS cancoNota CASCADE; CREATE TABLE cancoNota ( id_canco VARCHAR(255), id_nota VARCHAR(255), PRIMARY KEY(id_canco, id_nota), FOREIGN KEY(id_canco) REFERENCES Canco(id_canco), FOREIGN KEY(id_nota) REFERENCES Nota(id_nota) ); -- Mostra les taules SELECT * FROM Usuari; SELECT * FROM Canco; SELECT * FROM Reprodueix; SELECT * FROM Amics; SELECT * FROM Nota; SELECT * FROM cancoNota; -- Creacio del usuari INSERT INTO usuari(codiAmic,password,email,nickname)VALUES('123456788','1234','test@test.com','test'); -- Insert de les tres cançons publiques INSERT INTO canco(id_canco,public,nom,creador)VALUES('Midi1',1,'Midi1','0'); INSERT INTO canco(id_canco,public,nom,creador)VALUES('Midi2',1,'Midi2','0'); INSERT INTO canco(id_canco,public,nom,creador)VALUES('Midi3',1,'Midi3','0');
true
fdd93d613dc4924e95db52d3099485ba4d65fc31
SQL
DimaGashko/funnySqlTasks
/1.sql
UTF-8
216
3.15625
3
[]
no_license
-- https://vk.com/zadachi_sql?w=wall-126489801_2 SELECT MAX(salary) FROM worker; SELECT id, name, salary FROM worker WHERE salary = ( SELECT MAX(salary) FROM worker ); SELECT * FROM worker WHERE id > 25;
true
d9fa87a3e9198ed77dd0c3d5db4dd7e48fd8da0b
SQL
nchong128/fit3171
/Week 10/Tutorial/Solution/SQL-Intermediate-sample-sol.sql
UTF-8
4,918
4.1875
4
[]
no_license
/* 1. Find the maximum mark for FIT1004 in semester 1, 2013.*/ select max(mark) from SHAREDSAMPLES.enrolment where unitcode='FIT1004' and semester = 1 and to_char(ofyear,'YYYY')= '2013'; /* 2. Find the average mark of FIT1040 in semester 2, 2013.*/ select avg(mark) from SHAREDSAMPLES.enrolment where unitcode='FIT1040' and semester = 2 and to_char(ofyear,'YYYY')= '2013'; -- the ROUND function can be used with AVG function to limit the -- number of digits after the decimal point. select round(avg(mark),1) as rounded_avg_mark from SHAREDSAMPLES.enrolment where unitcode='FIT1040' and semester = 2 and to_char(ofyear,'YYYY')= '2013'; /* 3. List the average mark for each offering of FIT1040. In the listing, you need to include the year and semester number. Sort the result according to the year. */ select to_char(ofyear,'YYYY') as "YEAR of OFFER", semester, round(avg(mark),1) as avg_mark from SHAREDSAMPLES.enrolment where unitcode='FIT1040' group by ofyear, semester order by ofyear, semester; /* 4a. Find the number of students enrolled in the unit FIT1040 in the year 2013. Count a repeat student TWICE here. */ select count(studid) as student_count from SHAREDSAMPLES.enrolment where unitcode='FIT1040' and to_char(ofyear,'YYYY')= '2013'; /* 4b. Find the number of students enrolled in the unit FIT1040 in the year 2013. Count a repeat student ONCE. */ select count(distinct studid) as student_count from SHAREDSAMPLES.enrolment where unitcode='FIT1040' and to_char(ofyear,'YYYY')= '2013'; /* 5. Find the total number of enrolments per semester for each unit in the year 2013. The list should also include the unitcode, semester and year. Order the list in the increasing order of enrolment number.*/ select unitcode, to_char(ofyear,'YYYY') as "YEAR of OFFER", semester, count(studid) as total from SHAREDSAMPLES.enrolment where to_char(ofyear,'YYYY')= '2013' group by unitcode, ofyear, semester order by total; /* 6. Find the total number of prerequisite units for FIT2077. */ select count(has_prereq_of) as no_prereqs from SHAREDSAMPLES.prereq where unitcode='FIT2077'; /* 7. Find the total number of prerequisite units for each unit. In the list, include the unitcode for which the count is applicable. */ select unitcode, count(has_prereq_of) as no_prereqs from SHAREDSAMPLES.prereq group by unitcode order by unitcode; /*8. For each pre-requisite unit, calculate how many times it has been used as prerequisite. Include the name of the prerequisite unit in the listing. */ select has_prereq_of as unitcode, u.unitname, count(u.unitcode) as no_times_used from SHAREDSAMPLES.prereq p join SHAREDSAMPLES.unit u on u.unitcode = has_prereq_of group by has_prereq_of, u.unitname order by unitcode; /*9. Find the unit with the highest number of enrolments in a given offering in the year 2013. Note year has been included in the output here to make it more informative */ select unitcode, to_char(ofyear,'YYYY') as year, semester, count(studid) as student_count from SHAREDSAMPLES.enrolment group by unitcode, ofyear, semester having count(studid) = ( select max(count (studid)) from SHAREDSAMPLES.enrolment group by unitcode, ofyear, semester having to_char(ofyear,'YYYY')= '2013' ) order by unitcode; /*10. Who is the oldest student in FIT1004 throughout the whole history of the offering? Display the student full name and the date of birth. Making use of Oracle concatenate operator || here */ select studfname || ' ' || studlname as fullname, studdob from SHAREDSAMPLES.student s join SHAREDSAMPLES.enrolment e on s.studid = e.studid where e.unitcode = 'FIT1004' and studdob = ( select min(studdob) from SHAREDSAMPLES.student s join SHAREDSAMPLES.enrolment e on s.studid = e.studid where e.unitcode = 'FIT1004' ) order by s.studid; /*11. Find all students enrolled in FIT1004 in semester 1, 2013 who have scored more than the average mark of FIT1004 in the same offering? Display the students' name and the mark. Sort the list in the order of the mark from the highest to the lowest.*/ select studfname, studlname, mark from SHAREDSAMPLES.student s join SHAREDSAMPLES.enrolment e on s.studid = e.studid where unitcode='FIT1004' and semester = 1 and to_char(ofyear,'YYYY')= '2013' and mark > ( select avg(mark) from SHAREDSAMPLES.enrolment where unitcode='FIT1004' and semester = 1 and to_char(ofyear,'YYYY')= '2013' ) order by mark desc;
true
02383d9c47838e89397711c1e07cd17936d20c0a
SQL
mmoormeier/sql-challenge
/EmployeeSQL/TableCreation.sql
UTF-8
1,257
4.1875
4
[]
no_license
-- Create employees table CREATE TABLE employees ( emp_no VARCHAR NOT NULL PRIMARY KEY, emp_title_id VARCHAR(10) NOT NULL, birth_date DATE NOT NULL, first_name VARCHAR(20) NOT NULL, last_name VARCHAR(20) NOT NULL, sex VARCHAR(1) NOT NULL, hire_date DATE NOT NULL ); ALTER TABLE employees ALTER COLUMN hire_date TYPE DATE USING hire_date::date; -- Create salaries table CREATE TABLE salaries( emp_no VARCHAR(10) NOT NULL PRIMARY KEY, salary INT NOT NULL ); -- Create titles table CREATE TABLE titles( title_id VARCHAR(10) NOT NULL PRIMARY KEY, title VARCHAR(30) NOT NULL ); -- Create department employees table CREATE TABLE dept_emp( emp_no VARCHAR(10) NOT NULL, dept_no VARCHAR(10) NOT Null ); -- Create department managers table CREATE TABLE dept_manager( dept_no VARCHAR(10) NOT NULL, emp_no VARCHAR(10) NOT NULL PRIMARY KEY ); -- Create departments table CREATE TABLE departments( dept_no VARCHAR(10) NOT NULL PRIMARY KEY, dept_name VARCHAR(30) NOT NULL ); -- Import data into each table -- check unique values in tables -- Select Count(emp_no) FROM salaries -- Tables employees, salaries, titles and departments are all normalized --Add PK to dept_emp and dept_manager tables ALTER TABLE dept_emp ADD id SERIAL PRIMARY KEY;
true
ed47e2704035178a716e7c4fcf1241248d8527b5
SQL
kamkarm/Stock-Analysis
/graph_data/sql_queries/rolling_cumulative_volume.sql
UTF-8
177
3.453125
3
[]
no_license
-- contains the rolling cumulative volume for each stock SELECT symbol, SUM(volume) OVER ( PARTITION BY symbol ORDER BY open_day ) AS total_trades FROM stocks
true
1b3cc7342184f5d8ba6ce0b2d948e2dc5d898136
SQL
mhbratek/SQL
/QueryingData.sql
UTF-8
534
3.5
4
[]
no_license
select lastName, firstName, jobTitle from employees; select * from employees; select distinct * from employees; select lastName from employees order by lastName; select distinct lastName from employees order by lastName; select distinct state, city from customers where state is not null order by state, city; select state from customers group by state; select distinct state from customers; select count(distinct state) from customers where country = 'USA'; select distinct state from customers where state is not null limit 5;
true
28946fcaa9ba25fa3140df61347cac4e066d8079
SQL
EmperorSARATH/market
/market_basket (3).sql
UTF-8
26,288
2.96875
3
[]
no_license
-- phpMyAdmin SQL Dump -- version 4.8.4 -- https://www.phpmyadmin.net/ -- -- Host: 127.0.0.1 -- Generation Time: Feb 23, 2020 at 02:22 PM -- Server version: 10.1.37-MariaDB -- PHP Version: 5.6.40 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: `market_basket` -- -- -------------------------------------------------------- -- -- Table structure for table `auth_group` -- CREATE TABLE `auth_group` ( `id` int(11) NOT NULL, `name` varchar(150) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -------------------------------------------------------- -- -- Table structure for table `auth_group_permissions` -- CREATE TABLE `auth_group_permissions` ( `id` int(11) NOT NULL, `group_id` int(11) NOT NULL, `permission_id` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -------------------------------------------------------- -- -- Table structure for table `auth_permission` -- CREATE TABLE `auth_permission` ( `id` int(11) NOT NULL, `name` varchar(255) NOT NULL, `content_type_id` int(11) NOT NULL, `codename` varchar(100) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `auth_permission` -- INSERT INTO `auth_permission` (`id`, `name`, `content_type_id`, `codename`) VALUES (1, 'Can add log entry', 1, 'add_logentry'), (2, 'Can change log entry', 1, 'change_logentry'), (3, 'Can delete log entry', 1, 'delete_logentry'), (4, 'Can view log entry', 1, 'view_logentry'), (5, 'Can add permission', 2, 'add_permission'), (6, 'Can change permission', 2, 'change_permission'), (7, 'Can delete permission', 2, 'delete_permission'), (8, 'Can view permission', 2, 'view_permission'), (9, 'Can add group', 3, 'add_group'), (10, 'Can change group', 3, 'change_group'), (11, 'Can delete group', 3, 'delete_group'), (12, 'Can view group', 3, 'view_group'), (13, 'Can add user', 4, 'add_user'), (14, 'Can change user', 4, 'change_user'), (15, 'Can delete user', 4, 'delete_user'), (16, 'Can view user', 4, 'view_user'), (17, 'Can add content type', 5, 'add_contenttype'), (18, 'Can change content type', 5, 'change_contenttype'), (19, 'Can delete content type', 5, 'delete_contenttype'), (20, 'Can view content type', 5, 'view_contenttype'), (21, 'Can add session', 6, 'add_session'), (22, 'Can change session', 6, 'change_session'), (23, 'Can delete session', 6, 'delete_session'), (24, 'Can view session', 6, 'view_session'), (25, 'Can add bill', 7, 'add_bill'), (26, 'Can change bill', 7, 'change_bill'), (27, 'Can delete bill', 7, 'delete_bill'), (28, 'Can view bill', 7, 'view_bill'), (29, 'Can add category', 8, 'add_category'), (30, 'Can change category', 8, 'change_category'), (31, 'Can delete category', 8, 'delete_category'), (32, 'Can view category', 8, 'view_category'), (33, 'Can add company', 9, 'add_company'), (34, 'Can change company', 9, 'change_company'), (35, 'Can delete company', 9, 'delete_company'), (36, 'Can view company', 9, 'view_company'), (37, 'Can add product', 10, 'add_product'), (38, 'Can change product', 10, 'change_product'), (39, 'Can delete product', 10, 'delete_product'), (40, 'Can view product', 10, 'view_product'), (41, 'Can add customer', 11, 'add_customer'), (42, 'Can change customer', 11, 'change_customer'), (43, 'Can delete customer', 11, 'delete_customer'), (44, 'Can view customer', 11, 'view_customer'), (45, 'Can add cart', 12, 'add_cart'), (46, 'Can change cart', 12, 'change_cart'), (47, 'Can delete cart', 12, 'delete_cart'), (48, 'Can view cart', 12, 'view_cart'), (49, 'Can add wish list', 13, 'add_wishlist'), (50, 'Can change wish list', 13, 'change_wishlist'), (51, 'Can delete wish list', 13, 'delete_wishlist'), (52, 'Can view wish list', 13, 'view_wishlist'); -- -------------------------------------------------------- -- -- Table structure for table `auth_user` -- CREATE TABLE `auth_user` ( `id` int(11) NOT NULL, `password` varchar(128) NOT NULL, `last_login` datetime(6) DEFAULT NULL, `is_superuser` tinyint(1) NOT NULL, `username` varchar(150) NOT NULL, `first_name` varchar(30) NOT NULL, `last_name` varchar(150) NOT NULL, `email` varchar(254) NOT NULL, `is_staff` tinyint(1) NOT NULL, `is_active` tinyint(1) NOT NULL, `date_joined` datetime(6) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `auth_user` -- INSERT INTO `auth_user` (`id`, `password`, `last_login`, `is_superuser`, `username`, `first_name`, `last_name`, `email`, `is_staff`, `is_active`, `date_joined`) VALUES (1, '123', '2019-12-06 15:54:28.318359', 1, 'admin', '', 'Admin', '', 1, 1, '2019-12-06 15:21:25.172265'), (10, '123', '2020-01-06 03:57:01.742308', 0, 'abc@gmail.com', '', 'Company', '', 0, 1, '2019-12-06 15:53:50.388040'), (11, '123', '2020-02-23 12:23:27.421351', 0, 'rashila@gmail.com', '', 'Customer', '', 0, 1, '0000-00-00 00:00:00.000000'), (12, '123', '2020-01-31 05:18:45.300946', 0, 'c1@gmail.com', '', 'Customer', '', 0, 1, '2020-01-29 16:16:02.350809'); -- -------------------------------------------------------- -- -- Table structure for table `auth_user_groups` -- CREATE TABLE `auth_user_groups` ( `id` int(11) NOT NULL, `user_id` int(11) NOT NULL, `group_id` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -------------------------------------------------------- -- -- Table structure for table `auth_user_user_permissions` -- CREATE TABLE `auth_user_user_permissions` ( `id` int(11) NOT NULL, `user_id` int(11) NOT NULL, `permission_id` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -------------------------------------------------------- -- -- Table structure for table `django_admin_log` -- CREATE TABLE `django_admin_log` ( `id` int(11) NOT NULL, `action_time` datetime(6) NOT NULL, `object_id` longtext, `object_repr` varchar(200) NOT NULL, `action_flag` smallint(5) UNSIGNED NOT NULL, `change_message` longtext NOT NULL, `content_type_id` int(11) DEFAULT NULL, `user_id` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -------------------------------------------------------- -- -- Table structure for table `django_content_type` -- CREATE TABLE `django_content_type` ( `id` int(11) NOT NULL, `app_label` varchar(100) NOT NULL, `model` varchar(100) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `django_content_type` -- INSERT INTO `django_content_type` (`id`, `app_label`, `model`) VALUES (1, 'admin', 'logentry'), (3, 'auth', 'group'), (2, 'auth', 'permission'), (4, 'auth', 'user'), (5, 'contenttypes', 'contenttype'), (7, 'myapp', 'bill'), (12, 'myapp', 'cart'), (8, 'myapp', 'category'), (9, 'myapp', 'company'), (11, 'myapp', 'customer'), (10, 'myapp', 'product'), (13, 'myapp', 'wishlist'), (6, 'sessions', 'session'); -- -------------------------------------------------------- -- -- Table structure for table `django_migrations` -- CREATE TABLE `django_migrations` ( `id` int(11) NOT NULL, `app` varchar(255) NOT NULL, `name` varchar(255) NOT NULL, `applied` datetime(6) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `django_migrations` -- INSERT INTO `django_migrations` (`id`, `app`, `name`, `applied`) VALUES (1, 'contenttypes', '0001_initial', '2019-11-30 09:55:30.482116'), (2, 'auth', '0001_initial', '2019-11-30 09:55:31.963671'), (3, 'admin', '0001_initial', '2019-11-30 09:55:39.756206'), (4, 'admin', '0002_logentry_remove_auto_add', '2019-11-30 09:55:42.420176'), (5, 'admin', '0003_logentry_add_action_flag_choices', '2019-11-30 09:55:42.472014'), (6, 'contenttypes', '0002_remove_content_type_name', '2019-11-30 09:55:43.258010'), (7, 'auth', '0002_alter_permission_name_max_length', '2019-11-30 09:55:44.519992'), (8, 'auth', '0003_alter_user_email_max_length', '2019-11-30 09:55:44.702481'), (9, 'auth', '0004_alter_user_username_opts', '2019-11-30 09:55:44.783292'), (10, 'auth', '0005_alter_user_last_login_null', '2019-11-30 09:55:45.472416'), (11, 'auth', '0006_require_contenttypes_0002', '2019-11-30 09:55:45.513305'), (12, 'auth', '0007_alter_validators_add_error_messages', '2019-11-30 09:55:45.571192'), (13, 'auth', '0008_alter_user_username_max_length', '2019-11-30 09:55:45.709819'), (14, 'auth', '0009_alter_user_last_name_max_length', '2019-11-30 09:55:45.835461'), (15, 'auth', '0010_alter_group_name_max_length', '2019-11-30 09:55:45.966091'), (16, 'auth', '0011_update_proxy_permissions', '2019-11-30 09:55:46.018981'), (17, 'myapp', '0001_initial', '2019-11-30 09:55:48.735001'), (18, 'sessions', '0001_initial', '2019-11-30 09:55:57.956935'), (19, 'myapp', '0002_auto_20191130_1634', '2019-11-30 11:05:00.071679'), (20, 'myapp', '0003_auto_20191130_1638', '2019-11-30 11:09:30.313902'), (21, 'myapp', '0004_auto_20191206_2055', '2019-12-06 15:25:30.148223'), (22, 'myapp', '0005_auto_20191206_2106', '2019-12-06 15:36:45.023981'), (23, 'myapp', '0002_auto_20191224_2120', '2019-12-24 15:50:35.379243'), (24, 'myapp', '0003_auto_20191224_2121', '2020-01-29 16:09:25.021342'), (25, 'myapp', '0004_auto_20191224_2122', '2020-01-29 16:09:25.107426'), (26, 'myapp', '0005_auto_20200116_0830', '2020-01-29 16:09:26.793063'), (27, 'myapp', '0006_auto_20200116_1259', '2020-01-29 16:09:28.405346'), (28, 'myapp', '0007_auto_20200116_1303', '2020-01-29 16:09:29.953316'), (29, 'myapp', '0008_auto_20200129_2139', '2020-01-29 16:09:30.544989'), (30, 'myapp', '0009_auto_20200130_0841', '2020-01-30 03:11:16.323968'); -- -------------------------------------------------------- -- -- Table structure for table `django_session` -- CREATE TABLE `django_session` ( `session_key` varchar(40) NOT NULL, `session_data` longtext NOT NULL, `expire_date` datetime(6) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `django_session` -- INSERT INTO `django_session` (`session_key`, `session_data`, `expire_date`) VALUES ('0y5iyrjmuedz2qjjk2v19935b5o3yryc', 'MjlhNWFkN2EzOTUzNzc1NjdkNzIwZGNmOTVmMjhlNDFkNjI5MzRlMzp7Im1lbV9pZCI6MTEsIl9hdXRoX3VzZXJfaWQiOiIxMSIsIl9hdXRoX3VzZXJfYmFja2VuZCI6ImRqYW5nby5jb250cmliLmF1dGguYmFja2VuZHMuTW9kZWxCYWNrZW5kIiwiX2F1dGhfdXNlcl9oYXNoIjoiMWQwMWQ2MmY0OTBjMzdmZDk0MTQyYzE0NzFhYTI4MTZmNWQ5NjIyMSIsImNhcnRJdGVtcyI6MX0=', '2020-02-29 09:55:06.098661'), ('47w8w8s2xjb829u58ql680ua7lqn9i28', 'MTlkMjFiODQ3ZjEwNzBhNzJiYTM2ZTc1ZmIwMjE0ZGM2ZTZhNGUyOTp7Im1lbV9pZCI6MTEsIl9hdXRoX3VzZXJfaWQiOiIxMSIsIl9hdXRoX3VzZXJfYmFja2VuZCI6ImRqYW5nby5jb250cmliLmF1dGguYmFja2VuZHMuTW9kZWxCYWNrZW5kIiwiX2F1dGhfdXNlcl9oYXNoIjoiMWQwMWQ2MmY0OTBjMzdmZDk0MTQyYzE0NzFhYTI4MTZmNWQ5NjIyMSIsImNhcnRJdGVtcyI6Mn0=', '2020-03-08 12:25:20.346335'), ('5sme4ldvcdkptlih57g0arxrhu2p96fm', 'ZjM2ZWU4NGM3NTA3M2EwODg5NWZjNGIxMjgzNzE2ZWQ1OGRiZjA4NDp7Im1lbV9pZCI6MTB9', '2019-12-29 14:20:45.256131'), ('666vu2sg9892hsaydlwstli29jvzgymf', 'ZjRiN2EyYmU4MzNiODQ4MjgxMDZmZDUxNWM1Zjg5YjZkZTYxOWI3OTp7Im1lbV9pZCI6MTAsIl9hdXRoX3VzZXJfaWQiOiIxMCIsIl9hdXRoX3VzZXJfYmFja2VuZCI6ImRqYW5nby5jb250cmliLmF1dGguYmFja2VuZHMuTW9kZWxCYWNrZW5kIiwiX2F1dGhfdXNlcl9oYXNoIjoiMWQwMWQ2MmY0OTBjMzdmZDk0MTQyYzE0NzFhYTI4MTZmNWQ5NjIyMSJ9', '2020-01-20 03:57:01.956622'), ('9dz2ytitj4oq1h06uegu86047d5x2ina', 'ZjRiN2EyYmU4MzNiODQ4MjgxMDZmZDUxNWM1Zjg5YjZkZTYxOWI3OTp7Im1lbV9pZCI6MTAsIl9hdXRoX3VzZXJfaWQiOiIxMCIsIl9hdXRoX3VzZXJfYmFja2VuZCI6ImRqYW5nby5jb250cmliLmF1dGguYmFja2VuZHMuTW9kZWxCYWNrZW5kIiwiX2F1dGhfdXNlcl9oYXNoIjoiMWQwMWQ2MmY0OTBjMzdmZDk0MTQyYzE0NzFhYTI4MTZmNWQ5NjIyMSJ9', '2019-12-30 03:35:39.234739'), ('avg2c21kx1ri3qzic6feb50ajfx0dzk0', 'ZjRiN2EyYmU4MzNiODQ4MjgxMDZmZDUxNWM1Zjg5YjZkZTYxOWI3OTp7Im1lbV9pZCI6MTAsIl9hdXRoX3VzZXJfaWQiOiIxMCIsIl9hdXRoX3VzZXJfYmFja2VuZCI6ImRqYW5nby5jb250cmliLmF1dGguYmFja2VuZHMuTW9kZWxCYWNrZW5kIiwiX2F1dGhfdXNlcl9oYXNoIjoiMWQwMWQ2MmY0OTBjMzdmZDk0MTQyYzE0NzFhYTI4MTZmNWQ5NjIyMSJ9', '2020-01-10 03:36:43.525191'), ('c24g9eom78dd56r8bk5aoykjqq2h32wp', 'ZjM2ZWU4NGM3NTA3M2EwODg5NWZjNGIxMjgzNzE2ZWQ1OGRiZjA4NDp7Im1lbV9pZCI6MTB9', '2019-12-29 14:20:32.295992'), ('heptx6o6owq03zz8uxvz1alisjx8skmz', 'ZjRiN2EyYmU4MzNiODQ4MjgxMDZmZDUxNWM1Zjg5YjZkZTYxOWI3OTp7Im1lbV9pZCI6MTAsIl9hdXRoX3VzZXJfaWQiOiIxMCIsIl9hdXRoX3VzZXJfYmFja2VuZCI6ImRqYW5nby5jb250cmliLmF1dGguYmFja2VuZHMuTW9kZWxCYWNrZW5kIiwiX2F1dGhfdXNlcl9oYXNoIjoiMWQwMWQ2MmY0OTBjMzdmZDk0MTQyYzE0NzFhYTI4MTZmNWQ5NjIyMSJ9', '2020-01-19 07:47:26.036930'), ('jhjf18kjx3gx5qlg0iv53x2k6anx1tz5', 'MWVlN2MwNzUxOGU3ZjYwZThjYTcyNzliYmU2ODUxODM5NWZhNTRlOTp7fQ==', '2019-12-29 04:10:45.495528'), ('lfs21imp9b8ivto8o8ubb0dod44pyye8', 'ZjRiN2EyYmU4MzNiODQ4MjgxMDZmZDUxNWM1Zjg5YjZkZTYxOWI3OTp7Im1lbV9pZCI6MTAsIl9hdXRoX3VzZXJfaWQiOiIxMCIsIl9hdXRoX3VzZXJfYmFja2VuZCI6ImRqYW5nby5jb250cmliLmF1dGguYmFja2VuZHMuTW9kZWxCYWNrZW5kIiwiX2F1dGhfdXNlcl9oYXNoIjoiMWQwMWQ2MmY0OTBjMzdmZDk0MTQyYzE0NzFhYTI4MTZmNWQ5NjIyMSJ9', '2020-01-08 11:00:17.487547'), ('qpd7v6uajjshfylajlothe2ufqzc7xnb', 'YmNmODA0MDdjMGIxNzRkZDI4ODI0MDkwYjU2OTE3ZGE1ZTU5N2RjMjp7Il9hdXRoX3VzZXJfaWQiOiIxIiwiX2F1dGhfdXNlcl9iYWNrZW5kIjoiZGphbmdvLmNvbnRyaWIuYXV0aC5iYWNrZW5kcy5Nb2RlbEJhY2tlbmQiLCJfYXV0aF91c2VyX2hhc2giOiJiNjQ3N2QwNDM0YTc4YmQ5MzU3ZGVjMjcwMGUwYTI3MDJlMjQ3NjM2In0=', '2019-12-20 15:54:28.385022'), ('sgzcsqad8pu9c095pkw5q6fyh4r2w0ij', 'NGQ0YjE5ZjdjNjU1ZDk3ZGM1NzRjYTAwODY4N2QxMmY4NjZhN2U0OTp7Im1lbV9pZCI6MTEsIl9hdXRoX3VzZXJfaWQiOiIxMSIsIl9hdXRoX3VzZXJfYmFja2VuZCI6ImRqYW5nby5jb250cmliLmF1dGguYmFja2VuZHMuTW9kZWxCYWNrZW5kIiwiX2F1dGhfdXNlcl9oYXNoIjoiMWQwMWQ2MmY0OTBjMzdmZDk0MTQyYzE0NzFhYTI4MTZmNWQ5NjIyMSIsImNhcnRJdGVtcyI6NH0=', '2020-02-17 03:10:02.187630'), ('tg0b42ajisuyl2pqusekcx49keayno0b', 'ZjRiN2EyYmU4MzNiODQ4MjgxMDZmZDUxNWM1Zjg5YjZkZTYxOWI3OTp7Im1lbV9pZCI6MTAsIl9hdXRoX3VzZXJfaWQiOiIxMCIsIl9hdXRoX3VzZXJfYmFja2VuZCI6ImRqYW5nby5jb250cmliLmF1dGguYmFja2VuZHMuTW9kZWxCYWNrZW5kIiwiX2F1dGhfdXNlcl9oYXNoIjoiMWQwMWQ2MmY0OTBjMzdmZDk0MTQyYzE0NzFhYTI4MTZmNWQ5NjIyMSJ9', '2020-01-09 05:20:29.878458'), ('wowgi35qpzbwf77gu6kf9yn9s6uq4o7u', 'MjlhNWFkN2EzOTUzNzc1NjdkNzIwZGNmOTVmMjhlNDFkNjI5MzRlMzp7Im1lbV9pZCI6MTEsIl9hdXRoX3VzZXJfaWQiOiIxMSIsIl9hdXRoX3VzZXJfYmFja2VuZCI6ImRqYW5nby5jb250cmliLmF1dGguYmFja2VuZHMuTW9kZWxCYWNrZW5kIiwiX2F1dGhfdXNlcl9oYXNoIjoiMWQwMWQ2MmY0OTBjMzdmZDk0MTQyYzE0NzFhYTI4MTZmNWQ5NjIyMSIsImNhcnRJdGVtcyI6MX0=', '2020-03-04 12:01:49.358926'), ('zox3gdvil232twz54f1sl2zwj4b15qbt', 'NGE5MmM0ODVjYWVhYjc3MGFhNDQ3ZDEzZmYxNjA1ZDI2Nzk3NmZiYzp7Il9hdXRoX3VzZXJfaWQiOiIxMiIsIl9hdXRoX3VzZXJfYmFja2VuZCI6ImRqYW5nby5jb250cmliLmF1dGguYmFja2VuZHMuTW9kZWxCYWNrZW5kIiwiX2F1dGhfdXNlcl9oYXNoIjoiMWQwMWQ2MmY0OTBjMzdmZDk0MTQyYzE0NzFhYTI4MTZmNWQ5NjIyMSJ9', '2020-02-14 05:18:45.445810'); -- -------------------------------------------------------- -- -- Table structure for table `myapp_bill` -- CREATE TABLE `myapp_bill` ( `id` int(11) NOT NULL, `date` date NOT NULL, `amount` int(11) NOT NULL, `payment_type` varchar(100) NOT NULL, `customer_id_id` int(11) NOT NULL, `phoneNo` int(11) DEFAULT NULL, `shippingAddress` longtext ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `myapp_bill` -- INSERT INTO `myapp_bill` (`id`, `date`, `amount`, `payment_type`, `customer_id_id`, `phoneNo`, `shippingAddress`) VALUES (2, '2020-02-23', 600, 'Cash on Delivery', 1, 2147483647, 'Rashila Rasheed, India, Street, Appartment, City, 678678'); -- -------------------------------------------------------- -- -- Table structure for table `myapp_cart` -- CREATE TABLE `myapp_cart` ( `id` int(11) NOT NULL, `bill_id_id` int(11) DEFAULT NULL, `customer_id_id` int(11) NOT NULL, `product_id_id` int(11) NOT NULL, `company_id` int(11) DEFAULT NULL, `qty` int(11) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `myapp_cart` -- INSERT INTO `myapp_cart` (`id`, `bill_id_id`, `customer_id_id`, `product_id_id`, `company_id`, `qty`) VALUES (1, NULL, 2, 1, 1, 5), (2, 2, 1, 1, 1, 4), (3, 2, 1, 11, 1, 2); -- -------------------------------------------------------- -- -- Table structure for table `myapp_category` -- CREATE TABLE `myapp_category` ( `id` int(11) NOT NULL, `category_name` varchar(100) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `myapp_category` -- INSERT INTO `myapp_category` (`id`, `category_name`) VALUES (1, 'item'), (2, 'Grocery'), (3, 'Mobiles and Accessories'), (4, 'Clothes'), (5, 'Foot Wears'); -- -------------------------------------------------------- -- -- Table structure for table `myapp_company` -- CREATE TABLE `myapp_company` ( `id` int(11) NOT NULL, `name` varchar(100) NOT NULL, `contact_no` int(11) NOT NULL, `pincode` int(11) NOT NULL, `gst_no` int(11) NOT NULL, `user_id_id` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `myapp_company` -- INSERT INTO `myapp_company` (`id`, `name`, `contact_no`, `pincode`, `gst_no`, `user_id_id`) VALUES (1, 'ABC', 2147483647, 678678, 667, 10); -- -------------------------------------------------------- -- -- Table structure for table `myapp_customer` -- CREATE TABLE `myapp_customer` ( `id` int(11) NOT NULL, `name` varchar(100) NOT NULL, `ph_no` bigint(20) NOT NULL, `pincode` int(11) NOT NULL, `address` varchar(500) NOT NULL, `user_id_id` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `myapp_customer` -- INSERT INTO `myapp_customer` (`id`, `name`, `ph_no`, `pincode`, `address`, `user_id_id`) VALUES (1, 'Rashila', 989, 678, 'gfcgf', 11), (2, 'customer 1', 78787878, 678678, 'address of Customer 1', 12); -- -------------------------------------------------------- -- -- Table structure for table `myapp_product` -- CREATE TABLE `myapp_product` ( `id` int(11) NOT NULL, `name` varchar(300) NOT NULL, `price` int(11) NOT NULL, `quantity` int(11) NOT NULL, `offer` int(11) NOT NULL, `offer_price` double NOT NULL, `img` varchar(100) DEFAULT NULL, `description` varchar(255) NOT NULL, `category_id_id` int(11) NOT NULL, `company_id_id` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `myapp_product` -- INSERT INTO `myapp_product` (`id`, `name`, `price`, `quantity`, `offer`, `offer_price`, `img`, `description`, `category_id_id`, `company_id_id`) VALUES (1, 'I1', 25, 12, 0, 0, 'media/category-2.jpg', '', 1, 1), (2, 'I2', 67, 9, 0, 0, 'media/category-2.jpg', '', 1, 1), (3, 'I3', 98, 4, 10, 0, 'media/category-2.jpg', '', 1, 1), (5, 'I4', 67, 4, 0, 0, 'media/category-2.jpg', '', 1, 1), (6, 'I5', 45, 4, 0, 0, 'media/category-2.jpg', '', 1, 1), (7, 'I6', 34, 7, 0, 0, 'media/category-2.jpg', '', 1, 1), (8, 'I7', 98, 3, 0, 0, 'media/category-2.jpg', '', 1, 1), (9, 'I8', 56, 7, 0, 0, 'media/category-2.jpg', '', 1, 1), (10, 'I9', 98, 4, 0, 0, 'media/category-2.jpg', '', 1, 1), (11, 'Product 1', 250, 10, 0, 0, 'media/category_VTQKVDP.jpg', '', 1, 1), (12, 'Product 2', 300, 5, 0, 0, 'media/category-2.jpg', '', 1, 1); -- -------------------------------------------------------- -- -- Table structure for table `myapp_wishlist` -- CREATE TABLE `myapp_wishlist` ( `id` int(11) NOT NULL, `cust_id` int(11) NOT NULL, `product_id` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `myapp_wishlist` -- INSERT INTO `myapp_wishlist` (`id`, `cust_id`, `product_id`) VALUES (1, 2, 6); -- -------------------------------------------------------- -- -- Table structure for table `product` -- CREATE TABLE `product` ( `id` int(11) NOT NULL, `name` varchar(100) DEFAULT NULL, `price` int(20) DEFAULT NULL, `date` date DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `product` -- INSERT INTO `product` (`id`, `name`, `price`, `date`) VALUES (1, 'gpu', 8500, '1999-03-29'); -- -- Indexes for dumped tables -- -- -- Indexes for table `auth_group` -- ALTER TABLE `auth_group` ADD PRIMARY KEY (`id`), ADD UNIQUE KEY `name` (`name`); -- -- Indexes for table `auth_group_permissions` -- ALTER TABLE `auth_group_permissions` ADD PRIMARY KEY (`id`), ADD UNIQUE KEY `auth_group_permissions_group_id_permission_id_0cd325b0_uniq` (`group_id`,`permission_id`), ADD KEY `auth_group_permissio_permission_id_84c5c92e_fk_auth_perm` (`permission_id`); -- -- Indexes for table `auth_permission` -- ALTER TABLE `auth_permission` ADD PRIMARY KEY (`id`), ADD UNIQUE KEY `auth_permission_content_type_id_codename_01ab375a_uniq` (`content_type_id`,`codename`); -- -- Indexes for table `auth_user` -- ALTER TABLE `auth_user` ADD PRIMARY KEY (`id`), ADD UNIQUE KEY `username` (`username`); -- -- Indexes for table `auth_user_groups` -- ALTER TABLE `auth_user_groups` ADD PRIMARY KEY (`id`), ADD UNIQUE KEY `auth_user_groups_user_id_group_id_94350c0c_uniq` (`user_id`,`group_id`), ADD KEY `auth_user_groups_group_id_97559544_fk_auth_group_id` (`group_id`); -- -- Indexes for table `auth_user_user_permissions` -- ALTER TABLE `auth_user_user_permissions` ADD PRIMARY KEY (`id`), ADD UNIQUE KEY `auth_user_user_permissions_user_id_permission_id_14a6b632_uniq` (`user_id`,`permission_id`), ADD KEY `auth_user_user_permi_permission_id_1fbb5f2c_fk_auth_perm` (`permission_id`); -- -- Indexes for table `django_admin_log` -- ALTER TABLE `django_admin_log` ADD PRIMARY KEY (`id`), ADD KEY `django_admin_log_content_type_id_c4bce8eb_fk_django_co` (`content_type_id`), ADD KEY `django_admin_log_user_id_c564eba6_fk_auth_user_id` (`user_id`); -- -- Indexes for table `django_content_type` -- ALTER TABLE `django_content_type` ADD PRIMARY KEY (`id`), ADD UNIQUE KEY `django_content_type_app_label_model_76bd3d3b_uniq` (`app_label`,`model`); -- -- Indexes for table `django_migrations` -- ALTER TABLE `django_migrations` ADD PRIMARY KEY (`id`); -- -- Indexes for table `django_session` -- ALTER TABLE `django_session` ADD PRIMARY KEY (`session_key`), ADD KEY `django_session_expire_date_a5c62663` (`expire_date`); -- -- Indexes for table `myapp_bill` -- ALTER TABLE `myapp_bill` ADD PRIMARY KEY (`id`), ADD KEY `myapp_bill_customer_id_id_eaeacc23_fk_myapp_customer_id` (`customer_id_id`); -- -- Indexes for table `myapp_cart` -- ALTER TABLE `myapp_cart` ADD PRIMARY KEY (`id`), ADD KEY `myapp_cart_bill_id_id_5127ee78_fk_myapp_bill_id` (`bill_id_id`), ADD KEY `myapp_cart_customer_id_id_257a3411_fk_myapp_customer_id` (`customer_id_id`), ADD KEY `myapp_cart_product_id_id_68bd7aae_fk_myapp_product_id` (`product_id_id`), ADD KEY `myapp_cart_company_id_73b268ea_fk_myapp_company_id` (`company_id`); -- -- Indexes for table `myapp_category` -- ALTER TABLE `myapp_category` ADD PRIMARY KEY (`id`); -- -- Indexes for table `myapp_company` -- ALTER TABLE `myapp_company` ADD PRIMARY KEY (`id`), ADD UNIQUE KEY `pincode` (`pincode`), ADD UNIQUE KEY `gst_no` (`gst_no`), ADD KEY `myapp_company_user_id_b3d04a51_fk_auth_user_id` (`user_id_id`); -- -- Indexes for table `myapp_customer` -- ALTER TABLE `myapp_customer` ADD PRIMARY KEY (`id`), ADD KEY `myapp_customer_user_id_id_55011c4f_fk_auth_user_id` (`user_id_id`); -- -- Indexes for table `myapp_product` -- ALTER TABLE `myapp_product` ADD PRIMARY KEY (`id`), ADD KEY `myapp_product_category_id_id_3a558605_fk_myapp_category_id` (`category_id_id`), ADD KEY `myapp_product_company_id_id_02ee2b22_fk_myapp_company_id` (`company_id_id`); -- -- Indexes for table `myapp_wishlist` -- ALTER TABLE `myapp_wishlist` ADD PRIMARY KEY (`id`), ADD KEY `myapp_wishlist_cust_id_f1097e39_fk_myapp_customer_id` (`cust_id`), ADD KEY `myapp_wishlist_product_id_85e36668_fk_myapp_product_id` (`product_id`); -- -- Indexes for table `product` -- ALTER TABLE `product` ADD PRIMARY KEY (`id`); -- -- AUTO_INCREMENT for dumped tables -- -- -- AUTO_INCREMENT for table `auth_group` -- ALTER TABLE `auth_group` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT; -- -- AUTO_INCREMENT for table `auth_group_permissions` -- ALTER TABLE `auth_group_permissions` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT; -- -- AUTO_INCREMENT for table `auth_permission` -- ALTER TABLE `auth_permission` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=53; -- -- AUTO_INCREMENT for table `auth_user` -- ALTER TABLE `auth_user` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=13; -- -- AUTO_INCREMENT for table `auth_user_groups` -- ALTER TABLE `auth_user_groups` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT; -- -- AUTO_INCREMENT for table `auth_user_user_permissions` -- ALTER TABLE `auth_user_user_permissions` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT; -- -- AUTO_INCREMENT for table `django_admin_log` -- ALTER TABLE `django_admin_log` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT; -- -- AUTO_INCREMENT for table `django_content_type` -- ALTER TABLE `django_content_type` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=14; -- -- AUTO_INCREMENT for table `django_migrations` -- ALTER TABLE `django_migrations` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=31; -- -- AUTO_INCREMENT for table `myapp_bill` -- ALTER TABLE `myapp_bill` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3; -- -- AUTO_INCREMENT for table `myapp_cart` -- ALTER TABLE `myapp_cart` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4; -- -- AUTO_INCREMENT for table `myapp_category` -- ALTER TABLE `myapp_category` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6; -- -- AUTO_INCREMENT for table `myapp_company` -- ALTER TABLE `myapp_company` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2; -- -- AUTO_INCREMENT for table `myapp_customer` -- ALTER TABLE `myapp_customer` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3; -- -- AUTO_INCREMENT for table `myapp_product` -- ALTER TABLE `myapp_product` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=13; -- -- AUTO_INCREMENT for table `myapp_wishlist` -- ALTER TABLE `myapp_wishlist` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2; -- -- AUTO_INCREMENT for table `product` -- ALTER TABLE `product` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2; -- -- Constraints for dumped tables -- -- -- Constraints for table `auth_group_permissions` -- ALTER TABLE `auth_group_permissions` ADD CONSTRAINT `auth_group_permissio_permission_id_84c5c92e_fk_auth_perm` FOREIGN KEY (`permission_id`) REFERENCES `auth_permission` (`id`), ADD CONSTRAINT `auth_group_permissions_group_id_b120cbf9_fk_auth_group_id` FOREIGN KEY (`group_id`) REFERENCES `auth_group` (`id`); -- -- Constraints for table `auth_permission` -- ALTER TABLE `auth_permission` ADD CONSTRAINT `auth_permission_content_type_id_2f476e4b_fk_django_co` FOREIGN KEY (`content_type_id`) REFERENCES `django_content_type` (`id`); -- -- Constraints for table `auth_user_groups` -- ALTER TABLE `auth_user_groups` ADD CONSTRAINT `auth_user_groups_group_id_97559544_fk_auth_group_id` FOREIGN KEY (`group_id`) REFERENCES `auth_group` (`id`), ADD CONSTRAINT `auth_user_groups_user_id_6a12ed8b_fk_auth_user_id` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`); -- -- Constraints for table `auth_user_user_permissions` -- ALTER TABLE `auth_user_user_permissions` ADD CONSTRAINT `auth_user_user_permi_permission_id_1fbb5f2c_fk_auth_perm` FOREIGN KEY (`permission_id`) REFERENCES `auth_permission` (`id`), ADD CONSTRAINT `auth_user_user_permissions_user_id_a95ead1b_fk_auth_user_id` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`); -- -- Constraints for table `django_admin_log` -- ALTER TABLE `django_admin_log` ADD CONSTRAINT `django_admin_log_content_type_id_c4bce8eb_fk_django_co` FOREIGN KEY (`content_type_id`) REFERENCES `django_content_type` (`id`), ADD CONSTRAINT `django_admin_log_user_id_c564eba6_fk_auth_user_id` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`); -- -- Constraints for table `myapp_bill` -- ALTER TABLE `myapp_bill` ADD CONSTRAINT `myapp_bill_customer_id_id_eaeacc23_fk_myapp_customer_id` FOREIGN KEY (`customer_id_id`) REFERENCES `myapp_customer` (`id`); -- -- Constraints for table `myapp_cart` -- ALTER TABLE `myapp_cart` ADD CONSTRAINT `myapp_cart_company_id_73b268ea_fk_myapp_company_id` FOREIGN KEY (`company_id`) REFERENCES `myapp_company` (`id`), ADD CONSTRAINT `myapp_cart_customer_id_id_257a3411_fk_myapp_customer_id` FOREIGN KEY (`customer_id_id`) REFERENCES `myapp_customer` (`id`), ADD CONSTRAINT `myapp_cart_product_id_id_68bd7aae_fk_myapp_product_id` FOREIGN KEY (`product_id_id`) REFERENCES `myapp_product` (`id`); -- -- Constraints for table `myapp_company` -- ALTER TABLE `myapp_company` ADD CONSTRAINT `myapp_company_user_id_id_3d7fe422_fk_auth_user_id` FOREIGN KEY (`user_id_id`) REFERENCES `auth_user` (`id`); -- -- Constraints for table `myapp_customer` -- ALTER TABLE `myapp_customer` ADD CONSTRAINT `myapp_customer_user_id_id_55011c4f_fk_auth_user_id` FOREIGN KEY (`user_id_id`) REFERENCES `auth_user` (`id`); -- -- Constraints for table `myapp_product` -- ALTER TABLE `myapp_product` ADD CONSTRAINT `myapp_product_category_id_id_3a558605_fk_myapp_category_id` FOREIGN KEY (`category_id_id`) REFERENCES `myapp_category` (`id`), ADD CONSTRAINT `myapp_product_company_id_id_02ee2b22_fk_myapp_company_id` FOREIGN KEY (`company_id_id`) REFERENCES `myapp_company` (`id`); -- -- Constraints for table `myapp_wishlist` -- ALTER TABLE `myapp_wishlist` ADD CONSTRAINT `myapp_wishlist_cust_id_f1097e39_fk_myapp_customer_id` FOREIGN KEY (`cust_id`) REFERENCES `myapp_customer` (`id`), ADD CONSTRAINT `myapp_wishlist_product_id_85e36668_fk_myapp_product_id` FOREIGN KEY (`product_id`) REFERENCES `myapp_product` (`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
d23a3e80dbb3d4149d369ef0887d9853e4d06c9e
SQL
kin2pete/misc_useful_stuff
/ddl/tables/lb_att_chn.sql
UTF-8
1,195
3.359375
3
[]
no_license
DROP TABLE IF EXISTS lb_att_chn CASCADE; CREATE TABLE lb_att_chn ( attribution_channel_id varchar(40) DEFAULT ''::character varying NOT NULL, attribution_source varchar(255) NOT NULL, attribution_medium varchar(255) NOT NULL, attribution_campaign varchar(255) NOT NULL, attribution_content varchar(255) NOT NULL, attribution_shortkey varchar(40), attribution_utm_terms varchar(255), description varchar(4096) ); ALTER TABLE lb_att_chn ADD CONSTRAINT lb_att_chn_pkey PRIMARY KEY (attribution_channel_id); CREATE INDEX lb_att_chn_attribution_channel_id_idx ON lb_att_chn USING btree (attribution_channel_id); CREATE INDEX lb_att_chn_attribution_source_idx ON lb_att_chn USING btree (attribution_source); CREATE INDEX lb_att_chn_attribution_medium_idx ON lb_att_chn USING btree (attribution_medium); CREATE INDEX lb_att_chn_attribution_campaign_idx ON lb_att_chn USING btree (attribution_campaign); CREATE INDEX lb_att_chn_attribution_content_idx ON lb_att_chn USING btree (attribution_content); CREATE INDEX lb_att_chn_attribution_shortkey_idx ON lb_att_chn USING btree (attribution_shortkey); COMMIT;
true
937cbe425f982d1f01ae8f642d979c423f5c5745
SQL
Rajagunasekaran/Code-Backup
/OLD PROJECT SQL/SP'S/USER/SP_LOGIN_CREATION_INSERT_VER_0.5_14052014.sql
UTF-8
4,995
3.609375
4
[]
no_license
-- version 0.5 startdate:14/05/2014 --enddate:14/05/2014--- issueno 817 commentno:65-->desc: CHANGED THE SP FOR DYNAMIC PURPOSE BY RAJA -- version 0.4 startdate:14/03/2014 --enddate:15/03/2014--- issueno 659 commentno:#76-->desc: DONE SOME CHANGES FOR LOGIN REJOIN DONE BY:DHIVYA -- version 0.3 startdate:28/02/2014 --enddate:28/02/2014--- issueno 754 commentno:36-->desc: APPLIED SUB_SP TO REPLACE USERSTAMP AS ID-SAFI -- version 0.2 --sdate:27/02/2014 --edate:27/02/2014 --issue:754 --comment:22 --doneby:RL -- VER 0.1--->ISSUE NO:659 COMMENT NO:#2 START DATE:12/12/2013 ENDDATE:12/12/2013 DESC:SP FOR LOGIN CREATION INSERT DONE BY:DHIVYA.A DROP PROCEDURE IF EXISTS SP_LOGIN_CREATION_INSERT; CREATE PROCEDURE SP_LOGIN_CREATION_INSERT (LOGINID VARCHAR(40), ROLENAME VARCHAR(15), JOINDATE DATE, USERSTAMP VARCHAR(50), OUT UR_FLAG INTEGER) BEGIN -- VARIABLE DECLARATION DECLARE MINID INTEGER; DECLARE MAXID INTEGER; DECLARE RECVER INTEGER; DECLARE ULDID INTEGER; DECLARE USERSTAMP_ID INTEGER(2); DECLARE TEMPTABLE_MENU TEXT; DECLARE TEMPTBL_MENU TEXT; DECLARE EPID INT; DECLARE EXIT HANDLER FOR SQLEXCEPTION BEGIN ROLLBACK; SET UR_FLAG=0; END; START TRANSACTION; CALL SP_CHANGE_USERSTAMP_AS_ULDID(USERSTAMP,@ULDID); SET USERSTAMP_ID = (SELECT @ULDID); -- TEMP TABLE NAME START SET TEMPTBL_MENU=(SELECT CONCAT('TEMPTABLE_MENU',SYSDATE())); SET TEMPTBL_MENU=(SELECT REPLACE(TEMPTBL_MENU,' ','')); SET TEMPTBL_MENU=(SELECT REPLACE(TEMPTBL_MENU,'-','')); SET TEMPTBL_MENU=(SELECT REPLACE(TEMPTBL_MENU,':','')); SET TEMPTABLE_MENU=(SELECT CONCAT(TEMPTBL_MENU,'_',USERSTAMP_ID)); SET RECVER=(SELECT MAX(UA_REC_VER) FROM USER_ACCESS WHERE ULD_ID=(SELECT ULD_ID FROM USER_LOGIN_DETAILS WHERE ULD_LOGINID=LOGINID)); SET ULDID=(SELECT DISTINCT ULD_ID FROM USER_ACCESS WHERE ULD_ID=(SELECT ULD_ID FROM USER_LOGIN_DETAILS WHERE ULD_LOGINID=LOGINID)); IF NOT EXISTS(SELECT ULD_LOGINID FROM USER_LOGIN_DETAILS WHERE ULD_LOGINID=LOGINID)THEN IF LOGINID IS NOT NULL THEN -- INSERT QUERY FOR USER_LOGIN_DETAILS TABLE INSERT INTO USER_LOGIN_DETAILS(ULD_LOGINID,ULD_USERSTAMP)VALUES(LOGINID,USERSTAMP); SET UR_FLAG=1; END IF; END IF; IF (LOGINID IS NOT NULL AND ROLENAME IS NOT NULL AND JOINDATE IS NOT NULL AND USERSTAMP IS NOT NULL)THEN -- INSERT QUERY FOR USER_ACCESS TABLE IF (ULDID IS NOT NULL)THEN INSERT INTO USER_ACCESS(RC_ID,ULD_ID,UA_REC_VER,UA_JOIN_DATE,UA_JOIN,UA_USERSTAMP)VALUES((SELECT RC_ID FROM ROLE_CREATION WHERE RC_NAME=ROLENAME), (SELECT ULD_ID FROM USER_LOGIN_DETAILS WHERE ULD_LOGINID=LOGINID),(RECVER+1),JOINDATE,'X',USERSTAMP); SET UR_FLAG=1; ELSE INSERT INTO USER_ACCESS(RC_ID,ULD_ID,UA_REC_VER,UA_JOIN_DATE,UA_JOIN,UA_USERSTAMP)VALUES((SELECT RC_ID FROM ROLE_CREATION WHERE RC_NAME=ROLENAME), (SELECT ULD_ID FROM USER_LOGIN_DETAILS WHERE ULD_LOGINID=LOGINID),1,JOINDATE,'X',USERSTAMP); SET UR_FLAG=1; END IF; END IF; -- TEMP TABLE FOR GETTING MENU_ID AND ITS EMAIL_PROFILE ID -- DROP TABLE IF EXISTS TEMPTBL_MENU; SET @CREATE_TEMPTABLE_MENU=(SELECT CONCAT('CREATE TABLE ',TEMPTABLE_MENU,'(ID INTEGER PRIMARY KEY AUTO_INCREMENT,MP_ID INTEGER,EP_ID INTEGER)')); PREPARE CREATE_TEMPTABLE_MENU_STMT FROM @CREATE_TEMPTABLE_MENU; EXECUTE CREATE_TEMPTABLE_MENU_STMT; SET @INSERT_TEMPTABLE_MENU=(SELECT CONCAT('INSERT INTO ',TEMPTABLE_MENU,'(MP_ID,EP_ID) SELECT M.MP_ID,M.EP_ID FROM USER_MENU_DETAILS U,MENU_PROFILE M WHERE U.RC_ID=(SELECT RC_ID FROM ROLE_CREATION WHERE RC_NAME=','"',ROLENAME,'"',')AND U.MP_ID=M.MP_ID')); PREPARE INSERT_TEMPTABLE_MENU_STMT FROM @INSERT_TEMPTABLE_MENU; EXECUTE INSERT_TEMPTABLE_MENU_STMT; SET @MIN_ID=NULL; SET @SELECT_MINID=(SELECT CONCAT('SELECT MIN(ID) INTO @MIN_ID FROM ',TEMPTABLE_MENU)); PREPARE SELECT_MINID_STMT FROM @SELECT_MINID; EXECUTE SELECT_MINID_STMT; SET MINID=@MIN_ID; SET @MAX_ID=NULL; SET @SELECT_MAXID=(SELECT CONCAT('SELECT MAX(ID) INTO @MAX_ID FROM ',TEMPTABLE_MENU)); PREPARE SELECT_MAXID_STMT FROM @SELECT_MAXID; EXECUTE SELECT_MAXID_STMT; SET MAXID=@MAX_ID; WHILE (MINID<=MAXID)DO SET @T_EPID=NULL; SET @SELECT_EPID=(SELECT CONCAT('SELECT EP_ID INTO @T_EPID FROM ',TEMPTABLE_MENU,' WHERE ID=',MINID,' AND EP_ID IS NOT NULL')); PREPARE SELECT_EPID_STMT FROM @SELECT_EPID; EXECUTE SELECT_EPID_STMT; SET EPID=@T_EPID; IF (EPID IS NOT NULL)THEN -- INSERT QUERY FOR EMAIL_LIST TABLE SET @INSERT_EMAIL_LIST=(SELECT CONCAT('INSERT INTO EMAIL_LIST (EP_ID,EL_EMAIL_ID,ULD_ID)VALUES((SELECT EP_ID FROM ',TEMPTABLE_MENU,' WHERE ID=',MINID,'),','"',LOGINID,'"',',',USERSTAMP_ID,')')); PREPARE INSERT_EMAIL_LIST_STMT FROM @INSERT_EMAIL_LIST; EXECUTE INSERT_EMAIL_LIST_STMT; SET UR_FLAG=1; END IF; SET MINID=MINID+1; END WHILE; SET @DROP_TEMPTABLE_MENU=(SELECT CONCAT('DROP TABLE ',TEMPTABLE_MENU)); PREPARE DROP_TEMPTABLE_MENU_STMT FROM @DROP_TEMPTABLE_MENU; EXECUTE DROP_TEMPTABLE_MENU_STMT; COMMIT; END; /* CALL SP_LOGIN_CREATION_INSERT('bhavani.rajagopalagopal@ssomens.com','ADMIN','2013-09-08','sarathbabou.somaya@ssomens.com',@UR_FLAG); */
true
6b26e66a0e59e9f7a914804a15ce758874b070c6
SQL
mikeburkat/laicos
/Data_Scripts/tables_and_data.sql
UTF-8
54,933
3.046875
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
-- Adminer 4.1.0 MySQL dump SET NAMES utf8; SET time_zone = '+00:00'; SET foreign_key_checks = 0; SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO'; DROP DATABASE IF EXISTS `ebdb`; CREATE DATABASE `ebdb` /*!40100 DEFAULT CHARACTER SET latin1 */; USE `ebdb`; DROP TABLE IF EXISTS `club`; CREATE TABLE `club` ( `clubID` int(10) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(50) NOT NULL, `founderID` int(10) unsigned NOT NULL, `description` text NOT NULL, `posts_allowed_by_members` tinyint(1) DEFAULT NULL, PRIMARY KEY (`clubID`), UNIQUE KEY `name_UNIQUE` (`name`), KEY `FK_club_founder_idx` (`founderID`), CONSTRAINT `FK_club_founder` FOREIGN KEY (`founderID`) REFERENCES `user` (`userID`) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE=InnoDB DEFAULT CHARSET=latin1; INSERT INTO `club` (`clubID`, `name`, `founderID`, `description`, `posts_allowed_by_members`) VALUES (1, 'Best Club', 7, 'a place for rock and roll and two other things', NULL), (2, 'Legion of Macabre Company', 9, 'amet metus. Aliquam erat volutpat. Nulla facilisis. Suspendisse commodo tincidunt nibh. Phasellus nulla. Integer vulputate, risus a ultricies adipiscing, enim mi tempor lorem, eget mollis', 0), (3, 'Way of Boon Dock Vendor', 39, 'Aenean euismod mauris eu', 0), (4, 'Sentinels of Thë BläçK Bei', 39, 'ac orci. Ut semper pretium neque. Morbi quis urna. Nunc quis arcu vel quam dignissim pharetra. Nam ac nulla. In tincidunt congue turpis.', 0), (5, 'Keepers of the Hell Tribe', 29, 'arcu. Sed eu nibh vulputate mauris sagittis placerat. Cras dictum ultricies ligula. Nullam enim. Sed nulla ante, iaculis nec, eleifend non, dapibus rutrum, justo. Praesent luctus.', 1), (6, 'DOMINANT', 47, 'mi lacinia mattis. Integer eu lacus. Quisque imperdiet, erat nonummy ultricies ornare, elit elit fermentum risus, at fringilla purus mauris a nunc.', 0), (7, 'VíRulent Thunder', 7, 'vitae dolor. Donec fringilla. Donec feugiat metus sit amet ante. Vivamus non lorem vitae odio sagittis semper. Nam tempor', 0), (8, 'Wrath of Seventh Turning Clan', 11, 'adipiscing elit. Curabitur sed tortor. Integer aliquam adipiscing', 1), (9, 'The Sin Knights', 31, 'lacus vestibulum lorem, sit amet ultricies sem magna nec quam. Curabitur vel lectus. Cum sociis natoque penatibus et magnis', 1), (10, 'Flames of Ancient Steel', 14, 'tincidunt congue turpis. In condimentum. Donec at arcu. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Donec tincidunt. Donec', 1), (11, 'The Muffin Reeves', 35, 'Suspendisse non leo. Vivamus nibh dolor, nonummy ac, feugiat non, lobortis quis, pede. Suspendisse dui. Fusce diam nunc, ullamcorper eu, euismod ac, fermentum vel,', 0), (12, 'The Prowess', 50, 'luctus et ultrices posuere cubilia Curae; Phasellus ornare. Fusce mollis. Duis sit amet diam eu dolor', 1), (13, 'Gothic Monkeys', 25, 'a odio', 0), (14, 'Golden Darkness', 30, 'tellus. Phasellus elit pede, malesuada vel, venenatis vel, faucibus id, libero. Donec consectetuer mauris id sapien.', 1), (15, 'Horde Players', 22, 'porttitor vulputate, posuere vulputate, lacus. Cras interdum. Nunc sollicitudin commodo ipsum. Suspendisse non leo. Vivamus nibh dolor, nonummy ac, feugiat non, lobortis quis,', 1), (16, 'The Noxracers', 23, 'Quisque imperdiet, erat nonummy ultricies ornare, elit elit fermentum risus, at', 0), (17, 'Hand of Silly Hats Chaos', 14, 'venenatis vel, faucibus id, libero. Donec consectetuer mauris id sapien. Cras dolor dolor, tempus non, lacinia at,', 0), (18, 'Forsaken Souls', 38, 'nonummy. Fusce fermentum fermentum arcu. Vestibulum ante ipsum', 0), (19, 'Padrinos Destiny', 25, 'at auctor ullamcorper, nisl arcu iaculis enim, sit amet ornare lectus justo eu arcu. Morbi sit amet massa. Quisque porttitor eros nec tellus. Nunc lectus pede, ultrices a, auctor', 1), (20, 'Order of Blood Rage Hill', 42, 'sit amet, consectetuer adipiscing elit. Etiam laoreet, libero et tristique', 0), (21, 'MOON', 40, 'enim, condimentum eget, volutpat ornare, facilisis eget, ipsum. Donec sollicitudin adipiscing ligula. Aenean gravida nunc sed pede. Cum sociis natoque', 1), (22, 'Order of the Tragedys Crew', 41, 'mollis. Integer tincidunt aliquam arcu. Aliquam ultrices iaculis odio. Nam interdum', 0), (23, 'Tainted Revenge', 41, 'imperdiet, erat nonummy ultricies ornare, elit elit fermentum risus, at fringilla purus mauris a nunc. In at pede. Cras vulputate velit eu sem. Pellentesque ut ipsum ac mi eleifend egestas.', 1), (24, 'Blood Legion', 26, 'magna. Phasellus dolor elit, pellentesque', 0), (25, 'Twohardcore Order', 34, 'urna suscipit nonummy. Fusce fermentum fermentum arcu. Vestibulum ante ipsum', 0), (26, 'Endless Teldrassil', 50, 'mus. Proin vel nisl. Quisque fringilla euismod enim. Etiam gravida molestie arcu. Sed eu nibh vulputate mauris sagittis placerat. Cras dictum ultricies ligula. Nullam', 1), (27, 'Valar Anonymous', 46, 'nulla vulputate', 0), (28, 'Dragoons of Golden Bunnies', 40, 'in consequat enim diam vel arcu. Curabitur ut odio vel est tempor bibendum. Donec felis', 1), (29, 'Drunken Blood', 21, 'Vestibulum accumsan neque et nunc.', 0), (30, 'ROBOT', 33, 'imperdiet ornare. In faucibus. Morbi vehicula. Pellentesque tincidunt', 1), (31, 'The Animosity', 50, 'enim. Mauris quis turpis vitae purus gravida sagittis.', 1), (32, 'The Ping', 30, 'nec, cursus a, enim. Suspendisse aliquet, sem ut cursus luctus, ipsum leo elementum sem, vitae aliquam eros turpis non enim. Mauris quis turpis vitae purus gravida sagittis.', 0), (33, 'Unforgiven Soldiers', 43, 'Nunc laoreet lectus quis massa. Mauris vestibulum, neque sed dictum eleifend, nunc risus varius orci, in consequat enim diam vel arcu. Curabitur ut odio vel est tempor bibendum. Donec felis', 1), (34, 'Eyes of Silver Dragon Inches', 46, 'nisi. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Proin', 1), (35, 'Azeroth Stalkers', 27, 'euismod et, commodo at, libero. Morbi accumsan laoreet ipsum. Curabitur consequat, lectus sit amet', 0), (36, 'Dirty Crusade', 34, 'at pretium aliquet, metus urna convallis erat, eget tincidunt dui augue eu tellus. Phasellus elit', 0), (37, 'Gods of the Eldritch Fellowship', 20, 'amet nulla. Donec non', 0), (38, 'TOTETOTE', 30, 'aliquet magna a neque. Nullam ut nisi a odio semper cursus. Integer mollis. Integer tincidunt aliquam arcu. Aliquam ultrices iaculis odio. Nam interdum enim non nisi. Aenean eget metus.', 0), (39, 'Will of the Chemical Fury', 31, 'Proin vel nisl.', 0), (40, 'Empire of Fallen Blood Tippers', 38, 'molestie orci tincidunt adipiscing. Mauris molestie pharetra nibh. Aliquam ornare, libero at auctor ullamcorper,', 1), (41, 'The Alts of Midnight Dragon', 40, 'et arcu imperdiet ullamcorper. Duis at lacus. Quisque purus sapien, gravida non, sollicitudin a, malesuada', 0), (42, 'Alts Vudu', 8, 'Phasellus elit pede, malesuada vel, venenatis vel, faucibus id, libero. Donec consectetuer mauris id', 1), (43, 'Nocturnal Darkness', 24, 'lacinia mattis. Integer eu lacus. Quisque imperdiet, erat', 1), (44, 'Legacy of the Hardbull\'\'S Bros', 30, 'eu elit. Nulla', 1), (45, 'Altcast Nevidimka', 41, 'id magna et ipsum cursus vestibulum. Mauris magna. Duis dignissim tempor arcu. Vestibulum', 0), (46, 'The Gøds of Underground Justice', 21, 'Donec nibh enim, gravida sit amet, dapibus id, blandit at, nisi. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Proin vel nisl. Quisque', 0), (47, 'The Women of Steel Army', 44, 'aliquet. Proin velit. Sed malesuada augue ut lacus. Nulla tincidunt,', 1), (48, 'Holy Faith', 29, 'nonummy ipsum non arcu. Vivamus sit amet risus. Donec egestas. Aliquam nec enim. Nunc ut erat. Sed nunc est, mollis non, cursus non, egestas a, dui. Cras', 1), (49, 'The Starfox Alliance', 38, 'nisl', 1), (50, 'Chicken Dead', 47, 'pharetra', 1), (51, 'Knight of the Farpoint Order', 24, 'libero. Integer in magna. Phasellus dolor elit, pellentesque a, facilisis non, bibendum sed, est. Nunc laoreet lectus quis massa. Mauris', 0), (52, 'Hardcore Locusts', 29, 'eget mollis lectus', 0), (53, 'Knights of Black Tooth Viscious', 45, 'dictum sapien. Aenean massa. Integer vitae nibh. Donec est mauris, rhoncus id, mollis', 1), (54, 'The Eyes of Thousand Knights', 21, 'Curabitur vel lectus. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec dignissim magna a tortor. Nunc commodo auctor velit. Aliquam nisl. Nulla', 1), (55, 'Blood Few', 14, 'lectus quis massa. Mauris vestibulum, neque sed dictum eleifend, nunc risus varius orci,', 0), (56, 'Shogun of Vile Raiders', 14, 'nibh. Aliquam ornare, libero at auctor ullamcorper, nisl arcu iaculis enim, sit amet ornare lectus justo eu arcu. Morbi sit amet', 1), (57, 'Scions of Team Action Vengeance', 20, 'porttitor eros', 0), (58, 'Quild of Bright Yellow Assassins', 28, 'nisl arcu iaculis enim, sit amet ornare lectus justo eu arcu. Morbi sit amet massa. Quisque porttitor eros nec tellus. Nunc lectus pede,', 0), (59, 'The Decree of Deja Slivermoon', 20, 'ultrices. Vivamus rhoncus. Donec est.', 0), (60, 'The Nexus', 31, 'neque pellentesque massa lobortis ultrices. Vivamus rhoncus. Donec', 0), (61, 'The Storming Argentei', 22, 'orci sem eget massa. Suspendisse eleifend. Cras sed leo. Cras vehicula aliquet libero. Integer in magna. Phasellus dolor elit,', 0), (62, 'The Knights of Boneyard Kaos', 12, 'et, rutrum non, hendrerit id, ante.', 1), (63, 'Eternal Squad', 43, 'Vestibulum accumsan neque et nunc. Quisque ornare tortor at risus. Nunc ac', 1), (64, 'Keep of Team Action Templar', 10, 'id nunc interdum feugiat. Sed nec metus', 0), (65, 'The Sacred Unit', 37, 'amet risus. Donec egestas. Aliquam nec enim. Nunc ut erat. Sed', 0), (66, 'The Angelfire', 17, 'euismod urna.', 0), (67, 'Hearts of Tauren Dairy Triumvirate', 15, 'Suspendisse dui. Fusce diam nunc, ullamcorper eu, euismod ac, fermentum vel, mauris. Integer sem elit, pharetra ut, pharetra sed, hendrerit a, arcu. Sed et libero. Proin mi. Aliquam gravida mauris', 1), (68, 'Fighters of the Knights Outcasts', 29, 'vulputate, posuere vulputate, lacus. Cras interdum. Nunc sollicitudin commodo ipsum. Suspendisse non', 0), (69, 'Will of United Horde Pirates', 28, 'malesuada ut, sem. Nulla interdum. Curabitur dictum. Phasellus in felis. Nulla tempor augue ac ipsum. Phasellus vitae mauris sit amet lorem semper auctor. Mauris vel turpis. Aliquam adipiscing', 0), (70, 'Crusaders of Praetorian Teldrassil', 20, 'Ut tincidunt vehicula risus. Nulla eget metus eu erat semper rutrum. Fusce dolor quam, elementum at, egestas a, scelerisque sed, sapien. Nunc pulvinar arcu et pede. Nunc sed orci', 0), (71, 'Rubber Kindreds', 46, 'imperdiet ullamcorper. Duis at lacus. Quisque purus sapien, gravida non, sollicitudin a, malesuada id, erat. Etiam vestibulum massa rutrum magna. Cras convallis convallis dolor. Quisque tincidunt pede ac', 0), (72, 'Honored Shadow', 83, 'ipsum. Curabitur consequat, lectus sit amet', 1), (73, 'Disciples of the Old Proof', 23, 'id, ante. Nunc mauris sapien, cursus in, hendrerit consectetuer, cursus et, magna. Praesent interdum ligula eu enim. Etiam imperdiet dictum magna. Ut tincidunt orci quis lectus. Nullam suscipit, est', 1), (74, 'Journeyman Faithful', 36, 'nibh. Quisque nonummy ipsum non arcu. Vivamus', 0), (75, 'Brothers of Bloodhorde Team', 31, 'magna tellus faucibus leo, in lobortis tellus justo sit amet nulla. Donec non justo. Proin', 0), (94, 'first create', 12, 'asdfsadf sd fsd fa sd fsad asfdasdf asd sad asdf asdf sad ', 0), (95, 'new group', 12, 'asfasljdkhfasdf asd kfjasdkl; sadjfasjd; fksdaj asdfk lsadk;l fsak ldfas;', 1), (96, 'trying to redirect', 12, 'i\'m not sure this will work', 1), (97, 'membership test', 12, 'testing the membership and ownership of groups', 1), (98, 'test1', 7, 'test2', 1), (99, 'mike\'s group', 66, 'a special group', 1); DROP TABLE IF EXISTS `clubWall`; CREATE TABLE `clubWall` ( `postID` int(10) unsigned NOT NULL, `clubID` int(10) unsigned NOT NULL, KEY `FK_postMap_club_idx` (`clubID`), KEY `FK_postMap_post_idx` (`postID`), CONSTRAINT `clubWall_ibfk_1` FOREIGN KEY (`postID`) REFERENCES `post` (`postID`) ON DELETE CASCADE, CONSTRAINT `FK_postMap_club` FOREIGN KEY (`clubID`) REFERENCES `club` (`clubID`) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE=InnoDB DEFAULT CHARSET=latin1; INSERT INTO `clubWall` (`postID`, `clubID`) VALUES (62, 97), (107, 50), (109, 50), (111, 50), (142, 37), (147, 99), (148, 99), (149, 99), (150, 99), (151, 99), (152, 99), (153, 99), (155, 99), (159, 46), (160, 46), (180, 30), (190, 60), (191, 72), (204, 72); DROP TABLE IF EXISTS `comment`; CREATE TABLE `comment` ( `parentID` int(10) unsigned NOT NULL, `childID` int(10) unsigned NOT NULL, PRIMARY KEY (`parentID`,`childID`), KEY `FK_parent_post_idx` (`parentID`), KEY `FK_child_post_idx` (`childID`), CONSTRAINT `comment_ibfk_2` FOREIGN KEY (`childID`) REFERENCES `post` (`postID`) ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT `comment_ibfk_1` FOREIGN KEY (`parentID`) REFERENCES `post` (`postID`) ON DELETE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=latin1; INSERT INTO `comment` (`parentID`, `childID`) VALUES (3, 4), (3, 5), (3, 6), (9, 32), (9, 33), (10, 31), (11, 45), (15, 23), (15, 46), (17, 34), (17, 47), (17, 48), (17, 49), (24, 25), (24, 26), (24, 27), (24, 28), (24, 29), (53, 56), (53, 66), (95, 96), (97, 98), (127, 140), (128, 139), (137, 143), (153, 154), (155, 156), (179, 192), (179, 201); DROP TABLE IF EXISTS `content`; CREATE TABLE `content` ( `contentID` int(10) unsigned NOT NULL AUTO_INCREMENT, `type` enum('TEXT','IMAGE','VIDEO') NOT NULL, `permission` tinyint(3) unsigned NOT NULL DEFAULT '0', `link_url` text, `text` text, PRIMARY KEY (`contentID`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; INSERT INTO `content` (`contentID`, `type`, `permission`, `link_url`, `text`) VALUES (2, 'TEXT', 0, '', 'long text'), (3, 'TEXT', 0, NULL, 'stuff'), (4, 'TEXT', 0, NULL, 'Yah, i try and make it just like real life.'), (5, 'TEXT', 0, NULL, 'If you re-use the questions all the time its not much life real life.'), (6, 'TEXT', 0, NULL, 'I dont.'), (7, 'TEXT', 0, NULL, 'starting a private message'), (8, 'TEXT', 0, NULL, 'aprivate message'), (11, 'TEXT', 0, NULL, 'my third post'), (12, 'TEXT', 0, NULL, 'Dynamic prepend test'), (13, 'TEXT', 0, NULL, 'Dynamic prepend test number 2'), (14, 'TEXT', 0, NULL, 'Dynamic post test tree, I think this is the one'), (15, 'TEXT', 0, NULL, 'dynamic post, common work'), (16, 'TEXT', 0, NULL, 'dynamic posting works now?'), (17, 'TEXT', 0, NULL, 'Dynamic posting works great now.'), (19, 'TEXT', 0, NULL, 'hello marc'), (20, 'TEXT', 0, NULL, 'test'), (21, 'TEXT', 0, NULL, 'my first comment'), (22, 'TEXT', 0, NULL, 'my second comment'), (23, 'TEXT', 0, NULL, 'real test'), (24, 'TEXT', 0, NULL, 'hey'), (25, 'TEXT', 0, NULL, 'asiufgashkjfa'), (26, 'TEXT', 0, NULL, 'test'), (27, 'TEXT', 0, NULL, 'test reply'), (28, 'TEXT', 0, NULL, 'test reply'), (29, 'TEXT', 0, NULL, 'test reply'), (30, 'TEXT', 0, NULL, 'test reply'), (31, 'TEXT', 0, NULL, 'test reply'), (32, 'TEXT', 0, NULL, 'asdf'), (33, 'TEXT', 0, NULL, 'coment test'), (34, 'TEXT', 0, NULL, 'a comment'), (35, 'TEXT', 0, NULL, 'another comment'), (36, 'TEXT', 0, NULL, 'hi again'), (37, 'TEXT', 0, NULL, 'asdfasf'), (38, 'TEXT', 0, NULL, 'here'), (39, 'TEXT', 0, NULL, 'hey'), (40, 'TEXT', 0, NULL, 'sfas'), (41, 'TEXT', 0, NULL, 'jfkdsjafd'), (42, 'TEXT', 0, NULL, 'sdfasdf'), (43, 'TEXT', 0, NULL, 'fsadfasf'), (44, 'TEXT', 0, NULL, 'hello'), (45, 'TEXT', 0, NULL, 'another one... this is getting long'), (46, 'TEXT', 0, NULL, 'should be closing this'), (47, 'TEXT', 0, NULL, 'ok'), (48, 'TEXT', 0, NULL, 'sdfg'), (49, 'TEXT', 0, NULL, 'should work'), (50, 'TEXT', 0, NULL, 'again'), (51, 'TEXT', 0, NULL, 'works great'), (53, 'TEXT', 0, NULL, 'hello'), (54, 'TEXT', 0, NULL, 'test22'), (55, 'TEXT', 0, NULL, 'test'), (56, 'TEXT', 0, NULL, 'test'), (57, 'TEXT', 0, NULL, 'test'), (58, 'TEXT', 0, NULL, 't2'), (59, 'TEXT', 0, '', 'Enter your message.\r\n'), (60, 'IMAGE', 0, 'DSC_5865.jpg', 'Enter your message.\r\n'), (61, 'TEXT', 0, '', 'test1111'), (62, 'IMAGE', 0, 'image.png', 'test11111'), (63, 'IMAGE', 0, 'image1.png', 'test11111'), (64, 'IMAGE', 0, 'image2.png', 'test11111'), (66, 'TEXT', 0, '', 'Enter your message.'), (67, 'TEXT', 0, '', 'Enter your message.'), (68, 'TEXT', 0, NULL, 'test3'), (69, 'TEXT', 0, NULL, 'hello again'), (70, 'TEXT', 0, NULL, 'i like to say hi all the time'), (72, 'TEXT', 0, NULL, 'testing new tabbed post'), (73, 'TEXT', 0, NULL, 'afsfsadf'), (74, 'TEXT', 0, NULL, 'asdfasdfasdf'), (90, 'TEXT', 0, NULL, ''), (91, 'TEXT', 0, NULL, ''), (92, 'TEXT', 0, NULL, '0'), (93, 'TEXT', 0, NULL, 'one'), (96, 'TEXT', 0, '', 'Enter yasdour message.'), (97, 'VIDEO', 0, 'https://www.youtube.com/watch?v=8ATu1BiOPZA', NULL), (98, 'TEXT', 0, NULL, 'good tunes'), (99, 'VIDEO', 0, 'https://www.youtube.com/watch?v=yyDUC1LUXSU', NULL), (100, 'TEXT', 0, NULL, 'blurred lines'), (102, 'IMAGE', 0, NULL, NULL), (106, 'VIDEO', 0, 'https://www.youtube.com/watch?v=CKVKxBxy8Bo', 'Enter your message.'), (107, 'VIDEO', 0, 'https://www.youtube.com/watch?v=CKVKxBxy8Bo', 'Enter your message.'), (108, 'TEXT', 0, '', 'asdasdad'), (109, 'TEXT', 0, '', 'asdasdad'), (110, 'TEXT', 0, '', 'asdasdad asda asd asd a'), (111, 'TEXT', 0, '', 'the chickeadasdasdasda'), (112, 'TEXT', 0, '', 'the chickeadasdasdasda'), (113, 'TEXT', 0, '', 'asdasd'), (128, 'IMAGE', 0, NULL, NULL), (129, 'IMAGE', 0, NULL, NULL), (130, 'IMAGE', 0, NULL, NULL), (131, 'IMAGE', 0, NULL, NULL), (132, 'IMAGE', 0, NULL, NULL), (133, 'IMAGE', 0, NULL, NULL), (134, 'IMAGE', 0, '', 'photo test'), (135, 'IMAGE', 0, '', 'photo test'), (136, 'IMAGE', 0, '', 'Enter your message.'), (137, 'IMAGE', 0, 'DSC_59031.jpg', 'Enter your message.'), (138, 'IMAGE', 0, 'DSC_59032.jpg', 'Enter your message.'), (139, 'IMAGE', 0, 'DSC_59033.jpg', 'Enter teyour message.'), (140, 'TEXT', 0, '', 'asdasd'), (141, 'TEXT', 0, NULL, 'Beautiful Revy.'), (142, 'TEXT', 0, NULL, 'Sunny day in Edmonton'), (144, 'IMAGE', 0, 'OhbRkJs.jpg', 'test2'), (145, 'TEXT', 0, NULL, 'test'), (146, 'IMAGE', 0, NULL, NULL), (149, 'TEXT', 0, NULL, 'hello'), (150, 'TEXT', 0, NULL, 'testing dynamic posts'), (151, 'TEXT', 0, NULL, 'this one will work dynamically please'), (152, 'TEXT', 0, NULL, 'this is the one'), (153, 'TEXT', 0, NULL, 'this has to work now'), (154, 'TEXT', 0, NULL, 'haha it works dynamically finally'), (155, 'IMAGE', 0, NULL, NULL), (156, 'TEXT', 0, NULL, 'fireworks'), (157, 'VIDEO', 0, 'http://www.youtube.com/watch?v=O-zpOMYRi0w', NULL), (158, 'TEXT', 0, NULL, 'fancy iggy!'), (160, 'TEXT', 0, '', 'I have such a big penis.'), (161, 'TEXT', 0, NULL, 'test'), (162, 'TEXT', 0, NULL, 'test'), (163, '', 0, '', 'this is a test'), (164, 'TEXT', 0, '', 'this is another test'), (165, 'TEXT', 0, '', 'blah'), (166, 'TEXT', 0, '', 'lala'), (167, 'TEXT', 0, '', 'blah'), (168, 'TEXT', 0, '', 'another test for shits and giggles'), (169, 'TEXT', 0, '', 'i created an array of names'), (170, 'TEXT', 0, '', 'does this work?'), (171, 'TEXT', 0, '', 'does thsi work?'), (172, 'TEXT', 0, '', 'testing'), (173, 'TEXT', 0, '', 'yada yada'), (174, 'TEXT', 0, '', 'this should work'), (175, 'TEXT', 0, '', 'what about this'), (176, 'TEXT', 0, '', 'eureka'), (177, 'IMAGE', 0, NULL, NULL), (178, 'IMAGE', 0, '', 'Steak in space omnomnom'), (179, 'IMAGE', 0, '', 'Steak in space omnomnom'), (180, 'TEXT', 0, NULL, 'steak in space!'), (181, 'IMAGE', 0, NULL, NULL), (182, 'VIDEO', 0, 'https://www.youtube.com/watch?v=yNTzD7e6hNU', NULL), (183, 'TEXT', 0, '', 'hey'), (184, 'TEXT', 0, '', 'hey'), (185, 'TEXT', 0, '', 'hey'), (186, 'TEXT', 0, '', 'hey'), (187, 'TEXT', 0, '', 'hey'), (188, 'TEXT', 0, '', 'hey'), (189, 'TEXT', 0, '', 'hey'), (190, 'TEXT', 0, '', 'hey'), (191, 'TEXT', 0, '', 'hey'), (192, 'TEXT', 0, NULL, 'hello'), (193, 'TEXT', 0, NULL, 'hey'), (194, 'TEXT', 0, NULL, 'test'), (196, 'IMAGE', 0, '', 'asd'), (197, 'TEXT', 0, '', 'asddasdasdasdasdasd'), (202, 'TEXT', 0, '', 'deleted fkey'), (203, 'TEXT', 0, NULL, 'hello'), (204, 'TEXT', 0, '', 'adding a message'), (205, 'TEXT', 0, '', 'this is my wall'), (206, 'TEXT', 0, NULL, 'worksÉ'), (207, 'TEXT', 0, NULL, 'test'), (208, 'TEXT', 0, '', '123331'), (209, 'TEXT', 0, '', 'new post\r\n'), (210, 'TEXT', 0, '', 'honored shadow wall'); DROP TABLE IF EXISTS `has_tag`; CREATE TABLE `has_tag` ( `tagID` int(10) unsigned NOT NULL, `clubID` int(10) unsigned NOT NULL, KEY `FK_has_tag_tag` (`tagID`), KEY `FK_has_tag_club` (`clubID`), CONSTRAINT `FK_has_tag_tag` FOREIGN KEY (`tagID`) REFERENCES `tag` (`tagID`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `FK_has_tag_club` FOREIGN KEY (`clubID`) REFERENCES `club` (`clubID`) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE=InnoDB DEFAULT CHARSET=latin1; INSERT INTO `has_tag` (`tagID`, `clubID`) VALUES (35, 18), (67, 36), (56, 60), (57, 18), (93, 35), (19, 56), (16, 17), (67, 28), (51, 19), (18, 57), (12, 29), (48, 36), (43, 33), (53, 30), (14, 51), (22, 71), (56, 3), (72, 57), (43, 66), (50, 62), (92, 24), (35, 53), (51, 42), (95, 66), (28, 56), (82, 41), (26, 42), (61, 62), (8, 40), (10, 61), (25, 68), (101, 5), (40, 20), (52, 7), (4, 8), (5, 61), (8, 13), (21, 59), (85, 46), (33, 21), (43, 72), (53, 44), (101, 6), (1, 26), (22, 7), (30, 63), (81, 24), (17, 52), (39, 2), (43, 50), (85, 4), (14, 61), (14, 47), (70, 48), (34, 44), (23, 24), (13, 12), (92, 25), (17, 60), (13, 17), (26, 51), (102, 65), (7, 33), (88, 32), (38, 34), (29, 48), (40, 67), (86, 55), (62, 67), (70, 72), (38, 55), (42, 61), (68, 49), (46, 5), (64, 13), (85, 12), (12, 26), (76, 33), (78, 72), (86, 48), (7, 49), (57, 49), (72, 35), (90, 57), (94, 7), (85, 14), (66, 73), (87, 16), (93, 45), (8, 33), (45, 28), (21, 38), (10, 25), (4, 26), (90, 74), (39, 62), (45, 36), (81, 5), (7, 26), (25, 17), (13, 43), (43, 14), (58, 20), (73, 57), (42, 53), (72, 35), (54, 19), (54, 31), (60, 51), (63, 15), (41, 6), (67, 58), (10, 60), (76, 31), (73, 54), (10, 62), (13, 42), (51, 20), (55, 5), (4, 67), (3, 60), (76, 26), (21, 57), (18, 58), (5, 48), (80, 36), (22, 49), (80, 63), (80, 51), (1, 74), (31, 25), (102, 25), (11, 23), (60, 33), (38, 37), (88, 51), (29, 51), (81, 5), (51, 10), (100, 61), (97, 37), (65, 6), (76, 33), (44, 64), (33, 38), (89, 5), (13, 49), (83, 73), (20, 55), (38, 54); DROP TABLE IF EXISTS `hearts`; CREATE TABLE `hearts` ( `userID` int(10) unsigned NOT NULL, `postID` int(10) unsigned NOT NULL, KEY `userID` (`userID`), KEY `postID` (`postID`), CONSTRAINT `hearts_ibfk_3` FOREIGN KEY (`postID`) REFERENCES `post` (`postID`) ON DELETE CASCADE, CONSTRAINT `hearts_ibfk_1` FOREIGN KEY (`userID`) REFERENCES `user` (`userID`) ON DELETE NO ACTION ) ENGINE=InnoDB DEFAULT CHARSET=latin1; INSERT INTO `hearts` (`userID`, `postID`) VALUES (7, 17), (66, 17), (66, 144), (66, 155), (66, 153), (66, 128), (66, 152), (67, 144), (68, 200), (68, 174), (68, 198), (68, 196), (68, 17), (68, 15), (68, 14), (68, 11), (68, 13), (68, 12); DROP TABLE IF EXISTS `invites`; CREATE TABLE `invites` ( `timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `member` tinyint(4) NOT NULL DEFAULT '0', `invited` varchar(50) NOT NULL, `inviter` varchar(50) NOT NULL, `invitedurl` varchar(50) NOT NULL, PRIMARY KEY (`invited`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; INSERT INTO `invites` (`timestamp`, `member`, `invited`, `inviter`, `invitedurl`) VALUES ('0000-00-00 00:00:00', 0, '', '', 'd41d8cd98f00b204e9800998ecf8427e'), ('0000-00-00 00:00:00', 0, 'a@hotmail.com', '', ''), ('0000-00-00 00:00:00', 0, 'asasdas@fdsa.ca', '', 'cf960a90c6da15c310090a56fc142a90'), ('0000-00-00 00:00:00', 0, 'asdads@dsa.dsa', '', 'd016ba187918e7f68571b5c51e28021e'), ('0000-00-00 00:00:00', 0, 'caca@crotte.debic', '', '5c2005b0f97eeb8eaea22a9f1d968c9f'), ('2014-07-27 19:59:40', 0, 'dg@asd.com', '', 'f0141a5c5d7a8f8f25ef7e464a3bce91'), ('0000-00-00 00:00:00', 0, 'douche@bag.yeah', '', '19a3fb0338554f65a74ca0712ed8af5b'), ('2014-08-07 22:30:59', 0, 'geoff@geoff.com', '', '797371a189bc30516c212e4f33712def'), ('0000-00-00 00:00:00', 0, 'hnowrigvhw!@HGIOUDSA.GDA', '', 'e16cde732d22b3a61aa51abe09df65bf'), ('0000-00-00 00:00:00', 0, 'Honert@buggies.net', '', '3d3250d6fdfb369d80a6a9b29444a76c'), ('0000-00-00 00:00:00', 0, 'Hornet@buggies.net', '', '202e19609fdf9ed773409daac2dc4d55'), ('0000-00-00 00:00:00', 0, 'je@suis.con', '', '13890b149a6b0907996fc0d2b798a24c'), ('0000-00-00 00:00:00', 0, 'je@suis.cool', '', 'd7ddf9128dd052d0b01e65508c23d6be'), ('0000-00-00 00:00:00', 0, 'kpraglowski@gmail.com', '', '1e73c42f7248deefbfaf88112d2a0aaf'), ('0000-00-00 00:00:00', 0, 't@est.com', '', '8d60728671f60feff517a4179f94350d'), ('0000-00-00 00:00:00', 0, 't@t.com', '', '6065906a08ee2df2b20592fe34c6c166'), ('0000-00-00 00:00:00', 0, 'test@test.com', '', 'b642b4217b34b1e8d3bd915fc65c4452'), ('0000-00-00 00:00:00', 0, 'testicule@penis.bite', '', '08495fa27dede25b6e90c0e2746e33fd'), ('2014-07-27 18:06:00', 0, 'testing@time.stamp', '', 'cd915c12d4cfeabede0ecc71fb02bdc4'), ('0000-00-00 00:00:00', 0, 'tesutih@tges.cds', '', '014cfcba908386c9bf8a86263d95830f'), ('0000-00-00 00:00:00', 0, 'wfige@fda.dfa', '', '072e4b35025e83420fc4577cff32f93c'); DROP TABLE IF EXISTS `membership`; CREATE TABLE `membership` ( `clubID` int(10) unsigned NOT NULL, `userID` int(10) unsigned NOT NULL, `role` varchar(20) NOT NULL, KEY `FK_membership_user_idx` (`userID`), KEY `FK_membership_club_idx` (`clubID`), CONSTRAINT `FK_membership_club` FOREIGN KEY (`clubID`) REFERENCES `club` (`clubID`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `FK_membership_user` FOREIGN KEY (`userID`) REFERENCES `user` (`userID`) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE=InnoDB DEFAULT CHARSET=latin1; INSERT INTO `membership` (`clubID`, `userID`, `role`) VALUES (1, 7, 'owner'), (1, 7, 'member'), (97, 12, 'owner'), (97, 12, 'member'), (98, 7, 'owner'), (98, 7, 'member'), (99, 66, 'owner'), (97, 67, 'member'), (50, 83, 'owner'), (3, 66, 'member'), (34, 67, 'member'), (64, 67, 'member'), (37, 67, 'member'), (99, 66, 'member'), (46, 67, 'member'), (30, 67, 'member'), (72, 83, 'member'), (72, 83, 'owner'); DROP TABLE IF EXISTS `post`; CREATE TABLE `post` ( `postID` int(10) unsigned NOT NULL AUTO_INCREMENT, `userID` int(10) unsigned NOT NULL, `contentID` int(10) unsigned NOT NULL, `postHeartCount` int(10) unsigned NOT NULL, `timeCreated` datetime NOT NULL, `isComment` tinyint(1) unsigned NOT NULL DEFAULT '0', `allowsComments` tinyint(1) unsigned NOT NULL DEFAULT '1', PRIMARY KEY (`postID`), KEY `FK_post_user_idx` (`userID`), KEY `FK_post_content_idx` (`contentID`), CONSTRAINT `post_ibfk_4` FOREIGN KEY (`contentID`) REFERENCES `content` (`contentID`) ON DELETE CASCADE, CONSTRAINT `post_ibfk_3` FOREIGN KEY (`userID`) REFERENCES `user` (`userID`) ON DELETE NO ACTION ) ENGINE=InnoDB DEFAULT CHARSET=latin1; INSERT INTO `post` (`postID`, `userID`, `contentID`, `postHeartCount`, `timeCreated`, `isComment`, `allowsComments`) VALUES (2, 8, 2, 0, '2014-06-26 00:15:15', 1, 1), (3, 9, 3, 0, '2014-06-26 22:08:37', 0, 1), (4, 10, 4, 0, '2014-06-26 22:08:37', 1, 1), (5, 11, 5, 0, '2014-06-26 22:08:37', 1, 1), (6, 10, 6, 0, '2014-06-26 22:08:37', 1, 1), (7, 11, 7, 0, '2014-07-01 18:26:43', 0, 1), (8, 9, 8, 0, '2014-07-07 01:37:01', 0, 1), (9, 66, 11, 0, '2014-07-07 20:07:41', 0, 1), (10, 66, 12, 0, '2014-07-07 21:07:14', 0, 1), (11, 66, 13, 0, '2014-07-07 21:07:58', 0, 1), (12, 66, 14, 0, '2014-07-07 21:07:25', 0, 1), (13, 66, 15, 0, '2014-07-07 21:07:33', 0, 1), (14, 66, 16, 0, '2014-07-07 21:07:46', 0, 1), (15, 66, 17, 0, '2014-07-07 21:07:33', 0, 1), (17, 66, 19, 0, '2014-07-07 22:07:42', 0, 1), (18, 67, 20, 0, '2014-07-07 23:07:23', 0, 1), (19, 66, 21, 0, '2014-07-08 00:07:03', 1, 1), (20, 66, 22, 0, '2014-07-08 00:07:34', 1, 1), (21, 66, 23, 0, '2014-07-08 00:07:03', 1, 1), (22, 66, 24, 0, '2014-07-08 00:07:30', 1, 1), (23, 66, 25, 0, '2014-07-08 00:07:08', 1, 1), (24, 67, 26, 0, '2014-07-08 00:07:33', 0, 1), (25, 67, 27, 0, '2014-07-08 00:07:49', 1, 1), (26, 67, 28, 0, '2014-07-08 00:07:51', 1, 1), (27, 67, 29, 0, '2014-07-08 00:07:53', 1, 1), (28, 67, 30, 0, '2014-07-08 00:07:54', 1, 1), (29, 67, 31, 0, '2014-07-08 00:07:01', 1, 1), (30, 66, 32, 0, '2014-07-08 00:07:06', 1, 1), (31, 66, 33, 0, '2014-07-08 00:07:35', 1, 1), (32, 66, 34, 0, '2014-07-08 00:07:52', 1, 1), (33, 66, 35, 0, '2014-07-08 00:07:07', 1, 1), (34, 66, 36, 0, '2014-07-08 00:07:52', 1, 1), (35, 66, 37, 0, '2014-07-08 00:07:35', 1, 1), (36, 66, 38, 0, '2014-07-08 00:07:18', 1, 1), (37, 66, 39, 0, '2014-07-08 00:07:39', 1, 1), (38, 66, 40, 0, '2014-07-08 01:07:19', 1, 1), (39, 66, 41, 0, '2014-07-08 01:07:27', 1, 1), (40, 66, 42, 0, '2014-07-08 01:07:14', 1, 1), (41, 66, 43, 0, '2014-07-08 01:07:20', 1, 1), (42, 66, 44, 0, '2014-07-08 01:07:47', 1, 1), (43, 66, 45, 0, '2014-07-08 01:07:19', 1, 1), (44, 66, 46, 0, '2014-07-08 01:07:44', 1, 1), (45, 66, 47, 0, '2014-07-08 01:07:15', 1, 1), (46, 66, 48, 0, '2014-07-08 01:07:04', 1, 1), (47, 66, 49, 0, '2014-07-08 01:07:37', 1, 1), (48, 66, 50, 0, '2014-07-08 01:07:04', 1, 1), (49, 66, 51, 0, '2014-07-08 01:07:15', 1, 1), (51, 66, 53, 0, '2014-07-08 04:07:09', 1, 1), (52, 67, 54, 0, '2014-07-13 01:07:53', 0, 1), (53, 67, 55, 0, '2014-07-13 01:07:09', 0, 1), (54, 67, 56, 0, '2014-07-13 01:07:10', 0, 1), (55, 67, 57, 0, '2014-07-13 01:07:11', 0, 1), (56, 67, 58, 0, '2014-07-13 01:07:16', 1, 1), (57, 67, 59, 0, '2014-07-13 18:07:50', 0, 1), (58, 67, 60, 0, '2014-07-13 18:07:25', 0, 1), (59, 67, 61, 0, '2014-07-13 21:07:25', 0, 1), (60, 67, 62, 0, '2014-07-13 22:07:01', 0, 1), (61, 67, 63, 0, '2014-07-13 22:07:14', 0, 1), (62, 67, 64, 0, '2014-07-13 22:07:13', 0, 1), (64, 67, 66, 0, '2014-07-13 22:07:36', 0, 1), (65, 67, 67, 0, '2014-07-13 22:07:49', 0, 1), (66, 67, 68, 0, '2014-07-15 01:07:34', 1, 1), (67, 66, 69, 0, '2014-07-16 04:07:14', 1, 1), (68, 66, 70, 0, '2014-07-16 04:07:13', 1, 1), (70, 66, 72, 0, '2014-07-16 06:07:32', 0, 1), (71, 66, 73, 0, '2014-07-16 06:07:52', 0, 1), (72, 66, 74, 0, '2014-07-16 06:07:06', 0, 1), (88, 66, 90, 0, '2014-07-16 20:07:24', 1, 1), (89, 66, 91, 0, '2014-07-16 20:07:00', 1, 1), (90, 66, 92, 0, '2014-07-16 20:07:52', 1, 1), (91, 66, 93, 0, '2014-07-16 20:07:28', 1, 1), (94, 69, 96, 0, '2014-07-17 02:07:55', 0, 1), (95, 66, 97, 0, '2014-07-17 19:07:24', 0, 1), (96, 66, 98, 0, '2014-07-17 19:07:44', 1, 1), (97, 66, 99, 0, '2014-07-17 19:07:16', 0, 1), (98, 66, 100, 0, '2014-07-17 19:07:37', 1, 1), (100, 67, 102, 0, '2014-07-18 01:07:41', 0, 1), (104, 83, 106, 0, '2014-07-18 07:07:32', 0, 1), (105, 83, 107, 0, '2014-07-18 07:07:01', 0, 1), (106, 83, 108, 0, '2014-07-18 17:07:50', 0, 1), (107, 83, 109, 0, '2014-07-18 17:07:37', 0, 1), (108, 83, 110, 0, '2014-07-18 17:07:33', 0, 1), (109, 83, 111, 0, '2014-07-18 18:07:32', 0, 1), (110, 83, 112, 0, '2014-07-18 19:07:44', 0, 1), (111, 83, 113, 0, '2014-07-18 20:07:26', 0, 1), (126, 66, 128, 0, '2014-07-26 18:07:57', 0, 1), (127, 66, 129, 0, '2014-07-26 19:07:49', 0, 1), (128, 66, 130, 0, '2014-07-26 19:07:22', 0, 1), (129, 67, 131, 0, '2014-07-26 21:07:57', 0, 1), (130, 67, 132, 0, '2014-07-26 21:07:03', 0, 1), (131, 67, 133, 0, '2014-07-26 21:07:02', 0, 1), (132, 67, 134, 0, '2014-07-26 21:07:10', 0, 1), (133, 67, 135, 0, '2014-07-26 21:07:39', 0, 1), (134, 67, 136, 0, '2014-07-27 01:07:38', 0, 0), (135, 67, 137, 0, '2014-07-27 01:07:55', 0, 1), (136, 67, 138, 0, '2014-07-27 01:07:58', 0, 1), (137, 67, 139, 0, '2014-07-27 01:07:17', 0, 1), (138, 83, 140, 0, '2014-07-27 16:07:58', 0, 1), (139, 66, 141, 0, '2014-07-27 17:07:04', 1, 1), (140, 66, 142, 0, '2014-07-27 17:07:33', 1, 1), (142, 67, 144, 0, '2014-07-27 22:07:23', 0, 1), (143, 67, 145, 0, '2014-07-29 00:07:16', 1, 1), (144, 66, 146, 0, '2014-07-29 17:07:13', 0, 1), (147, 66, 149, 0, '2014-07-29 17:07:41', 0, 1), (148, 66, 150, 0, '2014-07-29 17:07:03', 0, 1), (149, 66, 151, 0, '2014-07-29 17:07:07', 0, 1), (150, 66, 152, 0, '2014-07-29 17:07:52', 0, 1), (151, 66, 153, 0, '2014-07-29 17:07:23', 0, 1), (152, 66, 154, 0, '2014-07-29 17:07:38', 0, 1), (153, 66, 155, 0, '2014-07-29 17:07:55', 0, 1), (154, 66, 156, 0, '2014-07-29 17:07:08', 1, 1), (155, 66, 157, 0, '2014-07-29 17:07:04', 0, 1), (156, 66, 158, 0, '2014-07-29 17:07:19', 1, 1), (158, 90, 160, 0, '2014-07-31 23:07:52', 0, 1), (159, 67, 161, 0, '2014-08-01 01:08:54', 0, 1), (160, 67, 162, 0, '2014-08-01 01:08:54', 0, 1), (161, 68, 163, 0, '2014-08-02 18:08:44', 0, 1), (162, 68, 164, 0, '2014-08-02 18:08:58', 0, 1), (163, 68, 165, 0, '2014-08-02 18:08:17', 0, 1), (164, 68, 166, 0, '2014-08-02 18:08:10', 0, 1), (165, 68, 167, 0, '2014-08-02 18:08:45', 0, 1), (166, 68, 168, 0, '2014-08-02 18:08:05', 0, 1), (167, 68, 169, 0, '2014-08-02 18:08:37', 0, 1), (168, 68, 170, 0, '2014-08-02 19:08:36', 0, 1), (169, 68, 171, 0, '2014-08-02 19:08:20', 0, 1), (170, 68, 172, 0, '2014-08-02 19:08:29', 0, 1), (171, 68, 173, 0, '2014-08-02 19:08:20', 0, 1), (172, 68, 174, 0, '2014-08-02 19:08:40', 0, 1), (173, 68, 175, 0, '2014-08-02 19:08:57', 0, 1), (174, 68, 176, 0, '2014-08-02 19:08:29', 0, 1), (175, 67, 177, 0, '2014-08-02 21:08:00', 0, 1), (176, 67, 178, 0, '2014-08-02 21:08:57', 0, 1), (177, 67, 179, 0, '2014-08-02 21:08:41', 0, 1), (178, 67, 180, 0, '2014-08-02 21:08:07', 0, 1), (179, 67, 181, 0, '2014-08-02 21:08:21', 0, 1), (180, 67, 182, 0, '2014-08-04 02:08:05', 0, 1), (181, 66, 183, 0, '2014-08-04 22:08:25', 0, 1), (182, 66, 184, 0, '2014-08-04 22:08:10', 0, 1), (183, 66, 185, 0, '2014-08-04 22:08:24', 0, 1), (184, 66, 186, 0, '2014-08-04 23:08:25', 0, 1), (185, 66, 187, 0, '2014-08-04 23:08:59', 0, 1), (186, 66, 188, 0, '2014-08-04 23:08:56', 0, 1), (187, 66, 189, 0, '2014-08-04 23:08:53', 0, 1), (188, 66, 190, 0, '2014-08-04 23:08:52', 0, 1), (189, 66, 191, 0, '2014-08-04 23:08:23', 0, 1), (190, 66, 192, 0, '2014-08-05 00:08:30', 0, 1), (191, 66, 193, 0, '2014-08-05 00:08:45', 0, 1), (192, 67, 194, 0, '2014-08-06 00:08:45', 1, 1), (194, 83, 196, 0, '2014-08-06 04:08:53', 0, 1), (195, 83, 197, 0, '2014-08-06 04:08:23', 0, 1), (196, 68, 202, 0, '2014-08-08 20:08:41', 0, 1), (198, 68, 204, 0, '2014-08-08 23:08:46', 0, 1), (199, 68, 205, 0, '2014-08-08 23:08:39', 0, 1), (200, 68, 206, 0, '2014-08-09 02:08:27', 0, 1), (201, 67, 207, 0, '2014-08-09 17:08:19', 1, 1), (202, 83, 208, 0, '2014-08-09 18:08:42', 0, 1), (203, 83, 209, 0, '2014-08-09 18:08:22', 0, 1), (204, 83, 210, 0, '2014-08-09 18:08:59', 0, 1); DROP TABLE IF EXISTS `privateMessages`; CREATE TABLE `privateMessages` ( `messageID` int(10) unsigned NOT NULL AUTO_INCREMENT, `userID` int(10) unsigned NOT NULL, `postID` int(10) unsigned NOT NULL, PRIMARY KEY (`messageID`), KEY `FK_convoMap_user_idx` (`userID`), KEY `convo_idx` (`messageID`), KEY `FK_privateMsg_post_idx` (`postID`), CONSTRAINT `FK_convoMap_user` FOREIGN KEY (`userID`) REFERENCES `user` (`userID`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `FK_privateMsg_post` FOREIGN KEY (`postID`) REFERENCES `post` (`postID`) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE=InnoDB DEFAULT CHARSET=latin1; INSERT INTO `privateMessages` (`messageID`, `userID`, `postID`) VALUES (2, 67, 7), (3, 11, 7), (4, 10, 7), (5, 10, 8), (6, 9, 8), (7, 7, 172), (8, 83, 172), (9, 7, 173), (10, 83, 173), (11, 68, 174), (12, 7, 174), (13, 83, 174), (14, 66, 189), (15, 7, 189), (16, 68, 196), (17, 66, 196), (18, 68, 198), (19, 10, 198); DROP TABLE IF EXISTS `relationship`; CREATE TABLE `relationship` ( `userID1` int(10) unsigned NOT NULL, `userID2` int(10) unsigned NOT NULL, `status` varchar(20) NOT NULL, KEY `FK_userID1_user_idx` (`userID1`), KEY `FK_userID2_user_idx` (`userID2`), CONSTRAINT `FK_userID1_user` FOREIGN KEY (`userID1`) REFERENCES `user` (`userID`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `FK_userID2_user` FOREIGN KEY (`userID2`) REFERENCES `user` (`userID`) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE=InnoDB DEFAULT CHARSET=latin1; INSERT INTO `relationship` (`userID1`, `userID2`, `status`) VALUES (7, 9, 'collegues'), (7, 11, 'collegues'), (7, 8, 'collegues'), (7, 10, 'collegues'), (67, 12, 'friends'), (67, 12, 'family'), (67, 12, 'collegues'), (66, 39, 'friends'), (66, 39, 'friends'), (66, 39, 'friends'), (66, 25, 'friends'), (66, 25, 'friends'), (66, 25, 'friends'), (67, 66, 'collegues'), (67, 69, 'family'), (67, 69, 'collegues'), (67, 66, 'collegues'), (83, 70, 'friends'), (67, 11, 'friends'), (67, 11, 'family'), (66, 9, 'friends'), (68, 7, 'friends'), (68, 10, 'friends'), (68, 83, 'friends'), (68, 66, 'collegues'), (11, 66, 'collegues'), (66, 11, 'friends'), (66, 7, 'friends'), (66, 7, 'friends'), (66, 7, 'friends'), (67, 11, 'collegues'), (7, 66, 'collegues'), (7, 66, 'collegues'), (66, 7, 'collegues'), (66, 83, 'collegues'), (7, 83, 'collegues'), (83, 67, 'family'); DROP TABLE IF EXISTS `tag`; CREATE TABLE `tag` ( `tagID` int(11) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(50) NOT NULL, PRIMARY KEY (`tagID`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; INSERT INTO `tag` (`tagID`, `name`) VALUES (1, 'Rock and Roll'), (2, 'Music'), (3, 'Hurricanes'), (4, 'Architecture'), (5, 'Montreal Canadians'), (6, 'Game Theory'), (7, 'Crystals'), (8, 'Aliens'), (9, 'Cars'), (10, 'Polygons'), (11, 'Chocolate'), (12, 'Pi'), (13, 'Genetics'), (14, 'Anthrax'), (15, 'Bridges'), (16, 'Cars'), (17, 'Angles'), (18, 'Brain'), (19, 'War'), (20, 'Nouns'), (21, 'Newspaper'), (22, 'Earth'), (23, 'Pi'), (24, 'Computers'), (25, 'Binary'), (26, 'Eclipse'), (27, 'Brain'), (28, 'Allergies'), (29, 'Basketball'), (30, 'Programming'), (31, 'Atoms'), (32, 'Ants'), (33, 'Eclipse'), (34, 'Polygons'), (35, 'Allergies'), (36, 'Allergies'), (37, 'Allergies'), (38, 'Teeth'), (39, 'Ethics'), (40, 'Genetics'), (41, 'Montreal Canadians'), (42, 'Algae'), (43, 'Pi'), (44, 'Angles'), (45, 'Earth'), (46, 'Computers'), (47, 'Newspaper'), (48, 'Pi'), (49, 'Angles'), (50, 'Soccer'), (51, 'Ants'), (52, 'Chocolate'), (53, 'Montreal Canadians'), (54, 'Dogs'), (55, 'Bridges'), (56, 'Montreal Canadians'), (57, 'Aliens'), (58, 'Polygons'), (59, 'Genetics'), (60, 'Research'), (61, 'Robots'), (62, 'Montreal Canadians'), (63, 'Ants'), (64, 'Hockey'), (65, 'Game Theory'), (66, 'Algae'), (67, 'Cells'), (68, 'Programming'), (69, 'Bridges'), (70, 'Binary'), (71, 'Music'), (72, 'Alcohol'), (73, 'Basketball'), (74, 'Problem Solving'), (75, 'Music'), (76, 'Newspaper'), (77, 'Soccer'), (78, 'Anthrax'), (79, 'Game Theory'), (80, 'Algae'), (81, 'Atoms'), (82, 'Hurricanes'), (83, 'Algae'), (84, 'Lasers'), (85, 'Polygons'), (86, 'Anthrax'), (87, 'Atoms'), (88, 'Architecture'), (89, 'Polygons'), (90, 'Programming'), (91, 'Graphics'), (92, 'Newspaper'), (93, 'Earth'), (94, 'Architecture'), (95, 'Eclipse'), (96, 'War'), (97, 'Ants'), (98, 'Pi'), (99, 'Bacteria'), (100, 'Ants'), (101, 'Baseball'), (102, 'Atoms'); DROP TABLE IF EXISTS `user`; CREATE TABLE `user` ( `userID` int(10) unsigned NOT NULL AUTO_INCREMENT, `role` enum('junior','senior','administrator') NOT NULL, `status` enum('active','inactive','suspended') NOT NULL, `displayName` varchar(15) NOT NULL, `firstName` varchar(45) NOT NULL, `lastName` varchar(45) NOT NULL, `tagline` varchar(140) NOT NULL, `email` varchar(50) NOT NULL, `password` varchar(64) NOT NULL, `address` text NOT NULL, `cityName` varchar(45) NOT NULL, `province` varchar(45) DEFAULT NULL, `country` varchar(50) NOT NULL, `availableHearts` int(10) unsigned NOT NULL, `totalHeartsEarned` int(10) unsigned NOT NULL, `dateCreated` datetime NOT NULL, `dateModified` datetime NOT NULL, `lastLogin` datetime NOT NULL, `dateOfBirth` date NOT NULL, `privacy` enum('public','private') NOT NULL, `lastStream` varchar(300) NOT NULL, PRIMARY KEY (`userID`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; INSERT INTO `user` (`userID`, `role`, `status`, `displayName`, `firstName`, `lastName`, `tagline`, `email`, `password`, `address`, `cityName`, `province`, `country`, `availableHearts`, `totalHeartsEarned`, `dateCreated`, `dateModified`, `lastLogin`, `dateOfBirth`, `privacy`, `lastStream`) VALUES (7, 'administrator', 'active', 'marcb', 'Marc', 'B', 'Some guy', 'belley.marc@gmail.com', '202cb962ac59075b964b07152d234b70', '4321 rue st-jacques apt 204', 'Montreal', NULL, '0', 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00', 'public', ''), (8, 'junior', 'active', '8', 'Bob', 'Joy', '', 'bob@jay.com', '827ccb0eea8a706c4c34a16891f84e7b', '', 'NYC', NULL, '0', 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00', 'public', ''), (9, 'junior', 'active', '9', 'Chuck', 'Norris', 'who needs one?', 'justplainawesome@internets.com', 'ep33n', '1337', 'Texas', 'texas', '0', 9001, 0, '2014-06-26 22:00:21', '2014-06-26 22:00:21', '2014-06-26 22:00:21', '2014-06-26', 'public', ''), (10, 'junior', 'active', '10', 'Prof', 'Bipin', 'real life', 'bipin@concordia.ca', 'quiizzzzes', 'lame', 'Montreal', 'Quebec', '0', 0, 0, '2014-06-26 22:02:02', '2014-06-26 22:02:02', '2014-06-26 22:02:02', '2014-06-26', 'public', ''), (11, 'junior', 'active', '11', 'Smartass', 'Student', 'school sux', 'student@concordia.ca', 'ifail', '111 de la blah', 'Montreal', 'Quebec', '0', 0, 0, '2014-06-26 22:02:51', '2014-06-26 22:02:51', '2014-06-26 22:02:51', '2014-06-26', 'public', ''), (12, 'senior', 'active', '12', 'Test', 'test', '', 'test@test.test', 'd79096188b670c2f81b7001f73801117', '', '', NULL, '0', 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00', 'public', ''), (13, 'junior', 'active', '13', '0', '', '', '0', '81dc9bdb52d04dc20036dbd8313ed055', '', '', NULL, '0', 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00', 'public', ''), (14, 'junior', 'active', '14', '0', '', '', '0', '81dc9bdb52d04dc20036dbd8313ed055', '', '', NULL, '0', 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00', 'public', ''), (15, 'junior', 'active', '15', '0', '', '', '0', '81dc9bdb52d04dc20036dbd8313ed055', '', '', NULL, '0', 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00', 'public', ''), (16, 'junior', 'active', '16', '0', '', '', '0', '81dc9bdb52d04dc20036dbd8313ed055', '', '', NULL, '0', 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00', 'public', ''), (17, 'junior', 'active', '17', '0', '', '', '0', '81dc9bdb52d04dc20036dbd8313ed055', '', '', NULL, '0', 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00', 'public', ''), (18, 'junior', 'active', '18', '0', '', '', '0', '6074c6aa3488f3c2dddff2a7ca821aab', '', '', NULL, '0', 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00', 'public', ''), (19, 'junior', 'active', '19', '0', '0', '', '0', '81dc9bdb52d04dc20036dbd8313ed055', '', '', NULL, '0', 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00', 'public', ''), (20, 'junior', 'active', '20', '0', '', '', '0', '81dc9bdb52d04dc20036dbd8313ed055', '', '', NULL, '0', 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00', 'public', ''), (21, 'junior', 'active', '21', '0', '', '', '0', '81dc9bdb52d04dc20036dbd8313ed055', '', '', NULL, '0', 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00', 'public', ''), (22, 'junior', 'active', '22', '0', '', '', '0', '81dc9bdb52d04dc20036dbd8313ed055', '', '', NULL, '0', 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00', 'public', ''), (23, 'junior', 'active', '23', '0', '', '', '0', 'd41d8cd98f00b204e9800998ecf8427e', '', '', NULL, '0', 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00', 'public', ''), (24, 'junior', 'active', '24', '0', '', '', '0', 'd41d8cd98f00b204e9800998ecf8427e', '', '', NULL, '0', 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00', 'public', ''), (25, 'junior', 'active', '25', '0', '', '', '0', 'asdf', '', '', NULL, '0', 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00', 'public', ''), (26, 'junior', 'active', '26', '0', '', '', '0', '912ec803b2ce49e4a541068d495ab570', '', '', NULL, '0', 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00', 'public', ''), (27, 'junior', 'active', '27', 'asdf', '', '', 'asdfff', '81dc9bdb52d04dc20036dbd8313ed055', '', '', NULL, '0', 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00', 'public', ''), (28, 'junior', 'active', '28', '', '', '', '', 'd41d8cd98f00b204e9800998ecf8427e', '', '', NULL, '0', 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00', 'public', ''), (29, 'junior', 'active', '29', 'asdf', '', '', 'asdasdasdasd', '81dc9bdb52d04dc20036dbd8313ed055', '', '', NULL, '0', 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00', 'public', ''), (30, 'junior', 'active', '30', '', '', '', '', 'd41d8cd98f00b204e9800998ecf8427e', '', '', NULL, '0', 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00', 'public', ''), (31, 'junior', 'active', '31', '', '', '', '', 'd41d8cd98f00b204e9800998ecf8427e', '', '', NULL, '0', 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00', 'public', ''), (32, 'junior', 'active', '32', '', '', '', '', 'd41d8cd98f00b204e9800998ecf8427e', '', '', NULL, '0', 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00', 'public', ''), (33, 'junior', 'active', '33', '', '', '', '', 'd41d8cd98f00b204e9800998ecf8427e', '', '', NULL, '0', 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00', 'public', ''), (34, 'junior', 'active', '34', '', '', '', '', 'd41d8cd98f00b204e9800998ecf8427e', '', '', NULL, '0', 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00', 'public', ''), (35, 'junior', 'active', '35', '', '', '', '', 'd41d8cd98f00b204e9800998ecf8427e', '', '', NULL, '0', 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00', 'public', ''), (36, 'junior', 'active', '36', '', '', '', '', 'd41d8cd98f00b204e9800998ecf8427e', '', '', NULL, '0', 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00', 'public', ''), (37, 'junior', 'active', '37', 'asdf', '', '', 'asdasdasdasd@gasd.com', '81dc9bdb52d04dc20036dbd8313ed055', '', '', NULL, '0', 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00', 'public', ''), (38, 'junior', 'active', '38', 'asdf', '', '', 'asdf@asdf.com', '81dc9bdb52d04dc20036dbd8313ed055', '', '', NULL, '0', 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00', 'public', ''), (39, 'junior', 'active', '39', 'Andrea', '', '', 'anD.t@hotmail.com', '1e626dd31cdb460d8b46f12cca396d26', '', '', NULL, '0', 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00', 'public', ''), (40, 'junior', 'active', '40', 'asdd', '', '', 'anD.t@hotmail.com', '81dc9bdb52d04dc20036dbd8313ed055', '', '', NULL, '0', 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00', 'public', ''), (41, 'junior', 'active', '41', 'asdd', '', '', 'anD.t@hotmail.com', '81dc9bdb52d04dc20036dbd8313ed055', '', '', NULL, '0', 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00', 'public', ''), (42, 'junior', 'active', '42', 'asdd', '', '', 'anD.t@hotmail.com', '81dc9bdb52d04dc20036dbd8313ed055', '', '', NULL, '0', 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00', 'public', ''), (43, 'junior', 'active', '43', 'asdd', '', '', 'anD.t@hotmail.com', '81dc9bdb52d04dc20036dbd8313ed055', '', '', NULL, '0', 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00', 'public', ''), (44, 'junior', 'active', '44', 'asdf', '', '', 'asdasdasdasd@gasd.com', '827ccb0eea8a706c4c34a16891f84e7b', '', '', NULL, '0', 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00', 'public', ''), (45, 'junior', 'active', '45', 'asdf', '', '', '1234@asd.com', '81dc9bdb52d04dc20036dbd8313ed055', '', '', NULL, '0', 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00', 'public', ''), (46, 'junior', 'active', '46', 'asdf', '', '', 'asdasdasdasd@gasd.com', '81dc9bdb52d04dc20036dbd8313ed055', '', '', NULL, '0', 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00', 'public', ''), (47, 'junior', 'active', '47', 'asdf', '', '', 'asdasdasdasd@gasd.com', '81dc9bdb52d04dc20036dbd8313ed055', '', '', NULL, '0', 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00', 'public', ''), (50, 'junior', 'active', '50', 'asdd', '', '', 'asdasdasdasd@gasd.com', '81dc9bdb52d04dc20036dbd8313ed055', '', '', NULL, '0', 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00', 'public', ''), (60, 'junior', 'active', 'asd', 'asd', 'asd', 'asdasdasda', 'asd@asd.com', '81dc9bdb52d04dc20036dbd8313ed055', 'asdasd', 'asdasd', 'asdasd', '0', 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00', 'public', ''), (61, 'junior', 'active', 'asd', 'asd', 'asd', 'zxc', 'asd@asd.com', '81dc9bdb52d04dc20036dbd8313ed055', 'asd', 'asd', 'asd', '0', 0, 0, '2014-07-06 06:01:02', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '2014-07-09', 'public', ''), (62, 'junior', 'active', 'asd', 'asd', 'asd', 'zxc', 'asd@asd.com', '81dc9bdb52d04dc20036dbd8313ed055', 'asd', 'asd', 'asd', '0', 0, 0, '2014-07-06 04:04:15', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '2014-07-09', 'public', ''), (63, 'junior', 'active', 'asd', 'asd', 'asd', 'zxc', 'asd@asd.com', '912ec803b2ce49e4a541068d495ab570', 'asd', 'asd', 'asd', '0', 0, 0, '2014-07-06 06:09:30', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '2014-07-09', 'public', ''), (64, 'junior', 'active', 'asd', 'asd', 'asd', 'zxc', 'asd@asd.com', '827ccb0eea8a706c4c34a16891f84e7b', 'asd', 'asd', 'asd', '0', 0, 0, '2014-07-06 06:11:47', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '2014-07-09', 'public', ''), (65, 'junior', 'active', 'asd', 'asd', 'asd', 'zxc', 'asd@asd.com', '81dc9bdb52d04dc20036dbd8313ed055', 'asd', 'asd', 'asd', '0', 0, 0, '2014-07-06 00:12:20', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '2014-07-09', 'public', ''), (66, 'senior', 'active', 'mikeb', 'Michael', 'Burkat', 'yo', 'mike.burkat@gmail.com', 'e10adc3949ba59abbe56e057f20f883e', '11207 79th ave NW', 'Edmonton', 'Alberta', '', 0, 0, '2014-07-06 14:38:52', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '1987-08-17', 'public', ''), (67, 'junior', 'active', 'test', 'M', 'B', 'yo', 'fearan@gmail.com', 'e10adc3949ba59abbe56e057f20f883e', '11', '11', 'qc', '', 0, 0, '2014-07-06 20:45:44', '2014-08-06 18:11:43', '0000-00-00 00:00:00', '2013-12-03', 'public', ''), (68, 'junior', 'active', 'geoff', 'G', 'S', 'yup', 'geoffrey.stanley@gmail.com', '202cb962ac59075b964b07152d234b70', '11', 'mtl', 'qc', '1', 1, 2, '2014-07-07 01:10:58', '2014-07-07 01:10:58', '2014-07-07 01:10:58', '2014-07-07', 'public', ''), (69, 'junior', 'active', 'dg', 'dg', 'dg', 'asdf', 'dg@dg.com', 'e10adc3949ba59abbe56e057f20f883e', 'asdf', 'asdasd', 'asdasd', '', 0, 0, '2014-07-07 11:07:49', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '2014-07-02', 'public', 'https://www.youtube.com/watch?v=-KKvIg9d0Kw'), (70, 'junior', 'active', 'geoff', 'geoff', 'St', 'something', 'e@mail.com', '073f99773db12841bb1dfed469f8d750', '123', 'Mtl', 'qc', '', 0, 0, '2014-07-12 18:59:44', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00', 'public', ''), (83, 'administrator', 'active', 'MyDisplayName', 'Dmitri', 'Grijalva', 'asdasdasd', 'dmitri.grijalva@gmail.com', '81dc9bdb52d04dc20036dbd8313ed055', '', 'Montreal', '', '', 0, 0, '2014-07-18 00:36:41', '2014-08-09 12:40:18', '0000-00-00 00:00:00', '2014-07-18', 'public', ''), (85, 'junior', 'active', 'f_negret', 'Fraklin', 'Negrete', 'im cool', 'fa.negrete@gmail.com', 'e10adc3949ba59abbe56e057f20f883e', '3838kdfk here', 'Montreal', 'Quebec', 'Canada', 0, 0, '2014-07-18 17:00:25', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00', 'private', ''), (88, 'junior', 'active', '123', '123', '123', '123', 'abc@abaca.com', 'e10adc3949ba59abbe56e057f20f883e', '123', '123', '123', '123', 0, 0, '2014-07-19 12:31:59', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0023-12-31', 'public', ''), (89, 'junior', 'active', 'huoisegad', '123', '123', '123', 'abc@caosnd.com', 'e10adc3949ba59abbe56e057f20f883e', 'asfdn', '123', '123', '123', 0, 0, '2014-07-19 12:32:58', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0123-12-03', 'public', ''), (90, 'junior', 'active', 'Thomas', 'Thomas', 'Tige', 'I am awesome', 'thomastige@gmail.com', 'e10adc3949ba59abbe56e057f20f883e', '123', 'Montreal', 'Quebec', 'Canada', 0, 0, '2014-07-19 15:26:42', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '1990-06-25', 'public', ''), (91, 'junior', 'active', 'test', 'test', 'test', 'tester', 't@e.st', '098f6bcd4621d373cade4e832627b4f6', '123', '123', '123', '123', 0, 0, '2014-07-27 11:10:29', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '1564-06-25', 'public', ''), (92, 'junior', 'active', 'test', 'test', 'test', 'haeto', 't@es.ticule', '098f6bcd4621d373cade4e832627b4f6', 'jip', 'hio', 'ioh', 'oih', 0, 0, '2014-07-27 11:11:32', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00', 'private', ''), (93, 'junior', 'active', 'jkbhb', 'bjk', 'bjkl', 'ihjo', 'randomemail@randomurl.org', 'e10adc3949ba59abbe56e057f20f883e', '1234', '1234', '1234', '1234', 0, 0, '2014-07-27 11:20:56', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00', 'public', ''), (94, 'junior', 'active', '', '', '', '', '', '', '', '', NULL, '', 0, 0, '2014-08-06 01:10:54', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00', 'public', ''), (95, 'junior', 'active', '', '', '', '', '', '', '', '', NULL, '', 0, 0, '0000-00-00 00:00:00', '2014-08-06 01:11:50', '0000-00-00 00:00:00', '0000-00-00', 'public', ''); DROP TABLE IF EXISTS `userWall`; CREATE TABLE `userWall` ( `userID` int(10) unsigned NOT NULL, `postID` int(10) unsigned NOT NULL, `privacy` tinyint(4) NOT NULL DEFAULT '0', KEY `FK_userID_user_idx` (`userID`), KEY `FK_postID_post_idx` (`postID`), CONSTRAINT `userWall_ibfk_2` FOREIGN KEY (`userID`) REFERENCES `user` (`userID`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `userWall_ibfk_1` FOREIGN KEY (`postID`) REFERENCES `post` (`postID`) ON DELETE CASCADE ON UPDATE NO ACTION ) ENGINE=InnoDB DEFAULT CHARSET=latin1; INSERT INTO `userWall` (`userID`, `postID`, `privacy`) VALUES (7, 2, 0), (7, 9, 0), (7, 10, 0), (7, 11, 0), (7, 12, 0), (7, 13, 0), (7, 14, 0), (7, 15, 0), (7, 17, 0), (10, 18, 0), (67, 24, 0), (10, 52, 0), (12, 53, 0), (12, 54, 0), (12, 55, 0), (67, 59, 0), (67, 64, 0), (67, 65, 0), (66, 70, 0), (66, 71, 0), (66, 72, 0), (69, 94, 0), (66, 95, 0), (66, 97, 0), (67, 100, 0), (83, 104, 0), (83, 105, 0), (83, 106, 0), (70, 108, 0), (83, 110, 0), (66, 126, 0), (66, 127, 0), (66, 128, 0), (11, 129, 0), (11, 130, 0), (67, 131, 0), (67, 132, 0), (67, 133, 0), (67, 134, 0), (67, 135, 0), (67, 136, 0), (67, 137, 0), (70, 138, 0), (66, 144, 0), (90, 158, 0), (67, 175, 0), (67, 176, 0), (67, 177, 0), (67, 178, 0), (67, 179, 0), (83, 194, 0), (83, 195, 0), (66, 179, 0), (67, 144, 0), (68, 17, 0), (68, 199, 0), (68, 200, 0), (83, 202, 0), (83, 203, 0); -- 2014-08-09 16:51:33
true
0ebb807485a922fbf60e3576cdb59a57533d4883
SQL
chgl16/shopping-platform
/src/main/resources/sql/db_shopping_platform.sql
UTF-8
5,849
3.734375
4
[]
no_license
DROP DATABASE IF EXISTS `db_shopping_platform`; CREATE DATABASE `db_shopping_platform` DEFAULT CHARACTER SET utf8; USE `db_shopping_platform`; /* 1.创建用户信息表 */ CREATE TABLE `tb_user` ( `pk_id` INT UNSIGNED AUTO_INCREMENT COMMENT '用户id', `uk_phone` VARCHAR(12) UNIQUE COMMENT '手机号', `shadow` VARCHAR(40) COMMENT '密码md5', `role_type` TINYINT DEFAULT 1 COMMENT '角色类型', PRIMARY KEY(`pk_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; /* 2.创建个人信息表 */ CREATE TABLE `tb_userinfo` ( `pk_id` INT UNSIGNED AUTO_INCREMENT COMMENT '用户id', `username` VARCHAR(20) COMMENT '昵称', `contact_phone` VARCHAR(11) COMMENT '收货地址', `contact_address` VARCHAR(100) COMMENT '收货地址', `img_url` VARCHAR(100) DEFAULT '../../picture/user/default.jpg' COMMENT '头像地址', PRIMARY KEY(`pk_id`), FOREIGN KEY(`pk_id`) REFERENCES `tb_user`(`pk_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; /* 3.创建货物-书信息表 */ CREATE TABLE `tb_book` ( `pk_id` INT UNSIGNED AUTO_INCREMENT COMMENT '书id', `isbn` VARCHAR(30) COMMENT 'ISBN', `title` VARCHAR(20) NOT NULL COMMENT '书名', `price` DECIMAL(6, 2) NOT NULL COMMENT '价格', `publication_house` VARCHAR(30) COMMENT '出版社', `publication_date` DATETIME COMMENT '出版时间', `introduction` VARCHAR(100) COMMENT '简要介绍', `type` VARCHAR(20) COMMENT '书本类型', `recommend` TINYINT UNSIGNED DEFAULT 0 COMMENT '推荐首页与否', `show` TINYINT UNSIGNED DEFAULT 0 COMMENT '是否轮播显示', `inventory` INT UNSIGNED COMMENT '库存量', `sale_volume` INT UNSIGNED DEFAULT 0 COMMENT '销量', `img_url1` VARCHAR(100) DEFAULT '../../picture/book/default.jpg' COMMENT '图片1', `img_url2` VARCHAR(100) DEFAULT '../../picture/book/default.jpg' COMMENT '图片2', `img_url3` VARCHAR(100) DEFAULT '../../picture/book/default.jpg' COMMENT '图片3', `img_url4` VARCHAR(100) DEFAULT '../../picture/book/default.jpg' COMMENT '图片4', `img_url5` VARCHAR(100) DEFAULT '../../picture/book/default.jpg' COMMENT '图片5', PRIMARY KEY(`pk_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; /* 4.创建店铺信息表 */ CREATE TABLE `tb_store` ( `pk_id` INT UNSIGNED AUTO_INCREMENT COMMENT '店铺id', `uk_name` VARCHAR(20) UNIQUE COMMENT '店铺名字', `founding_time` DATETIME COMMENT '创办时间', `introduction` VARCHAR(100) COMMENT '店铺介绍', `address` VARCHAR(100) COMMENT '店铺地址', `img_url` VARCHAR(100) DEFAULT '../../picture/store/default.jpg' COMMENT '店铺头像', PRIMARY KEY(`pk_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; /* 5.创建订单信息表 */ CREATE TABLE `tb_transaction` ( `pk_id` INT UNSIGNED AUTO_INCREMENT COMMENT '记录序号', `order_id` VARCHAR(30) UNIQUE COMMENT '订单号', `book_id` INT UNSIGNED COMMENT '书id', `book_name` VARCHAR(20) COMMENT '书名', `store_id` INT UNSIGNED COMMENT '店铺id', `store_name` VARCHAR(20) COMMENT '店铺名字', `customer_id` INT UNSIGNED COMMENT '顾客id', `customer_name` VARCHAR(20) COMMENT '顾客昵称', `customer_phone` VARCHAR(11) NOT NULL COMMENT '顾客收货手机号', `customer_address` VARCHAR(100) NOT NULL COMMENT '顾客收货地址', `price` DECIMAL(6, 2) COMMENT '商品金额', `status` TINYINT DEFAULT -1 COMMENT '订单状态:-1-未理,0-失败,1-发货,2-成功', `logistics` VARCHAR(40) COMMENT '物流号', `time` DATETIME COMMENT '订单时间', `remark` VARCHAR(100) COMMENT '备注信息', `book_img_url` VARCHAR(100) COMMENT '书的图片', PRIMARY KEY(`pk_id`), FOREIGN KEY(`book_id`) REFERENCES `tb_book`(`pk_id`), FOREIGN KEY(`store_id`) REFERENCES `tb_store`(`pk_id`), FOREIGN KEY(`customer_id`) REFERENCES `tb_user`(`pk_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; /* 6.创建店铺店主关系表 */ CREATE TABLE `tb_store_owner` ( `store_id` INT UNSIGNED COMMENT '店铺id', `owner_id` INT UNSIGNED COMMENT '店主id', FOREIGN KEY(`store_id`) REFERENCES `tb_store`(`pk_id`), FOREIGN KEY(`owner_id`) REFERENCES `tb_user`(`pk_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; /* 7.创建店铺货物关系表 */ CREATE TABLE `tb_store_book` ( `store_id` INT UNSIGNED COMMENT '店铺id', `book_id` INT UNSIGNED COMMENT '书id', FOREIGN KEY(`store_id`) REFERENCES `tb_store`(`pk_id`), FOREIGN KEY(`book_id`) REFERENCES `tb_book`(`pk_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; /* 8.创建店铺订单关系表 */ CREATE TABLE `tb_store_transaction` ( `store_id` INT UNSIGNED COMMENT '店铺id', `transaction_id` INT UNSIGNED COMMENT '订单id', FOREIGN KEY(`store_id`) REFERENCES `tb_store`(`pk_id`), FOREIGN KEY(`transaction_id`) REFERENCES `tb_transaction`(`pk_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; /* 9.创建顾客订单关系表 */ CREATE TABLE `tb_customer_transaction` ( `customer_id` INT UNSIGNED COMMENT '顾客id', `transaction_id` INT UNSIGNED COMMENT '订单id', FOREIGN KEY(`customer_id`) REFERENCES `tb_user`(`pk_id`), FOREIGN KEY(`transaction_id`) REFERENCES `tb_transaction`(`pk_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; /* 10.申请店铺信息表 */ CREATE TABLE `tb_apply_store` ( `pk_id` INT UNSIGNED AUTO_INCREMENT COMMENT '申请id', `owner_id` INT UNSIGNED COMMENT '店主id', `store_name` VARCHAR(20) NOT NULL COMMENT '店铺名字', `store_introduction` VARCHAR(100) COMMENT '店铺介绍', `apply_time` DATETIME COMMENT '申请时间', `status` TINYINT DEFAULT -1 COMMENT '申请状态:-1-未理,0-拒绝,1-通过', PRIMARY KEY(`pk_id`), FOREIGN KEY(`owner_id`) REFERENCES `tb_user`(`pk_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; /* 创建视图 */ CREATE VIEW v_user AS SELECT tb_user.pk_id AS id, tb_user.uk_phone AS phone, tb_user.role_type, tb_userinfo.username, tb_userinfo.img_url, tb_userinfo.contact_phone, tb_userinfo.contact_address FROM tb_user, tb_userinfo WHERE tb_user.pk_id = tb_userinfo.pk_id;
true
12665a0031fdb9d6f156c3b8caa3c4d7a911eab3
SQL
FanVane/DB4AI_POSTGRESQL_MADLIB_PLPY_C
/opengaussOPs.sql
GB18030
7,345
2.8125
3
[]
no_license
------------------------------------------------------------ ------------------------------------------------------------ -- db4ai_abs(input_table_name TEXT, output_table_name TEXT) -- input_table_name ľ -- output_table_name ľ -- ִ״̬ -- Ч ľÿԪضֵγ ------------------------------------------------------------ --[ͻ˽ӿ]-- CREATE OR REPLACE FUNCTION db4ai_abs(input_table_name TEXT, output_table_name TEXT) RETURNS INT AS 'db4ai_funcs','_Z15outer_db4ai_absP20FunctionCallInfoData' -- ǰֶΪ· ֶij.soеķ LANGUAGE C STRICT; --[ִк]-- CREATE OR REPLACE FUNCTION inner_db4ai_abs(float8[]) RETURNS float8[] AS 'db4ai_funcs','_Z15inner_db4ai_absP20FunctionCallInfoData' LANGUAGE C STRICT; ------------------------------------------------------------ ------------------------------------------------------------ -- db4ai_add(input_table1_name TEXT, input_table2_name TEXT, output_table_name TEXT) -- input_table1_name ľ1 -- input_table2_name ľ2 -- output_table_name ľ -- ִ״̬ -- Ч ľÿԪضͣγ ------------------------------------------------------------ --[ͻ˽ӿ]-- CREATE OR REPLACE FUNCTION db4ai_add(input_table1_name TEXT, input_table2_name TEXT, output_table_name TEXT) --ʱüʲôţַ RETURNS INTEGER AS 'db4ai_funcs','_Z15outer_db4ai_addP20FunctionCallInfoData' LANGUAGE C STRICT; --[ִк]-- CREATE OR REPLACE FUNCTION inner_db4ai_add(float8[], float8[]) RETURNS float8[] AS 'db4ai_funcs','_Z15inner_db4ai_addP20FunctionCallInfoData' LANGUAGE C STRICT; ------------------------------------------------------------ ------------------------------------------------------------ -- db4ai_div(input_table1_name TEXT, input_table2_name TEXT, output_table_name TEXT) -- input_table1_name ľ1 -- input_table2_name ľ2 -- output_table_name ľ -- ִ״̬ -- Ч ľÿԪضγ ------------------------------------------------------------ --[ͻ˽ӿ]-- CREATE OR REPLACE FUNCTION db4ai_div(input_table1_name TEXT, input_table2_name TEXT, output_table_name TEXT) --ʱüʲôţַ RETURNS INTEGER AS 'db4ai_funcs','_Z15outer_db4ai_divP20FunctionCallInfoData' LANGUAGE C STRICT; --[ִк]-- CREATE OR REPLACE FUNCTION inner_db4ai_div(float8[], float8[]) RETURNS float8[] AS 'db4ai_funcs','_Z15inner_db4ai_divP20FunctionCallInfoData' LANGUAGE C STRICT; ------------------------------------------------------------ ------------------------------------------------------------ -- db4ai_exp(input_table_name TEXT, output_table_name TEXT) -- input_table_name ľ -- output_table_name ľ -- ִ״̬ -- Ч ľÿԪضeΪ׵ָγ ------------------------------------------------------------ --[ͻ˽ӿ]-- CREATE OR REPLACE FUNCTION db4ai_exp(input_table_name TEXT, output_table_name TEXT) RETURNS INT AS 'db4ai_funcs','_Z15outer_db4ai_expP20FunctionCallInfoData' -- ǰֶΪ· ֶij.soеķ LANGUAGE C STRICT; --[ִк]-- CREATE OR REPLACE FUNCTION inner_db4ai_exp(float8[]) RETURNS float8[] AS 'db4ai_funcs','_Z15inner_db4ai_expP20FunctionCallInfoData' LANGUAGE C STRICT; ------------------------------------------------------------ ------------------------------------------------------------ -- db4ai_mul(input_table1_name TEXT, input_table2_name TEXT, output_table_name TEXT) -- input_table1_name ľ1 -- input_table2_name ľ2 -- output_table_name ľ -- ִ״̬ -- Ч ľÿԪض˻γ ------------------------------------------------------------ --[ͻ˽ӿ]-- CREATE OR REPLACE FUNCTION db4ai_mul(input_table1_name TEXT, input_table2_name TEXT, output_table_name TEXT) --ʱüʲôţַ RETURNS INTEGER AS 'db4ai_funcs','_Z15outer_db4ai_mulP20FunctionCallInfoData' LANGUAGE C STRICT; --[ִк]-- CREATE OR REPLACE FUNCTION inner_db4ai_mul(float8[], float8[]) RETURNS float8[] AS 'db4ai_funcs','_Z15inner_db4ai_mulP20FunctionCallInfoData' LANGUAGE C STRICT; -- CREATE TABLE a(rows INT ,cols INT, trans INT, data float8[]); -- INSERT INTO a values(2, 2, 0, '{1.0,2.0,3.0,-4.0}'); ------------------------------------------------------------ ------------------------------------------------------------ -- db4ai_ones(rows INT, cols INT, output_table_name TEXT) -- rows cols -- output_table_name ľ -- ִ״̬ -- Ч ղĹһȫ0ľ ------------------------------------------------------------ --[ͻ˽ӿ]-- CREATE OR REPLACE FUNCTION db4ai_ones(rows INT, cols INT, output_table_name TEXT) RETURNS INT AS 'db4ai_funcs','_Z16outer_db4ai_onesP20FunctionCallInfoData' -- ǰֶΪ· ֶij.soеķ LANGUAGE C STRICT; --[ִк]-- CREATE OR REPLACE FUNCTION inner_db4ai_ones(INT) RETURNS float8[] AS 'db4ai_funcs','_Z16inner_db4ai_onesP20FunctionCallInfoData' LANGUAGE C STRICT; ------------------------------------------------------------ ------------------------------------------------------------ -- db4ai_reshape(input_table_name TEXT,dim1 INT, dim2 INT,output_table_name TEXT) -- input_table_name ľ -- dim1 µ -- dim2 µ Ҫdim1*dim2 = old_dim1 * old_dim2 -- output_table_name -- ִ״̬ -- Ч ľ飬γ״̬ -- select db4ai_reshape('ones', 2, 6, 'reshape'); ------------------------------------------------------------ --[ͻ˽ӿ]-- --[ִк]-- CREATE OR REPLACE FUNCTION db4ai_reshape(input_table_name TEXT,dim1 INT, dim2 INT,output_table_name TEXT) RETURNS INT AS 'db4ai_funcs','_Z19outer_db4ai_reshapeP20FunctionCallInfoData' LANGUAGE C STRICT; ------------------------------------------------------------ ------------------------------------------------------------ -- db4ai_zeros(rows INT, cols INT, output_table_name TEXT) -- rows cols -- output_table_name ľ -- ִ״̬ -- Ч ղĹһȫ0ľ ------------------------------------------------------------ --[ͻ˽ӿ]-- CREATE OR REPLACE FUNCTION db4ai_zeros(rows INT, cols INT, output_table_name TEXT) RETURNS INT AS 'db4ai_funcs','_Z17outer_db4ai_zerosP20FunctionCallInfoData' -- ǰֶΪ· ֶij.soеķ LANGUAGE C STRICT; --[ִк]-- CREATE OR REPLACE FUNCTION inner_db4ai_zeros(INT) RETURNS float8[] AS 'db4ai_funcs','_Z17inner_db4ai_zerosP20FunctionCallInfoData' LANGUAGE C STRICT;
true
26c8aa617a05141da23251efa455444b35dd5382
SQL
Ghagini/comp9311
/comp9311/proj1/proj1.sql
UTF-8
1,391
2.859375
3
[]
no_license
-- comp9311 19T3 Project 1 -- -- MyMyUNSW Solutions -- Q1: create or replace view Q1(unswid, longname) as --... SQL statements, possibly using other views/functions defined by you ... ; -- Q2: create or replace view Q2(unswid,name) as --... SQL statements, possibly using other views/functions defined by you ... ; -- Q3: create or replace view Q3(unswid, name) as --... SQL statements, possibly using other views/functions defined by you ... ; -- Q4: create or replace view Q4(num_student) as --... SQL statements, possibly using other views/functions defined by you ... ; --Q5: create or replace view Q5(code, name, semester) as --... SQL statements, possibly using other views/functions defined by you ... ; -- Q6: create or replace view Q6(num) as --... SQL statements, possibly using other views/functions defined by you ... ; -- Q7: create or replace view Q7(year, term, average_mark) as --... SQL statements, possibly using other views/functions defined by you ... ; -- Q8: create or replace view Q8(zid, name) as --... SQL statements, possibly using other views/functions defined by you ... ; -- Q9: create or replace view Q9(unswid, name) as --... SQL statements, possibly using other views/functions defined by you ... ; -- Q10: create or replace view Q10(unswid, longname, num, rank) as --... SQL statements, possibly using other views/functions defined by you ... ;
true
d023f2993ab2179ff35ec83ca34fc5dd23c9704b
SQL
lalonica/PublicTransportation
/GTFSTransitModel_model2.cql
UTF-8
5,939
3.953125
4
[]
no_license
//************TimeTree************ //******************************** //CREATE HOURS WITH range(0,23) as HOURS FOREACH (hour in HOURS | CREATE (:Hour {id:hour})); //CREATE minutes MATCH (h:Hour) WITH range(0,59) as MINUTES, h FOREACH (mm in MINUTES | CREATE (:Minute {id:mm})<-[:HAS]-(h)); //CREATE SECONDS MATCH (h:Hour)-[:HAS]->(mm: Minute) WITH h, mm, range(0,59) as SECONDS FOREACH (ss in SECONDS | CREATE (:Second {id:ss})<-[:DIVIDED]-(mm)); CREATE INDEX ON :Hour(id); CREATE INDEX ON :Minute(id); CREATE INDEX ON :Second(id); //Connect hours Sequentially MATCH (h:Hour) WITH h ORDER BY h.id WITH collect(h) AS hours FOREACH(i in RANGE(0, size(hours)-2) | FOREACH(h1 in [hours[i]] | FOREACH(h2 in [hours[i+1]] | CREATE UNIQUE (h1)-[:NEXT]->(h2)))); //Connect minutes Sequentially. MATCH (h:Hour)-[:HAS]->(mm:Minute) WITH h, mm ORDER BY h.id, mm.id WITH collect(mm) AS minutes FOREACH(i in RANGE(0, size(minutes)-2) | FOREACH(mm1 in [minutes[i]] | FOREACH(mm2 in [minutes[i+1]] | CREATE UNIQUE (mm1)-[:NEXT]->(mm2)))); //Connect seconds Sequentially. MATCH (h:Hour)-[:HAS]->(mm:Minute)-[:DIVIDED]->(ss:Second) WITH h, mm,ss ORDER BY h.id, mm.id, ss.id WITH collect(ss) AS seconds FOREACH(i in RANGE(0, size(seconds)-2) | FOREACH(ss1 in [seconds[i]] | FOREACH(ss2 in [seconds[i+1]] | CREATE UNIQUE (ss1)-[:NEXT]->(ss2)))); //**************************************************************** //Add the nodes //**************************************************************** //LOAD CSV script for GFTS data //Create the constrains create constraint on (a:Agency) assert a.agencyID is unique; create constraint on (r:Route) assert r.routeID is unique; create constraint on (t:Trip) assert t.tripID is unique; create constraint on (c:Calendar) assert c.cal_serviceID is unique; create constraint on (s:BusStop) assert s.BusStopID is unique; schema await //add the agency load csv with headers from 'file:///d:\\TorontoGTFS/agency.txt' as csv create (a:Agency {agencyID: toInt(csv.agency_id), agName: csv.agency_name, agUrl: csv.agency_url, AgTimezone: csv.agency_timezone}); // add the routes load csv with headers from 'file:///d:\\TorontoGTFS/routes.txt' as csv match (a:Agency {agencyID: toInt(csv.agency_id)}) create (a)-[:RUNS]->(r:Route {routeID: csv.route_id, rShortName: csv.route_short_name, rLongName: csv.route_long_name, rType: toInt(csv.route_type)}); // add the trips load csv with headers from 'file:///d:\\TorontoGTFS/trips.txt' as csv match (r:Route {routeID: csv.route_id}) create (r)<-[:IS_PART_OF]-(t:Trip {tripID: csv.trip_id, serviceID: csv.service_id}); //add calendar //'file:///d:\\TorontoGTFS/calendar.txt' as csv //match (t:Trip {serviceID: csv.service_id}) //create (t)-[:SCHEDULED_AT]-> (c:Calendar {cal_serviceID:csv.service_id, mon:csv.monday, tue:csv.tuesday, wed:csv.wednesday, thu:csv.thursday, fri:csv.friday, sat:csv.saturday, sun:csv.sunday, startDate: csv.start_date, endDate: csv.end_date}); //add the stops load csv with headers from 'file:///d:\\TorontoGTFS/stops.txt' as csv create (bs:BusStop {BusStopID: csv.stop_id, sName: csv.stop_name, sLat: toFloat(csv.stop_lat), sLon: toFloat(csv.stop_lon), sParentStation: csv.parent_station, locType: csv.location_type}); //Neo4jShell -file D:\yyyProjects\PublicTransit\Neo4j\queries\GTFSTransitModel_model2.cql ////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// /////////////////////////////////IMPORTANT//////////////////////////////////// //////////////////Run this in a command console of windows//////////////////// ////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// // FOR %i IN (D:/*.txt) DO Neo4jShell.bat -c "LOAD CSV WITH HEADERS FROM 'file:///%i' as input MATCH (h:Hour {id: toInt(substring(input.arrival_time,0,2))})-[r4]->(mm:Minute {id:toInt(substring(input.arrival_time,3,2))})-[r5]->(ss:Second {id:toInt(substring(input.arrival_time,6))}) WITH h,mm,ss, input MATCH (bs:BusStop {BusStopID:input.stop_id}) WITH h,mm,ss,input,bs CREATE (bs)<-[:STOPS_AT]-(be:BusEvent {trip: input.trip_id, departureTime: input.departure_time, stopSequence: toInt(input.stop_sequence)})-[:ARRIVESS_AT]->(ss) WITH be, input MATCH (t:Trip {tripID: input.trip_id}) WITH be, t CREATE (be)<-[:COMPOSED_OF]-(t);" // The same that is above but split to be able to read it clearly //LOAD CSV WITH HEADERS FROM 'file:///%i' as input //MATCH (h:Hour {id: toInt(substring(input.arrival_time,0,2))})-[r4]->(mm:Minute {id:toInt(substring(input.arrival_time,3,2))})-[r5]->(ss:Second {id:toInt(substring(input.arrival_time,6))}) WITH h,mm,ss, input //MATCH (bs:BusStop {BusStopID:input.stop_id}) WITH h,mm,ss, input, bs //MATCH (t:Trip {tripID: input.trip_id}) WITH h,mm,ss, input, bs, t //CREATE (bs)<-[:STOPS_AT]-(be:BusEvent {trip: input.trip_id, departureTime: input.departure_time, stopSequence: toInt(input.stop_sequence)})-[:ARRIVESS_AT]->(ss) //WITH be, input //MATCH (t:Trip {tripID: input.trip_id}) //WITH be, t //CREATE (be)<-[:COMPOSED_OF]-(t);" // USING PERIODIC COMMIT 1000 load csv with headers from 'file:///d:\\TorontoGTFS/arrival_times.txt' as csv match (t:Trip {tripID: csv.trip_id}), (bs:BusStop {BusStopID: csv.stop_id}) create (t)-[:COMPOSED_OF]->(be:BusEvent {arrivalTime: csv.arrival_time, departureTime: csv.departure_time, stopSequence: toInt(csv.stop_sequence)})-[:STOPS_AT]->(bs); CREATE INDEX ON :BusEvent(stopSequence); match (be1:BusEvent)<-[:COMPOSED_OF]-(t:Trip), (be2:BusEvent)<-[:COMPOSED_OF]-(t) where be2.stopSequence > be1.stopSequence create (s1)-[:NEXT_BUS_EVENT]->(s2);
true
d66c08b7d1a21a8a13e32e12ba7840cb9a44c6dd
SQL
andrewpblee/snowplow-dvd-rentals
/question-queries/question_one.sql
UTF-8
611
4.46875
4
[]
no_license
with rentals_by_category as ( select fc.film_id, fc.category_id, count(rental_id) as rentals from rental as r inner join inventory i on r.inventory_id = i.inventory_id inner join film_category as fc on i.film_id = fc.film_id where rental_date between '2005-01-01' and '2006-06-30' group by 1, 2 ), categories_ranked as ( select category_id, film_id, rentals, row_number() over (partition by category_id order by rentals desc) as ranked from rentals_by_category ) select category_id, film_id, rentals, ranked from categories_ranked where ranked <= 10
true