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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
2e85e6544fff21c57c6ba84f293f34a3d1514de8 | SQL | agbrothers/Solve-Database-Build | /schema.sql | UTF-8 | 9,297 | 3.75 | 4 | [] | no_license | -- Define all tables and relations in the Solve Database (MySQL)
create database solve;
-- ROOT TABLE
create table users(
user_id char(36) not null,
user_creation_time datetime not null,
language varchar(30),
retention_id int,
ab_test_id int,
location_id int,
gender_id int,
device_id int,
primary key (user_id)
);
-- LOOKUP TABLES
create table locations(
id int auto_increment not null,
city varchar(50) not null,
country varchar(50) not null,
primary key (id)
);
create table genders(
id int auto_increment not null,
gender varchar(10) not null,
primary key (id)
);
create table retention(
id int auto_increment not null,
dn varchar(6) not null,
primary key (id)
);
create table ab_tests(
id int auto_increment not null,
test varchar(40) not null,
test_group varchar(40) not null,
primary key (id)
);
create table devices(
id int auto_increment not null,
device_model varchar(30),
device_manufacturer varchar(30),
device_family varchar(30),
device_carrier varchar(30),
device_type varchar(30),
platform varchar(30),
os_name varchar(10),
os_version varchar(30),
primary key (id)
);
create table event_types(
id int auto_increment not null,
type varchar(20),
primary key (id)
);
create table characters(
id int auto_increment not null,
name varchar(20),
primary key (id)
);
-- EVENT PROPERTY TABLES
create table events(
id int auto_increment not null,
user_id char(36) not null,
time datetime not null,
primary key (id),
foreign key (user_id) references users(user_id) on delete cascade
);
create table user_properties(
id int auto_increment not null,
user_id char(36) not null,
event_id int not null,
current_ab_test_group VARCHAR(40),
total_session_count INT,
current_story_manifest_id CHAR(12),
current_lives_inventory INT,
total_story_nodes_completed INT,
total_lives_spent INT,
first_session_start_time CHAR(33),
current_story_episode_number INT,
current_coin_inventory INT,
chill_id CHAR(32),
total_stars_spent INT,
current_ab_test VARCHAR(40),
total_coins_spent INT,
total_m3_level_losses INT,
total_m3_level_attempts INT,
current_story_episode_analytics_id VARCHAR(50),
current_m3_level_number INT,
previous_session_start_time CHAR(33),
is_first_session INT,
current_story_node_analytics_id VARCHAR(50),
current_m3_level_id CHAR(12),
current_star_inventory INT,
current_story_node_id CHAR(12),
total_revives_completed INT,
current_story_segment_analytics_id VARCHAR(50),
total_days_played INT,
current_session_start_time CHAR(33),
install_date CHAR(33),
current_gem_inventory INT,
total_story_segments_completed INT,
current_story_episode_id CHAR(10),
total_story_episodes_completed INT,
current_m3_puzzle_id CHAR(12),
total_m3_level_wins INT,
install_app_version VARCHAR(30),
current_story_analytics_id VARCHAR(100),
m3_manifest_id CHAR(12),
current_dn INT,
current_characters_count INT,
primary key (id),
foreign key (user_id) references users(user_id) on delete cascade,
foreign key (event_id) references events(id) on delete cascade
);
create table appsflyer_properties(
id int auto_increment not null,
user_id char(36) not null,
event_id int not null,
appsflyer_install_time CHAR(23),
appsflyer_platform VARCHAR(15),
appsflyer_bundle_id CHAR(22),
appsflyer_af_ad VARCHAR(100),
appsflyer_af_ad_type VARCHAR(50),
appsflyer_idfv CHAR(36),
appsflyer_region CHAR(2),
appsflyer_install_time_selected_timezone CHAR(28),
appsflyer_postal_code VARCHAR(30),
appsflyer_appsflyer_id CHAR(21),
appsflyer_af_c_id CHAR(17),
appsflyer_device_download_time_selected_timezone CHAR(28),
appsflyer_dma VARCHAR(30),
appsflyer_event_time_selected_timezone CHAR(28),
appsflyer_attributed_touch_type CHAR(5),
appsflyer_api_version CHAR(3),
appsflyer_selected_timezone CHAR(19),
appsflyer_campaign VARCHAR(100),
appsflyer_attributed_touch_time_selected_timezone CHAR(28),
appsflyer_idfa CHAR(36),
appsflyer_media_source VARCHAR(30),
appsflyer_af_adset_id CHAR(17),
appsflyer_country_code CHAR(2),
appsflyer_af_channel VARCHAR(40),
appsflyer_device_category CHAR(5),
appsflyer_network_account_id CHAR(15),
appsflyer_event_name CHAR(7),
appsflyer_age_range CHAR(3),
appsflyer_af_attribution_lookback CHAR(3),
appsflyer_marketing_goal CHAR(12),
appsflyer_event_source CHAR(3),
appsflyer_campaign_start_date VARCHAR(30),
appsflyer_campaign_title VARCHAR(40),
appsflyer_gender VARCHAR(25),
appsflyer_customer_user_id CHAR(36),
appsflyer_event_time CHAR(23),
appsflyer_attributed_touch_time CHAR(23),
appsflyer_language CHAR(5),
appsflyer_os_version VARCHAR(30),
appsflyer_user_agent VARCHAR(100),
appsflyer_sdk_version CHAR(7),
appsflyer_app_name CHAR(12),
appsflyer_app_id CHAR(12),
appsflyer_marketing_objective CHAR(13),
appsflyer_state VARCHAR(20),
appsflyer_match_type CHAR(3),
appsflyer_targeting_1 VARCHAR(30),
appsflyer_wifi INT,
appsflyer_city VARCHAR(50),
appsflyer_af_adset VARCHAR(50),
appsflyer_device_type VARCHAR(40),
appsflyer_af_ad_id CHAR(30),
appsflyer_is_retargeting INT,
appsflyer_ip VARCHAR(25),
appsflyer_selected_currency CHAR(3),
appsflyer_device_download_time CHAR(23),
appsflyer_app_version VARCHAR(25),
primary key (id),
foreign key (user_id) references users(user_id) on delete cascade,
foreign key (event_id) references events(id) on delete cascade
);
create table event_properties(
id int auto_increment not null,
user_id char(36) not null,
event_id int not null,
attempt_count INT,
points_overall_target INT,
coming_from_id CHAR(12),
total_session_count INT,
coming_from VARCHAR(30),
shuffle_count INT,
m3_level_number INT,
current_dn INT,
characters_used_count INT,
character_1_used_id CHAR(10),
goals_count_remaining INT,
loss_count INT,
stars_won INT,
is_first_session INT,
m3_level_id CHAR(12),
is_near_win INT,
character_1_used_freq INT,
character_2_used_freq INT,
has_tutorial INT,
m3_manifest_id CHAR(12),
points_has_goals INT,
total_days_played INT,
m3_puzzle_id CHAR(12),
m3_puzzle_version INT,
moves_left INT,
character_2_used VARCHAR(50),
lives_used_count INT,
m3_level_result VARCHAR(20),
more_moves_count INT,
character_1_used VARCHAR(50),
character_2_used_id CHAR(10),
character_rarity VARCHAR(30),
character_id VARCHAR(30),
revive_coin_cost INT,
revive_advert_placement CHAR(20),
revive_method VARCHAR(30),
advert_trigger CHAR(16),
advert_type CHAR(8),
advert_placement CHAR(20),
goals_progress_threshold INT,
goals_progress INT,
story_node_id CHAR(12),
story_node_analytics_id VARCHAR(50),
node_pause_count INT,
story_segment_analytics_id VARCHAR(50),
story_episode_number INT,
story_episode_id CHAR(10),
node_unpause_count INT,
story_manifest_id CHAR(12),
story_segment_id CHAR(12),
story_analytics_id VARCHAR(100),
node_type VARCHAR(40),
node_skip_forwards_count INT,
node_skip_backwards_count INT,
coins_collected INT,
choice CHAR(5),
current_star_inventory INT,
stars_required INT,
start_state VARCHAR(30),
action_taken_number INT,
stars_consumed INT,
total_options INT,
enough_stars INT,
action_taken_id VARCHAR(40),
action_taken_type VARCHAR(50),
character_3_used VARCHAR(50),
character_3_used_id CHAR(10),
character_3_used_freq INT,
is_level_retry INT,
total_revives_completed INT,
step_type VARCHAR(50),
action_taken_analytics_id VARCHAR(50),
story_episode_analytics_id VARCHAR(50),
points_score INT,
points_overall_target_achieved INT,
is_first_launch INT,
loading_type VARCHAR(30),
node_duration INT,
is_showing_stars INT,
loading_state CHAR(9),
node_current_time INT,
star_cost INT,
loading_type_id CHAR(12),
gems_awarded INT,
coins_awarded INT,
gem_cost INT,
current_gem_inventory INT,
can_afford INT,
current_characters_count INT,
source CHAR(5),
is_first_character INT,
is_duplicate INT,
state CHAR(6),
advert_error CHAR(15),
revive_error VARCHAR(50),
current_coin_inventory INT,
product_id CHAR(35),
purchase_error CHAR(13),
item_id CHAR(10),
coins_spent INT,
is_correct INT,
first_session_start_time CHAR(33),
previous_session_start_time CHAR(33),
current_session_start_time CHAR(33),
primary key (id),
foreign key (user_id) references users(user_id) on delete cascade,
foreign key (event_id) references events(id) on delete cascade
);
-- Junction Tables
create table UserRetention(
user_id char(36) not null,
retention_id int not null,
primary key (user_id, retention_id),
foreign key (user_id) references users(user_id) on delete cascade,
foreign key (retention_id) references retention(id) on delete cascade
);
create table UserTests(
user_id char(36) not null,
ab_id int not null,
primary key (user_id, ab_id),
foreign key (user_id) references users(user_id) on delete cascade,
foreign key (ab_id) references ab_tests(id) on delete cascade
);
-- ADD FOREIGN KEYS TO USERS
alter table users
add foreign key (location_id)
references locations(id)
on delete cascade;
alter table users
add foreign key (gender_id)
references genders(id)
on delete cascade;
alter table users
add foreign key (device_id)
references devices(id)
on delete cascade;
alter table users
add foreign key (retention_id)
references retention(id)
on delete cascade;
alter table users
add foreign key (ab_test_id)
references ab_tests(id)
on delete cascade;
| true |
a49f8ac91950967b9a0c9bbfefc4fcfe70f08754 | SQL | carlespoles/DSCI6010-student | /SQL-03.sql | UTF-8 | 1,188 | 3.984375 | 4 | [] | no_license | -- Example of creating custom size bins for histograms.
WITH
temp_recipes AS (
SELECT
t1.*
FROM
`firebase-wellio.recipes.imported_recipes` t1
INNER JOIN (
SELECT
MAX(updated_at) AS last_update,
id
FROM
`firebase-wellio.recipes.imported_recipes`
GROUP BY
id) t2
ON
t1.updated_at=last_update
AND t1.id=t2.id )
SELECT
CASE
WHEN CAST(price_per_serving AS float64) = 0 THEN '0'
WHEN CAST(price_per_serving AS float64) BETWEEN 0
AND 5 THEN '0 - 5'
WHEN CAST(price_per_serving AS float64) BETWEEN 5 AND 10 THEN '05 - 10'
WHEN CAST(price_per_serving AS float64) BETWEEN 10
AND 20 THEN '10 - 20'
WHEN CAST(price_per_serving AS float64) BETWEEN 20 AND 30 THEN '20 - 30'
WHEN CAST(price_per_serving AS float64) BETWEEN 30
AND 40 THEN '30 - 40'
WHEN CAST(price_per_serving AS float64) BETWEEN 40 AND 50 THEN '40 - 50'
WHEN CAST(price_per_serving AS float64) BETWEEN 50
AND 60 THEN '50 - 60'
WHEN CAST(price_per_serving AS float64) BETWEEN 60 AND 70 THEN '60 - 70'
ELSE '70+'
END AS price_per_serving_bin,
COUNT(*) AS count_of_recipes
FROM
temp_recipes
GROUP BY
1
ORDER BY
1 ASC | true |
c769e20122f97e239864b77b16ac4dd3fe123d3d | SQL | theboocock/OtagoGalaxy | /src/ensembl-variation/sql/patch_55_56_b.sql | UTF-8 | 877 | 2.53125 | 3 | [] | no_license | # added subsnp_id in the variation_synonym, allele, population_genotype, tmp_individual_genotype_single_bp, individual_genotype_multiple_bp table
##################
alter table variation_synonym add subsnp_id int(15) unsigned after variation_id, add key subsnp_idx(subsnp_id);
alter table allele add subsnp_id int(15) unsigned after variation_id, add key subsnp_idx(subsnp_id);
alter table population_genotype add subsnp_id int(15) unsigned after variation_id, add key subsnp_idx(subsnp_id);
alter table tmp_individual_genotype_single_bp add subsnp_id int(15) unsigned after variation_id, add key subsnp_idx(subsnp_id);
alter table individual_genotype_multiple_bp add subsnp_id int(15) unsigned after variation_id, add key subsnp_idx(subsnp_id);
# patch identifier
INSERT INTO meta (species_id, meta_key, meta_value) VALUES (NULL,'patch', 'patch_55_56_b.sql|add subsnp_id');
| true |
a723e422d00beb57c9420e5c945d01f4b481b01d | SQL | brianpacia/CS-122-Pure-Detail | /Dummy Data.sql | UTF-8 | 5,321 | 2.828125 | 3 | [] | no_license | //product
insertProduct("Pancit Bihon", "cooked food", 35.00, "1 cup per order");
insertProduct("Adobong Manok", "cooked food", 50.00, "3 pieces of meat per order");
insertProduct("Sinigang na Baboy", "cooked food", 50.00, "3 pieces of meat per order");
insertProduct("Plain Rice", "cooked food", 15.00, "1 cup per order");
insertProduct("Nilagang Baka", "cooked food", 50.00, "3 pieces of meat per order");
insertProduct("Pritong Bangus", "cooked food", 45.00, "1 entire fish per order");
insertProduct("Pork Barbecue on a Stick", "cooked food", 15.00, "1 stick per order");
insertProduct("Turon", "sari-sari", 15.00, "");
insertProduct("Cheese Piattos", "sari-sari", 15.00, "");
insertProduct("Oreos", "sari-sari", 12.00, "");
insertProduct("Skyflakes", "sari-sari", 10.00, "");
insertProduct("Nova", "sari-sari", 15.00, "");
insertProduct("Lemon Smart C", "drinks", 15.00, "");
insertProduct("Summit Water", "drinks", 12.00, "");
insertProduct("Gatorade Blue Bolt", "drinks", 30.00, "");
//customer
insertCustomer("Jeff", "T.", "Andawi", 1500.00, 0.00);
insertCustomer("Owen", "S.", "Medina", 1250.00, 0.00);
insertCustomer("Brian", "P.", "Pacia", 1250.00, 0.00);
insertCustomer("Angela", "M.", "Mercado", 1200.00, 100.00);
insertCustomer("Paolo", "O.", "Alilam", 1100.00, 200.00);
insertCustomer("Enzo", "A.", "Orbeta", 1100.00, 150.00);
insertCustomer("Alec", "A.", "Aquino", 1000.00, 300.00);
insertCustomer("Kristi", "T.", "Ingco", 1000.00, 100.00);
insertCustomer("Alyssa", "C.", "Cuan", 750.00, 0.00);
insertCustomer("Jerry", "P.", "Patajo", 500.00, 0.00);
//orders
insertOrder("Alec", "A.", "Aquino", 2018 , 5 , 15 );
insertOrder("Kristi", "T.", "Ingco", 2018 , 5 , 15 );
insertOrder("Enzo", "A.", "Orbeta", 2018 , 5 , 15 );
insertOrder("Paolo", "O.", "Alilam", 2018 , 5 , 16);
insertOrder("Angela", "M.", "Mercado", 2018 , 5 , 16);
insertOrder("Brian," "P.", "Pacia", 2018 , 5 , 17);
insertOrder("Owen", "S.", "Medina", 2018 , 5 , 17);
insertOrder("Jeff", "T.", "Andawi", 2018 , 5 , 17);
insertOrder("Jerry", "P.", "Patajo", 2018 , 5 , 17);
insertOrder("Brian," "P.", "Pacia", 2018 , 5 , 17);
//orderitem
insertOrderItem("Brian", "P.", "Pacia", "Pork Barbecue on a Stick", 4);
insertOrderItem("Brian", "P.", "Pacia", "Turon", 2);
insertOrderItem("Brian", "P.", "Pacia", "Pork Barbecue on a Stick", 2);
insertOrderItem("Owen", "S.", "Medina", "Lemon Smart C", 15);
insertOrderItem("Owen", "S.", "Medina", "Oreos", 10);
insertOrderItem("Jeff", "T.", "Andawi", "Cheese Piattos", 2);
insertOrderItem("Jeff", "T.", "Andawi", "Summit Water", 1);
insertOrderItem("Angela", "M.", "Mercado", "Nilagang Baka", 1);
insertOrderItem("Angela", "M.", "Mercado", "Plain Rice", 2);
insertOrderItem("Paolo", "O.", "Alilam", "Gatorade Blue Bolt", 1);
insertOrderItem("Alec", "A.", "Aquino", "Adobong Manok", 1);
insertOrderItem("Alec", "A.", "Aquino", "Plain Rice", 1);
insertOrderItem("Alec", "A.", "Aquino", "Summit Water", 1);
insertOrderItem("Kristi", "T.", "Ingco", "Pritong Bangus", 3);
insertOrderItem("Enzo", "A.", "Orbeta", "Skyflakes", 10);
insertOrderItem("Jerry", "P.", "Patajo", "Turon", 4);
//inventory
insertBegInv(2018, 5, 15, "Pancit Bihon", 15, 0, 0);
insertBegInv(2018, 5, 15, "Adobong Manok", 15, 0, 0);
insertBegInv(2018, 5, 15, "Sinigang na Baboy", 15, 0, 0);
insertBegInv(2018, 5, 15, "Plain Rice", 15, 0, 0);
insertBegInv(2018, 5, 15, "Nilagang Baka", 15, 0, 0);
insertBegInv(2018, 5, 15, "Pritong Bangus", 15, 0, 0);
insertBegInv(2018, 5, 15, "Pork Barbecue on a Stick", 15, 0, 0);
insertBegInv(2018, 5, 15, "Turon", 15, 0, 0);
insertBegInv(2018, 5, 15, "Cheese Piattos", 15, 0, 0);
insertBegInv(2018, 5, 15, "Oreos", 15, 0, 0);
insertBegInv(2018, 5, 15, "Skyflakes", 15, 0, 0);
insertBegInv(2018, 5, 15, "Nova", 15, 0, 0);
insertBegInv(2018, 5, 15, "Lemon Smart C", 15, 0, 0);
insertBegInv(2018, 5, 15, "Summit Water", 15, 0, 0);
insertBegInv(2018, 5, 15, "Gatorade Blue Bolt", 15, 0, 0);
insertBegInv(2018, 5, 16, "Pancit Bihon", 15, 0, 0);
insertBegInv(2018, 5, 16, "Adobong Manok", 15, 0, 0);
insertBegInv(2018, 5, 16, "Sinigang na Baboy", 15, 0, 0);
insertBegInv(2018, 5, 16, "Plain Rice", 15, 0, 0);
insertBegInv(2018, 5, 16, "Nilagang Baka", 15, 0, 0);
insertBegInv(2018, 5, 16, "Pritong Bangus", 15, 0, 0);
insertBegInv(2018, 5, 16, "Pork Barbecue on a Stick", 15, 0, 0);
insertBegInv(2018, 5, 16, "Turon", 15, 0, 0);
insertBegInv(2018, 5, 16, "Cheese Piattos", 15, 0, 0);
insertBegInv(2018, 5, 16, "Oreos", 15, 0, 0);
insertBegInv(2018, 5, 16, "Skyflakes", 15, 0, 0);
insertBegInv(2018, 5, 16, "Nova", 15, 0, 0);
insertBegInv(2018, 5, 16, "Lemon Smart C", 15, 0, 0);
insertBegInv(2018, 5, 16, "Summit Water", 15, 0, 0);
insertBegInv(2018, 5, 16, "Gatorade Blue Bolt", 15, 0, 0);
insertBegInv(2018, 5, 17, "Pancit Bihon", 15, 0, 0);
insertBegInv(2018, 5, 17, "Adobong Manok", 15, 0, 0);
insertBegInv(2018, 5, 17, "Sinigang na Baboy", 15, 0, 0);
insertBegInv(2018, 5, 17, "Plain Rice", 15, 0, 0);
insertBegInv(2018, 5, 17, "Nilagang Baka", 15, 0, 0);
insertBegInv(2018, 5, 17, "Pritong Bangus", 15, 0, 0);
insertBegInv(2018, 5, 17, "Pork Barbecue on a Stick", 15, 0, 0);
insertBegInv(2018, 5, 17, "Turon", 15, 0, 0);
insertBegInv(2018, 5, 17, "Cheese Piattos", 15, 0, 0);
insertBegInv(2018, 5, 17, "Oreos", 15, 0, 0);
insertBegInv(2018, 5, 17, "Skyflakes", 15, 0, 0);
insertBegInv(2018, 5, 17, "Nova", 15, 0, 0);
insertBegInv(2018, 5, 17, "Lemon Smart C", 15, 0, 0);
insertBegInv(2018, 5, 17, "Summit Water", 15, 0, 0);
insertBegInv(2018, 5, 17, "Gatorade Blue Bolt", 15, 0, 0);
| true |
bbc3dc54cd86f4a19662506cfd958299244ee4dd | SQL | geert-timmermans/sql | /php-pdo/sql_dump/weatherapp.sql | UTF-8 | 1,216 | 2.84375 | 3 | [] | no_license | -- phpMyAdmin SQL Dump
-- version 4.6.6deb5
-- https://www.phpmyadmin.net/
--
-- Host: localhost:3306
-- Generation Time: Apr 23, 2019 at 02:49 PM
-- Server version: 5.7.25-0ubuntu0.18.04.2
-- PHP Version: 7.2.15-0ubuntu0.18.04.2
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: `weatherapp`
--
-- --------------------------------------------------------
--
-- Table structure for table `weather`
--
CREATE TABLE `weather` (
`city` varchar(255) NOT NULL,
`high` int(11) NOT NULL,
`low` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `weather`
--
INSERT INTO `weather` (`city`, `high`, `low`) VALUES
('Brussels', 27, 13),
('Liège', 25, 15),
('Namur', 26, 15),
('Charleroi', 25, 12),
('Bruges', 28, 16);
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
| true |
203ae0ebb61188bb35feb2bc717265cdafd0f695 | SQL | jsonlog/sqlserver | /9/22/SQLQuery.sql | WINDOWS-1252 | 167 | 3.40625 | 3 | [] | no_license | USE db_2012
SELECT student.Sno,student.Sex,student.Sage,Sc.Grade
FROM student JOIN Sc ON student.Sno = Sc.Sno
WHERE student.Sex = ''
ORDER BY student.Sage DESC
| true |
bcaec9fecdbca6a2d40185420c88f4ffb77afe25 | SQL | suomenriistakeskus/oma-riista-web | /scripts/database/reference-data/import/harvest_season.sql | UTF-8 | 1,028 | 3.640625 | 4 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | CREATE TABLE import_harvest_season (
hunting_year INTEGER NOT NULL,
game_species_official_code INTEGER NOT NULL,
name_finnish VARCHAR(255) NOT NULL,
name_swedish VARCHAR(255) NOT NULL,
begin_date DATE NOT NULL,
end_date DATE NOT NULL,
end_of_reporting_date DATE NOT NULL,
begin_date2 DATE,
end_date2 DATE,
end_of_reporting_date2 DATE,
PRIMARY KEY (hunting_year, game_species_official_code)
);
\COPY import_harvest_season FROM './csv/harvest_season.csv' WITH CSV DELIMITER ';' NULL '' ENCODING 'UTF-8';
INSERT INTO harvest_season (
begin_date,
end_date,
end_of_reporting_date,
begin_date2,
end_date2,
end_of_reporting_date2,
name_finnish,
name_swedish,
game_species_id
) SELECT
hs.begin_date,
hs.end_date,
hs.end_of_reporting_date,
hs.begin_date2,
hs.end_date2,
hs.end_of_reporting_date2,
hs.name_finnish,
hs.name_swedish,
g.game_species_id
FROM import_harvest_season hs
JOIN game_species g ON (hs.game_species_official_code = g.official_code);
| true |
85261527c14ba9ab11c88e513abdcd51c4a0716a | SQL | efrozo23/crud-valid | /valid-test/src/main/resources/schema-all.sql | UTF-8 | 408 | 2.890625 | 3 | [] | no_license | SET MODE MySql;
DROP TABLE usuarios IF EXISTS;
CREATE TABLE usuarios (
id INT AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(80) NOT null,
lastname VARCHAR(30) NOT null,
status BOOLEAN not null default 0
);
CREATE SEQUENCE id_user_key;
insert into usuarios (id,name,lastname) values (100,'Elkin','Rozo');
insert into usuarios (id,name,lastname) values (200,'Fabian','O');
| true |
440169d56ab8a5caff224c6e5f0ba20c0088b712 | SQL | RCMAS-2018-21-Projects/Online-Gym-Management-System | /gym.sql | UTF-8 | 8,735 | 3.390625 | 3 | [] | no_license | -- phpMyAdmin SQL Dump
-- version 3.4.10.1
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Nov 26, 2020 at 04:57 PM
-- Server version: 5.5.20
-- PHP Version: 5.3.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 utf8 */;
--
-- Database: `gym`
--
-- --------------------------------------------------------
--
-- Table structure for table `tb_booking`
--
CREATE TABLE IF NOT EXISTS `tb_booking` (
`book_id` int(20) NOT NULL AUTO_INCREMENT,
`cust_id` int(20) NOT NULL,
`cat_id` int(20) NOT NULL,
`pack_id` int(20) NOT NULL,
`schedule_id` int(20) NOT NULL,
`doj` varchar(25) NOT NULL,
`book_date` varchar(25) NOT NULL,
PRIMARY KEY (`book_id`),
KEY `pack_id` (`pack_id`),
KEY `schedule_id` (`schedule_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=41 ;
--
-- Dumping data for table `tb_booking`
--
INSERT INTO `tb_booking` (`book_id`, `cust_id`, `cat_id`, `pack_id`, `schedule_id`, `doj`, `book_date`) VALUES
(39, 14, 19, 18, 18, '2020-12-01', '2020-11-26'),
(40, 11, 5, 17, 15, '2020-12-02', '2020-11-26');
-- --------------------------------------------------------
--
-- Table structure for table `tb_card`
--
CREATE TABLE IF NOT EXISTS `tb_card` (
`card_no` varchar(100) NOT NULL,
`cust_id` int(20) NOT NULL,
`card_name` varchar(20) NOT NULL,
`exp_date` varchar(100) NOT NULL,
`card_typ` varchar(10) NOT NULL,
PRIMARY KEY (`card_no`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `tb_card`
--
INSERT INTO `tb_card` (`card_no`, `cust_id`, `card_name`, `exp_date`, `card_typ`) VALUES
('4562 7899 4566 1236', 11, 'G BRISTOW', '12/2025', 'debit'),
('7894 5612 3336 1235', 14, 'Nithesh S Menon', '12/2020', 'debit'),
('7894 5621 1230 5777', 11, 'George Bristow', '01/2022', 'debit'),
('7896 4566 3214 5698', 11, 'George Bristow', '12/2022', 'debit');
-- --------------------------------------------------------
--
-- Table structure for table `tb_category`
--
CREATE TABLE IF NOT EXISTS `tb_category` (
`cat_id` int(20) NOT NULL AUTO_INCREMENT,
`cat_name` varchar(20) NOT NULL,
PRIMARY KEY (`cat_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=23 ;
--
-- Dumping data for table `tb_category`
--
INSERT INTO `tb_category` (`cat_id`, `cat_name`) VALUES
(5, 'Male 20-25'),
(19, 'Male30-40'),
(20, 'Male 40-50'),
(21, 'Male 50+'),
(22, 'Male 41');
-- --------------------------------------------------------
--
-- Table structure for table `tb_customer`
--
CREATE TABLE IF NOT EXISTS `tb_customer` (
`cust_id` int(20) NOT NULL AUTO_INCREMENT,
`cust_username` varchar(20) NOT NULL,
`cust_firstname` varchar(20) NOT NULL,
`cust_lastname` varchar(20) NOT NULL,
`cust_age` int(2) NOT NULL,
`cust_gen` char(1) NOT NULL,
`cust_hname` varchar(20) NOT NULL,
`cust_city` varchar(20) NOT NULL,
`cust_pin` varchar(10) NOT NULL,
`cust_phno` bigint(10) NOT NULL,
PRIMARY KEY (`cust_id`),
UNIQUE KEY `cust_username` (`cust_username`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=17 ;
--
-- Dumping data for table `tb_customer`
--
INSERT INTO `tb_customer` (`cust_id`, `cust_username`, `cust_firstname`, `cust_lastname`, `cust_age`, `cust_gen`, `cust_hname`, `cust_city`, `cust_pin`, `cust_phno`) VALUES
(11, 'gbristow@gmail.com', 'George', 'Bristow', 23, 'M', 'Palarivattom', 'Ernakulam', '682025', 9895412325),
(13, 'john@gmail.com', 'John', 'S', 23, 'M', 'Vinci Homes', 'Ernakulam', '682024', 9874567894),
(14, 'jeffery@gmail.com', 'Jeffery', 'Archer', 45, 'M', 'Dan Home', 'Ernakulam', '682025', 9895464125),
(16, 'dan@gmail.com', 'Dan', 'Brown', 23, 'M', 'Mmm', 'Eee', '789456', 9895456654);
-- --------------------------------------------------------
--
-- Table structure for table `tb_log`
--
CREATE TABLE IF NOT EXISTS `tb_log` (
`username` varchar(20) NOT NULL,
`usertype` varchar(20) NOT NULL,
`password` varchar(20) NOT NULL,
PRIMARY KEY (`username`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `tb_log`
--
INSERT INTO `tb_log` (`username`, `usertype`, `password`) VALUES
('admin@gmail.com', 'admin', 'admin@123'),
('aks@gmail.com', 'staff', 'Akshai123'),
('amal@gmail.com', 'staff', 'Amal12345'),
('dan@gmail.com', 'customer', 'Dan12345678'),
('gav@gmail.com', 'staff', 'Gavin1234'),
('gbristow@gmail.com', 'customer', 'Gbristow@123'),
('jeffery@gmail.com', 'customer', 'Jarcher123'),
('john@gmail.com', 'customer', 'John1234'),
('nithesh@gmail.com', 'staff', 'Nithesh123'),
('nitheshsmenon13@gmai', 'customer', 'Qwerty123'),
('qws@gmail.com', 'staff', 'Qws123456'),
('sureshmenon.b@gmail.', 'customer', 'Suresh123');
-- --------------------------------------------------------
--
-- Table structure for table `tb_package`
--
CREATE TABLE IF NOT EXISTS `tb_package` (
`pack_id` int(20) NOT NULL AUTO_INCREMENT,
`pack_name` char(20) NOT NULL,
`pack_rate` int(5) NOT NULL,
PRIMARY KEY (`pack_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=21 ;
--
-- Dumping data for table `tb_package`
--
INSERT INTO `tb_package` (`pack_id`, `pack_name`, `pack_rate`) VALUES
(1, 'Weight Training', 800),
(17, 'Aerobic', 800),
(18, 'Posture correction', 1000),
(19, 'Weight Loss', 800),
(20, 'Wiegth gain', 900);
-- --------------------------------------------------------
--
-- Table structure for table `tb_payment`
--
CREATE TABLE IF NOT EXISTS `tb_payment` (
`pay_id` int(20) NOT NULL AUTO_INCREMENT,
`book_id` int(20) NOT NULL,
`card_no` varchar(255) NOT NULL,
`payment_mode` varchar(20) NOT NULL,
`payment_status` varchar(20) NOT NULL,
`payment_date` varchar(100) NOT NULL,
PRIMARY KEY (`pay_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=15 ;
--
-- Dumping data for table `tb_payment`
--
INSERT INTO `tb_payment` (`pay_id`, `book_id`, `card_no`, `payment_mode`, `payment_status`, `payment_date`) VALUES
(12, 39, '7894 5612 3336 1235', 'Online', 'successful', '2020/11/26'),
(13, 38, '4562 7899 4566 1236', 'Online', 'successful', '2020/11/26'),
(14, 40, '7896 4566 3214 5698', 'Online', 'successful', '2020/11/26');
-- --------------------------------------------------------
--
-- Table structure for table `tb_schedule`
--
CREATE TABLE IF NOT EXISTS `tb_schedule` (
`schedule_id` int(20) NOT NULL AUTO_INCREMENT,
`trainer_id` int(20) NOT NULL,
`schedule_stime` time NOT NULL,
`schedule_etime` time NOT NULL,
`alloc_num` varchar(25) NOT NULL,
PRIMARY KEY (`schedule_id`),
KEY `trainer_id` (`trainer_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=21 ;
--
-- Dumping data for table `tb_schedule`
--
INSERT INTO `tb_schedule` (`schedule_id`, `trainer_id`, `schedule_stime`, `schedule_etime`, `alloc_num`) VALUES
(14, 40, '05:00:00', '08:00:00', '15'),
(15, 34, '06:00:00', '09:00:00', '15'),
(18, 41, '17:00:00', '20:00:00', '15'),
(20, 34, '04:00:00', '09:00:00', '10');
-- --------------------------------------------------------
--
-- Table structure for table `tb_trainer`
--
CREATE TABLE IF NOT EXISTS `tb_trainer` (
`trainer_id` int(20) NOT NULL AUTO_INCREMENT,
`trainer_username` varchar(20) NOT NULL,
`trainer_firstname` varchar(20) NOT NULL,
`trainer_lastname` varchar(20) NOT NULL,
`trainer_age` int(2) NOT NULL,
`trainer_gen` varchar(1) NOT NULL,
`trainer_hname` varchar(20) NOT NULL,
`trainer_city` varchar(20) NOT NULL,
`trainer_pin` varchar(10) NOT NULL,
`trainer_phno` bigint(25) NOT NULL,
PRIMARY KEY (`trainer_id`),
UNIQUE KEY `trainer_username` (`trainer_username`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=44 ;
--
-- Dumping data for table `tb_trainer`
--
INSERT INTO `tb_trainer` (`trainer_id`, `trainer_username`, `trainer_firstname`, `trainer_lastname`, `trainer_age`, `trainer_gen`, `trainer_hname`, `trainer_city`, `trainer_pin`, `trainer_phno`) VALUES
(34, 'nithesh@gmail.com', 'Nithesh', 'Menon', 29, 'M', 'Manimala Cross Road', 'Ernakulam', '682024', 9895123301),
(40, 'aks@gmail.com', 'Akshai', 'M', 26, 'M', 'Rose Villa', 'Ernakulam', '682024', 7894561231),
(41, 'gav@gmail.com', 'Gavin', 'CW', 25, 'M', 'Home', 'Ernakulam', '682024', 9874568521),
(43, 'amal@gmail.com', 'Amal', 'R', 26, 'M', 'VILAA', 'Ernakulam', '682024', 9895123369);
--
-- Constraints for dumped tables
--
--
-- Constraints for table `tb_booking`
--
ALTER TABLE `tb_booking`
ADD CONSTRAINT `tb_booking_ibfk_1` FOREIGN KEY (`pack_id`) REFERENCES `tb_package` (`pack_id`),
ADD CONSTRAINT `tb_booking_ibfk_2` FOREIGN KEY (`schedule_id`) REFERENCES `tb_schedule` (`schedule_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 |
3a680983eb824596af721ca538cf43efe115d2f0 | SQL | raymondelooff/profmos | /profmos_2015-09-18.sql | UTF-8 | 31,225 | 3.078125 | 3 | [] | no_license | # ************************************************************
# Sequel Pro SQL dump
# Version 4135
#
# http://www.sequelpro.com/
# http://code.google.com/p/sequel-pro/
#
# Host: delooff.synology.me (MySQL 5.5.43-MariaDB)
# Database: profmos
# Generation Time: 2015-09-18 12:46:53 +0000
# ************************************************************
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40014 SET @OLD_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 */;
# Dump of table bedrijf
# ------------------------------------------------------------
DROP TABLE IF EXISTS `bedrijf`;
CREATE TABLE `bedrijf` (
`BedrijfID` int(11) NOT NULL AUTO_INCREMENT,
`Naam` varchar(45) NOT NULL,
`Afkorting` varchar(10) DEFAULT NULL,
PRIMARY KEY (`BedrijfID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
LOCK TABLES `bedrijf` WRITE;
/*!40000 ALTER TABLE `bedrijf` DISABLE KEYS */;
INSERT INTO `bedrijf` (`BedrijfID`, `Naam`, `Afkorting`)
VALUES
(1,'Testbedrijf','TB'),
(2,'test2','t2'),
(3,'Test3','t3'),
(4,'Hammes','HAMM'),
(5,'234235','HMM'),
(6,'OSWD','13242345'),
(7,'Hammes','HAMM'),
(8,'RvY','RvY'),
(9,'Test bedrijf 1000','TB1000'),
(10,'Test','test'),
(11,'pitch bedrijf','PB');
/*!40000 ALTER TABLE `bedrijf` ENABLE KEYS */;
UNLOCK TABLES;
# Dump of table behandeling
# ------------------------------------------------------------
DROP TABLE IF EXISTS `behandeling`;
CREATE TABLE `behandeling` (
`BehandelingID` int(11) NOT NULL AUTO_INCREMENT,
`Datum` int(11) NOT NULL,
`Activiteit` varchar(45) NOT NULL,
`Mosselgroep_MosselgroepID` int(11) DEFAULT NULL,
`Zaaiing_ZaaiingID` int(11) DEFAULT NULL,
`Bedrijf_BedrijfID` int(11) NOT NULL,
`Vak_VakID` int(11) NOT NULL,
`Perceel_PerceelID` int(11) NOT NULL,
`Opmerking` varchar(200) DEFAULT NULL,
`Monster` tinyint(1) NOT NULL,
`MonsterLabel` varchar(200) DEFAULT NULL,
PRIMARY KEY (`BehandelingID`),
KEY `fk_behandeling_bedrijf1_idx` (`Bedrijf_BedrijfID`),
KEY `fk_behandeling_vak1_idx` (`Vak_VakID`),
KEY `fk_behandeling_perceel1_idx` (`Perceel_PerceelID`),
KEY `fk_behandeling_zaaiing1_idx` (`Zaaiing_ZaaiingID`),
KEY `Mosselgroep_MosselgroepID` (`Mosselgroep_MosselgroepID`),
CONSTRAINT `fk_behandeling_bedrijf1` FOREIGN KEY (`Bedrijf_BedrijfID`) REFERENCES `bedrijf` (`BedrijfID`) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT `fk_behandeling_mosselgroep1` FOREIGN KEY (`Mosselgroep_MosselgroepID`) REFERENCES `mosselgroep` (`MosselgroepID`) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT `fk_behandeling_perceel1` FOREIGN KEY (`Perceel_PerceelID`) REFERENCES `perceel` (`PerceelID`) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT `fk_behandeling_vak1` FOREIGN KEY (`Vak_VakID`) REFERENCES `vak` (`VakID`) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT `fk_behandeling_zaaiing1` FOREIGN KEY (`Zaaiing_ZaaiingID`) REFERENCES `zaaiing` (`ZaaiingID`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
LOCK TABLES `behandeling` WRITE;
/*!40000 ALTER TABLE `behandeling` DISABLE KEYS */;
INSERT INTO `behandeling` (`BehandelingID`, `Datum`, `Activiteit`, `Mosselgroep_MosselgroepID`, `Zaaiing_ZaaiingID`, `Bedrijf_BedrijfID`, `Vak_VakID`, `Perceel_PerceelID`, `Opmerking`, `Monster`, `MonsterLabel`)
VALUES
(26,1434627826,'Sterren Dweilen',38,45,1,2,1,'Dit is een opmerking.',1,'Dit is een label'),
(27,1681509600,'Trekje op perceel',NULL,NULL,8,14,23,'monster trekje perceel',1,'monster trekje perceel'),
(28,1681509600,'Trekje op perceel',NULL,NULL,8,14,23,'monster trekje perceel',1,'monster trekje perceel'),
(29,1681509600,'Trekje op perceel',NULL,NULL,8,14,23,'monster trekje perceel',1,'monster trekje perceel'),
(30,1681509600,'Trekje op perceel',46,54,8,14,23,'monster trekje perceel',1,'monster trekje perceel'),
(31,1465941600,'Sterren Dweilen',NULL,NULL,8,14,23,'Dit is weer een opmerking.',1,'monstertje'),
(32,1465941600,'Sterren Rapen',NULL,NULL,8,14,23,'Dit is weer een opmerking.',1,'monstertje'),
(33,1465941600,'Onder Zoet Water',NULL,NULL,8,14,23,'Dit is weer een opmerking.',1,'monstertje'),
(34,1465941600,'Onder Warm Water',NULL,NULL,2,1,1,'Dit is weer een opmerking.',1,'monstertje'),
(35,1465941600,'Peulen',NULL,NULL,2,8,18,'Dit is weer een opmerking.',1,'monstertje'),
(36,1465941600,'Groen',NULL,NULL,4,7,17,'Dit is weer een opmerking.',1,'monstertje'),
(37,1465941600,'Droog Leggen',NULL,NULL,2,4,3,'Dit is weer een opmerking.',1,'monstertje'),
(38,1465941600,'Over Spoelerij',NULL,NULL,8,14,23,'Dit is weer een opmerking.',1,'monstertje');
/*!40000 ALTER TABLE `behandeling` ENABLE KEYS */;
UNLOCK TABLES;
# Dump of table boot
# ------------------------------------------------------------
DROP TABLE IF EXISTS `boot`;
CREATE TABLE `boot` (
`BootID` int(11) NOT NULL AUTO_INCREMENT,
`Bedrijf_BedrijfID` int(11) NOT NULL,
`Naam` varchar(45) NOT NULL,
PRIMARY KEY (`BootID`),
KEY `fk_boot_bedrijf_idx` (`Bedrijf_BedrijfID`),
CONSTRAINT `fk_boot_bedrijf` FOREIGN KEY (`Bedrijf_BedrijfID`) REFERENCES `bedrijf` (`BedrijfID`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
LOCK TABLES `boot` WRITE;
/*!40000 ALTER TABLE `boot` DISABLE KEYS */;
INSERT INTO `boot` (`BootID`, `Bedrijf_BedrijfID`, `Naam`)
VALUES
(1,2,'bootje'),
(2,2,'bootje2'),
(3,2,'Fortuna'),
(4,2,'222'),
(5,2,'.'),
(6,8,'YE116'),
(7,9,'Test boot 1000'),
(8,10,'Testboot'),
(9,11,'pitch boot');
/*!40000 ALTER TABLE `boot` ENABLE KEYS */;
UNLOCK TABLES;
# Dump of table meting
# ------------------------------------------------------------
DROP TABLE IF EXISTS `meting`;
CREATE TABLE `meting` (
`MetingID` int(11) NOT NULL AUTO_INCREMENT,
`Vak_VakID` int(11) NOT NULL,
`Perceel_PerceelID` int(11) NOT NULL,
`Datum` int(11) NOT NULL,
`Compartiment` int(11) NOT NULL,
`Type` varchar(45) NOT NULL,
`Lengte` float DEFAULT NULL,
`Natgewicht` float DEFAULT NULL,
`Visgewicht` float DEFAULT NULL,
`AFDW` float DEFAULT NULL,
`DW_Schelp` float DEFAULT NULL,
PRIMARY KEY (`MetingID`),
KEY `fk_meting_vak1_idx` (`Vak_VakID`),
KEY `fk_meting_perceel1_idx` (`Perceel_PerceelID`),
CONSTRAINT `fk_meting_perceel1` FOREIGN KEY (`Perceel_PerceelID`) REFERENCES `perceel` (`PerceelID`) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT `fk_meting_vak1` FOREIGN KEY (`Vak_VakID`) REFERENCES `vak` (`VakID`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
LOCK TABLES `meting` WRITE;
/*!40000 ALTER TABLE `meting` DISABLE KEYS */;
INSERT INTO `meting` (`MetingID`, `Vak_VakID`, `Perceel_PerceelID`, `Datum`, `Compartiment`, `Type`, `Lengte`, `Natgewicht`, `Visgewicht`, `AFDW`, `DW_Schelp`)
VALUES
(5,1,1,1434492000,3,'Halfwas',0,2,2,1,1),
(9,2,1,1433282400,1,'zaad',10,10,10,10,10),
(11,8,18,1433289600,1,'consumptieFormaat',1,1,1,1,1),
(12,8,18,1433289600,1,'consumptieFormaat',1,1,1,1,1),
(13,8,18,1433282400,1,'consumptieFormaat',1,1,1,1,1),
(14,8,18,1433282400,7,'Consumptie formaat',2,2,2,2,2),
(15,2,1,1432677600,3,'Consumptie formaat',45,4576,53,764,876),
(16,1,1,1434146400,4,'Consumptie formaat',20,30,40,50,60);
/*!40000 ALTER TABLE `meting` ENABLE KEYS */;
UNLOCK TABLES;
# Dump of table monster
# ------------------------------------------------------------
DROP TABLE IF EXISTS `monster`;
CREATE TABLE `monster` (
`MonsterID` int(11) NOT NULL AUTO_INCREMENT,
`Bedrijf_BedrijfID` int(11) NOT NULL,
`Boot_BootID` int(11) NOT NULL,
`Perceel_PerceelID` int(11) NOT NULL,
`Vak_VakID` int(11) NOT NULL,
`mosselgroep_MosselgroepID` int(11) NOT NULL,
`Datum` int(11) NOT NULL,
`BrutoMonster` float DEFAULT NULL,
`NettoMonster` float DEFAULT NULL,
`Tarra` float DEFAULT NULL,
`Busstal` int(11) DEFAULT NULL,
`GewichtMossel` float DEFAULT NULL,
`Slippers` float DEFAULT NULL,
`Zeester` float DEFAULT NULL,
`Pokken` float DEFAULT NULL,
`BusNetto` float DEFAULT NULL,
`AantalKookmonsters` int(11) DEFAULT NULL,
`NettoKookmonster` float DEFAULT NULL,
`VisTotaleMonster` float DEFAULT NULL,
`VisPercentage` float DEFAULT NULL,
`Stukstal` float DEFAULT NULL,
`Kroesnr` int(11) DEFAULT NULL,
`Kroes` float DEFAULT NULL,
`KroesEnVlees` float DEFAULT NULL,
`DW` float DEFAULT NULL,
`AFDW` float DEFAULT NULL,
`AFDWpM` float DEFAULT NULL,
`SchelpenDroog` float DEFAULT NULL,
`GemiddeldeLengte` float DEFAULT NULL,
`GrGewicht` float DEFAULT NULL,
`GrLengte` float DEFAULT NULL,
`GrAFDW` float DEFAULT NULL,
`Opmerking` varchar(200) DEFAULT NULL,
PRIMARY KEY (`MonsterID`),
KEY `fk_monster_perceel1_idx` (`Perceel_PerceelID`),
KEY `fk_monster_bedrijf1_idx` (`Bedrijf_BedrijfID`),
KEY `fk_monster_boot1_idx` (`Boot_BootID`),
KEY `fk_monster_vak1_idx` (`Vak_VakID`),
KEY `fk_monster_mosselgroep1_idx` (`mosselgroep_MosselgroepID`),
CONSTRAINT `fk_monster_bedrijf1` FOREIGN KEY (`Bedrijf_BedrijfID`) REFERENCES `bedrijf` (`BedrijfID`) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT `fk_monster_boot1` FOREIGN KEY (`Boot_BootID`) REFERENCES `boot` (`BootID`) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT `fk_monster_mosselgroep1` FOREIGN KEY (`mosselgroep_MosselgroepID`) REFERENCES `mosselgroep` (`MosselgroepID`) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT `fk_monster_perceel1` FOREIGN KEY (`Perceel_PerceelID`) REFERENCES `perceel` (`PerceelID`) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT `fk_monster_vak1` FOREIGN KEY (`Vak_VakID`) REFERENCES `vak` (`VakID`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
LOCK TABLES `monster` WRITE;
/*!40000 ALTER TABLE `monster` DISABLE KEYS */;
INSERT INTO `monster` (`MonsterID`, `Bedrijf_BedrijfID`, `Boot_BootID`, `Perceel_PerceelID`, `Vak_VakID`, `mosselgroep_MosselgroepID`, `Datum`, `BrutoMonster`, `NettoMonster`, `Tarra`, `Busstal`, `GewichtMossel`, `Slippers`, `Zeester`, `Pokken`, `BusNetto`, `AantalKookmonsters`, `NettoKookmonster`, `VisTotaleMonster`, `VisPercentage`, `Stukstal`, `Kroesnr`, `Kroes`, `KroesEnVlees`, `DW`, `AFDW`, `AFDWpM`, `SchelpenDroog`, `GemiddeldeLengte`, `GrGewicht`, `GrLengte`, `GrAFDW`, `Opmerking`)
VALUES
(21,8,6,23,14,1,1401746400,1081,1081,0,53,0,52,0,0,0,53,594,138,23,0,0,69,207,210,35,0.660377,24,50,NULL,NULL,NULL,'Geen'),
(27,8,6,23,14,1,1407362400,1394.9,1379.7,0.0108968,0,0,0,0,0.2,0,50,575.2,135.844,23.6,0,0,2.1026,137.947,33.2356,30.5543,0.611086,204.7,51.26,0,0.0193846,-0.000758329,'Geen'),
(29,8,6,18,8,9,1433887200,1,1,0,1,1,1,1,1,1,1,1,1,1,2500,1,1,1,1,1,1,1,1,NULL,NULL,NULL,'1'),
(30,2,2,3,4,34,1433282400,64.87,123.12,-0.89795,19827,0.00131134,182.12,129,90,26,234,89,1238,33,1906440,87,98.124,898,981,76,0.324786,897,32.6,NULL,NULL,NULL,'Dit is een test opmerking.'),
(38,8,6,21,11,45,1434232800,765,675,0.117647,675,1.44889,675,6756,5465,978,76,65,54,67,1725.46,53,4587,56,6,543,7.14474,7,564,NULL,NULL,NULL,'33'),
(39,8,6,21,11,45,1434232800,765,675,0.117647,675,1.44889,675,6756,5465,978,76,65,54,67,1725.46,53,4587,56,6,543,7.14474,7,564,0,0,0,'33'),
(40,8,6,21,11,45,1434232800,765,675,0.117647,675,1.44889,675,6756,5465,978,76,65,54,67,1725.46,53,4587,56,6,543,7.14474,7,564,0,0,0,'33'),
(41,8,6,21,11,45,1434232800,765,675,0.117647,675,1.44889,675,6756,5465,978,76,65,54,67,1725.46,53,4587,56,6,543,7.14474,7,564,0,0,0,'33'),
(42,8,6,21,11,45,1434232800,765,675,0.117647,675,1.44889,675,6756,5465,978,76,65,54,67,1725.46,53,4587,56,6,543,7.14474,7,564,0,0,0,'33'),
(43,8,6,21,11,45,1434232800,765,675,0.117647,675,1.44889,675,6756,5465,978,76,65,54,67,1725.46,53,4587,56,6,543,7.14474,7,564,0,0,0,'33'),
(44,8,6,21,11,45,1434232800,765,675,0.117647,675,1.44889,675,6756,5465,978,76,65,54,67,1725.46,53,4587,56,6,543,7.14474,7,564,-0.00000111111,0,-0.00000315789,'33'),
(45,9,7,1,3,14,1433455200,4,4,0,54,1045.85,65675,6454,543,56476,67567,56,45,453,2.3904,64564564,5,433,545876,54,0.000799207,364,33457,NULL,NULL,NULL,'45678'),
(46,9,7,25,17,43,1434146400,30,20,0.333333,10,2,30,30,20,20,30,20,10,20,1250,30,20,30,10,20,0.666667,10,30,NULL,NULL,NULL,'Dit is een opmerking');
/*!40000 ALTER TABLE `monster` ENABLE KEYS */;
UNLOCK TABLES;
# Dump of table mosselgroep
# ------------------------------------------------------------
DROP TABLE IF EXISTS `mosselgroep`;
CREATE TABLE `mosselgroep` (
`MosselgroepID` int(11) NOT NULL AUTO_INCREMENT,
`ParentMosselgroepID` int(11) DEFAULT NULL,
PRIMARY KEY (`MosselgroepID`),
KEY `fk_mosselgroep_mosselgroep1_idx` (`ParentMosselgroepID`),
CONSTRAINT `fk_mosselgroep_mosselgroep1` FOREIGN KEY (`ParentMosselgroepID`) REFERENCES `mosselgroep` (`MosselgroepID`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
LOCK TABLES `mosselgroep` WRITE;
/*!40000 ALTER TABLE `mosselgroep` DISABLE KEYS */;
INSERT INTO `mosselgroep` (`MosselgroepID`, `ParentMosselgroepID`)
VALUES
(1,NULL),
(11,NULL),
(12,NULL),
(13,NULL),
(14,NULL),
(15,NULL),
(16,NULL),
(17,NULL),
(18,NULL),
(19,NULL),
(20,NULL),
(21,NULL),
(22,NULL),
(23,NULL),
(24,NULL),
(25,NULL),
(26,NULL),
(27,NULL),
(28,NULL),
(29,NULL),
(30,NULL),
(31,NULL),
(32,NULL),
(33,NULL),
(34,NULL),
(35,NULL),
(36,NULL),
(37,NULL),
(38,NULL),
(39,NULL),
(44,NULL),
(45,NULL),
(46,NULL),
(47,NULL),
(48,NULL),
(49,NULL),
(50,NULL),
(51,NULL),
(52,NULL),
(53,NULL),
(54,NULL),
(55,NULL),
(56,NULL),
(57,NULL),
(58,NULL),
(59,NULL),
(60,NULL),
(61,NULL),
(62,NULL),
(63,NULL),
(64,NULL),
(65,NULL),
(66,NULL),
(67,NULL),
(68,NULL),
(69,NULL),
(70,NULL),
(71,NULL),
(72,NULL),
(73,NULL),
(74,NULL),
(75,NULL),
(76,NULL),
(80,NULL),
(81,NULL),
(82,NULL),
(83,NULL),
(84,NULL),
(86,NULL),
(2,1),
(3,1),
(4,1),
(9,1),
(10,1),
(7,5),
(5,9),
(6,9),
(8,31),
(40,38),
(41,38),
(42,38),
(43,38),
(85,65),
(77,74),
(79,74),
(78,76);
/*!40000 ALTER TABLE `mosselgroep` ENABLE KEYS */;
UNLOCK TABLES;
# Dump of table oogst
# ------------------------------------------------------------
DROP TABLE IF EXISTS `oogst`;
CREATE TABLE `oogst` (
`OogstID` int(11) NOT NULL AUTO_INCREMENT,
`Zaaiing_ZaaiingID` int(11) DEFAULT NULL,
`Mosselgroep_MosselgroepID` int(11) DEFAULT NULL,
`Activiteit` varchar(45) NOT NULL,
`Datum` int(11) NOT NULL,
`BrutoMton` int(11) DEFAULT NULL,
`Kilogram` int(11) DEFAULT NULL,
`Rendement` float DEFAULT NULL,
`Stukstal` int(11) DEFAULT NULL,
`Bustal` int(11) DEFAULT NULL,
`Oppervlakte` float DEFAULT NULL,
`Opmerking` varchar(200) DEFAULT NULL,
`Monster` tinyint(1) NOT NULL,
`MonsterLabel` varchar(200) DEFAULT NULL,
PRIMARY KEY (`OogstID`),
KEY `fk_oogst_zaaiing1_idx` (`Zaaiing_ZaaiingID`),
KEY `fk_oogst_mosselgroep1_idx` (`Mosselgroep_MosselgroepID`),
CONSTRAINT `fk_oogst_mosselgroep1` FOREIGN KEY (`Mosselgroep_MosselgroepID`) REFERENCES `mosselgroep` (`MosselgroepID`) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT `fk_oogst_zaaiing1` FOREIGN KEY (`Zaaiing_ZaaiingID`) REFERENCES `zaaiing` (`ZaaiingID`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
LOCK TABLES `oogst` WRITE;
/*!40000 ALTER TABLE `oogst` DISABLE KEYS */;
INSERT INTO `oogst` (`OogstID`, `Zaaiing_ZaaiingID`, `Mosselgroep_MosselgroepID`, `Activiteit`, `Datum`, `BrutoMton`, `Kilogram`, `Rendement`, `Stukstal`, `Bustal`, `Oppervlakte`, `Opmerking`, `Monster`, `MonsterLabel`)
VALUES
(53,45,38,'Verzaaien',1434625167,30,3000,NULL,30,20,NULL,'Dit is een opmerking.',1,'Dit is een label'),
(54,45,38,'Verzaaien',1434625352,30,3000,NULL,30,20,NULL,'Dit is een opmerking.',1,'Dit is een label'),
(55,45,38,'Verzaaien',1434625414,30,3000,NULL,30,20,NULL,'Dit is een opmerking.',1,'Dit is een label'),
(56,46,38,'Verzaaien',1434625603,30,3000,NULL,30,20,NULL,'Dit is een opmerking.',1,'Dit is een label'),
(57,45,38,'Verzaaien',1434625664,30,3000,NULL,30,20,NULL,'Dit is een opmerking.',1,'Dit is een label'),
(58,46,43,'Verzaaien',1434625978,30,3000,NULL,30,20,NULL,'Dit is een opmerking.',1,'Dit is een label'),
(59,NULL,NULL,'Verzaaien',1686693600,400,40000,NULL,300,200,NULL,'Dit is weer een opmerking.',1,'monster'),
(60,NULL,NULL,'Vissen voor veiling',1433368800,400,40000,NULL,300,200,NULL,'edrftgh',1,'hijhbhj'),
(61,NULL,NULL,'Vissen voor veiling',1433368800,500,50000,NULL,300,200,NULL,'fegegsg',1,'fgsrhbe'),
(62,NULL,NULL,'Vissen voor veiling',1433368800,500,50000,NULL,300,200,NULL,'fegegsg',1,'fgsrhbe'),
(63,NULL,NULL,'Vissen voor veiling',1433368800,500,50000,NULL,300,200,NULL,'fegegsg',1,'fgsrhbe'),
(64,NULL,NULL,'Vissen voor veiling',1433368800,500,50000,NULL,300,200,NULL,'fegegsg',1,'fgsrhbe'),
(65,NULL,NULL,'Leegvissen',1433973600,400,40000,NULL,300,200,NULL,'sadsadas',1,'htrfnt'),
(66,NULL,NULL,'Leegvissen',1433973600,400,40000,NULL,300,200,NULL,'sadsadas',1,'htrfnt'),
(67,NULL,NULL,'Leegvissen',1433973600,400,40000,NULL,300,200,NULL,'sadsadas',1,'htrfnt'),
(68,54,46,'Verzaaien',1686693600,400,40000,NULL,300,200,NULL,'Dit is weer een opmerking.',1,'monster'),
(69,NULL,NULL,'Vissen voor veiling',1465941600,400,40000,NULL,300,200,NULL,'Dit is weer een opmerking.',1,'monstertje'),
(70,NULL,NULL,'Vissen voor veiling',1434060000,100,10000,NULL,300,200,NULL,'sadasdas',1,'fhghnhhg'),
(71,NULL,NULL,'Vissen voor veiling',1434060000,100,10000,NULL,300,200,NULL,'sadasdas',1,'fhghnhhg'),
(72,NULL,NULL,'Vissen voor veiling',1434060000,100,10000,NULL,300,200,NULL,'sadasdas',1,'fhghnhhg'),
(73,NULL,NULL,'Leegvissen',1465941600,400,40000,NULL,300,200,NULL,'Dit is weer een opmerking.',1,'monstertje'),
(74,72,65,'Vissen voor veiling',1434060000,100,10000,NULL,300,200,NULL,'sadasdas',1,'fhghnhhg'),
(75,72,65,'Vissen voor veiling',1434060000,100,10000,NULL,300,200,NULL,'sadasdas',1,'fhghnhhg'),
(76,51,43,'Leegvissen',1434146400,20,2000,NULL,20,20,NULL,'testerdetest',1,'testerdetest'),
(77,NULL,NULL,'Verzaaien',1434146400,400,40000,NULL,300,200,NULL,'sasagrgert',1,'Hallo'),
(78,NULL,NULL,'Verzaaien',1434146400,400,40000,NULL,300,200,NULL,'sasagrgert',1,'Hallo'),
(79,NULL,NULL,'Verzaaien',1434146400,400,40000,NULL,300,200,NULL,'sasagrgert',1,'Hallo'),
(80,72,65,'Verzaaien',1434146400,400,40000,NULL,300,200,NULL,'sasagrgert',1,'Hallo'),
(81,NULL,NULL,'Verzaaien',1432764000,300,30000,NULL,100,200,NULL,'sfsegbvwcsd',1,'feh'),
(82,NULL,NULL,'Verzaaien',1432764000,300,30000,NULL,100,200,NULL,'sfsegbvwcsd',1,'feh'),
(83,81,79,'Verzaaien',1433973600,2,200,NULL,20,20,NULL,'Hallo',1,'5'),
(84,NULL,NULL,'Verzaaien',1432764000,300,30000,NULL,100,200,NULL,'sfsegbvwcsd',1,'feh'),
(85,NULL,NULL,'Verzaaien',1433455200,400,40000,NULL,300,200,NULL,'sadsafw',1,'egh5ty'),
(86,NULL,NULL,'Verzaaien',1433455200,400,40000,NULL,300,200,NULL,'sadsafw',1,'egh5ty'),
(87,NULL,NULL,'Verzaaien',1433455200,400,40000,NULL,300,200,NULL,'sadsafw',1,'egh5ty'),
(88,NULL,NULL,'Verzaaien',1433455200,400,40000,NULL,300,200,NULL,'sadsafw',1,'egh5ty'),
(89,NULL,NULL,'Verzaaien',1433455200,400,40000,NULL,300,200,NULL,'sadsafw',1,'egh5ty'),
(90,NULL,NULL,'Verzaaien',1433455200,400,40000,NULL,300,200,NULL,'sadsafw',1,'egh5ty'),
(91,NULL,NULL,'Verzaaien',1433455200,400,40000,NULL,300,200,NULL,'sadsafw',1,'egh5ty'),
(92,NULL,NULL,'Verzaaien',1433282400,400,40000,NULL,300,200,NULL,'dwfegrhtjy',1,'dwfethjykulk'),
(93,NULL,NULL,'Verzaaien',1434146400,400,40000,NULL,300,200,NULL,'cefebegbbe',1,'rergt'),
(94,76,69,'Verzaaien',1434146400,400,40000,NULL,300,200,NULL,'cefebegbbe',1,'rergt'),
(95,NULL,NULL,'Verzaaien',1433455200,330,33000,NULL,300,300,NULL,'fejoenoenbe',1,'fefege'),
(96,NULL,NULL,'Verzaaien',1433455200,330,33000,NULL,300,300,NULL,'fejoenoenbe',1,'fefege'),
(97,76,69,'Verzaaien',1433455200,330,33000,NULL,300,300,NULL,'fejoenoenbe',1,'fefege'),
(98,89,82,'Verzaaien',861753600,400,40000,NULL,300,200,NULL,'Dit is weer een opmerking.',1,'Hallo'),
(99,NULL,NULL,'Verzaaien',861753600,400,40000,NULL,300,200,NULL,'Dit is weer een opmerking.',1,'Hallo'),
(100,NULL,NULL,'Verzaaien',861753600,400,40000,NULL,300,200,NULL,'Dit is weer een opmerking.',1,'Hallo'),
(101,NULL,NULL,'Verzaaien',861753600,400,40000,NULL,300,200,NULL,'Dit is weer een opmerking.',1,'Hallo'),
(102,NULL,NULL,'Verzaaien',861753600,400,40000,NULL,300,200,NULL,'Dit is weer een opmerking.',1,'Hallo'),
(103,76,69,'Verzaaien',861753600,400,40000,NULL,300,200,NULL,'Dit is weer een opmerking.',1,'Hallo'),
(104,72,65,'Verzaaien',861753600,400,40000,NULL,300,200,NULL,'Dit is weer een opmerking.',1,'Hallo'),
(105,72,65,'Verzaaien',861753600,400,40000,NULL,300,200,NULL,'Dit is weer een opmerking.',1,'Hallo'),
(106,NULL,NULL,'Verzaaien',861753600,400,40000,NULL,300,200,NULL,'Dit is weer een opmerking.',1,'Hallo'),
(107,72,85,'Verzaaien',1433541600,400,40000,NULL,300,200,NULL,'dwfeggrhr',0,''),
(108,NULL,NULL,'Verzaaien',861753600,400,40000,NULL,300,200,NULL,'Dit is weer een opmerking.',1,'Hallo'),
(109,79,72,'Verzaaien',861753600,400,40000,NULL,300,200,NULL,'Dit is weer een opmerking.',1,'Hallo'),
(110,NULL,NULL,'Verzaaien',1434060000,400,40000,NULL,300,200,NULL,'Dit is een opmerking.',1,'Dit is een monster.'),
(111,103,86,'Verzaaien',1434060000,400,40000,NULL,300,200,NULL,'Dit is een opmerking.',1,'Dit is een monster.');
/*!40000 ALTER TABLE `oogst` ENABLE KEYS */;
UNLOCK TABLES;
# Dump of table perceel
# ------------------------------------------------------------
DROP TABLE IF EXISTS `perceel`;
CREATE TABLE `perceel` (
`PerceelID` int(11) NOT NULL AUTO_INCREMENT,
`Plaats` varchar(45) NOT NULL,
`Nummer` varchar(10) NOT NULL,
PRIMARY KEY (`PerceelID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
LOCK TABLES `perceel` WRITE;
/*!40000 ALTER TABLE `perceel` DISABLE KEYS */;
INSERT INTO `perceel` (`PerceelID`, `Plaats`, `Nummer`)
VALUES
(1,'AAAA','1'),
(2,'OSWD','109'),
(3,'OSWD','200'),
(5,'HAM','184'),
(6,'Mastgat','22'),
(7,'OSWD','15'),
(8,'HAM','109'),
(9,'HAM','105'),
(10,'OSWD','101'),
(11,'OSWD','100'),
(12,'HAM','89'),
(13,'B','2'),
(14,'C','3'),
(15,'E','5'),
(16,'E','5'),
(17,'Perceeltje','19'),
(18,'Goes','2'),
(19,'534534','26'),
(20,'Goes','143543'),
(21,'.','25'),
(23,'HAMM','186'),
(24,'Test perceel 1000','67'),
(25,'Test perceel 1000','67'),
(26,'OSWD','13');
/*!40000 ALTER TABLE `perceel` ENABLE KEYS */;
UNLOCK TABLES;
# Dump of table vak
# ------------------------------------------------------------
DROP TABLE IF EXISTS `vak`;
CREATE TABLE `vak` (
`VakID` int(11) NOT NULL AUTO_INCREMENT,
`Omschrijving` varchar(45) NOT NULL DEFAULT 'Geheel',
`Oppervlakte` float NOT NULL,
`Perceel_PerceelID` int(11) NOT NULL,
PRIMARY KEY (`VakID`),
KEY `fk_vak_perceel1_idx` (`Perceel_PerceelID`),
CONSTRAINT `fk_vak_perceel1` FOREIGN KEY (`Perceel_PerceelID`) REFERENCES `perceel` (`PerceelID`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
LOCK TABLES `vak` WRITE;
/*!40000 ALTER TABLE `vak` DISABLE KEYS */;
INSERT INTO `vak` (`VakID`, `Omschrijving`, `Oppervlakte`, `Perceel_PerceelID`)
VALUES
(1,'Vak',20,1),
(2,'Geheel',30,1),
(3,'geheel',40,1),
(4,'geheel',50,3),
(5,'Geheel',50,15),
(6,'Geheel',50,16),
(7,'Geheel',120,17),
(8,'Geheel',1400,18),
(9,'Geheel',2,19),
(10,'Geheel',3123,20),
(11,'Geheel',25,21),
(12,'Maakt pudding',2,13),
(14,'Geheel',50,23),
(15,'Geheel',9798,24),
(16,'Vak 1000',398,24),
(17,'Geheel',987,25),
(18,'Vak boven',9798,2),
(19,'Geheel',50,26),
(20,'boven',20,26);
/*!40000 ALTER TABLE `vak` ENABLE KEYS */;
UNLOCK TABLES;
# Dump of table zaaiing
# ------------------------------------------------------------
DROP TABLE IF EXISTS `zaaiing`;
CREATE TABLE `zaaiing` (
`ZaaiingID` int(11) NOT NULL AUTO_INCREMENT,
`Bedrijf_BedrijfID` int(11) NOT NULL,
`Vak_VakID` int(11) NOT NULL,
`Perceel_PerceelID` int(11) NOT NULL,
`Mosselgroep_MosselgroepID` int(11) DEFAULT NULL,
`Activiteit` varchar(45) NOT NULL,
`Datum` int(11) DEFAULT NULL,
`BrutoMton` int(11) DEFAULT NULL,
`Kilogram` int(11) DEFAULT NULL,
`KilogramPerM2` float DEFAULT NULL,
`Bustal` int(11) DEFAULT NULL,
`Monster` tinyint(1) NOT NULL,
`MonsterLabel` varchar(200) DEFAULT NULL,
`Opmerking` varchar(200) NOT NULL,
PRIMARY KEY (`ZaaiingID`),
KEY `fk_zaaiing_bedrijf1_idx` (`Bedrijf_BedrijfID`),
KEY `fk_zaaiing_vak1_idx` (`Vak_VakID`),
KEY `fk_zaaiing_perceel1_idx` (`Perceel_PerceelID`),
KEY `fk_zaaiing_mosselgroep1_idx` (`Mosselgroep_MosselgroepID`),
CONSTRAINT `fk_zaaiing_bedrijf1` FOREIGN KEY (`Bedrijf_BedrijfID`) REFERENCES `bedrijf` (`BedrijfID`) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT `fk_zaaiing_mosselgroep1` FOREIGN KEY (`Mosselgroep_MosselgroepID`) REFERENCES `mosselgroep` (`MosselgroepID`) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT `fk_zaaiing_perceel1` FOREIGN KEY (`Perceel_PerceelID`) REFERENCES `perceel` (`PerceelID`) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT `fk_zaaiing_vak1` FOREIGN KEY (`Vak_VakID`) REFERENCES `vak` (`VakID`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
LOCK TABLES `zaaiing` WRITE;
/*!40000 ALTER TABLE `zaaiing` DISABLE KEYS */;
INSERT INTO `zaaiing` (`ZaaiingID`, `Bedrijf_BedrijfID`, `Vak_VakID`, `Perceel_PerceelID`, `Mosselgroep_MosselgroepID`, `Activiteit`, `Datum`, `BrutoMton`, `Kilogram`, `KilogramPerM2`, `Bustal`, `Monster`, `MonsterLabel`, `Opmerking`)
VALUES
(45,1,2,1,38,'Zaaien',1434625133,30,3000,0.006,20,1,'Dit is een label','Dit is een opmerking.'),
(46,1,3,1,38,'Verzaaien',1434625167,30,3000,0.006,20,1,'Dit is een label','Dit is een opmerking.'),
(47,1,3,1,38,'Verzaaien',1434625352,30,3000,0.006,20,1,'Dit is een label','Dit is een opmerking.'),
(48,1,3,1,38,'Verzaaien',1434625414,30,3000,0.006,20,1,'Dit is een label','Dit is een opmerking.'),
(49,1,3,1,38,'Verzaaien',1434625603,30,3000,0.006,20,1,'Dit is een label','Dit is een opmerking.'),
(50,1,3,1,38,'Verzaaien',1434625664,30,3000,0.006,20,1,'Dit is een label','Dit is een opmerking.'),
(51,1,2,1,43,'Verzaaien',1434625978,30,3000,0.006,20,1,'Dit is een label','Dit is een opmerking.'),
(52,1,2,1,44,'Zaaien',0,400,40000,0.133333,200,1,'Hallo','Dit is weer een opmerking.'),
(53,1,2,1,45,'Zaaien',0,400,40000,0.133333,200,1,'Hallo','Dit is weer een opmerking.'),
(54,8,14,23,46,'Bijzaaien',0,400,40000,0.08,200,1,'monstertje','Dit is weer een opmerking.'),
(55,1,2,1,47,'Zaaien',0,400,40000,0.133333,200,1,'Hallo','Dit is weer een opmerking.'),
(56,1,2,1,48,'Zaaien',0,400,40000,0.133333,200,1,'Hallo','Dit is weer een opmerking.'),
(57,1,3,1,49,'Zaaien',0,400,40000,0.133333,200,1,'Hallo','Dit is weer een opmerking.'),
(58,1,2,1,50,'Zaaien',0,400,40000,0.133333,200,1,'Hallo','Dit is weer een opmerking.'),
(59,1,2,1,51,'Zaaien',0,400,40000,0.133333,200,1,'Hallo','Dit is weer een opmerking.'),
(60,1,2,1,52,'Zaaien',861746400,400,40000,0.133333,200,1,'Hallo','Dit is weer een opmerking.'),
(61,1,2,1,53,'Zaaien',861746400,400,40000,0.133333,200,1,'Hallo','Dit is weer een opmerking.'),
(62,1,2,1,54,'Zaaien',861746400,400,40000,0.133333,200,1,'Hallo','Dit is weer een opmerking.'),
(63,1,2,1,56,'Zaaien',1433973600,400,40000,0.08,200,1,'Hallo','Hallo daar.'),
(64,1,2,1,57,'Zaaien',1433973600,400,40000,0.08,200,1,'Hallo','Hallo daar.'),
(65,1,2,1,58,'Zaaien',1433973600,400,40000,0.08,200,1,'Hallo','Hallo daar.'),
(66,1,2,1,59,'Zaaien',1433973600,400,40000,0.08,200,1,'Hallo','Hallo daar.'),
(67,1,2,1,60,'Zaaien',1433973600,400,40000,0.08,200,1,'Hallo','Hallo daar.'),
(68,1,2,1,61,'Zaaien',1433973600,400,40000,0.08,200,1,'Hallo','Hallo daar.'),
(69,1,2,1,62,'Zaaien',1433973600,400,40000,0.08,200,1,'Hallo','Hallo daar.'),
(70,1,2,1,63,'Zaaien',1433973600,400,40000,0.08,200,1,'Hallo','Hallo daar.'),
(71,1,2,1,64,'Zaaien',1433973600,400,40000,0.08,200,1,'Hallo','Hallo daar.'),
(72,1,1,1,65,'Zaaien',1433973600,400,40000,0.00917431,200,1,'Hallo','fsgeg'),
(73,1,1,1,66,'Zaaien',1433973600,500,50000,0.0114679,200,1,'Hallo','fsgeg'),
(74,1,2,1,67,'Zaaien',1433368800,500,50000,0.0153846,200,1,'fgsrhbe','fegegsg'),
(75,1,2,1,68,'Zaaien',861746400,400,40000,0.133333,200,1,'Hallo','Dit is weer een opmerking.'),
(76,1,1,1,69,'Zaaien',861746400,400,40000,0.133333,200,1,'Hallo','Dit is weer een opmerking.'),
(77,1,2,1,43,'Zaaien',861746400,400,40000,0.133333,200,1,'Hallo','Dit is weer een opmerking.'),
(78,8,14,23,71,'Bijzaaien',1465941600,400,40000,0.08,200,1,'monstertje','Dit is weer een opmerking.'),
(79,1,1,1,72,'Zaaien',1434060000,100,10000,0.0178571,200,1,'fgrshndtm','eaffef'),
(80,1,1,1,73,'Zaaien',861746400,400,40000,0.133333,200,1,'Hallo','Dit is weer een opmerking.'),
(81,2,1,1,74,'Zaaien',1434664800,2,200,0.001,20,1,'4','Hallo'),
(82,8,14,23,75,'Bijzaaien',1465941600,400,40000,0.08,200,1,'monstertje','Dit is weer een opmerking.'),
(83,2,1,1,76,'Zaaien',1434664800,2,200,0.001,30,1,'5','Hallo'),
(85,1,3,1,NULL,'Verzaaien',1433455200,330,33000,0.165,300,1,'fefege','fejoenoenbe'),
(86,1,3,1,69,'Verzaaien',1433455200,330,33000,0.165,300,1,'fefege','fejoenoenbe'),
(87,1,2,1,80,'Zaaien',1432504800,674,67400,0.00857506,876,1,'Blabla label','jlshd'),
(88,1,2,1,81,'Zaaien',1432504800,674,67400,0.00857506,876,1,'Blabla label','jlshd'),
(89,1,1,1,82,'Bijzaaien',1434060000,7997,799700,0.0891527,654,1,'asoihsdFIH;isdhf;','Opmerking isufdoidsuf'),
(90,8,14,23,83,'Zaaien',1433973600,45,4500,0.00671642,45,1,'Labeltje','Geen'),
(91,2,8,18,84,'Zaaien',1433887200,1,100,0.001,1,0,'','nope'),
(93,1,3,1,NULL,'Verzaaien',861753600,400,40000,0.133333,200,1,'Hallo','Dit is weer een opmerking.'),
(94,1,3,1,NULL,'Verzaaien',861753600,400,40000,0.133333,200,1,'Hallo','Dit is weer een opmerking.'),
(95,1,3,1,NULL,'Verzaaien',861753600,400,40000,0.133333,200,1,'Hallo','Dit is weer een opmerking.'),
(96,1,3,1,69,'Verzaaien',861753600,400,40000,0.133333,200,1,'Hallo','Dit is weer een opmerking.'),
(97,1,2,1,NULL,'Verzaaien',861753600,400,40000,0.133333,200,1,'Hallo','Dit is weer een opmerking.'),
(98,1,1,1,NULL,'Verzaaien',861753600,400,40000,0.133333,200,1,'Hallo','Dit is weer een opmerking.'),
(99,1,15,24,NULL,'Verzaaien',861753600,400,40000,0.133333,200,1,'Hallo','Dit is weer een opmerking.'),
(100,1,16,24,85,'Verzaaien',1433541600,400,40000,0.0714286,200,0,'','dwfeggrhr'),
(101,1,16,24,NULL,'Verzaaien',861753600,400,40000,0.133333,200,1,'Hallo','Dit is weer een opmerking.'),
(102,1,16,24,72,'Verzaaien',861753600,400,40000,0.133333,200,1,'Hallo','Dit is weer een opmerking.'),
(103,11,20,26,86,'Zaaien',861746400,400,40000,0.133333,200,1,'Hallo','Dit is weer een opmerking.'),
(104,5,16,24,NULL,'Verzaaien',1434060000,400,40000,0.133333,200,1,'Dit is een monster.','Dit is een opmerking.');
/*!40000 ALTER TABLE `zaaiing` ENABLE KEYS */;
UNLOCK TABLES;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_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 */;
| true |
d900349aa32f72ddbc3cb62f7b62d4b3977b827f | SQL | JuliaSlipchuk/DB-WindowsForm | /SQLQuery1.sql | UTF-8 | 372 | 2.921875 | 3 | [] | no_license | USE BeautySalo
CREATE TABLE ServiceBS
(
ID INT PRIMARY KEY IDENTITY,
FirstName NVARCHAR(100) NOT NULL,
SurName NVARCHAR(200) NOT NULL,
DirectionID INT NOT NULL,
ExhibitNumber INT NOT NULL,
FOREIGN KEY (DirectionID) REFERENCES Category(ID)
)
CREATE TABLE Category
(
ID INT PRIMARY KEY IDENTITY,
NameC NVARCHAR(150) NOT NULL,
DescriptionC NVARCHAR(250) NOT NULL
) | true |
9be8dfbd2c64f8bbec1f4c21a3e3ca7ce6362459 | SQL | JasmineBreeze/ToDoBackend | /todos_db.sql | UTF-8 | 2,017 | 2.859375 | 3 | [] | no_license | -- MySQL dump 10.13 Distrib 8.0.18, for osx10.14 (x86_64)
--
-- Host: techreturnersdb.c51zfs9re5y0.eu-west-1.rds.amazonaws.com Database: todos
-- ------------------------------------------------------
-- Server version 5.7.26-log
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!50503 SET NAMES utf8mb4 */;
/*!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 */;
SET @MYSQLDUMP_TEMP_LOG_BIN = @@SESSION.SQL_LOG_BIN;
SET @@SESSION.SQL_LOG_BIN= 0;
--
-- GTID state at the beginning of the backup
--
SET @@GLOBAL.GTID_PURGED=/*!80000 '+'*/ '';
--
-- Table structure for table `Task`
--
DROP TABLE IF EXISTS `Task`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `Task` (
`edit` tinyint(1) DEFAULT NULL,
`dateDue` date DEFAULT NULL,
`item` varchar(255) DEFAULT NULL,
`userId` int(11) DEFAULT NULL,
`id` int(11) NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`id`),
KEY `userId` (`userId`),
CONSTRAINT `Task_ibfk_1` FOREIGN KEY (`userId`) REFERENCES `User` (`UserId`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `Task`
--
LOCK TABLES `Task` WRITE;
/*!40000 ALTER TABLE `Task` DISABLE KEYS */;
INSERT INTO `Task` VALUES (0,'2020-02-19','Buy mums bday present',NULL,1),(0,'2020-02-19','Do Washing',2,3),(0,'2020-03-19','Cook Dinner',3,4),(0,'2020-03-22','Go Shopping',1,5),(NULL,NULL,'Cook Lunch',NULL,6);
/*!40000 ALTER TABLE `Task` ENABLE KEYS */;
UNLOCK TABLES;
| true |
4fddd8c621e28ec5a8afc151685737bd9ce82b40 | SQL | bhavsarvishwa/DreamHome | /sql/property_types.sql | UTF-8 | 565 | 2.984375 | 3 | [] | no_license |
DROP TABLE IF EXISTS property_types;
CREATE TABLE property_types(
value INT PRIMARY KEY,
property VARCHAR(30) NOT NULL
);
ALTER TABLE property_types OWNER TO group17_admin;
INSERT INTO property_types (value, property) VALUES (1, 'Detached ');
INSERT INTO property_types (value, property) VALUES (2, 'Townhouse');
INSERT INTO property_types (value, property) VALUES (4, 'Bungalow');
INSERT INTO property_types (value, property) VALUES (8, 'Semi-Detached');
INSERT INTO property_types (value, property) VALUES (16, 'Cottage');
SELECT * FROM property_types;
| true |
efda36e92b64643bd4b14e564a058f2e3675d269 | SQL | XingXing2019/LeetCode | /Database/LeetCode 1193 - MonthlyTransactionsI/MonthlyTransactionsI_SQLServer.sql | UTF-8 | 312 | 3.734375 | 4 | [] | no_license | SELECT LEFT(trans_date, 7) AS month, country,
COUNT(*) AS trans_count,
SUM(CASE state WHEN 'approved' THEN 1 ELSE 0 END) AS approved_count,
SUM(amount) AS trans_total_amount,
SUM(CASE state WHEN 'approved' THEN amount ELSE 0 END) AS approved_total_amount
FROM transactions GROUP BY country, LEFT(trans_date, 7); | true |
d9cbe17dfdbd360ca2f5021d59d217fbc8117db7 | SQL | OscarAnza/Sistema-de-Informacion | /Base de datos de Pedidos.sql | UTF-8 | 2,146 | 3.546875 | 4 | [] | no_license | -- MySQL Script generated by MySQL Workbench
-- Sat Jun 2 20:44:09 2018
-- Model: New Model Version: 1.0
-- 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
-- -----------------------------------------------------
-- -----------------------------------------------------
-- Table `Clientes`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `Clientes` (
`idCliente` INT NOT NULL AUTO_INCREMENT,
`Nombre` VARCHAR(45) NULL,
`Direccion` VARCHAR(45) NULL,
`Email` VARCHAR(45) NULL,
`Telefono` VARCHAR(45) NULL,
PRIMARY KEY (`idCliente`))
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `Productos`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `Productos` (
`idProducto` INT NOT NULL AUTO_INCREMENT,
`Nombre` VARCHAR(45) NULL,
`Precio` INT NULL,
`Descripcion` VARCHAR(45) NULL,
PRIMARY KEY (`idProducto`))
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `Pedidos`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `Pedidos` (
`idPedido` INT NOT NULL AUTO_INCREMENT,
`Fecha` DATE NULL,
`idCliente` INT NOT NULL,
`idProducto` INT NOT NULL,
`Cantidad` INT NULL,
PRIMARY KEY (`idPedido`, `idCliente`, `idProducto`),
INDEX `fk_Pedidos_Clientes_idx` (`idCliente` ASC),
INDEX `fk_Pedidos_Productos1_idx` (`idProducto` ASC),
CONSTRAINT `fk_Pedidos_Clientes`
FOREIGN KEY (`idCliente`)
REFERENCES `Clientes` (`idCliente`)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_Pedidos_Productos1`
FOREIGN KEY (`idProducto`)
REFERENCES `Productos` (`idProducto`)
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 |
c55e2f6401cbf765043f152bfb3ef5be6b27e011 | SQL | AlifyaFebriana/data-analyst-101 | /Progate/sql_dojo_1/page9/exercise2.sql | UTF-8 | 186 | 3.203125 | 3 | [] | no_license | -- dapatkan id dan nama pengguna yang membeli "sandal"
SELECT users.id, users.name
FROM sales_records
JOIN users
ON sales_records.user_id = users.id
WHERE item_id = 18
GROUP BY users.id; | true |
b94dbf5c24c0a764ee1cafb669c3b31a65bdb47f | SQL | patrickwensel/denver-campaign-finance-back-final-staging | /UserManagementApi.DataCore/DBScripts/Schema/Tables/contact.sql | UTF-8 | 1,815 | 3.1875 | 3 | [] | no_license | -- Table: public.contact
-- DROP TABLE public.contact;
CREATE TABLE public.contact
(
contact_id integer NOT NULL DEFAULT nextval('contact_contact_id_seq'::regclass),
contact_type character varying(10) COLLATE pg_catalog."default" NOT NULL,
first_name character varying(150) COLLATE pg_catalog."default",
middle_name character varying(100) COLLATE pg_catalog."default",
last_name character varying(150) COLLATE pg_catalog."default",
org_name character varying(200) COLLATE pg_catalog."default",
address1 character varying(200) COLLATE pg_catalog."default",
address2 character varying(200) COLLATE pg_catalog."default",
city character varying(150) COLLATE pg_catalog."default",
state_code character varying(2) COLLATE pg_catalog."default",
country_code character varying(2) COLLATE pg_catalog."default",
zip character varying(10) COLLATE pg_catalog."default",
email character varying(200) COLLATE pg_catalog."default",
phone character varying(15) COLLATE pg_catalog."default",
occupation character varying(150) COLLATE pg_catalog."default",
voter_id character varying(50) COLLATE pg_catalog."default",
description character varying(150) COLLATE pg_catalog."default",
filerid integer,
status_code character varying(10) COLLATE pg_catalog."default",
created_by character varying(100) COLLATE pg_catalog."default",
created_at date,
updated_by character varying(100) COLLATE pg_catalog."default",
updated_on date,
altphone character varying(500) COLLATE pg_catalog."default",
altemail character varying(500) COLLATE pg_catalog."default",
version_id integer,
CONSTRAINT contact_pkey PRIMARY KEY (contact_id)
)
WITH (
OIDS = FALSE
)
TABLESPACE pg_default;
ALTER TABLE public.contact
OWNER to devadmin; | true |
19d133c47c7f3f5f4cfda65cf58db5bafd85831b | SQL | Direct-Entry-Program-Dulanga/JDBC-Assignmet | /db-script.sql | UTF-8 | 1,641 | 4.1875 | 4 | [] | no_license | DROP DATABASE IF EXISTS DEP_master;
CREATE DATABASE DEP_master;
USE DEP_master;
DROP TABLE IF EXISTS student;
CREATE TABLE student (
id INT PRIMARY KEY AUTO_INCREMENT,
name VARCHAR(50) NOT NULL
);
ALTER TABLE student ADD COLUMN contact VARCHAR(25);
DROP TABLE IF EXISTS contact;
CREATE TABLE contact(
student_id INT NOT NULL,
contact VARCHAR(15) NOT NULL,
CONSTRAINT PRIMARY KEY ( student_id, contact ),
CONSTRAINT fk_contact FOREIGN KEY (student_id) REFERENCES student(id)
);
SELECT * FROM student;
# DELETE FROM student WHERE 1=1;
TRUNCATE student;
DELETE FROM student WHERE true;
ALTER TABLE student AUTO_INCREMENT = 1;
# SELECT * FROM table1, table2 = CROSS JOIN;
SELECT * FROM student, contact;
SELECT * FROM student CROSS JOIN contact;
#INNER JOIN (EQUI JOIN)
SELECT * FROM student INNER JOIN contact ON student.id = contact.student_id;
#RIGHT OUTER JOIN
SELECT * FROM student RIGHT OUTER JOIN contact ON student.id = contact.student_id;
#LEFT OUTER JOIN
SELECT * FROM student LEFT OUTER JOIN contact ON student.id = contact.student_id;
#SELECT * FROM student FULL OUTER JOIN contact;
#UNION
SELECT * FROM student
UNION
SELECT * FROM contact;
SELECT * FROM student LEFT OUTER JOIN contact ON student.id = contact.student_id
UNION
SELECT * FROM student RIGHT OUTER JOIN contact ON student.id = contact.student_id;
# ALTER TABLE contact RENAME COLUMN id TO student_id;
SELECT s.id, s.name, c.contact FROM student s LEFT OUTER JOIN contact c on s.id = c.student_id;
SELECT s.id AS sid, s.name, c.contact FROM student s LEFT OUTER JOIN contact c on s.id = c.student_id; | true |
8e04faa80e7dbfcf478de134b723034c63218a9e | SQL | Joohan-Park/sql | /practice01/연습문제4.sql | UTF-8 | 1,052 | 4.5 | 4 | [] | no_license | --연습문제
--1번
select count(*)
from employees
where salary <(select avg(salary) from employees);
--2번
select employee_id, last_name, salary
from employees
where(department_id, salary)
in (select department_id, max(salary)
from employees group by department_id)
order by salary desc;
--3번
--select sum(salary), job_id from employees group by job_id;
select a.JOB_TITLE,
sum_salary
from jobs a,
(select job_id, sum(salary) as sum_salary from employees group by job_id) b
where a.job_id = b.job_id
order by b.sum_salary desc;
--4번
select a.employee_id,
a.last_name,
a.salary
from employees a
where salary > (select avg(salary) from employees
where department_id = a.department_id);
select a.employee_id,
a.last_name,
a.salary
from employees a, (select department_id, avg(salary) as avg_salary
from employees group by department_id) b
where a.DEPARTMENT_ID = b.department_id
and a.SALARY > b.avg_salary;
| true |
2941d552dcd29aee13e1a07cc9561d470d295177 | SQL | JannatulMorium/Project | /Hotel_Management_System/CODES/Database Table/Server Database Table.sql | UTF-8 | 3,581 | 3.4375 | 3 | [] | no_license | clear screen;
drop table Customer cascade constraints;
drop table Admin cascade constraints;
drop table RoomDetails cascade constraints;
drop table Reservation cascade constraints;
drop table Employee cascade constraints;
drop table Food cascade constraints;
drop table Bill cascade constraints;
create table Customer
(c_id number(2),
name varchar2(6),
mobile integer,
email varchar2(16),
date_of_birth date,
nationality varchar2(12),
city varchar2(10),
primary key(c_id));
create table Admin
(admin_id number(10),
name varchar2(6),
address varchar2(20),
email varchar2(20),
mobile_no integer,
primary key(admin_id));
create table RoomDetails
(roomNo number(20),
roomType varchar2(30),
roomRate integer,
review varchar2(20),
PRIMARY KEY(roomNo));
create table Reservation
(rsrv_no number(10),
c_id number(5),
roomNo number(20),
checkin date,
checkout date,
PRIMARY KEY(rsrv_no),
Foreign KEY(c_id) references Customer(c_id),
Foreign KEY(roomNo) references RoomDetails(roomNo));
create table Employee
(Emp_id number(20),
name varchar2(6),
dutyHour varchar2(20),
roomNo number(20),
PRIMARY KEY(Emp_id));
Foreign KEY(roomNo) references RoomDetails(roomNo));
create table Food
(foodNo number(20),
type varchar2(20),
name varchar2(10),
rate integer,
PRIMARY KEY(foodNo));
create table Bill
(bill_id number(20),
c_id number(5),
roomNo number(20),
amount integer,
paymentStatus varchar2(20),
PRIMARY KEY(bill_id),
Foreign KEY(c_id) references Customer(c_id),
Foreign KEY(roomNo) references RoomDetails(roomNo));
insert into Customer values(1, 'Laboni', 123, 'laboni@gmail.com', '9-Oct-1995', 'Bangladeshi', 'Chittagong');
insert into Customer values(2, 'James', 234, 'james@gmail.com', '11-jan-1990', 'American', 'Chittagong');
insert into Customer values(3, 'Prima', 345, 'prima@gmail.com', '14-Dec-1995', 'Bangladeshi', 'Sylhet');
insert into Customer values(4, 'Kavin', 456, 'kavin@gmail.com', '13-apr-1990', 'American', 'Sylhet');
insert into Customer values(5, 'Sharif', 567, 'sharif@gmail.com', '21-Dec-1991', 'Bangladeshi', 'Dhaka');
insert into Admin values(1, 'Laboni', '27-Azimpur', 'laboni@gmail.com', 298);
insert into Admin values(2, 'Prima', '99-Niketon', 'prima@gmail.com', 876);
insert into Admin values(3, 'Neaz', '20-Bakshibzar', 'neaz@gmail.com', 654);
insert into RoomDetails values(1, 'Standard', 8000, 'Excellent');
insert into RoomDetails values(2, 'Deluxe', 12000, 'Good');
insert into RoomDetails values(3, 'Superior-Deluxe', 14000, 'Excellent');
insert into RoomDetails values(4, 'Junior-Suite', 16000, 'Average');
insert into Reservation values(1, 2, 4, '1-Jan-2018', '6-Jan-2018');
insert into Reservation values(2, 4, 1, '3-March-2018', '6-March-2018');
insert into Reservation values(3, 2, 3, '7-April-2018', '15-April-2018');
insert into Reservation values(4, 5, 2, '10-June-2018', '15-June-2018');
insert into Employee values(1, 'Rahim', '8am-2pm', 2);
insert into Employee values(2, 'Karim', '2pm-8pm', 4);
insert into Employee values(3, 'Abul', '8pm-2am', 1);
insert into Employee values(4, 'Jabbar', '2am-8am', 3);
insert into Food values(1, 'Breakfast', 'Muffin', 200);
insert into Food values(2, 'Lunch', 'Steak', 1000);
insert into Food values(3, 'Lunch', 'Chicken', 300);
insert into Food values(4, 'Dinner', 'Beef', 400);
insert into Bill values(1, 2, 4, 10300, 'Done');
insert into Bill values(2, 4, 1, 25000, 'Done');
insert into Bill values(3, 2, 3, 15200, 'Done');
insert into Bill values(4, 5, 2, 30000, 'Not Done');
commit;
select * from Customer;
select * from Admin;
select * from RoomDetails;
select * from Reservation;
select * from Bill;
select * from Employee;
select * from Food;
| true |
231699ae9f147e4232552b7b806cee8395414ef0 | SQL | QUANWEIRU/ErpOracleLibrary | /Xoa du lieu/Tool xoa giao dich Gui EVN/Code tool xoa du lieu/View/evn_udd_ap_payments_v.sql | UTF-8 | 354 | 2.953125 | 3 | [] | no_license | create view evn_udd_ap_payments_v as
select ac.check_id,
ac.check_number,
ac.description,
ap_checks_pkg.get_posting_status(ac.check_id) as posting_status,
ac.check_date,
c.branch_code
from ap.ap_checks_all ac, FPT_branches_v c
where ac.org_id = c.org_id
and ap_checks_pkg.get_posting_status(ac.check_id) <> 'Y';
| true |
0405d46a0bb8cfd9d756dd29b061b63fe1bf7e40 | SQL | voxelv/sQuire_kw | /Database/02 Create Messages.sql | UTF-8 | 735 | 3.765625 | 4 | [] | no_license |
use squire;
create table Channels (
channelID integer unsigned not null primary key auto_increment,
channelName varchar(30) unique
);
create table Messages (
MID integer unsigned not null primary key auto_increment,
timeSent timestamp,
fromID integer unsigned DEFAULT NULL,
channelID integer unsigned DEFAULT NULL,
messageText varchar(255),
foreign key (fromID) references Users(userID),
foreign key (channelID) references Channels(channelID)
);
create table Subscriptions (
channelID integer unsigned,
userID integer unsigned,
joinTime timestamp,
primary key (channelID, userID),
foreign key (channelID) references Channels(channelID),
foreign key (userID) references Users(userID)
);
| true |
94f41c033d096f828e24d535ffc60e170baa51ca | SQL | redpulse96/Gateway | /db-scripts/external_service_logs.sql | UTF-8 | 635 | 2.578125 | 3 | [] | no_license | CREATE TABLE `external_service_logs` (
`external_service_log_id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`path` varchar(100) COLLATE utf8mb4_bin DEFAULT NULL,
`request_headers` text,
`request_body` text,
`response_code` varchar(100) COLLATE utf8mb4_bin DEFAULT NULL,
`response` text,
`status` varchar(100) COLLATE utf8mb4_bin DEFAULT NULL,
`created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`external_service_log_id`)
) ENGINE=InnoDB DEFAULT AUTO_INCREMENT=1 CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
| true |
af330ec355c60e9c50783aa0cec08bb93125fa9c | SQL | OscOkt021/Praktikum-Pemrograman-Web-dan-Mobile-I | /Modul 3/modul3pemweb.sql | UTF-8 | 3,574 | 3.234375 | 3 | [] | no_license | -- phpMyAdmin SQL Dump
-- version 5.0.2
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Apr 11, 2021 at 07:14 AM
-- Server version: 10.4.14-MariaDB
-- PHP Version: 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 */;
--
-- Database: `modul3pemweb`
--
-- --------------------------------------------------------
--
-- Table structure for table `divisi`
--
CREATE TABLE `divisi` (
`id_divisi` int(3) UNSIGNED ZEROFILL NOT NULL,
`nama_divisi` varchar(50) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `divisi`
--
INSERT INTO `divisi` (`id_divisi`, `nama_divisi`) VALUES
(001, 'IT'),
(002, 'Public Relation'),
(003, 'Finance'),
(004, 'Business Strategy'),
(005, 'Product Development');
-- --------------------------------------------------------
--
-- Stand-in structure for view `info_karyawan`
-- (See below for the actual view)
--
CREATE TABLE `info_karyawan` (
`nama` varchar(50)
,`divisi` varchar(50)
);
-- --------------------------------------------------------
--
-- Table structure for table `karyawan`
--
CREATE TABLE `karyawan` (
`id_karyawan` int(3) UNSIGNED ZEROFILL NOT NULL,
`nama` varchar(50) DEFAULT NULL,
`divisi` int(3) UNSIGNED ZEROFILL DEFAULT NULL,
`Tgl_Lahir` date DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `karyawan`
--
INSERT INTO `karyawan` (`id_karyawan`, `nama`, `divisi`, `Tgl_Lahir`) VALUES
(001, 'Rick', 001, '1998-12-10'),
(002, 'Roll', 001, '1998-02-22'),
(003, 'Ricitas', 002, '1998-09-30'),
(004, 'Richman', 003, '1992-10-23'),
(005, 'Amin', 003, '1999-11-10'),
(006, 'Elon', 004, '1997-12-12'),
(007, 'Musk', 004, '1997-12-12'),
(008, 'Ricardo', 005, '1992-12-25'),
(009, 'Milos', 005, '1992-12-25'),
(010, 'Herp', 001, '2001-01-01'),
(018, 'Samir', 001, '1998-12-02'),
(019, 'Abdul', 004, '1987-07-14'),
(020, 'Sarukh', 004, '2002-12-11');
-- --------------------------------------------------------
--
-- Structure for view `info_karyawan`
--
DROP TABLE IF EXISTS `info_karyawan`;
CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `info_karyawan` AS (select `k`.`nama` AS `nama`,`d`.`nama_divisi` AS `divisi` from (`karyawan` `k` join `divisi` `d`) where `k`.`divisi` = `d`.`id_divisi`) ;
--
-- Indexes for dumped tables
--
--
-- Indexes for table `divisi`
--
ALTER TABLE `divisi`
ADD PRIMARY KEY (`id_divisi`);
--
-- Indexes for table `karyawan`
--
ALTER TABLE `karyawan`
ADD PRIMARY KEY (`id_karyawan`),
ADD KEY `divisi` (`divisi`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `divisi`
--
ALTER TABLE `divisi`
MODIFY `id_divisi` int(3) UNSIGNED ZEROFILL NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;
--
-- AUTO_INCREMENT for table `karyawan`
--
ALTER TABLE `karyawan`
MODIFY `id_karyawan` int(3) UNSIGNED ZEROFILL NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=22;
--
-- Constraints for dumped tables
--
--
-- Constraints for table `karyawan`
--
ALTER TABLE `karyawan`
ADD CONSTRAINT `karyawan_ibfk_1` FOREIGN KEY (`divisi`) REFERENCES `divisi` (`id_divisi`);
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 |
683c51dca2511f434a0cb1351f581a8932e79318 | SQL | nocturaf/rc-practice-backend | /sql/tokopedia_remote_config.sql | UTF-8 | 325 | 2.765625 | 3 | [] | no_license | CREATE TABLE public.users (
id serial NOT NULL,
first_name character varying(255) NOT NULL,
last_name character varying(255),
email character varying(255) NOT NULL,
password text NOT NULL,
CONSTRAINT users_pkey PRIMARY KEY (id),
CONSTRAINT email_unique UNIQUE (email)
)
WITH (
OIDS = FALSE
); | true |
46c7ac25d9ceb612ab025582c94ba02bf88103df | SQL | kradwhite/migration | /tests/_data/my.sql | UTF-8 | 1,965 | 2.96875 | 3 | [] | no_license | DROP TABLE IF EXISTS `migrations-create-table`;
DROP TABLE IF EXISTS `migrations-load`;
DROP TABLE IF EXISTS `migrations-add`;
DROP TABLE IF EXISTS `migrations-remove-by-id`;
DROP TABLE IF EXISTS `command-table`;
DROP TABLE IF EXISTS `command-migrate`;
DROP TABLE IF EXISTS `command-rollback`;
CREATE TABLE `migrations-load`
(
`id` BIGINT PRIMARY KEY AUTO_INCREMENT NOT NULL,
`name` VARCHAR(256) NOT NULL,
`date` TIMESTAMP NOT NULL
);
INSERT INTO `migrations-load` (`name`, `date`)
VALUES ('init', '2019-01-01 23:00:00'),
('name 1', '2019-01-01 23:00:00'),
('name 2', '2019-01-01 23:00:00');
CREATE TABLE `migrations-add`
(
`id` BIGINT PRIMARY KEY AUTO_INCREMENT NOT NULL,
`name` VARCHAR(256) NOT NULL,
`date` TIMESTAMP NOT NULL
);
CREATE TABLE `migrations-remove-by-id`
(
`id` BIGINT PRIMARY KEY AUTO_INCREMENT NOT NULL,
`name` VARCHAR(256) NOT NULL,
`date` TIMESTAMP NOT NULL
);
INSERT INTO `migrations-remove-by-id`(`name`, `date`)
VALUES ('init', '2019-01-01 23:00:00'),
('name 1', '2019-01-01 23:00:00'),
('name 2', '2019-01-01 23:00:00');
CREATE TABLE `command-migrate`
(
`id` BIGINT PRIMARY KEY AUTO_INCREMENT NOT NULL,
`name` VARCHAR(256) NOT NULL,
`date` TIMESTAMP NOT NULL
);
INSERT INTO `migrations-remove-by-id`(`name`, `date`)
VALUES ('init', '2019-01-01 23:00:00');
CREATE TABLE `command-rollback`
(
`id` BIGINT PRIMARY KEY AUTO_INCREMENT NOT NULL,
`name` VARCHAR(256) NOT NULL,
`date` TIMESTAMP NOT NULL
);
INSERT INTO `command-rollback`(`name`, `date`)
VALUES ('init', '2019-01-01 23:00:00'),
('_2019_01_01__00_00_00__first_1', '2019-01-01 00:00:00'),
('_2020_01_02__00_00_00__second_2', '2019-01-02 00:00:00'); | true |
9ee64c4dce536f81ca7cd8681abaf8d791e5f48e | SQL | sumitgupta19/Aws_Migration | /Automation_pyScripts/param/EventTypeCategoryDim.sql | UTF-8 | 282 | 2.59375 | 3 | [] | no_license | select
EventTypeCategoryDimKey
,SummaryCategory
,DetailCategory
,IsNull(Convert(VARCHAR(24),EffectiveFrom,120),'Null')
,IsNull(Convert(VARCHAR(24),EffectiveTo,120),'Null')
,EventClass
from Marketing.tblEventTypeCategoryDim
where EventTypeCategoryDimKey between -1 and 70
order by 1
| true |
c2c158124740c92b596fd942ca8432d62fc54978 | SQL | probro899/probro | /packages/server/build/db/migrations/0011-addCardAttachmentAndTangTable.sql | UTF-8 | 340 | 3.0625 | 3 | [] | no_license | --Up
ALTER TABLE BoardColumnCard ADD COLUMN Deadline INTEGER;
CREATE TABLE IF NOT EXISTS BoardColumnCardTag(
id INTEGER PRIMARY KEY,
tag TEXT NOT NULL,
boardColumnCardId INTEGER NOT NULL,
--CONSTRAINTS
CONSTRAINT BoardColumnCardTag_fk_boardColumnCardId FOREIGN KEY (boardColumnCardId) REFERENCES BoardColumnCard(id)
);
-- Down
| true |
976277015769265be51d8703b5eee2ee16d0fd88 | SQL | AlexBoeira/MigradorUnicooTotvs | /Progress/migracao/_scripts_migracao_gps/setar_NR_PROPOSTA_e_CD_USUARIO_em_IMPORT_BNFCIAR.sql | UTF-8 | 1,046 | 3.28125 | 3 | [] | no_license | --preencher NR_PROPOSTA e CD_USUARIO (NUM_LIVRE_6) em IMPORT_BNFCIAR
declare
ct_codigo number := 0;
ult_contrato number := 0;
begin
for x in (select ip.num_livre_10, ib.nr_contrato_antigo, ib.progress_recid from import_propost ip, import_bnfciar ib
where ib.nr_contrato_antigo = ip.nr_contrato_antigo order by ib.nr_contrato_antigo, ib.cd_grau_parentesco) loop
if ult_contrato <> x.nr_contrato_antigo then
ult_contrato := x.nr_contrato_antigo;
ct_codigo := 0;
end if;
ct_codigo := ct_codigo + 1;
update import_bnfciar ib set ib.nr_proposta = x.num_livre_10,
ib.num_livre_6 = ct_codigo
where ib.progress_recid = x.progress_recid;
end loop;
end;
--select distinct num_livre_6 from import_bnfciar
--select ib.cd_modalidade, ib.nr_proposta, ib.num_livre_6 from import_bnfciar ib order by ib.cd_modalidade, ib.nr_proposta, ib.num_livre_6
--select * from import_bnfciar ib where ib.cd_modalidade = 0
| true |
038c984c811ee42ede1a0f39dd53be3d0386da04 | SQL | wikimedia/labs-tools-connectivity | /isolated/iwikispy.sql | UTF-8 | 21,382 | 3.3125 | 3 | [] | no_license | --
-- Authors: [[:ru:user:Mashiah Davidson]]
--
-- Caution: PROCEDUREs defined here may have output designed for handle.sh.
--
-- Shared procedures: inter_langs
--
-- <pre>
############################################################
delimiter //
#
# Prepare interwiki based linking suggestions for one language
#
DROP PROCEDURE IF EXISTS inter_lang//
CREATE PROCEDURE inter_lang( dbname VARCHAR(32), language VARCHAR(16), mlang VARCHAR(16) )
BEGIN
DECLARE st VARCHAR(255);
DECLARE prefix VARCHAR(32);
DECLARE cnt INT;
DECLARE mlang10 VARCHAR(10);
DECLARE language10 VARCHAR(10);
SELECT CONCAT( ':: echo .', language, ' . ' ) INTO prefix;
SET language10=SUBSTRING( language FROM 1 FOR 10 );
#
# How many pages do link interwiki partners of our isolates.
#
# Note: Of course, we do not need too much of suggestions, thus
# the amount of links selected is limited here by 524'288;
#
SET @st=CONCAT( 'INSERT INTO liwl (fr, t) SELECT /* SLOW_OK */ pl_from as fr, id as t FROM ', dbname, ".pagelinks, iwl WHERE pl_title=title and pl_namespace=0 and lang='", language10, "' LIMIT 524288;" );
PREPARE stmt FROM @st;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SELECT count(*) INTO @cnt
FROM liwl;
SELECT CONCAT( prefix, @cnt, " links to isolate's interwikis found" );
IF @cnt>0
THEN
SET mlang10=SUBSTRING( mlang FROM 1 FOR 10 );
SET @st=CONCAT( 'INSERT INTO rinfo (fr, page_is_redirect, page_title, t) SELECT fr, page_is_redirect, page_title, t FROM ', dbname, '.page, liwl WHERE page_id=fr GROUP BY fr;' );
PREPARE stmt FROM @st;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SELECT CONCAT( prefix, count(*), ' existent pages link interwiki partners' )
FROM rinfo;
#
# We need no interwikified redirects for suggestion tool.
#
DELETE liwl
FROM liwl,
rinfo
WHERE page_is_redirect=1 and
rinfo.fr=liwl.fr;
SELECT CONCAT( prefix, count(*), " links to isolate's interwikis after redirects cleanup" )
FROM liwl;
SET @st=CONCAT( 'INSERT INTO liwl (fr, t) SELECT pl_from as fr, t FROM ', dbname, '.pagelinks, rinfo WHERE page_is_redirect=1 and pl_title=page_title and pl_namespace=0;' );
PREPARE stmt FROM @st;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SELECT CONCAT( prefix, count(*), " links to isolate's interwikis after redirects seaming" )
FROM liwl;
DELETE FROM rinfo;
CALL collect_disambig( dbname, -1, prefix );
#
# No need to suggest disambiguation pages translation.
#
DELETE liwl
FROM liwl,
d
WHERE fr=d_id;
SELECT CONCAT( prefix, count(*), " links to isolate's interwikis after disambiguations cleanup" )
FROM liwl;
DELETE FROM d;
#
# Discard all suggestions on linking from non-zero namespace.
#
SET @st=CONCAT( 'DELETE liwl FROM liwl, ', dbname, '.page WHERE page_id=fr AND page_namespace!=0;' );
PREPARE stmt FROM @st;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SELECT count(*) INTO @cnt
FROM liwl;
SELECT CONCAT( prefix, @cnt, " links to isolate's interwikis from zero namespace" );
SET @st=CONCAT( "INSERT INTO res (suggestn, id, lang) SELECT /* SLOW_OK */ REPLACE(ll_title,' ','_') as suggestn, t as id, '", language,"' as lang FROM ", dbname, ".langlinks, liwl WHERE fr=ll_from and ll_lang='", mlang10, "';" );
PREPARE stmt FROM @st;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SELECT CONCAT( prefix, count(DISTINCT id), ' isolates could be linked based on interwiki' )
FROM res
WHERE lang=language;
SET @st=CONCAT( 'DELETE liwl FROM ', dbname, ".langlinks, liwl WHERE fr=ll_from and ll_lang='", mlang10, "';" );
PREPARE stmt FROM @st;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SELECT count(*) INTO @cnt
FROM liwl;
SELECT CONCAT( prefix, @cnt, " links to isolate's interwikis after exclusion of already translated" );
SET @st=CONCAT( "INSERT INTO tres (suggestn, id, lang) SELECT page_title as suggestn, t as id, '", language, "' as lang FROM ", dbname, '.page, liwl WHERE page_id=fr and page_namespace=0;' );
PREPARE stmt FROM @st;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
DELETE FROM liwl;
SELECT CONCAT( prefix, count(DISTINCT id), ' isolates could be linked with main namespace pages translation' )
FROM tres
WHERE lang=language;
END IF;
END;
//
#
# Creates temporary and output tables for interwiki links analysis
#
DROP PROCEDURE IF EXISTS inter_langs_ct//
CREATE PROCEDURE inter_langs_ct()
BEGIN
DROP TABLE IF EXISTS iwl;
CREATE TABLE iwl (
id int(8) unsigned not null default '0',
title varchar(255) not null default '',
lang varchar(10) not null default '',
KEY (title)
) ENGINE=MEMORY;
DROP TABLE IF EXISTS liwl;
CREATE TABLE liwl (
fr int(8) unsigned not null default '0',
t int(8) unsigned not null default '0',
KEY (fr)
) ENGINE=MEMORY;
DROP TABLE IF EXISTS rinfo;
CREATE TABLE rinfo (
fr int(8) unsigned not null default '0',
page_is_redirect tinyint(1) unsigned not null default '0',
page_title varchar(255) not null default '',
t int(8) unsigned not null default '0',
KEY (page_is_redirect, page_title)
) ENGINE=MEMORY;
DROP TABLE IF EXISTS d;
CREATE TABLE d (
d_id int(8) unsigned not null default '0',
PRIMARY KEY (d_id)
) ENGINE=MEMORY;
DROP TABLE IF EXISTS res;
CREATE TABLE res (
suggestn varchar(255) not null default '',
id int(8) unsigned not null default '0',
lang varchar(16) not null default ''
) ENGINE=MEMORY;
DROP TABLE IF EXISTS tres;
CREATE TABLE tres (
suggestn varchar(255) not null default '',
id int(8) unsigned not null default '0',
lang varchar(16) not null default ''
) ENGINE=MEMORY;
#
# The table just for one row for single value named state.
#
# During any transfer the receiver state is being updated by the sender.
#
DROP TABLE IF EXISTS communication_exchange;
CREATE TABLE communication_exchange (
state int(8) unsigned not null default '0'
) ENGINE=MEMORY;
END;
//
#
# This procedure is being run on the master-host. It infects slave-hosts
# with its code and tables, initialtes transfer of initial data from master to
# slaves.
#
# Prepare interwiki based linking suggestions for isolated articles.
#
DROP PROCEDURE IF EXISTS inter_langs//
CREATE PROCEDURE inter_langs( srv INT )
BEGIN
DECLARE done INT DEFAULT 0;
DECLARE cur_lang VARCHAR(16);
DECLARE cur_db VARCHAR(32);
DECLARE ready INT DEFAULT 0;
DECLARE cur_host VARCHAR(64) DEFAULT '';
DECLARE cur_sv INT DEFAULT 0;
DECLARE dsync INT DEFAULT 0;
DECLARE dcnt INT DEFAULT 0;
DECLARE st VARCHAR(511);
DECLARE res VARCHAR(255) DEFAULT '';
DECLARE cur CURSOR FOR SELECT DISTINCT TRIM(TRAILING '.wikipedia.org' FROM domain), dbname FROM toolserver.wiki, u_mashiah_golem_p.server WHERE family='wikipedia' and is_closed=0 and server=sv_id and host_name=host_for_srv(srv) ORDER BY size DESC;
DECLARE scur CURSOR FOR SELECT host_name, MIN(server) as sv FROM toolserver.wiki, u_mashiah_golem_p.server WHERE family='wikipedia' and is_closed=0 and sv_id=server and host_name!=host_for_srv(srv) GROUP BY host_name ORDER BY sv ASC;
DECLARE CONTINUE HANDLER FOR SQLSTATE '02000' SET done = 1;
SELECT cry_for_memory( 4294967296 ) INTO @res;
IF @res!=''
THEN
SELECT CONCAT( ':: echo ', @res );
END IF;
#
# Infect slave servers with this library code
# and inform them on who is the master.
#
OPEN scur;
SET done = 0;
REPEAT
FETCH scur INTO cur_host, cur_sv;
IF NOT done
THEN
# hope this reduces the amount of mysql connections created
SELECT CONCAT( ':: s', cur_sv, ' init toolserver.sql memory.sql disambig.sql iwikispy.sql' );
END IF;
UNTIL done END REPEAT;
CLOSE scur;
#
# Infect everyone with necessary communication tables.
#
OPEN scur;
SET done = 0;
REPEAT
FETCH scur INTO cur_host, cur_sv;
IF NOT done
THEN
SELECT CONCAT( ':: s', cur_sv, ' call inter_langs_ct' );
END IF;
UNTIL done END REPEAT;
CLOSE scur;
#
# Self-infection.
#
CALL inter_langs_ct();
#
# Prepare interwiki links for isolated articles.
#
SET @st=CONCAT( 'INSERT INTO iwl (id, title, lang) /* SLOW_OK */ SELECT id, REPLACE(ll_title,', "' ','_'", ') as title, ll_lang as lang FROM ', @dbname, '.langlinks, ruwiki0 WHERE id=ll_from;' );
PREPARE stmt FROM @st;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
DELETE FROM iwl
WHERE title='';
SELECT CONCAT( ':: echo ', count(*), ' interwiki links for isolated articles found' )
FROM iwl;
#
# Prior to any transfer we need to escape quote marks.
#
# Note: master host languages may be left as they are due to no transfer.
#
UPDATE iwl
SET title=REPLACE (REPLACE( title, '\\', '\\\\\\' ), '"', '\\"')
WHERE lang IN
(
SELECT SUBSTRING( lang FROM 1 FOR 10 )
FROM toolserver.wiki,
u_mashiah_golem_p.server
WHERE family='wikipedia' and
is_closed=0 and
server=sv_id and
host_name!=host_for_srv(srv)
);
#
# Initiate interwiki transfer to slaves.
#
OPEN scur;
SET done = 0;
REPEAT
FETCH scur INTO cur_host, cur_sv;
IF NOT done
THEN
#
# Table name on the destination slave server to be filled.
#
SELECT CONCAT( ':: s', cur_sv, ' take iwl' );
#
# This query will come back to the master server from
# the outer handler driving transmission to its finish.
#
SELECT CONCAT( ":: s", srv, " give SELECT CONCAT\( '\( \"', id, '\",\"', title, '\",\"', iwl.lang, '\" \)' \) FROM iwl, toolserver.wiki, u_mashiah_golem_p.server WHERE family='wikipedia' and server=sv_id and host_name=host_for_srv\(", cur_sv, "\) and is_closed=0 and iwl.lang=SUBSTRING\(TRIM\(TRAILING \'.wikipedia.org\' FROM domain\) FROM 1 FOR 10\)\;" );
END IF;
UNTIL done END REPEAT;
CLOSE scur;
SELECT CONCAT( ':: echo all transfer issued from s', srv );
#
# Create output tables for res and tres from slaves.
#
OPEN scur;
SET done = 0;
REPEAT
FETCH scur INTO cur_host, cur_sv;
IF NOT done
THEN
SET @st=CONCAT( "DROP TABLE IF EXISTS res_s", cur_sv, ";" );
PREPARE stmt FROM @st;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @st=CONCAT( "CREATE TABLE res_s", cur_sv, " \( suggestn varchar\(255\) not null default '', id int\(8\) unsigned not null default '0', lang varchar\(10\) not null default '' \) ENGINE=MEMORY\;" );
PREPARE stmt FROM @st;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @st=CONCAT( "DROP TABLE IF EXISTS tres_s", cur_sv, ";" );
PREPARE stmt FROM @st;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @st=CONCAT( "CREATE TABLE tres_s", cur_sv, " \( suggestn varchar\(255\) not null default '', id int\(8\) unsigned not null default '0', lang varchar\(10\) not null default '' \) ENGINE=MEMORY\;" );
PREPARE stmt FROM @st;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
UNTIL done END REPEAT;
CLOSE scur;
#
# Call on slaves in parallel threads.
#
# Note: Callee are keeping track on data input sync.
#
OPEN scur;
SET done = 0;
REPEAT
FETCH scur INTO cur_host, cur_sv;
IF NOT done
THEN
SELECT CONCAT( ':: s', cur_sv, ' valu ', @target_lang );
SELECT CONCAT( ':: s', cur_sv, ' prlc inter_langs_slave' );
END IF;
UNTIL done END REPEAT;
CLOSE scur;
#
# Master languages loop
#
OPEN cur;
SET done = 0;
REPEAT
FETCH cur INTO cur_lang, cur_db;
IF NOT done
THEN
CALL inter_lang( cur_db, cur_lang, @target_lang );
END IF;
UNTIL done END REPEAT;
CLOSE cur;
#
# Deinitialize and report on master results.
#
DROP TABLE d;
DROP TABLE rinfo;
DROP TABLE iwl;
DROP TABLE liwl;
DELETE FROM res
WHERE suggestn='';
SELECT CONCAT( ':: echo With use of s', srv, ' ', count(DISTINCT id), ' isolates could be linked based on interwiki' )
FROM res;
SELECT CONCAT( ':: echo With use of s', srv, ' ', count(DISTINCT id), ' isolates could be linked with translation' )
FROM tres;
#
# The expected amount of synchonization events from slave processes.
#
SELECT 2*(count(DISTINCT host_name)-1) INTO dsync
FROM toolserver.wiki,
u_mashiah_golem_p.server
WHERE family='wikipedia' and
is_closed=0 and
server=sv_id;
#
# Looks like an infinite loop, right?
#
# Note: Lines are to be added by slaves when their transfer done.
#
REPEAT
# no more than once per second
SELECT sleep( 1 ) INTO ready;
SELECT count(*) INTO ready
FROM communication_exchange;
UNTIL ready=dsync END REPEAT;
DROP TABLE communication_exchange;
#
# Merging slave results to res and tres
#
OPEN scur;
SET done = 0;
REPEAT
FETCH scur INTO cur_host, cur_sv;
IF NOT done
THEN
SET @st=CONCAT( 'INSERT INTO res (suggestn, id, lang) SELECT suggestn, id, lang FROM res_s', cur_sv, ';' );
PREPARE stmt FROM @st;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @st=CONCAT( 'DROP TABLE res_s', cur_sv, ';' );
PREPARE stmt FROM @st;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SELECT CONCAT( ':: s', cur_sv, ' drop res' );
SET @st=CONCAT( 'INSERT INTO tres (suggestn, id, lang) SELECT suggestn, id, lang FROM tres_s', cur_sv, ';' );
PREPARE stmt FROM @st;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @st=CONCAT( 'DROP TABLE tres_s', cur_sv, ';' );
PREPARE stmt FROM @st;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SELECT CONCAT( ':: s', cur_sv, ' drop tres' );
END IF;
UNTIL done END REPEAT;
CLOSE scur;
SELECT count(*) INTO @dcnt
FROM res;
#
# Discard all suggestions on linking from templated non-articles.
#
DELETE res
FROM res,
iw_filter
WHERE name=suggestn;
DROP TABLE iw_filter;
#
# Discard all suggestions on linking from non-zero namespace.
#
# Note: Non-ucfirst'ed prefixes in interwiki-links are not recognized yet.
#
DELETE res
FROM res,
toolserver.namespacename
WHERE dbname=CONCAT( @target_lang, 'wiki_p') AND
ns_id!=0 AND
ns_type='primary' AND
suggestn like CONCAT( ns_name , ':%' );
#
# Exclude self-links from suggestions. May be there for various reasons.
#
DELETE res
FROM res,
ruwiki0
WHERE res.id=ruwiki0.id and
suggestn=title;
SELECT CONCAT( ':: echo ', @dcnt-count(*), ' linking suggestions discarded as not forming valid links' )
FROM res;
#
# Report and refresh the web
#
SELECT CONCAT( ':: echo Totally, ', count(DISTINCT id), ' isolates could be linked based on interwiki' )
FROM res;
SELECT CONCAT( ':: echo Totally, ', count(DISTINCT id), ' isolates could be linked with translation' )
FROM tres;
#
# Languages by articles to improve and isolates those articles could link.
#
DROP TABLE IF EXISTS nres;
CREATE TABLE nres (
lang varchar(16) not null default '',
a_amnt int(8) unsigned not null default '0',
i_amnt int(8) unsigned not null default '0'
) ENGINE=MEMORY AS
SELECT lang,
count(distinct suggestn) as a_amnt,
count(distinct id) as i_amnt
FROM res
GROUP BY lang;
SELECT CONCAT( ':: echo Totally, ', count(*), ' languages suggest on linking of isolates' )
FROM nres;
ALTER TABLE nres ENGINE=MyiSAM;
DROP TABLE IF EXISTS nisres;
RENAME TABLE nres TO nisres;
#
# Languages by articles to translate and isolates those articles could link.
#
DROP TABLE IF EXISTS ntres;
CREATE TABLE ntres (
lang varchar(16) not null default '',
a_amnt int(8) unsigned not null default '0',
i_amnt int(8) unsigned not null default '0'
) ENGINE=MEMORY AS
SELECT lang,
count(distinct suggestn) as a_amnt,
count(distinct id) as i_amnt
FROM tres
GROUP BY lang;
SELECT CONCAT( ':: echo Totally, ', count(*), ' languages suggest on articles translation for isolates linking' )
FROM ntres;
ALTER TABLE ntres ENGINE=MyiSAM;
DROP TABLE IF EXISTS nistres;
RENAME TABLE ntres TO nistres;
CALL categorystats( 'res', 'sglcatvolume' );
CALL langcategorystats( 'res', 'sglflcatvolume' );
# suggestor refresh
ALTER TABLE res ENGINE=MyISAM;
DROP TABLE IF EXISTS isres;
RENAME TABLE res TO isres;
CALL categorystats( 'tres', 'sgtcatvolume' );
CALL langcategorystats( 'tres', 'sgtflcatvolume' );
DROP TABLE nrcatl0;
ALTER TABLE tres ENGINE=MyISAM;
DROP TABLE IF EXISTS istres;
RENAME TABLE tres TO istres;
# categorizer refresh
DROP TABLE IF EXISTS sglcatvolume0;
RENAME TABLE sglcatvolume TO sglcatvolume0;
DROP TABLE IF EXISTS sgtcatvolume0;
RENAME TABLE sgtcatvolume TO sgtcatvolume0;
DROP TABLE IF EXISTS sglflcatvolume0;
RENAME TABLE sglflcatvolume TO sglflcatvolume0;
DROP TABLE IF EXISTS sgtflcatvolume0;
RENAME TABLE sgtflcatvolume TO sgtflcatvolume0;
CALL actuality( 'lsuggestor' );
CALL actuality( 'tsuggestor' );
END;
//
#
# Prepare interwiki based linking suggestions for isolated articles linked
# from slave languages and push results to the master server.
#
DROP PROCEDURE IF EXISTS inter_langs_slave//
CREATE PROCEDURE inter_langs_slave( snum INT, mlang VARCHAR(16) )
BEGIN
DECLARE mnum INT DEFAULT 0;
DECLARE done INT DEFAULT 0;
DECLARE cur_lang VARCHAR(16);
DECLARE cur_db VARCHAR(32);
DECLARE ready INT DEFAULT 0;
DECLARE cur CURSOR FOR SELECT DISTINCT TRIM(TRAILING '.wikipedia.org' FROM domain), dbname FROM toolserver.wiki, u_mashiah_golem_p.server WHERE family='wikipedia' and server=sv_id and host_name=host_for_srv(snum) and is_closed=0 ORDER BY size DESC;
DECLARE CONTINUE HANDLER FOR SQLSTATE '02000' SET done = 1;
# Convert master language name to master server number
SELECT server_num( mlang ) INTO mnum;
# Looks like an infinite loop, however, a line is to be modified externally
# when transfer done.
REPEAT
# no more than once per second
SELECT sleep( 1 ) INTO ready;
SELECT count(*) INTO ready
FROM communication_exchange;
UNTIL ready=1 END REPEAT;
DROP TABLE communication_exchange;
# slave languages loop
OPEN cur;
REPEAT
FETCH cur INTO cur_lang, cur_db;
IF NOT done
THEN
CALL inter_lang( cur_db, cur_lang, mlang );
END IF;
UNTIL done END REPEAT;
CLOSE cur;
DROP TABLE d;
DROP TABLE rinfo;
DROP TABLE iwl;
DROP TABLE liwl;
DELETE FROM res
WHERE suggestn='';
UPDATE res
SET suggestn=REPLACE( REPLACE( suggestn, '\\', '\\\\\\' ), '"', '\\"');
UPDATE tres
SET suggestn=REPLACE( REPLACE( suggestn, '\\', '\\\\\\' ), '"', '\\"');
SELECT CONCAT( ':: echo With use of s', snum, ' ', count(DISTINCT id), ' isolates could be linked based on interwiki' )
FROM res;
SELECT CONCAT( ':: echo With use of s', snum, ' ', count(DISTINCT id), ' isolates could be linked with translation' )
FROM tres;
SELECT CONCAT( ':: s', mnum, ' take res_s', snum );
SELECT CONCAT( ":: s", snum, " give SELECT DISTINCT CONCAT\( '\(\"', suggestn, '\",\"', id, '\",\"', lang, '\"\)' \) FROM res\;" );
SELECT CONCAT( ':: s', mnum, ' take tres_s', snum );
SELECT CONCAT( ":: s", snum, " give SELECT DISTINCT CONCAT\( '\(\"', suggestn, '\",\"', id, '\",\"', lang, '\"\)' \) FROM tres\;" );
SELECT CONCAT( ':: echo all transfer issued from s', snum );
END;
//
delimiter ;
############################################################
-- </pre>
| true |
938fe46e573abd662b3d9827058780b77272c3fe | SQL | lammia/nhap | /nhahangcuatoi.sql | UTF-8 | 13,954 | 2.8125 | 3 | [] | no_license | -- phpMyAdmin SQL Dump
-- version 4.5.1
-- http://www.phpmyadmin.net
--
-- Host: 127.0.0.1
-- Generation Time: May 25, 2017 at 09:31 AM
-- Server version: 10.1.16-MariaDB
-- PHP Version: 7.0.9
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: `nhahangcuatoi`
--
-- --------------------------------------------------------
--
-- Table structure for table `admin`
--
CREATE TABLE `admin` (
`username` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
`password` varchar(50) COLLATE utf8_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Dumping data for table `admin`
--
INSERT INTO `admin` (`username`, `password`) VALUES
('admin', 'admin');
-- --------------------------------------------------------
--
-- Table structure for table `ban`
--
CREATE TABLE `ban` (
`id_ban` int(2) NOT NULL,
`tenban` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
`soluong` int(2) NOT NULL,
`trangthai` varchar(50) COLLATE utf8_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Dumping data for table `ban`
--
INSERT INTO `ban` (`id_ban`, `tenban`, `soluong`, `trangthai`) VALUES
(1, 'Bàn 1', 10, 'Đã Đặt'),
(2, 'Bàn 2', 9, 'Trống'),
(3, 'Bàn 3', 5, 'Trống'),
(4, 'Bàn 4', 15, 'Trống'),
(5, 'Bàn 5', 12, 'Trống'),
(6, 'Bàn 6', 20, 'Trống'),
(7, 'Bàn 7', 12, 'Trống'),
(8, 'Bàn 8', 11, 'Trống'),
(9, 'Bàn 9', 10, 'Trống'),
(10, 'Bàn 10', 15, 'Trống'),
(11, 'Bàn 11', 12, 'Trống'),
(13, 'Bàn 12', 10, 'Trống'),
(14, 'Bàn 13', 20, 'Trống');
-- --------------------------------------------------------
--
-- Table structure for table `datban`
--
CREATE TABLE `datban` (
`ban` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
`username` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
`hoten` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
`thoigian` time DEFAULT NULL,
`ngaythang` date NOT NULL,
`sdt` int(12) NOT NULL,
`yeucau` varchar(100) COLLATE utf8_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Dumping data for table `datban`
--
INSERT INTO `datban` (`ban`, `username`, `hoten`, `thoigian`, `ngaythang`, `sdt`, `yeucau`) VALUES
('Bàn 1', 'user01', 'Duy Đạt', '00:12:00', '2017-05-25', 1215924015, 'Thêm người bầu bàn');
-- --------------------------------------------------------
--
-- Table structure for table `hinhanh`
--
CREATE TABLE `hinhanh` (
`hinhanh` varchar(200) COLLATE utf8_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Dumping data for table `hinhanh`
--
INSERT INTO `hinhanh` (`hinhanh`) VALUES
('14.jpg'),
('14.jpg'),
('18.jpg'),
('18.jpg');
-- --------------------------------------------------------
--
-- Table structure for table `hoadon`
--
CREATE TABLE `hoadon` (
`id_hoadon` int(50) NOT NULL,
`username` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
`hoten` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
`diachi` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
`ngay` date NOT NULL,
`sdt` int(20) NOT NULL,
`yeucau` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
`tongtientra` int(50) NOT NULL,
`thoigian` time NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Dumping data for table `hoadon`
--
INSERT INTO `hoadon` (`id_hoadon`, `username`, `hoten`, `diachi`, `ngay`, `sdt`, `yeucau`, `tongtientra`, `thoigian`) VALUES
(2, '4', 'Hiển', '192 Nguyễn Lương Bằng', '2017-05-20', 1699999364, 'Thêm Nước Ngọt', 70000, '22:58:36'),
(4, '4', 'Duy Đạt đẹp', '116 Nguyễn Văn Thoại', '2017-05-21', 123, 'Thêm Canh', 290000, '00:38:53'),
(5, '4', 'toàn chó', '192', '2017-05-21', 123, 'Toàn chó', 100000, '10:40:22'),
(6, '4', 'Duy Đạt đẹp trai', '116 Nguyễn Văn Thoại', '2017-05-21', 12, 'Thêm mắm', 120000, '13:58:52'),
(7, 'user01', 'Hiển', '192 Nguyễn Lương Bằng', '2017-05-21', 1699999364, 'Thêm Cơm', 90000, '14:05:17'),
(8, 'user02', 'hien', 'dn', '2017-05-22', 1234567890, 'kun', 407000, '09:27:05'),
(9, 'user02', 'hiển', 'dsfd', '2017-05-22', 12132, '34', 54000, '09:37:37');
-- --------------------------------------------------------
--
-- Table structure for table `hoadontheoid`
--
CREATE TABLE `hoadontheoid` (
`id` int(10) NOT NULL,
`id_hoadon` int(50) NOT NULL,
`tenmonan` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
`soluong` int(10) NOT NULL,
`gia` int(10) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Dumping data for table `hoadontheoid`
--
INSERT INTO `hoadontheoid` (`id`, `id_hoadon`, `tenmonan`, `soluong`, `gia`) VALUES
(6, 2, 'Cháo thịt bằm', 1, 70000),
(7, 4, 'Canh bắp', 2, 30000),
(8, 4, 'Canh cải thịt bò', 1, 100000),
(9, 4, 'Cá chép um chua', 1, 70000),
(10, 4, 'Kem Socola', 1, 30000),
(11, 4, 'Rau câu Dâu Tây', 1, 30000),
(12, 5, 'Chè Thái', 1, 20000),
(13, 5, 'Canh rau củ', 1, 80000),
(14, 6, 'Canh nấm', 1, 40000),
(15, 6, 'Kem Kiwi', 1, 40000),
(16, 6, 'Nộm cà chua', 1, 40000),
(17, 7, 'Canh bắp', 2, 30000),
(18, 7, 'Kem Socola', 1, 30000),
(19, 8, 'Canh bắp', 1, 27000),
(20, 8, 'Canh cải thịt bò', 1, 100000),
(21, 8, 'Rau câu Dâu Tây', 1, 30000),
(22, 8, 'Kem Socola', 1, 30000),
(23, 8, 'Tôm cuộn sốt bơ', 1, 220000),
(24, 9, 'Canh bắp', 2, 27000);
-- --------------------------------------------------------
--
-- Table structure for table `idtam`
--
CREATE TABLE `idtam` (
`id` int(20) NOT NULL,
`id_monan` int(20) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Dumping data for table `idtam`
--
INSERT INTO `idtam` (`id`, `id_monan`) VALUES
(1, 1),
(2, 2),
(3, 11),
(4, 2),
(5, 2),
(6, 38);
-- --------------------------------------------------------
--
-- Table structure for table `khachhang`
--
CREATE TABLE `khachhang` (
`username` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
`password` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
`hoten` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
`diachi` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
`sdt` varchar(11) COLLATE utf8_unicode_ci NOT NULL,
`email` varchar(50) COLLATE utf8_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Dumping data for table `khachhang`
--
INSERT INTO `khachhang` (`username`, `password`, `hoten`, `diachi`, `sdt`, `email`) VALUES
('user01', '123456', 'Duy Đạt đẹp gái', 'Đà nẵng', '0121592401', 'ndat905@gmail.com'),
('user02', 'abc', 'Thị Hiển', 'Quảng Trị', '0935762311', 'hiennguyenthi979@gmail.com'),
('user03', '123456', 'Bin Béo', '25 Ngô Quyề', '012345678', 'abc@gmail.com'),
('user05', '123', 'Hồ Thị Hiển', 'Quảng Bình', '0123123123', 'ndat04080@gmail.com');
-- --------------------------------------------------------
--
-- Table structure for table `monan`
--
CREATE TABLE `monan` (
`id_monan` int(2) NOT NULL,
`id_theloai` int(2) NOT NULL,
`tenmonan` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
`mota` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
`motachitiet` varchar(500) COLLATE utf8_unicode_ci NOT NULL,
`gia` int(6) NOT NULL,
`giamgia` int(2) NOT NULL,
`link` varchar(50) COLLATE utf8_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Dumping data for table `monan`
--
INSERT INTO `monan` (`id_monan`, `id_theloai`, `tenmonan`, `mota`, `motachitiet`, `gia`, `giamgia`, `link`) VALUES
(1, 2, 'Bò nhúng ớt kim chi', 'Thịt bò nguyên chất với kim chi Hàn ', 'Được chiết xuất từ thịt bò tươi nguyên chất kết hợp với nấm kim chi Hàn Quốc mang đến cho khách hàng một hương vị chua cay khó quên', 120000, 10, 'image/monchinh/1.jpg'),
(2, 2, 'Canh cải thịt bò', 'Mang đến hương vị gia truyền', 'Rau cải đặc trưng của miền đất Việt kết hợp với những miếng thịt bò đỏ tươi ngon', 110000, 0, 'image/monchinh/14.jpg'),
(3, 2, 'Cá chép um chua', 'Đặc biệt', 'Thành phần dinh dưỡng cao', 70000, 0, 'image/monchinh/3.jpg'),
(4, 2, 'Cơm chiên Dương Châu', 'Ngon bổ rẻ', 'Thành phần dinh dưỡng cao', 50000, 0, 'image/monchinh/4.jpg'),
(5, 2, 'Cháo trứng hồng đào', 'Rất ngon', 'Rất ngon', 30000, 0, 'image/monchinh/5.jpg'),
(6, 2, 'Bò xào nấm', 'Ngon, giá bình dân', 'Phù hợp', 50000, 0, 'image/monchinh/6.jpg'),
(7, 2, 'Miến gà', 'Thành phần dinh dưỡng cao', 'Ngon, bổ, rẻ', 70000, 0, 'image/monchinh/7.jpg'),
(8, 2, 'Rau muống tôm mực', 'Đặc biệt', 'Ngon, bổ , rẻ', 50000, 0, 'image/monchinh/8.jpg'),
(9, 2, 'Lẩu thập cẩm', 'Đặc biệt của nhà hàng', 'Thành phần dinh dưỡng cao', 150000, 0, 'image/monchinh/m1.jpg'),
(10, 1, 'Canh bắp', 'Ngon', 'Ngon', 30000, 10, 'image/monkhaivi/1.jpg'),
(11, 1, 'Canh nấm', 'Ngon', 'Ngon', 40000, 0, 'image/monkhaivi/2.jpg'),
(12, 1, 'Cháo rêu', 'Ngon, bổ dưỡng', 'Thành phần dinh dưỡng cao', 50000, 0, 'image/monkhaivi/3.jpg'),
(13, 1, 'Cháo thịt bằm', 'Bổ dưỡng', 'Ngon', 70000, 0, 'image/monkhaivi/4.jpg'),
(14, 1, 'Canh rau củ', 'Ngon', 'Ngon', 80000, 0, 'image/monkhaivi/5.jpg'),
(15, 1, 'Nộm tôm thịt', 'Ngon', 'Ngon', 50000, 0, 'image/monkhaivi/6.jpg'),
(16, 1, 'Tôm cuộn mỳ Ý', 'Ngon', 'Bổ dưỡng', 40000, 0, 'image/monkhaivi/7.jpg'),
(17, 1, 'Nộm cà chua', 'Nhiều vitamin C', 'Ngon', 40000, 0, 'image/monkhaivi/8.jpg'),
(18, 3, 'Rau câu cam', 'Ngon', 'Bổ dưỡng', 20000, 10, 'image/trangmieng/1.jpg'),
(19, 3, 'Rau câu Dâu Tây', 'Ngon', 'Ngon, bắt mắt', 30000, 0, 'image/trangmieng/2.jpg'),
(20, 3, 'Chè Thái', 'Ngon', 'Bổ dưỡng', 20000, 0, 'image/trangmieng/3.jpg'),
(21, 3, 'Bánh đa hình', 'Đẹp mắt', 'Ngon', 40000, 0, 'image/trangmieng/4.jpg'),
(22, 3, 'Bánh hỏi', 'Ngon', 'Ngon', 30000, 0, 'image/trangmieng/5.jpg'),
(23, 3, 'Kem Kiwi', 'Mát Lạnh', 'Bổ dưỡng', 40000, 0, 'image/trangmieng/6.jpg'),
(24, 3, 'Chè trôi nước', 'Thơm nồng', 'Ngon', 50000, 0, 'image/trangmieng/7.jpg'),
(25, 3, 'Kem sữa dừa', 'Ngon', 'Mát', 40000, 0, 'image/trangmieng/8.jpg'),
(26, 4, 'Matcha socola', 'Ngon', 'Ngon', 30000, 20, 'image/thucuong/1.jpg'),
(27, 4, 'Soda Trời', 'Ngon', 'Bổ rẻ', 30000, 0, 'image/thucuong/2.jpg'),
(28, 4, 'Kem Socola', 'Ngon', 'Ngon', 30000, 0, 'image/thucuong/3.jpg'),
(29, 4, 'Matcha Trà xanh', 'Ngon', 'Mát', 20000, 0, 'image/thucuong/4.jpg'),
(30, 4, 'Nước ngọt', 'Bình dân', 'Ngon', 10000, 0, 'image/thucuong/5.jpg'),
(31, 4, 'Soda các loại', 'Ngon', 'Bổ dưỡng', 30000, 0, 'image/thucuong/6.jpg'),
(32, 5, 'Bò Hầm Rau Cải Sốt Ngọt', 'Thưởng thức tuyệt vời', 'Không thể cưỡng lại được với hương vị này', 200000, 0, 'image/mondacbiet/1.jpg'),
(33, 5, 'Mỳ sốt cà chua hầm nước sốt ', 'Quá ngon, hấp dẫn', 'Sức hút không thể chối từ', 250000, 0, 'image/mondacbiet/2.jpg'),
(34, 5, 'Tôm cuộn sốt bơ', 'Được chiết xuất từ thiên nhiên', 'Tuyệt vời, bạn không thể ko thưởng thức món này', 220000, 0, 'image/mondacbiet/3.jpg'),
(35, 5, 'Bánh bèo sốt mắm', 'Rất cuốn hút', 'Tuyệt ngon hảo hạng', 200000, 0, 'image/mondacbiet/4.jpg'),
(36, 5, 'Thịt heo xông khói', 'Rất bắt mắt', 'Quá ngon và lôi cuốn', 250000, 0, 'image/mondacbiet/5.jpg'),
(37, 5, 'Sò huyết chêm trứng', 'Ngon và rất bổ dưỡng', 'Là một trong những món ăn ngon nhất của nhà hàng', 250000, 0, 'image/mondacbiet/6.jpg');
-- --------------------------------------------------------
--
-- Table structure for table `theloai`
--
CREATE TABLE `theloai` (
`id_theloai` int(2) NOT NULL,
`tentheloai` varchar(120) COLLATE utf8_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Dumping data for table `theloai`
--
INSERT INTO `theloai` (`id_theloai`, `tentheloai`) VALUES
(1, 'KHAI VỊ'),
(2, 'MÓN CHÍNH'),
(3, 'TRÁNG MIỆNG'),
(4, 'THỨC UỐNG'),
(5, 'ĐẶC BIỆT');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `admin`
--
ALTER TABLE `admin`
ADD PRIMARY KEY (`username`);
--
-- Indexes for table `ban`
--
ALTER TABLE `ban`
ADD PRIMARY KEY (`id_ban`);
--
-- Indexes for table `datban`
--
ALTER TABLE `datban`
ADD PRIMARY KEY (`ban`);
--
-- Indexes for table `hoadon`
--
ALTER TABLE `hoadon`
ADD PRIMARY KEY (`id_hoadon`);
--
-- Indexes for table `hoadontheoid`
--
ALTER TABLE `hoadontheoid`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `idtam`
--
ALTER TABLE `idtam`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `khachhang`
--
ALTER TABLE `khachhang`
ADD PRIMARY KEY (`username`);
--
-- Indexes for table `monan`
--
ALTER TABLE `monan`
ADD PRIMARY KEY (`id_monan`);
--
-- Indexes for table `theloai`
--
ALTER TABLE `theloai`
ADD PRIMARY KEY (`id_theloai`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `ban`
--
ALTER TABLE `ban`
MODIFY `id_ban` int(2) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=15;
--
-- AUTO_INCREMENT for table `hoadon`
--
ALTER TABLE `hoadon`
MODIFY `id_hoadon` int(50) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=10;
--
-- AUTO_INCREMENT for table `hoadontheoid`
--
ALTER TABLE `hoadontheoid`
MODIFY `id` int(10) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=25;
--
-- AUTO_INCREMENT for table `idtam`
--
ALTER TABLE `idtam`
MODIFY `id` int(20) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7;
--
-- AUTO_INCREMENT for table `monan`
--
ALTER TABLE `monan`
MODIFY `id_monan` int(2) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=39;
--
-- AUTO_INCREMENT for table `theloai`
--
ALTER TABLE `theloai`
MODIFY `id_theloai` int(2) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;
/*!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 |
c7a0910aa64a1aa1f3a1bfeb16d42d857e11c301 | SQL | bellmit/dbSmellsData | /data/open-source/extracted_sql/unepwcmc_ProtectedPlanet.sql | UTF-8 | 1,007 | 2.9375 | 3 | [
"MIT"
] | permissive | SELECT count(*) FROM #{std_table_name}
SELECT * FROM #{view_name_point}
SELECT * FROM #{view_name_poly}
SELECT * FROM #{args.table} WHERE continent = '#{regionName}'
SELECT wdpaid FROM poly LIMIT 100 OFFSET 100\" #{filename}
SELECT * FROM #{geometry_tables["polygons"]}
SELECT * FROM <%= original_table_name %>
SELECT * FROM #{std_table_name}
SELECT * FROM #{geometry_tables["point"]}
SELECT * FROM poly LIMIT 200 OFFSET 0\" #{filename}
SELECT * FROM #{source_table}
SELECT the_geom, the_geom_webmercator, wdpaid, marine FROM #{POINTS_TABLE} #{@_wdpa_where_clause(config)} UNION ALL SELECT the_geom, the_geom_webmercator, wdpaid, marine FROM #{POLYGONS_TABLE} #{@_wdpa_where_clause(config)}
SELECT wdpaid FROM poly LIMIT 100 OFFSET 0\" #{filename}
SELECT count(*) FROM #{table}
SELECT * FROM #{table_name}\
SELECT * FROM #{std_table_name} LIMIT #{size} OFFSET #{piece*size} ORDER BY wdpaid
SELECT * FROM somewhere\" #{filename}
SELECT * FROM #{view_name}
SELECT * FROM #{args.table} WHERE iso_3 = '#{iso3}'
| true |
6139e249cb0a3f632bb57c8ac21514678275c951 | SQL | pavel-voinov/oracle-dba-workspace | /scripts/reports/public_synonyms.sql | UTF-8 | 390 | 2.796875 | 3 | [
"MIT"
] | permissive | /*
*/
@@reports.inc
column db_link format a60 heading "Link name"
column synonym_name format a30 heading "Synonym"
column table_name format a30 heading "Object name"
column table_owner format a30 heading "Object owner"
SELECT synonym_name, table_owner, table_name, db_link
FROM dba_synonyms
WHERE owner = 'PUBLIC'
AND instr(synonym_name, '/') = 0 -- exclude java synonyms
ORDER BY 1
/
| true |
eb02272353505a69d6de594d14576d5d4fdda9b8 | SQL | Sathishgreatvines/LiquorWarehouse | /LiquorWarehouseStage_1_0/SFOut/Tables/gvp__RAD__c.sql | UTF-8 | 1,815 | 2.796875 | 3 | [] | no_license | CREATE TABLE [SFOut].[gvp__RAD__c]
(
[Id] char(18) NULL,
IsDeleted varchar(10) NOT null DEFAULT 'false',
Name nvarchar(100) null,
CreatedDate datetime null,
CreatedById char(18) null,
LastModifiedDate datetime null,
LastModifiedById char(18) null,
SystemModstamp datetime null,
LastViewedDate datetime null,
LastReferencedDate datetime null,
gvp__Account__c char(18) NOT null,
gvp__Brand__c nvarchar(100) null,
gvp__Cases_YTD__c decimal(14,2) null,
gvp__Date__c date NOT null,
gvp__Distributor__c char(18) NOT null,
gvp__Item__c char(18) NOT null,
gvp__Label__c nvarchar(100) null,
gvp__Physical_Cases__c DECIMAL(16, 2) null,
gvp__BDN_Created_Date__c date null,
gvp__BDN_Date_Month__c nvarchar(20) null,
gvp__BDN_Date_Year__c varchar(4) null,
gvp__RAD_Key__c NVARCHAR(255),
gvp__Salesman__c char(18) null,
gvp__Source_File__c NVARCHAR(255) null,
gvp__Distributor_Sales_Rep__c nvarchar(255) null,
gvp__Extended_Price_1__c money null,
gvp__Custom_1__c nvarchar(255) null,
gvp__Custom_2__c nvarchar(255) null,
gvp__Custom_Fact_1__c decimal(14,4) null,
gvp__Custom_Fact_2__c decimal(14,4) null,
gvp__Additional_Charge__c money null,
gvp__Deposit__c money null,
gvp__Dist_Inv_Number__c varchar(50) NOT null DEFAULT '',
gvp__Dist_Item_Number__c varchar(30) NOT null DEFAULT '',
gvp__Dist_Sales_Rep_Code__c VARCHAR(30) null,
gvp__Extended_Price_2__c money null,
gvp__Local_Tax__c money null,
gvp__Source_System__c varchar(25) null,
gvp__Account_Team__c varchar(18) null,
gvp__SalesPerson__c varchar(18) null,
gvp__Sales_Team_Division__c varchar(18) null,
[TransactionType] CHAR NULL,
CONSTRAINT [PK_gvp__RAD__c] PRIMARY KEY ([gvp__Distributor__c], [gvp__Account__c], [gvp__Item__c], [gvp__Dist_Inv_Number__c], [gvp__Date__c], gvp__Dist_Item_Number__c, IsDeleted)
)
| true |
2848b647f1e7005fa33e89cbbe933366d01db936 | SQL | landodn/tratamento-vip_dev | /sql-scripts/script.sql | UTF-8 | 5,758 | 2.609375 | 3 | [] | no_license | --tipo usuario
INSERT INTO tipo_usuario(id_tipo_usuario,descricao) VALUES (nextval('tipousuario_sequence'),'CLIENTE');
INSERT INTO tipo_usuario(id_tipo_usuario,descricao) VALUES (nextval('tipousuario_sequence'),'PROFISSIONAL');
INSERT INTO tipo_usuario(id_tipo_usuario,descricao) VALUES (nextval('tipousuario_sequence'),'SALÃO');
INSERT INTO tipo_usuario(id_tipo_usuario,descricao) VALUES (nextval('tipousuario_sequence'),'ADMIN');
--tipo endereco
INSERT INTO tipo_endereco(id_tipo_endereco,descricao) VALUES (nextval('tipoendereco_sequence'),'RESIDENCIAL');
INSERT INTO tipo_endereco(id_tipo_endereco,descricao) VALUES (nextval('tipoendereco_sequence'),'COMERCIAL');
INSERT INTO tipo_endereco(id_tipo_endereco,descricao) VALUES (nextval('tipoendereco_sequence'),'OUTROS');
--tipo telefone
INSERT INTO tipo_telefone(id_tipo_telefone,descricao) VALUES (nextval('tipotelefone_sequence'),'RESIDENCIAL');
INSERT INTO tipo_telefone(id_tipo_telefone,descricao) VALUES (nextval('tipotelefone_sequence'),'COMERCIAL');
INSERT INTO tipo_telefone(id_tipo_telefone,descricao) VALUES (nextval('tipotelefone_sequence'),'CELULAR');
INSERT INTO tipo_telefone(id_tipo_telefone,descricao) VALUES (nextval('tipotelefone_sequence'),'FAX');
--UF
insert into uf (id_uf, sigla, nome, capital) values(nextval('uf_sequence'), 'AC', 'Acre', 'Rio Branco');
insert into uf (id_uf, sigla, nome, capital) values(nextval('uf_sequence'), 'AL', 'Alagoas', 'Maceió');
insert into uf (id_uf, sigla, nome, capital) values(nextval('uf_sequence'), 'AM', 'Amazonas', 'Manaus');
insert into uf (id_uf, sigla, nome, capital) values(nextval('uf_sequence'), 'AP', 'Amapá', 'Macapá');
insert into uf (id_uf, sigla, nome, capital) values(nextval('uf_sequence'), 'BA', 'Bahia', 'Salvador');
insert into uf (id_uf, sigla, nome, capital) values(nextval('uf_sequence'), 'CE', 'Ceará', 'Fortaleza');
insert into uf (id_uf, sigla, nome, capital) values(nextval('uf_sequence'), 'DF', 'Distrito Federal', 'Brasília');
insert into uf (id_uf, sigla, nome, capital) values(nextval('uf_sequence'), 'ES', 'Espírito Santo', 'Vitória');
insert into uf (id_uf, sigla, nome, capital) values(nextval('uf_sequence'), 'GO', 'Goiás', 'Goiânia');
insert into uf (id_uf, sigla, nome, capital) values(nextval('uf_sequence'), 'MA', 'Maranhão', 'São Luís');
insert into uf (id_uf, sigla, nome, capital) values(nextval('uf_sequence'), 'MG', 'Minas Gerais', 'Belo Horizonte');
insert into uf (id_uf, sigla, nome, capital) values(nextval('uf_sequence'), 'MS', 'Mato Grosso do Sul', 'Campo Grande');
insert into uf (id_uf, sigla, nome, capital) values(nextval('uf_sequence'), 'MT', 'Mato Grosso', 'Cuiabá');
insert into uf (id_uf, sigla, nome, capital) values(nextval('uf_sequence'), 'PA', 'Pará', 'Belém');
insert into uf (id_uf, sigla, nome, capital) values(nextval('uf_sequence'), 'PB', 'Paraíba', 'João Pessoa');
insert into uf (id_uf, sigla, nome, capital) values(nextval('uf_sequence'), 'PE', 'Pernambuco', 'Recife');
insert into uf (id_uf, sigla, nome, capital) values(nextval('uf_sequence'), 'PI', 'Piauí', 'Teresina');
insert into uf (id_uf, sigla, nome, capital) values(nextval('uf_sequence'), 'PR', 'Paraná', 'Curitiba');
insert into uf (id_uf, sigla, nome, capital) values(nextval('uf_sequence'), 'RJ', 'Rio de Janeiro', 'Rio de Janeiro');
insert into uf (id_uf, sigla, nome, capital) values(nextval('uf_sequence'), 'RN', 'Rio Grande do Norte', 'Natal');
insert into uf (id_uf, sigla, nome, capital) values(nextval('uf_sequence'), 'RO', 'Rondônia', 'Porto Velho');
insert into uf (id_uf, sigla, nome, capital) values(nextval('uf_sequence'), 'RS', 'Rio Grande do Sul', 'Porto Alegre');
insert into uf (id_uf, sigla, nome, capital) values(nextval('uf_sequence'), 'RR', 'Roraima', 'Boa Vista');
insert into uf (id_uf, sigla, nome, capital) values(nextval('uf_sequence'), 'SC', 'Santa Catarina', 'Florianópolis');
insert into uf (id_uf, sigla, nome, capital) values(nextval('uf_sequence'), 'SE', 'Sergipe', 'Aracaju');
insert into uf (id_uf, sigla, nome, capital) values(nextval('uf_sequence'), 'SP', 'São Paulo', 'São Paulo');
insert into uf (id_uf, sigla, nome, capital) values(nextval('uf_sequence'), 'TO', 'Tocantins', 'Palmas');
--Especialidades
insert into especialidade values (nextval('especialidade_sequence'), 'Manicure', '01:00');
insert into especialidade values (nextval('especialidade_sequence'), 'Cabelereiro', '01:00');
insert into especialidade values (nextval('especialidade_sequence'), 'Pedicure', '01:00');
--Usuario ADMIN
INSERT INTO usuario(id, data_cadastro, login_email, senha, id_tipo_usuario)
VALUES (nextval('usuario_sequence'),now(), 'admin@tratamentovip.com.br', 'root', 1);
-- endereco
insert into endereco (
id_endereco,
bairro,
cep,
cidade,
complemento,
logradouro,
latitude,
longitude,
numero,
regiao,
id_tipo_endereco,
id_uf )
values (nextval('endereco_sequence'),'bairro','cep','cidade','complemento','logradouro',111,111,222,'regiao',1,1)
insert into telefone(id_telefone,ddd,numero,id_tipo_telefone)
values (nextval('telefone_sequence'),11,99999999,1)
--salao
-- primeiro add um usuario para ser o salao e acertar o id de acordo com o inserido
insert into salao_beleza (
cpf_cnpj,
facebook,
horario_abertura,
horario_fechamento,
nome_fantasia,
razao_social,
id,
id_endereco,
web_site)
values ('123456','face',now(),now(),'teste','teste',1,1 ,'www.tratamentovip.com.br' )
--especialidade salao
-- id do salao x id da especialidade
insert into especialidade_salao
( id,
id_especialidade )
values (1,1)
INSERT INTO salao_beleza_telefone(
id, id_telefone)
VALUES (1, 1);
| true |
511e44726a2a1fac45300ce970403b2ae69ff404 | SQL | idrinksprite1234567/outback | /public/api/data/sqldump06042019.sql | UTF-8 | 4,625 | 3.46875 | 3 | [] | no_license | -- phpMyAdmin SQL Dump
-- version 4.8.5
-- https://www.phpmyadmin.net/
--
-- Host: localhost:8889
-- Generation Time: Jun 04, 2019 at 09:14 PM
-- Server version: 5.7.25
-- PHP Version: 7.3.1
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
--
-- Database: `outback`
--
-- --------------------------------------------------------
--
-- Table structure for table `cart`
--
CREATE TABLE `cart` (
`id` int(10) UNSIGNED NOT NULL,
`user_id` int(10) UNSIGNED NOT NULL,
`item_count` mediumint(8) UNSIGNED NOT NULL,
`total_price` bigint(20) UNSIGNED NOT NULL,
`created` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`changed` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Table structure for table `cart_item`
--
CREATE TABLE `cart_item` (
`id` int(10) UNSIGNED NOT NULL,
`cart_id` int(10) UNSIGNED NOT NULL,
`product_id` int(10) UNSIGNED NOT NULL,
`quantity` int(10) UNSIGNED NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Table structure for table `company`
--
CREATE TABLE `company` (
`id` int(10) UNSIGNED NOT NULL,
`company_name` varchar(20) NOT NULL,
`website` varchar(100) NOT NULL,
`number` bigint(20) UNSIGNED DEFAULT NULL,
`headquarter` varchar(50) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Table structure for table `images`
--
CREATE TABLE `images` (
`id` int(10) UNSIGNED NOT NULL,
`product_id` int(10) UNSIGNED NOT NULL,
`url` text NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Table structure for table `product`
--
CREATE TABLE `product` (
`id` int(10) UNSIGNED NOT NULL,
`company` varchar(20) NOT NULL,
`name` varchar(50) NOT NULL,
`price` bigint(20) UNSIGNED NOT NULL,
`category` varchar(20) NOT NULL,
`gender` varchar(5) DEFAULT NULL,
`activity` varchar(15) NOT NULL,
`description` text NOT NULL,
`misc_details` text NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Table structure for table `user`
--
CREATE TABLE `user` (
`id` int(10) UNSIGNED NOT NULL,
`last_name` varchar(20) DEFAULT NULL,
`first_name` varchar(20) NOT NULL DEFAULT 'Guest',
`email` varchar(50) DEFAULT NULL,
`password` varchar(40) DEFAULT NULL,
`token` varchar(40) DEFAULT NULL,
`is_guest` tinyint(1) DEFAULT '1',
`cart_id` mediumint(9) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Table structure for table `user_connection`
--
CREATE TABLE `user_connection` (
`id` int(10) UNSIGNED NOT NULL,
`user_id` int(11) NOT NULL,
`created` datetime NOT NULL,
`token` varchar(40) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Indexes for dumped tables
--
--
-- Indexes for table `cart`
--
ALTER TABLE `cart`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `cartid_userid` (`id`,`user_id`);
--
-- Indexes for table `cart_item`
--
ALTER TABLE `cart_item`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `cart_product` (`cart_id`,`product_id`);
--
-- Indexes for table `company`
--
ALTER TABLE `company`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `images`
--
ALTER TABLE `images`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `product`
--
ALTER TABLE `product`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `user`
--
ALTER TABLE `user`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `user_connection`
--
ALTER TABLE `user_connection`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `cart`
--
ALTER TABLE `cart`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `cart_item`
--
ALTER TABLE `cart_item`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `company`
--
ALTER TABLE `company`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `images`
--
ALTER TABLE `images`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `product`
--
ALTER TABLE `product`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `user`
--
ALTER TABLE `user`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `user_connection`
--
ALTER TABLE `user_connection`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;
| true |
b18bd164a4f08ba37f45e95b8dbe12cdf86ff0ce | SQL | marielle1022/mass_charities_project | /additional_files/population_procedures.sql | UTF-8 | 3,745 | 3.625 | 4 | [] | no_license | /*
* Population procedures
*/
USE mass_nonprofits;
/*
* Procedure to list all populations
*/
DROP PROCEDURE IF EXISTS list_populations;
DELIMITER $$
CREATE PROCEDURE list_populations()
BEGIN
SELECT description FROM populations ORDER BY description asc;
END $$
DELIMITER ;
/*
* Procedure to add a population to the populations table
*/
DROP PROCEDURE IF EXISTS create_population;
DELIMITER $$
CREATE PROCEDURE create_population(IN population_description VARCHAR(255))
BEGIN
DECLARE EXIT HANDLER FOR 1062
BEGIN
SELECT 'This population already exists.' AS error;
END;
INSERT INTO populations(description) VALUES (population_description);
END $$
DELIMITER ;
/*
* Procedure to create age regulations
*/
DROP PROCEDURE IF EXISTS add_pop_ages;
DELIMITER $$
CREATE PROCEDURE add_pop_ages(IN population_description VARCHAR(255), IN minimum_age INT, IN maximum_age INT)
BEGIN
DECLARE population_num INT;
DECLARE EXIT HANDLER FOR 1048
BEGIN
SELECT 'This population does not exist in the database.' AS error;
END;
DECLARE EXIT HANDLER FOR 1062
BEGIN
SELECT 'This population already has an age range.' AS error;
END;
SELECT populationNo INTO population_num FROM populations
WHERE description = population_description;
INSERT INTO populations_age(populationNo, min_age, max_age)
VALUES (population_num, minimum_age, maximum_age);
END $$
DELIMITER ;
/*
* Procedure to create gender regulations
*/
DROP PROCEDURE IF EXISTS add_pop_genders;
DELIMITER $$
CREATE PROCEDURE add_pop_genders(IN population_description VARCHAR(255), IN in_male TINYINT, IN in_female TINYINT,
IN in_nonbinary TINYINT, IN in_transgender TINYINT)
BEGIN
DECLARE population_num INT;
DECLARE EXIT HANDLER FOR 1048
BEGIN
SELECT 'This population does not exist in the database.' AS error;
END;
DECLARE EXIT HANDLER FOR 1062
BEGIN
SELECT 'This population already has defined gender criterion.' AS error;
END;
SELECT populationNo INTO population_num FROM populations
WHERE description = population_description;
INSERT INTO populations_gender(populationNo, male, female, nonbinary, transgender)
VALUES (population_num, in_male, in_female, in_nonbinary, in_transgender);
END $$
DELIMITER ;
/*
* Procedure to create immigrant regulations
*/
DROP PROCEDURE IF EXISTS add_pop_immigrants;
DELIMITER $$
CREATE PROCEDURE add_pop_immigrants(IN population_description VARCHAR(255), IN in_immigrant TINYINT,
IN in_refugee TINYINT, IN in_asylee TINYINT, IN in_undocumented TINYINT)
BEGIN
DECLARE population_num INT;
DECLARE EXIT HANDLER FOR 1048
BEGIN
SELECT 'This population does not exist in the database.' AS error;
END;
SELECT populationNo INTO population_num FROM populations
WHERE description = population_description;
INSERT INTO populations_immigrant(populationNo, immigrant, refugee, asylee, undocumented)
VALUES (population_num, in_immigrant, in_refugee, in_asylee, in_undocumented);
END $$
DELIMITER ;
/*
* Procedure to create sexual orientation regulations
*/
DROP PROCEDURE IF EXISTS add_pop_orientations;
DELIMITER $$
CREATE PROCEDURE add_pop_orientations(IN population_description VARCHAR(255), IN in_gay TINYINT,
IN in_lesbian TINYINT, IN in_bisexual TINYINT, IN in_asexual TINYINT)
BEGIN
DECLARE population_num INT;
DECLARE EXIT HANDLER FOR 1048
BEGIN
SELECT 'This population does not exist in the database.' AS error;
END;
SELECT populationNo INTO population_num FROM populations
WHERE description = population_description;
INSERT INTO populations_sexual_orientation(populationNo, gay, lesbian, bisexual, asexual)
VALUES (population_num, in_gay, in_lesbian, in_bisexual, in_asexual);
END $$
DELIMITER ; | true |
b2b195958e005854a1911348b800618d203f8da7 | SQL | bmkim621/coffee_exam | /Scripts/InsertData.sql | UTF-8 | 466 | 2.59375 | 3 | [] | no_license | insert into product values
('A001', '아메리카노'), ('A002', '카푸치노'),
('A003', '헤이즐넛'), ('A004', '에스프레소'),
('B001', '딸기쉐이크'), ('B002', '후르츠와인'),
('B003', '팥빙수'), ('B004', '아이스초코');
select * from product;
select * from sale;
insert into sale(code, price, saleCnt, marginRate) values
('A001', 4500, 150, 10),
('A002', 3800, 140, 15),
('B001', 5200, 250, 12),
('B002', 4300, 110, 11);
| true |
1d94d78e05f96869a06f5af4bb30f8a19f601b52 | SQL | Shaposhnikov/country-code-to-emoji-flag | /update-table-flags.sql | UTF-8 | 15,630 | 2.84375 | 3 | [
"Apache-2.0"
] | permissive | --
-- Emoji Flags in Your MySQL Database
--
--
-- Copyright 2017 Peter Kahl <peter.kahl@colossalmind.com>
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- <http://www.apache.org/licenses/LICENSE-2.0>
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
--
-- USAGE:
-- Edit table name, column name etc. as needed.
--
ALTER TABLE `countries` ADD COLUMN `flag` varchar(10) CHARACTER SET utf8mb4_bin NOT NULL after `code`;
UPDATE `countries` SET `flag`='🇦🇩' WHERE `code`='ad';
UPDATE `countries` SET `flag`='🇦🇪' WHERE `code`='ae';
UPDATE `countries` SET `flag`='🇦🇫' WHERE `code`='af';
UPDATE `countries` SET `flag`='🇦🇬' WHERE `code`='ag';
UPDATE `countries` SET `flag`='🇦🇮' WHERE `code`='ai';
UPDATE `countries` SET `flag`='🇦🇱' WHERE `code`='al';
UPDATE `countries` SET `flag`='🇦🇲' WHERE `code`='am';
UPDATE `countries` SET `flag`='🇦🇴' WHERE `code`='ao';
UPDATE `countries` SET `flag`='🇦🇷' WHERE `code`='ar';
UPDATE `countries` SET `flag`='🇦🇸' WHERE `code`='as';
UPDATE `countries` SET `flag`='🇦🇹' WHERE `code`='at';
UPDATE `countries` SET `flag`='🇦🇺' WHERE `code`='au';
UPDATE `countries` SET `flag`='🇦🇼' WHERE `code`='aw';
UPDATE `countries` SET `flag`='🇦🇽' WHERE `code`='ax';
UPDATE `countries` SET `flag`='🇦🇿' WHERE `code`='az';
UPDATE `countries` SET `flag`='🇧🇦' WHERE `code`='ba';
UPDATE `countries` SET `flag`='🇧🇧' WHERE `code`='bb';
UPDATE `countries` SET `flag`='🇧🇩' WHERE `code`='bd';
UPDATE `countries` SET `flag`='🇧🇪' WHERE `code`='be';
UPDATE `countries` SET `flag`='🇧🇫' WHERE `code`='bf';
UPDATE `countries` SET `flag`='🇧🇬' WHERE `code`='bg';
UPDATE `countries` SET `flag`='🇧🇭' WHERE `code`='bh';
UPDATE `countries` SET `flag`='🇧🇮' WHERE `code`='bi';
UPDATE `countries` SET `flag`='🇧🇯' WHERE `code`='bj';
UPDATE `countries` SET `flag`='🇧🇲' WHERE `code`='bm';
UPDATE `countries` SET `flag`='🇧🇳' WHERE `code`='bn';
UPDATE `countries` SET `flag`='🇧🇴' WHERE `code`='bo';
UPDATE `countries` SET `flag`='🇧🇶' WHERE `code`='bq';
UPDATE `countries` SET `flag`='🇧🇷' WHERE `code`='br';
UPDATE `countries` SET `flag`='🇧🇸' WHERE `code`='bs';
UPDATE `countries` SET `flag`='🇧🇹' WHERE `code`='bt';
UPDATE `countries` SET `flag`='🇧🇻' WHERE `code`='bv';
UPDATE `countries` SET `flag`='🇧🇼' WHERE `code`='bw';
UPDATE `countries` SET `flag`='🇧🇾' WHERE `code`='by';
UPDATE `countries` SET `flag`='🇧🇿' WHERE `code`='bz';
UPDATE `countries` SET `flag`='🇨🇦' WHERE `code`='ca';
UPDATE `countries` SET `flag`='🇨🇨' WHERE `code`='cc';
UPDATE `countries` SET `flag`='🇨🇩' WHERE `code`='cd';
UPDATE `countries` SET `flag`='🇨🇫' WHERE `code`='cf';
UPDATE `countries` SET `flag`='🇨🇬' WHERE `code`='cg';
UPDATE `countries` SET `flag`='🇨🇭' WHERE `code`='ch';
UPDATE `countries` SET `flag`='🇨🇮' WHERE `code`='ci';
UPDATE `countries` SET `flag`='🇨🇰' WHERE `code`='ck';
UPDATE `countries` SET `flag`='🇨🇱' WHERE `code`='cl';
UPDATE `countries` SET `flag`='🇨🇲' WHERE `code`='cm';
UPDATE `countries` SET `flag`='🇨🇳' WHERE `code`='cn';
UPDATE `countries` SET `flag`='🇨🇴' WHERE `code`='co';
UPDATE `countries` SET `flag`='🇨🇷' WHERE `code`='cr';
UPDATE `countries` SET `flag`='🇨🇺' WHERE `code`='cu';
UPDATE `countries` SET `flag`='🇨🇻' WHERE `code`='cv';
UPDATE `countries` SET `flag`='🇨🇼' WHERE `code`='cw';
UPDATE `countries` SET `flag`='🇨🇽' WHERE `code`='cx';
UPDATE `countries` SET `flag`='🇨🇾' WHERE `code`='cy';
UPDATE `countries` SET `flag`='🇨🇿' WHERE `code`='cz';
UPDATE `countries` SET `flag`='🇩🇪' WHERE `code`='de';
UPDATE `countries` SET `flag`='🇩🇯' WHERE `code`='dj';
UPDATE `countries` SET `flag`='🇩🇰' WHERE `code`='dk';
UPDATE `countries` SET `flag`='🇩🇰' WHERE `code`='dk';
UPDATE `countries` SET `flag`='🇩🇲' WHERE `code`='dm';
UPDATE `countries` SET `flag`='🇩🇴' WHERE `code`='do';
UPDATE `countries` SET `flag`='🇩🇿' WHERE `code`='dz';
UPDATE `countries` SET `flag`='🇪🇨' WHERE `code`='ec';
UPDATE `countries` SET `flag`='🇪🇪' WHERE `code`='ee';
UPDATE `countries` SET `flag`='🇪🇬' WHERE `code`='eg';
UPDATE `countries` SET `flag`='🇪🇭' WHERE `code`='eh';
UPDATE `countries` SET `flag`='🇪🇷' WHERE `code`='er';
UPDATE `countries` SET `flag`='🇪🇸' WHERE `code`='es';
UPDATE `countries` SET `flag`='🇪🇹' WHERE `code`='et';
UPDATE `countries` SET `flag`='🇪🇺' WHERE `code`='eu';
UPDATE `countries` SET `flag`='🇫🇮' WHERE `code`='fi';
UPDATE `countries` SET `flag`='🇫🇯' WHERE `code`='fj';
UPDATE `countries` SET `flag`='🇫🇰' WHERE `code`='fk';
UPDATE `countries` SET `flag`='🇫🇲' WHERE `code`='fm';
UPDATE `countries` SET `flag`='🇫🇴' WHERE `code`='fo';
UPDATE `countries` SET `flag`='🇫🇷' WHERE `code`='fr';
UPDATE `countries` SET `flag`='🇬🇦' WHERE `code`='ga';
UPDATE `countries` SET `flag`='🇬🇧' WHERE `code`='uk';
UPDATE `countries` SET `flag`='🇬🇩' WHERE `code`='gd';
UPDATE `countries` SET `flag`='🇬🇪' WHERE `code`='ge';
UPDATE `countries` SET `flag`='🇬🇫' WHERE `code`='gf';
UPDATE `countries` SET `flag`='🇬🇬' WHERE `code`='gg';
UPDATE `countries` SET `flag`='🇬🇭' WHERE `code`='gh';
UPDATE `countries` SET `flag`='🇬🇮' WHERE `code`='gi';
UPDATE `countries` SET `flag`='🇬🇱' WHERE `code`='gl';
UPDATE `countries` SET `flag`='🇬🇲' WHERE `code`='gm';
UPDATE `countries` SET `flag`='🇬🇳' WHERE `code`='gn';
UPDATE `countries` SET `flag`='🇬🇵' WHERE `code`='gp';
UPDATE `countries` SET `flag`='🇬🇶' WHERE `code`='gq';
UPDATE `countries` SET `flag`='🇬🇷' WHERE `code`='gr';
UPDATE `countries` SET `flag`='🇬🇸' WHERE `code`='gs';
UPDATE `countries` SET `flag`='🇬🇹' WHERE `code`='gt';
UPDATE `countries` SET `flag`='🇬🇺' WHERE `code`='gu';
UPDATE `countries` SET `flag`='🇬🇼' WHERE `code`='gw';
UPDATE `countries` SET `flag`='🇬🇾' WHERE `code`='gy';
UPDATE `countries` SET `flag`='🇭🇰' WHERE `code`='hk';
UPDATE `countries` SET `flag`='🇭🇲' WHERE `code`='hm';
UPDATE `countries` SET `flag`='🇭🇳' WHERE `code`='hn';
UPDATE `countries` SET `flag`='🇭🇷' WHERE `code`='hr';
UPDATE `countries` SET `flag`='🇭🇹' WHERE `code`='ht';
UPDATE `countries` SET `flag`='🇭🇺' WHERE `code`='hu';
UPDATE `countries` SET `flag`='🇮🇩' WHERE `code`='id';
UPDATE `countries` SET `flag`='🇮🇪' WHERE `code`='ie';
UPDATE `countries` SET `flag`='🇮🇱' WHERE `code`='il';
UPDATE `countries` SET `flag`='🇮🇲' WHERE `code`='im';
UPDATE `countries` SET `flag`='🇮🇳' WHERE `code`='in';
UPDATE `countries` SET `flag`='🇮🇴' WHERE `code`='io';
UPDATE `countries` SET `flag`='🇮🇶' WHERE `code`='iq';
UPDATE `countries` SET `flag`='🇮🇷' WHERE `code`='ir';
UPDATE `countries` SET `flag`='🇮🇸' WHERE `code`='is';
UPDATE `countries` SET `flag`='🇮🇹' WHERE `code`='it';
UPDATE `countries` SET `flag`='🇯🇪' WHERE `code`='je';
UPDATE `countries` SET `flag`='🇯🇲' WHERE `code`='jm';
UPDATE `countries` SET `flag`='🇯🇴' WHERE `code`='jo';
UPDATE `countries` SET `flag`='🇯🇵' WHERE `code`='jp';
UPDATE `countries` SET `flag`='🇰🇪' WHERE `code`='ke';
UPDATE `countries` SET `flag`='🇰🇬' WHERE `code`='kg';
UPDATE `countries` SET `flag`='🇰🇭' WHERE `code`='kh';
UPDATE `countries` SET `flag`='🇰🇮' WHERE `code`='ki';
UPDATE `countries` SET `flag`='🇰🇲' WHERE `code`='km';
UPDATE `countries` SET `flag`='🇰🇳' WHERE `code`='kn';
UPDATE `countries` SET `flag`='🇰🇵' WHERE `code`='kp';
UPDATE `countries` SET `flag`='🇰🇷' WHERE `code`='kr';
UPDATE `countries` SET `flag`='🇰🇼' WHERE `code`='kw';
UPDATE `countries` SET `flag`='🇰🇾' WHERE `code`='ky';
UPDATE `countries` SET `flag`='🇰🇿' WHERE `code`='kz';
UPDATE `countries` SET `flag`='🇱🇦' WHERE `code`='la';
UPDATE `countries` SET `flag`='🇱🇧' WHERE `code`='lb';
UPDATE `countries` SET `flag`='🇱🇨' WHERE `code`='lc';
UPDATE `countries` SET `flag`='🇱🇮' WHERE `code`='li';
UPDATE `countries` SET `flag`='🇱🇰' WHERE `code`='lk';
UPDATE `countries` SET `flag`='🇱🇷' WHERE `code`='lr';
UPDATE `countries` SET `flag`='🇱🇸' WHERE `code`='ls';
UPDATE `countries` SET `flag`='🇱🇹' WHERE `code`='lt';
UPDATE `countries` SET `flag`='🇱🇺' WHERE `code`='lu';
UPDATE `countries` SET `flag`='🇱🇻' WHERE `code`='lv';
UPDATE `countries` SET `flag`='🇱🇾' WHERE `code`='ly';
UPDATE `countries` SET `flag`='🇲🇦' WHERE `code`='ma';
UPDATE `countries` SET `flag`='🇲🇨' WHERE `code`='mc';
UPDATE `countries` SET `flag`='🇲🇩' WHERE `code`='md';
UPDATE `countries` SET `flag`='🇲🇪' WHERE `code`='me';
UPDATE `countries` SET `flag`='🇲🇬' WHERE `code`='mg';
UPDATE `countries` SET `flag`='🇲🇭' WHERE `code`='mh';
UPDATE `countries` SET `flag`='🇲🇰' WHERE `code`='mk';
UPDATE `countries` SET `flag`='🇲🇱' WHERE `code`='ml';
UPDATE `countries` SET `flag`='🇲🇲' WHERE `code`='mm';
UPDATE `countries` SET `flag`='🇲🇳' WHERE `code`='mn';
UPDATE `countries` SET `flag`='🇲🇴' WHERE `code`='mo';
UPDATE `countries` SET `flag`='🇲🇵' WHERE `code`='mp';
UPDATE `countries` SET `flag`='🇲🇶' WHERE `code`='mq';
UPDATE `countries` SET `flag`='🇲🇷' WHERE `code`='mr';
UPDATE `countries` SET `flag`='🇲🇸' WHERE `code`='ms';
UPDATE `countries` SET `flag`='🇲🇹' WHERE `code`='mt';
UPDATE `countries` SET `flag`='🇲🇺' WHERE `code`='mu';
UPDATE `countries` SET `flag`='🇲🇻' WHERE `code`='mv';
UPDATE `countries` SET `flag`='🇲🇼' WHERE `code`='mw';
UPDATE `countries` SET `flag`='🇲🇽' WHERE `code`='mx';
UPDATE `countries` SET `flag`='🇲🇾' WHERE `code`='my';
UPDATE `countries` SET `flag`='🇲🇿' WHERE `code`='mz';
UPDATE `countries` SET `flag`='🇳🇦' WHERE `code`='na';
UPDATE `countries` SET `flag`='🇳🇨' WHERE `code`='nc';
UPDATE `countries` SET `flag`='🇳🇪' WHERE `code`='ne';
UPDATE `countries` SET `flag`='🇳🇫' WHERE `code`='nf';
UPDATE `countries` SET `flag`='🇳🇬' WHERE `code`='ng';
UPDATE `countries` SET `flag`='🇳🇮' WHERE `code`='ni';
UPDATE `countries` SET `flag`='🇳🇱' WHERE `code`='nl';
UPDATE `countries` SET `flag`='🇳🇴' WHERE `code`='no';
UPDATE `countries` SET `flag`='🇳🇵' WHERE `code`='np';
UPDATE `countries` SET `flag`='🇳🇷' WHERE `code`='nr';
UPDATE `countries` SET `flag`='🇳🇺' WHERE `code`='nu';
UPDATE `countries` SET `flag`='🇳🇿' WHERE `code`='nz';
UPDATE `countries` SET `flag`='🇴🇲' WHERE `code`='om';
UPDATE `countries` SET `flag`='🇵🇦' WHERE `code`='pa';
UPDATE `countries` SET `flag`='🇵🇪' WHERE `code`='pe';
UPDATE `countries` SET `flag`='🇵🇫' WHERE `code`='pf';
UPDATE `countries` SET `flag`='🇵🇬' WHERE `code`='pg';
UPDATE `countries` SET `flag`='🇵🇭' WHERE `code`='ph';
UPDATE `countries` SET `flag`='🇵🇰' WHERE `code`='pk';
UPDATE `countries` SET `flag`='🇵🇱' WHERE `code`='pl';
UPDATE `countries` SET `flag`='🇵🇲' WHERE `code`='pm';
UPDATE `countries` SET `flag`='🇵🇳' WHERE `code`='pn';
UPDATE `countries` SET `flag`='🇵🇷' WHERE `code`='pr';
UPDATE `countries` SET `flag`='🇵🇸' WHERE `code`='ps';
UPDATE `countries` SET `flag`='🇵🇹' WHERE `code`='pt';
UPDATE `countries` SET `flag`='🇵🇼' WHERE `code`='pw';
UPDATE `countries` SET `flag`='🇵🇾' WHERE `code`='py';
UPDATE `countries` SET `flag`='🇶🇦' WHERE `code`='qa';
UPDATE `countries` SET `flag`='🇷🇪' WHERE `code`='re';
UPDATE `countries` SET `flag`='🇷🇴' WHERE `code`='ro';
UPDATE `countries` SET `flag`='🇷🇸' WHERE `code`='rs';
UPDATE `countries` SET `flag`='🇷🇺' WHERE `code`='ru';
UPDATE `countries` SET `flag`='🇷🇼' WHERE `code`='rw';
UPDATE `countries` SET `flag`='🇸🇦' WHERE `code`='sa';
UPDATE `countries` SET `flag`='🇸🇧' WHERE `code`='sb';
UPDATE `countries` SET `flag`='🇸🇨' WHERE `code`='sc';
UPDATE `countries` SET `flag`='🇸🇩' WHERE `code`='sd';
UPDATE `countries` SET `flag`='🇸🇪' WHERE `code`='se';
UPDATE `countries` SET `flag`='🇸🇬' WHERE `code`='sg';
UPDATE `countries` SET `flag`='🇸🇭' WHERE `code`='sh';
UPDATE `countries` SET `flag`='🇸🇮' WHERE `code`='si';
UPDATE `countries` SET `flag`='🇸🇯' WHERE `code`='sj';
UPDATE `countries` SET `flag`='🇸🇰' WHERE `code`='sk';
UPDATE `countries` SET `flag`='🇸🇱' WHERE `code`='sl';
UPDATE `countries` SET `flag`='🇸🇲' WHERE `code`='sm';
UPDATE `countries` SET `flag`='🇸🇳' WHERE `code`='sn';
UPDATE `countries` SET `flag`='🇸🇴' WHERE `code`='so';
UPDATE `countries` SET `flag`='🇸🇷' WHERE `code`='sr';
UPDATE `countries` SET `flag`='🇸🇹' WHERE `code`='st';
UPDATE `countries` SET `flag`='🇸🇻' WHERE `code`='sv';
UPDATE `countries` SET `flag`='🇸🇽' WHERE `code`='sx';
UPDATE `countries` SET `flag`='🇸🇾' WHERE `code`='sy';
UPDATE `countries` SET `flag`='🇸🇿' WHERE `code`='sz';
UPDATE `countries` SET `flag`='🇹🇨' WHERE `code`='tc';
UPDATE `countries` SET `flag`='🇹🇩' WHERE `code`='td';
UPDATE `countries` SET `flag`='🇹🇫' WHERE `code`='tf';
UPDATE `countries` SET `flag`='🇹🇬' WHERE `code`='tg';
UPDATE `countries` SET `flag`='🇹🇭' WHERE `code`='th';
UPDATE `countries` SET `flag`='🇹🇯' WHERE `code`='tj';
UPDATE `countries` SET `flag`='🇹🇰' WHERE `code`='tk';
UPDATE `countries` SET `flag`='🇹🇱' WHERE `code`='tl';
UPDATE `countries` SET `flag`='🇹🇲' WHERE `code`='tm';
UPDATE `countries` SET `flag`='🇹🇳' WHERE `code`='tn';
UPDATE `countries` SET `flag`='🇹🇴' WHERE `code`='to';
UPDATE `countries` SET `flag`='🇹🇷' WHERE `code`='tr';
UPDATE `countries` SET `flag`='🇹🇹' WHERE `code`='tt';
UPDATE `countries` SET `flag`='🇹🇻' WHERE `code`='tv';
UPDATE `countries` SET `flag`='🇹🇼' WHERE `code`='tw';
UPDATE `countries` SET `flag`='🇹🇿' WHERE `code`='tz';
UPDATE `countries` SET `flag`='🇺🇦' WHERE `code`='ua';
UPDATE `countries` SET `flag`='🇺🇬' WHERE `code`='ug';
UPDATE `countries` SET `flag`='🇺🇸' WHERE `code`='us';
UPDATE `countries` SET `flag`='🇺🇾' WHERE `code`='uy';
UPDATE `countries` SET `flag`='🇺🇿' WHERE `code`='uz';
UPDATE `countries` SET `flag`='🇻🇦' WHERE `code`='va';
UPDATE `countries` SET `flag`='🇻🇨' WHERE `code`='vc';
UPDATE `countries` SET `flag`='🇻🇪' WHERE `code`='ve';
UPDATE `countries` SET `flag`='🇻🇬' WHERE `code`='vg';
UPDATE `countries` SET `flag`='🇻🇮' WHERE `code`='vi';
UPDATE `countries` SET `flag`='🇻🇳' WHERE `code`='vn';
UPDATE `countries` SET `flag`='🇻🇺' WHERE `code`='vu';
UPDATE `countries` SET `flag`='🇼🇫' WHERE `code`='wf';
UPDATE `countries` SET `flag`='🇼🇸' WHERE `code`='ws';
UPDATE `countries` SET `flag`='🇾🇪' WHERE `code`='ye';
UPDATE `countries` SET `flag`='🇾🇹' WHERE `code`='yt';
UPDATE `countries` SET `flag`='🇿🇦' WHERE `code`='za';
UPDATE `countries` SET `flag`='🇿🇲' WHERE `code`='zm';
UPDATE `countries` SET `flag`='🇿🇼' WHERE `code`='zw';
UPDATE `countries` SET `flag`='🏴' WHERE `code`='nt';
| true |
7ac18b9c65f63deaf9c74ce7c826bc5848ba7b98 | SQL | DmitriySh/rdbms-course | /09-dml-data-filling/data_postgresql.sql | UTF-8 | 1,942 | 3.40625 | 3 | [
"MIT"
] | permissive | -- DML: use PostgreSQL
-- account: client, store_employee and manager
INSERT INTO otus.account (id, pwd_hash, phone, email, type, first_name, surname, deleted, birthdate)
VALUES (1, 'pwd_hash1', '+71021110022', 'dmitriy@invalid.test', 'client', 'dmitriy', 'shishmakov', false, '1960-06-03'),
(2, 'pwd_hash2', '+71090001122', 'vladimir@invalid.test', 'store_employee', 'vladimir', 'mironov', false,
'1980-06-03'),
(3, 'pwd_hash3', '+71090104422', 'ingvar@invalid.test', 'manager', 'ingvar', 'shishmakov', false, '1991-06-03');
-- manufacturer 1
INSERT INTO otus.manufacturer (id, tag, description)
VALUES (1, 'tag_m1', 'manufacturer 1');
-- supplier 1
INSERT INTO otus.supplier (id, tag, description)
VALUES (1, 'tag_s1', 'supplier 1');
-- product 1 + properties + price
INSERT INTO otus.product (id, tag, manufacturer_id, supplier_id, description, count, deleted)
VALUES (1, 'tag_prod1', 1, 1, 'product 1', 100, false);
INSERT INTO otus.product_property (product_id, property_name, property_desc, comment)
VALUES (1, 'property 1', 'property description product 1', 'comment'),
(1, 'property 2', 'property description product 1', 'comment');
INSERT INTO otus.product_price (product_id, supplier_id, manufacturer_id, price)
VALUES (1, 1, 1, 110.0);
INSERT INTO otus.product_price_log (product_price_id, price, modified_by)
VALUES (1, 110.0, 1);
-- product 2 + properties + price
INSERT INTO otus.product (id, tag, manufacturer_id, supplier_id, description, count, deleted)
VALUES (2, 'tag_prod2', 1, 1, 'product 2', 50, false);
INSERT INTO otus.product_property (product_id, property_name, property_desc, comment)
VALUES (2, 'property 1', 'property description product 2', 'comment'),
(2, 'property 2', 'property description product 2', 'comment');
INSERT INTO otus.product_price (product_id, supplier_id, manufacturer_id, price)
VALUES (2, 1, 1, 55.0);
INSERT INTO otus.product_price_log (product_price_id, price, modified_by)
VALUES (2, 55.0, 1);
| true |
02988042419fcda34f71497a408706f3cdea919c | SQL | cgman64/mobile-case-study | /create_database.sql | UTF-8 | 2,384 | 3.546875 | 4 | [] | no_license | -- *************************************************************
-- This script creates sample database (MG)
-- Data Analyst
-- *************************************************************
-- ********************************************
-- CREATE THE MG DATABASE
-- *******************************************
-- create the database
DROP DATABASE IF EXISTS mg;
CREATE DATABASE mg;
-- select database
USE mg;
-- create table for days: a, b and c
-- day: 11/22
CREATE TABLE a
(
device_id INT PRIMARY KEY,
payment DECIMAL(9,2)
);
-- day: 11/23
CREATE TABLE b
(
device_id INT PRIMARY KEY,
payment DECIMAL(9,2)
);
-- day: 11/24
CREATE TABLE c
(
device_id INT PRIMARY KEY,
payment DECIMAL(9,2)
);
INSERT INTO a VALUES
(00001,20.20),
(00003,4.99),
(00009,12.50);
INSERT INTO b VALUES
(00001,0),
(00003,55.00),
(00009,6.50);
INSERT INTO c VALUES
(00001,9.99),
(00003,29.99),
(00009,0);
CREATE TABLE payment
(
user_name VARCHAR(30),
transaction_id INT,
amount DECIMAL(9,2)
);
INSERT INTO payment VALUES
('Andy',18,9.99),
('Laurie',77,4.99),
('Ken',55,4.99),
('Andy',88,19.99),
('Andy',118,4.99),
('Laurie',102,9.99),
('Frank',217,9.99),
('Laurie',389,9.99),
('Ken',270,4.99),
('Internal_employee',217,29.99);
CREATE TABLE feed
(
county VARCHAR(2),
longname VARCHAR(60),
network VARCHAR(30),
platform VARCHAR(5),
install_time DATETIME,
user_id VARCHAR(60),
paid DECIMAL(3,2)
);
INSERT INTO feed VALUES
('TR','com.thirdtime.derbyking','Organic','iOS','2016-05-04 13:36:00',
'D5655090-33CB-49B0-A8C4-FCC493AD33F4',0),
('US','com.thirdtime.derbyking','Facebook','iOS','2016-06-17 01:57:00',
'CBC92E11-F642-46D3-93CF-7F3A182B20BB',0),
('CN','com.spotlight.tropicalwars','Organic','iOS','2016-04-27 14:52:00',
'B8331894-4BFC-4714-A232-FA65F4401F29',0),
('DE','com.thirdtime.derbyking','Facebook','iOS','2016-06-16 11:37:00',
'90FCCFF2-E268-4466-9D22-99CCCEF9A4AB',0),
('FR','com.spotlight.languinis','Organic','iOS','2015-05-15 07:52:00',
'50D23049-BAA3-4755-BECA-1D3F8EE81F80',0.65),
('BE','com.thirdtime.derbyking','Facebook','iOS','2016-06-14 17:04:00',
'D7AFBF03-C5F6-44FF-86E7-40A9840D2023',0),
('FR','com.thirdtime.derbyking','Facebook','iOS','2016-06-17 08:44:00',
'B1596A58-C7CD-4BDF-BEE7-7B0DBD4FDA2F',0),
('US','com.thirdtime.derbyking','Facebook','iOS','2016-06-13 01:15:00',
'9826D3AA-5F43-416D-B440-2EC5750EB529',0);
| true |
3cd4443450fdb97abf1c6ad3836cb8db38597ef3 | SQL | vmuchui/Organisational-API | /create.sql | UTF-8 | 4,888 | 2.859375 | 3 | [
"MIT"
] | permissive | --
-- PostgreSQL database dump
--
-- Dumped from database version 10.9 (Ubuntu 10.9-0ubuntu0.18.10.1)
-- Dumped by pg_dump version 10.9 (Ubuntu 10.9-0ubuntu0.18.10.1)
SET statement_timeout = 0;
SET lock_timeout = 0;
SET idle_in_transaction_session_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SELECT pg_catalog.set_config('search_path', '', false);
SET check_function_bodies = false;
SET xmloption = content;
SET client_min_messages = warning;
SET row_security = off;
--
-- Name: plpgsql; Type: EXTENSION; Schema: -; Owner:
--
CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog;
--
-- Name: EXTENSION plpgsql; Type: COMMENT; Schema: -; Owner:
--
COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language';
SET default_tablespace = '';
SET default_with_oids = false;
--
-- Name: departments; Type: TABLE; Schema: public; Owner: victor
--
CREATE TABLE public.departments (
id integer NOT NULL,
name character varying,
email character varying
);
ALTER TABLE public.departments OWNER TO victor;
--
-- Name: departments_id_seq; Type: SEQUENCE; Schema: public; Owner: victor
--
CREATE SEQUENCE public.departments_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.departments_id_seq OWNER TO victor;
--
-- Name: departments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: victor
--
ALTER SEQUENCE public.departments_id_seq OWNED BY public.departments.id;
--
-- Name: news; Type: TABLE; Schema: public; Owner: victor
--
CREATE TABLE public.news (
id integer NOT NULL,
type character varying,
headlines character varying,
content character varying,
departmentid integer
);
ALTER TABLE public.news OWNER TO victor;
--
-- Name: news_id_seq; Type: SEQUENCE; Schema: public; Owner: victor
--
CREATE SEQUENCE public.news_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.news_id_seq OWNER TO victor;
--
-- Name: news_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: victor
--
ALTER SEQUENCE public.news_id_seq OWNED BY public.news.id;
--
-- Name: users; Type: TABLE; Schema: public; Owner: victor
--
CREATE TABLE public.users (
id integer NOT NULL,
name character varying,
role character varying,
rank character varying,
email character varying,
departmentid integer
);
ALTER TABLE public.users OWNER TO victor;
--
-- Name: users_id_seq; Type: SEQUENCE; Schema: public; Owner: victor
--
CREATE SEQUENCE public.users_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.users_id_seq OWNER TO victor;
--
-- Name: users_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: victor
--
ALTER SEQUENCE public.users_id_seq OWNED BY public.users.id;
--
-- Name: departments id; Type: DEFAULT; Schema: public; Owner: victor
--
ALTER TABLE ONLY public.departments ALTER COLUMN id SET DEFAULT nextval('public.departments_id_seq'::regclass);
--
-- Name: news id; Type: DEFAULT; Schema: public; Owner: victor
--
ALTER TABLE ONLY public.news ALTER COLUMN id SET DEFAULT nextval('public.news_id_seq'::regclass);
--
-- Name: users id; Type: DEFAULT; Schema: public; Owner: victor
--
ALTER TABLE ONLY public.users ALTER COLUMN id SET DEFAULT nextval('public.users_id_seq'::regclass);
--
-- Data for Name: departments; Type: TABLE DATA; Schema: public; Owner: victor
--
COPY public.departments (id, name, email) FROM stdin;
\.
--
-- Data for Name: news; Type: TABLE DATA; Schema: public; Owner: victor
--
COPY public.news (id, type, headlines, content, departmentid) FROM stdin;
\.
--
-- Data for Name: users; Type: TABLE DATA; Schema: public; Owner: victor
--
COPY public.users (id, name, role, rank, email, departmentid) FROM stdin;
\.
--
-- Name: departments_id_seq; Type: SEQUENCE SET; Schema: public; Owner: victor
--
SELECT pg_catalog.setval('public.departments_id_seq', 9, true);
--
-- Name: news_id_seq; Type: SEQUENCE SET; Schema: public; Owner: victor
--
SELECT pg_catalog.setval('public.news_id_seq', 17, true);
--
-- Name: users_id_seq; Type: SEQUENCE SET; Schema: public; Owner: victor
--
SELECT pg_catalog.setval('public.users_id_seq', 9, true);
--
-- Name: departments departments_pkey; Type: CONSTRAINT; Schema: public; Owner: victor
--
ALTER TABLE ONLY public.departments
ADD CONSTRAINT departments_pkey PRIMARY KEY (id);
--
-- Name: news news_pkey; Type: CONSTRAINT; Schema: public; Owner: victor
--
ALTER TABLE ONLY public.news
ADD CONSTRAINT news_pkey PRIMARY KEY (id);
--
-- Name: users users_pkey; Type: CONSTRAINT; Schema: public; Owner: victor
--
ALTER TABLE ONLY public.users
ADD CONSTRAINT users_pkey PRIMARY KEY (id);
--
-- PostgreSQL database dump complete
--
| true |
4ef83dddc1204d879a93352dbe49ced30c34cf9d | SQL | hnjogu/membersite | /database/dump.sql | UTF-8 | 34,440 | 3.03125 | 3 | [] | no_license | --
-- PostgreSQL database dump
--
-- Dumped from database version 9.6.1
-- Dumped by pg_dump version 9.6.1
SET statement_timeout = 0;
SET lock_timeout = 0;
SET idle_in_transaction_session_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SET check_function_bodies = false;
SET client_min_messages = warning;
SET row_security = off;
--
-- Name: plpgsql; Type: EXTENSION; Schema: -; Owner:
--
CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog;
--
-- Name: EXTENSION plpgsql; Type: COMMENT; Schema: -; Owner:
--
COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language';
SET search_path = public, pg_catalog;
SET default_tablespace = '';
SET default_with_oids = false;
--
-- Name: auth_group; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE auth_group (
id integer NOT NULL,
name character varying(80) NOT NULL
);
ALTER TABLE auth_group OWNER TO postgres;
--
-- Name: auth_group_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE auth_group_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE auth_group_id_seq OWNER TO postgres;
--
-- Name: auth_group_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE auth_group_id_seq OWNED BY auth_group.id;
--
-- Name: auth_group_permissions; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE auth_group_permissions (
id integer NOT NULL,
group_id integer NOT NULL,
permission_id integer NOT NULL
);
ALTER TABLE auth_group_permissions OWNER TO postgres;
--
-- Name: auth_group_permissions_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE auth_group_permissions_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE auth_group_permissions_id_seq OWNER TO postgres;
--
-- Name: auth_group_permissions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE auth_group_permissions_id_seq OWNED BY auth_group_permissions.id;
--
-- Name: auth_permission; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE auth_permission (
id integer NOT NULL,
name character varying(255) NOT NULL,
content_type_id integer NOT NULL,
codename character varying(100) NOT NULL
);
ALTER TABLE auth_permission OWNER TO postgres;
--
-- Name: auth_permission_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE auth_permission_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE auth_permission_id_seq OWNER TO postgres;
--
-- Name: auth_permission_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE auth_permission_id_seq OWNED BY auth_permission.id;
--
-- Name: auth_user; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE auth_user (
id integer NOT NULL,
password character varying(128) NOT NULL,
last_login timestamp with time zone,
is_superuser boolean NOT NULL,
username character varying(150) NOT NULL,
first_name character varying(30) NOT NULL,
last_name character varying(30) NOT NULL,
email character varying(254) NOT NULL,
is_staff boolean NOT NULL,
is_active boolean NOT NULL,
date_joined timestamp with time zone NOT NULL
);
ALTER TABLE auth_user OWNER TO postgres;
--
-- Name: auth_user_groups; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE auth_user_groups (
id integer NOT NULL,
user_id integer NOT NULL,
group_id integer NOT NULL
);
ALTER TABLE auth_user_groups OWNER TO postgres;
--
-- Name: auth_user_groups_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE auth_user_groups_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE auth_user_groups_id_seq OWNER TO postgres;
--
-- Name: auth_user_groups_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE auth_user_groups_id_seq OWNED BY auth_user_groups.id;
--
-- Name: auth_user_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE auth_user_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE auth_user_id_seq OWNER TO postgres;
--
-- Name: auth_user_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE auth_user_id_seq OWNED BY auth_user.id;
--
-- Name: auth_user_user_permissions; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE auth_user_user_permissions (
id integer NOT NULL,
user_id integer NOT NULL,
permission_id integer NOT NULL
);
ALTER TABLE auth_user_user_permissions OWNER TO postgres;
--
-- Name: auth_user_user_permissions_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE auth_user_user_permissions_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE auth_user_user_permissions_id_seq OWNER TO postgres;
--
-- Name: auth_user_user_permissions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE auth_user_user_permissions_id_seq OWNED BY auth_user_user_permissions.id;
--
-- Name: blog_comment; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE blog_comment (
id integer NOT NULL,
author character varying(200) NOT NULL,
text text NOT NULL,
created_date timestamp with time zone NOT NULL,
approved_comment boolean NOT NULL,
post_id integer NOT NULL
);
ALTER TABLE blog_comment OWNER TO postgres;
--
-- Name: blog_comment_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE blog_comment_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE blog_comment_id_seq OWNER TO postgres;
--
-- Name: blog_comment_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE blog_comment_id_seq OWNED BY blog_comment.id;
--
-- Name: blog_post; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE blog_post (
id integer NOT NULL,
title character varying(200) NOT NULL,
text text NOT NULL,
created_date timestamp with time zone NOT NULL,
published_date timestamp with time zone,
author_id integer NOT NULL
);
ALTER TABLE blog_post OWNER TO postgres;
--
-- Name: blog_post_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE blog_post_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE blog_post_id_seq OWNER TO postgres;
--
-- Name: blog_post_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE blog_post_id_seq OWNED BY blog_post.id;
--
-- Name: django_admin_log; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE django_admin_log (
id integer NOT NULL,
action_time timestamp with time zone NOT NULL,
object_id text,
object_repr character varying(200) NOT NULL,
action_flag smallint NOT NULL,
change_message text NOT NULL,
content_type_id integer,
user_id integer NOT NULL,
CONSTRAINT django_admin_log_action_flag_check CHECK ((action_flag >= 0))
);
ALTER TABLE django_admin_log OWNER TO postgres;
--
-- Name: django_admin_log_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE django_admin_log_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE django_admin_log_id_seq OWNER TO postgres;
--
-- Name: django_admin_log_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE django_admin_log_id_seq OWNED BY django_admin_log.id;
--
-- Name: django_content_type; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE django_content_type (
id integer NOT NULL,
app_label character varying(100) NOT NULL,
model character varying(100) NOT NULL
);
ALTER TABLE django_content_type OWNER TO postgres;
--
-- Name: django_content_type_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE django_content_type_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE django_content_type_id_seq OWNER TO postgres;
--
-- Name: django_content_type_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE django_content_type_id_seq OWNED BY django_content_type.id;
--
-- Name: django_migrations; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE django_migrations (
id integer NOT NULL,
app character varying(255) NOT NULL,
name character varying(255) NOT NULL,
applied timestamp with time zone NOT NULL
);
ALTER TABLE django_migrations OWNER TO postgres;
--
-- Name: django_migrations_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE django_migrations_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE django_migrations_id_seq OWNER TO postgres;
--
-- Name: django_migrations_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE django_migrations_id_seq OWNED BY django_migrations.id;
--
-- Name: django_session; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE django_session (
session_key character varying(40) NOT NULL,
session_data text NOT NULL,
expire_date timestamp with time zone NOT NULL
);
ALTER TABLE django_session OWNER TO postgres;
--
-- Name: auth_group id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY auth_group ALTER COLUMN id SET DEFAULT nextval('auth_group_id_seq'::regclass);
--
-- Name: auth_group_permissions id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY auth_group_permissions ALTER COLUMN id SET DEFAULT nextval('auth_group_permissions_id_seq'::regclass);
--
-- Name: auth_permission id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY auth_permission ALTER COLUMN id SET DEFAULT nextval('auth_permission_id_seq'::regclass);
--
-- Name: auth_user id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY auth_user ALTER COLUMN id SET DEFAULT nextval('auth_user_id_seq'::regclass);
--
-- Name: auth_user_groups id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY auth_user_groups ALTER COLUMN id SET DEFAULT nextval('auth_user_groups_id_seq'::regclass);
--
-- Name: auth_user_user_permissions id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY auth_user_user_permissions ALTER COLUMN id SET DEFAULT nextval('auth_user_user_permissions_id_seq'::regclass);
--
-- Name: blog_comment id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY blog_comment ALTER COLUMN id SET DEFAULT nextval('blog_comment_id_seq'::regclass);
--
-- Name: blog_post id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY blog_post ALTER COLUMN id SET DEFAULT nextval('blog_post_id_seq'::regclass);
--
-- Name: django_admin_log id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY django_admin_log ALTER COLUMN id SET DEFAULT nextval('django_admin_log_id_seq'::regclass);
--
-- Name: django_content_type id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY django_content_type ALTER COLUMN id SET DEFAULT nextval('django_content_type_id_seq'::regclass);
--
-- Name: django_migrations id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY django_migrations ALTER COLUMN id SET DEFAULT nextval('django_migrations_id_seq'::regclass);
--
-- Data for Name: auth_group; Type: TABLE DATA; Schema: public; Owner: postgres
--
--
-- Name: auth_group_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--
SELECT pg_catalog.setval('auth_group_id_seq', 1, false);
--
-- Data for Name: auth_group_permissions; Type: TABLE DATA; Schema: public; Owner: postgres
--
--
-- Name: auth_group_permissions_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--
SELECT pg_catalog.setval('auth_group_permissions_id_seq', 1, false);
--
-- Data for Name: auth_permission; Type: TABLE DATA; Schema: public; Owner: postgres
--
INSERT INTO auth_permission VALUES (1, 'Can add group', 1, 'add_group');
INSERT INTO auth_permission VALUES (2, 'Can change group', 1, 'change_group');
INSERT INTO auth_permission VALUES (3, 'Can delete group', 1, 'delete_group');
INSERT INTO auth_permission VALUES (4, 'Can add permission', 2, 'add_permission');
INSERT INTO auth_permission VALUES (5, 'Can change permission', 2, 'change_permission');
INSERT INTO auth_permission VALUES (6, 'Can delete permission', 2, 'delete_permission');
INSERT INTO auth_permission VALUES (7, 'Can add user', 3, 'add_user');
INSERT INTO auth_permission VALUES (8, 'Can change user', 3, 'change_user');
INSERT INTO auth_permission VALUES (9, 'Can delete user', 3, 'delete_user');
INSERT INTO auth_permission VALUES (10, 'Can add content type', 4, 'add_contenttype');
INSERT INTO auth_permission VALUES (11, 'Can change content type', 4, 'change_contenttype');
INSERT INTO auth_permission VALUES (12, 'Can delete content type', 4, 'delete_contenttype');
INSERT INTO auth_permission VALUES (13, 'Can add comment', 5, 'add_comment');
INSERT INTO auth_permission VALUES (14, 'Can change comment', 5, 'change_comment');
INSERT INTO auth_permission VALUES (15, 'Can delete comment', 5, 'delete_comment');
INSERT INTO auth_permission VALUES (16, 'Can add post', 6, 'add_post');
INSERT INTO auth_permission VALUES (17, 'Can change post', 6, 'change_post');
INSERT INTO auth_permission VALUES (18, 'Can delete post', 6, 'delete_post');
INSERT INTO auth_permission VALUES (19, 'Can add log entry', 7, 'add_logentry');
INSERT INTO auth_permission VALUES (20, 'Can change log entry', 7, 'change_logentry');
INSERT INTO auth_permission VALUES (21, 'Can delete log entry', 7, 'delete_logentry');
INSERT INTO auth_permission VALUES (22, 'Can add session', 8, 'add_session');
INSERT INTO auth_permission VALUES (23, 'Can change session', 8, 'change_session');
INSERT INTO auth_permission VALUES (24, 'Can delete session', 8, 'delete_session');
--
-- Name: auth_permission_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--
SELECT pg_catalog.setval('auth_permission_id_seq', 24, true);
--
-- Data for Name: auth_user; Type: TABLE DATA; Schema: public; Owner: postgres
--
INSERT INTO auth_user VALUES (3, 'pbkdf2_sha256$30000$owNzVvLErwKs$OMwK/HyA0Kc9QH8NzO9fkiPJ4vENbauy2Vte3gQcxUA=', '2017-03-28 16:58:56.209+03', true, 'harrugg', 'harri', 'stars', 'harr@gmail.com', true, true, '2017-02-22 20:21:34.431+03');
INSERT INTO auth_user VALUES (12, 'pbkdf2_sha256$30000$QuWVKmTQ9N05$eueC2FYzhXFw34McTx+wokoNnnbGmUb01gDYzIFtG4g=', '2017-03-02 14:39:14.539+03', false, 'tim', 'tim', 'tim', 'tim@gmail.com', false, true, '2017-03-01 16:01:56+03');
INSERT INTO auth_user VALUES (4, 'pbkdf2_sha256$30000$E7ImGqSTMKi8$+yFUUSxmENDvAtnDkcL//Q2ZtStEMxC8cfNmoZgGFHg=', '2017-02-28 16:16:40.769+03', false, 'harr', '', '', '', false, true, '2017-02-28 15:31:12.832+03');
INSERT INTO auth_user VALUES (5, 'pbkdf2_sha256$30000$rQkigcxY9gS0$TbgHQapH0DwbsDYx93qyhfrxDmMqD5lAVufon+JvAyE=', NULL, false, 'daa', '', '', '', false, true, '2017-02-28 16:18:37.225+03');
INSERT INTO auth_user VALUES (15, 'pbkdf2_sha256$30000$CL4ljjAfF85e$WqKHFsJK+vUwXceYHFPMmJzy4KtgpKf+NPoRSEiOsiw=', NULL, false, 'test2', 'test2', 'test2', 'test2@gmail.com', false, true, '2017-03-01 17:10:33.465+03');
INSERT INTO auth_user VALUES (6, 'pbkdf2_sha256$30000$fKCqSi1hX1X0$6Uh0q+TdvAqNDqS48t9YtyFdubCIZowdqRmY/yRc5nE=', NULL, false, 'harri', '', '', '', false, true, '2017-03-01 13:55:31.98+03');
INSERT INTO auth_user VALUES (7, 'pbkdf2_sha256$30000$dzu2lVhNifsN$OlaCuELLVqra9yfpuP8Y7VfRjC+I6PIOBxHLW0WCALk=', NULL, false, 'dsa', '', '', '', false, true, '2017-03-01 14:01:36.626+03');
INSERT INTO auth_user VALUES (8, 'pbkdf2_sha256$30000$RHXgUVViMhI9$jkP9sw7MVestiUxftF9nmsubKuyjesumOjNWr2JK3Bw=', NULL, false, 'lamp', '', '', '', false, true, '2017-03-01 14:56:30.424+03');
INSERT INTO auth_user VALUES (9, 'pbkdf2_sha256$30000$2Ykv6o9154kl$WpEwIWtvZfoMxyq3WizrDh3bDsHEHp/S2uniifSDmPg=', NULL, false, 'xampp', '', '', '', false, true, '2017-03-01 15:03:30.114+03');
INSERT INTO auth_user VALUES (10, 'pbkdf2_sha256$30000$ZUa5dCxnbVdg$O+CsR5SSwEDneUh+3IrcC0SYoD4cq8EDraSM02w7jkA=', NULL, false, 'man', '', '', '', false, true, '2017-03-01 15:05:58.791+03');
INSERT INTO auth_user VALUES (11, 'pbkdf2_sha256$30000$0oIO9XMUSLH9$xUqhmpOpHkRW4sus+4cYLXer6PhGsFkcCYwG431muxQ=', NULL, false, 'wan', '', '', '', false, true, '2017-03-01 15:20:00.695+03');
INSERT INTO auth_user VALUES (13, 'pbkdf2_sha256$30000$6Y7lE4KFdS6M$TOxxzlfyAoT+MWYUA41TVokWx79KG4aWFvOycbCg584=', NULL, false, 'shiru', 'shiru', 'shiru', 'shiru@gmail.com', false, true, '2017-03-01 17:02:24.51+03');
INSERT INTO auth_user VALUES (14, 'pbkdf2_sha256$30000$XARwhvSnXLcj$c8N71mgwBCDizpAKQMBmi2sU8EK0KgdTG9cwv102yhY=', '2017-03-01 17:11:15.011+03', false, 'test1', 'test1', 'test1', 'test1@gmail.com', false, true, '2017-03-01 17:08:46.7+03');
--
-- Data for Name: auth_user_groups; Type: TABLE DATA; Schema: public; Owner: postgres
--
--
-- Name: auth_user_groups_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--
SELECT pg_catalog.setval('auth_user_groups_id_seq', 1, false);
--
-- Name: auth_user_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--
SELECT pg_catalog.setval('auth_user_id_seq', 15, true);
--
-- Data for Name: auth_user_user_permissions; Type: TABLE DATA; Schema: public; Owner: postgres
--
--
-- Name: auth_user_user_permissions_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--
SELECT pg_catalog.setval('auth_user_user_permissions_id_seq', 1, false);
--
-- Data for Name: blog_comment; Type: TABLE DATA; Schema: public; Owner: postgres
--
INSERT INTO blog_comment VALUES (1, 'harrugg', 'it''s cool', '2017-02-25 23:06:59.939+03', true, 1);
--
-- Name: blog_comment_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--
SELECT pg_catalog.setval('blog_comment_id_seq', 1, true);
--
-- Data for Name: blog_post; Type: TABLE DATA; Schema: public; Owner: postgres
--
INSERT INTO blog_post VALUES (1, 'welkam', 'welkam to the django forum system', '2017-02-25 23:06:14.654+03', '2017-02-27 12:42:47.071+03', 3);
INSERT INTO blog_post VALUES (2, 'test', 'test prove.com', '2017-02-27 12:33:26.124+03', '2017-02-27 12:42:57.681+03', 3);
INSERT INTO blog_post VALUES (3, 'good', 'i have tried', '2017-03-27 13:54:52.043+03', NULL, 3);
--
-- Name: blog_post_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--
SELECT pg_catalog.setval('blog_post_id_seq', 3, true);
--
-- Data for Name: django_admin_log; Type: TABLE DATA; Schema: public; Owner: postgres
--
--
-- Name: django_admin_log_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--
SELECT pg_catalog.setval('django_admin_log_id_seq', 1, false);
--
-- Data for Name: django_content_type; Type: TABLE DATA; Schema: public; Owner: postgres
--
INSERT INTO django_content_type VALUES (1, 'auth', 'group');
INSERT INTO django_content_type VALUES (2, 'auth', 'permission');
INSERT INTO django_content_type VALUES (3, 'auth', 'user');
INSERT INTO django_content_type VALUES (4, 'contenttypes', 'contenttype');
INSERT INTO django_content_type VALUES (5, 'blog', 'comment');
INSERT INTO django_content_type VALUES (6, 'blog', 'post');
INSERT INTO django_content_type VALUES (7, 'admin', 'logentry');
INSERT INTO django_content_type VALUES (8, 'sessions', 'session');
--
-- Name: django_content_type_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--
SELECT pg_catalog.setval('django_content_type_id_seq', 8, true);
--
-- Data for Name: django_migrations; Type: TABLE DATA; Schema: public; Owner: postgres
--
INSERT INTO django_migrations VALUES (1, 'contenttypes', '0001_initial', '2017-02-22 19:55:27.816+03');
INSERT INTO django_migrations VALUES (2, 'auth', '0001_initial', '2017-02-22 19:55:28.976+03');
INSERT INTO django_migrations VALUES (3, 'blog', '0001_initial', '2017-02-22 19:55:29.191+03');
INSERT INTO django_migrations VALUES (4, 'blog', '0002_comment', '2017-02-22 19:55:29.346+03');
INSERT INTO django_migrations VALUES (5, 'blog', '0003_auto_20170222_1938', '2017-02-22 19:55:29.551+03');
INSERT INTO django_migrations VALUES (6, 'admin', '0001_initial', '2017-02-22 20:20:03.877+03');
INSERT INTO django_migrations VALUES (7, 'admin', '0002_logentry_remove_auto_add', '2017-02-22 20:20:03.917+03');
INSERT INTO django_migrations VALUES (8, 'contenttypes', '0002_remove_content_type_name', '2017-02-22 20:20:04.112+03');
INSERT INTO django_migrations VALUES (9, 'auth', '0002_alter_permission_name_max_length', '2017-02-22 20:20:04.157+03');
INSERT INTO django_migrations VALUES (10, 'auth', '0003_alter_user_email_max_length', '2017-02-22 20:20:04.182+03');
INSERT INTO django_migrations VALUES (11, 'auth', '0004_alter_user_username_opts', '2017-02-22 20:20:04.217+03');
INSERT INTO django_migrations VALUES (12, 'auth', '0005_alter_user_last_login_null', '2017-02-22 20:20:04.272+03');
INSERT INTO django_migrations VALUES (13, 'auth', '0006_require_contenttypes_0002', '2017-02-22 20:20:04.302+03');
INSERT INTO django_migrations VALUES (14, 'auth', '0007_alter_validators_add_error_messages', '2017-02-22 20:20:04.352+03');
INSERT INTO django_migrations VALUES (15, 'auth', '0008_alter_user_username_max_length', '2017-02-22 20:20:04.437+03');
INSERT INTO django_migrations VALUES (16, 'sessions', '0001_initial', '2017-02-22 20:20:04.612+03');
--
-- Name: django_migrations_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--
SELECT pg_catalog.setval('django_migrations_id_seq', 16, true);
--
-- Data for Name: django_session; Type: TABLE DATA; Schema: public; Owner: postgres
--
INSERT INTO django_session VALUES ('1la3oxhbc3plz0n43r41u325oc1enkdo', 'NmZhOWFmZDcxYzM0N2JhMmEyYTdhMTFlY2ZiYjA2MzI5OTFhZjE0Yzp7Il9hdXRoX3VzZXJfaGFzaCI6IjJmODc5MmRmODM0MmZlNTMxMjlmNzg1ZDM0YjA0NmQ5YTJhOTY5OGEiLCJfYXV0aF91c2VyX2JhY2tlbmQiOiJkamFuZ28uY29udHJpYi5hdXRoLmJhY2tlbmRzLk1vZGVsQmFja2VuZCIsIl9hdXRoX3VzZXJfaWQiOiIzIn0=', '2017-03-14 16:03:10.462+03');
INSERT INTO django_session VALUES ('phvkcm6hhjilgl0ozwx59aqdvxbktgji', 'NjA2ZmI0NTllZDE0ZmFkODk0NjM1NGQzOTRjZDEzMjc1MjQ5YTNiNjp7fQ==', '2017-04-11 15:28:46.866+03');
INSERT INTO django_session VALUES ('m25wmcb2ho9rrdgxnyhz1rpgr2bp62kj', 'NjA2ZmI0NTllZDE0ZmFkODk0NjM1NGQzOTRjZDEzMjc1MjQ5YTNiNjp7fQ==', '2017-04-11 15:29:28.142+03');
INSERT INTO django_session VALUES ('r38nx0rcgcm5ritgn3fzsj5xh68je8ju', 'NjA2ZmI0NTllZDE0ZmFkODk0NjM1NGQzOTRjZDEzMjc1MjQ5YTNiNjp7fQ==', '2017-04-11 15:33:25.125+03');
INSERT INTO django_session VALUES ('iftodxzt7bdftu61fw0vt7ub1wgdz0zw', 'NjA2ZmI0NTllZDE0ZmFkODk0NjM1NGQzOTRjZDEzMjc1MjQ5YTNiNjp7fQ==', '2017-04-11 15:33:32.336+03');
INSERT INTO django_session VALUES ('lc59tj55nu7uk4atsdkxies6ygq3umns', 'NjA2ZmI0NTllZDE0ZmFkODk0NjM1NGQzOTRjZDEzMjc1MjQ5YTNiNjp7fQ==', '2017-04-11 15:35:40.029+03');
INSERT INTO django_session VALUES ('he8epww0pbvrf1jnr0ku0a3o2143ypvv', 'NjA2ZmI0NTllZDE0ZmFkODk0NjM1NGQzOTRjZDEzMjc1MjQ5YTNiNjp7fQ==', '2017-04-11 15:39:11.078+03');
INSERT INTO django_session VALUES ('dw0oan9zmkh1woqwkwvei2fr80rq109j', 'NjA2ZmI0NTllZDE0ZmFkODk0NjM1NGQzOTRjZDEzMjc1MjQ5YTNiNjp7fQ==', '2017-04-11 15:40:06.458+03');
INSERT INTO django_session VALUES ('ulfxne9vocwzg4kouv5pupc7e81pszdq', 'NjA2ZmI0NTllZDE0ZmFkODk0NjM1NGQzOTRjZDEzMjc1MjQ5YTNiNjp7fQ==', '2017-04-11 15:40:47.378+03');
--
-- Name: auth_group auth_group_name_key; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY auth_group
ADD CONSTRAINT auth_group_name_key UNIQUE (name);
--
-- Name: auth_group_permissions auth_group_permissions_group_id_0cd325b0_uniq; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY auth_group_permissions
ADD CONSTRAINT auth_group_permissions_group_id_0cd325b0_uniq UNIQUE (group_id, permission_id);
--
-- Name: auth_group_permissions auth_group_permissions_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY auth_group_permissions
ADD CONSTRAINT auth_group_permissions_pkey PRIMARY KEY (id);
--
-- Name: auth_group auth_group_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY auth_group
ADD CONSTRAINT auth_group_pkey PRIMARY KEY (id);
--
-- Name: auth_permission auth_permission_content_type_id_01ab375a_uniq; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY auth_permission
ADD CONSTRAINT auth_permission_content_type_id_01ab375a_uniq UNIQUE (content_type_id, codename);
--
-- Name: auth_permission auth_permission_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY auth_permission
ADD CONSTRAINT auth_permission_pkey PRIMARY KEY (id);
--
-- Name: auth_user_groups auth_user_groups_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY auth_user_groups
ADD CONSTRAINT auth_user_groups_pkey PRIMARY KEY (id);
--
-- Name: auth_user_groups auth_user_groups_user_id_94350c0c_uniq; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY auth_user_groups
ADD CONSTRAINT auth_user_groups_user_id_94350c0c_uniq UNIQUE (user_id, group_id);
--
-- Name: auth_user auth_user_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY auth_user
ADD CONSTRAINT auth_user_pkey PRIMARY KEY (id);
--
-- Name: auth_user_user_permissions auth_user_user_permissions_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY auth_user_user_permissions
ADD CONSTRAINT auth_user_user_permissions_pkey PRIMARY KEY (id);
--
-- Name: auth_user_user_permissions auth_user_user_permissions_user_id_14a6b632_uniq; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY auth_user_user_permissions
ADD CONSTRAINT auth_user_user_permissions_user_id_14a6b632_uniq UNIQUE (user_id, permission_id);
--
-- Name: auth_user auth_user_username_key; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY auth_user
ADD CONSTRAINT auth_user_username_key UNIQUE (username);
--
-- Name: blog_comment blog_comment_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY blog_comment
ADD CONSTRAINT blog_comment_pkey PRIMARY KEY (id);
--
-- Name: blog_comment blog_comment_text_d21be499_uniq; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY blog_comment
ADD CONSTRAINT blog_comment_text_d21be499_uniq UNIQUE (text);
--
-- Name: blog_post blog_post_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY blog_post
ADD CONSTRAINT blog_post_pkey PRIMARY KEY (id);
--
-- Name: blog_post blog_post_title_36da7df3_uniq; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY blog_post
ADD CONSTRAINT blog_post_title_36da7df3_uniq UNIQUE (title, text);
--
-- Name: django_admin_log django_admin_log_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY django_admin_log
ADD CONSTRAINT django_admin_log_pkey PRIMARY KEY (id);
--
-- Name: django_content_type django_content_type_app_label_76bd3d3b_uniq; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY django_content_type
ADD CONSTRAINT django_content_type_app_label_76bd3d3b_uniq UNIQUE (app_label, model);
--
-- Name: django_content_type django_content_type_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY django_content_type
ADD CONSTRAINT django_content_type_pkey PRIMARY KEY (id);
--
-- Name: django_migrations django_migrations_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY django_migrations
ADD CONSTRAINT django_migrations_pkey PRIMARY KEY (id);
--
-- Name: django_session django_session_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY django_session
ADD CONSTRAINT django_session_pkey PRIMARY KEY (session_key);
--
-- Name: auth_group_name_a6ea08ec_like; Type: INDEX; Schema: public; Owner: postgres
--
CREATE INDEX auth_group_name_a6ea08ec_like ON auth_group USING btree (name varchar_pattern_ops);
--
-- Name: auth_group_permissions_0e939a4f; Type: INDEX; Schema: public; Owner: postgres
--
CREATE INDEX auth_group_permissions_0e939a4f ON auth_group_permissions USING btree (group_id);
--
-- Name: auth_group_permissions_8373b171; Type: INDEX; Schema: public; Owner: postgres
--
CREATE INDEX auth_group_permissions_8373b171 ON auth_group_permissions USING btree (permission_id);
--
-- Name: auth_permission_417f1b1c; Type: INDEX; Schema: public; Owner: postgres
--
CREATE INDEX auth_permission_417f1b1c ON auth_permission USING btree (content_type_id);
--
-- Name: auth_user_groups_0e939a4f; Type: INDEX; Schema: public; Owner: postgres
--
CREATE INDEX auth_user_groups_0e939a4f ON auth_user_groups USING btree (group_id);
--
-- Name: auth_user_groups_e8701ad4; Type: INDEX; Schema: public; Owner: postgres
--
CREATE INDEX auth_user_groups_e8701ad4 ON auth_user_groups USING btree (user_id);
--
-- Name: auth_user_user_permissions_8373b171; Type: INDEX; Schema: public; Owner: postgres
--
CREATE INDEX auth_user_user_permissions_8373b171 ON auth_user_user_permissions USING btree (permission_id);
--
-- Name: auth_user_user_permissions_e8701ad4; Type: INDEX; Schema: public; Owner: postgres
--
CREATE INDEX auth_user_user_permissions_e8701ad4 ON auth_user_user_permissions USING btree (user_id);
--
-- Name: auth_user_username_6821ab7c_like; Type: INDEX; Schema: public; Owner: postgres
--
CREATE INDEX auth_user_username_6821ab7c_like ON auth_user USING btree (username varchar_pattern_ops);
--
-- Name: blog_comment_f3aa1999; Type: INDEX; Schema: public; Owner: postgres
--
CREATE INDEX blog_comment_f3aa1999 ON blog_comment USING btree (post_id);
--
-- Name: blog_post_4f331e2f; Type: INDEX; Schema: public; Owner: postgres
--
CREATE INDEX blog_post_4f331e2f ON blog_post USING btree (author_id);
--
-- Name: django_admin_log_417f1b1c; Type: INDEX; Schema: public; Owner: postgres
--
CREATE INDEX django_admin_log_417f1b1c ON django_admin_log USING btree (content_type_id);
--
-- Name: django_admin_log_e8701ad4; Type: INDEX; Schema: public; Owner: postgres
--
CREATE INDEX django_admin_log_e8701ad4 ON django_admin_log USING btree (user_id);
--
-- Name: django_session_de54fa62; Type: INDEX; Schema: public; Owner: postgres
--
CREATE INDEX django_session_de54fa62 ON django_session USING btree (expire_date);
--
-- Name: django_session_session_key_c0390e0f_like; Type: INDEX; Schema: public; Owner: postgres
--
CREATE INDEX django_session_session_key_c0390e0f_like ON django_session USING btree (session_key varchar_pattern_ops);
--
-- Name: auth_group_permissions auth_group_permiss_permission_id_84c5c92e_fk_auth_permission_id; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY auth_group_permissions
ADD CONSTRAINT auth_group_permiss_permission_id_84c5c92e_fk_auth_permission_id FOREIGN KEY (permission_id) REFERENCES auth_permission(id) DEFERRABLE INITIALLY DEFERRED;
--
-- Name: auth_group_permissions auth_group_permissions_group_id_b120cbf9_fk_auth_group_id; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY auth_group_permissions
ADD CONSTRAINT auth_group_permissions_group_id_b120cbf9_fk_auth_group_id FOREIGN KEY (group_id) REFERENCES auth_group(id) DEFERRABLE INITIALLY DEFERRED;
--
-- Name: auth_permission auth_permiss_content_type_id_2f476e4b_fk_django_content_type_id; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY auth_permission
ADD CONSTRAINT auth_permiss_content_type_id_2f476e4b_fk_django_content_type_id FOREIGN KEY (content_type_id) REFERENCES django_content_type(id) DEFERRABLE INITIALLY DEFERRED;
--
-- Name: auth_user_groups auth_user_groups_group_id_97559544_fk_auth_group_id; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY auth_user_groups
ADD CONSTRAINT auth_user_groups_group_id_97559544_fk_auth_group_id FOREIGN KEY (group_id) REFERENCES auth_group(id) DEFERRABLE INITIALLY DEFERRED;
--
-- Name: auth_user_groups auth_user_groups_user_id_6a12ed8b_fk_auth_user_id; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY auth_user_groups
ADD CONSTRAINT auth_user_groups_user_id_6a12ed8b_fk_auth_user_id FOREIGN KEY (user_id) REFERENCES auth_user(id) DEFERRABLE INITIALLY DEFERRED;
--
-- Name: auth_user_user_permissions auth_user_user_per_permission_id_1fbb5f2c_fk_auth_permission_id; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY auth_user_user_permissions
ADD CONSTRAINT auth_user_user_per_permission_id_1fbb5f2c_fk_auth_permission_id FOREIGN KEY (permission_id) REFERENCES auth_permission(id) DEFERRABLE INITIALLY DEFERRED;
--
-- Name: auth_user_user_permissions auth_user_user_permissions_user_id_a95ead1b_fk_auth_user_id; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY auth_user_user_permissions
ADD CONSTRAINT auth_user_user_permissions_user_id_a95ead1b_fk_auth_user_id FOREIGN KEY (user_id) REFERENCES auth_user(id) DEFERRABLE INITIALLY DEFERRED;
--
-- Name: blog_comment blog_comment_post_id_580e96ef_fk_blog_post_id; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY blog_comment
ADD CONSTRAINT blog_comment_post_id_580e96ef_fk_blog_post_id FOREIGN KEY (post_id) REFERENCES blog_post(id) DEFERRABLE INITIALLY DEFERRED;
--
-- Name: blog_post blog_post_author_id_dd7a8485_fk_auth_user_id; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY blog_post
ADD CONSTRAINT blog_post_author_id_dd7a8485_fk_auth_user_id FOREIGN KEY (author_id) REFERENCES auth_user(id) DEFERRABLE INITIALLY DEFERRED;
--
-- Name: django_admin_log django_admin_content_type_id_c4bce8eb_fk_django_content_type_id; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY django_admin_log
ADD CONSTRAINT django_admin_content_type_id_c4bce8eb_fk_django_content_type_id FOREIGN KEY (content_type_id) REFERENCES django_content_type(id) DEFERRABLE INITIALLY DEFERRED;
--
-- Name: django_admin_log django_admin_log_user_id_c564eba6_fk_auth_user_id; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY django_admin_log
ADD CONSTRAINT django_admin_log_user_id_c564eba6_fk_auth_user_id FOREIGN KEY (user_id) REFERENCES auth_user(id) DEFERRABLE INITIALLY DEFERRED;
--
-- PostgreSQL database dump complete
--
| true |
ad477da9a211001cd7c6a63c80f65ab8f01ad6ad | SQL | icylydia/PlayWithLeetCode | /262. Trips and Users/solution.sql | UTF-8 | 444 | 4.375 | 4 | [
"MIT"
] | permissive | SELECT DAY,
ROUND((Total - Completed) / Total, 2) AS `Cancellation Rate`
FROM
(SELECT T.Request_at AS DAY,
COUNT(T.Id) AS Total,
SUM(CASE WHEN T.Status = 'completed' THEN 1 ELSE 0 END) AS Completed
FROM Trips T
INNER JOIN Users U ON T.Client_Id = U.Users_Id
AND U.Role = 'client'
AND U.Banned = 'No'
WHERE T.Request_at >= '2013-10-01'
AND T.Request_at <= '2013-10-03'
GROUP BY T.Request_at) V | true |
847aa1a8ba20c7ffab4e91e82283f1a6401ac5b2 | SQL | ghforlang/DataBase | /src/main/java/com/edu/nbu/mysql/sql/practise/courses.sql | UTF-8 | 343 | 3.28125 | 3 | [] | no_license | CREATE TABLE `courses` (
`id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '自增id',
`student` VARCHAR(255) DEFAULT NULL COMMENT '学生',
`class` VARCHAR(255) DEFAULT NULL COMMENT '课程',
`score` INT(255) DEFAULT NULL COMMENT '分数',
PRIMARY KEY (`id`),
UNIQUE KEY `course` (`student`, `class`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8; | true |
13cdc00dee1159d67bbfc53a7f3f8e540396e955 | SQL | dssg/cincinnati_ems_public | /etl/pipeline/convert_mapxy_to_geom.sql | UTF-8 | 697 | 3.171875 | 3 | [] | no_license | -- First, make a new `geom` column for QGIS
alter table
@TABLE drop
column if exists geom;
alter table
@TABLE add column geom geometry(Point, 4326);
update
@TABLE
set
geom = ST_Transform(ST_SetSRID(ST_Point(i_mapx, i_mapy), 3735), 4326);
-- Now do the same for longitude and latitude using the geom column
alter table
@TABLE drop
column if exists longitude;
alter table
@TABLE add column longitude double precision;
update
@TABLE
set
longitude = st_y(geom);
alter table
@TABLE drop
column if exists latitude;
alter table
@TABLE add column latitude double precision;
update
@TABLE
set
latitude = st_x(geom);
| true |
d7429529c6c9f57d7bcea05fc6c7e8bf24ad5abd | SQL | manuellena5/TpJavaModWeb | /src/biblioteca.sql | ISO-8859-10 | 5,947 | 3.90625 | 4 | [] | no_license | # SQL Manager 2005 Lite for MySQL 3.7.0.1
# ---------------------------------------
# Host : localhost
# Port : 3306
# Database : biblioteca
SET FOREIGN_KEY_CHECKS=0;
DROP DATABASE IF EXISTS `biblioteca`;
CREATE DATABASE `biblioteca`
CHARACTER SET 'latin1'
COLLATE 'latin1_swedish_ci';
#
# Structure for the `categorias` table :
#
CREATE TABLE `categorias` (
`id_categoria` int(11) NOT NULL auto_increment,
`descripcion` varchar(50) default NULL,
PRIMARY KEY (`id_categoria`),
UNIQUE KEY `id_categoria` (`id_categoria`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
#
# Structure for the `tipo_elementos` table :
#
CREATE TABLE `tipo_elementos` (
`id_tipoelemento` int(11) NOT NULL auto_increment,
`nombre` varchar(50) default NULL,
`cantMaxReservasPend` int(11) default NULL,
PRIMARY KEY (`id_tipoelemento`),
UNIQUE KEY `id_tipoelemento` (`id_tipoelemento`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
#
# Structure for the `elementos` table :
#
CREATE TABLE `elementos` (
`id_elemento` int(11) NOT NULL auto_increment,
`nombre` varchar(50) default NULL,
`stock` int(11) default NULL,
`autor` varchar(50) default NULL,
`genero` varchar(50) default NULL,
`descripcion` varchar(200) default NULL,
`id_tipoelemento` int(11) default NULL,
PRIMARY KEY (`id_elemento`),
UNIQUE KEY `id_elemento` (`id_elemento`),
KEY `id_tipoelemento` (`id_tipoelemento`),
CONSTRAINT `elementos_tipoelemento_fk` FOREIGN KEY (`id_tipoelemento`) REFERENCES `tipo_elementos` (`id_tipoelemento`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
#
# Structure for the `personas` table :
#
CREATE TABLE `personas` (
`id_persona` int(11) NOT NULL auto_increment,
`nombre` varchar(50) NOT NULL,
`apellido` varchar(50) NOT NULL,
`dni` varchar(50) default NULL,
`usuario` varchar(50) NOT NULL,
`password` varchar(50) NOT NULL,
`estado` tinyint(1) default NULL,
`id_categoria` int(11) default NULL,
PRIMARY KEY (`id_persona`),
UNIQUE KEY `id_persona` (`id_persona`),
KEY `id_categoria` (`id_categoria`),
CONSTRAINT `personas_categoria_fk` FOREIGN KEY (`id_categoria`) REFERENCES `categorias` (`id_categoria`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
#
# Structure for the `reservas` table :
#
CREATE TABLE `reservas` (
`id_elemento` int(11) NOT NULL,
`id_persona` int(11) NOT NULL,
`fecha_registro` date NOT NULL,
`fecha_inicio` date default NULL,
`fecha_fin` date default NULL,
`detalle` varchar(50) default NULL,
`estado` varchar(50) default NULL,
PRIMARY KEY (`id_elemento`,`id_persona`,`fecha_registro`),
KEY `id_elemento` (`id_elemento`),
KEY `id_persona` (`id_persona`),
CONSTRAINT `reservas_persona_fk` FOREIGN KEY (`id_persona`) REFERENCES `personas` (`id_persona`) ON DELETE CASCADE,
CONSTRAINT `reservas_elemento_fk` FOREIGN KEY (`id_elemento`) REFERENCES `elementos` (`id_elemento`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
#
# Data for the `categorias` table (LIMIT 0,500)
#
INSERT INTO `categorias` (`id_categoria`, `descripcion`) VALUES
(1,'Usuario'),
(2,'Administrador'),
(3,'Encargado');
COMMIT;
#
# Data for the `tipo_elementos` table (LIMIT 0,500)
#
INSERT INTO `tipo_elementos` (`id_tipoelemento`, `nombre`, `cantMaxReservasPend`) VALUES
(1,'Libro',2),
(2,'Revistas',3),
(3,'Peliculas',1);
COMMIT;
#
# Data for the `elementos` table (LIMIT 0,500)
#
INSERT INTO `elementos` (`id_elemento`, `nombre`, `stock`, `autor`, `genero`, `descripcion`, `id_tipoelemento`) VALUES
(1,'Harry Potter y la Piedra Filosofal',1,'J K Rowling','Fantasia','Harry Potter ',1),
(2,'Don Quijote de la mancha',1,'Miguel Cervantes','Novela Espaola','Don Quijote de la Mancha es una novela escrita por el espaol Miguel de Cervantes Saavedra.',1),
(5,'Descubrimiento America 2',1,'Nat Geo','Historia','Sin descripcion',2),
(6,'Papeles en el viento',1,'Eduardo Sacheri','Novela','Sin descripcion',1),
(7,'El seor de los Anillos',1,'J R R','Fantasia','Sin descripcion',1),
(13,'Titanic',1,'James cameron','drama','Sin descripcion',3),
(14,'Caperucita',2,'Pablo','Cuento infantil','Sin descripcion',1),
(16,'Martin Fierro',1,'Jose Hernandez','Ficcion','Sin descripcion',1),
(20,'Alienigenas ancestrales',1,'History','Historia','Historia de descubrimientos sobre la existencia de alienigenas',2),
(22,'Cocina argentina',1,'Maru Botana','Cocina','Sin descripcion',2),
(24,'Rayuela',1,'Julio Cortazar','Novela','Sin descripcion',1),
(30,'Java',1,'Sin autor','Sin genero','Sin descripcion',1);
COMMIT;
#
# Data for the `personas` table (LIMIT 0,500)
#
INSERT INTO `personas` (`id_persona`, `nombre`, `apellido`, `dni`, `usuario`, `password`, `estado`, `id_categoria`) VALUES
(2,'Manuel Alejandro','Ellena','37774145','manu_landeta','123456789',1,1),
(3,'Roman','Bressan','37896541','roman.94','123456789',1,1),
(8,'Admin','Admin','000','admin','admin',1,2),
(16,'Jose Luis','Martinez','10337894','encargado','encargado',1,3);
COMMIT;
#
# Data for the `reservas` table (LIMIT 0,500)
#
INSERT INTO `reservas` (`id_elemento`, `id_persona`, `fecha_registro`, `fecha_inicio`, `fecha_fin`, `detalle`, `estado`) VALUES
(1,2,'2017-12-04','2017-12-04','2017-12-07','Sin detalle','Sin devolver'),
(2,2,'2017-12-04','2017-12-04','2017-12-07','Sin detalle','Sin devolver'),
(5,2,'2017-12-05','2017-12-08','2017-12-10','Sin detalle','Cancelada'),
(13,2,'2017-12-05','2017-12-08','2017-12-10','Sin detalle','Cancelada'),
(20,2,'2017-12-04','2017-12-04','2017-12-07','Sin detalle','Terminada'),
(20,2,'2017-12-05','2017-12-05','2017-12-08','Sin detalle','Sin devolver'),
(22,3,'2017-12-05','2017-12-12','2017-12-15','Sin detalle','Activa'),
(24,3,'2017-12-05','2017-12-07','2017-12-09','Sin detalle','Sin devolver'),
(30,3,'2017-12-05','2017-12-05','2017-12-08','Sin detalle','Sin devolver');
COMMIT;
| true |
0120751634142ded816b82f1195d502fcb037994 | SQL | yacineak97/agent-api | /config/migration.sql | UTF-8 | 3,678 | 3.921875 | 4 | [] | no_license | -- DO $$
-- begin
-- IF EXISTS (SELECT FROM pg_database WHERE datname = 'beacon') THEN
-- RAISE NOTICE 'Database already exists'; -- optional
-- ELSE
-- PERFORM dblink_exec('dbname=' || current_database() -- current db
-- , 'CREATE DATABASE ' || quote_ident('beacon'));
-- END IF;
-- end $$;
-- \c beacon;
DROP TABLE IF EXISTS prodcuts_comments CASCADE;
DROP TABLE IF EXISTS accounts CASCADE;
DROP TABLE IF EXISTS products_videos CASCADE;
DROP TABLE IF EXISTS products_images CASCADE;
DROP TABLE IF EXISTS videos CASCADE;
DROP TABLE IF EXISTS images CASCADE;
DROP TABLE IF EXISTS agents CASCADE;
DROP TABLE IF EXISTS roles CASCADE;
DROP TABLE IF EXISTS categories CASCADE;
DROP TABLE IF EXISTS products CASCADE;
DROP TABLE IF EXISTS visitors CASCADE;
DROP TABLE IF EXISTS category CASCADE;
CREATE TABLE accounts (
id SERIAL PRIMARY KEY,
companyName VARCHAR(1024) NOT NULL,
avatar VARCHAR(2048) NOT NULL
);
CREATE TABLE roles (
id SERIAL PRIMARY KEY,
title VARCHAR(2048) NOT NULL,
permission INT[] NOT NULL
);
CREATE TABLE agents (
id SERIAL PRIMARY KEY,
username VARCHAR(128) NOT NULL,
first_name VARCHAR(512) NOT NULL,
last_name VARCHAR(512) NOT NULL,
email VARCHAR(2048) NOT NULL,
avatar VARCHAR(2048) NOT NULL,
phone VARCHAR(20) NOT NULL,
brief TEXT NOT NULL DEFAULT 'N/A',
password TEXT NOT NULL,
role SERIAL REFERENCES roles(id) ON DELETE CASCADE,
account_id SERIAL REFERENCES accounts(id) ON DELETE CASCADE
);
CREATE TABLE categories (
id SERIAL PRIMARY KEY,
title VARCHAR(2048) NOT NULL,
description TEXT NOT NULL DEFAULT 'N/A'
);
CREATE TABLE products (
id SERIAL PRIMARY KEY,
title VARCHAR(2048) NOT NULL,
description TEXT NOT NULL DEFAULT 'N/A',
price FLOAT NOT NULL,
old_price FLOAT DEFAULT 0,
created_at BIGINT,
agent_id SERIAL REFERENCES agents(id) ON DELETE CASCADE,
account_id SERIAL REFERENCES accounts(id) ON DELETE CASCADE,
category_id SERIAL REFERENCES categories(id) ON DELETE SET NULL
);
ALTER TABLE products ALTER COLUMN category_id drop not null;
CREATE TABLE visitors (
id SERIAL PRIMARY KEY,
username VARCHAR(128) NOT NULL,
firstName VARCHAR(512) NOT NULL,
lastName VARCHAR(512) NOT NULL,
email VARCHAR(2048) NOT NULL,
phone VARCHAR(20) NOT NULL,
avatar VARCHAR(2048) NOT NULL,
brief TEXT NOT NULL DEFAULT 'N/A',
address VARCHAR(2048) NOT NULL
);
CREATE TABLE prodcuts_comments (
id SERIAL PRIMARY KEY,
comment TEXT NOT NULL,
rate INT NOT NULL,
liked BOOLEAN NOT NULL,
disliked BOOLEAN NOT NULL,
created_at TIMESTAMP NOT NULL,
author_id SERIAL REFERENCES visitors(id) ON DELETE CASCADE,
comment_id SERIAL REFERENCES prodcuts_comments(id) ON DELETE CASCADE,
product_id SERIAL REFERENCES products(id) ON DELETE CASCADE
);
CREATE TABLE videos (
id SERIAL PRIMARY KEY,
url TEXT NOT NULL,
title VARCHAR(2048) NOT NULL,
description TEXT NOT NULL DEFAULT 'N/A',
agent_id SERIAL REFERENCES agents(id) ON DELETE CASCADE
);
CREATE TABLE images (
id SERIAL PRIMARY KEY,
url TEXT NOT NULL,
title VARCHAR(2048) NOT NULL,
description TEXT NOT NULL DEFAULT 'N/A',
agent_id SERIAL REFERENCES agents(id) ON DELETE CASCADE
);
CREATE TABLE products_images (
id SERIAL PRIMARY KEY,
product_id SERIAL REFERENCES products(id) ON DELETE CASCADE,
image_id SERIAL REFERENCES images(id) ON DELETE CASCADE
);
CREATE TABLE products_videos (
id SERIAL PRIMARY KEY,
product_id SERIAL REFERENCES products(id) ON DELETE CASCADE,
video_id SERIAL REFERENCES videos(id) ON DELETE CASCADE
);
| true |
5d942d12c21d2e06399e5cf5b7107ebafe082719 | SQL | kennethtsai0/ubiquitous-lamp | /Project1/SQL/reimbursementDCL.sql | UTF-8 | 619 | 2.90625 | 3 | [] | no_license | drop user reimbursementapp cascade;
create user reimbursementapp
identified by p4ssw0rd
default tablespace users
temporary tablespace temp
quota 10m on users;
-- we need to be able to connect to another user from bookapp
grant connect to reimbursementapp;
-- we want the ability to create types
grant resource to reimbursementapp;
-- we don't want the ability to alter and destroy types
-- grant dba to bookapp;
-- We do want the ability to create a session for transactions
grant create session to reimbursementapp;
-- self explanatory
grant create table to reimbursementapp;
grant create view to reimbursementapp; | true |
5d60aa7cff05ca7d473316da59b9b714d9ac0caa | SQL | ichoukou/Bigdata | /main/law/sql/sql_2018_10_09/192.168.12.34/laws_doc2/34-laws_doc2-创建法条临时表.sql | UTF-8 | 2,367 | 3.53125 | 4 | [] | no_license | CREATE table judgment2_etl_lawlist as SELECT a.id,a.uuid,b.lawlist,a.casedate from judgment2 a,tmp_weiwenchao b where a.uuid = b.uuid
SELECT id,province,city,district,court,court_cate from tmp_raolu where id < 100;
GRANT ALL PRIVILEGES ON *.* TO 'caitinggui'@'%' IDENTIFIED BY '123456' WITH GRANT OPTION;
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'HHly2017.' WITH GRANT OPTION;
GRANT ALL PRIVILEGES ON *.* TO 'test2'@'%' IDENTIFIED BY 'test2' WITH GRANT OPTION;
FLUSH PRIVILEGES;
GRANT ALL PRIVILEGES ON *.* TO 'test2'@'%'
mysql权限级别分为全局权限(包括所有库及库下的表)、库权限(包括该库下的表)、表权限(只包括具体的一个表),
对应于mysql库里面的user表、db表、tables_priv表。
grant all privileges on *.* :操作mysql.user表
grant all privileges on db.* :操作mysql.db表
grant all privileges on db.table :操作mysql.tables_priv表
这三种操作分别对应不同的表,互不影响,赋予一个用户大粒度的权限,并不能收回小粒度的权限。
SELECT * from mysql.user
SELECT * from mysql.db
SELECT * from mysql.tables_priv
查看所有用户:
SELECT DISTINCT CONCAT('User: ''',user,'''@''',host,''';') AS query FROM mysql.user;
查看权限
SHOW GRANTS FOR 'liuf';
--回收改表、删表权限
REVOKE DROP,Alter,Delete,INDEX,Insert,Update ON laws_doc.test FROM 'test2';
CREATE TABLE test like tmp2_wxy;
REVOKE DROP ON *.* FROM 'liuf';
FLUSH PRIVILEGES;
--回收表记录的增删改权限
REVOKE INSERT ON newythdb.* FROM 'zplat_cen1';
REVOKE UPDATE ON newythdb.* FROM 'zplat_cen1';
REVOKE DELETE ON newythdb.* FROM 'zplat_cen1';
数据库/数据表/数据列权限:
Drop: 删除数据表或数据库。
Alter: 修改已存在的数据表(例如增加/删除列)和索引。
Delete: 删除表的记录。
INDEX: 建立或删除索引。
Insert: 增加表的记录。
Update: 修改表中已存在的记录。
Create: 建立新的数据库或数据表。
Select: 显示/搜索表的记录。
全局管理MySQL用户权限:
file: 在MySQL服务器上读写文件。
PROCESS: 显示或杀死属于其它用户的服务线程。
RELOAD: 重载访问控制表,刷新日志等。
SHUTDOWN: 关闭MySQL服务。
特别的权限:
ALL: 允许做任何事(和root一样)。
USAGE: 只允许登录--其它什么也不允许做。
| true |
85a12eb546fb873df5e2bc869e5f8c921ecfb7f6 | SQL | Arshad-Ahmed/DataSciencePortfolio | /Dataquest/sql-databases-beginner/Challenge_ Practice expressing complex SQL queries-130.sql | UTF-8 | 485 | 3.9375 | 4 | [] | no_license | ## 2. Select and Limit ##
select College_jobs, Median, Unemployment_rate
from recent_grads
LIMIT 20;
## 3. Where ##
select Major
FROM recent_grads
where Major_category= 'Arts'
limit 5;
## 4. Operators ##
select Major, Total, Median, Unemployment_rate
from recent_grads
where Major_category != 'Engineering' AND ((Median <= 50000) OR (Unemployment_rate > 0.065))
## 5. Ordering ##
select Major
from recent_grads
where Major_category != 'Engineering'
order by Major desc
limit 20; | true |
dfd883ed1499ed2042456facc2dc3cd673a3e72f | SQL | tinyshop603/tinymall | /doc/db/tinymall_delivery_detail.sql | UTF-8 | 770 | 3.03125 | 3 | [] | no_license | drop table tinymall_delivery_detail;
CREATE TABLE `tinymall_delivery_detail` (
delivery_id varchar(50) not null COMMENT'订单Id',
client_id varchar(50) COMMENT'返回达达运单号,默认为空',
dm_id varchar(50) COMMENT '达达配送员id,接单以后会传',
dm_name varchar(50) COMMENT '达达配送员名字',
dm_mobile varchar(20) COMMENT '配送员手机号,接单以后会传',
update_time datetime DEFAULT NULL,
create_time datetime DEFAULT now(),
cancel_reason varchar(255) COMMENT '配送员手机号,接单以后会传',
cancel_from varchar(50) COMMENT '订单取消原因来源',
distance varchar(50) COMMENT '距离',
fee int(10) COMMENT '实际运费',
deliver_fee int(10) COMMENT '运费',
PRIMARY KEY (delivery_id)
)
| true |
9d002873d8f8e86fe3c516261c4aaac5f016fc7d | SQL | yunius/Agenda | /db/AgendaDatabase.sql | UTF-8 | 14,543 | 3.109375 | 3 | [] | no_license | DROP DATABASE if exists Agenda;
CREATE DATABASE if not exists Agenda CHARACTER SET utf8 COLLATE utf8_general_ci;
USE Agenda;
CREATE TABLE Type_de_materiel(
IDtypeMat Int NOT NULL auto_increment ,
typeMatLibelle Varchar (45) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ,
PRIMARY KEY (IDtypeMat )
)ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_general_ci;
CREATE TABLE Type_Activite(
IDtypeActivite Int NOT NULL auto_increment,
activiteLibelle Varchar (25) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ,
IDactiviteParente Int,
PRIMARY KEY (IDtypeActivite )
)ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_general_ci;
CREATE TABLE cotation(
IDcotation Int NOT NULL auto_increment,
LibelleCotation Varchar (10) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ,
ValeurCotation Varchar (10) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ,
PRIMARY KEY (IDcotation )
)ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_general_ci;
CREATE TABLE Adherents(
IDadherent Int NOT NULL auto_increment,
numLicence Int (14) NOT NULL,
statut Varchar (25) CHARACTER SET utf8 COLLATE utf8_general_ci ,
nomAdherent Varchar (50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ,
prenomAdherent Varchar (50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ,
pseudoAdherent Varchar (50) CHARACTER SET utf8 COLLATE utf8_general_ci ,
motDePasseAdherent Varchar (50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ,
DateNaissAdherent Date NOT NULL ,
genreAdherent Char (6) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ,
MailAdherent Varchar (60) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ,
adherentLibelleRue Varchar (50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ,
adherentNumRue Int NOT NULL ,
adherentNumTel Int NOT NULL ,
Vehicule Bool ,
co_voitureur Bool ,
CompteActif Bool ,
IDcommune Int NOT NULL ,
IDclub Int NOT NULL ,
IDrole Int ,
PRIMARY KEY (IDadherent )
)ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_general_ci;
CREATE TABLE commune(
IDcommune Int NOT NULL auto_increment ,
nomCommune Varchar (50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ,
codePostal Char (5) NOT NULL ,
IDpays Int NOT NULL ,
PRIMARY KEY (IDcommune )
)ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_general_ci;
CREATE TABLE pays(
IDpays Int NOT NULL auto_increment,
nomPays Char (25) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ,
PRIMARY KEY (IDpays )
)ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_general_ci;
CREATE TABLE club(
IDclub Int NOT NULL auto_increment,
nomClub Char (25) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ,
clubSecteur Varchar (25) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ,
clubNumTel Int NOT NULL ,
IDcommune Int NOT NULL ,
PRIMARY KEY (IDclub )
)ENGINE=InnoDB;
CREATE TABLE Encadrant_Professionnel(
IDencadrantPro Int NOT NULL auto_increment,
encProNom Varchar (50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ,
encProPrenom Varchar (50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ,
encProDateNaiss Date NOT NULL ,
encProGenre Char (5) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ,
encProMail Varchar (50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ,
encProLibelleRue Varchar (50) CHARACTER SET utf8 COLLATE utf8_general_ci ,
encProNumRue Int ,
encProNumTel Int NOT NULL ,
IDcommune Int ,
PRIMARY KEY (IDencadrantPro )
)ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_general_ci;
CREATE TABLE secteur(
IDsecteur Int NOT NULL auto_increment,
secteurLibelle Varchar (50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ,
IDcommune Int NOT NULL ,
PRIMARY KEY (IDsecteur )
)ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_general_ci;
CREATE TABLE Objectif(
IDobjectif Int NOT NULL auto_increment,
objectifLibelle Varchar (50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ,
IDsecteur Int NOT NULL ,
PRIMARY KEY (IDobjectif )
)ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_general_ci;
CREATE TABLE lieu(
IDlieu Int NOT NULL auto_increment,
lieuLibelle Varchar (50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ,
PRIMARY KEY (IDlieu )
)ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_general_ci;
CREATE TABLE Collectives(
IDcollective Int NOT NULL auto_increment,
collTitre Varchar (50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ,
collDateDebut Date NOT NULL ,
collDateFin Date ,
collDenivele Int ,
collDureeCourseEstim Float ,
collObservations Text CHARACTER SET utf8 COLLATE utf8_general_ci ,
collPublie Bool ,
collNbParticipantMax Int ,
collNbLongueurs Int ,
collHeureDepartTerrain Time ,
collHeureRetourTerrain Time ,
collDureeCourse Float ,
collConditionMeteo Varchar (100) CHARACTER SET utf8 COLLATE utf8_general_ci ,
collInfoComplementaire Text CHARACTER SET utf8 COLLATE utf8_general_ci ,
coll_incident_accident Text CHARACTER SET utf8 COLLATE utf8_general_ci ,
collTypeRocher Varchar (50) CHARACTER SET utf8 COLLATE utf8_general_ci ,
collDureeApproche Float ,
collCondition_neige_rocher_glace Text CHARACTER SET utf8 COLLATE utf8_general_ci ,
collEtatNeige Varchar (50) CHARACTER SET utf8 COLLATE utf8_general_ci ,
collConditionTerrain Text CHARACTER SET utf8 COLLATE utf8_general_ci ,
collCR_Horodateur TimeStamp ,
IDtypeActivite Int NOT NULL ,
IDobjectif Int NOT NULL ,
IDadherent Int NOT NULL ,
PRIMARY KEY (IDcollective )
)ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_general_ci;
CREATE TABLE encadrant(
IDadherent Int NOT NULL ,
IDtypeActivite Int NOT NULL ,
PRIMARY KEY (IDadherent )
)ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_general_ci;
CREATE TABLE Role(
IDrole Int NOT NULL auto_increment ,
RoleLibelle Varchar (15) CHARACTER SET utf8 COLLATE utf8_general_ci ,
RoleDescription Text CHARACTER SET utf8 COLLATE utf8_general_ci ,
PRIMARY KEY (IDrole )
)ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_general_ci;
CREATE TABLE Liste_de_materiel_type(
IDtypeMat Int NOT NULL ,
IDtypeActivite Int NOT NULL ,
PRIMARY KEY (IDtypeMat ,IDtypeActivite )
)ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_general_ci;
CREATE TABLE liste_de_cotation(
IDtypeActivite Int NOT NULL ,
IDcotation Int NOT NULL ,
PRIMARY KEY (IDtypeActivite ,IDcotation )
)ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_general_ci;
CREATE TABLE RDV(
heureRDV Time NOT NULL ,
IDlieu Int NOT NULL ,
IDcollective Int NOT NULL ,
PRIMARY KEY (IDlieu ,IDcollective )
)ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_general_ci;
CREATE TABLE etats(
IDetats Int NOT NULL auto_increment,
libelleEtat Varchar (25) NOT NULL ,
PRIMARY KEY (IDetats )
)ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_general_ci;
CREATE TABLE participants(
IDetats Int NOT NULL ,
IDadherent Int NOT NULL ,
IDcollective Int NOT NULL ,
PRIMARY KEY (IDadherent ,IDcollective)
)ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_general_ci;
CREATE TABLE encadrantPro_liste(
IDencadrantPro Int NOT NULL ,
IDcollective Int NOT NULL ,
PRIMARY KEY (IDencadrantPro ,IDcollective )
)ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_general_ci;
CREATE TABLE co_encadrant(
IDadherent Int NOT NULL ,
IDcollective Int NOT NULL ,
PRIMARY KEY (IDadherent ,IDcollective )
)ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_general_ci;
CREATE TABLE commentaire(
ComCompteur int NOT NULL,
contenu Text CHARACTER SET utf8 COLLATE utf8_general_ci ,
comHorodateur Time ,
IDadherent Int NOT NULL ,
IDcollective Int NOT NULL ,
PRIMARY KEY (ComCompteur, IDadherent ,IDcollective )
)ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_general_ci;
CREATE TABLE emprunt_location(
IDadherent Int NOT NULL ,
IDtypeMat Int NOT NULL ,
IDcollective Int NOT NULL ,
PRIMARY KEY (IDadherent ,IDtypeMat ,IDcollective )
)ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_general_ci;
CREATE TABLE liste_de_materiel_collective(
IDtypeMat Int NOT NULL ,
IDcollective Int NOT NULL ,
PRIMARY KEY (IDtypeMat ,IDcollective )
)ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_general_ci;
CREATE TABLE CollCotations(
IDcollective Int NOT NULL ,
IDcotation Int NOT NULL ,
PRIMARY KEY (IDcollective ,IDcotation )
)ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE Type_Activite ADD CONSTRAINT FK_Type_Activite_IDactiviteParente FOREIGN KEY (IDactiviteParente) REFERENCES Type_Activite(IDtypeActivite);
ALTER TABLE Adherents ADD CONSTRAINT FK_Adherents_IDcommune FOREIGN KEY (IDcommune) REFERENCES commune(IDcommune);
ALTER TABLE Adherents ADD CONSTRAINT FK_Adherents_IDclub FOREIGN KEY (IDclub) REFERENCES club(IDclub);
ALTER TABLE Adherents ADD CONSTRAINT FK_Adherents_IDrole FOREIGN KEY (IDrole) REFERENCES Role(IDrole);
ALTER TABLE commune ADD CONSTRAINT FK_commune_IDpays FOREIGN KEY (IDpays) REFERENCES pays(IDpays);
ALTER TABLE club ADD CONSTRAINT FK_club_IDcommune FOREIGN KEY (IDcommune) REFERENCES commune(IDcommune);
ALTER TABLE Encadrant_Professionnel ADD CONSTRAINT FK_Encadrant_Professionnel_IDcommune FOREIGN KEY (IDcommune) REFERENCES commune(IDcommune);
ALTER TABLE secteur ADD CONSTRAINT FK_secteur_IDcommune FOREIGN KEY (IDcommune) REFERENCES commune(IDcommune);
ALTER TABLE Objectif ADD CONSTRAINT FK_Objectif_IDsecteur FOREIGN KEY (IDsecteur) REFERENCES secteur(IDsecteur);
ALTER TABLE Collectives ADD CONSTRAINT FK_Collectives_IDtypeActivite FOREIGN KEY (IDtypeActivite) REFERENCES Type_Activite(IDtypeActivite);
ALTER TABLE Collectives ADD CONSTRAINT FK_Collectives_IDobjectif FOREIGN KEY (IDobjectif) REFERENCES Objectif(IDobjectif);
ALTER TABLE Collectives ADD CONSTRAINT FK_Collectives_IDadherent FOREIGN KEY (IDadherent) REFERENCES Adherents(IDadherent);
ALTER TABLE encadrant ADD CONSTRAINT FK_encadrant_IDadherent FOREIGN KEY (IDadherent) REFERENCES Adherents(IDadherent);
ALTER TABLE encadrant ADD CONSTRAINT FK_encadrant_IDtypeActivite FOREIGN KEY (IDtypeActivite) REFERENCES Type_Activite(IDtypeActivite);
ALTER TABLE Liste_de_materiel_type ADD CONSTRAINT FK_Liste_de_materiel_type_IDtypeMat FOREIGN KEY (IDtypeMat) REFERENCES Type_de_materiel(IDtypeMat);
ALTER TABLE Liste_de_materiel_type ADD CONSTRAINT FK_Liste_de_materiel_type_IDtypeActivite FOREIGN KEY (IDtypeActivite) REFERENCES Type_Activite(IDtypeActivite);
ALTER TABLE liste_de_cotation ADD CONSTRAINT FK_liste_de_cotation_IDtypeActivite FOREIGN KEY (IDtypeActivite) REFERENCES Type_Activite(IDtypeActivite);
ALTER TABLE liste_de_cotation ADD CONSTRAINT FK_liste_de_cotation_IDcotation FOREIGN KEY (IDcotation) REFERENCES cotation(IDcotation);
ALTER TABLE RDV ADD CONSTRAINT FK_RDV_IDlieu FOREIGN KEY (IDlieu) REFERENCES lieu(IDlieu);
ALTER TABLE RDV ADD CONSTRAINT FK_RDV_IDcollective FOREIGN KEY (IDcollective) REFERENCES Collectives(IDcollective);
ALTER TABLE participants ADD CONSTRAINT FK_participants_IDadherent FOREIGN KEY (IDadherent) REFERENCES Adherents(IDadherent);
ALTER TABLE participants ADD CONSTRAINT FK_participants_IDetats FOREIGN KEY (IDetats) REFERENCES etats(IDetats);
ALTER TABLE participants ADD CONSTRAINT FK_participants_IDcollective FOREIGN KEY (IDcollective) REFERENCES Collectives(IDcollective);
ALTER TABLE encadrantPro_liste ADD CONSTRAINT FK_encadrantPro_liste_IDencadrantPro FOREIGN KEY (IDencadrantPro) REFERENCES Encadrant_Professionnel(IDencadrantPro);
ALTER TABLE encadrantPro_liste ADD CONSTRAINT FK_encadrantPro_liste_IDcollective FOREIGN KEY (IDcollective) REFERENCES Collectives(IDcollective);
ALTER TABLE co_encadrant ADD CONSTRAINT FK_co_encadrant_IDadherent FOREIGN KEY (IDadherent) REFERENCES Adherents(IDadherent);
ALTER TABLE co_encadrant ADD CONSTRAINT FK_co_encadrant_IDcollective FOREIGN KEY (IDcollective) REFERENCES Collectives(IDcollective);
ALTER TABLE commentaire ADD CONSTRAINT FK_commentaire_IDadherent FOREIGN KEY (IDadherent) REFERENCES Adherents(IDadherent);
ALTER TABLE commentaire ADD CONSTRAINT FK_commentaire_IDcollective FOREIGN KEY (IDcollective) REFERENCES Collectives(IDcollective);
ALTER TABLE emprunt_location ADD CONSTRAINT FK_emprunt_location_IDadherent FOREIGN KEY (IDadherent) REFERENCES Adherents(IDadherent);
ALTER TABLE emprunt_location ADD CONSTRAINT FK_emprunt_location_IDtypeMat FOREIGN KEY (IDtypeMat) REFERENCES Type_de_materiel(IDtypeMat);
ALTER TABLE emprunt_location ADD CONSTRAINT FK_emprunt_location_IDcollective FOREIGN KEY (IDcollective) REFERENCES Collectives(IDcollective);
ALTER TABLE liste_de_materiel_collective ADD CONSTRAINT FK_liste_de_materiel_collective_IDtypeMat FOREIGN KEY (IDtypeMat) REFERENCES Type_de_materiel(IDtypeMat);
ALTER TABLE liste_de_materiel_collective ADD CONSTRAINT FK_liste_de_materiel_collective_IDcollective FOREIGN KEY (IDcollective) REFERENCES Collectives(IDcollective);
ALTER TABLE CollCotations ADD CONSTRAINT FK_CollCotations_IDcollective FOREIGN KEY (IDcollective) REFERENCES Collectives(IDcollective);
ALTER TABLE CollCotations ADD CONSTRAINT FK_CollCotations_IDcotation FOREIGN KEY (IDcotation) REFERENCES cotation(IDcotation);
| true |
e4e8a64810815cf7ce1d8d1d8290b001d9d6b1af | SQL | blackie1019/dotnet-mariadb-lab | /db-scripts/Lab/Transaction/CreateSP_AddNewProduct.sql | UTF-8 | 146 | 2.859375 | 3 | [] | no_license | DELIMITER //
CREATE PROCEDURE AddNewUser(IN userName NVARCHAR(40))
BEGIN
INSERT INTO User(User.Name) VALUES (userName);
END
//
DELIMITER ; | true |
cd84f6b85f130a4dc9b82ed28e43cdaac8eb83d3 | SQL | Sebastianch7/Android_distribution | /base.sql | UTF-8 | 7,431 | 3.328125 | 3 | [] | no_license | -- --------------------------------------------------------
-- Host: 127.0.0.1
-- Versión del servidor: 5.6.24 - MySQL Community Server (GPL)
-- SO del servidor: Win32
-- HeidiSQL Versión: 9.3.0.4984
-- --------------------------------------------------------
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET NAMES utf8mb4 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
-- Volcando estructura de base de datos para edibcac_distribucion_android
CREATE DATABASE IF NOT EXISTS `edibcac_distribucion_android` /*!40100 DEFAULT CHARACTER SET ucs2 COLLATE ucs2_spanish_ci */;
USE `edibcac_distribucion_android`;
-- Volcando estructura para tabla edibcac_distribucion_android.aplication
CREATE TABLE IF NOT EXISTS `aplication` (
`appId` int(11) NOT NULL AUTO_INCREMENT,
`appName` varchar(50) COLLATE ucs2_spanish_ci NOT NULL,
`appDescription` varchar(50) COLLATE ucs2_spanish_ci NOT NULL,
`appImage` text COLLATE ucs2_spanish_ci NOT NULL,
`appRoute` varchar(50) COLLATE ucs2_spanish_ci NOT NULL,
`labId` int(11) NOT NULL,
`typeId` int(11) NOT NULL,
PRIMARY KEY (`appId`),
UNIQUE KEY `appName` (`appName`),
UNIQUE KEY `appRoute` (`appRoute`),
KEY `appLaboratory` (`labId`),
KEY `appType` (`typeId`),
CONSTRAINT `appLaboratory` FOREIGN KEY (`labId`) REFERENCES `laboratory` (`labId`),
CONSTRAINT `appType` FOREIGN KEY (`typeId`) REFERENCES `typeaplication` (`typeId`)
) ENGINE=InnoDB AUTO_INCREMENT=51 DEFAULT CHARSET=ucs2 COLLATE=ucs2_spanish_ci;
-- Volcando datos para la tabla edibcac_distribucion_android.aplication: ~2 rows (aproximadamente)
/*!40000 ALTER TABLE `aplication` DISABLE KEYS */;
INSERT INTO `aplication` (`appId`, `appName`, `appDescription`, `appImage`, `appRoute`, `labId`, `typeId`) VALUES
(7, 'calculadora tecnofarma', 'calculadora de tecnofarma mexico', 'eqeqwqeqa', 'calculadora_tecnofarma', 2, 1),
(8, 'calculadora sanofi', 'calculadora sanofi', 'images', 'calculadora_sanofi', 2, 1),
(49, 'aaaaa', 'aaaa', '../uploads/2.jpg', '../donwload/version (6).apk', 1, 1),
(50, 'efefe', 'feeeef', '../uploads/IMG_0056.JPG', '../donwload/Pssss_-debug.apk', 2, 2);
/*!40000 ALTER TABLE `aplication` ENABLE KEYS */;
-- Volcando estructura para tabla edibcac_distribucion_android.laboratory
CREATE TABLE IF NOT EXISTS `laboratory` (
`labId` int(11) NOT NULL AUTO_INCREMENT,
`labName` varchar(50) COLLATE ucs2_spanish_ci NOT NULL,
`labDescription` varchar(50) COLLATE ucs2_spanish_ci NOT NULL,
PRIMARY KEY (`labId`),
UNIQUE KEY `labName` (`labName`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=ucs2 COLLATE=ucs2_spanish_ci;
-- Volcando datos para la tabla edibcac_distribucion_android.laboratory: ~2 rows (aproximadamente)
/*!40000 ALTER TABLE `laboratory` DISABLE KEYS */;
INSERT INTO `laboratory` (`labId`, `labName`, `labDescription`) VALUES
(1, 'Tecnofarma', 'tecnofarma laboratorios mexico'),
(2, 'Bristol', 'bristol de venezuela');
/*!40000 ALTER TABLE `laboratory` ENABLE KEYS */;
-- Volcando estructura para tabla edibcac_distribucion_android.roll
CREATE TABLE IF NOT EXISTS `roll` (
`rolId` int(11) NOT NULL AUTO_INCREMENT,
`rolName` varchar(50) COLLATE ucs2_spanish_ci NOT NULL,
`rolDescription` varchar(70) COLLATE ucs2_spanish_ci NOT NULL,
PRIMARY KEY (`rolId`),
UNIQUE KEY `rolName` (`rolName`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=ucs2 COLLATE=ucs2_spanish_ci;
-- Volcando datos para la tabla edibcac_distribucion_android.roll: ~3 rows (aproximadamente)
/*!40000 ALTER TABLE `roll` DISABLE KEYS */;
INSERT INTO `roll` (`rolId`, `rolName`, `rolDescription`) VALUES
(1, 'Admin', 'Administrador - Todos los permisos.'),
(2, 'Comercial', 'Comercial - Ventas'),
(3, 'Gerente', 'Gerente de producto');
/*!40000 ALTER TABLE `roll` ENABLE KEYS */;
-- Volcando estructura para tabla edibcac_distribucion_android.typeaplication
CREATE TABLE IF NOT EXISTS `typeaplication` (
`typeId` int(11) NOT NULL AUTO_INCREMENT,
`typeName` varchar(50) COLLATE ucs2_spanish_ci NOT NULL,
`typeDescription` varchar(50) COLLATE ucs2_spanish_ci NOT NULL,
PRIMARY KEY (`typeId`),
UNIQUE KEY `typeName` (`typeName`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=ucs2 COLLATE=ucs2_spanish_ci;
-- Volcando datos para la tabla edibcac_distribucion_android.typeaplication: ~2 rows (aproximadamente)
/*!40000 ALTER TABLE `typeaplication` DISABLE KEYS */;
INSERT INTO `typeaplication` (`typeId`, `typeName`, `typeDescription`) VALUES
(1, 'Calculadora', 'calculadora'),
(2, 'atlas', 'atlas anatomico');
/*!40000 ALTER TABLE `typeaplication` ENABLE KEYS */;
-- Volcando estructura para tabla edibcac_distribucion_android.user
CREATE TABLE IF NOT EXISTS `user` (
`userId` int(11) NOT NULL AUTO_INCREMENT,
`userName` varchar(50) COLLATE ucs2_spanish_ci NOT NULL,
`userMail` varchar(50) COLLATE ucs2_spanish_ci NOT NULL,
`userPassword` varchar(50) COLLATE ucs2_spanish_ci NOT NULL,
`userState` bit(1) NOT NULL,
`rollId` int(11) NOT NULL,
`userDateCreate` varchar(50) COLLATE ucs2_spanish_ci NOT NULL,
PRIMARY KEY (`userId`),
UNIQUE KEY `userMail` (`userMail`),
KEY `rollId` (`rollId`),
CONSTRAINT `rollId` FOREIGN KEY (`rollId`) REFERENCES `roll` (`rolId`)
) ENGINE=InnoDB AUTO_INCREMENT=71 DEFAULT CHARSET=ucs2 COLLATE=ucs2_spanish_ci;
-- Volcando datos para la tabla edibcac_distribucion_android.user: ~6 rows (aproximadamente)
/*!40000 ALTER TABLE `user` DISABLE KEYS */;
INSERT INTO `user` (`userId`, `userName`, `userMail`, `userPassword`, `userState`, `rollId`, `userDateCreate`) VALUES
(1, 'admin', 'admin', 'admin', b'0', 1, ''),
(2, 'Sebastian', 'sebass7@live.com', '1022399551SCH', b'1', 1, '2016/04/05'),
(66, '111', '111', '111', b'0', 2, '63.000000000000000000'),
(67, 'dsadas', 'sasss@ssss.com', '121212', b'0', 1, '2016/04/08'),
(68, 'asasasas', 'sassssss@ssss.com', '121212', b'1', 2, '2016/04/08'),
(69, 'asasasas', 'oiji,uju8', '121212', b'0', 2, '2016/04/08'),
(70, 'camilo', 'camilo@groups.com', '123456789', b'0', 2, '2016/04/15');
/*!40000 ALTER TABLE `user` ENABLE KEYS */;
-- Volcando estructura para tabla edibcac_distribucion_android.useraplication
CREATE TABLE IF NOT EXISTS `useraplication` (
`UAid` int(11) NOT NULL AUTO_INCREMENT,
`UserId` int(11) NOT NULL,
`appId` int(11) NOT NULL,
`UAdateCreate` date NOT NULL,
`UAdateFinish` date NOT NULL,
`UAstate` bit(1) NOT NULL,
PRIMARY KEY (`UAid`),
KEY `uaUser` (`UserId`),
KEY `uaApp` (`appId`),
CONSTRAINT `uaApp` FOREIGN KEY (`appId`) REFERENCES `aplication` (`appId`),
CONSTRAINT `uaUser` FOREIGN KEY (`UserId`) REFERENCES `user` (`userId`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=ucs2 COLLATE=ucs2_spanish_ci;
-- Volcando datos para la tabla edibcac_distribucion_android.useraplication: ~2 rows (aproximadamente)
/*!40000 ALTER TABLE `useraplication` DISABLE KEYS */;
INSERT INTO `useraplication` (`UAid`, `UserId`, `appId`, `UAdateCreate`, `UAdateFinish`, `UAstate`) VALUES
(1, 2, 7, '2016-04-06', '2016-04-11', b'1'),
(2, 2, 8, '2016-04-03', '2016-04-04', b'1');
/*!40000 ALTER TABLE `useraplication` ENABLE KEYS */;
/*!40101 SET SQL_MODE=IFNULL(@OLD_SQL_MODE, '') */;
/*!40014 SET FOREIGN_KEY_CHECKS=IF(@OLD_FOREIGN_KEY_CHECKS IS NULL, 1, @OLD_FOREIGN_KEY_CHECKS) */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
| true |
2e89acf89f9f13885e818cb930478c6a3e1fa84e | SQL | quuhua911/AiCompetitions | /CarsSalesForecast/src/SQL/CAIJUN/time_window/caijun_0313_feature_1_avg_2m3m6m12m.sql | UTF-8 | 814 | 2.5625 | 3 | [] | no_license | -- CHNAGELOH:
-- 18.3.6 caijun init.
-- <= ycc_sales_caijun0313_feature_basewindow
-- => ycc_sales_caijun0313_feature_avg_2m3m6m12m
--
DROP TABLE IF EXISTS ycc_sales_caijun0313_feature_avg_2m3m6m12m ;
CREATE TABLE ycc_sales_caijun0313_feature_avg_2m3m6m12m
as
select sale_date,province_id,city_id,class_id,sale_quantity,
(sale_last1M+sale_last2M)/2
as sale_last2M_avg,
(sale_last1M+sale_last2M+sale_last3M)/3
as sale_last3M_avg,
(sale_last1M+sale_last2M+sale_last3M+ sale_last4M+ sale_last5M+ sale_last6M)/6
as sale_last6M_avg,
(sale_last1M+sale_last2M+sale_last3M+ sale_last4M+ sale_last5M+ sale_last6M+ sale_last7M+ sale_last8M+ sale_last9M+ sale_last10M+sale_last11M+ sale_last12M)/12
as sale_last12M_avg
from prj_tc_231640_123409_4l0qvy.ycc_sales_caijun0313_feature_basewindow ;
| true |
6fc454a9266afc4a470584c2c7cb0f9001d49564 | SQL | fandashtic/arc_chennai | /Sivabalan-SQL/SQL_STORED_PROCEDURE/sp_list_InvoiceDocs.sql | UTF-8 | 739 | 3.4375 | 3 | [] | no_license | CREATE PROCEDURE sp_list_InvoiceDocs(@CUSTOMERID NVARCHAR(15), @FROMDATE DATETIME,
@TODATE DATETIME, @STATUS INT)
AS
SELECT InvoiceID, InvoiceDate,
Status = dbo.LookupDictionaryItem(CASE Status & 32 WHEN 32 THEN 'Sent' ELSE 'Not Sent' END, Default),
Customer.Company_Name, InvoiceAbstract.CustomerID
InvoiceType , DocumentID
FROM InvoiceAbstract, Customer
WHERE InvoiceAbstract.CustomerID like @CUSTOMERID
AND Status & 128 = 0 AND Status & @STATUS = 0 AND InvoiceType in (1,3)
And (status & 1024)=0 --The status 1024 is set for an implicit invoice when an customerpointredemption is made.
AND (InvoiceDate BETWEEN @FROMDATE AND @TODATE)
AND InvoiceAbstract.CustomerID = Customer.CustomerID
ORDER BY Customer.Company_Name, InvoiceDate
| true |
100676594447ed18a709f32ab3c2b24345a38764 | SQL | Davidcparrar/dsa4_week4 | /scripts.sql | UTF-8 | 460 | 2.625 | 3 | [] | no_license | create database strategy;
create table trades ("Number" int not null, "Trade type" varchar(5), "Entry time" varchar(20), "Exposure" varchar(40),
"Entry balance" float, "Exit balance" float, "Profit" float, "Pnl (incl fees)" float, "Exchange" varchar(10),
"Margin" int, "BTC Price" float);
psql -h week-4-case.cgadet6cjhqw.us-east-1.rds.amazonaws.com -U user_dash -d strategy -c "\copy trades from 'aggr.csv' with (format csv, header true, delimiter ',');"
| true |
2a827f640414dbf0fd9abf61f692ccb2cf6b6725 | SQL | gtang31/algorithms | /sql/zipcodes/zipcodes.sql | UTF-8 | 358 | 2.5625 | 3 | [] | no_license | -- Practice create tables, copy, alter, update, insert, de-dupes
-- Create table for zip codes
create table zipcodes(
id integer primary key not null auto_increment
, zip char(5) not null
, city varchar(50)
, state varchar(20)
, state_abbrv char(2)
, county varchar(30)
, latitude numeric(6,4)
, longitude numeric(7,4));
| true |
b428a960a8b6f2dea5b203451e9bddb66bd600b0 | SQL | PinchenCui/test-mysql | /1022-normal (copy)/2019-10-30-12:01:47.806022.sql | UTF-8 | 550 | 2.875 | 3 | [] | no_license | use db;
CREATE TABLE gPWFc (id smallint unsigned not null auto_increment, name varchar(32) not null, pwd varchar(32) not null, constraint pk_example primary key (id));
SELECT * FROM gPWFc;
INSERT INTO gPWFc (id,name,pwd) VALUES (null, 'qV', 'TNgZDrq9cqMtIisuO2QtqAe5U');
SELECT table_name FROM information_schema.tables WHERE table_schema="db";
SELECT * FROM example WHERE id=7;
SELECT * FROM example WHERE id=17;
SELECT * FROM example WHERE name="hollywood36830";
SELECT * FROM example WHERE name="euro";
SELECT * FROM example WHERE name="GKdvr2fFR171ECZ9W";
| true |
c5d7f97bb3eca8bf7a620eb7e434ba95c735f60b | SQL | alexanderturinske/rentme | /server/schemas.sql | UTF-8 | 6,623 | 4 | 4 | [] | no_license | DROP DATABASE IF EXISTS ecommerce;
CREATE DATABASE ecommerce;
USE ecommerce;
CREATE TABLE items (
id int NOT NULL AUTO_INCREMENT,
name varchar(50) NOT NULL,
description varchar(200) NOT NULL,
photo varchar(120) NOT NULL DEFAULT '../../assets/images/questionMark.jpg',
price int NOT NULL,
availability boolean,
PRIMARY KEY (ID)
);
CREATE TABLE address (
id int not NULL AUTO_INCREMENT,
street varchar(50),
number int,
city varchar(50),
postalcode int NOT NULL,
state varchar(30),
PRIMARY KEY (id)
);
CREATE TABLE users (
id int NOT NULL AUTO_INCREMENT,
googleid varchar(30) NOT NULL,
name varchar(50) NOT NULL,
familyname varchar(50) NOT NULL,
givenname varchar(50) NOT NULL,
email varchar(50) NOT NULL,
address_id int,
phoneNumber varchar(25),
avatar varchar(150),
birthday date,
type varchar(30) DEFAULT 'customer',
password varchar(30),
cart_Id int,
PRIMARY KEY (id),
FOREIGN KEY (address_id)
REFERENCES address(id)
ON DELETE CASCADE
);
CREATE TABLE user_items (
id int NOT NULL AUTO_INCREMENT,
user_Id int NOT NULL,
item_Id int NOT NULL,
inicial_date date,
end_date date,
PRIMARY KEY (id),
FOREIGN KEY (user_Id)
REFERENCES users(id),
FOREIGN KEY (item_Id)
REFERENCES items(id)
);
CREATE TABLE items_renting (
id int NOT NULL AUTO_INCREMENT,
user_Id int NOT NULL,
item_Id int NOT NULL,
inicial_date date,
end_date date,
PRIMARY KEY (id),
FOREIGN KEY (user_Id)
REFERENCES users(id),
FOREIGN KEY (item_Id)
REFERENCES items(id)
);
CREATE TABLE cart (
id int NOT NULL AUTO_INCREMENT,
user_Id int NOT NULL,
item_Id int NOT NULL,
PRIMARY KEY (id),
FOREIGN KEY (user_Id)
REFERENCES users(id),
FOREIGN KEY (item_Id)
REFERENCES items(id)
);
alter table users add FOREIGN KEY (cart_Id) REFERENCES cart(id) ON DELETE CASCADE;
CREATE TABLE reviews (
id int NOT NULL AUTO_INCREMENT,
items_Id int NOT NULL,
users_Id int NOT NULL,
user_experience varchar(255) NOT NULL DEFAULT '',
item_rating int(6) NOT NULL,
PRIMARY KEY (id),
FOREIGN KEY (items_Id) REFERENCES items(id),
FOREIGN KEY (users_Id) REFERENCES users(id)
);
CREATE TABLE feedback (
id int NOT NULL AUTO_INCREMENT,
users_Id_rentee int NOT NULL,
users_Id_renter int NOT NULL,
experience varchar(255) NOT NULL DEFAULT '',
rating int(6) NOT NULL,
is_rentee boolean NOT NULL,
PRIMARY KEY (id),
FOREIGN KEY (users_Id_rentee) REFERENCES users(id),
FOREIGN KEY (users_Id_renter) REFERENCES users(id)
);
-- Query for dummy data
-- add items
insert into items (name,description,price, photo) values ('Sony Laptop','This sits well on your lap! You won\'t regret it!', 14, '../../assets/images/1/computer.jpg'), ('Tennis racket and balls','An entire tennis setup to play with a friend!', 15, '../../assets/images/2/tennis.jpg'), ('Phone', 'Older phone, but still good.', 10, '../../assets/images/3/phone.jpg'),('Desktop computer','Simple computer to play your favorite video games on!', 12, '../../assets/images/4/computer.jpg'), ('Wrist watch', 'A nice watch to tell time with!', 9, '../../assets/images/1/watch.jpg');
-- add addresses
insert into address (street, number, city, postalcode) values ('Market St', 123, 'San Francisco',94102),('Market St', 12123, 'San Francisco',94102),('Montgomery St', 123, 'San Francisco',94101),('Kearny St', 246, 'San Francisco',94108),('Battery st',1015,'San Francisco',94111);
-- add user Allice
insert into users (name,email,address_id,phoneNumber,birthday,type,password, googleid, givenname, familyname, avatar) values ('Allice','allice@allice.com', (SELECT id FROM address WHERE postalcode=94111) ,48343432, '2015-6-9' ,'admin','password', 1, 'John', 'Doe', 'http://m5.paperblog.com/i/5/59754/dear-everyone-please-stop-taking-the-goofy-pi-L-k5OEtE.jpeg');
-- add user John
insert into users (name,email,address_id,phoneNumber,birthday,type,password, googleid, givenname, familyname, avatar) values ('John','john@john.com', (SELECT id FROM address WHERE postalcode=94101) ,48343432, '2015-6-9' ,'admin','password', 2, 'John', 'Doe', 'http://wallqq.com/wp-content/uploads/2015/10/goofy-face-man.jpg');
-- add user Foo
insert into users (name,email,address_id,phoneNumber,birthday,type,password, googleid, givenname, familyname, avatar) values ('Foo','john@john.com', (SELECT id FROM address WHERE postalcode=94102 and number = 123) ,48343432, '2015-6-9' ,'admin','password', 3, 'John', 'Doe', 'http://www.lexdebate.com/alec.jpg');
-- add user Bob
insert into users (name,email,address_id,phoneNumber,birthday,password, googleid, givenname, familyname, avatar) values ('Bob','bob@bob.com', (SELECT id FROM address WHERE postalcode=94108) ,48343432, '2015-6-9','password', 4, 'John', 'Doe', 'https://s-media-cache-ak0.pinimg.com/736x/2f/a5/ff/2fa5ffe953e6d679ca63711f4dfbc4b8.jpg');
-- add user Ann
insert into users (name,email,address_id,phoneNumber,birthday,password, googleid, givenname, familyname, avatar) values ('Ann','ann@ann.com', (SELECT id FROM address WHERE postalcode=94102 and number = 12123) ,48343432, '2015-6-9','password', 5, 'John', 'Doe', 'http://m5.paperblog.com/i/5/59754/dear-everyone-please-stop-taking-the-goofy-pi-L-k5OEtE.jpeg');
-- add item_user relationship
INSERT INTO user_items (user_Id, item_Id) VALUES (1, 1), (2, 2), (3, 3), (4, 4), (1, 5);
-- add reviews
INSERT INTO reviews (items_Id, users_Id, user_experience, item_rating) VALUES (1, 1, 'good', 4), (1, 2, 'fine', 3), (4, 3, 'bad', 0), (5, 5, 'the worst', 1), (2, 3, 'eh', 5), (3, 1, 'I just don\'t understand', 3);
-- add feedback
INSERT INTO feedback (users_Id_rentee, users_Id_renter, experience, rating, is_rentee) VALUES (1, 2, 'They were mean!', 0, 0), (2, 1, 'They were whinny!', 0, 1), (4, 3, 'Cool dude!', 5, 1), (3, 4, 'They were self-centered!', 2, 0), (3, 2, 'Good!', 3, 1), (1, 4, 'They were very mean!', 1, 0), (4, 1, 'Nicee!', 4, 1);
-- Query to retrieve items info.
-- insert into users (name,email,address_id,phoneNumber,birthday,type,password,item_Id) values ('John','john@john.com', (SELECT id FROM address WHERE postalcode=94101) ,48343432, '2015-6-9' ,'admin','password', (SELECT id FROM items WHERE name='laptop'));
-- select i.id,i.name,i.description,i.price,i.availability
-- from items i
-- inner join users s on i.id = s.item_Id
-- inner join address a on a.id = s.address_id and a.postalcode = 94111;
-- select i.id,i.name,i.description,i.price,i.availability, s.name from items i inner join users s on i.id = s.item_Id inner join address a on a.id = s.address_id and a.postalcode = 94111;
| true |
822f6501b02fb9d024af5ac7bb0693fc4baa1d18 | SQL | anandeka/my-project | /DBScripts/MasterScripts/Master_Scripts_636.sql | UTF-8 | 6,652 | 2.859375 | 3 | [] | no_license |
Insert into GMC_GRID_MENU_CONFIGURATION
(MENU_ID, GRID_ID, MENU_DISPLAY_NAME, DISPLAY_SEQ_NO, MENU_LEVEL_NO,
FEATURE_ID, LINK_CALLED, ICON_CLASS, MENU_PARENT_ID, ACL_ID)
Values
('LOG_DG_SL', 'LOG', 'Sampling Label Document', 15, 2,
'APP-PFL-N-182', 'function(){generateDocumentForSelectedGMR();}', NULL, '102', NULL);
-----------------------------------------------------
INSERT INTO dgm_document_generation_master
(dgm_id, doc_id, doc_name, activity_id, sequence_order,
fetch_query,
is_concentrate
)
VALUES ('DGM_SL', 'SL_DOC', 'Sampling Label', 'SL_DOC', 1,
'insert into asd_assay_sample_d
(internal_doc_ref_no,
corporate_id,
internal_gmr_ref_no,
gmr_ref_no,
senders_ref_no,
contract_refno,
cp_ref_no,
cp_name,
product_name,
vessel_voyage_name,
voyage_number,
shipper_name,
shippers_ref_no,
container_nos)
select ? internal_doc_ref_no,
gmr.corporate_id,
gmr.internal_gmr_ref_no,
gmr.gmr_ref_no,
gmr.senders_ref_no,
pcm.contract_ref_no contract_refno,
pcm.cp_contract_ref_no,
phd.companyname cp_name,
(select f_string_aggregate(pdm.product_desc)
from pdm_productmaster pdm,
agrd_action_grd agrd
where agrd.internal_gmr_ref_no = agmr.internal_gmr_ref_no
and agrd.action_no = agmr.action_no
and agrd.is_deleted = ''N''
and pdm.product_id = agrd.product_id) product_name,
vd.vessel_voyage_name,
vd.voyage_number,
phd_ship.companyname shipper_name,
vd.shippers_ref_no,
(select f_string_aggregate(agrd.container_no)
from agrd_action_grd agrd
where agrd.internal_gmr_ref_no = agmr.internal_gmr_ref_no
and agrd.action_no = agmr.action_no
and agrd.is_deleted = ''N'') container_nos
from gmr_goods_movement_record gmr,
agmr_action_gmr agmr,
sd_shipment_detail sd,
pcm_physical_contract_main pcm,
phd_profileheaderdetails phd,
phd_profileheaderdetails phd_ship,
vd_voyage_detail vd
where gmr.internal_gmr_ref_no = agmr.internal_gmr_ref_no
and agmr.gmr_latest_action_action_id in
(''shipmentDetail'', ''airDetail'', ''truckDetail'', ''railDetail'')
and agmr.is_deleted = ''N''
and sd.internal_gmr_ref_no = agmr.internal_gmr_ref_no
and sd.action_no = agmr.action_no
and vd.internal_gmr_ref_no = sd.internal_gmr_ref_no
and vd.action_no = sd.action_no
and agmr.internal_contract_ref_no = pcm.internal_contract_ref_no
and pcm.cp_id = phd.profileid
and gmr.shipping_line_profile_id = phd_ship.profileid(+)
and GMR.INTERNAL_GMR_REF_NO = ?
',
'N'
);
-------------------------------------------------------------------------------
INSERT INTO dgm_document_generation_master
(dgm_id, doc_id, doc_name, activity_id, sequence_order,
fetch_query,
is_concentrate
)
VALUES ('DGM_SL_CONC', 'SL_DOC', 'Sampling Label', 'SL_DOC', 1,
'insert into asd_assay_sample_d
(internal_doc_ref_no,
corporate_id,
internal_gmr_ref_no,
gmr_ref_no,
senders_ref_no,
contract_refno,
cp_ref_no,
cp_name,
product_name,
vessel_voyage_name,
voyage_number,
shipper_name,
shippers_ref_no,
container_nos)
select ? internal_doc_ref_no,
gmr.corporate_id,
gmr.internal_gmr_ref_no,
gmr.gmr_ref_no,
gmr.senders_ref_no,
pcm.contract_ref_no contract_refno,
pcm.cp_contract_ref_no,
phd.companyname cp_name,
(select f_string_aggregate(pdm.product_desc)
from pdm_productmaster pdm,
agrd_action_grd agrd
where agrd.internal_gmr_ref_no = agmr.internal_gmr_ref_no
and agrd.action_no = agmr.action_no
and agrd.is_deleted = ''N''
and pdm.product_id = agrd.product_id) product_name,
vd.vessel_voyage_name,
vd.voyage_number,
phd_ship.companyname shipper_name,
vd.shippers_ref_no,
(select f_string_aggregate(agrd.container_no)
from agrd_action_grd agrd
where agrd.internal_gmr_ref_no = agmr.internal_gmr_ref_no
and agrd.action_no = agmr.action_no
and agrd.is_deleted = ''N'') container_nos
from gmr_goods_movement_record gmr,
agmr_action_gmr agmr,
sd_shipment_detail sd,
pcm_physical_contract_main pcm,
phd_profileheaderdetails phd,
phd_profileheaderdetails phd_ship,
vd_voyage_detail vd
where gmr.internal_gmr_ref_no = agmr.internal_gmr_ref_no
and agmr.gmr_latest_action_action_id in
(''shipmentDetail'', ''airDetail'', ''truckDetail'', ''railDetail'')
and agmr.is_deleted = ''N''
and sd.internal_gmr_ref_no = agmr.internal_gmr_ref_no
and sd.action_no = agmr.action_no
and vd.internal_gmr_ref_no = sd.internal_gmr_ref_no
and vd.action_no = sd.action_no
and agmr.internal_contract_ref_no = pcm.internal_contract_ref_no
and pcm.cp_id = phd.profileid
and gmr.shipping_line_profile_id = phd_ship.profileid(+)
and GMR.INTERNAL_GMR_REF_NO = ?
',
'Y'
);
--------------------------------------------------------------------------------
Insert into DM_DOCUMENT_MASTER
(DOC_ID, DOC_NAME, DISPLAY_ORDER, VERSION, IS_ACTIVE,
IS_DELETED, ACTIVITY_ID, IS_CONTINUOUS_MIDDLE_NO_REQ)
Values
('SL_DOC', 'Sampling Label', 125, NULL, 'Y',
'N', NULL, 'Y');
-------------------------------------------------------------------------------
Insert into ADM_ACTION_DOCUMENT_MASTER
(ADM_ID, ACTION_ID, DOC_ID, IS_DELETED)
Values
('ADM_SL', 'CREATE_DOC_REFNO', 'SL_DOC', 'N');
------------------------------------------------------------------------------
INSERT INTO dkm_doc_ref_key_master
(doc_key_id, doc_key_desc,
validation_query
)
VALUES ('DKM-SL', 'Sampling Label',
'SELECT COUNT (*) FROM DS_DOCUMENT_SUMMARY ds WHERE DS.DOC_REF_NO = :pc_document_ref_no AND DS.CORPORATE_ID = :pc_corporate_id'
);
| true |
13808d8b18734bbecb8a61ae437feb611e1d2744 | SQL | team30pythian/diag_collect | /grant_privs.sql | UTF-8 | 1,318 | 2.578125 | 3 | [] | no_license | ----------------------------------------------------------
--
-- SQL to grant privileges to DIAG_COLLECT
--
-- History
--
-- Version 1.0 Created 11th Oct 2017 - Luke
--
-- Version 1.1 Added on 13th Nov 2017 - Luke
-- Added provs for
-- gv_$latchholder
-- gv_$mutex_sleep_history
----------------------------------------------------------
set feed 5
set pages 500
set lines 200
set head on
set verify off
GRANT CREATE SESSION TO diag_collect;
GRANT CREATE TABLE TO diag_collect;
GRANT CREATE VIEW TO diag_collect;
GRANT CREATE PROCEDURE TO diag_collect;
GRANT CREATE SEQUENCE TO diag_collect;
GRANT CREATE JOB TO diag_collect;
GRANT SELECT ON sys.v_$event_name TO diag_collect;
GRANT SELECT ON sys.v_$statname TO diag_collect;
GRANT SELECT ON sys.gv_$session TO diag_collect;
GRANT SELECT ON sys.gv_$session_wait TO diag_collect;
GRANT SELECT ON sys.gv_$sql TO diag_collect;
GRANT SELECT ON sys.gv_$sql_plan TO diag_collect;
GRANT SELECT ON sys.gv_$sesstat TO diag_collect;
GRANT SELECT ON sys.gv_$session_event TO diag_collect;
GRANT SELECT ON sys.gv_$latchholder TO diag_collect;
GRANT SELECT ON sys.gv_$mutex_sleep_history TO diag_collect;
| true |
f1a24a033a0c52910c5f7731cc09b77ca8cf7c27 | SQL | yuanfanqi/check_out | /src/main/resources/mysql/sell_his.sql | UTF-8 | 1,020 | 2.90625 | 3 | [] | no_license | /*
Navicat MySQL Data Transfer
Source Server : loc
Source Server Version : 80012
Source Host : localhost:3306
Source Database : check_out
Target Server Type : MYSQL
Target Server Version : 80012
File Encoding : 65001
Date: 2018-10-11 10:54:29
*/
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for sell_his
-- ----------------------------
DROP TABLE IF EXISTS `sell_his`;
CREATE TABLE `sell_his` (
`sell_date` datetime NOT NULL COMMENT '日期',
`goods_name` varchar(100) NOT NULL COMMENT '商品名称',
`goods_id` varchar(32) NOT NULL COMMENT '商品ID(商品条码)',
`sell_num` int(11) DEFAULT NULL COMMENT '销售数量',
`sell_price` decimal(10,2) DEFAULT NULL COMMENT '实际销售价格',
PRIMARY KEY (`sell_date`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='销售历史表';
-- ----------------------------
-- Records of sell_his
-- ----------------------------
SET FOREIGN_KEY_CHECKS=1;
| true |
ad18135ae5fc8451e043f861fbf51fe3fe9c65e5 | SQL | drubervany/paraconsistente | /src/main/resources/import.sql | UTF-8 | 1,430 | 2.765625 | 3 | [] | no_license | --
-- Dados iniciais
--
insert into GERENTE(cpf, email, nome)values('33937256881', 'gerente@teste.com', 'Gerente Teste')
insert into CLIENTE(cnpj, email, nome)values('45578205000197', 'cliente@teste.com', 'Cliente Teste')
insert into CFPS(cpf, cnpj, email, nome, numeroPontos, contador)values('33937256881', '45578205000197', 'cliente@teste.com', 'Cliente teste', 10, 'CLIENTE')
insert into CFPS(cpf, email, nome, numeroPontos, contador)values('33937256882', 'cfps2@teste.com', 'CFPS 2 teste', 10, 'FORNECEDOR')
insert into CFPS(cpf, email, nome, numeroPontos, contador)values('33937256883', 'cfps3@teste.com', 'CFPS 3 teste', 10, 'FORNECEDOR')
insert into CFPS(cpf, email, nome, numeroPontos, contador)values('33937256884', 'cfps4@teste.com', 'CFPS 4 teste', 10, 'FORNECEDOR')
insert into USUARIO(cpf, email, nome, senha, cargo, GERENTE_id, CFPS_ID)values('33937256881', 'teste@teste.com.br', 'Usuario GERENTE Teste', '123456', 'GERENTE', 1, 1)
insert into USUARIO(cpf, email, nome, senha, cargo)values('33937256881', 'cfps@teste.com.br', 'Usuario CFPS Teste', '123456', 'CFPS')
insert into PROJETO(nome, descricao, pontosFuncao, cliente_id, gerente_id, status, cfps_id, gce, gco)values('nome', 'descricao', 0, 1, 1, 'PENDENTE', 1, 0, 0)
insert into PROJETO_CFPS(PROJETO_ID, CFPSS_ID)values(1, 1)
insert into FUNCAO(nome, projeto_id, cfps_id)values('Funcao 1', 1, 1)
insert into MEDICAO(projeto_id, cfps_id, funcao_id, qtdeDados, qtdeRegistros, tipo, totalPonfoFuncao)values(1, 1, 1, 1, 1, 'ALI', 7) | true |
c3cdf897a9bcab47ee64b946e0969b0228b13d37 | SQL | CraryPrimitiveMan/simple-framework | /migrations/init.sql | UTF-8 | 573 | 3.640625 | 4 | [
"MIT"
] | permissive | /*创建新用户*/
CREATE USER jun@localhost IDENTIFIED BY 'jun';
/*用户授权 授权jun用户拥有sf数据库的所有权限*/
GRANT ALL PRIVILEGES ON sf.* TO jun@'%' IDENTIFIED BY 'jun';
/*刷新授权*/
FLUSH PRIVILEGES;
/*创建数据库*/
CREATE DATABASE IF NOT EXISTS `sf`;
/*选择数据库*/
USE `sf`;
/*创建表*/
CREATE TABLE IF NOT EXISTS `user` (
id INT(20) NOT NULL AUTO_INCREMENT,
name VARCHAR(50),
age INT(11),
PRIMARY KEY(id)
);
/*插入测试数据*/
INSERT INTO `user` (name, age) VALUES('harry', 20), ('tony', 23), ('tom', 24); | true |
70e5c210260e4b0c5f45d03273e0d4320de45d39 | SQL | KaelinStephens/SQL-Introduction-Exercise | /SQLIntroductionExercise.sql | UTF-8 | 688 | 3.828125 | 4 | [] | no_license |
SELECT * FROM products;
SELECT * FROM products
WHERE Price=1400;
SELECT * FROM products
WHERE Price NOT IN(11.99, 13.99);
SELECT * FROM products
WHERE Price NOT LIKE 11.99;
SELECT * FROM products
ORDER BY Price DESC;
SELECT * FROM employees
WHERE MiddleInitial IS NULL;
SELECT DISTINCT Price
FROM products;
SELECT * FROM employees
WHERE FirstName LIKE 'j%';
SELECT * FROM products
WHERE Name LIKE '%Macbook%';
SELECT * FROM products
WHERE OnSale IS NOT NULL;
SELECT AVG(Price)
FROM products;
SELECT * FROM employees
WHERE Title LIKE "%Geek Squad%" AND MiddleInitial IS NULL;
SELECT * FROM products
WHERE StockLevel BETWEEN 500 AND 1200
ORDER BY Price; | true |
845749f5cffb0c73efe493ffef8dd416786d391a | SQL | haileyan/biz_504_12_DB | /USER22(2018-12-11-01).sql | UHC | 3,864 | 3.796875 | 4 | [] | no_license | -- user22 ȭԴϴ.
CREATE TABLE tbl_grade(
str_num CHAR(3) PRIMARY KEY,
intKor NUMBER(3),
intEng NUMBER(3),
intMath NUMBER(3)
);
INSERT INTO tbl_grade
VALUES ('001', 85, 100, 90);
INSERT INTO tbl_grade
VALUES ('002', 95, 98, 100);
INSERT INTO tbl_grade
VALUES ('003', 88, 78, 96);
INSERT INTO tbl_grade
VALUES ('004', 100, 95, 100);
INSERT INTO tbl_grade
VALUES ('005', 75, 80, 86);
SELECT *
FROM tbl_grade;
-- Էµ Ͱ ¼ٺ й ڼ Է Ǿִ.
-- й ʹ.
SELECT *
FROM tbl_grade
ORDER BY str_num; --ϱ
SELECT *
FROM tbl_users
ORDER BY str_name;
SELECT *
FROM tbl_users
ORDER BY str_name DESC; -- (DESCENDING)
--SUM, AVG Լ
SELECT SUM(intKor), SUM(intEng), SUM(intMath)
FROM tbl_grade;
--Լ Į ϴ Լ̴.
-- л
SELECT str_num, intKor, intEng, intMath,(intKor+intEng+intMath) AS
FROM tbl_grade;
SELECT str_num, intKor, intEng, intMath,(intKor+intEng+intMath) AS ,
(intKor+intEng+intMath)/3 AS
FROM tbl_grade;
DELETE FROM tbl_grade;
INSERT INTO tbl_grade(str_num, intKor, intEng, intMath)
VALUES ('001',
ROUND(DBMS_RANDOM.VALUE(50,100),0),
ROUND(DBMS_RANDOM.VALUE(50,100),0),
ROUND(DBMS_RANDOM.VALUE(50,100),0)
);
INSERT INTO tbl_grade(str_num, intKor, intEng, intMath)
VALUES ('002',
ROUND(DBMS_RANDOM.VALUE(50,100),0),
ROUND(DBMS_RANDOM.VALUE(50,100),0),
ROUND(DBMS_RANDOM.VALUE(50,100),0)
);
INSERT INTO tbl_grade(str_num, intKor, intEng, intMath)
VALUES ('003',
ROUND(DBMS_RANDOM.VALUE(50,100),0),
ROUND(DBMS_RANDOM.VALUE(50,100),0),
ROUND(DBMS_RANDOM.VALUE(50,100),0)
);
INSERT INTO tbl_grade(str_num, intKor, intEng, intMath)
VALUES ('004',
ROUND(DBMS_RANDOM.VALUE(50,100),0),
ROUND(DBMS_RANDOM.VALUE(50,100),0),
ROUND(DBMS_RANDOM.VALUE(50,100),0)
);
INSERT INTO tbl_grade(str_num, intKor, intEng, intMath)
VALUES ('005',
ROUND(DBMS_RANDOM.VALUE(50,100),0),
ROUND(DBMS_RANDOM.VALUE(50,100),0),
ROUND(DBMS_RANDOM.VALUE(50,100),0)
);
INSERT INTO tbl_grade(str_num, intKor, intEng, intMath)
VALUES ('006',
ROUND(DBMS_RANDOM.VALUE(50,100),0),
ROUND(DBMS_RANDOM.VALUE(50,100),0),
ROUND(DBMS_RANDOM.VALUE(50,100),0)
);
INSERT INTO tbl_grade(str_num, intKor, intEng, intMath)
VALUES ( ROUND(DBMS_RANDOM.VALUE(0,999),0),
ROUND(DBMS_RANDOM.VALUE(50,100),0),
ROUND(DBMS_RANDOM.VALUE(50,100),0),
ROUND(DBMS_RANDOM.VALUE(50,100),0)
);
-- л
SELECT str_num, intKor, intEng, intMath,
(intKor+intEng+intMath) AS ,
ROUND((intKor+intEng+intMath)/3,2) AS
FROM tbl_grade;
--
SELECT str_num, intKor, intEng, intMath,
(intKor+intEng+intMath) AS ,
ROUND((intKor+intEng+intMath)/3,2) AS
FROM tbl_grade
ORDER BY ;
--
SELECT str_num, intKor, intEng, intMath,
(intKor+intEng+intMath) AS ,
ROUND((intKor+intEng+intMath)/3,2) AS
FROM tbl_grade
ORDER BY DESC;
-- ϰ ǥ
SELECT str_num, intKor, intEng, intMath,
(intKor+intEng+intMath) AS ,
ROUND((intKor+intEng+intMath)/3,2) AS ,
RANK()
OVER(ORDER BY (intKor+intEng+intMath) DESC) AS
FROM tbl_grade
ORDER BY str_num;
SELECT str_num, intKor, intEng, intMath, ROUND((intKor+intEng+intMath)/3,2) AS
FROM tbl_grade
WHERE ROUND((intKor+intEng+intMath)/3,2)>=90;
SELECT str_num, intKor, intEng, intMath, ROUND((intKor+intEng+intMath)/3,2) AS
FROM tbl_grade
WHERE ROUND((intKor+intEng+intMath)/3,2)<70;
SELECT * FROM tbl_grade
ORDER BY str_num;
| true |
5829547413590ade6164cb61e2b1bad7b1597918 | SQL | radtek/abs3 | /sql/mmfo/bars/Script/Ins_customer_field_f2k.sql | WINDOWS-1251 | 3,000 | 3.21875 | 3 | [] | no_license | -- 13/06/2017
-- #2K
-- 5872 볺
-- ( )
-- 볺 . .:
--1. SANKC - () -
--2. RNBOR - .
--3. RNBOU - , .
--4. RNBOS -
--5. RNBOD - .
exec bc.home;
Prompt INSERT INTO CUSTOMER_FIELD TAG LIKE 'SANKC';
BEGIN
Insert into BARS.CUSTOMER_FIELD
(TAG, NAME, B, U, F, TABNAME, TYPE, OPT, TABCOLUMN_CHECK, CODE, NOT_TO_EDIT)
Values
('SANKC', ' () (/ͳ) ', 1, 1, 1,
null, 'S', 1, null,
'FM', 0);
COMMIT;
EXCEPTION WHEN OTHERS THEN
NULL;
END;
/
Prompt INSERT INTO CUSTOMER_FIELD TAG LIKE 'RNBOR';
BEGIN
Insert into BARS.CUSTOMER_FIELD
(TAG, NAME, B, U, F, TABNAME, TYPE, OPT, TABCOLUMN_CHECK, CODE, NOT_TO_EDIT)
Values
('RNBOR', ' ( )', 1, 1, 1,
null, 'S', 1, null,
'FM', 0);
COMMIT;
EXCEPTION WHEN OTHERS THEN
NULL;
END;
/
Prompt INSERT INTO CUSTOMER_FIELD TAG LIKE 'RNBOU';
BEGIN
Insert into BARS.CUSTOMER_FIELD
(TAG, NAME, B, U, F, TABNAME, TYPE, OPT, TABCOLUMN_CHECK, CODE, NOT_TO_EDIT)
Values
('RNBOU', ' ( )', 1, 1, 1,
null, 'S', 1, null,
'FM', 0);
COMMIT;
EXCEPTION WHEN OTHERS THEN
NULL;
END;
/
Prompt INSERT INTO CUSTOMER_FIELD TAG LIKE 'RNBOS';
BEGIN
Insert into BARS.CUSTOMER_FIELD
(TAG, NAME, B, U, F, TABNAME, TYPE, OPT, TABCOLUMN_CHECK, CODE, NOT_TO_EDIT)
Values
('RNBOS', ' ', 1, 1, 1,
null, 'S', 1, null,
'FM', 0);
COMMIT;
EXCEPTION WHEN OTHERS THEN
NULL;
END;
/
Prompt INSERT INTO CUSTOMER_FIELD TAG LIKE 'RNBOD';
BEGIN
Insert into BARS.CUSTOMER_FIELD
(TAG, NAME, B, U, F, TABNAME, TYPE, OPT, TABCOLUMN_CHECK, CODE, NOT_TO_EDIT)
Values
('RNBOD', ' ', 1, 1, 1,
null, 'S', 1, null,
'FM', 0);
COMMIT;
EXCEPTION WHEN OTHERS THEN
NULL;
END;
/
| true |
504007c540b13ffa88a144777538a266508dc00f | SQL | Tangorn3x3/gestsup | /_SQL/update_3.0.11_to_3.1.20.sql | UTF-8 | 36,003 | 3.515625 | 4 | [] | no_license | -- SQL Update for GestSup !!! If you are not in lastest version, all previous scripts must be passed before !!! ;
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
-- fix bug empty availability_condition_type value
UPDATE tparameters SET availability_condition_type="4" WHERE availability_condition_type="";
-- add dashboard columun right
ALTER TABLE `trights` ADD `dashboard_col_priority` INT( 1 ) NOT NULL COMMENT 'Affiche la colonne priorité dans la liste des tickets.' AFTER `admin_user_view`;
UPDATE `trights` SET `dashboard_col_priority`='2';
-- fix empty user service problem in tincidents table
UPDATE tincidents, tusers
SET tincidents.u_service = tusers.service
WHERE tincidents.user=tusers.id AND tincidents.u_service='0';
-- update GestSup version number
UPDATE tparameters SET version="3.1.1";
ALTER TABLE `tassets_model` ADD `manufacturer` INT(5) NOT NULL AFTER `type`;
ALTER TABLE `tassets_model` ADD `image` VARCHAR(30) NOT NULL AFTER `manufacturer`;
ALTER TABLE `tassets_state` ADD `order` INT(3) NOT NULL AFTER `id`;
ALTER TABLE `tassets` CHANGE `sn_manufacturer` `sn_manufacturer` VARCHAR(40) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL;
ALTER TABLE `tassets` ADD `disable` INT(1) NOT NULL ;
CREATE TABLE IF NOT EXISTS `tassets_thread` (
`id` int(10) NOT NULL AUTO_INCREMENT,
`asset` int(10) NOT NULL,
`text` varchar(5000) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
ALTER TABLE `tassets` ADD `sn_indent` VARCHAR(40) NOT NULL AFTER `sn_manufacturer`;
ALTER TABLE `tassets` CHANGE `mac_wifi` `mac_wlan` VARCHAR(20) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL;
ALTER TABLE `tassets` CHANGE `room` `socket` VARCHAR(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL;
ALTER TABLE `tassets` ADD `maintenance` INT(10) NOT NULL AFTER `technician`;
ALTER TABLE `tservices` ADD `disable` INT(1) NOT NULL ;
ALTER TABLE `tassets` ADD `date_recycle` DATE NOT NULL AFTER `date_stock`;
ALTER TABLE `tassets_state` ADD `disable` INT(1) NOT NULL ;
ALTER TABLE `tassets` ADD `date_standbye` DATE NOT NULL AFTER `date_stock`;
ALTER TABLE `trights` ADD `side_asset_create` INT(1) NOT NULL COMMENT 'Affiche le bouton ajouter matériel' AFTER `side_open_ticket`;
UPDATE `trights` SET `side_asset_create`='2' WHERE id='1' OR id='4' OR id='5';
CREATE TABLE IF NOT EXISTS `tassets_network` (
`id` int(5) NOT NULL AUTO_INCREMENT,
`name` varchar(20) NOT NULL,
`network` varchar(15) NOT NULL,
`netmask` varchar(15) NOT NULL,
PRIMARY KEY (`Id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
-- dashboard columns
ALTER TABLE `trights` ADD `dashboard_col_date_create` INT(1) NOT NULL COMMENT 'Affiche la colonne date de création dans la liste des tickets.' AFTER `dashboard_col_priority`;
UPDATE `trights` SET `dashboard_col_date_create`='2';
ALTER TABLE `trights` ADD `dashboard_col_date_hope` INT(1) NOT NULL COMMENT 'Affiche la colonne date de résolution estimé dans la liste des tickets.' AFTER `dashboard_col_date_create`;
UPDATE `trights` SET `dashboard_col_date_hope`='0';
ALTER TABLE `trights` ADD `dashboard_col_date_res` INT(1) NOT NULL COMMENT 'Affiche la colonne date de résolution dans la liste des tickets.' AFTER `dashboard_col_date_hope`;
UPDATE `trights` SET `dashboard_col_date_res`='0';
ALTER TABLE `tparameters` DROP `dash_date`;
CREATE TABLE IF NOT EXISTS `ttoken` (
`id` int(5) NOT NULL AUTO_INCREMENT,
`token` varchar(20) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
-- fix place problem
ALTER TABLE `tincidents` CHANGE `place` `place` INT(5) NOT NULL DEFAULT '99999';
UPDATE `tincidents` SET place='99999' WHERE place='0';
INSERT INTO `tplaces` (`id`, `name`) VALUES ('99999', 'Aucun');
-- SQL Update for GestSup !!! If you are not in lastest version, all previous scripts must be passed before !!! ;
-- update GestSup version number
UPDATE tparameters SET version="3.1.2";
-- default asset state values
ALTER TABLE `tassets_state` ADD `display` VARCHAR(50) NOT NULL ;
ALTER TABLE `tassets_state` CHANGE `display` `display` VARCHAR(100) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL;
ALTER TABLE `tassets_state` ADD `description` VARCHAR(50) NOT NULL AFTER `name`;
INSERT INTO `tassets_state` (`id`, `order`, `name`, `description`, `disable`, `display`) VALUES ('1', '1', 'Stock', 'Equipement en stock', '0', 'label label-sm label-info arrowed-in');
INSERT INTO `tassets_state` (`id`, `order`, `name`, `description`, `disable`, `display`) VALUES ('2', '2', 'Installé', 'Equipement installé en production', '0','label label-sm label-success arrowed arrowed-right arrowed-left');
INSERT INTO `tassets_state` (`id`, `order`, `name`, `description`, `disable`, `display`) VALUES ('3', '3', 'Standbye', 'Equipement de coté', '0','label label-sm label-warning arrowed-in arrowed-right arrowed-in arrowed-left');
INSERT INTO `tassets_state` (`id`, `order`, `name`, `description`, `disable`, `display`) VALUES ('4', '4', 'Recyclé', 'Equipement recyclé, jeté', '0', 'label label-sm label-inverse arrowed arrowed-right arrowed-left');
-- default asset type
INSERT INTO `tassets_type` (`id`, `name`) VALUES (NULL, 'PC');
-- default manufacturer
INSERT INTO `tassets_manufacturer` (`id`, `name`) VALUES (NULL, 'Dell');
-- default asset model
INSERT INTO `tassets_model` (`id`, `type`, `manufacturer`, `image`, `name`) VALUES (NULL, '1', '1', '3020.jpg', 'Optiplex 3020');
-- update asset core
ALTER TABLE `tassets` ADD `manufacturer` INT(5) NOT NULL AFTER `type`;
ALTER TABLE `tassets_model` ADD `ip` INT(1) NOT NULL ;
ALTER TABLE `tassets_network` ADD `disable` INT(1) NOT NULL ;
ALTER TABLE `tassets` ADD `ip2` VARCHAR(20) NOT NULL AFTER `ip`;
ALTER TABLE `tassets_model` ADD `ip2` INT(1) NOT NULL AFTER `ip`;
ALTER TABLE `tassets_model` CHANGE `ip2` `wifi` INT(1) NOT NULL;
ALTER TABLE `tassets_model` ADD `warranty` INT(2) NOT NULL AFTER `wifi`;
-- update 3.1.2.2
ALTER TABLE `tassets_model` CHANGE `name` `name` VARCHAR( 50 ) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL;
ALTER TABLE `tassets_network` CHANGE `name` `name` VARCHAR(50) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL;
-- SQL Update for GestSup !!! If you are not in lastest version, all previous scripts must be passed before !!! ;
-- update GestSup version number
UPDATE tparameters SET version="3.1.3";
UPDATE tassets_model SET ip='1' WHERE name='Optiplex 3020';
UPDATE tassets_model SET warranty='3' WHERE name='Optiplex 3020';
ALTER TABLE `trights` ADD `asset_list_department_only` INT(1) NOT NULL COMMENT 'Affiche uniquement les matériels du serivce auquel est rattaché l''utilisateur.' AFTER `asset`;
UPDATE `trights` SET `asset_list_department_only` = '2' WHERE `trights`.`profile` = 1;
ALTER TABLE `trights` ADD `asset_list_view_only` INT(1) NOT NULL COMMENT 'Affiche uniquement la liste des matériels, sans droit d''éditer une fiche.' AFTER `asset_list_department_only`;
UPDATE `trights` SET `asset_list_view_only` = '2' WHERE `trights`.`profile` = 1;
ALTER TABLE `trights` ADD `side_asset_all_state` INT NOT NULL COMMENT 'Affiche tous les états des matériels dans le menu de gauche' AFTER `side_asset_create`;
UPDATE `trights` SET `side_asset_all_state` = '2' WHERE id='1' OR id='4' OR id='5';
-- update GestSup version number
UPDATE tparameters SET version="3.1.4";
ALTER TABLE `tparameters` ADD `mail_auto_user_modify` INT(1) NOT NULL DEFAULT '0' AFTER `mail_auto`;
ALTER TABLE `tparameters` ADD `mail_auto_tech_modify` INT(1) NOT NULL DEFAULT '0' AFTER `mail_auto_user_modify`;
-- update GestSup version number
UPDATE tparameters SET version="3.1.5";
UPDATE `trights` SET `ticket_delete` = '0' WHERE `trights`.`id` = 2;
UPDATE `trights` SET `ticket_delete` = '0' WHERE `trights`.`id` = 3;
ALTER TABLE `tparameters` ADD `mail_smtp_class` VARCHAR(15) NOT NULL DEFAULT 'isSMTP()' AFTER `mail_smtp`;
-- update GestSup version number
UPDATE tparameters SET version="3.1.6";
-- sql fix to empty date recycle on recyle asset state
UPDATE tassets SET date_recycle='2016-01-01' WHERE date_recycle='0000-00-00' AND state='4';
-- update GestSup version number
UPDATE tparameters SET version="3.1.7";
UPDATE tparameters SET version="3.1.9";
ALTER TABLE `tusers` CHANGE `mail` `mail` VARCHAR(100) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL;
ALTER TABLE `tparameters` ADD `user_limit_ticket` INT(1) NOT NULL DEFAULT '0' AFTER `user_register`;
ALTER TABLE `tusers` ADD `limit_ticket_number` INT(5) NOT NULL AFTER `dashboard_ticket_order`;
ALTER TABLE `tusers` ADD `limit_ticket_days` INT(5) NOT NULL AFTER `limit_ticket_number`;
ALTER TABLE `tusers` ADD `limit_ticket_date_start` DATE NOT NULL AFTER `limit_ticket_days`;
UPDATE tparameters SET version="3.1.10";
ALTER TABLE `tparameters` ADD `user_company_view` INT(1) NULL DEFAULT '0' AFTER `user_limit_ticket`;
ALTER TABLE `trights` ADD `side_company` INT(1) NOT NULL DEFAULT '0' COMMENT 'Affiche la section tous les tickets de ma société' AFTER `side_all_meta`;
UPDATE `trights` SET `side_company` = '2' WHERE id='2' OR id='3';
INSERT INTO `tcompany` (`id`, `name`, `address`, `zip`, `city`) VALUES ('0', 'Aucune', '', '', '');
UPDATE `tcompany` SET id='0' WHERE name='Aucune';
ALTER TABLE `trights` ADD `user_profil_company` INT(1) NOT NULL DEFAULT '2' COMMENT 'Modification de la société sur la fiche utilisateur' ;
ALTER TABLE `tparameters` ADD `company_limit_ticket` INT(1) NOT NULL DEFAULT '0';
ALTER TABLE `tcompany` ADD `limit_ticket_number` INT(5) NOT NULL DEFAULT '0' AFTER `city`;
ALTER TABLE `tcompany` ADD `limit_ticket_days` INT(5) NOT NULL AFTER `limit_ticket_number`;
ALTER TABLE `tcompany` ADD `limit_ticket_date_start` DATE NOT NULL AFTER `limit_ticket_days`;
ALTER TABLE `tusers` CHANGE `login` `login` VARCHAR(100) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL;
ALTER TABLE `tparameters` CHANGE `ldap_url` `ldap_url` VARCHAR(500) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL;
ALTER TABLE `tparameters` ADD `server_private_key` VARCHAR(40) NOT NULL AFTER `server_url`;
-- update GestSup version number
UPDATE tparameters SET version="3.1.11";
ALTER TABLE `tcompany` CHANGE `name` `name` VARCHAR(100) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL;
-- avoid invisible ticket with join at 0 value on tusers table
INSERT INTO `tusers` (`id`, `login`, `password`, `salt`, `firstname`, `lastname`, `profile`, `mail`, `phone`, `fax`, `function`, `service`, `company`, `address1`, `address2`, `zip`, `city`, `custom1`, `custom2`, `disable`, `chgpwd`, `last_login`, `skin`, `default_ticket_state`, `dashboard_ticket_order`, `limit_ticket_number`, `limit_ticket_days`, `limit_ticket_date_start`) VALUES ('0', 'aucun', '', '', '', '', '2', '', '', '', '', '0', '0', '', '', '', '', '', '', '1', '0', '2016-10-21 00:00:00', '', '', '', '0', '0', '2016-10-21');
UPDATE `tusers` SET `id` = '0' WHERE `tusers`.`login` = 'aucun';
UPDATE `tusers` SET `disable` = '1' WHERE `tusers`.`login` = 'aucun';
-- update GestSup version number
UPDATE tparameters SET version="3.1.12";
ALTER TABLE `tusers` CHANGE `login` `login` VARCHAR(200) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL;
ALTER TABLE `tassets` ADD `date_end_warranty` DATE NOT NULL AFTER `date_recycle`;
ALTER TABLE `trights` CHANGE `asset_list_department_only` `asset_list_department_only` INT(1) NOT NULL COMMENT 'Affiche uniquement les matériels du service auquel est rattaché l\'utilisateur.';
-- update new date end warranty field where warranty model is defined
SET sql_mode = '';
UPDATE tassets,tassets_model SET tassets.date_end_warranty= DATE_ADD(tassets.date_stock,INTERVAL tassets_model.warranty YEAR)
WHERE
tassets_model.id=tassets.model AND
tassets_model.warranty NOT LIKE 0 AND
tassets.date_stock NOT LIKE '0000-00-00' AND
tassets.date_end_warranty='0000-00-00';
ALTER TABLE `tparameters` ADD `asset_warranty` INT(1) NOT NULL AFTER `asset`;
UPDATE `tparameters` SET `asset_warranty`='0' WHERE id=1;
-- update GestSup version number
UPDATE tparameters SET version="3.1.13";
-- avoid delete default value problem
UPDATE tplaces SET id='0' WHERE name='Aucun';
UPDATE tincidents SET place='0' WHERE place='99999';
ALTER TABLE `tincidents` CHANGE `place` `place` INT(5) NULL DEFAULT NULL;
-- default value for new version of queries
INSERT INTO `tsubcat` (`cat`, `name`) VALUES ('0', 'Aucune');
UPDATE `tsubcat` SET id='0' WHERE name='Aucune';
-- default value for new version of queries
INSERT INTO `tcategory` (`id`, `name`) VALUES (NULL, 'Aucune');
UPDATE `tcategory` SET id='0' WHERE name='Aucune';
ALTER TABLE `tparameters` CHANGE `ldap_url` `ldap_url` VARCHAR(1000) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL;
UPDATE `tusers` SET `lastname` = 'Aucun' WHERE `tusers`.`login` = 'aucun';
-- update GestSup version number
UPDATE tparameters SET version="3.1.14";
-- remove space after the name
UPDATE `tstates` SET `name` = 'En cours' WHERE `tstates`.`id` = 2;
-- default value to type
INSERT INTO `ttypes` (`id`, `name`) VALUES (NULL, 'Aucun');
UPDATE ttypes SET id='0' WHERE name='Aucun';
INSERT INTO `tpriority` (`id`, `number`, `name`, `color`) VALUES (NULL, '0', 'Aucune', '#FFFFFF');
UPDATE `tpriority` SET `id` = '0' WHERE `tpriority`.`name` = 'Aucune';
-- fill current service data in tincidents from tusers
UPDATE tincidents,tusers SET tincidents.u_service=tusers.service WHERE tincidents.user=tusers.id AND tincidents.u_service='0';
ALTER TABLE `tusers` ADD `language` VARCHAR(10) NOT NULL DEFAULT 'fr_FR' AFTER `limit_ticket_date_start`;
ALTER TABLE `trights` ADD `ticket_place` INT(1) NOT NULL COMMENT 'Modification du lieu' AFTER `ticket_cat_actions`;
UPDATE `trights` SET `ticket_place`='2' WHERE id='1' OR id='4' OR id='5';
ALTER TABLE `trights` ADD `side_your_tech_group` INT(1) NOT NULL COMMENT 'Affiche les tickets associés à un groupe de technicien dans lequel vous êtes présent.' AFTER `side_your_meta`;
-- update GestSup version number
UPDATE tparameters SET version="3.1.15";
-- new thread for switch states
ALTER TABLE `tthreads` ADD `state` INT(1) NOT NULL AFTER `user`;
-- new field for global ping check
ALTER TABLE `tassets` ADD `date_last_ping` DATE NOT NULL AFTER `date_end_warranty`;
-- update name error in right description table
ALTER TABLE `trights` CHANGE `task_checkbox` `task_checkbox` INT(1) NOT NULL COMMENT 'Autorise les actions sur la sélection de plusieurs tickets, dans la liste des tickets';
ALTER TABLE `trights` CHANGE `side_your_meta` `side_your_meta` INT(1) NOT NULL COMMENT 'Affiche le meta état à traiter personnel';
ALTER TABLE `trights` CHANGE `side_all_meta` `side_all_meta` INT(1) NOT NULL COMMENT 'Affiche le meta état à traiter pour tous les techniciens';
ALTER TABLE `trights` CHANGE `side_view` `side_view` INT(1) NOT NULL COMMENT 'Affiche les vues personnelles';
ALTER TABLE `trights` CHANGE `ticket_next` `ticket_next` INT(1) NOT NULL COMMENT 'Affiche les flèches ticket suivant et précédent';
ALTER TABLE `trights` CHANGE `ticket_user` `ticket_user` INT(1) NOT NULL COMMENT 'Modification du demandeur';
ALTER TABLE `trights` CHANGE `ticket_state` `ticket_state` INT(1) NOT NULL COMMENT 'Modification du champ état dans le ticket';
ALTER TABLE `trights` CHANGE `ticket_availability` `ticket_availability` INT(1) NOT NULL COMMENT 'Modification de la partie disponibilité';
ALTER TABLE `trights` CHANGE `ticket_close` `ticket_close` INT(1) NOT NULL COMMENT 'Affiche le bouton de clôture dans le ticket';
UPDATE `tassets_state` SET `description` = 'Équipement en stock' WHERE `tassets_state`.`name` = 'Stock';
UPDATE `tassets_state` SET `description` = 'Équipement installé en production' WHERE `tassets_state`.`name` = 'Installé';
UPDATE `tassets_state` SET `description` = 'Équipement de coté' WHERE `tassets_state`.`name` = 'Standbye';
UPDATE `tassets_state` SET `description` = 'Équipement recyclé, jeté' WHERE `tassets_state`.`name` = 'Recyclé';
-- update GestSup version number
UPDATE tparameters SET version="3.1.16";
ALTER TABLE `trights` ADD `procedure_modify` INT(1) NOT NULL COMMENT 'Modification des procédures' AFTER `procedure`;
UPDATE `trights` SET `procedure_modify`='2' WHERE id='1' OR id='4' OR id='5';
ALTER TABLE `trights` ADD `dashboard_col_criticality` INT(1) NOT NULL COMMENT 'Affiche la colonne criticité dans la liste des tickets.' AFTER `admin_user_view`;
UPDATE `trights` SET `dashboard_col_criticality`='2';
ALTER TABLE `trights` ADD `dashboard_col_type` INT(1) NOT NULL COMMENT 'Affiche la colonne type dans la liste des tickets.' AFTER `admin_user_view`;
UPDATE `trights` SET `dashboard_col_type`='0';
-- fix invisible ticket from API
ALTER TABLE `tincidents` CHANGE `place` `place` INT(5) NOT NULL;
-- update asset name
ALTER TABLE `trights` CHANGE `asset` `asset` INT(1) NOT NULL COMMENT 'Affiche le menu équipement';
ALTER TABLE `trights` CHANGE `asset_list_department_only` `asset_list_department_only` INT(1) NOT NULL COMMENT 'Affiche uniquement les équipements du service auquel est rattaché l\'utilisateur.';
ALTER TABLE `trights` CHANGE `asset_list_view_only` `asset_list_view_only` INT(1) NOT NULL COMMENT 'Affiche uniquement la liste des équipements, sans droit d\'éditer une fiche.';
ALTER TABLE `trights` CHANGE `side_asset_create` `side_asset_create` INT(1) NOT NULL COMMENT 'Affiche le bouton ajouter équipement';
ALTER TABLE `trights` CHANGE `side_asset_all_state` `side_asset_all_state` INT(11) NOT NULL COMMENT 'Affiche tous les états des équipements dans le menu de gauche';
-- update GestSup version number
UPDATE tparameters SET version="3.1.17";
ALTER TABLE `tthreads` ADD `private` BOOLEAN NOT NULL DEFAULT FALSE;
ALTER TABLE `trights` ADD `ticket_thread_private` INT(1) NOT NULL COMMENT 'Autorise à passer le message en privé' AFTER `ticket_thread_post`;
UPDATE `trights` SET `ticket_thread_private`='2' WHERE id='1' OR id='4' OR id='5';
ALTER TABLE `trights` ADD `asset_delete` INT(1) NOT NULL COMMENT 'Droit de suppression des équipements' AFTER `asset`;
UPDATE `trights` SET `asset_delete`='2' WHERE id='1' OR id='4' OR id='5';
ALTER TABLE `trights` ADD `procedure_add` INT(1) NOT NULL COMMENT 'Droit d\'ajouter des procédures' AFTER `procedure`;
UPDATE `trights` SET `procedure_add`='2' WHERE id='1' OR id='4' OR id='5';
ALTER TABLE `trights` ADD `procedure_delete` INT(1) NOT NULL COMMENT 'Droit de supprimer des procédures' AFTER `procedure_add`;
UPDATE `trights` SET `procedure_delete`='2' WHERE id='1' OR id='4' OR id='5';
ALTER TABLE `trights` ADD `ticket_thread_private_button` INT(1) NOT NULL COMMENT 'Affiche un bouton pour ajouter un message en privé' AFTER `ticket_thread_private`;
ALTER TABLE `trights` CHANGE `admin_user_profile` `admin_user_profile` INT(1) NOT NULL COMMENT 'Droit de modification de profil des utilisateurs';
UPDATE `tpriority` SET `color` = '#B0B0B0' WHERE `tpriority`.`id` = 0;
ALTER TABLE `trights` CHANGE `ticket_time_hope` `ticket_time_hope` INT(1) NOT NULL COMMENT 'Modification du temps estimé passé par ticket';
ALTER TABLE `tparameters` ADD `asset_ip` INT(1) NOT NULL AFTER `asset`;
UPDATE `tparameters` SET `asset_ip`='1' WHERE id=1;
-- update GestSup version number
UPDATE tparameters SET version="3.1.18";
-- add country field on company table
ALTER TABLE `tcompany` ADD `country` VARCHAR(100) NOT NULL AFTER `city`;
ALTER TABLE `trights` ADD `dashboard_col_category` INT(1) NOT NULL COMMENT 'Affiche la colonne catégorie dans la liste des tickets' AFTER `dashboard_col_type`;
UPDATE `trights` SET `dashboard_col_category`='2';
ALTER TABLE `trights` ADD `dashboard_col_subcat` INT(1) NOT NULL COMMENT 'Affiche la colonne sous-catégorie dans la liste des tickets' AFTER `dashboard_col_category`;
UPDATE `trights` SET `dashboard_col_subcat`='2';
ALTER TABLE `trights` ADD `dashboard_col_company` INT(1) NOT NULL COMMENT 'Affiche la colonne société dans la liste des tickets' AFTER `admin_user_view`;
UPDATE `trights` SET `dashboard_col_company`='0';
ALTER TABLE `tcompany` ADD `disable` INT(1) NOT NULL AFTER `limit_ticket_date_start`;
ALTER TABLE `trights` ADD `dashboard_col_date_create_hour` INT(1) NOT NULL COMMENT 'Affiche l\'heure de création du ticket dans la colonne date de création, sur la liste des tickets' AFTER `dashboard_col_date_create`;
UPDATE `trights` SET `dashboard_col_date_create_hour`='0';
ALTER TABLE `trights` ADD `ticket_user_company` INT(1) NOT NULL COMMENT 'Affiche le nom de la société de l\'utilisateur dans la liste des utilisateurs sur un ticket' AFTER `ticket_user_actions`;
UPDATE `trights` SET `ticket_user_company`='0';
ALTER TABLE `tparameters` ADD `imap_blacklist` VARCHAR(250) NOT NULL AFTER `imap_inbox`;
UPDATE `tparameters` SET `imap_blacklist`='';
ALTER TABLE `tparameters` ADD `imap_post_treatment` VARCHAR(100) NOT NULL AFTER `imap_blacklist`;
ALTER TABLE `tparameters` ADD `imap_post_treatment_folder` VARCHAR(100) NOT NULL AFTER `imap_post_treatment`;
ALTER TABLE `tusers` CHANGE `default_ticket_state` `default_ticket_state` VARCHAR(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL;
ALTER TABLE `tparameters` ADD `mail_order` INT(1) NOT NULL AFTER `mail_link`;
UPDATE `tparameters` SET `mail_order`='0';
-- update GestSup version number
UPDATE tparameters SET version="3.1.19";
-- correct words errors
ALTER TABLE `trights` CHANGE `dashboard_col_date_hope` `dashboard_col_date_hope` INT(1) NOT NULL COMMENT 'Affiche la colonne date de résolution estimée dans la liste des tickets.';
ALTER TABLE `trights` CHANGE `ticket_date_hope_disp` `ticket_date_hope_disp` INT(1) NOT NULL COMMENT 'Affiche le champ date de résolution estimée dans le ticket';
ALTER TABLE `trights` CHANGE `ticket_date_hope_mandatory` `ticket_date_hope_mandatory` INT(1) NOT NULL COMMENT 'Oblige la saisie du champ date de résolution estimée';
ALTER TABLE `trights` CHANGE `asset_list_department_only` `asset_list_department_only` INT(1) NOT NULL COMMENT 'Affiche uniquement les équipements du service auquel est rattaché l\'utilisateur';
ALTER TABLE `trights` CHANGE `asset_list_view_only` `asset_list_view_only` INT(1) NOT NULL COMMENT 'Affiche uniquement la liste des équipements, sans droit d\'éditer une fiche';
ALTER TABLE `trights` CHANGE `dashboard_col_criticality` `dashboard_col_criticality` INT(1) NOT NULL COMMENT 'Affiche la colonne criticité dans la liste des tickets';
ALTER TABLE `trights` CHANGE `dashboard_col_priority` `dashboard_col_priority` INT(1) NOT NULL COMMENT 'Affiche la colonne priorité dans la liste des tickets';
ALTER TABLE `trights` CHANGE `dashboard_col_date_create` `dashboard_col_date_create` INT(1) NOT NULL COMMENT 'Affiche la colonne date de création dans la liste des tickets';
ALTER TABLE `trights` CHANGE `dashboard_col_type` `dashboard_col_type` INT(1) NOT NULL COMMENT 'Affiche la colonne type dans la liste des tickets';
ALTER TABLE `trights` CHANGE `dashboard_col_date_hope` `dashboard_col_date_hope` INT(1) NOT NULL COMMENT 'Affiche la colonne date de résolution estimée dans la liste des tickets';
ALTER TABLE `trights` CHANGE `dashboard_col_date_res` `dashboard_col_date_res` INT(1) NOT NULL COMMENT 'Affiche la colonne date de résolution dans la liste des tickets';
ALTER TABLE `trights` CHANGE `side_your_tech_group` `side_your_tech_group` INT(1) NOT NULL COMMENT 'Affiche les tickets associés à un groupe de technicien dans lequel vous êtes présent';
ALTER TABLE `trights` CHANGE `side_your_not_attribute` `side_your_not_attribute` INT(1) NOT NULL COMMENT 'Affiche vos demande non attribuées';
ALTER TABLE `trights` CHANGE `side_your` `side_your` INT(1) NOT NULL COMMENT 'Affiche la section vos tickets';
ALTER TABLE `trights` CHANGE `side_your_not_read` `side_your_not_read` INT(1) NOT NULL COMMENT 'Affiche vos tickets non lus';
ALTER TABLE `trights` CHANGE `side_your_not_attribute` `side_your_not_attribute` INT(1) NOT NULL COMMENT 'Affiche les tickets non attribués';
ALTER TABLE `trights` CHANGE `side_all` `side_all` INT(1) NOT NULL COMMENT 'Affiche la section tous les tickets';
ALTER TABLE `trights` CHANGE `side_all_wait` `side_all_wait` INT(1) NOT NULL COMMENT 'Affiche la vue nouveaux tickets dans tous les tickets';
-- multi iface role
CREATE TABLE `tassets_iface_role` (
`id` int(4) NOT NULL,
`name` varchar(250) NOT NULL
) ENGINE=InnodDB DEFAULT CHARSET=latin1;
ALTER TABLE `tassets_iface_role` ADD PRIMARY KEY (`id`);
ALTER TABLE `tassets_iface_role` MODIFY `id` int(4) NOT NULL AUTO_INCREMENT;
INSERT INTO `tassets_iface_role` (`id`, `name`) VALUES (NULL, 'LAN'), (NULL, 'WIFI');
ALTER TABLE `tassets_iface_role` ADD `disable` INT(1) NOT NULL AFTER `name`;
-- multi iface
CREATE TABLE `tassets_iface` (
`id` int(10) NOT NULL,
`role_id` int(5) NOT NULL,
`asset_id` int(10) NOT NULL,
`netbios` varchar(200) NOT NULL,
`ip` varchar(20) NOT NULL,
`mac` varchar(20) NOT NULL
) ENGINE=InnodDB DEFAULT CHARSET=latin1;
ALTER TABLE `tassets_iface` ADD PRIMARY KEY (`id`);
ALTER TABLE `tassets_iface` MODIFY `id` int(10) NOT NULL AUTO_INCREMENT;
ALTER TABLE `tassets_iface` ADD `disable` INT(1) NOT NULL AFTER `mac`;
-- current iface LAN conversion
INSERT INTO `tassets_iface` (`role_id`,`asset_id`,`netbios`,`ip`,`mac`) SELECT 1 as role_id, id, netbios, ip, mac_lan FROM tassets WHERE ip!='';
-- current iface WIFI conversion
INSERT INTO `tassets_iface` (`role_id`,`asset_id`,`netbios`,`ip`,`mac`) SELECT 2, id, netbios, ip2, mac_wlan FROM tassets WHERE ip2!='';
-- block ip search
ALTER TABLE `tassets_state` ADD `block_ip_search` INT(1) NOT NULL AFTER `description`;
UPDATE tassets_state SET block_ip_search='1' WHERE id='2';
-- location
CREATE TABLE `tassets_location` (
`id` int(5) NOT NULL,
`name` varchar(200) NOT NULL,
`disable` int(1) NOT NULL
) ENGINE=InnodDB DEFAULT CHARSET=latin1;
ALTER TABLE `tassets_location` ADD PRIMARY KEY (`id`);
ALTER TABLE `tassets_location` MODIFY `id` int(5) NOT NULL AUTO_INCREMENT;
INSERT INTO `tassets_location` (`id`, `name`, `disable`) VALUES (NULL, 'Aucune', '0');
UPDATE `tassets_location` SET `id` = '0' WHERE `tassets_location`.`name` = 'Aucune';
ALTER TABLE `tassets` ADD `location` INT(5) NOT NULL AFTER `date_last_ping`;
ALTER TABLE `tassets_type` ADD `virtualization` INT(1) NOT NULL AFTER `name`;
ALTER TABLE `tassets` ADD `virtualization` INT(1) NOT NULL AFTER `maintenance`;
ALTER TABLE `trights` ADD `asset_virtualization_disp` INT(1) NOT NULL AFTER `asset_delete`;
ALTER TABLE `trights` CHANGE `asset_virtualization_disp` `asset_virtualization_disp` INT(1) NOT NULL COMMENT 'Affiche le champ équipement virtuel';
ALTER TABLE `trights` ADD `asset_list_col_location` INT(1) NOT NULL COMMENT 'Affiche la colonne localisation dans la liste des tickets' AFTER `asset_list_view_only`;
ALTER TABLE `trights` ADD `asset_location_disp` INT(1) NOT NULL COMMENT 'Affiche le champ localisation sur un équipement' AFTER `asset_virtualization_disp`;
-- add mail parameters disable certificat check
ALTER TABLE `tparameters` ADD `mail_ssl_check` INT(1) NOT NULL AFTER `mail_port`;
UPDATE `tparameters` SET `mail_ssl_check` = '1' WHERE `tparameters`.`id` = 1;
-- indexes optimizations
ALTER TABLE `tthreads` ADD INDEX(`ticket`);
ALTER TABLE `tassets_iface` ADD INDEX(`asset_id`);
ALTER TABLE `tincidents` ADD INDEX(`state`);
ALTER TABLE `tincidents` ADD INDEX(`technician`);
ALTER TABLE `tincidents` ADD INDEX(`user`);
-- update GestSup version number
UPDATE tparameters SET version="3.1.20";
-- agencies
ALTER TABLE `tparameters` ADD `user_agency` INT(1) NOT NULL AFTER `user_company_view`;
CREATE TABLE IF NOT EXISTS `tagencies` (
`id` int(5) NOT NULL AUTO_INCREMENT,
`name` varchar(250) NOT NULL,
`disable` int(1) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
ALTER TABLE `tagencies` ADD `ldap_guid` VARCHAR(50) NOT NULL AFTER `name`;
ALTER TABLE `tagencies` ADD `mail` VARCHAR(100) NOT NULL AFTER `name`;
INSERT INTO `tagencies` (`id`, `name`, `disable`) VALUES (NULL, 'Aucune', '0');
UPDATE `tagencies` SET `id` = '0' WHERE `tagencies`.`id` = 1;
ALTER TABLE `tincidents` ADD `u_agency` INT(5) NOT NULL AFTER `u_service`;
-- create agency association table
CREATE TABLE IF NOT EXISTS `tusers_agencies` (
`id` int(5) NOT NULL AUTO_INCREMENT,
`user_id` int(5) NOT NULL,
`agency_id` int(5) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- create service association table
CREATE TABLE IF NOT EXISTS `tusers_services` (
`id` int(5) NOT NULL AUTO_INCREMENT,
`user_id` int(5) NOT NULL,
`service_id` int(5) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- migration data from multi service mode
INSERT INTO `tusers_services`(`user_id`, `service_id`) SELECT id,service from tusers WHERE service!='0';
-- ldap group parameters
ALTER TABLE `tparameters` ADD `ldap_service` INT(1) NOT NULL AFTER `ldap_type`;
ALTER TABLE `tparameters` ADD `ldap_agency` INT(1) NOT NULL AFTER `ldap_service`;
ALTER TABLE `tparameters` ADD `ldap_service_url` VARCHAR(500) NOT NULL AFTER `ldap_service`;
ALTER TABLE `tparameters` ADD `ldap_agency_url` VARCHAR(500) NOT NULL AFTER `ldap_agency`;
ALTER TABLE `tservices` ADD `ldap_guid` VARCHAR(50) NOT NULL AFTER `name`;
ALTER TABLE `tusers` ADD `ldap_guid` VARCHAR(50) NOT NULL AFTER `language`;
-- right service profil modification
ALTER TABLE `trights` ADD `user_profil_service` INT(1) NOT NULL COMMENT 'Modification du service sur la fiche de l\'utilisateur' AFTER `user_profil_company`;
UPDATE `trights` SET `user_profil_service`='2' WHERE id='1' OR id='4' OR id='5';
-- right to restrict ticket by service(s)
ALTER TABLE `tparameters` ADD `user_limit_service` INT(1) NOT NULL AFTER `user_agency`;
ALTER TABLE `trights` ADD `dashboard_service_only` INT(1) NOT NULL COMMENT 'Affiche uniquement les tickets du ou des services auquel est rattaché l\'utilisateur' AFTER `admin_user_view`;
-- category and subcat restriction by service
ALTER TABLE `tcategory` ADD `service` INT(5) NOT NULL AFTER `name`;
-- criticality list restriction by service
ALTER TABLE `tcriticality` ADD `service` INT(5) NOT NULL AFTER `color`;
-- right for new fields in ticket
ALTER TABLE `trights` ADD `ticket_service` INT(1) NOT NULL COMMENT 'Modification du service dans le ticket' AFTER `ticket_type_disp`;
ALTER TABLE `trights` ADD `ticket_service_disp` INT(1) NOT NULL COMMENT 'Affiche le champ service dans le ticket' AFTER `ticket_service`;
ALTER TABLE `trights` ADD `ticket_service_mandatory` INT NOT NULL COMMENT 'Oblige la saisie du champ service' AFTER `ticket_service_disp`;
INSERT INTO `tservices` (`id`, `name`, `ldap_guid`, `disable`) VALUES (NULL, 'Aucun', '', '0');
UPDATE `tservices` SET `id` = '0' WHERE `tservices`.`name` = 'Aucun';
ALTER TABLE `trights` ADD `ticket_new_service` INT(1) NOT NULL COMMENT 'Modification du service pour les nouveaux tickets' AFTER `ticket_new_type_disp`;
ALTER TABLE `trights` ADD `ticket_new_service_disp` INT(1) NOT NULL COMMENT 'Affiche le champ service pour les nouveaux tickets' AFTER `ticket_new_service`;
UPDATE `trights` SET `ticket_new_service`='2';
UPDATE `trights` SET `ticket_service`='2' WHERE id='1' OR id='4' OR id='5';
-- right to supervisor
ALTER TABLE `trights` ADD `admin_groups` INT(1) NOT NULL COMMENT 'Affiche le menu Administration > Groupes uniquement' AFTER `admin`;
ALTER TABLE `trights` ADD `admin_lists` INT(1) NOT NULL COMMENT 'Affiche le menu Administration > Listes uniquement' AFTER `admin_groups`;
ALTER TABLE `trights` ADD `admin_lists_category` INT(1) NOT NULL COMMENT 'Affiche le menu Administration > Listes > Catégories' AFTER `admin_lists`;
ALTER TABLE `trights` ADD `admin_lists_subcat` INT(1) NOT NULL COMMENT 'Affiche le menu Administration > Listes > Sous-catégories' AFTER `admin_lists_category`;
ALTER TABLE `trights` ADD `admin_lists_criticality` INT(1) NOT NULL COMMENT 'Affiche le menu Administration > Listes > Criticités' AFTER `admin_lists_subcat`;
ALTER TABLE `tgroups` ADD `service` INT(5) NOT NULL AFTER `type`;
-- modify dashboard for all services and agency modification
ALTER TABLE `trights` ADD `dashboard_col_service` INT(1) NOT NULL COMMENT 'Affiche la colonne service dans la liste des tickets' AFTER `dashboard_service_only`;
ALTER TABLE `trights` ADD `dashboard_col_agency` INT(1) NOT NULL COMMENT 'Affiche la colonne agence dans la liste des tickets' AFTER `dashboard_col_service`;
ALTER TABLE `trights` ADD `side_all_service_disp` INT(1) NOT NULL COMMENT 'Affiche tous les tickets associés aux services de l\'utilisateur connecté' AFTER `side_all_meta`;
ALTER TABLE `trights` ADD `side_all_service_edit` INT(1) NOT NULL COMMENT 'Permet de modifier tous les tickets associés aux services de l\'utilisateur connecté' AFTER `side_all_service_disp`;
ALTER TABLE `trights` ADD `side_all_agency_disp` INT(1) NOT NULL COMMENT 'Affiche tous les tickets associés aux agences de l\'utilisateur connecté' AFTER `side_all_service_edit`;
ALTER TABLE `trights` ADD `side_all_agency_edit` INT(1) NOT NULL COMMENT 'Permet de modifier tous les tickets associés aux agences de l\'utilisateur connecté' AFTER `side_all_agency_disp`;
ALTER TABLE `trights` ADD `dashboard_agency_only` INT(1) NOT NULL COMMENT 'Affiche uniquement les tickets des agences auxquelles est rattaché l\'utilisateur' AFTER `dashboard_service_only`;
-- mailbox modification
ALTER TABLE `tparameters` ADD `imap_mailbox_service` INT(1) NOT NULL AFTER `imap_post_treatment_folder`;
CREATE TABLE IF NOT EXISTS `tparameters_imap_multi_mailbox` (
`id` int(5) NOT NULL AUTO_INCREMENT,
`mail` varchar(250) NOT NULL,
`service_id` int(5) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
ALTER TABLE `tparameters_imap_multi_mailbox` ADD `password` VARCHAR(250) NOT NULL AFTER `mail`;
ALTER TABLE `trights` ADD `ticket_agency` INT(1) NOT NULL COMMENT 'Affiche le champ agence dans le ticket' AFTER `ticket_cat_actions`;
ALTER TABLE `tparameters` CHANGE `mail_from_adr` `mail_from_adr` VARCHAR(200) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL;
-- rename old fields
ALTER TABLE `tusers` CHANGE `service` `service_old` INT(5) NOT NULL;
ALTER TABLE `tassets` CHANGE `ip` `ip_old` VARCHAR(20) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL;
ALTER TABLE `tassets` CHANGE `ip2` `ip2_old` VARCHAR(20) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL;
ALTER TABLE `tassets` CHANGE `mac_lan` `mac_lan_old` VARCHAR(20) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL;
ALTER TABLE `tassets` CHANGE `mac_wlan` `mac_wlan_old` VARCHAR(20) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL;
-- survey part
CREATE TABLE IF NOT EXISTS `tsurvey_questions` (
`id` int(5) NOT NULL AUTO_INCREMENT,
`number` int(5) NOT NULL,
`type` int(5) NOT NULL COMMENT '1=yes/no,2=text,3=select,4=scale',
`text` varchar(250) NOT NULL,
`scale` int(2) NOT NULL,
`select_1` varchar(100) NOT NULL,
`select_2` varchar(100) NOT NULL,
`select_3` varchar(100) NOT NULL,
`select_4` varchar(100) NOT NULL,
`select_5` varchar(100) NOT NULL,
`disable` int(1) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1;
CREATE TABLE IF NOT EXISTS `tsurvey_answers` (
`id` int(5) NOT NULL AUTO_INCREMENT,
`date` datetime NOT NULL,
`ticket_id` int(10) NOT NULL,
`question_id` int(5) NOT NULL,
`answer` varchar(500) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
ALTER TABLE `tparameters` ADD `survey` INT(1) NOT NULL AFTER `procedure`;
ALTER TABLE `tparameters` ADD `survey_ticket_state` INT(2) NOT NULL AFTER `survey`;
ALTER TABLE `tparameters` ADD `survey_auto_close_ticket` INT(1) NOT NULL AFTER `survey_ticket_state`;
ALTER TABLE `tparameters` ADD `survey_mail_text` VARCHAR(500) NOT NULL AFTER `survey`;
UPDATE `tparameters` SET `survey_mail_text`='Dans le cadre de l’amélioration de notre support merci de répondre au sondage suivant:';
ALTER TABLE `ttoken` ADD `action` VARCHAR(50) NOT NULL AFTER `token`;
ALTER TABLE `ttoken` ADD `ticket_id` INT(5) NOT NULL AFTER `action`; | true |
8b0d6ddfd52ef03c40582cf7771f78187768c679 | SQL | evgdugin/pgReport | /SCHEMA/refbook/SEQUENCE/gi_statuses_status_id_seq.sql | UTF-8 | 357 | 2.796875 | 3 | [] | no_license | CREATE SEQUENCE refbook.gi_statuses_status_id_seq
AS smallint
START WITH 1
INCREMENT BY 1
NO MAXVALUE
NO MINVALUE
CACHE 1;
ALTER SEQUENCE refbook.gi_statuses_status_id_seq OWNER TO postgres;
GRANT ALL ON SEQUENCE refbook.gi_statuses_status_id_seq TO user1c;
ALTER SEQUENCE refbook.gi_statuses_status_id_seq
OWNED BY refbook.gi_statuses.status_id;
| true |
1539db5bde948b988fbb82e1a6f6f62de219848a | SQL | pqshawn/sparrowPHP | /application/dbcheme/ldos.sql | UTF-8 | 1,624 | 3.171875 | 3 | [] | no_license | /*
MySQL Data Transfer
Date: 2015-01-13 11:31:49
*/
/*
文章表
*/
DROP TABLE IF EXISTS `dos_posts`;
CREATE TABLE `dos_posts` (
`post_id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`post_author` bigint(20) unsigned NOT NULL DEFAULT '0',
`post_cdate` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`post_udate` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`post_title` varchar(250) NOT NULL,
`post_excerpt` text NOT NULL,
`post_content` longtext NOT NULL,
`post_name` varchar(100) NOT NULL DEFAULT 'nickname',
`post_password` varchar(20) NOT NUlL DEFAULT '',
`post_status` varchar(20) NOT NULL DEFAULT 'publish',
`post_type` varchar(20) NOT NULL DEFAULT 'post',
`post_url` varchar(100) NOT NULL DEFAULT '',
`comment_status` varchar(20) NOT NULL DEFAULT 'open',
`comment_count` bigint(20) NOT NULL DEFAULT '0',
PRIMARY KEY (`post_id`),
KEY `post_author` (`post_author`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=0;
DROP TABLE IF EXISTS `dos_users`;
CREATE TABLE `dos_users` (
`user_id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`user_login` varchar(60) NOT NULL DEFAULT '',
`user_pass` varchar(64) NOT NULL DEFAULT '',
`user_nickname` varchar(60) NOT NULL DEFAULT '',
`user_email` varchar(100) NOT NULL DEFAULT '',
`user_url` varchar(100) NOT NULL DEFAULT '',
`user_cdate` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`user_udate` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`user_status` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`user_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=0 ; | true |
ced6f285eabf27fbabe29e10080d929d83cb893d | SQL | threecrm/order | /OrderProject/src/main/resources/weixin.sql | UTF-8 | 9,389 | 3.25 | 3 | [] | no_license | /*
Navicat MySQL Data Transfer
Source Server : root
Source Server Version : 50710
Source Host : localhost:3306
Source Database : weixin
Target Server Type : MYSQL
Target Server Version : 50710
File Encoding : 65001
Date: 2019-09-21 13:59:30
*/
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for customer_addr
-- ----------------------------
DROP TABLE IF EXISTS `customer_addr`;
CREATE TABLE `customer_addr` (
`customer_addr_id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增主键ID',
`customer_id` int(10) unsigned NOT NULL COMMENT 'customer_inf表的自增ID',
`zip` varchar(6) NOT NULL COMMENT '邮编',
`province` varchar(6) NOT NULL COMMENT '省份',
`city` varchar(6) NOT NULL COMMENT '城市',
`district` varchar(6) NOT NULL COMMENT '县',
`address` varchar(200) NOT NULL COMMENT '具体的地址门牌号',
`is_default` char(4) NOT NULL COMMENT '是否默认',
`modified_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间',
PRIMARY KEY (`customer_addr_id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COMMENT='用户地址表';
-- ----------------------------
-- Records of customer_addr
-- ----------------------------
INSERT INTO `customer_addr` VALUES ('1', '1', '475300', '河南', '开封', '兰考', '黄河路274号', '1', '2019-09-16 11:27:05');
-- ----------------------------
-- Table structure for customer_inf
-- ----------------------------
DROP TABLE IF EXISTS `customer_inf`;
CREATE TABLE `customer_inf` (
`customer_inf_id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '用户编号',
`customer_name` varchar(20) NOT NULL COMMENT '用户名称',
`customer_password` varchar(255) DEFAULT NULL COMMENT '用户登录密码',
`identity_card_type` tinyint(4) NOT NULL DEFAULT '1' COMMENT '证件类型:1 身份证,2 军官证,3 护照',
`identity_card_no` varchar(20) DEFAULT NULL COMMENT '证件号码',
`mobile_phone` varchar(11) DEFAULT NULL COMMENT '手机号',
`customer_email` varchar(50) DEFAULT NULL COMMENT '邮箱',
`gender` char(1) DEFAULT NULL COMMENT '性别',
`user_point` int(11) NOT NULL DEFAULT '0' COMMENT '用户积分',
`register_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '注册时间',
`birthday` datetime DEFAULT NULL COMMENT '会员生日',
`customer_level` tinyint(4) NOT NULL DEFAULT '1' COMMENT '会员级别:1 普通会员,2 青铜,3白银,4黄金,5钻石',
`user_money` decimal(8,2) NOT NULL DEFAULT '0.00' COMMENT '用户余额',
`modified_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间',
PRIMARY KEY (`customer_inf_id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COMMENT='用户信息表';
-- ----------------------------
-- Records of customer_inf
-- ----------------------------
INSERT INTO `customer_inf` VALUES ('1', '刘承恩', null, '1', '410225199805055814', '15890311683', '15890311683@163.com', '男', '0', '2019-09-16 10:42:23', '2019-09-19 10:40:34', '1', '0.00', '2019-09-16 10:42:23');
-- ----------------------------
-- Table structure for order_detail
-- ----------------------------
DROP TABLE IF EXISTS `order_detail`;
CREATE TABLE `order_detail` (
`detail_id` varchar(32) NOT NULL,
`order_id` varchar(32) NOT NULL,
`product_id` varchar(32) NOT NULL,
`product_name` varchar(64) NOT NULL COMMENT '商品名称',
`product_price` decimal(8,2) NOT NULL COMMENT '商品价格',
`product_quantity` int(11) NOT NULL COMMENT '商品数量',
`product_icon` varchar(512) DEFAULT NULL COMMENT '商品小图',
`create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
PRIMARY KEY (`detail_id`),
KEY `idx_order_id` (`order_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='订单详情表';
-- ----------------------------
-- Records of order_detail
-- ----------------------------
-- ----------------------------
-- Table structure for order_master
-- ----------------------------
DROP TABLE IF EXISTS `order_master`;
CREATE TABLE `order_master` (
`order_id` varchar(32) NOT NULL,
`buyer_name` varchar(32) NOT NULL COMMENT '买家名字',
`buyer_phone` varchar(32) NOT NULL COMMENT '买家电话',
`buyer_address` varchar(128) NOT NULL COMMENT '买家地址',
`buyer_openid` varchar(64) NOT NULL COMMENT '买家微信openID',
`order_amount` decimal(8,2) NOT NULL COMMENT '订单总金额',
`order_status` tinyint(1) NOT NULL DEFAULT '0' COMMENT '订单状态,默认0新下单',
`pay_status` tinyint(1) NOT NULL DEFAULT '0' COMMENT '支付状态,默认0未支付',
`create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
PRIMARY KEY (`order_id`),
KEY `idx_buyer_openid` (`buyer_openid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='订单表';
-- ----------------------------
-- Records of order_master
-- ----------------------------
-- ----------------------------
-- Table structure for product_category
-- ----------------------------
DROP TABLE IF EXISTS `product_category`;
CREATE TABLE `product_category` (
`category_id` int(11) NOT NULL AUTO_INCREMENT,
`category_name` varchar(64) NOT NULL COMMENT '类目名字',
`catShopID` varchar(11) NOT NULL COMMENT '店铺编号',
`create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
PRIMARY KEY (`category_id`)
) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=utf8mb4 COMMENT='类目表';
-- ----------------------------
-- Records of product_category
-- ----------------------------
INSERT INTO `product_category` VALUES ('1', '日销榜', '1', '2019-09-04 17:17:27', '2019-09-16 10:10:24');
INSERT INTO `product_category` VALUES ('5', '女士最爱', '1', '2019-09-04 17:54:42', '2019-09-16 10:10:27');
INSERT INTO `product_category` VALUES ('14', '男士最爱', '1', '2019-09-05 17:37:37', '2019-09-15 22:15:18');
-- ----------------------------
-- Table structure for product_info
-- ----------------------------
DROP TABLE IF EXISTS `product_info`;
CREATE TABLE `product_info` (
`product_id` varchar(64) NOT NULL COMMENT '商品编号',
`product_name` varchar(64) NOT NULL COMMENT '商品名称',
`product_price` decimal(8,2) NOT NULL COMMENT '商品单价',
`product_stock` int(11) NOT NULL COMMENT '库存',
`product_description` varchar(64) DEFAULT NULL COMMENT '描述',
`product_icon` varchar(512) DEFAULT NULL COMMENT '小图',
`category_type` int(11) NOT NULL COMMENT '类目编号',
`create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
PRIMARY KEY (`product_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='商品表';
-- ----------------------------
-- Records of product_info
-- ----------------------------
INSERT INTO `product_info` VALUES ('f1978808-d827-11e9-b66b-e82a44a17662', '特步童鞋', '98.80', '55', '飞一般的感觉', 'img', '1', '2019-09-16 10:16:07', '2019-09-16 10:16:07');
-- ----------------------------
-- Table structure for shop
-- ----------------------------
DROP TABLE IF EXISTS `shop`;
CREATE TABLE `shop` (
`shopID` varchar(64) NOT NULL COMMENT '店铺编号',
`shopName` varchar(64) DEFAULT NULL COMMENT '店铺名称',
`shopDescribe` varchar(255) DEFAULT NULL COMMENT '店铺描述',
`userID` int(11) DEFAULT NULL COMMENT '商家用户id',
`shopicon` varchar(64) DEFAULT NULL COMMENT '店铺图片',
PRIMARY KEY (`shopID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- ----------------------------
-- Records of shop
-- ----------------------------
INSERT INTO `shop` VALUES ('1', '特步专卖店', '非一般的感觉', '1', 'img');
-- ----------------------------
-- Table structure for shopping_trolley
-- ----------------------------
DROP TABLE IF EXISTS `shopping_trolley`;
CREATE TABLE `shopping_trolley` (
`carID` varchar(255) NOT NULL COMMENT '购物车编号',
`customerID` int(11) DEFAULT NULL COMMENT '用户编号',
`productID` varchar(255) DEFAULT NULL COMMENT '商品编号',
PRIMARY KEY (`carID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- ----------------------------
-- Records of shopping_trolley
-- ----------------------------
-- ----------------------------
-- Table structure for users
-- ----------------------------
DROP TABLE IF EXISTS `users`;
CREATE TABLE `users` (
`userid` int(11) NOT NULL AUTO_INCREMENT COMMENT '用户编号',
`userName` varchar(255) DEFAULT NULL COMMENT '用户真实名称',
`user_loginName` varchar(32) DEFAULT NULL COMMENT '用户登录名称',
`user_PassWord` varchar(255) DEFAULT NULL COMMENT '用户登录密码',
PRIMARY KEY (`userid`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4;
-- ----------------------------
-- Records of users
-- ----------------------------
INSERT INTO `users` VALUES ('1', '刘承恩', '410225199805055814', '123456');
| true |
188f52d91deeaf418d5390282567eab626624a14 | SQL | 1241545483/terrace-cloud | /sql/20190122-category-dml.sql | UTF-8 | 2,688 | 2.734375 | 3 | [] | no_license |
/*推荐栏目*/
INSERT INTO base_system_parameter
(REC_ID,PARAMETER_TYPE, PARAMETER_KEY, PARAMETER_NAME, PARAMETER_VALUE, WEIGHT, CREATE_TIME, UPDATE_TIME)
VALUES ('111','menu', '1', '推荐栏目', '高考必备书目', 25, now(),now());
INSERT INTO base_system_parameter
(REC_ID,PARAMETER_TYPE, PARAMETER_KEY, PARAMETER_NAME, PARAMETER_VALUE, WEIGHT, CREATE_TIME, UPDATE_TIME)
VALUES ('112','menu', '2', '推荐栏目', '中考必备书目', 26, now(),now());
INSERT INTO base_system_parameter
(REC_ID,PARAMETER_TYPE, PARAMETER_KEY, PARAMETER_NAME, PARAMETER_VALUE, WEIGHT, CREATE_TIME, UPDATE_TIME)
VALUES ('113','menu', '3', '推荐栏目', '教育部推荐书目', 27, now(),now());
/*推荐年级*/
INSERT INTO base_system_parameter
(REC_ID,PARAMETER_TYPE, PARAMETER_KEY, PARAMETER_NAME, PARAMETER_VALUE, WEIGHT, CREATE_TIME, UPDATE_TIME)
VALUES ('121','level', '1', '推荐年级', '七年级上', 28, now(),now());
INSERT INTO base_system_parameter
(REC_ID,PARAMETER_TYPE, PARAMETER_KEY, PARAMETER_NAME, PARAMETER_VALUE, WEIGHT, CREATE_TIME, UPDATE_TIME)
VALUES ('122','level', '2', '推荐年级', '七年级下', 29, now(),now());
INSERT INTO base_system_parameter
(REC_ID,PARAMETER_TYPE, PARAMETER_KEY, PARAMETER_NAME, PARAMETER_VALUE, WEIGHT, CREATE_TIME, UPDATE_TIME)
VALUES ('123','level', '3', '推荐年级', '八年级上', 30, now(),now());
INSERT INTO base_system_parameter
(REC_ID,PARAMETER_TYPE, PARAMETER_KEY, PARAMETER_NAME, PARAMETER_VALUE, WEIGHT, CREATE_TIME, UPDATE_TIME)
VALUES ('124','level', '4', '推荐年级', '八年级下', 31, now(),now());
INSERT INTO base_system_parameter
(REC_ID,PARAMETER_TYPE, PARAMETER_KEY, PARAMETER_NAME, PARAMETER_VALUE, WEIGHT, CREATE_TIME, UPDATE_TIME)
VALUES ('125','level', '5', '推荐年级', '九年级上', 32, now(),now());
INSERT INTO base_system_parameter
(REC_ID,PARAMETER_TYPE, PARAMETER_KEY, PARAMETER_NAME, PARAMETER_VALUE, WEIGHT, CREATE_TIME, UPDATE_TIME)
VALUES ('126','level', '6', '推荐年级', '九年级下', 33, now(),now());
/*目录等级*/
INSERT INTO base_system_parameter
(REC_ID,PARAMETER_TYPE, PARAMETER_KEY, PARAMETER_NAME, PARAMETER_VALUE, WEIGHT, CREATE_TIME, UPDATE_TIME)
VALUES ('131','level', '1', '目录等级', '一级目录', 34, now(),now());
INSERT INTO base_system_parameter
(REC_ID,PARAMETER_TYPE, PARAMETER_KEY, PARAMETER_NAME, PARAMETER_VALUE, WEIGHT, CREATE_TIME, UPDATE_TIME)
VALUES ('132','level', '2', '目录等级', '二级目录', 35, now(),now());
INSERT INTO base_system_parameter
(REC_ID,PARAMETER_TYPE, PARAMETER_KEY, PARAMETER_NAME, PARAMETER_VALUE, WEIGHT, CREATE_TIME, UPDATE_TIME)
VALUES ('133','level', '3', '目录等级', '三级目录', 36, now(),now()); | true |
21c30b931287c211f70e0809dffcc44e013b8011 | SQL | rin-nas/postgresql-patterns-library | /dba/pg_constraints.sql | UTF-8 | 976 | 4.375 | 4 | [
"MIT"
] | permissive | --Find the Constraints in your Database
--source: https://www.crunchydata.com/blog/postgres-constraints-for-newbies
SELECT * FROM (
SELECT
c.connamespace::regnamespace::text as table_schema,
c.conrelid::regclass::text as table_name,
con.column_name,
c.conname as constraint_name,
pg_get_constraintdef(c.oid)
FROM
pg_constraint c
JOIN
pg_namespace ON pg_namespace.oid = c.connamespace
JOIN
pg_class ON c.conrelid = pg_class.oid
LEFT JOIN
information_schema.constraint_column_usage con ON
c.conname = con.constraint_name AND pg_namespace.nspname = con.constraint_schema
UNION ALL
SELECT
table_schema, table_name, column_name, NULL, 'NOT NULL'
FROM information_schema.columns
WHERE
is_nullable = 'NO'
) all_constraints
WHERE
table_schema NOT IN ('pg_catalog', 'information_schema')
ORDER BY table_schema, table_name, column_name, constraint_name
;
| true |
3f395c7418730e93b3a96d2926f036933abcc281 | SQL | krithika2802/Taiho-R3 | /ccdm/TAS3681_101/layer5/sitemilestone.sql | UTF-8 | 2,070 | 3.9375 | 4 | [] | no_license | /*
CCDM SiteMilestone mapping
Notes: Standard mapping to CCDM SiteMilestone table
*/
WITH included_sites AS (
SELECT DISTINCT studyid, siteid FROM site),
sitemilestone_data AS (
select studyid,
siteid,
row_number() over (partition by studyid,siteid order by expecteddate,milestonelabel) as milestoneseq,
milestonelabel,
milestonetype,
expecteddate,
ismandatory
from
(
SELECT 'TAS3681_101'::text AS studyid,
sm."site_number"::text AS siteid,
null::int AS milestoneseq,
sm."milestone_name"::text AS milestonelabel,
'Actual'::text AS milestonetype,
nullif(sm."actual_date",'')::date AS expecteddate,
'yes'::boolean AS ismandatory
from tas3681_101_ctms.site_milestones sm
UNION ALL
SELECT 'TAS3681_101'::text AS studyid,
sm."site_number"::text AS siteid,
null::int AS milestoneseq,
sm."milestone_name"::text AS milestonelabel,
'Planned'::text AS milestonetype,
nullif(sm."planned_date",'')::date AS expecteddate,
'yes'::boolean AS ismandatory
from tas3681_101_ctms.site_milestones sm
)sm
)
SELECT
/*KEY (sm.studyid || '~' || sm.siteid)::text AS comprehendid, KEY*/
sm.studyid::text AS studyid,
sm.siteid::text AS siteid,
sm.milestoneseq::int AS milestoneseq,
sm.milestonelabel::text AS milestonelabel,
sm.milestonetype::text AS milestonetype,
sm.expecteddate::date AS expecteddate,
sm.ismandatory::boolean AS ismandatory
/*KEY, (sm.studyid || '~' || sm.siteid || '~' || sm.milestonetype || '~' || sm.milestoneseq)::text AS objectuniquekey KEY*/
/*KEY , now()::timestamp with time zone AS comprehend_update_time KEY*/
FROM sitemilestone_data sm
JOIN included_sites si ON (sm.studyid = si.studyid AND sm.siteid = si.siteid);
| true |
be5fe7636d7808eaf1a4e9ec915a32c5e74d91bd | SQL | ThinkUpLLC/callbax | /sql/2012-02-24_followercount.sql | UTF-8 | 334 | 2.796875 | 3 | [] | no_license | ALTER TABLE cb_users ADD follower_count INT NOT NULL DEFAULT 0
COMMENT 'Total number of user followers/subscribers/friends.' AFTER username;
ALTER TABLE cb_users ADD last_follower_count TIMESTAMP NOT NULL
COMMENT 'Last time the user follower count was updated.';
UPDATE cb_users SET last_follower_count='2010-01-01 01:00:00'; | true |
f0ac842fc781be20b58fb1179237d591077c5147 | SQL | Blazeker/holbertonschool-higher_level_programming | /0x0D-SQL_introduction/11-best_score.sql | UTF-8 | 238 | 2.875 | 3 | [] | no_license | -- script that lists all records with a score >= 10 in the table second_table of the database hbtn_0c_0 in your MySQL server.
-- list all records with score >= 10
SELECT score, name FROM second_table WHERE score >= 10 ORDER BY score DESC; | true |
5d1eb5801e2491183e059db540413858d54752ca | SQL | didizhou25/VerkeersschoolVrijenburg | /loginsystem/loginsystem.sql | UTF-8 | 3,271 | 2.859375 | 3 | [] | no_license | -- phpMyAdmin SQL Dump
-- version 4.8.1
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Gegenereerd op: 03 jul 2018 om 09:04
-- Serverversie: 10.1.33-MariaDB
-- PHP-versie: 7.2.6
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Database: `loginsystem`
--
-- --------------------------------------------------------
--
-- Tabelstructuur voor tabel `reserve`
--
CREATE TABLE `reserve` (
`user_id` int(11) NOT NULL,
`kind` varchar(256) NOT NULL,
`datepicker` varchar(256) NOT NULL,
`first_name` varchar(256) NOT NULL,
`last_name` varchar(256) NOT NULL,
`birth_date` varchar(256) NOT NULL,
`bsn_number` varchar(256) NOT NULL,
`email` varchar(256) NOT NULL,
`phone_number` varchar(256) NOT NULL,
`address` varchar(256) NOT NULL,
`postal_code` varchar(256) NOT NULL,
`residence` varchar(256) NOT NULL,
`notes` varchar(256) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Gegevens worden geëxporteerd voor tabel `reserve`
--
INSERT INTO `reserve` (`user_id`, `kind`, `datepicker`, `first_name`, `last_name`, `birth_date`, `bsn_number`, `email`, `phone_number`, `address`, `postal_code`, `residence`, `notes`) VALUES
(1, 'aa', 'aa', 'Ding', 'Zhou', 'a', 'a', 'didizhou25@hotmail.com', '653305809', '2e opbouwstraat, 14', '3076 PS', 'Rotterdam', 'aaa'),
(2, 'aa', 'aa', 'Ding', 'Zhou', 'a', 'a', 'didizhou25@hotmail.com', '653305809', '2e opbouwstraat, 14', '3076 PS', 'Rotterdam', 'aaa'),
(3, '', '', '', '', '', '', '', '', '', '', '', ''),
(4, 'a', 'aa', 'Ding', 'Zhou', 'a', 'a', 'didizhou25@hotmail.com', '653305809', '2e opbouwstraat, 14', '3076 PS', 'Rotterdam', 'aaa');
-- --------------------------------------------------------
--
-- Tabelstructuur voor tabel `users`
--
CREATE TABLE `users` (
`user_id` int(11) NOT NULL,
`user_first` varchar(256) NOT NULL,
`user_last` varchar(256) NOT NULL,
`user_email` varchar(256) NOT NULL,
`user_uid` varchar(256) NOT NULL,
`user_pwd` varchar(256) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Gegevens worden geëxporteerd voor tabel `users`
--
INSERT INTO `users` (`user_id`, `user_first`, `user_last`, `user_email`, `user_uid`, `user_pwd`) VALUES
(3, 'aa', 'aa', 'didizhou25@hotmail.com', 'Admin', '$2y$10$GUaoj0gdOHSLFFugzARgE.oeFiWGWIIkJES2HDJDwAjlgKm6RgJXC');
--
-- Indexen voor geëxporteerde tabellen
--
--
-- Indexen voor tabel `reserve`
--
ALTER TABLE `reserve`
ADD PRIMARY KEY (`user_id`);
--
-- Indexen voor tabel `users`
--
ALTER TABLE `users`
ADD PRIMARY KEY (`user_id`);
--
-- AUTO_INCREMENT voor geëxporteerde tabellen
--
--
-- AUTO_INCREMENT voor een tabel `reserve`
--
ALTER TABLE `reserve`
MODIFY `user_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
--
-- AUTO_INCREMENT voor een tabel `users`
--
ALTER TABLE `users`
MODIFY `user_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
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 |
c32023792441cb7b7bd9d2971e445baa4eaa158d | SQL | Robertgaraban/projeto-toti-final-adtime | /database/db.sql | UTF-8 | 337 | 2.953125 | 3 | [] | no_license | -- to create a new database
--CREATE DATABASE adtime;
-- to use database
use adtime;
-- creating a new table
--CREATE TABLE adtime (
--id INT(6) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
-- pessoa VARCHAR(50) NOT NULL,
-- tarefa VARCHAR(100) NOT NULL,
--);
-- to show all tables
--show tables;
-- to describe table
--describe adtime;
| true |
e020a819ddf42236d86d415babf340435ff99fba | SQL | carollavecchiadba/ScriptsSQL | /Script Complete Process.sql | UTF-8 | 466 | 3.0625 | 3 | [] | no_license | /*
Script: Script Complete Process.SQL
Description: How to see process pending
Reference: Unknow
Author: Unknow
*/
SELECT session_id as SPID, command, a.text AS Query, start_time, percent_complete, dateadd(second,estimated_completion_time/1000, getdate()) as estimated_completion_time
FROM sys.dm_exec_requests r CROSS APPLY sys.dm_exec_sql_text(r.sql_handle) a
WHERE r.command in ('BACKUP DATABASE','RESTORE DATABASE', 'BACKUP LOG', 'SHRINKFILE') | true |
b407a6a66c20404a04efd3f4d870195ba762c956 | SQL | JhoanLT/mis-recetas | /_install/BD.sql | UTF-8 | 3,902 | 3.53125 | 4 | [] | no_license | /*
Navicat MySQL Data Transfer
Source Server : localhost
Source Server Version : 50505
Source Host : localhost:3306
Source Database : recetas
Target Server Type : MYSQL
Target Server Version : 50505
File Encoding : 65001
Date: 2018-11-28 15:22:38
*/
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for rol
-- ----------------------------
DROP TABLE IF EXISTS `rol`;
CREATE TABLE `rol` (
`idrol` int(11) NOT NULL AUTO_INCREMENT,
`nombre` varchar(55) NOT NULL,
`descripcion` varchar(55) DEFAULT NULL,
PRIMARY KEY (`idrol`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1;
-- ----------------------------
-- Table structure for usuario
-- ----------------------------
DROP TABLE IF EXISTS `usuario`;
CREATE TABLE `usuario` (
`idusuario` int(11) NOT NULL AUTO_INCREMENT,
`cedula` varchar(55) NOT NULL,
`nombre` varchar(55) NOT NULL,
`email` varchar(55) NOT NULL,
`usuario` varchar(55) NOT NULL,
`password` varchar(55) NOT NULL,
`fk_rol_idrol` int(11) NOT NULL,
PRIMARY KEY (`idusuario`),
KEY `fk_rol_idrol` (`fk_rol_idrol`),
CONSTRAINT `fk_rol_idrol` FOREIGN KEY (`fk_rol_idrol`) REFERENCES `rol` (`idrol`)
) ENGINE=InnoDB AUTO_INCREMENT=18 DEFAULT CHARSET=latin1;
-- ----------------------------
-- Table structure for clasificacion
-- ----------------------------
DROP TABLE IF EXISTS `clasificacion`;
CREATE TABLE `clasificacion` (
`idclasificacion` int(11) NOT NULL AUTO_INCREMENT,
`nombre` varchar(55) NOT NULL,
`descripcion` varchar(55) DEFAULT NULL,
PRIMARY KEY (`idclasificacion`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1;
-- ----------------------------
-- Table structure for receta
-- ----------------------------
DROP TABLE IF EXISTS `receta`;
CREATE TABLE `receta` (
`idreceta` int(11) NOT NULL AUTO_INCREMENT,
`idusuario` int(11) NOT NULL,
`nombre` varchar(45) NOT NULL,
`fecha` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`idreceta`),
KEY `fk_usuario_receta` (`idusuario`),
CONSTRAINT `fk_usuario_receta` FOREIGN KEY (`idusuario`) REFERENCES `usuario` (`idusuario`)
) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=latin1;
-- ----------------------------
-- Table structure for ingrediente
-- ----------------------------
DROP TABLE IF EXISTS `ingrediente`;
CREATE TABLE `ingrediente` (
`idingrediente` int(11) NOT NULL AUTO_INCREMENT,
`nombre` varchar(55) NOT NULL,
`descripcion` varchar(55) DEFAULT NULL,
`imagen` varchar(250) NOT NULL,
`clasificacion` int(11) NOT NULL,
PRIMARY KEY (`idingrediente`),
KEY `fk_clasificacion_idclasificacion` (`clasificacion`),
CONSTRAINT `fk_clasificacion_idclasificacion` FOREIGN KEY (`clasificacion`) REFERENCES `clasificacion` (`idclasificacion`)
) ENGINE=InnoDB AUTO_INCREMENT=20 DEFAULT CHARSET=latin1;
-- ----------------------------
-- Table structure for detalle_receta_ingrediente
-- ----------------------------
DROP TABLE IF EXISTS `detalle_receta_ingrediente`;
CREATE TABLE `detalle_receta_ingrediente` (
`id_detalle_receta_ingrediente` int(11) NOT NULL AUTO_INCREMENT,
`id_receta` int(11) NOT NULL,
`id_ingrediente` int(11) NOT NULL,
`cantidad` int(11) NOT NULL,
PRIMARY KEY (`id_detalle_receta_ingrediente`),
KEY `fk_receta_detalle_receta_ingrediente` (`id_receta`),
KEY `fk_ingrediente_detalle_receta_ingrediente` (`id_ingrediente`),
CONSTRAINT `fk_ingrediente_detalle_receta_ingrediente` FOREIGN KEY (`id_ingrediente`) REFERENCES `ingrediente` (`idingrediente`),
CONSTRAINT `fk_receta_detalle_receta_ingrediente` FOREIGN KEY (`id_receta`) REFERENCES `receta` (`idreceta`)
) ENGINE=InnoDB AUTO_INCREMENT=29 DEFAULT CHARSET=latin1;
/*INSERTAR USUARIO ADMINISTRADOR POR DEFECTO*/
INSERT INTO `usuario` (`cedula`, `nombre`, `email`, `usuario`, `password`, `fk_rol_idrol`) VALUES ('12345', 'Administrador', 'admin@admin.com', 'admin', '81dc9bdb52d04dc20036dbd8313ed055', '1'); | true |
b916010136a6c7897b33ca4ebdfbce749e0d5858 | SQL | Leo-Lvl/PPE-Ok-Boomer | /BDD_membre.sql | UTF-8 | 1,730 | 2.75 | 3 | [] | no_license | <<<<<<< HEAD
drop database if exists OkBoomer;
create database OkBoomer;
use OkBoomer;
drop table if exists Membre;
create table Membre
(idMembre int not null,
prenom varchar (15),
nom varchar (20),
pseudonyme varchar (20),
jourNaissance int,
moisNaissance int,
anneeNaissance int,
email varchar (30),
mdp varchar (15),
primary key (idMembre))engine=innodb;
create table genreActivité
(idGenreActivité int not null,
nomActivité varchar (25),
lieuActivité varchar (30),
horaireActivité time,
)
create table Activités
(idActivités int not null,
idGenreActivité int not null,
libelléActivité varchar (25),
)
insert into Membre(idMembre, prenom, nom, pseudonyme, jourNaissance, moisNaissance, anneeNaissance, email, mdp)
values (1,'Evan','Roussin','Nym_Le_Manchot',20,04,2001,'evan.roussin@gmail.com','motdepasse');
=======
drop database if exists OkBoomer;
create database OkBoomer;
use OkBoomer;
drop table if exists Membre;
create table Membre
(idMembre int not null,
prenom varchar (15),
nom varchar (20),
pseudonyme varchar (20),
jourNaissance int,
moisNaissance int,
anneeNaissance int,
email varchar (30),
mdp varchar (15),
primary key (idMembre))engine=innodb;
create table genreActivité
(idGenreActivité int not null,
nomActivité varchar (25),
lieuActivité varchar (30),
horaireActivité time,
)
create table Activités
(idActivités int not null,
idGenreActivité int not null,
libelléActivité varchar (25),
)
insert into Membre(idMembre, prenom, nom, pseudonyme, jourNaissance, moisNaissance, anneeNaissance, email, mdp)
values (1,'Evan','Roussin','Nym_Le_Manchot',20,04,2001,'evan.roussin@gmail.com','motdepasse');
>>>>>>> e7bcf90e2e8c4adda2d386b3a3e76bde97cff407
| true |
c8fa3074e65ff3544925c60441b171ece0d9b5d1 | SQL | dijkstra2003/docker-luc-dijkstra | /opdracht2/opdrachtC/demo-joel.sql | UTF-8 | 1,232 | 3.8125 | 4 | [] | no_license | DROP TABLE IF EXISTS `movies`;
CREATE TABLE `movies` (
`id` int(10) NOT NULL AUTO_INCREMENT,
`title` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`genre` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
PRIMARY KEY (`id`)
);
DROP TABLE IF EXISTS `actors`;
CREATE TABLE `actors` (
`id` int(10) NOT NULL AUTO_INCREMENT,
`first-name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`last-name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`age` tinyint(3) NOT NULL,
PRIMARY KEY (`id`)
);
DROP TABLE IF EXISTS `actors-in-movies`;
CREATE TABLE `actors-in-movies` (
`actor-id` int(10) NOT NULL,
`movie-id` int(10) NOT NULL,
KEY `actor_id_foreign` (`actor-id`),
KEY `movie_id_foreign` (`movie-id`),
CONSTRAINT `actor_id_foreign` FOREIGN KEY (`actor-id`) REFERENCES `actors` (`id`),
CONSTRAINT `movie_id_foreign` FOREIGN KEY (`movie-id`) REFERENCES `movies` (`id`)
);
DROP TABLE IF EXISTS `ratings`;
CREATE TABLE `ratings` (
`source` varchar(255) NOT NULL,
`movie-id` int(10) NOT NULL,
`rating` tinyint(2),
KEY `movie_id_ratings_foreign` (`movie-id`),
CONSTRAINT `movie_id_ratings_foreign` FOREIGN KEY (`movie-id`) REFERENCES `movies` (`id`)
); | true |
cd6c3e1580b52e4bb2b9155993f797c339b3022a | SQL | chege-maina/php-erp | /database/DBS needed/tbl_asset.sql | UTF-8 | 2,324 | 3.1875 | 3 | [] | no_license | -- phpMyAdmin SQL Dump
-- version 5.0.4
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Apr 28, 2021 at 11:53 AM
-- Server version: 10.4.17-MariaDB
-- PHP Version: 7.4.14
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Database: `msl_db`
--
-- --------------------------------------------------------
--
-- Table structure for table `tbl_asset`
--
CREATE TABLE `tbl_asset` (
`name` varchar(100) NOT NULL,
`number` varchar(100) NOT NULL,
`tag_no` varchar(100) NOT NULL,
`branch` varchar(15) NOT NULL,
`unit` varchar(20) NOT NULL,
`descpt` varchar(30) NOT NULL,
`weight` varchar(50) NOT NULL,
`date` date NOT NULL,
`dep_rate` varchar(15) NOT NULL,
`cost` varchar(100) NOT NULL,
`dep_method` varchar(50) NOT NULL,
`wear_tear` varchar(50) NOT NULL,
`asset_status` varchar(50) NOT NULL,
`financier` varchar(30) NOT NULL,
`loan_ref` varchar(100) NOT NULL,
`status` varchar(15) NOT NULL DEFAULT 'pending',
`asset_name` varchar(100) NOT NULL,
`asset_code` varchar(100) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `tbl_asset`
--
INSERT INTO `tbl_asset` (`name`, `number`, `tag_no`, `branch`, `unit`, `descpt`, `weight`, `date`, `dep_rate`, `cost`, `dep_method`, `wear_tear`, `asset_status`, `financier`, `loan_ref`, `status`, `asset_name`, `asset_code`) VALUES
('Ivy Wagner', '62', '35', 'MM1', 'Pieces', 'In sequi adipisci do', '60', '1978-09-23', '40', '100', 'Reducing', 'Class 2', 'inactive', 'Quidem sit exercita', '22', 'pending', '', ''),
('Kitra Villarreal', '96', '49', 'MM1', 'Pieces', 'Laboriosam voluptas', '68', '1980-01-04', '57', '11', 'Reducing', 'Class 3', 'disposed', 'Quia sunt in repell', '47', 'pending', '', '');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `tbl_asset`
--
ALTER TABLE `tbl_asset`
ADD PRIMARY KEY (`number`);
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 |
64b6c5d09983b08420697eea1bb39a14a71cbee9 | SQL | loonix/university | /PHP/Sistema_Registo/inscricoes.sql | UTF-8 | 1,593 | 3 | 3 | [] | no_license | -- phpMyAdmin SQL Dump
-- version 5.0.4
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Jun 26, 2021 at 04:58 PM
-- Server version: 10.4.17-MariaDB
-- PHP Version: 8.0.2
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Database: `bd_inscricoes`
--
-- --------------------------------------------------------
--
-- Table structure for table `inscricoes`
--
CREATE TABLE `inscricoes` (
`ID` int(11) NOT NULL,
`nome` varchar(50) NOT NULL,
`email` varchar(50) NOT NULL,
`telefone` varchar(50) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `inscricoes`
--
INSERT INTO `inscricoes` (`ID`, `nome`, `email`, `telefone`) VALUES
(1, 'James Badoos', 'jamesb@gmail.com', '908858574'),
(2, 'Omar', 'omar@mr.com', '985556555'),
(4, 'Teste', 'dan@asasd.asd', '9959595959');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `inscricoes`
--
ALTER TABLE `inscricoes`
ADD PRIMARY KEY (`ID`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `inscricoes`
--
ALTER TABLE `inscricoes`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;
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 |
760e0b911a296054b64ecec795b9ddf75306849c | SQL | sena-joaovictor/BancodeDados-Mysql | /dbinfox.sql | UTF-8 | 2,642 | 3.859375 | 4 | [
"MIT"
] | permissive | /**
Atividade 3 Banco de dados DBINFOX
@autor: João Victor S. Sena
Data da Criação 01/09/2021
*/
-- Pesquisar databases disponiveis
show databases;
-- Criando um banco de dados
create database dbinfox;
-- Selecionar o banco de dados
use dbinfox;
-- Criando uma tabela no banco de dados
-- tabela de funcionarios (usuarios)
create table usuarios(
id int primary key auto_increment,
usuario varchar(50) not null,
email varchar(250) not null unique,
login varchar(10) not null unique,
senha varchar(10)
);
-- tabela de clientes (clientes da assistencia tecnica)
create table clientes(
idcli int primary key auto_increment,
nome varchar(100) not null,
fone varchar(20) not null unique
);
-- tabela de ordem de serviço (OS)
create table tbos(
idos int primary key auto_increment,
equipamento varchar(250) not null,
defeito varchar(250)not null,
dataOs timestamp default current_timestamp,
statusOs varchar(50) not null,
valor decimal(10,2),
idcli int not null,
foreign key (idcli) references clientes(idcli)
);
insert into tbos(equipamento,defeito,statusOs,idcli)
values ('Notebook Asus Modelo VIVABOOK','HD com erro de leitura','Analise/Orçamento',1);
insert into tbos(equipamento,defeito,statusOs,valor,idcli)
values ('Notebook DELL Modelo Inspiron','Troca de sistema operacional','Aprovado','150',2);
describe clientes;
describe usuarios;
show tables;
drop table clientes;
drop table usuarios;
insert into usuarios (usuario,email,login,senha)
values ('Edward Snowden','edsnow@outlook.com','snwdm','1234');
insert into clientes (nome,fone)
values ('luciana ferraz','91234-7070');
insert into clientes (nome,fone)
values ('José de Assis','91234-7171');
-- comando usado para alterar campo na tabela
alter table usuarios modify senha varchar(250);
alter table usuarios modify login varchar(250);
-- Armazenando um campo com Criptografia
insert into usuarios (usuario,email,login,senha)
values ('anonymous','ADM',md5('1234'));
insert into usuarios (usuario,email,login,senha)
values ('Robson Vaamonde','linux00',md5('a1b2'));
insert into usuarios (usuario,email,login,senha)
values ('Leandro Ramos','','windows',md5('4321'));
insert into usuarios (usuario,email,login,senha)
values ('Kelly Cristina','raciocinio@logico','logica',md5('0101'));
insert into usuarios (usuario,email,login,senha)
values ('José de Assis','deassis@jose.com','mysql',md5('0001'));
insert into usuarios (usuario,email,login,senha)
values ('Edilson silva','backend@devops.com','DEVOPS',md5('0000'));
select * from usuarios;
select * from clientes;
select * from tbos;
-- excluindo um registro especifico da tabela (USAR SEMPRE O ID COMO FORMA DE "SEGURANÇA")
delete from usuarios where id=3; | true |
4a441315ed8d20b21a1440f490f15e9efd271f18 | SQL | CharH/AnimaLuvApp | /AnimaLuvData/Script.PostDeployment1.sql | UTF-8 | 2,194 | 3.546875 | 4 | [] | no_license | MERGE INTO Color AS Target
USING (VALUES
(1, 'Red'),
(2, 'Orange'),
(3, 'Yellow'),
(4, 'Green'),
(5, 'Blue'),
(6, 'Purple'),
(7, 'Rainbow')
)
AS Source (ColorID, Name)
ON Target.ColorID = Source.ColorID
WHEN NOT MATCHED BY TARGET THEN
INSERT (Name)
VALUES (Name);
MERGE INTO Material AS Target
USING (VALUES
(1, 'Fleece', 1),
(2, 'Felt', 0),
(3, 'Cotton', 1),
(4, 'Fur', 0)
)
AS Source (MaterialID, Name, BabySafe)
ON Target.MaterialID = Source.MaterialID
WHEN NOT MATCHED BY TARGET THEN
INSERT (Name, BabySafe)
VALUES (Name, BabySafe);
MERGE INTO Outfit AS Target
USING (VALUES
(1, 'Cowboy', 15),
(2, 'Ballerina', 10),
(3, 'Astronaut', 15),
(4, 'Clown', 10)
)
AS Source (OutfitID, Name, Price)
ON Target.OutfitID = Source.OutfitID
WHEN NOT MATCHED BY TARGET THEN
INSERT (Name, Price)
VALUES (Name, Price);
MERGE INTO Size AS Target
USING (VALUES
(1, 'Small (6")'),
(2, 'Medium (12")'),
(3, 'Large (18")'),
(4, 'Extra Large (24")')
)
AS Source (SizeID, Name)
ON Target.SizeID = Source.SizeID
WHEN NOT MATCHED BY TARGET THEN
INSERT (Name)
VALUES (Name);
MERGE INTO Stuffing AS Target
USING (VALUES
(1, 'Pellets (Beanbag feel)', 0),
(2, 'Polyester', 0),
(3, 'Organic Cotton', 1),
(4, 'Wool', 1),
(5, 'Bamboo', 1)
)
AS Source (StuffingID, Name, BabySafe)
ON Target.StuffingID = Source.StuffingID
WHEN NOT MATCHED BY TARGET THEN
INSERT (Name, BabySafe)
VALUES (Name, BabySafe);
MERGE INTO Animal AS Target
USING (VALUES
(1, 'Bear'),
(2, 'Puppy'),
(3, 'Kitty'),
(4, 'Pony'),
(5, 'Dragon')
)
AS Source (AnimalID, Name)
ON Target.AnimalID = Source.AnimalID
WHEN NOT MATCHED BY TARGET THEN
INSERT (Name)
VALUES (Name);
MERGE INTO CustomOrder AS Target
USING (VALUES
(1, 'Sally', 5, 3, 5, 1, 3, 2, '2013-09-01')
)
AS Source (CustomOrderID, Name, AnimalID, SizeID, ColorID, MaterialID, StuffingID, OutfitID, OrderDate)
ON Target.CustomOrderID = Source.CustomOrderID
WHEN NOT MATCHED BY TARGET THEN
INSERT (Name, AnimalID, SizeID, ColorID, MaterialID, StuffingID, OutfitID, OrderDate)
VALUES (Name, AnimalID, SizeID, ColorID, MaterialID, StuffingID, OutfitID, OrderDate);
| true |
d82616e400ef8cad5daeff15be18729f47fe1a37 | SQL | dieka2501/salesnav | /sales_nav.sql | UTF-8 | 3,100 | 3.078125 | 3 | [
"MIT"
] | permissive | -- phpMyAdmin SQL Dump
-- version 4.4.3
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Sep 27, 2016 at 03:46
-- Server version: 5.6.24
-- PHP Version: 5.6.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 */;
--
-- Database: `sales_nav`
--
-- --------------------------------------------------------
--
-- Table structure for table `profile`
--
DROP TABLE IF EXISTS `profile`;
CREATE TABLE IF NOT EXISTS `profile` (
`idprofile` int(11) NOT NULL,
`profile_name` text COLLATE utf8_unicode_ci NOT NULL,
`profile_email` text COLLATE utf8_unicode_ci NOT NULL,
`profile_phone` text COLLATE utf8_unicode_ci NOT NULL,
`profile_handphone` text COLLATE utf8_unicode_ci NOT NULL,
`profile_job_position` text COLLATE utf8_unicode_ci NOT NULL,
`profile_company` text COLLATE utf8_unicode_ci NOT NULL,
`profile_business_line` text COLLATE utf8_unicode_ci NOT NULL,
`profile_gender` enum('l','p') COLLATE utf8_unicode_ci NOT NULL,
`profile_experiece` text COLLATE utf8_unicode_ci NOT NULL,
`profile_interest` text COLLATE utf8_unicode_ci NOT NULL,
`profile_note` text COLLATE utf8_unicode_ci NOT NULL,
`created_at` datetime NOT NULL,
`update_at` datetime NOT NULL,
`deleted_at` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `users`
--
DROP TABLE IF EXISTS `users`;
CREATE TABLE IF NOT EXISTS `users` (
`id` int(11) NOT NULL,
`name` text COLLATE utf8_unicode_ci NOT NULL,
`email` text COLLATE utf8_unicode_ci NOT NULL,
`password` text COLLATE utf8_unicode_ci NOT NULL,
`remember_token` text COLLATE utf8_unicode_ci,
`created_at` datetime DEFAULT NULL,
`updated_at` datetime DEFAULT NULL,
`deleted_at` datetime DEFAULT NULL
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Dumping data for table `users`
--
INSERT INTO `users` (`id`, `name`, `email`, `password`, `remember_token`, `created_at`, `updated_at`, `deleted_at`) VALUES
(1, 'Dikdik kusdinar', 'dieka.koes@gmail.com', '$2y$10$nzRO4oDbATtdihOc9t65l.pIQejHaSNBOdlKGjNamcldXHqqFVXDm', '26rM7tP0G82jlba6YuBplfwX5y6cjY6FcBYXdXmP0Y06ru5HZNSqjhy8Mah8', '2016-09-27 03:32:40', '2016-09-27 03:34:47', NULL);
--
-- Indexes for dumped tables
--
--
-- Indexes for table `profile`
--
ALTER TABLE `profile`
ADD PRIMARY KEY (`idprofile`);
--
-- Indexes for table `users`
--
ALTER TABLE `users`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `profile`
--
ALTER TABLE `profile`
MODIFY `idprofile` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `users`
--
ALTER TABLE `users`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=2;
/*!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 |
89b16faa6a6c1cbfc81e702250f21651304d94da | SQL | Insight-Services-APAC/powerbi-workspace-automation | /Subscriber/PowerBITelemetryDB/CEN/Views/vw_Workspaces.sql | UTF-8 | 994 | 3.546875 | 4 | [] | no_license |
CREATE View [CEN].[vw_Workspaces]
AS
WITH DashboardApps AS
(
SELECT Distinct Workspace_ID
FROM CEN.Dashboards
WHERE SUBSTRING(TRIM([DisplayName]),1,5) = '[App]'
)
,ReportApps as
(
SELECT Distinct Workspace_ID
FROM CEN.Reports
WHERE SUBSTRING(TRIM([Name]),1,5) = '[App]'
)
,Apps as
(
SELECT DISTINCT Workspace_ID
FROM
(
SELECT Workspace_ID FROM DashboardApps
UNION ALL
SELECT Workspace_ID FROM ReportApps
) as a
)
Select W.[Workspace_Id]
,[Name]
,[IsReadOnly]
,[IsOnDedicatedCapacity]
,[CapacityId]
,[Description]
,[Type]
,[State]
,[IsOrphaned]
,[Users]
,[Reports]
,[Dashboards]
,[Datasets]
,[Dataflows]
,[Workbooks]
,CASE WHEN A.Workspace_ID is NULL THEN 0
ELSE 1
END as HasApp
,CAST([DateRetrieved] AS DATETIME2) AS DateRetrieved
From CEN.Workspaces as W
LEFT JOIN Apps as A
on W.Workspace_Id = A.Workspace_ID | true |
c6b0d491175b878f8eae1b1e08f1f134bc2e64eb | SQL | Q-Adorable/tw_grad_traim | /practice/thirdWeeks/tw_mall_orderserver/src/main/resources/db/migration/V201808021011__init_table.sql | UTF-8 | 451 | 2.96875 | 3 | [] | no_license |
CREATE TABLE `tw_order` (
`id` int(20) NOT NULL AUTO_INCREMENT,
`user_id` int(20) NOT NULL,
`create_time` datetime NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
CREATE TABLE `order_item` (
`id` int(20) NOT NULL AUTO_INCREMENT,
`order_id` int(20) NOT NULL,
`product_id` int(20) NOT NULL,
`product_count` double NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8; | true |
dc2bb2dc4531c1313dbb6c021a48ec0aa3d95f1d | SQL | vrattant/followup | /followup/followup.sql | UTF-8 | 9,611 | 2.859375 | 3 | [
"Apache-2.0",
"MIT"
] | permissive | -- phpMyAdmin SQL Dump
-- version 4.5.1
-- http://www.phpmyadmin.net
--
-- Host: 127.0.0.1
-- Generation Time: Aug 10, 2017 at 02:16 AM
-- Server version: 10.1.13-MariaDB
-- PHP Version: 7.0.5
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: `followup`
--
-- --------------------------------------------------------
--
-- Table structure for table `employe_master`
--
CREATE TABLE `employe_master` (
`sno` int(5) NOT NULL,
`firstname` varchar(15) NOT NULL,
`surname` varchar(15) NOT NULL,
`Designation` varchar(25) NOT NULL,
`id` int(20) NOT NULL,
`username` int(20) NOT NULL,
`password` varchar(80) NOT NULL,
`project_code` varchar(10) NOT NULL,
`last_login` varchar(20) NOT NULL,
`email` varchar(30) NOT NULL,
`phone` varchar(13) NOT NULL,
`followup_status` int(2) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `employe_master`
--
INSERT INTO `employe_master` (`sno`, `firstname`, `surname`, `Designation`, `id`, `username`, `password`, `project_code`, `last_login`, `email`, `phone`, `followup_status`) VALUES
(1, 'Anuj', 'Gupta', 'Developer', 110026, 110026, '1234', 'proj1001', '2017-08-10 05:45:34', 'vrattantarora@gmail.com', '8577986617', 1),
(2, 'Akhil', 'Singh', 'Project Manager', 110059, 110059, '1234', 'proj1001', '2017-07-21 12:00:20', 'vrattantarora1@gmail.com', '8286792861', 1),
(3, 'Rakesh', 'Arora', 'Developer', 110086, 110086, '1234', 'proj1001', '2017-07-21 11:51:11', 'rakesharora@hcl.com', '9716819919', 1),
(4, 'Raveesh', 'Malhotra', 'Designer', 110065, 110065, '1234', 'proj1001', '2017-06-30 08:14:21', 'raveeshmalhotra@hcl.com', '8588792761', 1),
(5, 'Anil', 'Kumar', 'Project Manager', 18005, 18005, '1234', 'proj1099', '2017-07-21 12:48:01', 'akumar@hcl.com', '8572728695', 1),
(6, 'Gaurav', 'Singh', 'Developer', 18002, 18002, '1234', 'proj1099', '', 'gauravsingh@hcl.com', '8577986687', 1),
(7, 'Ankit', 'Yadav', 'Developer', 110087, 110087, '1234', 'proj1099', '2017-07-20 10:30:12', 'yadavankit12@gmail.com', '8871447726', 1),
(8, 'Anant', 'Pandey', 'Developer', 11879, 11879, '1234', 'proj1001', '2017-07-20 10:29:25', 'apandey110@gmail.com', '8577986643', 1);
-- --------------------------------------------------------
--
-- Table structure for table `proj1001`
--
CREATE TABLE `proj1001` (
`sno` int(11) NOT NULL,
`designation` varchar(30) NOT NULL,
`id` varchar(30) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `proj1001`
--
INSERT INTO `proj1001` (`sno`, `designation`, `id`) VALUES
(1, 'Developer', '110026'),
(2, 'Project Manager', '110059'),
(3, 'Developer', '110086'),
(4, 'Designer', '110065');
-- --------------------------------------------------------
--
-- Table structure for table `proj1099`
--
CREATE TABLE `proj1099` (
`sno` int(11) NOT NULL,
`designation` varchar(30) NOT NULL,
`id` varchar(30) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `proj1099`
--
INSERT INTO `proj1099` (`sno`, `designation`, `id`) VALUES
(1, 'Project Manager', '18005'),
(2, 'Developer', '18002'),
(3, 'Developer', '110087');
-- --------------------------------------------------------
--
-- Table structure for table `project_master`
--
CREATE TABLE `project_master` (
`sno` int(11) NOT NULL,
`project_code` varchar(10) NOT NULL,
`project_name` varchar(40) NOT NULL,
`proj_manager_id` varchar(30) NOT NULL,
`project_start` varchar(30) NOT NULL,
`project_deadline` varchar(30) NOT NULL,
`project_status` varchar(30) NOT NULL,
`project_desc` varchar(60) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `project_master`
--
INSERT INTO `project_master` (`sno`, `project_code`, `project_name`, `proj_manager_id`, `project_start`, `project_deadline`, `project_status`, `project_desc`) VALUES
(1, 'proj1001', 'DATA CENTER PROJECT xyz', '110059', '2017-01-31', '2017-12-31', 'Development', 'Create New Application HCL On the Go '),
(2, 'proj1099', 'Order Processing v1', '18005', '2017-04-30', '2018-01-01', 'Design', 'Create New System for order processing');
-- --------------------------------------------------------
--
-- Table structure for table `reg_followup`
--
CREATE TABLE `reg_followup` (
`sno` int(11) NOT NULL,
`project_code` varchar(10) NOT NULL,
`status` int(2) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `reg_followup`
--
INSERT INTO `reg_followup` (`sno`, `project_code`, `status`) VALUES
(1, 'proj1001', 1),
(2, 'proj1099', 1);
-- --------------------------------------------------------
--
-- Table structure for table `tasks_proj1001`
--
CREATE TABLE `tasks_proj1001` (
`sno` int(11) NOT NULL,
`taskcode` varchar(10) NOT NULL,
`taskname` varchar(25) NOT NULL,
`taskdesc` varchar(200) NOT NULL,
`assignedto` varchar(30) NOT NULL,
`assignedby` varchar(30) NOT NULL,
`assignedon` varchar(20) NOT NULL,
`completiondate` varchar(20) NOT NULL,
`status` varchar(20) NOT NULL DEFAULT 'INCOMPLETE'
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `tasks_proj1001`
--
INSERT INTO `tasks_proj1001` (`sno`, `taskcode`, `taskname`, `taskdesc`, `assignedto`, `assignedby`, `assignedon`, `completiondate`, `status`) VALUES
(1, 'dev11', 'change UI 2', 'Please change the UI of users section as discussed', '110026', '110059', '2017-06-20', '2017-07-24', 'INCOMPLETE'),
(2, 'dev13', 'Remove Error', '"Permission to access file denied" error is observed in demo.java file. Please remove.', '110026', '110086', '2017-07-30', '2017-07-01', 'COMPLETE'),
(14, 'Dev_65', 'Updation of client table', 'Kindly update the client table attributes, as discussed today.', '110086', '110026 ', '2017-06-29', '2017-07-04', 'INCOMPLETE'),
(15, 'Des_A1', 'CHANGE CUSTOMER UI DESIGN', 'Please change the customer UI design so that it becomes more readable and user-friendly', '110065', '110026 ', '2017-06-29', '2017-07-02', 'INCOMPLETE'),
(20, 'Pro_22', 'Send Client list', 'Sir, please upload the client list in project documents.', '110059', '110026 ', '2017-06-29', '2017-07-21', 'COMPLETE'),
(21, 'Dev_85', 'Complete admin component', 'Please complete the component for admin, so that it can be tested', '110026', '110059 ', '2017-06-30', '2017-07-24', 'INCOMPLETE'),
(25, 'Des_5C', 'Update page4.html', 'please update the layout of page4.html file, as discussed today.', '110065', '110059 ', '2017-06-30', '2017-07-22', 'INCOMPLETE'),
(26, 'Dev_7C', 'Update client.java ', 'Please update this file as discussed.', '110026', '110059 ', '2017-07-21', '2017-07-22', 'COMPLETE'),
(27, 'Dev_FB', 'Check emp5.java', 'Please check emp5.java file and update as discussed today.', '110026', '110059 ', '2017-07-21', '2017-07-22', 'INCOMPLETE'),
(28, 'Pro_DC', 'abcd', 'do{ \n\n\n }', '110059', '110026 ', '2017-07-21', '2017-07-22', 'COMPLETE'),
(29, 'Dev_E8', 'sdbnsj', 'sdank', '110086', '110026 ', '2017-07-21', '2017-07-22', 'INCOMPLETE');
-- --------------------------------------------------------
--
-- Table structure for table `tasks_proj1099`
--
CREATE TABLE `tasks_proj1099` (
`sno` int(11) NOT NULL,
`taskcode` varchar(10) NOT NULL,
`taskname` varchar(25) NOT NULL,
`taskdesc` varchar(200) NOT NULL,
`assignedto` varchar(30) NOT NULL,
`assignedby` varchar(30) NOT NULL,
`assignedon` varchar(20) NOT NULL,
`completiondate` varchar(20) NOT NULL,
`status` varchar(20) NOT NULL DEFAULT 'INCOMPLETE'
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `test`
--
CREATE TABLE `test` (
`sno` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Indexes for dumped tables
--
--
-- Indexes for table `employe_master`
--
ALTER TABLE `employe_master`
ADD PRIMARY KEY (`sno`);
--
-- Indexes for table `proj1001`
--
ALTER TABLE `proj1001`
ADD PRIMARY KEY (`sno`);
--
-- Indexes for table `proj1099`
--
ALTER TABLE `proj1099`
ADD PRIMARY KEY (`sno`);
--
-- Indexes for table `project_master`
--
ALTER TABLE `project_master`
ADD PRIMARY KEY (`sno`);
--
-- Indexes for table `reg_followup`
--
ALTER TABLE `reg_followup`
ADD PRIMARY KEY (`sno`);
--
-- Indexes for table `tasks_proj1001`
--
ALTER TABLE `tasks_proj1001`
ADD PRIMARY KEY (`sno`);
--
-- Indexes for table `test`
--
ALTER TABLE `test`
ADD PRIMARY KEY (`sno`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `employe_master`
--
ALTER TABLE `employe_master`
MODIFY `sno` int(5) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=9;
--
-- AUTO_INCREMENT for table `proj1001`
--
ALTER TABLE `proj1001`
MODIFY `sno` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
--
-- AUTO_INCREMENT for table `proj1099`
--
ALTER TABLE `proj1099`
MODIFY `sno` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
--
-- AUTO_INCREMENT for table `project_master`
--
ALTER TABLE `project_master`
MODIFY `sno` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT for table `reg_followup`
--
ALTER TABLE `reg_followup`
MODIFY `sno` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT for table `tasks_proj1001`
--
ALTER TABLE `tasks_proj1001`
MODIFY `sno` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=30;
/*!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 |
aa3c208d077e47f92fd0c0138c2aa0ecbfd1f88d | SQL | asouzab/oracle_plsql | /GOLIVEELO/TOPSQL/VEWCARTEIRASAP.sql | UTF-8 | 1,367 | 3.234375 | 3 | [] | no_license |
CREATE OR REPLACE FORCE VIEW VND.VW_ELO_CARTEIRA_SAP_SALESGROUP
(ID, NU_CARTEIRA_VERSION,CD_SALES_ORG, CD_SALES_DISTRICT,NO_SALES_DISTRICT,CD_SALES_OFFICE,NO_SALES_OFFICE,
CD_SALES_GROUP,NO_SALES_GROUP)
AS
(
SELECT
CTX.ID,
CTX.CD_SALES_ORG,
CTX.NU_CARTEIRA_VERSION,
CTX.CD_SALES_DISTRICT,
CTX.NO_SALES_DISTRICT,
CTX.CD_SALES_OFFICE,
CTX.NO_SALES_OFFICE,
CTX.CD_SALES_GROUP,
CTX.NO_SALES_GROUP
FROM VND.ELO_CARTEIRA_SAP_SALES_GROUP CTX
);
GRANT SELECT ON VND.VW_ELO_CARTEIRA_SAP_SALESGROUP TO CPT;
GRANT SELECT ON VND.VW_ELO_CARTEIRA_SAP_SALESGROUP TO VND_SEC;
-----------------------------------------------------
CREATE OR REPLACE FORCE VIEW VND.VW_ELO_CD_WEEK_SEMANAL
(
ID,
CD_WEEK,
DT_WEEK_START_DAY,
IC_ATIVO,
CD_YEAR_WEEK,
CD_YEAR,
CD_WEEK_OF_YEAR,
CD_MONTH_OF_YEAR,
CD_DAY_OF_YEAR,
NU_YEAR,
NU_WEEK_OF_YEAR,
NU_MONTH_OF_YEAR,
NU_DAY_OF_YEAR
)
AS
(
SELECT
CTX.ID,
CTX.CD_WEEK,
CTX.DT_WEEK_START_DAY,
CTX.IC_ATIVO,
CTX.CD_YEAR_WEEK,
CTX.CD_YEAR,
CTX.CD_WEEK_OF_YEAR,
CTX.CD_MONTH_OF_YEAR,
CTX.CD_DAY_OF_YEAR,
CTX.NU_YEAR,
CTX.NU_WEEK_OF_YEAR,
CTX.NU_MONTH_OF_YEAR,
CTX.NU_DAY_OF_YEAR
FROM VND.ELO_CD_WEEK_SEMANAL CTX
);
GRANT SELECT ON VND.VW_ELO_CD_WEEK_SEMANAL TO CPT;
GRANT SELECT ON VND.VW_ELO_CD_WEEK_SEMANAL TO VND_SEC;
| true |
77d67455ec1f5f0b7c1e0fc3a70e625675bb0bc8 | SQL | ajcfood/WORKDESK | /tables/ow_template.sql | UTF-8 | 1,732 | 3.625 | 4 | [] | no_license | DROP TABLE WORKDESK.OW_TEMPLATE CASCADE CONSTRAINTS;
CREATE TABLE WORKDESK.OW_TEMPLATE
(
TK_OW NUMBER(7) NOT NULL
)
TABLESPACE WORKDESK_DATA
PCTUSED 40
PCTFREE 10
INITRANS 1
MAXTRANS 255
STORAGE (
INITIAL 1M
NEXT 40K
MINEXTENTS 1
MAXEXTENTS UNLIMITED
PCTINCREASE 0
FREELISTS 1
FREELIST GROUPS 1
BUFFER_POOL DEFAULT
)
LOGGING
NOCOMPRESS
NOCACHE;
COMMENT ON TABLE WORKDESK.OW_TEMPLATE IS 'This table includes the ids of templates created through Order Workdesk.';
COMMENT ON COLUMN WORKDESK.OW_TEMPLATE.TK_OW IS 'This is the id for the Template.';
CREATE UNIQUE INDEX WORKDESK.PK_OW_TEMPLATE ON WORKDESK.OW_TEMPLATE
(TK_OW)
LOGGING
TABLESPACE WORKDESK_INDEX
PCTFREE 10
INITRANS 2
MAXTRANS 255
STORAGE (
INITIAL 1M
NEXT 40K
MINEXTENTS 1
MAXEXTENTS UNLIMITED
PCTINCREASE 0
FREELISTS 1
FREELIST GROUPS 1
BUFFER_POOL DEFAULT
);
ALTER TABLE WORKDESK.OW_TEMPLATE ADD (
CONSTRAINT PK_OW_TEMPLATE
PRIMARY KEY
(TK_OW)
USING INDEX WORKDESK.PK_OW_TEMPLATE
ENABLE VALIDATE);
CREATE OR REPLACE PUBLIC SYNONYM OW_TEMPLATE FOR WORKDESK.OW_TEMPLATE;
ALTER TABLE WORKDESK.OW_TEMPLATE ADD (
CONSTRAINT FK_OW_TEMPLATE_WORKSHEET
FOREIGN KEY (TK_OW)
REFERENCES WORKDESK.OW_WORKSHEET (TK_OW)
ENABLE VALIDATE);
GRANT DELETE, INSERT, SELECT, UPDATE ON WORKDESK.OW_TEMPLATE TO OMS;
GRANT DELETE, INSERT, SELECT, UPDATE ON WORKDESK.OW_TEMPLATE TO PUBLIC;
| true |
ad5528a8b09134c23acf7b9ed46c9551ec2b492c | SQL | manusoler/code-challenges | /hackerrank/sql/advanced_select/5_new_companies.sql | UTF-8 | 2,535 | 4.3125 | 4 | [] | no_license | -- Amber's conglomerate corporation just acquired some new companies. Each of the companies follows this hierarchy:
-- Given the table schemas below, write a query to print the company_code, founder name, total number of lead managers, total number of senior managers, total number of managers, and total number of employees. Order your output by ascending company_code.
-- Note:
-- The tables may contain duplicate records.
-- The company_code is string, so the sorting should not be numeric. For example, if the company_codes are C_1, C_2, and C_10, then the ascending company_codes will be C_1, C_10, and C_2.
select c.company_code, c.founder, num_lm, num_sm, num_m, num_e
from company c
join (
select c1.company_code, count(*) as num_lm
from (
select distinct c1.company_code, lm.lead_manager_code
from company c1
join Lead_Manager lm on c1.company_code = lm.company_code
) c1
group by c1.company_code
) lm on lm.company_code = c.company_code
join (
select c1.company_code, count(*) as num_sm
from (
select distinct c1.company_code, sm.senior_manager_code
from company c1
join Lead_Manager lm on c1.company_code = lm.company_code
join Senior_Manager sm on lm.lead_manager_code = sm.lead_manager_code
) c1
group by c1.company_code
) sm on sm.company_code = c.company_code
join (
select c1.company_code, count(*) as num_m
from (
select distinct c1.company_code, m.manager_code
from company c1
join Lead_Manager lm on c1.company_code = lm.company_code
join Senior_Manager sm on lm.lead_manager_code = sm.lead_manager_code
join Manager m on sm.senior_manager_code = m.senior_manager_code
) c1
group by c1.company_code
) m on m.company_code = c.company_code
join (
select c1.company_code, count(*) as num_e
from (
select distinct c1.company_code, e.employee_code
from company c1
join Lead_Manager lm on c1.company_code = lm.company_code
join Senior_Manager sm on lm.lead_manager_code = sm.lead_manager_code
join Manager m on sm.senior_manager_code = m.senior_manager_code
join Employee e on m.manager_code = e.manager_code
) c1
group by c1.company_code
) e on e.company_code = c.company_code
order by company_code; | true |
41586f0d970fa17c34b29b3b2a1d459dbfa82cd4 | SQL | Nev-Iva/ITFB-group-test | /selpo_q.sql | UTF-8 | 1,361 | 3.96875 | 4 | [] | no_license | use selpo;
-- 3.1 Выбрать все марки гречки;
select * from goods where catalog_id in (select id from catalogs where name = 'Гречка');
-- 3.2 Выбрать все транзакции с суммой менее 1 рубля;
select * from full_purchase where sum_purch < 1;
-- 3.3 Выбрать все транзакции постоянного покупателя Иванова;
select * from full_purchase where user_id in (select id from clients where lastname = 'Иванов');
-- 3.4 Выбрать топ-5 покупателей, которые совершили больше всего покупок;
SELECT clients.firstname as name, clients.lastname as surname,
full_purchase.user_id as user_id, count(full_purchase.id) as count_purch
FROM clients INNER JOIN full_purchase ON full_purchase.user_id = clients.id
group by user_id order by count_purch DESC limit 5;
-- 3.5 Сформировать выгрузку (отчет), в котором будет указано, сколько в среднем в месяц тратит Иванов в магазине.
SELECT EXTRACT(YEAR_MONTH FROM purch_date) AS ym, count(id), SUM(sum_purch) AS sum, AVG(sum_purch) as avg
FROM full_purchase where user_id in (select id from clients where lastname = 'Иванов')
GROUP BY EXTRACT(YEAR_MONTH FROM purch_date);
| true |
6c4b3cae5dc63e2e18e596bc2b55ebabeb90a3f6 | SQL | axadn/app-academy-projects | /W3D2/aa_questions/import_db.sql | UTF-8 | 1,972 | 3.65625 | 4 | [] | no_license | CREATE table users(
user integer PRIMARY KEY AUTOINCREMENT,
fname varchar(64) NOT NULL,
lname varchar(128) NOT NULL
);
INSERT into users (fname,lname) VALUES ('Tyler','Wood');
INSERT into users (fname,lname) VALUES ('Adan','Marrufo');
CREATE table questions(
question integer PRIMARY KEY autoincrement,
title varchar(64) NOT NULL,
body text NOT NULL,
author integer NOT NULL,
FOREIGN KEY(author) REFERENCES users(user)
);
INSERT into questions (title,body,author) VALUES ('How do I use google?','Question about using google',1);
INSERT into questions (title,body,author) VALUES ('How do I use ask jeeves?','Question about using ask jeeves',2);
CREATE table question_follows(
question_follow integer PRIMARY KEY autoincrement,
user_id integer NOT NULL,
question_id integer NOT NULL,
FOREIGN KEY(user_id) REFERENCES users(user),
FOREIGN KEY(question_id) REFERENCES questions(question)
);
INSERT into question_follows (user_id,question_id) VALUES (1,2);
INSERT into question_follows (user_id,question_id) VALUES (2,1);
CREATE table replies(
reply integer PRIMARY KEY autoincrement,
subject_question integer NOT NULL,
parent_reply integer,
author_id integer NOT NULL,
body text,
FOREIGN KEY(subject_question) REFERENCES questions(question),
FOREIGN KEY(parent_reply) REFERENCES replies(reply),
FOREIGN KEY(author_id) REFERENCES users(user)
);
INSERT INTO replies (subject_question,author_id,body) VALUES (1,2,'You type stuff into the search bar dummy');
INSERT INTO replies (subject_question,author_id,body) VALUES (2,1,'P much do the same there');
CREATE table question_likes(
question_like integer PRIMARY KEY autoincrement,
user_id integer NOT NULL,
question_id integer NOT NULL,
FOREIGN KEY(user_id) REFERENCES users(user),
FOREIGN KEY(question_id) REFERENCES questions(question)
);
INSERT INTO question_likes (user_id,question_id) VALUES (1,2);
INSERT INTO question_likes (user_id,question_id) VALUES (2,1);
| true |
96fad593dea67d3cb7369bdd9f32df37696139f4 | SQL | SpongePowered/Ore | /ore/conf/evolutions/default/40.sql | UTF-8 | 453 | 2.734375 | 3 | [
"MIT"
] | permissive | # --- !Ups
drop table notifications;
create table notifications (
id bigserial not null primary key,
created_at timestamp not null,
user_id bigint not null references users on delete cascade,
notification_type int not null,
message varchar(255) not null,
action varchar(255) not null,
read boolean not null default false
);
| true |
feae36aa9284284f2f436e0c37662ccf938ef4f1 | SQL | AlishaTech/N18_warmups | /N18-classwork.sql | UTF-8 | 168 | 3.484375 | 3 | [] | no_license | SELECT order_details, products, customers_table,
RANK() OVER (PARTITION BY order_details)
AS rank
FROM northwind
WHERE country = 'USA'
limit 3; | true |
710487e7a3e8b47d63e105e6af1d0bf1f18a9a4c | SQL | Seosamhoc/Csharp-Basics | /CGDatabase/Mock Test/Request6.sql | UTF-8 | 303 | 3.59375 | 4 | [] | no_license | --Which jobs are found in the Marketing and Accounting departments?
--*HINT* JOIN Employees JOIN Jobs OR
SELECT Job_Title
FROM Jobs
WHERE Job_ID IN (SELECT Job_ID FROM Employees WHERE Department_No IN
(SELECT Department_No FROM Departments WHERE Department_Name IN ('Marketing', 'Accounting'))) | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.