text stringlengths 6 9.38M |
|---|
create table usuario(
codigo integer identity not null primary key,
nome varchar(100),
sobrenome varchar(100),
email varchar(100),
data_nascimento date,
sexo char(1),
cpf varchar(20),
estado_civil char(1),
renda_mensal numeric,
login varchar(100),
senha varchar(100),
UNIQUE (login)
);
create table tipo_movimentacao (
codigo integer identity not null primary key,
descricao varchar(100) not null,
observacao varchar(100),
codigo_usuario integer not null,
FOREIGN KEY (codigo_usuario) REFERENCES usuario(codigo)
);
create table movimentacao(
codigo integer identity not null primary key,
descricao varchar(100) not null,
situacao char(1) not null,
data timestamp not null,
valor numeric not null,
repetir char(1) not null,
codigo_tipo_movimentacao integer not null,
codigo_usuario integer not null,
FOREIGN KEY (codigo_tipo_movimentacao) REFERENCES tipo_movimentacao(codigo),
FOREIGN KEY (codigo_usuario) REFERENCES usuario(codigo)
);
|
drop schema musicbrainz cascade;
create schema musicbrainz;
set search_path to musicbrainz;
CREATE TABLE area_type ( -- replicate
id integer not null, -- PK
name VARCHAR(255) NOT NULL,
parent INTEGER, -- references area_type.id
child_order INTEGER NOT NULL DEFAULT 0,
description TEXT,
gid varchar(500) NOT NULL
);
CREATE TABLE area ( -- replicate (verbose)
id integer unique, -- PK
gid varchar(max),
name varchar(max),
type INTEGER, -- references area_type.id
edits_pending INTEGER,
last_updated TIMESTAMP WITH TIME ZONE DEFAULT NOW(),
begin_date_year SMALLINT,
begin_date_month SMALLINT,
begin_date_day SMALLINT,
end_date_year SMALLINT,
end_date_month SMALLINT,
end_date_day SMALLINT,
ended BOOLEAN DEFAULT FALSE,
comment varchar(max)
);
CREATE TABLE area_alias_type ( -- replicate
id integer not null, -- PK,
name TEXT NOT NULL,
parent INTEGER, -- references area_alias_type.id
child_order INTEGER NOT NULL,
description TEXT,
gid varchar(500) NOT NULL
);
CREATE TABLE area_alias ( -- replicate (verbose)
id integer not null, --PK
area INTEGER NOT NULL, -- references area.id
name VARCHAR NOT NULL,
locale TEXT,
edits_pending INTEGER NOT NULL,
last_updated TIMESTAMP WITH TIME ZONE DEFAULT NOW(),
type INTEGER, -- references area_alias_type.id
sort_name VARCHAR NOT NULL,
begin_date_year SMALLINT,
begin_date_month SMALLINT,
begin_date_day SMALLINT,
end_date_year SMALLINT,
end_date_month SMALLINT,
end_date_day SMALLINT,
primary_for_locale BOOLEAN NOT NULL DEFAULT false,
ended BOOLEAN NOT NULL DEFAULT FALSE
);
CREATE TABLE artist ( -- replicate (verbose)
id integer not null,
gid varchar(500) NOT NULL,
name VARCHAR(500) NOT NULL,
sort_name VARCHAR(500) NOT NULL,
begin_date_year SMALLINT,
begin_date_month SMALLINT,
begin_date_day SMALLINT,
end_date_year SMALLINT,
end_date_month SMALLINT,
end_date_day SMALLINT,
type INTEGER, -- references artist_type.id
area INTEGER, -- references area.id
gender INTEGER, -- references gender.id
comment VARCHAR(500) NOT NULL DEFAULT '',
edits_pending INTEGER,
last_updated TIMESTAMP WITH TIME ZONE DEFAULT NOW(),
ended BOOLEAN NOT NULL DEFAULT FALSE,
begin_area integer,
end_area integer
);
CREATE TABLE artist_alias_type ( -- replicate
id integer not null,
name TEXT NOT NULL,
parent INTEGER, -- references artist_alias_type.id
child_order INTEGER NOT NULL DEFAULT 0,
description TEXT,
gid varchar(500) NOT NULL
);
CREATE TABLE artist_alias ( -- replicate (verbose)
id integer not null,
artist INTEGER NOT NULL, -- references artist.id
name VARCHAR NOT NULL,
locale TEXT,
edits_pending INTEGER NOT NULL,
last_updated TIMESTAMP WITH TIME ZONE DEFAULT NOW(),
type INTEGER, -- references artist_alias_type.id
sort_name VARCHAR NOT NULL,
begin_date_year SMALLINT,
begin_date_month SMALLINT,
begin_date_day SMALLINT,
end_date_year SMALLINT,
end_date_month SMALLINT,
end_date_day SMALLINT,
primary_for_locale BOOLEAN NOT NULL DEFAULT false,
ended BOOLEAN NOT NULL DEFAULT FALSE
);
CREATE TABLE artist_credit ( -- replicate
id integer not null,
name varchar(max),
artist_count SMALLINT NOT NULL,
ref_count INTEGER DEFAULT 0,
created TIMESTAMP WITH TIME ZONE DEFAULT NOW()
);
CREATE TABLE artist_credit_name ( -- replicate (verbose)
artist_credit INTEGER NOT NULL, -- PK, references artist_credit.id CASCADE
position SMALLINT NOT NULL, -- PK
artist INTEGER NOT NULL, -- references artist.id CASCADE
name VARCHAR(max),
join_phrase TEXT DEFAULT ''
);
CREATE TABLE artist_type ( -- replicate
id integer not null,
name VARCHAR(255) NOT NULL,
parent INTEGER, -- references artist_type.id
child_order INTEGER NOT NULL DEFAULT 0,
description TEXT,
gid varchar(500) NOT NULL
);
CREATE TABLE gender ( -- replicate
id integer not null,
name VARCHAR(255) NOT NULL,
parent INTEGER, -- references gender.id
child_order INTEGER NOT NULL DEFAULT 0,
description TEXT,
gid varchar(500) NOT NULL
);
CREATE TABLE language ( -- replicate
id integer not null,
iso_code_2t CHAR(3), -- ISO 639-2 (T)
iso_code_2b CHAR(3), -- ISO 639-2 (B)
iso_code_1 CHAR(2), -- ISO 639
name VARCHAR(100) NOT NULL,
frequency INTEGER NOT NULL DEFAULT 0,
iso_code_3 CHAR(3) -- ISO 639-3
);
CREATE TABLE release ( -- replicate (verbose)
id integer not null,
gid varchar(500) NOT NULL,
name VARCHAR NOT NULL,
artist_credit INTEGER NOT NULL, -- references artist_credit.id
release_group INTEGER NOT NULL, -- references release_group.id
status INTEGER, -- references release_status.id
packaging INTEGER, -- references release_packaging.id
language INTEGER, -- references language.id
script INTEGER, -- references script.id
barcode VARCHAR(255),
comment VARCHAR(255) NOT NULL DEFAULT '',
edits_pending INTEGER NOT NULL,
quality SMALLINT NOT NULL DEFAULT -1,
last_updated varchar(max)
);
CREATE TABLE release_alias_type ( -- replicate
id integer not null, -- PK,
name TEXT NOT NULL,
parent INTEGER, -- references release_alias_type.id
child_order INTEGER NOT NULL DEFAULT 0,
description TEXT,
gid varchar(500) NOT NULL
);
CREATE TABLE release_alias ( -- replicate (verbose)
id integer not null, --PK
release INTEGER NOT NULL, -- references release.id
name VARCHAR NOT NULL,
locale TEXT,
edits_pending INTEGER NOT NULL,
last_updated TIMESTAMP WITH TIME ZONE DEFAULT NOW(),
type INTEGER, -- references release_alias_type.id
sort_name VARCHAR NOT NULL,
begin_date_year SMALLINT,
begin_date_month SMALLINT,
begin_date_day SMALLINT,
end_date_year SMALLINT,
end_date_month SMALLINT,
end_date_day SMALLINT,
primary_for_locale BOOLEAN NOT NULL DEFAULT false,
ended BOOLEAN NOT NULL DEFAULT FALSE
);
CREATE TABLE release_label ( -- replicate (verbose)
id integer not null,
release INTEGER NOT NULL, -- references release.id
label INTEGER, -- references label.id
catalog_number VARCHAR(255),
last_updated TIMESTAMP WITH TIME ZONE DEFAULT NOW()
);
CREATE TABLE release_packaging ( -- replicate
id integer not null,
name VARCHAR(255) NOT NULL,
parent INTEGER, -- references release_packaging.id
child_order INTEGER NOT NULL DEFAULT 0,
description TEXT,
gid varchar(500) NOT NULL
);
CREATE TABLE release_status ( -- replicate
id integer not null,
name VARCHAR(255) NOT NULL,
parent INTEGER, -- references release_status.id
child_order INTEGER NOT NULL DEFAULT 0,
description TEXT,
gid varchar(500)
);
CREATE TABLE release_group ( -- replicate (verbose)
id integer not null,
gid varchar(max),
name varchar(max),
artist_credit INTEGER NOT NULL, -- references artist_credit.id
type INTEGER, -- references release_group_primary_type.id
comment VARCHAR(max) DEFAULT '',
edits_pending INTEGER DEFAULT 0,
last_updated varchar(max)
);
CREATE TABLE release_group_alias_type ( -- replicate
id integer not null, -- PK,
name TEXT NOT NULL,
parent INTEGER, -- references release_group_alias_type.id
child_order INTEGER NOT NULL DEFAULT 0,
description TEXT,
gid varchar(500) NOT NULL
);
CREATE TABLE release_group_alias ( -- replicate (verbose)
id integer not null, --PK
release_group INTEGER NOT NULL, -- references release_group.id
name VARCHAR(500) NOT NULL,
locale TEXT,
edits_pending INTEGER NOT NULL,
last_updated TIMESTAMP WITH TIME ZONE DEFAULT NOW(),
type INTEGER, -- references release_group_alias_type.id
sort_name VARCHAR(MAX),
begin_date_year SMALLINT,
begin_date_month SMALLINT,
begin_date_day SMALLINT,
end_date_year SMALLINT,
end_date_month SMALLINT,
end_date_day SMALLINT,
primary_for_locale BOOLEAN NOT NULL DEFAULT false,
ended BOOLEAN NOT NULL DEFAULT FALSE
);
CREATE TABLE release_group_primary_type ( -- replicate
id integer not null,
name VARCHAR(500) NOT NULL,
parent INTEGER, -- references release_group_primary_type.id
child_order INTEGER NOT NULL DEFAULT 0,
description text,
gid varchar(500) NOT NULL
);
CREATE TABLE release_group_secondary_type ( -- replicate
id integer NOT NULL, -- PK
name varchar(500) NOT NULL,
parent INTEGER, -- references release_group_secondary_type.id
child_order INTEGER NOT NULL DEFAULT 0,
description TEXT,
gid varchar(500) NOT NULL
);
CREATE TABLE release_group_secondary_type_join ( -- replicate (verbose)
release_group INTEGER NOT NULL, -- PK, references release_group.id,
secondary_type INTEGER NOT NULL, -- PK, references release_group_secondary_type.id
created TIMESTAMP WITH TIME ZONE DEFAULT NOW()
);
|
SELECT t.function_type, t.action_type, t.remark, t.action_user,
date_format(action_time,'%Y-%m-%d %H:%i:%s.%f') AS action_time
FROM log_system_action t
WHERE time_stamp BETWEEN @from_dt AND @to_dt
AND action_user LIKE @cond_1
ORDER BY action_time
LIMIT @limit; |
;with cte
as(
select
1 as rn
, cast(N'* ' as varchar(max)) as res
union all
select
rn + 1
, cast(concat(res, N'* ') as varchar(max))
from cte
where (rn + 1) <= 20
)
select res from cte
order by rn |
/*
Highest Energy Consumption
Find the date with the highest total energy consumption from the Facebook data centers.
Output the date along with the total energy consumption across all data centers.
fb_eu_energy
date datetime
consumption int
fb_asia_energy
date datetime
consumption int
fb_na_energy
date datetime
consumption int
*/
WITH
total_energy AS
(SELECT *
FROM fb_eu_energy eu
UNION ALL SELECT *
FROM fb_asia_energy asia
UNION ALL SELECT *
FROM fb_na_energy na),
energy_by_date AS
(SELECT date, sum(consumption) AS total_energy
FROM total_energy
GROUP BY date
ORDER BY date ASC),
max_energy AS
(SELECT max(total_energy) AS max_energy
FROM energy_by_date)
SELECT ebd.date, ebd.total_energy
FROM energy_by_date ebd
JOIN max_energy me ON ebd.total_energy = me.max_energy
|
UPDATE admin
SET admin.access_rights = 'SELECT,INSERT,UPDATE,DELETE,add/remove Admin'
WHERE admin.department = 'IT';
UPDATE admin
SET admin.access_rights = 'SELECT,INSERT,UPDATE,DELETE,add/remove Admin'
WHERE staff_email = 'Amy@gmail.com'; |
CREATE DEFINER=`dba`@`%` PROCEDURE `INCLUIR_USUARIO`(OUT P_ID_USUARIO INT,
IN P_USU_EMAIL VARCHAR(255),
IN P_USU_SENHA VARCHAR(255),
IN P_COMMIT VARCHAR(1),
OUT P_OK VARCHAR(1),
OUT P_RETORNO VARCHAR(2000))
INCLUIR_USUARIO:BEGIN
DECLARE V_TEXTO VARCHAR(2000);
CALL VALIDA_CAMPO_OBRIGATORIO(P_USU_EMAIL, 'USUARIO', 'USU_EMAIL', P_OK, P_RETORNO);
IF P_OK = 'N' THEN
LEAVE INCLUIR_USUARIO;
END IF;
CALL VALIDA_CAMPO_OBRIGATORIO(P_USU_SENHA, 'USUARIO', 'USU_SENHA', P_OK, P_RETORNO);
IF P_OK = 'N' THEN
LEAVE INCLUIR_USUARIO;
END IF;
SELECT COUNT(1)
INTO @V_COUNT FROM USUARIO U
WHERE U.USU_EMAIL = P_USU_EMAIL;
IF @V_COUNT > 0 THEN
CALL MSG_ERRO('EMAIL_EXISTE', P_USU_EMAIL, NULL, NULL, NULL, NULL, P_OK, P_RETORNO);
-- O e-mail :param1 já existe.
LEAVE INCLUIR_USUARIO;
END IF;
-- incluir usuário
INSERT INTO USUARIO (USU_EMAIL, USU_SENHA)
VALUES(P_USU_EMAIL, MD5(P_USU_SENHA));
CALL MSG_SUCESSO('INCLUIR_USUARIO', NULL, NULL, NULL, NULL, NULL, P_OK, P_RETORNO);
-- Usuário cadastrado com sucesso.
IF P_OK = 'N' THEN
LEAVE INCLUIR_USUARIO;
END IF;
IF IFNULL(P_COMMIT,'N') = 'S'THEN
COMMIT;
END IF;
-- retorna o id do usuário cadastrado
SET P_ID_USUARIO := LAST_INSERT_ID();
END |
DROP DATABASE IF EXISTS socialbeauty;
CREATE DATABASE IF NOT EXISTS socialbeauty;
USE socialbeauty;
CREATE USER IF NOT EXISTS 'admin'@'localhost' IDENTIFIED BY 'S0C14LB34UTY';
GRANT ALL PRIVILEGES ON socialbeauty.* TO 'admin'@'localhost';
-- -----------------------------------------------------
-- Table users
-- -----------------------------------------------------
CREATE TABLE users (
userId INT NOT NULL AUTO_INCREMENT,
userName VARCHAR(80) UNIQUE NOT NULL,
userEmail VARCHAR(80) UNIQUE NOT NULL,
userPassword TEXT NOT NULL,
PRIMARY KEY (userId)
)
Engine = InnoDB;
-- -----------------------------------------------------
-- Table profiles
-- -----------------------------------------------------
CREATE TABLE profiles (
profileId INT NOT NULL AUTO_INCREMENT,
profileName VARCHAR(80) NOT NULL,
profileBirthDate VARCHAR(80) NOT NULL,
profileLocation VARCHAR(80) NOT NULL,
profileBio TEXT,
profileWebsite VARCHAR(255),
profilePicture VARCHAR(80) NOT NULL,
userId INT,
PRIMARY KEY (profileId),
CONSTRAINT FK_UserProfile FOREIGN KEY (userId)
REFERENCES users(userId)
)
Engine = InnoDB;
-- -----------------------------------------------------
-- Table articles
-- -----------------------------------------------------
CREATE TABLE articles (
articleId INT NOT NULL AUTO_INCREMENT,
articleTitle VARCHAR(255) NOT NULL,
articleAuthor VARCHAR(80) NOT NULL,
articleCategory VARCHAR(80) NOT NULL,
articleContent TEXT NOT NULL,
articleAddDate VARCHAR(80) NOT NULL,
PRIMARY KEY (articleId)
)
Engine = InnoDB;
-- -----------------------------------------------------
-- Table articlecomments
-- -----------------------------------------------------
CREATE TABLE articlecomments (
artcommentId INT NOT NULL AUTO_INCREMENT,
artcommentAuthor VARCHAR(80) NOT NULL,
artcommentContent TEXT NOT NULL,
artcommentAddDate VARCHAR(80) NOT NULL,
articleId INT NOT NULL,
PRIMARY KEY (artcommentId),
CONSTRAINT FK_ArticleComment FOREIGN KEY (articleId)
REFERENCES articles(articleId)
)
Engine = InnoDB;
-- -----------------------------------------------------
-- Table articlemedias
-- -----------------------------------------------------
CREATE TABLE articlemedias (
artmediaId INT NOT NULL AUTO_INCREMENT,
artmediaFileName VARCHAR(80) UNIQUE NOT NULL,
artmediaDate VARCHAR(80) NOT NULL,
articleId INT NOT NULL,
PRIMARY KEY (artmediaId),
CONSTRAINT FK_ArticleMedia FOREIGN KEY (articleId)
REFERENCES articles(articleId)
)
Engine = InnoDB;
-- -----------------------------------------------------
-- Table gallery
-- -----------------------------------------------------
CREATE TABLE galleries (
galleryId INT NOT NULL AUTO_INCREMENT,
galleryAuthor VARCHAR(80) NOT NULL,
galleryCategory VARCHAR(80) NOT NULL,
galleryAddDate VARCHAR(80) NOT NULL,
galleryDescription TEXT,
PRIMARY KEY (galleryId)
)
Engine = InnoDB;
-- -----------------------------------------------------
-- Table gallerycomments
-- -----------------------------------------------------
CREATE TABLE gallerycomments (
gallcommentId INT NOT NULL AUTO_INCREMENT,
gallcommentAuthor VARCHAR(80) NOT NULL,
gallcommentContent TEXT NOT NULL,
gallcommentAddDate VARCHAR(80) NOT NULL,
galleryId INT NOT NULL,
PRIMARY KEY (gallcommentId),
CONSTRAINT FK_GalleryComment FOREIGN KEY (galleryId)
REFERENCES galleries(galleryId)
)
Engine = InnoDB;
-- -----------------------------------------------------
-- Table gallerymedias
-- -----------------------------------------------------
CREATE TABLE gallerymedias (
gallmediaId INT NOT NULL AUTO_INCREMENT,
gallmediaFileName VARCHAR(80) UNIQUE NOT NULL,
gallmediaDate VARCHAR(80) NOT NULL,
galleryId INT NOT NULL,
PRIMARY KEY (gallmediaId),
CONSTRAINT FK_GalleryMedia FOREIGN KEY (galleryId)
REFERENCES galleries(galleryId)
)
Engine = InnoDB;
|
--create database veritabanư
--use veritabanư
--go
--create table kisiler
--(
--id int identity(0,1),
--adi char(50),
--soyadi char(50),
--cep_no int,
--email varchar(50),
--constraint PK_Kisiler primary key (id)
--)
|
INSERT INTO `TMDAD`.`ROLES` (`ID_ROLE`, `NAME`) VALUES ('1','ADMIN');
INSERT INTO `TMDAD`.`ROLES` (`ID_ROLE`, `NAME`) VALUES ('2','GUEST');
|
CREATE TABLE status_company
(
id integer NOT NULL,
name character varying(255),
status boolean,
CONSTRAINT balance_pkey PRIMARY KEY (id)
)
WITH (
OIDS=FALSE
);
ALTER TABLE status_company
OWNER TO thsadmin;
INSERT INTO status_company(id, name, status)
VALUES (1, 'mari.ruas', true);
INSERT INTO status_company(id, name, status)
VALUES (2, 'odon.moojen', true); |
----type to display the output of rolling_partitions
CREATE TYPE aws_utility.rolling_partitions_array AS
(
table_name VARCHAR,
table_count INTEGER
);
|
create view emp_view as
select employee_id 사원번호, last_name 성, salary 연봉
from employees;
select * from emp_view;
-- hr 스키마에 있는 테이블
-- 나라
select * from countries;
select * from cnt;
-- 부서
select * from departments;
select * from dep;
-- 직원
select * from employees;
select * from emp;
-- 지역
select * from locations;
select * from loc;
-- 업무
select * from jobs;
select * from job;
-- 연혁
select * from job_history;
select * from job_his;
-- 위치
select * from regions;
select * from reg;
drop view cnt;
create or replace view cnt as
select
country_id as cid,
country_name as cname,
region_id as rid
from countries;
create or replace view dep as
select
department_id as did,
department_name as dname,
manager_id as mid,
location_id as lid
from DEPARTMENTS;
create or replace view emp as
select
employee_id as eid,
first_name ||' '|| last_name as ename,
email,
phone_number as phone_no,
hire_date as hire_dt,
job_id as jid,
salary as sal,
commission_pct as cms_pt,
manager_id as mid,
department_id as did
from employees;
create or replace view job as
select
job_id as jid,
job_title as jname,
min_salary as min_sal,
max_salary as max_sal
from jobs;
create or replace view job_his as
select
employee_id as eid,
start_date as start_dt,
end_date as end_dt,
job_id as jid,
department_id as did
from JOB_HISTORY;
create or replace view loc as
select
location_id as lid,
street_address as street,
postal_code as zipcode,
city,
state_province as state,
country_id as cid
from LOCATIONS;
create or replace view reg as
select
region_id as rid,
region_name as rname
from REGIONS;
|
create table files (
day Date DEFAULT toDate(ts),
ts DateTime,
fuid String,
tx_hosts Array(String),
rx_hosts Array(String),
conn_uids Array(String),
source Enum8('SSL'=1, 'HTTP'=2),
depth UInt8,
analyzers Array(Enum8('SHA1'=1, 'MD5'=2, 'X509'=3, 'NEMAJSEXTRACT'=4, 'NEMAHTMLEXTRACT'=5, 'SFAEXTRACT'=6)),
mime_type String,
filename Nullable(String),
duration Float32,
local_orig Enum8('F'=0, 'T'=1),
is_orig Enum8('F'=0, 'T'=1),
seen_bytes UInt16,
total_bytes Nullable(UInt16),
missing_bytes UInt16,
overflow_bytes UInt16,
timedout Enum8('F'=0, 'T'=1),
parent_fuid Nullable(String),
md5 String,
sha1 String,
sha256 Nullable(String),
extracted Nullable(String),
extracted_cutoff Nullable(Enum8('F'=0, 'T'=1)),
extracted_size Nullable(UInt32)
)
ENGINE = MergeTree(day,cityHash64(fuid), (day,cityHash64(fuid), fuid), 8192);
|
-- MySQL Script generated by MySQL Workbench
-- Wed Oct 21 16:01:53 2020
-- Model: New Model Version: 1.0
-- MySQL Workbench Forward Engineering
SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;
SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION';
-- -----------------------------------------------------
-- Schema Pur_Beurre_Base_de_Donnees
-- -----------------------------------------------------
-- -----------------------------------------------------
-- Schema Pur_Beurre_Base_de_Donnees
-- -----------------------------------------------------
CREATE SCHEMA IF NOT EXISTS `Pur_Beurre_Base_de_Donnees` DEFAULT CHARACTER SET utf8 ;
USE `Pur_Beurre_Base_de_Donnees` ;
-- -----------------------------------------------------
-- Table `Pur_Beurre_Base_de_Donnees`.`storage`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `Pur_Beurre_Base_de_Donnees`.`storage` (
`start_food` INT NOT NULL,
`substitute_food` INT NOT NULL,
INDEX `id_start` (`start_food` ASC) VISIBLE,
INDEX `id_substitute` (`substitute_food` ASC) VISIBLE)
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `Pur_Beurre_Base_de_Donnees`.`food_datas`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `Pur_Beurre_Base_de_Donnees`.`food_datas` (
`Id's` INT NOT NULL,
`product_name` VARCHAR(255) NOT NULL,
`brands` VARCHAR(255) NOT NULL,
`nutriscore_grade_fr` VARCHAR(4) NOT NULL,
`stores` VARCHAR(255) NOT NULL,
`image_url` VARCHAR(255) NOT NULL,
PRIMARY KEY (`Id's`),
UNIQUE INDEX `Id's_UNIQUE` (`Id's` ASC) VISIBLE,
CONSTRAINT `key_start`
FOREIGN KEY (`Id's`)
REFERENCES `Pur_Beurre_Base_de_Donnees`.`storage` (`start_food`)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `key_substitute`
FOREIGN KEY (`Id's`)
REFERENCES `Pur_Beurre_Base_de_Donnees`.`storage` (`substitute_food`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `Pur_Beurre_Base_de_Donnees`.`categories`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `Pur_Beurre_Base_de_Donnees`.`categories` (
`category_id` INT NOT NULL,
`category` VARCHAR(50) NOT NULL,
PRIMARY KEY (`category_id`, `category`),
UNIQUE INDEX `category` (`category` ASC) VISIBLE,
CONSTRAINT `Key_food`
FOREIGN KEY (`category_id`)
REFERENCES `Pur_Beurre_Base_de_Donnees`.`food_datas` (`Id's`)
ON DELETE NO ACTION
ON UPDATE NO ACTION);
SET SQL_MODE=@OLD_SQL_MODE;
SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;
|
SELECT
title
FROM
movies
WHERE
year >= 2018
ORDER BY
title; |
-- criando tabela PRODUTOS
create database fichasI
-- EXERCICIO 2
create table PRODUTO_AULA4
(
id_pro int identity,
nome varchar(30) not null,
preco decimal(7,2) not null,
quantdd int default 90,
dtvalidade varchar(30) not null
primary key(id_pro)
);
-- EXERCICIO 3
-- inserindo dados na tabela com mais 5 PRODUTOS
insert into PRODUTO_AULA4 values ('Chocolate Diamante Negro',400.00,default,'06/06/2020');
insert into PRODUTO_AULA4 values ('Ovo de Pascoa Diamante Negro',450.00,default,'05/05/2020');
insert into PRODUTO_AULA4 values ('Barra Ovomaltine',150.00,default,'03/03/2020');
insert into PRODUTO_AULA4 values ('Trufa Diamante Negro',100.00,default,'02/02/2020');
insert into PRODUTO_AULA4 values (' Bis Ovomaltine',49.00,default,'01/01/2020');
-- verificando dados cadastrados
select * from PRODUTO_AULA4;
|
CREATE DATABASE University;
#TODO |
--- Dev stuff
DROP TABLE IF EXISTS `associated_feature_type`;
CREATE TABLE `associated_feature_type` (
`feature_id` int(10) unsigned NOT NULL,
`feature_table` enum('annotated', 'external', 'regulatory') default NULL,
`feature_type_id` int(10) unsigned NOT NULL,
PRIMARY KEY (`feature_id`, `feature_table`, `feature_type_id`),
KEY `feature_type_index` (`feature_type_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
# patch identifier
INSERT INTO meta (species_id, meta_key, meta_value) VALUES (NULL, 'patch', 'patch_50_51_c.sql|associated_feature_type');
|
create database ex03_18;
use ex03_18;
-- BIBLIOTECA
create table usuario(
IdMatricula int not null primary key auto_increment,
nome varchar(100),
endereco varchar(100),
email varchar(50)
);
-- insere na tabela as informações
insert usuario (nome, endereco, email)
values ('Jhonatan', 'Rod. Tertuliano Brito Xavier', 'jhonatan4alves@gmail.com');
select *from usuario;
create table livro(
IdCodigo int not null primary key auto_increment,
titulo varchar(100),
autor varchar(70),
editora varchar(50),
dataEmp date,
dataDev date,
dataRes date,
IdMatricula int,
foreign key (IdMatricula) references usuario (IdMatricula)
);
create table autor(
IdAutor int not null primary key auto_increment,
nome varchar(100),
enderecoWeb varchar(100),
nacionalidade varchar(100),
email varchar(100)
);
create table assunto(
IdAssunto int not null primary key auto_increment,
nome varchar(100)
);
create table subAssunto(
IdSubAssunto int not null primary key auto_increment
);
create table reservar(
IdMatricula int not null,
IdCodigo int not null,
primary key (IdMatricula, IdCodigo),
foreign key (IdMatricula) references usuario (IdMatricula),
foreign key (IdCodigo) references livro (IdCodigo)
);
create table escreve(
IdAutor int not null,
IdCodigo int not null,
primary key (IdAutor, IdCodigo),
foreign key (IdAutor) references autor (IdAutor),
foreign key (IdCodigo) references livro (IdCodigo)
);
create table contido(
IdCodigo int not null,
IdAssunto int not null,
primary key (IdCodigo, IdAssunto),
foreign key (IdCodigo) references livro (IdCodigo),
foreign key (IdAssunto) references assunto (IdAssunto)
);
create table contem(
IdAssunto int not null,
IdSubAssunto int not null,
primary key (IdAssunto, IdSubAssunto),
foreign key (IdAssunto) references assunto (IdAssunto),
foreign key (IdSubAssunto) references subAssunto (IdSubAssunto)
);
######################################################################
-- EMPRESA
create table departamento(
IdNumeroD int not null auto_increment,
nome varchar(100),
dataFuncio date,
localizacao varchar(100),
primary key(IdNumeroD)
);
create table funcionario(
IdFuncionario int not null auto_increment,
nome varchar(100),
salario int,
dataNascimento date,
sexo char(1),
numeroHoras int,
endereco varchar(100),
NSS int,
primary key(IdFuncionario)
);
#FUSAO DE TABELA
create table funcionario_departamento(
IdFuncionario int not null,
IdNumeroD int not null,
primary key(IdFuncionario, IdNumeroD)
);
create table projeto(
IdNumeroP int not null auto_increment,
nome varchar(100),
localizacao varchar(100),
primary key(IdNumeroP)
);
create table dependentes(
IdDependentes int not null auto_increment,
nome varchar(100),
dataNascimento date,
relacionamento varchar(100),
sexo char(1),
primary key(IdDependentes)
);
#//////
create table controla(
IdNumeroD int not null,
IdNumeroP int not null,
primary key(IdNumeroD, IdNumeroP),
foreign key (IdNumeroD) references departamento(IdNumeroD),
foreign key (IdNumeroP) references projeto(IdNumeroP)
);
create table trabalha(
IdNumeroD int not null,
IdFuncionario int not null,
primary key(IdNumeroD, IdFuncionario),
foreign key (IdNumeroD) references departamento(IdNumeroD),
foreign key (IdFuncionario) references funcionario(IdFuncionario)
);
create table beneficio(
IdDependentes int not null,
IdFuncionario int not null,
primary key(IdDependentes, IdFuncionario),
foreign key (IdDependentes) references dependentes(IdDependentes),
foreign key (IdFuncionario) references funcionario(IdFuncionario)
);
|
create table TYPE_BOT_EXPORT
(
TBE_CD VARCHAR(100) not null,
LABEL VARCHAR(100) not null,
LABEL_FR VARCHAR(100) not null,
constraint PK_TYPE_BOT_EXPORT primary key (TBE_CD)
);
comment on column TYPE_BOT_EXPORT.TBE_CD is
'Code';
comment on column TYPE_BOT_EXPORT.LABEL is
'Title';
comment on column TYPE_BOT_EXPORT.LABEL_FR is
'Titre';
insert into TYPE_BOT_EXPORT(TBE_CD, LABEL, LABEL_FR) values ('CATEGORIES', 'Categories', 'Catégories');
insert into TYPE_BOT_EXPORT(TBE_CD, LABEL, LABEL_FR) values ('TOPICS', 'Topics', 'Intentions');
insert into TYPE_BOT_EXPORT(TBE_CD, LABEL, LABEL_FR) values ('DICTIONARY', 'Dictionary', 'Dictionnaire'); |
use Northwind
insert into Products values (1, 'Produto 1', 100, 50);
insert into Products values (2, 'Produto 2', 200, 60);
insert into Products(ProductID, ProductName, UnitPrice, UnitsInStock) values (3, 'Produto 3', 300, 7);
--delete from products |
-- phpMyAdmin SQL Dump
-- version 5.1.0
-- https://www.phpmyadmin.net/
--
-- Servidor: 127.0.0.1
-- Tiempo de generación: 01-06-2021 a las 13:18:46
-- Versión del servidor: 10.4.18-MariaDB
-- Versión de PHP: 8.0.5
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
/*!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: `centroestetica_php`
--
CREATE DATABASE IF NOT EXISTS `centroestetica_php` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_spanish2_ci;
USE `centroestetica_php`;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `citas`
--
CREATE TABLE `citas` (
`idCita` int(11) NOT NULL,
`nombreClienteCita` varchar(65) COLLATE utf8mb4_spanish2_ci NOT NULL,
`horaDiaCita` datetime NOT NULL,
`idTratamientoFK` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_spanish2_ci;
--
-- Volcado de datos para la tabla `citas`
--
INSERT INTO `citas` (`idCita`, `nombreClienteCita`, `horaDiaCita`, `idTratamientoFK`) VALUES
(1, 'Laura', '2021-05-20 12:30:00', 2),
(2, 'Jose', '2021-06-20 15:30:00', 1);
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `empleados`
--
CREATE TABLE `empleados` (
`idEmpleado` int(11) NOT NULL,
`nombreEmpleado` varchar(20) COLLATE utf8mb4_spanish2_ci NOT NULL,
`apellidoEmpleado` varchar(45) COLLATE utf8mb4_spanish2_ci NOT NULL,
`especialidadEmpleado` varchar(45) COLLATE utf8mb4_spanish2_ci NOT NULL,
`idEmpleadoJefeFK` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_spanish2_ci;
--
-- Volcado de datos para la tabla `empleados`
--
INSERT INTO `empleados` (`idEmpleado`, `nombreEmpleado`, `apellidoEmpleado`, `especialidadEmpleado`, `idEmpleadoJefeFK`) VALUES
(1, 'Fernando', 'Gutierrez', 'Exfoliación', 1),
(2, 'Lorena', 'López', 'Cabello', 2);
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `esteticistas`
--
CREATE TABLE `esteticistas` (
`idEsteticista` int(11) NOT NULL,
`salaTrabajoEsteticista` int(11) NOT NULL,
`idEmpleadoFK` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_spanish2_ci;
--
-- Volcado de datos para la tabla `esteticistas`
--
INSERT INTO `esteticistas` (`idEsteticista`, `salaTrabajoEsteticista`, `idEmpleadoFK`) VALUES
(1, 2, 1),
(2, 5, 2);
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `peluqueros`
--
CREATE TABLE `peluqueros` (
`idPeluquero` int(11) NOT NULL,
`generoClientesPeluquero` varchar(10) COLLATE utf8mb4_spanish2_ci NOT NULL,
`idEmpleadoFK` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_spanish2_ci;
--
-- Volcado de datos para la tabla `peluqueros`
--
INSERT INTO `peluqueros` (`idPeluquero`, `generoClientesPeluquero`, `idEmpleadoFK`) VALUES
(1, 'Hombre', 1),
(2, 'Mujer', 2);
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `productos`
--
CREATE TABLE `productos` (
`idProducto` int(11) NOT NULL,
`marcaProducto` varchar(45) COLLATE utf8mb4_spanish2_ci NOT NULL,
`idProveedorFK` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_spanish2_ci;
--
-- Volcado de datos para la tabla `productos`
--
INSERT INTO `productos` (`idProducto`, `marcaProducto`, `idProveedorFK`) VALUES
(1, 'Loreal', 2),
(2, 'Kativa', 1);
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `proveedores`
--
CREATE TABLE `proveedores` (
`idProveedor` int(11) NOT NULL,
`direccionProveedor` varchar(100) COLLATE utf8mb4_spanish2_ci NOT NULL,
`telefonoProveedor` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_spanish2_ci;
--
-- Volcado de datos para la tabla `proveedores`
--
INSERT INTO `proveedores` (`idProveedor`, `direccionProveedor`, `telefonoProveedor`) VALUES
(1, 'Calle Cereza Nº12', 665789532),
(2, 'Calle Manzana Nº23', 655683220);
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `tratamientos`
--
CREATE TABLE `tratamientos` (
`idTratamiento` int(11) NOT NULL,
`nombreTratamiento` varchar(45) COLLATE utf8mb4_spanish2_ci NOT NULL,
`zonaTratamiento` varchar(20) COLLATE utf8mb4_spanish2_ci NOT NULL,
`idEmpleadoFK` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_spanish2_ci;
--
-- Volcado de datos para la tabla `tratamientos`
--
INSERT INTO `tratamientos` (`idTratamiento`, `nombreTratamiento`, `zonaTratamiento`, `idEmpleadoFK`) VALUES
(1, 'Exfoliación mecánica', 'cuerpo', 1),
(2, 'Keratina', 'Cabello', 2);
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `usos`
--
CREATE TABLE `usos` (
`idUso` int(11) NOT NULL,
`idProductoFK` int(11) NOT NULL,
`idTratamientoFK` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_spanish2_ci;
--
-- Volcado de datos para la tabla `usos`
--
INSERT INTO `usos` (`idUso`, `idProductoFK`, `idTratamientoFK`) VALUES
(1, 1, 2),
(2, 2, 1);
--
-- Índices para tablas volcadas
--
--
-- Indices de la tabla `citas`
--
ALTER TABLE `citas`
ADD PRIMARY KEY (`idCita`),
ADD KEY `idTratamientoFK` (`idTratamientoFK`);
--
-- Indices de la tabla `empleados`
--
ALTER TABLE `empleados`
ADD PRIMARY KEY (`idEmpleado`),
ADD KEY `idEmpleadoJefeFK` (`idEmpleadoJefeFK`);
--
-- Indices de la tabla `esteticistas`
--
ALTER TABLE `esteticistas`
ADD PRIMARY KEY (`idEsteticista`),
ADD KEY `idEmpleadoFK` (`idEmpleadoFK`);
--
-- Indices de la tabla `peluqueros`
--
ALTER TABLE `peluqueros`
ADD PRIMARY KEY (`idPeluquero`),
ADD KEY `idEmpleadoFK` (`idEmpleadoFK`);
--
-- Indices de la tabla `productos`
--
ALTER TABLE `productos`
ADD PRIMARY KEY (`idProducto`),
ADD KEY `idProveedorFK` (`idProveedorFK`);
--
-- Indices de la tabla `proveedores`
--
ALTER TABLE `proveedores`
ADD PRIMARY KEY (`idProveedor`);
--
-- Indices de la tabla `tratamientos`
--
ALTER TABLE `tratamientos`
ADD PRIMARY KEY (`idTratamiento`),
ADD KEY `idEmpleadoFK` (`idEmpleadoFK`);
--
-- Indices de la tabla `usos`
--
ALTER TABLE `usos`
ADD PRIMARY KEY (`idUso`),
ADD KEY `idTratamientoFK` (`idTratamientoFK`),
ADD KEY `idProductoFK` (`idProductoFK`),
ADD KEY `idTratamientoFK_2` (`idTratamientoFK`);
--
-- AUTO_INCREMENT de las tablas volcadas
--
--
-- AUTO_INCREMENT de la tabla `citas`
--
ALTER TABLE `citas`
MODIFY `idCita` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT de la tabla `empleados`
--
ALTER TABLE `empleados`
MODIFY `idEmpleado` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=14;
--
-- AUTO_INCREMENT de la tabla `esteticistas`
--
ALTER TABLE `esteticistas`
MODIFY `idEsteticista` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT de la tabla `peluqueros`
--
ALTER TABLE `peluqueros`
MODIFY `idPeluquero` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT de la tabla `productos`
--
ALTER TABLE `productos`
MODIFY `idProducto` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT de la tabla `proveedores`
--
ALTER TABLE `proveedores`
MODIFY `idProveedor` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
--
-- AUTO_INCREMENT de la tabla `tratamientos`
--
ALTER TABLE `tratamientos`
MODIFY `idTratamiento` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT de la tabla `usos`
--
ALTER TABLE `usos`
MODIFY `idUso` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- Restricciones para tablas volcadas
--
--
-- Filtros para la tabla `citas`
--
ALTER TABLE `citas`
ADD CONSTRAINT `citas_ibfk_1` FOREIGN KEY (`idTratamientoFK`) REFERENCES `tratamientos` (`idTratamiento`);
--
-- Filtros para la tabla `empleados`
--
ALTER TABLE `empleados`
ADD CONSTRAINT `empleados_ibfk_1` FOREIGN KEY (`idEmpleadoJefeFK`) REFERENCES `empleados` (`idEmpleado`);
--
-- Filtros para la tabla `esteticistas`
--
ALTER TABLE `esteticistas`
ADD CONSTRAINT `esteticistas_ibfk_1` FOREIGN KEY (`idEmpleadoFK`) REFERENCES `empleados` (`idEmpleado`);
--
-- Filtros para la tabla `peluqueros`
--
ALTER TABLE `peluqueros`
ADD CONSTRAINT `peluqueros_ibfk_1` FOREIGN KEY (`idEmpleadoFK`) REFERENCES `empleados` (`idEmpleado`);
--
-- Filtros para la tabla `productos`
--
ALTER TABLE `productos`
ADD CONSTRAINT `productos_ibfk_1` FOREIGN KEY (`idProveedorFK`) REFERENCES `proveedores` (`idProveedor`);
--
-- Filtros para la tabla `tratamientos`
--
ALTER TABLE `tratamientos`
ADD CONSTRAINT `tratamientos_ibfk_1` FOREIGN KEY (`idEmpleadoFK`) REFERENCES `empleados` (`idEmpleado`);
--
-- Filtros para la tabla `usos`
--
ALTER TABLE `usos`
ADD CONSTRAINT `usos_ibfk_1` FOREIGN KEY (`idProductoFK`) REFERENCES `productos` (`idProducto`),
ADD CONSTRAINT `usos_ibfk_2` FOREIGN KEY (`idTratamientoFK`) REFERENCES `tratamientos` (`idTratamiento`);
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 */;
|
CREATE DATABASE IF NOT EXISTS `selecaoTransire` /*!40100 DEFAULT CHARACTER SET latin1 */;
USE `selecaoTransire`;
-- MySQL dump 10.13 Distrib 5.7.20, for Linux (x86_64)
--
-- Host: localhost Database: selecaoTransire
-- ------------------------------------------------------
-- Server version 5.7.20-0ubuntu0.16.04.1
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
--
-- Table structure for table `tb_categorias`
--
DROP TABLE IF EXISTS `tb_categorias`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `tb_categorias` (
`idcat` int(11) NOT NULL AUTO_INCREMENT,
`desccat` varchar(50) NOT NULL,
PRIMARY KEY (`idcat`),
UNIQUE KEY `idcat_UNIQUE` (`idcat`),
UNIQUE KEY `desccat_UNIQUE` (`desccat`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `tb_categorias`
--
LOCK TABLES `tb_categorias` WRITE;
/*!40000 ALTER TABLE `tb_categorias` DISABLE KEYS */;
INSERT INTO `tb_categorias` VALUES (1,'ELETRÔNICO'),(2,'LIVRO'),(3,'MÚSICA');
/*!40000 ALTER TABLE `tb_categorias` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `tb_origens`
--
DROP TABLE IF EXISTS `tb_origens`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `tb_origens` (
`idorig` int(11) NOT NULL AUTO_INCREMENT,
`descorig` varchar(50) NOT NULL,
PRIMARY KEY (`idorig`),
UNIQUE KEY `idorig_UNIQUE` (`idorig`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `tb_origens`
--
LOCK TABLES `tb_origens` WRITE;
/*!40000 ALTER TABLE `tb_origens` DISABLE KEYS */;
INSERT INTO `tb_origens` VALUES (1,'NACIONAL'),(2,'IMPORTADO');
/*!40000 ALTER TABLE `tb_origens` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `tb_produtos`
--
DROP TABLE IF EXISTS `tb_produtos`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `tb_produtos` (
`idprod` int(11) NOT NULL AUTO_INCREMENT,
`proddesc` text NOT NULL,
`proddtcompra` date DEFAULT NULL,
`prodpreco` double NOT NULL,
`prodimage` text,
`prodorigem` int(11) NOT NULL,
`prodcat` int(11) NOT NULL,
PRIMARY KEY (`idprod`),
UNIQUE KEY `idprod_UNIQUE` (`idprod`),
KEY `fk_prodcat_idcat_idx` (`prodcat`),
KEY `fk_prodorigem_idorig_idx` (`prodorigem`),
CONSTRAINT `fk_prodcat_idcat` FOREIGN KEY (`prodcat`) REFERENCES `tb_categorias` (`idcat`) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT `fk_prodorigem_idorig` FOREIGN KEY (`prodorigem`) REFERENCES `tb_origens` (`idorig`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `tb_produtos`
--
LOCK TABLES `tb_produtos` WRITE;
/*!40000 ALTER TABLE `tb_produtos` DISABLE KEYS */;
INSERT INTO `tb_produtos` VALUES (1,'NINTENDO 3DS XL',NULL,899.99,'',2,1),(2,'ROTEADOR LINKSYS',NULL,129.99,'',1,1),(3,'PROGRAMANDO COM KOTLIN',NULL,98.99,'',1,2),(4,'DRAGONFORCE - THROUGH THE FIRE AND THE FLAMES',NULL,3.9,'',2,3),(6,'Produto 11','2017-12-15',259,NULL,1,1);
/*!40000 ALTER TABLE `tb_produtos` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2017-12-26 22:04:27
|
/*
New set of statistics for the protein tree pipeline
Requires a write access to the database to create
temporary tables / keys
*/
CREATE TEMPORARY TABLE tmp_genome_content
SELECT taxon_id, member_id, node_id, root_id
FROM
(SELECT SUBSTRING_INDEX(TRIM(LEADING 'gdb:' FROM description), ' ', 1)+0 AS genome_db_id, subset_id FROM subset WHERE description LIKE "gdb:%translations") ua
NATURAL JOIN
subset_member
NATURAL JOIN
genome_db
LEFT JOIN
protein_tree_member USING (member_id)
;
ALTER TABLE tmp_genome_content ADD PRIMARY KEY (taxon_id, root_id, member_id);
ALTER TABLE tmp_genome_content ADD INDEX (root_id);
OPTIMIZE TABLE tmp_genome_content;
# nb genes / species
SELECT taxon_id, name, nb_genes, nb_pep, nb_canon_pep FROM
(SELECT taxon_id, name FROM genome_db) ta
NATURAL JOIN
(SELECT taxon_id, COUNT(*) AS nb_genes FROM member WHERE source_name="ENSEMBLGENE" GROUP BY taxon_id) tb
NATURAL JOIN
(SELECT taxon_id, COUNT(*) AS nb_pep FROM member WHERE source_name="ENSEMBLPEP" GROUP BY taxon_id) tc
NATURAL JOIN
(SELECT taxon_id, COUNT(*) AS nb_canon_pep FROM tmp_genome_content GROUP BY taxon_id) td
NATURAL JOIN ncbi_taxa_node ORDER BY left_index;
CREATE TEMPORARY TABLE tmp_roots
SELECT protein_tree_node.root_id, IF(rank = "species", 0, 1) AS is_ancestral FROM
protein_tree_node
NATURAL JOIN
(SELECT node_id, value+0 AS taxon_id FROM protein_tree_tag WHERE tag="taxon_id") ta
JOIN
ncbi_taxa_node
USING (taxon_id)
WHERE protein_tree_node.root_id=node_id;
ALTER TABLE tmp_roots ADD PRIMARY KEY (root_id);
OPTIMIZE TABLE tmp_roots;
# nb genes in trees
SELECT
taxon_id, name,
nb_m AS nb_pep, nb_ts AS nb_pep_spectree, nb_ta AS nb_pep_anctree, nb_m-nb_ts-nb_ta AS nb_pep_orphan,
ROUND(100*nb_ts/nb_m, 2) AS perc_pep_spectree, ROUND(100*nb_ta/nb_m, 2) AS perc_pep_anctree, ROUND(100*(nb_m-nb_ts-nb_ta)/nb_m, 2) AS perc_pep_orphan
FROM
(SELECT
taxon_id, COUNT(member_id) AS nb_m, COUNT(node_id) AS nb_n, COUNT(root_id) AS nb_r, COUNT(IF(is_ancestral,node_id,NULL)) AS nb_ta, COUNT(IF(is_ancestral,NULL,node_id)) AS nb_ts
FROM tmp_genome_content LEFT JOIN tmp_roots USING (root_id)
GROUP BY taxon_id
) ta JOIN genome_db USING (taxon_id) NATURAL JOIN ncbi_taxa_node ORDER BY left_index;
# per tree stats: root_id, taxon_name, nb_genes, nb_species
CREATE TEMPORARY TABLE tmp_stats_trees SELECT root_id, value AS taxon_name, COUNT(member_id) AS nb_genes, COUNT(DISTINCT taxon_id) AS nb_species FROM protein_tree_node JOIN protein_tree_tag USING (node_id) JOIN protein_tree_member USING (root_id) JOIN member USING (member_id) WHERE protein_tree_node.node_id=root_id AND tag LIKE "taxon_name" GROUP BY root_id;
SELECT
tmp_stats_trees.taxon_name, ptt3.value+0 AS taxon_id, count(*) AS nb_trees,
SUM(tmp_stats_trees.nb_genes) AS tot_nb_prot, ROUND(AVG(tmp_stats_trees.nb_genes), 2) AS avg_nb_prot, MIN(tmp_stats_trees.nb_genes) AS min_nb_prot, MAX(tmp_stats_trees.nb_genes) AS max_nb_prot,
SUM(tmp_stats_trees.nb_species) AS tot_nb_spec, ROUND(AVG(tmp_stats_trees.nb_species), 2) AS avg_nb_spec, MIN(tmp_stats_trees.nb_species) AS min_nb_spec, MAX(tmp_stats_trees.nb_species) AS max_nb_spec,
ROUND(AVG(tmp_stats_trees.nb_genes) / AVG(tmp_stats_trees.nb_species), 2) AS avg_nb_prot_per_spec
FROM
protein_tree_tag ptt3, ncbi_taxa_node, tmp_stats_trees
WHERE
ptt3.tag='taxon_id' AND ptt3.value = taxon_id AND tmp_stats_trees.root_id=ptt3.node_id
GROUP BY tmp_stats_trees.taxon_name
ORDER BY left_index
;
# average dupscore
CREATE TEMPORARY TABLE tmp_1a
SELECT node_id, value+0 AS taxon_id FROM protein_tree_tag WHERE tag="taxon_id";
ALTER TABLE tmp_1a ADD PRIMARY KEY (node_id);
OPTIMIZE TABLE tmp_1a;
CREATE TEMPORARY TABLE tmp_1c
SELECT node_id, value AS taxon_name FROM protein_tree_tag WHERE tag="taxon_name";
ALTER TABLE tmp_1c ADD PRIMARY KEY (node_id);
OPTIMIZE TABLE tmp_1c;
CREATE TEMPORARY TABLE tmp_1b
SELECT node_id, value+0 AS duplication_confidence_score FROM protein_tree_tag WHERE tag="duplication_confidence_score";
ALTER TABLE tmp_1b ADD PRIMARY KEY (node_id);
OPTIMIZE TABLE tmp_1b;
SELECT taxon_id, taxon_name, COUNT(*) AS nb_nodes, COUNT(*)-COUNT(duplication_confidence_score) AS nb_spec_nodes, COUNT(duplication_confidence_score) AS nb_dup_nodes, COUNT(IF(duplication_confidence_score=0, 1, NULL)) AS nb_dubious_nodes, ROUND(AVG(duplication_confidence_score), 2) AS avg_dupscore, ROUND(AVG(IF(duplication_confidence_score=0, NULL, duplication_confidence_score)), 2) AS avg_dupscore_nondub
FROM tmp_1a LEFT JOIN tmp_1b USING (node_id) NATURAL JOIN tmp_1c NATURAL JOIN ncbi_taxa_node GROUP BY taxon_id ORDER BY left_index;
|
-- Return the version of the search addon if it exists, null otherwise
CREATE TEMP FUNCTION get_search_addon_version(active_addons ANY type) AS (
(
SELECT
mozfun.stats.mode_last(ARRAY_AGG(version))
FROM
UNNEST(active_addons)
WHERE
addon_id = 'followonsearch@mozilla.com'
GROUP BY
version
)
);
-- Bug 1693141: Remove engine suffixes for continuity
CREATE TEMP FUNCTION normalize_engine(engine STRING) AS (
CASE
WHEN
ENDS_WITH(engine, ':organic')
OR ENDS_WITH(engine, ':sap')
OR ENDS_WITH(engine, ':sap-follow-on')
THEN
SPLIT(engine, ':')[OFFSET(0)]
ELSE
engine
END
);
-- Bug 1693141: add organic suffix to source or type if the engine suffix is "organic"
CREATE TEMP FUNCTION organicize_source_or_type(engine STRING, original STRING) AS (
CASE
WHEN
ENDS_WITH(engine, ':organic')
THEN
CASE
WHEN
-- For some reason, the ad click source is "ad-click:" but type is "ad-click"
ENDS_WITH(original, ':')
THEN
CONCAT(original, 'organic')
ELSE
CONCAT(original, ':organic')
END
ELSE
original
END
);
WITH augmented AS (
SELECT
*,
ARRAY_CONCAT(
ARRAY(
SELECT AS STRUCT
element.source AS source,
element.engine AS engine,
element.count AS count,
CASE
WHEN
(
element.source IN (
'searchbar',
'urlbar',
'abouthome',
'newtab',
'contextmenu',
'system',
'activitystream',
'webextension',
'alias',
'urlbar-searchmode'
)
OR element.source IS NULL
)
THEN
'sap'
WHEN
(STARTS_WITH(element.source, 'in-content:sap:') OR STARTS_WITH(element.source, 'sap:'))
THEN
'tagged-sap'
WHEN
(
STARTS_WITH(element.source, 'in-content:sap-follow-on:')
OR STARTS_WITH(element.source, 'follow-on:')
)
THEN
'tagged-follow-on'
WHEN
STARTS_WITH(element.source, 'in-content:organic:')
THEN
'organic'
WHEN
STARTS_WITH(element.source, 'ad-click:')
THEN
'ad-click'
WHEN
STARTS_WITH(element.source, 'search-with-ads:')
THEN
'search-with-ads'
ELSE
'unknown'
END
AS type
FROM
UNNEST(search_counts) AS element
),
ARRAY(
SELECT AS STRUCT
organicize_source_or_type(key, "ad-click:") AS source,
normalize_engine(key) AS engine,
value AS count,
organicize_source_or_type(key, "ad-click") AS type
FROM
UNNEST(ad_clicks)
),
ARRAY(
SELECT AS STRUCT
organicize_source_or_type(key, "search-with-ads:") AS source,
normalize_engine(key) AS engine,
value AS count,
organicize_source_or_type(key, "search-with-ads") AS type
FROM
UNNEST(search_with_ads)
)
) AS _searches,
FROM
telemetry.clients_daily
),
flattened AS (
SELECT
*
FROM
augmented
CROSS JOIN
UNNEST(
IF
-- Provide replacement empty _searches with one null search, to ensure all
-- clients are included in results
(
ARRAY_LENGTH(_searches) > 0,
_searches,
[(CAST(NULL AS STRING), CAST(NULL AS STRING), NULL, CAST(NULL AS STRING))]
)
)
),
-- Get count based on search type
counted AS (
SELECT
-- use row number to dedupe over window
ROW_NUMBER() OVER w1 AS _n,
submission_date,
client_id,
engine,
source,
country,
get_search_addon_version(active_addons) AS addon_version,
app_version,
distribution_id,
locale,
user_pref_browser_search_region,
search_cohort,
os,
os_version,
channel,
is_default_browser,
UNIX_DATE(DATE(profile_creation_date)) AS profile_creation_date,
default_search_engine,
default_search_engine_data_load_path,
default_search_engine_data_submission_url,
default_private_search_engine,
default_private_search_engine_data_load_path,
default_private_search_engine_data_submission_url,
sample_id,
SAFE_CAST(subsession_hours_sum AS FLOAT64) AS subsession_hours_sum,
sessions_started_on_this_day,
active_addons_count_mean,
scalar_parent_browser_engagement_max_concurrent_tab_count_max AS max_concurrent_tab_count_max,
scalar_parent_browser_engagement_tab_open_event_count_sum AS tab_open_event_count_sum,
active_hours_sum,
scalar_parent_browser_engagement_total_uri_count_sum AS total_uri_count,
experiments,
scalar_parent_urlbar_searchmode_bookmarkmenu_sum,
scalar_parent_urlbar_searchmode_handoff_sum,
scalar_parent_urlbar_searchmode_keywordoffer_sum,
scalar_parent_urlbar_searchmode_oneoff_sum,
scalar_parent_urlbar_searchmode_other_sum,
scalar_parent_urlbar_searchmode_shortcut_sum,
scalar_parent_urlbar_searchmode_tabmenu_sum,
scalar_parent_urlbar_searchmode_tabtosearch_sum,
scalar_parent_urlbar_searchmode_tabtosearch_onboard_sum,
scalar_parent_urlbar_searchmode_topsites_newtab_sum,
scalar_parent_urlbar_searchmode_topsites_urlbar_sum,
scalar_parent_urlbar_searchmode_touchbar_sum,
scalar_parent_urlbar_searchmode_typed_sum,
profile_age_in_days,
SUM(IF(type = 'organic', count, 0)) OVER w1 AS organic,
SUM(IF(type = 'tagged-sap', count, 0)) OVER w1 AS tagged_sap,
SUM(IF(type = 'tagged-follow-on', count, 0)) OVER w1 AS tagged_follow_on,
SUM(IF(type = 'sap', count, 0)) OVER w1 AS sap,
SUM(IF(type = 'ad-click', count, 0)) OVER w1 AS ad_click,
SUM(IF(type = 'ad-click:organic', count, 0)) OVER w1 AS ad_click_organic,
SUM(IF(type = 'search-with-ads', count, 0)) OVER w1 AS search_with_ads,
SUM(IF(type = 'search-with-ads:organic', count, 0)) OVER w1 AS search_with_ads_organic,
SUM(IF(type = 'unknown', count, 0)) OVER w1 AS unknown,
FROM
flattened
WHERE
submission_date = @submission_date
AND client_id IS NOT NULL
AND (count < 10000 OR count IS NULL)
WINDOW
w1 AS (
PARTITION BY
client_id,
submission_date,
engine,
source,
type
)
)
SELECT
* EXCEPT (_n)
FROM
counted
WHERE
_n = 1
|
/*
Navicat MySQL Data Transfer
Source Server : laraoct
Source Server Version : 50553
Source Host : localhost:3306
Source Database : lar-admin
Target Server Type : MYSQL
Target Server Version : 50553
File Encoding : 65001
Date: 2018-11-20 22:55:25
*/
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for admin_config
-- ----------------------------
DROP TABLE IF EXISTS `admin_config`;
CREATE TABLE `admin_config` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`value` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`description` text COLLATE utf8mb4_unicode_ci,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `admin_config_name_unique` (`name`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- ----------------------------
-- Records of admin_config
-- ----------------------------
-- ----------------------------
-- Table structure for admin_menu
-- ----------------------------
DROP TABLE IF EXISTS `admin_menu`;
CREATE TABLE `admin_menu` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`parent_id` int(11) NOT NULL DEFAULT '0',
`order` int(11) NOT NULL DEFAULT '0',
`title` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
`icon` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
`uri` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`permission` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=15 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- ----------------------------
-- Records of admin_menu
-- ----------------------------
INSERT INTO `admin_menu` VALUES ('1', '0', '1', 'Index', 'fa-bar-chart', '/', null, null, null);
INSERT INTO `admin_menu` VALUES ('2', '0', '2', 'Admin', 'fa-tasks', '', null, null, null);
INSERT INTO `admin_menu` VALUES ('3', '2', '3', 'Users', 'fa-users', 'auth/users', null, null, null);
INSERT INTO `admin_menu` VALUES ('4', '2', '4', 'Roles', 'fa-user', 'auth/roles', null, null, null);
INSERT INTO `admin_menu` VALUES ('5', '2', '5', 'Permission', 'fa-ban', 'auth/permissions', null, null, null);
INSERT INTO `admin_menu` VALUES ('6', '2', '6', 'Menu', 'fa-bars', 'auth/menu', null, null, null);
INSERT INTO `admin_menu` VALUES ('7', '2', '7', 'Operation log', 'fa-history', 'auth/logs', null, null, null);
INSERT INTO `admin_menu` VALUES ('8', '0', '8', 'EnvManager', 'fa-gears', 'env-manager', null, '2018-11-20 14:05:44', '2018-11-20 14:05:44');
INSERT INTO `admin_menu` VALUES ('9', '0', '9', 'Exception Reporter', 'fa-bug', 'exceptions', null, '2018-11-20 14:08:40', '2018-11-20 14:08:40');
INSERT INTO `admin_menu` VALUES ('10', '0', '9', 'Helpers', 'fa-gears', '', null, '2018-11-20 14:16:51', '2018-11-20 14:16:51');
INSERT INTO `admin_menu` VALUES ('11', '10', '10', 'Scaffold', 'fa-keyboard-o', 'helpers/scaffold', null, '2018-11-20 14:16:51', '2018-11-20 14:16:51');
INSERT INTO `admin_menu` VALUES ('12', '10', '11', 'Database terminal', 'fa-database', 'helpers/terminal/database', null, '2018-11-20 14:16:51', '2018-11-20 14:16:51');
INSERT INTO `admin_menu` VALUES ('13', '10', '12', 'Laravel artisan', 'fa-terminal', 'helpers/terminal/artisan', null, '2018-11-20 14:16:51', '2018-11-20 14:16:51');
INSERT INTO `admin_menu` VALUES ('14', '10', '13', 'Routes', 'fa-list-alt', 'helpers/routes', null, '2018-11-20 14:16:51', '2018-11-20 14:16:51');
-- ----------------------------
-- Table structure for admin_operation_log
-- ----------------------------
DROP TABLE IF EXISTS `admin_operation_log`;
CREATE TABLE `admin_operation_log` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`user_id` int(11) NOT NULL,
`path` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`method` varchar(10) COLLATE utf8mb4_unicode_ci NOT NULL,
`ip` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`input` text COLLATE utf8mb4_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `admin_operation_log_user_id_index` (`user_id`)
) ENGINE=MyISAM AUTO_INCREMENT=25 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- ----------------------------
-- Records of admin_operation_log
-- ----------------------------
INSERT INTO `admin_operation_log` VALUES ('1', '1', 'admin', 'GET', '::1', '[]', '2018-11-20 14:31:04', '2018-11-20 14:31:04');
INSERT INTO `admin_operation_log` VALUES ('2', '1', 'admin', 'GET', '::1', '{\"_pjax\":\"#pjax-container\"}', '2018-11-20 14:31:17', '2018-11-20 14:31:17');
INSERT INTO `admin_operation_log` VALUES ('3', '1', 'admin/auth/users', 'GET', '::1', '{\"_pjax\":\"#pjax-container\"}', '2018-11-20 14:31:20', '2018-11-20 14:31:20');
INSERT INTO `admin_operation_log` VALUES ('4', '1', 'admin/auth/roles', 'GET', '::1', '{\"_pjax\":\"#pjax-container\"}', '2018-11-20 14:31:27', '2018-11-20 14:31:27');
INSERT INTO `admin_operation_log` VALUES ('5', '1', 'admin', 'GET', '::1', '{\"_pjax\":\"#pjax-container\"}', '2018-11-20 14:31:39', '2018-11-20 14:31:39');
INSERT INTO `admin_operation_log` VALUES ('6', '1', 'admin', 'GET', '::1', '{\"_pjax\":\"#pjax-container\"}', '2018-11-20 14:31:53', '2018-11-20 14:31:53');
INSERT INTO `admin_operation_log` VALUES ('7', '1', 'admin', 'GET', '::1', '[]', '2018-11-20 14:32:44', '2018-11-20 14:32:44');
INSERT INTO `admin_operation_log` VALUES ('8', '1', 'admin', 'GET', '::1', '{\"_pjax\":\"#pjax-container\"}', '2018-11-20 14:33:23', '2018-11-20 14:33:23');
INSERT INTO `admin_operation_log` VALUES ('9', '1', 'admin', 'GET', '::1', '{\"_pjax\":\"#pjax-container\"}', '2018-11-20 14:33:26', '2018-11-20 14:33:26');
INSERT INTO `admin_operation_log` VALUES ('10', '1', 'admin/auth/menu', 'GET', '::1', '{\"_pjax\":\"#pjax-container\"}', '2018-11-20 14:33:32', '2018-11-20 14:33:32');
INSERT INTO `admin_operation_log` VALUES ('11', '1', 'admin/auth/menu', 'GET', '::1', '[]', '2018-11-20 14:37:03', '2018-11-20 14:37:03');
INSERT INTO `admin_operation_log` VALUES ('12', '1', 'admin/auth/menu', 'GET', '::1', '[]', '2018-11-20 14:37:05', '2018-11-20 14:37:05');
INSERT INTO `admin_operation_log` VALUES ('13', '1', 'admin/helpers/terminal/artisan', 'GET', '::1', '{\"_pjax\":\"#pjax-container\"}', '2018-11-20 14:37:21', '2018-11-20 14:37:21');
INSERT INTO `admin_operation_log` VALUES ('14', '1', 'admin/helpers/terminal/artisan', 'GET', '::1', '[]', '2018-11-20 14:37:23', '2018-11-20 14:37:23');
INSERT INTO `admin_operation_log` VALUES ('15', '1', 'admin/helpers/terminal/database', 'GET', '::1', '{\"_pjax\":\"#pjax-container\"}', '2018-11-20 14:37:31', '2018-11-20 14:37:31');
INSERT INTO `admin_operation_log` VALUES ('16', '1', 'admin/auth/menu', 'GET', '::1', '{\"_pjax\":\"#pjax-container\"}', '2018-11-20 14:37:55', '2018-11-20 14:37:55');
INSERT INTO `admin_operation_log` VALUES ('17', '1', 'admin/helpers/scaffold', 'GET', '::1', '{\"_pjax\":\"#pjax-container\"}', '2018-11-20 14:38:00', '2018-11-20 14:38:00');
INSERT INTO `admin_operation_log` VALUES ('18', '1', 'admin/auth/menu', 'GET', '::1', '{\"_pjax\":\"#pjax-container\"}', '2018-11-20 14:38:05', '2018-11-20 14:38:05');
INSERT INTO `admin_operation_log` VALUES ('19', '1', 'admin/exceptions', 'GET', '::1', '{\"_pjax\":\"#pjax-container\"}', '2018-11-20 14:38:13', '2018-11-20 14:38:13');
INSERT INTO `admin_operation_log` VALUES ('20', '1', 'admin', 'GET', '::1', '{\"_pjax\":\"#pjax-container\"}', '2018-11-20 14:38:17', '2018-11-20 14:38:17');
INSERT INTO `admin_operation_log` VALUES ('21', '1', 'admin/env-manager', 'GET', '::1', '{\"_pjax\":\"#pjax-container\"}', '2018-11-20 14:39:45', '2018-11-20 14:39:45');
INSERT INTO `admin_operation_log` VALUES ('22', '1', 'admin/env-manager', 'GET', '::1', '[]', '2018-11-20 14:45:10', '2018-11-20 14:45:10');
INSERT INTO `admin_operation_log` VALUES ('23', '1', 'admin', 'GET', '::1', '{\"_pjax\":\"#pjax-container\"}', '2018-11-20 14:45:42', '2018-11-20 14:45:42');
INSERT INTO `admin_operation_log` VALUES ('24', '1', 'admin', 'GET', '::1', '[]', '2018-11-20 14:49:08', '2018-11-20 14:49:08');
-- ----------------------------
-- Table structure for admin_permissions
-- ----------------------------
DROP TABLE IF EXISTS `admin_permissions`;
CREATE TABLE `admin_permissions` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
`slug` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
`http_method` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`http_path` text COLLATE utf8mb4_unicode_ci,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `admin_permissions_name_unique` (`name`)
) ENGINE=MyISAM AUTO_INCREMENT=8 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- ----------------------------
-- Records of admin_permissions
-- ----------------------------
INSERT INTO `admin_permissions` VALUES ('1', 'All permission', '*', '', '*', null, null);
INSERT INTO `admin_permissions` VALUES ('2', 'Dashboard', 'dashboard', 'GET', '/', null, null);
INSERT INTO `admin_permissions` VALUES ('3', 'Login', 'auth.login', '', '/auth/login\r\n/auth/logout', null, null);
INSERT INTO `admin_permissions` VALUES ('4', 'User setting', 'auth.setting', 'GET,PUT', '/auth/setting', null, null);
INSERT INTO `admin_permissions` VALUES ('5', 'Auth management', 'auth.management', '', '/auth/roles\r\n/auth/permissions\r\n/auth/menu\r\n/auth/logs', null, null);
INSERT INTO `admin_permissions` VALUES ('6', 'Exceptions reporter', 'ext.reporter', null, '/exceptions*', '2018-11-20 14:08:40', '2018-11-20 14:08:40');
INSERT INTO `admin_permissions` VALUES ('7', 'Admin helpers', 'ext.helpers', null, '/helpers/*', '2018-11-20 14:16:51', '2018-11-20 14:16:51');
-- ----------------------------
-- Table structure for admin_role_menu
-- ----------------------------
DROP TABLE IF EXISTS `admin_role_menu`;
CREATE TABLE `admin_role_menu` (
`role_id` int(11) NOT NULL,
`menu_id` int(11) NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
KEY `admin_role_menu_role_id_menu_id_index` (`role_id`,`menu_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- ----------------------------
-- Records of admin_role_menu
-- ----------------------------
INSERT INTO `admin_role_menu` VALUES ('1', '2', null, null);
-- ----------------------------
-- Table structure for admin_role_permissions
-- ----------------------------
DROP TABLE IF EXISTS `admin_role_permissions`;
CREATE TABLE `admin_role_permissions` (
`role_id` int(11) NOT NULL,
`permission_id` int(11) NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
KEY `admin_role_permissions_role_id_permission_id_index` (`role_id`,`permission_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- ----------------------------
-- Records of admin_role_permissions
-- ----------------------------
INSERT INTO `admin_role_permissions` VALUES ('1', '1', null, null);
-- ----------------------------
-- Table structure for admin_role_users
-- ----------------------------
DROP TABLE IF EXISTS `admin_role_users`;
CREATE TABLE `admin_role_users` (
`role_id` int(11) NOT NULL,
`user_id` int(11) NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
KEY `admin_role_users_role_id_user_id_index` (`role_id`,`user_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- ----------------------------
-- Records of admin_role_users
-- ----------------------------
INSERT INTO `admin_role_users` VALUES ('1', '1', null, null);
-- ----------------------------
-- Table structure for admin_roles
-- ----------------------------
DROP TABLE IF EXISTS `admin_roles`;
CREATE TABLE `admin_roles` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
`slug` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `admin_roles_name_unique` (`name`)
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- ----------------------------
-- Records of admin_roles
-- ----------------------------
INSERT INTO `admin_roles` VALUES ('1', 'Administrator', 'administrator', '2018-11-20 13:57:19', '2018-11-20 13:57:19');
-- ----------------------------
-- Table structure for admin_user_permissions
-- ----------------------------
DROP TABLE IF EXISTS `admin_user_permissions`;
CREATE TABLE `admin_user_permissions` (
`user_id` int(11) NOT NULL,
`permission_id` int(11) NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
KEY `admin_user_permissions_user_id_permission_id_index` (`user_id`,`permission_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- ----------------------------
-- Records of admin_user_permissions
-- ----------------------------
-- ----------------------------
-- Table structure for admin_users
-- ----------------------------
DROP TABLE IF EXISTS `admin_users`;
CREATE TABLE `admin_users` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`username` varchar(190) COLLATE utf8mb4_unicode_ci NOT NULL,
`password` varchar(60) COLLATE utf8mb4_unicode_ci NOT NULL,
`name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`avatar` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`remember_token` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `admin_users_username_unique` (`username`)
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- ----------------------------
-- Records of admin_users
-- ----------------------------
INSERT INTO `admin_users` VALUES ('1', 'admin', '$2y$10$/hX/8TalaCqaLJqeyimS2uX25vBDduyeXBrg/Nj1.EbdwLWMgU8LW', 'Administrator', null, null, '2018-11-20 13:57:19', '2018-11-20 13:57:19');
-- ----------------------------
-- Table structure for laravel_exceptions
-- ----------------------------
DROP TABLE IF EXISTS `laravel_exceptions`;
CREATE TABLE `laravel_exceptions` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`type` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`code` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`message` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`file` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`line` int(11) NOT NULL,
`trace` text COLLATE utf8mb4_unicode_ci NOT NULL,
`method` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`path` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`query` text COLLATE utf8mb4_unicode_ci NOT NULL,
`body` text COLLATE utf8mb4_unicode_ci NOT NULL,
`cookies` text COLLATE utf8mb4_unicode_ci NOT NULL,
`headers` text COLLATE utf8mb4_unicode_ci NOT NULL,
`ip` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- ----------------------------
-- Records of laravel_exceptions
-- ----------------------------
-- ----------------------------
-- Table structure for migrations
-- ----------------------------
DROP TABLE IF EXISTS `migrations`;
CREATE TABLE `migrations` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`migration` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`batch` int(11) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- ----------------------------
-- 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');
INSERT INTO `migrations` VALUES ('3', '2016_01_04_173148_create_admin_tables', '1');
INSERT INTO `migrations` VALUES ('4', '2017_07_17_040159_create_config_table', '2');
INSERT INTO `migrations` VALUES ('5', '2017_07_17_040159_create_exceptions_table', '3');
-- ----------------------------
-- Table structure for password_resets
-- ----------------------------
DROP TABLE IF EXISTS `password_resets`;
CREATE TABLE `password_resets` (
`email` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`token` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
KEY `password_resets_email_index` (`email`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- ----------------------------
-- Records of password_resets
-- ----------------------------
-- ----------------------------
-- Table structure for users
-- ----------------------------
DROP TABLE IF EXISTS `users`;
CREATE TABLE `users` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`email` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`password` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`remember_token` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `users_email_unique` (`email`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- ----------------------------
-- Records of users
-- ----------------------------
|
# correlation between departure delays and arrival delays
SELECT CORR(CAST(DEP_DELAY) AS DOUBLE),
CAST(ARR_DELAY AS DOUBLE)
FROM airline;
|
--
-- data for table users
--
INSERT INTO library.users(user_id, first_name, last_name, category, birth_date) VALUES (1, 'Will', 'Smith', 'STAFF','1970-02-07'),
(2, 'Brad', 'Pitt', 'MANAGER','1980-07-07'),
(3, 'Angelina', 'Jolie', 'CUSTOMER','1990-04-09');
INSERT INTO library.users VALUES (4,'Peter','Jameson', '2013-03-01', 'Ard Blathna', 'Ard', 'Athlone','Westmeath','H45B435',0086538523,087653422,NULL,'Standard', 'STAFF', 'AIT', 0.0, now(),null),
(5,'Mary','Walsh', '2005-03-01','Sany view', 'Sany', 'Ballinasloe','Galway','U43563',0038859322,093847532,'marywalsh@gmail.com','Discounted', 'STAFF',null, 0.0,'2020-03-01 20:07:23',NULL);
--
-- data for table authentication
--
INSERT INTO library.authentication(username, password, user_id) VALUES('staff', '12345', 1);
INSERT INTO library.authentication(username, password, user_id) VALUES('manager', '12345', 2);
INSERT INTO library.authentication(username, password, user_id) VALUES('customer', '12345', 3);
--
-- data for table transactions
--
INSERT INTO transactions VALUES (1,'2020-03-08 19:13:01','Membership','DEBIT',50,2,0,50),(2,'2020-03-08 19:13:46','Class Registration','DEBIT',30,2,50,80);
--
-- data for table membership
--
INSERT INTO library.membership(userId, startDate, endDate ) VALUES (3, '2021-03-10', '2021-03-10'),
(4, '2021-03-09', '2021-03-09');
--
-- data for table classes
--
INSERT INTO library.classes(class_Id,class_title,class_category,class_slot,class_fee,class_start,class_duration, picture ) VALUES (1, 'Story time for kids','Children',40,5,'2021-02-10',60, "story1.jpeg"),
(2, 'English literature for beginners ','Adults',30,10,'2021-02-10',60, "englishBeginners.jpeg"),
(3, 'Creative writing for beginners', 'Adults', 30, 15, '2020-05-18', 60, "creativeWrit.jpeg"),
(4, 'Computers for beginners', 'Children', 30, 20, '2020-07-11', 60, "computers.jpeg"),
(5, 'Technology for the over 60s', 'Adults', 20, 5, '2020-09-08', 60, "tech.jpeg"),
(6, 'The Art of Drawing for kids', 'Children', 40, 10, '2020-06-12', 60, "drawing.jpeg"),
(7, 'Photography for passionates', 'Adults', 30, 15, '2021-07-13', 60, "photography1.jpeg"),
(8, 'Music time for adults', 'Adults', 40, 20, '2021-03-22', 60, "musicAdults2.jpeg"),
(9, 'Animation and Design', 'Adults', 30, 25, '2020-02-17', 60, "animation.jpeg"),
(10, 'Public speaking', 'Adults', 40, 30, '2020-11-02', 60, "speaking1.jpeg"),
(11, 'French for kids', 'Children', 30, 15,'2020-10-06', 60, "frenchKids.jpeg"),
(12, 'German for adults', 'Adults', 30,20, '2020-04-05', 60, "germanAdults.jpeg"),
(13, 'Italian for kids', 'Children', 30, 20, '2021-01-09', 60, "italianKids.jpeg");
--
-- data for table registration
--
INSERT INTO library.registration(classId,memberId,regDate,feeDue,balanceDue,attendance ) VALUES (1, 3, '2021-03-10',5,45,1),
(2, 3, '2021-03-10',10,35,1);
--
-- data for table timetable
--
INSERT INTO timetable VALUES(1, 'MON', '10am-12pm', 1);
INSERT INTO timetable VALUES(2, 'WED', '10am-12pm', 1);
INSERT INTO timetable VALUES(3, 'FRI', '10am-12pm', 1);
INSERT INTO timetable VALUES(4, 'TUE', '10am-12pm', 2);
INSERT INTO timetable VALUES(5, 'THU', '10am-12pm', 2);
INSERT INTO timetable VALUES(6, 'MON', '12pm-2pm', 3);
INSERT INTO timetable VALUES(7, 'WED', '12pm-2pm', 3);
INSERT INTO timetable VALUES(8, 'FRI', '12pm-2pm', 3);
INSERT INTO timetable VALUES(9, 'TUE', '12pm-2pm', 4);
INSERT INTO timetable VALUES(10,'THU', '12pm-2pm', 4);
INSERT INTO timetable VALUES(11,'MON', '11am-1pm', 5);
INSERT INTO timetable VALUES(12,'WED', '11am-1pm', 5);
INSERT INTO timetable VALUES(13,'FRI', '11am-1pm', 5);
INSERT INTO timetable VALUES(14,'TUE', '11am-1pm', 6);
INSERT INTO timetable VALUES(15,'THU', '11am-1pm', 6);
INSERT INTO timetable VALUES(16,'TUE', '11am-1pm', 7);
INSERT INTO timetable VALUES(17,'THU', '11am-1pm', 7);
INSERT INTO timetable VALUES(18,'MON', '1pm-3pm', 8);
INSERT INTO timetable VALUES(19,'WED', '1pm-3pm', 8);
INSERT INTO timetable VALUES(20,'FRI', '1pm-3pm', 8);
INSERT INTO timetable VALUES(21,'MON', '11am-1pm', 9);
INSERT INTO timetable VALUES(22,'WED', '11am-1pm', 9);
INSERT INTO timetable VALUES(23,'FRI', '11am-1pm', 9);
INSERT INTO timetable VALUES(24,'MON', '9am-11am', 10);
INSERT INTO timetable VALUES(25,'WED', '9am-11am', 10);
INSERT INTO timetable VALUES(26,'FRI', '9am-11am', 10);
INSERT INTO timetable VALUES(27,'TUE', '12pm-2pm', 11);
INSERT INTO timetable VALUES(28,'THU', '12pm-2pm', 11);
INSERT INTO timetable VALUES(29,'MON', '10am-12pm', 12);
INSERT INTO timetable VALUES(30,'WED', '10am-12pm', 12);
INSERT INTO timetable VALUES(31,'FRI', '10am-12pm', 12);
INSERT INTO timetable VALUES(32,'TUE', '12pm-2pm', 13);
INSERT INTO timetable VALUES(33,'THU', '12pm-2pm', 13);
select * from classes;
|
# ************************************************************
# Sequel Pro SQL dump
# Version 4541
#
# http://www.sequelpro.com/
# https://github.com/sequelpro/sequelpro
#
# Host: 127.0.0.1 (MySQL 5.7.10)
# Database: tedapp
# Generation Time: 2018-09-30 01:48:59 +0000
# ************************************************************
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
# Dump of table flyway_schema_history
# ------------------------------------------------------------
DROP TABLE IF EXISTS `flyway_schema_history`;
CREATE TABLE `flyway_schema_history` (
`installed_rank` int(11) NOT NULL,
`version` varchar(50) DEFAULT NULL,
`description` varchar(200) NOT NULL,
`type` varchar(20) NOT NULL,
`script` varchar(1000) NOT NULL,
`checksum` int(11) DEFAULT NULL,
`installed_by` varchar(100) NOT NULL,
`installed_on` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`execution_time` int(11) NOT NULL,
`success` tinyint(1) NOT NULL,
PRIMARY KEY (`installed_rank`),
KEY `flyway_schema_history_s_idx` (`success`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
LOCK TABLES `flyway_schema_history` WRITE;
/*!40000 ALTER TABLE `flyway_schema_history` DISABLE KEYS */;
INSERT INTO `flyway_schema_history` (`installed_rank`, `version`, `description`, `type`, `script`, `checksum`, `installed_by`, `installed_on`, `execution_time`, `success`)
VALUES
(1,'1','db init','SQL','V1__db_init.sql',-444840199,'root','2018-09-30 04:51:35',136,1);
/*!40000 ALTER TABLE `flyway_schema_history` ENABLE KEYS */;
UNLOCK TABLES;
# Dump of table rating_tag
# ------------------------------------------------------------
DROP TABLE IF EXISTS `rating_tag`;
CREATE TABLE `rating_tag` (
`id` bigint(20) NOT NULL,
`name` varchar(500) NOT NULL,
`createdat` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updatedat` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`deletedat` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
LOCK TABLES `rating_tag` WRITE;
/*!40000 ALTER TABLE `rating_tag` DISABLE KEYS */;
INSERT INTO `rating_tag` (`id`, `name`, `createdat`, `updatedat`, `deletedat`)
VALUES
(1,'Beautiful','2018-09-30 04:52:26','2018-09-30 04:52:26',NULL),
(2,'Confusing','2018-09-30 04:52:26','2018-09-30 04:52:26',NULL),
(3,'Courageous','2018-09-30 04:52:26','2018-09-30 04:52:26',NULL),
(7,'Funny','2018-09-30 04:52:26','2018-09-30 04:52:26',NULL),
(9,'Ingenious','2018-09-30 04:52:26','2018-09-30 04:52:26',NULL),
(11,'Longwinded','2018-09-30 04:52:26','2018-09-30 04:52:26',NULL);
/*!40000 ALTER TABLE `rating_tag` ENABLE KEYS */;
UNLOCK TABLES;
# Dump of table related_talk
# ------------------------------------------------------------
DROP TABLE IF EXISTS `related_talk`;
CREATE TABLE `related_talk` (
`id` bigint(20) NOT NULL,
`hero` varchar(500) DEFAULT NULL,
`speaker` varchar(500) DEFAULT NULL,
`title` varchar(700) NOT NULL,
`duration` bigint(20) DEFAULT '0',
`slug` varchar(500) DEFAULT NULL,
`viewed_count` bigint(20) DEFAULT '0',
`createdat` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updatedat` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`deletedat` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
LOCK TABLES `related_talk` WRITE;
/*!40000 ALTER TABLE `related_talk` DISABLE KEYS */;
INSERT INTO `related_talk` (`id`, `hero`, `speaker`, `title`, `duration`, `slug`, `viewed_count`, `createdat`, `updatedat`, `deletedat`)
VALUES
(865,'https://pe.tedcdn.com/images/ted/172559_800x600.jpg','Ken Robinson','Bring on the learning revolution!',1008,'sir_ken_robinson_bring_on_the_revolution',7266103,'2018-09-30 04:52:45','2018-09-30 04:52:45',NULL),
(1738,'https://pe.tedcdn.com/images/ted/de98b161ad1434910ff4b56c89de71af04b8b873_1600x1200.jpg','Ken Robinson','How to escape education\'s death valley',1151,'ken_robinson_how_to_escape_education_s_death_valley',6657572,'2018-09-30 04:52:45','2018-09-30 04:52:45',NULL);
/*!40000 ALTER TABLE `related_talk` ENABLE KEYS */;
UNLOCK TABLES;
# Dump of table tag
# ------------------------------------------------------------
DROP TABLE IF EXISTS `tag`;
CREATE TABLE `tag` (
`id` bigint(20) NOT NULL,
`name` varchar(500) NOT NULL,
`createdat` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updatedat` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`deletedat` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
LOCK TABLES `tag` WRITE;
/*!40000 ALTER TABLE `tag` DISABLE KEYS */;
INSERT INTO `tag` (`id`, `name`, `createdat`, `updatedat`, `deletedat`)
VALUES
(1,'children','2018-09-30 04:52:45','2018-09-30 04:52:45',NULL),
(2,'creativity','2018-09-30 04:52:45','2018-09-30 04:52:45',NULL),
(3,'culture','2018-09-30 04:52:45','2018-09-30 04:52:45',NULL),
(4,'dance','2018-09-30 04:52:45','2018-09-30 04:52:45',NULL),
(5,'cars','2018-09-30 04:52:45','2018-09-30 04:52:45',NULL),
(6,'climate change','2018-09-30 04:52:45','2018-09-30 04:52:45',NULL);
/*!40000 ALTER TABLE `tag` ENABLE KEYS */;
UNLOCK TABLES;
# Dump of table ted_related_talk_join
# ------------------------------------------------------------
DROP TABLE IF EXISTS `ted_related_talk_join`;
CREATE TABLE `ted_related_talk_join` (
`id` bigint(20) NOT NULL,
`ted_talk_id` bigint(20) NOT NULL,
`related_talk_id` bigint(20) NOT NULL,
`createdat` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updatedat` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`deletedat` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `ted_talk_id_fk_1` (`ted_talk_id`),
KEY `related_talk_id_fk_1` (`related_talk_id`),
CONSTRAINT `related_talk_id_fk_1` FOREIGN KEY (`related_talk_id`) REFERENCES `related_talk` (`id`),
CONSTRAINT `ted_talk_id_fk_1` FOREIGN KEY (`ted_talk_id`) REFERENCES `ted_talk` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
LOCK TABLES `ted_related_talk_join` WRITE;
/*!40000 ALTER TABLE `ted_related_talk_join` DISABLE KEYS */;
INSERT INTO `ted_related_talk_join` (`id`, `ted_talk_id`, `related_talk_id`, `createdat`, `updatedat`, `deletedat`)
VALUES
(1,1,865,'2018-09-30 04:55:04','2018-09-30 04:55:04',NULL),
(2,1,1738,'2018-09-30 04:55:04','2018-09-30 04:55:04',NULL);
/*!40000 ALTER TABLE `ted_related_talk_join` ENABLE KEYS */;
UNLOCK TABLES;
# Dump of table ted_talk
# ------------------------------------------------------------
DROP TABLE IF EXISTS `ted_talk`;
CREATE TABLE `ted_talk` (
`id` bigint(20) NOT NULL,
`description` text,
`event` varchar(500) NOT NULL,
`main_speaker` varchar(500) NOT NULL,
`name` text NOT NULL,
`publishdate` datetime NOT NULL,
`speaker_occupation` varchar(500) DEFAULT NULL,
`title` varchar(700) NOT NULL,
`url` text NOT NULL,
`views` bigint(20) DEFAULT '0',
`createdat` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updatedat` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`deletedat` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
LOCK TABLES `ted_talk` WRITE;
/*!40000 ALTER TABLE `ted_talk` DISABLE KEYS */;
INSERT INTO `ted_talk` (`id`, `description`, `event`, `main_speaker`, `name`, `publishdate`, `speaker_occupation`, `title`, `url`, `views`, `createdat`, `updatedat`, `deletedat`)
VALUES
(1,'Sir Ken Robinson makes an entertaining and profoundly moving case for creating an education system that nurtures (rather than undermines) creativity.','TED2006','Ken Robinson','Ken Robinson: Do schools kill creativity?','2006-06-27 12:11:00','Author/educator','Do schools kill creativity?','https://www.ted.com/talks/ken_robinson_says_schools_kill_creativity',47227110,'2018-09-30 04:55:01','2018-09-30 04:55:01',NULL),
(2,'With the same humor and humanity he exuded in \"An Inconvenient Truth,\" Al Gore spells out 15 ways that individuals can address climate change immediately, from buying a hybrid to inventing a new, hotter brand name for global warming.','TED2007','Al Gore','Al Gore: Averting the climate crisis','2006-06-27 12:11:00','Climate advocate','Averting the climate crisis','https://www.ted.com/talks/al_gore_on_averting_climate_crisis',3200520,'2018-09-30 04:55:01','2018-09-30 05:11:59',NULL);
/*!40000 ALTER TABLE `ted_talk` ENABLE KEYS */;
UNLOCK TABLES;
# Dump of table ted_talks_ratings
# ------------------------------------------------------------
DROP TABLE IF EXISTS `ted_talks_ratings`;
CREATE TABLE `ted_talks_ratings` (
`id` bigint(20) NOT NULL,
`rating_tag_id` bigint(20) NOT NULL,
`ted_talk_id` bigint(20) NOT NULL,
`count` bigint(20) DEFAULT '0',
`createdat` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updatedat` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`deletedat` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `ted_talk_id_fk_3` (`ted_talk_id`),
KEY `rating_tag_id_fk_3` (`rating_tag_id`),
CONSTRAINT `rating_tag_id_fk_3` FOREIGN KEY (`rating_tag_id`) REFERENCES `rating_tag` (`id`),
CONSTRAINT `ted_talk_id_fk_3` FOREIGN KEY (`ted_talk_id`) REFERENCES `ted_talk` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
LOCK TABLES `ted_talks_ratings` WRITE;
/*!40000 ALTER TABLE `ted_talks_ratings` DISABLE KEYS */;
INSERT INTO `ted_talks_ratings` (`id`, `rating_tag_id`, `ted_talk_id`, `count`, `createdat`, `updatedat`, `deletedat`)
VALUES
(1,7,1,19645,'2018-09-30 04:55:21','2018-09-30 04:55:21',NULL),
(2,1,1,4573,'2018-09-30 04:55:21','2018-09-30 04:55:21',NULL),
(3,9,1,6073,'2018-09-30 04:55:21','2018-09-30 04:55:21',NULL);
/*!40000 ALTER TABLE `ted_talks_ratings` ENABLE KEYS */;
UNLOCK TABLES;
# Dump of table ted_talks_tags_join
# ------------------------------------------------------------
DROP TABLE IF EXISTS `ted_talks_tags_join`;
CREATE TABLE `ted_talks_tags_join` (
`id` bigint(20) NOT NULL,
`ted_talk_id` bigint(20) NOT NULL,
`tag_id` bigint(20) NOT NULL,
`createdat` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updatedat` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`deletedat` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `ted_talk_id_fk_2` (`ted_talk_id`),
KEY `tag_id_fk_2` (`tag_id`),
CONSTRAINT `tag_id_fk_2` FOREIGN KEY (`tag_id`) REFERENCES `tag` (`id`),
CONSTRAINT `ted_talk_id_fk_2` FOREIGN KEY (`ted_talk_id`) REFERENCES `ted_talk` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
LOCK TABLES `ted_talks_tags_join` WRITE;
/*!40000 ALTER TABLE `ted_talks_tags_join` DISABLE KEYS */;
INSERT INTO `ted_talks_tags_join` (`id`, `ted_talk_id`, `tag_id`, `createdat`, `updatedat`, `deletedat`)
VALUES
(1,1,1,'2018-09-30 04:55:21','2018-09-30 04:55:21',NULL),
(2,1,2,'2018-09-30 04:55:21','2018-09-30 04:55:21',NULL),
(3,1,3,'2018-09-30 04:55:21','2018-09-30 04:55:21',NULL),
(4,1,4,'2018-09-30 04:55:21','2018-09-30 04:55:21',NULL);
/*!40000 ALTER TABLE `ted_talks_tags_join` ENABLE KEYS */;
UNLOCK TABLES;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
alter table t_cargo_detail add ne_ha_location varchar2(5);
--//@UNDO
alter table t_cargo_detail drop column ne_ha_location;
|
ALTER TABLE job DROP IF EXISTS destination;
DROP INDEX IF EXISTS job_destination_idx;
|
CREATE TABLE public."Drivers"
(
"Id" integer NOT NULL GENERATED BY DEFAULT AS IDENTITY ( INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 2147483647 CACHE 1 ),
"Name" character varying(100) COLLATE pg_catalog."default" NOT NULL,
"Available" boolean,
"Latitude" double precision,
"Longitude" double precision,
CONSTRAINT "PK_Drivers" PRIMARY KEY ("Id")
)
TABLESPACE pg_default;
ALTER TABLE public."Drivers"
OWNER to postgres;
CREATE TABLE public."Passengers"
(
"Id" integer NOT NULL GENERATED BY DEFAULT AS IDENTITY ( INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 2147483647 CACHE 1 ),
"Name" character varying(100) COLLATE pg_catalog."default" NOT NULL,
"Latitude" double precision,
"Longitude" double precision,
CONSTRAINT "PK_Passengers" PRIMARY KEY ("Id")
)
TABLESPACE pg_default;
ALTER TABLE public."Passengers"
OWNER to postgres;
CREATE TABLE public."Trips"
(
"Id" integer NOT NULL GENERATED BY DEFAULT AS IDENTITY ( INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 2147483647 CACHE 1 ),
"PassengerId" integer NOT NULL,
"DriverId" integer NOT NULL,
"Start" timestamp without time zone NOT NULL,
"End" timestamp without time zone,
CONSTRAINT "PK_Trips" PRIMARY KEY ("Id"),
CONSTRAINT fk_trips_drivers FOREIGN KEY ("DriverId")
REFERENCES public."Drivers" ("Id") MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE RESTRICT,
CONSTRAINT fk_trips_passenger FOREIGN KEY ("PassengerId")
REFERENCES public."Passengers" ("Id") MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE RESTRICT
)
TABLESPACE pg_default;
ALTER TABLE public."Trips"
OWNER to postgres;
-- Index: fki_fk_trips_drivers
-- DROP INDEX public.fki_fk_trips_drivers;
CREATE INDEX fki_fk_trips_drivers
ON public."Trips" USING btree
("DriverId" ASC NULLS LAST)
TABLESPACE pg_default;
-- Index: fki_fk_trips_passenger
-- DROP INDEX public.fki_fk_trips_passenger;
CREATE INDEX fki_fk_trips_passenger
ON public."Trips" USING btree
("PassengerId" ASC NULLS LAST)
TABLESPACE pg_default;
CREATE TABLE public."Invoices"
(
"Id" integer NOT NULL GENERATED BY DEFAULT AS IDENTITY ( INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 2147483647 CACHE 1 ),
"TripId" integer,
"Amount" money,
"Created" timestamp without time zone,
CONSTRAINT "PK_Invoices" PRIMARY KEY ("Id"),
CONSTRAINT fk_invoices_trips FOREIGN KEY ("TripId")
REFERENCES public."Trips" ("Id") MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE RESTRICT
)
TABLESPACE pg_default;
ALTER TABLE public."Invoices"
OWNER to postgres;
-- Index: fki_fk_invoices_trips
-- DROP INDEX public.fki_fk_invoices_trips;
CREATE INDEX fki_fk_invoices_trips
ON public."Invoices" USING btree
("TripId" ASC NULLS LAST)
TABLESPACE pg_default;
INSERT INTO public."Drivers"(
"Name", "Available", "Latitude", "Longitude")
VALUES ('First driver', true, 18.4923177, -69.8391991);
INSERT INTO public."Passengers"(
"Name", "Latitude", "Longitude")
VALUES ('First passenger', 18.4867788, -69.8386928);
|
update utbetaling_begrunnelse set vedtak_begrunnelse = 'INNVILGET_LOVLIG_OPPHOLD_EØS_BORGER_SKJØNNSMESSIG_VURDERING'
where vedtak_begrunnelse = 'INNVILGET_LOVLIG_OPPHOLD_AAREG'; |
CREATE OR REPLACE FUNCTION public.insert_band(
bname character varying,
mbid character varying)
RETURNS integer
LANGUAGE 'sql'
COST 100
VOLATILE PARALLEL UNSAFE
AS $BODY$
insert into band (bandname, musicbrainzid)
values (bname, mbid)
on conflict (musicbrainzid) do nothing;
select bandid from band where musicbrainzid = mbid
$BODY$;
|
CREATE TABLE car (
id BIGINT(20) PRIMARY KEY AUTO_INCREMENT,
model VARCHAR(50) NOT NULL,
color VARCHAR(30) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
SELECT SUM(last_cost - avg_cost) * SUM(qty_on_hand), item_no
FROM z_iminvloc
where last_cost > std_cost and last_cost > avg_cost and item_no
in (select item_no
from imitmidx_sql
where pur_or_mfg = 'P')
GROUP BY item_no
SELECT ((std_cost - avg_cost) * qty_on_hand) AS diff, std_cost, avg_cost, item_no
FROM z_iminvloc
where avg_cost < std_cost and item_no
in (select item_no
from imitmidx_sql
where pur_or_mfg = 'P') and qty_on_hand > 0
order by diff desc
|
CREATE DATABASE testDB;
CREATE TABLE CUSTOMERS(
ID INT NOT NULL,
NAME VARCHAR (20) NOT NULL,
AGE INT NOT NULL,
ADDRESS CHAR (25) ,
SALARY DECIMAL (18, 2),
PRIMARY KEY (ID)
);
INSERT INTO dbo.CUSTOMERS
( ID, NAME, AGE, ADDRESS, SALARY )
VALUES ( 123, -- ID - int
'Viet', -- NAME - varchar(20)
20, -- AGE - int
'Dalat', -- ADDRESS - char(25)
500 -- SALARY - decimal
);
INSERT INTO dbo.CUSTOMERS
( ID, NAME, AGE, ADDRESS, SALARY )
VALUES ( 233, -- ID - int
'Dan', -- NAME - varchar(20)
20, -- AGE - int
'Baoloc', -- ADDRESS - char(25)
NULL -- SALARY - decimal
);
SELECT * FROM dbo.CUSTOMERS; |
BEGIN TRANSACTION;
DROP TABLE IF EXISTS "setting";
CREATE TABLE setting ("ID" INTEGER PRIMARY KEY,"NAME" TEXT,"NUMBER" INTEGER DEFAULT 0,"EMAIL" TEXT,AGE INTEGER DEFAULT 0,B_DATE TEXT,ACTIVE INTEGER DEFAULT 0 ,NOTI INTEGER DEFAULT 0 ,SEX INTEGER DEFAULT 0, APIID INTEGER DEFAULT 0, "LANG" TEXT DEFAULT ar);
COMMIT; |
CREATE VIEW show_details_view AS
SELECT sh.id,
sh.title,
sh.year,
round(sh.rating, 1) AS round_rating,
sh.runtime,
sh.rating,
sh.overview,
sh.trailer,
sh.homepage,
string_agg(DISTINCT '{"genre_id": ' || ge.id || ', "genre_name": "' || ge.name || '"}', ', ') AS genres_name,
string_agg(DISTINCT '{"actor_id": ' || ac.id || ', "actor_name": "' || ac.name || '"}', ', ') AS actors_name
FROM shows sh
LEFT JOIN show_genres sg ON sh.id = sg.show_id
LEFT JOIN genres ge ON sg.genre_id = ge.id
LEFT JOIN show_characters sc ON sh.id = sc.show_id
LEFT JOIN actors ac ON sc.actor_id = ac.id
GROUP BY sh.id; |
use employees;
SELECT * FROM salaries;
SELECT
SUM(salary)
FROM salaries
WHERE to_date > '1997-01-01'; |
create database db_atividade_3;
use db_atividade_3;
create table tb_alunes (
id bigint auto_increment,
nome varchar (100) not null,
ra bigint unique not null,
notas decimal (4,2),
turma varchar (30) not null,
turno varchar (30) not null,
primary key (id)
);
describe tb_alunes;
insert into tb_alunes (nome, ra, notas, turma, turno) values ('Nicolas Jacarandá', '568', '8', '9ºano A', 'integral');
insert into tb_alunes (nome, ra, notas, turma, turno) values ('Manoela Sibipiruna ', '341', '9', '9ºano B', 'matutino');
insert into tb_alunes (nome, ra, notas, turma, turno) values ('Flávia Sibipiruna', '342', '6', '8ºano C', 'integral');
insert into tb_alunes (nome, ra, notas, turma, turno) values ('Jéssica ', '653', '8', '9ºano B', 'matutino');
select * from tb_alunes where notas>7;
select * from tb_alunes where notas<7;
|
select
distinct alias
from
gha_repos
where
alias is not null
order by
alias asc
;
|
create table if not exists ListOfBirds(
id serial primary key,
name1 varchar(20) not null,
name2 varchar(20) not null,
name3 varchar(20) not null,
name4 varchar(20) not null,
name5 varchar(20) not null
); |
update board1 set readcount=51 where num=256;
select * from board1;
select * from tabs; |
--테이블 명 : 고객
--컬럼 : 고객관리번호, 고객명, 주소, 전화
DROP TABLE client;
CREATE TABLE client(
cnum NUMBER,
cname VARCHAR2(50),
addr VARCHAR2(200),
tel VARCHAR2(20)
); |
SELECT CASE
WHEN NPA.APP_CODE_ENTRY = 'EMM' THEN '2-PAG AUTOMATED'
ELSE '1- CSR'
END
AS "TRANSACTION_SOURCE",
'Balance Transfer' "TRANSACTION_TYPE",
'ADJUSTMENT' "EVENT_CATEGORY",
'ADJUSTMENT' "EVENT_TYPE",
SAP_ORDER.CREATED_BY "PROFILE",
NULL "PAY_TYPE",
FHR.DESCRIPTION "REASON ID",
NPA.ENTRY_DATE RECEIVED_DATE,
SUBSTR( NPA.DEALER_CODE_ENTRY, INSTR( NPA.DEALER_CODE_ENTRY, '|' ) + 1 )
STORE_CODE,
NPA.DEALER_CODE_ENTRY DEALER_CODE,
BA.BILLING_ACCOUNT_CODE BAN,
NPA.ADJUSTMENT_AMOUNT TRANSACTION_AMOUNT
FROM NK_PREPAID_ACCOUNT_ADJUSTMENTS NPA,
BILLING_ACCOUNT BA,
FIN_HANDLING_REASON FHR,
(SELECT A.CREATED_BY,
CASE
WHEN TRIM( ZZAFLD00003U ) <> TRIM( ZZAFLD00003T ) THEN
ZZAFLD00003T
ELSE
ZZAFLD00003U
END
ORDER_ID
FROM SAPSR3.CRMD_ORDERADM_H A, SAPSR3.CRMD_CUSTOMER_H C
WHERE A.GUID = C.GUID) SAP_ORDER
WHERE NPA.BILLING_ACCOUNT_ID = BA.BILLING_ACCOUNT_ID
AND NPA.HANDLING_REASON_ID = FHR.HANDLING_REASON_ID
AND NPA.ORDER_ID_ENTRY = SAP_ORDER.ORDER_ID(+)
AND NPA.ACTION_TYPE_ENTRY = 'TRANSFERACCOUNTBALANCE' |
-- phpMyAdmin SQL Dump
-- version 5.1.0
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Apr 03, 2021 at 09:43 AM
-- Server version: 10.4.18-MariaDB
-- PHP Version: 8.0.3
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Database: `thesis`
--
-- --------------------------------------------------------
--
-- Table structure for table `academic_year`
--
CREATE TABLE `academic_year` (
`id` int(11) NOT NULL,
`year_name` varchar(30) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `academic_year`
--
INSERT INTO `academic_year` (`id`, `year_name`) VALUES
(1, '2010-01-01'),
(2, '2011-01-30'),
(3, '2012-04-25'),
(4, '2013-12-01'),
(5, '2014-01-01'),
(6, '2015-01-01'),
(7, '2016-01-01'),
(8, '2017-01-01'),
(9, '2018-01-01'),
(10, '2019-01-01'),
(11, '2020-01-01'),
(12, '2021-01-01'),
(13, '2022-01-01'),
(14, '2023-01-01'),
(15, '2024-01-01'),
(16, '2025-01-01'),
(17, '2026-01-01'),
(18, '2027-01-01'),
(19, '2028-01-01'),
(20, '2029-01-01'),
(22, '2030-01-01');
-- --------------------------------------------------------
--
-- Table structure for table `adminlastloggedin`
--
CREATE TABLE `adminlastloggedin` (
`id` int(10) UNSIGNED NOT NULL,
`loggedintime` timestamp NOT NULL DEFAULT current_timestamp(),
`admin_nim` bigint(20) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `adminlastloggedin`
--
INSERT INTO `adminlastloggedin` (`id`, `loggedintime`, `admin_nim`) VALUES
(1, '2020-11-26 02:06:07', 11160930000120),
(2, '2020-12-13 13:02:16', 11160930000192);
-- --------------------------------------------------------
--
-- Table structure for table `agency`
--
CREATE TABLE `agency` (
`id` int(10) UNSIGNED NOT NULL,
`agencytitle` varchar(50) NOT NULL DEFAULT 'No title found',
`student_id` bigint(20) NOT NULL,
`agencydescription` text NOT NULL DEFAULT 'No Description added',
`duration` char(5) NOT NULL DEFAULT 'N',
`start_time` varchar(40) NOT NULL,
`end_time` varchar(40) NOT NULL,
`lettertype` varchar(20) NOT NULL DEFAULT 'none'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `agency`
--
INSERT INTO `agency` (`id`, `agencytitle`, `student_id`, `agencydescription`, `duration`, `start_time`, `end_time`, `lettertype`) VALUES
(82, 'Computer Science and Engineering', 83789553791438, 'Networking with one\'s fellow scientists and engineers is extremely important for personal and professional development. Professional societies sponsor conferences, publish journals, and serve as reviewers or editors. They set professional and educational standards and provide job and career services for their members.', '1', '03/01/2021', '03/31/2021', 'Electronic');
-- --------------------------------------------------------
--
-- Table structure for table `all_subjects`
--
CREATE TABLE `all_subjects` (
`all_subjectname` varchar(70) NOT NULL,
`all_subjectid` int(10) UNSIGNED NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `all_subjects`
--
INSERT INTO `all_subjects` (`all_subjectname`, `all_subjectid`) VALUES
('Anthropology\r', 1),
('Archaeology\r', 2),
('Area Studies\r', 3),
('Cultural and Ethnic Studies\r', 4),
('Economics\r', 5),
('Gender and Sexuality Studies\r', 6),
('Geography\r', 7),
('Political Science\r', 8),
('Psychology\r', 9),
('Sociology\r', 10),
('Chemistry\r', 11),
('Earth Sciences\r', 12),
('Life Sciences\r', 13),
('Physics\r', 14),
('Space Sciences\r', 15),
('Computer Sciences\r', 16),
('Logic\r', 17),
('Mathematics\r', 18),
('Statistics\r', 19),
('Systems Science\r', 20),
('Agriculture\r', 21),
('Architecture and Design\r', 22),
('Business\r', 23),
('Divinity\r', 24),
('Education\r', 25),
('Engineering\r', 26),
('Environmental Studies and Forestry\r', 27),
('Family and Consumer Science\r', 28),
('Health Sciences\r', 29),
('Human Physical Performance and Recreation*\r', 30),
('Journalism, Media Studies and Communication\r', 31),
('Law\r', 32),
('Library and Museum Studies\r', 33),
('Military Sciences\r', 34),
('Public Administration\r', 35),
('Social Work\r', 36),
('Transportation', 37);
-- --------------------------------------------------------
--
-- Table structure for table `classes`
--
CREATE TABLE `classes` (
`id` int(10) UNSIGNED NOT NULL,
`class_grade` int(11) NOT NULL,
`class_code` int(11) NOT NULL,
`class_name` varchar(30) NOT NULL,
`days` varchar(30) NOT NULL,
`year_name` varchar(30) DEFAULT NULL,
`end_time` varchar(30) DEFAULT NULL,
`subjectid` int(11) NOT NULL,
`teacherid` bigint(20) NOT NULL,
`nim` bigint(20) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `classes`
--
INSERT INTO `classes` (`id`, `class_grade`, `class_code`, `class_name`, `days`, `year_name`, `end_time`, `subjectid`, `teacherid`, `nim`) VALUES
(2, 1, 42485, '56XR', 'Moday', '2010-01-01', '2020-06-30 20:25:00', 89124, 43632372818789, 83789553791438),
(3, 1, 95819, 'WRTJ', 'Moday', '2010-01-01', '2020-06-30 20:40:00', 23412, 43632372818789, 99325320048831),
(4, 2, 60908, 'FHIB', 'Moday', '2010-01-01', '2020-06-30 20:42:00', 23412, 43632372818789, 83789553791438),
(5, 1, 41603, 'WSD9', 'Moday', '2011-01-30 ', '2020-06-30 20:58:00', 35216, 43632372818789, 83789553791438),
(6, 1, 4635, 'LA5G', 'Moday', '2011-01-30', '2020-06-25 21:02:00', 54566, 43632372818789, 83789553791438),
(7, 2, 88533, 'JX57', 'Tuesday', '2011-01-30', '2020-06-06 21:04:00', 30183, 43632372818789, 17034213768553),
(8, 5, 10964, 'B4YU', 'Moday', '2010-01-01', '2020-06-30 21:24:00', 11511, 43632372818789, 17034213768553),
(9, 3, 28822, 'PLCE', 'Moday', '2010-01-01', '2020-09-16 22:40:00', 26156, 17352183302292, 83789553791438),
(11, 2, 21309, 'OMFJ', 'Wednesday', '2010-01-01', '2020-09-10 22:43:00', 23412, 18154898755021, 83789553791438),
(16, 3, 40302, 'EA13', 'tuesday', '2020-01-01', '02:00 AM', 9314, 42030737204174, 83789553791438),
(45, 3, 14104, 'Y2PK', 'wednesday', '2020-01-01', '01:30 AM', 9314, 28152121636563, 83789553791438),
(58, 4, 40423, 'DXKA', 'monday', '2021-01-01', '12:00 AM', 72186, 56871005568266, 83789553791438),
(59, 4, 13124, 'ODW1', 'tuesday', '2021-01-01', '02:30 AM', 54566, 28152121636563, 83789553791438),
(61, 4, 30004, '23QF', 'thursay', '2021-01-01', '10:30 PM', 30183, 31084335760364, 83789553791438),
(62, 3, 21244, '8HEK', 'sunday', '2020-01-01', '01:30 AM', 11511, 18154898755021, 83789553791438),
(63, 2, 43322, 'AHF2', 'friday', '2020-01-01', '02:00 AM', 9298, 38635016401032, 83789553791438);
-- --------------------------------------------------------
--
-- Table structure for table `class_grade_student`
--
CREATE TABLE `class_grade_student` (
`student_class_id` int(11) NOT NULL,
`class_grade` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `class_grade_student`
--
INSERT INTO `class_grade_student` (`student_class_id`, `class_grade`) VALUES
(1, 1),
(2, 2),
(3, 3),
(4, 4),
(5, 5),
(6, 6),
(7, 7),
(8, 8),
(9, 9),
(10, 10),
(11, 11),
(12, 12);
-- --------------------------------------------------------
--
-- Table structure for table `courses`
--
CREATE TABLE `courses` (
`id` int(10) UNSIGNED NOT NULL,
`user_id` bigint(20) NOT NULL,
`title` varchar(50) NOT NULL,
`price` float NOT NULL,
`description` text DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `courses`
--
INSERT INTO `courses` (`id`, `user_id`, `title`, `price`, `description`, `created_at`) VALUES
(2, 11160930000120, 'asdf', 23, 'asdfasdf', '2021-03-30 13:59:56'),
(3, 11160930000120, 'asdfasdf', 41, 'asdfasdfasdf', '2021-03-30 14:00:06'),
(5, 11160930000120, 'asdfasdf', 34, 'asdfgasdfasdf', '2021-03-30 14:00:31'),
(6, 11160930000120, 'JavaScript', 15, 'This is a full javascript project, with a cheap price.', '2021-04-02 07:39:48');
-- --------------------------------------------------------
--
-- Table structure for table `eletter`
--
CREATE TABLE `eletter` (
`id` int(10) UNSIGNED NOT NULL,
`letters` varchar(250) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `eletter`
--
INSERT INTO `eletter` (`id`, `letters`) VALUES
(1, 'Scholarship Recommendation Letter'),
(2, 'PKL Letter');
-- --------------------------------------------------------
--
-- Table structure for table `event`
--
CREATE TABLE `event` (
`id` int(11) NOT NULL,
`title` varchar(50) NOT NULL,
`description` text DEFAULT NULL,
`speaker` varchar(100) NOT NULL,
`start_time` timestamp NOT NULL DEFAULT current_timestamp(),
`start_end` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `event`
--
INSERT INTO `event` (`id`, `title`, `description`, `speaker`, `start_time`, `start_end`) VALUES
(1, 'How to be a good programmer', 'In this event the host will talk about programming lanuage, and will help you to become good programmer.', 'Dr. Syopiansyah Jaya Putra M.Si', '2021-04-02 08:00:00', '2021-04-02 08:14:48'),
(2, 'How to be a good programmer', 'In this event the host will talk about programming lanuage, and will help you to become good programmer.', '', '2021-04-02 08:14:51', '2021-04-02 08:14:51'),
(3, 'How to be a good programmer', 'In this event the host will talk about programming lanuage, and will help you to become good programmer.', '', '2021-04-02 08:14:51', '2021-04-02 08:14:51');
-- --------------------------------------------------------
--
-- Table structure for table `family`
--
CREATE TABLE `family` (
`family_id` int(10) UNSIGNED NOT NULL,
`nim` bigint(20) NOT NULL,
`familyname` varchar(30) DEFAULT NULL,
`familyjob` varchar(30) DEFAULT NULL,
`familyincome` varchar(30) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `family`
--
INSERT INTO `family` (`family_id`, `nim`, `familyname`, `familyjob`, `familyincome`) VALUES
(5, 47228610344222, 'Asdf', NULL, NULL),
(6, 83789553791438, 'Asdf', NULL, NULL),
(8, 47228610344221, 'Asdf', NULL, NULL),
(10, 47228610344266, 'Asdf', NULL, NULL),
(11, 16747873726784, 'aaa', NULL, NULL),
(12, 16747873726784, 'aaa', NULL, NULL),
(13, 99325320048831, 'Emma', NULL, NULL),
(14, 18793286422779, 'Olivia', NULL, NULL),
(15, 17034213768553, 'Charlotte', NULL, NULL),
(16, 54141807378939, 'Parker', NULL, NULL),
(17, 62960424079990, 'Gavin', NULL, NULL),
(18, 62498751658254, 'Kayden', NULL, NULL),
(19, 65384502317782, 'Asdf', NULL, NULL),
(20, 12926861659608, 'aa', NULL, NULL),
(21, 84614188815285, 'Mike', NULL, NULL),
(22, 19654297179939, 'asdf', NULL, NULL),
(23, 13124286433889, 'codeigniter', NULL, NULL),
(24, 15643314587511, 'codeigniter', NULL, NULL),
(25, 32452345234521, 'codeigniter', NULL, NULL),
(26, 16469843373399, 'codeigniter', NULL, NULL),
(27, 13712226564318, 'asdfasd', NULL, NULL),
(28, 18565196249818, 'Jordan', NULL, NULL),
(29, 12367227813729, 'asdfasd', NULL, NULL),
(30, 18933889855648, 'Dominic', NULL, NULL),
(31, 11446431127385, 'Austin', NULL, NULL),
(32, 18224933851118, 'Ian', NULL, NULL),
(33, 27054705240581, 'test', NULL, NULL),
(34, 15756282592211, 'INSERT', NULL, NULL),
(35, 63051738704130, 'asdfasdf', NULL, NULL),
(36, 58517486632460, 'asdfasdf', NULL, NULL),
(37, 58574236318147, 'sdfasdfas', NULL, NULL),
(38, 14604327012522, 'asdfasdf', NULL, NULL),
(39, 42773036300353, 'adsfasdf', NULL, NULL),
(40, 20584232423423, 'asdfasdf', NULL, NULL),
(41, 82487346006071, 'asdfasdf', NULL, NULL),
(42, 84574802185024, 'Asdfa', NULL, NULL),
(43, 87206712581231, 'Asdf', NULL, NULL),
(44, 98720671258123, 'Asdf', NULL, NULL),
(45, 98720671258111, 'ddddddd', NULL, NULL),
(46, 16328062132605, 'Asdfas', NULL, NULL),
(47, 26242752772112, 'Adf', NULL, NULL),
(48, 73477631735544, 'Asdfasdf', NULL, NULL),
(49, 47228610344232, 'Asdf', NULL, NULL),
(50, 47228610344111, 'Asdf', NULL, NULL),
(51, 47228610344222, 'Asdf', NULL, NULL),
(52, 47228610344221, 'Asdf', NULL, NULL),
(53, 47228610344229, 'Asdf', NULL, NULL),
(54, 47228610344266, 'Asdf', NULL, NULL);
--
-- Triggers `family`
--
DELIMITER $$
CREATE TRIGGER `insert_parent_name` AFTER INSERT ON `family` FOR EACH ROW BEGIN
INSERT INTO parent(nim, family_id ) VALUES (new.nim, new.family_id);
END
$$
DELIMITER ;
-- --------------------------------------------------------
--
-- Table structure for table `files`
--
CREATE TABLE `files` (
`file_id` int(11) NOT NULL,
`nim` bigint(20) NOT NULL,
`teacherid` bigint(20) NOT NULL,
`file_title` varchar(30) NOT NULL,
`file_description` text NOT NULL,
`file_attachment` blob NOT NULL,
`send_date` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `files`
--
INSERT INTO `files` (`file_id`, `nim`, `teacherid`, `file_title`, `file_description`, `file_attachment`, `send_date`) VALUES
(23, 99325320048831, 92254794233844, 'asdf', 'asdfasdf', 0x566f6c335f4e6f325f322e706466, '2020-12-04 13:34:19'),
(25, 99325320048831, 92254794233844, 'asdfasd', 'fasdfasdf', 0x6c61726176656c2e706466, '2020-12-04 13:35:09');
-- --------------------------------------------------------
--
-- Table structure for table `grades`
--
CREATE TABLE `grades` (
`grade_id` int(10) UNSIGNED NOT NULL,
`grade_number` int(10) UNSIGNED NOT NULL DEFAULT 0,
`nim` bigint(20) NOT NULL,
`teacherid` bigint(20) NOT NULL,
`subjectid` int(11) NOT NULL,
`class_grade_id` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `grades`
--
INSERT INTO `grades` (`grade_id`, `grade_number`, `nim`, `teacherid`, `subjectid`, `class_grade_id`) VALUES
(1, 100, 9223372036854775807, 43632372818789, 23412, 1),
(2, 200, 83789553791438, 43632372818789, 73218, 1),
(5, 300, 83789553791438, 43632372818789, 35216, 1);
-- --------------------------------------------------------
--
-- Table structure for table `login`
--
CREATE TABLE `login` (
`admin_id` int(10) UNSIGNED NOT NULL,
`admin_nim` bigint(20) NOT NULL,
`admin_name` varchar(30) NOT NULL,
`admin_lastname` varchar(30) DEFAULT NULL,
`admin_email` varchar(50) NOT NULL,
`admin_pass` text NOT NULL,
`admin_conpass` text NOT NULL,
`admin_image` blob DEFAULT NULL,
`admin_level` varchar(15) DEFAULT 'admin'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `login`
--
INSERT INTO `login` (`admin_id`, `admin_nim`, `admin_name`, `admin_lastname`, `admin_email`, `admin_pass`, `admin_conpass`, `admin_image`, `admin_level`) VALUES
(2, 11160930000192, 'Administration', NULL, 'newadminy@yahoo.com', '$2y$10$AlaBU3MM2EdXswOehLr1ruHL2JmE/W7akUxDOjleb/5Euky0/Qyny', '$2y$10$LM/rPc.XIMRNCPMQOzxoBurxtDgOODPP1LSs/ZozbGITSTcxVWHAe', 0x313539323734373032305f6261636b352e6a7067, 'admin'),
(11, 11160930000120, 'Saboor', 'Hamedi', 'saboorhamedi49@gmail.com', '$2y$10$ry1f/9iInlTthHNIdVGTq.PT3Nh9fW5QlwOhvNiTd1NhH09dVPVJ6', '$2y$10$EeL64huBmcj0z6QDFUtsDOuyJ1ZpDgXuEp7LoOu0Aw7mumiwf3jDG', 0x313630353834343933302d494d475f303936392e4a5047, 'admin'),
(12, 26748282305214, 'pak Eri', 'Rustam', 'pakerirustam@gmail.com', '$2y$10$xsPK02E4g76UuUWnAc3hv.a9.ZQc8FnuOusgAaeorPyDQiv8SN8em', '123', 0x313630363437323832362d70702e6a7067, 'admin'),
(13, 61068775746818, 'hkl', 'jkh', 'kjhkl@gmail.com', '$2y$10$EFsO0Z7iWF86QtHeBdwk2OicQH6LISBWwLqdI3kBGFanCAcbXFIX2', '123', 0x313630363938333139342d61646d697373696f6e206163746976697479206469616772616d2e706e67, 'admin');
-- --------------------------------------------------------
--
-- Table structure for table `parent`
--
CREATE TABLE `parent` (
`parent_id` int(10) UNSIGNED NOT NULL,
`nim` bigint(20) NOT NULL,
`family_id` int(10) UNSIGNED NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `parent`
--
INSERT INTO `parent` (`parent_id`, `nim`, `family_id`) VALUES
(3, 83789553791438, 6),
(5, 47228610344221, 8),
(7, 47228610344266, 10),
(8, 16747873726784, 11),
(9, 16747873726784, 12),
(10, 99325320048831, 13),
(11, 18793286422779, 14),
(12, 17034213768553, 15),
(13, 54141807378939, 16),
(14, 62960424079990, 17),
(15, 62498751658254, 18),
(16, 65384502317782, 19),
(17, 12926861659608, 20),
(18, 84614188815285, 21),
(19, 19654297179939, 22),
(20, 13124286433889, 23),
(21, 15643314587511, 24),
(22, 32452345234521, 25),
(23, 16469843373399, 26),
(24, 13712226564318, 27),
(25, 18565196249818, 28),
(26, 12367227813729, 29),
(27, 18933889855648, 30),
(28, 11446431127385, 31),
(29, 18224933851118, 32),
(30, 27054705240581, 33),
(31, 15756282592211, 34),
(32, 63051738704130, 35),
(33, 58517486632460, 36),
(34, 58574236318147, 37),
(35, 14604327012522, 38),
(36, 42773036300353, 39),
(37, 20584232423423, 40),
(38, 82487346006071, 41),
(39, 84574802185024, 42),
(40, 87206712581231, 43),
(41, 98720671258123, 44),
(42, 98720671258111, 45),
(43, 16328062132605, 46),
(44, 26242752772112, 47),
(45, 73477631735544, 48),
(46, 47228610344232, 49),
(47, 47228610344111, 50),
(48, 47228610344222, 51),
(49, 47228610344221, 52),
(50, 47228610344229, 53),
(51, 47228610344266, 54);
-- --------------------------------------------------------
--
-- Table structure for table `password_resets`
--
CREATE TABLE `password_resets` (
`email` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`token` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `post`
--
CREATE TABLE `post` (
`id` int(11) NOT NULL,
`title` varchar(250) DEFAULT NULL,
`content` text NOT NULL,
`content_time` timestamp NOT NULL DEFAULT current_timestamp(),
`author_id` bigint(20) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `post`
--
INSERT INTO `post` (`id`, `title`, `content`, `content_time`, `author_id`) VALUES
(1, 'New THML course ', '<p>dsfddddddddddddddd</p><p>dsfddddddddddddddd</p><p>dsfddddddddddddddd</p><p>dsfddddddddddddddd</p>', '2021-03-03 09:14:34', 83789553791438);
-- --------------------------------------------------------
--
-- Table structure for table `professions`
--
CREATE TABLE `professions` (
`profession_id` int(11) NOT NULL,
`profession_name` varchar(30) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `professions`
--
INSERT INTO `professions` (`profession_id`, `profession_name`) VALUES
(1, 'HTML'),
(2, 'Art\r'),
(3, 'Citizenship\r'),
(4, ' Geography\r'),
(6, ' History\r'),
(7, 'Languages (French, German, Spa'),
(8, 'Literacy\r'),
(9, 'Music\r'),
(11, ' Natural history\r'),
(12, ' Personal, social and health e'),
(13, ' Science\r'),
(14, ' Arithmetic\r'),
(15, ' Social Studies\r'),
(16, 'Reading\r'),
(17, ' Writing\r'),
(18, 'Information and communication '),
(19, 'Languages\r'),
(20, 'Mathematics\r'),
(21, 'Modern studies\r'),
(22, 'Music\r'),
(23, ' PE: Physical education\r'),
(24, ' P.S.H.E: Personal, social and'),
(25, ' RE: Religious education\r'),
(26, ' Science\r'),
(27, 'Study skills\r'),
(28, 'Physics\r'),
(29, 'Religion\r'),
(30, 'Woodwork\r'),
(31, ' Sociology\r'),
(32, 'Psychology\r'),
(33, 'H.ome economics\r'),
(34, 'Critical reading');
-- --------------------------------------------------------
--
-- Table structure for table `recommendationletter`
--
CREATE TABLE `recommendationletter` (
`id` int(10) UNSIGNED NOT NULL,
`nim` bigint(20) NOT NULL,
`description` text NOT NULL,
`lettertype` varchar(20) NOT NULL,
`create_at` timestamp NOT NULL DEFAULT current_timestamp(),
`update_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `recommendationletter`
--
INSERT INTO `recommendationletter` (`id`, `nim`, `description`, `lettertype`, `create_at`, `update_at`) VALUES
(3, 83789553791438, 'ACM (Association for Computing Machinery)\n“world’s largest educational and scientific computing society;” focused on advancing computing as a science and a profession.\n', 'Manual', '2021-03-08 14:28:45', '2021-03-08 14:28:45');
-- --------------------------------------------------------
--
-- Table structure for table `student`
--
CREATE TABLE `student` (
`id` int(10) UNSIGNED NOT NULL,
`nim` bigint(20) NOT NULL,
`name` varchar(30) NOT NULL,
`lastname` varchar(30) NOT NULL,
`address` varchar(50) NOT NULL,
`email` varchar(50) NOT NULL,
`age` int(11) NOT NULL,
`country` varchar(20) NOT NULL,
`password` longtext NOT NULL,
`conpassword` longtext NOT NULL,
`student_level` varchar(10) DEFAULT 'student',
`create_at` timestamp NOT NULL DEFAULT current_timestamp(),
`update_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `student`
--
INSERT INTO `student` (`id`, `nim`, `name`, `lastname`, `address`, `email`, `age`, `country`, `password`, `conpassword`, `student_level`, `create_at`, `update_at`) VALUES
(1, 83789553791438, 'Omer', 'Omer', 'Indonesia', 'Omer@gmail.com', 12, 'Afghanistan', '$2y$10$MC/oRT07.kNHLCzujRKzu.wfwc67NTYdK..AV/DRdVYarjzwfnvcW', '$2y$10$MC/oRT07.kNHLCzujRKzu.wfwc67NTYdK..AV/DRdVYarjzwfnvcW', 'student', '2021-03-01 07:41:02', '2021-02-22 13:00:24'),
(2, 99325320048831, 'Liam', 'Emma', 'Amercia', 'liamemma@gmail.com', 5, 'Afghanistan', '$2y$10$MC/oRT07.kNHLCzujRKzu.wfwc67NTYdK..AV/DRdVYarjzwfnvcW', '$2y$10$MC/oRT07.kNHLCzujRKzu.wfwc67NTYdK..AV/DRdVYarjzwfnvcW', 'student', '2021-03-04 21:16:30', '2021-02-22 21:21:44'),
(3, 18793286422779, 'Noah', 'Olivia', 'China', 'soliviachina@gmail.com', 12, 'Afghanistan', '$2y$10$MC/oRT07.kNHLCzujRKzu.wfwc67NTYdK..AV/DRdVYarjzwfnvcW', '$2y$10$MC/oRT07.kNHLCzujRKzu.wfwc67NTYdK..AV/DRdVYarjzwfnvcW', 'student', '2021-02-26 06:36:48', '2021-02-24 15:03:39'),
(4, 22092393858586, 'James', 'Isabella', 'French', 'jamesIsabella@gmail.com', 19, 'Afghanistan', '$2y$10$MC/oRT07.kNHLCzujRKzu.wfwc67NTYdK..AV/DRdVYarjzwfnvcW', '$2y$10$MC/oRT07.kNHLCzujRKzu.wfwc67NTYdK..AV/DRdVYarjzwfnvcW', 'student', '2021-02-24 12:31:49', '2021-03-04 06:29:18'),
(9, 17034213768553, 'Benjamin', 'Charlotte', 'Afghanistan', 'Benjamin@gmail.com', 12, 'Afghanistan', '$2y$10$MC/oRT07.kNHLCzujRKzu.wfwc67NTYdK..AV/DRdVYarjzwfnvcW', '$2y$10$MC/oRT07.kNHLCzujRKzu.wfwc67NTYdK..AV/DRdVYarjzwfnvcW', 'student', '2021-03-07 14:06:06', '2021-02-23 06:31:45'),
(10, 54141807378939, 'Xavier', 'Parker', 'asdf', 'Xavier@gmail.com', 17, 'Afghanistan', '$2y$10$MC/oRT07.kNHLCzujRKzu.wfwc67NTYdK..AV/DRdVYarjzwfnvcW', '$2y$10$MC/oRT07.kNHLCzujRKzu.wfwc67NTYdK..AV/DRdVYarjzwfnvcW', 'student', '2021-02-26 04:12:24', '2021-02-25 08:27:03'),
(13, 62960424079990, 'Sawyer', 'Gavin', 'asdfasdf', 'asdfasdf@gmail.com', 17, 'Afghanistan', '$2y$10$MC/oRT07.kNHLCzujRKzu.wfwc67NTYdK..AV/DRdVYarjzwfnvcW', '$2y$10$MC/oRT07.kNHLCzujRKzu.wfwc67NTYdK..AV/DRdVYarjzwfnvcW', 'student', '2021-03-01 22:01:04', '2021-03-06 17:56:12'),
(14, 62498751658254, 'Leonardo', 'Kayden', 'asdf', 'sadfsad199@yahoo.com', 12, 'Afghanistan', '$2y$10$MC/oRT07.kNHLCzujRKzu.wfwc67NTYdK..AV/DRdVYarjzwfnvcW', '$2y$10$MC/oRT07.kNHLCzujRKzu.wfwc67NTYdK..AV/DRdVYarjzwfnvcW', 'student', '2021-03-06 20:45:33', '2021-03-05 11:36:05'),
(15, 65384502317782, 'Validate', 'Asdf', 'asdfasd', 'alajs98@yahoo.com', 16, 'Afghanistan', '$2y$10$MC/oRT07.kNHLCzujRKzu.wfwc67NTYdK..AV/DRdVYarjzwfnvcW', '$2y$10$MC/oRT07.kNHLCzujRKzu.wfwc67NTYdK..AV/DRdVYarjzwfnvcW', 'student', '2021-03-06 09:01:53', '2021-02-26 23:28:01'),
(16, 12926861659608, 'Name updated', 'aa', 'afghanistan', 'asdfas@yahoo.com', 7, 'Afghanistan', '$2y$10$MC/oRT07.kNHLCzujRKzu.wfwc67NTYdK..AV/DRdVYarjzwfnvcW', '$2y$10$MC/oRT07.kNHLCzujRKzu.wfwc67NTYdK..AV/DRdVYarjzwfnvcW', 'student', '2021-03-03 02:10:10', '2021-02-26 05:48:03'),
(17, 84614188815285, 'Name updated', 'Mike', 'Australia', 'asdf72@yahoo.com', 9, 'Afghanistan', '$2y$10$MC/oRT07.kNHLCzujRKzu.wfwc67NTYdK..AV/DRdVYarjzwfnvcW', '$2y$10$MC/oRT07.kNHLCzujRKzu.wfwc67NTYdK..AV/DRdVYarjzwfnvcW', 'student', '2021-03-02 03:02:34', '2021-02-28 01:52:25'),
(18, 19654297179939, 'Name updated', 'asdf', 'asdf', 'asdfasdf@gmail.com', 8, 'Afghanistan', '$2y$10$MC/oRT07.kNHLCzujRKzu.wfwc67NTYdK..AV/DRdVYarjzwfnvcW', '$2y$10$MC/oRT07.kNHLCzujRKzu.wfwc67NTYdK..AV/DRdVYarjzwfnvcW', 'student', '2021-03-07 03:59:44', '2021-02-25 11:14:08'),
(23, 13124286433889, 'Name updated', 'codeigniter', 'asdfasdfa', 'asdfasdf', 8, 'Afghanistan', '$2y$10$MC/oRT07.kNHLCzujRKzu.wfwc67NTYdK..AV/DRdVYarjzwfnvcW', '$2y$10$MC/oRT07.kNHLCzujRKzu.wfwc67NTYdK..AV/DRdVYarjzwfnvcW', 'student', '2021-03-07 06:08:18', '2021-03-06 21:49:38'),
(26, 15643314587511, 'Asher', 'codeigniter', 'asdfasdfa', 'asdfasdf', 12, 'Afghanistan', '$2y$10$MC/oRT07.kNHLCzujRKzu.wfwc67NTYdK..AV/DRdVYarjzwfnvcW', '$2y$10$MC/oRT07.kNHLCzujRKzu.wfwc67NTYdK..AV/DRdVYarjzwfnvcW', 'student', '2021-03-06 13:59:42', '2021-03-05 22:41:57'),
(28, 32452345234521, 'Name updated', 'codeigniter', 'asdfasdfa', 'asdfasdf', 8, 'Afghanistan', '$2y$10$MC/oRT07.kNHLCzujRKzu.wfwc67NTYdK..AV/DRdVYarjzwfnvcW', '$2y$10$MC/oRT07.kNHLCzujRKzu.wfwc67NTYdK..AV/DRdVYarjzwfnvcW', 'student', '2021-03-02 22:50:58', '2021-02-28 19:17:03'),
(30, 16469843373399, 'Name updated', 'codeigniter', 'asdfasdfa', 'asdfasdf', 9, 'Afghanistan', '$2y$10$MC/oRT07.kNHLCzujRKzu.wfwc67NTYdK..AV/DRdVYarjzwfnvcW', '$2y$10$MC/oRT07.kNHLCzujRKzu.wfwc67NTYdK..AV/DRdVYarjzwfnvcW', 'student', '2021-02-28 19:33:07', '2021-03-05 23:35:39'),
(33, 13712226564318, 'Asher', 'asdfasd', 'fasdfasdf', 'asdfasdf', 12, 'Afghanistan', '$2y$10$MC/oRT07.kNHLCzujRKzu.wfwc67NTYdK..AV/DRdVYarjzwfnvcW', '$2y$10$MC/oRT07.kNHLCzujRKzu.wfwc67NTYdK..AV/DRdVYarjzwfnvcW', 'student', '2021-03-01 00:30:03', '2021-03-05 07:23:15'),
(36, 18565196249818, 'Brayden', 'Jordan', 'adfasdf', 'asdfasdfasdf', 15, 'Afghanistan', '$2y$10$MC/oRT07.kNHLCzujRKzu.wfwc67NTYdK..AV/DRdVYarjzwfnvcW', '$2y$10$MC/oRT07.kNHLCzujRKzu.wfwc67NTYdK..AV/DRdVYarjzwfnvcW', 'student', '2021-02-22 11:08:16', '2021-02-28 09:25:34'),
(44, 12367227813729, 'adsfasdf', 'asdfasd', 'adfasdf', 'asdfasdf', 18, 'Afghanistan', '$2y$10$MC/oRT07.kNHLCzujRKzu.wfwc67NTYdK..AV/DRdVYarjzwfnvcW', '$2y$10$MC/oRT07.kNHLCzujRKzu.wfwc67NTYdK..AV/DRdVYarjzwfnvcW', 'student', '2021-03-03 01:28:32', '2021-03-05 20:14:15'),
(45, 18933889855648, 'Bryson', 'Dominic', 'asdfasdf', 'asdfasd', 23, 'Afghanistan', '$2y$10$MC/oRT07.kNHLCzujRKzu.wfwc67NTYdK..AV/DRdVYarjzwfnvcW', '$2y$10$MC/oRT07.kNHLCzujRKzu.wfwc67NTYdK..AV/DRdVYarjzwfnvcW', 'student', '2021-02-23 17:15:17', '2021-03-05 20:10:46'),
(46, 11446431127385, 'adsfasdf', 'Austin', 'asdfasd', 'asdfasdf', 12, 'Afghanistan', '$2y$10$MC/oRT07.kNHLCzujRKzu.wfwc67NTYdK..AV/DRdVYarjzwfnvcW', '$2y$10$MC/oRT07.kNHLCzujRKzu.wfwc67NTYdK..AV/DRdVYarjzwfnvcW', 'student', '2021-03-03 05:08:09', '2021-03-03 11:27:18'),
(47, 18224933851118, 'asdfasdf', 'Ian', 'asdfasdf', 'asdfasdf', 12, 'Afghanistan', '$2y$10$MC/oRT07.kNHLCzujRKzu.wfwc67NTYdK..AV/DRdVYarjzwfnvcW', '$2y$10$MC/oRT07.kNHLCzujRKzu.wfwc67NTYdK..AV/DRdVYarjzwfnvcW', 'student', '2021-03-06 17:12:17', '2021-03-05 16:00:24'),
(49, 16747873726784, 'asdfasdf', 'Ian', 'asdfasd', 'asdfasd', 12, 'Afghanistan', '$2y$10$MC/oRT07.kNHLCzujRKzu.wfwc67NTYdK..AV/DRdVYarjzwfnvcW', '$2y$10$MC/oRT07.kNHLCzujRKzu.wfwc67NTYdK..AV/DRdVYarjzwfnvcW', 'student', '2021-03-01 17:54:23', '2021-02-23 16:56:19'),
(50, 27054705240581, 'Seminar', 'test', 'test', 'test@gmail.com', 10, 'Afghanistan', '$2y$10$MC/oRT07.kNHLCzujRKzu.wfwc67NTYdK..AV/DRdVYarjzwfnvcW', '$2y$10$MC/oRT07.kNHLCzujRKzu.wfwc67NTYdK..AV/DRdVYarjzwfnvcW', 'student', '2021-02-22 09:12:24', '2021-02-23 07:56:33'),
(51, 42803670603152, 'Naweed', 'Nazari', 'Kabul', 'naweednazari@gmail.com', 10, 'Afghanistan', '$2y$10$MC/oRT07.kNHLCzujRKzu.wfwc67NTYdK..AV/DRdVYarjzwfnvcW', '$2y$10$MC/oRT07.kNHLCzujRKzu.wfwc67NTYdK..AV/DRdVYarjzwfnvcW', 'student', '2021-02-28 11:36:12', '2021-02-23 08:10:04'),
(52, 15756282592211, 'INSERT', 'INSERT', 'INSERT', 'INSERT', 12, 'Afghanistan', '$2y$10$MC/oRT07.kNHLCzujRKzu.wfwc67NTYdK..AV/DRdVYarjzwfnvcW', '$2y$10$MC/oRT07.kNHLCzujRKzu.wfwc67NTYdK..AV/DRdVYarjzwfnvcW', 'student', '2021-02-25 01:41:12', '2021-02-24 12:16:52'),
(53, 63051738704130, 'asdfasdf', 'asdfasdf', 'asdfasdf', 'asdfasdf@gmail.com', 15, 'Afghanistan', '$2y$10$MC/oRT07.kNHLCzujRKzu.wfwc67NTYdK..AV/DRdVYarjzwfnvcW', '$2y$10$MC/oRT07.kNHLCzujRKzu.wfwc67NTYdK..AV/DRdVYarjzwfnvcW', 'student', '2021-03-03 16:54:48', '2021-03-02 08:10:20'),
(54, 58517486632460, 'asdfasdf', 'asdfasdf', 'asdfasdf', 'asdfasdf@gmail.com', 17, 'Afghanistan', '$2y$10$MC/oRT07.kNHLCzujRKzu.wfwc67NTYdK..AV/DRdVYarjzwfnvcW', '$2y$10$MC/oRT07.kNHLCzujRKzu.wfwc67NTYdK..AV/DRdVYarjzwfnvcW', 'student', '2021-03-05 02:47:45', '2021-02-27 23:17:15'),
(56, 58574236318147, 'Name updated', 'sdfasdfas', 'dfasdf', 'asdfasdfasd@gmail.com', 7, 'Afghanistan', '$2y$10$MC/oRT07.kNHLCzujRKzu.wfwc67NTYdK..AV/DRdVYarjzwfnvcW', '$2y$10$MC/oRT07.kNHLCzujRKzu.wfwc67NTYdK..AV/DRdVYarjzwfnvcW', 'student', '2021-03-06 06:31:42', '2021-02-26 15:11:28'),
(57, 14604327012522, 'asdfasdf', 'asdfasdf', 'asdfasdf', 'asdfasdf@gmail.com', 16, 'Afghanistan', '$2y$10$MC/oRT07.kNHLCzujRKzu.wfwc67NTYdK..AV/DRdVYarjzwfnvcW', '$2y$10$MC/oRT07.kNHLCzujRKzu.wfwc67NTYdK..AV/DRdVYarjzwfnvcW', 'student', '2021-03-07 19:32:40', '2021-02-27 01:21:48'),
(58, 42773036300353, 'asdfasdf', 'adsfasdf', 'asdfasdf', 'asdfasdh@gmail.cm', 15, 'Afghanistan', '$2y$10$MC/oRT07.kNHLCzujRKzu.wfwc67NTYdK..AV/DRdVYarjzwfnvcW', '$2y$10$MC/oRT07.kNHLCzujRKzu.wfwc67NTYdK..AV/DRdVYarjzwfnvcW', 'student', '2021-02-26 01:25:34', '2021-03-05 04:30:50'),
(59, 20584232423423, 'asdfasdfasd', 'asdfasdf', 'asdfasdf', 'asdfasdf@gmail.com', 19, 'Afghanistan', '$2y$10$MC/oRT07.kNHLCzujRKzu.wfwc67NTYdK..AV/DRdVYarjzwfnvcW', '$2y$10$MC/oRT07.kNHLCzujRKzu.wfwc67NTYdK..AV/DRdVYarjzwfnvcW', 'student', '2021-02-28 15:47:13', '2021-03-06 13:44:56'),
(60, 82487346006071, 'Name updated', 'asdfasdf', 'asdfasdf', 'asdfklj@gmail.cmo', 9, 'Afghanistan', '$2y$10$MC/oRT07.kNHLCzujRKzu.wfwc67NTYdK..AV/DRdVYarjzwfnvcW', '$2y$10$MC/oRT07.kNHLCzujRKzu.wfwc67NTYdK..AV/DRdVYarjzwfnvcW', 'student', '2021-02-28 21:56:46', '2021-02-23 02:28:24'),
(61, 84574802185024, 'Asdfa', 'Asdfa', 'asdf', 'adsfasdf@gmail.com', 18, 'Afghanistan', '$2y$10$MC/oRT07.kNHLCzujRKzu.wfwc67NTYdK..AV/DRdVYarjzwfnvcW', '$2y$10$MC/oRT07.kNHLCzujRKzu.wfwc67NTYdK..AV/DRdVYarjzwfnvcW', 'student', '2021-02-22 09:39:33', '2021-03-03 14:23:25'),
(62, 87206712581231, 'Asdf', 'Asdf', 'asdf', 'asdf@gmail.com', 19, 'Afghanistan', '$2y$10$MC/oRT07.kNHLCzujRKzu.wfwc67NTYdK..AV/DRdVYarjzwfnvcW', '$2y$10$MC/oRT07.kNHLCzujRKzu.wfwc67NTYdK..AV/DRdVYarjzwfnvcW', 'student', '2021-03-03 01:44:49', '2021-02-24 11:48:06'),
(63, 98720671258123, 'Asdf', 'Asdf', 'asdf', 'asdf@gmail.com', 15, 'Afghanistan', '$2y$10$MC/oRT07.kNHLCzujRKzu.wfwc67NTYdK..AV/DRdVYarjzwfnvcW', '$2y$10$MC/oRT07.kNHLCzujRKzu.wfwc67NTYdK..AV/DRdVYarjzwfnvcW', 'student', '2021-02-23 23:02:48', '2021-03-05 11:06:28'),
(64, 98720671258111, 'Asdf', 'ddddddd', 'asdf', 'asdf@gmail.com', 15, 'Afghanistan', '$2y$10$MC/oRT07.kNHLCzujRKzu.wfwc67NTYdK..AV/DRdVYarjzwfnvcW', '$2y$10$MC/oRT07.kNHLCzujRKzu.wfwc67NTYdK..AV/DRdVYarjzwfnvcW', 'student', '2021-03-04 09:16:55', '2021-03-01 15:24:15'),
(65, 16328062132605, 'Asdf', 'Asdfas', 'adsfasdf', 'sdfasdf@gmail.com', 12, 'Afghanistan', '$2y$10$MC/oRT07.kNHLCzujRKzu.wfwc67NTYdK..AV/DRdVYarjzwfnvcW', '$2y$10$MC/oRT07.kNHLCzujRKzu.wfwc67NTYdK..AV/DRdVYarjzwfnvcW', 'student', '2021-02-25 20:33:34', '2021-02-25 14:58:03'),
(66, 26242752772112, 'Ad', 'Adf', 'asdf', 'asfasdf@gmail.com', 12, 'Afghanistan', '$2y$10$MC/oRT07.kNHLCzujRKzu.wfwc67NTYdK..AV/DRdVYarjzwfnvcW', '$2y$10$MC/oRT07.kNHLCzujRKzu.wfwc67NTYdK..AV/DRdVYarjzwfnvcW', 'student', '2021-02-23 22:14:29', '2021-03-02 23:53:42'),
(67, 73477631735544, 'Asdf', 'Asdfasdf', 'asdfasdf', 'aksdfj@gmail.com', 18, 'Afghanistan', '$2y$10$MC/oRT07.kNHLCzujRKzu.wfwc67NTYdK..AV/DRdVYarjzwfnvcW', '$2y$10$MC/oRT07.kNHLCzujRKzu.wfwc67NTYdK..AV/DRdVYarjzwfnvcW', 'student', '2021-03-05 20:49:04', '2021-02-27 21:50:33'),
(68, 47228610344232, 'Asdf', 'Asdf', 'asdf', 'asdfasdf@gmail.com', 19, 'Afghanistan', '$2y$10$MC/oRT07.kNHLCzujRKzu.wfwc67NTYdK..AV/DRdVYarjzwfnvcW', '$2y$10$MC/oRT07.kNHLCzujRKzu.wfwc67NTYdK..AV/DRdVYarjzwfnvcW', 'student', '2021-03-05 08:39:16', '2021-02-24 08:47:50'),
(69, 47228610344111, 'Asdf', 'Asdf', 'asdf', 'asdfasdf@gmail.com', 19, 'Afghanistan', '$2y$10$MC/oRT07.kNHLCzujRKzu.wfwc67NTYdK..AV/DRdVYarjzwfnvcW', '$2y$10$MC/oRT07.kNHLCzujRKzu.wfwc67NTYdK..AV/DRdVYarjzwfnvcW', 'student', '2021-03-01 00:06:30', '2021-03-01 21:43:44'),
(78, 47228610344222, 'Asdf', 'Asdf', 'asdf', 'asdfasdf@gmail.com', 19, 'Afghanistan', '$2y$10$MC/oRT07.kNHLCzujRKzu.wfwc67NTYdK..AV/DRdVYarjzwfnvcW', '$2y$10$MC/oRT07.kNHLCzujRKzu.wfwc67NTYdK..AV/DRdVYarjzwfnvcW', 'student', '2021-02-22 17:52:06', '2021-02-26 05:31:22'),
(80, 47228610344221, 'Asdf', 'Asdf', 'asdf', 'asdfasdf@gmail.com', 19, 'Afghanistan', '$2y$10$MC/oRT07.kNHLCzujRKzu.wfwc67NTYdK..AV/DRdVYarjzwfnvcW', '$2y$10$MC/oRT07.kNHLCzujRKzu.wfwc67NTYdK..AV/DRdVYarjzwfnvcW', 'student', '2021-03-04 12:18:20', '2021-03-05 05:41:50'),
(81, 47228610344229, 'Asdf', 'Asdf', 'asdf', 'asdfasdf@gmail.com', 19, 'Afghanistan', '$2y$10$MC/oRT07.kNHLCzujRKzu.wfwc67NTYdK..AV/DRdVYarjzwfnvcW', '$2y$10$MC/oRT07.kNHLCzujRKzu.wfwc67NTYdK..AV/DRdVYarjzwfnvcW', 'student', '2021-03-02 03:12:45', '2021-02-23 07:11:19'),
(82, 47228610344266, 'Asdf', 'Asdf', 'asdf', 'asdfasdf@gmail.com', 19, 'Afghanistan', '$2y$10$MC/oRT07.kNHLCzujRKzu.wfwc67NTYdK..AV/DRdVYarjzwfnvcW', '$2y$10$MC/oRT07.kNHLCzujRKzu.wfwc67NTYdK..AV/DRdVYarjzwfnvcW', 'student', '2021-03-02 22:26:06', '2021-02-22 14:07:15');
--
-- Triggers `student`
--
DELIMITER $$
CREATE TRIGGER `insert_family_name` AFTER INSERT ON `student` FOR EACH ROW BEGIN
INSERT INTO family(nim, familyname ) VALUES (new.nim, new.lastname);
END
$$
DELIMITER ;
DELIMITER $$
CREATE TRIGGER `insert_profile` AFTER INSERT ON `student` FOR EACH ROW BEGIN
INSERT INTO student_details (nim)
VALUES(NEW.nim );
END
$$
DELIMITER ;
-- --------------------------------------------------------
--
-- Table structure for table `studentlastlogged`
--
CREATE TABLE `studentlastlogged` (
`id` int(11) NOT NULL,
`loggedtime` timestamp NOT NULL DEFAULT current_timestamp(),
`nim` bigint(20) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `studentlastlogged`
--
INSERT INTO `studentlastlogged` (`id`, `loggedtime`, `nim`) VALUES
(1, '2020-11-25 18:29:39', 83789553791438),
(2, '2020-11-26 02:19:25', 98720671258111),
(3, '2020-11-26 02:24:16', 84574802185024),
(4, '2020-11-26 02:58:27', 47228610344232),
(5, '2020-12-13 15:47:54', 99325320048831),
(6, '2021-03-03 09:15:52', 11446431127385);
-- --------------------------------------------------------
--
-- Table structure for table `student_details`
--
CREATE TABLE `student_details` (
`id` int(11) NOT NULL,
`nim` bigint(20) DEFAULT NULL,
`bio` text DEFAULT NULL,
`facebook` varchar(100) DEFAULT NULL,
`youtube` varchar(100) DEFAULT NULL,
`instagram` varchar(100) DEFAULT NULL,
`twitter` varchar(100) DEFAULT NULL,
`location` varchar(100) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `student_details`
--
INSERT INTO `student_details` (`id`, `nim`, `bio`, `facebook`, `youtube`, `instagram`, `twitter`, `location`) VALUES
(1, 83789553791438, 'I\'m Saboor, majoring Information System, I\'m specialist on Java computer Language, PHP, MySQL, SQL, HTML CSS, and a little JavaScript and jQuery', 'https://web.facebook.com/saboor.hamedi.7/', 'https://www.youtube.com/channel/UCssGbxijAmdGv7kjmOpNinA?view_as=subscriber', 'https://www.instagram.com/hamedisaboor/', '', 'Indonesia'),
(2, 9223372036854775807, 'Hello I\'m Liam from America', 'https://www.facebook.com', '', '', '', 'America'),
(4, 22092393858586, 'Hello everyone, I\'m James from America, I came here to study and I love this place wooo', '', '', '', '', ''),
(8, 12367227813729, '', 'https://web.facebook.com/', 'https://web.youtube.com/', 'https://www.instagram.com/', 'https://twitter.com/', 'America'),
(9, 98720671258111, NULL, NULL, NULL, NULL, NULL, NULL),
(10, 16328062132605, NULL, NULL, NULL, NULL, NULL, NULL),
(11, 26242752772112, NULL, NULL, NULL, NULL, NULL, NULL),
(12, 73477631735544, NULL, NULL, NULL, NULL, NULL, NULL),
(13, 47228610344232, 'asdfasdfasdf', '', '', '', '', ''),
(14, 47228610344111, NULL, NULL, NULL, NULL, NULL, NULL),
(23, 47228610344222, NULL, NULL, NULL, NULL, NULL, NULL),
(24, 807382473145, NULL, NULL, NULL, NULL, NULL, NULL),
(25, 47228610344221, NULL, NULL, NULL, NULL, NULL, NULL),
(26, 47228610344229, NULL, NULL, NULL, NULL, NULL, NULL),
(27, 47228610344266, NULL, NULL, NULL, NULL, NULL, NULL);
-- --------------------------------------------------------
--
-- Table structure for table `subjects`
--
CREATE TABLE `subjects` (
`sub_id` int(10) UNSIGNED NOT NULL,
`subjectid` int(11) NOT NULL,
`subjectname` varchar(30) NOT NULL,
`subjectcode` varchar(15) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `subjects`
--
INSERT INTO `subjects` (`sub_id`, `subjectid`, `subjectname`, `subjectcode`) VALUES
(1, 73218, 'Language Arts', 'L1AS'),
(2, 89124, 'Language Arts', 'ALU1'),
(4, 23412, 'History', 'H13D'),
(5, 35216, 'Music', 'YN7U'),
(6, 9314, 'Anthropology', 'L8JY'),
(7, 26156, 'Area Studies', 'KTWA'),
(8, 11511, 'Geography', 'TOBK'),
(9, 9298, 'Area Studies', 'BGC1'),
(10, 54566, 'Physics', '6AV7'),
(11, 28297, 'Mathematics', 'HTBG'),
(12, 30183, 'Life Sciences', 'KLWT'),
(13, 5561, 'Library and Museum Studies', 'ECUP'),
(14, 72186, 'Gender and Sexuality Studies', '4NPI'),
(15, 30011, 'Logic', '4861'),
(16, 25442, 'Anthropology', 'PDXC');
-- --------------------------------------------------------
--
-- Table structure for table `teacher`
--
CREATE TABLE `teacher` (
`tec_id` int(10) UNSIGNED NOT NULL,
`teacherid` bigint(20) NOT NULL,
`tname` varchar(30) NOT NULL,
`lastname` varchar(30) NOT NULL,
`address` varchar(70) NOT NULL,
`country` varchar(30) NOT NULL,
`profession` varchar(30) NOT NULL,
`teacher_image` blob DEFAULT NULL,
`pass` text NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `teacher`
--
INSERT INTO `teacher` (`tec_id`, `teacherid`, `tname`, `lastname`, `address`, `country`, `profession`, `teacher_image`, `pass`) VALUES
(1, 43632372818789, 'Wahid', 'Rahimi', 'Kabul', 'Afghanistan', 'Language professional', '', '123'),
(2, 17352183302292, 'Aahron', 'Seminar', 'Indonesia', '123', 'English literature', NULL, '123'),
(3, 73401312312453, 'Abrahaim', 'Abraham', 'Indonesia / Banten /Ciputat', 'Indonesia', 'Database administrator', NULL, '123'),
(4, 89643142801876, 'Abrahame', 'Abrahamo', 'asdfasdf', 'asdfasd', 'HTML ', NULL, '123'),
(5, 18154898755021, 'Abrahem', 'Abrahim', 'asdfasd', 'asdfas', 'HTML ', NULL, '123'),
(6, 47526615248432, 'Abrahm', 'Abrahon', 'akjdfhj', 'ajksdk', 'HTML ', NULL, '123'),
(7, 80605444465409, 'Master', 'asdf', 'asdfasdf', 'asdf', 'Languages (French, German, Spa', NULL, '123'),
(13, 42030737204174, 'Hello', 'Aaaaa', 'ddd', 'dd', 'dd', NULL, 'ddd'),
(14, 69099177388586, 'I have been updated', 'ddd', 'dddd', 'dddd', 'ddd', NULL, 'ddddd'),
(15, 34795397823220, 'ttt', 'ttt', 'ttt', 'ttt', 'ttt', NULL, 'ttt'),
(17, 64772801440232, 'asdf', 'asdf', 'asdf', 'asdfsd', 'fas', NULL, 'df'),
(18, 59350092051029, 'adf', 'sd', 'asdf', 'asdfa', 'sdf', NULL, 'sdf'),
(19, 92254794233844, 'yy', 'yy', 'yy', 'yy', 'yy', NULL, 'yy'),
(20, 83749561560103, 'hh', 'hh', 'hhh', 'hhh', 'hh', NULL, 'hh'),
(21, 91926932801454, 'Update', 'asdf', 'sadf', 'asdf', 'asdf', NULL, 'asdf'),
(22, 81066846838163, 'zzzz', 'zzzzz', 'zz', 'zz', 'zz', NULL, 'zz'),
(23, 23216118716884, 'baa', 'baa', 'baa', 'baa', 'baa', NULL, 'baa'),
(24, 50633102117110, 'vvv', 'vvv', 'vvv', 'vvv', 'vvv', NULL, 'vvv'),
(26, 28152121636563, 'asd', 'asdf', 'asd', 'asd', 'adf', NULL, 'adf'),
(27, 16531540007126, 'adf', 'asdfa', 'asdf', 'asdf', 'asdf', NULL, 'asdf'),
(28, 38635016401032, 'asdfa', 'f', 'asdf', 'asdf', 'asdf', NULL, 'f'),
(29, 15063310211710, 'asdf', 'asdfa', 'sdf', 'asdf', 'asdf', NULL, 'asdf'),
(30, 37003180416506, 'asdf', 'adsfa', 'sdf', 'asdf', 'asd', NULL, 'asdf'),
(31, 11506331021171, 'load', 'load', 'load', 'load', 'load', NULL, 'load'),
(32, 45820530160604, 'asdf', 'sdf', 'sdf', 'sdf', 'sdf', NULL, 'faadfasdf'),
(34, 12402256447111, 'Hello update', 'Asdf', 'asd', 'asdf', 'asdf', NULL, 'asdf'),
(35, 32744456284682, 'asdfasdf', 'asdf', 'sdfasdfas', 'asdfasdf', 'asdfasdf', NULL, 'asdfasdf'),
(36, 38783260050634, 'asdfasdf', 'sdfasd', 'sdfasdf', 'asdfasdf', 'asdfasdf', NULL, 'asdfasdf'),
(37, 10077248248021, 'asdfasdf', 'sdfasdf', 'asd', 'asdfasdf', 'asdfasdf', NULL, 'asdfasdfasdf'),
(39, 74216405655385, 'asdfa', 'asdf', 'asdf', 'adsf', 'asdf', NULL, 'adsf'),
(40, 30546167287573, 'adf', 'adf', 'asdf', 'asdf', 'asdf', NULL, 'adf'),
(41, 56465543217841, 'asdf', 'asdf', 'asdf', 'asdf', 'asdf', NULL, 'asdf'),
(42, 33463818527321, 'asdfa', 'sdf', 'asdf', 'asdf', 'asdf', NULL, 'asdf'),
(43, 45845467738827, 'asdf', 'adsf', 'asdfa', 'sdf', 'asdf', NULL, 'aaaaa'),
(44, 44332164521542, 'asdf', 'asdf', 'asdf', 'asdf', 'asdf', NULL, 'asdf'),
(45, 27108851235771, 'adfa', 'dsfa', 'asdfa', 'sdf', 'asdfadsf', NULL, 'asdf'),
(52, 56072142213523, 'asdf', 'asdfas', 'df', 'asdfasdf', 'asdf', NULL, 'asdfasdf'),
(53, 51630688122034, 'Hello', 'Asdfasdf', 'asdfasdf', 'asdfasdf', 'asdfasdf', NULL, 'asdfasdf'),
(54, 75683756446514, 'asdfasdf', 'asdfasdf', 'adsfasd', 'asdfasdf', 'asdfasdf', NULL, 'asdfasdf'),
(55, 62817213425052, 'asdf', 'asdf', 'asdfasdf', 'asdfasdf', 'asdfasdf', NULL, 'asdfasdfasdf'),
(56, 15817077276055, 'asdfa', 'asdf', 'aasdf', 'asdf', 'asdf', NULL, 'asdf'),
(57, 56871005568266, 'asd', 'asdf', 'asdf', 'asdf', 'asdf', NULL, 'sdfasdf'),
(58, 11764224311068, 'asdf', 'asdf', 'asdf', 'asdf', 'asdfasdf', NULL, 'asdf'),
(59, 15518143362070, 'asdfasdf', 'fasdf', 'asdf', 'asdf', 'asdf', NULL, 'asdfsdfasdf'),
(60, 31084335760364, 'asdfasdf', 'asdfasdf', 'asdf', 'asdfasdf', 'asdfasdf', NULL, 'asdfasdf'),
(61, 41373888047751, 'Asdf', 'Asdf', 'df', 'Asdf', 'asdf', NULL, 'asdf');
-- --------------------------------------------------------
--
-- Table structure for table `users`
--
CREATE TABLE `users` (
`id` int(10) UNSIGNED NOT NULL,
`name` varchar(50) DEFAULT NULL,
`texts` text DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `users`
--
INSERT INTO `users` (`id`, `name`, `texts`) VALUES
(1, NULL, NULL),
(2, NULL, NULL),
(3, 'Hello world', NULL),
(4, NULL, 'Hello world');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `academic_year`
--
ALTER TABLE `academic_year`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `year_name` (`year_name`);
--
-- Indexes for table `adminlastloggedin`
--
ALTER TABLE `adminlastloggedin`
ADD PRIMARY KEY (`id`),
ADD KEY `admin_nim` (`admin_nim`);
--
-- Indexes for table `agency`
--
ALTER TABLE `agency`
ADD PRIMARY KEY (`id`),
ADD KEY `student_id` (`student_id`);
--
-- Indexes for table `all_subjects`
--
ALTER TABLE `all_subjects`
ADD PRIMARY KEY (`all_subjectid`);
--
-- Indexes for table `classes`
--
ALTER TABLE `classes`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `class_code` (`class_code`),
ADD KEY `classes_ibfk_1` (`subjectid`),
ADD KEY `classes_ibfk_2` (`teacherid`),
ADD KEY `classes_ibfk_3` (`nim`),
ADD KEY `class_grade` (`class_grade`),
ADD KEY `start_time` (`year_name`);
--
-- Indexes for table `class_grade_student`
--
ALTER TABLE `class_grade_student`
ADD PRIMARY KEY (`student_class_id`),
ADD UNIQUE KEY `class_grade` (`class_grade`);
--
-- Indexes for table `courses`
--
ALTER TABLE `courses`
ADD PRIMARY KEY (`id`),
ADD KEY `user_id` (`user_id`);
--
-- Indexes for table `eletter`
--
ALTER TABLE `eletter`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `event`
--
ALTER TABLE `event`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `family`
--
ALTER TABLE `family`
ADD PRIMARY KEY (`family_id`),
ADD KEY `nim` (`nim`);
--
-- Indexes for table `files`
--
ALTER TABLE `files`
ADD PRIMARY KEY (`file_id`),
ADD KEY `nim` (`nim`),
ADD KEY `teacherid` (`teacherid`);
--
-- Indexes for table `grades`
--
ALTER TABLE `grades`
ADD PRIMARY KEY (`grade_id`),
ADD KEY `nim` (`nim`),
ADD KEY `teacherid` (`teacherid`),
ADD KEY `subjectid` (`subjectid`),
ADD KEY `class_grade_id` (`class_grade_id`);
--
-- Indexes for table `login`
--
ALTER TABLE `login`
ADD PRIMARY KEY (`admin_id`),
ADD UNIQUE KEY `admin_nim` (`admin_nim`);
--
-- Indexes for table `parent`
--
ALTER TABLE `parent`
ADD PRIMARY KEY (`parent_id`),
ADD KEY `nim` (`nim`),
ADD KEY `family_id` (`family_id`);
--
-- Indexes for table `password_resets`
--
ALTER TABLE `password_resets`
ADD KEY `password_resets_email_index` (`email`);
--
-- Indexes for table `post`
--
ALTER TABLE `post`
ADD PRIMARY KEY (`id`),
ADD KEY `author_id` (`author_id`);
--
-- Indexes for table `professions`
--
ALTER TABLE `professions`
ADD PRIMARY KEY (`profession_id`);
--
-- Indexes for table `recommendationletter`
--
ALTER TABLE `recommendationletter`
ADD PRIMARY KEY (`id`),
ADD KEY `nim` (`nim`);
--
-- Indexes for table `student`
--
ALTER TABLE `student`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `nim` (`nim`);
--
-- Indexes for table `studentlastlogged`
--
ALTER TABLE `studentlastlogged`
ADD PRIMARY KEY (`id`),
ADD KEY `nim` (`nim`);
--
-- Indexes for table `student_details`
--
ALTER TABLE `student_details`
ADD PRIMARY KEY (`id`),
ADD KEY `nim` (`nim`);
--
-- Indexes for table `subjects`
--
ALTER TABLE `subjects`
ADD PRIMARY KEY (`sub_id`),
ADD UNIQUE KEY `subjectid` (`subjectid`);
--
-- Indexes for table `teacher`
--
ALTER TABLE `teacher`
ADD PRIMARY KEY (`tec_id`),
ADD UNIQUE KEY `teacherid` (`teacherid`);
--
-- Indexes for table `users`
--
ALTER TABLE `users`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `academic_year`
--
ALTER TABLE `academic_year`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=23;
--
-- AUTO_INCREMENT for table `adminlastloggedin`
--
ALTER TABLE `adminlastloggedin`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT for table `agency`
--
ALTER TABLE `agency`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=84;
--
-- AUTO_INCREMENT for table `all_subjects`
--
ALTER TABLE `all_subjects`
MODIFY `all_subjectid` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=38;
--
-- AUTO_INCREMENT for table `classes`
--
ALTER TABLE `classes`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=64;
--
-- AUTO_INCREMENT for table `class_grade_student`
--
ALTER TABLE `class_grade_student`
MODIFY `student_class_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=13;
--
-- AUTO_INCREMENT for table `courses`
--
ALTER TABLE `courses`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7;
--
-- AUTO_INCREMENT for table `eletter`
--
ALTER TABLE `eletter`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=30;
--
-- AUTO_INCREMENT for table `event`
--
ALTER TABLE `event`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
--
-- AUTO_INCREMENT for table `family`
--
ALTER TABLE `family`
MODIFY `family_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=55;
--
-- AUTO_INCREMENT for table `files`
--
ALTER TABLE `files`
MODIFY `file_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=29;
--
-- AUTO_INCREMENT for table `grades`
--
ALTER TABLE `grades`
MODIFY `grade_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=9;
--
-- AUTO_INCREMENT for table `login`
--
ALTER TABLE `login`
MODIFY `admin_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=14;
--
-- AUTO_INCREMENT for table `parent`
--
ALTER TABLE `parent`
MODIFY `parent_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=52;
--
-- AUTO_INCREMENT for table `post`
--
ALTER TABLE `post`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT for table `professions`
--
ALTER TABLE `professions`
MODIFY `profession_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=35;
--
-- AUTO_INCREMENT for table `recommendationletter`
--
ALTER TABLE `recommendationletter`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;
--
-- AUTO_INCREMENT for table `student`
--
ALTER TABLE `student`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=83;
--
-- AUTO_INCREMENT for table `studentlastlogged`
--
ALTER TABLE `studentlastlogged`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7;
--
-- AUTO_INCREMENT for table `student_details`
--
ALTER TABLE `student_details`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=28;
--
-- AUTO_INCREMENT for table `subjects`
--
ALTER TABLE `subjects`
MODIFY `sub_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=17;
--
-- AUTO_INCREMENT for table `teacher`
--
ALTER TABLE `teacher`
MODIFY `tec_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=62;
--
-- AUTO_INCREMENT for table `users`
--
ALTER TABLE `users`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
--
-- Constraints for dumped tables
--
--
-- Constraints for table `adminlastloggedin`
--
ALTER TABLE `adminlastloggedin`
ADD CONSTRAINT `adminlastloggedin_ibfk_2` FOREIGN KEY (`admin_nim`) REFERENCES `login` (`admin_nim`);
--
-- Constraints for table `agency`
--
ALTER TABLE `agency`
ADD CONSTRAINT `agency_ibfk_1` FOREIGN KEY (`student_id`) REFERENCES `student` (`nim`) ON DELETE CASCADE;
--
-- Constraints for table `classes`
--
ALTER TABLE `classes`
ADD CONSTRAINT `classes_ibfk_1` FOREIGN KEY (`subjectid`) REFERENCES `subjects` (`subjectid`),
ADD CONSTRAINT `classes_ibfk_2` FOREIGN KEY (`teacherid`) REFERENCES `teacher` (`teacherid`),
ADD CONSTRAINT `classes_ibfk_4` FOREIGN KEY (`class_grade`) REFERENCES `class_grade_student` (`class_grade`),
ADD CONSTRAINT `classes_ibfk_5` FOREIGN KEY (`year_name`) REFERENCES `academic_year` (`year_name`),
ADD CONSTRAINT `classes_ibfk_6` FOREIGN KEY (`nim`) REFERENCES `student` (`nim`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Constraints for table `courses`
--
ALTER TABLE `courses`
ADD CONSTRAINT `courses_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `login` (`admin_nim`) ON DELETE CASCADE;
--
-- Constraints for table `family`
--
ALTER TABLE `family`
ADD CONSTRAINT `family_ibfk_1` FOREIGN KEY (`nim`) REFERENCES `student` (`nim`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Constraints for table `files`
--
ALTER TABLE `files`
ADD CONSTRAINT `files_ibfk_1` FOREIGN KEY (`nim`) REFERENCES `student` (`nim`),
ADD CONSTRAINT `files_ibfk_2` FOREIGN KEY (`teacherid`) REFERENCES `teacher` (`teacherid`);
--
-- Constraints for table `grades`
--
ALTER TABLE `grades`
ADD CONSTRAINT `grades_ibfk_1` FOREIGN KEY (`nim`) REFERENCES `student` (`nim`),
ADD CONSTRAINT `grades_ibfk_2` FOREIGN KEY (`teacherid`) REFERENCES `teacher` (`teacherid`),
ADD CONSTRAINT `grades_ibfk_3` FOREIGN KEY (`subjectid`) REFERENCES `subjects` (`subjectid`),
ADD CONSTRAINT `grades_ibfk_4` FOREIGN KEY (`class_grade_id`) REFERENCES `classes` (`class_grade`);
--
-- Constraints for table `parent`
--
ALTER TABLE `parent`
ADD CONSTRAINT `parent_ibfk_1` FOREIGN KEY (`nim`) REFERENCES `student` (`nim`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `parent_ibfk_2` FOREIGN KEY (`family_id`) REFERENCES `family` (`family_id`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Constraints for table `post`
--
ALTER TABLE `post`
ADD CONSTRAINT `post_ibfk_1` FOREIGN KEY (`author_id`) REFERENCES `student` (`nim`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Constraints for table `recommendationletter`
--
ALTER TABLE `recommendationletter`
ADD CONSTRAINT `recommendationletter_ibfk_1` FOREIGN KEY (`nim`) REFERENCES `student` (`nim`) ON DELETE CASCADE;
--
-- Constraints for table `studentlastlogged`
--
ALTER TABLE `studentlastlogged`
ADD CONSTRAINT `studentlastlogged_ibfk_1` FOREIGN KEY (`nim`) REFERENCES `student` (`nim`);
--
-- Constraints for table `student_details`
--
ALTER TABLE `student_details`
ADD CONSTRAINT `student_details_ibfk_1` FOREIGN KEY (`nim`) REFERENCES `student` (`nim`);
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 */;
|
CREATE TABLE IF NOT EXISTS posts (
id uuid DEFAULT uuid_generate_v4(),
name VARCHAR(255) NOT NULL,
slug VARCHAR(255) UNIQUE NOT NULL,
topic_id uuid NOT NULL,
author_id uuid NOT NULL,
content TEXT NOT NULL,
created_at timestamp,
updated_at timestamp,
PRIMARY KEY (id)
);
|
/* Add an index on organization name */
create index org_name_idx on ORGANIZATIONS (name(200));
|
select `n_name`
from `nation`
where `n_nationkey` in (select `r_regionkey`
from `region`) |
/* Question 6 */
/* Make every individual who's older than 50
* subscribe as a trial for a month to the senior healthplan (110) in case
* they did not yet subscribe to it */
INSERT
INTO
subscriptions SELECT
DISTINCT I.cid,
110,
'2018-02-28'::DATE,
'2018-03-29'::DATE
FROM
individuals I
WHERE
age(
CURRENT_DATE,
I.birthdate
)>= '50 years'
AND NOT EXISTS(
SELECT
*
FROM
individuals It,
subscriptions S
WHERE
It.cid = I.cid
AND S.planid = 110
);
/* Increase the price of every insurance plans every new year
* by 1% to account for inflation */
UPDATE
insuranceplans
SET
price = price*1.01
WHERE
EXTRACT(
MONTH
FROM
CURRENT_DATE
)= 1
AND EXTRACT(
DAY
FROM
CURRENT_DATE
)= 1;
/* Delete all the drugs that are neither in any covers nor in prescriptions contents */
DELETE
FROM
Drugs D
WHERE
NOT EXISTS(
SELECT
C.duid
FROM
covers C,
prescriptioncontents P
WHERE
C.duid = D.duid
OR P.duid = D.duid
);
/* Delete any pharmacists not registerd in the pharmacists table or if they have not given any receipts
* or prescription */
DELETE
FROM
healthpractitioners H
WHERE
H.specialization = 'Pharmacist'
AND NOT EXISTS(
SELECT
Ph.did
FROM
pharmacists Ph,
receipts R,
prescriptions Pr
WHERE
Ph.did = R.did
AND(
H.did = Ph.did
OR Pr.did = Ph.did
)
); |
<RCC>
<qresource>
<file alias = 'pic.png'>./pic.png</file>
</qresource>
</RCC> |
CREATE TABLE Aluno (
id_aluno integer not null,
nome character varying(15) not null,
sobrenome character varying(15) not null,
data_de_inicio date not null,
rua character varying(30),
numero integer not null,
bairro character varying(20),
cidade character varying(20),
email character varying(40),
primary key (id_aluno)
);
CREATE TABLE A_Telefone (
id_aluno integer not null,
numero integer not null,
primary key (id_aluno)
);
CREATE TABLE Departamento (
id_dep integer not null,
nome character varying(15),
sala integer not null,
primary key (id_dep)
);
CREATE TABLE Modalidade (
mid integer not null,
nome character varying(15),
id_dep integer not null,
primary key (mid),
foreign key (id_dep) references Departamento(id_dep)
);
CREATE TABLE Professor (
id_prof integer not null,
nome character varying(15) not null,
sobrenome character varying(15) not null,
rua character varying(30),
numero integer not null,
bairro character varying(20),
cidade character varying(20),
email character varying(40),
salario numeric(10,2),
primary key (id_prof)
);
CREATE TABLE Turma (
id_turma integer not null,
turno character(1),
id_prof integer not null,
mid integer not null,
primary key (id_turma),
foreign key (id_prof) references Professor(id_prof),
foreign key (mid) references Modalidade(mid)
);
CREATE TABLE Alunos_Turma (
id_aluno integer not null references Aluno(id_aluno),
nome character varying(15) not null,
sobrenome character varying(15) not null,
data_de_inicio date not null,
rua character varying(30),
numero integer not null,
bairro character varying(20),
cidade character varying(20),
email character varying(40),
id_turma integer not null references Turma(id_turma),
turno character(1),
id_prof integer not null,
mid integer not null,
primary key (id_aluno,id_turma),
foreign key (id_prof) references Professor(id_prof),
foreign key (mid) references Modalidade(mid)
);
CREATE TABLE P_Telefone (
id_prof integer not null,
numero integer not null,
primary key (id_prof)
);
|
CREATE VIEW [display].[kb_use_v]
AS
SELECT
--TOP (100)
--Dates/Users
[display].[kb_use].[sys_updated_on_display_value] AS [sys updated on display value_text],
TRY_CONVERT(DATETIME, [display].[kb_use].[sys_updated_on_display_value]) AS [sys updated on display value],
--IDs
[display].[kb_use].[sys_id_display_value] AS [sys id display value],
--Desc
[display].[kb_use].[article_display_value] AS [article display value],
[display].[kb_use].[used_display_value] AS [used display value],
[display].[kb_use].[viewed_display_value] AS [viewed display value],
[display].[kb_use].[times_viewed_display_value] AS [times viewed display value]
FROM [display].[kb_use]
|
CREATE TABLE statistic (
id SERIAL PRIMARY KEY,
request varchar(256),
answer varchar(2048),
dt timestamp
); |
# Host: localhost (Version: 5.6.14)
# Date: 2014-05-19 23:06:56
# Generator: MySQL-Front 5.3 (Build 4.108)
/*!40101 SET NAMES utf8 */;
#
# Data for table "regcuenta"
#
INSERT INTO `regcuenta` (`idRegCuenta`,`desRegCuenta`,`fecha`) VALUES (7,'ic','2013-12-31 00:00:00');
|
-- Project Name : hr_labor_management
-- Date/Time : 2019/9/10 星期二 22:52:59
-- Author : q4296
-- RDBMS Type : MySQL
-- Application : A5:SQL Mk-2
/*
BackupToTempTable, RestoreFromTempTable疑似命令が付加されています。
これにより、drop table, create table 後もデータが残ります。
この機能は一時的に $$TableName のような一時テーブルを作成します。
*/
-- 社員情報
--* RestoreFromTempTable
CREATE TABLE IF NOT EXISTS hr_labor_management.EMPLOYEE_INFO (
EMPLOYEE_ID INT UNSIGNED not null AUTO_INCREMENT comment '社員番号'
, FULL_NAME VARCHAR (50) not null comment '氏名'
, BIRTHDATE DATE not null comment '生年月日'
, SEX INT not null comment '性別'
, ENTERING_COMPANY_DATE DATE not null comment '入社日'
, QUITTING_DATE DATE comment '退社日'
, E_MAIL VARCHAR (50) comment 'メール'
, TELEPHONE VARCHAR (50) comment '電話'
, DUTY VARCHAR (50) comment '職務'
, BUSINESS_CAREER VARCHAR (50) comment '業務経歴'
, EDUCATIONAL_BACKGROUND VARCHAR (50) comment '学歴'
, PAYROLL_PREFERENCE VARCHAR (50) comment '給与設定'
, INSURANCE VARCHAR (50) comment '保険'
, ATTACHMENT VARCHAR (50) comment '添付'
, SKILL VARCHAR (50) comment 'スキル'
, constraint EMPLOYEE_INFO_PKC primary key (EMPLOYEE_ID)
) comment '社員情報';
|
-- phpMyAdmin SQL Dump
-- version 3.5.0
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: May 11, 2012 at 09:25 AM
-- Server version: 5.1.61
-- PHP Version: 5.3.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 */;
--
-- Database: `SMURF`
--
-- --------------------------------------------------------
--
-- Table structure for table `adminswitchboard`
--
CREATE TABLE IF NOT EXISTS `adminswitchboard` (
`adminPageID` int(11) NOT NULL AUTO_INCREMENT,
`adminPageName` varchar(40) NOT NULL,
`adminShortURL` varchar(150) NOT NULL,
`adminFullURL` varchar(150) NOT NULL,
`adminPanel` tinyint(1) NOT NULL,
`showOnAdminPanel` tinyint(1) NOT NULL,
`adminSecurity` tinyint(1) NOT NULL,
PRIMARY KEY (`adminPageID`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=14 ;
--
-- Dumping data for table `adminswitchboard`
--
INSERT INTO `adminswitchboard` (`adminPageID`, `adminPageName`, `adminShortURL`, `adminFullURL`, `adminPanel`, `showOnAdminPanel`, `adminSecurity`) VALUES
(3, '', 'login', 'modules/admin/account/login.php', 0, 0, -1),
(-1, '', 'logout', 'modules/admin/account/logout.php', 0, 0, 0),
(5, 'User Management', 'account', 'modules/admin/account/index.php', 1, 1, 4),
(6, '', 'panel', 'modules/admin/panel.php', 1, 0, 4);
-- --------------------------------------------------------
--
-- Table structure for table `cronjobs`
--
CREATE TABLE IF NOT EXISTS `cronjobs` (
`jobID` int(11) NOT NULL AUTO_INCREMENT,
`minute` varchar(5) NOT NULL,
`hour` varchar(5) NOT NULL,
`day` varchar(5) NOT NULL,
`month` varchar(5) NOT NULL,
`weekday` varchar(5) NOT NULL,
`page` varchar(150) NOT NULL,
PRIMARY KEY (`jobID`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=9 ;
-- --------------------------------------------------------
--
-- Table structure for table `menuitems`
--
CREATE TABLE IF NOT EXISTS `menuitems` (
`menuID` int(11) NOT NULL,
`pageID` int(11) NOT NULL,
`rank` int(11) NOT NULL,
`title` varchar(150) NOT NULL,
PRIMARY KEY (`menuID`,`pageID`),
KEY `pageID` (`pageID`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Dumping data for table `menuitems`
--
INSERT INTO `menuitems` (`menuID`, `pageID`, `rank`, `title`) VALUES
(0, 0, 0, 'Home');
-- --------------------------------------------------------
--
-- Table structure for table `menus`
--
CREATE TABLE IF NOT EXISTS `menus` (
`menuID` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(150) NOT NULL,
PRIMARY KEY (`menuID`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=11 ;
--
-- Dumping data for table `menus`
--
INSERT INTO `menus` (`menuID`, `name`) VALUES
(10, 'Site Menu');
-- --------------------------------------------------------
--
-- Table structure for table `pageContent`
--
CREATE TABLE IF NOT EXISTS `pageContent` (
`pageID` int(11) NOT NULL,
`content` text NOT NULL,
PRIMARY KEY (`pageID`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Dumping data for table `pageContent`
--
INSERT INTO `pageContent` (`pageID`, `content`) VALUES
(0, '<h3>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</h3> Morbi consequat est et velit congue vulputate. Nullam auctor dolor id est varius lobortis. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Sed a orci eu sapien porttitor venenatis ut ut orci. Praesent et felis sed mi varius sodales a eu sem. Proin fringilla, nibh non elementum vulputate, diam ligula faucibus quam, sed posuere nisl augue ut orci. Donec eget purus nec est convallis ornare id in ante. Fusce semper venenatis risus vitae malesuada. Donec quam magna, tincidunt quis convallis bibendum, feugiat eu sem.');
-- --------------------------------------------------------
--
-- Table structure for table `pages`
--
CREATE TABLE IF NOT EXISTS `pages` (
`pageID` int(11) NOT NULL AUTO_INCREMENT,
`shortURL` varchar(150) NOT NULL,
`fullURL` varchar(150) NOT NULL,
`title` varchar(150) NOT NULL,
`parentID` int(11) NOT NULL,
`menuID` int(11) NOT NULL,
`cols` int(11) NOT NULL,
`dbContent` tinyint(1) NOT NULL,
PRIMARY KEY (`pageID`),
KEY `urlID` (`pageID`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=26 ;
--
-- Dumping data for table `pages`
--
INSERT INTO `pages` (`pageID`, `shortURL`, `fullURL`, `title`, `parentID`, `menuID`, `cols`, `dbContent`) VALUES
(0, '', 'pages/home.php', 'Home', -1, -1, 1, 1),
(16, 'admin', 'modules/admin/index.php', 'Admin', 0, -1, 1, 0),
(17, 'json', 'modules/json/index.php', 'JSON', -1, -1, 0, 0),
(24, 'account', 'pages/account.php', 'Account', 0, -1, 1, 0);
-- --------------------------------------------------------
--
-- Table structure for table `slides`
--
CREATE TABLE IF NOT EXISTS `slides` (
`slideID` int(4) NOT NULL AUTO_INCREMENT,
`slideshowID` int(11) NOT NULL,
`imageName` varchar(40) NOT NULL,
`link` varchar(40) NOT NULL,
`rank` varchar(4) NOT NULL,
PRIMARY KEY (`slideID`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=6 ;
--
-- Dumping data for table `slides`
--
INSERT INTO `slides` (`slideID`, `slideshowID`, `imageName`, `link`, `rank`) VALUES
(1, 1, 'slide1.jpg', '/contactUs', '0'),
(2, 1, 'slide2.jpg', '/contactUs', '1'),
(3, 1, 'slide3.jpg', '/contactUs', '2');
-- --------------------------------------------------------
--
-- Table structure for table `slideshows`
--
CREATE TABLE IF NOT EXISTS `slideshows` (
`slideshowID` int(11) NOT NULL AUTO_INCREMENT,
`title` varchar(150) NOT NULL,
`width` int(11) NOT NULL,
`height` int(11) NOT NULL,
`seconds` int(11) NOT NULL,
PRIMARY KEY (`slideshowID`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;
--
-- Dumping data for table `slideshows`
--
INSERT INTO `slideshows` (`slideshowID`, `title`, `width`, `height`, `seconds`) VALUES
(1, 'Home', 600, 400, 5);
-- --------------------------------------------------------
--
-- Table structure for table `users`
--
CREATE TABLE IF NOT EXISTS `users` (
`userID` int(11) NOT NULL AUTO_INCREMENT,
`firstName` varchar(100) NOT NULL,
`lastName` varchar(50) NOT NULL,
`username` varchar(35) NOT NULL,
`password` varchar(50) NOT NULL,
`email` varchar(50) NOT NULL,
`securityLevel` tinyint(1) NOT NULL DEFAULT '0',
`temp` tinyint(1) NOT NULL DEFAULT '0',
`joinDate` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`sGUID` varchar(32) NOT NULL,
`lastLogin` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY (`userID`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;
--
-- Dumping data for table `users`
--
INSERT INTO `users` (`userID`, `firstName`, `lastName`, `username`, `password`, `email`, `securityLevel`, `temp`, `joinDate`, `sGUID`, `lastLogin`) VALUES
(0, 'SMURF Admin', '', 'admin', 'cf79aac5143ed792268bf520cb4b2ca5ae330f54', 'email@smurfsite.com', 0, 0, '2012-01-24 04:36:54', '7788ae1a8652536887f15a4087f4b5f2', '2012-01-29 17:54:23');
/*!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 */;
|
-- phpMyAdmin SQL Dump
-- version 4.9.0.1
-- https://www.phpmyadmin.net/
--
-- Hôte : localhost:3306
-- Généré le : lun. 12 oct. 2020 à 13:16
-- Version du serveur : 5.5.65-MariaDB
-- Version de PHP : 7.1.14
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Base de données : `location`
--
-- --------------------------------------------------------
--
-- Structure de la table `after_rental`
--
CREATE TABLE `after_rental` (
`id` int(11) NOT NULL,
`rentalId` int(11) NOT NULL,
`albumId` int(11) NOT NULL,
`kilometrage` int(11) NOT NULL,
`niveau_carburant` int(11) NOT NULL,
`createdAt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`comment` text NOT NULL,
`deleted` tinyint(1) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Structure de la table `albums`
--
CREATE TABLE `albums` (
`id` int(11) NOT NULL,
`title` varchar(30) NOT NULL,
`deleted` tinyint(1) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
--
-- Déchargement des données de la table `albums`
--
INSERT INTO `albums` (`id`, `title`, `deleted`) VALUES
(1, 'Car before', 0);
-- --------------------------------------------------------
--
-- Structure de la table `before_rental`
--
CREATE TABLE `before_rental` (
`id` int(11) NOT NULL,
`rentalId` int(11) NOT NULL,
`albumId` int(11) NOT NULL,
`kilometrage` int(11) NOT NULL,
`niveau_carburant` int(11) NOT NULL,
`createdAt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`comment` text NOT NULL,
`deleted` tinyint(1) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Structure de la table `bills`
--
CREATE TABLE `bills` (
`id` int(11) NOT NULL,
`bill_number` varchar(30) NOT NULL,
`bill_date` datetime NOT NULL,
`deleted` tinyint(1) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Structure de la table `bookings`
--
CREATE TABLE `bookings` (
`id` int(11) NOT NULL,
`carId` int(11) NOT NULL,
`customerId` int(11) NOT NULL,
`montant_avance` int(11) NOT NULL,
`date_begin` date NOT NULL,
`date_end` date NOT NULL,
`hour_begin` time NOT NULL,
`hour_end` time NOT NULL,
`comment` text NOT NULL,
`deleted` tinyint(1) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
--
-- Déchargement des données de la table `bookings`
--
INSERT INTO `bookings` (`id`, `carId`, `customerId`, `montant_avance`, `date_begin`, `date_end`, `hour_begin`, `hour_end`, `comment`, `deleted`) VALUES
(1, 2, 1, 0, '2020-10-09', '2020-10-12', '11:07:23', '11:07:23', '', 0),
(2, 1, 2, 0, '2020-10-22', '2020-10-30', '13:27:23', '13:27:23', '', 0);
-- --------------------------------------------------------
--
-- Structure de la table `brands`
--
CREATE TABLE `brands` (
`id` int(11) NOT NULL,
`name` varchar(30) NOT NULL,
`deleted` tinyint(1) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
--
-- Déchargement des données de la table `brands`
--
INSERT INTO `brands` (`id`, `name`, `deleted`) VALUES
(1, 'MERCEDESS', 0),
(2, 'AUDI', 0);
-- --------------------------------------------------------
--
-- Structure de la table `cars`
--
CREATE TABLE `cars` (
`id` int(11) NOT NULL,
`plate_number` varchar(15) NOT NULL,
`brandId` int(11) NOT NULL,
`model` varchar(30) NOT NULL,
`model_date` int(11) NOT NULL,
`categoryId` int(11) NOT NULL,
`price` int(11) NOT NULL,
`colorId` int(11) NOT NULL,
`chassis_number` varchar(30) NOT NULL,
`availability` tinyint(1) NOT NULL,
`statusId` int(11) NOT NULL,
`deleted` tinyint(1) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Déchargement des données de la table `cars`
--
INSERT INTO `cars` (`id`, `plate_number`, `brandId`, `model`, `model_date`, `categoryId`, `price`, `colorId`, `chassis_number`, `availability`, `statusId`, `deleted`) VALUES
(1, 'FB883930', 1, 'benz', 2000, 1, 100, 1, 'VF45664', 0, 1, 0),
(2, 'HG383893', 2, 'A3', 2013, 1, 350, 1, 'NY45664', 0, 1, 0),
(3, 'JH399303', 1, 'corolla', 2010, 1, 384, 0, 'AZ45664', 0, 1, 0);
-- --------------------------------------------------------
--
-- Structure de la table `car_insurances`
--
CREATE TABLE `car_insurances` (
`id` int(11) NOT NULL,
`carId` int(11) NOT NULL,
`insuranceId` int(11) NOT NULL,
`date_begin` date NOT NULL,
`date_end` date NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Structure de la table `categories`
--
CREATE TABLE `categories` (
`id` int(11) NOT NULL,
`title` varchar(25) NOT NULL,
`deleted` tinyint(1) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Déchargement des données de la table `categories`
--
INSERT INTO `categories` (`id`, `title`, `deleted`) VALUES
(1, 'Voiture touristique', 0);
-- --------------------------------------------------------
--
-- Structure de la table `colors`
--
CREATE TABLE `colors` (
`id` int(11) NOT NULL,
`name` varchar(15) NOT NULL,
`deleted` tinyint(1) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Déchargement des données de la table `colors`
--
INSERT INTO `colors` (`id`, `name`, `deleted`) VALUES
(1, 'Bleue', 0),
(2, 'Rouge', 0),
(3, 'Noire', 0),
(4, 'Blanche', 0);
-- --------------------------------------------------------
--
-- Structure de la table `contracts`
--
CREATE TABLE `contracts` (
`id` int(11) NOT NULL,
`rentalId` int(11) NOT NULL,
`contract_typeId` int(11) NOT NULL,
`date_begin` date NOT NULL,
`date_end` date NOT NULL,
`deleted` tinyint(1) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Structure de la table `contracts_type`
--
CREATE TABLE `contracts_type` (
`id` int(11) NOT NULL,
`name` varchar(30) NOT NULL,
`deleted` tinyint(1) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Structure de la table `customers`
--
CREATE TABLE `customers` (
`id` int(11) NOT NULL,
`firstname` varchar(30) NOT NULL,
`lastname` varchar(30) NOT NULL,
`birthday` date NOT NULL,
`gender` varchar(30) NOT NULL,
`cni` varchar(30) NOT NULL,
`type` tinyint(1) NOT NULL,
`driver_license` varchar(30) NOT NULL,
`city` varchar(30) NOT NULL,
`address` varchar(30) NOT NULL,
`phone` varchar(30) NOT NULL,
`email` varchar(30) NOT NULL,
`company_name` varchar(30) NOT NULL,
`deleted` tinyint(1) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
--
-- Déchargement des données de la table `customers`
--
INSERT INTO `customers` (`id`, `firstname`, `lastname`, `birthday`, `gender`, `cni`, `type`, `driver_license`, `city`, `address`, `phone`, `email`, `company_name`, `deleted`) VALUES
(1, 'zakia', 'momox', '1991-10-01', 'Mr', 'F33256', 1, 'erhehrzzzzzzzzzz', 'oujda', 'ddddddddd', '0698765432', 'zaka@gmail.com', '', 0),
(2, 'hamza', 'belkhadir', '1991-10-01', 'Mr', 'FB123456', 1, 'X234R432', 'berkan', 'eeeeeeeee', '0612345678', 'hamza@gmail.com', 'nadisperformance', 0);
-- --------------------------------------------------------
--
-- Structure de la table `images`
--
CREATE TABLE `images` (
`id` int(11) NOT NULL,
`albumId` int(11) NOT NULL,
`path` varchar(255) NOT NULL,
`deleted` tinyint(1) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
--
-- Déchargement des données de la table `images`
--
INSERT INTO `images` (`id`, `albumId`, `path`, `deleted`) VALUES
(1, 1, 'alzemazkmelm.jpg', 0),
(2, 1, 'path', 0),
(3, 1, '../../public/uploads/images/ESQ2yhkK8-13450168_10209591996533576_5153653816537082298_n.jpg', 0),
(4, 1, '../public/uploads/images/zbMzs1U-e-13450168_10209591996533576_5153653816537082298_n.jpg', 0),
(5, 1, 'public/uploads/images/UHCMUbhVP-13450168_10209591996533576_5153653816537082298_n.jpg', 0),
(6, 1, 'public//uploads/images/9bLi-aD1_-13450168_10209591996533576_5153653816537082298_n.jpg', 0);
-- --------------------------------------------------------
--
-- Structure de la table `insurances`
--
CREATE TABLE `insurances` (
`id` int(11) NOT NULL,
`name` varchar(30) NOT NULL,
`deleted` tinyint(1) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Structure de la table `rentals`
--
CREATE TABLE `rentals` (
`id` int(11) NOT NULL,
`bookingId` int(11) NOT NULL,
`carId` int(11) NOT NULL,
`customerId` int(11) NOT NULL,
`second_driverId` int(11) NOT NULL,
`date_begin` date NOT NULL,
`date_end` date NOT NULL,
`hour_begin` time NOT NULL,
`hour_end` time NOT NULL,
`deleted` tinyint(1) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Structure de la table `roles`
--
CREATE TABLE `roles` (
`id` int(11) NOT NULL,
`title` varchar(50) NOT NULL,
`deleted` tinyint(1) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
--
-- Déchargement des données de la table `roles`
--
INSERT INTO `roles` (`id`, `title`, `deleted`) VALUES
(1, 'Administrateur', 0),
(2, 'Assistant(e) de location', 0);
-- --------------------------------------------------------
--
-- Structure de la table `status`
--
CREATE TABLE `status` (
`id` int(11) NOT NULL,
`title` varchar(35) NOT NULL,
`deleted` tinyint(1) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Déchargement des données de la table `status`
--
INSERT INTO `status` (`id`, `title`, `deleted`) VALUES
(1, 'En vente', 0),
(2, 'En réparation', 0),
(3, 'A louer', 0);
-- --------------------------------------------------------
--
-- Structure de la table `technical_controls`
--
CREATE TABLE `technical_controls` (
`id` int(11) NOT NULL,
`carId` int(11) NOT NULL,
`date_begin` date NOT NULL,
`date_end` date NOT NULL,
`deleted` tinyint(1) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Structure de la table `users`
--
CREATE TABLE `users` (
`id` int(11) NOT NULL,
`firstname` varchar(50) NOT NULL,
`lastname` varchar(50) NOT NULL,
`gender` varchar(30) NOT NULL,
`cni` varchar(30) NOT NULL,
`address` varchar(30) NOT NULL,
`email` varchar(255) NOT NULL,
`phone` varchar(15) NOT NULL,
`roleId` int(11) NOT NULL,
`password` varchar(80) NOT NULL,
`deleted` tinyint(1) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Déchargement des données de la table `users`
--
INSERT INTO `users` (`id`, `firstname`, `lastname`, `gender`, `cni`, `address`, `email`, `phone`, `roleId`, `password`, `deleted`) VALUES
(1, 'Mohammed', 'ZBAIBI', 'Mr', 'FB120142', '07 LOT El Massira TAOURIRT', 'm.zbairi@gmail.fr', '0612345678', 2, '$2a$10$SCZNaUqeAi5VbvCJyo1IVu9aviVHYQwiACvwzC7tqx//v5gOKZ04.', 0),
(2, 'Ayoub', 'MAAMAR', 'Mr', 'HG292002', '', 'a.maamar@gmail.fr', '0698765432', 1, '$2a$10$U9qI770QiqkhWbLpukb2KeId4oJBEkUqXxwlwWpVRYvhpnCUZL0ni', 1),
(3, 'zaia', 'belkhadir', 'Mr', 'FB123456', 'LOT massira', 'zaka@gmail.com', '0612345678', 2, '$2a$10$83Z/9/bP3yR0h4vwYq/RC.zkuv28VousQy36xS/CKeNnvuRWF5ak2', 0),
(4, 'mkee', 'belabed', 'kl', 'klkkjlkjl', 'kljklkl', 'elkjkl', 'zekljklrljk', 1, '$2a$10$BQ0ic9KyITArvaWvC5hI3OXKO/y3pwyd3cyxyODfY2Dckm1upMbpy', 1);
--
-- Index pour les tables déchargées
--
--
-- Index pour la table `after_rental`
--
ALTER TABLE `after_rental`
ADD PRIMARY KEY (`id`);
--
-- Index pour la table `albums`
--
ALTER TABLE `albums`
ADD PRIMARY KEY (`id`);
--
-- Index pour la table `before_rental`
--
ALTER TABLE `before_rental`
ADD PRIMARY KEY (`id`);
--
-- Index pour la table `bills`
--
ALTER TABLE `bills`
ADD PRIMARY KEY (`id`);
--
-- Index pour la table `bookings`
--
ALTER TABLE `bookings`
ADD PRIMARY KEY (`id`);
--
-- Index pour la table `brands`
--
ALTER TABLE `brands`
ADD PRIMARY KEY (`id`);
--
-- Index pour la table `cars`
--
ALTER TABLE `cars`
ADD PRIMARY KEY (`id`);
--
-- Index pour la table `car_insurances`
--
ALTER TABLE `car_insurances`
ADD PRIMARY KEY (`id`);
--
-- Index pour la table `categories`
--
ALTER TABLE `categories`
ADD PRIMARY KEY (`id`);
--
-- Index pour la table `colors`
--
ALTER TABLE `colors`
ADD PRIMARY KEY (`id`);
--
-- Index pour la table `contracts`
--
ALTER TABLE `contracts`
ADD PRIMARY KEY (`id`);
--
-- Index pour la table `contracts_type`
--
ALTER TABLE `contracts_type`
ADD PRIMARY KEY (`id`);
--
-- Index pour la table `customers`
--
ALTER TABLE `customers`
ADD PRIMARY KEY (`id`);
--
-- Index pour la table `images`
--
ALTER TABLE `images`
ADD PRIMARY KEY (`id`);
--
-- Index pour la table `insurances`
--
ALTER TABLE `insurances`
ADD PRIMARY KEY (`id`);
--
-- Index pour la table `rentals`
--
ALTER TABLE `rentals`
ADD PRIMARY KEY (`id`);
--
-- Index pour la table `roles`
--
ALTER TABLE `roles`
ADD PRIMARY KEY (`id`);
--
-- Index pour la table `status`
--
ALTER TABLE `status`
ADD PRIMARY KEY (`id`);
--
-- Index pour la table `technical_controls`
--
ALTER TABLE `technical_controls`
ADD PRIMARY KEY (`id`);
--
-- Index pour la table `users`
--
ALTER TABLE `users`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT pour les tables déchargées
--
--
-- AUTO_INCREMENT pour la table `after_rental`
--
ALTER TABLE `after_rental`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT pour la table `albums`
--
ALTER TABLE `albums`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT pour la table `before_rental`
--
ALTER TABLE `before_rental`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT pour la table `bills`
--
ALTER TABLE `bills`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT pour la table `bookings`
--
ALTER TABLE `bookings`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT pour la table `brands`
--
ALTER TABLE `brands`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT pour la table `car_insurances`
--
ALTER TABLE `car_insurances`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT pour la table `categories`
--
ALTER TABLE `categories`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT pour la table `colors`
--
ALTER TABLE `colors`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
--
-- AUTO_INCREMENT pour la table `contracts`
--
ALTER TABLE `contracts`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT pour la table `contracts_type`
--
ALTER TABLE `contracts_type`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT pour la table `customers`
--
ALTER TABLE `customers`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT pour la table `images`
--
ALTER TABLE `images`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7;
--
-- AUTO_INCREMENT pour la table `insurances`
--
ALTER TABLE `insurances`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT pour la table `rentals`
--
ALTER TABLE `rentals`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT pour la table `roles`
--
ALTER TABLE `roles`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT pour la table `status`
--
ALTER TABLE `status`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
--
-- AUTO_INCREMENT pour la table `technical_controls`
--
ALTER TABLE `technical_controls`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT pour la table `users`
--
ALTER TABLE `users`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
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 */;
|
select t.DATE_WORK,
t.DATE_BEGIN,
t.DATE_END,
DATEADD(SS,T.TIME_WORK,0) AS TIME_WORK,
DATEADD(SS,DATEDIFF(SS,T.DATE_BEGIN,T.DATE_END)-T.TIME_WORK,0) AS TIME_INTERVAL
from (
SELECT
CONVERT(VARCHAR(10),T.DATE_BEGIN,104) AS DATE_WORK,
MIN(T.DATE_BEGIN) AS DATE_BEGIN,
MAX(T.DATE_END) AS DATE_END,
SUM(DATEDIFF(SS,T.DATE_BEGIN,T.DATE_END)) AS TIME_WORK,
COUNT(*) AS TASK_COUNT
FROM TASKS T
WHERE T.PERFORMER_ID='53C3425112CB9AD447A49FA6991DA03F'
AND T.RESULT_ID IS NOT NULL
GROUP BY CONVERT(VARCHAR(10),T.DATE_BEGIN,104)
) t |
CREATE TABLE leilao (
leilaoid BIGINT,
artigoid BIGINT NOT NULL,
minpreco DOUBLE PRECISION NOT NULL,
datacomeco TIMESTAMP NOT NULL,
cancelar BOOL DEFAULT false,
datafim TIMESTAMP NOT NULL,
utilizador_userid BIGINT NOT NULL,
PRIMARY KEY(leilaoid)
);
CREATE TABLE utilizador (
userid BIGINT,
username VARCHAR(512) UNIQUE NOT NULL,
email VARCHAR(512) UNIQUE NOT NULL,
password VARCHAR(512) NOT NULL,
admin BOOL NOT NULL,
blocked BOOL NOT NULL,
PRIMARY KEY(userid)
);
CREATE TABLE licitacao (
datadalicitacao TIMESTAMP NOT NULL,
precodelicitacao DOUBLE PRECISION NOT NULL,
utilizador_userid BIGINT,
leilao_leilaoid BIGINT NOT NULL,
licitacao_id BIGINT NOT NULL,
anulada BOOL DEFAULT false,
PRIMARY KEY(licitacao_id)
);
CREATE TABLE mural (
texto VARCHAR(512),
datetime TIMESTAMP NOT NULL,
leilao_leilaoid BIGINT,
utilizador_userid BIGINT NOT NULL,
mural_id bigint NOT NULL,
PRIMARY KEY(mural_id)
);
CREATE TABLE mensagem (
texto VARCHAR(512) NOT NULL,
utilread BOOL NOT NULL,
notifdate TIMESTAMP NOT NULL,
utilizador_userid BIGINT,
mensagem_id bigint NOT NULL,
PRIMARY KEY(mensagem_id)
);
CREATE TABLE descricao_titulo (
descricao VARCHAR(512),
titulo VARCHAR(512),
datademudanca TIMESTAMP,
leilao_leilaoid BIGINT,
descricao_titulo_id BIGINT,
PRIMARY KEY(descricao_titulo_id)
);
ALTER TABLE leilao ADD CONSTRAINT leilao_fk1 FOREIGN KEY (utilizador_userid) REFERENCES utilizador(userid);
ALTER TABLE leilao ADD CONSTRAINT constraint_0 CHECK (artigoID> 999999999 and artigoID<10000000000000);
ALTER TABLE licitacao ADD CONSTRAINT licitacao_fk1 FOREIGN KEY (utilizador_userid) REFERENCES utilizador(userid);
ALTER TABLE licitacao ADD CONSTRAINT licitacao_fk2 FOREIGN KEY (leilao_leilaoid) REFERENCES leilao(leilaoid);
ALTER TABLE mural ADD CONSTRAINT mural_fk1 FOREIGN KEY (leilao_leilaoid) REFERENCES leilao(leilaoid);
ALTER TABLE mural ADD CONSTRAINT mural_fk2 FOREIGN KEY (utilizador_userid) REFERENCES utilizador(userid);
ALTER TABLE mensagem ADD CONSTRAINT mensagem_fk1 FOREIGN KEY (utilizador_userid) REFERENCES utilizador(userid);
ALTER TABLE descricao_titulo ADD CONSTRAINT descricao_titulo_fk1 FOREIGN KEY (leilao_leilaoid) REFERENCES leilao(leilaoid);
|
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 xeqtionr_nano_db
-- -----------------------------------------------------
CREATE SCHEMA IF NOT EXISTS `xeqtionr_nano_db` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ;
USE `xeqtionr_nano_db` ;
-- -----------------------------------------------------
-- Table `xeqtionr_nano_db`.`tyres`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `xeqtionr_nano_db`.`tyres` ;
CREATE TABLE IF NOT EXISTS `xeqtionr_nano_db`.`tyres` (
`id` INT NOT NULL AUTO_INCREMENT,
`tyre_brand` VARCHAR(15) NOT NULL DEFAULT 'INTERTRAC',
`tyre_size` VARCHAR(15) NOT NULL,
`tyre_pattern` VARCHAR(10) NOT NULL,
PRIMARY KEY (`id`))
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `xeqtionr_nano_db`.`hscodes`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `xeqtionr_nano_db`.`hscodes` ;
CREATE TABLE IF NOT EXISTS `xeqtionr_nano_db`.`hscodes` (
`id` VARCHAR(20) NOT NULL,
PRIMARY KEY (`id`))
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `xeqtionr_nano_db`.`TYRE_hscodes`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `xeqtionr_nano_db`.`tyre_hscodes` ;
CREATE TABLE IF NOT EXISTS `xeqtionr_nano_db`.`tyre_hscodes` (
`tyre_id` INT NOT NULL,
`hscode` VARCHAR(20) NOT NULL,
INDEX `fk_TYRE_idx` (`tyre_id` ASC),
INDEX `fk_HSCODE_idx` (`hscode` ASC),
CONSTRAINT `fk_TYREtyre`
FOREIGN KEY (`tyre_id`)
REFERENCES `xeqtionr_nano_db`.`tyres` (`id`)
ON DELETE CASCADE
ON UPDATE CASCADE,
CONSTRAINT `fk_HSCODEhscode`
FOREIGN KEY (`hscode`)
REFERENCES `xeqtionr_nano_db`.`hscodes` (`id`)
ON DELETE CASCADE
ON UPDATE CASCADE)
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `xeqtionr_nano_db`.`lcs`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `xeqtionr_nano_db`.`lcs` ;
CREATE TABLE IF NOT EXISTS `xeqtionr_nano_db`.`lcs` (
`id` VARCHAR(15) NOT NULL,
`LC_dateissued` DATE NOT NULL,
`LC_dateexpiry` DATE NOT NULL,
`LC_applicant` VARCHAR(100) NOT NULL,
`LC_beneficiary` VARCHAR(100) NOT NULL,
`LC_currencycode` VARCHAR(5) NOT NULL DEFAULT 'USD',
`LC_foreignamount` DECIMAL(10,2) NOT NULL,
`LC_foreignexpense` DECIMAL(10,2) NOT NULL DEFAULT 0.0,
`:LC_domesticexpense` DECIMAL(10,2) NOT NULL DEFAULT 0.0,
`LC_exchangerate` DECIMAL(5,2) NOT NULL DEFAULT 1.0,
`LC_portdepart` VARCHAR(30) NOT NULL DEFAULT 'ENTER PORT',
`LC_portarrive` VARCHAR(30) NOT NULL DEFAULT 'ENTER PORT',
`LC_invoice#` VARCHAR(30) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE INDEX `LC_invoice#_UNIQUE` (`LC_invoice#` ASC))
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `xeqtionr_nano_db`.`performa_invoices`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `xeqtionr_nano_db`.`performa_invoices` ;
CREATE TABLE IF NOT EXISTS `xeqtionr_nano_db`.`performa_invoices` (
`id` BIGINT NOT NULL
`lc_num` VARCHAR(15) NOT NULL,
`tyre_id` INT NOT NULL,
`qty` INT NOT NULL DEFAULT 1,
`unit_price` DECIMAL(5,2) NOT NULL,
PRIMARY KEY (`id`),
INDEX `fk_TYRE_idx` (`tyre_id` ASC),
CONSTRAINT `fk_LCperforma`
FOREIGN KEY (`lc_num`)
REFERENCES `xeqtionr_nano_db`.`lcs` (`lc_num`)
ON DELETE RESTRICT
ON UPDATE CASCADE,
CONSTRAINT `fk_TYREperforma`
FOREIGN KEY (`tyre_id`)
REFERENCES `xeqtionr_nano_db`.`tyres` (`tyre_id`)
ON DELETE RESTRICT
ON UPDATE CASCADE)
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `xeqtionr_nano_db`.`consignments`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `xeqtionr_nano_db`.`consignments` ;
CREATE TABLE IF NOT EXISTS `xeqtionr_nano_db`.`consignments` (
`id` VARCHAR(30) NOT NULL DEFAULT 'CONSIGNMENT ID / BOL#',
`LC#` VARCHAR(15) NOT NULL,
`c_val` DECIMAL(10,2) NOT NULL,
`c_Tax` DECIMAL(10,2) NOT NULL DEFAULT 0.0,
`c_landdate` DATE NOT NULL,
PRIMARY KEY (`id`, `LC#`),
INDEX `fk_LCconsignments_idx` (`LC#` ASC),
CONSTRAINT `fk_LCconsignments`
FOREIGN KEY (`LC#`)
REFERENCES `xeqtionr_nano_db`.`lcs` (`id`)
ON DELETE RESTRICT
ON UPDATE CASCADE)
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `xeqtionr_nano_db`.`consignment_containers`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `xeqtionr_nano_db`.`consignment_containers` ;
CREATE TABLE IF NOT EXISTS `xeqtionr_nano_db`.`consignment_containers` (
`Container#` VARCHAR(45) NOT NULL,
`BOL#` VARCHAR(30) NOT NULL,
PRIMARY KEY (`Container#`, `BOL#`),
INDEX `fk_CONSIGNMENTcontainer_idx` (`BOL#` ASC),
CONSTRAINT `fk_CONSIGNMENTcontainer`
FOREIGN KEY (`BOL#`)
REFERENCES `xeqtionr_nano_db`.`consignments` (`id`)
ON DELETE CASCADE
ON UPDATE CASCADE)
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `xeqtionr_nano_db`.`consignment_expenses`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `xeqtionr_nano_db`.`consignment_expenses` ;
CREATE TABLE IF NOT EXISTS `xeqtionr_nano_db`.`consignment_expenses` (
`BOL#` VARCHAR(30) NOT NULL,
`expenseid` INT NOT NULL AUTO_INCREMENT,
`expense_foreign` DECIMAL(10,2) NOT NULL DEFAULT 0.0,
`expense_local` DECIMAL(10,2) NOT NULL DEFAULT 0.0,
`expense_notes` VARCHAR(100) NULL DEFAULT NULL,
PRIMARY KEY (`expenseid`, `BOL#`),
INDEX `fk_CONSIGNMENTexpenses_idx` (`BOL#` ASC),
CONSTRAINT `fk_CONSIGNMENTexpenses`
FOREIGN KEY (`BOL#`)
REFERENCES `xeqtionr_nano_db`.`consignments` (`id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `xeqtionr_nano_db`.`container_contents`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `xeqtionr_nano_db`.`container_contents` ;
CREATE TABLE IF NOT EXISTS `xeqtionr_nano_db`.`container_contents` (
`Container#` VARCHAR(45) NOT NULL,
`BOL#` VARCHAR(30) NOT NULL,
`tyre_id` INT NOT NULL,
`qty` INT NOT NULL DEFAULT 1,
`unit_price` DECIMAL(7,2) NOT NULL,
PRIMARY KEY (`Container#`, `BOL#`, `tyre_id`),
INDEX `fk_TYREcontents_idx` (`tyre_id` ASC),
CONSTRAINT `fk_CONTAINERcontents`
FOREIGN KEY (`Container#` , `BOL#`)
REFERENCES `xeqtionr_nano_db`.`consignment_containers` (`Container#` , `BOL#`)
ON DELETE CASCADE
ON UPDATE CASCADE,
CONSTRAINT `fk_TYREcontents`
FOREIGN KEY (`tyre_id`)
REFERENCES `xeqtionr_nano_db`.`tyres` (`id`)
ON DELETE RESTRICT
ON UPDATE CASCADE)
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `xeqtionr_nano_db`.`customers`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `xeqtionr_nano_db`.`customers` ;
CREATE TABLE IF NOT EXISTS `xeqtionr_nano_db`.`customers` (
`id` INT NOT NULL AUTO_INCREMENT,
`name` VARCHAR(20) NOT NULL,
`address` VARCHAR(50) NOT NULL,
`phone` VARCHAR(15) NULL DEFAULT NULL,
`notes` VARCHAR(50) NULL DEFAULT NULL,
PRIMARY KEY (`id`))
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `xeqtionr_nano_db`.`orders`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `xeqtionr_nano_db`.`orders` ;
CREATE TABLE IF NOT EXISTS `xeqtionr_nano_db`.`orders` (
`id` BIGINT ZEROFILL NOT NULL AUTO_INCREMENT,
`customer_id` INT NOT NULL,
`discount_percent` DECIMAL(5,2) NOT NULL DEFAULT 0.0,
`discount_amount` DECIMAL(10,2) NOT NULL DEFAULT 0.0,
`tax_percentage` DECIMAL(5,2) NOT NULL DEFAULT 0.0,
`tax_amount` DECIMAL(10,2) NOT NULL DEFAULT 0.0,
PRIMARY KEY (`id`),
INDEX `fk_CUSTOMERorder_idx` (`customer_id` ASC),
CONSTRAINT `fk_CUSTOMERorder`
FOREIGN KEY (`customer_id`)
REFERENCES `xeqtionr_nano_db`.`customers` (`id`)
ON DELETE RESTRICT
ON UPDATE CASCADE)
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `xeqtionr_nano_db`.`order_contents`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `xeqtionr_nano_db`.`order_contents` ;
CREATE TABLE IF NOT EXISTS `xeqtionr_nano_db`.`order_contents` (
`Order#` BIGINT ZEROFILL NOT NULL,
`Container#` VARCHAR(45) NOT NULL,
`BOL#` VARCHAR(30) NOT NULL,
`Tyre_id` INT NOT NULL,
`qty` INT NOT NULL DEFAULT 1,
`sell_price` DECIMAL(10,2) NOT NULL,
PRIMARY KEY (`Order#`, `Container#`, `BOL#`,`Tyre_id`),
INDEX `fk_ORDERtyre_idx` (`Tyre_id` ASC),
CONSTRAINT `fk_ORDERcontents`
FOREIGN KEY (`Order#`)
REFERENCES `xeqtionr_nano_db`.`orders` (`id`)
ON DELETE CASCADE
ON UPDATE CASCADE,
CONSTRAINT `fk_ORDERcontainerContents`
FOREIGN KEY (`Container#` ,`BOL#` , `Tyre_id`)
REFERENCES `xeqtionr_nano_db`.`container_contents` (`Container#` ,`BOL#` , `tyre_id`)
ON DELETE RESTRICT
ON UPDATE CASCADE)
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `xeqtionr_nano_db`.`payments`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `xeqtionr_nano_db`.`payments` ;
CREATE TABLE IF NOT EXISTS `xeqtionr_nano_db`.`payments` (
`Order#` BIGINT ZEROFILL NOT NULL,
`Invoice#` BIGINT NOT NULL AUTO_INCREMENT,
`payment_amount` DECIMAL(10,2) NOT NULL DEFAULT 0,
`payment_timestamp` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`Invoice#`, `Order#`),
CONSTRAINT `fk_orderspayment`
FOREIGN KEY (`Order#`)
REFERENCES `xeqtionr_nano_db`.`orders` (`id`)
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;
|
CREATE DATABASE if not exists shop
DEFAULT CHARACTER SET utf8
DEFAULT COLLATE utf8_general_ci;
use shop;
create table if not exists account(
username varchar(100) not null,
password varchar(100) not null,
position varchar(100) not null,
status varchar(100) not null,
primary key (username),
constraint check_pos check (position in ('manager','employee','customer')), /*quan ly, nhanvien, khachhang*/
constraint check_stt check (status in ('active','waiting','locked','deny')) /*dang hoat dong, dang cho phe duyet, dung hoat dong, bi tu choi*/
);
create table if not exists employee(
id int not null auto_increment ,
name varchar(100) not null,
birthday date not null,
address varchar(100) not null,
phone varchar(100) not null,
salary double precision not null,
username varchar(100) ,
primary key (id),
foreign key (username) REFERENCES account(username)
);
create table if not exists customer(
id int not null auto_increment,
name varchar(100) not null,
birthday date not null,
address varchar(100) not null,
phone varchar(100) not null,
username varchar(100) not null,
primary key (id),
foreign key (username) REFERENCES account(username)
);
create table if not exists product(
id int not null auto_increment,
name varchar(100) not null,
type_id varchar(100) not null ,
inventory int not null, /*so luong ton kho*/
buy_price double precision not null,
sell_price double precision not null,
entry_date datetime, /*ngay nhap kho*/
primary key (id)
);
create table if not exists product_type(
id varchar(100) not null ,
type_name varchar(100) not null,
primary key (id)
);
alter table product add foreign key (type_id) references product_type(id);
create table if not exists bill(
id int not null auto_increment ,
emp_id int not null ,
cus_id int not null,
sell_date datetime not null, /*ngay dat mua*/
process_date datetime, /*ngay xu ly don hang*/
status varchar(100) not null,
primary key (id),
foreign key (emp_id) references employee(id),
foreign key (cus_id) references customer(id),
constraint check_stt2 check (status in('processing','done')) /*trang thai don hang co the la dang xu ly hoac da xu ly*/
);
create table if not exists bill_detail(
bill_id int not null,
product_id int not null,
amount int not null, /*so luong dat mua san pham product_id*/
foreign key (bill_id) references bill(id),
foreign key (product_id) references product(id)
);
|
Create View V_beat_SalesMan
([Beat_ID], [Beat_Name], [Salesman_ID], [Salesman_Name], [Customer_ID], [Customer_Name], [Active])
AS
SELECT Beat_Salesman.BeatID, Beat.Description, Beat_Salesman.SalesmanID, Salesman.Salesman_Name,Beat_Salesman.CustomerID,
Customer.Company_Name, 'Active' = (Case When (Isnull(Beat.Active, 1)
+ Isnull(Salesman.Active, 1) + Isnull(Customer.Active, 1)) <> 3 then 0 else 1 end)
FROM Beat_Salesman
Inner Join Beat On Beat.BeatID = Beat_Salesman.BeatID
Left Outer Join Salesman On Salesman.SalesmanID = Beat_Salesman.SalesmanID
Left Outer Join Customer on Customer.CustomerID = Beat_SalesMan.CustomerID
inner join
(SELECT Salesmanid FROM DSType_Master TDM inner join DSType_Details TDD
on TDM.DSTypeId =TDD.DSTypeId and TDM.DSTypeCtlPos=TDD.DSTypeCtlPos and TDM.DSTypeName='Handheld DS' and TDM.DSTypeValue='Yes') HHS
on HHS.Salesmanid=Salesman.Salesmanid
Where Beat_Salesman.CustomerID in (Select C.CustomerID from Customer C)
|
set hive.execution.engine=spark;
insert overwrite table dws.tmp_dws_order_total_agg
select * from dws.tmp_dws_order_total_agg
where to_date(etl_update_time) <> from_unixtime(unix_timestamp(),'yyyy-MM-dd')
union all
select * from dws.tmp_dws_order_total_agg_add; |
SELECT
*
FROM
dept_emp
ORDER BY emp_no DESC
LIMIT 10;
insert into dept_emp
values(999903,'d005','1997-10-01','9999-01-01'); |
CREATE TABLE restaurant(
id SERIAL NOT NULL PRIMARY KEY,
name VARCHAR,
distance INTEGER,
stars INTEGER CHECK (stars >=0),
category VARCHAR,
favorite_food VARCHAR,
takeout BOOLEAN NOT NULL,
last_visit DATE
);
insert into restaurant VALUES(DEFAULT, 'Chick fil a', '10', '3', 'Fast food', 'chicken sandwhich', TRUE,'08-01-2019');
insert into restaurant VALUES(DEFAULT, 'The House of BBQ', '30', '4','BBQ', 'Porkchops', TRUE, '08/04/2019');
insert into restaurant VALUES(DEFAULT, 'Taco Bell', '3', '5','fast food', 'soft shell taco', TRUE, '01/01/2019');
insert into restaurant VALUES(DEFAULT, 'Farm Burger', '15', '5','fast food', 'Steak Burger', TRUE, '05/06/2019');
insert into restaurant VALUES(DEFAULT, 'The Swordfish', '1', '3','Seafood', 'Fish and Chips', TRUE, '07/28/2019');
insert into restaurant values( DEFAULT, 'chipotle', 1, 5, 'mexican', 'Steak Burrito ', FALSE, '05-21-2012');
select * from restaurant;
--Writing Queries Exercise
--The names of the restaurants that you gave a 5 stars to
select name from restaurant where stars ='5';
--The favorite dishes of all 5-star restaurants
select favorite_food from restaurant where stars ='5';
--The the id of a restaurant by a specific restaurant name,
select id from restaurant where name = 'Farm Burger';
--restaurants in the category of 'BBQ'
select name from restaurant where category ='BBQ';
--restaurants that do take out
select name from restaurant where takeout = TRUE;
--restaurants that do take out and is in the category of 'BBQ'
select name from restaurant where takeout = TRUE AND category = 'BBQ';
--restaurants within 2 miles
select name from restaurant where distance < 2 ;
--restaurants you haven't ate at in the last week
select * from restaurant where last_visit >= current_date - interval '7 days';
--restaurants you haven't ate at in the last week and has 5 stars
select * from restaurant where last_visit >= '07-31-2019' AND stars = 5;
--Aggregation and Sorting Queries Exercise
-- list restaurants by the closest distance.
SELECT * FROM restaurant ORDER BY distance ASC;
--list the top 2 restaurants by distance.
SELECT * FROM restaurant ORDER BY distance ASC LIMIT 2;
--list the top 2 restaurants by stars.
SELECT * FROM restaurant ORDER BY stars DESC LIMIT 2;
--list the top 2 restaurants by stars where the distance is less than 2 miles
SELECT * FROM restaurant WHERE distance < 2 ORDER BY stars DESC LIMIT 2;
--count the number of restaurants in the db
SELECT count(id) FROM restaurant;
--count the number of restaurants by category.
SELECT category, count(id) FROM restaurant GROUP BY category;
-- get the average stars per restaurant by category.
SELECT category, sum(stars)/count(id) FROM restaurant GROUP BY category;
-- get the max stars of a restaurant by category.
SELECT category, max(stars) FROM restaurant GROUP BY category;
|
-- phpMyAdmin SQL Dump
-- version 3.5.8.2
-- http://www.phpmyadmin.net
--
-- Počítač: wm19.wedos.net:3306
-- Vygenerováno: Úte 05. led 2021, 14:32
-- Verze serveru: 5.5.33
-- Verze PHP: 5.4.23
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 */;
--
-- Databáze: `d22429_dankovi`
--
-- --------------------------------------------------------
--
-- Struktura tabulky `pekarna_eventlog`
--
CREATE TABLE IF NOT EXISTS `pekarna_eventlog` (
`ID` int(11) NOT NULL AUTO_INCREMENT,
`SESSION_ID` varchar(36) COLLATE utf8_czech_ci NOT NULL,
`LOCATION_ID` varchar(256) COLLATE utf8_czech_ci NOT NULL,
`VIEW` varchar(32) COLLATE utf8_czech_ci DEFAULT NULL,
`EVENT` varchar(32) COLLATE utf8_czech_ci NOT NULL,
`DETAILS` varchar(256) COLLATE utf8_czech_ci DEFAULT NULL,
`USER_AGENT` varchar(512) COLLATE utf8_czech_ci DEFAULT NULL,
`TIMESTAMP` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=2 ;
--
-- Vypisuji data pro tabulku `pekarna_eventlog`
--
INSERT INTO `pekarna_eventlog` (`ID`, `SESSION_ID`, `LOCATION_ID`, `VIEW`, `EVENT`, `DETAILS`, `USER_AGENT`, `TIMESTAMP`) VALUES
(1, '12345678-1234-1234-1234-123456789abc', 'zeleny-les', 'quiz', 'view entered', NULL, 'Mozilla/5.0 (Linux; Android 10; SM-A415F) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.101 Mobile Safari/537.36', '2021-01-05 10:16:25');
/*!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 */;
|
-- 修改日期:20121217
-- 修改人:梁铭利
--修改内容:中烟加ERP接口银行的接口代码,以区分走银行接口还是走监管系统
declare
max_id_cs20121217 number;
begin
select count(*) into max_id_cs20121217 from BIS_BIF_INIT where BIF_CODE='9999';
if max_id_cs20121217=0 then
insert into bis_bif_init (BIF_CODE, NAME, MOD_ID, SVR_END_TIME, SVR_START_TIME)
values ('9999', 'ERP接口', 'ERP', to_date('01-01-1900 23:59:00', 'dd-mm-yyyy hh24:mi:ss'), to_date('01-01-1900 08:00:00', 'dd-mm-yyyy hh24:mi:ss'));
commit;
end if;
end;
/
-- 修改日期:20121231
-- 修改人:梁铭利
--修改内容:中烟加银行账号补录提示功能参数(监管系统导入的账号)
declare
max_id_cs20121231 number;
begin
select count(*) into max_id_cs20121231 from fc_param where param_code='bankacc_add';
if max_id_cs20121231=0 then
insert into fc_param ( PARAM_CODE, PARAM_NAME, PARAM_VALUE, RMK, COL_ADD1, COL_ADD2, WINDOW_NAME)
values ( 'bankacc_add', '银行账号补录', '0', '1提醒,0不提醒', '', '', '');
commit;
end if;
end;
/
|
ALTER TABLE "EAADMIN"."SOFTWARE_FILTER" ADD COLUMN CATALOG_TYPE VARCHAR(32)
;
ALTER TABLE TRAILSPD_CD.SOFTWARE_FILTER ADD COLUMN CATALOG_TYPE VARCHAR(32);
ALTER TABLE TRAILSPD_CC.SOFTWARE_FILTER ADD COLUMN CATALOG_TYPE VARCHAR(32);
ALTER TABLE "EAADMIN"."SOFTWARE_FILTER_H" ADD COLUMN CATALOG_TYPE VARCHAR(32)
;
ALTER TABLE TRAILSPD_CD.SOFTWARE_FILTER_H ADD COLUMN CATALOG_TYPE VARCHAR(32);
ALTER TABLE TRAILSPD_CC.SOFTWARE_FILTER_H ADD COLUMN CATALOG_TYPE VARCHAR(32);
REORG TABLE EAADMIN.SOFTWARE_FILTER;
REORG TABLE TRAILSPD_CD.SOFTWARE_FILTER;
REORG TABLE TRAILSPD_CC.SOFTWARE_FILTER;
REORG TABLE EAADMIN.SOFTWARE_FILTER_H;
REORG TABLE TRAILSPD_CD.SOFTWARE_FILTER_H;
REORG TABLE TRAILSPD_CC.SOFTWARE_FILTER_H;
RUNSTATS ON TABLE EAADMIN.SOFTWARE_FILTER ON ALL COLUMNS WITH DISTRIBUTION ON ALL COLUMNS AND DETAILED INDEXES ALL ALLOW WRITE ACCESS UTIL_IMPACT_PRIORITY 50
;
RUNSTATS ON TABLE TRAILSPD_CD.SOFTWARE_FILTER ON ALL COLUMNS WITH DISTRIBUTION ON ALL COLUMNS AND DETAILED INDEXES ALL ALLOW WRITE ACCESS UTIL_IMPACT_PRIORITY 50
;
RUNSTATS ON TABLE TRAILSPD_CC.SOFTWARE_FILTER ON ALL COLUMNS WITH DISTRIBUTION ON ALL COLUMNS AND DETAILED INDEXES ALL ALLOW WRITE ACCESS UTIL_IMPACT_PRIORITY 50
;
RUNSTATS ON TABLE EAADMIN.SOFTWARE_FILTER_H ON ALL COLUMNS WITH DISTRIBUTION ON ALL COLUMNS AND DETAILED INDEXES ALL ALLOW WRITE ACCESS UTIL_IMPACT_PRIORITY 50
;
RUNSTATS ON TABLE TRAILSPD_CD.SOFTWARE_FILTER_H ON ALL COLUMNS WITH DISTRIBUTION ON ALL COLUMNS AND DETAILED INDEXES ALL ALLOW WRITE ACCESS UTIL_IMPACT_PRIORITY 50
;
RUNSTATS ON TABLE TRAILSPD_CC.SOFTWARE_FILTER_H ON ALL COLUMNS WITH DISTRIBUTION ON ALL COLUMNS AND DETAILED INDEXES ALL ALLOW WRITE ACCESS UTIL_IMPACT_PRIORITY 50
; |
CREATE VIEW actor_name_view AS
SELECT first_name AS first_name_v, last_name AS last_name_v FROM actor;
|
-- Column: type
-- ALTER TABLE blocks DROP COLUMN type;
ALTER TABLE blocks ADD COLUMN type character(15); |
CREATE DATABASE historical_figures_dev;
CREATE DATABASE historical_figures_test;
|
--指令表添加指令来源字段
-- Add/modify columns
alter table BIS_EXC add VOUCHER_FROM number(2,0);
-- Add comments to the columns
comment on column BIS_EXC.VOUCHER_FROM
is '1——来自下拨
2——来自头寸调拨
3——来自上划
4——来自请款
5——来自付款
6——来自柜台手工记账';
-- Add/modify columns
--添加打回状态字段
alter table NIS_BILLHEAD add REFUSE_STATUS number;
--添加指令交易状态字段
alter table NIS_BILLHEAD add VOUCHER_STAT char(1);
-- Add comments to the columns
comment on column NIS_BILLHEAD.REFUSE_STATUS
is '1-记账打回
2-审批打回
3-指令打回';
comment on column NIS_BILLHEAD.VOUCHER_STAT
is '该字段为付款指令状态
交易成功 0
等待结果 1
银行处理失败 2
准备发送 3
银行已接受 4
收付款数据不全 5
等待补充数据 6
指令无效 7
已打印支票 8
接口处理失败 9
审批通过 p
待审批 w
审批打回 R
补录打回 B'; |
-- ///STORED PROCEDURES///
delimiter //
create procedure add_country()
begin
insert into countries (name) values ('Argentina');
end //
delimiter //
create procedure create_provinces()
begin
insert into provinces (name,id_country)
values
("Buenos Aires",1),
("Catamarca",1) ,
("Chaco",1) ,
("Chubut",1) ,
("Cordoba",1) ,
("Corrientes",1) ,
("Entre Rios",1) ,
("Formosa",1) ,
("Jujuy",1) ,
("La Pampa",1) ,
("La Rioja",1) ,
("Mendoza",1) ,
("Misiones",1) ,
("Neuquen",1) ,
("Rio Negro",1) ,
("Salta",1) ,
("San Juan",1) ,
("San Luis",1) ,
("Santa Cruz",1) ,
("Santa Fe",1) ,
("Santiago del Estero",1) ,
("Tierra del Fuego",1) ,
("Tucuman",1);
end //
-- Script de fees (tarda 15 minutos)
delimiter //
create procedure add_fees()
begin
declare i int;
declare j int;
declare total_cities int;
declare aux_ppm float;
declare aux_cpm float;
SET total_cities = (select count(id) from cities);
-- SET total_cities = 750;
SET i = 1;
set j=1;
set aux_ppm = 0;
set aux_cpm = 0;
truncate table fees;
start transaction;
while i < total_cities do
while j < total_cities do
set aux_ppm = TRUNCATE (((50 + (rand() * 250))/100), 2);
set aux_cpm =TRUNCATE (aux_ppm * TRUNCATE (((20 + (rand() * 80))/100), 2),2);
insert into fees (price_per_minute,cost_per_minute,id_source_city,id_destination_city) values ( aux_ppm, aux_cpm,i,j);
set j=j+1;
end while;
set i=i+1;
set j=1;
end while;
commit;
end //
delimiter //
create procedure add_telephone_lines()
begin
insert into telephone_lines (line_number, line_type, id_user, status) values ('116784509', 'MOBILE', 1, 'ACTIVE'),
('116784777', 'MOBILE', 1, 'ACTIVE'), ('2201234509', 'MOBILE', 2, 'ACTIVE'), ('2203214509', 'MOBILE', 2, 'ACTIVE'), ('2205554509', 'MOBILE', 3, 'ACTIVE'),
('2215141639', 'MOBILE', 4, 'ACTIVE'), ('221893147', 'MOBILE', 4, 'ACTIVE'), ('2236784509', 'MOBILE', 5, 'ACTIVE'), ('2306982659', 'MOBILE', 6, 'ACTIVE'),
('2306554409', 'MOBILE', 6, 'ACTIVE'), ('236921209', 'RESIDENTIAL', 7, 'ACTIVE'), ('2377788869', 'MOBILE', 8, 'ACTIVE'), ('35476784509', 'RESIDENTIAL', 1, 'ACTIVE');
end //
-- Script de cargar llamadas
-- drop procedure add_x_calls
delimiter //
create procedure add_x_calls(in x_calls int)
begin
declare total_lines int;
declare i int default 0;
declare total_cities int;
declare date_var timestamp;
declare source_number_var varchar(30);
declare destination_number_var varchar(30) default 0;
declare duration_var int default 0;
SET total_lines = (select count(id) from telephone_lines);
start transaction;
while i < x_calls do
set source_number_var = (SELECT line_number from telephone_lines order by rand() limit 1);
while(source_number_var = destination_number_var or destination_number_var = 0 ) DO
set destination_number_var = (SELECT line_number from telephone_lines order by rand() limit 1);
end while;
-- un mes tiene 2628000 segundos, 10 dias 864000
set date_var = FROM_UNIXTIME(UNIX_TIMESTAMP(now()- interval 10 day) + FLOOR(0 + (RAND() * 863000)));
set duration_var = ROUND((50+ rand()*1000),0);
insert into calls (source_number, destination_number, duration_secs, date_call) values (source_number_var, destination_number_var, duration_var, date_var);
set i=i+1;
set destination_number_var = 0;
end while;
commit;
end //
-- CALL STORED PROCEDURES
call add_country();
call create_provinces();
-- /////////////////////////////////////////////////
-- STOP STOP STOP //////////////////////////////////
-- /////////////////////////////////////////////////
-- tenemos un script en java que carga las ciudades, aca deberias ir y ejecutarlo
-- agregar usuarios por java ya que si los agregas por sql no tendran sus passwords hasheadas y no podran logear
call add_fees();
call add_x_calls(5000);
-- ///FACTURACION///
DELIMITER //
CREATE PROCEDURE facturation()
begin
DECLARE total_price_var float;
DECLARE total_price_sum float DEFAULT 0;
DECLARE total_cost_var float;
DECLARE total_cost_sum float DEFAULT 0;
DECLARE date_creation_var date;
DECLARE date_expiration_var date;
DECLARE id_telephone_line_var int;
DECLARE id_user_var int;
DECLARE id_source_number_call int;
DECLARE id_invoice_var int;
DECLARE id_call_var int DEFAULT 0;
DECLARE vFinished INTEGER DEFAULT 0;
DECLARE cur_telephone_lines CURSOR FOR
SELECT id, id_user
FROM telephone_lines;
DECLARE cur_calls CURSOR FOR
SELECT id, total_cost, total_price,id_source_number
FROM calls
WHERE date_call > (DATE(now()) - INTERVAL 1 MONTH) and ISNULL(id_invoice);
DECLARE CONTINUE HANDLER FOR NOT FOUND
SET vfinished=1;
SET date_creation_var = (select DATE(now()));
SET date_expiration_var =(select (DATE(now()) + INTERVAL 15 DAY));
start transaction;
OPEN cur_telephone_lines;
LOOP1: LOOP
FETCH cur_telephone_lines INTO id_telephone_line_var, id_user_var;
IF vfinished =1 THEN
LEAVE LOOP1;
END IF;
OPEN cur_calls;
LOOP2: LOOP
FETCH cur_calls INTO id_call_var, total_cost_var, total_price_var,id_source_number_call;
IF vfinished = 1 THEN
SET vfinished =0;
LEAVE LOOP2;
ELSE
IF (id_source_number_call = id_telephone_line_var) THEN
IF(total_cost_sum = 0) THEN
INSERT INTO invoices (total_price, total_cost, date_creation, date_expiration, paid, id_telephone_line, id_user)
values (0, 0, date_creation_var, date_expiration_var, 0, id_telephone_line_var, id_user_var);
SET id_invoice_var = last_insert_id();
END IF;
IF(id_invoice_var > 0) THEN
UPDATE calls
SET id_invoice = id_invoice_var
WHERE id=id_call_var;
END IF;
SET total_cost_sum = total_cost_sum + total_cost_var;
SET total_price_sum = total_price_sum + total_price_var;
END IF;
END IF;
SET vfinished =0;
END LOOP LOOP2;
IF (total_price_sum >0) THEN
UPDATE invoices
SET total_price = total_price_sum , total_cost = total_cost_sum
where id = id_invoice_var;
SET total_price_sum =0;
SET total_cost_sum =0;
SET id_invoice_var =0;
END IF;
CLOSE cur_calls;
END LOOP LOOP1;
CLOSE cur_telephone_lines;
commit;
end //
-- Y su pequeño evento
CREATE EVENT facturation_event
ON SCHEDULE EVERY 1 MONTH STARTS '2020-07-01 00:00:00'
DO CALL facturation();
select * from invoices
-- API
-- 2) Consulta de llamadas del usuario logueado por rango de fechas
delimiter //
create procedure user_calls_between_dates(IN fromD date, IN toD date, IN idLoggedUser int)
begin
select c.destination_number as calledNumber, c.duration_secs as callDuration, c.total_price as totalPrice
from calls c
join telephone_lines t
on c.source_number = t.line_number
join users u
on t.id_user = u.id
where u.id = idLoggedUser and c.date_call between fromD and toD;
end //
-- 3) Consulta de facturas del usuario logueado por rango de fechas.
delimiter //
create procedure user_invoices_between_dates(IN fromD date, IN toD date, IN idLoggedUser int)
begin
select i.date_creation as period_from, i.date_expiration as period_to, t.line_number, i.total_price, i.paid
from invoices i
join telephone_lines t
on i.id_telephone_line = t.id
join users u
on t.id_user = u.id
where u.id = idLoggedUser and i.date_creation between fromD and toD;
end //
-- 4) Consulta de TOP 10 destinos más llamados por el usuario
-- drop procedure user_top_most_called
delimiter //
create procedure user_top_most_called(IN idLoggedUser int)
begin
select ct.name as city, count(c.id_destination_city) as times_called
from calls c
join telephone_lines t
on c.source_number = t.line_number
join users u
on t.id_user = u.id
join cities ct
on c.id_destination_city = ct.id
where u.id = idLoggedUser
group by city
order by times_called DESC
limit 10;
end //
delimiter //
create procedure user_top_most_called_lines(IN idLoggedUser int)
begin
select c.destination_number as number_called, count(c.destination_number) as times_called
from calls c
join telephone_lines t
on c.source_number = t.line_number
join users u
on t.id_user = u.id
where u.id = idLoggedUser
group by number_called
order by times_called DESC
limit 10;
end //
-- BACK OFFICE
-- 2) Manejo de clientes
-- 3) Alta , baja y suspensión de líneas.
-- 4) Consulta de tarifas
delimiter //
create procedure backoffice_request_fee_by_id(IN idCityFrom int, IN idCityTo int)
begin
select cf.name as cityFrom, ct.name as cityTo, f.price_per_minute as fee
from fees f
inner join cities cf
on f.id_source_city = cf.id
inner join cities ct
on f.id_destination_city = ct.id
where f.id_source_city = idCityFrom and f.id_destination_city = idCityTo;
end //
delimiter //
create procedure backoffice_request_fee(IN cityFrom varchar(50), IN cityTo varchar(50))
begin
DECLARE idCityFrom int;
DECLARE idCityTo int;
SELECT id FROM cities c WHERE c.name = cityFrom INTO idCityFrom;
SELECT id FROM cities c WHERE c.name = cityTo INTO idCityTo;
select cityFrom, cityTo, f.price_per_minute as fee
from fees f
where f.id_source_city = idCityFrom and f.id_destination_city = idCityTo;
end //
-- 5) Consulta de llamadas por usuario.
delimiter //
create procedure backoffice_request_calls_user_simple(IN dni int)
begin
select u.firstname, u.lastname, u.dni, count(ca.id) as callsMade
from users u
inner join telephone_lines t
on u.id = t.id_user
inner join calls ca
on t.line_number = ca.source_number
where u.dni = dni
group by u.id;
end //
-- drop procedure backoffice_request_calls_user
delimiter //
create procedure backoffice_request_calls_user(IN dni int)
begin
select ca.source_number as sourceNumber , (select name from cities where id=ca.id_source_number) as sourceCity ,
ca.destination_number as destinationNumber , (select name from cities where id=ca.id_destination_number) as destinationCity ,
ca.total_price as totalPrice, ca.date_call as dateCall
from calls ca
inner join telephone_lines t
on ca.source_number = t.line_number
inner join users u
on t.id_user = u.id
where u.dni = dni;
end //
-- 6) Consulta de facturación. La facturación se hará directamente por un proceso interno en la base datos.
-- ver facturas de un usuario
delimiter //
create procedure backoffice_invoices_from_user(IN dni varchar(50))
begin
select u.dni, u.lastname, u.firstname, t.line_number, i.date_creation, i.date_expiration, i.total_cost, i.total_price, i.paid
from users u
inner join telephone_lines t
on u.id = t.id_user
inner join invoices i
on t.id = i.id_telephone_line
where u.dni = dni;
end //
-- ver facturas pagadas/sin pagar de un usuario
delimiter //
create procedure backoffice_invoices_from_user_paid(IN dni varchar(50))
begin
select u.dni, u.lastname, u.firstname, t.line_number, i.date_creation, i.date_expiration, i.total_cost, i.total_price, i.paid
from users u
inner join telephone_lines t
on u.id = t.id_user
inner join invoices i
on t.id = i.id_telephone_line
where u.dni = dni and i.paid = 1;
end //
delimiter //
create procedure backoffice_invoices_from_user_not_paid(IN dni varchar(50))
begin
select u.dni, u.lastname, u.firstname, t.line_number, i.date_creation, i.date_expiration, i.total_cost, i.total_price, i.paid
from users u
inner join telephone_lines t
on u.id = t.id_user
inner join invoices i
on t.id = i.id_telephone_line
where u.dni = dni and i.paid = 0;
end //
-- ver facturas de un mes
delimiter //
create procedure backoffice_invoices_from_month(IN monthI varchar(50),IN yearI varchar(50))
begin
select t.line_number, i.date_creation, i.date_expiration, i.total_cost, i.total_price, i.paid
from telephone_lines t
inner join invoices i
on t.id = i.id_telephone_line
where month(i.date_creation) = monthI and year(i.date_creation)=yearI;
end //
-- ver facturas de un año
delimiter //
create procedure backoffice_invoices_from_year(IN yearI varchar(50))
begin
select t.line_number, i.date_creation, i.date_expiration, i.total_cost, i.total_price, i.paid
from telephone_lines t
inner join invoices i
on t.id = i.id_telephone_line
where year(i.date_creation) = yearI;
end //
-- ver facturas de un periodo
delimiter //
create procedure backoffice_invoices_between_dates(IN fromI varchar(50), IN toI varchar(50))
begin
select t.line_number, i.date_creation, i.date_expiration, i.total_cost, i.total_price, i.paid
from telephone_lines t
inner join invoices i
on t.id = i.id_telephone_line
where i.date_creation between fromI and toI;
end //
-- ver ganancias
delimiter //
create procedure backoffice_check_income()
begin
select truncate((sum(i.total_price)-sum(i.total_cost)),2) as income
from invoices i;
end //
-- ver ganancias de un mes
delimiter //
create procedure backoffice_check_income_month(IN monthI varchar(50), IN yearI varchar(50))
begin
select truncate((sum(i.total_price)-sum(i.total_cost)),2) as income
from invoices i
where month(i.date_creation) = monthI and year(i.date_creation)=yearI;
end //
-- ver ganancias de un año
delimiter //
create procedure backoffice_check_income_year(IN yearI varchar(50))
begin
select truncate((sum(i.total_price)-sum(i.total_cost)),2) as income
from invoices i
where year(i.date_creation) = yearI;
end //
-- 6) Consulta de facturación. La facturación se hará directamente por un proceso interno en la base datos.
-- AERIAL
-- Se debe permitir también el agregado de llamadas, con un login especial, ya que
-- este método de nuestra API será llamado nada más que por el área de
-- infraestructura cada vez que se produzca una llamada. El área de infraestructura
-- sólo enviará la siguiente información de llamadas :
-- ○ Número de origen
-- ○ Número de destino
-- ○ Duración de la llamada
-- ○ Fecha y hora de la llamada
-- La tarifa y las localidades de destino deberán calcularse al momento de guardar la
-- llamada y no será recibido por la API REST.
-- STORED PROCEDURE ADD CALL
delimiter //
create procedure add_call_aerial(IN sourceNumber varchar(50), IN destinationNumber varchar(50), IN duration int, IN dateCall date)
begin
insert into calls(source_number, destination_number, duration_secs, date_call) values (sourceNumber, destinationNumber, duration, dateCall);
end //
|
/* Создание просмотра списаний учетных записей */
CREATE VIEW /*PREFIX*/S_ACCOUNT_CHARGES
(
ACCOUNT_ID,
SUM_CHARGE
)
AS
SELECT ACCOUNT_ID, SUM(SUM_CHARGE)
FROM /*PREFIX*/CHARGES
GROUP BY ACCOUNT_ID
--
/* Фиксация изменений */
COMMIT |
CREATE OR REPLACE PUBLIC SYNONYM finance_report_pkg FOR orient.finance_report_pkg; |
with commits_data as (
select c.dup_repo_name as repo,
c.sha,
c.dup_actor_id as actor_id,
c.dup_actor_login as actor_login,
coalesce(aa.company_name, '') as company
from
gha_commits c
left join
gha_actors_affiliations aa
on
aa.actor_id = c.dup_actor_id
and aa.dt_from <= c.dup_created_at
and aa.dt_to > c.dup_created_at
where
{{period:c.dup_created_at}}
and (lower(c.dup_actor_login) {{exclude_bots}})
union select c.dup_repo_name as repo,
c.sha,
c.author_id as actor_id,
c.dup_author_login as actor_login,
coalesce(aa.company_name, '') as company
from
gha_commits c
left join
gha_actors_affiliations aa
on
aa.actor_id = c.author_id
and aa.dt_from <= c.dup_created_at
and aa.dt_to > c.dup_created_at
where
c.author_id is not null
and {{period:c.dup_created_at}}
and (lower(c.dup_author_login) {{exclude_bots}})
union select c.dup_repo_name as repo,
c.sha,
c.committer_id as actor_id,
c.dup_committer_login as actor_login,
coalesce(aa.company_name, '') as company
from
gha_commits c
left join
gha_actors_affiliations aa
on
aa.actor_id = c.committer_id
and aa.dt_from <= c.dup_created_at
and aa.dt_to > c.dup_created_at
where
c.committer_id is not null
and {{period:c.dup_created_at}}
and (lower(c.dup_committer_login) {{exclude_bots}})
union select cr.dup_repo_name as repo,
cr.sha,
cr.actor_id as actor_id,
cr.actor_login as actor_login,
coalesce(aa.company_name, '') as company
from
gha_commits_roles cr
left join
gha_actors_affiliations aa
on
aa.actor_id = cr.actor_id
and aa.dt_from <= cr.dup_created_at
and aa.dt_to > cr.dup_created_at
where
cr.actor_id is not null
and cr.actor_id != 0
and cr.role = 'Co-authored-by'
and {{period:cr.dup_created_at}}
and (lower(cr.actor_login) {{exclude_bots}})
)
select
'hdev_' || sub.metric || ',All_All' as metric,
sub.author || '$$$' || sub.company as name,
sub.value as value
from (
select 'commits' as metric,
actor_login as author,
company,
count(distinct sha) as value
from
commits_data
group by
actor_login,
company
union select case e.type
when 'PushEvent' then 'pushes'
when 'PullRequestReviewCommentEvent' then 'review_comments'
when 'PullRequestReviewEvent' then 'raw_reviews'
when 'IssueCommentEvent' then 'issue_comments'
when 'CommitCommentEvent' then 'commit_comments'
end as metric,
e.dup_actor_login as author,
coalesce(aa.company_name, '') as company,
count(e.id) as value
from
gha_events e
left join
gha_actors_affiliations aa
on
aa.actor_id = e.actor_id
and aa.dt_from <= e.created_at
and aa.dt_to > e.created_at
where
e.type in (
'PushEvent', 'PullRequestReviewCommentEvent', 'PullRequestReviewEvent',
'IssueCommentEvent', 'CommitCommentEvent'
)
and {{period:e.created_at}}
and (lower(e.dup_actor_login) {{exclude_bots}})
group by
e.type,
e.dup_actor_login,
aa.company_name
union select 'contributions' as metric,
e.dup_actor_login as author,
coalesce(aa.company_name, '') as company,
count(e.id) as value
from
gha_events e
left join
gha_actors_affiliations aa
on
aa.actor_id = e.actor_id
and aa.dt_from <= e.created_at
and aa.dt_to > e.created_at
where
e.type in (
'PushEvent', 'PullRequestEvent', 'IssuesEvent', 'PullRequestReviewEvent',
'CommitCommentEvent', 'IssueCommentEvent', 'PullRequestReviewCommentEvent'
)
and {{period:e.created_at}}
and (lower(e.dup_actor_login) {{exclude_bots}})
group by
e.dup_actor_login,
aa.company_name
union select 'active_repos' as metric,
e.dup_actor_login as author,
coalesce(aa.company_name, '') as company,
count(distinct e.repo_id) as value
from
gha_events e
left join
gha_actors_affiliations aa
on
aa.actor_id = e.actor_id
and aa.dt_from <= e.created_at
and aa.dt_to > e.created_at
where
{{period:e.created_at}}
and (lower(e.dup_actor_login) {{exclude_bots}})
group by
e.dup_actor_login,
aa.company_name
union select 'comments' as metric,
dup_user_login as author,
coalesce(aa.company_name, '') as company,
count(distinct id) as value
from
gha_comments c
left join
gha_actors_affiliations aa
on
aa.actor_id = c.user_id
and aa.dt_from <= c.created_at
and aa.dt_to > c.created_at
where
{{period:c.created_at}}
and (lower(c.dup_user_login) {{exclude_bots}})
group by
c.dup_user_login,
aa.company_name
union select 'issues' as metric,
i.dup_user_login as author,
coalesce(aa.company_name, '') as company,
count(distinct i.id) as value
from
gha_issues i
left join
gha_actors_affiliations aa
on
aa.actor_id = i.user_id
and aa.dt_from <= i.created_at
and aa.dt_to > i.created_at
where
{{period:i.created_at}}
and i.is_pull_request = false
and (lower(i.dup_user_login) {{exclude_bots}})
group by
i.dup_user_login,
aa.company_name
union select 'prs' as metric,
i.dup_user_login as author,
coalesce(aa.company_name, '') as company,
count(distinct i.id) as value
from
gha_issues i
left join
gha_actors_affiliations aa
on
aa.actor_id = i.user_id
and aa.dt_from <= i.created_at
and aa.dt_to > i.created_at
where
{{period:i.created_at}}
and i.is_pull_request = true
and (lower(i.dup_user_login) {{exclude_bots}})
group by
i.dup_user_login,
aa.company_name
union select 'merged_prs' as metric,
i.dup_user_login as author,
coalesce(aa.company_name, '') as company,
count(distinct i.id) as value
from
gha_pull_requests i
left join
gha_actors_affiliations aa
on
aa.actor_id = i.user_id
and i.merged_at is not null
and aa.dt_from <= i.merged_at
and aa.dt_to > i.merged_at
where
{{period:i.merged_at}}
and (lower(i.dup_user_login) {{exclude_bots}})
group by
i.dup_user_login,
aa.company_name
union select 'events' as metric,
e.dup_actor_login as author,
coalesce(aa.company_name, '') as company,
count(e.id) as value
from
gha_events e
left join
gha_actors_affiliations aa
on
aa.actor_id = e.actor_id
and aa.dt_from <= e.created_at
and aa.dt_to > e.created_at
where
{{period:e.created_at}}
and (lower(e.dup_actor_login) {{exclude_bots}})
group by
e.dup_actor_login,
aa.company_name
) sub
/*where
(sub.metric = 'events' and sub.value >= 200)
or (sub.metric = 'active_repos' and sub.value >= 3)
or (sub.metric = 'contributions' and sub.value >= 30)
or (sub.metric = 'commit_comments' and sub.value >= 10)
or (sub.metric = 'comments' and sub.value >= 20)
or (sub.metric = 'issue_comments' and sub.value >= 20)
or (sub.metric = 'review_comments' and sub.value >= 20)
or (sub.metric in (
'commits',
'pushes',
'issues',
'prs',
'merged_prs'
) and sub.value > 1
)*/
union select 'hdev_' || sub.metric || ',' || sub.repo || '_All' as metric,
sub.author || '$$$' || sub.company as name,
sub.value as value
from (
select 'commits' as metric,
repo,
actor_login as author,
company,
count(distinct sha) as value
from
commits_data
where
repo in (select repo_name from trepos)
group by
repo,
actor_login,
company
union select case sub.type
when 'PushEvent' then 'pushes'
when 'PullRequestReviewCommentEvent' then 'review_comments'
when 'PullRequestReviewEvent' then 'raw_reviews'
when 'IssueCommentEvent' then 'issue_comments'
when 'CommitCommentEvent' then 'commit_comments'
end as metric,
sub.repo,
sub.author,
sub.company,
count(distinct sub.id) as value
from (
select e.dup_repo_name as repo,
e.type,
e.dup_actor_login as author,
coalesce(aa.company_name, '') as company,
e.id
from
gha_events e
left join
gha_actors_affiliations aa
on
aa.actor_id = e.actor_id
and aa.dt_from <= e.created_at
and aa.dt_to > e.created_at
where
e.type in (
'PushEvent', 'PullRequestReviewCommentEvent', 'PullRequestReviewEvent',
'IssueCommentEvent', 'CommitCommentEvent'
)
and {{period:e.created_at}}
and (lower(e.dup_actor_login) {{exclude_bots}})
and e.dup_repo_name in (select repo_name from trepos)
) sub
group by
sub.repo,
sub.type,
sub.author,
sub.company
union select 'contributions' as metric,
sub.repo,
sub.author,
sub.company,
count(distinct sub.id) as value
from (
select e.dup_repo_name as repo,
e.dup_actor_login as author,
coalesce(aa.company_name, '') as company,
e.id
from
gha_events e
left join
gha_actors_affiliations aa
on
aa.actor_id = e.actor_id
and aa.dt_from <= e.created_at
and aa.dt_to > e.created_at
where
e.type in (
'PushEvent', 'PullRequestEvent', 'IssuesEvent', 'PullRequestReviewEvent',
'CommitCommentEvent', 'IssueCommentEvent', 'PullRequestReviewCommentEvent'
)
and {{period:e.created_at}}
and (lower(e.dup_actor_login) {{exclude_bots}})
and e.dup_repo_name in (select repo_name from trepos)
) sub
group by
sub.repo,
sub.author,
sub.company
union select 'active_repos' as metric,
sub.repo,
sub.author,
sub.company,
count(distinct sub.repo_id) as value
from (
select e.dup_repo_name as repo,
e.dup_actor_login as author,
coalesce(aa.company_name, '') as company,
e.repo_id
from
gha_events e
left join
gha_actors_affiliations aa
on
aa.actor_id = e.actor_id
and aa.dt_from <= e.created_at
and aa.dt_to > e.created_at
where
{{period:e.created_at}}
and (lower(e.dup_actor_login) {{exclude_bots}})
and e.dup_repo_name in (select repo_name from trepos)
) sub
group by
sub.repo,
sub.author,
sub.company
union select 'comments' as metric,
sub.repo,
sub.author,
sub.company,
count(distinct sub.id) as value
from (
select c.dup_repo_name as repo,
c.dup_user_login as author,
coalesce(aa.company_name, '') as company,
c.id
from
gha_comments c
left join
gha_actors_affiliations aa
on
aa.actor_id = c.user_id
and aa.dt_from <= c.created_at
and aa.dt_to > c.created_at
where
{{period:c.created_at}}
and (lower(c.dup_user_login) {{exclude_bots}})
and c.dup_repo_name in (select repo_name from trepos)
) sub
group by
sub.author,
sub.company,
sub.repo
union select case sub.is_pull_request
when true then 'prs'
else 'issues'
end as metric,
sub.repo,
sub.author,
sub.company,
count(distinct sub.id) as value
from (
select i.dup_repo_name as repo,
i.dup_user_login as author,
coalesce(aa.company_name, '') as company,
i.id,
i.is_pull_request
from
gha_issues i
left join
gha_actors_affiliations aa
on
aa.actor_id = i.user_id
and aa.dt_from <= i.created_at
and aa.dt_to > i.created_at
where
{{period:i.created_at}}
and (lower(i.dup_user_login) {{exclude_bots}})
and i.dup_repo_name in (select repo_name from trepos)
) sub
group by
sub.repo,
sub.is_pull_request,
sub.author,
sub.company
union select 'merged_prs' as metric,
sub.repo,
sub.author,
sub.company,
count(distinct sub.id) as value
from (
select i.dup_repo_name as repo,
i.dup_user_login as author,
coalesce(aa.company_name, '') as company,
i.id
from
gha_pull_requests i
left join
gha_actors_affiliations aa
on
aa.actor_id = i.user_id
and aa.dt_from <= i.merged_at
and aa.dt_to > i.merged_at
where
i.merged_at is not null
and {{period:i.merged_at}}
and (lower(i.dup_user_login) {{exclude_bots}})
and i.dup_repo_name in (select repo_name from trepos)
) sub
group by
sub.repo,
sub.author,
sub.company
union select 'events' as metric,
sub.repo,
sub.author,
sub.company,
count(distinct sub.id) as value
from (
select e.dup_repo_name as repo,
e.dup_actor_login as author,
coalesce(aa.company_name, '') as company,
e.id
from
gha_events e
left join
gha_actors_affiliations aa
on
aa.actor_id = e.actor_id
and aa.dt_from <= e.created_at
and aa.dt_to > e.created_at
where
{{period:e.created_at}}
and (lower(e.dup_actor_login) {{exclude_bots}})
and e.dup_repo_name in (select repo_name from trepos)
) sub
group by
sub.repo,
sub.author,
sub.company
) sub
union select 'hdev_' || sub.metric || ',All_' || sub.country as metric,
sub.author || '$$$' || sub.company as name,
sub.value as value
from (
select 'commits' as metric,
a.country_name as country,
a.login as author,
c.company,
count(distinct c.sha) as value
from
commits_data c,
gha_actors a
where
c.actor_id = a.id
and a.country_name is not null
group by
a.country_name,
a.login,
c.company
union select case e.type
when 'PushEvent' then 'pushes'
when 'PullRequestReviewCommentEvent' then 'review_comments'
when 'PullRequestReviewEvent' then 'raw_reviews'
when 'IssueCommentEvent' then 'issue_comments'
when 'CommitCommentEvent' then 'commit_comments'
end as metric,
a.country_name as country,
a.login as author,
coalesce(aa.company_name, '') as company,
count(distinct e.id) as value
from
gha_actors a,
gha_events e
left join
gha_actors_affiliations aa
on
aa.actor_id = e.actor_id
and aa.dt_from <= e.created_at
and aa.dt_to > e.created_at
where
(e.actor_id = a.id or e.dup_actor_login = a.login)
and e.type in (
'PushEvent', 'PullRequestReviewCommentEvent', 'PullRequestReviewEvent',
'IssueCommentEvent', 'CommitCommentEvent'
)
and {{period:e.created_at}}
and (lower(a.login) {{exclude_bots}})
and a.country_name is not null
group by
e.type,
a.country_name,
a.login,
aa.company_name
union select 'contributions' as metric,
a.country_name as country,
a.login as author,
coalesce(aa.company_name, '') as company,
count(distinct e.id) as value
from
gha_actors a,
gha_events e
left join
gha_actors_affiliations aa
on
aa.actor_id = e.actor_id
and aa.dt_from <= e.created_at
and aa.dt_to > e.created_at
where
(e.actor_id = a.id or e.dup_actor_login = a.login)
and e.type in (
'PushEvent', 'PullRequestEvent', 'IssuesEvent', 'PullRequestReviewEvent',
'CommitCommentEvent', 'IssueCommentEvent', 'PullRequestReviewCommentEvent'
)
and {{period:e.created_at}}
and (lower(a.login) {{exclude_bots}})
and a.country_name is not null
group by
a.country_name,
a.login,
aa.company_name
union select 'active_repos' as metric,
a.country_name as country,
a.login as author,
coalesce(aa.company_name, '') as company,
count(distinct e.repo_id) as value
from
gha_actors a,
gha_events e
left join
gha_actors_affiliations aa
on
aa.actor_id = e.actor_id
and aa.dt_from <= e.created_at
and aa.dt_to > e.created_at
where
(e.actor_id = a.id or e.dup_actor_login = a.login)
and {{period:e.created_at}}
and (lower(a.login) {{exclude_bots}})
and a.country_name is not null
group by
a.country_name,
a.login,
aa.company_name
union select 'comments' as metric,
a.country_name as country,
a.login as author,
coalesce(aa.company_name, '') as company,
count(distinct c.id) as value
from
gha_actors a,
gha_comments c
left join
gha_actors_affiliations aa
on
aa.actor_id = c.user_id
and aa.dt_from <= c.created_at
and aa.dt_to > c.created_at
where
(c.user_id = a.id or c.dup_user_login = a.login)
and {{period:c.created_at}}
and (lower(a.login) {{exclude_bots}})
and a.country_name is not null
group by
a.country_name,
a.login,
aa.company_name
union select 'issues' as metric,
a.country_name as country,
a.login as author,
coalesce(aa.company_name, '') as company,
count(distinct i.id) as value
from
gha_actors a,
gha_issues i
left join
gha_actors_affiliations aa
on
aa.actor_id = i.user_id
and aa.dt_from <= i.created_at
and aa.dt_to > i.created_at
where
(i.user_id = a.id or i.dup_user_login = a.login)
and {{period:i.created_at}}
and i.is_pull_request = false
and (lower(a.login) {{exclude_bots}})
and a.country_name is not null
group by
a.country_name,
a.login,
aa.company_name
union select 'prs' as metric,
a.country_name as country,
a.login as author,
coalesce(aa.company_name, '') as company,
count(distinct pr.id) as value
from
gha_actors a,
gha_issues pr
left join
gha_actors_affiliations aa
on
aa.actor_id = pr.user_id
and aa.dt_from <= pr.created_at
and aa.dt_to > pr.created_at
where
(pr.user_id = a.id or pr.dup_user_login = a.login)
and {{period:pr.created_at}}
and pr.is_pull_request = true
and (lower(a.login) {{exclude_bots}})
and a.country_name is not null
group by
a.country_name,
a.login,
aa.company_name
union select 'merged_prs' as metric,
a.country_name as country,
a.login as author,
coalesce(aa.company_name, '') as company,
count(distinct pr.id) as value
from
gha_actors a,
gha_pull_requests pr
left join
gha_actors_affiliations aa
on
aa.actor_id = pr.user_id
and aa.dt_from <= pr.merged_at
and aa.dt_to > pr.merged_at
where
(pr.user_id = a.id or pr.dup_user_login = a.login)
and pr.merged_at is not null
and {{period:pr.merged_at}}
and (lower(a.login) {{exclude_bots}})
and a.country_name is not null
group by
a.country_name,
a.login,
aa.company_name
union select 'events' as metric,
a.country_name as country,
a.login as author,
coalesce(aa.company_name, '') as company,
count(distinct e.id) as value
from
gha_actors a,
gha_events e
left join
gha_actors_affiliations aa
on
aa.actor_id = e.actor_id
and aa.dt_from <= e.created_at
and aa.dt_to > e.created_at
where
(e.actor_id = a.id or e.dup_actor_login = a.login)
and {{period:e.created_at}}
and (lower(a.login) {{exclude_bots}})
and a.country_name is not null
group by
a.country_name,
a.login,
aa.company_name
) sub
/*where
(sub.metric = 'events' and sub.value >= 100)
or (sub.metric = 'active_repos' and sub.value >= 3)
or (sub.metric = 'contributions' and sub.value >= 15)
or (sub.metric = 'commit_comments' and sub.value >= 5)
or (sub.metric = 'comments' and sub.value >= 15)
or (sub.metric = 'issue_comments' and sub.value >= 10)
or (sub.metric = 'review_comments' and sub.value >= 10)
or (sub.metric in (
'commits',
'pushes',
'issues',
'prs',
'merged_prs'
) and sub.value > 1
)*/
union select 'hdev_' || sub.metric || ',' || sub.repo || '_' || sub.country as metric,
sub.author || '$$$' || sub.company as name,
sub.value as value
from (
select 'commits' as metric,
c.repo,
a.country_name as country,
a.login as author,
c.company,
count(distinct c.sha) as value
from
commits_data c,
gha_actors a
where
c.actor_id = a.id
and a.country_name is not null
and c.repo in (select repo_name from trepos)
group by
c.repo,
a.country_name,
a.login,
c.company
union select case sub.type
when 'PushEvent' then 'pushes'
when 'PullRequestReviewCommentEvent' then 'review_comments'
when 'PullRequestReviewEvent' then 'raw_reviews'
when 'IssueCommentEvent' then 'issue_comments'
when 'CommitCommentEvent' then 'commit_comments'
end as metric,
sub.repo,
sub.country,
sub.author,
sub.company,
count(distinct sub.id) as value
from (
select e.dup_repo_name as repo,
e.type,
a.country_name as country,
a.login as author,
coalesce(aa.company_name, '') as company,
e.id
from
gha_actors a,
gha_events e
left join
gha_actors_affiliations aa
on
aa.actor_id = e.actor_id
and aa.dt_from <= e.created_at
and aa.dt_to > e.created_at
where
(e.actor_id = a.id or e.dup_actor_login = a.login)
and e.type in (
'PushEvent', 'PullRequestReviewCommentEvent', 'PullRequestReviewEvent',
'IssueCommentEvent', 'CommitCommentEvent'
)
and {{period:e.created_at}}
and (lower(a.login) {{exclude_bots}})
and e.dup_repo_name in (select repo_name from trepos)
) sub
where
sub.country is not null
group by
sub.repo,
sub.type,
sub.country,
sub.author,
sub.company
union select 'contributions' as metric,
sub.repo,
sub.country,
sub.author,
sub.company,
count(distinct sub.id) as value
from (
select e.dup_repo_name as repo,
a.country_name as country,
a.login as author,
coalesce(aa.company_name, '') as company,
e.id
from
gha_actors a,
gha_events e
left join
gha_actors_affiliations aa
on
aa.actor_id = e.actor_id
and aa.dt_from <= e.created_at
and aa.dt_to > e.created_at
where
(e.actor_id = a.id or e.dup_actor_login = a.login)
and e.type in (
'PushEvent', 'PullRequestEvent', 'IssuesEvent', 'PullRequestReviewEvent',
'CommitCommentEvent', 'IssueCommentEvent', 'PullRequestReviewCommentEvent'
)
and {{period:e.created_at}}
and (lower(a.login) {{exclude_bots}})
and e.dup_repo_name in (select repo_name from trepos)
) sub
where
sub.country is not null
group by
sub.repo,
sub.country,
sub.author,
sub.company
union select 'active_repos' as metric,
sub.repo,
sub.country,
sub.author,
sub.company,
count(distinct sub.repo_id) as value
from (
select e.dup_repo_name as repo,
a.country_name as country,
a.login as author,
coalesce(aa.company_name, '') as company,
e.repo_id
from
gha_actors a,
gha_events e
left join
gha_actors_affiliations aa
on
aa.actor_id = e.actor_id
and aa.dt_from <= e.created_at
and aa.dt_to > e.created_at
where
(e.actor_id = a.id or e.dup_actor_login = a.login)
and {{period:e.created_at}}
and (lower(a.login) {{exclude_bots}})
and e.dup_repo_name in (select repo_name from trepos)
) sub
where
sub.country is not null
group by
sub.repo,
sub.country,
sub.author,
sub.company
union select 'comments' as metric,
sub.repo,
sub.country,
sub.author,
sub.company,
count(distinct sub.id) as value
from (
select c.dup_repo_name as repo,
a.country_name as country,
a.login as author,
coalesce(aa.company_name, '') as company,
c.id
from
gha_actors a,
gha_comments c
left join
gha_actors_affiliations aa
on
aa.actor_id = c.user_id
and aa.dt_from <= c.created_at
and aa.dt_to > c.created_at
where
(c.user_id = a.id or c.dup_user_login = a.login)
and {{period:c.created_at}}
and (lower(a.login) {{exclude_bots}})
and c.dup_repo_name in (select repo_name from trepos)
) sub
where
sub.country is not null
group by
sub.repo,
sub.country,
sub.author,
sub.company
union select case sub.is_pull_request
when true then 'prs'
else 'issues'
end as metric,
sub.repo,
sub.country,
sub.author,
sub.company,
count(distinct sub.id) as value
from (
select i.dup_repo_name as repo,
a.country_name as country,
a.login as author,
coalesce(aa.company_name, '') as company,
i.id,
i.is_pull_request
from
gha_actors a,
gha_issues i
left join
gha_actors_affiliations aa
on
aa.actor_id = i.user_id
and aa.dt_from <= i.created_at
and aa.dt_to > i.created_at
where
(i.user_id = a.id or i.dup_user_login = a.login)
and {{period:i.created_at}}
and (lower(a.login) {{exclude_bots}})
and i.dup_repo_name in (select repo_name from trepos)
) sub
where
sub.country is not null
group by
sub.is_pull_request,
sub.repo,
sub.country,
sub.author,
sub.company
union select 'merged_prs' as metric,
sub.repo,
sub.country,
sub.author,
sub.company,
count(distinct sub.id) as value
from (
select i.dup_repo_name as repo,
a.country_name as country,
a.login as author,
coalesce(aa.company_name, '') as company,
i.id
from
gha_actors a,
gha_pull_requests i
left join
gha_actors_affiliations aa
on
aa.actor_id = i.user_id
and aa.dt_from <= i.merged_at
and aa.dt_to > i.merged_at
where
i.merged_at is not null
and (i.user_id = a.id or i.dup_user_login = a.login)
and {{period:i.merged_at}}
and (lower(a.login) {{exclude_bots}})
and i.dup_repo_name in (select repo_name from trepos)
) sub
where
sub.country is not null
group by
sub.repo,
sub.country,
sub.author,
sub.company
union select 'events' as metric,
sub.repo,
sub.country,
sub.author,
sub.company,
count(distinct sub.id) as value
from (
select e.dup_repo_name as repo,
a.country_name as country,
a.login as author,
coalesce(aa.company_name, '') as company,
e.id
from
gha_actors a,
gha_events e
left join
gha_actors_affiliations aa
on
aa.actor_id = e.actor_id
and aa.dt_from <= e.created_at
and aa.dt_to > e.created_at
where
(e.actor_id = a.id or e.dup_actor_login = a.login)
and {{period:e.created_at}}
and (lower(e.dup_actor_login) {{exclude_bots}})
and e.dup_repo_name in (select repo_name from trepos)
) sub
where
sub.country is not null
group by
sub.repo,
sub.country,
sub.author,
sub.company
) sub
/*where
(sub.metric = 'events' and sub.value >= 20)
or (sub.metric = 'active_repos' and sub.value >= 2)
or (sub.metric = 'contributions' and sub.value >= 5)
or (sub.metric = 'commit_comments' and sub.value >= 3)
or (sub.metric = 'comments' and sub.value >= 5)
or (sub.metric = 'issue_comments' and sub.value >= 5)
or (sub.metric = 'review_comments' and sub.value >= 5)
or (sub.metric in (
'commits',
'pushes',
'issues',
'prs',
'merged_prs'
)
)*/
order by
metric asc,
value desc,
name asc
;
|
#1114-update user_package_log 加入应用和userid字段提取
#1107-update 'teacher'字段转化为中文'教师'
#1106-update user_alive_count/package 增加用户总数。增加user_num_all表处理。
#1101-update user_day_new 优化。增加table月处理,月度分表
SET GLOBAL event_scheduler = 1;
DELIMITER //
DROP PROCEDURE IF EXISTS userpackagelog//
CREATE PROCEDURE userpackagelog()
BEGIN
set @asql=concat(
"
INSERT INTO user_package_log(userid,packagename,createtime,datetime)(
SELECT
sta.userid,
sta.packagename,
sta.createtime,
sta.datetime
FROM (
SELECT
case
when (message LIKE '%users/%') then substr(message,INSTR(message,'users')+6,5)
when (message LIKE '%works/%studentid%')then substr(message,INSTR(message,'studentid')+10,5)
when (message LIKE '%works/%teacherid%')then substr(message,INSTR(message,'teacherid')+10,5)
when (message LIKE '%t/userStatistical%help%')then substr(message,INSTR(message,'userStatistical')+16,5)
when (message LIKE '%userId=%')then substr(message,INSTR(message,'userId')+7,5)
when (message LIKE '%v_/%/message%')then substr(request,INSTR(request,'message')-6,5)
when (message LIKE '%/praised/comment/%')then substr(request,INSTR(request,'praised/comment')-6,5)
when (message LIKE '%interfaces%')then substr(message,INSTR(message,'UserId=')+7,5)
when (message LIKE '%osc.yunzuoye.net%')then substr(message,-5,5)
when (message LIKE '%oet.yunzuoye.net%')then substr(message,-5,5)
when (message LIKE '%wcc.yunzuoye.net%')then substr(message,-5,5)
when (message LIKE '%gw01.yunzuoye.net%')then substr(message,-5,5)
else 0 end as userid,
case
when local_addr='ztp.yunzuoye.net' then 'pingtai3'
when local_addr='cloudwk.yunzuoye.net' then 'yunzuoye3'
when local_addr='read.yunzuoye.net' then 'read'
when local_addr='gw01.yunzuoye.net' then 'guwen'
when local_addr='wcc.yunzuoye.net' then 'yuwen'
when local_addr='oet.yunzuoye.net' then 'kouyu'
when local_addr='osc.yunzuoye.net' then 'xiaowai'
when local_addr='isc.yunzuoye.net' then 'xiaonei'
when local_addr='response.yunzuoye.net' then 'xiangying'
when (request LIKE '%interfaces%homework_new%') then 'yunzuoye2'
when (request LIKE '%interfaces_stw_mathematics%') then 'shuxuestw'
when (request LIKE '%interfaces_yystw%') then 'yystw'
when (request LIKE '%interfaces_stw_science%') then 'kexuestw'
else 0 end as packagename,
request,
UNIX_TIMESTAMP(substr(message,1,19))+28800 as createtime,
from_unixtime(UNIX_TIMESTAMP(substr(message,1,19))+28800,'%Y-%m-%d') as datetime
FROM user_package",DATE_FORMAT(adddate(date(sysdate()) ,-1),'%Y%m%d')
," WHERE local_addr IN ('ztp.yunzuoye.net','cloudwk.yunzuoye.net','read.yunzuoye.net','gw01.yunzuoye.net','wcc.yunzuoye.net','oet.yunzuoye.net','osc.yunzuoye.net','isc.yunzuoye.net','response.yunzuoye.net')
OR request LIKE '%interfaces%'
) sta
WHERE sta.userid RLIKE '^[1-9]' AND sta.userid RLIKE '[0-9]$'
)
"
);
prepare stm from @asql;
EXECUTE stm;
end//
DELIMITER //
DROP EVENT IF EXISTS userpackagelog_event//
CREATE EVENT userpackagelog_event
ON SCHEDULE EVERY 24 HOUR STARTS '2017-10-24 06:00:00'
ON COMPLETION PRESERVE
DO CALL userpackagelog()//
DELIMITER //
DROP PROCEDURE IF EXISTS useraliveday//
CREATE PROCEDURE useraliveday()
BEGIN
delete from user_alive_day where datetime = adddate(date(sysdate()) ,-1);
INSERT INTO user_alive_day(userid,packagename,schoolid,schoolname,gradename,datetime)(
SELECT
st.userId,
st.packagename,
st.schoolId,
st.schoolName,
st.gradename,
st.datetime
FROM
(SELECT
sta1.userId,
sta1.packagename,
ifnull(ifnull(sta2.schoolId,sta3.schoolId),0) AS schoolId,
ifnull(ifnull(sta2.sSchoolName,sta3.sSchoolName),0) AS schoolName,
ifnull(sta2.usergrade,'教师') AS gradename,
sta1.datetime
FROM(
SELECT DISTINCT
a1.userId,
a1.packagename,
a1.datetime
FROM
user_package_log a1
WHERE a1.datetime=adddate(date(sysdate()) ,-1)
) sta1
LEFT JOIN (SELECT DISTINCT
a2.userId,
a2.groupId,
a2.schoolId,
a5.sSchoolName,
a3.`name` AS usergrade
FROM
xh_webmanage.XHSchool_ClazzMembers a2
LEFT JOIN xh_webmanage.XHSchool_Clazzes a3 ON a2.groupId = a3.id
LEFT JOIN xh_webmanage.XHSchool_Info a5 ON a5.iSchoolId = a2.schoolId
) sta2 ON sta1.userId = sta2.userId
LEFT JOIN (SELECT DISTINCT
a4.UserId,
a4.schoolId,
a5.sSchoolName
FROM
xh_webmanage.XHSchool_Teachers a4
LEFT JOIN xh_webmanage.XHSchool_Info a5 ON a5.iSchoolId = a4.schoolId
) sta3 ON sta1.userId = sta3.userId) st
);
end//
DELIMITER //
DROP EVENT IF EXISTS useraliveday_event//
CREATE EVENT useraliveday_event
ON SCHEDULE EVERY 24 HOUR STARTS '2017-10-24 06:05:00'
ON COMPLETION PRESERVE
DO CALL useraliveday()//
DELIMITER //
DROP PROCEDURE IF EXISTS userpackagecount//
CREATE PROCEDURE userpackagecount()
BEGIN
delete from user_package_count where datetime = adddate(date(sysdate()) ,-1);
INSERT INTO user_package_count(schoolid,schoolname,gradename,packagename,stunum,daystunum,weekstunum,monthstunum,teanum,dayteanum,weekteanum,monthteanum,datetime)(
SELECT
st1.schoolid,
st1.schoolname,
st1.gradename,
st1.packagename,
st5.stunum,
stdayapp.daystunum,
stweekapp.weekstunum,
stmonthapp.monthstunum,
st5.alluser - st5.stunum,
stdayapp.alluser - stdayapp.daystunum AS dayteanum,
stweekapp.alluser - stweekapp.weekstunum AS weekteanum,
stmonthapp.alluser - stmonthapp.monthstunum AS monthteanum,
adddate(date(sysdate()) ,-1) as datetime
FROM(SELECT DISTINCT
a1.schoolid,
a1.schoolname,
a1.gradename,
a1.packagename
FROM
user_alive_day a1
WHERE a1.schoolid!='0'
and UNIX_TIMESTAMP(a1.datetime)>=UNIX_TIMESTAMP(adddate(date(sysdate()) ,-30))
) st1
LEFT JOIN (SELECT
a2.schoolid,
a2.schoolname,
a2.gradename,
a2.packagename,
count(DISTINCT a2.userid) AS alluser,
ifnull(CASE WHEN (a2.gradename != '教师') THEN count(DISTINCT a2.userid)
END,0) AS daystunum
FROM
user_alive_day a2
WHERE a2.datetime=adddate(date(sysdate()) ,-1)
GROUP BY
a2.schoolid,
a2.schoolname,
a2.gradename,
a2.packagename
) stdayapp ON st1.schoolid = stdayapp.schoolid
AND st1.packagename = stdayapp.packagename
AND st1.gradename = stdayapp.gradename
LEFT JOIN (SELECT
a3.schoolid,
a3.schoolname,
a3.gradename,
a3.packagename,
count(DISTINCT a3.userid) AS alluser,
ifnull(CASE WHEN (a3.gradename != '教师') THEN count(DISTINCT a3.userid)
END,0) AS weekstunum
FROM
user_alive_day a3
where UNIX_TIMESTAMP(a3.datetime)>=UNIX_TIMESTAMP(adddate(date(sysdate()) ,-7))
GROUP BY
a3.schoolid,
a3.schoolname,
a3.gradename,
a3.packagename
) stweekapp ON st1.schoolid = stweekapp.schoolid
AND st1.packagename = stweekapp.packagename
AND st1.gradename = stweekapp.gradename
LEFT JOIN (SELECT
a4.schoolid,
a4.schoolname,
a4.gradename,
a4.packagename,
count(DISTINCT a4.userId) AS alluser,
ifnull(CASE WHEN (a4.gradename != '教师') THEN count(DISTINCT a4.userid)
END,0) AS monthstunum
FROM
user_alive_day a4
where UNIX_TIMESTAMP(a4.datetime)>=UNIX_TIMESTAMP(adddate(date(sysdate()) ,-30))
GROUP BY
a4.schoolid,
a4.schoolname,
a4.gradename,
a4.packagename
) stmonthapp ON st1.schoolid = stmonthapp.schoolid
AND st1.packagename = stmonthapp.packagename
AND st1.gradename = stmonthapp.gradename
LEFT JOIN(
SELECT
a6.schoolId,
a6.schoolName,
a6.gradename,
count(DISTINCT a6.userId) AS alluser,
ifnull(
CASE
WHEN (a6.gradename != '教师') THEN
count(DISTINCT a6.userId)
END,
0
) AS stunum
FROM
user_num_all a6
WHERE
UNIX_TIMESTAMP(a6.datetime) = UNIX_TIMESTAMP(
adddate(date(sysdate()) ,- 1))
GROUP BY
a6.schoolId,
a6.schoolName,
a6.gradename) st5 ON st1.schoolId = st5.schoolId
AND st1.gradename = st5.gradename
);
END//
DELIMITER //
DROP EVENT IF EXISTS userpackagecount_event//
CREATE EVENT userpackagecount_event
ON SCHEDULE EVERY 24 HOUR STARTS '2017-10-24 06:25:00'
ON COMPLETION PRESERVE
DO CALL userpackagecount()//
DELIMITER //
DROP PROCEDURE IF EXISTS useralivecount//
CREATE PROCEDURE useralivecount()
BEGIN
delete from user_alive_count where datetime = adddate(date(sysdate()) ,-1);
INSERT INTO user_alive_count(schoolid,schoolname,gradename,daynewuser,stunum,daystunum,weekstunum,monthstunum,teanum,dayteanum,weekteanum,monthteanum,datetime)(
SELECT
st1.schoolId,
st1.schoolName,
st1.gradename,
stdaynew.daynewuser,
st5.stunum,
stdayuser.daystunum,
stweekuser.weekstunum,
stmonthuser.monthstunum,
st5.alluser - st5.stunum AS teanum,
stdayuser.dayalluser - stdayuser.daystunum AS dayteanum,
stweekuser.weekalluser - stweekuser.weekstunum AS weekteanum,
stmonthuser.monthalluser - stmonthuser.monthstunum AS monthteanum,
adddate(date(sysdate()) ,-1) as datetime
FROM(SELECT DISTINCT
a5.schoolid,
a5.schoolname,
a5.gradename
FROM
user_alive_day a5
WHERE
a5.schoolid != '0'
and UNIX_TIMESTAMP(a5.datetime)>=UNIX_TIMESTAMP(adddate(date(sysdate()) ,-30))
) st1
LEFT JOIN (
SELECT
a1.schoolid,
a1.schoolname,
a1.gradename,
count(DISTINCT a1.userid) AS daynewuser
FROM
user_day_new a1
WHERE
UNIX_TIMESTAMP(a1.datetime) = UNIX_TIMESTAMP(adddate(date(sysdate()) ,- 1))
GROUP BY
a1.schoolid,
a1.schoolname,
a1.gradename
) stdaynew ON st1.schoolid = stdaynew.schoolid
AND st1.gradename = stdaynew.gradename
LEFT JOIN (
SELECT
a2.schoolid,
a2.schoolname,
a2.gradename,
count(DISTINCT a2.userId) AS dayalluser,
ifnull(CASE WHEN (a2.gradename != '教师') THEN count(DISTINCT a2.userid)
END,0) AS daystunum
FROM
user_alive_day a2
WHERE
UNIX_TIMESTAMP(a2.datetime) = UNIX_TIMESTAMP(adddate(date(sysdate()) ,- 1))
GROUP BY
a2.schoolid,
a2.schoolname,
a2.gradename
) stdayuser ON st1.schoolid = stdayuser.schoolid
AND st1.gradename = stdayuser.gradename
LEFT JOIN (
SELECT
a3.schoolid,
a3.schoolname,
a3.gradename,
count(DISTINCT a3.userId) AS weekalluser,
ifnull(
CASE
WHEN (a3.gradename != '教师') THEN
count(DISTINCT a3.userId)
END,
0
) AS weekstunum
FROM
user_alive_day a3
WHERE
UNIX_TIMESTAMP(a3.datetime) >= UNIX_TIMESTAMP(
adddate(date(sysdate()) ,- 7)
)
AND
UNIX_TIMESTAMP(a3.datetime) < UNIX_TIMESTAMP(
date(sysdate())
)
GROUP BY
a3.schoolid,
a3.schoolname,
a3.gradename
) stweekuser ON st1.schoolId = stweekuser.schoolId
AND st1.gradename = stweekuser.gradename
LEFT JOIN (
SELECT
a4.schoolid,
a4.schoolname,
a4.gradename,
count(DISTINCT a4.userId) AS monthalluser,
ifnull(
CASE
WHEN (a4.gradename != '教师') THEN
count(DISTINCT a4.userId)
END,
0
) AS monthstunum
FROM
user_alive_day a4
WHERE
UNIX_TIMESTAMP(a4.datetime) >= UNIX_TIMESTAMP(
adddate(date(sysdate()) ,- 30)
)
AND
UNIX_TIMESTAMP(a4.datetime) < UNIX_TIMESTAMP(
date(sysdate())
)
GROUP BY
a4.schoolid,
a4.schoolname,
a4.gradename
) stmonthuser ON st1.schoolid = stmonthuser.schoolid
AND st1.gradename = stmonthuser.gradename
LEFT JOIN(
SELECT
a6.schoolId,
a6.schoolName,
a6.gradename,
count(DISTINCT a6.userId) AS alluser,
ifnull(
CASE
WHEN (a6.gradename != '教师') THEN
count(DISTINCT a6.userId)
END,
0
) AS stunum
FROM
user_num_all a6
WHERE
UNIX_TIMESTAMP(a6.datetime) = UNIX_TIMESTAMP(
adddate(date(sysdate()) ,- 1))
GROUP BY
a6.schoolId,
a6.schoolName,
a6.gradename) st5 ON st1.schoolId = st5.schoolId
AND st1.gradename = st5.gradename
)
);
end//
DELIMITER //
DROP EVENT IF EXISTS useralivecount_event//
CREATE EVENT useralivecount_event
ON SCHEDULE EVERY 24 HOUR STARTS '2017-10-24 06:20:00'
ON COMPLETION PRESERVE
DO CALL useralivecount()//
DELIMITER //
DROP PROCEDURE IF EXISTS userdaynew//
CREATE PROCEDURE userdaynew()
BEGIN
delete from user_day_new where datetime = adddate(date(sysdate()) ,-1);
INSERT INTO user_day_new(userid,packagename,schoolid,schoolname,gradename,datetime)(
SELECT
st.userid,
st.packagename,
st.schoolid,
st.schoolname,
st.gradename,
st.datetime
FROM
(
SELECT
sta1.userid,
sta1.packagename,
ifnull(ifnull(sta2.schoolId,sta3.schoolId),0) AS schoolid,
ifnull(ifnull(sta2.sSchoolName,sta3.sSchoolName),0) AS schoolname,
ifnull(sta2.usergrade, '教师') AS gradename,
sta1.datetime
FROM(
SELECT
a1.userid,
a1.packagename,
a1.datetime
FROM
(
SELECT DISTINCT
a2.userid,
a2.packagename,
a2.datetime
FROM
user_package_log a2
WHERE a2.datetime = adddate(date(sysdate()) ,- 1)
)a1 left JOIN
(
select DISTINCT a8.userid
from user_package_log a8
WHERE a8.datetime NOT LIKE adddate(date(sysdate()),-1)
)sta8
on a1.userid = sta8.userid
WHERE sta8.userid IS NULL
) sta1
LEFT JOIN (
SELECT DISTINCT
a2.userId,
a2.groupId,
a2.schoolId,
a5.sSchoolName,
a3.`name` as usergrade
FROM
xh_webmanage.XHSchool_ClazzMembers a2
LEFT JOIN xh_webmanage.XHSchool_Clazzes a3 ON a2.groupId = a3.id
LEFT JOIN xh_webmanage.XHSchool_Info a5 ON a5.iSchoolId = a2.schoolId
) sta2 ON sta1.userId = sta2.userId
LEFT JOIN (
SELECT DISTINCT
a4.UserId,
a4.schoolId,
a5.sSchoolName
FROM
xh_webmanage.XHSchool_Teachers a4
LEFT JOIN xh_webmanage.XHSchool_Info a5 ON a5.iSchoolId = a4.schoolId
) sta3 ON sta1.userId = sta3.userId ) st
);
end//
DELIMITER //
DROP EVENT IF EXISTS userdaynew_event//
CREATE EVENT userdaynew_event
ON SCHEDULE EVERY 24 HOUR STARTS '2017-10-24 06:10:00'
ON COMPLETION PRESERVE
DO CALL userdaynew()//
DELIMITER //
DROP PROCEDURE IF EXISTS useralivehuorly//
CREATE PROCEDURE useralivehuorly()
BEGIN
delete from user_alive_day_hourly where datetime = adddate(date(sysdate()) ,-1);
INSERT INTO user_alive_day_hourly (hourly, usernum, datetime)(
SELECT
from_unixtime(createtime, '%H') AS hourly,
count(DISTINCT userid) usernum,
adddate(date(sysdate()),- 1) as datetime
FROM
user_package_log a1
WHERE
a1.datetime=adddate(date(sysdate()),- 1)
GROUP BY
from_unixtime(createtime, '%H')
);
delete from user_alive_day_hourly_date where datetime = adddate(date(sysdate()) ,-1);
INSERT INTO user_alive_day_hourly_date (datetime)(
SELECT
adddate(date(sysdate()) ,- 1) AS datetime
);
end//
DELIMITER //
DROP EVENT IF EXISTS useralivehuorly_event//
CREATE EVENT useralivehuorly_event
ON SCHEDULE EVERY 24 HOUR STARTS '2017-10-24 06:15:00'
ON COMPLETION PRESERVE
DO CALL useralivehuorly()//
DELIMITER //
DROP PROCEDURE IF EXISTS tabledrop7d//
CREATE PROCEDURE tabledrop7d()
BEGIN
set @asql=concat(
"drop table if exists user_package",DATE_FORMAT(adddate(date(sysdate()) ,-8),'%Y%m%d')
);
prepare stm from @asql;
EXECUTE stm;
end//
DELIMITER //
DROP EVENT IF EXISTS tabledrop7d_event//
CREATE EVENT tabledrop7d_event
ON SCHEDULE EVERY 24 HOUR STARTS '2017-10-28 06:30:00'
ON COMPLETION PRESERVE
DO CALL tabledrop7d()//
DELIMITER //
DROP PROCEDURE IF EXISTS tablemonthdeal//
CREATE PROCEDURE tablemonthdeal()
BEGIN
set @rename_table=concat(
"RENAME TABLE user_package_log to user_package_log_",DATE_FORMAT(adddate(date(sysdate()) ,-1),'%Y%m')
);
set @create_table= CONCAT('create table user_package_log(`id` int(11) NOT NULL AUTO_INCREMENT,
`userid` varchar(255) NOT NULL,
`packagename` varchar(255) DEFAULT NULL,
`createtime` varchar(255) DEFAULT NULL,
`datetime` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;');
prepare remt from @rename_table;
EXECUTE remt;
prepare crmt from @create_table;
EXECUTE crmt;
end//
DELIMITER //
DROP EVENT IF EXISTS tablemonthdeal_event//
CREATE EVENT tablemonthdeal_event
ON SCHEDULE EVERY 1 MONTH STARTS '2017-11-01 23:30:00'
ON COMPLETION PRESERVE
DO CALL tablemonthdeal()//
DELIMITER //
DROP PROCEDURE IF EXISTS usernumall//
CREATE PROCEDURE usernumall()
BEGIN
delete from user_num_all where datetime = adddate(date(sysdate()) ,-1);
INSERT INTO user_num_all(userid,schoolid,schoolname,gradename,datetime)(
SELECT
st.iUserId,
st.schoolId,
st.schoolName,
st.gradename,
st.datetime
FROM
(SELECT
sta1.iUserId,
ifnull(ifnull(sta2.schoolId,sta3.schoolId),0) AS schoolId,
ifnull(ifnull(sta2.sSchoolName,sta3.sSchoolName),0) AS schoolName,
ifnull(sta2.usergrade,'教师') AS gradename,
adddate(date(sysdate()) ,- 1) AS datetime
FROM(
SELECT DISTINCT
a0.iUserId
FROM
xh_webmanage.XHSys_User a0
WHERE
a0.iUserType in ('1','4')
AND
a0.iSchoolId NOT in ('0','900090009')
) sta1
LEFT JOIN (SELECT DISTINCT
a2.userId,
a2.groupId,
a2.schoolId,
a5.sSchoolName,
a3.`name` AS usergrade
FROM
xh_webmanage.XHSchool_ClazzMembers a2
LEFT JOIN xh_webmanage.XHSchool_Clazzes a3 ON a2.groupId = a3.id
LEFT JOIN xh_webmanage.XHSchool_Info a5 ON a5.iSchoolId = a2.schoolId
) sta2 ON sta1.iUserId = sta2.userId
LEFT JOIN (SELECT DISTINCT
a4.UserId,
a4.schoolId,
a5.sSchoolName
FROM
xh_webmanage.XHSchool_Teachers a4
LEFT JOIN xh_webmanage.XHSchool_Info a5 ON a5.iSchoolId = a4.schoolId
) sta3 ON sta1.iUserId = sta3.userId) st
WHERE st.schoolId!='0'
);
end//
DELIMITER //
DROP EVENT IF EXISTS usernumall_event//
CREATE EVENT usernumall_event
ON SCHEDULE EVERY 24 HOUR STARTS '2017-11-07 03:30:00'
ON COMPLETION PRESERVE
DO CALL usernumall()//
|
-- 表的结构: xt_access --
CREATE TABLE `xt_access` (
`role_id` smallint(6) unsigned NOT NULL,
`node_id` smallint(6) unsigned NOT NULL,
`level` tinyint(1) NOT NULL,
`pid` smallint(6) NOT NULL,
`module` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
KEY `groupId` (`role_id`) USING BTREE,
KEY `nodeId` (`node_id`) USING BTREE
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- <fen> --
-- 表的结构: xt_address --
CREATE TABLE `xt_address` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`uid` int(11) NOT NULL,
`name` varchar(200) COLLATE utf8_unicode_ci NOT NULL,
`address` varchar(200) COLLATE utf8_unicode_ci NOT NULL,
`tel` varchar(200) COLLATE utf8_unicode_ci NOT NULL,
`moren` int(11) NOT NULL COMMENT '是否为默认地址',
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=9 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- <fen> --
-- 表的结构: xt_bonus --
CREATE TABLE `xt_bonus` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`uid` int(11) NOT NULL,
`user_id` varchar(200) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
`did` int(11) NOT NULL,
`s_date` int(11) NOT NULL,
`e_date` int(11) NOT NULL,
`b0` decimal(12,2) NOT NULL,
`b1` decimal(12,2) NOT NULL,
`b2` decimal(12,2) NOT NULL,
`b3` decimal(12,2) NOT NULL,
`b4` decimal(12,2) NOT NULL,
`b5` decimal(12,2) NOT NULL,
`b6` decimal(12,2) NOT NULL,
`b7` decimal(12,2) NOT NULL,
`b8` decimal(12,2) NOT NULL,
`b9` decimal(12,2) NOT NULL,
`b11` decimal(12,2) NOT NULL,
`b12` decimal(12,2) NOT NULL,
`b10` decimal(12,2) NOT NULL,
`b13` double(12,2) DEFAULT '0.00',
`b14` double(12,2) DEFAULT '0.00',
`b15` double(12,2) DEFAULT '0.00',
`b16` double(12,2) DEFAULT '0.00',
`b17` double(12,2) DEFAULT '0.00',
`b18` double(12,2) DEFAULT '0.00',
`b19` double(12,2) DEFAULT '0.00',
`b20` double(12,2) DEFAULT '0.00',
`b21` double(12,0) DEFAULT '0',
`encash_l` int(11) NOT NULL,
`encash_r` int(11) NOT NULL,
`encash` int(11) NOT NULL,
`is_count_b` int(11) NOT NULL,
`is_count_c` int(11) NOT NULL,
`is_pay` int(11) NOT NULL,
`u_level` int(11) NOT NULL,
`type` smallint(2) NOT NULL DEFAULT '0',
`additional` varchar(50) NOT NULL COMMENT '额外奖',
`encourage` varchar(50) NOT NULL COMMENT '阶段鼓励奖',
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=40054 DEFAULT CHARSET=utf8;
-- <fen> --
-- 表的结构: xt_bonus1 --
CREATE TABLE `xt_bonus1` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`uid` int(11) NOT NULL,
`user_id` varchar(200) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
`did` int(11) NOT NULL,
`s_date` int(11) NOT NULL,
`e_date` int(11) NOT NULL,
`b0` decimal(12,2) NOT NULL,
`b1` decimal(12,2) NOT NULL,
`b2` decimal(12,2) NOT NULL,
`b3` decimal(12,2) NOT NULL,
`b4` decimal(12,2) NOT NULL,
`b5` decimal(12,2) NOT NULL,
`b6` decimal(12,2) NOT NULL,
`b7` decimal(12,2) NOT NULL,
`b8` decimal(12,2) NOT NULL,
`b9` decimal(12,2) NOT NULL,
`b11` decimal(12,2) NOT NULL,
`b12` decimal(12,2) NOT NULL,
`b10` decimal(12,2) NOT NULL,
`b13` double(12,2) DEFAULT '0.00',
`b14` double(12,2) DEFAULT '0.00',
`b15` double(12,2) DEFAULT '0.00',
`b16` double(12,2) DEFAULT '0.00',
`b17` double(12,2) DEFAULT '0.00',
`b18` double(12,2) DEFAULT '0.00',
`b19` double(12,2) DEFAULT '0.00',
`b20` double(12,2) DEFAULT '0.00',
`b21` double(12,0) DEFAULT '0',
`encash_l` int(11) NOT NULL,
`encash_r` int(11) NOT NULL,
`encash` int(11) NOT NULL,
`is_count_b` int(11) NOT NULL,
`is_count_c` int(11) NOT NULL,
`is_pay` int(11) NOT NULL,
`u_level` int(11) NOT NULL,
`type` smallint(2) NOT NULL DEFAULT '0',
`additional` varchar(50) NOT NULL COMMENT '额外奖',
`encourage` varchar(50) NOT NULL COMMENT '阶段鼓励奖',
`nums` int(11) DEFAULT '0',
`re_nums` int(11) DEFAULT '0',
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=39556 DEFAULT CHARSET=utf8;
-- <fen> --
-- 表的结构: xt_bonushistory --
CREATE TABLE `xt_bonushistory` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`uid` int(11) NOT NULL,
`user_id` varchar(200) COLLATE utf8_unicode_ci NOT NULL,
`did` int(11) NOT NULL,
`d_user_id` varchar(200) COLLATE utf8_unicode_ci NOT NULL,
`action_type` varchar(32) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
`pdt` int(11) NOT NULL,
`epoints` decimal(12,2) NOT NULL,
`prep` decimal(12,2) NOT NULL,
`allp` decimal(12,2) NOT NULL,
`bz` text COLLATE utf8_unicode_ci NOT NULL,
`type` smallint(1) NOT NULL COMMENT '充值0明细1',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- <fen> --
-- 表的结构: xt_card --
CREATE TABLE `xt_card` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`bid` int(11) NOT NULL DEFAULT '0',
`buser_id` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
`card_no` varchar(200) COLLATE utf8_unicode_ci NOT NULL,
`card_pw` varchar(200) COLLATE utf8_unicode_ci NOT NULL,
`c_time` int(11) NOT NULL DEFAULT '0',
`f_time` int(11) NOT NULL DEFAULT '0',
`l_time` int(11) NOT NULL DEFAULT '0',
`b_time` int(11) NOT NULL DEFAULT '0',
`is_sell` int(3) NOT NULL DEFAULT '0',
`is_use` int(3) NOT NULL DEFAULT '0',
`money` decimal(12,2) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=150 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- <fen> --
-- 表的结构: xt_cash --
CREATE TABLE `xt_cash` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`order_id` varchar(200) COLLATE utf8_unicode_ci NOT NULL,
`uid` int(11) NOT NULL,
`user_id` varchar(50) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
`bid` int(11) NOT NULL DEFAULT '0',
`b_user_id` varchar(200) COLLATE utf8_unicode_ci NOT NULL,
`rdt` int(11) NOT NULL,
`money` decimal(12,2) NOT NULL,
`money_two` decimal(12,2) NOT NULL,
`epoint` int(11) NOT NULL DEFAULT '0',
`is_pay` int(11) NOT NULL,
`user_name` varchar(200) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
`bank_name` varchar(200) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
`bank_card` varchar(50) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
`x1` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
`x2` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
`x3` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
`x4` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
`sellbz` text COLLATE utf8_unicode_ci NOT NULL,
`s_type` smallint(3) NOT NULL DEFAULT '0',
`is_buy` int(11) NOT NULL DEFAULT '0',
`is_out` int(11) NOT NULL DEFAULT '0',
`bdt` int(11) NOT NULL DEFAULT '0',
`ldt` int(11) NOT NULL DEFAULT '0',
`okdt` int(11) NOT NULL DEFAULT '0',
`bz` text COLLATE utf8_unicode_ci NOT NULL,
`is_sh` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=6 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- <fen> --
-- 表的结构: xt_cashhistory --
CREATE TABLE `xt_cashhistory` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`cid` int(11) NOT NULL,
`order_id` varchar(200) COLLATE utf8_unicode_ci NOT NULL,
`did` int(11) NOT NULL,
`d_order_id` varchar(200) COLLATE utf8_unicode_ci NOT NULL,
`action_type` varchar(32) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
`pdt` int(11) NOT NULL,
`epoints` decimal(12,2) NOT NULL,
`allp` decimal(12,2) NOT NULL,
`bz` text COLLATE utf8_unicode_ci NOT NULL,
`type` smallint(1) NOT NULL COMMENT '充值0明细1',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- <fen> --
-- 表的结构: xt_cashpp --
CREATE TABLE `xt_cashpp` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`pp_orderid` varchar(200) COLLATE utf8_unicode_ci NOT NULL,
`order_id` varchar(200) COLLATE utf8_unicode_ci NOT NULL,
`b_order_id` varchar(200) COLLATE utf8_unicode_ci NOT NULL,
`uid` int(11) NOT NULL,
`user_id` varchar(50) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
`bid` int(11) NOT NULL DEFAULT '0',
`b_user_id` varchar(200) COLLATE utf8_unicode_ci NOT NULL,
`rdt` int(11) NOT NULL,
`money` decimal(12,2) NOT NULL,
`money_two` decimal(12,2) NOT NULL,
`epoint` int(11) NOT NULL DEFAULT '0',
`is_pay` int(11) NOT NULL,
`user_name` varchar(200) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
`bank_name` varchar(200) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
`bank_card` varchar(50) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
`x1` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
`x2` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
`x3` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
`x4` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
`sellbz` text COLLATE utf8_unicode_ci NOT NULL,
`s_type` smallint(3) NOT NULL DEFAULT '0',
`is_buy` int(11) NOT NULL DEFAULT '0',
`bdt` int(11) NOT NULL DEFAULT '0',
`ldt` int(11) NOT NULL DEFAULT '0',
`okdt` int(11) NOT NULL DEFAULT '0',
`bz` text COLLATE utf8_unicode_ci NOT NULL,
`is_sh` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- <fen> --
-- 表的结构: xt_chongzhi --
CREATE TABLE `xt_chongzhi` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`uid` int(11) NOT NULL,
`user_id` varchar(50) COLLATE utf8_bin NOT NULL,
`epoint` decimal(12,2) NOT NULL,
`huikuan` decimal(12,2) NOT NULL,
`zhuanghao` varchar(50) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
`rdt` int(11) NOT NULL,
`pdt` int(11) NOT NULL DEFAULT '0',
`is_pay` smallint(2) NOT NULL,
`stype` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=283 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
-- <fen> --
-- 表的结构: xt_cody --
CREATE TABLE `xt_cody` (
`c_id` smallint(6) NOT NULL AUTO_INCREMENT,
`cody_name` varchar(50) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
PRIMARY KEY (`c_id`)
) ENGINE=MyISAM AUTO_INCREMENT=31 DEFAULT CHARSET=utf8;
-- <fen> --
-- 表的结构: xt_cptype --
CREATE TABLE `xt_cptype` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`tpname` varchar(200) COLLATE utf8_unicode_ci NOT NULL,
`b_id` int(11) NOT NULL DEFAULT '0',
`s_id` int(11) NOT NULL DEFAULT '0',
`t_pai` int(11) NOT NULL DEFAULT '0',
`status` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- <fen> --
-- 表的结构: xt_fck --
CREATE TABLE `xt_fck` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`account` varchar(64) DEFAULT NULL,
`bind_account` varchar(50) DEFAULT NULL,
`new_login_time` int(11) NOT NULL DEFAULT '0',
`new_login_ip` varchar(40) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
`last_login_time` int(11) unsigned DEFAULT '0',
`last_login_ip` varchar(40) DEFAULT NULL,
`create_ip` varchar(40) DEFAULT NULL,
`login_count` mediumint(8) unsigned DEFAULT '0',
`verify` varchar(32) DEFAULT NULL,
`email` varchar(50) DEFAULT NULL,
`remark` varchar(255) DEFAULT NULL,
`create_time` int(11) unsigned NOT NULL,
`update_time` int(11) unsigned DEFAULT NULL,
`status` tinyint(1) DEFAULT '0',
`type_id` tinyint(2) unsigned DEFAULT '0',
`info` text,
`name` varchar(25) DEFAULT NULL,
`dept_id` smallint(3) DEFAULT NULL,
`user_id` varchar(200) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL COMMENT '用户编号',
`user_name` varchar(200) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL COMMENT '银行开户名',
`password` varchar(200) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL COMMENT '一级密码',
`pwd1` varchar(50) DEFAULT NULL COMMENT '一级密码不加密',
`passopen` varchar(200) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL COMMENT '二级密码',
`pwd2` varchar(50) DEFAULT NULL COMMENT '二级密码不加密',
`passopentwo` varchar(200) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL COMMENT '三级密码',
`pwd3` varchar(50) DEFAULT NULL COMMENT '三级密码不加密',
`nickname` varchar(200) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL COMMENT '昵称',
`qq` varchar(200) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL COMMENT 'QQ',
`bank_name` varchar(200) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL COMMENT '开户银行',
`bank_card` varchar(200) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL COMMENT '银行卡号',
`bank_province` varchar(200) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL COMMENT '开户银行所在省',
`bank_city` varchar(200) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL COMMENT '开户银行所在城市',
`bank_address` varchar(200) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL COMMENT '支行地址',
`user_code` varchar(200) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL COMMENT '身份证',
`user_address` varchar(200) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL COMMENT '联系地址',
`user_post` varchar(200) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL COMMENT '联系方式',
`user_tel` varchar(200) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL COMMENT '电话',
`user_phone` varchar(200) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL COMMENT '手机',
`rdt` int(11) NOT NULL COMMENT '注册时间',
`treeplace` int(11) DEFAULT NULL COMMENT '区分左(中)右',
`father_id` int(11) NOT NULL COMMENT '父节点',
`father_name` varchar(200) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL COMMENT '父名',
`re_id` int(11) NOT NULL COMMENT '推荐ID',
`re_name` varchar(200) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL COMMENT '推荐人名称',
`is_pay` int(11) NOT NULL COMMENT '是否开通(0,1)',
`is_lock` int(11) NOT NULL COMMENT '是否锁定(0,1)',
`is_lock_ok` int(3) NOT NULL DEFAULT '0',
`shoplx` int(11) NOT NULL COMMENT '报单中心ID',
`shop_a` varchar(200) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL COMMENT '//中心所在省',
`shop_b` varchar(200) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL COMMENT '//中心所在县',
`is_agent` int(11) NOT NULL COMMENT '报单中心(0,1,2)',
`agent_max` decimal(12,2) NOT NULL COMMENT '申请报单总金额',
`agent_use` decimal(12,2) NOT NULL COMMENT '奖金币',
`agent_zc` decimal(12,2) NOT NULL DEFAULT '0.00',
`agent_cash` decimal(12,2) NOT NULL COMMENT '报单币',
`agent_kt` decimal(12,2) NOT NULL DEFAULT '0.00',
`agent_xf` decimal(12,2) NOT NULL DEFAULT '0.00',
`agent_cf` decimal(12,2) NOT NULL DEFAULT '0.00',
`agent_gl` decimal(12,2) NOT NULL DEFAULT '0.00',
`agent_gp` decimal(12,2) NOT NULL DEFAULT '0.00',
`agent_sf` decimal(12,2) NOT NULL,
`agent_sfo` decimal(12,2) DEFAULT '0.00',
`agent_sfp` decimal(12,2) DEFAULT '0.00',
`agent_sfw` decimal(12,2) DEFAULT '0.00',
`gp_num` int(11) NOT NULL DEFAULT '0',
`agent_lock` decimal(12,2) NOT NULL DEFAULT '0.00',
`live_gupiao` int(11) NOT NULL DEFAULT '0',
`in_gupiao` int(11) NOT NULL DEFAULT '0',
`out_gupiao` int(11) NOT NULL DEFAULT '0',
`buy_gupiao` int(11) NOT NULL DEFAULT '0',
`flat_gupiao` int(11) NOT NULL DEFAULT '0',
`give_gupiao` int(11) NOT NULL DEFAULT '0',
`yuan_gupiao` int(11) NOT NULL DEFAULT '0',
`all_gupiao` int(11) NOT NULL DEFAULT '0',
`tx_num` int(3) NOT NULL DEFAULT '0',
`lssq` decimal(12,2) NOT NULL,
`zsq` decimal(12,2) NOT NULL,
`adt` int(11) NOT NULL COMMENT '申请成报单中心时间',
`l` int(11) NOT NULL COMMENT '左边总人数',
`r` int(11) NOT NULL COMMENT '右边总人数',
`benqi_l` int(11) NOT NULL COMMENT '本期左区新增',
`benqi_r` int(11) NOT NULL COMMENT '本期右区新增',
`shangqi_l` int(11) NOT NULL COMMENT '上期左区剩余',
`shangqi_r` int(11) NOT NULL COMMENT '上期右区剩余',
`peng_num` int(11) NOT NULL DEFAULT '0',
`u_level` int(11) DEFAULT NULL COMMENT '等级(会员级别)',
`u_levels` int(11) DEFAULT '0',
`is_boss` int(11) NOT NULL COMMENT '管理人为1,其它为0',
`idt` int(11) NOT NULL,
`pdt` int(11) NOT NULL COMMENT '开通时间',
`re_level` int(11) NOT NULL COMMENT '相对于推的代数',
`p_level` int(11) NOT NULL COMMENT '绝对层数',
`re_path` text CHARACTER SET utf8 COLLATE utf8_bin NOT NULL COMMENT '推荐的路径',
`p_path` text CHARACTER SET utf8 COLLATE utf8_bin NOT NULL COMMENT '自已的路径',
`tp_path` text CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
`is_del` int(11) NOT NULL,
`shop_id` int(11) NOT NULL COMMENT '隶属报单ID',
`shop_name` varchar(50) NOT NULL,
`b0` decimal(12,2) NOT NULL COMMENT '每期总资金',
`b1` decimal(12,2) NOT NULL COMMENT '奖1',
`b2` decimal(12,2) NOT NULL COMMENT '奖2',
`b3` decimal(12,2) NOT NULL COMMENT '奖3',
`b4` decimal(12,2) NOT NULL COMMENT '奖4',
`b5` decimal(12,2) NOT NULL COMMENT '奖5',
`b6` decimal(12,2) NOT NULL COMMENT '奖6',
`b7` decimal(12,2) NOT NULL COMMENT '奖7',
`b8` decimal(12,2) NOT NULL COMMENT '奖8',
`b9` decimal(12,2) NOT NULL COMMENT '奖9',
`b12` decimal(12,2) NOT NULL COMMENT '奖12',
`b11` decimal(12,2) NOT NULL COMMENT '奖11',
`b10` decimal(12,2) NOT NULL COMMENT '奖10',
`wlf` int(11) NOT NULL COMMENT '网络费',
`wlf_money` decimal(12,2) NOT NULL DEFAULT '0.00',
`cpzj` decimal(12,2) DEFAULT NULL COMMENT '注册金额',
`zjj` decimal(12,2) NOT NULL DEFAULT '0.00' COMMENT '总奖金',
`re_money` decimal(12,2) NOT NULL DEFAULT '0.00' COMMENT '推荐总注册金额',
`cz_epoint` decimal(12,2) NOT NULL DEFAULT '0.00' COMMENT '冲值总金额',
`lr` int(11) NOT NULL COMMENT '中间总单数',
`shangqi_lr` int(11) NOT NULL COMMENT '中间上期剩余单数',
`benqi_lr` int(11) NOT NULL COMMENT '中间本期单数',
`user_type` varchar(200) NOT NULL COMMENT '多线登录限制',
`re_peat_money` decimal(12,2) NOT NULL COMMENT 'x',
`re_nums` smallint(4) NOT NULL DEFAULT '0' COMMENT 'x',
`p_nums` smallint(4) NOT NULL DEFAULT '0',
`is_path` smallint(4) NOT NULL DEFAULT '0',
`outnums` smallint(4) NOT NULL DEFAULT '0',
`sh_level` smallint(4) NOT NULL,
`sh_one` smallint(4) NOT NULL DEFAULT '0',
`sh_two` smallint(4) NOT NULL DEFAULT '0',
`sh_three` smallint(4) DEFAULT '0',
`sh_four` smallint(4) DEFAULT '0',
`re_nums_b` int(11) NOT NULL DEFAULT '0',
`re_nums_l` int(11) NOT NULL DEFAULT '0',
`re_nums_r` int(11) NOT NULL DEFAULT '0',
`duipeng` decimal(12,2) NOT NULL,
`duipeng_p` varchar(255) DEFAULT '',
`_times` int(11) NOT NULL,
`fanli` int(11) NOT NULL,
`fanli_time` int(11) NOT NULL,
`fanli_num` int(11) NOT NULL,
`fanli_money` decimal(12,2) NOT NULL DEFAULT '0.00',
`is_fenh` smallint(2) NOT NULL,
`open` smallint(2) NOT NULL,
`f4` int(11) DEFAULT '0',
`new_agent` smallint(1) NOT NULL DEFAULT '0' COMMENT '//是否新服务中心',
`day_feng` decimal(12,2) NOT NULL DEFAULT '0.00',
`get_date` int(11) DEFAULT '0',
`get_numb` int(11) DEFAULT '0',
`is_jb` int(11) DEFAULT '0',
`sq_jb` int(11) DEFAULT '0',
`jb_sdate` int(11) DEFAULT '0',
`jb_idate` int(11) DEFAULT '0',
`man_ceng` int(11) NOT NULL DEFAULT '0' COMMENT '//满层数',
`prem` text CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL COMMENT '//权限',
`wang_j` smallint(1) NOT NULL DEFAULT '0' COMMENT '//结构图',
`wang_t` smallint(1) NOT NULL DEFAULT '0' COMMENT '//推荐图',
`get_level` int(11) NOT NULL DEFAULT '0',
`is_xf` smallint(11) NOT NULL DEFAULT '0',
`xf_money` decimal(12,2) NOT NULL DEFAULT '0.00',
`is_zy` int(11) NOT NULL DEFAULT '0',
`zyi_date` int(11) NOT NULL DEFAULT '0',
`zyq_date` int(11) NOT NULL DEFAULT '0',
`mon_get` decimal(12,2) NOT NULL DEFAULT '0.00',
`xy_money` decimal(12,2) NOT NULL DEFAULT '0.00',
`xx_money` decimal(12,2) NOT NULL DEFAULT '0.00',
`down_num` int(11) NOT NULL DEFAULT '0',
`u_pai` int(11) NOT NULL DEFAULT '0',
`n_pai` int(11) NOT NULL DEFAULT '0',
`ok_pay` int(11) NOT NULL DEFAULT '0',
`wenti` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
`wenti_dan` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
`is_tj` int(11) NOT NULL DEFAULT '0',
`re_f4` int(11) NOT NULL DEFAULT '0',
`is_aa` int(3) NOT NULL DEFAULT '0',
`is_bb` int(3) NOT NULL DEFAULT '0',
`us_img` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
`x_pai` int(11) NOT NULL DEFAULT '0',
`x_out` int(3) NOT NULL DEFAULT '0',
`x_num` int(11) NOT NULL DEFAULT '0',
`is_lockqd` int(11) NOT NULL COMMENT '是否关闭签到',
`is_lockfh` int(11) NOT NULL COMMENT '是否关闭分红',
`seller_rate` int(11) NOT NULL DEFAULT '5',
`is_fh` int(11) NOT NULL COMMENT '参与分红的次数',
`is_sf` int(2) NOT NULL DEFAULT '0',
`is_cc` int(11) NOT NULL COMMENT '国家',
`ach` int(11) NOT NULL DEFAULT '0',
`ach_s` int(11) DEFAULT '0',
`gdt` int(11) DEFAULT '0' COMMENT '加入分红的时间',
`pg_nums` int(11) DEFAULT '0' COMMENT '每周购买配股次数',
`fh_nums` int(11) DEFAULT '0' COMMENT '分红次数',
`is_cha` int(11) DEFAULT '0' COMMENT '分红点',
`re_pathb` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT '开通路径',
`kt_id` int(11) NOT NULL DEFAULT '0' COMMENT '开通的ID',
`tz_nums` int(11) DEFAULT '0' COMMENT '投资的次数',
`shangqi_use` decimal(12,0) DEFAULT '0' COMMENT '上一次积分',
`shangqi_tz` decimal(12,0) DEFAULT '0' COMMENT '上一次结算时的投资总额',
`jia_nums` int(11) DEFAULT '0' COMMENT '加单',
`vip4` int(11) DEFAULT '0',
`vip5` int(11) DEFAULT '0',
`vip6` int(11) DEFAULT '0',
`zdt` int(11) DEFAULT '0',
`shang_l` int(11) DEFAULT '0',
`shang_r` int(11) DEFAULT '0',
`shang_nums` int(11) DEFAULT '0',
`shang_ach` int(11) DEFAULT '0',
`z_date` int(11) DEFAULT '0',
`c_date` int(11) DEFAULT '0',
`l_nums` int(11) DEFAULT '0',
`r_nums` int(11) DEFAULT '0',
`ls` int(11) DEFAULT '0',
`rs` int(11) DEFAULT '0',
`s_province` varchar(200) DEFAULT '0',
`s_city` varchar(200) DEFAULT '0',
`s_county` varchar(200) DEFAULT '0',
`is_p` int(2) DEFAULT '0' COMMENT '省级代理',
`is_c` int(2) DEFAULT '0' COMMENT '市级代理',
`is_cty` int(2) DEFAULT '0' COMMENT '县级代理',
`youname` varchar(200) DEFAULT '0',
`youcar` varchar(200) DEFAULT '0',
`is_pp` int(2) DEFAULT '0',
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=3910 DEFAULT CHARSET=utf8;
-- <fen> --
-- 表的结构: xt_fck2 --
CREATE TABLE `xt_fck2` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`ceng` int(11) DEFAULT '0',
`numb` int(11) DEFAULT '0',
`fend` int(11) DEFAULT '0',
`jishu` int(11) NOT NULL DEFAULT '0' COMMENT '//����',
`fck_id` int(11) DEFAULT '0',
`user_id` varchar(200) COLLATE utf8_unicode_ci DEFAULT NULL,
`user_name` varchar(200) COLLATE utf8_unicode_ci DEFAULT NULL,
`nickname` varchar(200) COLLATE utf8_unicode_ci DEFAULT NULL,
`is_pay` int(11) NOT NULL DEFAULT '1',
`u_level` int(11) DEFAULT '0',
`re_num` int(11) NOT NULL DEFAULT '0',
`pdt` int(11) NOT NULL,
`treeplace` int(11) DEFAULT '0',
`father_id` int(11) DEFAULT '0',
`father_name` varchar(200) COLLATE utf8_unicode_ci DEFAULT NULL,
`p_level` int(11) DEFAULT '0',
`p_path` text CHARACTER SET utf8 COLLATE utf8_bin,
`u_pai` varchar(200) COLLATE utf8_unicode_ci DEFAULT '0',
`is_over` smallint(1) NOT NULL DEFAULT '0' COMMENT '//�ж��Ƿ�Ϊ����',
`is_out` smallint(1) NOT NULL DEFAULT '0' COMMENT '//�ж��Ƿ��Ѿ�����',
`is_yinc` smallint(1) NOT NULL DEFAULT '0' COMMENT '//����',
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- <fen> --
-- 表的结构: xt_fck_shop --
CREATE TABLE `xt_fck_shop` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`did` int(11) NOT NULL,
`uid` int(11) NOT NULL,
`price` decimal(12,2) NOT NULL,
`create_time` int(11) NOT NULL,
`is_pay` smallint(1) NOT NULL DEFAULT '0',
`pdt` int(11) NOT NULL,
`type` smallint(2) NOT NULL DEFAULT '0',
`num` int(11) NOT NULL DEFAULT '1',
`content` text NOT NULL,
`p_dt` int(11) NOT NULL COMMENT '退货时间',
`p_is_pay` smallint(2) NOT NULL DEFAULT '0' COMMENT '状态',
`out_type` smallint(2) NOT NULL DEFAULT '0' COMMENT '0为未评论,1为已评论',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
-- <fen> --
-- 表的结构: xt_fee --
CREATE TABLE `xt_fee` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`i1` int(12) DEFAULT '0',
`i2` int(12) DEFAULT '0',
`i3` int(12) DEFAULT '0',
`i4` int(12) DEFAULT '0',
`i5` int(12) DEFAULT '0',
`i6` int(12) DEFAULT '0',
`i7` int(12) DEFAULT '0',
`i8` int(12) DEFAULT '0',
`i9` int(12) DEFAULT '0',
`i10` int(12) DEFAULT '0',
`s1` varchar(200) DEFAULT NULL,
`s2` varchar(200) DEFAULT NULL,
`s3` varchar(200) DEFAULT NULL,
`s4` varchar(200) DEFAULT NULL,
`s5` varchar(200) DEFAULT NULL,
`s6` varchar(200) DEFAULT NULL,
`s7` varchar(200) DEFAULT NULL,
`s8` varchar(200) DEFAULT NULL,
`s9` varchar(200) DEFAULT NULL,
`s10` varchar(200) DEFAULT NULL,
`s11` varchar(200) DEFAULT NULL,
`s12` varchar(200) DEFAULT NULL,
`s13` varchar(200) DEFAULT NULL,
`s14` varchar(200) DEFAULT NULL,
`s15` varchar(200) DEFAULT NULL,
`s16` varchar(200) DEFAULT NULL,
`s17` varchar(200) DEFAULT NULL,
`s18` varchar(200) DEFAULT NULL,
`s19` varchar(200) DEFAULT NULL,
`s20` varchar(200) DEFAULT NULL,
`str1` varchar(200) DEFAULT NULL,
`str2` varchar(200) DEFAULT NULL,
`str3` varchar(200) DEFAULT NULL,
`str4` varchar(200) DEFAULT NULL,
`str5` varchar(200) DEFAULT NULL,
`str6` varchar(200) DEFAULT NULL,
`str7` varchar(200) DEFAULT NULL,
`str8` varchar(200) DEFAULT NULL,
`str9` varchar(200) DEFAULT NULL,
`str10` varchar(200) DEFAULT NULL,
`str11` varchar(200) DEFAULT NULL,
`str12` varchar(200) DEFAULT NULL,
`str13` varchar(200) DEFAULT NULL,
`str14` varchar(200) DEFAULT NULL,
`str15` varchar(200) DEFAULT NULL,
`str16` varchar(200) DEFAULT NULL,
`str17` varchar(200) DEFAULT NULL,
`str18` varchar(200) DEFAULT NULL,
`str19` varchar(200) DEFAULT NULL,
`str20` varchar(200) DEFAULT NULL,
`str21` varchar(200) DEFAULT NULL,
`str22` varchar(200) DEFAULT NULL,
`str23` varchar(200) DEFAULT NULL,
`str24` varchar(200) DEFAULT NULL,
`str25` varchar(200) DEFAULT NULL,
`str26` varchar(200) DEFAULT NULL,
`str27` varchar(200) DEFAULT NULL,
`str28` varchar(200) DEFAULT NULL,
`str29` varchar(200) DEFAULT NULL,
`str30` varchar(200) DEFAULT NULL,
`str99` text NOT NULL,
`us_num` int(11) NOT NULL DEFAULT '0',
`create_time` int(11) DEFAULT NULL COMMENT '清空数据时间截',
`f_time` int(11) NOT NULL DEFAULT '0',
`a_money` decimal(12,2) NOT NULL DEFAULT '0.00',
`b_money` decimal(12,2) NOT NULL DEFAULT '0.00',
`ff_num` int(11) NOT NULL DEFAULT '0',
`gp_one` decimal(12,2) NOT NULL DEFAULT '0.00' COMMENT '当前价格',
`gp_open` decimal(12,2) NOT NULL DEFAULT '0.00' COMMENT '开盘价格',
`gp_close` decimal(12,2) NOT NULL DEFAULT '0.00' COMMENT '关盘价格',
`gp_kg` int(3) NOT NULL DEFAULT '0' COMMENT '开关',
`gp_cnum` int(11) NOT NULL DEFAULT '0' COMMENT '拆股次数',
`gp_perc` varchar(50) NOT NULL COMMENT '手续费',
`gp_inm` varchar(50) NOT NULL COMMENT '交易分账',
`gp_inn` varchar(50) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
`gp_cgbl` varchar(50) NOT NULL COMMENT '拆比例',
`gp_fxnum` int(11) NOT NULL DEFAULT '0',
`gp_senum` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
-- <fen> --
-- 表的结构: xt_fenhong --
CREATE TABLE `xt_fenhong` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`uid` int(11) NOT NULL DEFAULT '0',
`user_id` varchar(200) COLLATE utf8_unicode_ci NOT NULL,
`f_num` decimal(12,2) NOT NULL DEFAULT '0.00',
`f_money` decimal(12,2) NOT NULL DEFAULT '0.00',
`pdt` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- <fen> --
-- 表的结构: xt_form --
CREATE TABLE `xt_form` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`title` varchar(255) NOT NULL,
`content` longtext NOT NULL,
`e_title` varchar(50) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
`e_content` text CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
`user_id` int(11) NOT NULL,
`create_time` int(11) unsigned NOT NULL,
`update_time` int(11) unsigned NOT NULL,
`status` tinyint(1) unsigned NOT NULL,
`baile` int(11) NOT NULL,
`type` varchar(255) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=103 DEFAULT CHARSET=utf8;
-- <fen> --
-- 表的结构: xt_form_class --
CREATE TABLE `xt_form_class` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(200) COLLATE utf8_unicode_ci NOT NULL,
`baile` int(11) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- <fen> --
-- 表的结构: xt_game --
CREATE TABLE `xt_game` (
`id` int(12) NOT NULL AUTO_INCREMENT,
`uid` int(12) NOT NULL,
`g_money` decimal(12,2) NOT NULL,
`used_money` decimal(12,2) NOT NULL,
`get_time` int(11) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=460 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- <fen> --
-- 表的结构: xt_gouwu --
CREATE TABLE `xt_gouwu` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`uid` int(11) NOT NULL,
`did` int(11) NOT NULL,
`lx` int(11) NOT NULL,
`ispay` smallint(2) NOT NULL,
`pdt` int(11) NOT NULL,
`money` decimal(12,2) NOT NULL,
`shu` int(11) NOT NULL,
`cprice` decimal(12,2) DEFAULT NULL,
`pvzhi` decimal(12,2) DEFAULT NULL,
`guquan` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL,
`s_type` int(11) DEFAULT '0',
`user_id` varchar(200) COLLATE utf8_unicode_ci DEFAULT NULL,
`us_name` varchar(200) COLLATE utf8_unicode_ci DEFAULT NULL,
`us_address` varchar(200) COLLATE utf8_unicode_ci DEFAULT NULL,
`us_tel` varchar(200) COLLATE utf8_unicode_ci DEFAULT NULL,
`isfh` int(11) DEFAULT '0',
`fhdt` int(11) DEFAULT '0',
`okdt` int(11) DEFAULT '0',
`ccxhbz` varchar(200) COLLATE utf8_unicode_ci DEFAULT NULL,
`countid` varchar(200) COLLATE utf8_unicode_ci DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=135 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- <fen> --
-- 表的结构: xt_gp --
CREATE TABLE `xt_gp` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`gp_name` varchar(100) COLLATE utf8_unicode_ci NOT NULL COMMENT '股票名称',
`danhao` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT '股票单号',
`opening` decimal(12,2) NOT NULL COMMENT '开盘价',
`closing` decimal(12,2) NOT NULL COMMENT '收盘价',
`today` decimal(12,2) NOT NULL COMMENT '当前报价',
`most_g` decimal(12,2) NOT NULL COMMENT '最高价',
`most_d` decimal(12,2) NOT NULL COMMENT '最低价',
`up` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT '涨幅',
`down` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT '跌幅',
`gp_quantity` int(11) NOT NULL DEFAULT '0' COMMENT '股票数量',
`cgp_num` int(11) NOT NULL DEFAULT '0',
`gp_zongji` decimal(12,2) NOT NULL DEFAULT '0.00' COMMENT '总价',
`turnover` varchar(50) COLLATE utf8_unicode_ci NOT NULL DEFAULT '0' COMMENT '成交量',
`f_date` varchar(50) COLLATE utf8_unicode_ci NOT NULL COMMENT '发布时间',
`status` int(11) NOT NULL COMMENT '状态(0关闭1开启)',
`pao_num` int(11) NOT NULL DEFAULT '0',
`ca_numb` int(11) NOT NULL DEFAULT '0',
`all_sell` int(11) NOT NULL DEFAULT '0',
`day_sell` int(11) NOT NULL DEFAULT '0',
`yt_sellnum` int(11) NOT NULL DEFAULT '0',
`buy_num` int(11) NOT NULL DEFAULT '0',
`sell_num` int(11) NOT NULL DEFAULT '0',
`fx_num` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- <fen> --
-- 表的结构: xt_gp_sell --
CREATE TABLE `xt_gp_sell` (
`id` int(12) NOT NULL AUTO_INCREMENT,
`uid` int(12) NOT NULL,
`sNun` int(11) NOT NULL DEFAULT '0',
`ispay` int(2) NOT NULL DEFAULT '0',
`eDate` int(11) NOT NULL DEFAULT '0',
`sell_mm` decimal(12,2) NOT NULL DEFAULT '0.00',
`sell_ln` int(11) NOT NULL DEFAULT '0',
`sell_mon` int(11) NOT NULL DEFAULT '0',
`sell_num` int(11) NOT NULL DEFAULT '0',
`sell_date` int(11) NOT NULL DEFAULT '0',
`is_over` smallint(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=5555 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- <fen> --
-- 表的结构: xt_gupiao --
CREATE TABLE `xt_gupiao` (
`id` int(12) NOT NULL AUTO_INCREMENT,
`uid` int(12) NOT NULL,
`pid` int(12) NOT NULL,
`price` decimal(12,2) NOT NULL DEFAULT '0.00',
`one_price` decimal(12,2) NOT NULL DEFAULT '0.00',
`sNun` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`used_num` int(12) NOT NULL,
`lnum` int(12) NOT NULL,
`ispay` int(2) NOT NULL,
`status` smallint(2) NOT NULL,
`eDate` int(11) NOT NULL,
`type` smallint(2) NOT NULL,
`is_en` smallint(1) NOT NULL DEFAULT '0',
`sell_mon` int(11) NOT NULL DEFAULT '0',
`sell_num` int(11) NOT NULL DEFAULT '0',
`sell_date` int(11) NOT NULL DEFAULT '0',
`is_over` smallint(1) NOT NULL DEFAULT '0',
`bz` varchar(200) COLLATE utf8_unicode_ci NOT NULL,
`buy_s` decimal(12,2) NOT NULL DEFAULT '0.00',
`buy_a` decimal(12,2) NOT NULL DEFAULT '0.00',
`buy_nn` int(11) NOT NULL DEFAULT '0',
`sell_g` decimal(12,2) NOT NULL DEFAULT '0.00',
`is_cancel` int(11) NOT NULL DEFAULT '0',
`spid` int(11) NOT NULL DEFAULT '0',
`last_s` int(11) NOT NULL DEFAULT '0',
`tpl` int(11) DEFAULT '0',
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=15411 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- <fen> --
-- 表的结构: xt_hgupiao --
CREATE TABLE `xt_hgupiao` (
`id` int(12) NOT NULL AUTO_INCREMENT,
`uid` int(12) NOT NULL,
`pid` int(12) NOT NULL,
`price` decimal(12,2) NOT NULL DEFAULT '0.00',
`gprice` decimal(12,2) NOT NULL DEFAULT '0.00',
`one_price` decimal(12,2) NOT NULL DEFAULT '0.00',
`gmp` decimal(12,2) NOT NULL DEFAULT '0.00',
`pmp` decimal(12,2) NOT NULL DEFAULT '0.00',
`sNun` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`ispay` int(2) NOT NULL,
`eDate` int(11) NOT NULL,
`type` smallint(2) NOT NULL,
`is_en` smallint(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=29292 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- <fen> --
-- 表的结构: xt_history --
CREATE TABLE `xt_history` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`uid` int(11) NOT NULL,
`user_id` varchar(50) NOT NULL,
`did` int(11) NOT NULL,
`user_did` varchar(50) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
`action_type` varchar(32) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
`pdt` int(11) NOT NULL,
`epoints` decimal(12,2) NOT NULL,
`allp` decimal(12,2) NOT NULL,
`bz` text NOT NULL,
`type` smallint(1) NOT NULL COMMENT '充值0明细1',
`act_pdt` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=657685 DEFAULT CHARSET=utf8;
-- <fen> --
-- 表的结构: xt_huikui --
CREATE TABLE `xt_huikui` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`uid` int(11) NOT NULL,
`touzi` varchar(255) CHARACTER SET latin1 NOT NULL,
`zhuangkuang` varchar(255) CHARACTER SET latin1 NOT NULL,
`hk` decimal(12,2) NOT NULL,
`time_hk` int(11) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- <fen> --
-- 表的结构: xt_img --
CREATE TABLE `xt_img` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`title` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`c_time` int(11) NOT NULL DEFAULT '0',
`small_url` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`img_url` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- <fen> --
-- 表的结构: xt_item --
CREATE TABLE `xt_item` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`title` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`content` text COLLATE utf8_unicode_ci NOT NULL,
`fsize` int(11) NOT NULL DEFAULT '0',
`user_id` int(11) NOT NULL,
`create_time` int(11) unsigned NOT NULL,
`update_time` int(11) unsigned NOT NULL,
`status` tinyint(1) unsigned NOT NULL,
`email` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
`type` int(11) NOT NULL,
`zip_url` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`zip_title` varchar(200) COLLATE utf8_unicode_ci NOT NULL,
`is_read` int(11) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- <fen> --
-- 表的结构: xt_jiadan --
CREATE TABLE `xt_jiadan` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`uid` int(11) NOT NULL,
`user_id` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
`adt` int(11) NOT NULL,
`pdt` int(11) NOT NULL,
`money` decimal(12,2) NOT NULL DEFAULT '0.00' COMMENT '金额',
`danshu` smallint(5) NOT NULL DEFAULT '0' COMMENT '单数',
`is_pay` smallint(3) NOT NULL DEFAULT '0',
`up_level` smallint(2) NOT NULL DEFAULT '0',
`out_level` smallint(2) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- <fen> --
-- 表的结构: xt_msg --
CREATE TABLE `xt_msg` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`f_uid` int(11) NOT NULL DEFAULT '0',
`f_user_id` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
`s_uid` int(11) NOT NULL DEFAULT '0',
`s_user_id` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
`title` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
`content` text COLLATE utf8_unicode_ci NOT NULL,
`f_time` int(11) NOT NULL DEFAULT '0',
`f_del` smallint(3) NOT NULL DEFAULT '0',
`s_del` smallint(3) NOT NULL DEFAULT '0',
`f_read` smallint(3) NOT NULL DEFAULT '0',
`s_read` smallint(3) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=418 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- <fen> --
-- 表的结构: xt_news_a --
CREATE TABLE `xt_news_a` (
`ID` int(11) NOT NULL AUTO_INCREMENT,
`n_title` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
`n_content` text COLLATE utf8_unicode_ci NOT NULL,
`n_top` int(11) NOT NULL DEFAULT '0',
`n_status` tinyint(1) NOT NULL DEFAULT '1',
`n_create_time` int(11) NOT NULL,
`n_update_time` int(11) NOT NULL,
PRIMARY KEY (`ID`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- <fen> --
-- 表的结构: xt_news_class --
CREATE TABLE `xt_news_class` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`title` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
`create_time` int(11) NOT NULL,
`type` smallint(2) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=12 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- <fen> --
-- 表的结构: xt_peng --
CREATE TABLE `xt_peng` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`uid` int(12) NOT NULL,
`ceng` int(12) NOT NULL,
`l` int(12) NOT NULL,
`r` int(12) NOT NULL,
`l1` int(12) NOT NULL,
`r1` int(12) NOT NULL,
`l2` int(12) NOT NULL,
`r2` int(12) NOT NULL,
`l3` int(12) NOT NULL,
`r3` int(11) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `id` (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- <fen> --
-- 表的结构: xt_plan --
CREATE TABLE `xt_plan` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`content` longtext COLLATE utf8_unicode_ci NOT NULL COMMENT '奖励计划',
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=6 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- <fen> --
-- 表的结构: xt_product --
CREATE TABLE `xt_product` (
`id` int(9) NOT NULL AUTO_INCREMENT,
`cid` varchar(200) COLLATE utf8_unicode_ci NOT NULL,
`name` varchar(200) COLLATE utf8_unicode_ci DEFAULT NULL,
`cptype` int(11) NOT NULL DEFAULT '0',
`ccname` varchar(200) COLLATE utf8_unicode_ci NOT NULL,
`xhname` varchar(200) COLLATE utf8_unicode_ci NOT NULL,
`money` decimal(12,2) DEFAULT '0.00',
`a_money` decimal(12,2) NOT NULL DEFAULT '0.00',
`b_money` decimal(12,2) NOT NULL DEFAULT '0.00',
`create_time` int(11) DEFAULT NULL,
`content` text COLLATE utf8_unicode_ci NOT NULL,
`img` varchar(200) COLLATE utf8_unicode_ci NOT NULL,
`yc_cp` int(11) NOT NULL DEFAULT '0',
`countid` varchar(200) COLLATE utf8_unicode_ci NOT NULL,
`is_reg` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=27 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- <fen> --
-- 表的结构: xt_promo --
CREATE TABLE `xt_promo` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`money` decimal(12,2) NOT NULL,
`money_two` decimal(12,2) NOT NULL,
`u_level` smallint(3) NOT NULL DEFAULT '0' COMMENT '升级前级别',
`uid` int(11) NOT NULL,
`create_time` int(11) NOT NULL,
`up_level` smallint(3) NOT NULL COMMENT '升级后级别',
`danshu` smallint(2) NOT NULL COMMENT '单数',
`pdt` int(11) NOT NULL,
`is_pay` smallint(3) NOT NULL DEFAULT '0',
`u_bank_name` smallint(2) NOT NULL DEFAULT '0' COMMENT '汇款银行',
`type` smallint(2) NOT NULL DEFAULT '0' COMMENT '0标示晋级,1标示加单',
`user_name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`user_id` varchar(11) COLLATE utf8_unicode_ci NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=1240 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- <fen> --
-- 表的结构: xt_region --
CREATE TABLE `xt_region` (
`id` smallint(5) unsigned NOT NULL AUTO_INCREMENT,
`pid` smallint(5) unsigned NOT NULL DEFAULT '0',
`name` varchar(120) NOT NULL DEFAULT '',
`region_type` tinyint(1) NOT NULL DEFAULT '2',
`agency_id` smallint(5) unsigned NOT NULL DEFAULT '0',
PRIMARY KEY (`id`),
KEY `parent_id` (`pid`),
KEY `region_type` (`region_type`),
KEY `agency_id` (`agency_id`)
) ENGINE=MyISAM AUTO_INCREMENT=3409 DEFAULT CHARSET=utf8;
-- <fen> --
-- 表的结构: xt_remit --
CREATE TABLE `xt_remit` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`uid` int(11) NOT NULL DEFAULT '0',
`user_id` varchar(200) COLLATE utf8_unicode_ci NOT NULL,
`b_uid` int(11) NOT NULL DEFAULT '0',
`amount` decimal(12,2) NOT NULL DEFAULT '0.00',
`kh_money` decimal(12,2) NOT NULL DEFAULT '0.00',
`or_time` int(11) NOT NULL DEFAULT '0',
`orderid` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
`bankid` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
`ok_time` int(11) NOT NULL DEFAULT '0',
`ok_type` int(11) NOT NULL DEFAULT '0',
`is_pay` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=108 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- <fen> --
-- 表的结构: xt_shouru --
CREATE TABLE `xt_shouru` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`uid` int(11) NOT NULL DEFAULT '0',
`user_id` varchar(200) COLLATE utf8_unicode_ci NOT NULL,
`in_money` decimal(12,2) NOT NULL DEFAULT '0.00',
`in_time` int(11) NOT NULL DEFAULT '0',
`in_bz` text COLLATE utf8_unicode_ci NOT NULL,
`in_type` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=3831 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- <fen> --
-- 表的结构: xt_times --
CREATE TABLE `xt_times` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`benqi` int(11) NOT NULL COMMENT '本期结算日期',
`shangqi` int(11) NOT NULL COMMENT '上期结算日期',
`is_count_b` int(11) NOT NULL,
`is_count_c` int(11) NOT NULL,
`is_count` int(11) NOT NULL,
`type` smallint(2) NOT NULL DEFAULT '0' COMMENT '是否已经结算',
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=370 DEFAULT CHARSET=utf8;
-- <fen> --
-- 表的结构: xt_times1 --
CREATE TABLE `xt_times1` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`benqi` int(11) DEFAULT NULL COMMENT '本期结算日期',
`shangqi` int(11) DEFAULT NULL COMMENT '上期结算日期',
`is_count_b` int(11) DEFAULT NULL,
`is_count_c` int(11) DEFAULT NULL,
`is_count` int(11) DEFAULT NULL,
`type` smallint(2) DEFAULT '0' COMMENT '是否已经结算',
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=263 DEFAULT CHARSET=utf8;
-- <fen> --
-- 表的结构: xt_tiqu --
CREATE TABLE `xt_tiqu` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`uid` int(11) NOT NULL,
`user_id` varchar(50) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
`rdt` int(11) NOT NULL,
`money` decimal(12,2) NOT NULL,
`money_two` decimal(12,2) NOT NULL,
`epoint` decimal(12,2) NOT NULL,
`is_pay` int(11) NOT NULL,
`user_name` varchar(200) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
`bank_name` varchar(200) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
`bank_card` varchar(200) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
`bank_address` varchar(200) NOT NULL,
`user_tel` varchar(200) NOT NULL,
`x1` varchar(50) DEFAULT NULL,
`x2` varchar(50) DEFAULT NULL,
`x3` varchar(50) DEFAULT NULL,
`x4` varchar(50) DEFAULT NULL,
`t_type` int(3) NOT NULL DEFAULT '0',
`email` varchar(200) DEFAULT '0',
`qq` varchar(200) DEFAULT '0',
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=708 DEFAULT CHARSET=utf8;
-- <fen> --
-- 表的结构: xt_ulevel --
CREATE TABLE `xt_ulevel` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`money` decimal(12,2) DEFAULT NULL,
`u_level` smallint(3) DEFAULT '0' COMMENT '升级前级别',
`uid` int(11) DEFAULT NULL,
`user_id` varchar(200) COLLATE utf8_unicode_ci NOT NULL,
`create_time` int(11) DEFAULT NULL,
`up_level` smallint(3) DEFAULT NULL COMMENT '升级后级别',
`danshu` smallint(2) DEFAULT NULL COMMENT '单数',
`pdt` int(11) DEFAULT NULL,
`is_pay` smallint(3) DEFAULT '0',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- <fen> --
-- 表的结构: xt_xfhistory --
CREATE TABLE `xt_xfhistory` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`uid` int(11) NOT NULL,
`user_id` varchar(200) COLLATE utf8_unicode_ci NOT NULL,
`did` int(11) NOT NULL,
`d_user_id` varchar(200) COLLATE utf8_unicode_ci NOT NULL,
`action_type` varchar(32) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
`pdt` int(11) NOT NULL,
`epoints` decimal(12,2) NOT NULL,
`allp` decimal(12,2) NOT NULL,
`bz` text COLLATE utf8_unicode_ci NOT NULL,
`type` smallint(1) NOT NULL COMMENT '充值0明细1',
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- <fen> --
-- 表的结构: xt_xiaof --
CREATE TABLE `xt_xiaof` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`uid` int(11) NOT NULL,
`user_id` varchar(50) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
`rdt` int(11) NOT NULL,
`pdt` int(11) NOT NULL DEFAULT '0',
`money` decimal(12,2) NOT NULL,
`money_two` int(11) NOT NULL DEFAULT '0',
`epoint` decimal(12,2) NOT NULL,
`fh_money` decimal(12,2) NOT NULL DEFAULT '0.00',
`is_pay` int(11) NOT NULL,
`user_name` varchar(200) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
`bank_name` varchar(200) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
`bank_card` varchar(50) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
`x1` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
`x2` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
`x3` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
`x4` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- <fen> --
-- 表的结构: xt_xml --
CREATE TABLE `xt_xml` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`money` decimal(12,2) NOT NULL,
`amount` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
`x_date` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
`is_lock` smallint(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=266 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- <fen> --
-- 表的结构: xt_zhuanj --
CREATE TABLE `xt_zhuanj` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`in_uid` int(11) DEFAULT NULL,
`out_uid` int(11) DEFAULT NULL,
`in_userid` varchar(50) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
`out_userid` varchar(50) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
`epoint` decimal(12,2) DEFAULT NULL,
`rdt` int(11) DEFAULT NULL,
`sm` varchar(200) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
`type` int(11) DEFAULT '0',
`is_gupiao` int(11) DEFAULT '0',
`is_fh` int(11) DEFAULT '0',
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=16946 DEFAULT CHARSET=utf8;
-- <fen> --
|
-- @conn iqdb
INSERT INTO houses (house_name, colour) VALUES('Dalberg', 'RED');
INSERT INTO houses (house_name, colour) VALUES('Savory', 'BLUE');
INSERT INTO houses (house_name, colour) VALUES('Hurley', 'BLACK'); |
select
sum(C_ACCTBAL)
from
tidb_resolveLock_test.CUSTOMER
where
C_ACCTBAL % 2 == 0 |
ALTER TABLE `Stat`
DROP COLUMN `group_id`;
ALTER TABLE `Stat`
DROP COLUMN `visited_date`;
|
CREATE TABLE jobs
(
job_id VARCHAR(10),
job_title VARCHAR(35) NOT NULL,
min_salary int,
max_salary int
);
alter table jobs
add constraint jobs_pk primary key (job_id);
----------
create sequence locations_seq;
CREATE TABLE locations
(
location_id int not null default nextval('locations_seq'),
street_address VARCHAR(40),
city VARCHAR(30) NOT NULL
);
alter table locations
add constraint locations_pk primary key (location_id);
----------
create sequence departments_seq;
CREATE TABLE departments
(
department_id int not null default nextval('departments_seq'),
department_name varchar(30) NOT NULL,
manager_id int,
location_id int
);
alter table departments
add constraint departments_id primary key (department_id);
alter table departments
add constraint departments_location_fk foreign key (location_id) references locations (location_id);
----------
create sequence employees_seq;
CREATE TABLE employees
(
employee_id int not null default nextval('employees_seq'),
first_name varchar(20),
last_name varchar(25) NOT NULL,
email varchar(25) NOT NULL,
phone_number varchar(20),
hire_date date NOT NULL,
job_id varchar(10) NOT NULL,
salary int,
manager_id int,
department_id int,
CONSTRAINT emp_salary_min
CHECK (salary > 0),
CONSTRAINT emp_email_uk
UNIQUE (email)
);
alter table employees
add constraint employees_pk primary key (employee_id);
alter table employees
add constraint employees_job_fk foreign key (job_id) references jobs (job_id);
alter table employees
add constraint employees_dep_fk foreign key (department_id) references departments (department_id);
alter table employees
add constraint employees_manager_fk foreign key (manager_id) references employees (employee_id);
----------
CREATE TABLE job_history
(
employee_id int NOT NULL,
start_date DATE NOT NULL,
end_date DATE NOT NULL,
job_id VARCHAR(10) NOT NULL,
department_id int,
CONSTRAINT jhist_date_interval
CHECK (end_date > start_date)
);
alter table job_history
add constraint job_history_pk primary key (employee_id, start_date);
alter table job_history
add constraint job_history_job_fk foreign key (job_id) references jobs (job_id);
alter table job_history
add constraint job_history_dep_fk foreign key (department_id) references departments (department_id);
alter table job_history
add constraint job_history_emp_fk foreign key (employee_id) references employees (employee_id); |
--
-- PostgreSQL database dump
--
-- Started on 2014-06-11 12:54:47
SET statement_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = off;
SET check_function_bodies = false;
SET client_min_messages = warning;
SET escape_string_warning = off;
SET search_path = public, pg_catalog;
SET default_tablespace = '';
SET default_with_oids = false;
--
-- TOC entry 1528 (class 1259 OID 113206)
-- Dependencies: 3
-- Name: bid; Type: TABLE; Schema: public; Owner: postgres; Tablespace:
--
CREATE TABLE bid (
bid_id bigint NOT NULL,
created timestamp without time zone,
value numeric(38,0),
provider_id bigint,
bid_state_id bigint,
task_id bigint
);
ALTER TABLE public.bid OWNER TO postgres;
--
-- TOC entry 1529 (class 1259 OID 113211)
-- Dependencies: 3
-- Name: bid_state; Type: TABLE; Schema: public; Owner: postgres; Tablespace:
--
CREATE TABLE bid_state (
bid_state_id bigint NOT NULL,
state character varying(255)
);
ALTER TABLE public.bid_state OWNER TO postgres;
--
-- TOC entry 1530 (class 1259 OID 113216)
-- Dependencies: 3
-- Name: client; Type: TABLE; Schema: public; Owner: postgres; Tablespace:
--
CREATE TABLE client (
client_id bigint NOT NULL,
user_details_id bigint
);
ALTER TABLE public.client OWNER TO postgres;
--
-- TOC entry 1531 (class 1259 OID 113221)
-- Dependencies: 3
-- Name: provider; Type: TABLE; Schema: public; Owner: postgres; Tablespace:
--
CREATE TABLE provider (
provider_id bigint NOT NULL,
title character varying(255),
user_details_id bigint
);
ALTER TABLE public.provider OWNER TO postgres;
--
-- TOC entry 1532 (class 1259 OID 113226)
-- Dependencies: 3
-- Name: rating; Type: TABLE; Schema: public; Owner: postgres; Tablespace:
--
CREATE TABLE rating (
rating_id bigint NOT NULL,
long_description character varying(255),
score integer,
short_description character varying(255),
client_id bigint,
task_id bigint
);
ALTER TABLE public.rating OWNER TO postgres;
--
-- TOC entry 1533 (class 1259 OID 113234)
-- Dependencies: 3
-- Name: role; Type: TABLE; Schema: public; Owner: postgres; Tablespace:
--
CREATE TABLE role (
role_id bigint NOT NULL,
role_type character varying(255),
title character varying(255)
);
ALTER TABLE public.role OWNER TO postgres;
--
-- TOC entry 1527 (class 1259 OID 112851)
-- Dependencies: 3
-- Name: sequence; Type: TABLE; Schema: public; Owner: postgres; Tablespace:
--
CREATE TABLE sequence (
seq_name character varying(50) NOT NULL,
seq_count numeric(38,0)
);
ALTER TABLE public.sequence OWNER TO postgres;
--
-- TOC entry 1534 (class 1259 OID 113242)
-- Dependencies: 3
-- Name: service; Type: TABLE; Schema: public; Owner: postgres; Tablespace:
--
CREATE TABLE service (
service_id bigint NOT NULL,
description character varying(255),
provider_id bigint,
service_type_id bigint
);
ALTER TABLE public.service OWNER TO postgres;
--
-- TOC entry 1536 (class 1259 OID 113255)
-- Dependencies: 3
-- Name: service_task_job_type; Type: TABLE; Schema: public; Owner: postgres; Tablespace:
--
CREATE TABLE service_task_job_type (
service_task_job_type_id bigint NOT NULL,
description character varying(255),
title character varying(255),
service_task_type_id bigint
);
ALTER TABLE public.service_task_job_type OWNER TO postgres;
--
-- TOC entry 1535 (class 1259 OID 113247)
-- Dependencies: 3
-- Name: service_task_type; Type: TABLE; Schema: public; Owner: postgres; Tablespace:
--
CREATE TABLE service_task_type (
service_task_type_id bigint NOT NULL,
description character varying(255),
title character varying(255),
service_type_id bigint
);
ALTER TABLE public.service_task_type OWNER TO postgres;
--
-- TOC entry 1537 (class 1259 OID 113263)
-- Dependencies: 3
-- Name: service_type; Type: TABLE; Schema: public; Owner: postgres; Tablespace:
--
CREATE TABLE service_type (
service_type_id bigint NOT NULL,
description character varying(255),
title character varying(255)
);
ALTER TABLE public.service_type OWNER TO postgres;
--
-- TOC entry 1538 (class 1259 OID 113271)
-- Dependencies: 3
-- Name: task; Type: TABLE; Schema: public; Owner: postgres; Tablespace:
--
CREATE TABLE task (
task_id bigint NOT NULL,
created timestamp without time zone,
post_code character varying(255),
client_id bigint,
service_task_job_type_id bigint,
service_task_type_id bigint,
service_type_id bigint,
task_state_id bigint
);
ALTER TABLE public.task OWNER TO postgres;
--
-- TOC entry 1539 (class 1259 OID 113276)
-- Dependencies: 3
-- Name: task_state; Type: TABLE; Schema: public; Owner: postgres; Tablespace:
--
CREATE TABLE task_state (
task_state_id bigint NOT NULL,
description character varying(255),
state character varying(255),
title character varying(255)
);
ALTER TABLE public.task_state OWNER TO postgres;
--
-- TOC entry 1540 (class 1259 OID 113284)
-- Dependencies: 3
-- Name: task_type; Type: TABLE; Schema: public; Owner: postgres; Tablespace:
--
CREATE TABLE task_type (
task_type_id bigint NOT NULL,
description character varying(255),
title character varying(255)
);
ALTER TABLE public.task_type OWNER TO postgres;
--
-- TOC entry 1541 (class 1259 OID 113292)
-- Dependencies: 3
-- Name: user_details; Type: TABLE; Schema: public; Owner: postgres; Tablespace:
--
CREATE TABLE user_details (
user_details_id bigint NOT NULL,
address character varying(255),
email character varying(255),
first_name character varying(255),
last_name character varying(255),
mobile_phone character varying(255),
password character varying(255),
phone character varying(255),
post_code character varying(255),
user_name character varying(255) NOT NULL,
role_id bigint
);
ALTER TABLE public.user_details OWNER TO postgres;
--
-- TOC entry 1822 (class 2606 OID 113210)
-- Dependencies: 1528 1528
-- Name: bid_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
--
ALTER TABLE ONLY bid
ADD CONSTRAINT bid_pkey PRIMARY KEY (bid_id);
--
-- TOC entry 1824 (class 2606 OID 113215)
-- Dependencies: 1529 1529
-- Name: bid_state_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
--
ALTER TABLE ONLY bid_state
ADD CONSTRAINT bid_state_pkey PRIMARY KEY (bid_state_id);
--
-- TOC entry 1826 (class 2606 OID 113220)
-- Dependencies: 1530 1530
-- Name: client_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
--
ALTER TABLE ONLY client
ADD CONSTRAINT client_pkey PRIMARY KEY (client_id);
--
-- TOC entry 1828 (class 2606 OID 113225)
-- Dependencies: 1531 1531
-- Name: provider_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
--
ALTER TABLE ONLY provider
ADD CONSTRAINT provider_pkey PRIMARY KEY (provider_id);
--
-- TOC entry 1830 (class 2606 OID 113233)
-- Dependencies: 1532 1532
-- Name: rating_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
--
ALTER TABLE ONLY rating
ADD CONSTRAINT rating_pkey PRIMARY KEY (rating_id);
--
-- TOC entry 1832 (class 2606 OID 113241)
-- Dependencies: 1533 1533
-- Name: role_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
--
ALTER TABLE ONLY role
ADD CONSTRAINT role_pkey PRIMARY KEY (role_id);
--
-- TOC entry 1820 (class 2606 OID 112855)
-- Dependencies: 1527 1527
-- Name: sequence_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
--
ALTER TABLE ONLY sequence
ADD CONSTRAINT sequence_pkey PRIMARY KEY (seq_name);
--
-- TOC entry 1834 (class 2606 OID 113246)
-- Dependencies: 1534 1534
-- Name: service_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
--
ALTER TABLE ONLY service
ADD CONSTRAINT service_pkey PRIMARY KEY (service_id);
--
-- TOC entry 1838 (class 2606 OID 113262)
-- Dependencies: 1536 1536
-- Name: service_task_job_type_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
--
ALTER TABLE ONLY service_task_job_type
ADD CONSTRAINT service_task_job_type_pkey PRIMARY KEY (service_task_job_type_id);
--
-- TOC entry 1836 (class 2606 OID 113254)
-- Dependencies: 1535 1535
-- Name: service_task_type_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
--
ALTER TABLE ONLY service_task_type
ADD CONSTRAINT service_task_type_pkey PRIMARY KEY (service_task_type_id);
--
-- TOC entry 1840 (class 2606 OID 113270)
-- Dependencies: 1537 1537
-- Name: service_type_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
--
ALTER TABLE ONLY service_type
ADD CONSTRAINT service_type_pkey PRIMARY KEY (service_type_id);
--
-- TOC entry 1842 (class 2606 OID 113275)
-- Dependencies: 1538 1538
-- Name: task_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
--
ALTER TABLE ONLY task
ADD CONSTRAINT task_pkey PRIMARY KEY (task_id);
--
-- TOC entry 1844 (class 2606 OID 113283)
-- Dependencies: 1539 1539
-- Name: task_state_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
--
ALTER TABLE ONLY task_state
ADD CONSTRAINT task_state_pkey PRIMARY KEY (task_state_id);
--
-- TOC entry 1846 (class 2606 OID 113291)
-- Dependencies: 1540 1540
-- Name: task_type_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
--
ALTER TABLE ONLY task_type
ADD CONSTRAINT task_type_pkey PRIMARY KEY (task_type_id);
--
-- TOC entry 1848 (class 2606 OID 113299)
-- Dependencies: 1541 1541
-- Name: user_details_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
--
ALTER TABLE ONLY user_details
ADD CONSTRAINT user_details_pkey PRIMARY KEY (user_details_id);
--
-- TOC entry 1851 (class 2606 OID 113310)
-- Dependencies: 1528 1823 1529
-- Name: fk_bid_bid_state_id; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY bid
ADD CONSTRAINT fk_bid_bid_state_id FOREIGN KEY (bid_state_id) REFERENCES bid_state(bid_state_id);
--
-- TOC entry 1850 (class 2606 OID 113305)
-- Dependencies: 1827 1531 1528
-- Name: fk_bid_provider_id; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY bid
ADD CONSTRAINT fk_bid_provider_id FOREIGN KEY (provider_id) REFERENCES provider(provider_id);
--
-- TOC entry 1849 (class 2606 OID 113300)
-- Dependencies: 1538 1528 1841
-- Name: fk_bid_task_id; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY bid
ADD CONSTRAINT fk_bid_task_id FOREIGN KEY (task_id) REFERENCES task(task_id);
--
-- TOC entry 1852 (class 2606 OID 113315)
-- Dependencies: 1847 1530 1541
-- Name: fk_client_user_details_id; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY client
ADD CONSTRAINT fk_client_user_details_id FOREIGN KEY (user_details_id) REFERENCES user_details(user_details_id);
--
-- TOC entry 1853 (class 2606 OID 113320)
-- Dependencies: 1847 1541 1531
-- Name: fk_provider_user_details_id; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY provider
ADD CONSTRAINT fk_provider_user_details_id FOREIGN KEY (user_details_id) REFERENCES user_details(user_details_id);
--
-- TOC entry 1854 (class 2606 OID 113325)
-- Dependencies: 1825 1530 1532
-- Name: fk_rating_client_id; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY rating
ADD CONSTRAINT fk_rating_client_id FOREIGN KEY (client_id) REFERENCES client(client_id);
--
-- TOC entry 1855 (class 2606 OID 113330)
-- Dependencies: 1538 1841 1532
-- Name: fk_rating_task_id; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY rating
ADD CONSTRAINT fk_rating_task_id FOREIGN KEY (task_id) REFERENCES task(task_id);
--
-- TOC entry 1857 (class 2606 OID 113340)
-- Dependencies: 1531 1827 1534
-- Name: fk_service_provider_id; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY service
ADD CONSTRAINT fk_service_provider_id FOREIGN KEY (provider_id) REFERENCES provider(provider_id);
--
-- TOC entry 1856 (class 2606 OID 113335)
-- Dependencies: 1534 1537 1839
-- Name: fk_service_service_type_id; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY service
ADD CONSTRAINT fk_service_service_type_id FOREIGN KEY (service_type_id) REFERENCES service_type(service_type_id);
--
-- TOC entry 1859 (class 2606 OID 113350)
-- Dependencies: 1536 1835 1535
-- Name: fk_service_task_job_type_service_task_type_id; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY service_task_job_type
ADD CONSTRAINT fk_service_task_job_type_service_task_type_id FOREIGN KEY (service_task_type_id) REFERENCES service_task_type(service_task_type_id);
--
-- TOC entry 1858 (class 2606 OID 113345)
-- Dependencies: 1535 1839 1537
-- Name: fk_service_task_type_service_type_id; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY service_task_type
ADD CONSTRAINT fk_service_task_type_service_type_id FOREIGN KEY (service_type_id) REFERENCES service_type(service_type_id);
--
-- TOC entry 1862 (class 2606 OID 113365)
-- Dependencies: 1538 1530 1825
-- Name: fk_task_client_id; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY task
ADD CONSTRAINT fk_task_client_id FOREIGN KEY (client_id) REFERENCES client(client_id);
--
-- TOC entry 1861 (class 2606 OID 113360)
-- Dependencies: 1538 1837 1536
-- Name: fk_task_service_task_job_type_id; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY task
ADD CONSTRAINT fk_task_service_task_job_type_id FOREIGN KEY (service_task_job_type_id) REFERENCES service_task_job_type(service_task_job_type_id);
--
-- TOC entry 1863 (class 2606 OID 113370)
-- Dependencies: 1538 1535 1835
-- Name: fk_task_service_task_type_id; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY task
ADD CONSTRAINT fk_task_service_task_type_id FOREIGN KEY (service_task_type_id) REFERENCES service_task_type(service_task_type_id);
--
-- TOC entry 1860 (class 2606 OID 113355)
-- Dependencies: 1538 1839 1537
-- Name: fk_task_service_type_id; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY task
ADD CONSTRAINT fk_task_service_type_id FOREIGN KEY (service_type_id) REFERENCES service_type(service_type_id);
--
-- TOC entry 1864 (class 2606 OID 113375)
-- Dependencies: 1539 1843 1538
-- Name: fk_task_task_state_id; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY task
ADD CONSTRAINT fk_task_task_state_id FOREIGN KEY (task_state_id) REFERENCES task_state(task_state_id);
--
-- TOC entry 1865 (class 2606 OID 113380)
-- Dependencies: 1831 1533 1541
-- Name: fk_user_details_role_id; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY user_details
ADD CONSTRAINT fk_user_details_role_id FOREIGN KEY (role_id) REFERENCES role(role_id);
--
-- TOC entry 1869 (class 0 OID 0)
-- Dependencies: 3
-- Name: public; Type: ACL; Schema: -; Owner: postgres
--
REVOKE ALL ON SCHEMA public FROM PUBLIC;
REVOKE ALL ON SCHEMA public FROM postgres;
GRANT ALL ON SCHEMA public TO postgres;
GRANT ALL ON SCHEMA public TO PUBLIC;
-- Completed on 2014-06-11 12:54:47
--
-- PostgreSQL database dump complete
--
|
USE musicdb;
COPY performer
(name, type, country, style, founded, born, died)
FROM '~/cascor/tools/exercise-2/performer.csv'
WITH HEADER = 'true';
COPY performers_by_style (style, name)
FROM '~/cascor/tools/exercise-2/performers_by_style.csv'
WITH HEADER = 'true';
COPY album (title, year, performer, genre, tracks)
FROM '~/cascor/tools/exercise-2/album.csv'
WITH HEADER = 'true';
COPY albums_by_performer (performer, year, title, genre)
FROM '~/cascor/tools/exercise-2/albums_by_performer.csv'
WITH HEADER = 'true';
COPY albums_by_genre (genre, performer, year, title)
FROM '~/cascor/tools/exercise-2/albums_by_genre.csv'
WITH HEADER = 'true';
COPY albums_by_track (track_title, performer, year, album_title)
FROM '~/cascor/tools/exercise-2/albums_by_track.csv'
WITH HEADER = 'true';
COPY tracks_by_album
(album_title, year, performer, genre, number, track_title)
FROM '~/cascor/tools/exercise-2/tracks_by_album.csv'
WITH HEADER = 'true';
|
CREATE TABLE confirmation (
id INTEGER PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY,
user_id INTEGER REFERENCES users(id) NOT NULL,
treatment_id INTEGER REFERENCES treatments(id) ON DELETE CASCADE,
comment TEXT,
order_date TIMESTAMPTZ DEFAULT now() NOT NULL,
appointment_date TIMESTAMPTZ NOT NULL
); |
-- +goose Up
-- SQL in section 'Up' is executed when this migration is applied
CREATE TABLE `observable_properties` (
`id` int(11) UNSIGNED NOT NULL COMMENT '管理用',
`observable_property_number` varchar(255) NOT NULL COMMENT '計測項目のID',
`system` varchar(5) NOT NULL COMMENT '植物体の場所',
`classification` varchar(255) NOT NULL COMMENT '観測の分類',
`classification_en` varchar(255) NOT NULL COMMENT '観測の分類(英語)',
`observation_property` varchar(255) NOT NULL COMMENT '物質量・現象',
`observation_property_en` varchar(255) NOT NULL COMMENT '物質量・現象(英語)',
`unit_of_measure` varchar(20) DEFAULT NULL COMMENT '単位',
`display_unit` varchar(20) DEFAULT NULL COMMENT '表示単位',
`created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '管理用',
`updated_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '管理用'
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='計測項目の情報を保存したテーブル';
ALTER TABLE `observable_properties`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `observable_property_id` (`observable_property_number`),
MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '管理用';
-- +goose Down
-- SQL section 'Down' is executed when this migration is rolled back
DROP TABLE observable_properties; |
-- phpMyAdmin SQL Dump
-- version 4.9.0.1
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Waktu pembuatan: 10 Des 2020 pada 13.37
-- Versi server: 10.3.16-MariaDB
-- Versi PHP: 7.3.6
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Database: `dbmahasiswa`
--
-- --------------------------------------------------------
--
-- Struktur dari tabel `mahasiswa`
--
CREATE TABLE `mahasiswa` (
`nim` varchar(10) NOT NULL,
`nama` varchar(128) DEFAULT NULL,
`alamat` varchar(128) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data untuk tabel `mahasiswa`
--
INSERT INTO `mahasiswa` (`nim`, `nama`, `alamat`) VALUES
('1808561106', 'Ida Bagus Weda Baskara Adi Putra', 'Klungkung');
-- --------------------------------------------------------
--
-- Struktur dari tabel `users`
--
CREATE TABLE `users` (
`id_user` int(11) NOT NULL,
`username` varchar(128) DEFAULT NULL,
`password` varchar(128) DEFAULT NULL,
`email` varchar(128) DEFAULT NULL,
`role` varchar(128) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data untuk tabel `users`
--
INSERT INTO `users` (`id_user`, `username`, `password`, `email`, `role`) VALUES
(1, 'admin', '21232f297a57a5a743894a0e4a801fc3', 'admin@gmail.com', 'admin'),
(2, 'pegawai', '047aeeb234644b9e2d4138ed3bc7976a', 'pegawai@gmail.com', 'pegawai');
--
-- Indexes for dumped tables
--
--
-- Indeks untuk tabel `mahasiswa`
--
ALTER TABLE `mahasiswa`
ADD PRIMARY KEY (`nim`);
--
-- Indeks untuk tabel `users`
--
ALTER TABLE `users`
ADD PRIMARY KEY (`id_user`);
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 */;
|
CREATE TABLE d3_qr (
id int(11) NOT NULL AUTO_INCREMENT,
URL VARCHAR(60) NOT NULL,
PRIMARY KEY (id)
);
CREATE TABLE d3_scan (
id int(11) NOT NULL AUTO_INCREMENT;
d3_user_id int(11) NOT NULL,
d3_qr_id int(11) NOT NULL,
date DATE NOT NULL
PRIMARY KEY (id);
FOREIGN KEY (d3_user_id, d3_qr_id)
);
|
CREATE TABLE `t_user` (
`id` int(20) NOT NULL AUTO_INCREMENT,
`user_name` varchar(255) DEFAULT NULL COMMENT '用户名',
`password` varchar(255) DEFAULT NULL COMMENT '密码',
`sex` tinyint(4) DEFAULT '0' COMMENT '性别:0 女,1 男',
`is_deleted` tinyint(4) DEFAULT '0' COMMENT '是否删除(0 否,1 是)',
`create_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`update_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
|
insert into addresses values(1, "Naperville", "CHICAGO", "IL", "60515", "USA");
insert into addresses values(2, "Elgin", "CHICAGO", "IL", "60515", "USA");
insert into students values(1, "John", "john@gmail.com", "123-456-7890", null, null, null, 1);
insert into students values(2, "Paul", "paul@gmail.com", "111-222-3333", null, null, null, 2);
insert into students values(3, "Paul2", "paul2@gmail.com", "111-222-3333", null, null, null, 2);
select * from students;
delete from students where STUD_ID=3;
commit;
Select stud_id, name, email, phone, A.addr_id, street, city, state, zip, COUNTRY from students left join addresses A on students.addr_id = A.addr_id where STUD_ID=1;
insert into tutors values(1, "John", "john@gmail.com", "123-456-7890", 1);
insert into tutors values(2, "Ying", "ying@gmail.com", "111-222-3333", 2);
insert into courses values(1, "JavaSE", "Java SE", "2013-01-10", "2013-02-10", 1);
insert into courses values(2, "JavaEE", "JavaEE6", "2013-01-10", "2013-03-10", 2);
insert into courses values(3, "MyBatis", "MyBatis", "2013-01-10", "2013-02-20", 2);
select * from tutors;
select * from courses;
select T.tutor_id, T.name as Tutor_name, email, C.course_id, C.name, description, start_date, end_date
from tutors T left outer join courses C on T.TUTOR_ID = C.TUTOR_ID;
commit; |
CREATE DATABASE db_controle;
USE db_controle;
CREATE TABLE entrada(
id INT NOT NULL AUTO_INCREMENT,
data_entrada DATE NOT NULL,
quantidade DECIMAL(10,2) NOT NULL,
valor DECIMAL(10,2) NOT NULL,
total DECIMAL(10,2) NOT NULL,
fornecedor VARCHAR(100) NOT NULL,
descricao_produto VARCHAR(200) NOT NULL,
tipo_unitario VARCHAR(10) NOT NULL,
PRIMARY KEY(id)
);
CREATE TABLE saida(
id INT NOT NULL AUTO_INCREMENT,
data_saida DATE NOT NULL,
quantidade DECIMAL(10,2) NOT NULL,
valor DECIMAL(10,2) NOT NULL,
total DECIMAL(10,2) NOT NULL,
fornecedor VARCHAR(100) NOT NULL,
descricao_produto VARCHAR(200) NOT NULL,
tipo_unitario VARCHAR(10) NOT NULL,
PRIMARY KEY(id)
);
CREATE TABLE estoque(
id INT NOT NULL AUTO_INCREMENT,
descricao_produto VARCHAR(200) NOT NULL,
tipo_unitario VARCHAR(10) NOT NULL,
fornecedor VARCHAR(100) NOT NULL,
quantidade DECIMAL(10,2) NOT NULL,
PRIMARY KEY(id)
);
CREATE TABLE usuarios(
id INT NOT NULL AUTO_INCREMENT,
email VARCHAR(200) NOT NULL,
senha VARCHAR(50) NOT NULL,
PRIMARY KEY (id)
)
INSERT INTO usuarios(email, senha) VALUES ('admin@gmail.com', 'admin'); |
ALTER TABLE locations
ADD COLUMN published_at datetime AFTER deleted_at; |
USE feideconnect;
DROP INDEX IF EXISTS clients_scopes_idx;
DROP INDEX IF EXISTS clients_scopes_requested_idx;
CREATE INDEX clients_scopes_idx ON clients(scopes);
CREATE INDEX clients_scopes_requested_idx ON clients(scopes_requested);
DROP INDEX IF EXISTS oauth_authorizations_scopes_idx;
CREATE INDEX oauth_authorizations_scopes_idx ON oauth_authorizations (scopes);
DROP INDEX IF EXISTS INDEX user_userid_sec_idx
CREATE INDEX user_userid_sec_idx ON users(userid_sec);
|
CREATE TABLE `xref` (
`xref_id` int(10) unsigned NOT NULL auto_increment,
`external_db_id` int(11) NOT NULL default '0',
`dbprimary_acc` varchar(40) collate latin1_bin NOT NULL default '',
`display_label` varchar(128) collate latin1_bin NOT NULL default '',
`version` varchar(10) collate latin1_bin NOT NULL default '',
`description` text collate latin1_bin,
`info_type` enum('PROJECTION','MISC','DEPENDENT','DIRECT','SEQUENCE_MATCH','INFERRED_PAIR','PROBE','UNMAPPED') collate latin1_bin default NULL,
`info_text` varchar(255) collate latin1_bin default NULL,
`priority` int(11) default NULL,
PRIMARY KEY (`xref_id`),
UNIQUE KEY `id_index` (`dbprimary_acc`,`external_db_id`),
KEY `display_index` (`display_label`)
) ENGINE=MyISAM AUTO_INCREMENT=1000006 DEFAULT CHARSET=latin1 COLLATE=latin1_bin;
|
set echo on;
set serveroutput on;
select * from user_role_privs;
select * from crawforl.customer;
desc tabs;
show user; |
DROP PROCEDURE IF EXISTS SP_INPERSONAL;
DELIMITER $$
CREATE PROCEDURE SP_INPERSONAL(
IN pcNombres VARCHAR(50),
IN pcApellidos VARCHAR(50),
IN pfNacimiento DATE,
IN pfIngreso DATE,
IN pcGenero ENUM('M', 'F', ''),
IN pcEmpleadoN VARCHAR (10),
IN pnActivo TINYINT(1)
)
SP:BEGIN
INSERT INTO personal1 (nombres,apellidos,fecha_nacimiento,fecha_ingreso,sexo,no_empleado,activo)
VALUES (pcNombres,pcApellidos,pfNacimiento,pfIngreso,pcGenero,pcEmpleadoN,pnActivo);
INSERT INTO personal (id_personal,nombres,apellidos,fecha_nacimiento,fecha_ingreso,sexo,no_empleado,activo)
VALUES (
( select id_personal from personal1 ORDER BY id_personal DESC LIMIT 1),
( select nombres from personal1 ORDER BY id_personal DESC LIMIT 1),
( select apellidos from personal1 ORDER BY id_personal DESC LIMIT 1),
( select fecha_nacimiento from personal1 ORDER BY id_personal DESC LIMIT 1),
( select fecha_ingreso from personal1 ORDER BY id_personal DESC LIMIT 1),
( select sexo from personal1 ORDER BY id_personal DESC LIMIT 1),
( select no_empleado from personal1 ORDER BY id_personal DESC LIMIT 1),
( select activo from personal1 ORDER BY id_personal DESC LIMIT 1)
);
END $$
DELIMITER ;
/*
call SP_INPERSONAL('Juan','Lopez','1970-05-13','2019-02-15','M','JL201902',1);
*/ |
drop table if exists users;
-- テーブルの作成
create table users (
id int unsigned primary key auto_increment,
name varchar(20),
score float not null
);
-- レコードを挿入
insert into users (name, score) values
('taguchi', 5.8),
('fkoji', 8.2),
('dotinstall', 6.1),
('yamada', null);
select * from users;
-- select * from users where score >= 6.0;
-- select * from users where score >= 3.0 and score <= 6.0;
-- select * from users where score between 3.0 and 6.0;
-- select * from users where name = 'taguchi' or name = 'fkoji';
-- select * from users where name in ('taguchi', 'fkoji');
-- select * from users where name like 't%';
-- select * from users where name like '%a%';
-- select * from users where name like '%a';
-- select * from users where name like 'T%';
-- select * from users where name like binary 'T%';
-- select * from users where name like '______';
-- select * from users where name like '_a%';
-- select * from users order by score;
-- select * from users where score is not null order by score desc;
-- select * from users limit 3;
-- select * from users limit 3 offset 3;
-- select * from users order by score desc limit 3;
-- update users set score = 5.9;
-- update users set score = 5.9 where id = 1;
-- update users set name = 'sasaki', score = 2.9 where name = 'tanaka';
-- delete from users;
-- delete from users where score < 5.0;
-- update users set score = score * 1.2 where id % 2 = 0;
-- select * from users;
-- select round(5.355); -- 5
-- select round(5.355, 1); -- 5.4
-- select floor(5.833); -- 5
-- select ceil(5.238); -- 6
-- select rand();
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.