text stringlengths 6 9.38M |
|---|
CREATE TABLE IF NOT EXISTS "Vehiculo" (
"bastidor" varchar(30) NOT NULL,
"matricula" varchar(30) UNIQUE,
"marca" varchar(30) NOT NULL,
"modelo" varchar(30) NOT NULL,
"color" varchar(30) NOT NULL,
"precio" REAL NOT NULL,
"extrasInstalados" varchar(30),
"motor" varchar(30) NOT NULL,
"potencia" INTEGER NOT NULL,
"cilindrada" varchar(30) NOT NULL,
"tipo" varchar(30) NOT NULL,
"estado" varchar(20) NOT NULL,
PRIMARY KEY("bastidor")
); |
CREATE TABLE `users` (
`id` INT NOT NULL AUTO_INCREMENT,
`email` varchar(255) NOT NULL,
`password` varchar(255) NOT NULL,
`firstname` varchar(255) NOT NULL,
`lastname` varchar(255) NOT NULL,
`birthdate` DATE NOT NULL,
`role` INT NOT NULL DEFAULT '1',
PRIMARY KEY (`id`)
);
CREATE TABLE `trips` (
`id` INT NOT NULL AUTO_INCREMENT,
`driver` INT NOT NULL,
PRIMARY KEY (`id`)
);
CREATE TABLE `steps` (
`id` INT NOT NULL AUTO_INCREMENT,
`departure_time` DATE NOT NULL,
`departure_city` INT NOT NULL,
`arrival_time` DATE NOT NULL,
`arrival_city` INT NOT NULL,
`price` FLOAT NOT NULL,
`trip_id` INT NOT NULL,
PRIMARY KEY (`id`)
);
CREATE TABLE `passengers` (
`user_id` INT NOT NULL,
`step_id` INT NOT NULL
);
CREATE TABLE `cars` (
`id` INT NOT NULL AUTO_INCREMENT,
`slots` INT NOT NULL,
`model` varchar(255),
`user_id` INT NOT NULL,
PRIMARY KEY (`id`)
);
CREATE TABLE `cities` (
`id` INT NOT NULL AUTO_INCREMENT,
`label` varchar(255) NOT NULL,
`postcode` varchar(255) NOT NULL,
PRIMARY KEY (`id`)
);
CREATE TABLE `messages` (
`id` INT NOT NULL AUTO_INCREMENT,
`user_id` INT NOT NULL,
`trip_id` INT NOT NULL,
`body` varchar(255) NOT NULL,
`date` DATE NOT NULL,
PRIMARY KEY (`id`)
);
ALTER TABLE `trips` ADD CONSTRAINT `trips_fk0` FOREIGN KEY (`driver`) REFERENCES `users`(`id`);
ALTER TABLE `steps` ADD CONSTRAINT `steps_fk0` FOREIGN KEY (`departure_city`) REFERENCES `cities`(`id`);
ALTER TABLE `steps` ADD CONSTRAINT `steps_fk1` FOREIGN KEY (`arrival_city`) REFERENCES `cities`(`id`);
ALTER TABLE `steps` ADD CONSTRAINT `steps_fk2` FOREIGN KEY (`trip_id`) REFERENCES `trips`(`id`);
ALTER TABLE `passengers` ADD CONSTRAINT `passengers_fk0` FOREIGN KEY (`user_id`) REFERENCES `users`(`id`);
ALTER TABLE `passengers` ADD CONSTRAINT `passengers_fk1` FOREIGN KEY (`step_id`) REFERENCES `steps`(`id`);
ALTER TABLE `cars` ADD CONSTRAINT `cars_fk0` FOREIGN KEY (`user_id`) REFERENCES `users`(`id`);
ALTER TABLE `messages` ADD CONSTRAINT `messages_fk0` FOREIGN KEY (`user_id`) REFERENCES `users`(`id`);
ALTER TABLE `messages` ADD CONSTRAINT `messages_fk1` FOREIGN KEY (`trip_id`) REFERENCES `trips`(`id`);
|
-- phpMyAdmin SQL Dump
-- version 4.6.4
-- https://www.phpmyadmin.net/
--
-- Anamakine: 127.0.0.1
-- Üretim Zamanı: 16 Haz 2017, 20:54:08
-- Sunucu sürümü: 5.7.14
-- PHP Sürümü: 5.6.25
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 */;
--
-- Veritabanı: `personel`
--
-- --------------------------------------------------------
--
-- Tablo için tablo yapısı `employee`
--
CREATE TABLE `employee` (
`id` int(100) NOT NULL,
`name` varchar(150) NOT NULL,
`designation` varchar(150) NOT NULL,
`salary` varchar(100) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Tablo döküm verisi `employee`
--
INSERT INTO `employee` (`id`, `name`, `designation`, `salary`) VALUES
(7, 'mehmet', 'yönetim', '1000'),
(3, 'batuhan', 'computer', '5000'),
(6, 'ahmet', 'civil', '1000'),
(8, 'deneme', 'deneme', '1000');
--
-- Dökümü yapılmış tablolar için indeksler
--
--
-- Tablo için indeksler `employee`
--
ALTER TABLE `employee`
ADD UNIQUE KEY `1` (`id`),
ADD KEY `id` (`id`);
--
-- Dökümü yapılmış tablolar için AUTO_INCREMENT değeri
--
--
-- Tablo için AUTO_INCREMENT değeri `employee`
--
ALTER TABLE `employee`
MODIFY `id` int(100) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=9;
/*!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 */;
|
DROP TABLE IF EXISTS user_roles;
DROP TABLE IF EXISTS votes;
DROP TABLE IF EXISTS dishes;
DROP TABLE IF EXISTS users;
DROP TABLE IF EXISTS restaurants;
DROP SEQUENCE IF EXISTS global_seq;
CREATE SEQUENCE global_seq START 100000;
CREATE TABLE users
(
id INTEGER PRIMARY KEY DEFAULT nextval('global_seq'),
name VARCHAR NOT NULL,
email VARCHAR NOT NULL,
password VARCHAR NOT NULL,
registered TIMESTAMP DEFAULT now(),
enabled BOOL DEFAULT TRUE
);
CREATE UNIQUE INDEX users_unique_email_idx
ON users (email);
CREATE TABLE user_roles
(
user_id INTEGER NOT NULL,
role VARCHAR,
CONSTRAINT user_roles_idx UNIQUE (user_id, role),
FOREIGN KEY (user_id) REFERENCES users (id) ON DELETE CASCADE
);
CREATE TABLE restaurants
(
id INTEGER PRIMARY KEY DEFAULT nextval('global_seq'),
name VARCHAR NOT NULL,
address VARCHAR NOT NULL
);
CREATE TABLE dishes
(
id INTEGER PRIMARY KEY DEFAULT nextval('global_seq'),
restaurant_id INTEGER NOT NULL,
date TIMESTAMP NOT NULL,
name TEXT NOT NULL,
price INTEGER NOT NULL,
FOREIGN KEY (restaurant_id) REFERENCES restaurants (id) ON DELETE CASCADE
);
CREATE TABLE votes
(
restaurant_id INTEGER NOT NULL,
user_id INTEGER NOT NULL,
date DATE NOT NULL DEFAULT now(),
CONSTRAINT user_votes_idx UNIQUE (user_id, date),
FOREIGN KEY (restaurant_id) REFERENCES restaurants (id),
FOREIGN KEY (user_id) REFERENCES users (id) ON DELETE CASCADE
) |
drop view v_artists_with_most_album_releases;
create or replace view v_artists_with_most_album_releases as
select count(r.mb_id) as Releases, a.name as Artist from unified.d_releases_mb_release r, unified.mb_d_artist a
where a.mb_artist_name_id = r.artist_credit
group by a.name order by count(r.mb_id) desc limit 10;
drop view v_most_common_artist_name_in_industry;
create or replace view v_most_common_artist_name_in_industry as
select name as Artist_Name, count(name) as #_of_artists_with_this_name from unified.mb_d_artist a
group by name
order by count(name) desc limit(5);
drop view v_average_group_size_of_artists;
create or replace view v_average_group_size_of_artists as
select avg(artist_count) as average_artist_count_size from unified.MB_artist_credit_junction;
drop view v_most_common_medium_of_music_in_2015;
create or replace view v_most_common_medium_of_music_in_2015 as
select r.year as Year, f.format_type as Format, count(f.format_type) as Count from unified.D_releases_formats f
inner join unified.d_releases_mb_release r on f.release_id = r.d_id
group by r.year, f.format_type
having r.year = 2015
order by count(f.format_type) desc limit(10);
drop view v_most_common_word_used_in_release_name;
create or replace view v_most_common_word_used_in_release_name as
select a.name as word, count(a.name) as Count from unified.MB_D_artist a
inner join unified.d_releases_mb_release r on a.name = r.name
group by a.name
order by count(a.name) desc limit(10);
drop view v_area_with_most_artists;
create or replace view v_area_with_most_artists as
select x.name as Area, count(x.name) as Count from unified.mb_area x
right outer join unified.mb_d_artist a on a.area = x.area_id
group by x.name
order by count(x.name) desc limit 10;
drop view v_most_common_type_of_artist;
create or replace view v_most_common_type_of_artist as
select count(t.name) as Count, t.name as Type_of_Artist from unified.MB_artist_type t
join unified.mb_d_artist a on a.mb_artist_type_id = t.artist_type_id
group by t.name
order by count(t.artist_type_id) desc limit 10;
drop view v_most_popular_genres_in_2013;
create or replace view v_most_popular_genres_in_2013 as
select r.year as Year, g.name as Genre, count(g.name) as Count from unified.d_genres g
join unified.d_releases_genres rg on rg.genre_id = g.genre_id
join unified.d_releases_mb_release r on r.d_id = rg.release_id
where rg.genre_id is not null
group by r.year, g.name
having r.year = 2013
order by count(g.name) desc limit(3);
drop view v_biggest_group_of_musicians;
create or replace view v_biggest_group_of_musicians as
select max(c.artist_count) as Size, c.name as Group from unified.mb_artist_credit_junction c
join unified.d_releases_mb_release r on c.artist_credit_id = r.artist_credit
group by c.name
order by max(c.artist_count) desc limit 5;
drop view v_most_common_language_in_music_industry;
create or replace view v_most_common_language_in_music_industry as
select l.name as Language, count(l.name) as Count from unified.mb_language l
join unified.d_releases_mb_release r on r.language = l.language_id
group by l.name
order by count(l.name) desc limit 10;
--Time: 5745.850 ms
select * from v_artists_with_most_album_releases;
--Time: 886.389 ms
select * from v_most_common_artist_name_in_industry;
--Time: 118.285 ms
select * from v_average_group_size_of_artists;
--Time: 2513.822 ms
select * from v_most_common_medium_of_music_in_2015;
--Time: 3427.607 ms
select * from v_most_common_word_used_in_release_name;
--Time: 218.266 ms
select * from v_area_with_most_artists;
--Time: 856.267 ms
select * from v_most_common_type_of_artist;
--Time: 944.942 ms
select * from v_most_popular_genres_in_2013;
--Time: 1512.052 ms
select * from v_biggest_group_of_musicians;
--Time: 1271.650 ms
select * from v_most_common_language_in_music_industry;
|
-- View: vg_xxx_stock_location_product_serial_make_model_4
-- DROP VIEW vg_xxx_stock_location_product_serial_make_model_4;
CREATE OR REPLACE VIEW vg_xxx_stock_location_product_serial_make_model_4 AS
WITH l AS (
SELECT a.id,
a.location_id,
a.product_id,
a.prodlot_id,
e.name AS gtr_no,
e.x_greentek_lot AS lot_no,
e.x_transfer_price_cost AS transfer_price,
CASE
WHEN e.create_date IS NOT NULL THEN date_part('day'::text, age(now(), e.create_date::timestamp with time zone))
ELSE 60::double precision
END AS age,
a.stock_qty
FROM vg_xxx_stock_move_by_location a
LEFT JOIN stock_production_lot e ON a.prodlot_id = e.id
)
SELECT l.id,
l.location_id,
l.product_id,
l.prodlot_id,
r.complete_name AS wh_location,
d.name AS product_name,
split_part(d.name::text, '-'::text, 1) AS make,
split_part(d.name::text, '-'::text, 2) AS model,
split_part(d.name::text, '-'::text, 3) AS hdd,
split_part(d.name::text, '-'::text, 4) AS grade,
upper(split_part(d.name::text, '-'::text, 6)) AS color,
d.list_price,
l.gtr_no,
l.lot_no,
l.transfer_price,
l.age,
l.stock_qty
FROM l
JOIN product_product c ON l.product_id = c.id
JOIN product_template d ON c.product_tmpl_id = d.id
JOIN stock_location r ON l.location_id = r.id;
ALTER TABLE vg_xxx_stock_location_product_serial_make_model_4
OWNER TO odoo;
-- -------------------------------- ----------------------------------------------------------------
-- View: vg_xxx_stock_location_product_serial_make_model_5
-- DROP VIEW vg_xxx_stock_location_product_serial_make_model_5;
CREATE OR REPLACE VIEW vg_xxx_stock_location_product_serial_make_model_5 AS
SELECT vg_xxx_stock_location_product_serial_make_model_4.id,
vg_xxx_stock_location_product_serial_make_model_4.location_id,
vg_xxx_stock_location_product_serial_make_model_4.product_id,
vg_xxx_stock_location_product_serial_make_model_4.prodlot_id,
vg_xxx_stock_location_product_serial_make_model_4.wh_location,
vg_xxx_stock_location_product_serial_make_model_4.product_name,
vg_xxx_stock_location_product_serial_make_model_4.make,
vg_xxx_stock_location_product_serial_make_model_4.model,
vg_xxx_stock_location_product_serial_make_model_4.hdd,
vg_xxx_stock_location_product_serial_make_model_4.grade,
vg_xxx_stock_location_product_serial_make_model_4.color,
vg_xxx_stock_location_product_serial_make_model_4.list_price,
vg_xxx_stock_location_product_serial_make_model_4.gtr_no,
vg_xxx_stock_location_product_serial_make_model_4.lot_no,
vg_xxx_stock_location_product_serial_make_model_4.transfer_price,
vg_xxx_stock_location_product_serial_make_model_4.age,
vg_xxx_stock_location_product_serial_make_model_4.stock_qty
FROM vg_xxx_stock_location_product_serial_make_model_4
WHERE NOT (vg_xxx_stock_location_product_serial_make_model_4.prodlot_id IN ( SELECT vg_xxx_stock_location_product_serial_make_model_4_1.prodlot_id
FROM vg_xxx_stock_location_product_serial_make_model_4 vg_xxx_stock_location_product_serial_make_model_4_1
WHERE vg_xxx_stock_location_product_serial_make_model_4_1.prodlot_id IS NOT NULL
GROUP BY vg_xxx_stock_location_product_serial_make_model_4_1.prodlot_id
HAVING sum(vg_xxx_stock_location_product_serial_make_model_4_1.stock_qty) < 0::numeric));
ALTER TABLE vg_xxx_stock_location_product_serial_make_model_5
OWNER TO odoo;
-- -------------------------------- ----------------------------------------------------------------
-- View: vg_xxy_serial_age
-- DROP VIEW vg_xxy_serial_age;
CREATE OR REPLACE VIEW vg_xxy_serial_age AS
WITH a AS (
SELECT vg_xxx_stock_location_product_serial_make_model_4.prodlot_id,
sum(vg_xxx_stock_location_product_serial_make_model_4.stock_qty) AS closing_stk
FROM vg_xxx_stock_location_product_serial_make_model_4
GROUP BY vg_xxx_stock_location_product_serial_make_model_4.prodlot_id
HAVING sum(vg_xxx_stock_location_product_serial_make_model_4.stock_qty) > 0::numeric
)
SELECT d.name AS product_name,
split_part(d.name::text, '-'::text, 1) AS make,
split_part(d.name::text, '-'::text, 2) AS model,
split_part(d.name::text, '-'::text, 3) AS hdd,
split_part(d.name::text, '-'::text, 4) AS grade,
upper(split_part(d.name::text, '-'::text, 6)) AS color,
d.list_price,
CASE
WHEN l.create_date IS NOT NULL THEN date_part('day'::text, age(now(), l.create_date::timestamp with time zone))
ELSE 60::double precision
END AS age,
l.name AS gtr_no,
l.x_greentek_lot AS lot_no,
l.x_transfer_price_cost AS transfer_price
FROM stock_production_lot l
JOIN product_product c ON l.product_id = c.id
JOIN product_template d ON c.product_tmpl_id = d.id
WHERE (l.id IN ( SELECT a.prodlot_id
FROM a));
ALTER TABLE vg_xxy_serial_age
OWNER TO odoo;
COMMENT ON VIEW vg_xxy_serial_age
IS '-- first get which serial nos are in stock
-- now for each serial # in stock , from stock_production_lot get name , gtr , create_date (which is age)';
-- -------------------------------- ----------------------------------------------------------------
-- View: vg_xxy_max_sale_date_location_product_1
-- DROP VIEW vg_xxy_max_sale_date_location_product_1;
CREATE OR REPLACE VIEW vg_xxy_max_sale_date_location_product_1 AS
SELECT i.location_id,
i.product_id,
max(i.date) AS last_sale_date
FROM stock_move i
JOIN stock_picking_type m ON i.picking_type_id = m.id
WHERE i.state::text <> 'cancel'::text AND i.invoice_state::text = 'invoiced'::text AND i.invoice_line_id IS NOT NULL AND m.name::text = 'Delivery Orders'::text
GROUP BY i.location_id, i.product_id;
ALTER TABLE vg_xxy_max_sale_date_location_product_1
OWNER TO odoo;
COMMENT ON VIEW vg_xxy_max_sale_date_location_product_1
IS 'location wise product wise get maximum date of transaction
the transaction status must be invoiced and delivery note created';
-- -------------------------------- ----------------------------------------------------------------
-- View: vg_xxy_max_sale_date_location_product_2
-- DROP VIEW vg_xxy_max_sale_date_location_product_2;
CREATE OR REPLACE VIEW vg_xxy_max_sale_date_location_product_2 AS
SELECT l.location_id,
l.product_id,
l.last_sale_date,
d.name AS product_name,
split_part(d.name::text, '-'::text, 1) AS make,
split_part(d.name::text, '-'::text, 2) AS model,
split_part(d.name::text, '-'::text, 3) AS hdd,
split_part(d.name::text, '-'::text, 4) AS grade,
upper(split_part(d.name::text, '-'::text, 6)) AS color,
b.complete_name AS wh_location
FROM vg_xxy_max_sale_date_location_product_1 l
JOIN product_product c ON l.product_id = c.id
JOIN product_template d ON c.product_tmpl_id = d.id
JOIN stock_location b ON l.location_id = b.id;
ALTER TABLE vg_xxy_max_sale_date_location_product_2
OWNER TO odoo;
-- -------------------------------- ----------------------------------------------------------------
|
-- Provide a query that shows the most purchased track of 2013.
select top 10 with ties t.Name, sum(il.Quantity)
from InvoiceLine as il
join Track t
on il.TrackId = t.TrackId
join Invoice i
on i.InvoiceId = il.InvoiceId
where YEAR(i.InvoiceDate) = 2013
group by t.TrackId, t.Name
order by 2 desc |
-- +migrate Up
create table if not exists oauth_roles (
id varchar(36) not null,
name varchar(50) not null,
unique(name),
primary key(id)
);
-- +migrate Down
drop table if exists oauth_roles;
|
CREATE TABLE "user"(
id SERIAL PRIMARY KEY ,
login VARCHAR UNIQUE NOT NULL ,
mdp VARCHAR NOT NULL
);
CREATE TABLE "favorie"(
id_user VARCHAR NOT NULL,
id_pokemon INTEGER,
PRIMARY KEY(id_user,id_pokemon)
);
INSERT INTO "user"(login, mdp) VALUES ('john.doe','test');
INSERT INTO "user"(login, mdp) VALUES ('yvette.angel','test');
INSERT INTO "user"(login, mdp) VALUES ('amelia.waters','test');
INSERT INTO "user"(login, mdp) VALUES ('manuel.holloway','test');
INSERT INTO "user"(login, mdp) VALUES ('alonzo.erickson','test');
INSERT INTO "user"(login, mdp) VALUES ('otis.roberson','test');
INSERT INTO "user"(login, mdp) VALUES ('jaime.king','test');
create table "pokemon"(
abilities VARCHAR (255) ,
against_bug NUMERIC,
against_dark NUMERIC,
against_dragon NUMERIC,
against_electric NUMERIC,
against_fairy NUMERIC,
against_fight NUMERIC,
against_fire NUMERIC,
against_flying NUMERIC,
against_ghost NUMERIC,
against_grass NUMERIC,
against_ground NUMERIC,
against_ice NUMERIC,
against_normal NUMERIC,
against_poison NUMERIC,
against_psychic NUMERIC,
against_rock NUMERIC,
against_steel NUMERIC,
against_water NUMERIC,
attack INTEGER,
base_egg_steps NUMERIC,
base_happiness NUMERIC,
base_total NUMERIC,
capture_rate NUMERIC,
classfication VARCHAR (255),
defense INTEGER,
experience_growth NUMERIC,
height_m NUMERIC,
hp NUMERIC,
japanese_name VARCHAR (255),
english_name VARCHAR (255),
french_name VARCHAR (255),
percentage_male NUMERIC,
pokedex_number INTEGER PRIMARY KEY,
sp_attack INTEGER,
sp_defense INTEGER,
speed INTEGER,
type1 VARCHAR (255),
type2 VARCHAR (255),
weight_kg NUMERIC,
generation INTEGER,
is_legendary INTEGER
);
COPY "pokemon"(abilities , against_bug, against_dark, against_dragon, against_electric, against_fairy, against_fight, against_fire, against_flying, against_ghost, against_grass, against_ground, against_ice, against_normal, against_poison, against_psychic, against_rock, against_steel, against_water, attack, base_egg_steps, base_happiness, base_total, capture_rate, classfication, defense, experience_growth, height_m, hp, japanese_name, english_name, french_name, percentage_male, pokedex_number, sp_attack, sp_defense, speed, type1, type2, weight_kg, generation, is_legendary
)
FROM '/var/www/html/data/pokemon.csv' DELIMITER ';' CSV HEADER ENCODING 'windows-1251';
/*
admin NUMERIC DEFAULT 0
INSERT INTO "user"(login, firstname, lastname, mdp,admin) VALUES ('mehdi.tahri','Mehdi', 'Tahri','test',1);
CREATE TABLE "favorie" (
id_user INTEGER PRIMARY KEY ,
id_pokemon INTEGER PRIMARY KEY
);
*/
|
DROP TABLE IF EXISTS users cascade;
DROP TABLE IF EXISTS restaurants cascade;
DROP TABLE IF EXISTS followers cascade;
DROP TABLE IF EXISTS favorites cascade;
DROP TABLE IF EXISTS reviews;
DROP TABLE IF EXISTS reaction;
CREATE TABLE users (
id SERIAL PRIMARY KEY,
fname VARCHAR(255),
lname VARCHAR(255),
username VARCHAR(255) UNIQUE,
password VARCHAR(255),
about_me VARCHAR(255),
auth INTEGER DEFAULT 1,
loc VARCHAR(255),
date_created TIMESTAMP NOT NULL DEFAULT NOW()
);
CREATE TABLE restaurants (
id SERIAL PRIMARY KEY,
name VARCHAR(255),
rating INTEGER DEFAULT 0,
cuisine VARCHAR(255),
img_src VARCHAR(255),
loc VARCHAR(255),
creator VARCHAR(255) DEFAULT 'yelp',
date_created TIMESTAMP NOT NULL DEFAULT NOW()
);
CREATE TABLE followers (
id SERIAL PRIMARY KEY,
user_id VARCHAR(255) REFERENCES users(username) ON UPDATE CASCADE ON DELETE CASCADE NOT NULL,
follower_name VARCHAR(255) REFERENCES users(username) ON UPDATE CASCADE ON DELETE CASCADE NOT NULL,
date_created TIMESTAMP NOT NULL DEFAULT NOW()
);
CREATE TABLE favorites (
id SERIAL PRIMARY KEY,
user_id INTEGER REFERENCES users(id) ON UPDATE CASCADE ON DELETE CASCADE NOT NULL,
username VARCHAR(255),
restaurant_id INTEGER REFERENCES restaurants(id) ON UPDATE CASCADE ON DELETE CASCADE NOT NULL,
restaurant_name VARCHAR(255),
date_created TIMESTAMP NOT NULL DEFAULT NOW()
);
CREATE TABLE reviews (
id SERIAL PRIMARY KEY,
user_id INTEGER REFERENCES users(id) ON UPDATE CASCADE ON DELETE CASCADE NOT NULL,
username VARCHAR(255),
restaurant_id INTEGER REFERENCES restaurants(id) ON UPDATE CASCADE ON DELETE CASCADE NOT NULL,
restaurant_name VARCHAR(255),
content VARCHAR(700),
date_created TIMESTAMP NOT NULL DEFAULT NOW()
);
CREATE INDEX ON users (username);
CREATE INDEX ON restaurants (name);
|
-- Create database
CREATE DATABASE `testdb`
-- Create table
CREATE TABLE `testdb`.`users`
(
`id` INT AUTO_INCREMENT PRIMARY KEY,
`username` VARCHAR(50) NOT NULL,
`email` VARCHAR(50) NOT NULL,
`password` VARCHAR(60) NOT NULL
) |
-- phpMyAdmin SQL Dump
-- version 4.5.1
-- http://www.phpmyadmin.net
--
-- Client : 127.0.0.1
-- Généré le : Dim 16 Octobre 2016 à 16:15
-- Version du serveur : 10.1.13-MariaDB
-- Version de PHP : 5.5.37
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
CREATE DATABASE IF NOT EXISTS `biblioshare`;
USE `biblioshare`;
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Base de données : `biblioshare`
--
-- --------------------------------------------------------
--
-- Structure de la table `appartenir`
--
CREATE TABLE `appartenir` (
`num_auteur` int(4) NOT NULL,
`num_livre` int(4) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Structure de la table `auteur`
--
CREATE TABLE `auteur` (
`num_auteur` int(4) NOT NULL,
`nom_auteur` varchar(32) NOT NULL,
`prenom_auteur` varchar(32) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Structure de la table `collection`
--
CREATE TABLE `collection` (
`num_collection` int(4) NOT NULL,
`libelle_collection` varchar(32) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Structure de la table `categorie`
--
CREATE TABLE `categorie` (
`num_categorie` int(4) NOT NULL,
`libelle_categorie` varchar(32) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Structure de la table `detenir`
--
CREATE TABLE `detenir` (
`num_utilisateur` int(4) NOT NULL,
`num_livre` int(4) NOT NULL,
`emprunt` tinyint(1) DEFAULT NULL,
`confie` tinyint(1) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Structure de la table `edition`
--
CREATE TABLE `edition` (
`num_editeur` int(4) NOT NULL,
`libelle_editeur` varchar(32) NOT NULL,
`date_edition` date NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Structure de la table `livre`
--
CREATE TABLE `livre` (
`num_livre` int(4) NOT NULL,
`num_editeur` int(4) NOT NULL,
`num_collection` int(4) NOT NULL,
`num_categorie` int(4) NOT NULL,
`description` varchar(255) NOT NULL,
`date_sortie` date NOT NULL,
`libelle_livre` varchar(255) NOT NULL,
`image` longblob NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Structure de la table `posseder`
--
CREATE TABLE `posseder` (
`num_utilisateur` int(4) NOT NULL,
`num_utilisateur_1` int(4) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Structure de la table `utilisateur`
--
CREATE TABLE `utilisateur` (
`num_utilisateur` int(4) NOT NULL,
`nom` varchar(32) NOT NULL,
`prenom` varchar(32) NOT NULL,
`e_mail` varchar(32) NOT NULL,
`motdepasse` varchar(32) NOT NULL,
`date_inscription` date NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Contenu de la table `utilisateur`
--
INSERT INTO `utilisateur` (`num_utilisateur`, `nom`, `prenom`, `e_mail`, `motdepasse`, `date_inscription`) VALUES
(1, 'tongle', 'michael', 'michael@3il.fr', '314toto33', '2016-10-15'),
(2, 'kamdem', 'edgar', 'edgar@3il.fr', 'titi77854tt', '2016-10-15'),
(3, 'kamdem', 'roger', 'roger@3il.fr', '66roger123', '2016-10-15'),
(4, 'teka', 'diego', 'diego@3il.fr', 'ff123hh78', '2016-10-15');
--
-- Index pour les tables exportées
--
--
-- Index pour la table `appartenir`
--
ALTER TABLE `appartenir`
ADD PRIMARY KEY (`num_auteur`,`num_livre`),
ADD KEY `fk_appartenir_livre` (`num_livre`);
--
-- Index pour la table `auteur`
--
ALTER TABLE `auteur`
ADD PRIMARY KEY (`num_auteur`);
--
-- Index pour la table `collection`
--
ALTER TABLE `collection`
ADD PRIMARY KEY (`num_collection`);
--
-- Index pour la table `categorie`
--
ALTER TABLE `categorie`
ADD PRIMARY KEY (`num_categorie`);
--
-- Index pour la table `detenir`
--
ALTER TABLE `detenir`
ADD PRIMARY KEY (`num_utilisateur`,`num_livre`),
ADD KEY `fk_detenir_livre` (`num_livre`);
--
-- Index pour la table `edition`
--
ALTER TABLE `edition`
ADD PRIMARY KEY (`num_editeur`);
--
-- Index pour la table `livre`
--
ALTER TABLE `livre`
ADD PRIMARY KEY (`num_livre`),
ADD KEY `fk_livre_edition` (`num_editeur`),
ADD KEY `fk_livre_collection` (`num_collection`),
ADD KEY `fk_livre_categorie` (`num_categorie`);
--
-- Index pour la table `posseder`
--
ALTER TABLE `posseder`
ADD PRIMARY KEY (`num_utilisateur`,`num_utilisateur_1`),
ADD KEY `fk_posseder_utilisateur1` (`num_utilisateur_1`);
--
-- Index pour la table `utilisateur`
--
ALTER TABLE `utilisateur`
ADD PRIMARY KEY (`num_utilisateur`);
--
-- AUTO_INCREMENT pour les tables exportées
--
--
-- AUTO_INCREMENT pour la table `auteur`
--
ALTER TABLE `auteur`
MODIFY `num_auteur` int(4) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT pour la table `collection`
--
ALTER TABLE `collection`
MODIFY `num_collection` int(4) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT pour la table `categorie`
--
ALTER TABLE `categorie`
MODIFY `num_categorie` int(4) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT pour la table `edition`
--
ALTER TABLE `edition`
MODIFY `num_editeur` int(4) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT pour la table `livre`
--
ALTER TABLE `livre`
MODIFY `num_livre` int(4) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT pour la table `utilisateur`
--
ALTER TABLE `utilisateur`
MODIFY `num_utilisateur` int(4) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
--
-- Contraintes pour les tables exportées
--
--
-- Contraintes pour la table `appartenir`
--
ALTER TABLE `appartenir`
ADD CONSTRAINT `fk_appartenir_auteur` FOREIGN KEY (`num_auteur`) REFERENCES `auteur` (`num_auteur`),
ADD CONSTRAINT `fk_appartenir_livre` FOREIGN KEY (`num_livre`) REFERENCES `livre` (`num_livre`);
--
-- Contraintes pour la table `detenir`
--
ALTER TABLE `detenir`
ADD CONSTRAINT `fk_detenir_livre` FOREIGN KEY (`num_livre`) REFERENCES `livre` (`num_livre`),
ADD CONSTRAINT `fk_detenir_utilisateur` FOREIGN KEY (`num_utilisateur`) REFERENCES `utilisateur` (`num_utilisateur`);
--
-- Contraintes pour la table `livre`
--
ALTER TABLE `livre`
ADD CONSTRAINT `fk_livre_collection` FOREIGN KEY (`num_collection`) REFERENCES `collection` (`num_collection`),
ADD CONSTRAINT `fk_livre_categorie` FOREIGN KEY (`num_categorie`) REFERENCES `categorie` (`num_categorie`),
ADD CONSTRAINT `fk_livre_edition` FOREIGN KEY (`num_editeur`) REFERENCES `edition` (`num_editeur`);
--
-- Contraintes pour la table `posseder`
--
ALTER TABLE `posseder`
ADD CONSTRAINT `fk_posseder_utilisateur` FOREIGN KEY (`num_utilisateur`) REFERENCES `utilisateur` (`num_utilisateur`),
ADD CONSTRAINT `fk_posseder_utilisateur1` FOREIGN KEY (`num_utilisateur_1`) REFERENCES `utilisateur` (`num_utilisateur`);
/*!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 */;
|
CREATE TABLE
LOGIN_INFO
(
ID VARCHAR(32) NOT NULL,
USERNAME VARCHAR(100),
LOGIN_NAME VARCHAR(32),
LOGIN_TIME TIMESTAMP,
PRIMARY KEY (ID)
) |
select name, price, imageurl
from
|
# --- !Ups
CREATE MATERIALIZED VIEW entry_index AS
SELECT entry.id,
chapter.organization_id,
(to_tsvector(entry.content) || to_tsvector(entry.title)) as document
FROM entry
JOIN section ON entry.section_id = section.id
JOIN chapter ON section.chapter_id = chapter.id
WHERE entry.deleted=false AND section.deleted=false AND chapter.deleted=false;
CREATE INDEX idx_entry_index ON entry_index USING gin(document);
# --- !Downs
DROP INDEX idx_entry_index;
DROP MATERIALIZED VIEW entry_index;
|
-- --------------------------------------------------------
-- Host: 127.0.0.1
-- Versión del servidor: 10.3.13-MariaDB - mariadb.org binary distribution
-- SO del servidor: Win64
-- HeidiSQL Versión: 9.5.0.5196
-- --------------------------------------------------------
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET NAMES utf8 */;
/*!50503 SET NAMES utf8mb4 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
-- Volcando estructura de base de datos para proyectobd3
CREATE DATABASE IF NOT EXISTS `proyectobd3` /*!40100 DEFAULT CHARACTER SET utf8 */;
USE `proyectobd3`;
-- Volcando estructura para tabla proyectobd3.cliente
CREATE TABLE IF NOT EXISTS `cliente` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`nombre` varchar(100) NOT NULL,
`apellido` varchar(100) NOT NULL,
`nit` varchar(30) NOT NULL,
`telefono` varchar(30) DEFAULT NULL,
`correo` varchar(100) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- La exportación de datos fue deseleccionada.
-- Volcando estructura para tabla proyectobd3.compra
CREATE TABLE IF NOT EXISTS `compra` (
`id` int(11) NOT NULL,
`fecha` date NOT NULL,
`total` float NOT NULL,
`no_factura` varchar(70) DEFAULT NULL,
`proveedor_id` int(11) NOT NULL,
PRIMARY KEY (`id`),
KEY `fk_compra_proveedor1_idx` (`proveedor_id`),
CONSTRAINT `fk_compra_proveedor1` FOREIGN KEY (`proveedor_id`) REFERENCES `proveedor` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- La exportación de datos fue deseleccionada.
-- Volcando estructura para tabla proyectobd3.credito
CREATE TABLE IF NOT EXISTS `credito` (
`id` int(11) NOT NULL,
`saldo` float NOT NULL,
`abono` float NOT NULL,
`cargo` float NOT NULL,
`fecha` date DEFAULT NULL,
`proveedor_id` int(11) NOT NULL,
PRIMARY KEY (`id`),
KEY `fk_credito_proveedor1_idx` (`proveedor_id`),
CONSTRAINT `fk_credito_proveedor1` FOREIGN KEY (`proveedor_id`) REFERENCES `proveedor` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- La exportación de datos fue deseleccionada.
-- Volcando estructura para tabla proyectobd3.credito_has_compra
CREATE TABLE IF NOT EXISTS `credito_has_compra` (
`credito_id` int(11) NOT NULL,
`compra_id` int(11) NOT NULL,
PRIMARY KEY (`credito_id`,`compra_id`),
KEY `fk_credito_has_compra_compra1_idx` (`compra_id`),
KEY `fk_credito_has_compra_credito1_idx` (`credito_id`),
CONSTRAINT `fk_credito_has_compra_compra1` FOREIGN KEY (`compra_id`) REFERENCES `compra` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT `fk_credito_has_compra_credito1` FOREIGN KEY (`credito_id`) REFERENCES `credito` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- La exportación de datos fue deseleccionada.
-- Volcando estructura para tabla proyectobd3.detalle_compra
CREATE TABLE IF NOT EXISTS `detalle_compra` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`precio` float NOT NULL,
`cantidad` int(11) NOT NULL,
`compra_id` int(11) NOT NULL,
`material_id` int(11) NOT NULL,
PRIMARY KEY (`id`),
KEY `fk_detalle_compra_compra1_idx` (`compra_id`),
KEY `fk_detalle_compra_material1_idx` (`material_id`),
CONSTRAINT `fk_detalle_compra_compra1` FOREIGN KEY (`compra_id`) REFERENCES `compra` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT `fk_detalle_compra_material1` FOREIGN KEY (`material_id`) REFERENCES `material` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- La exportación de datos fue deseleccionada.
-- Volcando estructura para tabla proyectobd3.detalle_pro
CREATE TABLE IF NOT EXISTS `detalle_pro` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`cantidad` int(11) NOT NULL,
`precio` float NOT NULL,
`factura_id` int(11) NOT NULL,
`producto_id` int(11) NOT NULL,
PRIMARY KEY (`id`),
KEY `fk_detalle_pro_factura1_idx` (`factura_id`),
KEY `fk_detalle_pro_producto1_idx` (`producto_id`),
CONSTRAINT `fk_detalle_pro_factura1` FOREIGN KEY (`factura_id`) REFERENCES `factura` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT `fk_detalle_pro_producto1` FOREIGN KEY (`producto_id`) REFERENCES `producto` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- La exportación de datos fue deseleccionada.
-- Volcando estructura para tabla proyectobd3.factura
CREATE TABLE IF NOT EXISTS `factura` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`fecha` date NOT NULL,
`total` float NOT NULL,
`nit` varchar(30) NOT NULL,
`cliente_id` int(11) NOT NULL,
PRIMARY KEY (`id`),
KEY `fk_factura_cliente1_idx` (`cliente_id`),
CONSTRAINT `fk_factura_cliente1` FOREIGN KEY (`cliente_id`) REFERENCES `cliente` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- La exportación de datos fue deseleccionada.
-- Volcando estructura para tabla proyectobd3.factura_has_pago
CREATE TABLE IF NOT EXISTS `factura_has_pago` (
`factura_id` int(11) NOT NULL,
`pago_id` int(11) NOT NULL,
PRIMARY KEY (`factura_id`,`pago_id`),
KEY `fk_factura_has_pago_pago1_idx` (`pago_id`),
KEY `fk_factura_has_pago_factura1_idx` (`factura_id`),
CONSTRAINT `fk_factura_has_pago_factura1` FOREIGN KEY (`factura_id`) REFERENCES `factura` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT `fk_factura_has_pago_pago1` FOREIGN KEY (`pago_id`) REFERENCES `pago` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- La exportación de datos fue deseleccionada.
-- Volcando estructura para tabla proyectobd3.material
CREATE TABLE IF NOT EXISTS `material` (
`id` int(11) NOT NULL,
`nombre` varchar(200) NOT NULL,
`alto` float DEFAULT NULL,
`ancho` float DEFAULT NULL,
`cantidad` int(11) NOT NULL,
`color` varchar(50) DEFAULT NULL,
`tipo` varchar(45) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- La exportación de datos fue deseleccionada.
-- Volcando estructura para tabla proyectobd3.pago
CREATE TABLE IF NOT EXISTS `pago` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`cargo` float NOT NULL,
`abono` float NOT NULL,
`cliente_id` int(11) NOT NULL,
PRIMARY KEY (`id`),
KEY `fk_pago_cliente_idx` (`cliente_id`),
CONSTRAINT `fk_pago_cliente` FOREIGN KEY (`cliente_id`) REFERENCES `cliente` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- La exportación de datos fue deseleccionada.
-- Volcando estructura para tabla proyectobd3.producto
CREATE TABLE IF NOT EXISTS `producto` (
`id` int(11) NOT NULL,
`descripcion` varchar(400) DEFAULT NULL,
`nombre` varchar(200) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- La exportación de datos fue deseleccionada.
-- Volcando estructura para tabla proyectobd3.producto_has_material
CREATE TABLE IF NOT EXISTS `producto_has_material` (
`producto_id` int(11) NOT NULL,
`material_id` int(11) NOT NULL,
`Cantidad` int(11) NOT NULL,
PRIMARY KEY (`producto_id`,`material_id`),
KEY `fk_producto_has_material_material1_idx` (`material_id`),
KEY `fk_producto_has_material_producto1_idx` (`producto_id`),
CONSTRAINT `fk_producto_has_material_material1` FOREIGN KEY (`material_id`) REFERENCES `material` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT `fk_producto_has_material_producto1` FOREIGN KEY (`producto_id`) REFERENCES `producto` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- La exportación de datos fue deseleccionada.
-- Volcando estructura para tabla proyectobd3.proveedor
CREATE TABLE IF NOT EXISTS `proveedor` (
`id` int(11) NOT NULL,
`nombre` varchar(150) NOT NULL,
`telefono` varchar(30) NOT NULL,
`nit` varchar(30) DEFAULT NULL,
`direccion` varchar(100) DEFAULT NULL,
`correo` varchar(100) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- La exportación de datos fue deseleccionada.
-- Volcando estructura para tabla proyectobd3.usuario
CREATE TABLE IF NOT EXISTS `usuario` (
`idUsuario` int(11) NOT NULL AUTO_INCREMENT,
`Nombre` varchar(45) NOT NULL,
`Passwar` varchar(45) NOT NULL,
`Accesibilidad` int(11) NOT NULL,
PRIMARY KEY (`idUsuario`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- La exportación de datos fue deseleccionada.
/*!40101 SET SQL_MODE=IFNULL(@OLD_SQL_MODE, '') */;
/*!40014 SET FOREIGN_KEY_CHECKS=IF(@OLD_FOREIGN_KEY_CHECKS IS NULL, 1, @OLD_FOREIGN_KEY_CHECKS) */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
|
SELECT piskunova_course.course_id,
piskunova_course.name
FROM piskunova_course
Inner Join piskunova_graduate ON piskunova_graduate.course_id = piskunova_course.course_id
Inner Join piskunova_graduate_time ON piskunova_graduate_time.graduate_id = piskunova_graduate.graduate_id
Inner Join piskunova_lesson_num ON piskunova_graduate_time.lesson_num_id = piskunova_lesson_num.lesson_num_id AND piskunova_lesson_num.time_lesson BETWEEN '12:30:00' AND '18:30:00'
|
USE hibnatebd;
INSERT INTO roles (role) VALUE ('admin');
INSERT INTO roles (role) VALUE ('moderator');
INSERT INTO roles (role) VALUE ('designer');
INSERT INTO roles (role) VALUE ('user'); |
library OpioidCDS_Common version '0.1.0'
using FHIR version '4.0.0'
include FHIRHelpers version '4.0.0' called FHIRHelpers
include OMTKLogic version '0.0.2' called OMTKLogic
codesystem "LOINC": 'http://loinc.org'
codesystem "SNOMED": 'http://snomed.info/sct'
codesystem "Medication Request Category Codes": 'http://terminology.hl7.org/CodeSystem/medicationrequest-category'
codesystem "Condition Clinical Status Codes": 'http://terminology.hl7.org/CodeSystem/condition-clinical'
// Expression-based
valueset "Opioids With Ambulatory Misuse Potential": 'http://fhir.org/guides/cdc/opioid-cds/ValueSet/opioid-with-ambulatory-misuse-potential'
valueset "Extended Release Opioid with Ambulatory Abuse Potential": 'http://fhir.org/guides/cdc/opioid-cds/ValueSet/extended-release-opioid-with-ambulatory-abuse-potential'
valueset "Buprenorphine and Methadone medications": 'http://fhir.org/guides/cdc/opioid-cds/ValueSet/buprenorphine-and-methadone-medications'
// Enumerated-compose
valueset "Limited Life Expectancy (findings)": 'http://fhir.org/guides/cdc/opioid-cds/ValueSet/limited-life-expectancy-conditions-enum'
valueset "Therapies Indicating End of Life Care": 'http://fhir.org/guides/cdc/opioid-cds/ValueSet/therapies-indicating-end-of-life-care-enum'
valueset "Conditions Likely Terminal for Opioid Prescribing": 'http://fhir.org/guides/cdc/opioid-cds/ValueSet/conditions-likely-terminal-for-opioid-prescribing-enum'
valueset "CDC Malignant Cancer Conditions": 'http://fhir.org/guides/cdc/opioid-cds/ValueSet/cdc-malignant-cancer-conditions-enum'
valueset "Oncology Specialty Designations (NUCC)": 'http://fhir.org/guides/cdc/opioid-cds/ValueSet/oncology-specialty-designations-enum'
valueset "Opioid Misuse Disorders": 'http://fhir.org/guides/cdc/opioid-cds/ValueSet/opioid-misuse-disorders-enum'
valueset "Substance Misuse Behavioral Counseling": 'http://fhir.org/guides/cdc/opioid-cds/ValueSet/substance-misuse-behavioral-counseling-enum'
// Harvested from VSAV - OID: 2.16.840.1.113883.3.464.1003.101.12.1001
valueset "All Ambulatory Encounters": 'http://fhir.org/guides/cdc/opioid-cds/ValueSet/all-ambulatory-encounters'
/* Existing sets for first six recs */
valueset "Benzodiazepines": 'http://fhir.org/guides/cdc/opioid-cds/ValueSet/benzodiazepines'
valueset "Illicit Drug Screening": 'http://fhir.org/guides/cdc/opioid-cds/ValueSet/illicit-drug-urine-screening'
valueset "Naloxone": 'http://fhir.org/guides/cdc/opioid-cds/ValueSet/naloxone'
valueset "Risk Assessment": 'http://fhir.org/guides/cdc/opioid-cds/ValueSet/opioid-abuse-assessment'
valueset "Opioid Drug Screening": 'http://fhir.org/guides/cdc/opioid-cds/ValueSet/opioid-urine-screening'
valueset "Substance Abuse": 'http://fhir.org/guides/cdc/opioid-cds/ValueSet/substance-abuse'
// Harvested from VSAC - OID: 2.16.840.1.113762.1.4.1108.15
valueset "Hospice Disposition": 'http://fhir.org/guides/cdc/opioid-cds/ValueSet/hospice-disposition'
valueset "Hospice Finding Codes": 'http://fhir.org/guides/cdc/opioid-cds/ValueSet/hospice-finding'
valueset "Hospice Procedure Codes": 'http://fhir.org/guides/cdc/opioid-cds/ValueSet/hospice-procedure'
// Recommendation #2
// See the latest notes in the Definitions table for Rec 2 - needs to be specific Direct Reference Codes:
// Creation: Opioid treatment plan: LOINC 80764-4 Pain medicine plan of care note
// Edit/Review: Treatment Plan Edited or Reviewed: SNOMED Chronic pain control management (procedure) 408957008
valueset "Pain Management Treatment Plan Review": 'http://todo.com/pain-management-treatment-plan-review'
/*
Opioid treatment plan exists (a record artifact) #2 80764-4 Pain medicine Plan of care note
Opioid treatment plan edited (a procedure) #2 Chronic pain control management (procedure) SCTID: 408957008
Opioid treatment plan reviewed (a procedure if to be an order, a finding if identifying it has occurred) #2 Chronic pain control management (procedure) SCTID: 408957008
Documented discussion of opioid harms and risks #3 Counseling about opioid safety (procedure) 460831000124102
Documented discussion of opioid harms and risks #3 Exclusion for rec #3 - Counseling about opioid safety not done (situation) SCTID: 460841000124107
Review PDMP data procedure #9 Review of prescription drug monitoring program record (procedure) SCTID: 461621000124108
PDMP data review done Situation (the finding/situation is documented) #9 Review of prescription drug monitoring program record done (situation) SCTID: 461651000124104
*/
code "Opioid treatment plan exists (a record artifact)": '80764-4' from "LOINC" //Pain medicine Plan of care note
code "Opioid treatment plan edited (a procedure)": '408957008' from "SNOMED" //Chronic pain control management (procedure) SCTID: 408957008
code "Opioid treatment plan reviewed (a procedure if to be an order, a finding if identifying it has occurred)": '408957008' from "SNOMED" //Chronic pain control management (procedure) SCTID: 408957008
code "Documented discussion of opioid harms and risks": '460831000124102' from "SNOMED" //Counseling about opioid safety (procedure)
code "Documented discussion of opioid harms and risks not done": '460841000124107' from "SNOMED" //Counseling about opioid safety not done (situation)
code "Review PDMP data procedure": '461621000124108' from "SNOMED" //Review of prescription drug monitoring program record (procedure)
code "PDMP data review done Situation (the finding/situation is documented)": '461651000124104' from "SNOMED" //Review of prescription drug monitoring program record done (situation)
code "Referral to Hospice": '306205009' from "SNOMED"
code "Outpatient": 'outpatient' from "Medication Request Category Codes"
code "Active Condition": 'active' from "Condition Clinical Status Codes"
// TODO: code "Nonpharmacologic therapy and nonopioid pharmocologic": 'TODO' from "TODO"
// TODO: Capture process decisions for long-term opioid use
define IsForChronicPain: true
define "Active Ambulatory Opioid Rx":
"Is Active Ambulatory Medication Request?"(
[MedicationRequest: "Opioids With Ambulatory Misuse Potential"]
)
define "Active Ambulatory Benzodiazepine Rx":
"Is Active Ambulatory Medication Request?"(
[MedicationRequest: "Benzodiazepines"]
)
define "Active Ambulatory Naloxone Rx":
"Is Active Ambulatory Medication Request?"(
[MedicationRequest: "Naloxone"]
)
define "Ambulatory Opioid Rx":
"Is Ambulatory Medication Request?"(
[MedicationRequest: "Opioids With Ambulatory Misuse Potential"]
)
define function "Is Active Ambulatory Medication Request?" (value List<MedicationRequest>) returns List<MedicationRequest>:
value Rx
where Rx.status.value = 'active'
and exists (
Rx.category RxCategory
where FHIRHelpers.ToConcept(RxCategory) ~ "Outpatient"
)
define function "Is Ambulatory Medication Request?" (value List<MedicationRequest>) returns List<MedicationRequest>:
value Rx
where exists (
Rx.category RxCategory
where FHIRHelpers.ToConcept(RxCategory) ~ "Outpatient"
)
define "End of Life Assessment":
// 1. Conditions indicating end of life or with limited life expectancy
exists (
"Conditions Indicating End of Life or With Limited Life Expectancy"
)
// 2. Admitted/referred/discharged to hospice care
or exists (
"Admitted/Referred/Discharged to Hospice Care"
)
// 3. Medications indicating end of life
/* or exists (
"Medications Indicating End of Life"
) */
define "Conditions Indicating End of Life or With Limited Life Expectancy":
(
[Condition: "Conditions Likely Terminal for Opioid Prescribing"] C
where exists (
C.clinicalStatus.coding Coding
where FHIRHelpers.ToCode(Coding) ~ "Active Condition"
)
)
union
(
[Condition: code in "Limited Life Expectancy (findings)"] C
where exists (
C.clinicalStatus.coding Coding
where FHIRHelpers.ToCode(Coding) ~ "Active Condition"
)
)
define "Admitted/Referred/Discharged to Hospice Care":
(
[Procedure: code in "Hospice Procedure Codes"] P
where P.status.value in { 'in-progress', 'completed' }
)
union
(
[ServiceRequest: code in "Hospice Procedure Codes"] E
where E.status.value in { 'planned', 'arrived', 'in-progress', 'finished', 'onleave' }
)
union
(
[Observation: code in "Hospice Finding Codes"] O
where not (O.status.value in { 'unknown', 'entered-in-error', 'cancelled' })
)
union
(
[Encounter] E
where
(
if E.hospitalization.dischargeDisposition.coding is null
or not exists (E.hospitalization.dischargeDisposition.coding)
then false
else E.hospitalization.dischargeDisposition in "Hospice Disposition"
)
and E.status.value in { 'planned', 'arrived', 'in-progress', 'finished', 'onleave' }
)
/* define "Medications Indicating End of Life":
(
[MedicationAdministration: "End Of Life Opioids"] MA
where MA.status.value in { 'in-progress', 'on-hold', 'completed' }
)
union
(
[MedicationDispense: "End Of Life Opioids"] MD
where MD.status.value in { 'preparation', 'in-progress', 'on-hold', 'completed' }
)
union
(
[MedicationRequest: "End Of Life Opioids"] MR
where MR.status.value in { 'active', 'completed' }
)
union
(
[MedicationStatement: "End Of Life Opioids"] MS
where MS.status.value in { 'active', 'completed', 'intended' }
) */
define function Prescriptions(Orders List<MedicationRequest>):
Orders O
let
// NOTE: Assuming medication is specified as a CodeableConcept with a single RxNorm code
rxNormCode: ToCode(O.medication.coding[0]),
medicationName: OMTKLogic.GetMedicationName(rxNormCode),
// NOTE: Assuming a single dosage instruction element
dosageInstruction: O.dosageInstruction[0],
// NOTE: Assuming a single dose and rate element
doseAndRate: dosageInstruction.doseAndRate[0],
repeat: dosageInstruction.timing.repeat,
frequency: Coalesce(repeat.frequencyMax.value, repeat.frequency.value),
period: System.Quantity { value: repeat.period.value, unit: repeat.periodUnit.value },
doseDescription:
Coalesce(
// There should be a conversion from FHIR.SimpleQuantity to System.Quantity
if doseAndRate.dose is FHIR.Range
then ToString(ToQuantity(doseAndRate.dose.low))
+ '-' + ToString(ToQuantity(doseAndRate.dose.high))
+ doseAndRate.dose.high.unit.value
else ToString(ToQuantity(doseAndRate.dose)),
''
),
frequencyDescription:
ToString(dosageInstruction.timing.repeat.frequency.value) +
Coalesce(
'-' + ToString(dosageInstruction.timing.repeat.frequencyMax.value),
''
)
return {
rxNormCode: rxNormCode,
isDraft: O.status.value = 'draft',
// NOTE: Assuming asNeeded is expressed as a boolean
isPRN: dosageInstruction.asNeeded.value,
prescription:
if dosageInstruction.text is not null then
medicationName + ' ' + dosageInstruction.text.value
else
// TODO: Shouldn't need the .value here on asNeededBoolean
medicationName + ' ' + doseDescription + ' q' + frequencyDescription + (if dosageInstruction.asNeeded.value then ' PRN' else ''),
// TODO: Shouldn't need the ToQuantity here...
dose: if doseAndRate.dose is FHIR.Range
then ToQuantity(doseAndRate.dose.high)
else ToQuantity(doseAndRate.dose),
dosesPerDay: Coalesce(OMTKLogic.ToDaily(frequency, period), 1.0)
}
define function MME(prescriptions List<MedicationRequest>):
(Prescriptions(prescriptions)) P
let mme: SingletonFrom(OMTKLogic.CalculateMMEs({ { rxNormCode: P.rxNormCode, doseQuantity: P.dose, dosesPerDay: P.dosesPerDay } }))
return {
rxNormCode: P.rxNormCode,
isDraft: P.isDraft,
isPRN: P.isPRN,
prescription: P.prescription,
dailyDose: mme.dailyDoseDescription,
conversionFactor: mme.conversionFactor,
mme: mme.mme
}
define function TotalMME(prescriptions List<MedicationRequest>):
System.Quantity {
value: Sum((MME(prescriptions)) M return M.mme.value),
unit: 'mg/d'
}
define function ProbableDaysInRange(Orders List<MedicationRequest>, daysPast Integer, numDaysInDaysPast Integer):
Orders orders
let
frequency: orders.dosageInstruction[0].timing.repeat.frequency.value,
period: orders.dosageInstruction[0].timing.repeat.period.value,
periodDays: GetPeriodDays(orders.dosageInstruction[0].timing.repeat.periodUnit.value),
dosesPerDay:
if (frequency / (period * periodDays)) >= 1.0
then 1.0
else frequency / (period * periodDays),
repeat: orders.dispenseRequest.numberOfRepeatsAllowed.value,
supplyDuration: GetDurationInDays(orders.dispenseRequest.expectedSupplyDuration),
validityPeriod: days between orders.dispenseRequest.validityPeriod."start".value and Today(),
endDifference:
if orders.dispenseRequest.validityPeriod."end".value < Today()
then days between orders.dispenseRequest.validityPeriod."end".value and Today()
else 0
return
if (repeat * supplyDuration) < numDaysInDaysPast then false
else
(dosesPerDay * ((repeat * supplyDuration) / validityPeriod) * (daysPast - endDifference)) >= numDaysInDaysPast
define function GetPeriodDays(value System.String): // returns Decimal:
case
when value = 'a' then 365.0
when value = 'mo' then 30.0
when value = 'h' then 1.0/24.0
when value = 'min' then 1.0/24.0*60.0
when value = 's' then 1.0/24.0*60.0*60.0
when value = 'ms' then 1.0/24.0*60.0*60.0*1000.0
else 1.0
end
define function GetDurationInDays(value FHIR.Duration): // returns Decimal:
case
when StartsWith(value.unit.value, 'a') then value.value.value * 365.0
when StartsWith(value.unit.value, 'mo') then value.value.value * 30.0
when StartsWith(value.unit.value, 'wk') then value.value.value * 7.0
when StartsWith(value.unit.value, 'd') then value.value.value
when StartsWith(value.unit.value, 'h') then value.value.value / 24.0
when StartsWith(value.unit.value, 'min') then value.value.value / 60.0 / 24.0
when StartsWith(value.unit.value, 's') then value.value.value / 60.0 / 60.0 / 24.0
when StartsWith(value.unit.value, 'ms') then value.value.value / 60.0 / 60.0 / 24.0 / 1000.0
else Message(1000, true, 'Undefined', 'Error', 'Unsupported duration unit')
end
define function GetIngredient(rxNormCode Code):
OMTKLogic.GetIngredients(rxNormCode).ingredientName
define function GetIngredients(rxNormCodes List<Code>):
rxNormCodes rnc return GetIngredient(rnc)
define function GetMedicationNames(medications List<MedicationRequest>):
medications M
return OMTKLogic.GetIngredients(ToRxNormCode(M.medication.coding)).rxNormCode.display
/*
* Conversion Functions
*/
define function CodeableConceptsToString(concepts List<FHIR.CodeableConcept>):
concepts c return CodeableConceptToString(c)
define function CodingToString(coding FHIR.Coding):
if (coding is null)
then null
else
'Code {' &
'code: ' & coding.code &
'system: ' & coding.system &
'version: ' & coding.version &
'display: ' & coding.display &
'}'
define function CodeableConceptToString(concept FHIR.CodeableConcept):
if (concept is null or concept.coding is null)
then null
else
'CodeableConcept {' &
'Coding: [' &
Combine(concept.coding Coding return CodingToString(Coding), ',')
& ']'
& '}'
define function ToCode(coding FHIR.Coding):
System.Code {
code: coding.code.value,
system: coding.system.value,
version: coding.version.value,
display: coding.display.value
}
define function ToCodes(coding List<FHIR.Coding>):
coding c return ToCode(c)
define function ToRxNormCode(coding List<FHIR.Coding>):
singleton from (
coding C where C.system = 'http://www.nlm.nih.gov/research/umls/rxnorm'
)
define function ToQuantity(quantity FHIR.Quantity):
System.Quantity { value: quantity.value.value, unit: quantity.unit.value }
|
create index valinnantilat_henkilo_idx on valinnantilat(henkilo_oid);
|
-- 上传文件表
CREATE TABLE ${SCHEMA}.upload_file (
uuid varchar(32) NOT NULL,
tenant_id bigint not null default 0,
app_module varchar(50),
rel_obj_type varchar(50),
rel_obj_id varchar(32),
rel_obj_field varchar(50),
file_name varchar(100) NOT NULL,
storage_path varchar(200) NOT NULL,
access_url varchar(200) NULL,
file_type varchar(20),
data_count int not null DEFAULT 0,
description varchar(100),
is_deleted tinyint not null DEFAULT 0,
create_by bigint default 0,
create_time datetime not null default CURRENT_TIMESTAMP,
constraint PK_upload_file primary key (uuid)
);
-- 添加备注,
execute sp_addextendedproperty 'MS_Description', N'UUID', 'SCHEMA', '${SCHEMA}', 'table', upload_file, 'column', 'uuid';
execute sp_addextendedproperty 'MS_Description', N'租户ID','SCHEMA', '${SCHEMA}', 'table', upload_file, 'column', 'tenant_id';
execute sp_addextendedproperty 'MS_Description', N'应用模块','SCHEMA', '${SCHEMA}', 'table', upload_file, 'column', 'app_module';
execute sp_addextendedproperty 'MS_Description', N'关联对象类', 'SCHEMA', '${SCHEMA}', 'table', upload_file, 'column', 'rel_obj_type';
execute sp_addextendedproperty 'MS_Description', N'关联对象ID', 'SCHEMA', '${SCHEMA}', 'table', upload_file, 'column', 'rel_obj_id';
execute sp_addextendedproperty 'MS_Description', N'关联对象属性名称', 'SCHEMA', '${SCHEMA}', 'table', upload_file, 'column', 'rel_obj_field';
execute sp_addextendedproperty 'MS_Description', N'文件名', 'SCHEMA', '${SCHEMA}', 'table', upload_file, 'column', 'file_name';
execute sp_addextendedproperty 'MS_Description', N'存储路径', 'SCHEMA', '${SCHEMA}', 'table', upload_file, 'column', 'storage_path';
execute sp_addextendedproperty 'MS_Description', N'访问地址', 'SCHEMA', '${SCHEMA}', 'table', upload_file, 'column', 'access_url';
execute sp_addextendedproperty 'MS_Description', N'文件类型', 'SCHEMA', '${SCHEMA}', 'table', upload_file, 'column', 'file_type';
execute sp_addextendedproperty 'MS_Description', N'数据量', 'SCHEMA', '${SCHEMA}', 'table', upload_file, 'column', 'data_count';
execute sp_addextendedproperty 'MS_Description', N'备注', 'SCHEMA', '${SCHEMA}', 'table', upload_file, 'column', 'description';
execute sp_addextendedproperty 'MS_Description', N'删除标记', 'SCHEMA', '${SCHEMA}', 'table', upload_file, 'column', 'is_deleted';
execute sp_addextendedproperty 'MS_Description', N'创建人', 'SCHEMA', '${SCHEMA}', 'table', upload_file, 'column', 'create_by';
execute sp_addextendedproperty 'MS_Description', N'创建时间', 'SCHEMA', '${SCHEMA}', 'table', upload_file, 'column', 'create_time';
execute sp_addextendedproperty 'MS_Description', N'上传文件', 'SCHEMA', '${SCHEMA}', 'table', upload_file, null, null;
-- 索引
create nonclustered index idx_upload_file on upload_file(rel_obj_type, rel_obj_id, rel_obj_field);
create nonclustered index idx_upload_file_tenant on upload_file(tenant_id);
|
-- Ceci est un commentaire sur une ligne
-- Pour créer une base de données, par convention les mots-clés sont écrits en majuscules
CREATE DATABASE wf3_entreprise;
-- Pour voir toutes les BDD sur le serveur, le S de DATABASES est obligatoire
SHOW DATABASES;
-- Pour utiliser une DB
USE nom_de_la_bdd
USE wf3_entreprise;
-- Pour effacer une DB
DROP DATABASE nom_de_la_bdd;
-- Pour effacer une table
DROP TABLE nom_de_la_table;
-- Pour vider une table sans l'effacer
TRUNCATE nom_de_la_table;
-- Pour afficher une table, au pluriel également
SHOW TABLES;
-- Pour observer la structure d'une table
DESC nom_de_la_table;
--# REQUETES SELECTION (les plus nombreuses, question que l'on pose)
-- Récupération des données de la table employes
SELECT id_employes, nom, prenom, sexe, service, date_embauche, salaire FROM employes;
-- Il est possible d'afficher tout le contenu d'une liste avec le caractère universel *, tout est sorti dans l'ordre de la table
SELECT * FROM employes;
-- Uniquement les prénoms et les noms
SELECT prenom, nom FROM employes;
-- Afficher tous les services
SELECT service FROM employes;
-- Idem mais sans répétition
SELECT DISTINCT service FROM employes;
-- affichage des ifos des employes du service informatique, informatique ici est une valeur et doit être "", à l'inverse des champs: nom, service, qui s'écrivent sans ""
SELECT nom, prenom, service FROM employes WHERE service = "informatique";
-- BETWEEN
-- Afficher les employes ayant été recrutés entre 2010 et aujourd'hui
-- WHERE signifie à condition, BETWEEN est toujours suivi de AND, ENTRE ceci ET celà
SELECT * FROM employes WHERE date_embauche BETWEEN '2010-01-01' AND '2017-06-14';
-- La date du jour, toujours sous format américian sous MySQL
SELECT CURDATE();
-- LIKE
-- affichage des employes avec un prenom dont la première lettre commence par s, le % permet de limiter la recherche au s et uniquement le "s"
SELECT prenom FROM employes WHERE prenom LIKE 's%';
-- prenom finissant par "ie"
SELECT prenom FROM employes WHERE prenom LIKE '%ie';
-- prenom contenant un trait d'union, dans ce cas-là, les caractères entre les % peut se trouver n'importe où dans le prenom
SELECT prenom FROM employes WHERE prenom LIKE '%-%';
-- La liste des employes avec un salaire supérieur à 3000, ne pas mettre le nombre entre '' car MySQL réinterprète la valeur et perd de la performance
SELECT nom, prenom, service, salaire FROM employes WHERE salaire > 3000;
-- Opérateurs de comparaison > ... < ... = ... != ... >= ... <=
-- Pour récupérer les infos avec un ordre, ASC ascendant en anglais, est par défaut
SELECT prenom FROM employes ORDER BY prenom ASC;
SELECT prenom FROM employes ORDER BY prenom;
-- L'inverse, DESC pour descendant, à ne pas confondre avec DESC description
SELECT prenom FROM employes ORDER BY prenom DESC;
SELECT prenom, salaire FROM employes ORDER BY salaire DESC;
-- pour un deuxième classement
SELECT prenom, salaire FROM employes ORDER BY salaire ASC, prenom ASC;
-- ASC par défaut
SELECT prenom, salaire FROM employes ORDER BY salaire, prenom;
-- LIMIT
-- Affichage des employés 3 par 3 (pagination)
SELECT prenom, nom FROM employes ORDER BY prenom ASC LIMIT 0, 3;
SELECT prenom, nom FROM employes LIMIT 3, 3;
SELECT prenom, nom FROM employes LIMIT 6, 3;
-- Avec LIMIT, la 1ère valeur est la position de départ et la 2ème représente le nombre de lignes à renvoyer
-- Le salaire annuel des employes
SELECT prenom, salaire * 12 FROM employes;
-- On réécrit le nom du champ avec AS 'nom du champ', '' car il y ades espaces
--AS -> Alias
SELECT prenom, salaire * 12 AS 'salaire annuel' FROM employes;
-- SUM(), c'est une valeur unique, on ne sélectionne rien d'autre
SELECT SUM(salaire*12) AS 'Masse Salariale' FROM employes;
-- AVG() jamais d'espace avant () sinon MySQL n'interprète pas
SELECT AVG(salaire) AS 'Salaire Moyen' FROM employes;
-- arrondi avec ROUND() On place une fonction AVG() dans la fonction ROUND()
SELECT ROUND(AVG(salaire)) AS 'Salaire Moyen' FROM employes;
-- Pour arrondir au centième, on place une valeur après la première dans la fonction ROUND(), séparée par une ","
SELECT ROUND(AVG(salaire), 2) AS 'Salaire Moyen' FROM employes;
-- COUNT() va compter le nombre de lignes
-- Affichage du nombre de femmes dans la table employes, on place le '*' dans COUNT() pour qu'il passe en revue toutes les rangées. IL FAUT PRIVILEGIER LE *
SELECT COUNT(*) AS 'Nombre de femmes' FROM employes WHERE sexe='f';
-- MIN()
SELECT MIN(salaire) FROM employes;
-- MAX
SELECT MAX(salaire) FROM employes;
SELECT nom, prenom, salaire FROM employes ORDER BY salaire LIMIT 0, 1;
-- Afficher le nom, prenom de l'employé ayant le salaire le plus petit
-- /!\ la requête est fausse
SELECT nom, prenom, MIN(salaire) FROM employes;
-- En effet, le MIN() bloque la requête car elle ne peut renvoyer qu'une seule ligne Du coup on récupère le premier nom, prenom de la table et le salaire minimum qui ne correspond pas forcément au premier nom, prenom
-- Dans ce cas précis où l'on ne cherche qu'une valeur, nous pouvons utiliser ORDER BY avec LIMIT
SELECT nom, prenom, salaire FROM employes ORDER BY salaire ASC LIMIT 0, 1;
--+--------+--------+---------+
--| nom | prenom | salaire |
--+--------+--------+---------+
--| Cottet | Julien | 1390 |
--+--------+--------+---------+
-- Autre solution avec une requête imbriquée, à condition que WHERE salaire = (2eme requete)
SELECT nom, prenom, salaire FROM employes WHERE salaire = (SELECT MIN(salaire) FROM employes); -- le "=" ne renvoie qu'une seule valeur
-- IN renvoie plusieurs valeurs -- inclusion
-- /!\ requête fausse
SELECT nom, prenom, service FROM employes WHERE service = 'informatique', "comptabilité";
SELECT nom, prenom, service FROM employes WHERE service IN ('informatique', "comptabilité");
-- IN permet de faire une comparaison sur plusieurs valeurs
-- avec = comparaison sur une seule valeur
-- NOT IN -- exclusion
SELECT nom, prenom, service FROM employes WHERE service NOT IN ('informatique', 'comptabilité');
-- NOT IN : plusieurs valeurs
-- != : une seule valeur
SELECT nom, prenom, service FROM employes WHERE service NOT IN ('informatique', 'comptabilité') ORDER BY service;
-- REQUETE avec plusieurs conditions, on place AND après WHERE, on peut en rajouter à loisir
SELECT * FROM employes WHERE service = 'commercial' AND salaire <= 2000;
-- /!\ requête fausse, il faut mettre des parenthèses, le OR crée une incohérence. La dernière condition ne se retrouve pas lié au service "production"
SELECT * FROM employes WHERE service = "production" AND salaire = 1900 OR salaire = 2300;
-- Les employes du service production ayant un salaire de 1900 ou 2300
SELECT * FROM employes WHERE service = "production" AND (salaire = 1900 OR salaire = 2300);
-- GROUP BY
-- le nombre d'employés par service
SELECT service, COUNT(*) FROM employes GROUP BY service;
-- Pour mettre une ou des conditions avec un group by
-- HAVING
-- Le nompbre d'employés (de lignes avec COUNT()) par service
-- Même requête qu'au dessus avec une condition si la valeur du COUNT(*) est supérieur à 2
SELECT service, COUNT(*) FROM employes GROUP BY service HAVING COUNT(*) > 2;
-- Le nombre d'employés femme par service
SELECT service, COUNT(*) FROM employes WHERE sexe = "f" GROUP BY service;
-- GROUP BY permet de regrouper des informations
-- HAVING permet de mettre une condition sur le GROUP BY
--# REQUETE INSERTION (enregistrement)
INSERT INTO employes (id_employes, prenom, nom, sexe, service, date_embauche, salaire) VALUES (NULL, 'Jordan', 'Muller', 'm', 'informatique', '2017-06-14', 2500);
-- Si nous donnons tous les champs dans le même ordre que la table, il n'est pas nécessaire de préciser ces champs
INSERT INTO employes VALUES (NULL, 'Jordan', 'Muller', 'm', 'informatique', '2017-06-14', 2500);
SELECT * FROM employes;
-- Si l'on fait une insertion sans remplir tous les champs, nous sommes obligés de précviser ces champs
INSERT INTO employes (id_employes, prenom, nom, sexe, service, date_embauche, salaire) VALUES ('Jordan', 'Muller', 'm', 'informatique', '2017-06-14', 2500); -- On a supprimé la valeur de l'id_employes
--# REQUETE UPDATE (modification)
UPDATE employes SET salaire = 1391 WHERE id_employes = 699; -- On conditionne avec l'id (la clé primaire) car il est unique, il faut toujours que le champ soit unique.
-- Pour une modification d'une entrée précise, il faut privilégier la condition sur la clé primaire de la table (ici id_employes)
UPDATE employes SET salaire = 1391, service = 'informatique' WHERE id_employes = 699;
--# REQUETE DELETE (suppression)
SELECT * FROM employes;
DELETE FROM employes WHERE id_employes = 992;
SELECT * FROM employes;
DELETE FROM employes WHERE id_employes = 992 AND service = "informatique";
DELETE FROM employes; -- equivalent à un TRUNCATE employes, on supprime les données mais on garde la structure;
DROP TABLE employes; -- on efface les données et la structure
-- Affiche la date actuelle
SELECT CURDATE();
-- Affiche la date et l'heure actuelles
SELECT NOW();
|
--修改日期:20130131
--修改人:蔡瑾钊
--需求编号:VP7622 付款查询批量打印和统计打印次数
ALTER TABLE nis_billhead ADD PRINTS NUMBER DEFAULT 0; |
INSERT INTO tb_doctor (name,phone,address) VALUES('Jhon Smith','89333764','Transv 34 N 12-34');
INSERT INTO tb_doctor (name,phone,address) VALUES('Cristina Adams','89536864','Diag 34 N 12-34');
SELECT * FROM tb_doctor WHERE name='Jhon Smith';
INSERT INTO tb_hospital (name,phone,address, patient_type, id_doctor) VALUES('Hospital Veterinario','567463154','San Juan 13-45', 1, 2);
ALTER TABLE `tb_pet` CHANGE `healthStatus` `healthStatus` VARCHAR(30) NOT NULL;
INSERT INTO tb_pet (code, name,born_year,color, healthStatus) VALUES
('001','Firulais',2004,'amarillo', 'Saludable'),
('002','Menino',2010,'Blanco', 'Enfermo'),
('003','Motas',2015,'Gris', 'Saludable')
;
INSERT INTO tb_dog (breed, pedigree, id_pet) VALUES
('Criollo',0,1),
('Pincher',1,3)
;
INSERT INTO tb_cat (breed, id_pet) VALUES
('Criollo',2);
UPDATE tb_doctor SET phone='3054650245', address='Cra 24 N12-78' WHERE id=2;
DELETE FROM tb_doctor where id=1;
SELECT * from tb_pet p
INNER JOIN tb_dog d
ON p.id = d.id=id_pet
;
SELECT p.code, p.name, p.born_year, p.color, p.healthStatus, d.breed, d.pedigree from tb_pet p
INNER JOIN tb_dog d
ON p.id = d.id=id_pet
;
SELECT p.code, p.name, p.born_year, p.color, p.healthStatus, d.breed, d.pedigree from tb_pet p
RIGHT JOIN tb_dog d
ON p.id = d.id=id_pet
; |
--------------------------------------------------------
-- DDL for Table TEC_CE_CDC_TPS_IBHW
--------------------------------------------------------
CREATE TABLE TEC_CE_CDC_TPS_IBHW
( FECHA DATE,
PAIS CHAR(3 CHAR),
MAX_TPS NUMBER,
MAX_CAP_HW NUMBER,
MAX_CAP_SW NUMBER,
UTIL_HW NUMBER(10,2),
UTIL_SW NUMBER(10,2)
)
NOCOMPRESS LOGGING
TABLESPACE TBS_SUMMARY ;
--------------------------------------------------------
-- DDL for Index TEC_CE_CDC_TPS_IBHW_PK
--------------------------------------------------------
CREATE UNIQUE INDEX TEC_CE_CDC_TPS_IBHW_PK ON TEC_CE_CDC_TPS_IBHW (PAIS, FECHA)
TABLESPACE TBS_SUMMARY ;
--------------------------------------------------------
-- Constraints for Table TEC_CE_CDC_TPS_IBHW
--------------------------------------------------------
ALTER TABLE TEC_CE_CDC_TPS_IBHW ADD CONSTRAINT TEC_CE_CDC_TPS_IBHW_PK PRIMARY KEY (PAIS, FECHA) ENABLE;
ALTER TABLE TEC_CE_CDC_TPS_IBHW MODIFY (UTIL_SW NOT NULL ENABLE);
ALTER TABLE TEC_CE_CDC_TPS_IBHW MODIFY (UTIL_HW NOT NULL ENABLE);
ALTER TABLE TEC_CE_CDC_TPS_IBHW MODIFY (MAX_CAP_SW NOT NULL ENABLE);
ALTER TABLE TEC_CE_CDC_TPS_IBHW MODIFY (MAX_CAP_HW NOT NULL ENABLE);
ALTER TABLE TEC_CE_CDC_TPS_IBHW MODIFY (MAX_TPS NOT NULL ENABLE);
ALTER TABLE TEC_CE_CDC_TPS_IBHW MODIFY (PAIS NOT NULL ENABLE);
ALTER TABLE TEC_CE_CDC_TPS_IBHW MODIFY (FECHA NOT NULL ENABLE);
|
CREATE DATABASE BASEPRUEBA;
USE BASEPRUEBA;
CREATE TABLE ENTIDADES (
ID_ENTIDAD VARCHAR (10) PRIMARY KEY NOT NULL,
NOM_ENTIDAD VARCHAR (100) NOT NULL,
DIRECCION VARCHAR (100)
);
CREATE TABLE EMPLEADOS (
ID_EMPLEADO VARCHAR (10) PRIMARY KEY NOT NULL,
NOM_EMPLEADO VARCHAR (100) NOT NULL,
DIRECCION VARCHAR (100),
ID_ENTIDAD VARCHAR (10) NOT NULL FOREIGN KEY REFERENCES ENTIDADES(ID_ENTIDAD),
);
INSERT INTO ENTIDADES VALUES ('12345','ENTIDAD PRUEBA','CALLE 123')
INSERT INTO ENTIDADES VALUES ('67890','ENTIDAD PRUEBA 2','CALLE 456')
INSERT INTO EMPLEADOS VALUES ('1065618027','JORGE VALEGA','CALLE 123','12345');
INSERT INTO EMPLEADOS VALUES ('1065632003','PEDRO PEREZ','CALLE 456','67890');
INSERT INTO EMPLEADOS VALUES ('1000123456','MARIA CAMPO','CALLE 789','12345');
|
/*==============================================================*/
/* DBMS name: MySQL 5.0 */
/* Created on: 2016/12/9 10:58:31 */
/*==============================================================*/
/*==============================================================*/
/* Table: communityrepair */
/*==============================================================*/
create table communityrepair
(
id bigint(20),
communityInformationid bigint(20) not null,
serialnumber varchar(20),
entrymode tinyint not null,
entrytime datetime not null,
customercategories tinyint not null,
contentinfo varchar(150) not null,
roomid bigint,
contact varchar(10),
contactnumber varchar(20),
timeofappointment datetime,
twotimesmaintenance tinyint not null,
maintenancecategory tinyint,
remark varchar(150),
state tinyint default 1,
singlestate tinyint not null
)
engine=innodb charset=utf8
PARTITION BY RANGE (id)
(
PARTITION b0 VALUES LESS THAN (1000000),
PARTITION b1 VALUES LESS THAN (2000000),
PARTITION b2 VALUES LESS THAN (3000000),
PARTITION b3 VALUES LESS THAN (4000000),
PARTITION b4 VALUES LESS THAN (5000000),
PARTITION b5 VALUES LESS THAN (6000000),
PARTITION b6 VALUES LESS THAN (7000000),
PARTITION b7 VALUES LESS THAN (8000000),
PARTITION b8 VALUES LESS THAN (9000000),
PARTITION b9 VALUES LESS THAN (10000000),
PARTITION b10 VALUES LESS THAN (20000000),
PARTITION b99 VALUES LESS THAN MAXVALUE
);
/*==============================================================*/
/* Table: pm_addressbook */
/*==============================================================*/
create table pm_addressbook
(
pc_addressbook_id bigint(20) not null auto_increment,
propertycompanyid bigint(20) not null,
communityInformationid bigint(20) not null,
username varchar(6) not null,
Gender varchar(2),
mobilephone varchar(20),
telephone varchar(20),
qq varchar(11),
address varchar(50),
idcard_number varchar(18),
remark varchar(200),
administrativeOffice_id bigint(20),
customcategories_id bigint(10),
position varchar(20),
nation varchar(20),
birthday datetime,
email varchar(30),
workunit varchar(50),
create_time datetime not null,
createuserid bigint(20) not null,
createusername varchar(20) not null,
primary key (pc_addressbook_id)
)
engine=innodb charset=utf8
PARTITION BY RANGE (pc_addressbook_id)
(
PARTITION b0 VALUES LESS THAN (1000000),
PARTITION b1 VALUES LESS THAN (2000000),
PARTITION b2 VALUES LESS THAN (3000000),
PARTITION b3 VALUES LESS THAN (4000000),
PARTITION b4 VALUES LESS THAN (5000000),
PARTITION b5 VALUES LESS THAN (6000000),
PARTITION b6 VALUES LESS THAN (7000000),
PARTITION b7 VALUES LESS THAN (8000000),
PARTITION b8 VALUES LESS THAN (9000000),
PARTITION b9 VALUES LESS THAN (10000000),
PARTITION b10 VALUES LESS THAN (20000000),
PARTITION b99 VALUES LESS THAN MAXVALUE
);
/*==============================================================*/
/* Table: pm_base_button */
/*==============================================================*/
create table pm_base_button
(
button_id int not null auto_increment,
button_name varchar(20) not null,
button_img varchar(50) not null,
button_code varchar(100) not null,
SortCode bigint(10) not null,
button_type varchar(50) not null,
button_remak varchar(150),
deletemark bigint(2) default 1,
menu_state bigint(2) default 1,
create_time datetime,
createuserid bigint(20) not null,
createusername varchar(20) not null,
modifydate datetime not null,
modifyuserid bigint(20) not null,
modifyusername varchar(20) not null,
primary key (button_id)
)
engine=innodb charset=utf8
PARTITION BY RANGE (button_id)
(
PARTITION b0 VALUES LESS THAN (1000000),
PARTITION b1 VALUES LESS THAN (2000000),
PARTITION b2 VALUES LESS THAN (3000000),
PARTITION b3 VALUES LESS THAN (4000000),
PARTITION b4 VALUES LESS THAN (5000000),
PARTITION b5 VALUES LESS THAN (6000000),
PARTITION b6 VALUES LESS THAN (7000000),
PARTITION b7 VALUES LESS THAN (8000000),
PARTITION b8 VALUES LESS THAN (9000000),
PARTITION b9 VALUES LESS THAN (10000000),
PARTITION b10 VALUES LESS THAN (20000000),
PARTITION b99 VALUES LESS THAN MAXVALUE
);
/*==============================================================*/
/* Table: pm_base_userright */
/*==============================================================*/
create table pm_base_userright
(
userright_id bigint(20) not null auto_increment,
user_id bigint(20) not null,
menu_id bigint(20) not null,
propertycompanyid bigint(20) not null,
companyid bigint(20) not null,
departmentid bigint(20) not null,
create_time datetime,
createuserid bigint(20) not null,
createusername varchar(20) not null,
primary key (userright_id)
)
engine=innodb charset=utf8
PARTITION BY RANGE (userright_id)
(
PARTITION b0 VALUES LESS THAN (1000000),
PARTITION b1 VALUES LESS THAN (2000000),
PARTITION b2 VALUES LESS THAN (3000000),
PARTITION b3 VALUES LESS THAN (4000000),
PARTITION b4 VALUES LESS THAN (5000000),
PARTITION b5 VALUES LESS THAN (6000000),
PARTITION b6 VALUES LESS THAN (7000000),
PARTITION b7 VALUES LESS THAN (8000000),
PARTITION b8 VALUES LESS THAN (9000000),
PARTITION b9 VALUES LESS THAN (10000000),
PARTITION b10 VALUES LESS THAN (20000000),
PARTITION b99 VALUES LESS THAN MAXVALUE
);
/*==============================================================*/
/* Table: pm_breakdown_cost */
/*==============================================================*/
create table pm_breakdown_cost
(
cost_id bigint(20) not null auto_increment,
breakdown_id bigint(20) not null,
cost_material bigint(20) not null,
cost_material_num bigint(5) not null,
cost_material_unit varchar(5) not null,
unit_price decimal(16,4) not null,
stock_money decimal(16,4) not null,
prime_cost decimal(16,4) not null,
summation decimal(16,4) not null,
cost_detail varchar(100),
create_time datetime not null,
primary key (cost_id)
);
/*==============================================================*/
/* Table: pm_breakdown_operation */
/*==============================================================*/
create table pm_breakdown_operation
(
operation_id bigint(20) not null auto_increment,
breakdown_id bigint(20) not null,
user_id bigint(20) not null,
user_id_type varchar(1) not null,
operation_result varchar(2) not null,
operation_text varchar(100),
operation_time varchar(20),
operation_days bigint(10) not null,
customersatisfaction tinyint,
operationmission_text varchar(200) not null,
begin_time datetime not null,
end_time datetime not null,
primary key (operation_id)
);
/*==============================================================*/
/* Table: pm_breakdown_work */
/*==============================================================*/
create table pm_breakdown_work
(
worker_id bigint(20) not null auto_increment,
breakdown_id bigint(20),
user_id bigint(20),
work_type varchar(1) not null,
create_time date,
primary key (worker_id)
);
/*==============================================================*/
/* Table: pm_building */
/*==============================================================*/
create table pm_building
(
id bigint(20) not null auto_increment,
communityInformationid bigint(20) not null,
buildingcode varchar(20) not null,
buildingname varchar(20) not null,
buildingaddress varchar(50),
buildingtype bigint(10) not null,
buildingstructure bigint(10) not null,
buildingorientation varchar(20),
remark varchar(100),
primary key (id)
)
engine=innodb charset=utf8
PARTITION BY RANGE (id)
(
PARTITION b0 VALUES LESS THAN (1000000),
PARTITION b1 VALUES LESS THAN (2000000),
PARTITION b2 VALUES LESS THAN (3000000),
PARTITION b3 VALUES LESS THAN (4000000),
PARTITION b4 VALUES LESS THAN (5000000),
PARTITION b5 VALUES LESS THAN (6000000),
PARTITION b6 VALUES LESS THAN (7000000),
PARTITION b7 VALUES LESS THAN (8000000),
PARTITION b8 VALUES LESS THAN (9000000),
PARTITION b9 VALUES LESS THAN (10000000),
PARTITION b10 VALUES LESS THAN (20000000),
PARTITION b99 VALUES LESS THAN MAXVALUE
);
/*==============================================================*/
/* Table: pm_city_code */
/*==============================================================*/
create table pm_city_code
(
code_id varchar(10) not null,
code_id_up varchar(10) not null,
code_name varchar(30) not null,
code_level varchar(1) not null,
create_time datetime,
createuserid bigint(20) not null,
createusername varchar(20) not null,
primary key (code_id)
);
/*==============================================================*/
/* Table: pm_communityInformation */
/*==============================================================*/
create table pm_communityInformation
(
id bigint(20) not null auto_increment,
propertycompanyid bigint(20) not null,
number varchar(20) not null,
communityname varchar(20),
address varchar(50),
personincharge varchar(10),
personincontact varchar(10),
telephone varchar(20),
numberofmultistoreybuildings bigint(10),
numberofhighrisebuildings bigint(10),
builtuparea decimal(12,4),
areaofpublicplaces decimal(12,4),
afforestedarea decimal(12,4),
roadarea decimal(12,4),
designofparkingarea decimal(12,4),
areacovered decimal(12,4),
garagearea decimal(12,4),
carnumber bigint(10),
remark varchar(200),
create_time datetime not null,
createuserid bigint(20) not null,
createusername varchar(20) not null,
primary key (id)
)
engine=innodb charset=utf8
PARTITION BY RANGE (id)
(
PARTITION b0 VALUES LESS THAN (1000000),
PARTITION b1 VALUES LESS THAN (2000000),
PARTITION b2 VALUES LESS THAN (3000000),
PARTITION b3 VALUES LESS THAN (4000000),
PARTITION b4 VALUES LESS THAN (5000000),
PARTITION b5 VALUES LESS THAN (6000000),
PARTITION b6 VALUES LESS THAN (7000000),
PARTITION b7 VALUES LESS THAN (8000000),
PARTITION b8 VALUES LESS THAN (9000000),
PARTITION b9 VALUES LESS THAN (10000000),
PARTITION b10 VALUES LESS THAN (20000000),
PARTITION b99 VALUES LESS THAN MAXVALUE
);
/*==============================================================*/
/* Table: pm_completedregistration */
/*==============================================================*/
create table pm_completedregistration
(
id bigint(20) not null,
serialnumber varchar(20) not null,
whethercompleted bit not null,
maintenancecondition varchar(150) not null,
completiondate datetime not null,
materialcost float(6,2) default 0.00,
thissingleprofit float(6,2) default 0.00,
othercosts float(6,2) default 0.00,
servicecommission float(6,2) default 0.00,
totalcharge float(6,2) default 0.00,
remark varchar(100),
primary key (id)
)
engine=innodb charset=utf8
PARTITION BY RANGE (id)
(
PARTITION b0 VALUES LESS THAN (1000000),
PARTITION b1 VALUES LESS THAN (2000000),
PARTITION b2 VALUES LESS THAN (3000000),
PARTITION b3 VALUES LESS THAN (4000000),
PARTITION b4 VALUES LESS THAN (5000000),
PARTITION b5 VALUES LESS THAN (6000000),
PARTITION b6 VALUES LESS THAN (7000000),
PARTITION b7 VALUES LESS THAN (8000000),
PARTITION b8 VALUES LESS THAN (9000000),
PARTITION b9 VALUES LESS THAN (10000000),
PARTITION b10 VALUES LESS THAN (20000000),
PARTITION b99 VALUES LESS THAN MAXVALUE
);
/*==============================================================*/
/* Table: pm_completedregistrationmanagementstaff */
/*==============================================================*/
create table pm_completedregistrationmanagementstaff
(
id bigint(20) not null,
maintenancepersonnelid bigint(20),
primary key (id)
)
engine=innodb charset=utf8
PARTITION BY RANGE (id)
(
PARTITION b0 VALUES LESS THAN (1000000),
PARTITION b1 VALUES LESS THAN (2000000),
PARTITION b2 VALUES LESS THAN (3000000),
PARTITION b3 VALUES LESS THAN (4000000),
PARTITION b4 VALUES LESS THAN (5000000),
PARTITION b5 VALUES LESS THAN (6000000),
PARTITION b6 VALUES LESS THAN (7000000),
PARTITION b7 VALUES LESS THAN (8000000),
PARTITION b8 VALUES LESS THAN (9000000),
PARTITION b9 VALUES LESS THAN (10000000),
PARTITION b10 VALUES LESS THAN (20000000),
PARTITION b99 VALUES LESS THAN MAXVALUE
);
/*==============================================================*/
/* Table: pm_completedregistrationofmanagement */
/*==============================================================*/
create table pm_completedregistrationofmanagement
(
id bigint(20) not null,
itemcode varchar(10) not null,
itemname varchar(15) not null,
单价 float(6,2) default 0.00,
num tinyint,
amountofmoney float(9,2),
remark varchar(100),
primary key (id)
)
engine=innodb charset=utf8
PARTITION BY RANGE (id)
(
PARTITION b0 VALUES LESS THAN (1000000),
PARTITION b1 VALUES LESS THAN (2000000),
PARTITION b2 VALUES LESS THAN (3000000),
PARTITION b3 VALUES LESS THAN (4000000),
PARTITION b4 VALUES LESS THAN (5000000),
PARTITION b5 VALUES LESS THAN (6000000),
PARTITION b6 VALUES LESS THAN (7000000),
PARTITION b7 VALUES LESS THAN (8000000),
PARTITION b8 VALUES LESS THAN (9000000),
PARTITION b9 VALUES LESS THAN (10000000),
PARTITION b10 VALUES LESS THAN (20000000),
PARTITION b99 VALUES LESS THAN MAXVALUE
);
/*==============================================================*/
/* Table: pm_customcategorysettings */
/*==============================================================*/
create table pm_customcategorysettings
(
id bigint(20) not null auto_increment,
propertycompanyid varchar(30) not null,
categoryname varchar(20) not null,
parentid bigint(20),
ordernumber varchar(10),
whetherbuiltinidentification bigint(2) default 0,
deletemark bigint(2) default 1,
primary key (id)
)
engine=innodb charset=utf8
PARTITION BY RANGE (id)
(
PARTITION b0 VALUES LESS THAN (1000000),
PARTITION b1 VALUES LESS THAN (2000000),
PARTITION b2 VALUES LESS THAN (3000000),
PARTITION b3 VALUES LESS THAN (4000000),
PARTITION b4 VALUES LESS THAN (5000000),
PARTITION b5 VALUES LESS THAN (6000000),
PARTITION b6 VALUES LESS THAN (7000000),
PARTITION b7 VALUES LESS THAN (8000000),
PARTITION b8 VALUES LESS THAN (9000000),
PARTITION b9 VALUES LESS THAN (10000000),
PARTITION b10 VALUES LESS THAN (20000000),
PARTITION b99 VALUES LESS THAN MAXVALUE
);
/*==============================================================*/
/* Table: pm_customereventmanagement */
/*==============================================================*/
create table pm_customereventmanagement
(
id bigint(20) not null auto_increment,
communityInformationid bigint(20) not null,
roomid bigint(20) not null,
dateofoccurrence datetime not null,
contentinfo varchar(150) not null,
importantlevel bigint(10) not null,
category varchar(20),
remark varchar(100),
primary key (id)
)
engine=innodb charset=utf8
PARTITION BY RANGE (id)
(
PARTITION b0 VALUES LESS THAN (1000000),
PARTITION b1 VALUES LESS THAN (2000000),
PARTITION b2 VALUES LESS THAN (3000000),
PARTITION b3 VALUES LESS THAN (4000000),
PARTITION b4 VALUES LESS THAN (5000000),
PARTITION b5 VALUES LESS THAN (6000000),
PARTITION b6 VALUES LESS THAN (7000000),
PARTITION b7 VALUES LESS THAN (8000000),
PARTITION b8 VALUES LESS THAN (9000000),
PARTITION b9 VALUES LESS THAN (10000000),
PARTITION b10 VALUES LESS THAN (20000000),
PARTITION b99 VALUES LESS THAN MAXVALUE
);
/*==============================================================*/
/* Table: pm_customeroutmoverecord */
/*==============================================================*/
create table pm_customeroutmoverecord
(
id bigint(20) not null auto_increment,
propertycompanyid bigint(20) not null,
communityInformationid bigint(20) not null,
roomid bigint(20) not null,
roomcode varchar(20),
customername varchar(10),
chargeserviceobject bigint(10),
dateoflastimmigration datetime,
outchargeserviceobject bigint(10),
moveoutdate datetime,
outroomstate bigint(10),
remark varchar(50),
autoclearflag bigint(10) default 0,
create_time datetime,
createuserid bigint(20) not null,
createusername varchar(20) not null,
moveoutstate bigint(10),
primary key (id)
)
engine=innodb charset=utf8
PARTITION BY RANGE (id)
(
PARTITION b0 VALUES LESS THAN (1000000),
PARTITION b1 VALUES LESS THAN (2000000),
PARTITION b2 VALUES LESS THAN (3000000),
PARTITION b3 VALUES LESS THAN (4000000),
PARTITION b4 VALUES LESS THAN (5000000),
PARTITION b5 VALUES LESS THAN (6000000),
PARTITION b6 VALUES LESS THAN (7000000),
PARTITION b7 VALUES LESS THAN (8000000),
PARTITION b8 VALUES LESS THAN (9000000),
PARTITION b9 VALUES LESS THAN (10000000),
PARTITION b10 VALUES LESS THAN (20000000),
PARTITION b99 VALUES LESS THAN MAXVALUE
);
/*==============================================================*/
/* Table: pm_customsubitem */
/*==============================================================*/
create table pm_customsubitem
(
id bigint(20) not null auto_increment,
keyvalues varchar(20) not null,
ordernumber varchar(10) not null,
whetherbuiltinidentification bigint(2) default 0,
deletemark bigint(2) default 1,
primary key (id)
)
engine=innodb charset=utf8
PARTITION BY RANGE (id)
(
PARTITION b0 VALUES LESS THAN (1000000),
PARTITION b1 VALUES LESS THAN (2000000),
PARTITION b2 VALUES LESS THAN (3000000),
PARTITION b3 VALUES LESS THAN (4000000),
PARTITION b4 VALUES LESS THAN (5000000),
PARTITION b5 VALUES LESS THAN (6000000),
PARTITION b6 VALUES LESS THAN (7000000),
PARTITION b7 VALUES LESS THAN (8000000),
PARTITION b8 VALUES LESS THAN (9000000),
PARTITION b9 VALUES LESS THAN (10000000),
PARTITION b10 VALUES LESS THAN (20000000),
PARTITION b99 VALUES LESS THAN MAXVALUE
);
/*==============================================================*/
/* Table: pm_dispatchmanagement */
/*==============================================================*/
create table pm_dispatchmanagement
(
id bigint(20) not null,
serialnumber varchar(20) not null,
maintenancepersonnelid bigint(20),
maintenancecompany tinyint not null,
remark varchar(100),
短信数 tinyint,
primary key (id)
)
engine=innodb charset=utf8
PARTITION BY RANGE (id)
(
PARTITION b0 VALUES LESS THAN (1000000),
PARTITION b1 VALUES LESS THAN (2000000),
PARTITION b2 VALUES LESS THAN (3000000),
PARTITION b3 VALUES LESS THAN (4000000),
PARTITION b4 VALUES LESS THAN (5000000),
PARTITION b5 VALUES LESS THAN (6000000),
PARTITION b6 VALUES LESS THAN (7000000),
PARTITION b7 VALUES LESS THAN (8000000),
PARTITION b8 VALUES LESS THAN (9000000),
PARTITION b9 VALUES LESS THAN (10000000),
PARTITION b10 VALUES LESS THAN (20000000),
PARTITION b99 VALUES LESS THAN MAXVALUE
);
/*==============================================================*/
/* Table: pm_employeefileregistration */
/*==============================================================*/
create table pm_employeefileregistration
(
id bigint(20) not null auto_increment,
propertycompanyid bigint(20) not null,
organizationregistrationid bigint(20),
employeestatus bigint(10) not null,
staffcode varchar(20) not null,
whetheronthejob bigint(10) not null,
name varchar(10) not null,
gender bigint(10),
birthday datetime not null,
entrytime datetime not null,
education bigint(10),
idnumber varchar(20),
job varchar(10),
jobnumber varchar(20),
contractstartdate datetime,
contractenddate datetime,
mobilephone varchar(15),
telephone varchar(20),
address varchar(100),
placeoforigin varchar(20),
height varchar(10),
weight varchar(10),
major varchar(10),
basepay varchar(10),
email varchar(15),
qq varchar(19),
skilllevel varchar(10),
politicallandscape varchar(10),
hobby varchar(10),
workexperience varchar(20),
bankaccount varchar(30),
bank varchar(30),
departuretime datetime,
remark varchar(100),
create_time datetime,
createuserid bigint(20) not null,
createusername varchar(20) not null,
primary key (id)
)
engine=innodb charset=utf8
PARTITION BY RANGE (id)
(
PARTITION b0 VALUES LESS THAN (1000000),
PARTITION b1 VALUES LESS THAN (2000000),
PARTITION b2 VALUES LESS THAN (3000000),
PARTITION b3 VALUES LESS THAN (4000000),
PARTITION b4 VALUES LESS THAN (5000000),
PARTITION b5 VALUES LESS THAN (6000000),
PARTITION b6 VALUES LESS THAN (7000000),
PARTITION b7 VALUES LESS THAN (8000000),
PARTITION b8 VALUES LESS THAN (9000000),
PARTITION b9 VALUES LESS THAN (10000000),
PARTITION b10 VALUES LESS THAN (20000000),
PARTITION b99 VALUES LESS THAN MAXVALUE
);
/*==============================================================*/
/* Table: pm_employeetrainingrecord */
/*==============================================================*/
create table pm_employeetrainingrecord
(
id bigint(20) not null auto_increment,
propertycompanyid bigint(20) not null,
organizationregistrationid bigint(20),
employeefileregistrationid bigint(20) not null,
watercode varchar(50) not null,
trainingcontent varchar(100) not null,
trainingtime datetime not null,
remark varchar(100),
auditstatus bigint(2) default 0,
primary key (id)
)
engine=innodb charset=utf8
PARTITION BY RANGE (id)
(
PARTITION b0 VALUES LESS THAN (1000000),
PARTITION b1 VALUES LESS THAN (2000000),
PARTITION b2 VALUES LESS THAN (3000000),
PARTITION b3 VALUES LESS THAN (4000000),
PARTITION b4 VALUES LESS THAN (5000000),
PARTITION b5 VALUES LESS THAN (6000000),
PARTITION b6 VALUES LESS THAN (7000000),
PARTITION b7 VALUES LESS THAN (8000000),
PARTITION b8 VALUES LESS THAN (9000000),
PARTITION b9 VALUES LESS THAN (10000000),
PARTITION b10 VALUES LESS THAN (20000000),
PARTITION b99 VALUES LESS THAN MAXVALUE
);
/*==============================================================*/
/* Table: pm_listofrewardsandpunishments */
/*==============================================================*/
create table pm_listofrewardsandpunishments
(
id bigint(20) not null auto_increment,
propertycompanyid bigint(20) not null,
organizationregistrationid bigint(20),
employeeid bigint(20) not null,
watercode varchar(50) not null,
ewardsandpunishments varchar(100) not null,
rewardandpunishmentcategory varchar(20) not null,
remark varchar(100),
create_time datetime,
createuserid bigint(20) not null,
CreateUserName varchar(20) not null,
auditperson varchar(20) not null,
auditstatus bigint(2) default 0,
primary key (id)
)
engine=innodb charset=utf8
PARTITION BY RANGE (id)
(
PARTITION b0 VALUES LESS THAN (1000000),
PARTITION b1 VALUES LESS THAN (2000000),
PARTITION b2 VALUES LESS THAN (3000000),
PARTITION b3 VALUES LESS THAN (4000000),
PARTITION b4 VALUES LESS THAN (5000000),
PARTITION b5 VALUES LESS THAN (6000000),
PARTITION b6 VALUES LESS THAN (7000000),
PARTITION b7 VALUES LESS THAN (8000000),
PARTITION b8 VALUES LESS THAN (9000000),
PARTITION b9 VALUES LESS THAN (10000000),
PARTITION b10 VALUES LESS THAN (20000000),
PARTITION b99 VALUES LESS THAN MAXVALUE
);
/*==============================================================*/
/* Table: pm_loginaccountsettings */
/*==============================================================*/
create table pm_loginaccountsettings
(
id bigint(20) not null auto_increment,
account varchar(10) not null,
displayname varchar(20) not null,
pwd varchar(20) not null default '666666',
propertycompanyid bigint(20) not null,
departmentid bigint(20) not null,
userrole bigint(20),
telephone varchar(20),
state varchar(1) not null default '1',
communityInformation varchar(50),
warehouseInformation varchar(50),
remark varchar(100),
primary key (id)
)
engine=innodb charset=utf8
PARTITION BY RANGE (id)
(
PARTITION b0 VALUES LESS THAN (1000000),
PARTITION b1 VALUES LESS THAN (2000000),
PARTITION b2 VALUES LESS THAN (3000000),
PARTITION b3 VALUES LESS THAN (4000000),
PARTITION b4 VALUES LESS THAN (5000000),
PARTITION b5 VALUES LESS THAN (6000000),
PARTITION b6 VALUES LESS THAN (7000000),
PARTITION b7 VALUES LESS THAN (8000000),
PARTITION b8 VALUES LESS THAN (9000000),
PARTITION b9 VALUES LESS THAN (10000000),
PARTITION b10 VALUES LESS THAN (20000000),
PARTITION b99 VALUES LESS THAN MAXVALUE
);
/*==============================================================*/
/* Table: pm_loginroleinformationtable */
/*==============================================================*/
create table pm_loginroleinformationtable
(
role_id bigint(20) not null auto_increment,
characterencoding varchar(10) not null,
rolename varchar(10) not null,
deletemark bigint(2) default 1,
remark varchar(50),
create_time datetime,
createuserid bigint(20) not null,
createusername varchar(20) not null,
modifydate datetime not null,
modifyuserid bigint(20) not null,
modifyusername varchar(20) not null,
primary key (role_id)
)
engine=innodb charset=utf8
PARTITION BY RANGE (role_id)
(
PARTITION b0 VALUES LESS THAN (1000000),
PARTITION b1 VALUES LESS THAN (2000000),
PARTITION b2 VALUES LESS THAN (3000000),
PARTITION b3 VALUES LESS THAN (4000000),
PARTITION b4 VALUES LESS THAN (5000000),
PARTITION b5 VALUES LESS THAN (6000000),
PARTITION b6 VALUES LESS THAN (7000000),
PARTITION b7 VALUES LESS THAN (8000000),
PARTITION b8 VALUES LESS THAN (9000000),
PARTITION b9 VALUES LESS THAN (10000000),
PARTITION b10 VALUES LESS THAN (20000000),
PARTITION b99 VALUES LESS THAN MAXVALUE
);
/*==============================================================*/
/* Table: pm_menu_action_power */
/*==============================================================*/
create table pm_menu_action_power
(
roleright_id bigint(20) not null auto_increment,
roles_id bigint(20) not null,
menu_id varchar(6) not null,
create_time datetime,
createuserid bigint(20) not null,
createusername varchar(20) not null,
primary key (roleright_id)
)
engine=innodb charset=utf8
PARTITION BY RANGE (roleright_id)
(
PARTITION b0 VALUES LESS THAN (1000000),
PARTITION b1 VALUES LESS THAN (2000000),
PARTITION b2 VALUES LESS THAN (3000000),
PARTITION b3 VALUES LESS THAN (4000000),
PARTITION b4 VALUES LESS THAN (5000000),
PARTITION b5 VALUES LESS THAN (6000000),
PARTITION b6 VALUES LESS THAN (7000000),
PARTITION b7 VALUES LESS THAN (8000000),
PARTITION b8 VALUES LESS THAN (9000000),
PARTITION b9 VALUES LESS THAN (10000000),
PARTITION b10 VALUES LESS THAN (20000000),
PARTITION b99 VALUES LESS THAN MAXVALUE
);
/*==============================================================*/
/* Table: pm_of_type */
/*==============================================================*/
create table pm_of_type
(
type_id bigint(20) not null auto_increment,
categoryname varchar(30) not null,
parentid bigint(20),
ordernumber varchar(10),
type_depict varchar(300),
type_state varchar(1) not null,
whetherbuiltinidentification bigint(2) default 0,
create_time datetime not null,
createuserid bigint(20) not null,
createusername varchar(20) not null,
primary key (type_id)
)
engine=innodb charset=utf8
PARTITION BY RANGE (type_id)
(
PARTITION b0 VALUES LESS THAN (1000000),
PARTITION b1 VALUES LESS THAN (2000000),
PARTITION b2 VALUES LESS THAN (3000000),
PARTITION b3 VALUES LESS THAN (4000000),
PARTITION b4 VALUES LESS THAN (5000000),
PARTITION b5 VALUES LESS THAN (6000000),
PARTITION b6 VALUES LESS THAN (7000000),
PARTITION b7 VALUES LESS THAN (8000000),
PARTITION b8 VALUES LESS THAN (9000000),
PARTITION b9 VALUES LESS THAN (10000000),
PARTITION b10 VALUES LESS THAN (20000000),
PARTITION b99 VALUES LESS THAN MAXVALUE
);
/*==============================================================*/
/* Table: pm_parametertypedatasheet */
/*==============================================================*/
create table pm_parametertypedatasheet
(
id bigint(20) not null auto_increment,
pm_customcategorysettings_id bigint(20),
keyvalues varchar(20) not null,
order_num int,
column_state varchar(1),
ordernumber varchar(10) not null,
whetherbuiltinidentification bigint(2) default 0,
create_time datetime,
createuserid bigint(20) not null,
createusername varchar(20) not null,
primary key (id)
)
engine=innodb charset=utf8
PARTITION BY RANGE (id)
(
PARTITION b0 VALUES LESS THAN (1000000),
PARTITION b1 VALUES LESS THAN (2000000),
PARTITION b2 VALUES LESS THAN (3000000),
PARTITION b3 VALUES LESS THAN (4000000),
PARTITION b4 VALUES LESS THAN (5000000),
PARTITION b5 VALUES LESS THAN (6000000),
PARTITION b6 VALUES LESS THAN (7000000),
PARTITION b7 VALUES LESS THAN (8000000),
PARTITION b8 VALUES LESS THAN (9000000),
PARTITION b9 VALUES LESS THAN (10000000),
PARTITION b10 VALUES LESS THAN (20000000),
PARTITION b99 VALUES LESS THAN MAXVALUE
);
/*==============================================================*/
/* Table: pm_postchangeregistration */
/*==============================================================*/
create table pm_postchangeregistration
(
id bigint(20) not null auto_increment,
propertycompanyid varchar(30) not null,
organizationregistrationid bigint(20),
employeeid bigint(20) not null,
watercode varchar(50) not null,
oldorganizationregistrationid bigint(20) not null,
neworganizationregistrationid bigint(20) not null,
newjobname varchar(20) not null,
newpostsalary decimal(16,4) not null,
remark varchar(100),
oldjobname varchar(20) not null,
oldpostsalary decimal(16,4) not null,
createuserid bigint(20) not null,
CreateUserName varchar(20) not null,
create_time datetime,
auditperson varchar(20) not null,
audittime datetime,
auditstatus bigint(2) default 0,
primary key (id)
)
engine=innodb charset=utf8
PARTITION BY RANGE (id)
(
PARTITION b0 VALUES LESS THAN (1000000),
PARTITION b1 VALUES LESS THAN (2000000),
PARTITION b2 VALUES LESS THAN (3000000),
PARTITION b3 VALUES LESS THAN (4000000),
PARTITION b4 VALUES LESS THAN (5000000),
PARTITION b5 VALUES LESS THAN (6000000),
PARTITION b6 VALUES LESS THAN (7000000),
PARTITION b7 VALUES LESS THAN (8000000),
PARTITION b8 VALUES LESS THAN (9000000),
PARTITION b9 VALUES LESS THAN (10000000),
PARTITION b10 VALUES LESS THAN (20000000),
PARTITION b99 VALUES LESS THAN MAXVALUE
);
/*==============================================================*/
/* Table: pm_propertycompany */
/*==============================================================*/
create table pm_propertycompany
(
id bigint(20) not null auto_increment,
enterprisenumber varchar(30) not null,
pc_name varchar(50) not null,
pc_people varchar(6) not null,
pc_phone varchar(20) not null,
pc_detail varchar(1000) not null,
pc_level bigint(10) not null,
bm_store_img_id varchar(18),
bm_store_img_id_u varchar(200),
businesslicenseimgurl varchar(200),
street_name varchar(30),
province_id varchar(10) not null,
province_name varchar(30),
city_id varchar(10) not null,
city_name varchar(30) not null,
area_id2 varchar(10) not null,
area_name varchar(30),
street_id2 varchar(10),
street_name2 varchar(30),
bm_store_addr varchar(100) not null,
bm_y varchar(20),
bm_x varchar(20),
begin_time_stamp bigint(20) not null,
end_time_stamp bigint(20) not null,
begin_time datetime not null,
end_time datetime not null,
worker_id bigint(20),
pc_state varchar(1) not null,
create_time datetime not null,
createuserid bigint(20) not null,
createusername varchar(20) not null,
primary key (id)
)
engine=innodb charset=utf8
PARTITION BY RANGE (id)
(
PARTITION b0 VALUES LESS THAN (1000000),
PARTITION b1 VALUES LESS THAN (2000000),
PARTITION b2 VALUES LESS THAN (3000000),
PARTITION b3 VALUES LESS THAN (4000000),
PARTITION b4 VALUES LESS THAN (5000000),
PARTITION b5 VALUES LESS THAN (6000000),
PARTITION b6 VALUES LESS THAN (7000000),
PARTITION b7 VALUES LESS THAN (8000000),
PARTITION b8 VALUES LESS THAN (9000000),
PARTITION b9 VALUES LESS THAN (10000000),
PARTITION b10 VALUES LESS THAN (20000000),
PARTITION b99 VALUES LESS THAN MAXVALUE
);
/*==============================================================*/
/* Table: pm_propertycompany_branch */
/*==============================================================*/
create table pm_propertycompany_branch
(
pc_branch_id bigint(20) not null auto_increment,
pc_id bigint(20) not null,
parentid bigint(20) not null default 0,
pc_branch_name varchar(50) not null,
create_time datetime not null,
createuserid bigint(20) not null,
createusername varchar(20) not null,
primary key (pc_branch_id)
)
engine=innodb charset=utf8
PARTITION BY RANGE (pc_branch_id)
(
PARTITION b0 VALUES LESS THAN (1000000),
PARTITION b1 VALUES LESS THAN (2000000),
PARTITION b2 VALUES LESS THAN (3000000),
PARTITION b3 VALUES LESS THAN (4000000),
PARTITION b4 VALUES LESS THAN (5000000),
PARTITION b5 VALUES LESS THAN (6000000),
PARTITION b6 VALUES LESS THAN (7000000),
PARTITION b7 VALUES LESS THAN (8000000),
PARTITION b8 VALUES LESS THAN (9000000),
PARTITION b9 VALUES LESS THAN (10000000),
PARTITION b10 VALUES LESS THAN (20000000),
PARTITION b99 VALUES LESS THAN MAXVALUE
);
/*==============================================================*/
/* Table: pm_propertycompany_menu */
/*==============================================================*/
create table pm_propertycompany_menu
(
id bigint(20) not null auto_increment,
menu_id bigint(6) not null,
propertycompanyid bigint(20) not null,
menu_state bigint(2) default 1,
primary key (id)
)
engine=innodb charset=utf8
PARTITION BY RANGE (id)
(
PARTITION b0 VALUES LESS THAN (1000000),
PARTITION b1 VALUES LESS THAN (2000000),
PARTITION b2 VALUES LESS THAN (3000000),
PARTITION b3 VALUES LESS THAN (4000000),
PARTITION b4 VALUES LESS THAN (5000000),
PARTITION b5 VALUES LESS THAN (6000000),
PARTITION b6 VALUES LESS THAN (7000000),
PARTITION b7 VALUES LESS THAN (8000000),
PARTITION b8 VALUES LESS THAN (9000000),
PARTITION b9 VALUES LESS THAN (10000000),
PARTITION b10 VALUES LESS THAN (20000000),
PARTITION b99 VALUES LESS THAN MAXVALUE
);
/*==============================================================*/
/* Table: pm_returnvisitregistrationmanagementtable */
/*==============================================================*/
create table pm_returnvisitregistrationmanagementtable
(
id bigint(20) not null auto_increment,
serialnumber varchar(20) not null,
whetherareturnvisit bit not null,
customersatisfaction bigint(10) not null,
customeropinion char(10) not null,
returnvisit varchar(50),
returndate datetime,
remark varchar(50),
primary key (id)
)
engine=innodb charset=utf8
PARTITION BY RANGE (id)
(
PARTITION b0 VALUES LESS THAN (1000000),
PARTITION b1 VALUES LESS THAN (2000000),
PARTITION b2 VALUES LESS THAN (3000000),
PARTITION b3 VALUES LESS THAN (4000000),
PARTITION b4 VALUES LESS THAN (5000000),
PARTITION b5 VALUES LESS THAN (6000000),
PARTITION b6 VALUES LESS THAN (7000000),
PARTITION b7 VALUES LESS THAN (8000000),
PARTITION b8 VALUES LESS THAN (9000000),
PARTITION b9 VALUES LESS THAN (10000000),
PARTITION b10 VALUES LESS THAN (20000000),
PARTITION b99 VALUES LESS THAN MAXVALUE
);
/*==============================================================*/
/* Table: pm_roomarchives */
/*==============================================================*/
create table pm_roomarchives
(
id bigint(20) not null auto_increment,
propertycompanyid bigint(20) not null,
communityInformationid bigint(20),
roomcode varchar(20) not null,
builtuparea decimal(12,4) not null default 0.00,
Innerarea decimal(12,4),
poolarea decimal(12,4),
sortcode bigint(10),
decorationsituation bigint(10),
orientation varchar(20),
roomtype bigint(10),
roomstate bigint(10),
chargeserviceobject bigint(10),
numberoffloors bigint(10) not null,
roomuse varchar(20),
unitnumber varchar(10),
ownershiptype varchar(10),
address varchar(100),
remark varchar(150),
rent decimal(12,4),
whethertosigntheagreement bigint(10),
totalprice decimal(12,4),
unitprice decimal(12,4),
managementexpense decimal(12,4),
contractsigningprocess varchar(150),
specialunitindication varchar(20),
whethertheroomiseffective bigint(10),
splitrentstatus bigint(10),
splitactivestate bigint(10),
create_time datetime not null,
createuserid bigint(20) not null,
createusername varchar(20) not null,
primary key (id)
)
engine=innodb charset=utf8
PARTITION BY RANGE (id)
(
PARTITION b0 VALUES LESS THAN (1000000),
PARTITION b1 VALUES LESS THAN (2000000),
PARTITION b2 VALUES LESS THAN (3000000),
PARTITION b3 VALUES LESS THAN (4000000),
PARTITION b4 VALUES LESS THAN (5000000),
PARTITION b5 VALUES LESS THAN (6000000),
PARTITION b6 VALUES LESS THAN (7000000),
PARTITION b7 VALUES LESS THAN (8000000),
PARTITION b8 VALUES LESS THAN (9000000),
PARTITION b9 VALUES LESS THAN (10000000),
PARTITION b10 VALUES LESS THAN (20000000),
PARTITION b99 VALUES LESS THAN MAXVALUE
);
/*==============================================================*/
/* Table: pm_roomclientfile */
/*==============================================================*/
create table pm_roomclientfile
(
id bigint(20) not null auto_increment,
propertycompanyid bigint(20) not null,
communityInformationid bigint(20) not null,
roomarchives bigint(20) not null,
clientproperty bigint(20) not null,
customernumber varchar(20) not null,
customercategories bigint(20),
customername varchar(10) not null,
contacts varchar(10),
telephone varchar(20),
mobilephone varchar(15),
fax varchar(20),
idnumber varchar(15),
birthday datetime,
qq varchar(12),
handoverdate datetime,
email varchar(20),
checkindate datetime,
decorationdate datetime,
chargestartdate datetime,
chargeuptodate datetime,
workplace varchar(50),
associationworkplace varchar(50),
zipcode varchar(6),
duties varchar(10),
residentpopulation varchar(10),
licenseplate varchar(15),
temporaryresidents varchar(10),
householdcardnumber varchar(20),
emergencycontact varchar(10),
emergencycontactphone varchar(20),
address varchar(50),
customerinquirycode varchar(10),
remark varchar(100),
legalperson varchar(10),
ownedindustry varchar(20),
mainbusiness varchar(20),
operatingconditions varchar(20),
starrating varchar(10),
dutyparagraph varchar(20),
accountname varchar(20),
bankcode varchar(20),
bankaccount varchar(20),
bank varchar(20),
whetherthebankwithheld bigint(10),
contractstartdate datetime,
enddateofcontract datetime,
moveoutstate bigint(10),
create_time datetime not null,
createuserid bigint(20) not null,
createusername varchar(20) not null,
primary key (id)
)
engine=innodb charset=utf8
PARTITION BY RANGE (id)
(
PARTITION b0 VALUES LESS THAN (1000000),
PARTITION b1 VALUES LESS THAN (2000000),
PARTITION b2 VALUES LESS THAN (3000000),
PARTITION b3 VALUES LESS THAN (4000000),
PARTITION b4 VALUES LESS THAN (5000000),
PARTITION b5 VALUES LESS THAN (6000000),
PARTITION b6 VALUES LESS THAN (7000000),
PARTITION b7 VALUES LESS THAN (8000000),
PARTITION b8 VALUES LESS THAN (9000000),
PARTITION b9 VALUES LESS THAN (10000000),
PARTITION b10 VALUES LESS THAN (20000000),
PARTITION b99 VALUES LESS THAN MAXVALUE
);
/*==============================================================*/
/* Table: pm_roomcustomerfamilymembers */
/*==============================================================*/
create table pm_roomcustomerfamilymembers
(
id bigint(20) not null auto_increment,
roomclientfile bigint(20) not null,
name varchar(10) not null,
idcardnum varchar(20),
gender bigint(5) not null,
birthday datetime,
relationshipwiththeheadofhousehold bigint(10),
telephone varchar(20),
workplace varchar(50),
primary key (id)
);
/*==============================================================*/
/* Table: pm_roomfileattachmenttable */
/*==============================================================*/
create table pm_roomfileattachmenttable
(
id bigint(20) not null auto_increment,
propertycompanyid bigint(20) not null,
communityInformationid bigint(20),
filename varchar(20) not null,
uploaddate datetime not null,
createuserid bigint(20) not null,
createusername varchar(20) not null,
filesize varchar(20),
primary key (id)
)
engine=innodb charset=utf8
PARTITION BY RANGE (id)
(
PARTITION b0 VALUES LESS THAN (1000000),
PARTITION b1 VALUES LESS THAN (2000000),
PARTITION b2 VALUES LESS THAN (3000000),
PARTITION b3 VALUES LESS THAN (4000000),
PARTITION b4 VALUES LESS THAN (5000000),
PARTITION b5 VALUES LESS THAN (6000000),
PARTITION b6 VALUES LESS THAN (7000000),
PARTITION b7 VALUES LESS THAN (8000000),
PARTITION b8 VALUES LESS THAN (9000000),
PARTITION b9 VALUES LESS THAN (10000000),
PARTITION b10 VALUES LESS THAN (20000000),
PARTITION b99 VALUES LESS THAN MAXVALUE
);
/*==============================================================*/
/* Table: pm_staffassessmentregistrationform */
/*==============================================================*/
create table pm_staffassessmentregistrationform
(
id bigint(20) not null auto_increment,
propertycompanyid bigint(20) not null,
employeeid bigint(20),
organizationregistrationid bigint(20),
evaluationperson varchar(10),
appraisaldate datetime not null,
evaluationstartdate datetime not null,
evaluationenddate datetime not null,
evaluationcontent varchar(20),
evaluationrequirements varchar(20),
evaluationresults varchar(50),
evaluationremark varchar(150),
create_time datetime,
createuserid bigint(20) not null,
CreateUserName varchar(20) not null,
auditstatus bigint(2) default 0,
primary key (id)
)
engine=innodb charset=utf8
PARTITION BY RANGE (id)
(
PARTITION b0 VALUES LESS THAN (1000000),
PARTITION b1 VALUES LESS THAN (2000000),
PARTITION b2 VALUES LESS THAN (3000000),
PARTITION b3 VALUES LESS THAN (4000000),
PARTITION b4 VALUES LESS THAN (5000000),
PARTITION b5 VALUES LESS THAN (6000000),
PARTITION b6 VALUES LESS THAN (7000000),
PARTITION b7 VALUES LESS THAN (8000000),
PARTITION b8 VALUES LESS THAN (9000000),
PARTITION b9 VALUES LESS THAN (10000000),
PARTITION b10 VALUES LESS THAN (20000000),
PARTITION b99 VALUES LESS THAN MAXVALUE
);
/*==============================================================*/
/* Table: pm_sys_admin */
/*==============================================================*/
create table pm_sys_admin
(
admin_id int not null auto_increment,
admin_pwd varchar(50),
byname varchar(10),
wx_id varchar(50),
wxgzpt_id varchar(50),
create_time datetime,
ip varchar(50),
logintime datetime,
primary key (admin_id)
)
engine=innodb charset=utf8;
/*==============================================================*/
/* Table: pm_sys_menu */
/*==============================================================*/
create table pm_sys_menu
(
menu_id bigint(8) not null auto_increment,
parentid bigint(8) not null default 0,
menu_name varchar(20) not null,
menu_img varchar(50) not null,
menu_type bigint(10) not null,
navigateurl varchar(200),
menu_order int(6),
target varchar(10),
sortcode bigint(10) not null,
deletemark bigint(2) default 1,
create_time datetime,
createuserid bigint(20) not null,
createusername varchar(20) not null,
modifydate datetime not null,
modifyuserid bigint(20) not null,
modifyusername varchar(20) not null,
primary key (menu_id)
)
engine=innodb charset=utf8
PARTITION BY RANGE (menu_id)
(
PARTITION b0 VALUES LESS THAN (1000000),
PARTITION b1 VALUES LESS THAN (2000000),
PARTITION b2 VALUES LESS THAN (3000000),
PARTITION b3 VALUES LESS THAN (4000000),
PARTITION b4 VALUES LESS THAN (5000000),
PARTITION b5 VALUES LESS THAN (6000000),
PARTITION b6 VALUES LESS THAN (7000000),
PARTITION b7 VALUES LESS THAN (8000000),
PARTITION b8 VALUES LESS THAN (9000000),
PARTITION b9 VALUES LESS THAN (10000000),
PARTITION b10 VALUES LESS THAN (20000000),
PARTITION b99 VALUES LESS THAN MAXVALUE
);
/*==============================================================*/
/* Table: pm_warrantysheet */
/*==============================================================*/
create table pm_warrantysheet
(
breakdown_id bigint(20) not null auto_increment,
breakdown_code varchar(30) not null,
pc_id bigint(20) not null,
breakdown_name varchar(20) not null,
breakdown_phone varchar(20) not null,
province_id varchar(10) not null,
province_name varchar(30),
city_id varchar(10) not null,
city_name varchar(30) not null,
area_id varchar(10) not null,
area_name varchar(30),
street_id varchar(10),
street_name varchar(30),
community_id bigint(20) not null,
buildingid bigint(20) not null,
roomarchivesid bigint(20),
begin_time datetime,
end_time datetime,
breakdown_detail varchar(3000) not null,
breakdown_class varchar(2),
breakdown_state varchar(2),
breakdown_type varchar(1),
breakdown_genre varchar(1),
repair_days bigint(10) not null default 0,
worker_days bigint(10) not null default 0,
worker_days_check varchar(1) not null,
bill_repair_text varchar(50),
worker_describe varchar(3000),
create_user bigint(20) not null,
create_type varchar(1) not null,
operation_id bigint(20),
user_id_assign bigint(20),
user_id_accept bigint(20),
material_money decimal(16,4) not null,
worker_money decimal(16,4) not null,
prime_cost decimal(16,4) not null,
summation decimal(16,4) not null,
pay_no bigint(20),
pay_type varchar(1),
create_time date not null,
primary key (breakdown_id)
);
|
CREATE DATABASE desafio2db;
use desafio2db;
CREATE TABLE modulo(id INT NOT NULL AUTO_INCREMENT, nome VARCHAR(255), PRIMARY KEY(id));
INSERT INTO modulo(nome) VALUES ('Docker');
INSERT INTO modulo(nome) VALUES ('RabbitMQ');
INSERT INTO modulo(nome) VALUES ('Autenticação entre os microsserviços');
|
/**
* @name 135789226175018
* @manual
* @public
* @rolesAllowed admin
*/
update replicate_actions t set error_code =
(Select replicate_dropView(:platypusUser, :schemaName, :tableName, :actionId) AS actionResult
From (Select COUNT(*)
From DUMMYTABLE t1) t_dropView
) where id = :id |
CREATE TABLE emails (id INT,subject character(20),"from" character(20), "to" CHARACTER (20), timestamp timestamp);
INSERT
INTO
emails
VALUES
(1, 'Yosemite', 'zach@g.com', 'thomas@g.com', '2018-01-02 12:45:03'),
(2, 'Big Sur', 'sarah@g.com', 'thomas@g.com', '2018-01-02 16:30:01'),
(3, 'Yosemite', 'thomas@g.com', 'zach@g.com', '2018-01-02 16:35:04'),
(4, 'Running', ' jill@g.com', 'zach@g.com', '2018-01-03 08:12:45'),
(5, 'Yosemite', 'zach@g.com', 'thomas@g.com', '2018-01-03 14:02:01'),
(6, 'Yosemite', 'thomas@g.com', 'zach@g.com', ' 2018-01-03 15:01:05');
SELECT * FROM emails;
SELECT max(timestamp)-min(timestamp) FROM emails;
--разделение timestamp на столбцы времени и даты:
ALTER TABLE emails ADD COLUMN dat date;
ALTER TABLE emails ADD COLUMN tim time;
ALTER TABLE emails DROP COLUMN time;
UPDATE emails SET dat=timestamp::date, tim=timestamp::time;
--фильтр по переписке с zach@g.com:
SELECT * FROM emails WHERE "from" = 'zach@g.com' or "to"= 'zach@g.com' ORDER by (subject);
--время отклика на каждое письмо (id), отправленное на zach@g.com:
SELECT
A.id, A.subject,
min(B.timestamp-A.timestamp) AS TIME_TO_RESPOND
FROM
EMAILS A
JOIN EMAILS B ON
B.subject = A.subject
AND A."to" = B."from"
AND A."from" = B."to"
GROUP BY
A.id, A.subject;
--Время отклика на 'zach@g.com'
SELECT
a.id,
MIN(b.timestamp - a.timestamp) as time_to_respond
FROM
emails a
JOIN
emails b
ON
b.subject = a.subject
AND
a.to = b.from
AND
a.from = b.to
AND
a.timestamp < b.timestamp
WHERE
a.to = 'zach@g.com'
GROUP BY
a.id;
|
insert into public.currencies (id, code, name) values (1, ' USD', ' US Dollar');
insert into public.currencies (id, code, name) values (2, ' EUR', ' Euro');
insert into public.currencies (id, code, name) values (3, ' UAH', ' Hryvnia');
insert into public.currencies (id, code, name) values (4, ' GBP', ' Pound Sterling');
insert into public.currencies (id, code, name) values (5, ' RUB', ' Russian Ruble');
insert into public.currencies (id, code, name) values (6, ' AFN', ' Afghani');
insert into public.currencies (id, code, name) values (7, ' ALL', ' Lek');
insert into public.currencies (id, code, name) values (8, ' DZD', ' Algerian Dinar');
insert into public.currencies (id, code, name) values (9, ' AOA', ' Kwanza');
insert into public.currencies (id, code, name) values (10, ' XCD', ' East Caribbean Dollar');
insert into public.currencies (id, code, name) values (11, ' ARS', ' Argentine Peso');
insert into public.currencies (id, code, name) values (12, ' AMD', ' Armenian Dram');
insert into public.currencies (id, code, name) values (14, ' AUD', ' Australian Dollar');
insert into public.currencies (id, code, name) values (15, ' AZN', ' Azerbaijan Manat');
insert into public.currencies (id, code, name) values (16, ' BSD', ' Bahamian Dollar');
insert into public.currencies (id, code, name) values (17, ' BHD', ' Bahraini Dinar');
insert into public.currencies (id, code, name) values (18, ' BDT', ' Taka');
insert into public.currencies (id, code, name) values (19, ' BBD', ' Barbados Dollar');
insert into public.currencies (id, code, name) values (20, ' BYN', ' Belarusian Ruble');
insert into public.currencies (id, code, name) values (21, ' BZD', ' Belize Dollar');
insert into public.currencies (id, code, name) values (22, ' XOF', ' CFA Franc BCEAO');
insert into public.currencies (id, code, name) values (23, ' BMD', ' Bermudian Dollar');
insert into public.currencies (id, code, name) values (24, ' INR', ' Indian Rupee');
insert into public.currencies (id, code, name) values (25, ' BTN', ' Ngultrum');
insert into public.currencies (id, code, name) values (26, ' BOB', ' Boliviano');
insert into public.currencies (id, code, name) values (27, ' BOV', ' Mvdol');
insert into public.currencies (id, code, name) values (28, ' BAM', ' Convertible Mark');
insert into public.currencies (id, code, name) values (29, ' BWP', ' Pula');
insert into public.currencies (id, code, name) values (30, ' NOK', ' Norwegian Krone');
insert into public.currencies (id, code, name) values (31, ' BRL', ' Brazilian Real');
insert into public.currencies (id, code, name) values (32, ' BND', ' Brunei Dollar');
insert into public.currencies (id, code, name) values (33, ' BGN', ' Bulgarian Lev');
insert into public.currencies (id, code, name) values (34, ' BIF', ' Burundi Franc');
insert into public.currencies (id, code, name) values (35, ' CVE', ' Cabo Verde Escudo');
insert into public.currencies (id, code, name) values (36, ' KHR', ' Riel');
insert into public.currencies (id, code, name) values (37, ' XAF', ' CFA Franc BEAC');
insert into public.currencies (id, code, name) values (38, ' CAD', ' Canadian Dollar');
insert into public.currencies (id, code, name) values (39, ' KYD', ' Cayman Islands Dollar');
insert into public.currencies (id, code, name) values (40, ' CLP', ' Chilean Peso');
insert into public.currencies (id, code, name) values (41, ' CLF', ' Unidad de Fomento');
insert into public.currencies (id, code, name) values (42, ' CNY', ' Yuan Renminbi');
insert into public.currencies (id, code, name) values (43, ' COP', ' Colombian Peso');
insert into public.currencies (id, code, name) values (44, ' COU', ' Unidad de Valor Real');
insert into public.currencies (id, code, name) values (45, ' KMF', ' Comorian Franc');
insert into public.currencies (id, code, name) values (46, ' CDF', ' Congolese Franc');
insert into public.currencies (id, code, name) values (47, ' NZD', ' New Zealand Dollar');
insert into public.currencies (id, code, name) values (48, ' CRC', ' Costa Rican Colon');
insert into public.currencies (id, code, name) values (49, ' HRK', ' Kuna');
insert into public.currencies (id, code, name) values (50, ' CUP', ' Cuban Peso');
insert into public.currencies (id, code, name) values (51, ' CUC', ' Peso Convertible');
insert into public.currencies (id, code, name) values (52, ' ANG', ' Netherlands Antillean Guilder');
insert into public.currencies (id, code, name) values (53, ' CZK', ' Czech Koruna');
insert into public.currencies (id, code, name) values (54, ' DKK', ' Danish Krone');
insert into public.currencies (id, code, name) values (55, ' DJF', ' Djibouti Franc');
insert into public.currencies (id, code, name) values (56, ' DOP', ' Dominican Peso');
insert into public.currencies (id, code, name) values (57, ' EGP', ' Egyptian Pound');
insert into public.currencies (id, code, name) values (58, ' SVC', ' El Salvador Colon');
insert into public.currencies (id, code, name) values (59, ' ERN', ' Nakfa');
insert into public.currencies (id, code, name) values (60, ' ETB', ' Ethiopian Birr');
insert into public.currencies (id, code, name) values (61, ' FKP', ' Falkland Islands Pound');
insert into public.currencies (id, code, name) values (62, ' FJD', ' Fiji Dollar');
insert into public.currencies (id, code, name) values (63, ' XPF', ' CFP Franc');
insert into public.currencies (id, code, name) values (64, ' GMD', ' Dalasi');
insert into public.currencies (id, code, name) values (65, ' GEL', ' Lari');
insert into public.currencies (id, code, name) values (66, ' GHS', ' Ghana Cedi');
insert into public.currencies (id, code, name) values (67, ' GIP', ' Gibraltar Pound');
insert into public.currencies (id, code, name) values (68, ' GTQ', ' Quetzal');
insert into public.currencies (id, code, name) values (69, ' GNF', ' Guinean Franc');
insert into public.currencies (id, code, name) values (70, ' GYD', ' Guyana Dollar');
insert into public.currencies (id, code, name) values (71, ' HTG', ' Gourde');
insert into public.currencies (id, code, name) values (72, ' HNL', ' Lempira');
insert into public.currencies (id, code, name) values (73, ' HKD', ' Hong Kong Dollar');
insert into public.currencies (id, code, name) values (74, ' HUF', ' Forint');
insert into public.currencies (id, code, name) values (75, ' ISK', ' Iceland Krona');
insert into public.currencies (id, code, name) values (76, ' IDR', ' Rupiah');
insert into public.currencies (id, code, name) values (77, ' XDR', ' SDR (Special Drawing Right)');
insert into public.currencies (id, code, name) values (78, ' IRR', ' Iranian Rial');
insert into public.currencies (id, code, name) values (79, ' IQD', ' Iraqi Dinar');
insert into public.currencies (id, code, name) values (80, ' ILS', ' New Israeli Sheqel');
insert into public.currencies (id, code, name) values (81, ' JMD', ' Jamaican Dollar');
insert into public.currencies (id, code, name) values (82, ' JPY', ' Yen');
insert into public.currencies (id, code, name) values (83, ' JOD', ' Jordanian Dinar');
insert into public.currencies (id, code, name) values (84, ' KZT', ' Tenge');
insert into public.currencies (id, code, name) values (85, ' KES', ' Kenyan Shilling');
insert into public.currencies (id, code, name) values (86, ' KPW', ' North Korean Won');
insert into public.currencies (id, code, name) values (87, ' KRW', ' Won');
insert into public.currencies (id, code, name) values (88, ' KWD', ' Kuwaiti Dinar');
insert into public.currencies (id, code, name) values (89, ' KGS', ' Som');
insert into public.currencies (id, code, name) values (90, ' LAK', ' Lao Kip');
insert into public.currencies (id, code, name) values (91, ' LBP', ' Lebanese Pound');
insert into public.currencies (id, code, name) values (92, ' LSL', ' Loti');
insert into public.currencies (id, code, name) values (93, ' ZAR', ' Rand');
insert into public.currencies (id, code, name) values (94, ' LRD', ' Liberian Dollar');
insert into public.currencies (id, code, name) values (95, ' LYD', ' Libyan Dinar');
insert into public.currencies (id, code, name) values (96, ' CHF', ' Swiss Franc');
insert into public.currencies (id, code, name) values (97, ' MOP', ' Pataca');
insert into public.currencies (id, code, name) values (98, ' MKD', ' Denar');
insert into public.currencies (id, code, name) values (99, ' MGA', ' Malagasy Ariary');
insert into public.currencies (id, code, name) values (100, ' MWK', ' Malawi Kwacha');
insert into public.currencies (id, code, name) values (101, ' MYR', ' Malaysian Ringgit');
insert into public.currencies (id, code, name) values (102, ' MVR', ' Rufiyaa');
insert into public.currencies (id, code, name) values (103, ' MRO', ' Ouguiya');
insert into public.currencies (id, code, name) values (104, ' MUR', ' Mauritius Rupee');
insert into public.currencies (id, code, name) values (105, ' XUA', ' ADB Unit of Account');
insert into public.currencies (id, code, name) values (106, ' MXN', ' Mexican Peso');
insert into public.currencies (id, code, name) values (107, ' MXV', ' Mexican Unidad de Inversion');
insert into public.currencies (id, code, name) values (108, ' MDL', ' Moldovan Leu');
insert into public.currencies (id, code, name) values (109, ' MNT', ' Tugrik');
insert into public.currencies (id, code, name) values (110, ' MAD', ' Moroccan Dirham');
insert into public.currencies (id, code, name) values (111, ' MZN', ' Mozambique Metical');
insert into public.currencies (id, code, name) values (112, ' MMK', ' Kyat');
insert into public.currencies (id, code, name) values (113, ' NAD', ' Namibia Dollar');
insert into public.currencies (id, code, name) values (114, ' NPR', ' Nepalese Rupee');
insert into public.currencies (id, code, name) values (115, ' NIO', ' Cordoba Oro');
insert into public.currencies (id, code, name) values (116, ' NGN', ' Naira');
insert into public.currencies (id, code, name) values (117, ' OMR', ' Rial Omani');
insert into public.currencies (id, code, name) values (118, ' PKR', ' Pakistan Rupee');
insert into public.currencies (id, code, name) values (119, ' PAB', ' Balboa');
insert into public.currencies (id, code, name) values (120, ' PGK', ' Kina');
insert into public.currencies (id, code, name) values (121, ' PYG', ' Guarani');
insert into public.currencies (id, code, name) values (122, ' PEN', ' Sol');
insert into public.currencies (id, code, name) values (123, ' PHP', ' Philippine Piso');
insert into public.currencies (id, code, name) values (124, ' PLN', ' Zloty');
insert into public.currencies (id, code, name) values (125, ' QAR', ' Qatari Rial');
insert into public.currencies (id, code, name) values (126, ' RON', ' Romanian Leu');
insert into public.currencies (id, code, name) values (127, ' RWF', ' Rwanda Franc');
insert into public.currencies (id, code, name) values (128, ' SHP', ' Saint Helena Pound');
insert into public.currencies (id, code, name) values (129, ' WST', ' Tala');
insert into public.currencies (id, code, name) values (130, ' STD', ' Dobra');
insert into public.currencies (id, code, name) values (131, ' SAR', ' Saudi Riyal');
insert into public.currencies (id, code, name) values (132, ' RSD', ' Serbian Dinar');
insert into public.currencies (id, code, name) values (133, ' SCR', ' Seychelles Rupee');
insert into public.currencies (id, code, name) values (134, ' SLL', ' Leone');
insert into public.currencies (id, code, name) values (135, ' SGD', ' Singapore Dollar');
insert into public.currencies (id, code, name) values (136, ' XSU', ' Sucre');
insert into public.currencies (id, code, name) values (137, ' SBD', ' Solomon Islands Dollar');
insert into public.currencies (id, code, name) values (138, ' SOS', ' Somali Shilling');
insert into public.currencies (id, code, name) values (139, ' SSP', ' South Sudanese Pound');
insert into public.currencies (id, code, name) values (140, ' LKR', ' Sri Lanka Rupee');
insert into public.currencies (id, code, name) values (141, ' SDG', ' Sudanese Pound');
insert into public.currencies (id, code, name) values (142, ' SRD', ' Surinam Dollar');
insert into public.currencies (id, code, name) values (143, ' SZL', ' Lilangeni');
insert into public.currencies (id, code, name) values (144, ' SEK', ' Swedish Krona');
insert into public.currencies (id, code, name) values (145, ' CHE', ' WIR Euro');
insert into public.currencies (id, code, name) values (146, ' CHW', ' WIR Franc');
insert into public.currencies (id, code, name) values (147, ' SYP', ' Syrian Pound');
insert into public.currencies (id, code, name) values (148, ' TWD', ' New Taiwan Dollar');
insert into public.currencies (id, code, name) values (149, ' TJS', ' Somoni');
insert into public.currencies (id, code, name) values (150, ' TZS', ' Tanzanian Shilling');
insert into public.currencies (id, code, name) values (151, ' THB', ' Baht');
insert into public.currencies (id, code, name) values (152, ' TOP', ' Pa’anga');
insert into public.currencies (id, code, name) values (153, ' TTD', ' Trinidad and Tobago Dollar');
insert into public.currencies (id, code, name) values (154, ' TND', ' Tunisian Dinar');
insert into public.currencies (id, code, name) values (155, ' TRY', ' Turkish Lira');
insert into public.currencies (id, code, name) values (156, ' TMT', ' Turkmenistan New Manat');
insert into public.currencies (id, code, name) values (157, ' UGX', ' Uganda Shilling');
insert into public.currencies (id, code, name) values (158, ' AED', ' UAE Dirham');
insert into public.currencies (id, code, name) values (159, ' UYU', ' Peso Uruguayo');
insert into public.currencies (id, code, name) values (160, ' UYI', ' Uruguay Peso en Unidades Indexadas');
insert into public.currencies (id, code, name) values (161, ' UZS', ' Uzbekistan Sum');
insert into public.currencies (id, code, name) values (162, ' VUV', ' Vatu');
insert into public.currencies (id, code, name) values (163, ' VEF', ' Bolívar');
insert into public.currencies (id, code, name) values (164, ' VND', ' Dong');
insert into public.currencies (id, code, name) values (165, ' YER', ' Yemeni Rial');
insert into public.currencies (id, code, name) values (166, ' ZMW', ' Zambian Kwacha');
insert into public.currencies (id, code, name) values (167, ' ZWL', ' Zimbabwe Dollar');
|
{{
config({
"materialized" : "table",
"sort" : "detail_posting_date",
"unique_key" : "line_item_id"
})
}}
select
entry_number,
line_item_id,
account_id,
detail_create_date,
detail_posting_date,
credit,
debit,
detail_comment,
source_journal,
source_module,
full_account_number,
full_account_name,
account_type,
account_group,
account_category,
account_code,
cost_center_code,
division_code,
--a.name as account,
a.group as group,
cc.name as cost_center,
case cost_center_code
when 10070 then 'CPG'
else d.name
end as division,
a.type,
a.statement,
a.pl_cost_center
from {{ref('general_ledger_entry_detail')}} e
left join {{ref('gl_full_account_mapping')}} a on a.account = e.account_code and a.division = e.division_code and a.cost_center = e.cost_center_code
left join {{ref('gl_cost_center_mapping')}} cc on cc.cost_center = e.cost_center_code
left join {{ref('gl_division_mapping')}} d on d.division = e.division_code |
ALTER TABLE KIND_TOPIC ADD COLUMN LABEL_FR VARCHAR(100);
ALTER TABLE KIND_TOPIC ADD COLUMN DESCRIPTION_FR TEXT;
ALTER TABLE KIND_TOPIC ALTER COLUMN DESCRIPTION TYPE TEXT; |
-- phpMyAdmin SQL Dump
-- version 4.4.10
-- http://www.phpmyadmin.net
--
-- Client : localhost:8889
-- Généré le : Mar 12 Janvier 2016 à 17:32
-- Version du serveur : 5.5.42
-- Version de PHP : 7.0.0
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
--
-- Base de données : `mailinglist`
--
-- --------------------------------------------------------
--
-- Structure de la table `inscrits`
--
CREATE TABLE `inscrits` (
`id` int(11) NOT NULL,
`email` varchar(255) NOT NULL,
`secret` varchar(255) NOT NULL DEFAULT '',
`date_inscrit` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`actif` varchar(11) NOT NULL DEFAULT 'FALSE'
) ENGINE=InnoDB AUTO_INCREMENT=37 DEFAULT CHARSET=latin1;
--
-- Contenu de la table `inscrits`
--
INSERT INTO `inscrits` (`id`, `email`, `secret`, `date_inscrit`, `actif`) VALUES
(35, 'thao@delefortrie.be', '569522b3886d8', '2016-01-12 15:58:43', 'FALSE');
--
-- Index pour les tables exportées
--
--
-- Index pour la table `inscrits`
--
ALTER TABLE `inscrits`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT pour les tables exportées
--
--
-- AUTO_INCREMENT pour la table `inscrits`
--
ALTER TABLE `inscrits`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=37; |
INSERT INTO `ssaif_prod_abril`.`tbtipotorneo`
(`idtipotorneo`,
`tipotorneo`)
SELECT `formatostorneo`.`formatotorneoid`,
`formatostorneo`.`descripcion`
FROM `ssaif_back_abril`.`formatostorneo`;
|
CREATE OR REPLACE PROCEDURE EXECUTE_TRANSACTION_26787(applyname IN VARCHAR2,ltxnid IN VARCHAR2) IS
i NUMBER;
loopdog NUMBER;
txnid VARCHAR2(30);
source VARCHAR2(128);
msgno NUMBER;
msgcnt NUMBER;
errno NUMBER;
errmsg VARCHAR2(2000);
lcr ANYDATA;
rowlcr SYS.LCR$_ROW_RECORD;
typenm VARCHAR2(61);
res NUMBER;
command VARCHAR2(10);
old_values SYS.LCR$_ROW_LIST;
new_values SYS.LCR$_ROW_LIST;
v_code NUMBER;
v_errm VARCHAR2(1024);
BEGIN
SELECT LOCAL_TRANSACTION_ID,
SOURCE_DATABASE,
MESSAGE_NUMBER,
MESSAGE_COUNT,
ERROR_NUMBER,
ERROR_MESSAGE
INTO txnid, source, msgno, msgcnt, errno, errmsg
FROM DBA_APPLY_ERROR
WHERE LOCAL_TRANSACTION_ID = ltxnid;
DBMS_OUTPUT.PUT_LINE('--- Local Transaction ID: ' || txnid);
DBMS_OUTPUT.PUT_LINE('--- Source Database: ' || source);
DBMS_OUTPUT.PUT_LINE('---Error in Message: '|| msgno);
DBMS_OUTPUT.PUT_LINE('---Error Number: '||errno);
DBMS_OUTPUT.PUT_LINE('---Message Text: '||errmsg);
i := msgno;
loopdog :=0;
WHILE i <= msgcnt LOOP
IF loopdog > msgcnt then
RAISE_APPLICATION_ERROR(-20002,'Insert or Delete error. please check your procedure.');
END IF;
loopdog :=loopdog+1;
DBMS_OUTPUT.PUT_LINE('--message: ' || i);
lcr := DBMS_APPLY_ADM.GET_ERROR_MESSAGE(i, txnid); -- gets the LCR
--print_lcr(lcr);
typenm := lcr.GETTYPENAME();
DBMS_OUTPUT.PUT_LINE('type name: ' || typenm);
IF (typenm = 'SYS.LCR$_ROW_RECORD') THEN
res := lcr.GETOBJECT(rowlcr);
command := rowlcr.GET_COMMAND_TYPE();
DBMS_OUTPUT.PUT_LINE('command type name: ' || command);
IF command = 'DELETE' THEN
-- Set the command_type in the row LCR to INSERT
rowlcr.SET_COMMAND_TYPE('INSERT');
old_values := rowlcr.GET_VALUES('old');
-- Set the old values in the row LCR to the new values in the row LCR
rowlcr.SET_VALUES('new', old_values);
-- Set the old values in the row LCR to NULL
rowlcr.SET_VALUES('old', NULL);
-- Apply the row LCR as an INSERT into the hr.emp_del table
rowlcr.EXECUTE(true);
ELSIF command = 'UPDATE' THEN
BEGIN
old_values := rowlcr.GET_VALUES('old');
new_values := rowlcr.GET_VALUES('new');
rowlcr.EXECUTE(true);
rowlcr.SET_VALUES('new', old_values);
rowlcr.SET_VALUES('old', new_values);
rowlcr.EXECUTE(true);
EXCEPTION when OTHERS then
rowlcr.SET_COMMAND_TYPE('INSERT');
rowlcr.SET_VALUES('new', old_values);
-- Set the old values in the row LCR to NULL
rowlcr.SET_VALUES('old', NULL);
rowlcr.EXECUTE(true);
END;
END IF;
BEGIN
dbms_apply_adm.execute_all_errors(applyname);
--dbms_apply_adm.execute_error(ltxnid);
return;
EXCEPTION when OTHERS then
SELECT MESSAGE_NUMBER INTO i FROM DBA_APPLY_ERROR WHERE LOCAL_TRANSACTION_ID = ltxnid;
v_code := SQLCODE;
v_errm := SUBSTR(SQLERRM, 1, 1024);
DBMS_OUTPUT.PUT_LINE('Error message: ' || v_errm);
IF v_code = -26787 then
DBMS_OUTPUT.PUT_LINE('Error code(-26787): ' || v_code);
--null;
ELSIF v_code = -26786 then
DBMS_OUTPUT.PUT_LINE('Error code(-26786): ' || v_code);
RAISE_APPLICATION_ERROR(-20786,v_errm);
ELSIF v_code = -1 then
DBMS_OUTPUT.PUT_LINE('Error code(-1): ' || v_code);
RAISE_APPLICATION_ERROR(-20001,v_errm);
ELSE
RAISE_APPLICATION_ERROR(-20000,v_errm);
END IF;
END;
END IF;
END LOOP;
END EXECUTE_TRANSACTION_26787;
|
--DROP TABLE UserAccount;
--DROP TABLE Timetable;
--DROP TABLE TermReport;
--DROP TABLE Homework;
--DROP TABLE Grade;
--DROP TABLE Course;
--DROP TABLE Semester;
--DROP TABLE Student;
--DROP TABLE Teacher;
CREATE TABLE Teacher
(
TeacherID INT IDENTITY(1,1) PRIMARY KEY,
TeacherName VARCHAR(150) NOT NULL,
TeacherEmail VARCHAR(100),
TeacherPhone VARCHAR(100)
)
CREATE TABLE Student
(
StudentID INT IDENTITY(1,1) PRIMARY KEY,
StudentName VARCHAR(150) NOT NULL,
StudentPhoto VARCHAR(200) NULL,
Observations VARCHAR(200) NULL
)
CREATE TABLE Semester
(
SemesterID INT IDENTITY(1,1) PRIMARY KEY,
SemesterNumber INT NOT NULL,
SchoolYear CHAR(9) NOT NULL
)
CREATE TABLE Course
(
CourseID INT IDENTITY(1,1) PRIMARY KEY,
CourseName VARCHAR(200),
LevelYear INT NOT NULL,
TeacherID INT,
CONSTRAINT FK_Subjects_TeacherID FOREIGN KEY (TeacherID) REFERENCES Teacher(TeacherID)
)
CREATE TABLE Grade
(
GradeID INT IDENTITY(1,1) PRIMARY KEY,
StudentID INT NOT NULL,
SemesterID INT NOT NULL,
CourseID INT NOT NULL,
Mark NUMERIC(4,2) NOT NULL,
DateOfMark DATE DEFAULT GETDATE(),
GradingWeight NUMERIC(4,2) NOT NULL,
Observations VARCHAR(200),
CONSTRAINT FK_Grades_StudentID FOREIGN KEY (StudentID) REFERENCES Student(StudentID),
CONSTRAINT FK_Grades_SemesterID FOREIGN KEY (SemesterID) REFERENCES Semester(SemesterID),
CONSTRAINT FK_Grades_CourseID FOREIGN KEY (CourseID) REFERENCES Course(CourseID)
)
CREATE TABLE Homework
(
HomeworkID INT IDENTITY(1,1) PRIMARY KEY,
StudentID INT NOT NULL,
CourseID INT NOT NULL,
DateOfHomework DATE DEFAULT GETDATE(),
DueDate DATE DEFAULT GETDATE()+1,
Details VARCHAR(500) NOT NULL,
HomeworkStatus VARCHAR(50) DEFAULT 'TO DO' NOT NULL,
CONSTRAINT FK_Homework_StudentID FOREIGN KEY (StudentID) REFERENCES Student(StudentID),
CONSTRAINT FK_Homework_CourseIDD FOREIGN KEY (CourseID) REFERENCES Course(CourseID),
CONSTRAINT CK_Homework_HWStatus CHECK (HomeworkStatus IN ('TO DO','IN PROGRESS','FINISHED'))
)
CREATE TABLE TermReport
(
ReportID INT IDENTITY(1,1) PRIMARY KEY,
StudentID INT NOT NULL,
SemesterID INT NOT NULL,
CourseID INT NOT NULL,
AverageGrade NUMERIC(4,2) DEFAULT 0.00 NOT NULL,
CONSTRAINT FK_TermReports_StudentID FOREIGN KEY (StudentID) REFERENCES Student(StudentID),
CONSTRAINT FK_TermReports_SemesterID FOREIGN KEY (SemesterID) REFERENCES Semester(SemesterID),
CONSTRAINT FK_TermReports_CourseID FOREIGN KEY (CourseID) REFERENCES Course(CourseID)
)
CREATE TABLE Timetable
(
TimetableID INT IDENTITY(1,1) PRIMARY KEY,
StudentID INT NOT NULL,
DayOfTheWeek VARCHAR(50) NOT NULL,
TimeInterval VARCHAR(50) NOT NULL,
CourseID INT NOT NULL,
CONSTRAINT FK_Timetable_StudentID FOREIGN KEY (StudentID) REFERENCES Student(StudentID),
CONSTRAINT FK_Timetable_CourseID FOREIGN KEY (CourseID) REFERENCES Course(CourseID)
)
CREATE TABLE UserAccount
(
UserID INT IDENTITY(1,1) PRIMARY KEY,
FirstName VARCHAR(200) NOT NULL,
LastName VARCHAR(200) NOT NULL,
Email VARCHAR(200) NOT NULL,
Username VARCHAR(200) UNIQUE,
Password VARCHAR(200) NOT NULL,
ConfirmPassword VARCHAR(200) NOT NULL
) |
/*
control table vs work folders:
--compares Informatica folders against what’s in data control table. This is a FULL OUTER JOIN.
For use in auditing ETL as part of development lifecycle.
You can use this to compare what is live in a given folder as compared with some arbitrary list (here CTE "b")
*/
with
a as
(select distinct infa.task_name, c.subj_name FROM PC_REPO.OPB_TASK infa, PC_REPO.OPB_SUBJECT c where infa.subject_id = c.subj_id),
b as
(select distinct etl.infamap_bulk_workflow_name from YOUR_INFORMATICA_CONTROL_TABLE etl) --ideally this table is source controlled and lists the production workflows.
select a.task_name as pcREPO
, a.subj_name as locFolder
, b.infamap_bulk_workflow_name as controlTable
from a
full outer join b
on a.task_name = b.infamap_bulk_workflow_name
where a.TASK_NAME like 'NAMINGCONVENTIONHERE%'
order by 3 desc, 1;
|
-- setc.sql
-- set container
-- 2020 jkstill@gmail.com
--
-- see comments for restrictions on use
/*
usage: @setc [-|con_name|con_id]
-: this will display a list of PDBs
type a con_name or con_id
con_id: switch to this con_id
con_name: switch to this con_name
SQL# @setc 3
V_PDB_MSG
----------------------------------------
Results: Switched Containers
CON_ID CON_NAME
------ ---------------
3 PDB1
===========================================================
SQL# @setc pdb4
V_PDB_MSG
----------------------------------------
Results: Switched Containers
CON_ID CON_NAME
------ ---------------
6 PDB4
===========================================================
SQL# @setc -
CON_ID PDB_NAME
------ --------------------
2 PDB$SEED
3 PDB1
4 PDB2
5 PDB3
6 PDB4
Which PDB?:
1
V_PDB_MSG
----------------------------------------
Results: Switched Containers
CON_ID CON_NAME
------ ---------------
1 CDB$ROOT
===========================================================
SQL# @setc 12
A non-existent PDB was requested
V_PDB_MSG
----------------------------------------
Results: Did NOT Switch Containers
CON_ID CON_NAME
------ ---------------
1 CDB$ROOT
*/
/*
as per 'Security Concepts in Oracle Multitenant'
https://www.oracle.com/technetwork/database/multitenant/learn-more/multitenant-security-concepts-12c-2402462.pdf
"Although developers may think that they can use “execute immediatealter session set container”
to switch between two containers inside a pl/sql procedure, function or package it is blocked
from execution from within a PDB."
this only works when current container is cdb$root
otherwise, 'ORA-01031: insufficient privileges' is raised, even as SYS
SQL#
select
sys_context('userenv','con_id') con_id
, sys_context('userenv','con_name') con_name
4 from dual;
CON_ID CON_NAME
------ ---------------
4 PDB2
1 row selected.
SQL# begin
2 execute immediate 'alter session set container=pdb3';
3 end;
4 /
begin
*
ERROR at line 1:
ORA-01031: insufficient privileges
ORA-06512: at line 2
Due to these restrictions, this script only works with SYS privileges
*/
set feedback off term off pause off echo off
@save-sqlplus-settings
--set serveroutput on size unlimited format word_wrapped
set serveroutput on size unlimited
set feedback off term off verify off echo off pause off
var v_pdb_msg varchar2(60)
exec :v_pdb_msg := 'Results: Switched Containers '
col u_session_container new_value s_session_container noprint format a20
col pdb_name format a20
col con_id format 9999
var v_session_container varchar2(30)
exec :v_session_container:='&1'
-- if the input is '-' display all pdb and prompt for input
--set feed on term on echo on
col u_display_pdbs new_value u_display_pdbs noprint
col u_do_not_display_pdbs new_value u_do_not_display_pdbs noprint
col db_name format a15
col open_mode format a10
col con_name format a15
select
decode(:v_session_container,'-','','--') u_display_pdbs
, decode(:v_session_container,'-','--','') u_do_not_display_pdbs
from dual;
-- reset the value for v_session_container
alter session set container=cdb$root;
set term on
-- specified '-' on the CLI
/*
select
&u_display_pdbs con_id, name pdb_name
&u_do_not_display_pdbs dummy
&u_display_pdbs from v$pdbs order by con_id
&u_do_not_display_pdbs from dual where 0=1
union
select
&u_display_pdbs 1 con_id, 'CDB$ROOT' pdb_name
& u_do_not_display_pdbs 'noop' from dual where 1=0
/
*/
--/*
select
&u_display_pdbs con_id, name pdb_name
&u_do_not_display_pdbs dummy
&u_display_pdbs from v$pdbs
&u_do_not_display_pdbs from dual where 0=1
union
select
&u_display_pdbs 1 con_id, 'CDB$ROOT' pdb_name from dual
& u_do_not_display_pdbs 'noop' from dual where 1=0
order by 1
/
--*/
begin
&u_display_pdbs dbms_output.put_line('Which PDB?: ');
null;
end;
/
set term off
-- specified PDB on CLI
select
&u_do_not_display_pdbs :v_session_container u_session_container
&u_display_pdbs dummy
&u_do_not_display_pdbs from dual
&u_display_pdbs from dual where 0=1
/
-- now set v_session_container to the value from the select
exec :v_session_container:='&s_session_container'
--pause
set term on
declare
not_allowed exception;
pdb_does_not_exist exception;
pragma exception_init(not_allowed,-1031);
pragma exception_init(pdb_does_not_exist,-65011);
-- may be a container number or name
v_container varchar2(30);
v_sql varchar2(200);
begin
if regexp_like(:v_session_container,'^[[:digit:]]+') then
if :v_session_container = '1' then
v_container := 'cdb$root';
else
select name into v_container
from v$pdbs
where con_id = to_number(:v_session_container);
end if;
else
v_container := :v_session_container;
end if;
--dbms_output.put_line('v_container: ' || v_container);
execute immediate 'alter session set container = ' || v_container;
exception
when not_allowed then
dbms_output.put_line('');
dbms_output.put_line('Must be SYS and in CDB$ROOT to change containers in PL/SQL');
dbms_output.put_line('');
:v_pdb_msg := 'Results: Did NOT Switch Containers';
--raise;
when no_data_found or pdb_does_not_exist then
dbms_output.put_line('');
dbms_output.put_line('A non-existent PDB was requested');
dbms_output.put_line('');
:v_pdb_msg := 'Results: Did NOT Switch Containers';
dbms_output.put_line('');
--raise;
when others then
raise;
end;
/
--pause
--select name db_name, open_mode from v$pdbs order by 1;
col v_pdb_msg format a40
print :v_pdb_msg
select
to_number(sys_context('userenv','con_id')) con_id
, sys_context('userenv','con_name') con_name
from dual;
undef 1
undef s_session_container
@restore-sqlplus-settings
set feedback on term on
@remove-sqlplus-settings
|
/*primeiro vou criar o database do prrojeto integrador grupo 5 */
CREATE DATABASE db_rede_social_empowerenergy;
USE db_rede_social_empowerenergy;
/*agora vou criar 3 tabelas do database tb_postagem, tb_tema e tb_usuario*/
CREATE TABLE tb_usuario(
id_usuario BIGINT NOT NULL AUTO_INCREMENT,
nome_usuario VARCHAR (255) NOT NULL,
sobrenome_usuario VARCHAR(255) NOT NULL,
idade_usuario INT NOT NULL,
email_usuario VARCHAR (255) NOT NULL UNIQUE,
senha_usuario VARCHAR(255) NOT NULL,
PRIMARY KEY (id_usuario)
);
CREATE TABLE tb_tema(
id_tema BIGINT NOT NULL AUTO_INCREMENT,
eolica_tema VARCHAR (255) NOT NULL,
hidrica_tema VARCHAR (255) NOT NULL,
biomassa_tema VARCHAR (255) NOT NULL,
solar_tema VARCHAR (255) NOT NULL,
PRIMARY KEY (id_tema)
);
CREATE TABLE tb_postagem(
id_postagem BIGINT NOT NULL AUTO_INCREMENT,
imagem_postagem VARCHAR (255) NOT NULL,
mencao_postagem VARCHAR(255) NOT NULL,
hashtag_postagem VARCHAR(255) NOT NULL,
localizacao_postagem VARCHAR(255)NOT NULL,
fk_id_usuario BIGINT NOT NULL,
fk_id_tema BIGINT NOT NULL,
PRIMARY KEY (id_postagem),
FOREIGN KEY (fk_id_usuario) REFERENCES tb_usuario (id_usuario),
FOREIGN KEY (fk_id_tema) REFERENCES tb_tema (id_tema)
);
|
select
'sigm_txt,' || sub2.sig as sig,
round(count(distinct sub2.eid) / {{n}}, 2) as count_value
from (
select case sub.sig
when 'aws' then 'cloud-provider'
when 'azure' then 'cloud-provider'
when 'batchd' then 'cloud-provider'
when 'cloud-provider-aws' then 'cloud-provider'
when 'gcp' then 'cloud-provider'
when 'ibmcloud' then 'cloud-provider'
when 'openstack' then 'cloud-provider'
when 'vmware' then 'cloud-provider'
else sub.sig
end as sig,
sub.eid
from (
select substring(sel.sig from 17) as sig,
sel.eid
from
(
select event_id as eid,
lower(coalesce(
substring(
body from '(?i)(?:^|\s)+(@kubernetes/sig-[\w\d-]+)(?:-bug|-feature-request|-pr-review|-api-review|-misc|-proposal|-design-proposal|-test-failure|-owners)s?(?:$|[^\w\d-]+)'
),
substring(
body from '(?i)(?:^|\s)+(@kubernetes/sig-[\w\d-]*[\w\d]+)(?:$|[^\w\d-]+)'
)
)) as sig
from
gha_texts
where
(lower(actor_login) {{exclude_bots}})
and created_at >= '{{from}}'
and created_at < '{{to}}'
) sel
where
sel.sig is not null
and sel.sig not in (
'apimachinery', 'api-machiner', 'cloude-provider', 'nework',
'scalability-proprosals', 'storge', 'ui-preview-reviewes',
'cluster-fifecycle', 'rktnetes'
)
and sel.sig not like '%use-only-as-a-last-resort'
) sub
) sub2
where
sub2.sig in (select sig_mentions_texts_name from tsig_mentions_texts)
group by
sub2.sig
order by
count_value desc,
sub2.sig asc
;
|
CREATE TABLE `customers` (
`id` int NOT NULL AUTO_INCREMENT,
`height` int NOT NULL,
`weight` int NOT NULL,
`subscription_idsubscription_fk` int DEFAULT NULL,
`user_details_iduser_details` int DEFAULT NULL,
`coach_idcoach` int DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `id_UNIQUE` (`id`); |
/* add column */
ALTER TABLE mst_animes
ADD COLUMN `tipe` enum('Anime','Live Action') AFTER `tgl_terbit`,
ADD COLUMN `jenis` enum('Series','Movie') AFTER `tipe`;
|
SET @email_template_id := (SELECT id FROM email_template where email_key="Email_PDF_Report_Student");
UPDATE `email_template_lang` SET `body`= '<!DOCTYPE html>
<body>
<style>
body {
background: none repeat scroll 0 0# f4f4f4;
}
div {
display: block;
padding: 15px;
width: 100%;
}
p {
font - family: helvetica, arial, verdana, san - serif;
font - size: 13px;
color: #333;
}
</style>
<div>
<p>Hi $$student_first_name$$ $$student_last_name$$,</p>
<p>Your Student report is now available. Please click the link below to access and view your results.</p>
<p><a href ="$$pdf_report$$">Report view</a><p>
<p>If you believe that you received this email in error or if you have any questions, please contact
$$coordinator_first_name$$ $$coordinator_last_name$$ at $$coordinator_email_address$$.</p>
<p>Thank you.</br>
<img src="$$Skyfactor_Mapworks_logo$$" alt ="Skyfactor Mapworks logo" title ="Skyfactor Mapworks logo" /><p>
</div>
</body>
</html>' WHERE `email_template_id`=@email_template_id; |
-- Pergunta 1
-- Quando foi lançado o primeiro episódio?
select * from data order by season and episode asc limit 1;
-- OU
-- select Season, Episode, Title, Release_date from data order by season and episode asc limit 1; |
--修改内容:抵质押物登记新增字段
--修改人:吴结兵
--修改时间:2012-12-07
--折旧率
DECLARE
VN_COUNT NUMBER;
VC_STR VARCHAR2(1000);
BEGIN
--查看该表中该字段是否存在
SELECT COUNT(*)
INTO VN_COUNT
FROM USER_TAB_COLUMNS
WHERE TABLE_NAME = 'GUA_MORTGAGE_INFO' AND COLUMN_NAME = 'DEPRECIATION_RATE';
--如果小于1则说明不存在,则新增此字段
IF VN_COUNT < 1 THEN
VC_STR := 'alter table gua_mortgage_info add depreciation_rate number(8,6)';
EXECUTE IMMEDIATE VC_STR;
END IF;
END;
/
|
-- phpMyAdmin SQL Dump
-- version 4.8.3
-- https://www.phpmyadmin.net/
--
-- Host: localhost
-- Generation Time: Mar 07, 2020 at 02:57 PM
-- Server version: 5.6.38
-- PHP Version: 7.3.3
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: `book`
--
-- --------------------------------------------------------
--
-- Table structure for table `book_tb`
--
CREATE TABLE `book_tb` (
`id_book` int(11) NOT NULL,
`name_book` varchar(255) NOT NULL,
`category_id` int(11) NOT NULL,
`writer_id` int(11) NOT NULL,
`publication_year` int(11) NOT NULL,
`img` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `book_tb`
--
INSERT INTO `book_tb` (`id_book`, `name_book`, `category_id`, `writer_id`, `publication_year`, `img`) VALUES
(2, 'Structure and Interpretation of Computer Programs', 1, 2, 1979, '5e63a4c018449.jpg'),
(4, 'Norse Gods and Giants', 3, 4, 1967, 'book4.jpeg'),
(5, 'The Illustrated Book of Myths: Tales & Legends of the World', 3, 5, 1995, 'book5.jpg');
-- --------------------------------------------------------
--
-- Table structure for table `category_tb`
--
CREATE TABLE `category_tb` (
`id_cat` int(11) NOT NULL,
`name_cat` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `category_tb`
--
INSERT INTO `category_tb` (`id_cat`, `name_cat`) VALUES
(1, 'Programming Book'),
(2, 'Fiksi'),
(3, 'Myth'),
(4, 'History'),
(5, 'Fiksion'),
(6, 'Lala'),
(7, 'Lizard');
-- --------------------------------------------------------
--
-- Table structure for table `writer_tb`
--
CREATE TABLE `writer_tb` (
`id_writ` int(11) NOT NULL,
`name_writ` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `writer_tb`
--
INSERT INTO `writer_tb` (`id_writ`, `name_writ`) VALUES
(1, 'Andy Hunt'),
(2, 'Hal Abelson'),
(3, 'Jean Lang'),
(4, 'Ingri and Edgar Parin d\'Aulaire'),
(5, 'Neil Philip'),
(6, 'JK Rowling'),
(7, 'Yuval Noah Harari'),
(8, 'Anjay mabar'),
(9, 'Anjay mabar');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `book_tb`
--
ALTER TABLE `book_tb`
ADD PRIMARY KEY (`id_book`),
ADD KEY `cat_foreign` (`category_id`),
ADD KEY `wr_foreign` (`writer_id`);
--
-- Indexes for table `category_tb`
--
ALTER TABLE `category_tb`
ADD PRIMARY KEY (`id_cat`);
--
-- Indexes for table `writer_tb`
--
ALTER TABLE `writer_tb`
ADD PRIMARY KEY (`id_writ`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `book_tb`
--
ALTER TABLE `book_tb`
MODIFY `id_book` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=25;
--
-- AUTO_INCREMENT for table `category_tb`
--
ALTER TABLE `category_tb`
MODIFY `id_cat` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8;
--
-- AUTO_INCREMENT for table `writer_tb`
--
ALTER TABLE `writer_tb`
MODIFY `id_writ` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=10;
--
-- Constraints for dumped tables
--
--
-- Constraints for table `book_tb`
--
ALTER TABLE `book_tb`
ADD CONSTRAINT `cat_foreign` FOREIGN KEY (`category_id`) REFERENCES `category_tb` (`id_cat`) ON DELETE CASCADE,
ADD CONSTRAINT `wr_foreign` FOREIGN KEY (`writer_id`) REFERENCES `writer_tb` (`id_writ`) ON DELETE CASCADE;
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
alter table valintatapajonot alter column prioriteetti set not null;
alter table valintatapajonot alter column hyvaksytty set not null;
alter table valintatapajonot alter column varalla set not null;
alter table valintatapajonot alter column kaikki_ehdon_tayttavat_hyvaksytaan set not null;
alter table valintatapajonot alter column kaikki_ehdon_tayttavat_hyvaksytaan set default false;
alter table valintatapajonot alter column poissaoleva_taytto set not null;
alter table valintatapajonot alter column poissaoleva_taytto set default false;
alter table valintatapajonot alter column ei_varasijatayttoa set not null;
alter table valintatapajonot alter column ei_varasijatayttoa set default false;
alter table valintatapajonot alter column varasijat drop not null;
alter table valintatapajonot alter column varasijatayttopaivat drop not null;
alter table jonosijat alter column sijoitteluajo_id set not null;
alter table jonosijat alter column hakukohde_oid set not null;
alter table jonosijat alter column onko_muuttunut_viime_sijoittelussa set not null;
alter table jonosijat alter column onko_muuttunut_viime_sijoittelussa set default false;
alter table jonosijat alter column tasasijajonosija set not null;
alter table jonosijat alter column hyvaksytty_harkinnanvaraisesti set not null;
alter table jonosijat alter column hyvaksytty_harkinnanvaraisesti set default false;
alter table jonosijat alter column siirtynyt_toisesta_valintatapajonosta set not null;
alter table jonosijat alter column siirtynyt_toisesta_valintatapajonosta set default false;
alter table valinnantulokset alter column julkaistavissa set default false;
alter table valinnantulokset alter column ehdollisesti_hyvaksyttavissa set default false;
alter table valinnantulokset alter column hyvaksytty_varasijalta set default false;
alter table valinnantulokset alter column hyvaksy_peruuntunut set default false;
alter table hakijaryhmat drop COLUMN paikat;
alter table hakijaryhmat drop COLUMN alin_hyvaksytty_pistemaara;
alter table hakijaryhmat alter column prioriteetti set not null;
alter table hakijaryhmat alter column kiintio set not null;
alter table hakijaryhmat alter column kayta_kaikki set not null;
alter table hakijaryhmat alter column tarkka_kiintio set not null;
alter table hakijaryhmat alter column kaytetaan_ryhmaan_kuuluvia set not null;
alter table hakijaryhmat alter column sijoitteluajo_id set not null;
alter table hakijaryhmat alter column hakukohde_oid set not null;
|
INSERT INTO INTERESAN (ID_OFERTA, DOC_CLIENTE, TIPO_DOC_CLIENTE)
VALUES ('685921742', '9828347','CE');
INSERT INTO INTERESAN (ID_OFERTA, DOC_CLIENTE, TIPO_DOC_CLIENTE)
VALUES ('979581516', '4563203','CC');
INSERT INTO INTERESAN (ID_OFERTA, DOC_CLIENTE, TIPO_DOC_CLIENTE)
VALUES ('612867047', '75695439','PA');
INSERT INTO INTERESAN (ID_OFERTA, DOC_CLIENTE, TIPO_DOC_CLIENTE)
VALUES ('215215533', '1000709438','TI');
INSERT INTO INTERESAN (ID_OFERTA, DOC_CLIENTE, TIPO_DOC_CLIENTE)
VALUES ('837833864', '54384093','CC'); |
DROP SEQUENCE PRODUCT_SEQ;
CREATE SEQUENCE PRODUCT_SEQ
START WITH 1
INCREMENT BY 1
MAXVALUE 999999
NOCYCLE
NOCACHE;
DROP TABLE PRODUCT;
CREATE TABLE PRODUCT
(
PNO NUMBER PRIMARY KEY,
PNAME VARCHAR2(50) NOT NULL,
PIMAGE VARCHAR2(100),
PPRICE NUMBER NOT NULL,
PCATEGORY VARCHAR2(50),
PTAG VARCHAR2(100),
PDISRATE NUMBER,
MNO NUMBER REFERENCES MEMBER (MNO)
);
|
select c.day,sum(c.directorder) as `宫格支付直接订单`
from
(select to_date(a.orderdate) as day,round(count(distinct a.orderid)*0.85,0) as directorder
from
dw_htlmaindb.FactHotelOrder_All_Inn a
where to_date(a.orderdate)>='2017-06-01' and to_date(a.orderdate)<='2018-06-28'and a.d='2018-06-28'
group by to_date(a.orderdate)
union all
select b1.day,count(distinct b1.ctriporderid) as directorder
from
(select to_date(a.createtime) as day,a.ctriporderid,datediff(to_date(a.checkout),to_date(a.checkin))*(a.quantity) as output,a.totalamount,
case when a.statusId in (11,19) OR (a.statusId = 13 AND a.paymentStatusId = 3) then '预订成功'
when (a.statusId = 12 AND a.vendorId != 108) OR (a.vendorId = 108 AND a.paymentStatusId = 2) or (a.vendorid !=108 and a.statusid=7) then '房东拒单'
when a.statusid in (11,10,19)
or (a.paymentstatusid in (2,3))
or (a.statusid=12 and a.vendorid!=108)
or (a.statusId = 13 AND a.paymentStatusId = 3) then '支付成功'
when a.statusid=7 then '房东拒绝'
when a.statusid=8 then '未支付未确认'
when a.statusid=10 then '已支付未确认'
when a.statusid=12 then '其他原因关闭'
when a.statusid=13 then '用户关闭'
when a.statusid=19 then '已完成'
when a.statusid=9 then '已确认未支付'
else '其他' end as orderstatus
from
ods_htl_groupwormholedb.bnb_order a
where
a.d='2018-06-28' and to_date(a.createtime)<='2018-06-28' and to_date(a.createtime)>='2018-06-28'-8
and a.saleamount>=20 )b1 where b1.orderstatus in('预订成功','房东拒单','支付成功')
group by b1.day--------老订单支付成功订单-----------
union all
select b2.day,count(distinct b2.ctriporderid) as directorder
from
(select to_date(b1.createdtime) as day,a1.orderid as ctriporderid,a1.saleamount,datediff(to_date(c1.checkout),to_date(c1.checkin))*(a1.quantity) as output
from
ods_htl_bnborderdb.order_item a1
left join ods_htl_bnborderdb.order_header_v2 b1 on a1.orderid=b1.orderid and b1.d='2018-06-28'
left join ods_htl_bnborderdb.order_item_space c1 on c1.orderitemid=a1.orderitemid and c1.d='2018-06-28'
where to_date(b1.createdtime)<='2018-06-28'and to_date(b1.createdtime)>='2018-06-28'
and a1.saleamount>=20 and a1.d='2018-06-28' and uid not in('$seller-agent') and
b1.visitsource not in (13,14,18) and
(a1.statusid like '12%' or a1.statusid like '20%' or a1.statusid like '22%' or a1.statusid like '23%') ) b2
group by b2.day)c
group by c.day |
DROP TABLE "public"."SkillTopic";
|
/*
Name: Number of actions coming from referrers...
Data source: 4
Created By: Admin
Last Update At: 2016-03-17T19:03:37.400949+00:00
*/
SELECT v.Referrer_domain AS Referrer_domain,
count(*) AS Number_of_actions,
FROM
(SELECT *
FROM
( SELECT LOWER(CASE WHEN ref_domain = '' THEN 'no referrer domain' ELSE ref_domain END) As Referrer_domain,
/*LOWER(ref_domain) AS Referrer_domain,*/
visit_page_num,
visid_high,
visid_low,
visit_num
FROM (TABLE_QUERY(djomniture:cipomniture_djmansionglobal,'CONCAT(REPLACE(table_id,"_","-"),"-01") BETWEEN STRFTIME_UTC_USEC("{{startdate}}", "%Y-%m-01") and STRFTIME_UTC_USEC("{{enddate}}", "%Y-%m-31")')))v
JOIN
(SELECT visid_high,
visid_low,
visit_num,
post_prop19,
visit_page_num
FROM (TABLE_QUERY(djomniture:cipomniture_djmansionglobal,'CONCAT(REPLACE(table_id,"_","-"),"-01") BETWEEN STRFTIME_UTC_USEC("{{startdate}}", "%Y-%m-01") and STRFTIME_UTC_USEC("{{enddate}}", "%Y-%m-31")'))
WHERE DATE(date_time) >= DATE('{{startdate}}')
AND DATE(date_time) <= DATE('{{enddate}}')
AND (post_prop13 = 'LeadSubmited')
/*AND post_prop19 = 'home'*/ ) AS det ON det.visid_high = v.visid_high
AND det.visid_low = v.visid_low
AND det.visit_num = v.visit_num)
WHERE v.visit_page_num = '1'
GROUP BY Referrer_domain
ORDER BY Number_of_actions DESC
|
-- MySQL Script generated by MySQL Workbench
-- Fri Feb 2 15:50:00 2018
-- Model: New Model Version: 1.0
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
-- -----------------------------------------------------
CREATE SCHEMA IF NOT EXISTS `mydb` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ;
-- -----------------------------------------------------
-- Schema new_schema1
-- -----------------------------------------------------
USE `mydb` ;
-- -----------------------------------------------------
-- Table `mydb`.`Expenses`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `mydb`.`Expenses` (
)
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `mydb`.`Category`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `mydb`.`Category` (
`idCategory` INT NOT NULL,
`name` VARCHAR(45) NULL,
`description` VARCHAR(150) NULL,
PRIMARY KEY (`idCategory`),
UNIQUE INDEX `idCategory_UNIQUE` (`idCategory` ASC))
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `mydb`.`Subcategory`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `mydb`.`Subcategory` (
`idSubcategory` INT NOT NULL,
`idCategoryFk` VARCHAR(45) NOT NULL,
`name` VARCHAR(45) NULL,
PRIMARY KEY (`idSubcategory`),
UNIQUE INDEX `idSubcategory_UNIQUE` (`idSubcategory` ASC),
UNIQUE INDEX `idCategoryFk_UNIQUE` (`idCategoryFk` ASC),
CONSTRAINT `fkCategory`
FOREIGN KEY (`idSubcategory`)
REFERENCES `mydb`.`Category` (`idCategory`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `mydb`.`table1`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `mydb`.`table1` (
)
ENGINE = InnoDB;
USE `mydb` ;
-- -----------------------------------------------------
-- Placeholder table for view `mydb`.`view1`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `mydb`.`view1` (`id` INT);
-- -----------------------------------------------------
-- routine1
-- -----------------------------------------------------
DELIMITER $$
USE `mydb`$$
CREATE PROCEDURE `routine1` ()
BEGIN
END$$
DELIMITER ;
-- -----------------------------------------------------
-- View `mydb`.`view1`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `mydb`.`view1`;
USE `mydb`;
SET SQL_MODE=@OLD_SQL_MODE;
SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;
|
DROP TABLE IF EXISTS `userparentguardians`;
|
create or replace view v1_MQ_337_2 as
select jsde303 VoucherId,hdde254 RepaymentId,de061 DepartMentName,de281 CreditCardUser,jsde329 CreditCardNo,jsde336 CostId,jsde332 CostDate,hdde132 CostMoney,de181 Amount from hdcs019 where nvl(jsde940,'9') <> '1' and de022 = 110108
order by jsde303,hdde254
/*
VoucherId 流水号
RepaymentId 明细流水号
DepartMentName 部门
CreditCardUser 持卡人姓名
CreditCardNo 卡号
CostId 交易授权号
CostDate 交易日期
CostMoney 交易金额
Amount 还款金额
*/
|
-- Query 1: Top 10 Countries who purchased Metal Genre
SELECT
i.BillingCountry Country,
COUNT(*) MetalGenre_Purchased
FROM Invoice i
JOIN InvoiceLine iL
ON i.InvoiceId = iL.InvoiceId
JOIN Track t
ON iL.TrackId = t.TrackId
JOIN Genre g
ON t.GenreId = g.Genreid
WHERE g.Name = 'Metal'
GROUP BY i.BillingCountry
ORDER BY MetalGenre_Purchased DESC, i.BillingCountry
LIMIT 10; |
use TelerikAcademy;
select FirstName, LastName, AddressText from Employees e, Addresses a
where a.AddressID = e.AddressId;
|
WITH order_payments AS (
SELECT order_id, SUM(payment_value) payment
FROM ecommerce_by_olist.olist_order_payments_dataset
GROUP BY order_id
)
, orders AS (
SELECT o.order_id, o.customer_id, o.order_status, o.order_delivered_customer_date,
EXTRACT(DATE FROM order_delivered_customer_date) order_delivered_customer_date_,
EXTRACT(YEAR FROM order_delivered_customer_date) order_delivered_customer_year,
EXTRACT(MONTH FROM order_delivered_customer_date) order_delivered_customer_month,
CASE WHEN CAST(EXTRACT(MONTH FROM order_delivered_customer_date) AS int64) < 10
THEN CAST(
CONCAT(
CONCAT(EXTRACT(YEAR FROM order_delivered_customer_date),
'0'),
EXTRACT(MONTH FROM order_delivered_customer_date)
) AS int64
)
ELSE CAST(
CONCAT(
EXTRACT(YEAR FROM order_delivered_customer_date),
EXTRACT(MONTH FROM order_delivered_customer_date)
) AS int64
)
END order_delivered_ym,
op.payment
FROM ecommerce_by_olist.olist_orders_dataset AS o
LEFT JOIN order_payments AS op
ON o.order_id = op.order_id
)
-- SELECT * FROM orders;
SELECT order_delivered_customer_date_,
COUNT(order_id) order_quantity,
ROUND(
COUNT(order_id)/
LAG(COUNT(order_id), 7)
OVER (ORDER BY order_delivered_customer_date_)
, 2) order_quantity_per_7day,
ROUND(
COUNT(order_id)/
LAG(COUNT(order_id), 28)
OVER (ORDER BY order_delivered_customer_date_)
, 2) order_quantity_per_28day,
ROUND(
COUNT(order_id)/
LAG(COUNT(order_id), 365)
OVER (ORDER BY order_delivered_customer_date_)
, 2) order_quantity_per_1year,
COUNT(customer_id) customer_quantity,
ROUND(
COUNT(customer_id)/
LAG(COUNT(customer_id), 7)
OVER (ORDER BY order_delivered_customer_date_)
, 2) customer_quantity_per_7day,
ROUND(
COUNT(customer_id)/
LAG(COUNT(customer_id), 28)
OVER (ORDER BY order_delivered_customer_date_)
, 2) customer_quantity_per_28day,
ROUND(
COUNT(customer_id)/
LAG(COUNT(customer_id), 365)
OVER (ORDER BY order_delivered_customer_date_)
, 2) customer_quantity_per_1year,
ROUND(SUM(payment), 2) revenue,
ROUND(
SUM(payment)/
LAG(SUM(payment), 7)
OVER (ORDER BY order_delivered_customer_date_)
, 2) revenue_per_7day,
ROUND(
SUM(payment)/
LAG(SUM(payment), 28)
OVER (ORDER BY order_delivered_customer_date_)
, 2) revenue_per_28day,
ROUND(
SUM(payment)/
LAG(SUM(payment), 365)
OVER (ORDER BY order_delivered_customer_date_)
, 2) revenue_per_1year
FROM orders
WHERE order_status = 'delivered'
AND order_delivered_customer_date IS NOT NULL
AND order_delivered_customer_date >= '2017-01-01 00:00:00'
AND order_delivered_customer_date < '2018-09-01 00:00:00'
GROUP BY order_delivered_customer_date_
ORDER BY order_delivered_customer_date_;
|
create or replace package body WXHPCK_WZ is
/**
-- author :���º� ����������Ϣ�Ѽ�
-- purpose :<b> new package is WXHPCK_WZ_HANDLE</b>
*/
function get_oss_changed(ip_so_nbr varchar2
,ip_pt_sys varchar2
,ip_arclevle varchar2 default null) return varchar2 is
lv_chg varchar2(200);
lv_old varchar2(1000);
lv_new varchar2(1000);
begin
if ip_arclevle is null then
begin
select name
into lv_chg
from so t, chg_serv_spec u
where t.so_nbr = ip_so_nbr
and t.sts = 'A'
and t.chg_serv_spec_id = u.chg_serv_spec_id
and t.chg_serv_spec_id IN ('1', '12');
return lv_chg;
exception
when others then
if ip_pt_sys IN ('kd', 'IPTV') then
--'144'
select (select max(u.spec_prpty_value)
from so_main_prod t, so_main_prod_prpty u
where t.so_main_prod_id = u.so_main_prod_id
and t.so_nbr = ip_so_nbr
and u.spec_prpty_id = '144'
and t.sts = 'A'
and u.sts = 'A'
and (t.no_flag = 'A' or (t.no_flag = 'P' and t.act_type = 'R')))
,(select max(u.spec_prpty_value)
from so_main_prod t, so_main_prod_prpty u
where t.so_main_prod_id = u.so_main_prod_id
and t.so_nbr = ip_so_nbr
and u.spec_prpty_id = '144'
and t.sts = 'A'
and u.sts = 'A'
and t.no_flag = 'P')
into lv_new, lv_old
from dual;
if lv_old <> lv_new then
return lv_old || '->' || lv_new;
else
return null;
end if;
elsif ip_pt_sys IN ('IPTVDB') then
--'548'
select (select max(u.spec_prpty_value)
from so_main_prod t, so_main_prod_prpty u
where t.so_main_prod_id = u.so_main_prod_id
and t.so_nbr = ip_so_nbr
and u.spec_prpty_id = '548'
and t.sts = 'A'
and u.sts = 'A'
and (t.no_flag = 'A' or (t.no_flag = 'P' and t.act_type = 'R')))
,(select max(u.spec_prpty_value)
from so_main_prod t, so_main_prod_prpty u
where t.so_main_prod_id = u.so_main_prod_id
and t.so_nbr = ip_so_nbr
and u.spec_prpty_id = '548'
and t.sts = 'A'
and u.sts = 'A'
and t.no_flag = 'P')
into lv_new, lv_old
from dual;
if lv_old <> lv_new then
return lv_old || '->' || lv_new;
else
return null;
end if;
elsif ip_pt_sys IN ('fix', 'ZNW') then
select (select acc_nbr
from so_acc_nbr
where so_nbr = ip_so_nbr
and sts = 'A'
AND NO_FLAG = 'P') --as oldval
,(select acc_nbr
from so_acc_nbr
where so_nbr = ip_so_nbr
and sts = 'A'
AND (NO_FLAG = 'A' or (no_flag = 'P' and act_type = 'R'))) --as newval
into lv_old, lv_new
from dual;
if lv_old <> lv_new then
return lv_old || '->' || lv_new;
else
return null;
end if;
elsif ip_pt_sys in ('CDMA', 'EVDO') then
--'801' imsi��
--'801'
select (select max(u.spec_prpty_value)
from so_main_prod t, so_main_prod_prpty u
where t.so_main_prod_id = u.so_main_prod_id
and t.so_nbr = ip_so_nbr
and u.spec_prpty_id = '801'
and t.sts = 'A'
and u.sts = 'A'
and (t.no_flag = 'A' or (t.no_flag = 'P' and t.act_type = 'R')))
,(select max(u.spec_prpty_value)
from so_main_prod t, so_main_prod_prpty u
where t.so_main_prod_id = u.so_main_prod_id
and t.so_nbr = ip_so_nbr
and u.spec_prpty_id = '801'
and t.sts = 'A'
and u.sts = 'A'
and t.no_flag = 'P')
into lv_new, lv_old
from dual;
if lv_old <> lv_new then
return lv_old || '->' || lv_new;
else
return null;
end if;
else
return '���жϵ�ƽ̨' || ip_pt_sys;
end if;
end;
elsif ip_arclevle = 'arc' then
begin
select name
into lv_chg
from so_arc t, chg_serv_spec u
where t.so_nbr = ip_so_nbr
and t.sts = 'A'
and t.chg_serv_spec_id = u.chg_serv_spec_id
and t.chg_serv_spec_id IN ('1', '12');
return lv_chg;
exception
when others then
if ip_pt_sys IN ('kd', 'IPTV') then
--'144'
select (select max(u.spec_prpty_value)
from so_main_prod_arc t, so_main_prod_prpty_arc u
where t.so_main_prod_id = u.so_main_prod_id
and t.so_nbr = ip_so_nbr
and u.spec_prpty_id = '144'
and t.sts = 'A'
and u.sts = 'A'
and (t.no_flag = 'A' or (t.no_flag = 'P' and t.act_type = 'R')))
,(select max(u.spec_prpty_value)
from so_main_prod_arc t, so_main_prod_prpty_arc u
where t.so_main_prod_id = u.so_main_prod_id
and t.so_nbr = ip_so_nbr
and u.spec_prpty_id = '144'
and t.sts = 'A'
and u.sts = 'A'
and t.no_flag = 'P')
into lv_new, lv_old
from dual;
if lv_old <> lv_new then
return lv_old || '->' || lv_new;
else
return null;
end if;
elsif ip_pt_sys IN ('IPTVDB') then
--'548'
select (select max(u.spec_prpty_value)
from so_main_prod_ARC t, so_main_prod_prpty_ARC u
where t.so_main_prod_id = u.so_main_prod_id
and t.so_nbr = ip_so_nbr
and u.spec_prpty_id = '548'
and t.sts = 'A'
and u.sts = 'A'
and (t.no_flag = 'A' or (t.no_flag = 'P' and t.act_type = 'R')))
,(select max(u.spec_prpty_value)
from so_main_prod_ARC t, so_main_prod_prpty_ARC u
where t.so_main_prod_id = u.so_main_prod_id
and t.so_nbr = ip_so_nbr
and u.spec_prpty_id = '548'
and t.sts = 'A'
and u.sts = 'A'
and t.no_flag = 'P')
into lv_new, lv_old
from dual;
if lv_old <> lv_new then
return lv_old || '->' || lv_new;
else
return null;
end if;
elsif ip_pt_sys IN ('fix', 'ZNW') then
select (select acc_nbr
from so_acc_nbr_arc
where so_nbr = ip_so_nbr
and sts = 'A'
AND NO_FLAG = 'P') --as oldval
,(select acc_nbr
from so_acc_nbr_arc
where so_nbr = ip_so_nbr
and sts = 'A'
AND (NO_FLAG = 'A' or (no_flag = 'P' and act_type = 'R'))) --as newval
into lv_old, lv_new
from dual;
if lv_old <> lv_new then
return lv_old || '->' || lv_new;
else
return null;
end if;
elsif ip_pt_sys in ('CDMA', 'EVDO') then
--'801' imsi��
--'801'
select (select max(u.spec_prpty_value)
from so_main_prod_arc t, so_main_prod_prpty_arc u
where t.so_main_prod_id = u.so_main_prod_id
and t.so_nbr = ip_so_nbr
and u.spec_prpty_id = '801'
and t.sts = 'A'
and u.sts = 'A'
and (t.no_flag = 'A' or (t.no_flag = 'P' and t.act_type = 'R')))
,(select max(u.spec_prpty_value)
from so_main_prod_arc t, so_main_prod_prpty_arc u
where t.so_main_prod_id = u.so_main_prod_id
and t.so_nbr = ip_so_nbr
and u.spec_prpty_id = '801'
and t.sts = 'A'
and u.sts = 'A'
and t.no_flag = 'P')
into lv_new, lv_old
from dual;
if lv_old <> lv_new then
return lv_old || '->' || lv_new;
else
return null;
end if;
else
return '���жϵ�ƽ̨' || ip_pt_sys;
end if;
end;
elsif ip_arclevle = 'his' then
begin
select name
into lv_chg
from so_his t, chg_serv_spec u
where t.so_nbr = ip_so_nbr
and t.sts = 'A'
and t.chg_serv_spec_id = u.chg_serv_spec_id
and t.chg_serv_spec_id IN ('1', '12');
return lv_chg;
exception
when others then
if ip_pt_sys IN ('kd', 'IPTV') then
--'144'
select (select max(u.spec_prpty_value)
from so_main_prod_his t, so_main_prod_prpty_his u
where t.so_main_prod_id = u.so_main_prod_id
and t.so_nbr = ip_so_nbr
and u.spec_prpty_id = '144'
and t.sts = 'A'
and u.sts = 'A'
and (t.no_flag = 'A' or (t.no_flag = 'P' and t.act_type = 'R')))
,(select max(u.spec_prpty_value)
from so_main_prod_his t, so_main_prod_prpty_his u
where t.so_main_prod_id = u.so_main_prod_id
and t.so_nbr = ip_so_nbr
and u.spec_prpty_id = '144'
and t.sts = 'A'
and u.sts = 'A'
and t.no_flag = 'P')
into lv_new, lv_old
from dual;
if lv_old <> lv_new then
return lv_old || '->' || lv_new;
else
return null;
end if;
elsif ip_pt_sys IN ('IPTVDB') then
--'548'
select (select max(u.spec_prpty_value)
from so_main_prod_his t, so_main_prod_prpty_his u
where t.so_main_prod_id = u.so_main_prod_id
and t.so_nbr = ip_so_nbr
and u.spec_prpty_id = '548'
and t.sts = 'A'
and u.sts = 'A'
and (t.no_flag = 'A' or (t.no_flag = 'P' and t.act_type = 'R')))
,(select max(u.spec_prpty_value)
from so_main_prod_his t, so_main_prod_prpty_his u
where t.so_main_prod_id = u.so_main_prod_id
and t.so_nbr = ip_so_nbr
and u.spec_prpty_id = '548'
and t.sts = 'A'
and u.sts = 'A'
and t.no_flag = 'P')
into lv_new, lv_old
from dual;
if lv_old <> lv_new then
return lv_old || '->' || lv_new;
else
return null;
end if;
elsif ip_pt_sys IN ('fix', 'ZNW') then
select (select acc_nbr
from so_acc_nbr_his
where so_nbr = ip_so_nbr
and sts = 'A'
AND NO_FLAG = 'P') --as oldval
,(select acc_nbr
from so_acc_nbr_his
where so_nbr = ip_so_nbr
and sts = 'A'
and (no_flag = 'A' or (no_flag = 'P' and act_type = 'R'))) --as newval
into lv_old, lv_new
from dual;
if lv_old <> lv_new then
return lv_old || '->' || lv_new;
else
return null;
end if;
elsif ip_pt_sys in ('CDMA', 'EVDO') then
--'801' imsi��
--'801'
select (select max(u.spec_prpty_value)
from so_main_prod_his t, so_main_prod_prpty_his u
where t.so_main_prod_id = u.so_main_prod_id
and t.so_nbr = ip_so_nbr
and u.spec_prpty_id = '801'
and t.sts = 'A'
and u.sts = 'A'
and (t.no_flag = 'A' or (t.no_flag = 'P' and t.act_type = 'R')))
,(select max(u.spec_prpty_value)
from so_main_prod_his t, so_main_prod_prpty_his u
where t.so_main_prod_id = u.so_main_prod_id
and t.so_nbr = ip_so_nbr
and u.spec_prpty_id = '801'
and t.sts = 'A'
and u.sts = 'A'
and t.no_flag = 'P')
into lv_new, lv_old
from dual;
if lv_old <> lv_new then
return lv_old || '->' || lv_new;
else
return null;
end if;
else
return '���жϵ�ƽ̨' || ip_pt_sys;
end if;
end;
end if;
end;
function get_servid_#rm_by_acc_nbr(ip_orig_nbr in varchar2
,ip_platform varchar2 default null) return varchar2 is
begin
return rmrd.wxhf_getserv_id_by_acc_nbr@zk_to_zy(ip_orig_nbr
,case when ip_platform = 'sms' then 'fix' else ip_platform end
,ip_orig_nbr);
end;
-- Function and procedure implementations
function get_servid_#sid_attr_itv(ip_attr_val varchar2
,ip_attr_type varchar2) return varchar2 is
result varchar2(100);
begin
select to_char(wm_concat(serv_id))
into result
from (select max(l.serv_id) serv_id
from ls65_sid.serv_attr_t@to_sid l, ls65_sid.serv_t@to_sid r
where /*attr_val = ip_attr_val */(attr_val = ip_attr_val or attr_val = lower(ip_attr_val) or attr_val = upper(ip_attr_val))
and '' || attr_type = ip_attr_type
and l.serv_id = r.serv_id
and l.agreement_id = r.agreement_id
and r.product_id in (90604010, 90604030, 90604020))
where 1 = 1;
return(Result);
end;
function get_servid_#crm_attr_itv(ip_attr_val varchar2
,ip_attr_type varchar2) return varchar2 is
result varchar2(100);
begin
select to_char(wm_concat(serv_id))
into result
from (select max(l.serv_id) serv_id
from LS65_CRM1.p_serv_attr_t@to_crm l, LS65_CRM1.p_serv_t@to_crm r
where /*attr_val = ip_attr_val */(attr_val = ip_attr_val or attr_val = lower(ip_attr_val)or attr_val = upper(ip_attr_val))
and '' || attr_type = ip_attr_type
and l.serv_id = r.serv_id
and l.agreement_id = r.agreement_id
and r.product_id in (90604010, 90604030, 90604020))
where 1 = 1;
return(Result);
end;
function get_servid_#sid_itv(ip_acc_nbr varchar2) return varchar2 is
result varchar2(100);
begin
select to_char(wm_concat(serv_id))
into result
from (select max(r.serv_id) serv_id
from ls65_sid.serv_t@to_sid r
where (acc_nbr = ip_acc_nbr or acc_nbr = lower(ip_acc_nbr) or acc_nbr = upper(ip_acc_nbr) )
and r.product_id in (90604010, 90604030, 90604020))
where 1 = 1;
return(Result);
end;
function get_servid_#comm(ip_acc_nbr varchar2,ip_platform varchar2 default null) return varchar2 is
RET_SERV_ID varchar2(120);
SERV_ID_crm varchar2(120);
AGREEMENT_ID_crm number;
SERV_ID_oss varchar2(120);
AGREEMENT_ID_oss varchar2(120);
CO_NBR_OSS VARCHAR2(120);
lv_serv_state_crm varchar2(120);
fuck_kd_acc varchar2(120);
suffix_kd_acc varchar2(120);
begin
fuck_kd_acc:=regexp_replace(ip_acc_nbr,'@.+');
suffix_kd_acc:=substr(regexp_substr(ip_acc_nbr,'@.+'),1);
select max(serv_id), max(agreement_id), max(serv_state)
into SERV_ID_crm, AGREEMENT_ID_crm, lv_serv_state_crm
from (select r.serv_id, agreement_id, serv_state
from LS65_CRM1.p_serv_t@to_crm r
where suffix_kd_acc is null --���������˺� ȫ��ƥ��
and (acc_nbr = ip_acc_nbr or acc_nbr = lower(ip_acc_nbr) or acc_nbr = upper(ip_acc_nbr))
and agreement_id = (select max(agreement_id) from LS65_CRM1.p_serv_t@to_crm where (acc_nbr = ip_acc_nbr or acc_nbr = lower(ip_acc_nbr) or acc_nbr = upper(ip_acc_nbr)))
union
select r.serv_id, agreement_id, serv_state --ȫ��ƥ��
from LS65_CRM1.p_serv_t@to_crm r
where suffix_kd_acc is null and r.product_id='20201010' and ip_platform='kd'
and (acc_nbr = ip_acc_nbr||'@ADSL' or acc_nbr = lower(ip_acc_nbr)||'@ADSL' or acc_nbr = upper(ip_acc_nbr)||'@ADSL')
and r.agreement_id = (select max(agreement_id) from LS65_CRM1.p_serv_t@to_crm
where (acc_nbr = ip_acc_nbr||'@ADSL' or acc_nbr = lower(ip_acc_nbr)||'@ADSL' or acc_nbr = upper(ip_acc_nbr)||'@ADSL'))
union
select r.serv_id, r.agreement_id, r.serv_state --�Դ�����,һ��ΪADSL ,6��ƥ��
from LS65_CRM1.p_serv_t@to_crm r,LS65_CRM1.p_serv_attr_t@to_crm fuck
where suffix_kd_acc ='@ADSL' and r.product_id='20201010' and ip_platform='kd'
and fuck.agreement_id=r.agreement_id and fuck.serv_id = r.serv_id
and fuck.attr_type = 'LS_FLD_HOST_DOMAIN_NAME' and nvl(fuck.attr_val, 0) = '-1'
and (acc_nbr = ip_acc_nbr or acc_nbr = lower(ip_acc_nbr) or acc_nbr = upper(ip_acc_nbr)
or acc_nbr = fuck_kd_acc or acc_nbr = lower(fuck_kd_acc) or acc_nbr = upper(fuck_kd_acc)
or acc_nbr = fuck_kd_acc||'@ADSL' or acc_nbr = lower(fuck_kd_acc)||'@ADSL' or acc_nbr = upper(fuck_kd_acc)||'@ADSL')
and r.agreement_id = (select max(agreement_id) from LS65_CRM1.p_serv_t@to_crm where
(acc_nbr = ip_acc_nbr or acc_nbr = lower(ip_acc_nbr) or acc_nbr = upper(ip_acc_nbr)
or acc_nbr = fuck_kd_acc or acc_nbr = lower(fuck_kd_acc) or acc_nbr = upper(fuck_kd_acc)
or acc_nbr = fuck_kd_acc||'@ADSL' or acc_nbr = lower(fuck_kd_acc)||'@ADSL' or acc_nbr = upper(fuck_kd_acc)||'@ADSL'))
union
select r.serv_id, r.agreement_id, r.serv_state --�ر��д�����
from LS65_CRM1.p_serv_t@to_crm r,LS65_CRM1.p_serv_attr_t@to_crm fuck
where suffix_kd_acc !='@ADSL' and r.product_id='20201010' and ip_platform='kd'
and fuck.agreement_id=r.agreement_id and fuck.serv_id = r.serv_id
and fuck.attr_type = 'LS_FLD_HOST_DOMAIN_NAME' and nvl(fuck.attr_val, 0) = suffix_kd_acc
and (acc_nbr = fuck_kd_acc or acc_nbr = lower(fuck_kd_acc) or acc_nbr = upper(fuck_kd_acc))
and r.agreement_id = (select max(agreement_id) from LS65_CRM1.p_serv_t@to_crm where (acc_nbr = fuck_kd_acc or acc_nbr = lower(fuck_kd_acc) or acc_nbr = upper(fuck_kd_acc)))
order by serv_id
)
where rownum = 1;
if lv_serv_state_crm LIKE '%F1R%' and ip_platform is null
or SERV_ID_crm is null then
SELECT max(SERV_ID), MAX(CO_NBR)
into SERV_ID_oss, CO_NBR_OSS
from (SELECT to_number(T.SO_NBR) as SO_NBR
,(SELECT SERV_INST_ID
FROM SO
WHERE SO_NBR = T.SO_NBR
AND STS = 'A') SERV_ID
,(SELECT CO_NBR
FROM SO
WHERE SO_NBR = T.SO_NBR
AND STS = 'A') CO_NBR
FROM SO_ACC_NBR T
WHERE (T.ACC_NBR = ip_acc_nbr or T.Acc_Nbr = lower(ip_acc_nbr) or T.acc_nbr = upper(ip_acc_nbr))
AND STS = 'A'
UNION
SELECT to_number(T.SO_NBR) as SO_NBR
,(SELECT SERV_INST_ID
FROM SO_ARC
WHERE SO_NBR = T.SO_NBR
AND STS = 'A') SERV_ID
,(SELECT CO_NBR
FROM SO_ARC
WHERE SO_NBR = T.SO_NBR
AND STS = 'A') CO_NBR
FROM SO_ACC_NBR_ARC T
WHERE (T.ACC_NBR = ip_acc_nbr or T.Acc_Nbr = lower(ip_acc_nbr) or T.acc_nbr = upper(ip_acc_nbr))
AND STS = 'A'
union
SELECT /*+INDEX(t S_A_N_HIS_INX_ACC_NBR)*/
to_number(T.SO_NBR) as SO_NBR
,(SELECT SERV_INST_ID
FROM SO_HIS
WHERE SO_NBR = T.SO_NBR
AND STS = 'A') SERV_ID
,(SELECT CO_NBR
FROM SO_HIS
WHERE SO_NBR = T.SO_NBR
AND STS = 'A') CO_NBR
FROM SPS_DEVHIS.SO_ACC_NBR_HIS T
WHERE (T.ACC_NBR = ip_acc_nbr or T.Acc_Nbr = lower(ip_acc_nbr)or T.acc_nbr = upper(ip_acc_nbr))
AND STS = 'A'
ORDER BY 1 DESC)
where rownum = 1;
if SERV_ID_crm is null then
if SERV_ID_oss is null then
SELECT max(serv_id) into RET_SERV_ID from
(select r.serv_id
from LS65_SID.serv_t@to_sid r
where suffix_kd_acc is null --���������˺� ȫƥ��
and (acc_nbr = ip_acc_nbr or acc_nbr = lower(ip_acc_nbr) or acc_nbr = upper(ip_acc_nbr))
union
select r.serv_id --ȫƥ��
from LS65_SID.serv_t@to_sid r
where suffix_kd_acc is null and r.product_id='20201010' and ip_platform='kd'
and (acc_nbr = ip_acc_nbr||'@ADSL' or acc_nbr = lower(ip_acc_nbr)||'@ADSL' or acc_nbr = upper(ip_acc_nbr)||'@ADSL')
union
select r.serv_id --�Դ�����,һ��ΪADSL ,6��ƥ��
from LS65_SID.serv_t@to_sid r,LS65_SID.serv_attr_t@to_sid fuck
where suffix_kd_acc ='@ADSL' and r.product_id='20201010' and ip_platform='kd'
and fuck.agreement_id=r.agreement_id and fuck.serv_id = r.serv_id
and fuck.attr_type = 'LS_FLD_HOST_DOMAIN_NAME' and nvl(fuck.attr_val, 0) = '-1'
and (acc_nbr = ip_acc_nbr or acc_nbr = lower(ip_acc_nbr) or acc_nbr = upper(ip_acc_nbr)
or acc_nbr = fuck_kd_acc or acc_nbr = lower(fuck_kd_acc) or acc_nbr = upper(fuck_kd_acc)
or acc_nbr = fuck_kd_acc||'@ADSL' or acc_nbr = lower(fuck_kd_acc)||'@ADSL' or acc_nbr = upper(fuck_kd_acc)||'@ADSL')
union
select r.serv_id--�ر��д�����
from LS65_SID.serv_t@to_sid r,LS65_SID.serv_attr_t@to_sid fuck
where suffix_kd_acc !='@ADSL' and r.product_id='20201010' and ip_platform='kd'
and fuck.agreement_id=r.agreement_id and fuck.serv_id = r.serv_id
and fuck.attr_type = 'LS_FLD_HOST_DOMAIN_NAME' and nvl(fuck.attr_val, 0) = suffix_kd_acc
and (acc_nbr = fuck_kd_acc or acc_nbr = lower(fuck_kd_acc) or acc_nbr = upper(fuck_kd_acc))
);
return RET_SERV_ID;
else
return SERV_ID_oss;
end if;
else
SELECT max(AGREEMENT_ID)
into AGREEMENT_ID_oss
FROM LS65_CRM1.CUST_INDENT_T@TO_CRM
WHERE CUST_INDENT_NBR = CO_NBR_OSS;
if AGREEMENT_ID_oss > lv_serv_state_crm then
return SERV_ID_oss;
else
return SERV_ID_crm;
end if;
end if;
else
return SERV_ID_crm;
end if;
end;
----------------------------
function get_servid_#attr_evdo(ip_attr_val varchar2
,ip_attr_type varchar2) return varchar2 is
result varchar2(100);
begin
select to_char(wm_concat(serv_id))
into result
from (select max(l.serv_id) serv_id
from LS65_CRM1.p_serv_attr_t@to_crm l, LS65_CRM1.p_serv_t@to_crm r
where attr_val = ip_attr_val
and '' || attr_type = ip_attr_type
and l.serv_id = r.serv_id
and l.agreement_id = r.agreement_id
and r.product_id in (10501110))
where 1 = 1;
if result LIKE '%,%'
or to_number(result) > 0 then
return result;
else
select to_char(wm_concat(serv_id))
into result
from (select max(l.serv_id) serv_id
from ls65_sid.serv_attr_t@to_sid l, ls65_sid.serv_t@to_sid r
where attr_val = ip_attr_val
and '' || attr_type = ip_attr_type
and l.serv_id = r.serv_id
and l.agreement_id = r.agreement_id
and r.product_id in (10501110))
where 1 = 1;
return(Result);
end if;
return(null);
end;
-------------------------------
function get_servid_#itv(ip_acc_nbr varchar2
,ip_attr_type varchar2) return varchar2 is
lv_serv_ids varchar2(100);
begin
lv_serv_ids := get_servid_#psid_itv(ip_acc_nbr);
if lv_serv_ids LIKE '%,%'
or to_number(lv_serv_ids) > 0 then
return lv_serv_ids;
else
lv_serv_ids := get_servid_#sid_itv(ip_acc_nbr);
if lv_serv_ids LIKE '%,%'
or to_number(lv_serv_ids) > 0 then
return lv_serv_ids;
else
lv_serv_ids := get_servid_#crm_attr_itv(ip_acc_nbr, ip_attr_type);
if lv_serv_ids LIKE '%,%'
or to_number(lv_serv_ids) > 0 then
return lv_serv_ids;
else
lv_serv_ids := get_servid_#sid_attr_itv(ip_acc_nbr, ip_attr_type);
if lv_serv_ids LIKE '%,%'
or to_number(lv_serv_ids) > 0 then
return lv_serv_ids;
else
return null;
end if;
end if;
end if;
end if;
end;
function get_servid_#psid_itv(ip_acc_nbr varchar2) return varchar2 is
result varchar2(100);
begin
select to_char(wm_concat(serv_id))
into result
from (select max(r.serv_id) serv_id
from LS65_CRM1.p_serv_t@to_crm r
where (acc_nbr = ip_acc_nbr or acc_nbr = lower(ip_acc_nbr) or acc_nbr = upper(ip_acc_nbr))
and r.product_id in (90604010, 90604030, 90604020))
where 1 = 1;
return(Result);
end;
---������ʷ���� CRM��serv_id
function get_doing_#servid(ip_serv_id varchar2
,ip_attr_type varchar2) return varchar2 is
result varchar2(4000);
begin
return hbwh_boss.FIND_CRM_ADD_DEL_CHG_FUL@to_crm(ip_serv_id, ip_attr_type);
return(Result);
end;
function get_doing_#servid_crm_p_serv_t(ip_acc_nbr varchar2
,ip_attr_type varchar2) return varchar2 is
result varchar2(4000);
begin
select to_char(wm_concat(serv_id_do))
into result
from (select max(hbwh_boss.FIND_CRM_ADD_DEL_CHG_FUL@to_crm(r.serv_id, ip_attr_type)) as serv_id_do
from LS65_CRM1.p_serv_t@to_crm r
where acc_nbr = ip_acc_nbr
and r.product_id in (90604010, 90604030, 90604020))
where 1 = 1;
return(Result);
end;
---������ʷ���� sid��serv_id
function get_doing_#servid_sid_serv_t(ip_acc_nbr varchar2
,ip_attr_type varchar2) return varchar2 is
result varchar2(4000);
begin
select to_char(wm_concat(serv_id_do))
into result
from (select max(hbwh_boss.FIND_CRM_ADD_DEL_CHG_FUL@to_crm(r.serv_id, ip_attr_type)) as serv_id_do
from ls65_sid.serv_t@to_sid r
where acc_nbr = ip_acc_nbr
and r.product_id in (90604010, 90604030, 90604020))
where 1 = 1;
return(Result);
end;
function get_doing_#sid_attr_itv(ip_attr_val varchar2
,ip_attr_type varchar2) return varchar2 is
result varchar2(4000);
begin
select to_char(wm_concat(serv_id_do))
into result
from (select max(hbwh_boss.FIND_CRM_ADD_DEL_CHG_FUL@to_crm(l.serv_id, ip_attr_type)) serv_id_do
from LS65_CRM1.p_serv_attr_t@to_crm l, LS65_CRM1.p_serv_t@to_crm r
where attr_val = ip_attr_val
and '' || attr_type = ip_attr_type
and l.serv_id = r.serv_id
and l.agreement_id = r.agreement_id
and r.product_id in (90604010, 90604030, 90604020))
where 1 = 1;
return(Result);
end;
function get_doing_#crm_attr_itv(ip_attr_val varchar2
,ip_attr_type varchar2) return varchar2 is
result varchar2(4000);
begin
select to_char(wm_concat(serv_id_do))
into result
from (select max(hbwh_boss.FIND_CRM_ADD_DEL_CHG_FUL@to_crm(l.serv_id, ip_attr_type)) serv_id_do
from LS65_CRM1.p_serv_attr_t@to_crm l, LS65_CRM1.p_serv_t@to_crm r
where attr_val = ip_attr_val
and '' || attr_type = ip_attr_type
and l.serv_id = r.serv_id
and l.agreement_id = r.agreement_id
and r.product_id in (90604010, 90604030, 90604020))
where 1 = 1;
return(Result);
end;
function C#yjg(ip_serv_id varchar2
,ip_nbr varchar2) return boolean as
RET int;
begin
select count(1)
into ret
from LS65_sid.serv_t@to_sid
where serv_id = ip_serv_id
and acc_nbr = ip_Nbr
and ((state in ('F00','F0A') AND SERV_STATE IN ('F1A', 'F1N')));
if ret > 0 then
return true;
else
if ip_nbr LIKE '4600%' then
select count(1)
into ret
from LS65_sid.serv_t@to_sid a, LS65_sid.serv_attr_t@to_sid b
where a.serv_id = ip_serv_id
and b.serv_id = a.serv_id
and b.agreement_id = a.agreement_id
and b.attr_type = 'LS_FLD_MOBILE_IMSI'
and b.attr_val = ip_nbr
and ((a.state in ('F00','F0A') AND a.SERV_STATE IN ('F1A', 'F1N')));
end if;
return ret > 0;
end if;
end;
function get_accnbr_#by_id(ip_serv_id varchar2) return varchar2 as
RET VARCHAR2(100);
begin
select acc_nbr
INTO RET
from LS65_sid.serv_t@to_sid
where serv_id = ip_serv_id
and ((state = 'F0A' and serv_state <> 'F1R')
--or (state='F00' AND SERV_STATE='F1A')
) --19042804467(F00/F1A)
;
RETURN RET;
exception
when no_data_found then
return null;
when TOO_MANY_ROWS then
return '-1';
when others then
return '-2';
end;
function get_phynbr_#by_id(ip_serv_id varchar2) return varchar2 as
RET VARCHAR2(100);
begin
select physics_nbr
INTO RET
from LS65_sid.serv_t@to_sid
where serv_id = ip_serv_id
and ((state = 'F0A' and serv_state <> 'F1R')
--or (state='F00' AND SERV_STATE='F1A')
) --19042804467(F00/F1A)
;
RETURN RET;
exception
when no_data_found then
return null;
when TOO_MANY_ROWS then
return '-1';
when others then
return '-2';
end;
function get_P_accnbr_#by_id(ip_agreement_id number
,ip_serv_id varchar2) return varchar2 as
RET VARCHAR2(100);
begin
select max(acc_nbr)
INTO RET
from ls65_crm1.p_serv_t@to_crm
where serv_id = ip_serv_id
and agreement_id = ip_agreement_id;
RETURN RET;
exception
when no_data_found then
return null;
when TOO_MANY_ROWS then
return '-1';
when others then
return '-2';
end;
function get_servid_#by_spec_value(ip_attr_val varchar2
,ip_spec_prpty_id varchar2
,op_agreement_id out number) return number is
lv_serv_id number;
lv_co_nbr varchar2(20);
val_trans varchar2(100);
begin
---ֻ����δ�鵵��,�ѹ鵵��Ӧ������CRM��,Ӧ��CRM������
rollback;
begin
SELECT /*+INDEX(a SO_MAIN_PROD_VAL_INX)*/
serv_inst_id, co_nbr
into lv_serv_id, lv_co_nbr
FROM (SELECT b.serv_inst_id, c.co_nbr
FROM so_main_prod_prpty a, so_main_prod b, so c, SPEC_PRPTY CORD
where a.spec_prpty_id = ip_spec_prpty_id
and b.so_main_prod_id = a.so_main_prod_id
and a.spec_prpty_value = ip_attr_val
and b.so_nbr = c.so_nbr
AND CORD.NAME = A.SPEC_PRPTY_NAME AND A.SPEC_PRPTY_ID = CORD.SPEC_PRPTY_ID AND CORD.SPEC_PRPTY_ID = ip_spec_prpty_id
order by c.co_nbr desc)
where rownum = 1;
select agreement_id
into op_agreement_id
from LS65_CRM1.cust_indent_t@to_crm
where cust_indent_nbr = lv_co_nbr
and rownum = 1;
return lv_serv_id;
exception
when no_data_found then
if ip_spec_prpty_id = '801' then
val_trans := tool_trans_Imsi2ICCID(ip_attr_val);
begin
SELECT /*+INDEX(a SO_MAIN_PROD_VAL_INX)*/
serv_inst_id, co_nbr
into lv_serv_id, lv_co_nbr
FROM (SELECT b.serv_inst_id, c.co_nbr
FROM so_main_prod_prpty a, so_main_prod b, so c, SPEC_PRPTY CORD
where a.spec_prpty_id = '800'
and b.so_main_prod_id = a.so_main_prod_id
and a.spec_prpty_value = val_trans
and b.so_nbr = c.so_nbr
AND CORD.NAME = A.SPEC_PRPTY_NAME AND A.SPEC_PRPTY_ID = CORD.SPEC_PRPTY_ID AND CORD.SPEC_PRPTY_ID = ip_spec_prpty_id
order by c.co_nbr desc)
where rownum = 1;
select agreement_id
into op_agreement_id
from LS65_CRM1.cust_indent_t@to_crm
where cust_indent_nbr = lv_co_nbr
and rownum = 1;
return lv_serv_id;
exception
when others then
null;
end;
else
null;
end if;
when others then
null;
end;
op_agreement_id := null;
return null;
end;
function get_servid_#by_crm_attr(ip_attr_val varchar2
,ip_attr_type varchar2
,op_agreement_id out number) return varchar2 as
lv_servid_crm number;
lv_servid_sid number;
lv_servid_oss number;
lv_serv_state VARCHAR2(20);
lv_spec_prpty_id varchar2(24);
lv_agrement_id_crm number;
lv_agrement_id_sid number;
lv_agrement_id_oss number;
lv_ICCID varchar2(32) := null;
begin
if ip_attr_val LIKE '4600%'
and ip_attr_type = 'LS_FLD_MOBILE_IMSI' then
lv_ICCID := tool_trans_Imsi2ICCID(ip_attr_val);
end if;
select max(serv_id), max(agreement_id)
INTO lv_servid_crm, lv_agrement_id_crm
from (select serv_id, agreement_id
from LS65_crm1.p_serv_attr_t@to_crm crm
where attr_val = ip_attr_val
and attr_type = ip_attr_type
and agreement_id = (select max(agreement_id)
from LS65_crm1.p_serv_attr_t@to_crm
where attr_val = ip_attr_val
and attr_type = ip_attr_type)
union
select serv_id, agreement_id
from LS65_crm1.p_serv_attr_t@to_crm crm
where lv_ICCID is not null
and attr_val = lv_ICCID
and attr_type = 'LS_FLD_MOBILE_NBR'
and agreement_id = (select max(agreement_id)
from LS65_crm1.p_serv_attr_t@to_crm
where attr_val = lv_ICCID
and lv_ICCID is not null
and attr_type = 'LS_FLD_MOBILE_NBR')
order by agreement_id desc)
where rownum = 1;
if lv_servid_crm is null then
select max(serv_id), max(agreement_id)
INTO lv_servid_crm, lv_agrement_id_crm
from LS65_sid.serv_t@to_sid t
where (acc_nbr = ip_attr_val or acc_nbr = lower(ip_attr_val) or acc_nbr = upper(ip_attr_val))
and product_id in (90604010, 90604030, 90604020)
and agreement_id = (select max(z.agreement_id)
from LS65_sid.serv_t@to_sid z
where (z.acc_nbr = ip_attr_val or z.acc_nbr = lower(ip_attr_val) or z.acc_nbr = upper(ip_attr_val))
and z.product_id in (90604010, 90604030, 90604020));
end if;
select nvl(max(serv_state), 'F1R')
into lv_serv_state
from LS65_CRM1.p_serv_t@to_crm
where serv_id = lv_servid_crm
and agreement_id = lv_agrement_id_crm
and lv_agrement_id_crm > 0;
if lv_serv_state = 'F1R'
or lv_servid_crm is null then
---P����
---ȡoss����
SELECT max(spec_prpty_id)
into lv_spec_prpty_id
FROM spec_prpty
where standard_code = ip_attr_type
and ip_attr_type LIKE 'LS\_%' escape '\';
lv_servid_oss := get_servid_#by_spec_value(ip_attr_val, lv_spec_prpty_id, lv_agrement_id_oss);
if lv_servid_crm is null then
if lv_servid_oss is null then
--������
select max(serv_id), max(agreement_id)
INTO lv_servid_sid, lv_agrement_id_sid
from LS65_sid.serv_attr_t@to_sid sid
where attr_val = ip_attr_val
and attr_type = ip_attr_type
and agreement_id = (select max(agreement_id)
from LS65_sid.serv_attr_t@to_sid
where attr_val = ip_attr_val
and attr_type = ip_attr_type)
and rownum = 1;
op_agreement_id := lv_agrement_id_sid;
return lv_servid_sid;
else
op_agreement_id := lv_agrement_id_oss;
return lv_servid_oss;
end if;
else
if lv_agrement_id_oss > lv_agrement_id_crm then
op_agreement_id := lv_agrement_id_oss;
return lv_servid_oss;
else
op_agreement_id := lv_agrement_id_crm;
return lv_servid_crm;
end if;
end if;
else
op_agreement_id := lv_agrement_id_crm;
return lv_servid_crm;
end if;
end;
function get_crm_attr_#by_id_old(ip_agreement_id varchar2
,ip_serv_id varchar2
,ip_attr_type varchar2) return varchar2 as
RET VARCHAR2(100);
begin
select max(A_OBJECT_VALUE)
INTO RET
from LS65_CRM1.CUST_INDENT_ATTR_T@to_crm X
where SECOND_OBJECT_ID = ip_serv_id
and agreement_id = ip_agreement_id
and OPER_XML_FIELD = ip_attr_type;
return ret;
exception
when no_data_found then
return null;
when TOO_MANY_ROWS then
return '-1';
when others then
return '-2';
end;
function get_crm_attr_#by_id_new(ip_agreement_id varchar2
,ip_serv_id varchar2
,ip_attr_type varchar2) return varchar2 as
RET VARCHAR2(100);
begin
select max(N_OBJECT_VALUE)
INTO RET
from LS65_CRM1.CUST_INDENT_ATTR_T@to_crm X
where SECOND_OBJECT_ID = ip_serv_id
and agreement_id = ip_agreement_id
and OPER_XML_FIELD = ip_attr_type;
return ret;
exception
when no_data_found then
return null;
when TOO_MANY_ROWS then
return '-1';
when others then
return '-2';
end;
function get_attr_#by_id(ip_serv_id varchar2
,ip_attr_type varchar2) return varchar2 as
RET VARCHAR2(100);
begin
select acc_nbr
INTO RET
from LS65_sid.serv_t@to_sid
where serv_id = ip_serv_id
and state = 'F0A'
and serv_state <> 'F1R';
--RETURN RET;
select max(attr_val)
INTO RET
from LS65_sid.serv_attr_t@to_sid
where serv_id = ip_serv_id
and state = '00A'
and attr_type = ip_attr_type;
return ret;
exception
when no_data_found then
return null;
when TOO_MANY_ROWS then
return '-1';
when others then
return '-2';
end;
function get_accnbr_#by_orig_nbr(ip_orig_nbr varchar2
,ip_attr_type varchar2) return varchar2 as
lv_serv_id varchar2(100);
lv_acc_nbr varchar2(100);
begin
lv_serv_id := nvl(get_servid_#sid_itv(ip_orig_nbr), 0);
IF not regexp_like(LV_SERV_ID, '^[0-9]+$') THEN
RETURN '+' || LV_SERV_ID;
end if;
if lv_serv_id > 1 then
lv_acc_nbr := get_accnbr_#by_id(lv_serv_id);
else
lv_acc_nbr := null;
end if;
if lv_acc_nbr is not null then
return lv_acc_nbr;
end if;
lv_serv_id := nvl(get_servid_#sid_itv(ip_orig_nbr), 0);
if not regexp_like(LV_SERV_ID, '^[0-9]+$') THEN
RETURN '+' || LV_SERV_ID;
end if;
if lv_serv_id > 1 then
lv_acc_nbr := get_accnbr_#by_id(lv_serv_id);
else
lv_acc_nbr := null;
end if;
if lv_acc_nbr is not null then
return lv_acc_nbr;
end if;
lv_serv_id := nvl(get_servid_#crm_attr_itv(ip_orig_nbr, ip_attr_type), 0);
if not regexp_like(LV_SERV_ID, '^[0-9]+$') THEN
RETURN '+' || LV_SERV_ID;
end if;
if lv_serv_id > 1 then
lv_acc_nbr := get_accnbr_#by_id(lv_serv_id);
else
lv_acc_nbr := null;
end if;
if lv_acc_nbr is not null then
return lv_acc_nbr;
end if;
return null;
end;
function getHis_as_acc_nbr(ip_acc_nbr varchar2) return varchar2 as
ret varchar(4000);
begin
select replace(to_char(wm_concat('agrm_id=' || agreement_id || ',serv_id=' || serv_id || ',cust_id=' || cust_id))
,',agrm_id'
,chr(10) || ',agrm_id')
into ret
from LS65_sid.serv_t@to_sid
where acc_nbr = ip_acc_nbr
and product_id in (90604010, 90604030, 90604020)
order by serv_id, serv_seq_id;
return ret;
end;
function getHis_as_p_acc_nbr(ip_acc_nbr varchar2) return varchar2 as
ret varchar(4000);
begin
select replace(to_char(wm_concat('agrm_id=' || agreement_id || ',serv_id=' || serv_id || ',cust_id=' || cust_id))
,',agrm_id'
,chr(10) || ',agrm_id')
into ret
from LS65_CRM1.p_serv_t@to_crm
where acc_nbr = ip_acc_nbr
and product_id in (90604010, 90604030, 90604020)
order by serv_id, serv_seq_id;
return ret;
end;
function getHis_as_sid_attr_val(ip_attr_val varchar2
,ip_attr_type varchar) return varchar2 as
ret varchar(4000);
begin
select replace(to_char(wm_concat('agrm_id=' || agreement_id || ',serv_id=' || serv_id || ',state=' || state))
,',agrm_id'
,chr(10) || ',agrm_id')
into ret
from ls65_sid.serv_attr_t@to_sid
where attr_val = ip_attr_val
and '' || attr_type = ip_attr_type
order by serv_id, AGREEMENT_ID;
return ret;
end;
function getHis_as_crm_attr_val(ip_attr_val varchar2
,ip_attr_type varchar) return varchar2 as
ret varchar(4000);
begin
select replace(to_char(wm_concat('agrm_id=' || agreement_id || ',serv_id=' || serv_id || ',state=' || state))
,',agrm_id'
,chr(10) || ',agrm_id')
into ret
from LS65_CRM1.p_serv_attr_t@to_crm
where attr_val = ip_attr_val
and '' || attr_type = ip_attr_type
order by serv_id, AGREEMENT_ID;
return ret;
end;
function tool_trans_iccid2Imsi(ip_icc_id varchar2) return varchar2 is
Result varchar2(200);
begin
select IMSI
into result
from HBWH_OSS_ADMIN.MID_UIM_RES_INFO MURI
where muri.icc_id = ip_icc_id
AND MURI.MID_UIM_RES_INFO_ID =
(SELECT MAX(Z.MID_UIM_RES_INFO_ID) FROM HBWH_OSS_ADMIN.MID_UIM_RES_INFO Z WHERE Z.icc_id = ip_icc_id);
return(Result);
exception
when no_data_found then
return null;
when too_many_rows then
return '-2';
when others then
return '-3';
end;
function tool_trans_Imsi2ICCID(ip_IMSI varchar2) return varchar2 is
Result varchar2(200);
begin
select icc_id
into result
from HBWH_OSS_ADMIN.MID_UIM_RES_INFO MURI
where muri.IMSI = ip_IMSI
AND MURI.MID_UIM_RES_INFO_ID =
(SELECT MAX(Z.MID_UIM_RES_INFO_ID) FROM HBWH_OSS_ADMIN.MID_UIM_RES_INFO Z WHERE Z.IMSI = ip_IMSI);
return(Result);
exception
when no_data_found then
return null;
when too_many_rows then
return '-2';
when others then
return '-3';
end;
FUNCTION get_SPJK_CMDs(COM_ACC_NBR VARCHAR2
,ip_serv_id varchar2
,IP_PTLX VARCHAR2) RETURN VARCHAR2 IS
/* LV_WO_NBR NUMBER;
LV_CO_NBR VARCHAR2(1400);
LV_DESC VARCHAR2(400);
LV_COMBO VARCHAR2(4000);
LV_CLASS CHAR(1);
FUNCTION GETFIX_NBR(IPACC_NBR VARCHAR2
,IP_CLASS CHAR) RETURN VARCHAR2 IS
BEGIN
IF IP_CLASS <> 'Y' THEN
RETURN NULL;
END IF;
BEGIN
SELECT WORK_ITEM_ID
,ACC_NBR||DECODE(PARA_OPER, '114060', '��װ', '114061', '����', '114003', '�ĺ�='||PARA_VALUE_OLD||'->'||PARA_VALUE, PARA_OPER) || ' ' ||
TO_CHAR(RECV_TIME, 'yy-mm-dd hh24:mi:ss')
INTO LV_WO_NBR, LV_DESC
FROM (SELECT WORK_ITEM_ID, Z2.PARA_OPER, RECV_TIME,PARA_VALUE_OLD,PARA_VALUE,Z1.ACC_NBR
FROM SPJK_TABLE@JK_WH Z1, SPJK_PARA@JK_WH Z2
WHERE Z1.ACC_NBR = IPACC_NBR
AND Z1.STS = 'C'
AND Z2.SPJK_ID = Z1.SPJK_ID
AND Z2.PARA_OPER IN ('114060', '114061', '114003')
ORDER BY RECV_TIME DESC)
WHERE ROWNUM = 1;
EXCEPTION
WHEN NO_DATA_FOUND THEN
RETURN NULL;
WHEN OTHERS THEN
RETURN SQLERRM;
END;
begin
SELECT CODESC
INTO LV_CO_NBR
FROM (SELECT CO_NBR || '(' || PR.NAME || '/' || CG.NAME || ')' AS CODESC
FROM SO SO, WO WO, PROD PR, CHG_SERV_SPEC CG
WHERE SO.SO_NBR = WO.SO_NBR
AND SO.PROD_ID = PR.PROD_ID
AND CG.CHG_SERV_SPEC_ID = SO.CHG_SERV_SPEC_ID
AND SO.STS = 'A'
AND WO.WO_NBR = LV_WO_NBR
UNION
SELECT CO_NBR || '(' || PR.NAME || '/' || CG.NAME || ')'
FROM SO_ARC SO, WO_ARC WO, PROD PR, CHG_SERV_SPEC CG
WHERE SO.SO_NBR = WO.SO_NBR
AND SO.PROD_ID = PR.PROD_ID
AND CG.CHG_SERV_SPEC_ID = SO.CHG_SERV_SPEC_ID
AND SO.STS = 'A'
AND WO.WO_NBR = LV_WO_NBR
UNION
SELECT CO_NBR || '(' || PR.NAME || '/' || CG.NAME || ')'
FROM SO_HIS SO, WO_HIS WO, PROD PR, CHG_SERV_SPEC CG
WHERE SO.SO_NBR = WO.SO_NBR
AND SO.PROD_ID = PR.PROD_ID
AND CG.CHG_SERV_SPEC_ID = SO.CHG_SERV_SPEC_ID
AND SO.STS = 'A'
AND WO.WO_NBR = LV_WO_NBR)
WHERE ROWNUM = 1;
exception when no_data_found then
RETURN '[����һ��ƽ̨:' || LV_DESC || ']������';
when others then
RETURN '[����һ��ƽ̨:' || LV_DESC || ']'||sqlerrm;
end ;
RETURN LV_CO_NBR || '[����һ��ƽ̨:' || LV_DESC || ']';
EXCEPTION
WHEN NO_DATA_FOUND THEN
RETURN NULL;
WHEN OTHERS THEN
RETURN SQLERRM;
END;
FUNCTION GETAD_NBR(lip_serv_id VARCHAR2
,IP_CLASS CHAR) RETURN VARCHAR2 IS
LV_OP_DATE DATE;
LV_OP VARCHAR2(64);
lv_relate_co_nbr varchar2(120);
lv_sps_spjk_id varchar2(40);
RET VARCHAR2(4000);
BEGIN
if lip_serv_id is null then
BEGIN
SELECT account||DECODE(OPERATE, '3', '����', '2', '����', '4', 'ע��', '16', '����'), FINISH_TIME,order_no
INTO LV_OP, LV_OP_DATE,lv_sps_spjk_id
FROM (SELECT account ||nvl2(domain,'@'||domain,'') account,OPERATE, FINISH_TIME,order_no
FROM JK_163@JK_WH
WHERE( ACCOUNT = LOWER(COM_ACC_NBR)
or account=regexp_replace(LOWER(COM_ACC_NBR),'@.+')
)
AND OPERATE IN (3, 2, 4, 16)
ORDER BY FINISH_TIME DESC)
WHERE ROWNUM = 1
AND IP_CLASS = 'a';
if regexp_like(lv_sps_spjk_id ,'^sps[0-9]+$') then
lv_sps_spjk_id:=substr(lv_sps_spjk_id,4);
select max(co_nbr) into lv_relate_co_nbr from spjk_table st, so so where spjk_id=lv_sps_spjk_id
and so.so_nbr=st.so_nbr and so.sts='A';
if lv_relate_co_nbr is null then
select max(co_nbr) into lv_relate_co_nbr from spjk_table_arc st, so_arc so where spjk_id=lv_sps_spjk_id
and so.so_nbr=st.so_nbr and so.sts='A';
end if;
if lv_relate_co_nbr is null then
select max(co_nbr) into lv_relate_co_nbr from spjk_table_his st, so_his so where spjk_id=lv_sps_spjk_id
and so.so_nbr=st.so_nbr and so.sts='A';
end if;
else
lv_relate_co_nbr:='';
end if;
if lv_relate_co_nbr is null then
lv_relate_co_nbr:=',������';
else
lv_relate_co_nbr:=',������:'||lv_relate_co_nbr;
end if;
RET := RET || LV_OP || '@' || TO_CHAR(LV_OP_DATE, 'yy-mm-dd hh24:mi:ss')||lv_relate_co_nbr||';' ;
EXCEPTION
when no_data_found then
ret:=null;
WHEN OTHERS THEN
RET:=RET||sqlerrm;
END;
return RET;
end if;
FOR REC IN (select lip_serv_id as serv_id from dual
\*SELECT *
FROM ( SELECT SERV_ID, CREATE_DATE
FROM LS65_CRM1.P_SERV_T@TO_CRM
WHERE serv_id=ip_serv_id
AND IP_CLASS IN ('a', 'Y')
union
SELECT SERV_ID, CREATE_DATE
FROM LS65_CRM1.P_SERV_T@TO_CRM
WHERE ACC_NBR = IPACC_NBR
AND IP_CLASS IN ('a', 'Y')
UNION
SELECT SERV_ID, CREATE_DATE
FROM LS65_SID.SERV_T@TO_SID
WHERE ACC_NBR = IPACC_NBR
AND IP_CLASS IN ('a', 'Y')
UNION
SELECT SERV_ID, CREATE_DATE
FROM LS65_CRM1.P_SERV_T@TO_CRM
WHERE PHYSICS_NBR = IPACC_NBR
AND IP_CLASS IN ('A')
UNION
SELECT SERV_ID, CREATE_DATE
FROM LS65_SID.SERV_T@TO_SID
WHERE PHYSICS_NBR = IPACC_NBR
AND IP_CLASS IN ('A')
ORDER BY CREATE_DATE DESC)
WHERE ROWNUM = 1*\)
LOOP
FOR REC1 IN (SELECT distinct acc_nbr
FROM (SELECT ACC_NBR
FROM LS65_CRM1.P_SERV_T@TO_CRM
WHERE SERV_ID = REC.SERV_ID
AND IP_CLASS = 'a'
ORDER BY CREATE_DATE )\*
WHERE ROWNUM = 1*\)
LOOP
BEGIN
SELECT account||DECODE(OPERATE, '3', '����', '2', '����', '4', 'ע��', '16', '����'), FINISH_TIME,order_no
INTO LV_OP, LV_OP_DATE,lv_sps_spjk_id
FROM (SELECT account ||nvl2(domain,'@'||domain,'') account,OPERATE, FINISH_TIME,order_no
FROM JK_163@JK_WH
WHERE ( ACCOUNT = LOWER(rec1.acc_nbr)
or account=regexp_replace(LOWER(rec1.acc_nbr),'@.+')
)
AND OPERATE IN (3, 2, 4, 16)
ORDER BY FINISH_TIME desc)
WHERE ROWNUM = 1
AND IP_CLASS = 'a';
if regexp_like(lv_sps_spjk_id ,'^sps[0-9]+$') then
lv_sps_spjk_id:=substr(lv_sps_spjk_id,4);
select max(co_nbr) into lv_relate_co_nbr from spjk_table st, so so where spjk_id=lv_sps_spjk_id
and so.so_nbr=st.so_nbr and so.sts='A';
if lv_relate_co_nbr is null then
select max(co_nbr) into lv_relate_co_nbr from spjk_table_arc st, so_arc so where spjk_id=lv_sps_spjk_id
and so.so_nbr=st.so_nbr and so.sts='A';
end if;
if lv_relate_co_nbr is null then
select max(co_nbr) into lv_relate_co_nbr from spjk_table_his st, so_his so where spjk_id=lv_sps_spjk_id
and so.so_nbr=st.so_nbr and so.sts='A';
end if;
else
lv_relate_co_nbr:='';
end if;
if lv_relate_co_nbr is null then
lv_relate_co_nbr:=',������';
else
lv_relate_co_nbr:=',������:'||lv_relate_co_nbr;
end if;
RET := RET || LV_OP || '@' || TO_CHAR(LV_OP_DATE, 'yy-mm-dd hh24:mi:ss')||lv_relate_co_nbr||';' ;
EXCEPTION
WHEN no_data_found THEN
null;
when others then
RET:=ret||sqlerrm;
\*BEGIN
SELECT RET || TO_CHAR(WM_CONCAT(NAME))
INTO RET
FROM CHG_SERV_SPEC A, SO B
WHERE B.SERV_INST_ID = REC.SERV_ID
AND B.STS = 'A'
AND A.STS = 'A'
AND A.CHG_SERV_SPEC_ID = B.CHG_SERV_SPEC_ID and a.CHG_SERV_SPEC_ID in(SELECT CHG_SERV_SPEC_ID
FROM CHG_SERV_SPEC
WHERE CHG_SERV_SPEC_ID IN (40360, 19, 50, 10, 68, 79, 82, 69, 73, 74, 192, 187, 191, 189, 121, 40460)
AND STS = 'A'
UNION
SELECT CHG_SERV_SPEC_ID
FROM CHG_SERV_SPEC_COMP
WHERE REL_CHG_SERV_SPEC_ID IN
(40360, 19, 50, 10, 68, 79, 82, 69, 73, 74, 192, 187, 191, 189, 121, 40460)
AND STS = 'A');
EXCEPTION
WHEN OTHERS THEN
NULL;
END;*\
END;
END LOOP;
END LOOP;
RETURN rtrim(RET,',');
END;
*/
BEGIN
/*CASE NVL(IP_PTLX, 0)
WHEN '��������ƽ̨' THEN
LV_CLASS := 'a';
WHEN '��������ƽ̨' THEN
LV_CLASS := 'Y';
WHEN '�ƶ�����ƽ̨' THEN
LV_CLASS := 'Y';
WHEN '�ƶ�����ƽ̨' THEN
LV_CLASS := 'A';
WHEN '�ƶ�����ƽ̨' THEN
LV_CLASS := 'Y';
WHEN 'Эͬͨ��ƽ̨' THEN
LV_CLASS := 'Y';
WHEN 'IPTV����ƽ̨' THEN
LV_CLASS := 'a';
WHEN 'IPTV����ƽ̨' THEN
LV_CLASS := 'a';
ELSE
LV_CLASS := 'a';
END CASE;
CASE NVL(IP_PTLX, 0)
WHEN 'kd' THEN
LV_CLASS := 'a';
WHEN 'IPTV' then
LV_CLASS := 'a';
WHEN 'fix' THEN
LV_CLASS := 'Y';
WHEN 'sms' THEN
LV_CLASS := '0';
return null;
WHEN 'CDMA' THEN
LV_CLASS := '0';
return null;
WHEN 'EVDO' THEN
LV_CLASS := '0';
return null;
WHEN 'ZNW' THEN
LV_CLASS := '0';
return null;
WHEN 'IPTVDB' THEN
LV_CLASS := '0';
return null;
ELSE
LV_CLASS := 'a';
return null;
END CASE;
LV_COMBO := GETFIX_NBR(COM_ACC_NBR, LV_CLASS);
IF LV_COMBO IS NULL THEN
LV_COMBO:=GETAD_NBR(ip_serv_id, LV_CLASS);
if LV_COMBO is null then
return null;
else
return LV_COMBO;
end if;
ELSE
RETURN LV_COMBO;
END IF;*/
return wxhf_find_spjk_cmd_full(COM_ACC_NBR, ip_serv_id, IP_PTLX);
END;
function get_agreement_id#bysonbr(ip_so_nbr varchar2
,ip_depth varchar2) return number is
RES VARCHAR2(20);
AGRID NUMBER;
begin
SELECT MAX(CO_NBR)
INTO RES
FROM (select co_nbr
from so
where so_nbr = ip_so_nbr
and rownum = 1
and ip_depth is null
union
select co_nbr
from so_arc
where so_nbr = ip_so_nbr
and rownum = 1
and ip_depth = 'arc'
union
select /*+INDEX(X SO_HIS_INX_SO_NBR)*/
co_nbr
from so_HIS X
where so_nbr = ip_so_nbr
and rownum = 1
and ip_depth = 'his');
IF RES IS NOT NULL THEN
SELECT MAX(AGREEMENT_ID) INTO AGRID FROM LS65_CRM1.CUST_INDENt_T@TO_CRM WHERE CUST_INDENT_NBR = RES;
RETURN AGRID;
END IF;
RETURN NULL;
end;
begin
-- Initialization
null;
end WXHPCK_WZ;
/
|
-- ----------------------------------------------------------
-- 2.5 to 2.6
-- ----------------------------------------------------------
ALTER TABLE `template` DROP INDEX `template_list_index4157`,
ADD UNIQUE INDEX `template_list_index4157` USING BTREE(`name`),
DROP INDEX `Index_3`,
ADD UNIQUE INDEX `Index_3` USING BTREE(`code`);
insert into version (idmajor,idminor,comment) values (2,6,"Unique index for enzymes code");
-- ----------------------------------------------------------
-- 2.6 to 2.7
-- ----------------------------------------------------------
DROP PROCEDURE IF EXISTS `createProtocolVersion`;
DELIMITER $$
CREATE PROCEDURE createProtocolVersion(
IN protocol_qmrf_number VARCHAR(36),
IN new_qmrf_number VARCHAR(36),
IN title_new VARCHAR(255),
IN abstract_new TEXT,
OUT version_new INT)
begin
DECLARE no_more_rows BOOLEAN;
DECLARE pid INT;
--
DECLARE protocols CURSOR FOR
select max(version)+1,idprotocol from protocol where idprotocol in (select idprotocol from protocol where qmrf_number=protocol_qmrf_number) LIMIT 1;
DECLARE CONTINUE HANDLER FOR NOT FOUND SET no_more_rows = TRUE;
OPEN protocols;
the_loop: LOOP
FETCH protocols into version_new,pid;
IF no_more_rows THEN
CLOSE protocols;
LEAVE the_loop;
END IF;
-- update published status of the old version to archived
-- create new version
insert into protocol (idprotocol,version,title,qmrf_number,abstract,iduser,summarySearchable,idproject,idorganisation,filename,status,created,published_status)
select idprotocol,version_new,ifnull(title_new,title),concat("XMETDB",idprotocol,"v",version_new),ifnull(abstract_new,abstract),iduser,summarySearchable,idproject,idorganisation,null,status,now(),published_status
from protocol where qmrf_number=protocol_qmrf_number;
-- copy authors
insert into protocol_authors (idprotocol,version,iduser)
select idprotocol,version_new,protocol_authors.iduser from protocol_authors join protocol using(idprotocol,version) where qmrf_number=protocol_qmrf_number;
-- copy endpoints
insert into protocol_endpoints (idprotocol,version,idtemplate)
select idprotocol,version_new,idtemplate from protocol_endpoints join protocol using(idprotocol,version) where qmrf_number=protocol_qmrf_number;
-- copy keywords
insert into keywords (idprotocol,version,keywords)
select idprotocol,version_new,keywords from keywords join protocol using(idprotocol,version) where qmrf_number=protocol_qmrf_number;
-- Set the previous protocol status to archived
update protocol set published_status='archived' where qmrf_number=protocol_qmrf_number;
END LOOP the_loop;
end $$
DELIMITER ;
insert into version (idmajor,idminor,comment) values (2,7,"New protocol version stored proc");
-- ----------------------------------------------------------
-- 2.7 to 2.8
-- ----------------------------------------------------------
ALTER TABLE `protocol` ADD COLUMN `atom_uncertainty` ENUM('Certain','Uncertain') NOT NULL DEFAULT 'Uncertain' AFTER `published_status`,
ADD COLUMN `product_amount` ENUM('Major','Minor','Unknown') NOT NULL DEFAULT 'Unknown' AFTER `atom_uncertainty`,
ADD INDEX `Index_9`(`atom_uncertainty`),
ADD INDEX `Index_10`(`product_amount`);
insert into version (idmajor,idminor,comment) values (2,8,"Atom uncertainty and product amount fields");
-- ----------------------------------------------------------
-- 2.8 to 2.9
-- ----------------------------------------------------------
ALTER TABLE `template` ADD COLUMN `allele` TEXT DEFAULT null AFTER `uri`;
update template set allele="1A,1B,1C,1E,1F,1G,1H,1J,1K,1L,1M,1N,1P,1Q,1R,1S,1T,2,3,4,5,6,7,8,9,10,11,12,13,14,15A,15B,16A,16B,17,18A,18B,19,20,21,22"
where code='CYP3A4';
update template set allele="1A,1B,1C,1Cx2,2,3,4,5A,5B,6,7A,7B,7C" where code='CYP2E1';
update template set allele="1A,1B,1C,1D,1E,1XN,2A,2B,2C,2D,2E,2F,2G,2H,2J,2K,2L,2M,2XN,3A,3B,4A,4B,4C,4D,4E,4F,4G,4H,4J,4K,4L,4M,4N,4X2,5,6A,6B,6C,6D,7,8,9,9x2,10A,10B,10C,10D,10X2,11,12,13,14A,14B,15,16,17,17XN,18,19,20,21A,21B,22,23,24,25,26,27,28,29,30,31,32,33,34,35A,35B,35X2,36,37,38,39,40,41,42,43,44,45A,45B,46,47,48,49,50,51,52,53,54,55,56A,56B,57,59,60,61,62,63,64,65,66,67,68A,68B,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84-101,102,103,104,105"
where code='CYP2D6';
update template set allele="1A,1B,1C,2A,2B,2C,3A,3B,4,5,6,7,8,9,10,11A,11B,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,34,33,34,35,36-56,57"
where code='CYP2C9';
update template set allele="1A,1B,1C,1D,1E,1F,1G,1H,1J,1K,1L,1M,1N,1P,1Q,1R,1S,1T,1U,1V,1W,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21"
where code='CYP1A2';
update template set allele="1A,1B,1C,2A,2B,2C,2D,3A,3B,4A,4B,5A,5B,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28"
where code='CYP2C19';
update template set allele="1,2A,2B,2C,3,4,5,6,7,8,9,10,11"
where code='CYP1A1';
update template set allele="1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26"
where code='CYP1B1';
update template set allele="1A,1B,1C,1D,1E,1F,1G,1H,2,3,4,5A,5B"
where code='CYP2S1';
update template set allele="1A,1B,1C,1D,1E,2,3A,3B,3C,3D,3E,3F,3G,3H,3I,3J,3K,3L,4,5,6,7,8,9,10,11"
where code='CYP3A5';
update template set allele="1A,1B,1C,2,3,4,5,6,7,8,9,10,11,12,13,14"
where code='CYP2C8';
update template set allele="1,2A,2B,3,4,5,6,7"
where code='CYP4B1';
update template set allele="1A,1B,2,3,4,5,6"
where code='CYP2W1';
update template set allele="1,2,3,4"
where code='CYP26A1';
ALTER TABLE `protocol_endpoints` ADD COLUMN `allele` VARCHAR(15) NOT NULL AFTER `idtemplate`,
ADD INDEX `Index_3`(`idtemplate`, `allele`);
DROP PROCEDURE IF EXISTS `createProtocolVersion`;
DELIMITER $$
CREATE PROCEDURE createProtocolVersion(
IN protocol_qmrf_number VARCHAR(36),
IN new_qmrf_number VARCHAR(36),
IN title_new VARCHAR(255),
IN abstract_new TEXT,
OUT version_new INT)
begin
DECLARE no_more_rows BOOLEAN;
DECLARE pid INT;
--
DECLARE protocols CURSOR FOR
select max(version)+1,idprotocol from protocol where idprotocol in (select idprotocol from protocol where qmrf_number=protocol_qmrf_number) LIMIT 1;
DECLARE CONTINUE HANDLER FOR NOT FOUND SET no_more_rows = TRUE;
OPEN protocols;
the_loop: LOOP
FETCH protocols into version_new,pid;
IF no_more_rows THEN
CLOSE protocols;
LEAVE the_loop;
END IF;
-- update published status of the old version to archived
-- create new version
insert into protocol (idprotocol,version,title,qmrf_number,abstract,iduser,summarySearchable,idproject,idorganisation,filename,status,created,published_status)
select idprotocol,version_new,ifnull(title_new,title),concat("XMETDB",idprotocol,"v",version_new),ifnull(abstract_new,abstract),iduser,summarySearchable,idproject,idorganisation,null,status,now(),published_status
from protocol where qmrf_number=protocol_qmrf_number;
-- copy authors
insert into protocol_authors (idprotocol,version,iduser)
select idprotocol,version_new,protocol_authors.iduser from protocol_authors join protocol using(idprotocol,version) where qmrf_number=protocol_qmrf_number;
-- copy endpoints
insert into protocol_endpoints (idprotocol,version,idtemplate,allele)
select idprotocol,version_new,idtemplate,allele from protocol_endpoints join protocol using(idprotocol,version) where qmrf_number=protocol_qmrf_number;
-- copy keywords
insert into keywords (idprotocol,version,keywords)
select idprotocol,version_new,keywords from keywords join protocol using(idprotocol,version) where qmrf_number=protocol_qmrf_number;
-- Set the previous protocol status to archived
update protocol set published_status='archived' where qmrf_number=protocol_qmrf_number;
END LOOP the_loop;
end $$
DELIMITER ;
insert into version (idmajor,idminor,comment) values (2,9,"Alleles");
-- ----------------------------------------------------------
-- 2.9 to 2.10
-- ----------------------------------------------------------
ALTER TABLE `protocol` MODIFY COLUMN `title` VARCHAR(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT 'Title',
MODIFY COLUMN `abstract` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL,
CHANGE COLUMN `template` `reference` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT 'Reference',
ADD INDEX `Index_11`(`reference`);
insert into version (idmajor,idminor,comment) values (2,10,"References");
-- ----------------------------------------------------------
-- 2.10 to 2.11
-- ----------------------------------------------------------
ALTER TABLE `attachments` DROP INDEX `Index_4`,
ADD UNIQUE INDEX `Index_4` USING BTREE(`idprotocol`, `version`, `type`);
insert into version (idmajor,idminor,comment) values (2,11,"One attachment of a type");
-- ----------------------------------------------------------
-- 2.11 to 2.12
-- ----------------------------------------------------------
DROP PROCEDURE IF EXISTS `createProtocolVersion`;
DELIMITER $$
CREATE PROCEDURE createProtocolVersion(
IN protocol_qmrf_number VARCHAR(36),
IN new_qmrf_number VARCHAR(36),
IN title_new VARCHAR(255),
IN abstract_new TEXT,
OUT version_new INT)
begin
DECLARE no_more_rows BOOLEAN;
DECLARE pid INT;
--
DECLARE protocols CURSOR FOR
select max(version)+1,idprotocol from protocol where idprotocol in (select idprotocol from protocol where qmrf_number=protocol_qmrf_number) LIMIT 1;
DECLARE CONTINUE HANDLER FOR NOT FOUND SET no_more_rows = TRUE;
OPEN protocols;
the_loop: LOOP
FETCH protocols into version_new,pid;
IF no_more_rows THEN
CLOSE protocols;
LEAVE the_loop;
END IF;
-- update published status of the old version to archived
-- create new version
insert into protocol (idprotocol,version,title,qmrf_number,abstract,iduser,summarySearchable,idproject,idorganisation,filename,status,created,published_status,atom_uncertainty,product_amount)
select idprotocol,version_new,ifnull(title_new,title),concat("XMETDB",idprotocol,"v",version_new),ifnull(abstract_new,abstract),iduser,summarySearchable,idproject,idorganisation,filename,status,now(),'draft',atom_uncertainty,product_amount
from protocol where qmrf_number=protocol_qmrf_number;
-- copy authors
insert into protocol_authors (idprotocol,version,iduser)
select idprotocol,version_new,protocol_authors.iduser from protocol_authors join protocol using(idprotocol,version) where qmrf_number=protocol_qmrf_number;
-- copy endpoints
insert into protocol_endpoints (idprotocol,version,idtemplate,allele)
select idprotocol,version_new,idtemplate,allele from protocol_endpoints join protocol using(idprotocol,version) where qmrf_number=protocol_qmrf_number;
-- copy keywords
insert into keywords (idprotocol,version,keywords)
select idprotocol,version_new,keywords from keywords join protocol using(idprotocol,version) where qmrf_number=protocol_qmrf_number;
-- Set the previous protocol status to archived
update protocol set published_status='archived' where qmrf_number=protocol_qmrf_number;
-- copy attachments
insert into attachments (idprotocol,version,name,description,type,updated,format,original_name,imported)
select idprotocol,version_new,name,description,type,now(),format,original_name,imported from attachments a, protocol p
where p.idprotocol=a.idprotocol and p.version = a.version and p.qmrf_number = protocol_qmrf_number;
END LOOP the_loop;
end $$
DELIMITER ;
DROP PROCEDURE IF EXISTS `createProtocolCopy`;
DELIMITER $$
CREATE PROCEDURE createProtocolCopy(
IN protocol_qmrf_number VARCHAR(36),
OUT new_qmrf_number VARCHAR(36))
begin
DECLARE new_id INT;
-- create new version
insert into protocol (idprotocol,version,title,qmrf_number,abstract,iduser,summarySearchable,idproject,idorganisation,filename,status,created,published_status,atom_uncertainty,product_amount)
select null,1,title,concat("XMETDB",idprotocol,"v",now()),abstract,iduser,summarySearchable,idproject,idorganisation,filename,status,now(),'draft',atom_uncertainty,product_amount
from protocol where qmrf_number=protocol_qmrf_number;
SELECT LAST_INSERT_ID() INTO new_id;
UPDATE protocol set qmrf_number=concat("XMETDB",new_id) where idprotocol=new_id and version=1;
SET new_qmrf_number = concat("XMETDB",new_id);
-- copy authors
insert into protocol_authors (idprotocol,version,iduser)
select new_id,1,protocol_authors.iduser from protocol_authors join protocol using(idprotocol,version) where qmrf_number=protocol_qmrf_number;
-- copy endpoints
insert into protocol_endpoints (idprotocol,version,idtemplate,allele)
select new_id,1,idtemplate,allele from protocol_endpoints join protocol using(idprotocol,version) where qmrf_number=protocol_qmrf_number;
-- copy keywords
insert into keywords (idprotocol,version,keywords)
select new_id,1,concat('Copy of ',protocol_qmrf_number,' ',keywords) from keywords join protocol using(idprotocol,version) where qmrf_number=protocol_qmrf_number;
-- copy attachments
insert into attachments (idprotocol,version,name,description,type,updated,format,original_name,imported)
select new_id,1,name,description,type,now(),format,original_name,imported from attachments a, protocol p
where p.idprotocol=a.idprotocol and p.version = a.version and p.qmrf_number = protocol_qmrf_number;
end $$
DELIMITER ;
insert into version (idmajor,idminor,comment) values (2,12,"copy observation procedure");
-- ----------------------------------------------------------
-- 2.12 to 2.13
-- ----------------------------------------------------------
drop table dictionary;
insert into version (idmajor,idminor,comment) values (2,13,"drop dictionary table");
-- ----------------------------------------------------------
-- 2.13 to 2.14
-- ----------------------------------------------------------
update template set uri = replace(uri,"http://www.uniprot.org/uniprot/","");
ALTER TABLE `template` MODIFY COLUMN `name` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
MODIFY COLUMN `code` VARCHAR(16) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
CHANGE COLUMN `uri` `uniprot` VARCHAR(16) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT 'UniProt ID',
CHANGE COLUMN `allele` `alleles` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL
, DROP INDEX `template_name`,
DROP INDEX `template_code`,
ADD UNIQUE INDEX `template_code` USING BTREE(`code`, `name`),
ADD UNIQUE INDEX `template_uniprot` USING BTREE(`uniprot`),
ADD INDEX `template_alleles`(`alleles`(200));
insert into version (idmajor,idminor,comment) values (2,14,"Enzymes table refactoring");
-- ----------------------------------------------------------
-- users
-- ----------------------------------------------------------
use xmet_users;
update roles set role_name="xmetdb_admin" where role_name="xmetdb_manager";
update roles set role_name="xmetdb_curator" where role_name="xmetdb_editor";
update user_roles set role_name="xmetdb_admin" where role_name="xmetdb_manager" and user_name is not null;
update user_roles set role_name="xmetdb_curator" where role_name="xmetdb_editor" and user_name is not null; |
-- phpMyAdmin SQL Dump
-- version 4.5.2
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Feb 12, 2017 at 06:28 PM
-- 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: `book_project`
--
-- --------------------------------------------------------
--
-- Table structure for table `authors`
--
CREATE TABLE `authors` (
`author_id` int(11) UNSIGNED NOT NULL,
`author_name` varchar(255) COLLATE utf8_bin NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
--
-- Dumping data for table `authors`
--
INSERT INTO `authors` (`author_id`, `author_name`) VALUES
(1, 'Robert B. Cialdini'),
(2, 'Andrius Tapinas'),
(3, 'Tomas Mitkus'),
(4, 'Johann Wolfgang Goethe'),
(5, 'Roger Moorhouse'),
(6, 'Jean M. Auel'),
(7, 'Justin Heimber'),
(8, 'Billy Frolick'),
(9, 'Rennie Brown'),
(10, 'Andrius Užkalnis'),
(11, 'Reinhard Lintelmann'),
(12, 'Arūnas Valinskas'),
(13, 'Jonah Berger'),
(14, 'Vytautas Mačernis'),
(15, 'George Beahm'),
(16, 'Walter Isaacson'),
(17, 'Gintarė Jarašienė'),
(18, 'Dalai Lama'),
(19, 'Jeffrey Hopkins'),
(20, 'Shunryu Suzuki'),
(21, 'Lorànt Deutsch'),
(22, 'Arminas Lydeka'),
(23, 'Stephen King'),
(24, 'Mari Jungstedt'),
(25, 'Ingar Johnsrud'),
(26, 'Paulo Coelho'),
(27, 'Arvydas Juozaitis'),
(28, 'Gyula Gulyas'),
(29, 'Dean Foster'),
(30, 'Johann Voss'),
(31, 'Lavija Šurnaitė'),
(32, 'Steponas Pučinskas'),
(33, 'Claude M. Bristol'),
(34, 'Edvard Radzinsky'),
(35, 'Simon Sebag Montefiore'),
(36, 'Stasys Gliaudys'),
(37, 'Isabelle Fiemeyer'),
(38, 'Greta Girdžiūtė'),
(39, 'Agnė Girdžiūtė'),
(40, 'Felicija Stramilaitė'),
(41, 'Catherine Mayer'),
(42, 'Jamie Oliver'),
(43, 'Eglė Mačerauskienė'),
(44, 'Alexandre Havard'),
(45, 'Douglas Adams'),
(46, 'Nikki Highmore Sims'),
(47, 'Jurgis Brėdikis'),
(48, 'Salvador Dali'),
(49, 'Mark Twain'),
(50, 'Andrea Wellnitz'),
(51, 'Dr. Jenny Sutcliffe'),
(52, 'Jussi Adler-Olsen'),
(53, 'David Lynch'),
(54, 'Christophe André');
-- --------------------------------------------------------
--
-- Table structure for table `books`
--
CREATE TABLE `books` (
`book_id` int(11) UNSIGNED NOT NULL,
`book_name` varchar(255) COLLATE utf8_bin NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
--
-- Dumping data for table `books`
--
INSERT INTO `books` (`book_id`, `book_name`) VALUES
(1, 'Įtakos galia. Kaip pasiekti savo tikslus'),
(2, 'Vilko valanda. Sidabras. Nuotykai Arizonoje'),
(3, 'Iš mano gyvenimo. Poezija ir tiesa'),
(4, 'Kariaujantis Berlynas'),
(5, 'Pirmykštė moteris: Urvinio lokio gentis'),
(6, 'Saldžių sapnų'),
(7, 'NAUJŲJŲ LAIKŲ EVANGELIJA PAGAL UŽKALNĮ'),
(8, 'Superautomobiliai: didieji klasikai nuo 1900 iki dabarties'),
(9, 'Auksinis protas. Antras sezonas'),
(10, 'Užkrečiama: kodėl daiktai ar idėjos tampa populiarūs'),
(11, 'Sielos paveikslas'),
(12, 'iSteve. Steve Jobs įžvalgos'),
(13, 'Steve Jobs. Oficiali biografija'),
(14, 'Grafinio dizaino pagrindai'),
(15, 'Apie proto, dvasios ir minčių galią'),
(16, 'Kaip pažinti save'),
(17, 'Dzeno protas, pradinuko protas'),
(18, 'Metromanas. Viena diena senovės Paryžiuje'),
(19, 'Protokolas'),
(20, 'Ponas Mersedesas'),
(21, 'Nutylėtas'),
(22, 'Vienos brolija'),
(23, 'Alchemikas'),
(24, 'Klaipėda – Mėmelio paslaptis'),
(25, 'Valstybės tarnautojų etika'),
(26, 'Azijos šalių etiketas'),
(27, 'Juodasis edelveisas: Waffen-SS kario atsiminimai'),
(28, 'Maži įpročiai – dideli pokyčiai'),
(29, 'Šiuolaikinė žūklė. Atnaujintas ir papildytas leidimas'),
(30, 'Būk įkvėptas pokyčiams'),
(31, 'Rasputinas: gyvenimas ir mirtis'),
(32, 'Stalinas: Raudonojo caro dvaras'),
(33, 'Žmonijos kilmės paslaptys'),
(34, 'Chanel iš arti'),
(35, 'Makiažo galia'),
(36, 'Sukurk savo mandalą'),
(37, 'Nemirtingumas'),
(38, 'Supermaistas kasdien: receptai sveikesniam ir laimingesniam gyvenimui'),
(39, 'Gyventi skanu. Geriausi tinklaraštininkų receptai'),
(40, 'Sukurti dideliems dalykams'),
(41, 'Keliautojo autostopu vadovas po galaktiką'),
(42, 'Kaip surengti seminarą'),
(43, 'Kitokiu žvilgsniu'),
(44, 'Slaptas Salvadoro Dali gyvenimas'),
(45, 'Gyvenimas prie Misisipės'),
(46, 'Etiketas keliaujantiems svetur'),
(47, 'Viskas apie nugarą'),
(48, 'Moteris narve'),
(49, 'Pagauti didžiąją žuvį'),
(50, 'Netobuli, laisvi ir laimingi');
-- --------------------------------------------------------
--
-- Table structure for table `book_authors`
--
CREATE TABLE `book_authors` (
`book_id` int(11) UNSIGNED NOT NULL,
`author_id` int(11) UNSIGNED NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
--
-- Dumping data for table `book_authors`
--
INSERT INTO `book_authors` (`book_id`, `author_id`) VALUES
(23, 26),
(15, 18),
(9, 12),
(9, 2),
(26, 29),
(30, 33),
(34, 37),
(17, 20),
(46, 50),
(14, 17),
(45, 49),
(39, 43),
(12, 15),
(3, 4),
(27, 30),
(16, 19),
(16, 18),
(42, 46),
(4, 5),
(41, 45),
(43, 47),
(24, 27),
(35, 38),
(35, 39),
(28, 31),
(18, 21),
(48, 52),
(7, 10),
(37, 41),
(50, 54),
(21, 24),
(49, 53),
(5, 6),
(20, 23),
(19, 22),
(31, 34),
(6, 7),
(6, 8),
(6, 9),
(11, 14),
(44, 48),
(32, 35),
(13, 16),
(36, 40),
(40, 44),
(8, 11),
(38, 42),
(10, 13),
(25, 28),
(22, 25),
(2, 2),
(2, 3),
(47, 51),
(1, 1),
(29, 32),
(33, 36);
-- --------------------------------------------------------
--
-- Table structure for table `book_genres`
--
CREATE TABLE `book_genres` (
`book_id` int(11) UNSIGNED NOT NULL,
`genre_id` int(11) UNSIGNED NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
--
-- Dumping data for table `book_genres`
--
INSERT INTO `book_genres` (`book_id`, `genre_id`) VALUES
(1, 1),
(2, 2),
(3, 3),
(4, 4),
(5, 5),
(6, 6),
(7, 7),
(8, 8),
(9, 9),
(10, 10),
(11, 11),
(12, 10),
(13, 10),
(14, 12),
(15, 13),
(16, 13),
(17, 13),
(18, 14),
(19, 15),
(20, 16),
(21, 17),
(22, 17),
(23, 5),
(24, 7),
(25, 15),
(26, 15),
(27, 4),
(28, 18),
(29, 19),
(30, 1),
(31, 20),
(32, 4),
(33, 7),
(34, 20),
(35, 18),
(36, 21),
(37, 18),
(38, 22),
(39, 22),
(40, 1),
(41, 11),
(42, 10),
(43, 18),
(44, 3),
(45, 3),
(46, 15),
(47, 18),
(48, 17),
(49, 21),
(50, 21);
-- --------------------------------------------------------
--
-- Table structure for table `book_release_dates`
--
CREATE TABLE `book_release_dates` (
`book_id` int(11) UNSIGNED NOT NULL,
`release_date_id` int(11) UNSIGNED NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
--
-- Dumping data for table `book_release_dates`
--
INSERT INTO `book_release_dates` (`book_id`, `release_date_id`) VALUES
(1, 2),
(2, 2),
(3, 5),
(4, 5),
(5, 6),
(6, 2),
(7, 4),
(8, 2),
(9, 3),
(10, 2),
(11, 3),
(12, 6),
(13, 6),
(14, 5),
(15, 2),
(16, 7),
(17, 5),
(18, 4),
(19, 2),
(20, 1),
(21, 1),
(22, 1),
(23, 8),
(24, 2),
(25, 16),
(26, 14),
(27, 2),
(28, 2),
(29, 7),
(30, 2),
(31, 7),
(32, 7),
(33, 5),
(34, 4),
(35, 2),
(36, 3),
(37, 5),
(38, 2),
(39, 6),
(40, 4),
(41, 2),
(42, 8),
(43, 3),
(44, 5),
(45, 7),
(46, 10),
(47, 5),
(48, 5),
(49, 4),
(50, 4);
-- --------------------------------------------------------
--
-- Table structure for table `genres`
--
CREATE TABLE `genres` (
`genre_id` int(11) UNSIGNED NOT NULL,
`genre_name` varchar(255) COLLATE utf8_bin NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
--
-- Dumping data for table `genres`
--
INSERT INTO `genres` (`genre_id`, `genre_name`) VALUES
(1, 'Lyderystė'),
(2, 'Komiksai'),
(3, 'Autobiografijos'),
(4, 'Istorija'),
(5, 'Romanai'),
(6, 'Pasakos'),
(7, 'Publicistika'),
(8, 'Transportas'),
(9, 'Žaidimų knygos'),
(10, 'Verslas, vadyba'),
(11, 'Klasika'),
(12, 'Kompiuterija ir informacinės technologijos'),
(13, 'Rytų išmintis'),
(14, 'Kelionės'),
(15, 'Etiketas ir protokolas'),
(16, 'Fantastika ir fantasy'),
(17, 'Detektyvai, trileriai'),
(18, 'Sveikata ir grožis'),
(19, 'Medžioklė ir žvejyba'),
(20, 'Biografijos'),
(21, 'Asmenybės tobulėjimas'),
(22, 'Receptų knygos');
-- --------------------------------------------------------
--
-- Table structure for table `release_dates`
--
CREATE TABLE `release_dates` (
`release_date_id` int(11) UNSIGNED NOT NULL,
`year` year(4) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
--
-- Dumping data for table `release_dates`
--
INSERT INTO `release_dates` (`release_date_id`, `year`) VALUES
(1, 2017),
(2, 2016),
(3, 2015),
(4, 2014),
(5, 2013),
(6, 2012),
(7, 2011),
(8, 2010),
(9, 2009),
(10, 2008),
(11, 2007),
(12, 2006),
(13, 2005),
(14, 2004),
(15, 2003),
(16, 2002),
(17, 2001),
(18, 2000);
--
-- Indexes for dumped tables
--
--
-- Indexes for table `authors`
--
ALTER TABLE `authors`
ADD PRIMARY KEY (`author_id`);
--
-- Indexes for table `books`
--
ALTER TABLE `books`
ADD PRIMARY KEY (`book_id`);
--
-- Indexes for table `book_authors`
--
ALTER TABLE `book_authors`
ADD KEY `book_author_id` (`book_id`),
ADD KEY `author_id` (`author_id`);
--
-- Indexes for table `book_genres`
--
ALTER TABLE `book_genres`
ADD KEY `book_genre_id` (`book_id`),
ADD KEY `genre_id` (`genre_id`);
--
-- Indexes for table `book_release_dates`
--
ALTER TABLE `book_release_dates`
ADD KEY `book_release_date_id` (`book_id`),
ADD KEY `release_date_id` (`release_date_id`);
--
-- Indexes for table `genres`
--
ALTER TABLE `genres`
ADD PRIMARY KEY `genre_id` (`genre_id`);
--
-- Indexes for table `release_dates`
--
ALTER TABLE `release_dates`
ADD PRIMARY KEY `release_date_id` (`release_date_id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `authors`
--
ALTER TABLE `authors`
MODIFY `author_id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=55;
--
-- AUTO_INCREMENT for table `books`
--
ALTER TABLE `books`
MODIFY `book_id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=51;
--
-- AUTO_INCREMENT for table `genres`
--
ALTER TABLE `genres`
MODIFY `genre_id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=23;
--
-- AUTO_INCREMENT for table `release_dates`
--
ALTER TABLE `release_dates`
MODIFY `release_date_id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=19;
--
-- Constraints for dumped tables
--
--
-- Constraints for table `book_authors`
--
ALTER TABLE `book_authors`
ADD CONSTRAINT `book_authors_ibfk_1` FOREIGN KEY (`book_id`) REFERENCES `books` (`book_id`),
ADD CONSTRAINT `book_authors_ibfk_2` FOREIGN KEY (`author_id`) REFERENCES `authors` (`author_id`);
--
-- Constraints for table `book_genres`
--
ALTER TABLE `book_genres`
ADD CONSTRAINT `book_genres_ibfk_1` FOREIGN KEY (`book_id`) REFERENCES `books` (`book_id`),
ADD CONSTRAINT `book_genres_ibfk_2` FOREIGN KEY (`genre_id`) REFERENCES `genres` (`genre_id`);
--
-- Constraints for table `book_release_dates`
--
ALTER TABLE `book_release_dates`
ADD CONSTRAINT `book_release_dates_ibfk_1` FOREIGN KEY (`release_date_id`) REFERENCES `release_dates` (`release_date_id`),
ADD CONSTRAINT `book_release_dates_ibfk_2` FOREIGN KEY (`book_id`) REFERENCES `books` (`book_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 */;
|
-- a script that creates the MySQL server user user_0d_1
-- user_0d_1 should have all privileges on your MySQL
CREATE USER IF NOT EXISTS user_0d_1@'localhost' IDENTIFIED BY 'user_0d_1_pwd';
GRANT ALL PRIVILEGES ON *.* TO user_0d_1@'localhost';
|
TRUNCATE TABLE noteful_notes CASCADE;
TRUNCATE TABLE noteful_folder CASCADE; |
-- +migrate Up
create table if not exists oauth_auth_codes (
id varchar(60) not null,
user_id varchar(60) not null,
client_id varchar(36) not null,
code varchar(1024) not null,
scopes varchar(1024) null,
revoked boolean default false,
created_at datetime not null,
expires_at datetime not null,
foreign key(client_id) references oauth_clients(id),
foreign key(user_id) references oauth_users(id),
primary key(id)
);
-- +migrate Down
drop table if exists oauth_auth_codes;
|
delete from SEQUENTIAL;
delete from SEQUENTIAL_ID;
insert into SEQUENTIAL_ID (SEQUENTIAL_ID) values ('LOGIN_SEQUENCE');
insert into SEQUENTIAL (COMPANY_ID, SEQUENTIAL_ID, SEQUENTIAL_VALUE, SEQUENTIAL_CODE, VERSION) values ('ALL', 'LOGIN_SEQUENCE', 0, null, 0);
|
insert into category(name,code) values('建筑','architecture');
insert into category(name,code) values('艺术','art');
insert into category(name,code) values('汽车','cars');
insert into category(name,code) values('设计','design');
insert into category(name,code) values('DIY','diy');
insert into category(name,code) values('教育','education');
insert into category(name,code) values('电影,音乐','film-music');
insert into category(name,code) values('健康','fitness');
insert into category(name,code) values('饮食','food');
insert into category(name,code) values('园艺','gardening');
insert into category(name,code) values('G客','geek');
insert into category(name,code) values('美容','hair');
insert into category(name,code) values('节日','holidays');
insert into category(name,code) values('历史','history');
insert into category(name,code) values('家装','home-decor');
insert into category(name,code) values('搞笑','humor');
insert into category(name,code) values('儿童','kids');
insert into category(name,code) values('生活','life');
insert into category(name,code) values('服装','apparel');
insert into category(name,code) values('户外','outdoors');
insert into category(name,code) values('民族','people');
insert into category(name,code) values('宠物','pets');
insert into category(name,code) values('印刷品','print');
insert into category(name,code) values('产品','products');
insert into category(name,code) values('自然科学','science');
insert into category(name,code) values('运动','sports');
insert into category(name,code) values('技术','technology');
insert into category(name,code) values('旅游','travel');
insert into category(name,code) values('婚礼','wedding');
insert into category(name,code) values('其他','other');
|
/* Создание таблицы содержания подписки */
CREATE TABLE /*PREFIX*/SUBSCRIPTION_CONTENTS
(
SUBSCRIPTION_ID VARCHAR(32) NOT NULL,
VIEW_ID VARCHAR(32) NOT NULL,
TYPE_ID VARCHAR(32) NOT NULL,
OPERATION_ID VARCHAR(32) NOT NULL,
PUBLISHING_ID VARCHAR(32) NOT NULL,
PRIMARY KEY (SUBSCRIPTION_ID,VIEW_ID,TYPE_ID,OPERATION_ID,PUBLISHING_ID),
FOREIGN KEY (SUBSCRIPTION_ID) REFERENCES /*PREFIX*/SUBSCRIPTIONS (SUBSCRIPTION_ID),
FOREIGN KEY (VIEW_ID) REFERENCES /*PREFIX*/VIEWS (VIEW_ID),
FOREIGN KEY (TYPE_ID) REFERENCES /*PREFIX*/TYPES (TYPE_ID),
FOREIGN KEY (OPERATION_ID) REFERENCES /*PREFIX*/OPERATIONS (OPERATION_ID),
FOREIGN KEY (PUBLISHING_ID) REFERENCES /*PREFIX*/PUBLISHING (PUBLISHING_ID)
)
--
/* Создание просмотра таблицы содержания подписки */
CREATE VIEW /*PREFIX*/S_SUBSCRIPTION_CONTENTS
AS
SELECT SC.*,
S.NAME AS SUBSCRIPTION_NAME,
V.NAME AS VIEW_NAME,
T.NAME AS TYPE_NAME,
O.NAME AS OPERATION_NAME,
PB.NAME AS PUBLISHING_NAME
FROM /*PREFIX*/SUBSCRIPTION_CONTENTS SC
JOIN /*PREFIX*/SUBSCRIPTIONS S ON S.SUBSCRIPTION_ID=SC.SUBSCRIPTION_ID
JOIN /*PREFIX*/VIEWS V ON V.VIEW_ID=SC.VIEW_ID
JOIN /*PREFIX*/TYPES T ON T.TYPE_ID=SC.TYPE_ID
JOIN /*PREFIX*/OPERATIONS O ON O.OPERATION_ID=SC.OPERATION_ID
JOIN /*PREFIX*/PUBLISHING PB ON PB.PUBLISHING_ID=SC.PUBLISHING_ID
--
/* Создание процедуры добавления содержания подписки */
CREATE PROCEDURE /*PREFIX*/I_SUBSCRIPTION_CONTENT
(
IN SUBSCRIPTION_ID VARCHAR(32),
IN VIEW_ID VARCHAR(32),
IN TYPE_ID VARCHAR(32),
IN OPERATION_ID VARCHAR(32),
IN PUBLISHING_ID VARCHAR(32)
)
BEGIN
INSERT INTO /*PREFIX*/SUBSCRIPTION_CONTENTS (SUBSCRIPTION_ID,VIEW_ID,TYPE_ID,OPERATION_ID,PUBLISHING_ID)
VALUES (SUBSCRIPTION_ID,VIEW_ID,TYPE_ID,OPERATION_ID,PUBLISHING_ID);
END;
--
/* Создание процедуры изменения содержания подписки */
CREATE PROCEDURE /*PREFIX*/U_SUBSCRIPTION_CONTENT
(
IN SUBSCRIPTION_ID VARCHAR(32),
IN VIEW_ID VARCHAR(32),
IN TYPE_ID VARCHAR(32),
IN OPERATION_ID VARCHAR(32),
IN PUBLISHING_ID VARCHAR(32),
IN OLD_SUBSCRIPTION_ID VARCHAR(32),
IN OLD_VIEW_ID VARCHAR(32),
IN OLD_TYPE_ID VARCHAR(32),
IN OLD_OPERATION_ID VARCHAR(32),
IN OLD_PUBLISHING_ID VARCHAR(32)
)
BEGIN
UPDATE /*PREFIX*/SUBSCRIPTION_CONTENTS SC
SET SC.SUBSCRIPTION_ID=SUBSCRIPTION_ID,
SC.VIEW_ID=VIEW_ID,
SC.TYPE_ID=TYPE_ID,
SC.OPERATION_ID=OPERATION_ID,
SC.PUBLISHING_ID=PUBLISHING_ID
WHERE SC.SUBSCRIPTION_ID=OLD_SUBSCRIPTION_ID
AND SC.VIEW_ID=OLD_VIEW_ID
AND SC.TYPE_ID=OLD_TYPE_ID
AND SC.OPERATION_ID=OLD_OPERATION_ID
AND SC.PUBLISHING_ID=OLD_PUBLISHING_ID;
END;
--
/* Создание процедуры удаления содержания подписки */
CREATE PROCEDURE /*PREFIX*/D_SUBSCRIPTION_CONTENT
(
IN OLD_SUBSCRIPTION_ID VARCHAR(32),
IN OLD_VIEW_ID VARCHAR(32),
IN OLD_TYPE_ID VARCHAR(32),
IN OLD_OPERATION_ID VARCHAR(32),
IN OLD_PUBLISHING_ID VARCHAR(32)
)
BEGIN
DELETE FROM /*PREFIX*/SUBSCRIPTION_CONTENTS
WHERE SUBSCRIPTION_ID=OLD_SUBSCRIPTION_ID
AND VIEW_ID=OLD_VIEW_ID
AND TYPE_ID=OLD_TYPE_ID
AND OPERATION_ID=OLD_OPERATION_ID
AND PUBLISHING_ID=OLD_PUBLISHING_ID;
END;
-- |
-- --------------------------------------------------------
-- Хост: 127.0.0.1
-- Версия сервера: 5.7.25 - MySQL Community Server (GPL)
-- ОС Сервера: Win64
-- HeidiSQL Версия: 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' */;
-- Дамп структуры для таблица vk.communities
DROP TABLE IF EXISTS `communities`;
CREATE TABLE IF NOT EXISTS `communities` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(150) COLLATE utf8_unicode_ci NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `name` (`name`)
) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- Дамп данных таблицы vk.communities: ~10 rows (приблизительно)
/*!40000 ALTER TABLE `communities` DISABLE KEYS */;
INSERT INTO `communities` (`id`, `name`) VALUES
(1, 'aut'),
(8, 'dignissimos'),
(4, 'ducimus'),
(6, 'enim'),
(2, 'et'),
(7, 'expedita'),
(5, 'id'),
(9, 'sint'),
(3, 'sit'),
(10, 'ut');
/*!40000 ALTER TABLE `communities` ENABLE KEYS */;
-- Дамп структуры для таблица vk.communities_users
DROP TABLE IF EXISTS `communities_users`;
CREATE TABLE IF NOT EXISTS `communities_users` (
`community_id` int(10) unsigned NOT NULL,
`user_id` int(10) unsigned NOT NULL,
PRIMARY KEY (`community_id`,`user_id`),
KEY `communities_users_user_id_fk` (`user_id`),
CONSTRAINT `communities_users_community_id_fk` FOREIGN KEY (`community_id`) REFERENCES `communities` (`id`),
CONSTRAINT `communities_users_user_id_fk` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- Дамп данных таблицы vk.communities_users: ~138 rows (приблизительно)
/*!40000 ALTER TABLE `communities_users` DISABLE KEYS */;
INSERT INTO `communities_users` (`community_id`, `user_id`) VALUES
(3, 1),
(1, 2),
(4, 2),
(3, 3),
(6, 3),
(8, 3),
(1, 5),
(3, 5),
(7, 5),
(9, 5),
(5, 6),
(6, 6),
(3, 7),
(6, 10),
(7, 10),
(7, 11),
(8, 11),
(10, 11),
(8, 12),
(7, 14),
(9, 14),
(10, 15),
(4, 16),
(8, 16),
(5, 17),
(2, 18),
(9, 18),
(5, 20),
(9, 20),
(6, 22),
(4, 25),
(1, 27),
(6, 27),
(1, 30),
(1, 31),
(5, 31),
(10, 31),
(1, 32),
(2, 32),
(6, 33),
(8, 33),
(3, 34),
(5, 35),
(5, 36),
(7, 36),
(10, 36),
(2, 37),
(3, 37),
(2, 38),
(7, 38),
(8, 38),
(2, 39),
(3, 39),
(8, 39),
(1, 40),
(5, 40),
(6, 40),
(6, 41),
(5, 42),
(7, 43),
(9, 43),
(1, 45),
(5, 45),
(9, 46),
(5, 48),
(6, 48),
(8, 48),
(5, 50),
(7, 52),
(9, 53),
(7, 54),
(3, 55),
(4, 57),
(5, 57),
(2, 59),
(3, 59),
(4, 59),
(5, 59),
(6, 59),
(5, 60),
(4, 61),
(5, 62),
(9, 62),
(6, 63),
(8, 64),
(7, 65),
(2, 66),
(3, 66),
(4, 66),
(7, 67),
(8, 67),
(3, 68),
(9, 68),
(7, 69),
(6, 70),
(9, 70),
(6, 72),
(10, 72),
(1, 73),
(4, 73),
(5, 73),
(9, 74),
(3, 75),
(3, 76),
(4, 76),
(8, 76),
(8, 77),
(2, 78),
(4, 79),
(7, 79),
(10, 79),
(3, 81),
(5, 81),
(1, 82),
(2, 82),
(7, 83),
(1, 84),
(3, 84),
(1, 87),
(7, 87),
(3, 88),
(4, 88),
(3, 89),
(5, 89),
(10, 89),
(1, 90),
(7, 90),
(9, 90),
(3, 91),
(4, 92),
(5, 92),
(8, 92),
(2, 93),
(5, 94),
(10, 94),
(2, 99),
(10, 99),
(8, 100);
/*!40000 ALTER TABLE `communities_users` ENABLE KEYS */;
-- Дамп структуры для таблица vk.friendship
DROP TABLE IF EXISTS `friendship`;
CREATE TABLE IF NOT EXISTS `friendship` (
`user_id` int(10) unsigned NOT NULL,
`friend_id` int(10) unsigned NOT NULL,
`status_id` int(10) unsigned NOT NULL,
`requested_at` datetime DEFAULT CURRENT_TIMESTAMP,
`confirmed_at` datetime DEFAULT NULL,
PRIMARY KEY (`user_id`,`friend_id`),
KEY `friendship_friend_id_fk` (`friend_id`),
KEY `friendship_status_id_fk` (`status_id`),
CONSTRAINT `friendship_friend_id_fk` FOREIGN KEY (`friend_id`) REFERENCES `users` (`id`),
CONSTRAINT `friendship_status_id_fk` FOREIGN KEY (`status_id`) REFERENCES `friendship_statuses` (`id`),
CONSTRAINT `friendship_user_id_fk` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- Дамп данных таблицы vk.friendship: ~100 rows (приблизительно)
/*!40000 ALTER TABLE `friendship` DISABLE KEYS */;
INSERT INTO `friendship` (`user_id`, `friend_id`, `status_id`, `requested_at`, `confirmed_at`) VALUES
(2, 39, 1, '2014-03-03 17:58:06', '2018-02-14 22:32:52'),
(3, 18, 2, '2016-10-11 06:38:04', '2020-04-28 21:18:20'),
(3, 86, 2, '2018-05-26 19:11:27', '2020-04-28 21:18:20'),
(4, 40, 3, '2016-11-17 14:32:18', '2020-04-28 21:18:20'),
(4, 51, 3, '2014-12-28 06:09:47', '2019-12-08 17:26:13'),
(6, 66, 2, '2019-05-30 04:48:00', '2020-04-28 21:18:20'),
(6, 91, 2, '2019-05-11 13:35:13', '2020-04-28 21:18:20'),
(6, 93, 2, '2019-06-04 18:26:35', '2020-04-28 21:18:20'),
(7, 2, 1, '2012-11-30 03:28:50', '2020-04-28 21:18:20'),
(12, 49, 1, '2016-03-04 21:33:52', '2020-04-28 21:18:20'),
(13, 11, 2, '2015-10-03 19:27:08', '2017-02-16 15:05:49'),
(13, 87, 2, '2016-04-21 05:08:59', '2017-07-12 21:57:50'),
(14, 15, 1, '2014-10-19 20:55:16', '2020-04-28 21:18:20'),
(14, 42, 1, '2014-04-28 14:56:12', '2019-09-27 11:46:05'),
(14, 69, 1, '2012-07-10 09:19:00', '2012-11-17 18:47:01'),
(16, 2, 2, '2014-03-27 08:47:03', '2017-08-12 13:46:04'),
(16, 62, 1, '2015-04-24 13:32:43', '2018-01-20 05:24:00'),
(16, 88, 3, '2016-11-16 14:45:44', '2020-04-28 21:18:20'),
(18, 1, 1, '2016-05-13 01:05:47', '2016-08-24 14:39:18'),
(20, 66, 2, '2017-02-23 00:36:54', '2020-04-28 21:18:20'),
(20, 92, 1, '2017-06-02 07:58:30', '2020-04-28 21:18:20'),
(22, 43, 2, '2013-05-09 14:39:18', '2017-01-28 04:02:19'),
(23, 98, 2, '2016-08-12 21:42:50', '2017-01-09 18:58:59'),
(25, 65, 3, '2015-03-11 03:01:49', '2020-04-28 21:18:20'),
(26, 46, 2, '2017-01-13 01:12:45', '2020-04-28 21:18:20'),
(26, 69, 2, '2012-08-22 07:04:59', '2019-11-26 12:19:33'),
(28, 36, 3, '2016-01-04 02:24:10', '2020-04-28 21:18:20'),
(29, 29, 1, '2013-12-24 08:37:20', '2018-12-06 00:09:09'),
(29, 98, 2, '2015-09-14 02:21:21', '2016-04-26 06:28:42'),
(30, 36, 2, '2014-04-09 19:50:48', '2016-12-28 13:05:15'),
(30, 82, 3, '2017-05-13 04:05:46', '2018-08-24 05:14:54'),
(33, 21, 1, '2012-06-29 12:42:25', '2015-04-25 01:45:38'),
(33, 39, 1, '2015-11-30 20:04:23', '2018-12-22 15:55:35'),
(34, 39, 1, '2017-05-23 03:34:38', '2020-04-28 21:18:20'),
(36, 49, 3, '2015-02-15 00:16:02', '2018-05-06 20:11:48'),
(37, 97, 3, '2014-05-22 22:03:53', '2016-11-17 20:26:20'),
(41, 33, 3, '2015-03-05 05:42:02', '2018-10-25 01:43:58'),
(41, 36, 1, '2014-11-25 15:31:19', '2018-08-09 06:05:43'),
(41, 42, 2, '2013-11-17 09:47:08', '2015-11-18 20:45:26'),
(42, 47, 2, '2012-12-15 15:21:11', '2020-04-28 21:18:20'),
(43, 4, 1, '2012-06-29 10:58:03', '2020-04-28 21:18:20'),
(44, 73, 2, '2010-07-31 22:33:53', '2017-07-04 06:26:45'),
(46, 32, 1, '2010-06-06 17:27:25', '2016-10-29 00:30:54'),
(48, 66, 3, '2011-04-19 01:58:04', '2014-03-19 00:28:54'),
(50, 17, 1, '2013-12-23 04:15:04', '2019-11-23 14:01:29'),
(51, 2, 3, '2019-06-14 05:50:55', '2019-08-25 11:57:09'),
(51, 52, 1, '2017-11-06 08:29:16', '2020-04-28 21:18:20'),
(52, 88, 2, '2017-07-10 00:58:06', '2020-04-28 21:18:20'),
(54, 46, 3, '2015-08-20 05:31:04', '2020-04-28 21:18:20'),
(54, 94, 2, '2013-12-12 03:26:50', '2018-10-05 07:57:30'),
(56, 53, 1, '2010-08-27 00:33:51', '2011-10-01 04:49:02'),
(57, 6, 1, '2012-06-12 02:35:16', '2020-04-28 21:18:20'),
(58, 55, 1, '2013-11-05 10:34:35', '2015-08-14 04:26:12'),
(59, 84, 2, '2019-10-11 21:29:53', '2020-04-28 21:18:20'),
(59, 86, 3, '2020-01-31 10:13:05', '2020-04-28 21:18:20'),
(60, 66, 2, '2013-12-19 16:46:42', '2017-12-06 15:12:18'),
(62, 31, 2, '2019-04-13 12:57:40', '2020-04-28 21:18:20'),
(63, 14, 2, '2019-07-21 06:37:54', '2020-04-28 21:18:20'),
(63, 37, 2, '2017-04-26 17:06:51', '2020-04-28 21:18:20'),
(65, 67, 1, '2013-03-27 19:09:26', '2018-08-18 12:57:08'),
(66, 88, 3, '2013-01-15 16:22:42', '2020-04-28 21:18:20'),
(67, 6, 2, '2012-09-04 16:39:24', '2019-09-25 12:38:15'),
(67, 100, 1, '2015-06-15 19:56:43', '2016-09-07 16:54:08'),
(68, 23, 3, '2020-01-26 05:33:30', '2020-04-28 21:18:20'),
(70, 57, 2, '2014-08-14 14:36:57', '2020-04-28 21:18:20'),
(71, 10, 1, '2013-12-31 00:40:42', '2015-06-05 23:47:13'),
(71, 12, 3, '2016-08-02 23:33:50', '2020-03-01 08:53:55'),
(71, 22, 3, '2019-10-15 08:51:33', '2020-04-28 21:18:20'),
(72, 87, 3, '2011-08-23 11:43:45', '2019-10-06 15:33:23'),
(73, 81, 1, '2020-01-23 14:22:20', '2020-04-28 21:18:20'),
(74, 44, 1, '2010-09-20 09:17:13', '2018-01-15 05:52:26'),
(75, 20, 2, '2017-05-17 06:24:29', '2018-12-02 10:35:19'),
(75, 94, 1, '2014-08-25 02:02:48', '2020-04-28 21:18:20'),
(76, 53, 3, '2016-09-26 20:12:11', '2020-04-28 21:18:20'),
(77, 40, 3, '2014-07-30 13:38:50', '2020-04-28 21:18:20'),
(78, 54, 2, '2016-06-12 19:09:35', '2017-10-30 21:05:26'),
(81, 59, 2, '2019-01-04 01:27:58', '2020-04-28 21:18:20'),
(83, 17, 3, '2018-09-11 11:23:15', '2020-04-28 21:18:20'),
(83, 60, 1, '2015-05-04 16:12:32', '2020-03-01 03:36:57'),
(83, 97, 1, '2013-02-09 03:32:55', '2020-04-28 21:18:20'),
(84, 41, 3, '2013-09-29 13:51:58', '2020-02-15 07:28:12'),
(86, 24, 2, '2018-10-23 13:55:57', '2019-04-06 18:50:33'),
(87, 34, 1, '2018-05-23 00:10:41', '2020-04-28 21:18:20'),
(87, 62, 1, '2016-12-19 01:33:40', '2018-08-27 04:25:44'),
(90, 43, 3, '2014-04-24 17:50:27', '2020-04-28 21:18:20'),
(90, 70, 3, '2019-04-15 08:42:03', '2020-04-28 21:18:20'),
(92, 31, 3, '2019-05-13 06:32:15', '2020-04-28 21:18:20'),
(92, 83, 2, '2019-08-02 06:44:18', '2020-04-28 21:18:20'),
(93, 94, 1, '2014-07-30 10:20:41', '2015-11-06 00:40:26'),
(95, 94, 2, '2018-12-19 13:03:58', '2020-04-28 21:18:20'),
(96, 31, 2, '2016-03-09 18:34:38', '2018-04-25 09:09:43'),
(96, 52, 3, '2018-01-14 11:45:36', '2020-04-28 21:18:20'),
(96, 97, 1, '2013-02-20 14:37:15', '2020-01-08 01:52:22'),
(98, 30, 1, '2013-08-08 00:18:46', '2019-08-30 18:32:54'),
(98, 34, 3, '2014-03-29 19:35:11', '2020-02-26 00:03:03'),
(98, 77, 1, '2012-09-28 08:49:55', '2020-04-28 21:18:20'),
(98, 98, 2, '2013-09-03 03:22:31', '2020-04-28 21:18:20'),
(99, 20, 2, '2011-09-11 23:16:05', '2012-12-27 11:46:28'),
(99, 56, 2, '2011-12-20 12:17:52', '2019-02-22 23:36:37'),
(99, 72, 3, '2020-03-18 13:50:10', '2020-04-28 21:18:20');
/*!40000 ALTER TABLE `friendship` ENABLE KEYS */;
-- Дамп структуры для таблица vk.friendship_statuses
DROP TABLE IF EXISTS `friendship_statuses`;
CREATE TABLE IF NOT EXISTS `friendship_statuses` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(150) COLLATE utf8_unicode_ci NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `name` (`name`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- Дамп данных таблицы vk.friendship_statuses: ~3 rows (приблизительно)
/*!40000 ALTER TABLE `friendship_statuses` DISABLE KEYS */;
INSERT INTO `friendship_statuses` (`id`, `name`) VALUES
(2, 'Confirmed'),
(3, 'Rejected'),
(1, 'Requested');
/*!40000 ALTER TABLE `friendship_statuses` ENABLE KEYS */;
-- Дамп структуры для таблица vk.likes
DROP TABLE IF EXISTS `likes`;
CREATE TABLE IF NOT EXISTS `likes` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`user_id` int(10) unsigned NOT NULL,
`target_id` int(10) unsigned NOT NULL,
`target_type_id` int(10) unsigned NOT NULL,
`created_at` datetime DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=101 DEFAULT CHARSET=latin1;
-- Дамп данных таблицы vk.likes: 100 rows
/*!40000 ALTER TABLE `likes` DISABLE KEYS */;
INSERT INTO `likes` (`id`, `user_id`, `target_id`, `target_type_id`, `created_at`) VALUES
(71, 62, 43, 4, '2020-05-05 18:08:35'),
(24, 70, 56, 3, '2020-05-05 18:08:35'),
(51, 68, 49, 4, '2020-05-05 18:08:35'),
(85, 13, 77, 2, '2020-05-05 18:08:35'),
(84, 89, 36, 1, '2020-05-05 18:08:35'),
(42, 55, 49, 1, '2020-05-05 18:08:35'),
(65, 42, 39, 1, '2020-05-05 18:08:35'),
(61, 47, 45, 2, '2020-05-05 18:08:35'),
(70, 22, 3, 4, '2020-05-05 18:08:35'),
(28, 22, 2, 4, '2020-05-05 18:08:35'),
(81, 58, 81, 2, '2020-05-05 18:08:35'),
(91, 6, 83, 3, '2020-05-05 18:08:35'),
(30, 3, 7, 1, '2020-05-05 18:08:35'),
(33, 63, 80, 2, '2020-05-05 18:08:35'),
(6, 45, 32, 1, '2020-05-05 18:08:35'),
(34, 100, 83, 4, '2020-05-05 18:08:35'),
(45, 76, 51, 1, '2020-05-05 18:08:35'),
(48, 50, 80, 3, '2020-05-05 18:08:35'),
(53, 47, 65, 3, '2020-05-05 18:08:35'),
(44, 95, 74, 2, '2020-05-05 18:08:35'),
(92, 65, 73, 3, '2020-05-05 18:08:35'),
(57, 22, 43, 4, '2020-05-05 18:08:35'),
(86, 80, 85, 4, '2020-05-05 18:08:35'),
(68, 14, 58, 3, '2020-05-05 18:08:35'),
(79, 24, 80, 1, '2020-05-05 18:08:35'),
(52, 93, 1, 2, '2020-05-05 18:08:35'),
(64, 95, 50, 3, '2020-05-05 18:08:35'),
(56, 60, 26, 4, '2020-05-05 18:08:35'),
(88, 92, 80, 1, '2020-05-05 18:08:35'),
(97, 55, 20, 4, '2020-05-05 18:08:35'),
(18, 83, 59, 2, '2020-05-05 18:08:35'),
(25, 1, 34, 2, '2020-05-05 18:08:35'),
(95, 41, 83, 3, '2020-05-05 18:08:35'),
(75, 34, 59, 1, '2020-05-05 18:08:35'),
(31, 94, 2, 3, '2020-05-05 18:08:35'),
(58, 98, 5, 1, '2020-05-05 18:08:35'),
(41, 46, 7, 3, '2020-05-05 18:08:35'),
(47, 92, 85, 1, '2020-05-05 18:08:35'),
(1, 71, 74, 3, '2020-05-05 18:08:35'),
(26, 59, 70, 1, '2020-05-05 18:08:35'),
(80, 14, 31, 2, '2020-05-05 18:08:35'),
(32, 16, 41, 2, '2020-05-05 18:08:35'),
(43, 33, 4, 2, '2020-05-05 18:08:35'),
(4, 84, 35, 2, '2020-05-05 18:08:35'),
(10, 17, 42, 1, '2020-05-05 18:08:35'),
(29, 80, 3, 1, '2020-05-05 18:08:35'),
(62, 33, 86, 4, '2020-05-05 18:08:35'),
(63, 72, 2, 2, '2020-05-05 18:08:35'),
(5, 30, 85, 1, '2020-05-05 18:08:35'),
(82, 9, 28, 3, '2020-05-05 18:08:35'),
(3, 86, 69, 2, '2020-05-05 18:08:35'),
(98, 91, 61, 3, '2020-05-05 18:08:35'),
(55, 53, 88, 4, '2020-05-05 18:08:35'),
(15, 15, 5, 1, '2020-05-05 18:08:35'),
(40, 16, 47, 2, '2020-05-05 18:08:35'),
(73, 67, 4, 2, '2020-05-05 18:08:35'),
(20, 29, 6, 3, '2020-05-05 18:08:35'),
(54, 37, 85, 4, '2020-05-05 18:08:35'),
(17, 50, 50, 3, '2020-05-05 18:08:35'),
(36, 86, 72, 2, '2020-05-05 18:08:35'),
(100, 2, 1, 4, '2020-05-05 18:08:35'),
(49, 9, 29, 2, '2020-05-05 18:08:35'),
(93, 31, 7, 4, '2020-05-05 18:08:35'),
(74, 41, 81, 3, '2020-05-05 18:08:35'),
(69, 41, 41, 2, '2020-05-05 18:08:35'),
(7, 23, 3, 2, '2020-05-05 18:08:35'),
(89, 49, 5, 1, '2020-05-05 18:08:35'),
(99, 65, 53, 3, '2020-05-05 18:08:35'),
(12, 75, 2, 1, '2020-05-05 18:08:35'),
(21, 98, 26, 2, '2020-05-05 18:08:35'),
(66, 12, 79, 1, '2020-05-05 18:08:35'),
(37, 21, 3, 3, '2020-05-05 18:08:35'),
(50, 25, 38, 3, '2020-05-05 18:08:35'),
(83, 34, 47, 4, '2020-05-05 18:08:35'),
(11, 70, 1, 4, '2020-05-05 18:08:35'),
(14, 4, 48, 3, '2020-05-05 18:08:35'),
(76, 4, 80, 1, '2020-05-05 18:08:35'),
(22, 57, 78, 4, '2020-05-05 18:08:35'),
(23, 47, 39, 2, '2020-05-05 18:08:35'),
(59, 60, 58, 1, '2020-05-05 18:08:35'),
(9, 47, 73, 2, '2020-05-05 18:08:35'),
(13, 35, 89, 2, '2020-05-05 18:08:35'),
(72, 91, 30, 2, '2020-05-05 18:08:35'),
(77, 21, 86, 4, '2020-05-05 18:08:35'),
(8, 18, 2, 4, '2020-05-05 18:08:35'),
(35, 13, 25, 3, '2020-05-05 18:08:35'),
(96, 65, 80, 1, '2020-05-05 18:08:35'),
(38, 2, 46, 4, '2020-05-05 18:08:35'),
(39, 77, 74, 1, '2020-05-05 18:08:35'),
(2, 7, 33, 2, '2020-05-05 18:08:35'),
(67, 53, 44, 4, '2020-05-05 18:08:35'),
(87, 49, 20, 4, '2020-05-05 18:08:35'),
(46, 32, 69, 2, '2020-05-05 18:08:35'),
(78, 36, 81, 2, '2020-05-05 18:08:35'),
(19, 23, 4, 1, '2020-05-05 18:08:35'),
(94, 16, 1, 1, '2020-05-05 18:08:35'),
(16, 47, 86, 3, '2020-05-05 18:08:35'),
(27, 98, 42, 2, '2020-05-05 18:08:35'),
(60, 21, 36, 2, '2020-05-05 18:08:35'),
(90, 27, 51, 3, '2020-05-05 18:08:35');
/*!40000 ALTER TABLE `likes` ENABLE KEYS */;
-- Дамп структуры для таблица vk.media
DROP TABLE IF EXISTS `media`;
CREATE TABLE IF NOT EXISTS `media` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`media_type_id` int(10) unsigned NOT NULL,
`user_id` int(10) unsigned NOT NULL,
`filename` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`size` int(11) NOT NULL,
`metadata` json DEFAULT NULL,
`created_at` datetime DEFAULT CURRENT_TIMESTAMP,
`updated_at` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
KEY `media_user_id_fk` (`user_id`),
KEY `media_media_type_id_fk` (`media_type_id`),
CONSTRAINT `media_media_type_id_fk` FOREIGN KEY (`media_type_id`) REFERENCES `media_types` (`id`),
CONSTRAINT `media_user_id_fk` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=101 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- Дамп данных таблицы vk.media: ~100 rows (приблизительно)
/*!40000 ALTER TABLE `media` DISABLE KEYS */;
INSERT INTO `media` (`id`, `media_type_id`, `user_id`, `filename`, `size`, `metadata`, `created_at`, `updated_at`) VALUES
(1, 2, 94, 'https://dropbox/vk/autem.jpeg', 8281, {"owner": "Maybelle Schiller"}, '2014-06-09 06:02:20', '2020-05-05 13:31:28'),
(2, 1, 85, 'https://dropbox/vk/qui.jpeg', 9053, {"owner": "Marie Morissette"}, '2018-10-07 04:56:37', '2020-05-05 13:31:28'),
(3, 2, 24, 'https://dropbox/vk/voluptatibus.avi', 235236, {"owner": "Ubaldo Gleason"}, '2018-10-07 03:15:41', '2020-05-05 13:31:28'),
(4, 3, 38, 'https://dropbox/vk/qui.jpeg', 28335, {"owner": "Noelia Roberts"}, '2016-08-19 03:33:53', '2020-05-05 13:31:28'),
(5, 2, 25, 'https://dropbox/vk/ea.avi', 425969, {"owner": "Kendrick Hansen"}, '2016-01-17 13:18:55', '2020-05-05 13:31:28'),
(6, 3, 23, 'https://dropbox/vk/ut.avi', 74206, {"owner": "Walker Leuschke"}, '2012-08-24 05:40:23', '2020-05-05 13:31:28'),
(7, 3, 52, 'https://dropbox/vk/quidem.avi', 957687894, {"owner": "Daniela Rempel"}, '2011-12-14 15:12:10', '2020-05-05 13:31:28'),
(8, 3, 73, 'https://dropbox/vk/iste.jpeg', 66524, {"owner": "Verla Barrows"}, '2010-12-05 00:10:18', '2020-05-05 13:31:28'),
(9, 2, 29, 'https://dropbox/vk/dolor.avi', 34838, {"owner": "Arielle Shields"}, '2020-02-26 07:56:15', '2020-05-05 13:31:28'),
(10, 2, 6, 'https://dropbox/vk/sed.png', 46875662, {"owner": "Flo DuBuque"}, '2010-08-05 02:35:15', '2020-05-05 13:31:28'),
(11, 3, 21, 'https://dropbox/vk/facilis.png', 886285, {"owner": "Kyleigh Kilback"}, '2016-02-18 09:37:18', '2020-05-05 13:31:28'),
(12, 1, 16, 'https://dropbox/vk/repellendus.png', 316912, {"owner": "Janice Hansen"}, '2020-02-18 01:59:22', '2020-05-05 13:31:28'),
(13, 1, 27, 'https://dropbox/vk/autem.mprg', 915706, {"owner": "Oleta Hodkiewicz"}, '2014-03-01 05:31:37', '2020-05-05 13:31:28'),
(14, 2, 55, 'https://dropbox/vk/autem.png', 262675914, {"owner": "Noble Ferry"}, '2014-07-08 11:19:07', '2020-05-05 13:31:28'),
(15, 3, 61, 'https://dropbox/vk/tenetur.avi', 8804, {"owner": "Branson Jerde"}, '2017-02-09 21:43:50', '2020-05-05 13:31:28'),
(16, 1, 20, 'https://dropbox/vk/quis.jpeg', 9046470, {"owner": "Janet Davis"}, '2012-12-11 07:01:35', '2020-05-05 13:31:28'),
(17, 1, 29, 'https://dropbox/vk/consequatur.png', 617793, {"owner": "Arielle Shields"}, '2017-03-11 14:49:50', '2020-05-05 13:31:28'),
(18, 1, 50, 'https://dropbox/vk/velit.mprg', 153475, {"owner": "Annabelle Beatty"}, '2013-05-11 02:40:36', '2020-05-05 13:31:28'),
(19, 1, 69, 'https://dropbox/vk/rerum.avi', 331849, {"owner": "Christa Bednar"}, '2012-05-11 16:43:05', '2020-05-05 13:31:28'),
(20, 1, 3, 'https://dropbox/vk/sed.avi', 795864, {"owner": "Wilbert Hintz"}, '2015-08-17 00:08:18', '2020-05-05 13:31:28'),
(21, 2, 84, 'https://dropbox/vk/corporis.jpeg', 65894, {"owner": "Margaretta Kris"}, '2010-09-02 17:50:32', '2020-05-05 13:31:28'),
(22, 3, 39, 'https://dropbox/vk/cupiditate.jpeg', 973777, {"owner": "Aiden Beier"}, '2019-02-05 19:31:35', '2020-05-05 13:31:28'),
(23, 1, 70, 'https://dropbox/vk/sit.jpeg', 827303, {"owner": "Carlee Schmidt"}, '2016-01-20 16:47:33', '2020-05-05 13:31:28'),
(24, 1, 15, 'https://dropbox/vk/accusamus.mprg', 8229, {"owner": "Bernadette Schuster"}, '2018-11-06 07:15:48', '2020-05-05 13:31:28'),
(25, 1, 14, 'https://dropbox/vk/amet.jpeg', 471292, {"owner": "Jeanie Koch"}, '2015-12-22 05:38:53', '2020-05-05 13:31:28'),
(26, 2, 24, 'https://dropbox/vk/sit.jpeg', 9443, {"owner": "Ubaldo Gleason"}, '2015-03-31 05:31:50', '2020-05-05 13:31:28'),
(27, 1, 90, 'https://dropbox/vk/quia.png', 4255, {"owner": "Carleton Gibson"}, '2011-11-25 15:24:46', '2020-05-05 13:31:28'),
(28, 1, 7, 'https://dropbox/vk/eligendi.avi', 688901, {"owner": "Deron Langworth"}, '2013-12-11 03:41:03', '2020-05-05 13:31:28'),
(29, 2, 16, 'https://dropbox/vk/et.jpeg', 425128, {"owner": "Janice Hansen"}, '2014-04-07 07:33:50', '2020-05-05 13:31:28'),
(30, 2, 67, 'https://dropbox/vk/et.avi', 62083438, {"owner": "Ephraim Cassin"}, '2013-02-17 03:59:48', '2020-05-05 13:31:28'),
(31, 2, 65, 'https://dropbox/vk/dolore.avi', 3846945, {"owner": "Colleen Bauch"}, '2018-05-05 04:25:09', '2020-05-05 13:31:28'),
(32, 1, 30, 'https://dropbox/vk/rem.png', 701766, {"owner": "Ursula Jast"}, '2017-08-21 20:13:29', '2020-05-05 13:31:28'),
(33, 3, 90, 'https://dropbox/vk/optio.mprg', 5435296, {"owner": "Carleton Gibson"}, '2013-06-18 09:04:41', '2020-05-05 13:31:28'),
(34, 3, 45, 'https://dropbox/vk/ab.jpeg', 170381, {"owner": "Rossie Wyman"}, '2014-12-08 09:02:48', '2020-05-05 13:31:28'),
(35, 1, 66, 'https://dropbox/vk/nostrum.png', 223448, {"owner": "Benedict Walker"}, '2016-07-28 05:07:05', '2020-05-05 13:31:28'),
(36, 1, 52, 'https://dropbox/vk/ipsa.mprg', 44719, {"owner": "Daniela Rempel"}, '2010-06-08 11:10:20', '2020-05-05 13:31:28'),
(37, 3, 73, 'https://dropbox/vk/amet.avi', 4919703, {"owner": "Verla Barrows"}, '2016-07-26 14:03:14', '2020-05-05 13:31:28'),
(38, 3, 83, 'https://dropbox/vk/aut.png', 1001942, {"owner": "Destin Hoeger"}, '2014-03-07 16:40:47', '2020-05-05 13:31:28'),
(39, 3, 1, 'https://dropbox/vk/mollitia.mprg', 8282, {"owner": "Selina Herzog"}, '2019-08-04 15:33:57', '2020-05-05 13:31:28'),
(40, 3, 40, 'https://dropbox/vk/ipsum.avi', 190349573, {"owner": "Faye Ankunding"}, '2013-07-11 06:09:35', '2020-05-05 13:31:28'),
(41, 1, 18, 'https://dropbox/vk/repudiandae.mprg', 490354, {"owner": "Francesca Deckow"}, '2019-08-25 05:09:55', '2020-05-05 13:31:28'),
(42, 3, 49, 'https://dropbox/vk/excepturi.mprg', 329365, {"owner": "Mariela Lang"}, '2019-07-10 01:19:10', '2020-05-05 13:31:28'),
(43, 1, 1, 'https://dropbox/vk/architecto.jpeg', 631000, {"owner": "Selina Herzog"}, '2014-07-26 03:33:10', '2020-05-05 13:31:28'),
(44, 1, 23, 'https://dropbox/vk/pariatur.png', 156906, {"owner": "Walker Leuschke"}, '2011-06-05 19:53:47', '2020-05-05 13:31:28'),
(45, 2, 17, 'https://dropbox/vk/earum.mprg', 61318, {"owner": "Stephania Howe"}, '2017-10-08 07:28:40', '2020-05-05 13:31:28'),
(46, 1, 92, 'https://dropbox/vk/sit.mprg', 37453403, {"owner": "Isabella Muller"}, '2013-10-01 18:18:25', '2020-05-05 13:31:28'),
(47, 2, 76, 'https://dropbox/vk/voluptatem.mprg', 881530, {"owner": "Lottie Mann"}, '2015-02-20 14:36:36', '2020-05-05 13:31:28'),
(48, 2, 73, 'https://dropbox/vk/velit.jpeg', 48329599, {"owner": "Verla Barrows"}, '2015-07-12 15:49:39', '2020-05-05 13:31:28'),
(49, 2, 99, 'https://dropbox/vk/et.jpeg', 2306581, {"owner": "Roberta Dickens"}, '2017-09-17 06:14:33', '2020-05-05 13:31:28'),
(50, 2, 24, 'https://dropbox/vk/ea.jpeg', 926931, {"owner": "Ubaldo Gleason"}, '2016-09-18 01:01:41', '2020-05-05 13:31:28'),
(51, 3, 65, 'https://dropbox/vk/delectus.jpeg', 199500, {"owner": "Colleen Bauch"}, '2013-02-20 10:30:34', '2020-05-05 13:31:28'),
(52, 1, 12, 'https://dropbox/vk/enim.png', 87134, {"owner": "Joelle Casper"}, '2017-09-26 03:38:51', '2020-05-05 13:31:28'),
(53, 1, 64, 'https://dropbox/vk/suscipit.avi', 980068, {"owner": "Claudie Gutkowski"}, '2016-08-17 03:52:37', '2020-05-05 13:31:28'),
(54, 1, 79, 'https://dropbox/vk/quidem.jpeg', 109547, {"owner": "Lisette Koelpin"}, '2011-02-04 09:54:08', '2020-05-05 13:31:28'),
(55, 2, 92, 'https://dropbox/vk/reiciendis.png', 5931949, {"owner": "Isabella Muller"}, '2019-05-02 10:13:30', '2020-05-05 13:31:28'),
(56, 3, 79, 'https://dropbox/vk/itaque.avi', 597533, {"owner": "Lisette Koelpin"}, '2018-11-12 12:00:16', '2020-05-05 13:31:28'),
(57, 2, 82, 'https://dropbox/vk/quibusdam.mprg', 56625466, {"owner": "Courtney Brown"}, '2019-10-02 21:41:25', '2020-05-05 13:31:28'),
(58, 1, 16, 'https://dropbox/vk/eligendi.mprg', 6090652, {"owner": "Janice Hansen"}, '2011-11-27 18:47:55', '2020-05-05 13:31:28'),
(59, 2, 82, 'https://dropbox/vk/reprehenderit.avi', 24336, {"owner": "Courtney Brown"}, '2015-09-23 22:54:31', '2020-05-05 13:31:28'),
(60, 2, 98, 'https://dropbox/vk/nisi.mprg', 87976, {"owner": "Marcel Corwin"}, '2013-03-02 22:14:56', '2020-05-05 13:31:28'),
(61, 2, 28, 'https://dropbox/vk/vitae.jpeg', 649025, {"owner": "Oleta Stanton"}, '2016-03-11 14:03:15', '2020-05-05 13:31:28'),
(62, 3, 79, 'https://dropbox/vk/harum.jpeg', 6285753, {"owner": "Lisette Koelpin"}, '2015-07-07 04:10:13', '2020-05-05 13:31:28'),
(63, 1, 10, 'https://dropbox/vk/repellat.jpeg', 8824829, {"owner": "Rosario Dach"}, '2019-03-13 04:08:14', '2020-05-05 13:31:28'),
(64, 3, 70, 'https://dropbox/vk/quia.avi', 442526, {"owner": "Carlee Schmidt"}, '2017-07-15 16:16:04', '2020-05-05 13:31:28'),
(65, 2, 69, 'https://dropbox/vk/quo.png', 255557, {"owner": "Christa Bednar"}, '2015-01-17 08:15:26', '2020-05-05 13:31:28'),
(66, 1, 71, 'https://dropbox/vk/ut.mprg', 3834630, {"owner": "Otis Wiegand"}, '2014-09-06 10:32:25', '2020-05-05 13:31:28'),
(67, 2, 68, 'https://dropbox/vk/incidunt.mprg', 2299, {"owner": "Wilford Boyer"}, '2014-01-24 12:32:03', '2020-05-05 13:31:28'),
(68, 2, 70, 'https://dropbox/vk/nihil.png', 5396757, {"owner": "Carlee Schmidt"}, '2016-07-07 00:12:48', '2020-05-05 13:31:28'),
(69, 3, 78, 'https://dropbox/vk/qui.avi', 1906, {"owner": "Augustus Nicolas"}, '2019-05-27 20:48:04', '2020-05-05 13:31:28'),
(70, 2, 96, 'https://dropbox/vk/nemo.mprg', 940204, {"owner": "Christa Macejkovic"}, '2012-12-09 23:44:09', '2020-05-05 13:31:28'),
(71, 1, 67, 'https://dropbox/vk/autem.mprg', 924353, {"owner": "Ephraim Cassin"}, '2019-01-18 23:36:57', '2020-05-05 13:31:28'),
(72, 3, 78, 'https://dropbox/vk/voluptate.mprg', 791152, {"owner": "Augustus Nicolas"}, '2017-04-06 04:09:22', '2020-05-05 13:31:28'),
(73, 3, 1, 'https://dropbox/vk/quia.avi', 9132672, {"owner": "Selina Herzog"}, '2017-02-17 06:16:31', '2020-05-05 13:31:28'),
(74, 2, 30, 'https://dropbox/vk/cupiditate.png', 172704, {"owner": "Ursula Jast"}, '2011-04-21 23:50:26', '2020-05-05 13:31:28'),
(75, 1, 32, 'https://dropbox/vk/voluptatem.png', 79596, {"owner": "Alexanne King"}, '2016-10-09 08:58:40', '2020-05-05 13:31:28'),
(76, 2, 80, 'https://dropbox/vk/unde.png', 480062, {"owner": "Abner McCullough"}, '2010-09-06 21:52:16', '2020-05-05 13:31:28'),
(77, 2, 17, 'https://dropbox/vk/sit.mprg', 872198, {"owner": "Stephania Howe"}, '2013-05-15 19:45:55', '2020-05-05 13:31:28'),
(78, 3, 63, 'https://dropbox/vk/cumque.png', 629685773, {"owner": "Crawford Hane"}, '2019-06-29 11:48:23', '2020-05-05 13:31:28'),
(79, 1, 9, 'https://dropbox/vk/beatae.avi', 910803, {"owner": "Alexandra Prosacco"}, '2018-01-07 13:31:03', '2020-05-05 13:31:28'),
(80, 1, 33, 'https://dropbox/vk/deserunt.mprg', 47338, {"owner": "Zackary Larson"}, '2012-07-05 04:10:43', '2020-05-05 13:31:28'),
(81, 1, 25, 'https://dropbox/vk/earum.mprg', 83731744, {"owner": "Kendrick Hansen"}, '2013-11-11 19:07:47', '2020-05-05 13:31:28'),
(82, 2, 10, 'https://dropbox/vk/harum.png', 927425, {"owner": "Rosario Dach"}, '2012-04-16 00:47:49', '2020-05-05 13:31:28'),
(83, 1, 87, 'https://dropbox/vk/autem.mprg', 2080, {"owner": "Sharon Simonis"}, '2015-09-24 21:08:50', '2020-05-05 13:31:28'),
(84, 2, 24, 'https://dropbox/vk/dicta.jpeg', 894715, {"owner": "Ubaldo Gleason"}, '2012-07-06 01:11:53', '2020-05-05 13:31:28'),
(85, 3, 28, 'https://dropbox/vk/rerum.avi', 98765668, {"owner": "Oleta Stanton"}, '2015-04-25 06:59:17', '2020-05-05 13:31:28'),
(86, 3, 32, 'https://dropbox/vk/odit.mprg', 681299, {"owner": "Alexanne King"}, '2018-09-22 14:15:06', '2020-05-05 13:31:28'),
(87, 3, 93, 'https://dropbox/vk/sed.mprg', 712350, {"owner": "Camden Simonis"}, '2014-04-21 21:10:05', '2020-05-05 13:31:28'),
(88, 2, 43, 'https://dropbox/vk/corporis.avi', 38333829, {"owner": "Dayton Larkin"}, '2012-01-23 13:34:23', '2020-05-05 13:31:28'),
(89, 2, 3, 'https://dropbox/vk/a.mprg', 756286, {"owner": "Wilbert Hintz"}, '2014-05-04 10:27:05', '2020-05-05 13:31:28'),
(90, 3, 75, 'https://dropbox/vk/voluptate.png', 87569, {"owner": "Earline Lueilwitz"}, '2018-03-13 15:37:27', '2020-05-05 13:31:28'),
(91, 3, 100, 'https://dropbox/vk/enim.png', 7746, {"owner": "Delpha Flatley"}, '2019-11-29 22:58:55', '2020-05-05 13:31:28'),
(92, 3, 94, 'https://dropbox/vk/et.mprg', 507857, {"owner": "Maybelle Schiller"}, '2015-12-18 14:07:30', '2020-05-05 13:31:28'),
(93, 3, 12, 'https://dropbox/vk/et.png', 511199535, {"owner": "Joelle Casper"}, '2016-12-01 10:42:59', '2020-05-05 13:31:28'),
(94, 2, 42, 'https://dropbox/vk/fugit.jpeg', 9538, {"owner": "Elena Reynolds"}, '2013-09-05 20:08:20', '2020-05-05 13:31:28'),
(95, 3, 89, 'https://dropbox/vk/est.jpeg', 55409, {"owner": "Fredrick Wiegand"}, '2014-01-29 14:39:39', '2020-05-05 13:31:28'),
(96, 3, 98, 'https://dropbox/vk/error.avi', 392232, {"owner": "Marcel Corwin"}, '2013-01-17 11:23:15', '2020-05-05 13:31:28'),
(97, 2, 78, 'https://dropbox/vk/animi.mprg', 107696, {"owner": "Augustus Nicolas"}, '2012-07-02 13:21:43', '2020-05-05 13:31:28'),
(98, 1, 6, 'https://dropbox/vk/perspiciatis.mprg', 27864388, {"owner": "Flo DuBuque"}, '2016-12-18 12:37:34', '2020-05-05 13:31:28'),
(99, 2, 87, 'https://dropbox/vk/unde.avi', 3889, {"owner": "Sharon Simonis"}, '2013-01-19 16:10:04', '2020-05-05 13:31:28'),
(100, 2, 28, 'https://dropbox/vk/sint.avi', 682722, {"owner": "Oleta Stanton"}, '2014-06-21 23:23:10', '2020-05-05 13:31:28');
/*!40000 ALTER TABLE `media` ENABLE KEYS */;
-- Дамп структуры для таблица vk.media_types
DROP TABLE IF EXISTS `media_types`;
CREATE TABLE IF NOT EXISTS `media_types` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `name` (`name`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- Дамп данных таблицы vk.media_types: ~3 rows (приблизительно)
/*!40000 ALTER TABLE `media_types` DISABLE KEYS */;
INSERT INTO `media_types` (`id`, `name`) VALUES
(3, 'audio'),
(1, 'photo'),
(2, 'video');
/*!40000 ALTER TABLE `media_types` ENABLE KEYS */;
-- Дамп структуры для таблица vk.messages
DROP TABLE IF EXISTS `messages`;
CREATE TABLE IF NOT EXISTS `messages` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`from_user_id` int(10) unsigned NOT NULL,
`to_user_id` int(10) unsigned DEFAULT NULL,
`community_id` int(10) unsigned DEFAULT NULL,
`body` text COLLATE utf8_unicode_ci NOT NULL,
`is_important` tinyint(1) DEFAULT NULL,
`is_delivered` tinyint(1) DEFAULT NULL,
`created_at` datetime DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
KEY `messages_from_user_id_fk` (`from_user_id`),
KEY `messages_to_user_id_fk` (`to_user_id`),
KEY `messages_community_id_fk` (`community_id`),
CONSTRAINT `messages_community_id_fk` FOREIGN KEY (`community_id`) REFERENCES `communities` (`id`),
CONSTRAINT `messages_from_user_id_fk` FOREIGN KEY (`from_user_id`) REFERENCES `users` (`id`),
CONSTRAINT `messages_to_user_id_fk` FOREIGN KEY (`to_user_id`) REFERENCES `users` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=150 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- Дамп данных таблицы vk.messages: ~149 rows (приблизительно)
/*!40000 ALTER TABLE `messages` DISABLE KEYS */;
INSERT INTO `messages` (`id`, `from_user_id`, `to_user_id`, `community_id`, `body`, `is_important`, `is_delivered`, `created_at`) VALUES
(1, 38, 77, 8, 'Aut expedita facere et qui. Quibusdam dolor magnam praesentium quibusdam. Ullam cupiditate rerum cupiditate non et pariatur reprehenderit nulla. Odio illo aliquid fuga debitis.', 1, 1, '2019-02-13 17:46:12'),
(2, 88, 88, 4, 'Tempora consequatur ut quibusdam et maiores. Et autem dolore rem optio rem voluptatem dolores iste. Aut hic voluptatem earum sed asperiores. Ut occaecati sint quisquam autem quo nostrum qui quia.', 0, 1, '2015-04-17 12:10:16'),
(3, 51, 25, NULL, 'Nihil sit facilis exercitationem ut. Doloribus occaecati aut enim quam illum. Nostrum maiores voluptas facere laudantium amet laboriosam ea quaerat. Non quibusdam et commodi est.', 0, 0, '2015-10-01 13:30:51'),
(4, 43, 5, NULL, 'Enim quos nemo adipisci qui dolorem. Enim ratione autem soluta est ut libero modi eos. Reprehenderit repudiandae error iste sunt voluptatem sit quis officiis. Sequi quo nemo unde dolorem facilis.', 1, 1, '2012-08-28 10:10:19'),
(5, 48, 64, 8, 'Est accusantium error accusamus a nihil vel. Et accusantium odio iure dolore ut et nam.', 1, 1, '2014-06-22 03:45:06'),
(6, 18, 62, NULL, 'Hic omnis voluptatem explicabo sed quod quaerat nisi magnam. Quo beatae quia alias assumenda sint odio. Eius ut fuga ab et et illo.', 0, 0, '2017-01-13 12:32:00'),
(7, 72, 33, 6, 'Sunt labore et consequatur asperiores est laudantium omnis. Quia aut quia quos cupiditate quod sed cupiditate. Dignissimos illo nesciunt voluptatibus voluptas nemo eveniet dolorem qui.', 1, 0, '2015-12-14 04:49:55'),
(8, 85, 18, NULL, 'Impedit quis ex at non harum. Rerum provident ut animi et sed. Possimus rerum commodi aut laudantium maiores sequi et id.', 0, 0, '2011-01-30 07:10:53'),
(9, 82, 42, NULL, 'Praesentium fuga non maiores corrupti. Maxime enim velit tempore sequi. Corrupti animi nihil autem animi quis. Dolor quia inventore quia quae aut id.', 0, 1, '2017-01-23 21:29:42'),
(10, 44, NULL, NULL, 'Ipsam est quia a tempore sunt nam. Eos officia non porro ipsa. Libero voluptatem debitis reiciendis dolorem eos tempora in. Distinctio non et placeat officia impedit voluptas eum.', 0, 1, '2015-02-11 17:14:53'),
(11, 77, 48, 8, 'Autem sed nam possimus sit voluptatem. Molestiae alias voluptatum voluptatem ipsum aut ad. Deserunt soluta debitis dolore impedit. Ullam enim rerum molestiae.', 1, 1, '2019-08-20 22:15:33'),
(12, 74, 46, 9, 'Sit rerum molestiae distinctio et est praesentium. Ducimus dolor quam delectus labore vel qui.', 1, 1, '2018-08-21 06:09:26'),
(13, 82, 38, 2, 'Temporibus optio aut corrupti sed quam ratione voluptas distinctio. Tempore amet accusamus tenetur est quidem. Perferendis et corporis nobis nihil eaque. Optio nobis tenetur aut ea.', 1, 0, '2017-07-22 23:42:49'),
(14, 77, 92, NULL, 'Sit autem molestiae ipsam at in cumque quia. Deserunt in porro qui sed sit.', 1, 0, '2016-10-05 14:14:17'),
(15, 55, 76, 3, 'Non eius enim voluptates sed nulla beatae. Rerum illum et tenetur dolorem voluptas voluptatem. Expedita repellat distinctio ea. Ratione dolorem optio vel facilis dolorem aspernatur ea.', 1, 1, '2019-10-12 13:23:58'),
(16, 97, 31, NULL, 'Asperiores omnis sed suscipit. Quibusdam modi vel rerum laboriosam repellat nihil. Sequi est consequatur assumenda molestiae.', 1, 1, '2010-12-28 17:32:49'),
(17, 64, 39, 8, 'Earum iusto aut repellat eligendi aut sapiente quis fuga. Similique quis et rerum deleniti. Laborum et omnis consequatur distinctio necessitatibus sit ea modi.', 0, 0, '2012-06-03 22:42:18'),
(18, 32, 88, NULL, 'Deserunt nam sed dolorem corrupti nobis similique. Hic quia sed saepe ad vel est explicabo. Deleniti consectetur atque quisquam.', 0, 1, '2018-12-12 14:32:15'),
(19, 95, 70, NULL, 'A qui iste qui dolores. Fugiat nisi omnis magnam quia aut sit non. Aut ut sint iusto cumque rerum rerum. Omnis recusandae odio enim accusantium dicta.', 0, 1, '2015-03-09 16:58:21'),
(20, 59, 88, 4, 'Et cupiditate error sed qui explicabo sed. Nihil voluptas velit sed impedit similique iusto hic ea. Cumque totam vel quasi nihil.', 0, 0, '2017-03-03 05:38:19'),
(21, 74, 68, NULL, 'Ut doloribus nam fugit expedita ab exercitationem. Itaque commodi voluptas quaerat esse dolorum. Ut qui et esse vitae sunt sed autem ut.', 0, 1, '2015-09-17 17:00:24'),
(22, 78, 63, NULL, 'Nobis explicabo odio non vero voluptatem. Expedita quos iste corporis incidunt inventore quia.', 0, 1, '2018-07-05 00:56:59'),
(23, 78, 99, 2, 'Libero ut voluptas dolores est similique nihil architecto distinctio. Odio consequuntur rem ullam debitis.', 0, 0, '2018-01-05 10:27:35'),
(24, 3, 21, NULL, 'Ut illo voluptatem placeat ratione. Dolorem veniam rerum cumque atque est aut. Rem est repellat est aut.', 1, 1, '2019-04-05 06:51:35'),
(25, 32, 76, NULL, 'Sed ut minima dolore in non voluptatem. Qui voluptas accusantium necessitatibus tempore aut eos.', 0, 1, '2018-04-01 17:57:23'),
(26, 39, 34, 3, 'Aut tempore sed commodi. Voluptas enim consequuntur quod officia adipisci dolor sunt animi. Asperiores inventore quaerat non. Similique est vitae iure consequatur.', 1, 0, '2016-06-10 15:16:08'),
(27, 99, 94, NULL, 'Et quod quod autem eos. Maxime voluptatem nulla asperiores dolore atque illum. Saepe alias consequatur esse modi alias sit beatae.', 1, 0, '2014-10-21 08:58:30'),
(28, 13, 67, NULL, 'Ut consequatur qui natus in consectetur aut ut. Tempore odit rerum dignissimos consequuntur. Similique labore ducimus et et.', 1, 1, '2015-10-25 08:23:18'),
(29, 44, 62, NULL, 'Fugit maxime voluptatem voluptatem reprehenderit quo. Repellendus consectetur eos non cumque. Aperiam id illo nulla itaque praesentium. Et nihil ipsa eum facilis consequatur.', 0, 0, '2013-10-02 21:23:08'),
(30, 16, 20, NULL, 'Repellat consequatur asperiores harum vero modi ex. Vel et in impedit nesciunt quam necessitatibus quis. Sit eius soluta sint dolore atque perspiciatis aliquam maiores. Cumque aut eius quibusdam aut.', 0, 1, '2011-08-19 19:56:17'),
(31, 36, 94, NULL, 'Id excepturi qui eveniet ab nulla velit. Dicta ipsam porro blanditiis explicabo cumque. Nam vel quae rerum eum eveniet maiores eum. Et et placeat quae earum dolorem quas pariatur aliquam.', 1, 0, '2020-02-07 13:52:27'),
(32, 40, 33, 6, 'Cumque eius natus consequatur. Porro aliquam voluptatem sed voluptas non excepturi. Optio nihil non non dolorum ea. Beatae accusamus et et a exercitationem et.', 0, 1, '2012-02-20 07:10:36'),
(33, 17, 49, NULL, 'Ad eos quibusdam ut. Eligendi minus ratione et et repellat mollitia et. Beatae doloremque aliquid sequi neque placeat. Alias consequatur aut dolorum hic dolorem id quos et.', 1, 0, '2015-12-20 09:11:36'),
(34, 18, 51, NULL, 'Culpa autem repellendus officia molestias ad eaque rerum. Ipsam quia ut necessitatibus odit porro. Sed repellendus repellat ea. Accusantium nihil sequi dolorum id ut iusto quidem.', 1, 0, '2018-02-07 00:27:05'),
(35, 85, NULL, NULL, 'Officia ullam rerum ullam consequatur eos. Consectetur omnis consequatur illum perferendis dolore. Et officia harum quas ab. Vitae corporis sapiente aut harum odio delectus.', 1, 0, '2017-02-01 05:53:45'),
(36, 65, 20, NULL, 'Cum consequatur in non dolores omnis culpa. Voluptatem nihil eum velit sed recusandae voluptas. In labore ad quaerat omnis.\nQuia ipsa nam vero veritatis. Ullam quidem qui libero ullam.', 1, 1, '2015-03-25 07:41:30'),
(37, 75, 19, NULL, 'Voluptatum et sapiente ad voluptates. Placeat tenetur libero culpa aut. Placeat placeat molestias et doloremque.', 0, 1, '2012-11-28 15:01:34'),
(38, 87, 11, 7, 'At reprehenderit at nisi consequatur. Et omnis voluptas veniam possimus natus quaerat quo. Ut quo sed nulla quibusdam eveniet rerum itaque.', 0, 1, '2018-07-30 17:21:04'),
(39, 87, 43, 7, 'Possimus laboriosam suscipit tempora dolor amet. Ut qui consequatur rem beatae error impedit deserunt. Error voluptatem voluptatibus doloremque temporibus. Omnis sit qui ex.', 0, 0, '2012-07-22 05:01:58'),
(40, 56, NULL, NULL, 'Excepturi voluptas sequi corrupti laborum expedita tenetur quis exercitationem. Id necessitatibus laboriosam voluptatum maiores. Ipsa rem et eos qui occaecati eveniet qui.', 1, 1, '2019-06-03 14:54:36'),
(41, 37, 99, 2, 'Placeat nisi adipisci cupiditate id numquam itaque. Nulla distinctio eveniet aut voluptates eum est nihil. Nobis amet est omnis commodi sit necessitatibus molestiae excepturi.', 1, 0, '2018-11-29 11:12:30'),
(42, 8, 65, NULL, 'Ipsum qui quia rerum blanditiis quisquam vel eum. Aut ea officiis non facilis distinctio totam. Perferendis molestias minus labore sit. Et neque quam ex voluptatem est nam.', 0, 0, '2014-07-31 01:27:20'),
(43, 42, 48, NULL, 'Voluptatem nemo natus sed voluptatibus inventore qui. Consequatur itaque incidunt officiis perferendis impedit eveniet dolore. Perferendis perspiciatis vero aut voluptatem qui aperiam quasi.', 0, 1, '2016-01-11 06:23:41'),
(44, 20, 100, NULL, 'Vero ut repudiandae autem nisi. Doloribus quia aut sed repellendus modi aut.', 1, 0, '2013-06-21 21:04:17'),
(45, 18, 85, NULL, 'Laborum ut nesciunt at est omnis nesciunt illum. Molestiae quidem ad sed vero distinctio aut. Tempora dolorum maiores odio accusamus harum veniam.', 0, 1, '2016-01-03 11:44:17'),
(46, 92, 49, NULL, 'Autem rerum quia cupiditate eos. Tenetur accusamus asperiores quis sit nihil vitae fuga. Repellat voluptatem nesciunt id occaecati repellat.', 0, 0, '2011-03-01 04:57:07'),
(47, 37, 66, NULL, 'Rerum ut quae sed nesciunt animi. Voluptas error officia earum earum. Cum aut fuga quo facere veritatis facere officiis et.', 1, 1, '2011-06-02 14:27:52'),
(48, 18, 32, 2, 'Dolor ipsam animi deleniti vero distinctio. Sed a dolorum ut corporis nostrum libero. Ut vero aliquid autem aliquid. Delectus molestiae nobis qui atque.', 1, 1, '2017-12-13 22:59:10'),
(49, 66, 81, 3, 'Quia consequatur minima repudiandae libero rerum ad non. Architecto expedita possimus soluta quo. Consequatur debitis vel illum eius sed nemo. Enim sed enim eos.', 1, 0, '2017-07-17 15:55:20'),
(50, 75, 37, 3, 'Repellat dolor soluta sed. Minus ipsam minus iusto aut blanditiis. Fugit non molestias placeat consequatur.', 1, 1, '2015-09-27 02:58:51'),
(51, 3, 88, NULL, 'Autem porro architecto perferendis qui nemo. Id sed provident ut eligendi officia repellendus. Dolor eos quia sequi accusantium illo dignissimos. Et ipsum ipsa sapiente eum.', 1, 0, '2011-09-27 09:07:58'),
(52, 26, 96, NULL, 'Fugit sit reprehenderit eveniet odio ipsa ut inventore. Sint similique quod sit error quod ut autem eaque.', 0, 1, '2017-08-13 20:12:34'),
(53, 19, 37, NULL, 'Dolor et vel facere quidem. Deleniti sequi veritatis et. Rerum ea sint recusandae sed modi est autem quasi. Harum autem et facere eius sapiente.', 1, 1, '2015-11-22 19:12:56'),
(54, 61, 57, NULL, 'Quis doloremque sit nulla tempora enim cumque et perspiciatis. Delectus qui velit quis corporis. Reprehenderit velit saepe est voluptatem adipisci. Perspiciatis est possimus et iusto et.', 0, 1, '2016-03-29 18:24:31'),
(55, 54, 79, 7, 'Enim voluptas provident ea voluptate facilis. Modi aut in est et. Ipsa ab distinctio eligendi quibusdam error.', 1, 0, '2011-08-20 09:59:30'),
(56, 28, NULL, NULL, 'Repudiandae dolore ex aperiam architecto. Et at possimus sed voluptatem perspiciatis quaerat ut. Non est vitae eos in alias ut ut.', 0, 1, '2019-08-18 02:33:23'),
(57, 22, 10, 6, 'Dolor qui quae qui at eum rerum enim. Itaque ut dolorem voluptas quasi dolores aliquid. Omnis cupiditate maxime eum quod quis voluptatem sed. Non eos rerum fugit dolores culpa a consequuntur.', 1, 1, '2012-11-24 12:46:14'),
(58, 36, 21, NULL, 'Ut est quae consectetur molestiae dolores quia. Expedita repellat quidem atque sint sunt. Non deserunt sint aut tenetur.', 0, 0, '2015-06-12 06:07:52'),
(59, 80, 86, NULL, 'Qui ab distinctio nihil ullam sint eos. Amet laudantium explicabo quidem. Veniam aut deleniti velit et omnis tempora non. Libero laudantium sit sunt.', 1, 0, '2011-06-04 18:13:10'),
(60, 100, 60, NULL, 'Impedit cumque quia repellat officiis. Repellendus aut in esse debitis saepe qui. Inventore vel omnis ut beatae. Rerum qui sequi quia fugit unde magni.', 1, 0, '2013-08-18 09:26:35'),
(61, 10, 63, NULL, 'Ut quia fuga accusantium ratione quis. Suscipit quia blanditiis incidunt reiciendis et sed fuga. Aliquid cum vero hic porro tempore id quia. Sint natus id voluptatibus et voluptatem libero id.', 1, 0, '2016-09-21 04:41:58'),
(62, 45, 36, NULL, 'Natus reiciendis molestiae consectetur autem omnis et. Nihil architecto eos voluptatem dolor. Expedita enim cupiditate animi nulla illum fuga.', 1, 1, '2013-09-14 14:50:48'),
(63, 45, 89, NULL, 'Repellendus harum accusamus corrupti est qui et. Et voluptatum harum eligendi et. Rerum ratione at ipsam aut. Nemo qui et quia rerum voluptatem ex.', 1, 0, '2019-04-22 22:03:59'),
(64, 27, 87, 1, 'Modi consequatur culpa saepe. Autem soluta earum quia voluptas. Qui id libero eos voluptas laudantium atque dolores. Non quidem quia ea dignissimos.', 1, 1, '2018-02-28 02:20:31'),
(65, 8, 21, NULL, 'Laboriosam dignissimos amet quis architecto assumenda voluptas esse tempore. Facere quis sit odit ipsum odit. Molestiae non ut voluptas sed.', 1, 0, '2017-11-23 11:40:24'),
(66, 74, 43, 9, 'Voluptatem voluptatem sapiente ut non et et. Et qui sunt in eum fugit non. Qui libero rerum est consectetur.', 1, 1, '2019-08-30 16:03:31'),
(67, 88, 1, 3, 'Ducimus et modi magni enim. Aut sunt quia eaque voluptas quia ut. Nobis dolor et sit nihil eaque. Natus dolorum sed explicabo omnis quod.', 0, 0, '2019-05-02 02:50:39'),
(68, 24, 6, NULL, 'Omnis et recusandae consequuntur saepe aspernatur. Illo veritatis suscipit delectus. Doloribus cumque necessitatibus nam sint nemo. Quia similique deleniti provident vitae sunt odit natus.', 1, 0, '2012-10-28 12:57:24'),
(69, 69, 83, NULL, 'Ipsa sunt voluptas rem illum vitae quia. Perferendis perferendis in et cumque tempore optio assumenda. Dolor iste maxime dicta aut. Occaecati consequatur maxime soluta qui ducimus illo quae.', 1, 0, '2015-08-11 20:25:35'),
(70, 10, 85, NULL, 'Quaerat fuga voluptates architecto autem. Sit occaecati iure in quaerat consequuntur. Veritatis numquam alias harum in iusto ut.\nHic omnis aut tempore est et et. Reprehenderit sed ullam animi et.', 0, 0, '2011-06-08 06:15:52'),
(71, 2, 57, 4, 'Et dignissimos ratione quisquam non doloremque quos voluptatem. Culpa consequatur velit eum rerum quia dolor suscipit. Sit in cupiditate repellendus est magnam consequuntur labore vel.', 1, 0, '2012-10-04 16:45:20'),
(72, 82, 78, 2, 'Est accusantium laudantium quis quod omnis. Maiores voluptatem provident dolor debitis quia impedit commodi. Nam ut quia cum laboriosam.', 0, 0, '2016-10-29 09:39:19'),
(73, 56, 83, NULL, 'Adipisci natus et repudiandae aperiam consequatur odit reprehenderit id. Neque ea dolorem qui perferendis. Optio qui sint qui tenetur ducimus alias. Excepturi natus nobis earum rerum neque fugiat et.', 0, 1, '2015-07-03 10:19:06'),
(74, 68, 9, NULL, 'Ex voluptatibus eos pariatur cumque beatae animi. In eius repudiandae nemo eaque vitae vitae repellat vitae. Voluptas accusamus repellat pariatur aliquam sint recusandae ut.', 1, 1, '2020-03-08 17:36:51'),
(75, 35, 20, NULL, 'Quaerat vero saepe incidunt illum porro voluptas vitae. Qui incidunt et sunt dicta consequatur ipsum corporis.', 1, 1, '2012-11-01 07:09:23'),
(76, 77, 38, 8, 'Magni voluptatem consectetur illo ut doloribus. Cupiditate consequatur repudiandae amet reiciendis rerum sed ut. Vel rerum sit iste eos sequi sunt fuga.', 1, 0, '2015-05-13 12:09:04'),
(77, 84, 32, 1, 'Et eveniet blanditiis cumque impedit molestiae aut. Libero nemo pariatur dolorem exercitationem et aut dolorem. Ratione laborum ullam est laboriosam cupiditate.', 1, 0, '2018-07-09 14:27:56'),
(78, 94, 1, NULL, 'Sed est debitis eos aut perferendis laudantium. Id sint itaque tempora et est eius quis. Et quisquam est nulla quam exercitationem ipsa voluptatem molestiae. Aut nostrum quas eum maiores.', 0, 1, '2012-08-05 00:44:28'),
(79, 24, NULL, NULL, 'Quos enim dolores deserunt. Dignissimos dolorem reiciendis et nemo quo nihil. Fugiat sed et reiciendis ipsam voluptatem.', 1, 1, '2011-01-11 06:11:17'),
(80, 39, 68, 3, 'Velit ex ipsam sunt consequatur. Repudiandae qui corporis illo sit nobis minus. Delectus voluptatem aut perspiciatis beatae laborum quia aut. Porro aut explicabo quis est.', 1, 0, '2011-10-10 16:16:52'),
(81, 14, 70, NULL, 'Facilis ipsam incidunt enim eum possimus aliquam quis minus. Quos cum vel fugiat et vel.', 0, 1, '2014-10-05 03:09:16'),
(82, 50, 20, 5, 'Beatae vel qui expedita quos mollitia est perspiciatis. Veniam eaque voluptates deserunt aut at dolor. Eos aut id ut quia enim.', 0, 1, '2013-01-07 00:55:06'),
(83, 75, 84, 3, 'In est quaerat dicta laborum aperiam. Officia similique id temporibus error dolore aperiam aut.', 1, 1, '2017-06-09 00:10:01'),
(84, 6, 85, NULL, 'Maiores veritatis placeat porro non quisquam necessitatibus quo. Aut itaque est sit laboriosam. Eum possimus incidunt debitis dolor minima voluptas quaerat. Distinctio aut error quaerat quia.', 1, 0, '2013-05-22 04:44:18'),
(85, 4, 20, NULL, 'Blanditiis alias eum officiis eligendi deleniti. Eius laborum nam dicta. A magnam officiis blanditiis ex eos necessitatibus fugit.', 0, 0, '2019-03-23 09:33:15'),
(86, 23, NULL, NULL, 'Eum eos velit rerum. Perspiciatis molestias sint libero non. Hic sed labore rerum cumque sint. Nam nihil itaque at magnam non est officia.', 1, 1, '2011-01-18 11:11:59'),
(87, 91, 81, NULL, 'Numquam inventore fugiat cum aut ut. Illo minima sit iusto qui voluptatem dolorem. Eum est numquam quisquam asperiores ut voluptates fugiat. Enim velit placeat ad commodi aperiam.', 1, 0, '2019-11-25 00:28:01'),
(88, 28, 75, NULL, 'Animi cum et enim ut mollitia amet ad. Hic maiores sint at voluptate alias cupiditate et. Sint eum laboriosam incidunt modi perspiciatis distinctio voluptatibus.', 1, 1, '2011-03-05 03:06:55'),
(89, 72, 98, NULL, 'Quia sunt quaerat ipsum suscipit. Error cum vel vel dolorum non ea. Harum tempora quisquam explicabo laudantium eum eligendi nisi.', 0, 0, '2011-10-12 17:55:05'),
(90, 100, 37, NULL, 'Reiciendis aliquid voluptas aut ut sapiente. Expedita optio voluptatem aspernatur.', 1, 1, '2017-06-26 06:13:42'),
(91, 14, 50, NULL, 'Distinctio suscipit quo at alias. Ab commodi sequi officiis non. Rerum eos aperiam vitae omnis.', 1, 1, '2015-04-04 01:10:50'),
(92, 21, NULL, NULL, 'Harum qui quod est laboriosam sapiente error. Et id et voluptas natus sequi laborum. Est eum modi perspiciatis ipsam.', 1, 1, '2015-03-14 04:40:52'),
(93, 67, 77, 8, 'Ut deleniti magni voluptatem dolores. Exercitationem sint quia veritatis molestiae aut dolorem. At consequuntur itaque sit ut explicabo voluptatem esse.', 1, 0, '2015-05-03 18:35:57'),
(94, 95, NULL, NULL, 'Suscipit ut quia velit harum culpa. Velit sunt consequatur voluptate omnis ratione tempore est.', 1, 0, '2017-08-09 20:38:48'),
(95, 32, 83, NULL, 'Velit iusto vel quam temporibus. Consequatur nesciunt veritatis quos totam hic error non. Nemo incidunt repellendus enim.', 1, 0, '2013-07-26 11:04:01'),
(96, 86, 6, NULL, 'Accusantium numquam ducimus qui voluptatem quis. Cupiditate et quas ipsum molestiae provident ex non in. Ipsam assumenda eos voluptatum.', 1, 0, '2014-07-28 14:37:27'),
(97, 30, 32, 1, 'Molestiae autem voluptate qui veniam similique velit. Dignissimos eligendi nam aliquam. Rem eos magnam vel reprehenderit.', 0, 0, '2018-10-03 23:54:19'),
(98, 51, 24, NULL, 'Ea totam aut tempora est nisi saepe. Est labore incidunt molestiae et quod est quia.', 0, 1, '2016-03-02 05:14:16'),
(99, 73, 48, NULL, 'Consequatur eligendi blanditiis iste. Et velit necessitatibus enim deserunt alias incidunt distinctio. Laborum architecto laborum itaque cupiditate. Omnis consequuntur omnis ullam optio optio.', 1, 0, '2013-08-21 11:35:45'),
(100, 65, 10, NULL, 'Officia corrupti ut voluptatum sit similique molestiae sed. Aut ad ut autem ut dolor ea vel. Est dolore qui minima maiores minima nesciunt.', 0, 1, '2016-06-21 18:01:35'),
(101, 22, 22, 6, 'Aut expedita facere et qui. Quibusdam dolor magnam praesentium quibusdam. Ullam cupiditate rerum cupiditate non et pariatur reprehenderit nulla. Odio illo aliquid fuga debitis.', 0, 0, '2020-05-05 20:12:37'),
(102, 66, 92, 4, 'Aut expedita facere et qui. Quibusdam dolor magnam praesentium quibusdam. Ullam cupiditate rerum cupiditate non et pariatur reprehenderit nulla. Odio illo aliquid fuga debitis.', 0, 0, '2020-05-05 20:12:51'),
(103, 35, 96, NULL, 'Aut expedita facere et qui. Quibusdam dolor magnam praesentium quibusdam. Ullam cupiditate rerum cupiditate non et pariatur reprehenderit nulla. Odio illo aliquid fuga debitis.', 0, 0, '2020-05-05 20:12:51'),
(104, 14, 63, NULL, 'Aut expedita facere et qui. Quibusdam dolor magnam praesentium quibusdam. Ullam cupiditate rerum cupiditate non et pariatur reprehenderit nulla. Odio illo aliquid fuga debitis.', 0, 0, '2020-05-05 20:12:51'),
(105, 23, NULL, NULL, 'Aut expedita facere et qui. Quibusdam dolor magnam praesentium quibusdam. Ullam cupiditate rerum cupiditate non et pariatur reprehenderit nulla. Odio illo aliquid fuga debitis.', 0, 0, '2020-05-05 20:12:54'),
(106, 90, 52, 7, 'Aut expedita facere et qui. Quibusdam dolor magnam praesentium quibusdam. Ullam cupiditate rerum cupiditate non et pariatur reprehenderit nulla. Odio illo aliquid fuga debitis.', 0, 0, '2020-05-05 20:12:54'),
(107, 11, 87, 7, 'Aut expedita facere et qui. Quibusdam dolor magnam praesentium quibusdam. Ullam cupiditate rerum cupiditate non et pariatur reprehenderit nulla. Odio illo aliquid fuga debitis.', 0, 0, '2020-05-05 20:12:54'),
(108, 4, 53, NULL, 'Aut expedita facere et qui. Quibusdam dolor magnam praesentium quibusdam. Ullam cupiditate rerum cupiditate non et pariatur reprehenderit nulla. Odio illo aliquid fuga debitis.', 0, 0, '2020-05-05 20:12:56'),
(109, 95, NULL, NULL, 'Aut expedita facere et qui. Quibusdam dolor magnam praesentium quibusdam. Ullam cupiditate rerum cupiditate non et pariatur reprehenderit nulla. Odio illo aliquid fuga debitis.', 0, 0, '2020-05-05 20:12:56'),
(110, 36, 99, 10, 'Aut expedita facere et qui. Quibusdam dolor magnam praesentium quibusdam. Ullam cupiditate rerum cupiditate non et pariatur reprehenderit nulla. Odio illo aliquid fuga debitis.', 0, 0, '2020-05-05 20:12:56'),
(111, 12, 12, 8, 'Aut expedita facere et qui. Quibusdam dolor magnam praesentium quibusdam. Ullam cupiditate rerum cupiditate non et pariatur reprehenderit nulla. Odio illo aliquid fuga debitis.', 0, 0, '2020-05-05 20:12:57'),
(112, 79, 24, NULL, 'Aut expedita facere et qui. Quibusdam dolor magnam praesentium quibusdam. Ullam cupiditate rerum cupiditate non et pariatur reprehenderit nulla. Odio illo aliquid fuga debitis.', 0, 0, '2020-05-05 20:12:57'),
(113, 42, 80, NULL, 'Aut expedita facere et qui. Quibusdam dolor magnam praesentium quibusdam. Ullam cupiditate rerum cupiditate non et pariatur reprehenderit nulla. Odio illo aliquid fuga debitis.', 0, 0, '2020-05-05 20:12:57'),
(114, 86, 48, NULL, 'Aut expedita facere et qui. Quibusdam dolor magnam praesentium quibusdam. Ullam cupiditate rerum cupiditate non et pariatur reprehenderit nulla. Odio illo aliquid fuga debitis.', 0, 0, '2020-05-05 20:12:57'),
(115, 30, 73, 1, 'Aut expedita facere et qui. Quibusdam dolor magnam praesentium quibusdam. Ullam cupiditate rerum cupiditate non et pariatur reprehenderit nulla. Odio illo aliquid fuga debitis.', 0, 0, '2020-05-05 20:12:57'),
(116, 32, 82, 2, 'Aut expedita facere et qui. Quibusdam dolor magnam praesentium quibusdam. Ullam cupiditate rerum cupiditate non et pariatur reprehenderit nulla. Odio illo aliquid fuga debitis.', 0, 0, '2020-05-05 20:12:57'),
(117, 24, 24, NULL, 'Aut expedita facere et qui. Quibusdam dolor magnam praesentium quibusdam. Ullam cupiditate rerum cupiditate non et pariatur reprehenderit nulla. Odio illo aliquid fuga debitis.', 0, 0, '2020-05-05 20:12:58'),
(118, 18, 18, 9, 'Aut expedita facere et qui. Quibusdam dolor magnam praesentium quibusdam. Ullam cupiditate rerum cupiditate non et pariatur reprehenderit nulla. Odio illo aliquid fuga debitis.', 0, 0, '2020-05-05 20:12:58'),
(119, 70, 90, 9, 'Aut expedita facere et qui. Quibusdam dolor magnam praesentium quibusdam. Ullam cupiditate rerum cupiditate non et pariatur reprehenderit nulla. Odio illo aliquid fuga debitis.', 0, 0, '2020-05-05 20:12:58'),
(120, 37, 78, 2, 'Aut expedita facere et qui. Quibusdam dolor magnam praesentium quibusdam. Ullam cupiditate rerum cupiditate non et pariatur reprehenderit nulla. Odio illo aliquid fuga debitis.', 0, 0, '2020-05-05 20:12:58'),
(121, 67, 76, 8, 'Aut expedita facere et qui. Quibusdam dolor magnam praesentium quibusdam. Ullam cupiditate rerum cupiditate non et pariatur reprehenderit nulla. Odio illo aliquid fuga debitis.', 0, 0, '2020-05-05 20:12:58'),
(122, 12, 4, NULL, 'Aut expedita facere et qui. Quibusdam dolor magnam praesentium quibusdam. Ullam cupiditate rerum cupiditate non et pariatur reprehenderit nulla. Odio illo aliquid fuga debitis.', 0, 0, '2020-05-05 20:12:58'),
(123, 21, 15, NULL, 'Aut expedita facere et qui. Quibusdam dolor magnam praesentium quibusdam. Ullam cupiditate rerum cupiditate non et pariatur reprehenderit nulla. Odio illo aliquid fuga debitis.', 0, 0, '2020-05-05 20:12:58'),
(124, 71, 93, NULL, 'Aut expedita facere et qui. Quibusdam dolor magnam praesentium quibusdam. Ullam cupiditate rerum cupiditate non et pariatur reprehenderit nulla. Odio illo aliquid fuga debitis.', 0, 0, '2020-05-05 20:12:58'),
(125, 43, 43, 7, 'Aut expedita facere et qui. Quibusdam dolor magnam praesentium quibusdam. Ullam cupiditate rerum cupiditate non et pariatur reprehenderit nulla. Odio illo aliquid fuga debitis.', 0, 0, '2020-05-05 20:12:58'),
(126, 55, 51, NULL, 'Aut expedita facere et qui. Quibusdam dolor magnam praesentium quibusdam. Ullam cupiditate rerum cupiditate non et pariatur reprehenderit nulla. Odio illo aliquid fuga debitis.', 0, 0, '2020-05-05 20:13:11'),
(127, 97, NULL, NULL, 'Aut expedita facere et qui. Quibusdam dolor magnam praesentium quibusdam. Ullam cupiditate rerum cupiditate non et pariatur reprehenderit nulla. Odio illo aliquid fuga debitis.', 0, 0, '2020-05-05 20:13:11'),
(128, 69, 48, NULL, 'Aut expedita facere et qui. Quibusdam dolor magnam praesentium quibusdam. Ullam cupiditate rerum cupiditate non et pariatur reprehenderit nulla. Odio illo aliquid fuga debitis.', 0, 0, '2020-05-05 20:13:11'),
(129, 69, 11, 7, 'Aut expedita facere et qui. Quibusdam dolor magnam praesentium quibusdam. Ullam cupiditate rerum cupiditate non et pariatur reprehenderit nulla. Odio illo aliquid fuga debitis.', 0, 0, '2020-05-05 20:13:12'),
(130, 61, 59, 4, 'Aut expedita facere et qui. Quibusdam dolor magnam praesentium quibusdam. Ullam cupiditate rerum cupiditate non et pariatur reprehenderit nulla. Odio illo aliquid fuga debitis.', 0, 0, '2020-05-05 20:13:12'),
(131, 29, 54, NULL, 'Aut expedita facere et qui. Quibusdam dolor magnam praesentium quibusdam. Ullam cupiditate rerum cupiditate non et pariatur reprehenderit nulla. Odio illo aliquid fuga debitis.', 0, 0, '2020-05-05 20:13:12'),
(132, 15, 72, 10, 'Aut expedita facere et qui. Quibusdam dolor magnam praesentium quibusdam. Ullam cupiditate rerum cupiditate non et pariatur reprehenderit nulla. Odio illo aliquid fuga debitis.', 0, 0, '2020-05-05 20:13:13'),
(133, 27, 3, NULL, 'Aut expedita facere et qui. Quibusdam dolor magnam praesentium quibusdam. Ullam cupiditate rerum cupiditate non et pariatur reprehenderit nulla. Odio illo aliquid fuga debitis.', 0, 0, '2020-05-05 20:13:13'),
(134, 89, 64, NULL, 'Aut expedita facere et qui. Quibusdam dolor magnam praesentium quibusdam. Ullam cupiditate rerum cupiditate non et pariatur reprehenderit nulla. Odio illo aliquid fuga debitis.', 0, 0, '2020-05-05 20:13:13'),
(135, 17, 62, 5, 'Aut expedita facere et qui. Quibusdam dolor magnam praesentium quibusdam. Ullam cupiditate rerum cupiditate non et pariatur reprehenderit nulla. Odio illo aliquid fuga debitis.', 0, 0, '2020-05-05 20:13:13'),
(136, 46, 100, NULL, 'Aut expedita facere et qui. Quibusdam dolor magnam praesentium quibusdam. Ullam cupiditate rerum cupiditate non et pariatur reprehenderit nulla. Odio illo aliquid fuga debitis.', 0, 0, '2020-05-05 20:13:13'),
(137, 79, 73, 4, 'Aut expedita facere et qui. Quibusdam dolor magnam praesentium quibusdam. Ullam cupiditate rerum cupiditate non et pariatur reprehenderit nulla. Odio illo aliquid fuga debitis.', 0, 0, '2020-05-05 20:13:13'),
(138, 35, 54, NULL, 'Aut expedita facere et qui. Quibusdam dolor magnam praesentium quibusdam. Ullam cupiditate rerum cupiditate non et pariatur reprehenderit nulla. Odio illo aliquid fuga debitis.', 0, 0, '2020-05-05 20:13:14'),
(139, 58, 34, NULL, 'Aut expedita facere et qui. Quibusdam dolor magnam praesentium quibusdam. Ullam cupiditate rerum cupiditate non et pariatur reprehenderit nulla. Odio illo aliquid fuga debitis.', 0, 0, '2020-05-05 20:13:14'),
(140, 16, 12, 8, 'Aut expedita facere et qui. Quibusdam dolor magnam praesentium quibusdam. Ullam cupiditate rerum cupiditate non et pariatur reprehenderit nulla. Odio illo aliquid fuga debitis.', 0, 0, '2020-05-05 20:13:14'),
(141, 16, 3, NULL, 'Aut expedita facere et qui. Quibusdam dolor magnam praesentium quibusdam. Ullam cupiditate rerum cupiditate non et pariatur reprehenderit nulla. Odio illo aliquid fuga debitis.', 0, 0, '2020-05-05 20:13:14'),
(142, 88, 7, 3, 'Aut expedita facere et qui. Quibusdam dolor magnam praesentium quibusdam. Ullam cupiditate rerum cupiditate non et pariatur reprehenderit nulla. Odio illo aliquid fuga debitis.', 0, 0, '2020-05-05 20:13:14'),
(143, 84, 9, NULL, 'Aut expedita facere et qui. Quibusdam dolor magnam praesentium quibusdam. Ullam cupiditate rerum cupiditate non et pariatur reprehenderit nulla. Odio illo aliquid fuga debitis.', 0, 0, '2020-05-05 20:13:14'),
(144, 21, 55, NULL, 'Aut expedita facere et qui. Quibusdam dolor magnam praesentium quibusdam. Ullam cupiditate rerum cupiditate non et pariatur reprehenderit nulla. Odio illo aliquid fuga debitis.', 0, 0, '2020-05-05 20:13:15'),
(145, 96, NULL, NULL, 'Aut expedita facere et qui. Quibusdam dolor magnam praesentium quibusdam. Ullam cupiditate rerum cupiditate non et pariatur reprehenderit nulla. Odio illo aliquid fuga debitis.', 0, 0, '2020-05-05 20:13:15'),
(146, 19, 37, NULL, 'Aut expedita facere et qui. Quibusdam dolor magnam praesentium quibusdam. Ullam cupiditate rerum cupiditate non et pariatur reprehenderit nulla. Odio illo aliquid fuga debitis.', 0, 0, '2020-05-05 20:13:15'),
(147, 99, 18, 2, 'Aut expedita facere et qui. Quibusdam dolor magnam praesentium quibusdam. Ullam cupiditate rerum cupiditate non et pariatur reprehenderit nulla. Odio illo aliquid fuga debitis.', 0, 0, '2020-05-05 20:13:15'),
(148, 25, 16, 4, 'Aut expedita facere et qui. Quibusdam dolor magnam praesentium quibusdam. Ullam cupiditate rerum cupiditate non et pariatur reprehenderit nulla. Odio illo aliquid fuga debitis.', 0, 0, '2020-05-05 20:13:15'),
(149, 41, 59, 6, 'Aut expedita facere et qui. Quibusdam dolor magnam praesentium quibusdam. Ullam cupiditate rerum cupiditate non et pariatur reprehenderit nulla. Odio illo aliquid fuga debitis.', 0, 0, '2020-05-05 20:13:15');
/*!40000 ALTER TABLE `messages` ENABLE KEYS */;
-- Дамп структуры для таблица vk.posts
DROP TABLE IF EXISTS `posts`;
CREATE TABLE IF NOT EXISTS `posts` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`user_id` int(10) unsigned NOT NULL,
`community_id` int(10) unsigned DEFAULT NULL,
`head` varchar(255) CHARACTER SET latin1 DEFAULT NULL,
`body` text CHARACTER SET latin1 NOT NULL,
`media_id` int(10) unsigned DEFAULT NULL,
`created_at` datetime DEFAULT CURRENT_TIMESTAMP,
`updated_at` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
KEY `posts_user_id_fk` (`user_id`),
KEY `posts_community_id_fk` (`community_id`),
KEY `posts_media_id_fk` (`media_id`),
CONSTRAINT `posts_community_id_fk` FOREIGN KEY (`community_id`) REFERENCES `communities` (`id`),
CONSTRAINT `posts_media_id_fk` FOREIGN KEY (`media_id`) REFERENCES `media` (`id`),
CONSTRAINT `posts_user_id_fk` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=101 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- Дамп данных таблицы vk.posts: ~100 rows (приблизительно)
/*!40000 ALTER TABLE `posts` DISABLE KEYS */;
INSERT INTO `posts` (`id`, `user_id`, `community_id`, `head`, `body`, `media_id`, `created_at`, `updated_at`) VALUES
(1, 37, 2, 'Quis ut aut in accusantium.', 'Alice did not see anything that had fallen into the sky. Alice went on muttering over the jury-box with the Queen never left off writing on his knee, and looking at the Hatter, with an M, such as.', 43, '2015-08-01 00:04:32', '2020-05-05 17:29:41'),
(2, 5, NULL, 'Omnis ab illo incidunt eos autem quae pariatur.', 'But here, to Alice\'s great surprise, the Duchess\'s cook. She carried the pepper-box in her haste, she had never done such a long silence after this, and Alice was more hopeless than ever: she sat.', 91, '2019-10-07 15:08:28', '2020-05-05 17:28:47'),
(3, 48, 8, 'Aut temporibus ut necessitatibus asperiores qui nam.', 'Suppress him! Pinch him! Off with his head!\' or \'Off with her arms folded, frowning like a snout than a real nose; also its eyes were getting extremely small for a minute, while Alice thought this a.', NULL, '2013-07-14 12:57:44', '2020-05-05 17:29:41'),
(4, 27, 1, 'Dolore aut temporibus qui eos commodi atque.', 'WAS a curious plan!\' exclaimed Alice. \'That\'s very important,\' the King and Queen of Hearts, carrying the King\'s crown on a little nervous about it in a sort of present!\' thought Alice. The King and.', NULL, '2019-03-07 12:05:18', '2020-05-05 17:29:41'),
(5, 49, NULL, 'Consectetur adipisci ducimus fugiat deserunt praesentium corporis rerum.', 'Queen say only yesterday you deserved to be said. At last the Caterpillar contemptuously. \'Who are YOU?\' said the Pigeon; \'but I haven\'t been invited yet.\' \'You\'ll see me there,\' said the March.', NULL, '2011-11-05 13:24:16', '2020-05-05 17:29:41'),
(6, 48, 8, 'Nobis aut non quia tempore quia laboriosam.', 'King said to herself. Imagine her surprise, when the tide rises and sharks are around, His voice has a timid voice at her hands, wondering if anything would EVER happen in a VERY turn-up nose, much.', 53, '2017-08-16 09:31:57', '2020-05-05 17:02:16'),
(7, 20, 9, 'Minima harum aut libero quia ut veniam consequatur.', 'Alice could hardly hear the very middle of one! There ought to go down the middle, wondering how she would get up and walking away. \'You insult me by talking such nonsense!\' \'I didn\'t know it was.', 20, '2011-03-31 04:13:48', '2020-05-05 17:29:41'),
(8, 12, 8, 'Nam qui adipisci sit corporis quaerat omnis.', 'Alice hastily replied; \'at least--at least I mean what I eat" is the reason so many different sizes in a rather offended tone, and everybody laughed, \'Let the jury asked. \'That I can\'t remember,\'.', NULL, '2019-09-12 02:19:48', '2020-05-05 17:28:54'),
(9, 18, 9, 'Iusto porro aliquid voluptatibus.', 'Alice! when she caught it, and fortunately was just in time to see the earth takes twenty-four hours to turn round on its axis--\' \'Talking of axes,\' said the Caterpillar. \'Not QUITE right, I\'m.', NULL, '2017-06-26 06:25:58', '2020-05-05 17:29:41'),
(10, 32, 1, NULL, 'Duchess sneezed occasionally; and as the rest were quite silent, and looked at the end of the miserable Mock Turtle. So she set to work very diligently to write with one eye, How the Owl had the.', 16, '2015-09-09 08:33:05', '2020-05-05 17:30:47'),
(11, 10, NULL, 'Perferendis qui at aut.', 'I meant,\' the King in a dreamy sort of people live about here?\' \'In THAT direction,\' the Cat went on, \'What\'s your name, child?\' \'My name is Alice, so please your Majesty?\' he asked. \'Begin at the.', 29, '2020-04-24 14:26:10', '2020-05-05 17:28:47'),
(12, 79, 7, 'Exercitationem numquam eveniet voluptas eligendi possimus aut.', 'VERY unpleasant state of mind, she turned to the executioner: \'fetch her here.\' And the moral of that is--"Oh, \'tis love, \'tis love, \'tis love, \'tis love, that makes them so often, you know.\' \'Not.', NULL, '2019-11-13 21:06:21', '2020-05-05 17:29:41'),
(13, 9, NULL, 'Omnis impedit deserunt ut et quia.', 'Alice again, for this time she saw in my time, but never ONE with such sudden violence that Alice quite hungry to look at it!\' This speech caused a remarkable sensation among the people near the.', 49, '2019-04-26 11:12:54', '2020-05-05 17:29:41'),
(14, 17, NULL, 'Exercitationem exercitationem quia iure.', 'By the time she had put on his slate with one finger for the moment they saw her, they hurried back to the beginning of the jurymen. \'No, they\'re not,\' said the Duchess. An invitation for the.', 64, '2011-01-08 01:02:10', '2020-05-05 17:28:47'),
(15, 68, NULL, 'Fugit maiores voluptas aut iste quis et placeat.', 'QUEEN OF HEARTS. Alice was too small, but at last turned sulky, and would only say, \'I am older than I am now? That\'ll be a walrus or hippopotamus, but then she noticed that the poor little thing.', 95, '2014-05-08 04:16:49', '2020-05-05 17:28:47'),
(16, 79, NULL, 'Exercitationem sit sint quis repellendus iusto doloribus.', 'First, she tried to open her mouth; but she stopped hastily, for the Dormouse,\' thought Alice; \'but when you have to turn into a pig, my dear,\' said Alice, \'because I\'m not looking for eggs, I know.', 70, '2017-03-10 06:27:20', '2020-05-05 17:28:47'),
(17, 1, NULL, 'Asperiores fugit perspiciatis voluptas temporibus sunt quia.', 'I fancied that kind of thing never happened, and now here I am to see what was on the ground near the King said gravely, \'and go on crying in this affair, He trusts to you never had to ask help of.', 1, '2012-08-12 08:24:05', '2020-05-05 17:28:47'),
(18, 57, 4, 'Et minus sit eum voluptatum.', 'Gryphon, lying fast asleep in the distance, and she was near enough to try the first verse,\' said the Mock Turtle. \'No, no! The adventures first,\' said the Mock Turtle in a Little Bill It was the.', NULL, '2012-05-27 22:24:40', '2020-05-05 17:29:41'),
(19, 49, NULL, 'Culpa non facilis perspiciatis vero quasi quia corrupti harum.', 'She waited for a conversation. \'You don\'t know what a long argument with the strange creatures of her or of anything else. CHAPTER V. Advice from a Caterpillar The Caterpillar was the Rabbit coming.', 40, '2013-08-09 03:07:31', '2020-05-05 17:29:41'),
(20, 27, NULL, 'Earum asperiores ratione qui ea quae.', 'Nobody moved. \'Who cares for you?\' said Alice, \'because I\'m not the smallest idea how confusing it is to France-- Then turn not pale, beloved snail, but come and join the dance. Would not, could.', 44, '2014-05-20 04:32:18', '2020-05-05 17:28:47'),
(21, 36, 5, 'Est vero aut non ipsam.', 'Hatter, with an important air, \'are you all ready? This is the same thing as a lark, And will talk in contemptuous tones of her sharp little chin. \'I\'ve a right to think,\' said Alice timidly. \'Would.', 49, '2011-04-18 12:03:29', '2020-05-05 17:29:41'),
(22, 11, 8, 'Cum et ducimus repellendus eligendi.', 'I\'ll kick you down stairs!\' \'That is not said right,\' said the Mouse, who seemed to be no chance of her favourite word \'moral,\' and the poor animal\'s feelings. \'I quite agree with you,\' said the.', 20, '2014-06-07 01:30:35', '2020-05-05 17:29:41'),
(23, 84, NULL, 'Explicabo facere expedita quia quod iusto ut aut natus.', 'Alice did not like the right size to do it! Oh dear! I shall never get to twenty at that rate! However, the Multiplication Table doesn\'t signify: let\'s try Geography. London is the driest thing I.', 61, '2013-06-17 15:49:47', '2020-05-05 17:28:47'),
(24, 39, NULL, NULL, 'Alice after it, never once considering how in the act of crawling away: besides all this, there was a table set out under a tree in front of the court, \'Bring me the list of singers. \'You may go,\'.', 36, '2014-08-11 07:05:07', '2020-05-05 17:30:47'),
(25, 41, NULL, 'Minima et deleniti enim et consequuntur et.', 'MARMALADE\', but to open her mouth; but she was now more than Alice could not make out at all for any of them. \'I\'m sure those are not the smallest notice of them at dinn--\' she checked herself.', 18, '2018-04-19 08:35:36', '2020-05-05 17:28:47'),
(26, 27, 6, 'Enim dicta non eaque exercitationem est sint voluptatem.', 'King. \'When did you ever saw. How she longed to change the subject of conversation. \'Are you--are you fond--of--of dogs?\' The Mouse looked at the top with its mouth again, and she grew no larger:.', 31, '2012-11-26 13:27:57', '2015-12-15 00:39:37'),
(27, 46, 9, 'Est eos et vel velit neque at.', 'King said to one of them hit her in a solemn tone, only changing the order of the e--e--evening, Beautiful, beautiful Soup!\' CHAPTER XI. Who Stole the Tarts? The King turned pale, and shut his.', NULL, '2013-07-07 17:04:54', '2020-05-05 17:29:41'),
(28, 21, NULL, 'Optio assumenda necessitatibus placeat voluptatem.', 'You gave us three or more; They all sat down a good deal on where you want to stay with it as far as they were gardeners, or soldiers, or courtiers, or three pairs of tiny white kid gloves, and was.', 10, '2016-03-05 09:36:32', '2020-05-05 17:28:47'),
(29, 43, NULL, 'Molestias est quaerat aspernatur laboriosam cupiditate odit autem.', 'King said, with a yelp of delight, and rushed at the place of the wood to listen. \'Mary Ann! Mary Ann!\' said the one who got any advantage from the time he had never before seen a cat without a.', 71, '2010-09-06 10:57:06', '2020-05-05 17:28:47'),
(30, 47, NULL, 'Unde dicta sunt rem enim libero enim non.', 'Bill\'s got the other--Bill! fetch it back!\' \'And who is Dinah, if I shall have somebody to talk about her other little children, and everybody laughed, \'Let the jury wrote it down \'important,\' and.', NULL, '2013-06-03 03:40:56', '2020-05-05 17:29:41'),
(31, 97, NULL, NULL, 'However, I\'ve got to the garden at once; but, alas for poor Alice! when she had never had to fall a long argument with the glass table and the King had said that day. \'A likely story indeed!\' said.', 54, '2019-02-02 04:43:41', '2020-05-05 17:30:47'),
(32, 18, 2, NULL, 'Dormouse into the teapot. \'At any rate a book written about me, that there was the White Rabbit read:-- \'They told me he was speaking, and this time she had put the Dormouse again, so that it is!\'.', 17, '2015-09-23 23:18:17', '2020-05-05 17:30:47'),
(33, 87, NULL, NULL, 'Alice ventured to remark. \'Tut, tut, child!\' said the Mouse. \'--I proceed. "Edwin and Morcar, the earls of Mercia and Northumbria--"\' \'Ugh!\' said the Cat remarked. \'Don\'t be impertinent,\' said the.', 36, '2010-08-15 22:13:18', '2020-05-05 17:30:47'),
(34, 65, NULL, 'Vitae ea tenetur inventore vel.', 'When the Mouse with an M--\' \'Why with an M?\' said Alice. \'Come on, then,\' said the voice. \'Fetch me my gloves this moment!\' Then came a little house in it about four feet high. \'Whoever lives.', 93, '2015-11-10 19:27:19', '2020-05-05 17:28:47'),
(35, 96, NULL, 'Provident quae dolorum velit quia.', 'The chief difficulty Alice found at first was moderate. But the insolence of his head. But at any rate, there\'s no use denying it. I suppose it were white, but there were ten of them, and all of.', 49, '2019-01-22 22:50:10', '2020-05-05 17:28:47'),
(36, 45, 1, NULL, 'Alice could see, when she first saw the White Rabbit as he spoke. \'UNimportant, of course, to begin again, it was too small, but at the corners: next the ten courtiers; these were all writing very.', NULL, '2019-08-16 01:38:50', '2020-05-05 17:30:47'),
(37, 44, NULL, 'Similique et eum dolores ratione et error.', 'However, this bottle does. I do hope it\'ll make me grow smaller, I suppose.\' So she tucked her arm affectionately into Alice\'s, and they can\'t prove I did: there\'s no room to open it; but, as the.', NULL, '2015-04-13 08:07:49', '2020-05-05 17:29:41'),
(38, 19, NULL, 'Esse maxime nihil vero nam et.', 'Last came a little girl,\' said Alice, \'how am I to do with you. Mind now!\' The poor little juror (it was Bill, the Lizard) could not remember ever having seen such a capital one for catching.', NULL, '2018-02-17 06:19:02', '2020-05-05 17:29:41'),
(39, 20, NULL, 'Facere sit ut accusamus nulla.', 'NOT, being made entirely of cardboard.) \'All right, so far,\' said the Cat, \'if you don\'t know much,\' said Alice; not that she remained the same size: to be two people! Why, there\'s hardly enough of.', 39, '2019-03-25 16:17:39', '2020-05-05 17:28:47'),
(40, 65, 7, 'Laudantium repellat qui minus voluptates dolores recusandae.', 'I had to kneel down on one knee. \'I\'m a poor man, your Majesty,\' said Alice to herself, \'whenever I eat or drink something or other; but the Hatter with a smile. There was a queer-shaped little.', NULL, '2014-09-15 09:39:54', '2020-05-05 17:29:41'),
(41, 32, NULL, NULL, 'Mock Turtle to the waving of the others took the regular course.\' \'What was THAT like?\' said Alice. \'I mean what I eat" is the capital of Rome, and Rome--no, THAT\'S all wrong, I\'m certain! I must.', 41, '2014-03-27 21:06:05', '2020-05-05 17:30:47'),
(42, 64, NULL, NULL, 'The Gryphon sat up and down, and the Hatter went on just as well be at school at once.\' And in she went. Once more she found herself lying on the glass table and the Mock Turtle persisted. \'How.', 62, '2013-03-05 20:51:49', '2020-05-05 17:30:47'),
(43, 79, 7, 'Incidunt quae ipsum quia dolores eum facilis eum quae.', 'And she tried to say \'I once tasted--\' but checked herself hastily, and said \'No, never\') \'--so you can find out the verses on his spectacles. \'Where shall I begin, please your Majesty,\' said Two,.', NULL, '2020-03-29 11:30:08', '2020-05-05 17:29:41'),
(44, 66, 2, 'Quod dolor quis qui nobis nam.', 'Alice, who was beginning to grow to my right size: the next verse.\' \'But about his toes?\' the Mock Turtle said with a deep sigh, \'I was a long tail, certainly,\' said Alice indignantly. \'Ah! then.', 13, '2019-07-13 09:03:48', '2020-05-05 17:02:16'),
(45, 89, 10, NULL, 'Soup! Soup of the room. The cook threw a frying-pan after her as she went on so long that they couldn\'t see it?\' So she stood looking at Alice the moment how large she had felt quite strange at.', NULL, '2013-10-02 12:30:37', '2020-05-05 17:30:47'),
(46, 5, NULL, 'Esse dolores perferendis quos sint ad consectetur iusto.', 'Alice; \'living at the Hatter, \'when the Queen of Hearts were seated on their hands and feet, to make ONE respectable person!\' Soon her eye fell on a summer day: The Knave did so, very carefully,.', 20, '2012-07-30 03:39:16', '2020-05-05 17:28:47'),
(47, 98, NULL, 'Vel sit dolorem corrupti at pariatur reiciendis non odit.', 'I will prosecute YOU.--Come, I\'ll take no denial; We must have been changed for any lesson-books!\' And so she sat down with her face like the right size, that it might tell her something about the.', 90, '2018-02-06 01:55:40', '2020-05-05 17:28:47'),
(48, 20, NULL, 'Reprehenderit qui reprehenderit nam facilis possimus natus officiis.', 'III. A Caucus-Race and a scroll of parchment in the pictures of him), while the Dodo had paused as if it had fallen into the earth. At last the Gryphon went on eagerly. \'That\'s enough about.', 68, '2017-02-07 11:31:38', '2020-05-05 17:28:47'),
(49, 10, 6, 'Ut praesentium qui est rerum ratione amet quasi nemo.', 'Cat, and vanished again. Alice waited a little, \'From the Queen. \'Never!\' said the Gryphon. \'Well, I shan\'t go, at any rate, there\'s no meaning in them, after all. I needn\'t be so stingy about it,.', 56, '2015-10-24 15:31:46', '2020-05-05 17:29:41'),
(50, 53, 9, 'Unde iure voluptatem id est totam ipsa.', 'YOU like cats if you drink much from a Caterpillar The Caterpillar was the same age as herself, to see if there were three gardeners instantly jumped up, and began to cry again. \'You ought to eat or.', NULL, '2015-07-28 17:56:13', '2020-05-05 17:29:41'),
(51, 46, NULL, 'Est et quo earum.', 'Alice. \'Only a thimble,\' said Alice angrily. \'It wasn\'t very civil of you to set about it; if I\'m not particular as to prevent its undoing itself,) she carried it out loud. \'Thinking again?\' the.', 33, '2010-05-30 00:14:37', '2020-05-05 17:28:47'),
(52, 79, NULL, 'Recusandae quidem aliquid eligendi vel ut.', 'Dormouse go on crying in this affair, He trusts to you how it was a real Turtle.\' These words were followed by a very fine day!\' said a whiting to a shriek, \'and just as she heard her voice sounded.', 62, '2013-05-11 22:56:33', '2020-05-05 17:28:47'),
(53, 60, NULL, NULL, 'Caterpillar. \'Not QUITE right, I\'m afraid,\' said Alice, feeling very glad to do with this creature when I get it home?\' when it grunted again, so violently, that she had felt quite strange at first;.', 91, '2012-07-06 01:12:10', '2020-05-05 17:30:47'),
(54, 54, 7, NULL, 'Alice could only see her. She is such a thing before, but she saw them, they were mine before. If I or she fell very slowly, for she felt very lonely and low-spirited. In a minute or two she stood.', NULL, '2019-08-19 16:14:36', '2020-05-05 17:30:47'),
(55, 5, NULL, 'Et et nobis aliquid et quis nisi nobis.', 'Queen was to eat or drink anything; so I\'ll just see what was coming. It was so much about a foot high: then she noticed that the Gryphon in an offended tone. And she began again. \'I wonder how many.', 41, '2013-12-22 06:06:38', '2020-05-05 17:28:47'),
(56, 52, NULL, 'Alias qui sed aliquam debitis qui consequatur molestias doloribus.', 'Alice. \'Then it ought to have him with them,\' the Mock Turtle, \'but if you\'ve seen them so shiny?\' Alice looked at her, and the happy summer days. THE.', 41, '2017-09-03 23:56:35', '2020-05-05 17:28:47'),
(57, 69, 7, NULL, 'I can\'t put it into one of the singers in the sea!\' cried the Mouse, in a deep sigh, \'I was a little girl,\' said Alice, very loudly and decidedly, and the Queen, \'and he shall tell you more than.', NULL, '2016-03-09 04:44:56', '2020-05-05 17:30:47'),
(58, 64, 8, NULL, 'Alice ventured to remark. \'Tut, tut, child!\' said the Eaglet. \'I don\'t quite understand you,\' she said, \'for her hair goes in such a thing before, but she did not notice this question, but hurriedly.', NULL, '2015-05-18 22:35:55', '2020-05-05 17:30:47'),
(59, 29, NULL, NULL, 'Edwin and Morcar, the earls of Mercia and Northumbria--"\' \'Ugh!\' said the Caterpillar. \'Well, perhaps your feelings may be different,\' said Alice; \'all I know all the arches are gone from this side.', NULL, '2019-04-07 06:54:43', '2020-05-05 17:30:47'),
(60, 18, NULL, 'Temporibus delectus quis atque natus vero omnis.', 'MINE.\' The Queen smiled and passed on. \'Who ARE you doing out here? Run home this moment, I tell you, you coward!\' and at last in the book,\' said the Cat, \'or you wouldn\'t squeeze so.\' said the Cat..', 87, '2019-10-18 17:39:53', '2020-05-05 17:28:47'),
(61, 11, 7, 'Suscipit odio omnis alias quaerat.', 'King said to Alice, very earnestly. \'I\'ve had nothing else to do, so Alice went on growing, and, as they were playing the Queen added to one of the jury wrote it down into its eyes by this time)..', 45, '2015-07-05 23:51:38', '2020-05-05 17:29:41'),
(62, 5, NULL, NULL, 'Alice, \'I\'ve often seen a cat without a moment\'s pause. The only things in the sea. But they HAVE their tails in their proper places--ALL,\' he repeated with great curiosity, and this time she found.', 62, '2015-01-08 23:21:57', '2020-05-05 17:30:47'),
(63, 67, 7, NULL, 'On various pretexts they all crowded round her once more, while the Dodo solemnly, rising to its feet, \'I move that the way wherever she wanted much to know, but the great concert given by the.', NULL, '2016-02-03 00:19:58', '2020-05-05 17:30:47'),
(64, 15, NULL, NULL, 'Alice\'s, and they sat down, and felt quite strange at first; but she could not join the dance. \'"What matters it how far we go?" his scaly friend replied. "There is another shore, you know, upon the.', 55, '2015-03-22 11:14:23', '2020-05-05 17:30:47'),
(65, 54, 7, NULL, 'Alice. \'You must be,\' said the Hatter. This piece of evidence we\'ve heard yet,\' said the Dodo. Then they both bowed low, and their curls got entangled together. Alice was not much surprised at her.', 3, '2018-01-04 07:21:17', '2020-05-05 17:30:47'),
(66, 75, 3, NULL, 'Alice\'s elbow was pressed so closely against her foot, that there was a little pattering of feet on the whole cause, and condemn you to offer it,\' said Five, in a dreamy sort of use in saying.', NULL, '2017-02-13 00:53:30', '2020-05-05 17:30:47'),
(67, 86, NULL, NULL, 'Dormouse go on for some time after the rest of it appeared. \'I don\'t see any wine,\' she remarked. \'It tells the day of the water, and seemed to be done, I wonder?\' Alice guessed who it was, and, as.', 4, '2012-02-17 20:58:22', '2020-05-05 17:30:47'),
(68, 77, 8, NULL, 'March Hare. \'Yes, please do!\' but the wise little Alice and all sorts of little Alice and all of you, and don\'t speak a word till I\'ve finished.\' So they had to fall a long breath, and said to the.', 40, '2012-08-19 03:55:37', '2020-05-05 17:30:47'),
(69, 91, 3, NULL, 'Dormouse shall!\' they both bowed low, and their slates and pencils had been all the way down one side and then added them up, and there was no one else seemed inclined to say \'I once tasted--\' but.', 53, '2018-06-24 05:43:44', '2020-05-05 17:30:47'),
(70, 75, 3, 'Sit facere consequatur mollitia voluptatem rerum veritatis.', 'Then came a rumbling of little Alice was very provoking to find that she had a large cauldron which seemed to think that proved it at all. However, \'jury-men\' would have called him Tortoise because.', NULL, '2018-07-13 06:44:51', '2020-05-05 17:29:41'),
(71, 24, NULL, 'Perferendis et et ut.', 'And when I sleep" is the same year for such dainties would not open any of them. \'I\'m sure I\'m not Ada,\' she said, \'and see whether it\'s marked "poison" or not\'; for she thought, \'till its ears have.', 44, '2010-10-05 20:10:52', '2020-05-05 17:28:47'),
(72, 62, 5, 'Doloremque quaerat sint dicta ut voluptas accusamus nam.', 'Gryphon, the squeaking of the song, perhaps?\' \'I\'ve heard something like this:-- \'Fury said to herself, \'after such a curious feeling!\' said Alice; \'you needn\'t be afraid of them!\' \'And who is to do.', NULL, '2017-12-17 07:28:02', '2020-05-05 17:29:41'),
(73, 57, 4, 'Ea aliquid neque incidunt eligendi distinctio et id.', 'She did it at all. However, \'jury-men\' would have called him Tortoise because he was speaking, and this time the Queen was to find that she began fancying the sort of a well?\' \'Take some more tea,\'.', 60, '2013-01-13 18:46:03', '2020-05-05 17:29:41'),
(74, 85, NULL, NULL, 'I\'m mad?\' said Alice. \'Why, there they lay sprawling about, reminding her very earnestly, \'Now, Dinah, tell me your history, you know,\' the Hatter and the choking of the wood to listen. The.', 29, '2016-05-20 16:50:53', '2020-05-05 17:30:47'),
(75, 10, 7, NULL, 'Caterpillar. \'Well, perhaps your feelings may be different,\' said Alice; \'I can\'t help that,\' said the others. \'Are their heads downward! The Antipathies, I think--\' (for, you see, because some of.', 8, '2019-02-11 14:37:28', '2020-05-05 17:30:47'),
(76, 52, 7, 'Asperiores repudiandae cupiditate itaque laborum non id accusamus.', 'Alice like the name: however, it only grinned a little pattering of feet in the window?\' \'Sure, it\'s an arm for all that.\' \'Well, it\'s got no business of MINE.\' The Queen turned crimson with fury,.', 60, '2014-09-29 08:54:50', '2020-05-05 17:29:41'),
(77, 66, NULL, 'Ut eius eius molestiae at ut.', 'Dormouse; \'--well in.\' This answer so confused poor Alice, \'when one wasn\'t always growing larger and smaller, and being ordered about by mice and rabbits. I almost wish I could let you out, you.', 23, '2012-03-18 18:10:54', '2020-05-05 17:28:47'),
(78, 52, 7, NULL, 'I can say.\' This was not otherwise than what you were me?\' \'Well, perhaps not,\' said Alice to herself, \'I wish I hadn\'t to bring tears into her eyes; and once again the tiny hands were clasped upon.', 21, '2012-12-29 17:17:12', '2020-05-05 17:30:47'),
(79, 56, NULL, NULL, 'Caterpillar. \'I\'m afraid I can\'t put it right; \'not that it signifies much,\' she said this she looked at the Lizard in head downwards, and the others took the hookah out of sight; and an Eaglet, and.', 7, '2018-04-24 06:15:51', '2020-05-05 17:30:47'),
(80, 57, 4, NULL, 'Hatter: and in his sleep, \'that "I breathe when I breathe"!\' \'It IS the same year for such a new idea to Alice, very much of it had some kind of authority over Alice. \'Stand up and picking the.', 28, '2012-02-28 00:40:50', '2020-05-05 17:30:47'),
(81, 97, NULL, NULL, 'This is the same size for ten minutes together!\' \'Can\'t remember WHAT things?\' said the Duchess; \'and most of \'em do.\' \'I don\'t quite understand you,\' she said, as politely as she was about a.', 69, '2011-08-13 00:20:29', '2020-05-05 17:30:47'),
(82, 38, NULL, 'Aut nesciunt magnam est.', 'Either the well was very deep, or she should push the matter worse. You MUST have meant some mischief, or else you\'d have signed your name like an honest man.\' There was a queer-shaped little.', 56, '2017-03-20 21:18:46', '2020-05-05 17:28:47'),
(83, 40, NULL, NULL, 'Hatter. \'You might just as if she meant to take MORE than nothing.\' \'Nobody asked YOUR opinion,\' said Alice. \'Well, then,\' the Gryphon only answered \'Come on!\' and ran off, thinking while she was up.', 95, '2010-10-27 22:52:50', '2020-05-05 17:30:47'),
(84, 36, NULL, 'Quo id excepturi tempore earum.', 'Alice was just in time to go, for the next witness would be wasting our breath." "I\'ll be judge, I\'ll be jury," Said cunning old Fury: "I\'ll try the whole pack of cards: the Knave of Hearts, she.', 34, '2019-08-07 03:26:40', '2020-05-05 17:28:47'),
(85, 85, NULL, NULL, 'Alice thought she might as well as if it makes me grow larger, I can kick a little!\' She drew her foot slipped, and in THAT direction,\' the Cat in a great letter, nearly as she had been running half.', NULL, '2012-10-25 01:02:54', '2020-05-05 17:30:47'),
(86, 19, NULL, NULL, 'I said "What for?"\' \'She boxed the Queen\'s ears--\' the Rabbit say, \'A barrowful of WHAT?\' thought Alice to herself, \'the way all the rats and--oh dear!\' cried Alice (she was rather glad there WAS no.', 88, '2012-04-29 15:40:10', '2020-05-05 17:30:47'),
(87, 66, NULL, NULL, 'Dodo suddenly called out \'The race is over!\' and they can\'t prove I did: there\'s no use in talking to him,\' said Alice in a very hopeful tone though), \'I won\'t interrupt again. I dare say you\'re.', 54, '2015-04-26 12:00:19', '2020-05-05 17:30:47'),
(88, 58, NULL, NULL, 'Presently she began very cautiously: \'But I don\'t like it, yer honour, at all, at all!\' \'Do as I do,\' said Alice indignantly. \'Let me alone!\' \'Serpent, I say again!\' repeated the Pigeon, but in a.', 86, '2015-06-21 13:17:37', '2020-05-05 17:30:47'),
(89, 81, NULL, NULL, 'I know I have dropped them, I wonder?\' As she said this, she came up to her to wink with one finger pressed upon its forehead (the position in which the cook had disappeared. \'Never mind!\' said the.', 93, '2019-02-15 16:14:18', '2020-05-05 17:30:47'),
(90, 91, 3, NULL, 'Pray, what is the capital of Rome, and Rome--no, THAT\'S all wrong, I\'m certain! I must be kind to them,\' thought Alice, \'and those twelve creatures,\' (she was obliged to have the experiment tried..', 13, '2011-09-17 16:41:26', '2020-05-05 17:30:47'),
(91, 17, 5, NULL, 'Alice had learnt several things of this pool? I am to see what would happen next. The first witness was the cat.) \'I hope they\'ll remember her saucer of milk at tea-time. Dinah my dear! Let this be.', 58, '2018-10-27 19:11:45', '2020-05-05 17:30:47'),
(92, 26, NULL, NULL, 'THESE?\' said the Gryphon never learnt it.\' \'Hadn\'t time,\' said the Queen, \'and he shall tell you how the Dodo solemnly, rising to its feet, \'I move that the Queen of Hearts, carrying the King\'s.', 22, '2018-04-07 07:52:40', '2020-05-05 17:30:47'),
(93, 68, 3, NULL, 'I suppose I ought to have lessons to learn! Oh, I shouldn\'t like THAT!\' \'Oh, you foolish Alice!\' she answered herself. \'How can you learn lessons in here? Why, there\'s hardly room to open them.', 10, '2016-11-24 11:35:40', '2020-05-05 17:30:47'),
(94, 26, NULL, NULL, 'That he met in the last few minutes, and she could not stand, and she thought it over a little now and then, and holding it to the Knave of Hearts, he stole those tarts, And took them quite away!\'.', 43, '2014-09-07 07:47:47', '2020-05-05 17:30:47'),
(95, 5, 3, NULL, 'Alice said with some curiosity. \'What a pity it wouldn\'t stay!\' sighed the Hatter. \'You MUST remember,\' remarked the King, \'and don\'t look at a reasonable pace,\' said the Mock Turtle in a trembling.', 61, '2012-08-02 00:12:42', '2020-05-05 17:30:47'),
(96, 96, NULL, NULL, 'WOULD put their heads downward! The Antipathies, I think--\' (for, you see, Miss, we\'re doing our best, afore she comes, to--\' At this moment the King, \'that saves a world of trouble, you know, this.', 75, '2012-06-29 20:44:33', '2020-05-05 17:30:47'),
(97, 4, NULL, NULL, 'Alice replied eagerly, for she was appealed to by all three to settle the question, and they repeated their arguments to her, still it had VERY long claws and a large cat which was a little timidly,.', NULL, '2019-08-06 10:24:56', '2020-05-05 17:30:47'),
(98, 71, NULL, NULL, 'Mock Turtle replied, counting off the top of his teacup and bread-and-butter, and then keep tight hold of this sort of idea that they could not help bursting out laughing: and when she heard a.', 56, '2020-03-21 19:56:12', '2020-05-05 17:30:47'),
(99, 11, 8, NULL, 'O Mouse!\' (Alice thought this must ever be A secret, kept from all the time she heard her voice sounded hoarse and strange, and the poor little thing howled so, that Alice had begun to think that.', 59, '2010-06-19 10:01:20', '2020-05-05 17:30:47'),
(100, 56, NULL, NULL, 'Dormouse, and repeated her question. \'Why did you call it sad?\' And she went slowly after it: \'I never was so long since she had never been so much surprised, that for two Pennyworth only of.', NULL, '2020-01-03 16:23:39', '2020-05-05 17:30:47');
/*!40000 ALTER TABLE `posts` ENABLE KEYS */;
-- Дамп структуры для таблица vk.profiles
DROP TABLE IF EXISTS `profiles`;
CREATE TABLE IF NOT EXISTS `profiles` (
`user_id` int(10) unsigned NOT NULL,
`gender` char(1) COLLATE utf8_unicode_ci NOT NULL,
`birthday` date DEFAULT NULL,
`city` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL,
`country` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL,
`photo_id` int(10) unsigned DEFAULT NULL,
PRIMARY KEY (`user_id`),
KEY `profiles_photo_id_fk` (`photo_id`),
CONSTRAINT `profiles_photo_id_fk` FOREIGN KEY (`photo_id`) REFERENCES `media` (`id`) ON DELETE SET NULL,
CONSTRAINT `profiles_user_id_fk` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- Дамп данных таблицы vk.profiles: ~100 rows (приблизительно)
/*!40000 ALTER TABLE `profiles` DISABLE KEYS */;
INSERT INTO `profiles` (`user_id`, `gender`, `birthday`, `city`, `country`, `photo_id`) VALUES
(1, 'f', '1991-03-20', 'Coleshire', 'Guinea', 13),
(2, 'f', '1976-08-07', 'Zolaville', 'Saint Vincent and the Grenadines', 5),
(3, 'f', '1992-05-07', 'North Emelietown', 'Lesotho', 83),
(4, 'm', '2016-08-18', 'Dietrichbury', 'Egypt', 2),
(5, 'm', '1997-08-10', 'Port Jessika', 'United Arab Emirates', 59),
(6, 'f', '1997-12-28', 'Emeraldberg', 'Cocos (Keeling) Islands', 89),
(7, 'm', '2017-05-02', 'Johnsview', 'Uganda', 67),
(8, 'f', '1997-06-22', 'Cruickshankfurt', 'Malaysia', 66),
(9, 'f', '1980-11-25', 'Katharinamouth', 'Slovakia (Slovak Republic)', 28),
(10, 'f', '1998-10-07', 'North Stantonland', 'Comoros', 45),
(11, 'f', '1981-10-03', 'Schillerfort', 'Korea', 38),
(12, 'f', '1982-05-27', 'Kleinmouth', 'Eritrea', 56),
(13, 'm', '1987-08-27', 'Lake Coltville', 'Sierra Leone', 65),
(14, 'm', '1994-05-30', 'Masonton', 'Kiribati', 56),
(15, 'm', '1973-07-27', 'Huelsland', 'Saint Helena', 85),
(16, 'm', '2006-02-19', 'North Josephine', 'Ukraine', 56),
(17, 'm', '2000-08-10', 'Bernierborough', 'Anguilla', 25),
(18, 'f', '1997-11-15', 'Caseyberg', 'Kiribati', 57),
(19, 'f', '1990-06-30', 'New Amelialand', 'Panama', 9),
(20, 'm', '1983-03-12', 'Maudieside', 'South Africa', 72),
(21, 'f', '1987-12-22', 'Lake Alayna', 'Libyan Arab Jamahiriya', 33),
(22, 'f', '1982-07-24', 'Eleonorefurt', 'Nicaragua', 50),
(23, 'm', '1987-09-30', 'Lake Cassandrashire', 'Cape Verde', 51),
(24, 'm', '1971-01-11', 'Noemyberg', 'Vietnam', 4),
(25, 'f', '1981-12-12', 'Huelsmouth', 'Guinea-Bissau', 67),
(26, 'm', '1972-10-02', 'New German', 'Bahrain', 22),
(27, 'm', '2008-06-28', 'Leathaside', 'Netherlands Antilles', 8),
(28, 'f', '1993-02-01', 'Maryburgh', 'Ireland', 74),
(29, 'f', '2014-02-15', 'South Mohammed', 'Albania', 45),
(30, 'f', '1997-01-28', 'Marcellestad', 'Lithuania', 3),
(31, 'f', '1973-03-17', 'East Rosetta', 'Ukraine', 81),
(32, 'f', '2003-01-14', 'Horaceland', 'Suriname', 93),
(33, 'm', '1973-08-27', 'Leschtown', 'French Guiana', 23),
(34, 'f', '1989-04-08', 'South Ryleeside', 'Azerbaijan', 35),
(35, 'm', '1992-12-13', 'Durganton', 'Malaysia', 5),
(36, 'f', '1983-07-28', 'Hudsonborough', 'United States of America', 19),
(37, 'm', '1995-01-08', 'South Brendanstad', 'Panama', 80),
(38, 'f', '2019-11-02', 'Medhurstport', 'Seychelles', 43),
(39, 'm', '2014-02-01', 'Yundtside', 'French Polynesia', 73),
(40, 'f', '1989-01-29', 'Lake Gaston', 'Dominica', 38),
(41, 'm', '1990-11-13', 'North Tyrellmouth', 'Cook Islands', 68),
(42, 'm', '1970-11-11', 'Runolfssonfurt', 'Lao People\'s Democratic Republic', 26),
(43, 'm', '1985-05-31', 'Felicityburgh', 'Djibouti', 27),
(44, 'm', '1974-07-20', 'Jeramyfort', 'Saint Lucia', 56),
(45, 'm', '1976-12-13', 'Port Effie', 'Singapore', 100),
(46, 'm', '1976-04-09', 'O\'Keefemouth', 'Solomon Islands', 29),
(47, 'f', '1987-01-12', 'Port Kip', 'Romania', 44),
(48, 'm', '2012-04-06', 'West Jorge', 'Brazil', 32),
(49, 'f', '2005-02-28', 'Port Nobleland', 'Paraguay', 30),
(50, 'm', '1980-09-13', 'Stefaniefort', 'Belgium', 53),
(51, 'm', '2006-03-21', 'New Ryanport', 'Liechtenstein', 73),
(52, 'm', '1998-08-13', 'North Maximillian', 'Sudan', 8),
(53, 'm', '1988-08-10', 'Port Braeden', 'Latvia', 18),
(54, 'f', '2015-11-01', 'Mantestad', 'Saint Lucia', 64),
(55, 'm', '1986-07-02', 'East Tyrese', 'Portugal', 69),
(56, 'f', '1970-07-03', 'South Marion', 'Mauritius', 52),
(57, 'f', '1986-03-13', 'North Leanne', 'Saint Vincent and the Grenadines', 51),
(58, 'f', '1997-11-04', 'Ursulabury', 'Palau', 1),
(59, 'm', '1970-08-21', 'East Otho', 'Venezuela', 51),
(60, 'm', '2002-03-04', 'North Monserrat', 'Malta', 51),
(61, 'f', '1988-09-19', 'Abelport', 'Mongolia', 1),
(62, 'f', '1972-11-16', 'Darenstad', 'Sudan', 52),
(63, 'm', '1970-10-31', 'Schultzberg', 'British Virgin Islands', 56),
(64, 'f', '1974-05-15', 'Port Charlesside', 'Taiwan', 23),
(65, 'f', '1997-03-07', 'Mrazhaven', 'Spain', 48),
(66, 'm', '2011-08-28', 'Emilhaven', 'Turks and Caicos Islands', 68),
(67, 'f', '1993-11-04', 'Wymanmouth', 'Gibraltar', 99),
(68, 'm', '1997-07-18', 'Schowalterborough', 'Turkmenistan', 87),
(69, 'm', '1986-06-05', 'Turnerhaven', 'Guadeloupe', 40),
(70, 'f', '1976-06-02', 'North Brendaton', 'Swaziland', 38),
(71, 'm', '1993-07-22', 'Leuschkeside', 'Sudan', 71),
(72, 'm', '2004-03-05', 'Haskellborough', 'Burundi', 38),
(73, 'm', '2019-06-30', 'Littleburgh', 'Kiribati', 79),
(74, 'f', '1973-05-20', 'Emmerichshire', 'Taiwan', 82),
(75, 'm', '2008-11-15', 'Lilianmouth', 'Netherlands', 69),
(76, 'm', '2003-03-01', 'Donaldton', 'Malta', 98),
(77, 'm', '2012-09-14', 'South Mollie', 'Saint Helena', 85),
(78, 'f', '1986-03-26', 'Meganestad', 'Palestinian Territory', 30),
(79, 'm', '1980-09-09', 'Osinskifurt', 'South Georgia and the South Sandwich Islands', 96),
(80, 'm', '1978-05-27', 'Enolahaven', 'Sao Tome and Principe', 89),
(81, 'f', '1991-06-03', 'Jaskolskiborough', 'Zimbabwe', 58),
(82, 'f', '2015-11-26', 'Hyattport', 'Cayman Islands', 20),
(83, 'f', '2001-07-13', 'New Dallas', 'Burundi', 25),
(84, 'f', '1978-01-23', 'East Eldridge', 'Chad', 65),
(85, 'f', '2001-09-28', 'Nellaville', 'Western Sahara', 49),
(86, 'f', '2008-03-04', 'East Trevorville', 'Malta', 50),
(87, 'm', '1985-05-28', 'New Dejaside', 'Timor-Leste', 2),
(88, 'm', '1986-11-20', 'East Torreymouth', 'Cuba', 59),
(89, 'f', '1975-04-03', 'Feeneybury', 'Nicaragua', 90),
(90, 'm', '1979-07-07', 'East Jarret', 'Puerto Rico', 73),
(91, 'f', '1980-01-18', 'Altenwerthberg', 'South Georgia and the South Sandwich Islands', 94),
(92, 'f', '2010-11-21', 'Lake Maureen', 'Bosnia and Herzegovina', 52),
(93, 'm', '1976-06-26', 'West Britneymouth', 'Aruba', 76),
(94, 'm', '1978-11-14', 'Alexieport', 'Guadeloupe', 25),
(95, 'm', '1976-11-06', 'Urbantown', 'Slovakia (Slovak Republic)', 97),
(96, 'm', '1995-07-09', 'Boscomouth', 'Svalbard & Jan Mayen Islands', 7),
(97, 'm', '1998-01-23', 'New Anne', 'Malaysia', 43),
(98, 'f', '2016-01-18', 'New Savanna', 'Sierra Leone', 94),
(99, 'f', '1998-12-05', 'Prohaskatown', 'Egypt', 39),
(100, 'm', '2005-09-02', 'East Alainaberg', 'Cambodia', 13);
/*!40000 ALTER TABLE `profiles` ENABLE KEYS */;
-- Дамп структуры для таблица vk.target_types
DROP TABLE IF EXISTS `target_types`;
CREATE TABLE IF NOT EXISTS `target_types` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(255) CHARACTER SET latin1 NOT NULL,
`created_at` datetime DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `name` (`name`)
) ENGINE=InnoDB AUTO_INCREMENT=101 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- Дамп данных таблицы vk.target_types: ~4 rows (приблизительно)
/*!40000 ALTER TABLE `target_types` DISABLE KEYS */;
INSERT INTO `target_types` (`id`, `name`, `created_at`) VALUES
(1, 'messages', '2020-05-05 14:34:31'),
(2, 'users', '2020-05-05 14:34:31'),
(3, 'media', '2020-05-05 14:34:31'),
(4, 'posts', '2020-05-05 14:34:31');
/*!40000 ALTER TABLE `target_types` ENABLE KEYS */;
-- Дамп структуры для таблица vk.users
DROP TABLE IF EXISTS `users`;
CREATE TABLE IF NOT EXISTS `users` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`first_name` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
`last_name` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
`email` varchar(120) COLLATE utf8_unicode_ci NOT NULL,
`phone` varchar(120) COLLATE utf8_unicode_ci NOT NULL,
`created_at` datetime DEFAULT CURRENT_TIMESTAMP,
`updated_at` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `email` (`email`),
UNIQUE KEY `phone` (`phone`)
) ENGINE=InnoDB AUTO_INCREMENT=101 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- Дамп данных таблицы vk.users: ~100 rows (приблизительно)
/*!40000 ALTER TABLE `users` DISABLE KEYS */;
INSERT INTO `users` (`id`, `first_name`, `last_name`, `email`, `phone`, `created_at`, `updated_at`) VALUES
(1, 'Selina', 'Herzog', 'antone92@example.org', '145-965-3188', '2018-08-06 00:55:43', '2020-04-24 20:19:18'),
(2, 'Doris', 'Lubowitz', 'lbosco@example.net', '08032147891', '2013-05-18 02:13:10', '2019-02-02 02:47:05'),
(3, 'Wilbert', 'Hintz', 'wmarvin@example.org', '(639)216-3718x36184', '2017-12-26 19:31:24', '2020-04-24 20:19:18'),
(4, 'Myrtie', 'Weissnat', 'olson.gerardo@example.com', '(208)030-8932', '2019-02-07 20:28:31', '2020-04-24 20:19:18'),
(5, 'Alford', 'Doyle', 'ifriesen@example.org', '286-883-4769', '2016-09-17 11:40:17', '2020-04-24 20:19:18'),
(6, 'Flo', 'DuBuque', 'bella08@example.net', '09648893205', '2015-08-16 22:42:24', '2020-04-24 20:19:18'),
(7, 'Deron', 'Langworth', 'ghills@example.com', '+84(0)9312857577', '2018-01-31 20:57:58', '2020-04-24 20:19:18'),
(8, 'Hayley', 'O\'Hara', 'champlin.alysa@example.org', '(351)788-2358', '2017-04-17 17:26:24', '2020-04-24 20:19:18'),
(9, 'Alexandra', 'Prosacco', 'broderick17@example.org', '02190889670', '2018-03-13 00:54:11', '2020-04-24 20:19:18'),
(10, 'Rosario', 'Dach', 'aglae16@example.org', '268-645-4134x30668', '2016-10-06 13:19:53', '2020-04-24 20:19:18'),
(11, 'Ian', 'Heaney', 'alycia00@example.com', '408.893.2754x1031', '2016-01-11 03:23:17', '2020-04-24 20:19:18'),
(12, 'Joelle', 'Casper', 'felicity.buckridge@example.org', '00961891158', '2020-04-06 23:32:53', '2020-04-24 20:19:18'),
(13, 'Daija', 'VonRueden', 'jackson.bartell@example.net', '1-887-644-9639x287', '2011-08-16 19:10:10', '2015-01-20 22:01:19'),
(14, 'Jeanie', 'Koch', 'linnie27@example.org', '234-392-0925x36403', '2018-12-10 16:47:59', '2019-09-05 01:37:48'),
(15, 'Bernadette', 'Schuster', 'jose61@example.org', '1-378-653-6815x126', '2020-02-17 12:22:40', '2020-04-24 20:19:18'),
(16, 'Janice', 'Hansen', 'ally50@example.org', '(133)948-9882', '2019-11-23 05:58:13', '2020-04-24 20:19:18'),
(17, 'Stephania', 'Howe', 'harber.jerald@example.com', '1-541-257-7830', '2014-09-06 16:52:11', '2020-01-16 13:07:29'),
(18, 'Francesca', 'Deckow', 'kirsten.runte@example.org', '(550)856-0377x11212', '2018-07-11 21:20:31', '2020-04-24 20:19:18'),
(19, 'Lorenza', 'Bechtelar', 'qhyatt@example.org', '154-027-3580x71781', '2019-04-16 01:18:21', '2020-04-24 20:19:18'),
(20, 'Janet', 'Davis', 'mgleichner@example.com', '1-179-346-0730', '2010-05-12 16:16:41', '2020-02-17 01:01:17'),
(21, 'Kyleigh', 'Kilback', 'mclaughlin.tiara@example.org', '332-082-1890x609', '2014-07-14 11:58:02', '2015-12-21 17:59:58'),
(22, 'Roselyn', 'Abshire', 'sonya58@example.net', '143-237-6121', '2013-05-29 00:53:02', '2016-08-23 21:02:31'),
(23, 'Walker', 'Leuschke', 'quincy.rodriguez@example.net', '+38(9)4829782590', '2018-11-14 02:17:11', '2020-04-24 20:19:18'),
(24, 'Ubaldo', 'Gleason', 'jules60@example.com', '+45(3)6463089950', '2010-08-26 07:35:36', '2018-05-22 03:46:59'),
(25, 'Kendrick', 'Hansen', 'mohammed03@example.net', '632.305.7905x976', '2015-11-17 06:03:15', '2020-04-24 20:19:18'),
(26, 'Clinton', 'Anderson', 'payton.romaguera@example.net', '(475)042-8157x01682', '2011-11-04 01:55:06', '2014-01-02 02:48:56'),
(27, 'Oleta', 'Hodkiewicz', 'marcia21@example.com', '1-247-838-9004x087', '2014-08-23 13:04:03', '2015-08-05 03:09:13'),
(28, 'Oleta', 'Stanton', 'kozey.thalia@example.org', '909.440.6328', '2014-11-06 02:27:11', '2015-10-26 02:30:26'),
(29, 'Arielle', 'Shields', 'oheller@example.net', '312.284.8195', '2014-03-19 05:55:19', '2016-08-23 04:11:58'),
(30, 'Ursula', 'Jast', 'ellis01@example.org', '(733)872-7278', '2014-10-22 22:02:01', '2020-04-24 20:19:18'),
(31, 'Hosea', 'Williamson', 'clinton42@example.org', '1-700-681-0913', '2020-02-26 21:25:09', '2020-04-24 20:19:18'),
(32, 'Alexanne', 'King', 'nlangosh@example.org', '+56(0)0152616734', '2013-10-12 18:44:24', '2015-09-29 07:15:22'),
(33, 'Zackary', 'Larson', 'rlebsack@example.net', '430-655-3518', '2015-08-24 04:12:02', '2019-10-27 07:27:30'),
(34, 'Tito', 'Hamill', 'rau.lisa@example.com', '(701)740-2162x8250', '2017-10-09 02:18:19', '2020-04-24 20:19:18'),
(35, 'Haley', 'Swaniawski', 'eulah33@example.net', '853.798.1033x3597', '2017-02-03 13:37:04', '2018-02-12 15:51:00'),
(36, 'Thomas', 'Thompson', 'hraynor@example.com', '135-442-8382x93742', '2015-01-29 17:35:47', '2020-04-24 20:19:18'),
(37, 'Eryn', 'Harvey', 'turner.merl@example.com', '809-394-3551x1026', '2010-04-25 18:08:37', '2018-12-06 23:54:58'),
(38, 'Noelia', 'Roberts', 'lyla.lindgren@example.net', '1-389-231-1130', '2017-10-22 18:48:52', '2018-09-24 00:34:46'),
(39, 'Aiden', 'Beier', 'manley31@example.com', '806-352-7775x280', '2020-02-07 11:30:01', '2020-04-24 20:19:18'),
(40, 'Faye', 'Ankunding', 'cassandra74@example.com', '+37(4)2117145183', '2011-05-10 02:45:31', '2015-10-29 04:04:52'),
(41, 'Nola', 'Bruen', 'akunze@example.org', '921-242-7167x58330', '2019-12-19 22:47:23', '2020-04-24 20:19:18'),
(42, 'Elena', 'Reynolds', 'kessler.imani@example.org', '1-877-020-7239', '2015-12-26 12:34:58', '2020-04-24 20:19:18'),
(43, 'Dayton', 'Larkin', 'christ82@example.com', '(837)864-2053x5238', '2016-07-08 01:41:25', '2018-07-28 06:24:34'),
(44, 'Melyssa', 'Cronin', 'quitzon.geovanni@example.org', '(690)236-8667x25045', '2016-02-05 09:29:31', '2020-04-24 20:19:18'),
(45, 'Rossie', 'Wyman', 'littel.ashley@example.org', '262.141.6186', '2015-11-08 07:52:31', '2020-04-24 20:19:18'),
(46, 'Craig', 'Feil', 'alexandria55@example.org', '(576)662-2395x92368', '2010-11-03 06:52:59', '2012-12-03 00:02:26'),
(47, 'Dallin', 'Kovacek', 'rempel.victoria@example.com', '(921)530-1690', '2018-04-28 03:17:27', '2020-04-24 20:19:18'),
(48, 'Eleazar', 'Langosh', 'mreinger@example.org', '+15(3)0472798416', '2013-11-27 00:56:25', '2020-04-24 20:19:18'),
(49, 'Mariela', 'Lang', 'arden.braun@example.com', '778-961-1318', '2012-11-15 10:51:40', '2017-01-31 19:01:56'),
(50, 'Annabelle', 'Beatty', 'kasandra54@example.net', '1-684-661-0893', '2012-06-03 09:24:48', '2012-09-13 18:04:01'),
(51, 'Natasha', 'Mayer', 'weissnat.kacie@example.com', '097.714.8747x8065', '2014-02-28 23:53:42', '2015-11-26 04:14:00'),
(52, 'Daniela', 'Rempel', 'wilderman.lew@example.org', '535.244.0848', '2017-12-04 12:16:30', '2020-04-24 20:19:18'),
(53, 'Assunta', 'Adams', 'botsford.chanelle@example.net', '(080)253-1806', '2018-12-04 18:13:27', '2019-08-02 13:38:31'),
(54, 'Letha', 'Buckridge', 'narmstrong@example.com', '710-622-3627', '2014-08-02 18:54:52', '2016-10-05 06:00:20'),
(55, 'Noble', 'Ferry', 'walker.leilani@example.org', '010-035-5585x0162', '2012-05-14 14:32:34', '2020-04-24 20:19:18'),
(56, 'Layla', 'Kub', 'dalton32@example.org', '1-838-625-0722x3943', '2010-09-18 23:42:29', '2017-01-10 06:20:24'),
(57, 'Kaley', 'Eichmann', 'jenkins.allison@example.com', '253.917.0109x65474', '2010-06-04 05:57:58', '2014-02-07 20:35:02'),
(58, 'Wilbert', 'Fritsch', 'aliza56@example.com', '106.032.1389', '2018-06-27 09:28:34', '2020-04-24 20:19:18'),
(59, 'Tad', 'Champlin', 'roxane07@example.org', '(753)810-1734', '2017-09-05 20:27:07', '2020-04-24 20:19:18'),
(60, 'Lupe', 'Conn', 'tgulgowski@example.com', '1-025-261-0938', '2019-03-06 05:18:43', '2020-04-24 20:19:18'),
(61, 'Branson', 'Jerde', 'tavares.ritchie@example.net', '(663)879-6874x952', '2019-09-10 03:40:49', '2020-04-24 20:19:18'),
(62, 'Bernadette', 'Homenick', 'wolff.raymundo@example.org', '357.335.3631x14055', '2015-02-20 21:13:08', '2020-04-24 20:19:18'),
(63, 'Crawford', 'Hane', 'retha96@example.net', '603.199.2334x51009', '2014-12-03 21:01:58', '2016-09-14 04:55:37'),
(64, 'Claudie', 'Gutkowski', 'brippin@example.org', '936.743.7573', '2015-07-14 07:35:33', '2020-04-24 20:19:18'),
(65, 'Colleen', 'Bauch', 'cruickshank.sadye@example.net', '404.535.2485', '2010-10-12 08:19:26', '2018-07-12 23:41:23'),
(66, 'Benedict', 'Walker', 'hilton44@example.net', '1-165-750-6070', '2018-03-24 08:19:00', '2020-04-24 20:19:18'),
(67, 'Ephraim', 'Cassin', 'hope81@example.org', '(117)553-1517', '2019-03-15 08:30:32', '2020-02-01 11:40:16'),
(68, 'Wilford', 'Boyer', 'oceane.stroman@example.org', '1-304-611-7798', '2017-08-01 17:10:54', '2020-04-24 20:19:18'),
(69, 'Christa', 'Bednar', 'bkohler@example.org', '03609574482', '2011-12-12 23:03:47', '2016-04-27 00:44:19'),
(70, 'Carlee', 'Schmidt', 'igrimes@example.net', '08135900798', '2018-11-13 21:26:15', '2020-04-24 20:19:18'),
(71, 'Otis', 'Wiegand', 'ned56@example.com', '783.745.1085x46021', '2014-02-17 08:35:01', '2020-04-24 20:19:18'),
(72, 'Emmalee', 'Sawayn', 'neoma85@example.org', '361.504.4921x556', '2013-05-10 13:10:42', '2014-05-30 10:09:24'),
(73, 'Verla', 'Barrows', 'jason.gislason@example.com', '632.945.3670', '2010-06-10 13:56:52', '2018-08-04 20:31:36'),
(74, 'Reid', 'Block', 'marvin.joanne@example.org', '(468)072-8420', '2014-06-08 17:42:55', '2016-07-28 05:20:28'),
(75, 'Earline', 'Lueilwitz', 'ida14@example.net', '437-166-4272x1168', '2018-07-11 04:34:58', '2020-04-24 20:19:18'),
(76, 'Lottie', 'Mann', 'scot36@example.net', '1-339-996-3691x91116', '2018-06-17 08:28:54', '2020-04-24 20:19:18'),
(77, 'Rollin', 'Gutkowski', 'liza.wyman@example.org', '672-202-2977x744', '2013-12-26 14:21:36', '2020-04-24 20:19:18'),
(78, 'Augustus', 'Nicolas', 'winfield36@example.net', '259-452-9337', '2019-12-24 02:17:29', '2020-04-24 20:19:18'),
(79, 'Lisette', 'Koelpin', 'botsford.carley@example.net', '(692)008-5279x80165', '2014-07-01 05:04:47', '2018-07-12 10:28:06'),
(80, 'Abner', 'McCullough', 'jillian65@example.com', '+34(6)4647623871', '2015-02-06 10:17:28', '2020-04-24 20:19:18'),
(81, 'Samson', 'Schmitt', 'npowlowski@example.org', '664-604-6285', '2013-12-25 11:40:20', '2014-03-16 02:07:44'),
(82, 'Courtney', 'Brown', 'sandra.grady@example.org', '043-877-6042x58366', '2015-01-09 07:10:40', '2020-04-24 20:19:18'),
(83, 'Destin', 'Hoeger', 'dgutmann@example.org', '1-240-842-6726x971', '2014-07-10 01:53:14', '2016-08-30 13:38:14'),
(84, 'Margaretta', 'Kris', 'lillie.jacobs@example.org', '296.971.8435', '2010-08-01 23:13:27', '2011-12-05 20:07:58'),
(85, 'Marie', 'Morissette', 'zwalter@example.com', '424-303-4371x482', '2019-07-04 23:54:47', '2020-04-24 20:19:18'),
(86, 'Pearline', 'Vandervort', 'hegmann.reginald@example.net', '380.150.6337', '2013-11-17 17:14:38', '2014-01-17 04:53:20'),
(87, 'Sharon', 'Simonis', 'dhamill@example.net', '223-482-2518x7367', '2018-11-30 13:52:50', '2018-12-23 10:27:28'),
(88, 'Mona', 'Hodkiewicz', 'berneice55@example.org', '891.000.5108x7916', '2011-06-03 17:42:07', '2016-09-30 20:13:27'),
(89, 'Fredrick', 'Wiegand', 'braden.pfeffer@example.com', '00344043612', '2018-08-07 00:33:17', '2020-04-24 20:19:18'),
(90, 'Carleton', 'Gibson', 'melvin.greenholt@example.org', '04787521655', '2013-10-10 16:23:03', '2015-08-14 01:14:07'),
(91, 'Esta', 'Beier', 'labadie.samir@example.org', '(227)791-3830x54071', '2014-07-22 07:43:22', '2015-02-16 17:09:33'),
(92, 'Isabella', 'Muller', 'smraz@example.net', '999.472.9701', '2014-12-25 20:13:47', '2020-04-24 20:19:18'),
(93, 'Camden', 'Simonis', 'tleannon@example.org', '(131)749-2912x729', '2013-10-13 20:50:55', '2020-04-24 20:19:18'),
(94, 'Maybelle', 'Schiller', 'hills.jennie@example.com', '07607704594', '2018-10-18 23:05:46', '2020-04-24 20:19:18'),
(95, 'Kennith', 'Stiedemann', 'fkemmer@example.org', '065.083.1150', '2016-12-07 05:56:01', '2020-04-24 20:19:18'),
(96, 'Christa', 'Macejkovic', 'erdman.jaylin@example.net', '1-897-154-6240', '2017-03-22 12:28:09', '2017-10-08 03:11:15'),
(97, 'Chester', 'Fadel', 'bins.edmond@example.com', '561-652-5388x10297', '2014-10-14 05:27:10', '2017-12-27 09:58:56'),
(98, 'Marcel', 'Corwin', 'echristiansen@example.com', '(920)390-1367', '2019-09-16 10:15:26', '2020-04-24 20:19:18'),
(99, 'Roberta', 'Dickens', 'olen44@example.net', '272-368-5895', '2020-04-05 17:39:17', '2020-04-24 20:19:18'),
(100, 'Delpha', 'Flatley', 'lillie53@example.net', '436-853-7309x00114', '2017-04-25 18:14:36', '2020-04-24 20:19:18');
/*!40000 ALTER TABLE `users` 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 */;
|
CREATE DATABASE myNewDB;
SHOW DATABASES; |
-- drop column
ALTER TABLE items DROP COLUMN ruby; |
-- disable automatics tasks
-- useful for test systems with limited resources
declare
type window_array_typ is table of varchar2(30);
window_array window_array_typ := window_array_typ('SUNDAY_WINDOW','MONDAY_WINDOW','TUESDAY_WINDOW','WEDNESDAY_WINDOW','THURSDAY_WINDOW','FRIDAY_WINDOW','SATURDAY_WINDOW');
begin
for window in window_array.first .. window_array.last
loop
dbms_output.put_line('Disabling stats job for: ' || window_array(window));
DBMS_AUTO_TASK_ADMIN.DISABLE(
client_name => 'auto optimizer stats collection',
operation => 'auto optimizer stats job',
window_name => window_array(window)
);
end loop;
end;
/
|
/*
Navicat Premium Data Transfer
Source Server : xampp-local-mdb
Source Server Type : MariaDB
Source Server Version : 100411
Source Host : localhost:3306
Source Schema : pbss_info
Target Server Type : MariaDB
Target Server Version : 100411
File Encoding : 65001
Date: 17/08/2020 10:37:15
*/
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for imported_csv_files
-- ----------------------------
DROP TABLE IF EXISTS `imported_csv_files`;
CREATE TABLE `imported_csv_files` (
`id` int(10) NOT NULL AUTO_INCREMENT,
`file_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`uploaded` datetime(0) NOT NULL DEFAULT current_timestamp,
`imported` datetime(0) NULL DEFAULT NULL,
`data_info` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`hash` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`status` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 61 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for student_info_archive
-- ----------------------------
DROP TABLE IF EXISTS `student_info_archive`;
CREATE TABLE `student_info_archive` (
`sl_id` int(11) NOT NULL AUTO_INCREMENT,
`tcert_id` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`stu_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`father` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`mother` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`gender` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`village` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`post_office` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`post_code` int(10) NOT NULL,
`upazilla` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`district` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`exam_name` varchar(150) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`borad_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`exam_year` int(10) NOT NULL,
`group_tread` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`result` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`result_status` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`roll_no` int(10) NOT NULL,
`exam_centre` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`reg_no` bigint(16) NOT NULL,
`session` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`date_of_birth` date NOT NULL,
`phone_number` varchar(15) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`last_printed` datetime(0) NULL DEFAULT NULL,
PRIMARY KEY (`sl_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for student_info_for_testimonial
-- ----------------------------
DROP TABLE IF EXISTS `student_info_for_testimonial`;
CREATE TABLE `student_info_for_testimonial` (
`sl_id` int(11) NOT NULL AUTO_INCREMENT,
`tcert_id` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`stu_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`father` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`mother` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`gender` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`village` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`post_office` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`post_code` int(10) NOT NULL,
`upazilla` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`district` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`exam_name` varchar(150) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`board_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`exam_year` int(10) NOT NULL,
`group_tread` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`result` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`result_status` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`roll_no` int(10) NOT NULL,
`exam_centre` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`reg_no` bigint(16) NOT NULL,
`session` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`date_of_birth` date NOT NULL,
`phone_number` varchar(15) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`last_printed` datetime(0) NULL DEFAULT NULL,
PRIMARY KEY (`sl_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1356 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for temp_list_for_testimonial
-- ----------------------------
DROP TABLE IF EXISTS `temp_list_for_testimonial`;
CREATE TABLE `temp_list_for_testimonial` (
`temp_id` int(11) NOT NULL AUTO_INCREMENT,
`tcert_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`stu_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`father` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`mother` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`gender` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`village` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`post_office` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`post_code` int(10) NOT NULL,
`upazilla` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`district` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`exam_name` varchar(150) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`borad_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`exam_year` int(10) NOT NULL,
`group_tread` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`result_status` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`result` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`roll_no` int(10) NOT NULL,
`exam_centre` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`reg_no` bigint(16) NOT NULL,
`session` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`date_of_birth` date NOT NULL,
`phone_number` varchar(15) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
PRIMARY KEY (`temp_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1581 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for user_info
-- ----------------------------
DROP TABLE IF EXISTS `user_info`;
CREATE TABLE `user_info` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`username` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`fullname` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`email` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`passwd` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`user_role` varchar(25) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
SET FOREIGN_KEY_CHECKS = 1;
|
CREATE PROCEDURE [sp_update_Cash_Customer]
(@CustomerID_1 [int],
@CustomerName_2 [nvarchar],
@Address_3 [nvarchar],
@CustomerID_4 [int],
@CustomerName_5 [nvarchar](50),
@Address_6 [nvarchar](255))
AS UPDATE [Cash_Customer]
SET [CustomerName] = @CustomerName_5,
[Address] = @Address_6
WHERE
( [CustomerID] = @CustomerID_1 AND
[CustomerName] = @CustomerName_2 AND
[Address] = @Address_3)
|
ALTER TABLE `logs` ADD COLUMN `entry_id` INT(11) NOT NULL;
UPDATE `logs` SET `entry_id` = CASE WHEN `parent_id` IS NULL THEN `id` ELSE `parent_id` END;
INSERT INTO `entries` (`id`, `created`) SELECT `id`, `created` FROM `logs` WHERE `parent_id` IS NULL;
ALTER TABLE `logs` DROP COLUMN `parent_id`,
DROP INDEX `log_parent_id_fk`,
DROP FOREIGN KEY `log_parent_id_fk`;
ALTER TABLE `logs` CHANGE COLUMN `created` `modified` DATETIME NOT NULL,
MODIFY COLUMN `entry_id` INT(11) UNSIGNED NOT NULL,
ADD INDEX `entry_id_fk`(`entry_id`),
ADD CONSTRAINT `entry_id_fk` FOREIGN KEY `entry_id_fk` (`entry_id`)
REFERENCES `entries` (`id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION; |
insert into "role" (id,name,wording)
VALUES
(1,'ROLE_ADMIN','Administrateur'),
(2,'ROLE_ACTUATOR','Membre'),
(3,'ROLE_USER','Utilisateur');
/* Insert USERS */
INSERT INTO "users"
(id,email,active,last_name,password,first_name,phone)
VALUES
(1,'romaindavid.sergeant@gmail.com',
true,'ADMIN','$2a$10$mVLweGs6HLxItvuYt5W21e9sr7sgkqeuk6q.3pke4HEHJZry4fWSO',
'Romain-David' ,'0768000001'),
(2,'actuator@gmail.com',
true,'ACTUATOR','$2a$10$mVLweGs6HLxItvuYt5W21e9sr7sgkqeuk6q.3pke4HEHJZry4fWSO',
'Romain-David' ,'0768000002'),
(3,'user@gmail.com',
true,'USER','$2a$10$mVLweGs6HLxItvuYt5W21e9sr7sgkqeuk6q.3pke4HEHJZry4fWSO',
'Romain-David' ,'0768000003');
/* Insert role_user */
insert into "users_role" (id_user,id_role)
VALUES
(1,1),
(2,2),
(3,3);
|
-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-- *********************************** Drop foreign keys *********************************
-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-- --------------------------------------------------------------------
-- AbstractConstruction
-- --------------------------------------------------------------------
ALTER TABLE AbstractConstruction
DROP CONSTRAINT Abstr_bound_Bound_energ_ADE_FK;
ALTER TABLE AbstractConstruction
DROP CONSTRAINT Abstr_openi_Openi_energ_ADE_FK;
-- --------------------------------------------------------------------
-- AbstractMaterial
-- --------------------------------------------------------------------
ALTER TABLE AbstractMaterial
DROP CONSTRAINT AbstractMateri_imageTexture_FK;
-- --------------------------------------------------------------------
-- Boiler
-- --------------------------------------------------------------------
ALTER TABLE Boiler
DROP CONSTRAINT Boiler_FK;
-- --------------------------------------------------------------------
-- BuildingUni_to_address_address
-- --------------------------------------------------------------------
ALTER TABLE BuildingUni_to_address_address
DROP CONSTRAINT Buildin_to_address_address_FK1;
ALTER TABLE BuildingUni_to_address_address
DROP CONSTRAINT Buildin_to_address_address_FK2;
-- --------------------------------------------------------------------
-- BuildingUnit
-- --------------------------------------------------------------------
ALTER TABLE BuildingUnit
DROP CONSTRAINT BuildingUnit_FK;
ALTER TABLE BuildingUnit
DROP CONSTRAINT BuildingU_contains_UsageZon_FK;
-- --------------------------------------------------------------------
-- CombinedHeatPower
-- --------------------------------------------------------------------
ALTER TABLE CombinedHeatPower
DROP CONSTRAINT CombinedHeatPower_FK;
-- --------------------------------------------------------------------
-- ConstantValueSchedule
-- --------------------------------------------------------------------
ALTER TABLE ConstantValueSchedule
DROP CONSTRAINT ConstantValueSchedule_FK;
-- --------------------------------------------------------------------
-- Construction
-- --------------------------------------------------------------------
ALTER TABLE Construction
DROP CONSTRAINT Construction_FK;
ALTER TABLE Construction
DROP CONSTRAINT Construction_opticalPropert_FK;
ALTER TABLE Construction
DROP CONSTRAINT Construction_serviceLife_FK;
-- --------------------------------------------------------------------
-- DHWFacilities
-- --------------------------------------------------------------------
ALTER TABLE DHWFacilities
DROP CONSTRAINT DHWFacilities_FK;
-- --------------------------------------------------------------------
-- DailyPatternSchedule
-- --------------------------------------------------------------------
ALTER TABLE DailyPatternSchedule
DROP CONSTRAINT DailyPatternSchedule_FK;
-- --------------------------------------------------------------------
-- DailySchedule
-- --------------------------------------------------------------------
ALTER TABLE DailySchedule
DROP CONSTRAINT DailySchedule_schedule_FK;
ALTER TABLE DailySchedule
DROP CONSTRAINT DailySche_dailySch_PeriodOf_FK;
-- --------------------------------------------------------------------
-- DistrictNetworkSubstation
-- --------------------------------------------------------------------
ALTER TABLE DistrictNetworkSubstation
DROP CONSTRAINT DistrictNetworkSubstation_FK;
-- --------------------------------------------------------------------
-- DualValueSchedule
-- --------------------------------------------------------------------
ALTER TABLE DualValueSchedule
DROP CONSTRAINT DualValueSchedule_FK;
-- --------------------------------------------------------------------
-- ElectricalAppliances
-- --------------------------------------------------------------------
ALTER TABLE ElectricalAppliances
DROP CONSTRAINT ElectricalAppliances_FK;
-- --------------------------------------------------------------------
-- ElectricalResistance
-- --------------------------------------------------------------------
ALTER TABLE ElectricalResistance
DROP CONSTRAINT ElectricalResistance_FK;
-- --------------------------------------------------------------------
-- Emissivity
-- --------------------------------------------------------------------
ALTER TABLE Emissivity
DROP CONSTRAINT Emissivit_emissivi_OpticalP_FK;
-- --------------------------------------------------------------------
-- EnergyConversionSystem
-- --------------------------------------------------------------------
ALTER TABLE EnergyConversionSystem
DROP CONSTRAINT EnergyConvers_productAndIns_FK;
ALTER TABLE EnergyConversionSystem
DROP CONSTRAINT EnergyConversio_serviceLife_FK;
ALTER TABLE EnergyConversionSystem
DROP CONSTRAINT EnergyConversio_installedIn_FK;
ALTER TABLE EnergyConversionSystem
DROP CONSTRAINT Energ_energ_CityO_energ_ADE_FK;
-- --------------------------------------------------------------------
-- EnergyDemand
-- --------------------------------------------------------------------
ALTER TABLE EnergyDemand
DROP CONSTRAINT EnergyDemand_energyAmount_FK;
ALTER TABLE EnergyDemand
DROP CONSTRAINT EnergyDemand_energyDistribu_FK;
ALTER TABLE EnergyDemand
DROP CONSTRAINT Energ_energ_CityO_ener_ADE_FK1;
-- --------------------------------------------------------------------
-- EnergyDistributionSystem
-- --------------------------------------------------------------------
ALTER TABLE EnergyDistributionSystem
DROP CONSTRAINT EnergyDistribut_serviceLife_FK;
-- --------------------------------------------------------------------
-- EnergyPerformanceCertification
-- --------------------------------------------------------------------
ALTER TABLE EnergyPerformanceCertification
DROP CONSTRAINT Energ_energ_Abstr_energ_ADE_FK;
ALTER TABLE EnergyPerformanceCertification
DROP CONSTRAINT EnergyPer_energyPe_Building_FK;
-- --------------------------------------------------------------------
-- Energy_isProv_TO_Energy_provid
-- --------------------------------------------------------------------
ALTER TABLE Energy_isProv_TO_Energy_provid
DROP CONSTRAINT Energ_isPro_TO_Energ_provi_FK1;
ALTER TABLE Energy_isProv_TO_Energy_provid
DROP CONSTRAINT Energ_isPro_TO_Energ_provi_FK2;
-- --------------------------------------------------------------------
-- Facilities
-- --------------------------------------------------------------------
ALTER TABLE Facilities
DROP CONSTRAINT Facilities_operationSchedul_FK;
ALTER TABLE Facilities
DROP CONSTRAINT Facilities_heatDissipation_FK;
ALTER TABLE Facilities
DROP CONSTRAINT Facilitie_equipped_Building_FK;
ALTER TABLE Facilities
DROP CONSTRAINT Facilitie_equipped_UsageZon_FK;
-- --------------------------------------------------------------------
-- FinalE_isCons_TO_Energy_consum
-- --------------------------------------------------------------------
ALTER TABLE FinalE_isCons_TO_Energy_consum
DROP CONSTRAINT Final_isCon_TO_Energ_consu_FK1;
ALTER TABLE FinalE_isCons_TO_Energy_consum
DROP CONSTRAINT Final_isCon_TO_Energ_consu_FK2;
-- --------------------------------------------------------------------
-- FinalE_isProd_TO_Energy_produc
-- --------------------------------------------------------------------
ALTER TABLE FinalE_isProd_TO_Energy_produc
DROP CONSTRAINT Final_isPro_TO_Energ_produ_FK1;
ALTER TABLE FinalE_isProd_TO_Energy_produc
DROP CONSTRAINT Final_isPro_TO_Energ_produ_FK2;
-- --------------------------------------------------------------------
-- FinalEnergy
-- --------------------------------------------------------------------
ALTER TABLE FinalEnergy
DROP CONSTRAINT FinalEnergy_energyAmount_FK;
ALTER TABLE FinalEnergy
DROP CONSTRAINT FinalEnergy_energyCarrier_FK;
-- --------------------------------------------------------------------
-- FloorArea
-- --------------------------------------------------------------------
ALTER TABLE FloorArea
DROP CONSTRAINT Floor_floor_Abstr_energ_ADE_FK;
ALTER TABLE FloorArea
DROP CONSTRAINT FloorArea_floorAre_Building_FK;
ALTER TABLE FloorArea
DROP CONSTRAINT FloorArea_floorAre_ThermalZ_FK;
ALTER TABLE FloorArea
DROP CONSTRAINT FloorArea_floorAre_UsageZon_FK;
-- --------------------------------------------------------------------
-- Gas
-- --------------------------------------------------------------------
ALTER TABLE Gas
DROP CONSTRAINT Gas_FK;
-- --------------------------------------------------------------------
-- HeatPump
-- --------------------------------------------------------------------
ALTER TABLE HeatPump
DROP CONSTRAINT HeatPump_FK;
-- --------------------------------------------------------------------
-- HeightAboveGround
-- --------------------------------------------------------------------
ALTER TABLE HeightAboveGround
DROP CONSTRAINT Heigh_heigh_Abstr_energ_ADE_FK;
-- --------------------------------------------------------------------
-- Household
-- --------------------------------------------------------------------
ALTER TABLE Household
DROP CONSTRAINT Household_househol_Occupant_FK;
-- --------------------------------------------------------------------
-- IrregularTimeSeries
-- --------------------------------------------------------------------
ALTER TABLE IrregularTimeSeries
DROP CONSTRAINT IrregularTimeSeries_FK;
-- --------------------------------------------------------------------
-- IrregularTimeSeriesFile
-- --------------------------------------------------------------------
ALTER TABLE IrregularTimeSeriesFile
DROP CONSTRAINT IrregularTimeSeriesFile_FK;
-- --------------------------------------------------------------------
-- Layer
-- --------------------------------------------------------------------
ALTER TABLE Layer
DROP CONSTRAINT Layer_layer_Construction_FK;
-- --------------------------------------------------------------------
-- LayerComponent
-- --------------------------------------------------------------------
ALTER TABLE LayerComponent
DROP CONSTRAINT LayerComponent_serviceLife_FK;
ALTER TABLE LayerComponent
DROP CONSTRAINT LayerComponent_material_FK;
ALTER TABLE LayerComponent
DROP CONSTRAINT LayerCompo_layerCompo_Layer_FK;
-- --------------------------------------------------------------------
-- LightingFacilities
-- --------------------------------------------------------------------
ALTER TABLE LightingFacilities
DROP CONSTRAINT LightingFacilities_FK;
-- --------------------------------------------------------------------
-- MeasurementPoint
-- --------------------------------------------------------------------
ALTER TABLE MeasurementPoint
DROP CONSTRAINT Measureme_contains_Irregula_FK;
-- --------------------------------------------------------------------
-- MechanicalVentilation
-- --------------------------------------------------------------------
ALTER TABLE MechanicalVentilation
DROP CONSTRAINT MechanicalVentilation_FK;
-- --------------------------------------------------------------------
-- Occupants
-- --------------------------------------------------------------------
ALTER TABLE Occupants
DROP CONSTRAINT Occupants_heatDissipation_FK;
ALTER TABLE Occupants
DROP CONSTRAINT Occupants_occupancyRate_FK;
ALTER TABLE Occupants
DROP CONSTRAINT Occupants_occupied_Building_FK;
ALTER TABLE Occupants
DROP CONSTRAINT Occupants_occupied_UsageZon_FK;
-- --------------------------------------------------------------------
-- PeriodOfYear
-- --------------------------------------------------------------------
ALTER TABLE PeriodOfYear
DROP CONSTRAINT PeriodOfY_periodOf_DailyPat_FK;
-- --------------------------------------------------------------------
-- PhotovoltaicSystem
-- --------------------------------------------------------------------
ALTER TABLE PhotovoltaicSystem
DROP CONSTRAINT PhotovoltaicSystem_FK;
-- --------------------------------------------------------------------
-- PhotovoltaicThermalSystem
-- --------------------------------------------------------------------
ALTER TABLE PhotovoltaicThermalSystem
DROP CONSTRAINT PhotovoltaicThermalSystem_FK;
-- --------------------------------------------------------------------
-- PowerDistributionSystem
-- --------------------------------------------------------------------
ALTER TABLE PowerDistributionSystem
DROP CONSTRAINT PowerDistributionSystem_FK;
-- --------------------------------------------------------------------
-- PowerStorageSystem
-- --------------------------------------------------------------------
ALTER TABLE PowerStorageSystem
DROP CONSTRAINT PowerStorageSystem_FK;
-- --------------------------------------------------------------------
-- Reflectance
-- --------------------------------------------------------------------
ALTER TABLE Reflectance
DROP CONSTRAINT Reflectan_reflecta_OpticalP_FK;
-- --------------------------------------------------------------------
-- RefurbishmentMeasure
-- --------------------------------------------------------------------
ALTER TABLE RefurbishmentMeasure
DROP CONSTRAINT Refurbishment_dateOfRefurbi_FK;
ALTER TABLE RefurbishmentMeasure
DROP CONSTRAINT Refur_refur_Abstr_energ_ADE_FK;
ALTER TABLE RefurbishmentMeasure
DROP CONSTRAINT Refur_refur_Bound_energ_ADE_FK;
-- --------------------------------------------------------------------
-- RegularTimeSeries
-- --------------------------------------------------------------------
ALTER TABLE RegularTimeSeries
DROP CONSTRAINT RegularTimeSeries_FK;
-- --------------------------------------------------------------------
-- RegularTimeSeriesFile
-- --------------------------------------------------------------------
ALTER TABLE RegularTimeSeriesFile
DROP CONSTRAINT RegularTimeSeriesFile_FK;
-- --------------------------------------------------------------------
-- ReverseConstruction
-- --------------------------------------------------------------------
ALTER TABLE ReverseConstruction
DROP CONSTRAINT ReverseConstruction_FK;
ALTER TABLE ReverseConstruction
DROP CONSTRAINT ReverseConstr_baseConstruct_FK;
-- --------------------------------------------------------------------
-- ShadingType
-- --------------------------------------------------------------------
ALTER TABLE ShadingType
DROP CONSTRAINT ShadingType_transmittance_FK;
ALTER TABLE ShadingType
DROP CONSTRAINT Shadi_indoo_Openi_energ_ADE_FK;
ALTER TABLE ShadingType
DROP CONSTRAINT Shadi_outdo_Openi_energ_ADE_FK;
-- --------------------------------------------------------------------
-- SolarEnergySystem
-- --------------------------------------------------------------------
ALTER TABLE SolarEnergySystem
DROP CONSTRAINT SolarEnergySystem_FK;
ALTER TABLE SolarEnergySystem
DROP CONSTRAINT SolarEnergySy_installedOnBo_FK;
ALTER TABLE SolarEnergySystem
DROP CONSTRAINT SolarEnergySy_installedOnBu_FK;
ALTER TABLE SolarEnergySystem
DROP CONSTRAINT SolarEnergySy_surfaceGeomet_FK;
-- --------------------------------------------------------------------
-- SolarThermalSystem
-- --------------------------------------------------------------------
ALTER TABLE SolarThermalSystem
DROP CONSTRAINT SolarThermalSystem_FK;
-- --------------------------------------------------------------------
-- SolidMaterial
-- --------------------------------------------------------------------
ALTER TABLE SolidMaterial
DROP CONSTRAINT SolidMaterial_FK;
-- --------------------------------------------------------------------
-- StorageSystem
-- --------------------------------------------------------------------
ALTER TABLE StorageSystem
DROP CONSTRAINT StorageSystem_serviceLife_FK;
ALTER TABLE StorageSystem
DROP CONSTRAINT StorageSy_storage_EnergyDem_FK;
-- --------------------------------------------------------------------
-- SystemOperation
-- --------------------------------------------------------------------
ALTER TABLE SystemOperation
DROP CONSTRAINT SystemOpera_has_EnergyConve_FK;
ALTER TABLE SystemOperation
DROP CONSTRAINT SystemOperati_operationTime_FK;
-- --------------------------------------------------------------------
-- Therma_bounde_TO_Therma_delimi
-- --------------------------------------------------------------------
ALTER TABLE Therma_bounde_TO_Therma_delimi
DROP CONSTRAINT Therm_bound_TO_Therm_delim_FK1;
ALTER TABLE Therma_bounde_TO_Therma_delimi
DROP CONSTRAINT Therm_bound_TO_Therm_delim_FK2;
-- --------------------------------------------------------------------
-- Therma_to_themat_surfac_relate
-- --------------------------------------------------------------------
ALTER TABLE Therma_to_themat_surfac_relate
DROP CONSTRAINT Therm_to_thema_surfa_relat_FK1;
ALTER TABLE Therma_to_themat_surfac_relate
DROP CONSTRAINT Therm_to_thema_surfa_relat_FK2;
-- --------------------------------------------------------------------
-- ThermalBoundary
-- --------------------------------------------------------------------
ALTER TABLE ThermalBoundary
DROP CONSTRAINT ThermalBoundary_FK;
ALTER TABLE ThermalBoundary
DROP CONSTRAINT ThermalBounda_surfaceGeomet_FK;
-- --------------------------------------------------------------------
-- ThermalComponent
-- --------------------------------------------------------------------
ALTER TABLE ThermalComponent
DROP CONSTRAINT ThermalComponent_FK;
ALTER TABLE ThermalComponent
DROP CONSTRAINT ThermalComponent_relates_FK;
ALTER TABLE ThermalComponent
DROP CONSTRAINT ThermalCompone_construction_FK;
ALTER TABLE ThermalComponent
DROP CONSTRAINT ThermalCo_composed_ThermalB_FK;
-- --------------------------------------------------------------------
-- ThermalDistributionSystem
-- --------------------------------------------------------------------
ALTER TABLE ThermalDistributionSystem
DROP CONSTRAINT ThermalDistributionSystem_FK;
-- --------------------------------------------------------------------
-- ThermalStorageSystem
-- --------------------------------------------------------------------
ALTER TABLE ThermalStorageSystem
DROP CONSTRAINT ThermalStorageSystem_FK;
-- --------------------------------------------------------------------
-- ThermalZone
-- --------------------------------------------------------------------
ALTER TABLE ThermalZone
DROP CONSTRAINT ThermalZone_FK;
ALTER TABLE ThermalZone
DROP CONSTRAINT Therm_therm_Abstr_energ_ADE_FK;
ALTER TABLE ThermalZone
DROP CONSTRAINT ThermalZone_volumeGeometry_FK;
-- --------------------------------------------------------------------
-- ThermalZone_to_room_interiorRo
-- --------------------------------------------------------------------
ALTER TABLE ThermalZone_to_room_interiorRo
DROP CONSTRAINT ThermalZo_to_room_interior_FK1;
ALTER TABLE ThermalZone_to_room_interiorRo
DROP CONSTRAINT ThermalZo_to_room_interior_FK2;
-- --------------------------------------------------------------------
-- TimeSeries
-- --------------------------------------------------------------------
ALTER TABLE TimeSeries
DROP CONSTRAINT TimeSeries_variableProperti_FK;
-- --------------------------------------------------------------------
-- TimeSeriesSchedule
-- --------------------------------------------------------------------
ALTER TABLE TimeSeriesSchedule
DROP CONSTRAINT TimeSeriesSchedule_FK;
ALTER TABLE TimeSeriesSchedule
DROP CONSTRAINT TimeSeriesSch_timeDepending_FK;
-- --------------------------------------------------------------------
-- Transmittance
-- --------------------------------------------------------------------
ALTER TABLE Transmittance
DROP CONSTRAINT Transmitt_transmit_OpticalP_FK;
-- --------------------------------------------------------------------
-- UsageZone
-- --------------------------------------------------------------------
ALTER TABLE UsageZone
DROP CONSTRAINT UsageZone_FK;
ALTER TABLE UsageZone
DROP CONSTRAINT UsageZone_coolingSchedule_FK;
ALTER TABLE UsageZone
DROP CONSTRAINT UsageZone_heatingSchedule_FK;
ALTER TABLE UsageZone
DROP CONSTRAINT UsageZone_ventilationSchedu_FK;
ALTER TABLE UsageZone
DROP CONSTRAINT UsageZone_averageInternalGa_FK;
ALTER TABLE UsageZone
DROP CONSTRAINT Usage_usage_Abstr_energ_ADE_FK;
ALTER TABLE UsageZone
DROP CONSTRAINT UsageZone_contains_ThermalZ_FK;
ALTER TABLE UsageZone
DROP CONSTRAINT UsageZone_volumeGeometry_FK;
-- --------------------------------------------------------------------
-- VolumeType
-- --------------------------------------------------------------------
ALTER TABLE VolumeType
DROP CONSTRAINT Volum_volum_Abstr_energ_ADE_FK;
ALTER TABLE VolumeType
DROP CONSTRAINT VolumeType_volume_ThermalZo_FK;
-- --------------------------------------------------------------------
-- WeatherData
-- --------------------------------------------------------------------
ALTER TABLE WeatherData
DROP CONSTRAINT WeatherData_values_FK;
ALTER TABLE WeatherData
DROP CONSTRAINT Weath_weath_CityO_energ_ADE_FK;
-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-- *********************************** Drop tables **************************************
-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-- --------------------------------------------------------------------
-- AbstractBuilding_energy_ADE
-- --------------------------------------------------------------------
DROP TABLE AbstractBuilding_energy_ADE;
-- --------------------------------------------------------------------
-- AbstractConstruction
-- --------------------------------------------------------------------
DROP TABLE AbstractConstruction;
-- --------------------------------------------------------------------
-- AbstractMaterial
-- --------------------------------------------------------------------
DROP TABLE AbstractMaterial;
-- --------------------------------------------------------------------
-- Boiler
-- --------------------------------------------------------------------
DROP TABLE Boiler;
-- --------------------------------------------------------------------
-- BoundarySurface_energy_ADE
-- --------------------------------------------------------------------
DROP TABLE BoundarySurface_energy_ADE;
-- --------------------------------------------------------------------
-- BuildingUni_to_address_address
-- --------------------------------------------------------------------
DROP TABLE BuildingUni_to_address_address;
-- --------------------------------------------------------------------
-- BuildingUnit
-- --------------------------------------------------------------------
DROP TABLE BuildingUnit;
-- --------------------------------------------------------------------
-- CityObject_energy_ADE
-- --------------------------------------------------------------------
DROP TABLE CityObject_energy_ADE;
-- --------------------------------------------------------------------
-- CombinedHeatPower
-- --------------------------------------------------------------------
DROP TABLE CombinedHeatPower;
-- --------------------------------------------------------------------
-- ConstantValueSchedule
-- --------------------------------------------------------------------
DROP TABLE ConstantValueSchedule;
-- --------------------------------------------------------------------
-- Construction
-- --------------------------------------------------------------------
DROP TABLE Construction;
-- --------------------------------------------------------------------
-- DHWFacilities
-- --------------------------------------------------------------------
DROP TABLE DHWFacilities;
-- --------------------------------------------------------------------
-- DailyPatternSchedule
-- --------------------------------------------------------------------
DROP TABLE DailyPatternSchedule;
-- --------------------------------------------------------------------
-- DailySchedule
-- --------------------------------------------------------------------
DROP TABLE DailySchedule;
-- --------------------------------------------------------------------
-- DateOfEvent
-- --------------------------------------------------------------------
DROP TABLE DateOfEvent;
-- --------------------------------------------------------------------
-- DistrictNetworkSubstation
-- --------------------------------------------------------------------
DROP TABLE DistrictNetworkSubstation;
-- --------------------------------------------------------------------
-- DualValueSchedule
-- --------------------------------------------------------------------
DROP TABLE DualValueSchedule;
-- --------------------------------------------------------------------
-- ElectricalAppliances
-- --------------------------------------------------------------------
DROP TABLE ElectricalAppliances;
-- --------------------------------------------------------------------
-- ElectricalResistance
-- --------------------------------------------------------------------
DROP TABLE ElectricalResistance;
-- --------------------------------------------------------------------
-- Emissivity
-- --------------------------------------------------------------------
DROP TABLE Emissivity;
-- --------------------------------------------------------------------
-- EnergyCarrier
-- --------------------------------------------------------------------
DROP TABLE EnergyCarrier;
-- --------------------------------------------------------------------
-- EnergyConversionSystem
-- --------------------------------------------------------------------
DROP TABLE EnergyConversionSystem;
-- --------------------------------------------------------------------
-- EnergyDemand
-- --------------------------------------------------------------------
DROP TABLE EnergyDemand;
-- --------------------------------------------------------------------
-- EnergyDistributionSystem
-- --------------------------------------------------------------------
DROP TABLE EnergyDistributionSystem;
-- --------------------------------------------------------------------
-- EnergyPerformanceCertification
-- --------------------------------------------------------------------
DROP TABLE EnergyPerformanceCertification;
-- --------------------------------------------------------------------
-- Energy_isProv_TO_Energy_provid
-- --------------------------------------------------------------------
DROP TABLE Energy_isProv_TO_Energy_provid;
-- --------------------------------------------------------------------
-- Facilities
-- --------------------------------------------------------------------
DROP TABLE Facilities;
-- --------------------------------------------------------------------
-- FinalE_isCons_TO_Energy_consum
-- --------------------------------------------------------------------
DROP TABLE FinalE_isCons_TO_Energy_consum;
-- --------------------------------------------------------------------
-- FinalE_isProd_TO_Energy_produc
-- --------------------------------------------------------------------
DROP TABLE FinalE_isProd_TO_Energy_produc;
-- --------------------------------------------------------------------
-- FinalEnergy
-- --------------------------------------------------------------------
DROP TABLE FinalEnergy;
-- --------------------------------------------------------------------
-- FloorArea
-- --------------------------------------------------------------------
DROP TABLE FloorArea;
-- --------------------------------------------------------------------
-- Gas
-- --------------------------------------------------------------------
DROP TABLE Gas;
-- --------------------------------------------------------------------
-- HeatExchangeType
-- --------------------------------------------------------------------
DROP TABLE HeatExchangeType;
-- --------------------------------------------------------------------
-- HeatPump
-- --------------------------------------------------------------------
DROP TABLE HeatPump;
-- --------------------------------------------------------------------
-- HeightAboveGround
-- --------------------------------------------------------------------
DROP TABLE HeightAboveGround;
-- --------------------------------------------------------------------
-- Household
-- --------------------------------------------------------------------
DROP TABLE Household;
-- --------------------------------------------------------------------
-- ImageTexture
-- --------------------------------------------------------------------
DROP TABLE ImageTexture;
-- --------------------------------------------------------------------
-- IrregularTimeSeries
-- --------------------------------------------------------------------
DROP TABLE IrregularTimeSeries;
-- --------------------------------------------------------------------
-- IrregularTimeSeriesFile
-- --------------------------------------------------------------------
DROP TABLE IrregularTimeSeriesFile;
-- --------------------------------------------------------------------
-- Layer
-- --------------------------------------------------------------------
DROP TABLE Layer;
-- --------------------------------------------------------------------
-- LayerComponent
-- --------------------------------------------------------------------
DROP TABLE LayerComponent;
-- --------------------------------------------------------------------
-- LightingFacilities
-- --------------------------------------------------------------------
DROP TABLE LightingFacilities;
-- --------------------------------------------------------------------
-- MeasurementPoint
-- --------------------------------------------------------------------
DROP TABLE MeasurementPoint;
-- --------------------------------------------------------------------
-- MechanicalVentilation
-- --------------------------------------------------------------------
DROP TABLE MechanicalVentilation;
-- --------------------------------------------------------------------
-- Occupants
-- --------------------------------------------------------------------
DROP TABLE Occupants;
-- --------------------------------------------------------------------
-- Opening_energy_ADE
-- --------------------------------------------------------------------
DROP TABLE Opening_energy_ADE;
-- --------------------------------------------------------------------
-- OpticalProperties
-- --------------------------------------------------------------------
DROP TABLE OpticalProperties;
-- --------------------------------------------------------------------
-- PeriodOfYear
-- --------------------------------------------------------------------
DROP TABLE PeriodOfYear;
-- --------------------------------------------------------------------
-- PhotovoltaicSystem
-- --------------------------------------------------------------------
DROP TABLE PhotovoltaicSystem;
-- --------------------------------------------------------------------
-- PhotovoltaicThermalSystem
-- --------------------------------------------------------------------
DROP TABLE PhotovoltaicThermalSystem;
-- --------------------------------------------------------------------
-- PowerDistributionSystem
-- --------------------------------------------------------------------
DROP TABLE PowerDistributionSystem;
-- --------------------------------------------------------------------
-- PowerStorageSystem
-- --------------------------------------------------------------------
DROP TABLE PowerStorageSystem;
-- --------------------------------------------------------------------
-- Reflectance
-- --------------------------------------------------------------------
DROP TABLE Reflectance;
-- --------------------------------------------------------------------
-- RefurbishmentMeasure
-- --------------------------------------------------------------------
DROP TABLE RefurbishmentMeasure;
-- --------------------------------------------------------------------
-- RegularTimeSeries
-- --------------------------------------------------------------------
DROP TABLE RegularTimeSeries;
-- --------------------------------------------------------------------
-- RegularTimeSeriesFile
-- --------------------------------------------------------------------
DROP TABLE RegularTimeSeriesFile;
-- --------------------------------------------------------------------
-- ReverseConstruction
-- --------------------------------------------------------------------
DROP TABLE ReverseConstruction;
-- --------------------------------------------------------------------
-- Schedule
-- --------------------------------------------------------------------
DROP TABLE Schedule;
-- --------------------------------------------------------------------
-- ServiceLife
-- --------------------------------------------------------------------
DROP TABLE ServiceLife;
-- --------------------------------------------------------------------
-- ShadingType
-- --------------------------------------------------------------------
DROP TABLE ShadingType;
-- --------------------------------------------------------------------
-- SolarEnergySystem
-- --------------------------------------------------------------------
DROP TABLE SolarEnergySystem;
-- --------------------------------------------------------------------
-- SolarThermalSystem
-- --------------------------------------------------------------------
DROP TABLE SolarThermalSystem;
-- --------------------------------------------------------------------
-- SolidMaterial
-- --------------------------------------------------------------------
DROP TABLE SolidMaterial;
-- --------------------------------------------------------------------
-- StorageSystem
-- --------------------------------------------------------------------
DROP TABLE StorageSystem;
-- --------------------------------------------------------------------
-- SystemOperation
-- --------------------------------------------------------------------
DROP TABLE SystemOperation;
-- --------------------------------------------------------------------
-- Therma_bounde_TO_Therma_delimi
-- --------------------------------------------------------------------
DROP TABLE Therma_bounde_TO_Therma_delimi;
-- --------------------------------------------------------------------
-- Therma_to_themat_surfac_relate
-- --------------------------------------------------------------------
DROP TABLE Therma_to_themat_surfac_relate;
-- --------------------------------------------------------------------
-- ThermalBoundary
-- --------------------------------------------------------------------
DROP TABLE ThermalBoundary;
-- --------------------------------------------------------------------
-- ThermalComponent
-- --------------------------------------------------------------------
DROP TABLE ThermalComponent;
-- --------------------------------------------------------------------
-- ThermalDistributionSystem
-- --------------------------------------------------------------------
DROP TABLE ThermalDistributionSystem;
-- --------------------------------------------------------------------
-- ThermalStorageSystem
-- --------------------------------------------------------------------
DROP TABLE ThermalStorageSystem;
-- --------------------------------------------------------------------
-- ThermalZone
-- --------------------------------------------------------------------
DROP TABLE ThermalZone;
-- --------------------------------------------------------------------
-- ThermalZone_to_room_interiorRo
-- --------------------------------------------------------------------
DROP TABLE ThermalZone_to_room_interiorRo;
-- --------------------------------------------------------------------
-- TimeSeries
-- --------------------------------------------------------------------
DROP TABLE TimeSeries;
-- --------------------------------------------------------------------
-- TimeSeriesSchedule
-- --------------------------------------------------------------------
DROP TABLE TimeSeriesSchedule;
-- --------------------------------------------------------------------
-- TimeValuesProperties
-- --------------------------------------------------------------------
DROP TABLE TimeValuesProperties;
-- --------------------------------------------------------------------
-- Transmittance
-- --------------------------------------------------------------------
DROP TABLE Transmittance;
-- --------------------------------------------------------------------
-- UsageZone
-- --------------------------------------------------------------------
DROP TABLE UsageZone;
-- --------------------------------------------------------------------
-- VolumeType
-- --------------------------------------------------------------------
DROP TABLE VolumeType;
-- --------------------------------------------------------------------
-- WeatherData
-- --------------------------------------------------------------------
DROP TABLE WeatherData;
-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-- ********************************* Drop Sequences ***********************************
-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
DROP SEQUENCE DateOfEvent_SEQ;
PURGE RECYCLEBIN;
|
-- phpMyAdmin SQL Dump
-- version 4.9.2
-- https://www.phpmyadmin.net/
--
-- Servidor: 127.0.0.1
-- Tiempo de generación: 20-01-2020 a las 04:13:58
-- Versión del servidor: 10.4.11-MariaDB
-- Versión de PHP: 7.2.26
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
CREATE DATABASE IF NOT EXISTS amigos;
USE amigos;
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Base de datos: `amigos`
--
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `amigos`
--
CREATE TABLE `amigos` (
`id` int(11) NOT NULL,
`idpersona` double DEFAULT NULL,
`idamigo` double NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Volcado de datos para la tabla `amigos`
--
INSERT INTO `amigos` (`id`, `idpersona`, `idamigo`) VALUES
(19, 12746250, 1088286264),
(20, 1088286264, 12746250);
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `personas`
--
CREATE TABLE `personas` (
`id` double NOT NULL,
`Nombre` varchar(50) NOT NULL DEFAULT '0',
`Apellido` varchar(50) NOT NULL DEFAULT '0',
`Sexo` tinyint(4) NOT NULL DEFAULT 0,
`FechaNacimiento` varchar(20) NOT NULL,
`FechaRegistro` varchar(20) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Volcado de datos para la tabla `personas`
--
INSERT INTO `personas` (`id`, `Nombre`, `Apellido`, `Sexo`, `FechaNacimiento`, `FechaRegistro`) VALUES
(0, '', '', 1, '', NULL),
(12746250, 'JUAN JOSE', 'OBANDO', 1, '1979-04-02', NULL),
(1088286264, 'XIOMARA', 'OROZCO', 2, '1990-12-20', NULL);
--
-- Índices para tablas volcadas
--
--
-- Indices de la tabla `amigos`
--
ALTER TABLE `amigos`
ADD PRIMARY KEY (`id`),
ADD KEY `fk_persona_id` (`idpersona`),
ADD KEY `fk_amigo_id` (`idamigo`);
--
-- Indices de la tabla `personas`
--
ALTER TABLE `personas`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT de las tablas volcadas
--
--
-- AUTO_INCREMENT de la tabla `amigos`
--
ALTER TABLE `amigos`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=21;
--
-- Restricciones para tablas volcadas
--
--
-- Filtros para la tabla `amigos`
--
ALTER TABLE `amigos`
ADD CONSTRAINT `fk_amigo_id` FOREIGN KEY (`idamigo`) REFERENCES `personas` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `fk_persona_id` FOREIGN KEY (`idpersona`) REFERENCES `personas` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
/* Name: Tahsin Rahman
Student ID:
Date: October 8, 2020
DBS211 - Lab 04
*/
SET AUTOCOMMIT ON;
/*Question 1*/
--a)
SELECT e.employeenumber, e.firstname, e.lastname, o.city, o.phone, o.postalcode
FROM employees e, offices o
WHERE o.officecode = e.officecode
AND o.country = 'France';
--b)
SELECT e.employeenumber, e.firstname, e.lastname, o.city, o.phone, o.postalcode
FROM employees e
INNER JOIN offices o ON o.officecode = e.officecode
WHERE o.country = 'France';
/*Question 2*/
SELECT p.customernumber, c.customername, to_char(p.paymentdate, 'Month DD, YYYY') AS paymentdate, p.amount
FROM payments p
INNER JOIN customers c ON p.customernumber = c.customernumber
WHERE c.country = 'Canada'
ORDER BY customernumber;
/*Question 3*/
SELECT c.customernumber, c.customername
FROM customers c
LEFT JOIN payments p on p.customernumber = c.customernumber
WHERE c.country = 'USA'
AND p.customernumber IS NULL
ORDER BY c.customernumber;
/*Question 4*/
--a)
CREATE VIEW vwCustomerOrder AS
(SELECT c.customernumber, o.orderNumber, o.orderdate, p.productname, od.quantityordered, od.priceeach
FROM customers c
LEFT JOIN orders o ON o.customernumber = c.customernumber
LEFT JOIN orderdetails od ON od.ordernumber = o.ordernumber
LEFT JOIN products p ON p.productcode = od.productcode
);
--b)
SELECT *
FROM vwcustomerorder;
/*Question 5*/
SELECT *
FROM vwcustomerorder vc
LEFT JOIN orderdetails od ON od.ordernumber = vc.ordernumber
WHERE customernumber = 124
ORDER BY vc.ordernumber , od.orderlinenumber;
/*Question 6*/
SELECT c.customernumber, c.contactfirstname, c.contactlastname, c.phone, c.creditlimit
FROM customers c
LEFT JOIN orders o ON o.customernumber = c.customernumber
WHERE o.customernumber IS NULL;
/*Question 7*/
CREATE VIEW vwEmployeeManager AS
(
SELECT e1.employeenumber, e1.lastname, e1.firstname, e1.extension, e1.email, e1.officecode, e1.reportsto, e1.jobtitle,
e2.Firstname AS Manager_FName, e2.Lastname AS Manager_LName --Manager information
FROM employees e1
LEFT JOIN employees e2 ON e1.reportsto = e2.employeenumber
);
/*Question 8*/
CREATE OR REPLACE VIEW vwEmployeeManager AS
(
SELECT e1.employeenumber, e1.lastname, e1.firstname, e1.extension, e1.email, e1.officecode, e1.reportsto, e1.jobtitle,
e2.firstname AS Manager_FName, e2.lastname AS Manager_LName --Manager information
FROM employees e1
LEFT JOIN employees e2 ON e1.reportsto = e2.employeenumber
WHERE e1.reportsto IS NOT NULL
);
/*Question 9*/
DROP VIEW vwcustomerorder;
DROP VIEW vwEmployeeManager;
|
CREATE OR ALTER PROC usp_GetEmployeesFromTown (@input NVARCHAR(MAX))
AS
SELECT FirstName, LastName FROM Employees e
JOIN Addresses a ON e.AddressID=a.AddressID
JOIN Towns t ON a.TownID=t.TownID
WHERE t.Name= @input
|
select top 10
len(Stream)-len(replace(Stream, char(13), '')),
*
from
ItemVersions
|
SELECT ct.id,
ct.tenant_id,
ct.operand_id,
ct.amount_amount AS amount,
ct.source,
CASE
WHEN
ct.source IN (5, 10)
THEN
wt.wallet_id
ELSE
ct.source_id
END,
ct.description,
cb.created_at,
cb.user_id AS created_by
FROM customer_transaction ct
JOIN created_by cb ON cb.id = ct.id
LEFT JOIN wallet_transaction wt ON wt.id = ct.source_id
|
DROP TABLE IF EXISTS reportcard;
CREATE TABLE reportcard (
id serial,
)
|
/*
Navicat Premium Data Transfer
Source Server : localhost_3306
Source Server Type : MySQL
Source Server Version : 100421
Source Host : localhost:3306
Source Schema : otr
Target Server Type : MySQL
Target Server Version : 100421
File Encoding : 65001
Date: 22/11/2021 20:31:34
*/
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for migrations
-- ----------------------------
DROP TABLE IF EXISTS `migrations`;
CREATE TABLE `migrations` (
`id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
`migration` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
`batch` int(11) NOT NULL,
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of migrations
-- ----------------------------
INSERT INTO `migrations` VALUES (1, '2014_10_12_000000_create_users_table', 1);
INSERT INTO `migrations` VALUES (2, '2014_10_12_100000_create_password_resets_table', 1);
-- ----------------------------
-- Table structure for password_resets
-- ----------------------------
DROP TABLE IF EXISTS `password_resets`;
CREATE TABLE `password_resets` (
`email` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
`token` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
`created_at` timestamp(0) NULL DEFAULT NULL,
INDEX `password_resets_email_index`(`email`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of password_resets
-- ----------------------------
INSERT INTO `password_resets` VALUES ('markveronich@gmail.com', 'A0E7VAjzY3GtgCwyenJgMTrdd3JeZHwrP3OTFl3wKK1v8tK41nAwAKoucxJsJwJn', '2021-11-17 15:45:12');
INSERT INTO `password_resets` VALUES ('markveronich@gmail.com', 'glMy7OUHyfNu8ZWYzPzcRKyV5QSL9NAEiMyXtVfYZXReCnirJdnCha2AL9ye9SCO', '2021-11-17 15:47:21');
INSERT INTO `password_resets` VALUES ('test.test@gmail.com', 't34uVdMMjfIJMfdYOjUtolBcRINeU4rH2eZSZLUJXavZuRuPlouno1i4vkKl4N1T', '2021-11-17 15:47:32');
INSERT INTO `password_resets` VALUES ('linodeBp17@gmail.com', 'bh3bE6PIhfse2gP3e6ETKbsIqyMr09QiZYP2gOW1sTX54biWIohJvESsOSISv2QS', '2021-11-17 15:48:03');
INSERT INTO `password_resets` VALUES ('linodeBp17@gmail.com', 'S0oQHe2n2yowsWHacGAb6CqRGuUIDCwHUzSpAgQl9NNwEuMhIfJErQaPmPMz9CFS', '2021-11-17 15:49:00');
INSERT INTO `password_resets` VALUES ('markveronich@gmail.com', 'lzzqhATYiAup887whqU03hTBBzAoKxomO240lcQ8XMj6g82gdtjmZspxWtQqqhRm', '2021-11-17 15:57:05');
INSERT INTO `password_resets` VALUES ('markveronich@gmail.com', 'Gqy5r5MNNgNAM9cz3hw34KbvS366fUmR1Cyo4oRbRzyXpb2ySMnGyBnOIH2MJ05C', '2021-11-17 16:00:05');
INSERT INTO `password_resets` VALUES ('markveronich@gmail.com', 'SgO4bssep4BtAHjrg0W5AoF57DWLd5IOqL1VlVw51e958f6iIH0gWE5DiNvhOeyb', '2021-11-18 04:26:53');
-- ----------------------------
-- Table structure for users
-- ----------------------------
DROP TABLE IF EXISTS `users`;
CREATE TABLE `users` (
`id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
`name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
`email` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
`email_verified_at` timestamp(0) NULL DEFAULT NULL,
`phone` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
`password` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
`remember_token` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
`created_at` timestamp(0) NULL DEFAULT NULL,
`updated_at` timestamp(0) NULL DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE,
UNIQUE INDEX `users_email_unique`(`email`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of users
-- ----------------------------
INSERT INTO `users` VALUES (1, 'Daniel', 'linodebp15@gmail.com', NULL, '+72341890872', '$2y$10$Z6OVfeQ2zCb6Ir1NRTT6Pey3Z1WfzrAiiQXV/s9s2mdIdhJA0VDzu', NULL, '2021-11-17 15:01:43', '2021-11-17 15:01:43');
INSERT INTO `users` VALUES (2, 'Vladimir', 'kevin.arimaa@gmail.com', NULL, '+72341890872', '$2y$10$s2t4xTIgDWZnMCCXrJzuvOydFFjh.S.j4p7ow4wqkN19Ygbpjn6NO', NULL, '2021-11-17 15:07:18', '2021-11-17 15:07:18');
SET FOREIGN_KEY_CHECKS = 1;
|
insert into adviser_usr(email, password, role, active, activation_code) values
('svg@mail.com', '12345', 'ROLE_USER', true, null),
('skc@mail.com', '12345', 'ROLE_USER', false, 'asdf-1234-simple'),
('bvg@mail.com', '12345', 'ROLE_BUSINESS', true, null),
('bkc@mail.com', '12345', 'ROLE_BUSINESS', false, 'asdf-1234-business');
insert into simple_usr(first_name, last_name, user_details_id) values
('Vasya', 'Gogy', (select id from adviser_usr where email like 'svg@mail.com')),
('Katya', 'Cat', (select id from adviser_usr where email like 'skc@mail.com'));
insert into type_car(name) values ('coupe'), ('crossover');
insert into car_brand(name) values ('Audi'), ('BMW');
insert into car_model(name, car_brand_id, type_car_id) values
('X5', (select id from car_brand where name like 'BMW'), (select id from type_car where name like 'crossover')),
('M5', (select id from car_brand where name like 'BMW'), (select id from type_car where name like 'crossover'))
;
insert into user_car(release_year, car_model_id, simple_user_user_details_id) values
(
'2016',
(select id from car_model where name like 'M5'),
(select user_details_id from simple_usr where first_name in('Vasya'))
),
(
'2016',
(select id from car_model where name like 'X5'),
(select user_details_id from simple_usr where first_name in('Vasya'))
);
|
create or replace view czcs041 as
(
select ysnf as de011,dwdm as de042,dwmc as de041,dwdm as jsde955,
jbbs as jsde017,null as jsde901,320581 as de022,2 as jsde070,0 as jsde001,
null as jsde025,null as jsde019,null as jsde642,null as czde603,null as jsde045,
null as de194,null as czde047,null as jsde057,null as jsde999,null as de192
from xtdwb where dwdm <'997');
|
SELECT
DATE_TRUNC('hour', date_created) AS hour,
count(*) AS volume,
PERCENTILE_CONT(0.8) WITHIN GROUP(ORDER BY transaction_delay) AS "80%",
PERCENTILE_CONT(0.85) WITHIN GROUP(ORDER BY transaction_delay) AS "85%",
PERCENTILE_CONT(0.9) WITHIN GROUP(ORDER BY transaction_delay) AS "90%",
PERCENTILE_CONT(0.95) WITHIN GROUP(ORDER BY transaction_delay) AS "95%",
PERCENTILE_CONT(0.99) WITHIN GROUP(ORDER BY transaction_delay) AS "99%",
MAX(transaction_delay)
FROM (
SELECT
date_created,
DATEDIFF(second, transaction_date, date_created) AS transaction_delay
FROM netsuite.surge_events
WHERE date_created::DATE BETWEEN '2019-08-09' AND '2019-08-15'
AND transaction_date IS NOT NULL
) GROUP BY hour
ORDER BY hour;
|
DROP TABLE IF EXISTS `t_repair_order_sequence`;
CREATE TABLE `t_repair_order_sequence` (
`id` int(11) NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 11 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic; |
-- phpMyAdmin SQL Dump
-- version 4.5.1
-- http://www.phpmyadmin.net
--
-- Host: 127.0.0.1
-- Generation Time: Mar 10, 2017 at 08:11 AM
-- Server version: 10.1.19-MariaDB
-- PHP Version: 5.6.28
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: `test`
--
-- --------------------------------------------------------
--
-- Table structure for table `province_th`
--
CREATE TABLE `province_th` (
`province_id` int(11) NOT NULL,
`province_name` varchar(200) NOT NULL DEFAULT '',
`province_part` int(11) NOT NULL DEFAULT '0'
) ENGINE=MyISAM DEFAULT CHARSET=tis620;
--
-- Dumping data for table `province_th`
--
INSERT INTO `province_th` (`province_id`, `province_name`, `province_part`) VALUES
(1, 'กระบี่', 0),
(2, 'กรุงเทพมหานคร', 0),
(3, 'กาญจนบุรี', 0),
(4, 'กาฬสินธุ์', 0),
(5, 'กำแพงเพชร', 0),
(6, 'ขอนแก่น', 0),
(7, 'จันทบุรี', 0),
(8, 'ฉะเชิงเทรา', 0),
(9, 'ชลบุรี', 0),
(10, 'ชัยนาท', 0),
(11, 'ชัยภูมิ', 0),
(12, 'ชุมพร', 0),
(13, 'เชียงราย', 0),
(14, 'เชียงใหม่', 0),
(15, 'ตรัง', 0),
(16, 'ตราด', 0),
(17, 'ตาก', 0),
(18, 'นครนายก', 0),
(19, 'นครปฐม', 0),
(20, 'นครพนม', 0),
(21, 'นครราชสีมา', 0),
(22, 'นครศรีธรรมราช', 0),
(23, 'นครสวรรค์', 0),
(24, 'นนทบุรี', 0),
(25, 'นราธิวาส', 0),
(26, 'น่าน', 0),
(27, 'บุรีรัมย์', 0),
(28, 'ปทุมธานี', 0),
(29, 'ประจวบคีรีขันธ์', 0),
(30, 'ปราจีนบุรี', 0),
(31, 'ปัตตานี', 0),
(32, 'พระนครศรีอยุธยา', 0),
(33, 'พะเยา', 0),
(34, 'พังงา', 0),
(35, 'พัทลุง', 0),
(36, 'พิจิตร', 0),
(37, 'พิษณุโลก', 0),
(38, 'เพชรบุรี', 0),
(39, ' เพชรบูรณ์', 0),
(40, 'แพร่', 0),
(41, 'ภูเก็ต', 0),
(42, 'มหาสารคาม', 0),
(43, 'มุกดาหาร', 0),
(44, 'แม่ฮ่องสอน', 0),
(45, 'ยโสธร', 0),
(46, 'ยะลา', 0),
(47, 'ร้อยเอ็ด', 0),
(48, 'ระนอง', 0),
(49, 'ระยอง', 0),
(50, 'ราชบุรี', 0),
(51, 'ลพบุรี', 0),
(52, 'ลำปาง', 0),
(53, 'ลำพูน', 0),
(54, 'เลย', 0),
(55, 'ศรีสะเกษ', 0),
(56, 'สกลนคร', 0),
(57, 'สงขลา', 0),
(58, 'สตูล', 0),
(59, 'สมุทรปราการ', 0),
(60, 'สมุทรสงคราม', 0),
(61, 'สมุทรสาคร', 0),
(62, 'สระแก้ว', 0),
(63, 'สระบุรี', 0),
(64, 'สิงห์บุรี', 0),
(65, 'สุโขทัย', 0),
(66, 'สุพรรณบุรี', 0),
(67, 'สุราษฎร์ธานี', 0),
(68, 'สุรินทร์', 0),
(69, 'หนองคาย', 0),
(70, 'หนองบัวลำภู', 0),
(71, 'อ่างทอง', 0),
(72, 'อำนาจเจริญ', 0),
(73, 'อุดรธานี', 0),
(74, 'อุตรดิตถ์', 0),
(75, 'อุทัยธานี', 0),
(76, 'อุบลราชธานี', 0);
--
-- Indexes for dumped tables
--
--
-- Indexes for table `province_th`
--
ALTER TABLE `province_th`
ADD PRIMARY KEY (`province_id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `province_th`
--
ALTER TABLE `province_th`
MODIFY `province_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=77;
/*!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 */;
|
-- 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='ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION';
-- -----------------------------------------------------
-- Schema hospital
-- -----------------------------------------------------
-- -----------------------------------------------------
-- Schema hospital
-- -----------------------------------------------------
CREATE SCHEMA IF NOT EXISTS `hospital` DEFAULT CHARACTER SET utf8 ;
USE `hospital` ;
-- -----------------------------------------------------
-- Table `hospital`.`users`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `hospital`.`users` (
`id_users` INT NOT NULL AUTO_INCREMENT,
`last_name` VARCHAR(45) NOT NULL,
`first_name` VARCHAR(45) NOT NULL,
`patronymic` VARCHAR(45) NOT NULL,
`date_of_birth` DATE NOT NULL,
`login` VARCHAR(45) NOT NULL,
`password` VARCHAR(45) NOT NULL,
`email` VARCHAR(45) NOT NULL,
PRIMARY KEY (`id_users`))
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `hospital`.`patient`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `hospital`.`patient` (
`id_patient` INT NOT NULL AUTO_INCREMENT,
`address` VARCHAR(45) NULL,
`phone_number` INT(20) NULL,
`users_id` INT NOT NULL,
PRIMARY KEY (`id_patient`),
INDEX `fk_patient_users1_idx` (`users_id` ASC) VISIBLE,
CONSTRAINT `fk_patient_users1`
FOREIGN KEY (`users_id`)
REFERENCES `hospital`.`users` (`id_users`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `hospital`.`personal`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `hospital`.`personal` (
`id_personal` INT NOT NULL,
`specialization` VARCHAR(45) NOT NULL,
`personal_role` VARCHAR(45) NOT NULL,
`users_id` INT NOT NULL,
PRIMARY KEY (`id_personal`),
INDEX `fk_personal_users1_idx` (`users_id` ASC) VISIBLE,
CONSTRAINT `fk_personal_users1`
FOREIGN KEY (`users_id`)
REFERENCES `hospital`.`users` (`id_users`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `hospital`.`reception`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `hospital`.`reception` (
`id_reception` INT NOT NULL AUTO_INCREMENT,
`patient_id` INT NOT NULL,
`reception_date` DATE NOT NULL,
`preliminary_diagnosis` VARCHAR(45) NOT NULL,
`discharge_date` DATE NULL,
`final_diagnosis` VARCHAR(45) NULL,
`personal_id` INT NOT NULL,
PRIMARY KEY (`id_reception`),
INDEX `fk_reception_patient1_idx` (`patient_id` ASC) VISIBLE,
INDEX `fk_reception_personal1_idx` (`personal_id` ASC) VISIBLE,
CONSTRAINT `fk_reception_patient1`
FOREIGN KEY (`patient_id`)
REFERENCES `hospital`.`patient` (`id_patient`)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_reception_personal1`
FOREIGN KEY (`personal_id`)
REFERENCES `hospital`.`personal` (`id_personal`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `hospital`.`prescrition`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `hospital`.`prescrition` (
`id_prescrition` INT NOT NULL AUTO_INCREMENT,
`name_prescription` VARCHAR(45) NOT NULL,
`type_prescription` VARCHAR(45) NOT NULL,
`description` VARCHAR(45) NULL,
`personal_id` INT NOT NULL,
PRIMARY KEY (`id_prescrition`),
INDEX `fk_prescrition_personal1_idx` (`personal_id` ASC) VISIBLE,
CONSTRAINT `fk_prescrition_personal1`
FOREIGN KEY (`personal_id`)
REFERENCES `hospital`.`personal` (`id_personal`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `hospital`.`reception_prescrition`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `hospital`.`reception_prescrition` (
`prescrition_id` INT NOT NULL,
`reception_id` INT NOT NULL,
PRIMARY KEY (`prescrition_id`, `reception_id`),
INDEX `fk_prescrition_has_reception_reception1_idx` (`reception_id` ASC) VISIBLE,
INDEX `fk_prescrition_has_reception_prescrition1_idx` (`prescrition_id` ASC) VISIBLE,
CONSTRAINT `fk_prescrition_has_reception_prescrition1`
FOREIGN KEY (`prescrition_id`)
REFERENCES `hospital`.`prescrition` (`id_prescrition`)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_prescrition_has_reception_reception1`
FOREIGN KEY (`reception_id`)
REFERENCES `hospital`.`reception` (`id_reception`)
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;
|
insert into DEPARTMENT values (1,'Computer Sciences','West Lafayette');
insert into DEPARTMENT values (2,'Management','West Lafayette');
insert into DEPARTMENT values (3,'Medical Education','Purdue Calumet');
insert into DEPARTMENT values (4,'Education','Purdue North Central');
insert into DEPARTMENT values (5,'Pharmacal Sciences','Indianapolis');
insert into STUDENT values (0418,'S.Jack',1,'SO',19);
insert into STUDENT values (0671,'A.Smith',2,'FR',20);
insert into STUDENT values (1234,'T.Banks',3,'SR',18);
insert into STUDENT values (3726,'M.Lee',5,'SO',20);
insert into STUDENT values (4829,'J.Bale',3,'JR',22);
insert into STUDENT values (5765,'L.Lim',1,'SR',19);
insert into STUDENT values (0019,'D.Sharon',2,'FR',20);
insert into STUDENT values (7357,'G.Johnson',1,'JR',19);
insert into STUDENT values (8016,'E.Cho',5,'JR',22);
insert into STUDENT values (1111,'AAAA',1,'JR',23);
insert into STUDENT values (2222,'BBBB',1,'JR',21);
insert into STUDENT values (3333,'CCCC',2,'JR',21);
insert into FACULTY values (101,'S.Layton',1);
insert into FACULTY values (102,'B.Jungles',2);
insert into FACULTY values (103,'N.Guzaldo',5);
insert into FACULTY values (104,'S.Boling',4);
insert into FACULTY values (105,'G.Mason',1);
insert into FACULTY values (106,'S.Zwink',2);
insert into FACULTY values (107,'Y.Walton',5);
insert into FACULTY values (108,'I.Teach',5);
insert into FACULTY values (109,'C.Jason',5);
insert into FACULTY values (110,'FFFF',1);
insert into FACULTY values (111,'GGGG',2);
insert into CLASS values ('ENG400',to_date('08:30','HH:MI'),'U003',104);
insert into CLASS values ('ENG320', to_date('09:30','HH:MI'),'R128',104);
insert into CLASS values ('COM100', to_date('11:30','HH:MI'),'L108',104);
insert into CLASS values ('ME308', to_date('10:30','HH:MI'),'R128',102);
insert into CLASS values ('CS448', to_date('09:30','HH:MI'),'R128',101);
insert into CLASS values ('HIS210', to_date('01:30','HH:MI'),'L108',104);
insert into CLASS values ('MATH275', to_date('02:30','HH:MI'),'L108',105);
insert into CLASS values ('STAT110', to_date('04:30','HH:MI'),'R128',105);
insert into CLASS values ('PHYS100', to_date('04:30','HH:MI'),'U003',101);
insert into CLASS values ('CS111', to_date('11:30','HH:MI'),'R128',110);
insert into CLASS values ('CS222', to_date('01:30','HH:MI'),'R128',110);
insert into ENROLLED values (0418,'CS448');
insert into ENROLLED values (1111,'CS448');
insert into ENROLLED values (2222,'CS448');
insert into ENROLLED values (3333,'CS448');
insert into ENROLLED values (0418,'MATH275');
insert into ENROLLED values (1234,'ENG400');
insert into ENROLLED values (8016,'ENG400');
insert into ENROLLED values (8016,'ENG320');
insert into ENROLLED values (8016,'HIS210');
insert into ENROLLED values (8016,'STAT110');
insert into ENROLLED values (0418,'STAT110');
insert into ENROLLED values (1234,'COM100');
insert into ENROLLED values (0671,'ENG400');
insert into ENROLLED values (1234,'HIS210');
insert into ENROLLED values (5765,'PHYS100');
insert into ENROLLED values (5765,'ENG320'); |
INSERT INTO tecnologias (nombre,descripcion) VALUES
('Benji','Benji')
,('Ecoobost','Ecoobost')
,('KingFisher','KingFisher')
; |
VIP订单表.sql
-- 用户累计充值金额
CREATE TABLE `tb_pay_balance` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
`uid` int(11) NOT NULL COMMENT '用户id',
`total_money` double(10,4) DEFAULT NULL COMMENT '累积充值总金额(单位元)',
`total_fee` int(11) DEFAULT NULL COMMENT '累积充值总金额(单位分)',
`state` tinyint(1) NOT NULL DEFAULT '0' COMMENT '状态 0:正常',
`create_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`update_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`create_uid` varchar(16) NOT NULL DEFAULT '',
`update_uid` varchar(16) NOT NULL DEFAULT '',
PRIMARY KEY (`id`),
UNIQUE KEY `uk_uid` (`uid`),
KEY `idx_uid` (`uid`)
) ENGINE=InnoDB AUTO_INCREMENT=298 DEFAULT CHARSET=utf8mb4;
-- 用户支付记录
CREATE TABLE `tb_pay_record` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
`uid` int(11) NOT NULL COMMENT '用户id',
`order_no` varchar(32) NOT NULL COMMENT '订单号(规则见tapd 其明制定的规则)',
`serial_number` varchar(48) DEFAULT NULL COMMENT '原始订单号(支付流水号)',
`money` double(10,4) DEFAULT NULL COMMENT '支付金额(单位元)',
`fee` int(11) DEFAULT NULL COMMENT '支付金额(单位分)',
`unit` varchar(5) DEFAULT 'CNY' COMMENT '金额币种,默认为CNY',
`pay_method` tinyint(1) DEFAULT NULL COMMENT '支付方式 1:微信,2:支付宝,3:银联,4:其他',
`pay_status` tinyint(1) DEFAULT NULL COMMENT '支付状态 0:成功,1:失败,3:待支付,4:失效',
`pay_descr` varchar(200) DEFAULT NULL COMMENT '支付结果描述',
`post_body` text COMMENT '请求信息',
`back_body` text COMMENT '返回信息',
`expire_time` datetime DEFAULT NULL COMMENT '过期时间',
`state` tinyint(1) NOT NULL DEFAULT '0' COMMENT '状态 0:正常',
`create_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`update_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`create_uid` varchar(16) NOT NULL DEFAULT '' COMMENT '创建人id',
`update_uid` varchar(16) NOT NULL DEFAULT '' COMMENT '修改人id',
PRIMARY KEY (`id`),
UNIQUE KEY `uk_serial_number` (`serial_number`),
KEY `idx_uid` (`uid`),
KEY `idx_order_no` (`order_no`),
KEY `idx_serial_number` (`serial_number`),
KEY `idx_pay_method` (`pay_method`),
KEY `idx_pay_status` (`pay_status`)
) ENGINE=InnoDB AUTO_INCREMENT=933 DEFAULT CHARSET=utf8mb4;
-- 订单表
CREATE TABLE `tb_order` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
`uid` int(11) NOT NULL COMMENT '用户id',
`order_no` varchar(32) NOT NULL COMMENT '订单号(规则见tapd 其明制定的规则)',
`serial_number` varchar(48) DEFAULT NULL COMMENT '原始订单号(支付流水号)',
`origin_money` double(10,4) DEFAULT NULL COMMENT '原金额',
`money` double(10,4) DEFAULT NULL COMMENT '订单金额(单位元)',
`fee` int(11) DEFAULT NULL COMMENT '订单金额(单位分)',
`unit` varchar(5) DEFAULT 'CNY' COMMENT '金额币种,默认为CNY',
`order_channel` tinyint(1) DEFAULT NULL COMMENT '下单渠道 1PC 2手机 3手机端微信浏览器',
`pay_method` tinyint(1) DEFAULT NULL COMMENT '支付方式 1:微信,2:支付宝,3:银联,4:其他',
`order_status` tinyint(1) DEFAULT NULL COMMENT '订单状态 0:完成,1:未完成,2:已失效,3:已关闭,4:支付超时',
`business_type` tinyint(1) DEFAULT NULL COMMENT '业务类型 1.预留 2.商品购买 3.VIP开通 4.特权购买 5.FAE咨询',
`is_invoice` tinyint(1) NOT NULL DEFAULT '1' COMMENT '是否开发票 1:未开发票,2:已开发票 3:申请中',
`description` varchar(100) DEFAULT NULL COMMENT '订单描述',
`details` text COMMENT '商品详情',
`product_id` varchar(16) DEFAULT NULL COMMENT '购买的产品id',
`expire_time` datetime DEFAULT NULL COMMENT '过期时间',
`notify_url` text COMMENT '订单回调地址',
`trade_type` varchar(10) DEFAULT NULL COMMENT '交易类型 "NATIVE","H5","APP"等',
`client_ip` varchar(16) DEFAULT NULL COMMENT '下单客户端ip',
`state` tinyint(1) NOT NULL DEFAULT '0' COMMENT '状态 0:正常',
`create_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时`),
间',
`update_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`create_uid` varchar(16) NOT NULL DEFAULT '' COMMENT '创建人id',
`update_uid` varchar(16) NOT NULL DEFAULT '' COMMENT '修改人id',
PRIMARY KEY (`id`),
UNIQUE KEY `uk_order_no` (`order_no`),
KEY `idx_uid` (`uid KEY `idx_order_no` (`order_no`),
KEY `idx_product_id` (`product_id`),
KEY `idx_order_status` (`order_status`)
) ENGINE=InnoDB AUTO_INCREMENT=586 DEFAULT CHARSET=utf8mb4;
-- 订单表增加字段
alter table db_user.tb_order add (
`pay_method` tinyint(1) DEFAULT NULL COMMENT '支付方式 1:微信,2:支付宝,3:银联,4:其他',
`serial_number` varchar(48) DEFAULT NULL COMMENT '支付流水号',
`back_body` text COMMENT '返回信息'
);
--修复数据
UPDATE tb_order t1 JOIN tb_pay_record t2
ON t1.order_no = t2.order_no
SET t1.pay_method=t2.pay_method,t1.serial_number=t2.serial_number,t1.back_body=t2.back_body; |
SELECT AVG(rate)
FROM "comment"
WHERE movie_id = ?; |
WITH RECURSIVE chain_cmd (empno, mgr, `path`) AS
(
SELECT empno, mgr, CAST(ename AS CHAR(200))
FROM emp
WHERE empno = 7788 /* SCOTT */
UNION ALL
SELECT EMP.empno, EMP.mgr, CONCAT(CCMD.`path`, ' -> ', EMP.ename)
FROM chain_cmd CCMD,
emp EMP
WHERE EMP.empno = CCMD.mgr
)
SELECT *
FROM chain_cmd
WHERE mgr IS NULL;
|
DROP TABLE IF EXISTS `pending_checkin`;
CREATE TABLE `pending_checkin` (
`id` int unsigned NOT NULL AUTO_INCREMENT,
`user_id` bigint(20) NOT NULL,
`challenge_id` bigint(20) NOT NULL,
`create_time` timestamp NOT NULL,
`pic_url` varchar(1024) NOT NULL,
`media_id` varchar(1024) NOT NULL,
`msg_id` varchar(1024) NOT NULL,
`status` int NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
DROP TABLE IF EXISTS `jobs`;
CREATE TABLE `jobs` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`handler` text NOT NULL,
`queue` varchar(255) NOT NULL DEFAULT 'default',
`attempts` int(10) unsigned NOT NULL DEFAULT '0',
`run_at` datetime DEFAULT NULL,
`locked_at` datetime DEFAULT NULL,
`locked_by` varchar(255) DEFAULT NULL,
`failed_at` datetime DEFAULT NULL,
`error` text,
`created_at` datetime NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_unicode_ci;
|
练习 使用book表
1. 将呐喊的价格修改为45元
update book set price=45 where name="呐喊";
2. 增加一个字段出版时间 类型为 date 放在价格后面
alter table book add board_time date;
3. 修改所有老舍的作品出版时间为 2018-10-1
update book set date="2018-10-1" where author="老舍";
4. 修改所有中国文学出版社出版的但是不是老舍的作品出版时间为 2020-1-1
update book set date="2020-1-1" where author!="老舍"and press="中国文学";
5. 修改所有出版时间为Null的图书 出版时间为 2019-10-1
update book set date="2019-10-1" where date=null;
6. 所有鲁迅的图书价格增加5元
update book set price=price+1 where author="鲁迅"
7. 删除所有价格超过70元或者不到40元的图书
alter table book drop price where price between 70 and 40;
|
Create Procedure Sp_InsertRecdOLTPM(@RecdDocID Int,@PMCode Nvarchar(255),@DStypeID Int,@ParameterID Int,@OutletID Nvarchar(255),@Target Decimal(18,6),@OCG Nvarchar(255),@CG Nvarchar(255))
As
Begin
Set DateFormat DMY
Insert Into Recd_PMOLT (RecdDocID,PMCode,DStypeID,ParameterID,OutletID,Target,OCG,CG,Status,CreationDate)
Select @RecdDocID,@PMCode,@DStypeID,@ParameterID,@OutletID,@Target,@OCG,@CG,0,Getdate()
Select @@Identity
End
|
-- phpMyAdmin SQL Dump
-- version 4.2.11
-- http://www.phpmyadmin.net
--
-- Servidor: localhost
-- Tiempo de generación: 23-11-2015 a las 23:44:53
-- Versión del servidor: 5.6.21
-- Versión de PHP: 5.6.3
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
--
-- Base de datos: `inmobiliaria`
--
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `inmuebles`
--
CREATE TABLE IF NOT EXISTS `inmuebles` (
`id` int(11) NOT NULL,
`venta_alquiler` int(11) NOT NULL,
`departamento` int(11) NOT NULL,
`municipio` int(11) NOT NULL,
`sector` int(11) NOT NULL,
`tipo_propiedad` int(11) NOT NULL,
`precio` int(11) NOT NULL,
`area` int(11) NOT NULL,
`habitaciones` int(11) NOT NULL,
`banos` int(11) NOT NULL,
`fotografia` int(11) NOT NULL,
`gas` int(11) NOT NULL,
`residencial` int(11) NOT NULL,
`cocina_integral` int(11) NOT NULL,
`piscina` int(11) NOT NULL,
`parqueadero` int(11) NOT NULL,
`transporte_cerca` int(11) NOT NULL,
`supermercados_cerca` int(11) NOT NULL,
`colegios_cerca` int(11) NOT NULL,
`zona_comercial_cerca` int(11) NOT NULL,
`zona_rosa_cerca` int(11) NOT NULL,
`fecha` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`activo` int(11) NOT NULL
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1;
--
-- Volcado de datos para la tabla `inmuebles`
--
INSERT INTO `inmuebles` (`id`, `venta_alquiler`, `departamento`, `municipio`, `sector`, `tipo_propiedad`, `precio`, `area`, `habitaciones`, `banos`, `fotografia`, `gas`, `residencial`, `cocina_integral`, `piscina`, `parqueadero`, `transporte_cerca`, `supermercados_cerca`, `colegios_cerca`, `zona_comercial_cerca`, `zona_rosa_cerca`, `fecha`, `activo`) VALUES
(1, 0, 10, 418, 1, 1, 6345555, 65, 2, 3, 1, 0, 0, 1, 0, 0, 1, 1, 1, 1, 1, '2015-11-23 22:15:11', 1);
--
-- Índices para tablas volcadas
--
--
-- Indices de la tabla `inmuebles`
--
ALTER TABLE `inmuebles`
ADD PRIMARY KEY (`id`), ADD UNIQUE KEY `id` (`id`);
--
-- AUTO_INCREMENT de las tablas volcadas
--
--
-- AUTO_INCREMENT de la tabla `inmuebles`
--
ALTER TABLE `inmuebles`
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 */;
|
# coding: utf-8
from sqlalchemy import Column, DateTime, Integer, String, text
from sqlalchemy.ext.declarative import declarative_base
Base = declarative_base()
metadata = Base.metadata
class Okopf(Base):
__tablename__ = 'okopf'
__table_args__ = {'schema': 'data'}
id = Column(Integer, primary_key=True, server_default=text("nextval('\"data\".okopf_id_seq'::regclass)"))
code = Column(String(32), nullable=False, unique=True)
name = Column(String(1024), nullable=False, unique=True)
date_added = Column(DateTime, nullable=False, server_default=text("now()"))
# coding: utf-8
from sqlalchemy import Column, DateTime, Integer, String, text
from sqlalchemy.ext.declarative import declarative_base
Base = declarative_base()
metadata = Base.metadata
class TypeTargetOrg(Base):
__tablename__ = 'type_target_org'
__table_args__ = {'schema': 'data'}
id = Column(Integer, primary_key=True, server_default=text("nextval('\"data\".type_target_org_id_seq'::regclass)"))
name = Column(String(32), nullable=False, unique=True)
date_added = Column(DateTime, nullable=False, server_default=text("now()"))
# coding: utf-8
from sqlalchemy import Column, DateTime, Integer, String, text
from sqlalchemy.ext.declarative import declarative_base
Base = declarative_base()
metadata = Base.metadata
class TargetStudyRequestStatu(Base):
__tablename__ = 'target_study_request_status'
__table_args__ = {'schema': 'data'}
id = Column(Integer, primary_key=True, server_default=text("nextval('\"data\".target_study_request_status_id_seq'::regclass)"))
name = Column(String(64), unique=True)
date_added = Column(DateTime, nullable=False, server_default=text("now()"))
# coding: utf-8
from sqlalchemy import Column, DateTime, Integer, String, text
from sqlalchemy.ext.declarative import declarative_base
Base = declarative_base()
metadata = Base.metadata
class TypeOrganizationActivity(Base):
__tablename__ = 'type_organization_activity'
__table_args__ = {'schema': 'data'}
id = Column(Integer, primary_key=True, server_default=text("nextval('\"data\".type_organization_activity_id_seq'::regclass)"))
name = Column(String(64), unique=True)
date_added = Column(DateTime, nullable=False, server_default=text("now()"))
# coding: utf-8
from sqlalchemy import Column, DateTime, ForeignKey, Integer, String, text
from sqlalchemy.orm import relationship
from sqlalchemy.ext.declarative import declarative_base
Base = declarative_base()
metadata = Base.metadata
class Okf(Base):
__tablename__ = 'okfs'
__table_args__ = {'schema': 'data'}
id = Column(Integer, primary_key=True, server_default=text("nextval('\"data\".okfs_id_seq'::regclass)"))
code = Column(String(16), nullable=False)
name = Column(String(1024), nullable=False)
dateadd = Column(DateTime, nullable=False, server_default=text("now()"))
class Okopf(Base):
__tablename__ = 'okopf'
__table_args__ = {'schema': 'data'}
id = Column(Integer, primary_key=True, server_default=text("nextval('\"data\".okopf_id_seq'::regclass)"))
code = Column(String(32), nullable=False, unique=True)
name = Column(String(1024), nullable=False, unique=True)
date_added = Column(DateTime, nullable=False, server_default=text("now()"))
class Okso(Base):
__tablename__ = 'okso'
__table_args__ = {'schema': 'data'}
id = Column(Integer, primary_key=True, server_default=text("nextval('\"data\".okso_id_seq'::regclass)"))
code = Column(String(16), nullable=False)
name = Column(String(1024), nullable=False)
dateadd = Column(DateTime, nullable=False, server_default=text("now()"))
class Region(Base):
__tablename__ = 'region'
__table_args__ = {'schema': 'data'}
id = Column(Integer, primary_key=True, server_default=text("nextval('\"data\".region_id_seq'::regclass)"))
name = Column(String(1024), nullable=False)
code = Column(String(16), nullable=False)
dateadd = Column(DateTime, nullable=False, server_default=text("now()"))
class TargetStudyRequestStatu(Base):
__tablename__ = 'target_study_request_status'
__table_args__ = {'schema': 'data'}
id = Column(Integer, primary_key=True, server_default=text("nextval('\"data\".target_study_request_status_id_seq'::regclass)"))
name = Column(String(64), unique=True)
date_added = Column(DateTime, nullable=False, server_default=text("now()"))
class TypeMrigo(Base):
__tablename__ = 'type_mrigo'
__table_args__ = {'schema': 'data'}
id = Column(Integer, primary_key=True, server_default=text("nextval('\"data\".type_mrigo_id_seq'::regclass)"))
name = Column(String(1024), nullable=False)
dateadd = Column(DateTime, nullable=False, server_default=text("now()"))
class TypeOrganizationActivity(Base):
__tablename__ = 'type_organization_activity'
__table_args__ = {'schema': 'data'}
id = Column(Integer, primary_key=True, server_default=text("nextval('\"data\".type_organization_activity_id_seq'::regclass)"))
name = Column(String(64), unique=True)
date_added = Column(DateTime, nullable=False, server_default=text("now()"))
class TypeTargetOrg(Base):
__tablename__ = 'type_target_org'
__table_args__ = {'schema': 'data'}
id = Column(Integer, primary_key=True, server_default=text("nextval('\"data\".type_target_org_id_seq'::regclass)"))
name = Column(String(32), nullable=False, unique=True)
date_added = Column(DateTime, nullable=False, server_default=text("now()"))
class City(Base):
__tablename__ = 'city'
__table_args__ = {'schema': 'data'}
id = Column(Integer, primary_key=True, server_default=text("nextval('\"data\".city_id_seq'::regclass)"))
name = Column(String(1024), nullable=False)
id_region = Column(ForeignKey('data.region.id'), nullable=False)
dateadd = Column(DateTime, nullable=False, server_default=text("now()"))
region = relationship('Region')
class Mrigo(Base):
__tablename__ = 'mrigo'
__table_args__ = {'schema': 'data'}
id = Column(Integer, primary_key=True, server_default=text("nextval('\"data\".mrigo_id_seq'::regclass)"))
name = Column(String(1024), nullable=False)
id_region = Column(ForeignKey('data.region.id'), nullable=False)
id_city = Column(ForeignKey('data.city.id'))
id_type_mrigo = Column(ForeignKey('data.type_mrigo.id'), nullable=False)
dateadd = Column(DateTime, nullable=False, server_default=text("now()"))
city = relationship('City')
region = relationship('Region')
type_mrigo = relationship('TypeMrigo')
class Organization(Base):
__tablename__ = 'organization'
__table_args__ = {'schema': 'data'}
id = Column(Integer, primary_key=True, server_default=text("nextval('\"data\".organization_id_seq'::regclass)"))
inn = Column(String(16), nullable=False)
name = Column(String(1024), nullable=False, unique=True)
id_mrigo = Column(ForeignKey('data.mrigo.id'), nullable=False)
id_okfs = Column(ForeignKey('data.okfs.id'), nullable=False)
dateadd = Column(DateTime, nullable=False, server_default=text("now()"))
is_educ = Column(Integer, server_default=text("1"))
is_worker = Column(Integer, server_default=text("1"))
mrigo = relationship('Mrigo')
okf = relationship('Okf')
class TargetStudyRequest(Base):
__tablename__ = 'target_study_request'
__table_args__ = {'schema': 'data'}
id = Column(Integer, primary_key=True, server_default=text("nextval('\"data\".target_study_request_id_seq'::regclass)"))
id_organization = Column(ForeignKey('data.organization.id'), nullable=False)
id_type_target_org = Column(ForeignKey('data.type_target_org.id'), nullable=False)
id_okopf_customer = Column(ForeignKey('data.okopf.id'))
id_type_activity_customer = Column(ForeignKey('data.type_organization_activity.id'))
id_okopf_employer = Column(ForeignKey('data.okopf.id'))
id_type_activity_employer = Column(ForeignKey('data.type_organization_activity.id'))
id_region = Column(ForeignKey('data.region.id'))
id_mrigo = Column(ForeignKey('data.mrigo.id'))
id_educ_organization = Column(ForeignKey('data.organization.id'))
id_okso = Column(ForeignKey('data.okso.id'))
work_duration = Column(String(128))
job_name = Column(String(512))
job_descr = Column(String(512))
salary_min = Column(Integer)
salary_max = Column(Integer)
salary_comment = Column(String(512))
additional_info = Column(String(4000))
support_info = Column(String(4000))
practice_info = Column(String(4000))
job_garanty = Column(String(4000))
email = Column(String(32))
phone = Column(String(32))
id_target_study_request_status = Column(ForeignKey('data.target_study_request_status.id'), server_default=text("1"))
date_added = Column(DateTime, nullable=False, server_default=text("now()"))
organization = relationship('Organization', primaryjoin='TargetStudyRequest.id_educ_organization == Organization.id')
mrigo = relationship('Mrigo')
okopf = relationship('Okopf', primaryjoin='TargetStudyRequest.id_okopf_customer == Okopf.id')
okopf1 = relationship('Okopf', primaryjoin='TargetStudyRequest.id_okopf_employer == Okopf.id')
okso = relationship('Okso')
organization1 = relationship('Organization', primaryjoin='TargetStudyRequest.id_organization == Organization.id')
region = relationship('Region')
target_study_request_statu = relationship('TargetStudyRequestStatu')
type_organization_activity = relationship('TypeOrganizationActivity', primaryjoin='TargetStudyRequest.id_type_activity_customer == TypeOrganizationActivity.id')
type_organization_activity1 = relationship('TypeOrganizationActivity', primaryjoin='TargetStudyRequest.id_type_activity_employer == TypeOrganizationActivity.id')
type_target_org = relationship('TypeTargetOrg')
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.