text stringlengths 6 9.38M |
|---|
create table `reservation_request` (
`id` BIGINT AUTO_INCREMENT NOT NULL,
`doctor_id` BIGINT,
`patient_id` BIGINT,
`clinic_id` BIGINT,
`clinic_branch_id` BIGINT,
`status` varchar(255),
`reservation_date_time` DATETIME NOT NULL,
PRIMARY KEY(`id`),
FOREIGN KEY(doctor_id) references user (id) on delete no action on update cascade,
FOREIGN KEY(patient_id) references user (id) on delete no action on update cascade,
FOREIGN KEY(clinic_id) references clinic (id) on delete cascade on update cascade,
FOREIGN KEY(clinic_branch_id) references clinic_branch (id) on delete cascade on update cascade
); |
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/**
* Author: Tom�
* Created: 12.4.2016
*/
CREATE TABLE band (
id BIGINT PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY,
name VARCHAR(40),
region INT,
pricePerHour Double,
rate Double
);
CREATE TABLE customer (
id BIGINT PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY,
name VARCHAR(50),
phoneNumber VARCHAR(20),
address VARCHAR(50)
);
CREATE TABLE lease (
id BIGINT PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY,
idBand BIGINT REFERENCES band(id),
idCustomer BIGINT REFERENCES customer(id),
date TIMESTAMP,
region INT,
duration INT
);
CREATE TABLE band_styles (
id BIGINT PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY,
idBand BIGINT REFERENCES band(id),
style INT
); |
-- phpMyAdmin SQL Dump
-- version 5.0.2
-- https://www.phpmyadmin.net/
--
-- Host: localhost
-- Generation Time: Oct 31, 2020 at 02:25 PM
-- Server version: 10.4.13-MariaDB
-- PHP Version: 7.2.32
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: `OnlineExam`
--
-- --------------------------------------------------------
--
-- Table structure for table `addTest`
--
CREATE TABLE `addTest` (
`testid` int(40) NOT NULL,
`testname` varchar(40) NOT NULL,
`ques` int(40) NOT NULL,
`positive` int(40) NOT NULL,
`negative` int(40) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `addTest`
--
INSERT INTO `addTest` (`testid`, `testname`, `ques`, `positive`, `negative`) VALUES
(3, 'Java', 10, 1, 0),
(4, 'Python', 5, 1, 1),
(5, 'Aptitude', 2, 1, 1);
-- --------------------------------------------------------
--
-- Table structure for table `answerTable`
--
CREATE TABLE `answerTable` (
`ansid` int(40) NOT NULL,
`answer` varchar(200) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
--
-- Table structure for table `questionTable`
--
CREATE TABLE `questionTable` (
`quesid` int(40) NOT NULL,
`testid` int(40) NOT NULL,
`ques` varchar(300) NOT NULL,
`option1` varchar(200) NOT NULL,
`option2` varchar(200) NOT NULL,
`option3` varchar(200) NOT NULL,
`option4` varchar(200) NOT NULL,
`answer` int(40) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `questionTable`
--
INSERT INTO `questionTable` (`quesid`, `testid`, `ques`, `option1`, `option2`, `option3`, `option4`, `answer`) VALUES
(1, 3, 'Which of the following option leads to the portability and security of Java?', 'Bytecode is executed by JVM', 'The applet makes the Java code secure and portable', 'Use of exception handling', 'Dynamic binding between objects', 1),
(2, 3, 'Which of the following is not a Java features?', 'Dynamic', 'Architecture Neutral', 'Use of pointers', 'Object-oriented', 3),
(3, 3, 'What is the return type of the hashCode() method in the Object class?', 'Object', 'int', 'void', 'long', 2),
(4, 3, 'Which of the following is a valid long literal?', 'ABH8097', 'L990023', '904423', '0xnf029L', 4),
(5, 3, 'Java is plateform independent?', 'yes', 'no', 'dont know', 'yes know but dont know', 1),
(6, 3, 'Which package contains the Random class?', 'java.util package', 'java.lang package', 'java.awt package', 'java.io package', 1),
(7, 4, 'What is output for − min(\'hello world\')', 'e', 'blank space', 'w', 'none of the above', 2),
(8, 4, ' Which keyword is use for function?', 'define', 'fun', 'def', 'function', 3),
(9, 4, 'Which of the following items are present in the function header?', ' function name', 'parameter list', 'return value', 'Both A and B', 4),
(10, 5, 'A fruit seller had some apples. He sells 40% apples and still has 420 apples. Originally, he had:', '588 apples', '600 apples', '672 apples', '700 apples', 4),
(11, 5, 'The population of a town increased from 1,75,000 to 2,62,500 in a decade. The average percent increase of population per year is:', '4.37', '5', '6', '8', 2);
-- --------------------------------------------------------
--
-- Table structure for table `result`
--
CREATE TABLE `result` (
`rid` int(40) NOT NULL,
`sessid` varchar(100) NOT NULL,
`testname` varchar(40) NOT NULL,
`username` varchar(40) NOT NULL,
`totalmarks` varchar(40) NOT NULL,
`usermarks` varchar(40) NOT NULL,
`status` varchar(40) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
--
-- Table structure for table `user`
--
CREATE TABLE `user` (
`userid` int(40) NOT NULL,
`username` varchar(50) NOT NULL,
`password` varchar(50) NOT NULL,
`email` varchar(40) NOT NULL,
`role` varchar(40) NOT NULL DEFAULT 'user'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `user`
--
INSERT INTO `user` (`userid`, `username`, `password`, `email`, `role`) VALUES
(2, 'sumit', '123', 'gsgsgs@nchft.com', 'admin'),
(3, 'amit', '123', 'amit@gmail.com', 'user');
-- --------------------------------------------------------
--
-- Table structure for table `useranswer`
--
CREATE TABLE `useranswer` (
`uid` int(40) NOT NULL,
`sessid` varchar(100) NOT NULL,
`quesid` int(40) NOT NULL,
`testid` int(40) NOT NULL,
`ques` varchar(200) NOT NULL,
`option1` varchar(200) NOT NULL,
`option2` varchar(200) NOT NULL,
`option3` varchar(200) NOT NULL,
`option4` varchar(200) NOT NULL,
`userans` varchar(200) NOT NULL,
`rightans` varchar(200) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Indexes for dumped tables
--
--
-- Indexes for table `addTest`
--
ALTER TABLE `addTest`
ADD PRIMARY KEY (`testid`),
ADD UNIQUE KEY `testname` (`testname`);
--
-- Indexes for table `answerTable`
--
ALTER TABLE `answerTable`
ADD PRIMARY KEY (`ansid`);
--
-- Indexes for table `questionTable`
--
ALTER TABLE `questionTable`
ADD PRIMARY KEY (`quesid`),
ADD KEY `testid` (`testid`);
--
-- Indexes for table `result`
--
ALTER TABLE `result`
ADD PRIMARY KEY (`rid`);
--
-- Indexes for table `user`
--
ALTER TABLE `user`
ADD PRIMARY KEY (`userid`);
--
-- Indexes for table `useranswer`
--
ALTER TABLE `useranswer`
ADD PRIMARY KEY (`uid`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `addTest`
--
ALTER TABLE `addTest`
MODIFY `testid` int(40) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;
--
-- AUTO_INCREMENT for table `answerTable`
--
ALTER TABLE `answerTable`
MODIFY `ansid` int(40) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `questionTable`
--
ALTER TABLE `questionTable`
MODIFY `quesid` int(40) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=12;
--
-- AUTO_INCREMENT for table `result`
--
ALTER TABLE `result`
MODIFY `rid` int(40) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=170;
--
-- AUTO_INCREMENT for table `user`
--
ALTER TABLE `user`
MODIFY `userid` int(40) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
--
-- AUTO_INCREMENT for table `useranswer`
--
ALTER TABLE `useranswer`
MODIFY `uid` int(40) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=123;
--
-- Constraints for dumped tables
--
--
-- Constraints for table `questionTable`
--
ALTER TABLE `questionTable`
ADD CONSTRAINT `questionTable_ibfk_1` FOREIGN KEY (`testid`) REFERENCES `addTest` (`testid`) ON DELETE CASCADE ON UPDATE CASCADE;
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
Create Procedure sp_get_CategoryBasedSplCategory
(@Special_Cat_Code INT)
As
Select CategoryID from Special_Cat_Product where Special_Cat_Code=@Special_Cat_Code
|
-- addres_maps updates
UPDATE backend_company
SET address_maps = backend_address.address_maps
FROM backend_address
WHERE backend_company.id_migration = backend_address.id_migration;
-- Company updates
UPDATE backend_company
SET legal_id_id = backend_legal.id
FROM backend_legal
WHERE backend_company.legal_id_migration = backend_legal.id_migration;
-- Place updates
UPDATE backend_place
SET company_id_id = backend_company.id
FROM backend_company
WHERE backend_place.company_id_migration = backend_company.id_migration;
-- Job updates
UPDATE backend_job
SET company_id_id = backend_company.id, contract_type_id_id = backend_typecontract.id
FROM backend_company, backend_typecontract
WHERE backend_job.company_id_migration = backend_company.id_migration
AND backend_job.contract_type_id_migration = backend_typecontract.id_migration;
-- AreaUser updates
UPDATE backend_areauser
SET user_id_id = backend_user.id, area_id_id = backend_area.id
FROM backend_user, backend_area
WHERE backend_areauser.user_id_migration = backend_user.id_migration
AND backend_areauser.area_id_migration = backend_area.id_migration;
-- JobUser updates
UPDATE backend_jobapplication
SET job_id_id = backend_job.id, user_id_id = backend_user.id
FROM backend_job, backend_user
WHERE backend_jobapplication.job_id_migration = backend_job.id_migration
AND backend_jobapplication.user_id_migration = backend_user.id_migration;
-- Position updates
UPDATE backend_position
SET user_id_id = backend_user.id
FROM backend_user
WHERE backend_position.user_id_migration = backend_user.id_migration;
-- Message updates
UPDATE backend_message
SET user_id_id = backend_user.id
FROM backend_user
WHERE backend_message.user_id_migration = backend_user.id_migration;
-- Education updates
UPDATE backend_education
SET user_id_id = backend_user.id
FROM backend_user
WHERE backend_education.user_id_migration = backend_user.id_migration;
-- UserCompany updates
UPDATE backend_usercompany
SET company_id_id = backend_company.id, user_id_id = backend_user.id
FROM backend_company, backend_user
WHERE backend_usercompany.company_id_migration = backend_company.id_migration
AND backend_usercompany.user_id_migration = backend_user.id_migration;
-- UserLanguage updates
UPDATE backend_userlanguage
SET user_id_id = backend_user.id, language_id_id = backend_language.id, language_level_id_id = backend_languagelevel.id
FROM backend_user, backend_language, backend_languagelevel
WHERE backend_userlanguage.user_id_migration = backend_user.id_migration AND backend_userlanguage.language_id_migration = backend_language.id_migration
AND backend_userlanguage.language_level_id_migration = backend_languagelevel.id_migration;
-- TimeSchedule updates
UPDATE backend_timeschedule
SET company_id_id = backend_company.id, place_id_id = backend_place.id
FROM backend_company, backend_place
WHERE backend_timeschedule.company_id_migration = backend_company.id_migration
AND backend_timeschedule.place_id_migration = backend_place.id_migration;
-- CompanyField updates
UPDATE backend_companyfield
SET company_id_id = backend_company.id, field_id_id = backend_field.id
FROM backend_company, backend_field
WHERE backend_companyfield.company_id_migration = backend_company.id_migration
AND backend_companyfield.field_id_migration = backend_field.id_migration;
|
SELECT a.id AS id,
a.numero AS numero,
a.nom_voie AS nom_voie,
a.rep AS rep,
c.code_insee AS code_insee,
a.code_post AS code_post,
c.nom AS nom
FROM {SCHEMA}.adresse a,
{SCHEMA}.commune c
WHERE a.code_insee = c.code_insee
AND a.code_post like '{DEPARTEMENT}%' |
-- script lists all cities contained in database
-- record displays city id, name and state name
-- ordered by cities.id
SELECT cities.id, cities.name, states.name
FROM cities INNER JOIN states ON cities.state_id=states.id
ORDER BY cities.id ASC;
|
create index IX_EBCEF6CB on LP_LPServiceTimer (billId);
create index IX_7B27FACF on LP_LPServiceTimer (clientId);
create index IX_27C83AC5 on LP_LPServiceTimer (matterId);
create index IX_A6E63C8F on LP_LPServiceTimer (userId); |
SET NOCOUNT ON;
-- Since the starting quantity can vary from 0-1, create a list of vendor-item pairs to identify the lowest level pricebreak.
-- The first range = base cost and can be excluded from the matrix.
WITH
STARTLIST AS
(
SELECT itemPrice.[Vendor No_] VENDORID, RTRIM(itemPrice.[Item No_]) ITEMNMBR, MIN(itemPrice.[Minimum Quantity]) FIRSTRANGE
FROM
(SELECT purchasePrice.* FROM [WXYZ$Purchase Price] purchasePrice
INNER JOIN (SELECT [Item No_], [Vendor No_], [Unit of Measure Code], [Minimum Quantity], MAX([Starting Date]) as startdate
FROM [WXYZ$Purchase Price]
GROUP BY [Item No_],[Vendor No_], [Unit of Measure Code], [Minimum Quantity]
) oldestDate
ON purchasePrice.[Item No_]=oldestDate.[Item No_]
AND purchasePrice.[Vendor No_]=oldestDate.[Vendor No_]
AND purchasePrice.[Starting Date]=oldestDate.startdate
AND purchasePrice.[Unit of Measure Code]=oldestDate.[Unit of Measure Code]
AND purchasePrice.[Minimum Quantity] = oldestDate.[Minimum Quantity]
) itemPrice
GROUP BY itemPrice.[Vendor No_], RTRIM(itemPrice.[Item No_])
)
SELECT
'000' ShipperCode,
itemPrice.[Item No_] ItemCode,
itemPrice.[Vendor No_] SupplierCode,
1 Type, -- VolumeDiscount
1 DiscountMeasure, -- Units
2 DiscountType, -- Cost
itemPrice.[Minimum Quantity] Quantity, -- "quantity at which this level of discount is reached."
itemPrice.[Direct Unit Cost] Amount,
NULL MaxNumberOfBuys,
0 NumberOfTimesUsed,
NULL MaxBuyQuantity,
0 QuantityBoughtOnPricebreak,
NULL SupplierQuoteNumber,
NULL DateEffective,
CASE
WHEN itemPrice.[Ending Date] NOT LIKE '1753-01-01%' THEN
itemPrice.[Ending Date]
ELSE
' '
END DateExpires,
NULL Note,
NULL DateUpdated
FROM
(SELECT purchasePrice.* FROM [WXYZ$Purchase Price] purchasePrice
INNER JOIN (SELECT [Item No_], [Vendor No_], [Unit of Measure Code], [Minimum Quantity], MAX([Starting Date])as startdate
FROM [WXYZ$Purchase Price]
GROUP BY [Item No_],[Vendor No_], [Unit of Measure Code], [Minimum Quantity]
) oldestDate
ON purchasePrice.[Item No_]=oldestDate.[Item No_]
AND purchasePrice.[Vendor No_]=oldestDate.[Vendor No_]
AND purchasePrice.[Starting Date]=oldestDate.startdate
AND purchasePrice.[Unit of Measure Code]=oldestDate.[Unit of Measure Code]
AND purchasePrice.[Minimum Quantity] = oldestDate.[Minimum Quantity]) itemPrice
WHERE NOT EXISTS
(SELECT skip1.VENDORID, skip1.ITEMNMBR, skip1.FIRSTRANGE
FROM STARTLIST skip1
WHERE skip1.VENDORID=RTRIM(itemPrice.[Vendor No_])
AND skip1.ITEMNMBR=RTRIM(itemPrice.[Item No_])
AND skip1.FIRSTRANGE=itemPrice.[Minimum Quantity]
);
|
-- phpMyAdmin SQL Dump
-- version 4.2.11
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: 17-Fev-2017 às 03:12
-- Versão do servidor: 5.6.21
-- PHP Version: 5.6.3
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
--
-- Database: `estoque`
--
-- --------------------------------------------------------
--
-- Estrutura da tabela `fornecedor`
--
CREATE TABLE IF NOT EXISTS `fornecedor` (
`cnpj` varchar(18) NOT NULL,
`razao_social` varchar(100) NOT NULL,
`nome_fantasia` varchar(100) NOT NULL,
`endereco` varchar(100) NOT NULL,
`telefone` varchar(15) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Extraindo dados da tabela `fornecedor`
--
INSERT INTO `fornecedor` (`cnpj`, `razao_social`, `nome_fantasia`, `endereco`, `telefone`) VALUES
('05238271000527', 'Andrade Materiais de Construção Ltda', 'Andrade Materiais de Construção Ltda', 'Av. AtÃlio Fontana, Efapi, SC', '49 33297-517'),
('75384404000125', 'Rezzadori & Cia Ltda', 'DistriOeste', 'R Xanxere, 239-E, Lider, Chapeco, SC, CEP 89805-270, Brasil', '49 33310-600'),
('79245296000160', 'MEPAR MERCADO DE PARAFUSOS LTDA', 'MEPAR MERCADO DE PARAFUSOS LTDA', 'Av. Fernando Machado, 3240-D - LÃder, SC, 89805-203', '49 33217-777');
-- --------------------------------------------------------
--
-- Estrutura da tabela `fornecimento`
--
CREATE TABLE IF NOT EXISTS `fornecimento` (
`cod` bigint(20) unsigned NOT NULL,
`cnpj` varchar(18) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Extraindo dados da tabela `fornecimento`
--
INSERT INTO `fornecimento` (`cod`, `cnpj`) VALUES
(10001, '05238271000527'),
(30001, '79245296000160');
-- --------------------------------------------------------
--
-- Estrutura da tabela `grupo`
--
CREATE TABLE IF NOT EXISTS `grupo` (
`codg` bigint(20) unsigned NOT NULL,
`nome` varchar(100) NOT NULL
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=latin1;
--
-- Extraindo dados da tabela `grupo`
--
INSERT INTO `grupo` (`codg`, `nome`) VALUES
(1, 'Materiais e UtensÃlios Diversos para Instalações, Manutenção e Reparo'),
(2, 'Dispositivos e Acessórios para Instalações Hidráulicas'),
(3, 'Acessórios e Componentes Elétrico / Eletrônico / Telefonia'),
(4, 'Ferragens e Suprimentos para Instalações Elétricas'),
(5, 'Materiais de Expediente e Escritório');
-- --------------------------------------------------------
--
-- Estrutura da tabela `insercao`
--
CREATE TABLE IF NOT EXISTS `insercao` (
`codp` varchar(20) NOT NULL,
`qtd` int(11) NOT NULL,
`data` date NOT NULL,
`cnpj` varchar(18) DEFAULT NULL,
`vlr` decimal(10,0) NOT NULL,
`nfe` varchar(30) DEFAULT NULL,
`tipo` varchar(10) NOT NULL,
`local` bigint(20) unsigned NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Extraindo dados da tabela `insercao`
--
INSERT INTO `insercao` (`codp`, `qtd`, `data`, `cnpj`, `vlr`, `nfe`, `tipo`, `local`) VALUES
('00010001', 10, '2017-02-01', '05238271000527', '100', '1221', 'Compra', 1),
('00010001', 10, '2017-02-02', '05238271000527', '100', '111', 'Compra', 2),
('00010001', 5, '2017-03-01', NULL, '0', NULL, 'Transferê', 4),
('00030001', 10, '2017-04-14', '79245296000160', '0', '111', 'Compra', 5);
-- --------------------------------------------------------
--
-- Estrutura da tabela `local`
--
CREATE TABLE IF NOT EXISTS `local` (
`codl` bigint(20) unsigned NOT NULL,
`nome` varchar(100) NOT NULL
) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=latin1;
--
-- Extraindo dados da tabela `local`
--
INSERT INTO `local` (`codl`, `nome`) VALUES
(1, 'Campus Chapecó'),
(2, 'Campus Cerro Largo'),
(3, 'Campus Passo Fundo'),
(4, 'Campus Laranjeiras do Sul'),
(5, 'Campus Realeza'),
(6, 'Campus Erechim'),
(7, 'Reitoria');
-- --------------------------------------------------------
--
-- Estrutura da tabela `localizacao`
--
CREATE TABLE IF NOT EXISTS `localizacao` (
`codl` bigint(20) unsigned NOT NULL,
`codp` varchar(20) NOT NULL,
`qtd` int(11) DEFAULT NULL,
`qtdmin` int(11) DEFAULT NULL,
`alarm` tinyint(1) DEFAULT '1'
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Extraindo dados da tabela `localizacao`
--
INSERT INTO `localizacao` (`codl`, `codp`, `qtd`, `qtdmin`, `alarm`) VALUES
(1, '00010001', 10, 5, 1),
(2, '00010001', 5, 0, 1),
(4, '00010001', 5, 0, 1),
(1, '00030001', 0, 1, 1),
(5, '00030001', 10, 0, 1),
(1, '00040001', 0, 10, 1),
(7, '00050001', 0, 20, 1);
-- --------------------------------------------------------
--
-- Estrutura da tabela `produto`
--
CREATE TABLE IF NOT EXISTS `produto` (
`cod` varchar(20) NOT NULL,
`nome` varchar(100) NOT NULL,
`medida` varchar(10) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Extraindo dados da tabela `produto`
--
INSERT INTO `produto` (`cod`, `nome`, `medida`) VALUES
('00010001', 'Massa para Calafetar, Embalagem 350 g', 'Unidade'),
('00030001', 'Mini Disjuntor 20 A / 1 P, Monofasico', 'Unidade'),
('00040001', 'Fio FlexÃÂvel, 2,5mm, Verde', 'Unidade'),
('00050001', 'Caneta Esferográfica, Cor Azul', 'Unidade');
-- --------------------------------------------------------
--
-- Estrutura da tabela `remocao`
--
CREATE TABLE IF NOT EXISTS `remocao` (
`data` date NOT NULL,
`qtd` int(11) NOT NULL,
`codp` varchar(20) NOT NULL,
`destino` varchar(100) NOT NULL,
`chamado` varchar(100) DEFAULT NULL,
`local` bigint(20) unsigned NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Extraindo dados da tabela `remocao`
--
INSERT INTO `remocao` (`data`, `qtd`, `codp`, `destino`, `chamado`, `local`) VALUES
('2017-03-01', 5, '00010001', 'Transferência', '-', 2);
-- --------------------------------------------------------
--
-- Estrutura da tabela `usuario`
--
CREATE TABLE IF NOT EXISTS `usuario` (
`cod` bigint(20) unsigned NOT NULL,
`nome` varchar(16) NOT NULL,
`funcao` varchar(50) NOT NULL,
`senha` varchar(100) NOT NULL,
`codl` varchar(3) NOT NULL
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1;
--
-- Extraindo dados da tabela `usuario`
--
INSERT INTO `usuario` (`cod`, `nome`, `funcao`, `senha`, `codl`) VALUES
(1, 'ketly', 'Administrador', '58fd9f8fa442d83bc7ede1f2d7ae7792', '1');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `fornecedor`
--
ALTER TABLE `fornecedor`
ADD PRIMARY KEY (`cnpj`);
--
-- Indexes for table `fornecimento`
--
ALTER TABLE `fornecimento`
ADD PRIMARY KEY (`cod`,`cnpj`);
--
-- Indexes for table `grupo`
--
ALTER TABLE `grupo`
ADD PRIMARY KEY (`codg`);
--
-- Indexes for table `insercao`
--
ALTER TABLE `insercao`
ADD PRIMARY KEY (`codp`,`data`), ADD KEY `insercao_ibfk_2` (`cnpj`);
--
-- Indexes for table `local`
--
ALTER TABLE `local`
ADD PRIMARY KEY (`codl`);
--
-- Indexes for table `localizacao`
--
ALTER TABLE `localizacao`
ADD PRIMARY KEY (`codp`,`codl`), ADD KEY `localizacao_ibfk_2` (`codl`);
--
-- Indexes for table `produto`
--
ALTER TABLE `produto`
ADD PRIMARY KEY (`cod`), ADD UNIQUE KEY `cod` (`cod`);
--
-- Indexes for table `remocao`
--
ALTER TABLE `remocao`
ADD PRIMARY KEY (`data`,`codp`), ADD KEY `remocao_ibfk_1` (`codp`);
--
-- Indexes for table `usuario`
--
ALTER TABLE `usuario`
ADD PRIMARY KEY (`cod`), ADD UNIQUE KEY `cod` (`cod`), ADD KEY `codl` (`codl`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `grupo`
--
ALTER TABLE `grupo`
MODIFY `codg` bigint(20) unsigned NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=6;
--
-- AUTO_INCREMENT for table `local`
--
ALTER TABLE `local`
MODIFY `codl` bigint(20) unsigned NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=8;
--
-- AUTO_INCREMENT for table `usuario`
--
ALTER TABLE `usuario`
MODIFY `cod` bigint(20) unsigned NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=2;
--
-- Constraints for dumped tables
--
--
-- Limitadores para a tabela `insercao`
--
ALTER TABLE `insercao`
ADD CONSTRAINT `insercao_ibfk_1` FOREIGN KEY (`codp`) REFERENCES `produto` (`cod`),
ADD CONSTRAINT `insercao_ibfk_2` FOREIGN KEY (`cnpj`) REFERENCES `fornecedor` (`cnpj`);
--
-- Limitadores para a tabela `localizacao`
--
ALTER TABLE `localizacao`
ADD CONSTRAINT `localizacao_ibfk_1` FOREIGN KEY (`codp`) REFERENCES `produto` (`cod`),
ADD CONSTRAINT `localizacao_ibfk_2` FOREIGN KEY (`codl`) REFERENCES `local` (`codl`);
--
-- Limitadores para a tabela `remocao`
--
ALTER TABLE `remocao`
ADD CONSTRAINT `remocao_ibfk_1` FOREIGN KEY (`codp`) REFERENCES `produto` (`cod`);
/*!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 texasTable.airline_name, SUM(texasTable.flight_count) as flight_count
from (select A.airline_name ,F.plane_tail_number, count(*) as flight_count
from flight_reports F, world_area_codes W, airline_codes A
where W.wac_name = 'Texas' and W.wac_id = F.dest_wac_id and A.airline_code = F.airline_code
group by A.airline_name, F.plane_tail_number) as texasTable
where texasTable.plane_tail_number in (select distinct F.plane_tail_number
from flight_reports F, world_area_codes W
where W.wac_name = 'Texas' and W.wac_id = F.dest_wac_id
except
select distinct F.plane_tail_number
from flight_reports F, world_area_codes W
where W.wac_name <> 'Texas' and W.wac_id = F.dest_wac_id
)
group by airline_name
order by texasTable.airline_name asc; |
'SELECT * FROM employee_trackerdb.employee' |
DROP DATABASE IF EXISTS todo_db;
CREATE DATABASE todo_db;
USE todo_db;
CREATE TABLE items (
id INT AUTO_INCREMENT NOT NULL PRIMARY KEY,
text VARCHAR(50) NOT NULL,
isDone BOOL NOT NULL DEFAULT 0
); |
-- phpMyAdmin SQL Dump
-- version 3.3.3
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Jul 07, 2011 at 06:34 AM
-- Server version: 5.5.8
-- PHP Version: 5.3.5
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
/*!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: `ppp`
--
CREATE DATABASE `ppp` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
USE `ppp`;
-- --------------------------------------------------------
--
-- Table structure for table `skewdot`
--
CREATE TABLE IF NOT EXISTS `skewdot` (
`RecordID` int(11) NOT NULL AUTO_INCREMENT,
`MeasuredTime` varchar(256) DEFAULT NULL,
`SerialNo` varchar(256) DEFAULT NULL,
`ProductName` varchar(256) DEFAULT NULL,
`BuildPhase` varchar(256) DEFAULT NULL,
`UnitNo` varchar(256) DEFAULT NULL,
`SideInfo` varchar(256) DEFAULT NULL,
`ReworkCode` varchar(256) DEFAULT NULL,
`Platform` varchar(256) DEFAULT NULL,
`MediaType` varchar(256) DEFAULT NULL,
`Commt1` varchar(256) DEFAULT NULL,
`Commt2` varchar(256) DEFAULT NULL,
`Page` int(11) DEFAULT NULL,
`Paper` double DEFAULT NULL,
`PF` double DEFAULT NULL,
`Top` double DEFAULT NULL,
`Side` double DEFAULT NULL,
`Feed` double DEFAULT NULL,
`LLFE` double DEFAULT NULL,
`RLFE` double DEFAULT NULL,
`LTS` double DEFAULT NULL,
`RTS` double DEFAULT NULL,
`TLM` double DEFAULT NULL,
`BLM` double DEFAULT NULL,
`RecordTimestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`RecordID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
--
-- Dumping data for table `skewdot`
--
|
/*Creation of strong entities*/
#create schema carfactory;
create table factory(
factoryID int unsigned not null,
address text not null,
faxNo varchar(20) not null,
phoneNo varchar (20) not null,
manager int unsigned,
primary key(factoryID)
);
create table staff(
staffID int unsigned not null,
fname varchar(20) not null,
lname varchar(20) not null,
gender char(1),
age int,
roleID int unsigned not null,
factoryID int unsigned not null,
hiredate date,
phoneNo varchar(20) not null,
primary key(staffID),
foreign key(factoryID) references factory(factoryID)
);
create table roles(
roleID int unsigned not null,
rolename varchar(20) not null,
description text not null,
primary key(roleID)
);
create table salespoint(
salespointID int unsigned not null,
address text not null,
phoneNo varchar(20) not null,
faxNo varchar(20) not null,
primary key(salespointID)
);
create table port_lane(
portlaneID int unsigned not null,
primary key(portlaneID)
);
create table factory_shippingport(
shippingportID int unsigned not null,
factoryID int unsigned not null,
manager int unsigned not null,
primary key(shippingportID,factoryID),
foreign key(factoryID) references factory(factoryID),
foreign key(manager) references staff(staffID)
);
create table factory_shippingport_portlane(
shippingportID int unsigned not null,
factoryID int unsigned not null,
portlaneID int unsigned not null,
status varchar(20) not null,
primary key(shippingportID,factoryID,portlaneID),
foreign key (shippingportID,factoryID) references factory_shippingport(shippingportID,factoryID)
);
create table productionline(
productionlineID int unsigned not null,
primary key(productionlineID)
);
create table category(
categoryID int unsigned not null,
description text not null,
primary key(categoryID)
);
create table model(
modelID int unsigned not null,
categoryID int unsigned not null,
year_start_production int unsigned,
unit_price int unsigned not null,
primary key(modelID),
foreign key(categoryID) references category(categoryID)
);
create table factory_productionline_model(
productionlineID int unsigned not null,
factoryID int unsigned not null,
modelID int unsigned not null,
daily_output int unsigned not null,
date_last_maintenance date not null,
date_next_maintenance date not null,
uptime int unsigned not null,
primary key(productionlineID,factoryID,modelID),
foreign key(productionlineID) references productionline(productionlineID),
foreign key(factoryID) references factory(factoryID),
foreign key(modelID) references model(modelID)
);
create table factory_productionline_staff(
productionlineID int unsigned not null,
factoryID int unsigned not null,
staffID int unsigned not null,
shift_start time not null,
shift_end time not null,
shiftdate date not null,
primary key(productionlineID,factoryID,staffID),
foreign key(productionlineID) references productionline(productionlineID),
foreign key(factoryID) references factory(factoryID),
foreign key(staffID) references staff(staffID)
);
create table batch(
batchNo int unsigned not null,
productionlineID int unsigned not null,
factoryID int unsigned not null,
modelID int unsigned not null,
batch_size int not null,
batch_date date not null,
primary key(batchNo),
foreign key(productionlineID,factoryID,modelID) references factory_productionline_model(productionlineID,factoryID,modelID)
);
create table inspection(
inspectorID int unsigned not null,
batchNo int unsigned not null,
inspection_date date not null,
inspection_status varchar(10) not null,
comments text,
primary key(inspectorID,batchNo,inspection_date),
foreign key(batchNo) references batch(batchNo),
foreign key(inspectorID) references staff(staffID)
);
create table shipment(
shipmentID int unsigned not null,
shippingportID int unsigned not null,
factoryID int unsigned not null,
portlaneID int unsigned not null,
batchNo int unsigned not null,
salespointID int unsigned not null,
date_shipped date not null,
primary key(shipmentID),
foreign key(shippingportID,factoryID,portlaneID) references factory_shippingport_portlane(shippingportID,factoryID,portlaneID),
foreign key(batchNo) references batch(batchNo),
foreign key(salespointID) references salespoint(salespointID)
);
/*Adding in foreign key constraints*/
alter table factory
add foreign key(manager) references staff(staffID);
alter table staff
add foreign key(roleID) references roles(roleID);
commit;
|
-- Q1: What is the average number of films rented per day, and the average days between rentals for the top 5 renting customers?
WITH
t1 AS (
SELECT customer_id,
COUNT(*) AS num_of_films_rented,
DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS customer_rank
FROM rental
GROUP BY 1
ORDER BY 2 DESC
LIMIT 5
),
t2 AS (
SELECT t1.customer_rank,
t1.customer_id,
CONCAT(first_name,' ',last_name) AS full_name,
DATE_TRUNC('day',rental_date) AS day,
COUNT(*) AS num_of_films_rented_per_day,
CAST(DATE_TRUNC('day',rental_date) AS DATE) - CAST(LAG(DATE_TRUNC('day',rental_date)) OVER (PARTITION BY t1.customer_id ORDER BY DATE_TRUNC('day',rental_date)) AS DATE) AS days_between_rentals
FROM t1
JOIN rental r
ON t1.customer_id = r.customer_id
JOIN customer c
ON t1.customer_id = c.customer_id
GROUP BY 1,2,3,4
)
SELECT customer_rank,
full_name,
ROUND(AVG(num_of_films_rented_per_day)) AS avg_films_rented_per_day,
ROUND(AVG(days_between_rentals)) AS avg_days_between_rentals
FROM t2
GROUP BY 1,2
ORDER BY 1
-- Q2: What is the most rented film category in (India, China, United States, Japan and Brazil) and how many times they were rented?
WITH
t1 AS (
SELECT co.country,
ca.name AS category_name,
COUNT(*) AS num_of_rentals
FROM customer cu
JOIN address ad
ON ad.address_id = cu.address_id
JOIN city ci
ON ci.city_id = ad.city_id
JOIN country co
ON co.country_id = ci.country_id
JOIN rental re
ON cu.customer_id = re.customer_id
JOIN inventory i
ON i.inventory_id = re.inventory_id
JOIN film_category fc
ON fc.film_id = i.film_id
JOIN category ca
ON ca.category_id = fc.category_id
GROUP BY 1,2
),
t2 AS (
Select country,
MAX(num_of_rentals) AS max_num_of_rentals
FROM t1
WHERE country IN ('India','China','United States','Japan','Brazil')
GROUP BY 1
)
Select t2.country,
t1.category_name,
t1.num_of_rentals
FROM t1
JOIN t2
ON t1.country = t2.country
AND t1.num_of_rentals = t2.max_num_of_rentals
ORDER BY 3 DESC
-- Q3: What is the most and least profitable films in store 1,
And how many times they were rented?
WITH
t1 AS (
SELECT title,
SUM(amount) AS total_earnings,
COUNT(*) AS num_of_rentals
FROM film f
JOIN inventory i
ON f.film_id = i.film_id
JOIN rental r
ON i.inventory_id = r.inventory_id
JOIN payment p
ON r.rental_id = p.rental_id
WHERE i.store_id = 1
GROUP BY 1
),
t2 AS (
SELECT MAX(total_earnings) AS max,
MIN(total_earnings) AS min
FROM t1
)
SELECT title,
total_earnings,
num_of_rentals
FROM t1
JOIN t2
ON t1.total_earnings=t2.max
OR t1.total_earnings=t2.min
-- Q4: What is the most and least preferred film length by customers?
SELECT CASE
WHEN length < 60 THEN 'less than 1 hour'
WHEN length BETWEEN 60 AND 120 THEN '1 - 2 hours'
WHEN length BETWEEN 121 AND 180 THEN '2 - 3 hours'
ELSE 'more than 3 hours'
END AS film_length,
COUNT(*) AS num_of_rentals
FROM film f
JOIN inventory i
ON f.film_id = i.film_id
JOIN rental r
ON i.inventory_id = r.rental_id
GROUP BY 1
ORDER BY 2 DESC
|
-- Write a SQL query to find the salary of all employees whose salary is in the range [20000…30000].
SELECT e.Salary
FROM dbo.Employees e
WHERE e.Salary >= 20000 AND e.Salary <= 30000 |
-- phpMyAdmin SQL Dump
-- version 5.0.2
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1:3306
-- Tempo de geração: 05-Abr-2021 às 14:48
-- Versão do servidor: 8.0.21
-- versão do PHP: 7.4.9
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 */;
--
-- Banco de dados: `moiras`
--
CREATE DATABASE IF NOT EXISTS `moiras` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
USE `moiras`;
-- --------------------------------------------------------
--
-- Estrutura da tabela `usuarios`
--
DROP TABLE IF EXISTS `usuarios`;
CREATE TABLE IF NOT EXISTS `usuarios` (
`Cod_Usuario` int NOT NULL,
`Nome_Usuario` varchar(100) NOT NULL,
`User` varchar(100) NOT NULL,
`Senha` varchar(12) NOT NULL,
`img_pequena` varchar(100) NOT NULL,
`img_grande` varchar(100) NOT NULL,
`Data_Nascimento` date NOT NULL,
`Informacoes_Alma` longtext NOT NULL,
PRIMARY KEY (`Cod_Usuario`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
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 DrugMgmt (
DrugID int,
DrugName varchar(255)
); |
SELECT * FROM soft_uni.employees;
#Exercise 1
SELECT first_name, last_name FROM employees
WHERE LOWER(substring(first_name, 1, 2)) = 'sa'
ORDER BY employee_id;
#Exercise 2
SELECT first_name, last_name FROM employees
WHERE LOCATE('ei', LOWER(last_name))
ORDER BY employee_id;
#Exercise 3
SELECT first_name FROM employees
WHERE
department_id IN (3, 10) AND
EXTRACT(YEAR FROM hire_date) BETWEEN 1995 AND 2005
ORDER BY employee_id ASC;
#Exerise 4
SELECT first_name, last_name FROM employees
WHERE LOCATE('engineer', LOWER(job_title)) = 0
ORDER BY employee_id ASC;
#Exercise 5
SELECT name FROM towns
WHERE CHAR_LENGTH(name) IN (5, 6)
ORDER BY name ASC;
#Exercise 6
SELECT town_id, name FROM towns
WHERE LEFT(LOWER(name), 1) IN ('M','K','B','E')
ORDER BY name ASC;
#Exercise 7
SELECT town_id, name FROM towns
WHERE LEFT(LOWER(name), 1) NOT IN ('r','b','d')
ORDER BY name ASC;
#Exercise 8
CREATE VIEW v_employees_hired_after_2000 AS
SELECT first_name, last_name FROM employees
WHERE YEAR(hire_date) > 2000;
#Exercise 9
SELECT first_name, last_name FROM employees
WHERE char_length(last_name) = 5;
#Exercise 10
USE geography;
SELECT country_name, iso_code FROM countries
WHERE LOWER(country_name) LIKE '%a%a%a%'
ORDER BY iso_code;
#Exercise 11
SELECT peak_name,
river_name,
LOWER(CONCAT(peak_name, SUBSTRING(river_name, 2))) as mix
#LOWER(CONCAT(`peak_name`, SUBSTRING(`river_name`, 2))) AS 'mix'
FROM peaks,
rivers
WHERE LOWER(RIGHT(peak_name, 1)) = LOWER(LEFT(river_name, 1))
ORDER BY mix;
#Exercise 12
USE diablo;
SELECT name, DATE_FORMAT(start, '%Y-%m-%d') FROM games
WHERE YEAR(start) IN (2011, 2012)
ORDER BY start, name
LIMIT 50;
#Exercise 13
SELECT user_name,
REVERSE(SUBSTRING(REVERSE(email) FROM 1 FOR (LOCATE('@', REVERSE(email))-1))) AS `Email Provider`
FROM users
ORDER BY `Email Provider`, user_name;
#another solurtion
SELECT
`user_name`,
SUBSTRING_INDEX(`email`, '@', - 1) AS 'Email Provider'
FROM
`users`
ORDER BY `Email Provider` , `user_name`;
#Exercise 14
SELECT user_name, ip_address FROM users
WHERE ip_address LIKE '___.1%.%.___'
ORDER BY user_name;
#Exercise 15
SELECT name,
CASE
WHEN HOUR(start) >= 0 AND HOUR(start) < 12 THEN 'Morning'
WHEN HOUR(start) >= 12 AND HOUR(start) < 18 THEN 'Afternoon'
WHEN HOUR(start) >= 18 AND HOUR(start) < 24 THEN 'Evening'
END AS `Par of the Day`,
CASE
WHEN duration <= 3 THEN 'Extra Short'
WHEN duration > 3 AND duration <= 6 THEN 'Short'
WHEN duration > 6 AND duration <= 10 THEN 'Long'
ELSE 'Extra Long'
END AS `Duration`
FROM games;
#Exercise 16
USE orders;
SELECT product_name,
order_date,
DATE_ADD(order_date, INTERVAL 3 DAY) as pay_due,
DATE_ADD(order_date, INTERVAL 1 MONTH) as deliver_due
FROM orders;
|
-- Grader report
SET SEARCH_PATH TO markus;
DROP TABLE IF EXISTS q4;
-- You must not change this table definition.
CREATE TABLE q4 (
assignment_id integer,
username varchar(25),
num_marked integer,
num_not_marked integer,
min_mark real,
max_mark real
);
-- You may find it convenient to do this for each of the views
-- that define your intermediate steps. (But give them better names!)
DROP VIEW IF EXISTS pool CASCADE;
DROP VIEW IF EXISTS assigned CASCADE;
DROP VIEW IF EXISTS marked CASCADE;
DROP VIEW IF EXISTS not_marked CASCADE;
DROP VIEW IF EXISTS assignment_max_mark CASCADE;
DROP VIEW IF EXISTS group_true_mark CASCADE;
DROP VIEW IF EXISTS minScore CASCADE;
DROP VIEW IF EXISTS maxScore CASCADE;
DROP VIEW IF EXISTS answer CASCADE;
-- Define views for your intermediate steps here.
-- Question Four
-- For each assignment that has any graders delcared, and each grader of that assignment, report the number of groups that they have
-- already completed grading (that is, there is a grade recorded in the Result table), the number they have been assigned but have not yet
-- graded, and the minimum and maximum grade they have given
-- Find all Graders for each assignment
create view pool as
select distinct assignment_id, group_id, username as TA
from AssignmentGroup natural join Grader;
-- Find the number of groups that each TA as assigned to mark for each assignment
create view assigned as
select TA, assignment_id, count(*) as numberAssigned
from pool
group by TA, assignment_id;
-- Find the number of groups that the TA has already marked for each assignment
create view marked as
select TA, assignment_id, count(mark) as numberMarked
from pool natural left join Result
group by TA, assignment_id;
-- Calculate the number of groups left for each assignment to be marked
create view not_marked as
select TA, assignment_id, (numberAssigned - numberMarked) as numberNmarked
from assigned natural left join marked;
-- Find the maximum possible score that is possible for each assignment
create view assignment_max_mark as
select assignment_id, cast (sum(out_of * weight) as float) as max_mark
from RubricItem
group by assignment_id;
-- Calculate the percentage mark that each group got
create view group_true_mark as
select assignment_id, group_id, ( cast(mark as float) / cast (max_mark as float))*100.0 as true_mark
from AssignmentGroup
natural left join Result
natural left join assignment_max_mark;
-- Find the min and max mark that the TA have gave so far
create view minScore as
select TA, assignment_id, min(true_mark) as min_mark
from pool natural join group_true_mark
group by TA, assignment_id;
create view maxScore as
select TA, assignment_id, max(true_mark) as max_mark
from pool natural join group_true_mark
group by TA, assignment_id;
-- Putting everything together to build the final answer
create view answer as
select distinct assignment_id,
TA as username,
numberMarked as num_marked,
numberNmarked as num_not_marked,
min_mark, max_mark
from pool natural full join assigned
natural full join marked
natural full join not_marked
natural full join minScore
natural full join maxScore;
-- Final answer.
INSERT INTO q4 (select * from answer);
-- put a final query here so that its results will go into the table. |
.load ../utils/split.dylib
create temporary table input(line TEXT);
.mode csv
.import 11_input.txt input
create table all_seats as
select value from input, split(input.line, "");
create table seats(x int, y int, status int, unique(x,y));
with dimensions(d) as (
select max(length(line)) from input
) insert into seats select
(all_seats.rowid-1) / dimensions.d,
(all_seats.rowid-1) % dimensions.d,
CASE
WHEN value = "L" THEN 0 -- empty
ELSE 1 -- taken
END
from
all_seats,
dimensions
where
value != "."
order by 1, 2;
select count(*), max(length(line)), min(length(line)) from input; |
CREATE TABLE IF NOT EXISTS accounts (
id uuid PRIMARY KEY,
email VARCHAR(40) NOT NULL UNIQUE,
login VARCHAR(40) NOT NULL UNIQUE,
password VARCHAR NOT NULL,
balance NUMERIC(20, 2) DEFAULT 0.00 CONSTRAINT not_negative_balance CHECK (balance >= 0),
created_at TIMESTAMPTZ DEFAULT CURRENT_TIMESTAMP
); |
------------------------------------------------------------------------------
-- PostgreSQL Table Tranlation Engine - Helper functions uninstallation file
-- Version 0.1 for PostgreSQL 9.x
-- https://github.com/edwardsmarc/postTranslationEngine
--
-- This is free software; you can redistribute and/or modify it under
-- the terms of the GNU General Public Licence. See the COPYING file.
--
-- Copyright (C) 2018-2020 Pierre Racine <pierre.racine@sbf.ulaval.ca>,
-- Marc Edwards <medwards219@gmail.com>,
-- Pierre Vernier <pierre.vernier@gmail.com>
-------------------------------------------------------------------------------
DROP FUNCTION IF EXISTS TT_DefaultErrorCode(text, text);
-- validation helper functions
DROP FUNCTION IF EXISTS TT_NotNull(text);
DROP FUNCTION IF EXISTS TT_NotNull(text, text);
DROP FUNCTION IF EXISTS TT_NotEmpty(text, text);
DROP FUNCTION IF EXISTS TT_NotEmpty(text) CASCADE;
DROP FUNCTION IF EXISTS TT_IsInt(text);
DROP FUNCTION IF EXISTS TT_IsInt(text, text);
DROP FUNCTION IF EXISTS TT_IsNumeric(text);
DROP FUNCTION IF EXISTS TT_IsNumeric(text, text);
DROP FUNCTION IF EXISTS TT_IsBoolean(text);
DROP FUNCTION IF EXISTS TT_IsName(text);
DROP FUNCTION IF EXISTS TT_IsChar(text);
DROP FUNCTION IF EXISTS TT_IsStringList(text, boolean);
DROP FUNCTION IF EXISTS TT_IsDoubleList(text);
DROP FUNCTION IF EXISTS TT_IsIntList(text);
DROP FUNCTION IF EXISTS TT_IsCharList(text);
DROP FUNCTION IF EXISTS TT_IsBetween(text, text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_IsBetween(text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_IsBetween(text, text, text);
DROP FUNCTION IF EXISTS TT_IsGreaterThan(text, text, text, text);
DROP FUNCTION IF EXISTS TT_IsGreaterThan(text, text, text);
DROP FUNCTION IF EXISTS TT_IsGreaterThan(text, text);
DROP FUNCTION IF EXISTS TT_IsLessThan(text, text, text, text);
DROP FUNCTION IF EXISTS TT_IsLessThan(text, text, text);
DROP FUNCTION IF EXISTS TT_IsLessThan(text, text);
DROP FUNCTION IF EXISTS TT_IsUnique(text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_IsUnique(text, text, text, text);
DROP FUNCTION IF EXISTS TT_IsUnique(text, text, text);
DROP FUNCTION IF EXISTS TT_IsUnique(text, text);
DROP FUNCTION IF EXISTS TT_MatchTable(text, text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_MatchTable(text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_MatchTable(text, text, text, text);
DROP FUNCTION IF EXISTS TT_MatchList(text, text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_MatchList(text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_MatchList(text, text, text, text);
DROP FUNCTION IF EXISTS TT_MatchList(text, text, text);
DROP FUNCTION IF EXISTS TT_MatchList(text, text);
DROP FUNCTION IF EXISTS TT_SumIntMatchList(text, text, text, text);
DROP FUNCTION IF EXISTS TT_SumIntMatchList(text, text, text);
DROP FUNCTION IF EXISTS TT_SumIntMatchList(text, text);
DROP FUNCTION IF EXISTS TT_LengthMatchList(text, text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_LengthMatchList(text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_LengthMatchList(text, text, text, text);
DROP FUNCTION IF EXISTS TT_LengthMatchList(text, text, text);
DROP FUNCTION IF EXISTS TT_LengthMatchList(text, text);
DROP FUNCTION IF EXISTS TT_NotMatchList(text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_NotMatchList(text, text, text, text);
DROP FUNCTION IF EXISTS TT_NotMatchList(text, text, text);
DROP FUNCTION IF EXISTS TT_NotMatchList(text, text);
DROP FUNCTION IF EXISTS TT_False();
DROP FUNCTION IF EXISTS TT_True();
DROP FUNCTION IF EXISTS TT_HasCountOfNotNull(text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_HasCountOfNotNull(text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_HasCountOfNotNull(text, text, text, text, text, text, text, text, text, text, text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_HasCountOfNotNull(text, text, text, text, text, text, text, text, text, text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_HasCountOfNotNull(text, text, text, text, text, text, text, text, text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_HasCountOfNotNull(text, text, text, text, text, text, text, text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_HasCountOfNotNull(text, text, text, text, text, text, text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_HasCountOfNotNull(text, text, text, text, text, text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_HasCountOfNotNull(text, text, text, text, text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_HasCountOfNotNull(text, text, text, text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_HasCountOfNotNull(text, text, text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_HasCountOfNotNull(text, text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_HasCountOfNotNull(text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_HasCountOfNotNull(text, text, text, text);
DROP FUNCTION IF EXISTS TT_HasCountOfNotNull(text, text, text);
DROP FUNCTION IF EXISTS TT_HasCountOfNotNullOrZero(text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_HasCountOfNotNullOrZero(text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_HasCountOfNotNullOrZero(text, text, text, text, text, text, text, text, text, text, text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_HasCountOfNotNullOrZero(text, text, text, text, text, text, text, text, text, text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_HasCountOfNotNullOrZero(text, text, text, text, text, text, text, text, text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_HasCountOfNotNullOrZero(text, text, text, text, text, text, text, text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_HasCountOfNotNullOrZero(text, text, text, text, text, text, text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_HasCountOfNotNullOrZero(text, text, text, text, text, text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_HasCountOfNotNullOrZero(text, text, text, text, text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_HasCountOfNotNullOrZero(text, text, text, text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_HasCountOfNotNullOrZero(text, text, text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_HasCountOfNotNullOrZero(text, text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_HasCountOfNotNullOrZero(text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_HasCountOfNotNullOrZero(text, text, text, text);
DROP FUNCTION IF EXISTS TT_HasCountOfNotNullOrZero(text, text, text);
DROP FUNCTION IF EXISTS TT_IsIntSubstring(text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_IsIntSubstring(text, text, text, text);
DROP FUNCTION IF EXISTS TT_IsIntSubstring(text, text, text);
DROP FUNCTION IF EXISTS TT_IsBetweenSubstring(text, text, text, text, text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_IsBetweenSubstring(text, text, text, text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_IsBetweenSubstring(text, text, text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_IsBetweenSubstring(text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_MatchListSubstring(text, text, text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_MatchListSubstring(text, text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_MatchListSubstring(text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_MatchListSubstring(text, text, text, text);
DROP FUNCTION IF EXISTS TT_HasLength(text, text, text);
DROP FUNCTION IF EXISTS TT_HasLength(text, text);
DROP FUNCTION IF EXISTS TT_MaxIndexNotNull(text, text);
DROP FUNCTION IF EXISTS TT_MaxIndexNotNull(text, text, text, text);
DROP FUNCTION IF EXISTS TT_MinIndexNotNull(text, text);
DROP FUNCTION IF EXISTS TT_MinIndexNotNull(text, text, text, text);
DROP FUNCTION IF EXISTS TT_MinIndexNotEmpty(text, text);
DROP FUNCTION IF EXISTS TT_MinIndexNotEmpty(text, text, text, text);
DROP FUNCTION IF EXISTS TT_MaxIndexNotEmpty(text, text);
DROP FUNCTION IF EXISTS TT_MaxIndexNotEmpty(text, text, text, text);
DROP FUNCTION IF EXISTS TT_IsXMinusYBetween(text, text, text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_IsXMinusYBetween(text, text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_IsXMinusYBetween(text, text, text, text);
DROP FUNCTION IF EXISTS TT_MatchListTwice(text, text, text, text);
DROP FUNCTION IF EXISTS TT_MaxIndexIsInt(text, text);
DROP FUNCTION IF EXISTS TT_MaxIndexIsInt(text, text, text, text);
DROP FUNCTION IF EXISTS TT_MinIndexIsInt(text, text);
DROP FUNCTION IF EXISTS TT_MinIndexIsInt(text, text, text, text);
DROP FUNCTION IF EXISTS TT_MinIndexIsBetween(text, text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_MinIndexIsBetween(text, text, text, text);
DROP FUNCTION IF EXISTS TT_MaxIndexIsBetween(text, text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_MaxIndexIsBetween(text, text, text, text);
DROP FUNCTION IF EXISTS TT_MinIndexMatchList(text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_MinIndexMatchList(text, text, text);
DROP FUNCTION IF EXISTS TT_MaxIndexMatchList(text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_MaxIndexMatchList(text, text, text);
DROP FUNCTION IF EXISTS TT_CoalesceIsInt(text);
DROP FUNCTION IF EXISTS TT_CoalesceIsInt(text, text);
DROP FUNCTION IF EXISTS TT_CoalesceIsBetween(text, text, text);
DROP FUNCTION IF EXISTS TT_CoalesceIsBetween(text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_CoalesceIsBetween(text, text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_HasCountOfMatchList(text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_HasCountOfMatchList(text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_HasCountOfMatchList(text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_HasCountOfMatchList(text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_HasCountOfMatchList(text, text, text, text, text, text, text, text, text, text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_HasCountOfMatchList(text, text, text, text, text, text, text, text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_HasCountOfMatchList(text, text, text, text, text, text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_HasCountOfMatchList(text, text, text, text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_HasCountOfMatchList(text, text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_AlphaNumericMatchList(text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_AlphaNumericMatchList(text, text, text, text);
DROP FUNCTION IF EXISTS TT_AlphaNumericMatchList(text, text, text);
DROP FUNCTION IF EXISTS TT_AlphaNumericMatchList(text, text);
DROP FUNCTION IF EXISTS TT_AlphaNumeric(text);
DROP FUNCTION IF EXISTS TT_GetIndexNotNull(text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_GetIndexNotNull(text, text, text);
DROP FUNCTION IF EXISTS TT_GetIndexNotEmpty(text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_GetIndexNotEmpty(text, text, text);
DROP FUNCTION IF EXISTS TT_GetIndexIsInt(text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_GetIndexIsInt(text, text, text);
DROP FUNCTION IF EXISTS TT_GetIndexIsBetween(text, text, text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_GetIndexIsBetween(text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_GetIndexMatchList(text, text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_GetIndexMatchList(text, text, text, text);
DROP FUNCTION IF EXISTS TT_GetIndexNotMatchList(text, text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_GetIndexNotMatchList(text, text, text, text);
DROP FUNCTION IF EXISTS TT_MaxIndexNotMatchList(text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_MaxIndexNotMatchList(text, text, text);
DROP FUNCTION IF EXISTS TT_MinIndexNotMatchList(text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_MinIndexNotMatchList(text, text, text);
-- translation helper functions
DROP FUNCTION IF EXISTS TT_CopyText(text);
DROP FUNCTION IF EXISTS TT_CopyDouble(text);
DROP FUNCTION IF EXISTS TT_CopyInt(text);
DROP FUNCTION IF EXISTS TT_LookupInt(text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_LookupInt(text, text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_LookupDouble(text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_LookupDouble(text, text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_LookupText(text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_LookupText(text, text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_LookupText(text, text, text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_MapText(text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_MapText(text, text, text, text);
DROP FUNCTION IF EXISTS TT_MapText(text, text, text);
DROP FUNCTION IF EXISTS TT_MapDouble(text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_MapDouble(text, text, text, text);
DROP FUNCTION IF EXISTS TT_MapDouble(text, text, text);
DROP FUNCTION IF EXISTS TT_MapInt(text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_MapInt(text, text, text, text);
DROP FUNCTION IF EXISTS TT_MapInt(text, text, text);
DROP FUNCTION IF EXISTS TT_Length(text);
DROP FUNCTION IF EXISTS TT_Length(text, text);
DROP FUNCTION IF EXISTS TT_Pad(text, text, text);
DROP FUNCTION IF EXISTS TT_Pad(text, text, text, text);
DROP FUNCTION IF EXISTS TT_PadConcat(text, text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_PadConcat(text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_Concat(text, text);
DROP FUNCTION IF EXISTS TT_Concat(text, text, text);
DROP FUNCTION IF EXISTS TT_NothingText();
DROP FUNCTION IF EXISTS TT_NothingDouble();
DROP FUNCTION IF EXISTS TT_NothingInt();
DROP FUNCTION IF EXISTS TT_CountOfNotNull(text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_CountOfNotNull(text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_CountOfNotNull(text, text, text, text, text, text, text, text, text, text, text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_CountOfNotNull(text, text, text, text, text, text, text, text, text, text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_CountOfNotNull(text, text, text, text, text, text, text, text, text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_CountOfNotNull(text, text, text, text, text, text, text, text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_CountOfNotNull(text, text, text, text, text, text, text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_CountOfNotNull(text, text, text, text, text, text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_CountOfNotNull(text, text, text, text, text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_CountOfNotNull(text, text, text, text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_CountOfNotNull(text, text, text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_CountOfNotNull(text, text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_CountOfNotNull(text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_CountOfNotNull(text, text, text, text);
DROP FUNCTION IF EXISTS TT_CountOfNotNull(text, text, text);
DROP FUNCTION IF EXISTS TT_IfElseCountOfNotNullText(text, text, text, text, text, text, text, text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_IfElseCountOfNotNullText(text, text, text, text, text, text, text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_IfElseCountOfNotNullText(text, text, text, text, text, text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_IfElseCountOfNotNullText(text, text, text, text, text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_IfElseCountOfNotNullText(text, text, text, text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_IfElseCountOfNotNullText(text, text, text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_IfElseCountOfNotNullText(text, text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_IfElseCountOfNotNullText(text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_IfElseCountOfNotNullInt(text, text, text, text, text, text, text, text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_IfElseCountOfNotNullInt(text, text, text, text, text, text, text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_IfElseCountOfNotNullInt(text, text, text, text, text, text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_IfElseCountOfNotNullInt(text, text, text, text, text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_IfElseCountOfNotNullInt(text, text, text, text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_IfElseCountOfNotNullInt(text, text, text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_IfElseCountOfNotNullInt(text, text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_IfElseCountOfNotNullInt(text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_SubstringText(text, text, text, text);
DROP FUNCTION IF EXISTS TT_SubstringText(text, text, text);
DROP FUNCTION IF EXISTS TT_SubstringInt(text, text, text, text);
DROP FUNCTION IF EXISTS TT_SubstringInt(text, text, text);
DROP FUNCTION IF EXISTS TT_MapSubstringText(text, text, text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_MapSubstringText(text, text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_MapSubstringText(text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_SumIntMapText(text, text, text);
DROP FUNCTION IF EXISTS TT_LengthMapInt(text, text, text, text);
DROP FUNCTION IF EXISTS TT_LengthMapInt(text, text, text);
DROP FUNCTION IF EXISTS TT_XMinusYInt(text, text);
DROP FUNCTION IF EXISTS TT_XMinusYDouble(text, text);
DROP FUNCTION IF EXISTS TT_MinInt(text);
DROP FUNCTION IF EXISTS TT_MaxInt(text);
DROP FUNCTION IF EXISTS TT_MinIndexCopyText(text, text);
DROP FUNCTION IF EXISTS TT_MinIndexCopyText(text, text, text, text);
DROP FUNCTION IF EXISTS TT_MaxIndexCopyText(text, text);
DROP FUNCTION IF EXISTS TT_MaxIndexCopyText(text, text, text, text);
DROP FUNCTION IF EXISTS TT_MinIndexCopyInt(text, text);
DROP FUNCTION IF EXISTS TT_MinIndexCopyInt(text, text, text, text);
DROP FUNCTION IF EXISTS TT_MaxIndexCopyInt(text, text);
DROP FUNCTION IF EXISTS TT_MaxIndexCopyInt(text, text, text, text);
DROP FUNCTION IF EXISTS TT_MinIndexMapText(text, text, text, text);
DROP FUNCTION IF EXISTS TT_MinIndexMapText(text, text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_MaxIndexMapText(text, text, text, text);
DROP FUNCTION IF EXISTS TT_MaxIndexMapText(text, text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_MinIndexMapInt(text, text, text, text);
DROP FUNCTION IF EXISTS TT_MinIndexMapInt(text, text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_MaxIndexMapInt(text, text, text, text);
DROP FUNCTION IF EXISTS TT_MaxIndexMapInt(text, text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_DivideInt(text, text);
DROP FUNCTION IF EXISTS TT_DivideDouble(text, text);
DROP FUNCTION IF EXISTS TT_Multiply(text, text);
DROP FUNCTION IF EXISTS TT_CoalesceInt(text);
DROP FUNCTION IF EXISTS TT_CoalesceInt(text, text);
DROP FUNCTION IF EXISTS TT_CoalesceText(text);
DROP FUNCTION IF EXISTS TT_CoalesceText(text, text);
DROP FUNCTION IF EXISTS TT_CoalesceText(text, text, text);
DROP FUNCTION IF EXISTS TT_CountOfNotNullMapText(text, text, text, text, text, text, text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_CountOfNotNullMapText(text, text, text, text, text, text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_CountOfNotNullMapText(text, text, text, text, text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_CountOfNotNullMapText(text, text, text, text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_CountOfNotNullMapText(text, text, text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_CountOfNotNullMapText(text, text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_CountOfNotNullMapText(text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_CountOfNotNullMapText(text, text, text, text);
DROP FUNCTION IF EXISTS TT_CountOfNotNullMapInt(text, text, text, text, text, text, text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_CountOfNotNullMapInt(text, text, text, text, text, text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_CountOfNotNullMapInt(text, text, text, text, text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_CountOfNotNullMapInt(text, text, text, text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_CountOfNotNullMapInt(text, text, text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_CountOfNotNullMapInt(text, text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_CountOfNotNullMapInt(text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_CountOfNotNullMapInt(text, text, text, text);
DROP FUNCTION IF EXISTS TT_CountOfNotNullMapDouble(text, text, text, text, text, text, text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_CountOfNotNullMapDouble(text, text, text, text, text, text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_CountOfNotNullMapDouble(text, text, text, text, text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_CountOfNotNullMapDouble(text, text, text, text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_CountOfNotNullMapDouble(text, text, text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_CountOfNotNullMapDouble(text, text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_CountOfNotNullMapDouble(text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_CountOfNotNullMapDouble(text, text, text, text);
DROP FUNCTION IF EXISTS TT_MapTextNotNullIndex(text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_MapTextNotNullIndex(text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_MapTextNotNullIndex(text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_MapTextNotNullIndex(text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_MapTextNotNullIndex(text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_MapTextNotNullIndex(text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_MapTextNotNullIndex(text, text, text, text, text, text, text, text, text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_MapTextNotNullIndex(text, text, text, text, text, text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_MapTextNotNullIndex(text, text, text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_SubstringMultiplyInt(text, text, text, text);
DROP FUNCTION IF EXISTS TT_MultiplyInt(text, text);
DROP FUNCTION IF EXISTS TT_GetIndexCopyText(text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_GetIndexCopyText(text, text, text);
DROP FUNCTION IF EXISTS TT_GetIndexCopyInt(text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_GetIndexCopyInt(text, text, text);
DROP FUNCTION IF EXISTS TT_GetIndexMapText(text, text, text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_GetIndexMapText(text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_GetIndexMapInt(text, text, text, text, text, text, text);
DROP FUNCTION IF EXISTS TT_GetIndexMapInt(text, text, text, text, text);
-- generic and test functions
DROP FUNCTION IF EXISTS TT_ValidateParams(text, text[]);
DROP FUNCTION IF EXISTS TT_TestNullAndWrongTypeParams(int, text, text[]);
-- internal functions
DROP FUNCTION IF EXISTS TT_Min_Internal(double precision[]);
DROP FUNCTION IF EXISTS TT_Max_Internal(double precision[]);
DROP FUNCTION IF EXISTS TT_Min_Max_Indexes_Internal(double precision[], text);
DROP FUNCTION IF EXISTS TT_minIndex_getTestVal(text, text, text, text);
DROP FUNCTION IF EXISTS TT_maxIndex_getTestVal(text, text, text, text);
DROP FUNCTION IF EXISTS TT_getIndexTestVal(text, text, text, text, text);
|
-- Just detect problem with duplicate field on the screens
-- Duplicate key error in Jira server on creating issue via REST API or accessing Custom Fields page in JIRA
-- https://confluence.atlassian.com/jirakb/duplicate-key-error-in-jira-server-on-creating-issue-via-rest-api-or-accessing-custom-fields-page-in-jira-872016885.html
SELECT f.name, i.fieldidentifier, count(*)
FROM fieldscreen f, fieldscreenlayoutitem i, fieldscreentab t
WHERE f.id = t.fieldscreen
AND i.fieldscreentab = t.id
GROUP BY f.name, i.fieldidentifier
HAVING count(*) > 1;
|
#SELECT * FROM mydb.producto
#WHERE nombre LIKE '%a'
#5 productos más caros
#SELECT * FROM mydb.producto
#ORDER BY precio DESC
#LIMIT 5
#VEGATALES PRECIO ENTRE 10 y 12
#SELECT * FROM mydb.producto
#WHERE idcategoria = 2 AND precio BETWEEN 10 AND 12
#Cuanto ganaria si vendo todo el stock
SELECT SUM(precio * stock) AS total
FROM mydb.producto
|
-- =================================================
-- Autor: Stephan Endres, Diego Salas
-- Resumen: Procedimiento almacenado que imprime el mapa RISQ
-- Fecha creacion: 20/08/2013
-- Fecha modificacion:29/01/2014
-- =================================================
CREATE or REPLACE Procedure PA_print
IS
pcontinente1 varchar2(25);
pcolonia1 varchar2(25);
pid_colonia1 number;
pjugador1 varchar2(2);
pregimiento1 number;
pcomandantes1 number;
pcontinente2 varchar2(25);
pcolonia2 varchar2(25);
pid_colonia2 number;
pjugador2 varchar2(2);
pregimiento2 number;
pcomandantes2 number;
pcontinente3 varchar2(25);
pcolonia3 varchar2(25);
pid_colonia3 number;
pjugador3 varchar2(2);
pregimiento3 number;
pcomandantes3 number;
pcontinente4 varchar2(25);
pcolonia4 varchar2(25);
pid_colonia4 number;
pjugador4 varchar2(2);
pregimiento4 number;
pcomandantes4 number;
pcontinente5 varchar2(25);
pcolonia5 varchar2(25);
pid_colonia5 number;
pjugador5 varchar2(2);
pregimiento5 number;
pcomandantes5 number;
pcontinente6 varchar2(25);
pcolonia6 varchar2(25);
pjugador6 varchar2(2);
pid_colonia6 number;
pregimiento6 number;
pcomandantes6 number;
pcontinente7 varchar2(25);
pcolonia7 varchar2(25);
pid_colonia7 number;
pjugador7 varchar2(2);
pregimiento7 number;
pcomandantes7 number;
pcontinente8 varchar2(25);
pcolonia8 varchar2(25);
pid_colonia8 number;
pjugador8 varchar2(2);
pregimiento8 number;
pcomandantes8 number;
contCiclo number:=1;
pid_contiente number:=0;
BEGIN
while contCiclo<=5 loop
--id del continente ------------ 1ro!
pid_contiente:=pid_contiente+1;
--primero
select unique(con.nombre), col.nombre, substr(j.color,1,2), col.id_colonia
into pcontinente1, pcolonia1, pjugador1, pid_colonia1
from jugador j join figura f on (j.id_jugador=f.id_jugador)
join colonia col on (f.id_colonia=col.id_colonia)
join continente con on (col.id_continente=con.id_continente)
where f.id_colonia=pid_contiente;
--cant regimientos
begin
select count(f.id_figura)
into pregimiento1
from figura f
where f.id_tipo_figura = 1 and f.id_colonia=pid_contiente
group by f.id_colonia;
--se controla cuando no hay datos
exception
when no_data_found then
pregimiento1:=0;
end;
--cant comandantes
begin
select count(f.id_figura)
into pcomandantes1
from figura f
where f.id_tipo_figura = 2 and f.id_colonia=pid_contiente
group by f.id_colonia;
--se controla cuando no hay datos
exception
when no_data_found then
pcomandantes1:=0;
end;
--id del continente ------------ 2do!
pid_contiente:=pid_contiente+1;
--primero
select unique(con.nombre), col.nombre, substr(j.color,1,2), col.id_colonia
into pcontinente2, pcolonia2, pjugador2, pid_colonia2
from jugador j join figura f on (j.id_jugador=f.id_jugador)
join colonia col on (f.id_colonia=col.id_colonia)
join continente con on (col.id_continente=con.id_continente)
where f.id_colonia=pid_contiente;
--cant regimientos
begin
select count(f.id_figura)
into pregimiento2
from figura f
where f.id_tipo_figura = 1 and f.id_colonia=pid_contiente
group by f.id_colonia;
--se controla cuando no hay datos
exception
when no_data_found then
pregimiento2:=0;
end;
--cant comandantes
begin
select count(f.id_figura)
into pcomandantes2
from figura f
where f.id_tipo_figura = 2 and f.id_colonia=pid_contiente
group by f.id_colonia;
--se controla cuando no hay datos
exception
when no_data_found then
pcomandantes2:=0;
end;
--id del continente ------------ 3ro!
pid_contiente:=pid_contiente+1;
--primero
select unique(con.nombre), col.nombre, substr(j.color,1,2), col.id_colonia
into pcontinente3, pcolonia3, pjugador3, pid_colonia3
from jugador j join figura f on (j.id_jugador=f.id_jugador)
join colonia col on (f.id_colonia=col.id_colonia)
join continente con on (col.id_continente=con.id_continente)
where f.id_colonia=pid_contiente;
--cant regimientos
begin
select count(f.id_figura)
into pregimiento3
from figura f
where f.id_tipo_figura = 1 and f.id_colonia=pid_contiente
group by f.id_colonia;
--se controla cuando no hay datos
exception
when no_data_found then
pregimiento3:=0;
end;
--cant comandantes
begin
select count(f.id_figura)
into pcomandantes3
from figura f
where f.id_tipo_figura = 2 and f.id_colonia=pid_contiente
group by f.id_colonia;
--se controla cuando no hay datos
exception
when no_data_found then
pcomandantes3:=0;
end;
--id del continente ------------ 4to!
pid_contiente:=pid_contiente+1;
--primero
select unique(con.nombre), col.nombre, substr(j.color,1,2), col.id_colonia
into pcontinente4, pcolonia4, pjugador4, pid_colonia4
from jugador j join figura f on (j.id_jugador=f.id_jugador)
join colonia col on (f.id_colonia=col.id_colonia)
join continente con on (col.id_continente=con.id_continente)
where f.id_colonia=pid_contiente;
--cant regimientos
begin
select count(f.id_figura)
into pregimiento4
from figura f
where f.id_tipo_figura = 1 and f.id_colonia=pid_contiente
group by f.id_colonia;
--se controla cuando no hay datos
exception
when no_data_found then
pregimiento4:=0;
end;
--cant comandantes
begin
select count(f.id_figura)
into pcomandantes4
from figura f
where f.id_tipo_figura = 2 and f.id_colonia=pid_contiente
group by f.id_colonia;
--se controla cuando no hay datos
exception
when no_data_found then
pcomandantes4:=0;
end;
--id del continente ------------ 5to!
pid_contiente:=pid_contiente+1;
--primero
select unique(con.nombre), col.nombre, substr(j.color,1,2), col.id_colonia
into pcontinente5, pcolonia5, pjugador5, pid_colonia5
from jugador j join figura f on (j.id_jugador=f.id_jugador)
join colonia col on (f.id_colonia=col.id_colonia)
join continente con on (col.id_continente=con.id_continente)
where f.id_colonia=pid_contiente;
--cant regimientos
begin
select count(f.id_figura)
into pregimiento5
from figura f
where f.id_tipo_figura = 1 and f.id_colonia=pid_contiente
group by f.id_colonia;
--se controla cuando no hay datos
exception
when no_data_found then
pregimiento5:=0;
end;
--cant comandantes
begin
select count(f.id_figura)
into pcomandantes5
from figura f
where f.id_tipo_figura = 2 and f.id_colonia=pid_contiente
group by f.id_colonia;
--se controla cuando no hay datos
exception
when no_data_found then
pcomandantes5:=0;
end;
--id del continente ------------ 6to!
pid_contiente:=pid_contiente+1;
--primero
select unique(con.nombre), col.nombre, substr(j.color,1,2), col.id_colonia
into pcontinente6, pcolonia6, pjugador6, pid_colonia6
from jugador j join figura f on (j.id_jugador=f.id_jugador)
join colonia col on (f.id_colonia=col.id_colonia)
join continente con on (col.id_continente=con.id_continente)
where f.id_colonia=pid_contiente;
--cant regimientos
begin
select count(f.id_figura)
into pregimiento6
from figura f
where f.id_tipo_figura = 1 and f.id_colonia=pid_contiente
group by f.id_colonia;
--se controla cuando no hay datos
exception
when no_data_found then
pregimiento6:=0;
end;
--cant comandantes
begin
select count(f.id_figura)
into pcomandantes6
from figura f
where f.id_tipo_figura = 2 and f.id_colonia=pid_contiente
group by f.id_colonia;
--se controla cuando no hay datos
exception
when no_data_found then
pcomandantes6:=0;
end;
--id del continente ------------ 7mo!
pid_contiente:=pid_contiente+1;
--primero
select unique(con.nombre), col.nombre, substr(j.color,1,2), col.id_colonia
into pcontinente7, pcolonia7, pjugador7, pid_colonia7
from jugador j join figura f on (j.id_jugador=f.id_jugador)
join colonia col on (f.id_colonia=col.id_colonia)
join continente con on (col.id_continente=con.id_continente)
where f.id_colonia=pid_contiente;
--cant regimientos
begin
select count(f.id_figura)
into pregimiento7
from figura f
where f.id_tipo_figura = 1 and f.id_colonia=pid_contiente
group by f.id_colonia;
--se controla cuando no hay datos
exception
when no_data_found then
pregimiento7:=0;
end;
--cant comandantes
begin
select count(f.id_figura)
into pcomandantes7
from figura f
where f.id_tipo_figura = 2 and f.id_colonia=pid_contiente
group by f.id_colonia;
--se controla cuando no hay datos
exception
when no_data_found then
pcomandantes7:=0;
end;
--id del continente ------------ 8vo!
pid_contiente:=pid_contiente+1;
--primero
select unique(con.nombre), col.nombre, substr(j.color,1,2), col.id_colonia
into pcontinente8, pcolonia8, pjugador8, pid_colonia8
from jugador j join figura f on (j.id_jugador=f.id_jugador)
join colonia col on (f.id_colonia=col.id_colonia)
join continente con on (col.id_continente=con.id_continente)
where f.id_colonia=pid_contiente;
--cant regimientos
begin
select count(f.id_figura)
into pregimiento8
from figura f
where f.id_tipo_figura = 1 and f.id_colonia=pid_contiente
group by f.id_colonia;
--se controla cuando no hay datos
exception
when no_data_found then
pregimiento8:=0;
end;
--cant comandantes
begin
select count(f.id_figura)
into pcomandantes8
from figura f
where f.id_tipo_figura = 2 and f.id_colonia=pid_contiente
group by f.id_colonia;
--se controla cuando no hay datos
exception
when no_data_found then
pcomandantes8:=0;
end;
-- Se realiza el print
DBMS_OUTPUT.PUT_LINE(rpad('-',80,'-'));
DBMS_OUTPUT.PUT_LINE(':'||rpad(pcontinente1,9,' ')||':'||rpad(pcontinente2,9,' ')||':'||rpad(pcontinente3,9,' ')||':'||rpad(pcontinente4,9,' ')||':'||rpad(pcontinente5,9,' ')||':'||rpad(pcontinente6,9,' ')||':'||rpad(pcontinente7,9,' ')||':'||rpad(pcontinente8,9,' '));
DBMS_OUTPUT.PUT_LINE(':'||rpad(pcolonia1,9,' ')||':'||rpad(pcolonia2,9,' ')||':'||rpad(pcolonia3,9,' ')||':'||rpad(pcolonia4,9,' ')||':'||rpad(pcolonia5,9,' ')||':'||rpad(pcolonia6,9,' ')||':'||rpad(pcolonia7,9,' ')||':'||rpad(pcolonia8,9,' '));
DBMS_OUTPUT.PUT_LINE(':'||'ID_Col '||rpad(pid_colonia1,2,' ')||':'||'ID_Col '||rpad(pid_colonia2,2,' ')||':'||'ID_Col '||rpad(pid_colonia3,2,' ')||':'||'ID_Col '||rpad(pid_colonia4,2,' ')||':'||'ID_Col '||rpad(pid_colonia5,2,' ')||':'||'ID_Col '||rpad(pid_colonia6,2,' ')||':'||'ID_Col '||rpad(pid_colonia7,2,' ')||':'||'ID_Col '||rpad(pid_colonia8,2,' '));
DBMS_OUTPUT.PUT_LINE(':'||rpad(pjugador1,2,' ')||'('||lpad(pregimiento1,2,' ')||','||lpad(pcomandantes1,2,' ')||')'||':'||rpad(pjugador2,2,' ')||'('||lpad(pregimiento2,2,' ')||','||lpad(pcomandantes2,2,' ')||')'||':'||rpad(pjugador3,2,' ')||'('||lpad(pregimiento3,2,' ')||','||lpad(pcomandantes3,2,' ')||')'||':'||rpad(pjugador4,2,' ')||'('||lpad(pregimiento4,2,' ')||','||lpad(pcomandantes4,2,' ')||')'||':'||rpad(pjugador5,2,' ')||'('||lpad(pregimiento5,2,' ')||','||lpad(pcomandantes5,2,' ')||')'||':'||rpad(pjugador6,2,' ')||'('||lpad(pregimiento6,2,' ')||','||lpad(pcomandantes6,2,' ')||')'||':'||rpad(pjugador7,2,' ')||'('||lpad(pregimiento7,2,' ')||','||lpad(pcomandantes7,2,' ')||')'||':'||rpad(pjugador8,2,' ')||'('||lpad(pregimiento8,2,' ')||','||lpad(pcomandantes8,2,' ')||')');
DBMS_OUTPUT.PUT_LINE(rpad('-',80,'-'));
contCiclo:=contCiclo+1;
end loop;
END;
/
|
-- 1303. 求团队人数
-- 员工表:Employee
--
-- +---------------+---------+
-- | Column Name | Type |
-- +---------------+---------+
-- | employee_id | int |
-- | team_id | int |
-- +---------------+---------+
-- employee_id 字段是这张表的主键,表中的每一行都包含每个员工的 ID 和他们所属的团队。
-- 编写一个 SQL 查询,以求得每个员工所在团队的总人数。
--
-- 查询结果中的顺序无特定要求。
--
-- 查询结果格式示例如下:
--
-- Employee Table:
-- +-------------+------------+
-- | employee_id | team_id |
-- +-------------+------------+
-- | 1 | 8 |
-- | 2 | 8 |
-- | 3 | 8 |
-- | 4 | 7 |
-- | 5 | 9 |
-- | 6 | 9 |
-- +-------------+------------+
-- Result table:
-- +-------------+------------+
-- | employee_id | team_size |
-- +-------------+------------+
-- | 1 | 3 |
-- | 2 | 3 |
-- | 3 | 3 |
-- | 4 | 1 |
-- | 5 | 2 |
-- | 6 | 2 |
-- +-------------+------------+
-- ID 为 1、2、3 的员工是 team_id 为 8 的团队的成员,
-- ID 为 4 的员工是 team_id 为 7 的团队的成员,
-- ID 为 5、6 的员工是 team_id 为 9 的团队的成员。
--
-- 来源:力扣(LeetCode)
-- 链接:https://leetcode-cn.com/problems/find-the-team-size
-- 著作权归领扣网络所有。商业转载请联系官方授权,非商业转载请注明出处。
SELECT
e1.employee_id,
( SELECT count( * ) FROM Employee AS e2 WHERE e2.team_id = e1.team_id ) AS team_size
FROM
Employee AS e1; |
USE `arenafifadb`;
DELIMITER $$
DROP PROCEDURE IF EXISTS `spCreateTablesTempAutomaticDraw` $$
CREATE PROCEDURE `spCreateTablesTempAutomaticDraw`()
Begin
DROP TABLE IF EXISTS `TB_AUTOMATIC_DRAW_TB_USUARIO_TEMP`;
DROP TABLE IF EXISTS `TB_AUTOMATIC_DRAW_TB_TIME_TEMP`;
CREATE TABLE `TB_AUTOMATIC_DRAW_TB_USUARIO_TEMP` (
`ID_USUARIO` INTEGER NOT NULL DEFAULT 0,
`NM_USUARIO` VARCHAR(50) NOT NULL,
`PSN_ID` VARCHAR(30) NOT NULL,
`ID_DRAW` INTEGER NOT NULL DEFAULT 0,
INDEX (`ID_DRAW`),
PRIMARY KEY (`ID_USUARIO`)
) ENGINE=myisam DEFAULT CHARSET=utf8;
CREATE TABLE `TB_AUTOMATIC_DRAW_TB_TIME_TEMP` (
`ID_TIME` INTEGER NOT NULL DEFAULT 0,
`NM_TIME` VARCHAR(50) NOT NULL,
`ID_DRAW` INTEGER NOT NULL DEFAULT 0,
`IN_POTE_GRUPO` INTEGER NULL DEFAULT NULL,
INDEX (`ID_DRAW`, `IN_POTE_GRUPO`),
PRIMARY KEY (`ID_TIME`)
) ENGINE=myisam DEFAULT CHARSET=utf8;
#SELECT X.* FROM (select id_time, (1 + FLOOR(RAND() * (20 - 1 + 1))) as DRAWRAND from tb_campeonato_time where id_campeonato = 198) X
#ORDER BY X.DRAWRAND;
End$$
DELIMITER ;
DELIMITER $$
DROP PROCEDURE IF EXISTS `spAddRecordsTableTeam` $$
CREATE PROCEDURE `spAddRecordsTableTeam`()
Begin
DROP TABLE IF EXISTS `TB_TABLETEAM_PROVISION`;
DROP TABLE IF EXISTS `TB_TABLETEAM_PROVISION_ONLINE`;
CREATE TABLE `TB_TABLETEAM_PROVISION` (
`IN_TABELA_GRUPO` INTEGER NOT NULL DEFAULT 0,
`ID_TIPO_TABELA` INTEGER NOT NULL DEFAULT 0,
`NU_TIME_HOME` INTEGER NOT NULL DEFAULT 0,
`NU_TIME_AWAY` INTEGER NOT NULL DEFAULT 0,
`NU_RODADA` INTEGER NOT NULL DEFAULT 0,
INDEX (`NU_TIME_HOME`),
INDEX (`NU_TIME_AWAY`),
PRIMARY KEY (`IN_TABELA_GRUPO`, `ID_TIPO_TABELA`, `NU_TIME_HOME`, `NU_TIME_AWAY`, `NU_RODADA`)
);
CREATE TABLE `TB_TABLETEAM_PROVISION_ONLINE` (
`IN_TABELA_GRUPO` INTEGER NOT NULL DEFAULT 0,
`ID_TIPO_TABELA` INTEGER NOT NULL DEFAULT 0,
`NU_TIME_HOME` INTEGER NOT NULL DEFAULT 0,
`NU_TIME_AWAY` INTEGER NOT NULL DEFAULT 0,
`NU_RODADA` INTEGER NOT NULL DEFAULT 0,
`ID_DRAW_HOME` INTEGER NOT NULL DEFAULT 0,
`ID_DRAW_AWAY` INTEGER NOT NULL DEFAULT 0,
INDEX (`ID_DRAW_HOME`),
INDEX (`ID_DRAW_AWAY`),
INDEX (`NU_RODADA`),
INDEX (`IN_TABELA_GRUPO`, `ID_TIPO_TABELA`),
PRIMARY KEY (`IN_TABELA_GRUPO`, `ID_TIPO_TABELA`, `NU_TIME_HOME`, `NU_TIME_AWAY`, `NU_RODADA`)
);
#Tabela de Grupos - 4 TIMES POR GRUPO
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (1,1,2,1,4);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (1,3,4,1,4);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (2,1,3,1,4);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (2,4,2,1,4);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (3,2,3,1,4);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (3,4,1,1,4);
#Tabela de Grupos - 5 TIMES POR GRUPO
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (1,1,4,1,5);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (1,5,3,1,5);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (2,4,2,1,5);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (2,3,1,1,5);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (3,2,5,1,5);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (3,3,4,1,5);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (4,1,2,1,5);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (4,4,5,1,5);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (5,5,1,1,5);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (5,2,3,1,5);
#Tabela de Grupos - 6 TIMES POR GRUPO
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (1,1,4,1,6);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (1,5,3,1,6);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (1,2,6,1,6);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (2,4,2,1,6);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (2,3,1,1,6);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (2,6,5,1,6);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (3,2,5,1,6);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (3,3,4,1,6);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (3,6,1,1,6);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (4,1,2,1,6);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (4,4,5,1,6);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (4,3,6,1,6);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (5,5,1,1,6);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (5,2,3,1,6);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (5,6,4,1,6);
#Tabela de Grupos - 8 TIMES POR GRUPO
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (1,1,2,1,8);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (1,3,4,1,8);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (1,5,6,1,8);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (1,7,8,1,8);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (2,2,5,1,8);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (2,6,1,1,8);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (2,4,7,1,8);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (2,8,3,1,8);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (3,2,4,1,8);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (3,6,8,1,8);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (3,5,7,1,8);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (3,1,3,1,8);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (4,7,1,1,8);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (4,8,2,1,8);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (4,4,6,1,8);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (4,3,5,1,8);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (5,2,7,1,8);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (5,1,4,1,8);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (5,5,8,1,8);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (5,3,6,1,8);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (6,1,5,1,8);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (6,4,8,1,8);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (6,6,2,1,8);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (6,3,7,1,8);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (7,5,4,1,8);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (7,8,1,1,8);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (7,2,3,1,8);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (7,7,6,1,8);
#Tabela de Grupos - 10 TIMES POR GRUPO
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (1,1,2,1,10);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (1,3,4,1,10);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (1,5,6,1,10);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (1,7,8,1,10);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (1,9,10,1,10);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (2,3,9,1,10);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (2,2,7,1,10);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (2,4,10,1,10);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (2,5,8,1,10);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (2,6,1,1,10);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (3,8,3,1,10);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (3,10,7,1,10);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (3,1,5,1,10);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (3,4,6,1,10);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (3,9,2,1,10);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (4,8,1,1,10);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (4,6,2,1,10);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (4,5,10,1,10);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (4,7,3,1,10);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (4,4,9,1,10);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (5,2,8,1,10);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (5,9,5,1,10);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (5,3,1,1,10);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (5,7,4,1,10);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (5,10,6,1,10);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (6,1,4,1,10);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (6,8,6,1,10);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (6,9,7,1,10);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (6,2,5,1,10);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (6,10,3,1,10);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (7,2,4,1,10);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (7,7,1,1,10);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (7,3,5,1,10);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (7,8,10,1,10);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (7,6,9,1,10);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (8,1,9,1,10);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (8,4,8,1,10);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (8,6,3,1,10);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (8,5,7,1,10);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (8,10,2,1,10);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (9,3,2,1,10);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (9,7,6,1,10);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (9,4,5,1,10);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (9,10,1,1,10);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (9,9,8,1,10);
#Tabela de Grupos - 10 pontos corridos
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (1,1,2,0,10);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (1,3,4,0,10);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (1,5,6,0,10);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (1,7,8,0,10);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (1,9,10,0,10);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (2,3,9,0,10);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (2,2,7,0,10);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (2,4,10,0,10);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (2,5,8,0,10);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (2,6,1,0,10);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (3,8,3,0,10);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (3,10,7,0,10);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (3,1,5,0,10);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (3,4,6,0,10);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (3,9,2,0,10);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (4,8,1,0,10);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (4,6,2,0,10);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (4,5,10,0,10);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (4,7,3,0,10);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (4,4,9,0,10);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (5,2,8,0,10);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (5,9,5,0,10);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (5,3,1,0,10);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (5,7,4,0,10);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (5,10,6,0,10);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (6,1,4,0,10);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (6,8,6,0,10);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (6,9,7,0,10);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (6,2,5,0,10);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (6,10,3,0,10);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (7,2,4,0,10);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (7,7,1,0,10);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (7,3,5,0,10);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (7,8,10,0,10);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (7,6,9,0,10);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (8,1,9,0,10);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (8,4,8,0,10);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (8,6,3,0,10);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (8,5,7,0,10);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (8,10,2,0,10);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (9,3,2,0,10);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (9,7,6,0,10);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (9,4,5,0,10);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (9,10,1,0,10);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (9,9,8,0,10);
#Tabela de 12 times - pontos corridos
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (1,1,2,0,12);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (1,3,4,0,12);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (1,5,6,0,12);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (1,7,8,0,12);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (1,9,10,0,12);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (1,11,12,0,12);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (2,12,3,0,12);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (2,6,9,0,12);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (2,10,11,0,12);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (2,8,1,0,12);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (2,2,5,0,12);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (2,4,7,0,12);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (3,3,8,0,12);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (3,7,6,0,12);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (3,5,10,0,12);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (3,11,2,0,12);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (3,9,4,0,12);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (3,1,12,0,12);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (4,12,9,0,12);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (4,2,3,0,12);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (4,4,1,0,12);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (4,8,5,0,12);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (4,6,11,0,12);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (4,10,7,0,12);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (5,7,11,0,12);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (5,8,9,0,12);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (5,1,6,0,12);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (5,3,10,0,12);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (5,2,4,0,12);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (5,5,12,0,12);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (6,12,4,0,12);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (6,11,3,0,12);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (6,10,8,0,12);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (6,6,2,0,12);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (6,5,1,0,12);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (6,9,7,0,12);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (7,7,1,0,12);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (7,4,10,0,12);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (7,8,11,0,12);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (7,2,9,0,12);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (7,6,12,0,12);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (7,3,5,0,12);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (8,7,12,0,12);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (8,1,10,0,12);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (8,3,6,0,12);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (8,4,5,0,12);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (8,11,9,0,12);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (8,2,8,0,12);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (9,12,2,0,12);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (9,10,6,0,12);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (9,5,11,0,12);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (9,9,1,0,12);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (9,3,7,0,12);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (9,4,8,0,12);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (10,10,2,0,12);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (10,8,12,0,12);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (10,7,5,0,12);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (10,6,4,0,12);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (10,9,3,0,12);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (10,1,11,0,12);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (11,6,8,0,12);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (11,5,9,0,12);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (11,11,4,0,12);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (11,1,3,0,12);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (11,12,10,0,12);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (11,2,7,0,12);
#Tabela de 14 times - pontos corridos
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (1,14,6,0,14);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (1,11,8,0,14);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (1,13,12,0,14);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (1,1,7,0,14);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (1,4,3,0,14);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (1,9,2,0,14);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (1,10,5,0,14);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (2,11,14,0,14);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (2,12,6,0,14);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (2,8,1,0,14);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (2,3,13,0,14);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (2,7,9,0,14);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (2,5,4,0,14);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (2,2,10,0,14);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (3,14,12,0,14);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (3,1,11,0,14);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (3,6,3,0,14);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (3,9,8,0,14);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (3,13,5,0,14);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (3,10,7,0,14);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (3,4,2,0,14);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (4,1,14,0,14);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (4,3,12,0,14);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (4,11,9,0,14);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (4,5,6,0,14);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (4,8,10,0,14);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (4,2,13,0,14);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (4,7,4,0,14);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (5,14,3,0,14);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (5,9,1,0,14);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (5,12,5,0,14);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (5,10,11,0,14);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (5,6,2,0,14);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (5,4,8,0,14);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (5,13,7,0,14);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (6,9,14,0,14);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (6,5,3,0,14);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (6,1,10,0,14);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (6,2,12,0,14);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (6,11,4,0,14);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (6,7,6,0,14);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (6,8,13,0,14);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (7,14,5,0,14);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (7,10,9,0,14);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (7,3,2,0,14);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (7,4,1,0,14);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (7,12,7,0,14);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (7,13,11,0,14);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (7,6,8,0,14);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (8,10,14,0,14);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (8,2,5,0,14);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (8,9,4,0,14);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (8,7,3,0,14);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (8,1,13,0,14);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (8,8,12,0,14);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (8,11,6,0,14);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (9,14,2,0,14);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (9,4,10,0,14);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (9,5,7,0,14);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (9,13,9,0,14);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (9,3,8,0,14);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (9,6,1,0,14);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (9,12,11,0,14);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (10,4,14,0,14);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (10,7,2,0,14);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (10,10,13,0,14);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (10,8,5,0,14);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (10,9,6,0,14);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (10,11,3,0,14);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (10,1,12,0,14);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (11,14,7,0,14);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (11,13,4,0,14);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (11,2,8,0,14);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (11,6,10,0,14);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (11,5,11,0,14);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (11,12,9,0,14);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (11,3,1,0,14);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (12,13,14,0,14);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (12,8,7,0,14);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (12,4,6,0,14);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (12,11,2,0,14);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (12,10,12,0,14);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (12,1,5,0,14);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (12,9,3,0,14);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (13,14,8,0,14);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (13,6,13,0,14);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (13,7,11,0,14);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (13,12,4,0,14);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (13,2,1,0,14);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (13,3,10,0,14);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (13,5,9,0,14);
#Tabela de 16 times - pontos corridos
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (1,16,4,0,16);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (1,2,8,0,16);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (1,7,11,0,16);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (1,6,10,0,16);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (1,12,9,0,16);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (1,5,1,0,16);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (1,3,13,0,16);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (1,14,15,0,16);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (2,15,2,0,16);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (2,13,6,0,16);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (2,4,3,0,16);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (2,11,14,0,16);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (2,1,8,0,16);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (2,10,12,0,16);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (2,9,7,0,16);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (2,5,16,0,16);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (3,3,5,0,16);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (3,14,9,0,16);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (3,16,1,0,16);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (3,8,15,0,16);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (3,2,11,0,16);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (3,7,10,0,16);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (3,6,4,0,16);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (3,12,13,0,16);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (4,13,7,0,16);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (4,10,14,0,16);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (4,9,2,0,16);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (4,4,12,0,16);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (4,5,6,0,16);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (4,16,3,0,16);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (4,1,15,0,16);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (4,11,8,0,16);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (5,8,9,0,16);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (5,15,11,0,16);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (5,12,5,0,16);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (5,6,16,0,16);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (5,7,4,0,16);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (5,14,13,0,16);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (5,2,10,0,16);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (5,3,1,0,16);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (6,1,11,0,16);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (6,16,12,0,16);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (6,10,8,0,16);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (6,5,7,0,16);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (6,13,2,0,16);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (6,9,15,0,16);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (6,3,6,0,16);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (6,4,14,0,16);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (7,15,10,0,16);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (7,2,4,0,16);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (7,8,13,0,16);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (7,11,9,0,16);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (7,12,3,0,16);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (7,6,1,0,16);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (7,14,5,0,16);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (7,7,16,0,16);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (8,6,12,0,16);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (8,3,7,0,16);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (8,16,14,0,16);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (8,5,2,0,16);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (8,13,15,0,16);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (8,4,8,0,16);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (8,10,11,0,16);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (8,1,9,0,16);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (9,14,3,0,16);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (9,11,13,0,16);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (9,7,6,0,16);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (9,12,1,0,16);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (9,15,4,0,16);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (9,2,16,0,16);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (9,8,5,0,16);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (9,9,10,0,16);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (10,13,9,0,16);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (10,5,15,0,16);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (10,1,10,0,16);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (10,12,7,0,16);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (10,6,14,0,16);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (10,4,11,0,16);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (10,16,8,0,16);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (10,3,2,0,16);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (11,14,12,0,16);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (11,7,1,0,16);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (11,9,4,0,16);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (11,10,13,0,16);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (11,8,3,0,16);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (11,11,5,0,16);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (11,15,16,0,16);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (11,2,6,0,16);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (12,6,8,0,16);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (12,4,10,0,16);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (12,1,13,0,16);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (12,7,14,0,16);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (12,16,11,0,16);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (12,5,9,0,16);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (12,12,2,0,16);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (12,3,15,0,16);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (13,13,4,0,16);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (13,14,1,0,16);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (13,15,6,0,16);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (13,11,3,0,16);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (13,10,5,0,16);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (13,9,16,0,16);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (13,2,7,0,16);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (13,8,12,0,16);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (14,16,10,0,16);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (14,6,11,0,16);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (14,7,8,0,16);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (14,1,4,0,16);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (14,14,2,0,16);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (14,12,15,0,16);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (14,3,9,0,16);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (14,5,13,0,16);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (15,2,1,0,16);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (15,8,14,0,16);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (15,15,7,0,16);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (15,11,12,0,16);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (15,9,6,0,16);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (15,10,3,0,16);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (15,13,16,0,16);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (15,4,5,0,16);
#Tabela de 18 times - pontos corridos
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (1,4,11,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (1,7,9,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (1,16,10,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (1,6,18,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (1,8,13,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (1,12,15,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (1,17,14,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (1,3,2,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (1,5,1,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (2,14,1,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (2,15,5,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (2,2,4,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (2,13,3,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (2,18,17,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (2,10,12,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (2,9,8,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (2,11,6,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (2,7,16,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (3,15,2,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (3,13,1,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (3,18,5,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (3,4,14,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (3,10,3,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (3,9,17,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (3,11,12,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (3,7,8,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (3,16,6,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (4,6,7,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (4,4,16,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (4,8,11,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (4,12,9,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (4,17,10,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (4,3,18,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (4,5,13,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (4,1,15,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (4,2,14,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (5,10,13,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (5,9,15,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (5,11,14,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (5,7,2,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (5,16,1,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (5,6,5,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (5,8,3,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (5,12,17,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (5,18,4,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (6,13,14,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (6,18,2,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (6,10,1,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (6,9,5,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (6,11,3,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (6,7,17,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (6,15,4,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (6,16,12,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (6,6,8,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (7,4,3,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (7,5,17,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (7,1,12,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (7,2,8,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (7,14,6,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (7,15,16,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (7,13,7,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (7,18,11,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (7,10,9,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (8,16,11,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (8,6,9,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (8,8,10,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (8,12,18,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (8,17,13,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (8,3,15,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (8,5,14,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (8,7,4,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (8,1,2,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (9,12,6,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (9,17,16,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (9,4,8,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (9,3,7,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (9,5,11,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (9,1,9,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (9,2,10,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (9,14,18,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (9,15,13,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (10,4,10,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (10,9,18,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (10,11,13,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (10,7,15,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (10,16,14,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (10,6,2,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (10,8,1,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (10,12,5,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (10,17,3,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (11,18,15,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (11,10,14,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (11,9,2,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (11,11,1,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (11,7,5,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (11,16,3,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (11,6,17,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (11,4,13,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (11,8,12,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (12,11,10,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (12,7,18,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (12,16,13,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (12,6,15,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (12,8,14,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (12,12,2,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (12,17,1,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (12,3,5,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (12,9,4,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (13,17,8,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (13,3,6,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (13,5,16,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (13,1,7,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (13,2,11,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (13,14,9,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (13,12,4,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (13,15,10,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (13,13,18,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (14,6,4,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (14,8,16,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (14,12,7,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (14,17,11,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (14,3,9,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (14,5,10,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (14,1,18,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (14,2,13,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (14,14,15,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (15,1,3,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (15,5,4,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (15,2,17,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (15,14,12,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (15,15,8,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (15,13,6,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (15,18,16,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (15,10,7,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (15,9,11,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (16,2,5,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (16,14,3,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (16,15,17,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (16,13,12,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (16,4,1,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (16,18,8,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (16,10,6,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (16,9,16,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (16,11,7,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (17,3,12,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (17,5,8,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (17,1,6,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (17,2,16,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (17,14,7,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (17,15,11,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (17,13,9,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (17,17,4,0,18);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (17,18,10,0,18);
#Tabela de 20 times - pontos corridos
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (1,1,2,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (1,3,4,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (1,5,6,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (1,7,8,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (1,9,10,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (1,11,12,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (1,13,14,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (1,15,16,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (1,17,18,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (1,19,20,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (2,6,11,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (2,14,15,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (2,16,19,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (2,4,7,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (2,12,17,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (2,18,5,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (2,10,13,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (2,8,9,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (2,2,3,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (2,20,1,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (3,14,10,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (3,12,4,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (3,13,9,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (3,5,1,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (3,7,18,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (3,19,15,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (3,17,3,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (3,6,20,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (3,16,8,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (3,11,2,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (4,17,13,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (4,18,10,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (4,16,2,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (4,15,5,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (4,1,19,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (4,20,7,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (4,9,4,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (4,3,12,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (4,11,14,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (4,8,6,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (5,2,12,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (5,5,9,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (5,4,20,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (5,13,16,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (5,18,1,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (5,3,11,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (5,7,19,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (5,15,17,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (5,10,6,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (5,8,14,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (6,6,16,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (6,18,11,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (6,10,8,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (6,9,1,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (6,5,2,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (6,12,15,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (6,19,3,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (6,14,7,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (6,13,4,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (6,17,20,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (7,10,7,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (7,20,15,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (7,11,5,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (7,12,9,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (7,2,14,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (7,4,8,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (7,3,13,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (7,1,17,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (7,16,18,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (7,6,19,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (8,8,3,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (8,7,16,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (8,12,20,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (8,1,11,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (8,5,13,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (8,2,4,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (8,18,14,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (8,15,10,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (8,19,17,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (8,9,6,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (9,9,7,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (9,16,5,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (9,14,12,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (9,10,2,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (9,4,19,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (9,11,20,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (9,13,1,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (9,6,18,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (9,17,8,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (9,15,3,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (10,11,13,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (10,14,1,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (10,18,12,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (10,8,15,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (10,3,6,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (10,20,2,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (10,17,16,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (10,19,9,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (10,4,10,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (10,5,7,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (11,5,8,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (11,2,18,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (11,15,13,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (11,7,17,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (11,1,4,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (11,9,3,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (11,10,11,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (11,12,19,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (11,16,20,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (11,6,14,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (12,4,11,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (12,17,10,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (12,3,1,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (12,15,9,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (12,19,5,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (12,16,12,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (12,14,20,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (12,2,6,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (12,13,7,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (12,8,18,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (13,7,3,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (13,10,16,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (13,9,17,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (13,11,19,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (13,8,2,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (13,14,4,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (13,5,12,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (13,13,6,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (13,1,15,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (13,20,18,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (14,12,8,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (14,4,5,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (14,3,10,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (14,2,19,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (14,18,9,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (14,17,11,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (14,20,13,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (14,6,1,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (14,7,15,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (14,16,14,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (15,18,4,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (15,6,12,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (15,8,13,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (15,10,20,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (15,19,14,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (15,9,11,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (15,17,5,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (15,3,16,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (15,1,7,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (15,15,2,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (16,14,17,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (16,20,8,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (16,2,7,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (16,13,18,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (16,10,19,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (16,4,6,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (16,5,3,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (16,11,15,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (16,16,9,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (16,1,12,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (17,18,3,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (17,2,17,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (17,4,16,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (17,12,10,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (17,6,15,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (17,14,9,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (17,7,11,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (17,8,1,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (17,20,5,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (17,19,13,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (18,17,6,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (18,7,12,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (18,19,18,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (18,1,16,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (18,3,14,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (18,9,20,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (18,13,2,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (18,11,8,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (18,15,4,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (18,5,10,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (19,20,3,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (19,18,15,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (19,8,19,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (19,12,13,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (19,2,9,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (19,14,5,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (19,16,11,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (19,4,17,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (19,6,7,0,20);
INSERT INTO TB_TABLETEAM_PROVISION (NU_RODADA, NU_TIME_HOME, NU_TIME_AWAY, IN_TABELA_GRUPO, ID_TIPO_TABELA) VALUES (19,10,1,0,20);
End$$
DELIMITER ;
DELIMITER $$
DROP PROCEDURE IF EXISTS `spAutomaticDrawOfTimes` $$
CREATE PROCEDURE `spAutomaticDrawOfTimes`(pIdCamp INTEGER)
begin
DECLARE _msgRetorno VARCHAR(250) DEFAULT "";
DECLARE _totTimes INTEGER DEFAULT 0;
DECLARE _totTecnicos INTEGER DEFAULT 0;
DECLARE _count INTEGER DEFAULT 0;
DECLARE _qtTimes INTEGER DEFAULT 0;
SELECT count(1) into _totTimes FROM TB_CAMPEONATO_TIME C WHERE C.ID_CAMPEONATO = pIdCamp;
SELECT count(1) into _totTecnicos FROM TB_CAMPEONATO_USUARIO C WHERE C.ID_CAMPEONATO = pIdCamp;
call `arenafifadb`.`spCreateTablesTempAutomaticDraw`();
IF _totTimes = _totTecnicos THEN
SELECT count(1) into _count FROM TB_USUARIO_TIME C WHERE C.ID_CAMPEONATO = pIdCamp;
IF _count = 0 THEN
call `arenafifadb`.`spGenerateRecordsDrawOfTimes`(pIdCamp);
call `arenafifadb`.`spGenerateRecordsDrawOfTecnicos`(pIdCamp);
SELECT C.QT_TIMES into _qtTimes FROM TB_CAMPEONATO C WHERE C.ID_CAMPEONATO = pIdCamp;
call `arenafifadb`.`spGenerateAutomaticDrawOfTimes`(_qtTimes);
call `arenafifadb`.`spGenerateAutomaticDrawOfTecnicos`(_qtTimes);
call `arenafifadb`.`spGenerateDrawFinalOfTimesAndTecnicos`(pIdCamp);
ELSE
SET _msgRetorno = "ATENÇÃO, Sorteio já foi efetuado. Favor realizar o cancelamento e sortear novamente.";
END IF;
ELSE
SET _msgRetorno = "ATENÇÃO, Sorteio não efetuado. A quantidade de Times não é igual a quantidade de Técnicos selecionados para o campeonato.";
END IF;
SELECT _msgRetorno as msgRetornoSorteioAutomaticoTimes;
End$$
DELIMITER ;
DELIMITER $$
DROP PROCEDURE IF EXISTS `spAssumeDrawOfTimesByDrawLeague` $$
CREATE PROCEDURE `spAssumeDrawOfTimesByDrawLeague`(pIdCamp INTEGER)
begin
DECLARE _finished INTEGER DEFAULT 0;
DECLARE _msgRetorno VARCHAR(250) DEFAULT "";
DECLARE _totTimes INTEGER DEFAULT 0;
DECLARE _totTecnicos INTEGER DEFAULT 0;
DECLARE _count INTEGER DEFAULT 0;
DECLARE _qtTimes INTEGER DEFAULT 0;
DECLARE _qtGrupos INTEGER DEFAULT 0;
DECLARE _idUsu INTEGER DEFAULT 0;
DECLARE _idTime INTEGER DEFAULT 0;
DECLARE _tipoCamp VARCHAR(4) DEFAULT "";
DECLARE _tipoCampLiga VARCHAR(30) DEFAULT "";
DECLARE tabela_cursor CURSOR FOR
SELECT ID_USUARIO FROM TB_CAMPEONATO_USUARIO WHERE ID_CAMPEONATO = pIdCamp ORDER BY ID_USUARIO;
DECLARE CONTINUE HANDLER FOR NOT FOUND SET _finished = 1;
SELECT count(1) into _totTimes FROM TB_CAMPEONATO_TIME C WHERE C.ID_CAMPEONATO = pIdCamp;
SELECT count(1) into _totTecnicos FROM TB_CAMPEONATO_USUARIO C WHERE C.ID_CAMPEONATO = pIdCamp;
IF _totTimes = _totTecnicos THEN
SELECT count(1) into _count FROM TB_USUARIO_TIME C WHERE ID_CAMPEONATO = pIdCamp;
IF _count = 0 THEN
SELECT SG_TIPO_CAMPEONATO, QT_GRUPOS into _tipoCamp, _qtGrupos FROM TB_CAMPEONATO WHERE ID_CAMPEONATO = pIdCamp;
IF (_tipoCamp = "CPGL" AND _qtGrupos = 0) OR _tipoCamp = "MDCL" THEN
SET _tipoCampLiga = "DIV1, DIV2, DIV3";
ELSEIF _tipoCamp = "CPGL" AND _qtGrupos > 0 THEN
SET _tipoCampLiga = "DIV1, DIV2";
ELSEIF _tipoCamp = "CPSA" THEN
SET _tipoCampLiga = "DIV3";
END IF;
OPEN tabela_cursor;
get_tabela: LOOP
FETCH tabela_cursor INTO _idUsu;
IF _finished = 1 THEN
LEAVE get_tabela;
END IF;
SELECT T.ID_TIME into _idTime FROM TB_USUARIO_TIME T, TB_CAMPEONATO C
WHERE C.ID_TEMPORADA = fcGetIdTempCurrent()
AND FIND_IN_SET(C.SG_TIPO_CAMPEONATO,_tipoCampLiga)
AND C.IN_CAMPEONATO_ATIVO = True
AND T.ID_USUARIO = _idUsu
AND T.DT_VIGENCIA_FIM IS NULL
AND T.ID_CAMPEONATO = C.ID_CAMPEONATO
LIMIT 1;
IF _idTime IS NOT NULL THEN
IF _idTime > 0 THEN
call `arenafifadb`.`spAddUsuarioTimev2`(pIdCamp, _idUsu, _idTime, _count);
END IF;
END IF;
SET _count = _count + 1;
END LOOP get_tabela;
CLOSE tabela_cursor;
ELSE
SET _msgRetorno = "ATENÇÃO, Sorteio já foi efetuado. Favor realizar o cancelamento e sortear novamente.";
END IF;
ELSE
SET _msgRetorno = "ATENÇÃO, Sorteio não efetuado. A quantidade de Times não é igual a quantidade de Técnicos selecionados para o campeonato.";
END IF;
SELECT _msgRetorno as msgRetornoSorteioAssumirTimesLiga;
End$$
DELIMITER ;
DELIMITER $$
DROP PROCEDURE IF EXISTS `spGenerateDrawFinalOfTimesAndTecnicos` $$
CREATE PROCEDURE `spGenerateDrawFinalOfTimesAndTecnicos`(pIdCamp INTEGER)
begin
DECLARE _finished INTEGER DEFAULT 0;
DECLARE _idTime INTEGER DEFAULT 0;
DECLARE _idUsu INTEGER DEFAULT 0;
DECLARE _idDraw INTEGER DEFAULT 0;
DECLARE tabela_cursor CURSOR FOR
SELECT T.ID_Time, U.ID_USUARIO, T.ID_DRAW FROM TB_AUTOMATIC_DRAW_TB_TIME_TEMP T, TB_AUTOMATIC_DRAW_TB_USUARIO_TEMP U
WHERE T.ID_DRAW = U.ID_DRAW ORDER BY T.ID_DRAW;
DECLARE CONTINUE HANDLER FOR NOT FOUND SET _finished = 1;
OPEN tabela_cursor;
get_tabela: LOOP
FETCH tabela_cursor INTO _idTime, _idUsu, _idDraw;
IF _finished = 1 THEN
LEAVE get_tabela;
END IF;
call `arenafifadb`.`spAddUsuarioTimev2`(pIdCamp, _idUsu, _idTime, _idDraw);
END LOOP get_tabela;
CLOSE tabela_cursor;
End$$
DELIMITER ;
DELIMITER $$
DROP PROCEDURE IF EXISTS `spGenerateRecordsDrawOfTimes` $$
CREATE PROCEDURE `spGenerateRecordsDrawOfTimes`(pIdCamp INTEGER)
begin
DECLARE _finished INTEGER DEFAULT 0;
DECLARE _idTime INTEGER DEFAULT 0;
DECLARE _nmTime VARCHAR(50) DEFAULT "";
DECLARE tabela_cursor CURSOR FOR
SELECT C.ID_Time, T.NM_TIME FROM TB_CAMPEONATO_TIME C, TB_TIME T WHERE C.ID_TIME = T.ID_TIME AND C.ID_CAMPEONATO = pIdCamp ORDER BY T.NM_Time;
DECLARE CONTINUE HANDLER FOR NOT FOUND SET _finished = 1;
OPEN tabela_cursor;
get_tabela: LOOP
FETCH tabela_cursor INTO _idTime, _nmTime;
IF _finished = 1 THEN
LEAVE get_tabela;
END IF;
INSERT INTO TB_AUTOMATIC_DRAW_TB_TIME_TEMP (ID_TIME, NM_TIME, ID_DRAW)
VALUES (_idTime, _nmTime, 0);
END LOOP get_tabela;
CLOSE tabela_cursor;
End$$
DELIMITER ;
DELIMITER $$
DROP PROCEDURE IF EXISTS `spGenerateRecordsDrawOfTecnicos` $$
CREATE PROCEDURE `spGenerateRecordsDrawOfTecnicos`(pIdCamp INTEGER)
begin
DECLARE _finished INTEGER DEFAULT 0;
DECLARE _idTecnico INTEGER DEFAULT 0;
DECLARE _nmTecnico VARCHAR(50) DEFAULT "";
DECLARE _psnID VARCHAR(30) DEFAULT "";
DECLARE tabela_cursor CURSOR FOR
SELECT C.ID_Usuario, U.NM_USUARIO, U.PSN_ID FROM TB_CAMPEONATO_USUARIO C, TB_USUARIO U WHERE C.ID_USUARIO = U.ID_USUARIO AND C.ID_CAMPEONATO = pIdCamp ORDER BY U.NM_Usuario;
DECLARE CONTINUE HANDLER FOR NOT FOUND SET _finished = 1;
OPEN tabela_cursor;
get_tabela: LOOP
FETCH tabela_cursor INTO _idTecnico, _nmTecnico, _psnID;
IF _finished = 1 THEN
LEAVE get_tabela;
END IF;
INSERT INTO TB_AUTOMATIC_DRAW_TB_USUARIO_TEMP (ID_USUARIO, NM_USUARIO, PSN_ID, ID_DRAW)
VALUES (_idTecnico, _nmTecnico, _psnID, 0);
END LOOP get_tabela;
CLOSE tabela_cursor;
End$$
DELIMITER ;
DELIMITER $$
DROP PROCEDURE IF EXISTS `spGenerateAutomaticDrawOfTimes` $$
CREATE PROCEDURE `spGenerateAutomaticDrawOfTimes`(pQtMaxTimes INTEGER)
begin
DECLARE _finished INTEGER DEFAULT 0;
DECLARE _inIdDrawExist INTEGER DEFAULT 0;
DECLARE _idDraw INTEGER DEFAULT 0;
DECLARE _idTime INTEGER DEFAULT 0;
DECLARE tabela_cursor CURSOR FOR
SELECT ID_Time FROM TB_AUTOMATIC_DRAW_TB_TIME_TEMP ORDER BY NM_Time;
DECLARE CONTINUE HANDLER FOR NOT FOUND SET _finished = 1;
OPEN tabela_cursor;
get_tabela: LOOP
FETCH tabela_cursor INTO _idTime;
IF _finished = 1 THEN
LEAVE get_tabela;
END IF;
call `arenafifadb`.`spAutomaticDrawTimes`(_idTime, pQtMaxTimes);
END LOOP get_tabela;
CLOSE tabela_cursor;
End$$
DELIMITER ;
DELIMITER $$
DROP PROCEDURE IF EXISTS `spGenerateAutomaticDrawOfTecnicos` $$
CREATE PROCEDURE `spGenerateAutomaticDrawOfTecnicos`(pQtMaxTecnicos INTEGER)
begin
DECLARE _finished INTEGER DEFAULT 0;
DECLARE _inIdDrawExist INTEGER DEFAULT 0;
DECLARE _idDraw INTEGER DEFAULT 0;
DECLARE _idTecnico INTEGER DEFAULT 0;
DECLARE tabela_cursor CURSOR FOR
SELECT ID_USUARIO FROM TB_AUTOMATIC_DRAW_TB_USUARIO_TEMP ORDER BY NM_USUARIO;
DECLARE CONTINUE HANDLER FOR NOT FOUND SET _finished = 1;
OPEN tabela_cursor;
get_tabela: LOOP
FETCH tabela_cursor INTO _idTecnico;
IF _finished = 1 THEN
LEAVE get_tabela;
END IF;
get_draw: LOOP
SET _idDraw = fcGetIdDrawAutomatic(1, pQtMaxTecnicos);
SET _inIdDrawExist = fcValidadeIdDrawTecnicoExist(_idDraw);
IF _inIdDrawExist = 0 THEN
LEAVE get_draw;
END IF;
END LOOP get_draw;
UPDATE TB_AUTOMATIC_DRAW_TB_USUARIO_TEMP
SET ID_DRAW = _idDraw
WHERE ID_USUARIO = _idTecnico;
END LOOP get_tabela;
CLOSE tabela_cursor;
End$$
DELIMITER ;
DELIMITER $$
DROP FUNCTION IF EXISTS `fcGetIdDrawAutomatic` $$
CREATE FUNCTION `fcGetIdDrawAutomatic`(pMinRange INTEGER, pMaxRange INTEGER) RETURNS INTEGER
DETERMINISTIC
begin
DECLARE _pick INTEGER DEFAULT 0;
SET _pick = pMinRange + FLOOR(RAND() * (pMaxRange - pMinRange + 1));
RETURN _pick;
End$$
DELIMITER ;
DELIMITER $$
DROP FUNCTION IF EXISTS `fcValidadeIdDrawTimeExist` $$
CREATE FUNCTION `fcValidadeIdDrawTimeExist`(pIdDraw INTEGER) RETURNS INTEGER
DETERMINISTIC
begin
DECLARE _inRetorno INTEGER DEFAULT 0;
DECLARE _count INTEGER DEFAULT 0;
SELECT count(1) into _count FROM TB_AUTOMATIC_DRAW_TB_TIME_TEMP WHERE ID_DRAW = pIdDraw;
IF _count > 0 THEN
SET _inRetorno = 1;
END IF;
RETURN _inRetorno;
End$$
DELIMITER ;
DELIMITER $$
DROP FUNCTION IF EXISTS `fcValidadeIdDrawTimeExistNoPote` $$
CREATE FUNCTION `fcValidadeIdDrawTimeExistNoPote`(pIdDraw INTEGER, pIdPote INTEGER) RETURNS INTEGER
DETERMINISTIC
begin
DECLARE _inRetorno INTEGER DEFAULT 0;
DECLARE _count INTEGER DEFAULT 0;
SELECT count(1) into _count FROM TB_AUTOMATIC_DRAW_TB_TIME_TEMP WHERE ID_DRAW = pIdDraw AND IN_POTE_GRUPO = pIdPote;
IF _count > 0 THEN
SET _inRetorno = 1;
END IF;
RETURN _inRetorno;
End$$
DELIMITER ;
DELIMITER $$
DROP FUNCTION IF EXISTS `fcValidadeIdDrawTecnicoExist` $$
CREATE FUNCTION `fcValidadeIdDrawTecnicoExist`(pIdDraw INTEGER) RETURNS INTEGER
DETERMINISTIC
begin
DECLARE _inRetorno INTEGER DEFAULT 0;
DECLARE _count INTEGER DEFAULT 0;
SELECT count(1) into _count FROM TB_AUTOMATIC_DRAW_TB_USUARIO_TEMP WHERE ID_DRAW = pIdDraw;
IF _count > 0 THEN
SET _inRetorno = 1;
END IF;
RETURN _inRetorno;
End$$
DELIMITER ;
DELIMITER $$
DROP PROCEDURE IF EXISTS `spCancelDrawOfTimes` $$
CREATE PROCEDURE `spCancelDrawOfTimes`(pIdCamp INTEGER)
begin
DELETE FROM TB_COMENTARIO_USUARIO WHERE ID_CAMPEONATO = pIdCamp;
DELETE FROM TB_TABELA_JOGO WHERE ID_CAMPEONATO = pIdCamp;
DELETE FROM TB_USUARIO_TIME WHERE ID_CAMPEONATO = pIdCamp;
UPDATE TB_CLASSIFICACAO SET ID_GRUPO = 0 WHERE ID_CAMPEONATO = pIdCamp;
End$$
DELIMITER ;
DELIMITER $$
DROP PROCEDURE IF EXISTS `spCancelDrawOfGrupos` $$
CREATE PROCEDURE `spCancelDrawOfGrupos`(pIdCamp INTEGER)
begin
DELETE FROM TB_COMENTARIO_USUARIO WHERE ID_CAMPEONATO = pIdCamp;
DELETE FROM TB_TABELA_JOGO WHERE ID_CAMPEONATO = pIdCamp;
UPDATE TB_CLASSIFICACAO SET ID_GRUPO = 0 WHERE ID_CAMPEONATO = pIdCamp;
End$$
DELIMITER ;
DELIMITER $$
DROP PROCEDURE IF EXISTS `spCancelDrawOfJogos` $$
CREATE PROCEDURE `spCancelDrawOfJogos`(pIdCamp INTEGER)
begin
DELETE FROM TB_COMENTARIO_USUARIO WHERE ID_CAMPEONATO = pIdCamp;
DELETE FROM TB_TABELA_JOGO WHERE ID_CAMPEONATO = pIdCamp;
End$$
DELIMITER ;
DELIMITER $$
DROP PROCEDURE IF EXISTS `spAutomaticDrawOfGroupForPots` $$
CREATE PROCEDURE `spAutomaticDrawOfGroupForPots`(pIdCamp INTEGER)
begin
DECLARE _msgRetorno VARCHAR(250) DEFAULT "";
DECLARE _count INTEGER DEFAULT 0;
DECLARE _qtTimes INTEGER DEFAULT 0;
DECLARE _qtGrupos INTEGER DEFAULT 0;
DECLARE _inOrdemPote INTEGER DEFAULT 0;
SELECT count(1) into _count FROM TB_USUARIO_TIME C WHERE C.ID_CAMPEONATO = pIdCamp;
IF _count > 0 THEN
SELECT QT_TIMES, QT_GRUPOS into _qtTimes, _qtGrupos FROM TB_CAMPEONATO WHERE ID_CAMPEONATO = pIdCamp;
DELETE FROM TB_AUTOMATIC_DRAW_TB_TIME_TEMP WHERE ID_TIME >= 0;
SET _inOrdemPote = 0;
get_tabela: LOOP
SET _inOrdemPote = _inOrdemPote + 1;
IF _inOrdemPote > (_qtTimes/_qtGrupos) THEN
LEAVE get_tabela;
END IF;
call `arenafifadb`.`spAutomaticDrawInOrdemGrupos`(pIdCamp, _qtTimes, _qtGrupos, _inOrdemPote);
END LOOP get_tabela;
call `arenafifadb`.`spGenerateDrawFinalOfGruposPorPotes`(pIdCamp);
ELSE
SET _msgRetorno = "ATENÇÃO, Geração dos Grupos não efetuada. O Sorteio dos Times e Técnicos ainda não foi realizado.";
END IF;
SELECT _msgRetorno as msgRetornoSorteioAutomaticoGruposPorPotes;
End$$
DELIMITER ;
DELIMITER $$
DROP PROCEDURE IF EXISTS `spAutomaticDrawInOrdemGrupos` $$
CREATE PROCEDURE `spAutomaticDrawInOrdemGrupos`(pIdCamp INTEGER, pQtTimes INTEGER, pQtGrupos INTEGER, pInOrdemPotes INTEGER)
begin
DECLARE _finished INTEGER DEFAULT 0;
DECLARE _idTime INTEGER DEFAULT 0;
DECLARE _nmTime VARCHAR(50) DEFAULT NULL;
DECLARE _count INTEGER DEFAULT 0;
DECLARE _inIdDrawExist INTEGER DEFAULT 0;
DECLARE _idDraw INTEGER DEFAULT 0;
DECLARE tabela_cursor CURSOR FOR
SELECT C.ID_Time, T.NM_Time FROM TB_POTE_TIME_GRUPO C, TB_TIME T
WHERE C.ID_CAMPEONATO = pIdCamp AND C.IN_ORDEM_GRUPO = pInOrdemPotes AND C.ID_TIME = T.ID_TIME
ORDER BY T.NM_Time;
DECLARE CONTINUE HANDLER FOR NOT FOUND SET _finished = 1;
OPEN tabela_cursor;
get_tabela: LOOP
FETCH tabela_cursor INTO _idTime, _nmTime;
IF _finished = 1 THEN
LEAVE get_tabela;
END IF;
INSERT INTO TB_AUTOMATIC_DRAW_TB_TIME_TEMP (ID_TIME, NM_TIME, ID_DRAW, IN_POTE_GRUPO)
VALUES (_idTime, _nmTime, 0, pInOrdemPotes);
call `arenafifadb`.`spAutomaticDrawTimesPorGrupo`(_idTime, pInOrdemPotes, pQtGrupos);
END LOOP get_tabela;
CLOSE tabela_cursor;
End$$
DELIMITER ;
DELIMITER $$
DROP PROCEDURE IF EXISTS `spGenerateDrawFinalOfGruposPorPotes` $$
CREATE PROCEDURE `spGenerateDrawFinalOfGruposPorPotes`(pIdCamp INTEGER)
begin
DECLARE _finished INTEGER DEFAULT 0;
DECLARE _idTime INTEGER DEFAULT 0;
DECLARE _inOrdemGrupo INTEGER DEFAULT 0;
DECLARE _idDraw INTEGER DEFAULT 0;
DECLARE tabela_cursor CURSOR FOR
SELECT T.ID_Time, T.ID_DRAW, T.IN_POTE_GRUPO FROM TB_AUTOMATIC_DRAW_TB_TIME_TEMP T
ORDER BY T.IN_POTE_GRUPO, T.ID_DRAW;
DECLARE CONTINUE HANDLER FOR NOT FOUND SET _finished = 1;
OPEN tabela_cursor;
get_tabela: LOOP
FETCH tabela_cursor INTO _idTime, _idDraw, _inOrdemGrupo;
IF _finished = 1 THEN
LEAVE get_tabela;
END IF;
call `arenafifadb`.`spAddClassificacaoGrupoOfTime`(pIdCamp, _idTime, _idDraw, _inOrdemGrupo);
END LOOP get_tabela;
CLOSE tabela_cursor;
End$$
DELIMITER ;
DELIMITER $$
DROP PROCEDURE IF EXISTS `spAutomaticDrawOfTables` $$
CREATE PROCEDURE `spAutomaticDrawOfTables`(pIdCamp INTEGER)
begin
DECLARE _msgRetorno VARCHAR(250) DEFAULT "";
DECLARE _count INTEGER DEFAULT 0;
DECLARE _countTimesQualify INTEGER DEFAULT 0;
DECLARE _qtTimes INTEGER DEFAULT 0;
DECLARE _qtGrupos INTEGER DEFAULT 0;
DECLARE _firstFase INTEGER DEFAULT 0;
DECLARE _intervalDias INTEGER DEFAULT 0;
DECLARE _inDoubleRound INTEGER DEFAULT NULL;
DECLARE _dtInicio DATE DEFAULT NULL;
DECLARE _dtInicioLastRound DATE DEFAULT NULL;
DECLARE _inIdaEVolta TINYINT(1) DEFAULT NULL;
DECLARE _inGrupo TINYINT(1) DEFAULT NULL;
DECLARE _inTurnoReturno TINYINT(1) DEFAULT NULL;
DECLARE _qtTimesPorGrupo TINYINT(1) DEFAULT NULL;
DECLARE _idFaseClassif INTEGER DEFAULT 0;
DECLARE _idFaseQualify INTEGER DEFAULT -1;
DECLARE _idFaseRound32 INTEGER DEFAULT 1;
DECLARE _idFaseRound16 INTEGER DEFAULT 2;
SELECT count(1) into _count FROM TB_USUARIO_TIME C WHERE C.ID_CAMPEONATO = pIdCamp;
IF _count > 0 THEN
SELECT QT_TIMES, QT_DIAS_PARTIDA_CLASSIFICACAO, IN_DOUBLE_ROUND, DT_INICIO, IN_SISTEMA_IDA_VOLTA, IN_CAMPEONATO_GRUPO, IN_CAMPEONATO_TURNO_RETURNO, QT_GRUPOS
into _qtTimes, _intervalDias, _inDoubleRound, _dtInicio, _inIdaEVolta, _inGrupo, _inTurnoReturno, _qtGrupos
FROM TB_CAMPEONATO WHERE ID_CAMPEONATO = pIdCamp;
SELECT ID_Fase into _firstFase FROM TB_FASE_CAMPEONATO WHERE ID_CAMPEONATO = pIdCamp ORDER BY ID_FASE LIMIT 1;
DELETE FROM TB_TABLETEAM_PROVISION_ONLINE WHERE IN_TABELA_GRUPO >= 0;
DELETE FROM TB_AUTOMATIC_DRAW_TB_TIME_TEMP WHERE ID_TIME >= 0;
call `arenafifadb`.`spCancelDrawOfJogos`(pIdCamp);
IF _firstFase = _idFaseQualify THEN
SELECT count(1) into _countTimesQualify FROM TB_TIMES_FASE_PRECOPA WHERE ID_CAMPEONATO = pIdCamp;
IF _countTimesQualify > 0 THEN
call `arenafifadb`.`spAutomaticDrawTimesPlayOffQualify`(pIdCamp, _intervalDias, _inDoubleRound, _dtInicio, _inIdaEVolta, _firstFase, _countTimesQualify);
call `arenafifadb`.`spAddLoadComentarioUsuarioOfCampeonato`(pIdCamp);
ELSE
SET _msgRetorno = "ATENÇÃO, Geração da Tabela não efetuada. Não há times da Tabela PRE COPA para este Campeonato.";
END IF;
ELSEIF _firstFase = _idFaseRound32 OR _firstFase = _idFaseRound16 THEN
call `arenafifadb`.`spAutomaticDrawAllTimesCampeonato`(pIdCamp, _qtTimes);
call `arenafifadb`.`spAutomaticDrawClashesFasePlayOff`(pIdCamp, pIntervalDias, _inDoubleRound, pDtInicio, pInIdaEVolta, pFirstFase);
call `arenafifadb`.`spAddLoadComentarioUsuarioOfCampeonato`(pIdCamp);
ELSEIF _firstFase = _idFaseClassif AND (_inGrupo = false OR _qtGrupos = 0) THEN
call `arenafifadb`.`spAutomaticDrawAllTimesCampeonato`(pIdCamp, _qtTimes);
call `arenafifadb`.`spAutomaticDrawClashesProvisionTemp`(_qtTimes);
IF _inTurnoReturno = true THEN
call `arenafifadb`.`spAutomaticDrawClashesProvisionTransferToTable`(pIdCamp, _intervalDias, _inDoubleRound, _dtInicio, false, _firstFase, _qtTimes, _dtInicioLastRound);
call `arenafifadb`.`spAutomaticDrawClashesProvisionTransferToTable`(pIdCamp, _intervalDias, _inDoubleRound, _dtInicioLastRound, true, _firstFase, _qtTimes, _dtInicioLastRound);
ELSE
call `arenafifadb`.`spAutomaticDrawClashesProvisionTransferToTable`(pIdCamp, _intervalDias, _inDoubleRound, _dtInicio, false, _firstFase, _qtTimes, _dtInicioLastRound);
END IF;
call `arenafifadb`.`spAddLoadComentarioUsuarioOfCampeonato`(pIdCamp);
ELSEIF _firstFase = _idFaseClassif AND (_inGrupo = true OR _qtGrupos > 0) THEN
SET _qtTimesPorGrupo = (_qtTimes / _qtGrupos);
call `arenafifadb`.`spAutomaticDrawAllTimesPorGrupo`(pIdCamp, _qtTimesPorGrupo);
SET _count = 0;
get_tabela: LOOP
SET _count = _count + 1;
IF _count > _qtGrupos THEN
LEAVE get_tabela;
END IF;
call `arenafifadb`.`spAutomaticDrawClashesProvisionTempPorGrupo`(_qtTimesPorGrupo, _count);
IF _inTurnoReturno = true THEN
call `arenafifadb`.`spAutomaticDrawClashesProvisionTransferToTable`(pIdCamp, _intervalDias, _inDoubleRound, _dtInicio, false, _firstFase, _qtTimesPorGrupo, _dtInicioLastRound);
call `arenafifadb`.`spAutomaticDrawClashesProvisionTransferToTable`(pIdCamp, _intervalDias, _inDoubleRound, _dtInicioLastRound, true, _firstFase, (_qtTimesPorGrupo+1), _dtInicioLastRound);
ELSE
call `arenafifadb`.`spAutomaticDrawClashesProvisionTransferToTable`(pIdCamp, _intervalDias, _inDoubleRound, _dtInicio, false, _firstFase, _qtTimesPorGrupo, _dtInicioLastRound);
END IF;
END LOOP get_tabela;
call `arenafifadb`.`spAddLoadComentarioUsuarioOfCampeonato`(pIdCamp);
END IF;
ELSE
SET _msgRetorno = "ATENÇÃO, Geração da Tabela não efetuada. O Sorteio dos Times e Técnicos ainda não foi realizado.";
END IF;
SELECT _msgRetorno as msgRetornoSorteioAutomaticoTabelas;
End$$
DELIMITER ;
DELIMITER $$
DROP PROCEDURE IF EXISTS `spAutomaticDrawClashesProvisionTempPorGrupo` $$
CREATE PROCEDURE `spAutomaticDrawClashesProvisionTempPorGrupo`(pQtMaxTimes INTEGER, pIdGrupo INTEGER)
begin
DECLARE _finished INTEGER DEFAULT 0;
DECLARE _idTime INTEGER DEFAULT 0;
DECLARE _idDraw INTEGER DEFAULT 0;
DECLARE tabela_cursor CURSOR FOR
SELECT ID_TIME, ID_DRAW FROM TB_AUTOMATIC_DRAW_TB_TIME_TEMP WHERE IN_POTE_GRUPO = pIdGrupo ORDER BY ID_DRAW DESC;
DECLARE CONTINUE HANDLER FOR NOT FOUND SET _finished = 1;
DELETE FROM TB_TABLETEAM_PROVISION_ONLINE;
INSERT INTO TB_TABLETEAM_PROVISION_ONLINE SELECT *, NU_TIME_HOME as ID_DRAW_HOME, NU_TIME_AWAY as ID_DRAW_AWAY FROM TB_TABLETEAM_PROVISION WHERE IN_TABELA_GRUPO = 1 AND ID_TIPO_TABELA = pQtMaxTimes;
OPEN tabela_cursor;
get_tabela: LOOP
FETCH tabela_cursor INTO _idTime, _idDraw;
IF _finished = 1 THEN
LEAVE get_tabela;
END IF;
UPDATE TB_TABLETEAM_PROVISION_ONLINE
SET NU_TIME_HOME = _idTime
WHERE ID_DRAW_HOME = _idDraw;
UPDATE TB_TABLETEAM_PROVISION_ONLINE
SET NU_TIME_AWAY = _idTime
WHERE ID_DRAW_AWAY = _idDraw;
END LOOP get_tabela;
CLOSE tabela_cursor;
End$$
DELIMITER ;
DELIMITER $$
DROP PROCEDURE IF EXISTS `spAutomaticDrawAllTimesPorGrupo` $$
CREATE PROCEDURE `spAutomaticDrawAllTimesPorGrupo`(
pIdCamp INTEGER, pQtMaxTimes INTEGER
)
begin
DECLARE _finished INTEGER DEFAULT 0;
DECLARE _idTime INTEGER DEFAULT 0;
DECLARE _nmTime VARCHAR(50) DEFAULT NULL;
DECLARE _idGrupo INTEGER DEFAULT 0;
DECLARE tabela_cursor CURSOR FOR
SELECT C.ID_TIME, C.ID_GRUPO, T.NM_Time FROM TB_CLASSIFICACAO C, TB_TIME T
WHERE C.ID_CAMPEONATO = pIdCamp AND C.ID_Time = T.ID_Time ORDER BY T.NM_Time;
DECLARE CONTINUE HANDLER FOR NOT FOUND SET _finished = 1;
OPEN tabela_cursor;
get_tabela: LOOP
FETCH tabela_cursor INTO _idTime, _idGrupo, _nmTime;
IF _finished = 1 THEN
LEAVE get_tabela;
END IF;
INSERT INTO TB_AUTOMATIC_DRAW_TB_TIME_TEMP (ID_TIME, NM_TIME, ID_DRAW, IN_POTE_GRUPO)
VALUES (_idTime, _nmTime, 0, _idGrupo);
call `arenafifadb`.`spAutomaticDrawTimesPorGrupo`(_idTime, _idGrupo, pQtMaxTimes);
END LOOP get_tabela;
CLOSE tabela_cursor;
End$$
DELIMITER ;
DELIMITER $$
DROP PROCEDURE IF EXISTS `spAutomaticDrawAllTimesCampeonato` $$
CREATE PROCEDURE `spAutomaticDrawAllTimesCampeonato`(
pIdCamp INTEGER, pQtMaxTimes INTEGER
)
begin
DECLARE _finished INTEGER DEFAULT 0;
DECLARE _idTime INTEGER DEFAULT 0;
DECLARE _nmTime VARCHAR(50) DEFAULT NULL;
DECLARE tabela_cursor CURSOR FOR
SELECT C.ID_TIME, T.NM_Time FROM TB_CAMPEONATO_TIME C, TB_TIME T
WHERE C.ID_CAMPEONATO = pIdCamp AND C.ID_Time = T.ID_Time ORDER BY T.NM_Time;
DECLARE CONTINUE HANDLER FOR NOT FOUND SET _finished = 1;
OPEN tabela_cursor;
get_tabela: LOOP
FETCH tabela_cursor INTO _idTime, _nmTime;
IF _finished = 1 THEN
LEAVE get_tabela;
END IF;
INSERT INTO TB_AUTOMATIC_DRAW_TB_TIME_TEMP (ID_TIME, NM_TIME, ID_DRAW)
VALUES (_idTime, _nmTime, 0);
call `arenafifadb`.`spAutomaticDrawTimes`(_idTime, pQtMaxTimes);
END LOOP get_tabela;
CLOSE tabela_cursor;
End$$
DELIMITER ;
DELIMITER $$
DROP PROCEDURE IF EXISTS `spAutomaticDrawClashesProvisionTemp` $$
CREATE PROCEDURE `spAutomaticDrawClashesProvisionTemp`(pQtMaxTimes INTEGER)
begin
DECLARE _finished INTEGER DEFAULT 0;
DECLARE _idTime INTEGER DEFAULT 0;
DECLARE _idDraw INTEGER DEFAULT 0;
DECLARE tabela_cursor CURSOR FOR
SELECT ID_TIME, ID_DRAW FROM TB_AUTOMATIC_DRAW_TB_TIME_TEMP ORDER BY ID_DRAW DESC;
DECLARE CONTINUE HANDLER FOR NOT FOUND SET _finished = 1;
DELETE FROM TB_TABLETEAM_PROVISION_ONLINE;
INSERT INTO TB_TABLETEAM_PROVISION_ONLINE SELECT *, NU_TIME_HOME as ID_DRAW_HOME, NU_TIME_AWAY as ID_DRAW_AWAY FROM TB_TABLETEAM_PROVISION WHERE IN_TABELA_GRUPO = 0 AND ID_TIPO_TABELA = pQtMaxTimes;
OPEN tabela_cursor;
get_tabela: LOOP
FETCH tabela_cursor INTO _idTime, _idDraw;
IF _finished = 1 THEN
LEAVE get_tabela;
END IF;
UPDATE TB_TABLETEAM_PROVISION_ONLINE
SET NU_TIME_HOME = _idTime
WHERE ID_DRAW_HOME = _idDraw;
UPDATE TB_TABLETEAM_PROVISION_ONLINE
SET NU_TIME_AWAY = _idTime
WHERE ID_DRAW_AWAY = _idDraw;
END LOOP get_tabela;
CLOSE tabela_cursor;
End$$
DELIMITER ;
DELIMITER $$
DROP PROCEDURE IF EXISTS `spAutomaticDrawClashesProvisionTransferToTable` $$
CREATE PROCEDURE `spAutomaticDrawClashesProvisionTransferToTable`(
pIdCamp INTEGER, pIntervalDias INTEGER, pInDoubleRound INTEGER,
pDtInicio DATE, pInReturno TINYINT, pFirstFase INTEGER, pQtMaxTimes INTEGER, OUT pDtInicioLastRound DATE
)
begin
DECLARE _finished INTEGER DEFAULT 0;
DECLARE _idTimeHome INTEGER DEFAULT 0;
DECLARE _idTimeAway INTEGER DEFAULT 0;
DECLARE _nuRodada INTEGER DEFAULT 0;
DECLARE _nuRodadaAux INTEGER DEFAULT 1;
DECLARE _count INTEGER DEFAULT 0;
DECLARE _countRecords INTEGER DEFAULT 0;
DECLARE _totRecords INTEGER DEFAULT 0;
DECLARE _nuRodadaJogo INTEGER DEFAULT 0;
DECLARE _dtInicio DATE DEFAULT NULL;
DECLARE tabela_cursor CURSOR FOR
SELECT NU_TIME_HOME, NU_TIME_AWAY, NU_RODADA FROM TB_TABLETEAM_PROVISION_ONLINE ORDER BY NU_RODADA;
DECLARE CONTINUE HANDLER FOR NOT FOUND SET _finished = 1;
SELECT count(1) into _totRecords FROM TB_TABLETEAM_PROVISION_ONLINE;
IF pInReturno = true THEN
SET _dtInicio = date_add(pDtInicio, INTERVAL pIntervalDias DAY);
SET _count = pQtMaxTimes - 1;
ELSE
SET _dtInicio = pDtInicio;
END IF;
OPEN tabela_cursor;
get_tabela: LOOP
FETCH tabela_cursor INTO _idTimeHome, _idTimeAway, _nuRodada;
SET _countRecords = _countRecords + 1;
IF _countRecords > _totRecords THEN
LEAVE get_tabela;
END IF;
IF _nuRodada > 1 THEN
IF _nuRodadaAux <> _nuRodada THEN
IF pInDoubleRound = 0 OR (pInDoubleRound = 1 AND MOD(_nuRodada, 2) = 0) THEN
SET _dtInicio = date_add(_dtInicio, INTERVAL pIntervalDias DAY);
END IF;
SET _nuRodadaAux = _nuRodada;
END IF;
END IF;
IF pInReturno = true THEN
SET _nuRodada = _nuRodada + _count;
END IF;
call `arenafifadb`.`spAddTabelaJogo`(pIdCamp, pFirstFase, _dtInicio, pIntervalDias, _nuRodada, _idTimeHome, _idTimeAway, 0, false, false);
END LOOP get_tabela;
SET pDtInicioLastRound = _dtInicio;
CLOSE tabela_cursor;
End$$
DELIMITER ;
DELIMITER $$
DROP PROCEDURE IF EXISTS `spAutomaticDrawTimesPlayOffQualify` $$
CREATE PROCEDURE `spAutomaticDrawTimesPlayOffQualify`(
pIdCamp INTEGER, pIntervalDias INTEGER, pInDoubleRound INTEGER, pDtInicio DATE, pInIdaEVolta TINYINT, pFirstFase INTEGER, pQtMaxTimes INTEGER
)
begin
DECLARE _finished INTEGER DEFAULT 0;
DECLARE _idTime INTEGER DEFAULT 0;
DECLARE _nmTime VARCHAR(50) DEFAULT NULL;
DECLARE _count INTEGER DEFAULT 0;
DECLARE _inIdDrawExist INTEGER DEFAULT 0;
DECLARE _idDraw INTEGER DEFAULT 0;
DECLARE tabela_cursor CURSOR FOR
SELECT C.ID_TIME, T.NM_Time FROM TB_TIMES_FASE_PRECOPA C, TB_TIME T
WHERE C.ID_CAMPEONATO = pIdCamp AND C.ID_Time = T.ID_Time ORDER BY T.NM_Time;
DECLARE CONTINUE HANDLER FOR NOT FOUND SET _finished = 1;
OPEN tabela_cursor;
get_tabela: LOOP
FETCH tabela_cursor INTO _idTime, _nmTime;
IF _finished = 1 THEN
LEAVE get_tabela;
END IF;
INSERT INTO TB_AUTOMATIC_DRAW_TB_TIME_TEMP (ID_TIME, NM_TIME, ID_DRAW)
VALUES (_idTime, _nmTime, 0);
call `arenafifadb`.`spAutomaticDrawTimes`(_idTime, pQtMaxTimes);
END LOOP get_tabela;
call `arenafifadb`.`spAutomaticDrawClashesFasePlayOff`(pIdCamp, pIntervalDias, pInDoubleRound, pDtInicio, pInIdaEVolta, pFirstFase);
CLOSE tabela_cursor;
End$$
DELIMITER ;
DELIMITER $$
DROP PROCEDURE IF EXISTS `spAutomaticDrawClashesFasePlayOff` $$
CREATE PROCEDURE `spAutomaticDrawClashesFasePlayOff`(
pIdCamp INTEGER, pIntervalDias INTEGER, pInDoubleRound INTEGER, pDtInicio DATE, pInIdaEVolta TINYINT, pFirstFase INTEGER
)
begin
DECLARE _finished INTEGER DEFAULT 0;
DECLARE _idTimeHome INTEGER DEFAULT 0;
DECLARE _idTimeAway INTEGER DEFAULT 0;
DECLARE _inIdDrawExist INTEGER DEFAULT 0;
DECLARE _count INTEGER DEFAULT 0;
DECLARE tabela_cursor CURSOR FOR
SELECT ID_TIME FROM TB_AUTOMATIC_DRAW_TB_TIME_TEMP ORDER BY ID_DRAW;
DECLARE CONTINUE HANDLER FOR NOT FOUND SET _finished = 1;
OPEN tabela_cursor;
get_tabela: LOOP
SET _count = _count + 1;
FETCH tabela_cursor INTO _idTimeAway;
IF _finished = 1 THEN
LEAVE get_tabela;
END IF;
FETCH tabela_cursor INTO _idTimeHome;
IF _finished = 1 THEN
LEAVE get_tabela;
END IF;
call `arenafifadb`.`spAddTabelaJogo`(pIdCamp, pFirstFase, pDtInicio, pIntervalDias, 0, _idTimeHome, _idTimeAway, _count, pInIdaEVolta, true);
END LOOP get_tabela;
CLOSE tabela_cursor;
End$$
DELIMITER ;
DELIMITER $$
DROP PROCEDURE IF EXISTS `spAutomaticDrawTimes` $$
CREATE PROCEDURE `spAutomaticDrawTimes`(pIdTime INTEGER, pQtMaxDraw INTEGER)
begin
DECLARE _finished INTEGER DEFAULT 0;
DECLARE _inIdDrawExist INTEGER DEFAULT 0;
DECLARE _idDraw INTEGER DEFAULT 0;
get_draw: LOOP
SET _idDraw = fcGetIdDrawAutomatic(1, pQtMaxDraw);
SET _inIdDrawExist = fcValidadeIdDrawTimeExist(_idDraw);
IF _inIdDrawExist = 0 THEN
LEAVE get_draw;
END IF;
END LOOP get_draw;
UPDATE TB_AUTOMATIC_DRAW_TB_TIME_TEMP
SET ID_DRAW = _idDraw
WHERE ID_TIME = pIdTime;
End$$
DELIMITER ;
DELIMITER $$
DROP PROCEDURE IF EXISTS `spAutomaticDrawTimesPorGrupo` $$
CREATE PROCEDURE `spAutomaticDrawTimesPorGrupo`(pIdTime INTEGER, pIdGrupo INTEGER, pQtMaxDraw INTEGER)
begin
DECLARE _finished INTEGER DEFAULT 0;
DECLARE _inIdDrawExist INTEGER DEFAULT 0;
DECLARE _idDraw INTEGER DEFAULT 0;
get_draw: LOOP
SET _idDraw = fcGetIdDrawAutomatic(1, pQtMaxDraw);
SET _inIdDrawExist = fcValidadeIdDrawTimeExistNoPote(_idDraw, pIdGrupo);
IF _inIdDrawExist = 0 THEN
LEAVE get_draw;
END IF;
END LOOP get_draw;
UPDATE TB_AUTOMATIC_DRAW_TB_TIME_TEMP
SET ID_DRAW = _idDraw
WHERE ID_TIME = pIdTime;
End$$
DELIMITER ;
DELIMITER $$
DROP PROCEDURE IF EXISTS `spAddSpoolerDraw` $$
CREATE PROCEDURE `spAddSpoolerDraw`(pIdCamp INTEGER, pDescription VARCHAR(80), pTypeSpooler VARCHAR(50), pIdUsuResponsible INTEGER)
begin
DECLARE _finished INTEGER DEFAULT 0;
DECLARE _nmDescription VARCHAR(80) DEFAULT "";
DECLARE _nmCamp VARCHAR(50) DEFAULT "";
DECLARE _idProcess INTEGER DEFAULT NULL;
DECLARE _count INTEGER DEFAULT 0;
DECLARE _idTemp INTEGER DEFAULT 0;
DECLARE _idModerador1 INTEGER DEFAULT 0;
DECLARE _idModerador2 INTEGER DEFAULT 0;
DECLARE _idUsu INTEGER DEFAULT 0;
DECLARE _nmUsu VARCHAR(50) DEFAULT "";
DECLARE _email VARCHAR(80) DEFAULT "";
DECLARE _psnID VARCHAR(30) DEFAULT "";
DECLARE _inTecnico VARCHAR(1) DEFAULT "";
DECLARE _inUsuModerator TINYINT DEFAULT NULL;
DECLARE tabela_cursor CURSOR FOR
SELECT ID_USUARIO, NM_USUARIO, DS_EMAIL, PSN_ID, IN_USUARIO_MODERADOR, '1' as IN_TECNICO FROM TB_USUARIO T WHERE fcGetIdUsuariosVazio(T.ID_USUARIO,'NOT') AND T.ID_Usuario IN (SELECT C.ID_USUARIO FROM TB_CAMPEONATO_USUARIO C WHERE C.ID_Campeonato = pIdCamp) AND DS_EMAIL IS NOT NULL
UNION ALL
SELECT ID_USUARIO, NM_USUARIO, DS_EMAIL, PSN_ID, IN_USUARIO_MODERADOR, '0' as IN_TECNICO FROM TB_USUARIO T WHERE T.ID_Usuario IN (_idModerador1, _idModerador2) AND DS_EMAIL IS NOT NULL
ORDER BY NM_USUARIO;
DECLARE CONTINUE HANDLER FOR NOT FOUND SET _finished = 1;
SELECT NM_CAMPEONATO, ID_TEMPORADA, ID_USUARIO_MODERADOR, ID_USUARIO_2oMODERADOR into _nmCamp, _idTemp, _idModerador1, _idModerador2
FROM TB_CAMPEONATO WHERE ID_CAMPEONATO = pIdCamp;
SET _nmDescription = CONCAT(pDescription, _nmCamp);
OPEN tabela_cursor;
get_tabela: LOOP
SET _count = _count + 1;
FETCH tabela_cursor INTO _idUsu, _nmUsu, _email, _psnID, _inUsuModerator, _inTecnico;
IF _finished = 1 THEN
LEAVE get_tabela;
END IF;
IF _count = 1 THEN
call `arena_spooler`.`spAddSpooler`(_nmDescription, pTypeSpooler, pIdUsuResponsible);
SET _idProcess = `arena_spooler`.`fcGetLastProcessID`();
END IF;
IF `arena_spooler`.`fcValidateExistProcessUser`(_idProcess, _idUsu) = 0 THEN
call `arena_spooler`.`spAddSpoolerDetailsDraw`(_idProcess, _idUsu, _count, _nmUsu, _psnID, _email, _inUsuModerator, _idTemp, pIdCamp, _inTecnico, pIdUsuResponsible);
END IF;
END LOOP get_tabela;
CLOSE tabela_cursor;
call `arena_spooler`.`spUpdateTotalSpooler`(_idProcess);
SELECT count(1) as TOTAL_EMAILS_SENT FROM arena_spooler.TB_PROCESSOS_EMAIL_DETALHE WHERE id_processo = _idProcess;
End$$
DELIMITER ;
#call `arenafifadb`.`spCreateTablesTempAutomaticDraw`();
#call `arenafifadb`.`spAddRecordsTableTeam`();
|
prompt Created on 2012-04-24 by ljy
prompt batch sql beginning...
@@01_f_userinfo.sql;
@@02_f_roleinfo.sql;
@@03_f_optdef.sql;
@@04_f_optinfo.sql;
@@05_f_userrole.sql;
@@06_f_rolepower.sql;
@@07_f_usersetting.sql;
@@08_f_datacatalog.sql;
@@09_f_datadictionary.sql;
@@10_clear.sql
@@11_f_unitinfo.sql
prompt batch sql end... |
alter table Group_ add typeSettings long varchar;
alter table SCProductEntry add tags varchar(300);
alter table SCProductEntry add author varchar(75);
create table SCProductScreenshot (
productScreenshotId bigint not null primary key,
companyId bigint,
groupId bigint,
productEntryId bigint,
thumbnailId bigint,
fullImageId bigint,
priority integer
);
alter table TagsAsset add description long varchar;
alter table TagsAsset add summary long varchar;
|
# 1. 테이블 생성
CREATE TABLE `favorite` (
`id` int NOT NULL AUTO_INCREMENT primary key,
`name` varchar(16) NOT NULL,
`url` varchar(512) NOT NULL,
`createdAt` timestamp DEFAULT CURRENT_TIMESTAMP,
`updatedAt` timestamp DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
# 2. 데이터 저장
INSERT INTO `favorite` (`name`, `url`, `createdAt`, `updatedAt`)
VALUES
('마론달', 'http://marondal.com', now(), now()),
('구글', 'https://google.com', now(), now()),
('네이버', 'https://naver.com', now(), now()),
('다음', 'https://daum.net', now(), now()); |
select jou.*, jli.*
from joujournal jou
join jjoujlijli joujli on joujli.UIDjou = jou.jouUID
join jlijournalline jli on jli.jliUID = joujli.journalLineUIDjli
where jouSubjectId = 'b0448179-316a-402f-b2a0-213a1e13731b'
#and jouType in ('PREMIUM_ORIGINAL', 'PREMIUM_ADDITIONAL', 'PREMIUM_RETURN')
#and jli.jliType = 'PREMIUM'
and jou.jouPostedDate >= '2019-04-01'
order by jou.jouSubjectId, jou.jouPostedDate asc;
update jlijournalline set jliAmount = 218.11 where jliUID = 1711210;
update jlijournalline set jliAmount = 23.37 where jliUID = 1711211;
update jlijournalline set jliAmount = 46.74 where jliUID = 1711212;
update jlijournalline set jliAmount = 148.00 where jliUID = 1711213;
update jlijournalline set jliAmount = 218.11 where jliUID = 1711215;
update jlijournalline set jliAmount = 218.11 where jliUID = 1711216;
update jlijournalline set jliAmount = 3.25 where jliUID = 1711218;
update jlijournalline set jliAmount = 3.25 where jliUID = 1711219; |
INSERT INTO insuranceclaims( icid, subid, DATE )
VALUES( 34, 32, '2016-04-21 02:43:23' );
INSERT INTO insuranceclaims( icid, subid, DATE )
VALUES( 48, 38, '2016-05-07 23:29:03' );
INSERT INTO insuranceclaims( icid, subid, DATE )
VALUES( 25, 40, '2016-12-07 20:18:35' );
INSERT INTO insuranceclaims( icid, subid, DATE )
VALUES( 18, 4, '2002-12-19 09:37:38' );
INSERT INTO insuranceclaims( icid, subid, DATE )
VALUES( 44, 36, '2001-08-07 03:19:22' );
INSERT INTO insuranceclaims( icid, subid, DATE )
VALUES( 20, 3, '2017-08-19 11:39:36' );
INSERT INTO insuranceclaims( icid, subid, DATE )
VALUES( 7, 8, '2008-01-11 05:30:21' );
INSERT INTO insuranceclaims( icid, subid, DATE )
VALUES( 33, 24, '2005-09-26 06:59:26' );
INSERT INTO insuranceclaims( icid, subid, DATE )
VALUES( 26, 19, '2001-09-20 23:41:44' );
INSERT INTO insuranceclaims( icid, subid, DATE )
VALUES( 49, 13, '2002-09-15 18:59:52' );
INSERT INTO insuranceclaims( icid, subid, DATE )
VALUES( 31, 37, '2011-07-12 08:26:00' );
INSERT INTO insuranceclaims( icid, subid, DATE )
VALUES( 23, 46, '2018-06-30 00:24:52' );
INSERT INTO insuranceclaims( icid, subid, DATE )
VALUES( 17, 47, '2002-12-25 23:09:50' );
INSERT INTO insuranceclaims( icid, subid, DATE )
VALUES( 30, 29, '2018-06-16 14:35:57' );
INSERT INTO insuranceclaims( icid, subid, DATE )
VALUES( 28, 11, '2000-07-21 13:11:14' );
INSERT INTO insuranceclaims( icid, subid, DATE )
VALUES( 24, 20, '2005-10-01 04:58:58' );
INSERT INTO insuranceclaims( icid, subid, DATE )
VALUES( 6, 25, '2007-02-04 09:38:52' );
INSERT INTO insuranceclaims( icid, subid, DATE )
VALUES( 46, 39, '2005-09-07 19:40:50' );
INSERT INTO insuranceclaims( icid, subid, DATE )
VALUES( 50, 12, '2009-05-22 00:06:54' );
INSERT INTO insuranceclaims( icid, subid, DATE )
VALUES( 32, 33, '2017-03-19 02:43:06' );
INSERT INTO insuranceclaims( icid, subid, DATE )
VALUES( 8, 15, '2009-03-08 18:22:32' );
INSERT INTO insuranceclaims( icid, subid, DATE )
VALUES( 40, 21, '2019-07-01 09:27:31' );
INSERT INTO insuranceclaims( icid, subid, DATE )
VALUES( 16, 28, '2011-11-24 21:52:12' );
INSERT INTO insuranceclaims( icid, subid, DATE )
VALUES( 10, 14, '2002-11-02 03:00:42' );
INSERT INTO insuranceclaims( icid, subid, DATE )
VALUES( 29, 2, '2017-01-23 16:50:13' );
INSERT INTO insuranceclaims( icid, subid, DATE )
VALUES( 2, 41, '2002-04-30 10:51:55' );
INSERT INTO insuranceclaims( icid, subid, DATE )
VALUES( 37, 45, '2006-07-13 11:40:48' );
INSERT INTO insuranceclaims( icid, subid, DATE )
VALUES( 11, 26, '2002-02-15 23:12:02' );
INSERT INTO insuranceclaims( icid, subid, DATE )
VALUES( 12, 1, '2000-11-18 12:10:50' );
INSERT INTO insuranceclaims( icid, subid, DATE )
VALUES( 35, 35, '2012-08-26 00:06:45' );
INSERT INTO insuranceclaims( icid, subid, DATE )
VALUES( 36, 10, '2018-06-10 07:08:53' );
INSERT INTO insuranceclaims( icid, subid, DATE )
VALUES( 42, 9, '2000-07-18 13:39:01' );
INSERT INTO insuranceclaims( icid, subid, DATE )
VALUES( 43, 23, '2000-12-31 01:14:20' );
INSERT INTO insuranceclaims( icid, subid, DATE )
VALUES( 21, 43, '2017-06-26 01:02:50' );
INSERT INTO insuranceclaims( icid, subid, DATE )
VALUES( 15, 7, '2018-08-01 12:02:02' );
INSERT INTO insuranceclaims( icid, subid, DATE )
VALUES( 22, 6, '2011-06-27 03:04:52' );
INSERT INTO insuranceclaims( icid, subid, DATE )
VALUES( 47, 16, '2016-07-15 09:29:18' );
INSERT INTO insuranceclaims( icid, subid, DATE )
VALUES( 45, 44, '2019-07-31 17:17:27' );
--INSERT INTO insuranceclaims( icid, subid, DATE )
--VALUES( 42, 0, '2010-02-06 00:07:56' );
INSERT INTO insuranceclaims( icid, subid, DATE )
VALUES( 39, 34, '2010-02-06 00:07:56' );
INSERT INTO insuranceclaims( icid, subid, DATE )
VALUES( 9, 49, '2009-04-21 15:07:57' );
INSERT INTO insuranceclaims( icid, subid, DATE )
VALUES( 19, 48, '2012-11-29 13:21:48' );
INSERT INTO insuranceclaims( icid, subid, DATE )
VALUES( 27, 18, '2016-07-04 10:24:12' );
INSERT INTO insuranceclaims( icid, subid, DATE )
VALUES( 13, 42, '2004-07-20 19:51:56' );
INSERT INTO insuranceclaims( icid, subid, DATE )
VALUES( 4, 27, '2009-10-14 17:43:03' );
INSERT INTO insuranceclaims( icid, subid, DATE )
VALUES( 5, 31, '2017-03-23 01:02:57' );
INSERT INTO insuranceclaims( icid, subid, DATE )
VALUES( 38, 22, '2013-05-12 11:49:53' );
INSERT INTO insuranceclaims( icid, subid, DATE )
VALUES( 3, 30, '2005-02-11 03:39:26' );
INSERT INTO insuranceclaims( icid, subid, DATE )
VALUES( 14, 50, '2002-12-29 23:04:35' );
INSERT INTO insuranceclaims( icid, subid, DATE )
VALUES( 41, 17, '2005-10-07 04:34:50' );
INSERT INTO insuranceclaims( icid, subid, DATE )
VALUES( 1, 5, '2000-02-01 18:12:26' );
|
SELECT USER
FROM DUAL;
--==>> SCOTT
--■■■ UPDATE ■■■--
-- 1. 테이블에서 기존 데이터를 수정(변경)하는 구문
-- 2. 형식 및 구조
-- UPDATE 테이블명
-- SET 컬럼명 = 변경할값[, 컬럼명 = 변경할값, ...]
-- [WHERE 조건절];
SELECT *
FROM TBL_SAWON;
--○ TBL_SAWON 테이블에서 사원번호 1004번 사원의
-- 주민번호를 [ 8802031234567 ] 로 수정한다.
UPDATE TBL_SAWON
SET 주민번호 = '8802031234567'
WHERE 사원번호 1004;
UPDATE TBL_SAWON
SET JUBUN = '8802031234567'
WHERE SANO = 1004;
--==>> 1 행 이(가) 업데이트되었습니다.
SELECT*
FROM TBL_SAWON;
--==>> 1004 박해일 8802031234567 1990-09-20 2000
--※ 실행 후 COMMIT 또는 ROLLBACK 을 반드시 선택적으로 실행
COMMIT;
--==>> 커밋 완료.
--○ TBL_SAWON 테이블에서 1005번 사원의 입사일과 급여를
-- 각각 2020-04-01, 5200 으로 변경한다.
UPDATE TBL_SAWON
SET HIREDATE = TO_DATE('2020-04-01', 'YYYY-MM-DD')
, SAL = 5200
WHERE SANO = 1005;
SELECT *
FROM TBL_SAWON;
DESC TBL_SAWON;
COMMIT;
--==>> 커밋 완료.
SELECT *
FROM TBL_INSA;
--○ TBL_INSA 테이블의 데이터 복사
CREATE TABLE TBL_INSABACKUP
AS
SELECT *
FROM TBL_INSA;
--==>> Table TBL_INSABACKUP이(가) 생성되었습니다.
-- 확인
SELECT *
FROM TBL_INSABACKUP;
--○ TBL_INSABACKUP 테이블에서
-- 직위가 과장과 부장만 수당 10% 인상
UPDATE TBL_INSABACKUP
SET SUDANG = SUDANG * 1.1
WHERE JIKWI IN ('과장', '부장');
SELECT *
FROM TBL_INSABACKUP;
COMMIT;
--==>> 커밋 완료.
--○ TBL_INSABACKUP 테이블에서
-- 전화번호가 016, 017, 018, 019 로 시작하는 전화번호인 경우
-- 이를 모두 010 으로 변경한다.
SELECT *
WHERE SUBSTR(TEL, 1, 3) IN ('016', '017', '018', '019');
--==>> 24명 조회
UPDATE TBL_INSABACKUP
SET TEL = '010' || SUBSTR(TEL, 4)
WHERE SUBSTR(TEL, 1, 3) BETWEEN '016' AND '019';
--==>> 24개 행 이(가) 업데이트되었습니다.
SELECT *
FROM TBL_INSABACKUP;
COMMIT;
--------------------------------------------------------------------------------
-- DATA DICTIONARY 뷰 종류는 총 3가지
DBA_.... --
USER_.... -- OWNER가 '나'인 객체들만 조회
ALL_.... -- SCOTT에 생성된 모든 객체
SELECT *
FROM ALL_CONSTRAINTS;
SELECT *
FROM ALL_CONS_COLUMNS;
-- 자식 테이블의 자식컬럼이 참조하는 부모테이블과 부모컬럼을 찾기 위한 SQL 형식
SELECT FK.COSNTRAINT_NAME, FK.TABLE_NAME "자식테이블", FC.COLUMN_NAME "자식컬럼"
, PK.TABLE_NAME "부모테이블", PC.COLUMN_NAME "부모컬럼"
FROM ALL_CONSTRAINTS FK, ALL_CONSTRAINTS PK, ALL_CONS_COLUMNS FC, ALL_CONS_COLUMNS PC
WHERE FK.R_CONSTRAINT_NAME = PK.CONSTRAINT_NAME
AND FK.CONSTRAINT_NAME = FC.CONSTRAINT_NAME
AND PK.CONSTRAINT_NAME = PC.CONSTRAINT_NAME
AND FK.CONSTRAINT_TYPE = 'R'
AND PK.CONSTRAINT_TYPE = 'P'
AND FK.TABLE_NAME = '자식테이블의 테이블명';
-- 자식테이블 EMP의 외래키 컬럼명에 대해 부모테이블과 부모 컬럼 찾기
SELECT FK.CONSTRAINT_NAME, FK.TABLE_NAME "자식테이블", FC.COLUMN_NAME "자식컬럼"
, PK.TABLE_NAME "부모테이블", PC.COLUMN_NAME "부모컬럼"
FROM ALL_CONSTRAINTS FK, ALL_CONSTRAINTS PK, ALL_CONS_COLUMNS FC, ALL_CONS_COLUMNS PC
WHERE FK.R_CONSTRAINT_NAME = PK.CONSTRAINT_NAME
AND FK.CONSTRAINT_NAME = FC.CONSTRAINT_NAME
AND PK.CONSTRAINT_NAME = PC.CONSTRAINT_NAME
AND FK.CONSTRAINT_TYPE = 'R'
AND PK.CONSTRAINT_TYPE = 'P'
AND FK.TABLE_NAME = 'EMP';
|
/*
Navicat Premium Data Transfer
Source Server : localhost
Source Server Type : MySQL
Source Server Version : 50726
Source Host : localhost:3306
Source Schema : phone_store
Target Server Type : MySQL
Target Server Version : 50726
File Encoding : 65001
Date: 12/04/2021 10:32:51
*/
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for buyer_address
-- ----------------------------
DROP TABLE IF EXISTS `buyer_address`;
CREATE TABLE `buyer_address` (
`address_id` int(11) NOT NULL AUTO_INCREMENT,
`buyer_name` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '买家名字',
`buyer_phone` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '买家电话',
`buyer_address` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '买家地址',
`area_code` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '地址编码',
`update_time` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '修改时间',
`create_time` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
PRIMARY KEY (`address_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 38 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '收货地址表' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of buyer_address
-- ----------------------------
INSERT INTO `buyer_address` VALUES (35, '李四', '13612344321', '北京市北京市东城区168号606室', '110101', '2021-04-07 21:24:33', '2021-04-04 12:37:58');
INSERT INTO `buyer_address` VALUES (36, '小龙', '13678787878', '广东省深圳市罗湖区科技路123号456室', '330104', '2021-04-05 13:06:26', '2021-04-05 13:04:44');
INSERT INTO `buyer_address` VALUES (37, '张三', '13678900987', '北京市北京市东城区168号306室', '110101', '2021-04-11 09:34:00', '2021-04-11 09:34:00');
-- ----------------------------
-- Table structure for order_master
-- ----------------------------
DROP TABLE IF EXISTS `order_master`;
CREATE TABLE `order_master` (
`order_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`buyer_name` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '买家名字',
`buyer_phone` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '买家电话',
`buyer_address` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '买家地址',
`phone_id` int(11) NULL DEFAULT NULL COMMENT '商品编号',
`phone_name` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '商品名称',
`phone_quantity` int(11) NULL DEFAULT NULL COMMENT '商品数量',
`phone_icon` varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '商品小图',
`specs_id` int(11) NULL DEFAULT NULL COMMENT '规格编号',
`specs_name` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '规格名称',
`specs_price` decimal(8, 2) NULL DEFAULT NULL COMMENT '规格单价',
`order_amount` decimal(8, 2) NOT NULL COMMENT '订单总金额',
`pay_status` tinyint(3) NOT NULL DEFAULT 0 COMMENT '支付状态,默认0未支付',
`create_time` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`update_time` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '修改时间',
PRIMARY KEY (`order_id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '订单表' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of order_master
-- ----------------------------
INSERT INTO `order_master` VALUES ('123456', '张三', '13678787878', '广东省深圳市罗湖区科技路123号456室', 1, 'Honor 8A', 2, '../static/e84a2e03-7f19-41d2-98a5-a5c16b7e252d.jpg', 1, '32GB', 320000.00, 6400.00, 0, '2021-04-05 13:22:55', '2021-04-05 13:22:55');
INSERT INTO `order_master` VALUES ('1617511081680952376', '洪同学', '17720762076', '福建省福州市鼓楼区福州大学至诚学院', 1, 'Honor 8A', 2, '../static/e84a2e03-7f19-41d2-98a5-a5c16b7e252d.jpg', 2, '64GB', 320000.00, 6410.00, 1, '2020-04-01 18:03:08', '2021-04-04 12:38:04');
INSERT INTO `order_master` VALUES ('1617951497013427423', '李四', '13612344321', '北京市北京市东城区168号606室', 1, 'Honor 8A', 2, '../static/e84a2e03-7f19-41d2-98a5-a5c16b7e252d.jpg', 1, '32GB', 280000.00, 5610.00, 1, '2020-04-01 18:03:08', '2021-04-09 14:58:20');
INSERT INTO `order_master` VALUES ('1617969990686695653', '张三', '13678787878', '广东省深圳市罗湖区科技路123号456室', 1, 'Honor 8A', 1, '../static/e84a2e03-7f19-41d2-98a5-a5c16b7e252d.jpg', 1, '32GB', 280000.00, 2810.00, 1, '2020-04-01 18:03:08', '2021-04-09 21:30:59');
INSERT INTO `order_master` VALUES ('1618109260007309520', '张三', '13678787878', '广东省深圳市罗湖区科技路123号456室', 1, 'Honor 8A', 1, '../static/e84a2e03-7f19-41d2-98a5-a5c16b7e252d.jpg', 1, '32GB', 280000.00, 2810.00, 0, '2020-04-01 18:03:08', '2021-04-06 21:51:56');
INSERT INTO `order_master` VALUES ('1618143514786579348', '张三', '13678900987', '北京市北京市东城区168号306室', 1, 'Honor 8A', 1, '../static/e84a2e03-7f19-41d2-98a5-a5c16b7e252d.jpg', 1, '32GB', 280000.00, 2810.00, 1, '2020-04-01 18:03:08', '2021-04-11 20:18:41');
INSERT INTO `order_master` VALUES ('1618143607104294175', '小龙', '13678787878', '广东省深圳市罗湖区科技路123号456室', 1, 'Honor 8A', 1, '../static/e84a2e03-7f19-41d2-98a5-a5c16b7e252d.jpg', 1, '32GB', 280000.00, 2810.00, 1, '2020-04-01 18:03:08', '2021-04-11 20:20:25');
INSERT INTO `order_master` VALUES ('1618193498138937094', '李四', '13612344321', '北京市北京市东城区168号606室', 1, 'Honor 8A', 3, '../static/e84a2e03-7f19-41d2-98a5-a5c16b7e252d.jpg', 2, '64GB', 320000.00, 9610.00, 1, '2020-04-01 18:03:08', '2021-04-12 10:11:43');
-- ----------------------------
-- Table structure for phone_category
-- ----------------------------
DROP TABLE IF EXISTS `phone_category`;
CREATE TABLE `phone_category` (
`category_id` int(11) NOT NULL AUTO_INCREMENT,
`category_name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '类目名称',
`category_type` int(11) NOT NULL COMMENT '类目编号',
`create_time` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`update_time` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '修改时间',
PRIMARY KEY (`category_id`) USING BTREE,
UNIQUE INDEX `uqe_category_type`(`category_type`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 5 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '类目表' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of phone_category
-- ----------------------------
INSERT INTO `phone_category` VALUES (1, '魅焰红', 1, '2020-04-01 18:39:43', '2020-04-01 20:35:54');
INSERT INTO `phone_category` VALUES (2, '极光蓝', 2, '2020-04-01 18:39:43', '2020-04-01 20:35:54');
INSERT INTO `phone_category` VALUES (3, '铂光金', 3, '2020-04-01 18:39:43', '2020-04-01 20:35:54');
INSERT INTO `phone_category` VALUES (4, '幻夜黑', 4, '2020-04-01 18:39:43', '2020-04-01 20:35:54');
-- ----------------------------
-- Table structure for phone_info
-- ----------------------------
DROP TABLE IF EXISTS `phone_info`;
CREATE TABLE `phone_info` (
`phone_id` int(11) NOT NULL AUTO_INCREMENT,
`phone_name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '商品名称',
`phone_price` decimal(8, 2) NOT NULL COMMENT '商品单价',
`phone_description` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '描述',
`phone_stock` int(11) NOT NULL COMMENT '库存',
`phone_icon` varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '小图',
`category_type` int(11) NOT NULL COMMENT '类目编号',
`create_time` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`update_time` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '修改时间',
`phone_tag` varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '标签',
PRIMARY KEY (`phone_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 20 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '商品表' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of phone_info
-- ----------------------------
INSERT INTO `phone_info` VALUES (1, 'Honor 8A', 2800.00, '魅焰红', 90, '../static/e84a2e03-7f19-41d2-98a5-a5c16b7e252d.jpg', 1, '2020-04-01 18:03:08', '2021-04-06 21:51:56', '720P珍珠屏&Micro USB接口');
INSERT INTO `phone_info` VALUES (2, 'Honor 10 青春版', 2800.00, '极光蓝', 100, '../static/8f0bd0d0-a11e-4185-927e-04b54ff4a1bd.jpg', 2, '2020-04-01 18:03:08', '2020-04-01 22:30:42', '720P珍珠屏&EMUI9 Lite');
INSERT INTO `phone_info` VALUES (3, 'Honor V20', 3450.00, '铂光金', 100, '../static/fd7fee3c-a35c-477b-b007-9fda6e9c589a.jpg', 3, '2020-04-01 18:14:54', '2020-04-01 22:30:42', '2+1独立三卡槽');
INSERT INTO `phone_info` VALUES (4, 'HUAWEI Mate 20 Pro', 4550.00, '幻夜黑', 100, '../static/cb819ad9-ec6f-4123-a4e9-aa629e2f8224.jpg', 4, '2020-04-01 18:14:54', '2020-04-01 22:30:42', '内存3GB&EMUI9 Lite');
INSERT INTO `phone_info` VALUES (5, 'HUAWEI nova 5 Pro', 5450.00, '魅焰红', 100, '../static/8a0f5be0-3c78-4f23-b58b-dc2a92f1f95a.jpg', 1, '2020-04-01 18:14:54', '2020-04-01 22:30:42', '内存3GB&Micro USB接口');
INSERT INTO `phone_info` VALUES (6, 'HUAWEI P30', 8700.00, '极光蓝', 100, '../static/6dcad185-315f-40f0-87f2-52910f49c8b7.jpg', 2, '2020-04-01 18:14:54', '2020-04-01 22:30:42', '720P珍珠屏&内存3GB');
INSERT INTO `phone_info` VALUES (7, 'HUAWEI P30 Pro', 8988.00, '铂光金', 100, '../static/b12a46a9-3738-49ab-ab3a-6878539bd76b.jpg', 3, '2020-04-01 18:14:54', '2020-04-01 22:30:42', '720P珍珠屏&Micro USB接口');
INSERT INTO `phone_info` VALUES (8, 'HUAWEI 畅想9 Plus', 2760.00, '幻夜黑', 100, '../static/15a5dcf2-4b50-41a0-93e8-08df97c21341.jpg', 4, '2020-04-01 18:14:54', '2020-04-01 22:30:42', '内存3GB&存储32GB');
INSERT INTO `phone_info` VALUES (9, 'SAMSUNG G S10', 7254.00, '魅焰红', 100, '../static/a4f0cef8-59da-4f7c-abfa-d373f6648035.jpg', 1, '2020-04-01 18:14:54', '2020-04-01 22:30:42', '720P珍珠屏&存储32GB');
INSERT INTO `phone_info` VALUES (10, 'OPPO K3', 2889.00, '极光蓝', 100, '../static/efc31538-a1f0-4dba-a673-4369f17e5708.jpg', 2, '2020-04-01 18:14:54', '2020-04-01 22:30:42', '存储32GB&Micro USB接口');
INSERT INTO `phone_info` VALUES (11, 'Iphone XR', 9888.00, '铂光金', 100, '../static/4ef5a3c0-ad88-495f-a6bc-a31c1dde667b.jpg', 3, '2020-04-01 18:14:54', '2020-04-01 22:30:42', '1300万像素&Micro USB接口');
INSERT INTO `phone_info` VALUES (12, 'MI 8', 5888.00, '幻夜黑', 100, '../static/aff8224c-3196-42a9-ae9e-4f06e20555c4.jpg', 4, '2020-04-01 18:14:54', '2020-04-01 22:30:42', '内存3GB&存储32GB');
INSERT INTO `phone_info` VALUES (13, 'VIVO X27', 2888.00, '魅焰红', 100, '../static/cdf065ec-e409-4204-93e6-600e172e461a.jpg', 1, '2020-04-01 18:14:54', '2020-04-01 22:30:42', 'F/1.8光圈&Micro USB接口');
INSERT INTO `phone_info` VALUES (14, 'Iphone 6', 5678.00, '极光蓝', 100, '../static/899a9c64-62d0-416d-b320-e730b4585cb0.jpg', 2, '2020-04-01 18:14:54', '2020-04-01 22:30:42', '720P珍珠屏&F/1.8光圈');
INSERT INTO `phone_info` VALUES (15, 'Iphone 7', 5576.00, '铂光金', 100, '../static/67aa6e9b-681f-4a6f-aae4-97eb3ec51b08.jpg', 3, '2020-04-01 18:14:54', '2020-04-01 22:30:42', '720P珍珠屏&1300万像素');
INSERT INTO `phone_info` VALUES (16, 'Iphone 8', 6212.00, '幻夜黑', 100, '../static/a8b5b846-7fbb-4e7b-abcf-01ae73979000.jpg', 4, '2020-04-01 18:14:54', '2020-04-01 22:30:42', '内存3GB&F/1.8光圈');
INSERT INTO `phone_info` VALUES (17, 'Meizu 16s', 1220.00, '魅焰红', 100, '../static/1a2b8e30-6e98-405f-9a18-9cd31ff96c35.jpg', 1, '2020-04-01 18:14:54', '2020-04-01 22:30:42', '720P珍珠屏&Micro USB接口');
INSERT INTO `phone_info` VALUES (18, 'Iphone X', 6770.00, '极光蓝', 100, '../static/39197368-aeaf-48ea-b399-5ad65f7b6c47.jpg', 2, '2020-04-01 18:14:54', '2020-04-01 22:30:42', 'F/1.8光圈&Micro USB接口');
INSERT INTO `phone_info` VALUES (19, 'HUAWEI P20', 5580.00, '铂光金', 100, '../static/f382351b-7fc8-4b34-bcce-162085e75191.jpg', 3, '2020-04-01 18:14:54', '2020-04-01 22:30:42', '1300万像素&Micro USB接口');
-- ----------------------------
-- Table structure for phone_specs
-- ----------------------------
DROP TABLE IF EXISTS `phone_specs`;
CREATE TABLE `phone_specs` (
`specs_id` int(11) NOT NULL AUTO_INCREMENT,
`phone_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`specs_name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '规格名称',
`specs_stock` int(11) NOT NULL COMMENT '库存',
`specs_price` decimal(8, 2) NOT NULL COMMENT '单价',
`specs_icon` varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '小图',
`specs_preview` varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '预览图',
`update_time` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '修改时间',
`create_time` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
PRIMARY KEY (`specs_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '商品规格表' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of phone_specs
-- ----------------------------
INSERT INTO `phone_specs` VALUES (1, '1', '32GB', 99999, 280000.00, '../static/e84a2e03-7f19-41d2-98a5-a5c16b7e252d.jpg', '../static/e84a2e03-7f19-41d2-98a5-a5c16b7e252d.jpg', '2021-04-12 10:10:05', '2020-04-01 22:16:36');
INSERT INTO `phone_specs` VALUES (2, '1', '64GB', 88885, 320000.00, '../static/e84a2e03-7f19-41d2-98a5-a5c16b7e252d.jpg', '../static/e84a2e03-7f19-41d2-98a5-a5c16b7e252d.jpg', '2021-04-12 10:10:09', '2020-04-01 22:16:36');
SET FOREIGN_KEY_CHECKS = 1;
|
CREATE TABLE usuario (
email VARCHAR(100) primary key,
senha varchar(255) not null,
codigo_grupo BIGINT
);
alter table farmaceutico add column email_usuario VARCHAR(100) not null;
alter table farmaceutico add constraint email_fk foreign key(email_usuario) references usuario(email); |
CREATE TABLE ships (
ship TEXT NOT NULL PRIMARY KEY,
weapon TEXT NOT NULL,
hull TEXT NOT NULL,
engine TEXT NOT NULL,
FOREIGN KEY(weapon) REFERENCES weapons(weapon),
FOREIGN KEY(hull) REFERENCES hulls(hull),
FOREIGN KEY(engine) REFERENCES engines(engine)
);
CREATE TABLE engines (
engine TEXT NOT NULL PRIMARY KEY,
power INTEGER NOT NULL,
type INTEGER NOT NULL
);
CREATE TABLE hulls (
hull TEXT NOT NULL PRIMARY KEY,
armor INTEGER NOT NULL,
type INTEGER NOT NULL,
capacity INTEGER NOT NULL
);
CREATE TABLE weapons (
weapon TEXT NOT NULL PRIMARY KEY,
reload_speed INTEGER NOT NULL,
rotational_speed INTEGER NOT NULL,
diameter INTEGER NOT NULL,
power_volley INTEGER NOT NULL,
count INTEGER NOT NULL
);
|
\encoding UTF8;
SET client_min_messages TO WARNING;
CREATE TABLE app.com_gruppo_cliente
(
id SERIAL NOT NULL PRIMARY KEY,
descrizione VARCHAR(255) NOT NULL
);
CREATE TABLE app.com_divisa
(
id SERIAL NOT NULL PRIMARY KEY,
simbolo VARCHAR(255),
iso_alpha VARCHAR(3),
iso_num NUMERIC(3),
descrizione VARCHAR(255) NOT NULL
);
CREATE TABLE app.com_tipo_business_partner
(
id SERIAL NOT NULL PRIMARY KEY,
descrizione VARCHAR(255) NOT NULL
);
CREATE TABLE app.com_cliente
(
id SERIAL NOT NULL PRIMARY KEY,
codice VARCHAR(255) NOT NULL,
ragione_sociale VARCHAR(1024) NOT NULL,
partita_iva VARCHAR(50),
codice_fiscale VARCHAR(50),
gruppo_cliente_id INTEGER REFERENCES app.com_gruppo_cliente(id),
divisa_id INTEGER REFERENCES app.com_divisa(id),
telefono_1 VARCHAR(255),
telefono_2 VARCHAR(255),
cellulare VARCHAR(255),
fax VARCHAR(255),
email VARCHAR(255),
attivo BOOLEAN NOT NULL,
attivo_dal_ts TIMESTAMP WITH TIME ZONE,
attivo_al_ts TIMESTAMP WITH TIME ZONE,
attivo_note VARCHAR(1024),
bloccato BOOLEAN NOT NULL,
bloccato_dal_ts TIMESTAMP WITH TIME ZONE,
bloccato_al_ts TIMESTAMP WITH TIME ZONE,
bloccato_note VARCHAR(1024),
tipo_business_partner_id INTEGER REFERENCES app.com_tipo_business_partner(id),
saldo_contabile NUMERIC(18, 4),
creazione_ts TIMESTAMP WITH TIME ZONE,
ultima_modifica_ts TIMESTAMP WITH TIME ZONE
);
|
UPDATE
fdmail
SET
del_s = 1
WHERE
id = ?
AND sndr = ?
|
set names utf8;
set foreign_key_checks = 0;
USE overflowing;
update challenge set
description = "We are born in society. It's natural to communicate with people.\r\nStart a conversation with random completely strangers."
where challenge_name = "Have A Conversation With Strangers";
update challenge set
challenge_name = "Try Foods You Have Never Eaten"
where description = "At grocery store, pick ingredients you had never eaten.At restaurant, order something you had never tried."; |
-- MySQL dump 10.13 Distrib 5.7.29, for Linux (x86_64)
--
-- Host: localhost Database: fa2
-- ------------------------------------------------------
-- Server version 5.7.29
/*!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 `base`
--
DROP TABLE IF EXISTS `base`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `base` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`status` int(11) NOT NULL DEFAULT '1',
`is_free` int(11) NOT NULL DEFAULT '1',
`limitSize` int(11) DEFAULT '15',
`timelim` int(11) DEFAULT '1',
`totlim` int(11) DEFAULT '100',
`deptit` varchar(100) DEFAULT NULL,
`create_time` int(11) DEFAULT NULL,
`update_time` int(11) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `base`
--
LOCK TABLES `base` WRITE;
/*!40000 ALTER TABLE `base` DISABLE KEYS */;
INSERT INTO `base` VALUES (1,1,1,15,1,250,' 发种机v2.0,',1594458047,1594458047);
/*!40000 ALTER TABLE `base` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `pt`
--
DROP TABLE IF EXISTS `pt`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `pt` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`status` int(11) NOT NULL DEFAULT '1',
`name` varchar(55) DEFAULT NULL,
`mod` int(11) DEFAULT '0',
`is_get` int(11) DEFAULT '0',
`is_dow` int(11) DEFAULT '0',
`is_pos` int(11) DEFAULT '0',
`host` varchar(255) DEFAULT NULL,
`passkey` varchar(255) DEFAULT NULL,
`logindata` varchar(300) DEFAULT NULL,
`cookie` varchar(255) DEFAULT NULL,
`cookietime` int(11) DEFAULT '0',
`create_time` int(11) DEFAULT NULL,
`update_time` int(11) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=6 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `pt`
--
--
-- Table structure for table `tor`
--
DROP TABLE IF EXISTS `tor`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `tor` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`id1` int(11) DEFAULT NULL,
`id2` int(11) DEFAULT NULL,
`hash1` varchar(255) DEFAULT NULL,
`name` varchar(1000) DEFAULT NULL,
`time` bigint(12) DEFAULT NULL,
`size` float(11,2) DEFAULT NULL,
`status` int(11) DEFAULT '0',
`descr` varchar(10000) DEFAULT '',
`ref` int(11) DEFAULT NULL,
`create_time` int(11) DEFAULT NULL,
`update_time` int(11) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `id1` (`id1`)
) ENGINE=MyISAM AUTO_INCREMENT=5985 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `tor`
--
/*!40000 ALTER TABLE `tor` DISABLE KEYS */;
/*!40000 ALTER TABLE `tor` ENABLE KEYS */;
/*!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 2020-11-03 19:47:21
|
-- TITLE1:
-- TITLE2: Viewing the Capture Processes for the LCRs in Each Buffered Queue
-- DESC:
COLUMN SENDER_NAME HEADING 'Capture|Process' FORMAT A10
COLUMN SENDER_ADDRESS HEADING 'Sender Queue' FORMAT A15
COLUMN QUEUE_NAME HEADING 'Queue Name' FORMAT A10
COLUMN CNUM_MSGS HEADING 'Number|of LCRs|Enqueued' FORMAT 99999999
COLUMN LAST_ENQUEUED_MSG HEADING 'Last|Enqueued|LCR' FORMAT 9999999999
COLUMN MEMORY_USAGE HEADING 'Percent|Streams|Pool|Used' FORMAT 999
COLUMN PUBLISHER_STATE HEADING 'Publisher|State' FORMAT A10
SELECT SENDER_NAME,
SENDER_ADDRESS,
QUEUE_NAME,
CNUM_MSGS,
LAST_ENQUEUED_MSG,
MEMORY_USAGE,
PUBLISHER_STATE
FROM V$BUFFERED_PUBLISHERS;
|
SELECT
'GL' SRCE,
ACCT,
PERD,
MODULE,
CUSMOD,
BATCH,
CUSKEY4 PART,
SUM(AMT) AMTGL,
0.0 AMTQOH
FROM
QGPL.FFSBGLR1
WHERE
MODULE = 'ICIT' AND
PERD = '1603' AND
SUBSTR(ACCT,7,4) IN ('1200','1220')
GROUP BY
ACCT,
PERD,
MODULE,
CUSMOD,
BATCH,
CUSKEY4
UNION ALL
SELECT
'GL' SRCE,
ACCT,
PERD,
MODULE,
CUSMOD,
BATCH,
CUSKEY1 PART,
SUM(AMT) AMTGL,
0.0 AMTQOH
FROM
QGPL.FFSBGLR1
WHERE
MODULE = 'IC' AND
PERD = '1603' AND
SUBSTR(ACCT,7,4) IN ('1200','1220')
GROUP BY
ACCT,
PERD,
MODULE,
CUSMOD,
BATCH,
CUSKEY1
UNION ALL
SELECT
'QOH' SRCE,
YACOMP||Y1INVA AS ACCT,
SUBSTR(DIGITS(BYFSYY),3,2)||DIGITS(BYFSPR) PERD,
BYSRC MODULE,
RTRIM(BYSRC)||UPPER(SUBSTRING(BYDREF,1,3)) CUSMOD,
BYJREF BATCH,
BYPART PART,
0.0 AMTGL,
sum(BYQTY*CASE BYACTN WHEN 'I' THEN -1 ELSE 1 END*COALESCE(FCOST, CGSTCS, CHSTCS, Y0STCS)) AS AMTQOH
FROM
LGDAT.STKT STKT
LEFT OUTER JOIN LGDAT.ICSTP P ON
CHPART = STKT.BYPART AND
CHPLNT = STKT.BYPLNT
LEFT OUTER JOIN LGDAT.ICSTM M ON
CGPART = STKT.BYPART AND
CGPLNT = STKT.BYPLNT
LEFT OUTER JOIN LGDAT.ICSTR R ON
Y0PART = STKT.BYPART AND
Y0PLNT = STKT.BYPLNT
LEFT OUTER JOIN LGDAT.STKMP MP ON
MP.AWPART = BYPART
LEFT OUTER JOIN LGDAT.STKMM MM ON
MM.AVPART = BYPART
LEFT OUTER JOIN LGDAT.GLIE A ON
Y1GLEC = COALESCE(AVGLED, AWGLED) AND
Y1PLNT = BYPLNT
LEFT OUTER JOIN LGDAT.PLNT L ON
YAPLNT = BYPLNT
LEFT OUTER JOIN QGPL.FFCOSTEFFD ON
PART = BYPART AND
PLNT = BYPLNT AND
CHAR(FDT)||CHAR(FTM) < CHAR(BYSDAT)||CHAR(BYSTIM) AND
CHAR(TDT)||CHAR(TTM) > CHAR(BYSDAT)||CHAR(BYSTIM)
WHERE
BYFSYY = 2016 AND
BYFSPR = 3 AND
BYACTN IN ('I','R') AND
BYSRC = 'OE ' AND
UPPER(SUBSTRING(BYDREF,1,3)) = 'TRF'
GROUP BY
YACOMP||Y1INVA,
SUBSTR(DIGITS(BYFSYY),3,2)||DIGITS(BYFSPR),
BYSRC,
RTRIM(BYSRC)||UPPER(SUBSTRING(BYDREF,1,3)),
BYJREF,
BYPART
UNION ALL
SELECT
'QOH' SRCE,
YACOMP||Y1INVA AS ACCT,
SUBSTR(DIGITS(BYFSYY),3,2)||DIGITS(BYFSPR) PERD,
BYSRC MODULE,
RTRIM(BYSRC)||BYREAS CUSMOD,
BYJREF BATCH,
BYPART PART,
0.0 AMTGL,
SUM(BYQTY*CASE BYACTN WHEN 'I' THEN -1 ELSE 1 END*COALESCE(FCOST, CGSTCS, CHSTCS, Y0STCS)) AS AMTQOH
FROM
LGDAT.STKT STKT
LEFT OUTER JOIN LGDAT.ICSTP P ON
CHPART = STKT.BYPART AND
CHPLNT = STKT.BYPLNT
LEFT OUTER JOIN LGDAT.ICSTM M ON
CGPART = STKT.BYPART AND
CGPLNT = STKT.BYPLNT
LEFT OUTER JOIN LGDAT.ICSTR R ON
Y0PART = STKT.BYPART AND
Y0PLNT = STKT.BYPLNT
LEFT OUTER JOIN LGDAT.STKMP MP ON
MP.AWPART = BYPART
LEFT OUTER JOIN LGDAT.STKMM MM ON
MM.AVPART = BYPART
LEFT OUTER JOIN LGDAT.GLIE A ON
Y1GLEC = COALESCE(AVGLED, AWGLED) AND
Y1PLNT = BYPLNT
LEFT OUTER JOIN LGDAT.PLNT L ON
YAPLNT = BYPLNT
LEFT OUTER JOIN QGPL.FFCOSTEFFD ON
PART = BYPART AND
PLNT = BYPLNT AND
CHAR(FDT)||CHAR(FTM) < CHAR(BYSDAT)||CHAR(BYSTIM) AND
CHAR(TDT)||CHAR(TTM) > CHAR(BYSDAT)||CHAR(BYSTIM)
WHERE
BYFSYY = 2016 AND
BYFSPR = 3 AND
BYACTN IN ('I','R') AND
BYSRC = 'INV'
GROUP BY
YACOMP||Y1INVA,
SUBSTR(DIGITS(BYFSYY),3,2)||DIGITS(BYFSPR),
BYSRC,
RTRIM(BYSRC)||BYREAS,
BYJREF,
BYPART
UNION ALL
SELECT
'QOH' SRCE,
YACOMP||Y1INVA AS ACCT,
SUBSTR(DIGITS(BYFSYY),3,2)||DIGITS(BYFSPR) PERD,
BYSRC MODULE,
RTRIM(BYSRC)||BYREAS CUSMOD,
BYJREF BATCH,
BYPART PART,
0.0 AMTGL,
SUM(BYQTY*CASE BYACTN WHEN 'I' THEN -1 ELSE 1 END*COALESCE(FCOST, CGSTCS, CHSTCS, Y0STCS)) AS AMTQOH
FROM
LGDAT.STKT STKT
LEFT OUTER JOIN LGDAT.ICSTP P ON
CHPART = STKT.BYPART AND
CHPLNT = STKT.BYPLNT
LEFT OUTER JOIN LGDAT.ICSTM M ON
CGPART = STKT.BYPART AND
CGPLNT = STKT.BYPLNT
LEFT OUTER JOIN LGDAT.ICSTR R ON
Y0PART = STKT.BYPART AND
Y0PLNT = STKT.BYPLNT
LEFT OUTER JOIN LGDAT.STKMP MP ON
MP.AWPART = BYPART
LEFT OUTER JOIN LGDAT.STKMM MM ON
MM.AVPART = BYPART
LEFT OUTER JOIN LGDAT.GLIE A ON
Y1GLEC = COALESCE(AVGLED, AWGLED) AND
Y1PLNT = BYPLNT
LEFT OUTER JOIN LGDAT.PLNT L ON
YAPLNT = BYPLNT
LEFT OUTER JOIN QGPL.FFCOSTEFFD ON
PART = BYPART AND
PLNT = BYPLNT AND
CHAR(FDT)||CHAR(FTM) < CHAR(BYSDAT)||CHAR(BYSTIM) AND
CHAR(TDT)||CHAR(TTM) > CHAR(BYSDAT)||CHAR(BYSTIM)
WHERE
BYFSYY = 2016 AND
BYFSPR = 3 AND
BYACTN IN ('I','R') AND
BYSRC = 'PHY'
GROUP BY
YACOMP||Y1INVA,
SUBSTR(DIGITS(BYFSYY),3,2)||DIGITS(BYFSPR),
BYSRC,
RTRIM(BYSRC)||BYREAS,
BYJREF,
BYPART |
-- Update alert_cause prefix
-- Auther: Jackie vndwbwan@cn.ibm.com
-- Description: Please make sure to update TRAILSPD and the replication scripts for TRAILSRP && TRAILSST will do automatic data update for alert_cause db table
-- Rule: Given the Cause Codes with the Prefix '1'
-- The prefixes should be migrated to "SOM1a"
-- Given the Cause Codes with the Prefix '2'
-- The prefixes should be migrated to "SOM2a"
-- Given the Cause Codes with the Prefix '3'
-- The prefixes should be migrated to "SOM2b"
-- Given the Cause Codes with the Prefix '4'
-- The prefixes should be migrated to "SOM2c"
-- Given the Cause Codes with the Prefix '5'
-- They should be migrated to "SOM4a"
-- Given the Cause Codes with the Prefix '5+6'
-- They should be migrated to "SOM4x"
UPDATE EAADMIN.ALERT_CAUSE SET NAME=(
CASE
WHEN LEFT(NAME,1) = '1' THEN 'SOM1a' || RIGHT(NAME,LENGTH(NAME)-1)
WHEN LEFT(NAME,1) = '2' THEN 'SOM2a' || RIGHT(NAME,LENGTH(NAME)-1)
WHEN LEFT(NAME,1) = '3' THEN 'SOM2b' || RIGHT(NAME,LENGTH(NAME)-1)
WHEN LEFT(NAME,1) = '4' THEN 'SOM2c' || RIGHT(NAME,LENGTH(NAME)-1)
WHEN LEFT(NAME,1) = '5' AND LEFT(NAME,3) <> '5+6' THEN 'SOM4a' || RIGHT(NAME,LENGTH(NAME)-1)
WHEN LEFT(NAME,3) = '5+6' THEN 'SOM4x' || RIGHT(NAME,LENGTH(NAME)-3)
ELSE NAME
END
)
|
CREATE TABLE Instance (
id INT PRIMARY KEY AUTO_INCREMENT,
model_id INT NOT NULL,
FOREIGN KEY (model_id) REFERENCES Gun (id)
);
INSERT INTO Instance (model_id) VALUES (1);
INSERT INTO Instance (model_id) VALUES (1);
INSERT INTO Instance (model_id) VALUES (1);
INSERT INTO Instance (model_id) VALUES (1);
INSERT INTO Instance (model_id) VALUES (1);
INSERT INTO Instance (model_id) VALUES (1);
INSERT INTO Instance (model_id) VALUES (2);
INSERT INTO Instance (model_id) VALUES (2);
INSERT INTO Instance (model_id) VALUES (2);
INSERT INTO Instance (model_id) VALUES (2);
INSERT INTO Instance (model_id) VALUES (3);
INSERT INTO Instance (model_id) VALUES (3);
INSERT INTO Instance (model_id) VALUES (4);
INSERT INTO Instance (model_id) VALUES (4);
INSERT INTO Instance (model_id) VALUES (4);
INSERT INTO Instance (model_id) VALUES (4);
INSERT INTO Instance (model_id) VALUES (4);
INSERT INTO Instance (model_id) VALUES (4);
INSERT INTO Instance (model_id) VALUES (4);
INSERT INTO Instance (model_id) VALUES (4);
INSERT INTO Instance (model_id) VALUES (5);
INSERT INTO Instance (model_id) VALUES (5);
INSERT INTO Instance (model_id) VALUES (5);
INSERT INTO Instance (model_id) VALUES (5);
INSERT INTO Instance (model_id) VALUES (5); |
Create Procedure sp_get_MailInfo (@MailID int)
As
Select CustomerID, VendorID, Message, CreationDate, DocPrefix + Cast(DocumentID As nvarchar),
Subject From MailMessage Where ID = @MailID
|
-- AQ test tables for OCI*ML
--
-- Need AQ_ADMINISTRATOR_ROLE and EXECUTE on DBMS_AQ for this to work
--
-- typed queue
create type message_t as object (
message_id integer,
message_text varchar2(80));
/
begin
dbms_aqadm.create_queue_table (
queue_table => 'tbl_message_queue',
queue_payload_type => 'message_t');
dbms_aqadm.create_queue (
queue_name => 'message_queue',
queue_table => 'tbl_message_queue');
dbms_aqadm.start_queue (
queue_name => 'message_queue');
end;
/
create type int2_t as object (int1 integer, int2 integer);
/
begin
dbms_aqadm.create_queue_table (
queue_table => 'tbl_int2_queue',
queue_payload_type => 'int2_t');
dbms_aqadm.create_queue (
queue_name => 'int2_queue',
queue_table => 'tbl_int2_queue');
dbms_aqadm.start_queue (
queue_name => 'int2_queue');
end;
/
-- raw queue
begin
dbms_aqadm.create_queue_table (
queue_table => 'tbl_image_queue',
queue_payload_type => 'RAW');
dbms_aqadm.create_queue (
queue_name => 'image_queue',
queue_table => 'tbl_image_queue');
dbms_aqadm.start_queue (
queue_name => 'image_queue');
end;
/
-- end of file |
Working with dates and timestamps |
USE productmanagementdb2;
-- products
INSERT INTO products VALUES
(1, 'Galaxy ','Samsung','Android',550),
(2, 'iPhone5','Apple','iOS',700),
(3, 'GE 60 2PE Apache Pro','MSI','Gaming Notebook',1300),
(4, 'Remi Note 3 Pro','Xiaomi','Android',250),
(5, 'Play Station 4','Sony','Gaming Console',350),
(6, 'MOTO G4','Motorola','Android',180),
(7, 'MacBook Air 13\" (MMGF2UA/A) ','Apple','Notebook',1000),
(8, 'X9 mini','Doogee','Android',80),
(9, 'M3 Note16Gb ','Meizu ','Android',210),
(10,'M5 Note 16 Gb','Meizu ','Android',220);
-- users
INSERT INTO users VALUES
/*original password for admin and user: '12345678' */
(1, 'Admin', '$2a$11$smEyFewSCrtmlNUSgNq5H.1V0WT5w7tM8geL.WV4WsjFuzlEMU2Ty', 'ADMIN', FALSE),
(2, 'User', '$2a$11$RJMC5HReOOWjjgvYXFcMHOtJ0A7jf9FSKkPrttTWu0.cDHSkyHWyO', 'USER', FALSE), |
-- DDL:Create database item_stock
CREATE TABLE item_stock(
repository_id CHAR(4) NOT NULL,
item_id CHAR(4) NOT NULL,
stock INTEGER NOT NULL,
PRIMARY KEY (repository_id, item_id)
);
-- DML Register data
BEGIN TRANSACTION;
INSERT INTO item_stock VALUES ('S001', '0001', 0);
INSERT INTO item_stock VALUES ('S001', '0002', 120);
INSERT INTO item_stock VALUES ('S001', '0003', 200);
INSERT INTO item_stock VALUES ('S001', '0004', 3);
INSERT INTO item_stock VALUES ('S001', '0005', 0);
INSERT INTO item_stock VALUES ('S001', '0006', 99);
INSERT INTO item_stock VALUES ('S001', '0007', 999);
INSERT INTO item_stock VALUES ('S001', '0008', 200);
INSERT INTO item_stock VALUES ('S002', '0001', 10);
INSERT INTO item_stock VALUES ('S002', '0002', 25);
INSERT INTO item_stock VALUES ('S002', '0003', 34);
INSERT INTO item_stock VALUES ('S002', '0004', 19);
INSERT INTO item_stock VALUES ('S002', '0005', 99);
INSERT INTO item_stock VALUES ('S002', '0006', 0);
INSERT INTO item_stock VALUES ('S002', '0007', 0);
INSERT INTO item_stock VALUES ('S002', '0008', 18);
COMMIT; |
-- DROP TABLE IF EXISTS products;
--
-- CREATE TABLE customers (
-- customer_id VARCHAR(100) PRIMARY KEY NOT NULL,
-- personal_Id_number INT NOT NULL,
-- full_name TEXT NOT NULL,
-- address TEXT,
-- phone_number INT
-- );
-- INSERT INTO customers (customer_id, personal_Id_number, full_name, address, phone_number)
-- VALUES('e254f8c-c442-4ebe-a82a-e2fc1d1ff78a', 7913911, 'Marco Antonio Cadima De La Via', 'Moxos Street #888', 76490946); |
ALTER TABLE `app_users`
ADD COLUMN `last_login_datetime` DATETIME NULL AFTER `wall_message`,
ADD COLUMN `last_login_ip` VARCHAR(16) NULL AFTER `last_login_datetime`; |
-- phpMyAdmin SQL Dump
-- version 3.3.8.1
-- http://www.phpmyadmin.net
--
-- Host: sql
-- Erstellungszeit: 10. Januar 2013 um 05:30
-- Server Version: 5.1.66
-- PHP-Version: 5.3.8
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
/*!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 */;
--
-- Datenbank: `u_fschulenburg`
--
-- --------------------------------------------------------
--
-- Tabellenstruktur für Tabelle `courses`
--
CREATE TABLE IF NOT EXISTS `courses` (
`course_id` int(11) NOT NULL AUTO_INCREMENT,
`course_coursename` text NOT NULL,
`course_instructor` text NOT NULL,
`course_university_id` int(11) NOT NULL,
`course_language` text NOT NULL,
`course_year` text NOT NULL,
`course_term` text NOT NULL,
`course_startdate` text NOT NULL,
`course_enddate` text NOT NULL,
PRIMARY KEY (`course_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=205 ;
--
-- Daten für Tabelle `courses`
--
INSERT INTO `courses` (`course_id`, `course_coursename`, `course_instructor`, `course_university_id`, `course_language`, `course_year`, `course_term`, `course_startdate`, `course_enddate`) VALUES
(1, 'Policy Analysis', 'Donna Infeld', 1, 'en', '2010', 'fall', '20100901', ''),
(2, 'Policy Analysis', 'Peter Linquiti', 1, 'en', '2010', 'fall', '20100901', ''),
(3, 'Theorizing Culture and Politics', 'Rochelle Davis', 2, 'en', '2010', 'fall', '20100901', ''),
(4, 'Introduction to the Study of the Arab World', 'Rochelle Davis', 2, 'en', '2010', 'fall', '20100901', ''),
(5, 'Media, Politics and Power in the Digital Age', 'Nicco Mele', 3, 'en', '2010', 'fall', '20100901', ''),
(6, 'Seminar in Urban Economic Development', 'Barry Rubin', 4, 'en', '2010', 'fall', '20100901', ''),
(7, 'Political Economy of Technology and Science', 'Jeffrey Tang', 5, 'en', '2010', 'fall', '20100901', ''),
(8, 'Seminar in Intervention', 'Chaim Kaufmann', 6, 'en', '2010', 'fall', '20100901', ''),
(9, 'Wikipedia and Public Policy', 'Carol Dwyer', 7, 'en', '2010', 'fall', '20100901', ''),
(10, 'Intellectual Property Law for the Information Industries', 'Brian Carver', 8, 'en', '2010', 'fall', '20100901', ''),
(11, 'Politics of Piracy', 'Max Klein and Matt Senate', 8, 'en', '2010', 'fall', '20100901', ''),
(12, 'Arab Media', 'Adel Iskandar', 2, 'en', '2011', 'spring', '20110131', ''),
(13, 'Refugees in the Arab World', 'Rochelle Davis', 2, 'en', '2011', 'spring', '20110131', ''),
(14, 'Women and Human Rights', 'Robin Kelley', 2, 'en', '2011', 'spring', '20110131', ''),
(15, 'International Trade and Strategy', 'Anh Tran', 4, 'en', '2011', 'spring', '20110131', ''),
(16, 'Approaches to Development', 'Anh Tran', 4, 'en', '2011', 'spring', '20110131', ''),
(17, 'Energy Economics and Politics, Environmental Economics and Policy', 'Ken Richards', 4, 'en', '2011', 'spring', '20110131', ''),
(18, 'Energy Economics and Policy', 'Maria Papadakis', 5, 'en', '2011', 'spring', '20110131', ''),
(19, 'Professional and Technical Editing', 'Cindy Allen', 5, 'en', '2011', 'spring', '20110131', ''),
(20, 'Advanced Seminar in Political Communication', 'Robert Mann', 9, 'en', '2011', 'spring', '20110131', ''),
(22, 'Telecommunication Policy Analysis', 'Johannes Bauer', 10, 'en', '2011', 'spring', '20110131', ''),
(23, 'Media and Telecommunication Policy', 'Jonathan Obar', 10, 'en', '2011', 'spring', '20110131', ''),
(24, 'Federal Indian Law and Policy', 'Kristin Ruppel', 11, 'en', '2011', 'spring', '20110131', ''),
(25, 'Copyright, Commerce, and Culture', 'Evan Hill-Ries', 12, 'en', '2011', 'spring', '20110131', ''),
(26, 'Environmental Policy', 'Sheldon Gen', 13, 'en', '2011', 'spring', '20110131', ''),
(27, 'Advertising and Marketing Law', 'Eric Goldman', 14, 'en', '2011', 'spring', '20110131', ''),
(28, 'Public Relations Seminar', 'Marlene Fine', 15, 'en', '2011', 'spring', '20110131', ''),
(29, 'Wikipedia and Public Policy', 'Carol Dwyer', 7, 'en', '2011', 'spring', '20110131', ''),
(30, 'Transnational NGOs in World Affairs', 'George Mitchell', 7, 'en', '2011', 'spring', '20110131', ''),
(31, 'Seminary in Public Affairs', 'Byron E. Price', 16, 'en', '2011', 'spring', '20110131', ''),
(33, 'Public Policy Making', 'Ellen Rosell', 17, 'en', '2011', 'spring', '20110131', ''),
(34, 'Cyberlaw', 'Brian Carver', 8, 'en', '2011', 'spring', '20110131', ''),
(35, 'Politics of Piracy', 'Max Klein and Patrick Berger', 8, 'en', '2011', 'spring', '20110131', ''),
(36, 'Economics of Public Policy', 'Eugenia Toma', 18, 'en', '2011', 'spring', '20110131', ''),
(37, 'Environmental Law', 'Aaron Frank', 19, 'en', '2011', 'spring', '20110131', ''),
(38, 'Public Policy Design and Evaluation', 'Matt Dull', 20, 'en', '2011', 'spring', '20110131', ''),
(39, 'Policy Analysis', 'Christopher Cooper', 21, 'en', '2011', 'spring', '20110131', ''),
(40, 'Political Research Seminar', 'Kara Lindaman', 22, 'en', '2011', 'spring', '20110131', ''),
(41, 'Business Data Communication', 'Kari Walters', 9, 'en', '2011', 'spring', '20110131', ''),
(42, 'Public Policy Analysis: Public Roles in Private Markets', 'David Weil', 23, 'en', '2011', 'spring', '20110131', ''),
(43, 'Data Structures and Algorithms', 'Abhijit A.M.', 24, 'en', '2011', 'fall', '20110701', ''),
(44, 'Object Oriented Modeling and Design', 'Jagannath V. Aghav', 24, 'en', '2011', 'fall', '20110701', ''),
(45, 'Artificial Intelligence', 'Sawant Suraj Tanaji', 24, 'en', '2011', 'fall', '20110701', ''),
(46, 'Computational Methods in Engineering', 'Neeta V. Shinde', 24, 'en', '2011', 'fall', '20110701', ''),
(47, 'Discrete Signal Processing', 'K.V. Khushalani', 24, 'en', '2011', 'fall', '20110701', ''),
(48, 'Computer Organization and Advanced Microprocessors', 'Pankaj P. Tasgaonkar', 24, 'en', '2011', 'fall', '20110701', ''),
(49, 'Machine Drawing and Computer Graphics', 'H P Shinde', 24, 'en', '2011', 'fall', '20110701', ''),
(50, 'Solid State Devices and Linear Circuits Laboratory', 'Suhas Kakade', 24, 'en', '2011', 'fall', '20110711', ''),
(51, 'Software Testing and Quality Assurance', 'Pradeep Waychal', 24, 'en', '2011', 'fall', '20110701', ''),
(52, 'Corporate Social Responsibility', 'Dr. Sukalpa Chakrabarti', 25, 'en', '2011', 'fall', '20110701', ''),
(53, 'Macroeconomics', 'Ishita Ghosh', 25, 'en', '2011', 'fall', '20110701', ''),
(54, 'Year 2, Group A', 'Shirin Tejani and V.Kalyan Shankar / Krishna Kanta Roy / Pallavi Tak Rai / V.Kalyan Shankar', 25, 'en', '2011', 'fall', '20110701', ''),
(55, 'Year 2, Group B', 'Shirin Tejani and V.Kalyan Shankar / Krishna Kanta Roy / Pallavi Tak Rai / V.Kalyan Shankar', 25, 'en', '2011', 'fall', '20110701', ''),
(56, 'Year 3, Group A', 'Ishita Ghosh and V.Kalyan Shankar / Pallavi Tak Rai', 25, 'en', '2011', 'fall', '20110701', ''),
(57, 'Year 3, Group B', 'Ishita Ghosh and V.Kalyan Shankar / Pallavi Tak Rai', 25, 'en', '2011', 'fall', '20110701', ''),
(58, 'Communication Media for Children', 'Radha Misra', 26, 'en', '2011', 'fall', '20110701', ''),
(59, 'Intro to Organizational Communication', 'Lori Britt', 5, 'en', '2011', 'fall', '20110901', ''),
(60, 'Communication, Leadership, and Entrepreneurship', 'Dan O’Hair / Jennifer Dupuis', 18, 'en', '2011', 'fall', '20110901', ''),
(61, 'Nanjing Normal University Class Project', 'Njnu-ban-xueshenghao', 27, 'en', '2011', 'fall', '20110901', ''),
(63, 'New Media: Dissidence, Innovation, Community', 'Adel Iskandar', 2, 'en', '2011', 'fall', '20110901', ''),
(64, 'Interdisciplinary Applications of Biology', 'Candace Timpte', 28, 'en', '2011', 'fall', '20110901', ''),
(65, 'Composition II', 'Dayna Goldstein', 29, 'en', '2011', 'fall', '20110901', ''),
(66, 'U.S. Political Parties', 'Shamira Gelbman', 30, 'en', '2011', 'fall', '20110815', ''),
(67, 'Geography of Crop Plants', 'Mary Handley', 5, 'en', '2011', 'fall', '20110901', ''),
(68, 'American Political Systems', 'Marc Thomas', 31, 'en', '2011', 'fall', '20110901', ''),
(69, 'Conservation Biology', 'Kyle Harms', 9, 'en', '2011', 'fall', '20110901', ''),
(70, 'Prokaryotic Diversity', 'Gary King', 9, 'en', '2011', 'fall', '20110901', ''),
(71, 'Plate Tectonics', 'Alex Webb', 9, 'en', '2011', 'fall', '20110901', ''),
(72, 'Theatre Script Analysis', 'Leigh Clemons', 9, 'en', '2011', 'fall', '20110901', ''),
(73, 'Politics of Developing Nations', 'Martha Johnson', 32, 'en', '2011', 'fall', '20110901', ''),
(74, 'MPP Integrative Core I', 'Mark Henderson', 32, 'en', '2011', 'fall', '20110901', ''),
(75, 'Political Participation', 'Tess Marchant-Shapiro', 33, 'en', '2011', 'fall', '20110901', ''),
(76, 'Introduction to Psychology', 'Mitch Harden', 34, 'en', '2011', 'fall', '20110901', ''),
(77, 'Sociology of Poverty', 'Sandra Smith', 8, 'en', '2011', 'fall', '20110901', ''),
(78, 'Politics of piracy', 'Kevin Gorman / Katie Gilmore', 8, 'en', '2011', 'fall', '20110901', ''),
(79, 'Intro to Political Theory', 'Edward Erikson', 35, 'en', '2011', 'fall', '20110901', ''),
(80, 'Sociology of Marriage', 'Piotr Konieczny', 36, 'en', '2011', 'fall', '20110901', ''),
(81, 'Intro to Mass Communication', 'Chad Tew', 37, 'en', '2011', 'fall', '20110901', ''),
(82, 'Theories of the State', 'Erik Olin Wright', 38, 'en', '2011', 'fall', '20110901', ''),
(83, 'Cognitive Psychology', 'Greta Munger', 39, 'en', '2011', 'fall', '20110901', ''),
(84, 'History of Design and Digital Media', 'Michael Mandiberg', 40, 'en', '2011', 'fall', '20110901', ''),
(85, 'Intellectual Property law', 'Brian Carver', 8, 'en', '2011', 'fall', '20110901', ''),
(86, 'Intro to Law and Technology', 'Brad Rosen', 41, 'en', '2011', 'fall', '20110901', ''),
(87, 'Western Washington University: Reality Check', 'John Farquhar', 42, 'en', '2011', 'fall', '20110901', ''),
(88, 'Writing as Communication', 'Zachary McDowell', 35, 'en', '2011', 'fall', '20110901', ''),
(89, 'Technical Communication', 'Jim Lipuma / Davida Scharf', 43, 'en', '2011', 'fall', '20110901', ''),
(90, 'Intellectual Property: Copyright, Trademark and Patent', 'Ariel Katz', 44, 'en', '2011', 'fall', '20110901', ''),
(91, 'The Newspaper in Canadian Society', 'Michael Valpy', 44, 'en', '2011', 'fall', '20110901', ''),
(92, 'Knowledge and Information in Society', 'Andrew Clement / Siobhan Stevenson', 44, 'en', '2011', 'fall', '20110901', ''),
(93, 'Introduction to Psychology, Part I', 'Steve Joordens', 45, 'en', '2011', 'fall', '20110901', ''),
(94, 'Psychology of Language', 'Paula Marentette', 46, 'en', '2011', 'fall', '20110901', ''),
(95, 'Advanced Media Studies', 'Jennifer Geigel Mikulay', 47, 'en', '2011', 'fall', '20110901', ''),
(96, 'Digital Literacies', 'Webster Newbold', 48, 'en', '2011', 'fall', '20110901', ''),
(97, 'Accelerated Composition', 'Patricia Fancher', 49, 'en', '2011', 'fall', '20110901', ''),
(98, 'The Anthropology of Cyberspace', 'Terry Epperson', 50, 'en', '2011', 'fall', '20110901', ''),
(99, 'Political Scandals', 'John Todsen', 51, 'en', '2011', 'fall', '20110901', ''),
(100, 'Communication Theory and Frameworks', 'Jeanine Turner', 2, 'en', '2011', 'fall', '20110901', ''),
(101, 'Art and Terrorism', 'Diane Apostolos-Cappadona', 2, 'en', '2011', 'fall', '20110901', ''),
(102, 'Mycology', 'Lee Kurtz', 28, 'en', '2011', 'fall', '20110901', ''),
(103, 'Feminist Thought', 'Laura Brunell', 52, 'en', '2011', 'fall', '20110901', ''),
(104, 'Finding Lost Space: Community Planning and Design', 'Bruce Sharky', 9, 'en', '2011', 'fall', '20110901', ''),
(105, 'Introduction to Sociological Theory', 'Dan Ryan', 32, 'en', '2011', 'fall', '20110901', ''),
(106, 'Wikipedia: Aim for Featured Article', 'Matt Senate', 53, 'en', '2011', 'fall', '20110901', ''),
(107, 'Introduction to Educational Psychology', 'Anthony Derriso', 54, 'en', '2011', 'fall', '20110901', ''),
(108, 'Global Enterprise and Sustainable Development', 'Ming Xu', 55, 'en', '2011', 'fall', '20110901', ''),
(110, 'Housing and Social Policy', 'Rachel Kleit', 56, 'en', '2011', 'fall', '20110901', ''),
(111, 'Genetics in Everyday Life', 'Tom Haffie', 57, 'en', '2012', 'spring', '2012-01-10', ''),
(112, 'Archaeological Ethics, Politics, and Law', 'Grant Aylesworth', 58, 'en', '2012', 'spring', '2012-01-05', ''),
(113, 'Archaeology and Popular Culture', 'Grant Aylesworth', 58, 'en', '2012', 'spring', '2012-01-05', ''),
(114, 'Environment and Society', 'Grant Aylesworth', 58, 'en', '2012', 'spring', '2012-01-05', ''),
(115, 'Language Acquisition', 'Paula Marentette', 46, 'en', '2012', 'spring', '2012-01-05', ''),
(116, 'Seminar in Physiology', 'Louise Milligan', 57, 'en', '2012', 'spring', '2012-01-05', ''),
(117, 'Cognitive Science', 'Ruby Nadler', 57, 'en', '2012', 'spring', '2012-01-05', ''),
(118, 'Contemporary Research in Personality', 'John Zelenski', 59, 'en', '2012', 'spring', '2012-01-05', ''),
(119, 'Art and Ethics', 'Diane Apostolos-Cappadona', 2, 'en', '2012', 'spring', '2012-01-05', ''),
(120, 'Human Rights of Indigenous Peoples', 'Carwil Bjork-James', 60, 'en', '2012', 'spring', '2012-01-05', ''),
(121, 'Leadership Communication', 'Lori Britt', 5, 'en', '2012', 'spring', '2012-01-05', ''),
(122, 'Cyberlaw', 'Brian Carver', 8, 'en', '2012', 'spring', '2012-01-05', ''),
(123, 'Psychology of Language', 'Kyle Chambers', 61, 'en', '2012', 'spring', '2012-01-05', ''),
(124, 'Intro to Dramatic Lit', 'Leigh Clemons', 9, 'en', '2012', 'spring', '2012-01-05', ''),
(125, 'Personality', 'William Fleeson', 62, 'en', '2012', 'spring', '2012-01-05', ''),
(126, 'Film Theory in the Age of New Media', 'Melissa Goldman', 2, 'en', '2012', 'spring', '2012-01-05', ''),
(127, 'Sport in Society', 'Shelly Habel', 2, 'en', '2012', 'spring', '2012-01-05', ''),
(128, 'Copyright Commerce and Culture', 'Evan Hill-Ries', 12, 'en', '2012', 'spring', '2012-01-05', ''),
(129, 'Media and Communications in the Arab World', 'Adel Iskandar', 2, 'en', '2012', 'spring', '2012-01-05', ''),
(130, 'Embattled Media: Conflict and War Journalism', 'Adel Iskandar', 2, 'en', '2012', 'spring', '2012-01-05', ''),
(131, 'History and Systems of Psychology', 'Scott P. King', 63, 'en', '2012', 'spring', '2012-01-05', ''),
(132, 'Political Research Seminar', 'Kara Lindaman', 22, 'en', '2012', 'spring', '2012-01-05', ''),
(133, 'Technical Communication', 'James Lipuma', 43, 'en', '2012', 'spring', '2012-01-05', ''),
(134, 'Interactive Technology and Pedagogy', 'Michael Mandiberg', 64, 'en', '2012', 'spring', '2012-01-05', ''),
(135, 'Research in Personality', 'MaryBeth McGavran', 18, 'en', '2012', 'spring', '2012-01-05', ''),
(136, 'Language Development', 'Cecile McKee', 65, 'en', '2012', 'spring', '2012-01-05', ''),
(137, 'Introduction to Digital Literacies', 'Webster Newbold', 48, 'en', '2012', 'spring', '2012-01-05', ''),
(138, 'Teaching With Technology', 'Webster Newbold', 48, 'en', '2012', 'spring', '2012-01-05', ''),
(139, 'Wiki-Project Management', 'Jonathan Obar', 10, 'en', '2012', 'spring', '2012-01-05', ''),
(140, 'Poverty, Gender, and Development', 'Diana Strassmann, Anne Chao', 66, 'en', '2012', 'spring', '2012-01-05', ''),
(141, 'Industrial Psychology', 'Michael J. Tagler', 48, 'en', '2012', 'spring', '2012-01-05', ''),
(142, 'Introduction to Mass Communication', 'Chad Tew', 37, 'en', '2012', 'spring', '2012-01-05', ''),
(143, 'Interdisciplinary Application of Biology', 'Candace Timpte', 28, 'en', '2012', 'spring', '2012-01-05', ''),
(144, 'Communication Technology and Organizations', 'Jeanine Turner', 2, 'en', '2012', 'spring', '2012-01-05', ''),
(145, 'Information Fluency in the Digital Age', 'Michele Van Hoeck, Ben Bolin', 67, 'en', '2012', 'spring', '2012-01-05', ''),
(146, 'Rhetoric and Composition', 'Patricia Fancher', 49, 'en', '2012', 'spring', '2012-01-05', ''),
(147, 'Environmental Law', 'Aaron Frank', 19, 'en', '2012', 'spring', '2012-01-05', ''),
(148, 'Writing as Communication', 'Zach McDowell', 35, 'en', '2012', 'spring', '2012-01-05', ''),
(149, 'Writing & Rhetoric II', 'Matt Vetter', 68, 'en', '2012', 'spring', '2012-01-05', ''),
(150, 'Adolescent Literature', 'Adrianne Wadewitz', 69, 'en', '2012', 'spring', '2012-01-05', ''),
(151, 'Criminal Process', 'Heather Winslow', 70, 'en', '2012', 'spring', '2012-01-05', ''),
(152, 'Organic Chemistry', 'Anne McNeil', 55, 'en', '2012', 'spring', '2012-01-05', ''),
(153, 'Peace and Health: Praxis', 'Nancy Doubleday', 71, 'en', '2012', 'spring', '2012-01-05', ''),
(154, 'Controversies in Science', 'Andrew Reil', 72, 'en', '2012', 'spring', '2012-01-05', ''),
(155, 'News Media and Deep Democracy', 'Michael Valpy', 57, 'en', '2012', 'spring', '2012-01-05', ''),
(156, 'Gender and Economic Development in the Third World', 'Gunseli Berik', 73, 'en', '2012', 'spring', '2012-01-05', ''),
(157, 'American Political Thought', 'Edward Erikson', 35, 'en', '2012', 'spring', '2012-01-05', ''),
(158, 'Introduction to Psychology', 'Mitch Harden', 34, 'en', '2012', 'spring', '2012-01-05', ''),
(159, 'Cognition', 'Chris Koch', 74, 'en', '2012', 'spring', '2012-01-05', ''),
(160, 'Cognitive Psychology', 'Stefania Mereu', 75, 'en', '2012', 'spring', '2012-01-05', ''),
(161, 'American Political Systems', 'Marc Thomas', 31, 'en', '2012', 'spring', '2012-01-05', ''),
(162, 'American National Government', 'Marc Thomas', 76, 'en', '2012', 'spring', '2012-01-05', ''),
(163, 'International Economic Strategy and Trade Policy', 'Ahn Tran', 4, 'en', '2012', 'spring', '2012-01-05', ''),
(164, 'Development Economics', 'Anh Tran', 4, 'en', '2012', 'spring', '2012-01-05', ''),
(165, 'Sustainable Systems in Developing Countries', 'Ming Xu', 55, 'en', '2012', 'spring', '2012-01-05', ''),
(166, 'The Rhetoric of Digital and Interactive Media Environments', 'Rhonda McEwen', 77, 'en', '2012', 'spring', '2012-01-05', ''),
(167, 'Poverty, Justice, and Human Capabilities', 'Kimberly Kay Hoang', 66, 'en', '2012', 'spring', '2012-01-05', ''),
(168, 'Corporate Training and Development', 'Lynn Keane', 78, 'en', '2012', 'spring', '2012-01-05', ''),
(169, 'Advanced Media Studies', 'Jennifer Geigel Mikulay', 47, 'en', '2012', 'spring', '2012-01-05', ''),
(170, 'Writing: The Editing Process', 'Jennifer Geigel Mikulay', 47, 'en', '2012', 'spring', '2012-01-05', ''),
(171, 'Psychology Senior Capstone', 'Greta Munger', 39, 'en', '2012', 'spring', '2012-01-05', ''),
(172, 'Historisches Wissen in der Online-Enzyklopädie Wikipedia', 'Jürgen Nemitz', 79, 'de', '2012', 'spring', '2012-04-01', ''),
(173, 'Archaeology meets Wikipedia – Studenten schreiben in der Online-Enzyklopädie', 'Harald Meller', 80, 'de', '2012', 'spring', '2012-04-01', ''),
(174, 'Mass Communications', 'Amany Fahmy', 81, 'ar', '2012', 'spring', '2012-02-01', ''),
(175, 'Mathematics', 'Hany Hosseiny', 81, 'ar', '2012', 'spring', '2012-02-01', ''),
(176, 'Spanish, translations', 'Abeer El Hafez', 81, 'ar', '2012', 'spring', '2012-02-01', ''),
(177, 'Drama', 'Iman Ezzeldin', 82, 'ar', '2012', 'spring', '2012-02-01', ''),
(178, 'French, translations', 'Dalia El-Toukhy', 82, 'ar', '2012', 'spring', '2012-02-01', ''),
(179, 'French, extracurricular', 'Hoda Abaza', 82, 'ar', '2012', 'spring', '2012-02-01', ''),
(180, 'American Political Thought', 'Edward Erikson', 35, 'en', '2012', 'spring', '2012-01-05', ''),
(181, 'Telecommunications Policy Analysis', 'Jonathan Obar', 10, 'en', '2012', 'spring', '2012-01-05', ''),
(182, 'Ethnic Studies', 'Victoria Robinson', 8, 'en', '2012', 'spring', '2012-01-05', ''),
(183, 'Public Policy Analysis', 'Chris Cooper', 21, 'en', '2012', 'spring', '2012-01-05', ''),
(184, 'The Social Web', 'Robert E. Kraut', 83, 'en', '2012', 'spring', '2012-01-05', ''),
(185, 'North American Environmental History', 'Tina Loo', 84, 'en', '2012', 'spring', '2012-01-05', ''),
(186, 'Memória e Vivência', 'Heloisa Pait', 85, 'pt', '2012', 'spring', '20120412', '20120629'),
(187, 'Política Cultural', 'Pablo Ortellado', 86, 'pt', '2012', 'spring', '20120307', '20120629'),
(188, 'Eletromagnetismo', 'Edivaldo Santos', 87, 'pt', '2012', 'spring', '20120403', '20120629'),
(189, 'Espalhamento Elástico de Luz e Raios-X por Biossistemas', 'Vera Henriques', 86, 'pt', '2012', 'spring', '20120411', '20120629'),
(190, 'Digitale Hilfswissenschaften', '', 79, 'de', '2012', 'spring', '2012-04-01', ''),
(191, 'Sportgeschichte in der Online-Enzyklopädie Wikipedia', '', 88, 'de', '2012', 'spring', '2012-04-01', ''),
(192, 'Wikipedia – Social Media oder Content Management System?', '', 89, 'de', '2012', 'spring', '2012-04-01', ''),
(193, 'Architekturgeschichte und ihre Darstellung in digitalen Medien', 'Stephan Hoppe', 90, 'de', '2012', 'spring', '2012-01-04', ''),
(194, 'Asian Politics', 'Ahmed Abd Rabou', 81, 'ar', '2012', 'spring', '2012-02-01', ''),
(195, 'Drama', 'Iman Ezz El-Din', 82, 'ar', '2012', 'fall', '2012-08-01', ''),
(196, 'English', 'Karma Sami', 82, 'ar', '2012', 'fall', '2012-08-01', ''),
(197, 'English', 'Loubna Yusuf', 81, 'ar', '2012', 'fall', '2012-08-01', ''),
(198, 'English', 'Radwa Kotait', 82, 'ar', '2012', 'fall', '2012-08-01', ''),
(199, 'French', 'Dalia El-Tokhy', 82, 'ar', '2012', 'fall', '2012-08-01', ''),
(200, 'French', 'Hoda Abaza', 82, 'ar', '2012', 'fall', '2012-08-01', ''),
(201, 'Hebrew', 'Mansour Abd El-Wahab', 82, 'ar', '2012', 'fall', '2012-08-01', ''),
(202, 'Japanese', 'Amal Refaat', 81, 'ar', '2012', 'fall', '2012-08-01', ''),
(203, 'Research Methods', 'Doaa Saif El-Din', 82, 'ar', '2012', 'fall', '2012-08-01', ''),
(204, 'Spanish', 'Abeer Abd El-Hafez', 81, 'ar', '2012', 'fall', '2012-08-01', '');
|
-- select column user_id
SELECT user_id,
-- select the maximum time_stamp for each user_id as last_stamp.
MAX(time_stamp) AS last_stamp
-- select from logins
FROM Logins
-- where the year of time_stamp is 2020
WHERE YEAR(time_stamp) = 2020
-- group by user_id
GROUP BY user_id;
|
# This will be used to store data on stored weapons for PD
CREATE TABLE IF NOT EXISTS `rack_weapons` (
`id` INT(11) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
`owner` varchar(22) NOT NULL,
`stored` varchar(22) NOT NULL DEFAULT `0`,
`weapon` varchar(22) NOT NULL,
`flashlight` varchar(22) NOT NULL DEFAULT '0',
`mag` varchar(22) NOT NULL DEFAULT '0',
`scope` varchar(22) NOT NULL DEFAULT '0',
)
|
create or replace view v_dtpf17012_data_gkb as
select de042, de086, pc, sum(je) as n1, bz, bs from
(
select de042, f_getjsde702byde086(2017, de086) as de086, pc, sum(nvl(n4, 0)-nvl(n12, 0)+nvl(n23, 0)+nvl(n25, 0)+nvl(n27, 0)) as je, 0 as bz, 3 as bs from v_dtys17001s_3
where de086 in ('30201','30202','30205','30206','30207','30208','30209','30211','30213','30215','30218','30229','30231','30299')
and czde119 like '0101%'
group by de042, de086, pc having sum(nvl(n4, 0)-nvl(n12, 0)+nvl(n23, 0)+nvl(n25, 0)+nvl(n27, 0)) <> 0
union all
select de042, f_getjsde702byde086(2017, de086) as de086, pc, sum(nvl(n4, 0)-nvl(n12, 0)+nvl(n23, 0)+nvl(n25, 0)+nvl(n27, 0)) as je, 0 as bz, 3 as bs from v_dtys17001s_3
where de086 like '31002%' and (czde119 like '0101%' or czde119 like '010202%' or czde119 like '010203%')
group by de042, de086, pc having sum(nvl(n4, 0)-nvl(n12, 0)+nvl(n23, 0)+nvl(n25, 0)+nvl(n27, 0)) <> 0
/*
union all
select de042, de086, pc, sum(nvl(n4, 0)-nvl(n12, 0)+nvl(n23, 0)+nvl(n25, 0)+nvl(n27, 0)) as je, 0 as bz, 5 as bs from v_dtys17001s_5
where de086 like '5%' and czde119 like '0101%'
group by de042, de086, pc having sum(nvl(n4, 0)-nvl(n12, 0)+nvl(n23, 0)+nvl(n25, 0)+nvl(n27, 0)) <> 0
union all
select de042, de086, pc, sum(nvl(n4, 0)-nvl(n12, 0)+nvl(n23, 0)+nvl(n25, 0)+nvl(n27, 0)) as je, 0 as bz, 5 as bs from v_dtys17001s_5
where de086 like '5%' and (czde119 like '0101%' or czde119 like '0102%')
group by de042, de086, pc having sum(nvl(n4, 0)-nvl(n12, 0)+nvl(n23, 0)+nvl(n25, 0)+nvl(n27, 0)) <> 0
*/
) data1
group by de042, de086, pc, bz, bs;
|
create schema lifter;
use lifter;
create table if not exists 响应信息
(
时间 datetime not null,
楼层 int not null,
等待时间 bigint not null,
primary key(时间,楼层,等待时间),
index(时间)
);
create table if not exists 运行信息
(
时间 datetime not null,
楼层 int not null,
位置 double not null,
速度 double not null,
primary key(时间),
index(时间)
); |
INSERT INTO `ticket` VALUES (1, 20, 199, '2016-12-27 00:00:00', 2, 1);
INSERT INTO `ticket` VALUES (2, 20, 1000, '2016-12-27 00:00:00', 1, 1);
|
/*SET NAMES utf8;*/
INSERT INTO tbl_type(`name`, `parent`) VALUES
("коллекция", NULL), /* 1 */
("плитка", NULL), /* 2 */
("напольная плитка", 2),
("настенная плитка", 2),
("декоративные элементы", NULL); |
---------------------------------------------------------------------------------------------
-------------------------------- INCIO FINANCEIRO -------------------------------------------
---------------------------------------------------------------------------------------------
-- planilha de distribuição
drop table if exists planilhadistribuicaomaterial;
drop table if exists planilhadistribuicaodepart;
drop table if exists planilhadistribuicao;
drop sequence if exists planilhadistribuicaomaterial_pd03_sequencial_seq;
drop sequence if exists planilhadistribuicaodepart_pd02_sequencial_seq;
drop sequence if exists planilhadistribuicao_pd01_sequencial_seq;
-- fim planilha de distribuição
---------------------------------------------------------------------------------------------
-------------------------------- FIM FINANCEIRO---------------------------------------------
---------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------
------------------------------ INICIO EDUCAÇÃO E SAÚDE -----------------------------
------------------------------------------------------------------------------------
DROP TABLE IF EXISTS controlematriculainicial CASCADE;
DROP SEQUENCE IF EXISTS controlematriculainicial_ed135_sequencial_seq;
------------------------------------------------------------------------------------
------------------------------ FIM EDUCAÇÃO E SAÚDE --------------------------------
------------------------------------------------------------------------------------ |
-- Leetcode: https://leetcode.com/problems/find-total-time-spent-by-each-employee/
-- Find the total time an employee spends in office by event day
# Write your MySQL query statement below
select event_day as day, emp_id, sum(out_time - in_time) as total_time from Employees group by 1, 2 |
CREATE TABLE [display].[sc_cat_item]
(
[sc_catalogs_display_value] NVARCHAR(4000) NULL,
[sys_name_display_value] NVARCHAR(255) NULL,
[vendor_display_value] NVARCHAR(255) NULL,
[sys_created_on_display_value] DATETIME NULL,
[use_sc_layout_display_value] NVARCHAR(255) NULL,
[description_display_value] NVARCHAR(MAX) NULL,
[no_order_now_display_value] NVARCHAR(255) NULL,
[recurring_frequency_display_value] NVARCHAR(255) NULL,
[sys_class_name_display_value] NVARCHAR(255) NULL,
[sys_policy_display_value] NVARCHAR(255) NULL,
[billable_display_value] NVARCHAR(255) NULL,
[picture_display_value] NVARCHAR(255) NULL,
[mobile_picture_type_display_value] NVARCHAR(255) NULL,
[sys_tags_display_value] NVARCHAR(255) NULL,
[no_cart_display_value] NVARCHAR(255) NULL,
[list_price_display_value] NVARCHAR(255) NULL,
[availability_display_value] NVARCHAR(255) NULL,
[sys_package_display_value] NVARCHAR(255) NULL,
[visible_bundle_display_value] NVARCHAR(255) NULL,
[delivery_plan_display_value] NVARCHAR(255) NULL,
[short_description_display_value] NVARCHAR(MAX) NULL,
[no_order_display_value] NVARCHAR(255) NULL,
[sys_mod_count_display_value] NVARCHAR(255) NULL,
[location_display_value] NVARCHAR(255) NULL,
[mobile_hide_price_display_value] NVARCHAR(255) NULL,
[sys_created_by_display_value] NVARCHAR(255) NULL,
[no_proceed_checkout_display_value] NVARCHAR(255) NULL,
[sys_updated_on_display_value] DATETIME NULL,
[visible_standalone_display_value] NVARCHAR(255) NULL,
[ignore_price_display_value] NVARCHAR(255) NULL,
[ordered_item_link_display_value] NVARCHAR(255) NULL,
[omit_price_display_value] NVARCHAR(255) NULL,
[no_search_display_value] NVARCHAR(255) NULL,
[category_display_value] NVARCHAR(255) NULL,
[icon_display_value] NVARCHAR(255) NULL,
[sc_ic_version_display_value] NVARCHAR(255) NULL,
[sys_updated_by_display_value] NVARCHAR(255) NULL,
[recurring_price_display_value] NVARCHAR(255) NULL,
[group_display_value] NVARCHAR(255) NULL,
[price_display_value] NVARCHAR(255) NULL,
[sys_id_display_value] NVARCHAR(255) NULL,
[sys_replace_on_upgrade_display_value] NVARCHAR(255) NULL,
[start_closed_display_value] NVARCHAR(255) NULL,
[active_display_value] NVARCHAR(255) NULL,
[no_quantity_display_value] NVARCHAR(255) NULL,
[name_display_value] NVARCHAR(255) NULL,
[delivery_time_display_value] NVARCHAR(255) NULL,
[preview_display_value] NVARCHAR(255) NULL,
[visible_guide_display_value] NVARCHAR(255) NULL,
[order_display_value] NVARCHAR(255) NULL,
[custom_cart_display_value] NVARCHAR(255) NULL,
[sys_scope_display_value] NVARCHAR(255) NULL,
[entitlement_script_display_value] NVARCHAR(4000) NULL,
[type_display_value] NVARCHAR(255) NULL,
[cost_display_value] NVARCHAR(255) NULL,
[model_display_value] NVARCHAR(255) NULL,
[image_display_value] NVARCHAR(255) NULL,
[sc_ic_item_staging_display_value] NVARCHAR(255) NULL,
[workflow_display_value] NVARCHAR(255) NULL,
[template_display_value] NVARCHAR(255) NULL,
[sys_update_name_display_value] NVARCHAR(255) NULL,
[mobile_picture_display_value] NVARCHAR(255) NULL,
[delivery_plan_script_display_value] NVARCHAR(4000) NULL,
[roles_display_value] NVARCHAR(255) NULL,
[meta_display_value] NVARCHAR(255) NULL,
[sys_customer_update_display_value] NVARCHAR(255) NULL
)
|
DROP TABLE IF EXISTS drinker;
CREATE TABLE drinker (value SMALLINT PRIMARY KEY, property VARCHAR (20) NOT NULL);
INSERT INTO drinker (value, property) VALUES (0, 'Prefer Not To Say');
INSERT INTO drinker (value, property) VALUES (1, 'No');
INSERT INTO drinker (value, property) VALUES (2, 'Yes - Not often');
INSERT INTO drinker (value, property) VALUES (4, 'Yes - often'); |
-- findcol.sql - jared still
-- jkstill@gmail.com
@clears
@columns
col owner format a10
col data_type format a20
set line 120
col ccolumn noprint new_value ucolumn
col cowner noprint new_value uowner
set term on echo off feed off
prompt This utility searches for columns in DBA_TAB_COLUMNS
prompt
prompt Account to search for column on (Partial Name OK) :
set feed off term off
select upper('&1') cowner from dual;
set term on
prompt Column name to search for (Partial Name OK) :
set term off feed off
select upper('&2') ccolumn from dual;
set term on feed on
break on owner skip 1 on table_name skip 1
select
owner,
table_name,
column_name,
data_type
from dba_tab_columns
where owner like '%&&uowner%'
and column_name like '%&&ucolumn%'
order by owner, table_name, column_name
/
undef 1 2
|
\connect "city-info"
CREATE TABLE junction (
id text NOT NULL PRIMARY KEY,
name text NOT NULL,
latitude real NOT NULL,
longitude real NOT NULL
);
CREATE TABLE meter (
id text NOT NULL PRIMARY KEY,
address text NOT NULL,
latitude real NOT NULL,
longitude real NOT NULL
);
CREATE TABLE meter_update (
id serial PRIMARY KEY,
meter_id text NOT NULL references meter(id),
timestamp TIMESTAMP NOT NULL,
status_text text NOT NULL
);
CREATE TABLE junction_update (
id serial PRIMARY KEY,
junction_id text NOT NULL references junction(id),
timestamp TIMESTAMP NOT NULL,
count_ns int NOT NULL,
count_ew int NOT NULL
);
COPY junction(id,name,latitude,longitude) FROM '/docker-entrypoint-initdb.d/junction_info.csv' DELIMITER ',' CSV HEADER;
COPY meter(id,address,latitude,longitude) FROM '/docker-entrypoint-initdb.d/meter_info.csv' DELIMITER ',' CSV HEADER;
|
PRAGMA foreign_keys = ON;
BEGIN TRANSACTION;
DROP TABLE IF EXISTS server;
CREATE TABLE server (
id INTEGER PRIMARY KEY,
name VARCHAR UNIQUE,
notes VARCHAR
);
DROP TABLE IF EXISTS ip;
CREATE TABLE ip (
id INTEGER PRIMARY KEY,
ip INTEGER UNIQUE,
notes VARCHAR
);
DROP TABLE IF EXISTS subnet;
CREATE TABLE subnet (
id INTEGER PRIMARY KEY,
network INTEGER UNIQUE,
gateway VARCHAR UNIQUE,
broadcast VARCHAR UNIQUE,
prefix VARCHAR,
netmask VARCHAR,
comment VARCHAR
);
DROP TABLE IF EXISTS vlan;
CREATE TABLE vlan (
id INTEGER PRIMARY KEY,
vlan INTEGER,
comment VARCHAR,
notes VARCHAR
);
DROP TABLE IF EXISTS vlan_subnets;
CREATE TABLE vlan_subnets (
vlan_id INTEGER,
subnet_id INTEGER,
FOREIGN KEY(vlan_id) REFERENCES vlan(id) ON DELETE CASCADE,
FOREIGN KEY(subnet_id) REFERENCES subnet(id) ON DELETE CASCADE
);
DROP TABLE IF EXISTS ip_subnet;
CREATE TABLE ip_subnet (
subnet_id INTEGER,
ip_id INTEGER,
FOREIGN KEY(subnet_id) REFERENCES subnet(id) ON DELETE CASCADE,
FOREIGN KEY(ip_id) REFERENCES ip(id) ON DELETE CASCADE
);
DROP TABLE IF EXISTS server_ips;
CREATE TABLE server_ips (
server_id INTEGER,
ip_id INTEGER,
FOREIGN KEY(server_id) REFERENCES server(id) ON DELETE CASCADE,
FOREIGN KEY(ip_id) REFERENCES ip(id) ON DELETE CASCADE
);
CREATE INDEX subnet_index ON ip_subnet(subnet_id);
CREATE INDEX ip_subnet_index ON ip_subnet(ip_id);
CREATE INDEX server_index ON server_ips(server_id);
CREATE INDEX ip_index ON server_ips(ip_id);
CREATE INDEX vlan_index ON vlan_subnets(vlan_id);
CREATE INDEX subnet_vlan_index ON vlan_subnets(subnet_id);
INSERT INTO "server" VALUES(1, 'abc-123', '' );
INSERT INTO "server" VALUES(2, 'def-456', '' );
INSERT INTO "server" VALUES(3, 'hij-654', '' );
INSERT INTO "server" VALUES(4, 'zxc-576', '' );
INSERT INTO "server" VALUES(5, 'fgh-753', '' );
INSERT INTO "vlan" VALUES(1, 100, 'Foo', '' );
INSERT INTO "vlan" VALUES(2, 130, 'Public', '' );
INSERT INTO "vlan" VALUES(3, 131, 'Private', '' );
INSERT INTO "ip" VALUES(1, -1062731774, '' );
INSERT INTO "ip" VALUES(2, -1062731773, '' );
INSERT INTO "ip" VALUES(3, -1062731772, '' );
INSERT INTO "ip" VALUES(4, -1062731771, '' );
INSERT INTO "ip" VALUES(5, 168427522, '' );
INSERT INTO "ip" VALUES(6, 168427523, '' );
INSERT INTO "ip" VALUES(7, 168427524, '' );
INSERT INTO "ip" VALUES(8, 168427525, '' );
INSERT INTO "ip" VALUES(9, -1409283582, '' );
INSERT INTO "ip" VALUES(10, -1409283581, '' );
INSERT INTO "ip" VALUES(11, -1409283580, '' );
INSERT INTO "ip" VALUES(12, -1409283579, '' );
INSERT INTO "subnet" VALUES(1, '-1062731776', '192.168.0.1', '192.168.0.255', '/24', '255.255.255.0', '');
INSERT INTO "subnet" VALUES(2, '168427520', '10.10.0.1', '10.10.0.255', '/24', '255.255.255.0', '');
INSERT INTO "subnet" VALUES(3, '-1409283584', '172.0.10.1', '172.0.10.255', '/24', '255.255.255.0', '');
INSERT INTO "vlan_subnets" VALUES(1, 1);
INSERT INTO "vlan_subnets" VALUES(1, 2);
INSERT INTO "vlan_subnets" VALUES(2, 3);
INSERT INTO "ip_subnet" VALUES(1, 1);
INSERT INTO "ip_subnet" VALUES(1, 2);
INSERT INTO "ip_subnet" VALUES(1, 3);
INSERT INTO "ip_subnet" VALUES(1, 4);
INSERT INTO "ip_subnet" VALUES(2, 5);
INSERT INTO "ip_subnet" VALUES(2, 6);
INSERT INTO "ip_subnet" VALUES(2, 7);
INSERT INTO "ip_subnet" VALUES(2, 8);
INSERT INTO "ip_subnet" VALUES(3, 9);
INSERT INTO "ip_subnet" VALUES(3, 10);
INSERT INTO "ip_subnet" VALUES(3, 11);
INSERT INTO "ip_subnet" VALUES(3, 12);
INSERT INTO "server_ips" VALUES(1, 1);
INSERT INTO "server_ips" VALUES(2, 2);
INSERT INTO "server_ips" VALUES(3, 3);
INSERT INTO "server_ips" VALUES(3, 4);
INSERT INTO "server_ips" VALUES(4, 5);
INSERT INTO "server_ips" VALUES(4, 6);
INSERT INTO "server_ips" VALUES(4, 7);
INSERT INTO "server_ips" VALUES(4, 8);
INSERT INTO "server_ips" VALUES(5, 9);
INSERT INTO "server_ips" VALUES(5, 10);
INSERT INTO "server_ips" VALUES(5, 11);
INSERT INTO "server_ips" VALUES(5, 12);
COMMIT;
/* get server name and ips */
SELECT server.name, ip.ip
FROM server
LEFT JOIN server_ips ON server.id = server_ips.server_id
LEFT JOIN ip on server_ips.ip_id = ip.id;
/* Find server name based on IP */
SELECT server.name
FROM server
LEFT JOIN server_ips ON server.id = server_ips.server_id
LEFT JOIN ip on server_ips.ip_id = ip.id
WHERE ip.ip = '192.168.0.2';
/* get ip and subnet */
SELECT ip.ip, subnet.network, subnet.gateway, subnet.broadcast, subnet.prefix, subnet.netmask
FROM ip
LEFT JOIN ip_subnet ON ip.id = ip_subnet.ip_id
LEFT JOIN subnet ON ip_subnet.subnet_id = subnet.id;
/* Get Vlans and IP addresses */
SELECT vlan.vlan, subnet.network
FROM vlan
LEFT JOIN vlan_subnets ON vlan.id = vlan_subnets.vlan_id
LEFT JOIN subnet ON vlan_subnets.subnet_id = subnet.id;
/* Select IPs subnets and VLANs */
SELECT ip.ip, subnet.network, subnet.gateway, subnet.broadcast, vlan.vlan
FROM ip
LEFT JOIN ip_subnet ON ip.id = ip_subnet.ip_id
LEFT JOIN subnet ON ip_subnet.subnet_id = subnet.id
LEFT JOIN vlan_subnets ON subnet.id = vlan_subnets.subnet_id
LEFT JOIN vlan ON vlan_subnets.vlan_id = vlan.id;
|
-- Queries 1- 8
--1. List the following details of each employee: employee number, last name, first name, sex, and salary.
--Creatig a view
CREATE VIEW question1 as
SELECT e.emp_no, e.last_name, e.first_name, e.sex, s.salary
FROM employees as e
INNER JOIN salaries as s
ON (e.emp_no = s.emp_no)
ORDER BY s.salary DESC;
--2. List first name, last name, and hire date for employees who were hired in 1986.
CREATE VIEW Question2 AS
SELECT first_name, last_name, hire_date
FROM employees
WHERE hire_date BETWEEN '1986-01-01'AND '1986-12-31';
-- 3. List the manager of each department with the following information: department number, department name, the manager's employee number, last name, first name.
CREATE VIEW Question3 AS
SELECT d.dept_no, d.dept_name, e.first_name, e.last_name, e.emp_no
FROM departmentmanager AS dm
INNER JOIN departments AS d
ON(dm.dept_no = d.dept_no)
INNER JOIN employees AS e
ON(e.emp_no = dm.emp_no);
-- 4.List the department of each employee with the following information: employee number, last name, first name, and department name.
CREATE VIEW Question4 As
SELECT e.emp_no, e.last_name, e.first_name, d.dept_name
FROM employees AS e
INNER JOIN dept_employees AS de
ON(e.emp_no = de.emp_no)
INNER JOIN departments AS d
ON(d.dept_no = de.dept_no)
ORDER BY e.emp_no, e.first_name, e.last_name, d.dept_name;
SELECT * FROM Question4;
-- 5.List first name, last name, and sex for employees whose first name is "Hercules" and last names begin with "B."
CREATE VIEW Question5 As
SELECT first_name, last_name, sex
FROM employees
WHERE first_name = 'Hercules'
AND last_name LIKE 'B%';
-- 6. List all employees in the Sales department, including their employee number, last name, first name, and department name.
CREATE VIEW Question6 As
SELECT e.emp_no, e.last_name, e.first_name, d.dept_name
FROM employees AS e
INNER JOIN dept_employees AS de
ON(e.emp_no = de.emp_no)
INNER JOIN departments AS d
ON(d.dept_no = de.dept_no)
WHERE d.dept_name = 'Sales';
-- 7.List all employees in the Sales and Development departments, including their employee number, last name, first name, and department name.
CREATE VIEW Question7 As
SELECT e.emp_no, e.last_name, e.first_name, d.dept_name
FROM employees AS e
INNER JOIN dept_employees AS de
ON(e.emp_no = de.emp_no)
INNER JOIN departments AS d
ON(d.dept_no = de.dept_no)
WHERE d.dept_name IN ('Sales', 'Development');
-- 8.In descending order, list the frequency count of employee last names, i.e., how many employees share each last name.
CREATE VIEW Question8 As
SELECT last_name, COUNT(last_name)
FROM employees
GROUP BY last_name
ORDER BY COUNT(last_name) DESC
|
/*建立用户并授权*/
create user YKT_CK
identified by "kingstar"
default tablespace TS_YKT_CK
temporary tablespace TEMP
profile DEFAULT
quota unlimited on TS_YKT_CK;
grant create any index to YKT_CK;
grant create any table to YKT_CK;
grant create any view to YKT_CK;
grant drop any table to YKT_CK;
grant drop any trigger to YKT_CK;
grant drop any view to YKT_CK;
GRANT CONNECT TO YKT_CK;
/*建立表空间*/
create tablespace TS_YKT_CK
datafile '/udata/oracle/oradata/ykt/ts_ykt_ck.dbf'
size 1000M
reuse
autoextend on
next 10M
maxsize UNLIMITED
logging
extent management local autoallocate
segment space management auto
flashback on;
|
DROP DATABASE IF EXISTS `jbb-associates-db`;
CREATE DATABASE IF NOT EXISTS `jbb-associates-db`;
USE `jbb-associates-db`;
-- Table structure for table `user_details_table`
DROP TABLE IF EXISTS `user_details_table`;
CREATE TABLE `user_details_table` (
`user_id` int(11) NOT NULL auto_increment,
`password` char(120) NOT NULL,
`first_name` varchar(50) NOT NULL,
`last_name` varchar(50) NOT NULL,
`email_id` varchar(70) NOT NULL,
`mobile_no` varchar(10) NOT NULL,
`role` varchar(20) NOT NULL,
`joining_date` DATETIME NOT NULL,
`is_active` BIT NOT NULL DEFAULT 1,
PRIMARY KEY (`user_id`),
UNIQUE KEY (`user_id`, `email_id`, `mobile_no`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=latin1
COMMENT = 'Table to store all users data.';
-- Table structure for table `user_search_table`
DROP TABLE IF EXISTS `user_prefs_table`;
CREATE TABLE `user_prefs_table` (
`user_id` INT NOT NULL,
`subscribe_news` BIT NOT NULL DEFAULT 1,
`subscribe_emails` BIT NOT NULL DEFAULT 1,
`subscribe_msgs` BIT NOT NULL,
`bookmarked_homes` LONGTEXT NULL,
`last_search_time` DATETIME NULL,
`last_online_time` DATETIME NULL,
PRIMARY KEY (`user_id`),
UNIQUE INDEX (`user_id`))
COMMENT = 'Table to store all searched or subscribed by user data.';
-- Table structure for table `home_details_table`
DROP TABLE IF EXISTS `home_details_table`;
CREATE TABLE `home_details_table` (
`home_id` int(11) NOT NULL auto_increment,
`seller_id` int(11) NOT NULL,
`property_type` varchar(20) NOT NULL,
`property_sell_type` varchar(20) NOT NULL,
`sell_status` varchar(20) NOT NULL,
`address` varchar(200) NOT NULL,
`area` varchar(50) NOT NULL,
`pin_code` int(10) NOT NULL,
`city` varchar(50) NOT NULL,
`country` varchar(50) NOT NULL,
`price` varchar(50) NOT NULL,
`currency_type` varchar(20) NOT NULL,
`description` LONGTEXT NOT NULL,
`submitted_date` DATETIME NOT NULL,
`bought_date` DATETIME NULL,
`buyer_id` int(11) NULL,
`db_path` varchar(200) NOT NULL,
PRIMARY KEY (`home_id`),
UNIQUE KEY (`home_id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=latin1
COMMENT = 'Table to store all homes data.';
-- Table structure for table `home_indexes_table`
DROP TABLE IF EXISTS `home_indexes_table`;
CREATE TABLE `home_indexes_table` (
`home_id` INT NOT NULL,
`keywords` LONGTEXT NOT NULL,
`enable_auto_indexing` BIT NOT NULL DEFAULT 1,
PRIMARY KEY (`home_id`),
UNIQUE INDEX (`home_id`))
COMMENT = 'Table to store all indexes for each home.';
|
-- phpMyAdmin SQL Dump
-- version 5.0.1
-- https://www.phpmyadmin.net/
--
-- Máy chủ: 127.0.0.1
-- Thời gian đã tạo: Th2 27, 2020 lúc 05:51 AM
-- Phiên bản máy phục vụ: 10.4.11-MariaDB
-- Phiên bản PHP: 7.4.2
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 */;
--
-- Cơ sở dữ liệu: `thietbi`
--
-- --------------------------------------------------------
--
-- Cấu trúc bảng cho bảng `lt`
--
CREATE TABLE `lt` (
`id` int(10) NOT NULL,
`ma` varchar(40) COLLATE utf8mb4_unicode_ci NOT NULL,
`ten` varchar(40) COLLATE utf8mb4_unicode_ci NOT NULL,
`dongia` varchar(40) COLLATE utf8mb4_unicode_ci NOT NULL,
`soluong` varchar(40) COLLATE utf8mb4_unicode_ci NOT NULL,
`trangthai` varchar(40) COLLATE utf8mb4_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Đang đổ dữ liệu cho bảng `lt`
--
INSERT INTO `lt` (`id`, `ma`, `ten`, `dongia`, `soluong`, `trangthai`) VALUES
(1, '1', 'Asus S510u', '12000', '10', 'ok'),
(2, '2', 'Dell 6667', '13000', '19', 'dep'),
(3, '3', 'dell8876', '12000', '5', 'ok'),
(4, '4', 'lenovo432', '18990', '7', 'dep'),
(6, '6', 'lenovo8934', '476324', '3', 'ok'),
(7, '7', 'tinkpad5656', '423423', '5', 'dep'),
(8, '8', 'LG72423', '234567', '13', 'ok'),
(9, '9', 'thinkpad567', '432435', '10', 'ok'),
(10, '10', 'thinkpad876', '212313', '14', 'dep');
--
-- Chỉ mục cho các bảng đã đổ
--
--
-- Chỉ mục cho bảng `lt`
--
ALTER TABLE `lt`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT cho các bảng đã đổ
--
--
-- AUTO_INCREMENT cho bảng `lt`
--
ALTER TABLE `lt`
MODIFY `id` int(10) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=11;
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 */;
|
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';
CREATE SCHEMA IF NOT EXISTS `oac_archive` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci ;
USE `oac_archive`;
-- -----------------------------------------------------
-- Table `oac_archive`.`users`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `oac_archive`.`users` ;
CREATE TABLE IF NOT EXISTS `oac_archive`.`users` (
`id` INT NOT NULL AUTO_INCREMENT ,
`username` VARCHAR(50) NOT NULL ,
`full_name` VARCHAR(40) NOT NULL ,
`password` VARCHAR(40) NOT NULL ,
`view_level_flag` INT NULL ,
`created` DATETIME NULL ,
`modified` DATETIME NULL ,
PRIMARY KEY (`id`) )
ENGINE = MyISAM;
-- -----------------------------------------------------
-- Table `oac_archive`.`compilers`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `oac_archive`.`compilers` ;
CREATE TABLE IF NOT EXISTS `oac_archive`.`compilers` (
`id` INT NOT NULL AUTO_INCREMENT ,
`name` VARCHAR(40) NOT NULL ,
`user_id` INT NULL ,
`created` DATETIME NOT NULL ,
`modified` DATETIME NULL ,
PRIMARY KEY (`id`) ,
CONSTRAINT `user_id`
FOREIGN KEY (`user_id` )
REFERENCES `oac_archive`.`users` (`id` )
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = MyISAM;
CREATE INDEX `user_id` ON `oac_archive`.`compilers` (`user_id` ASC) ;
-- -----------------------------------------------------
-- Table `oac_archive`.`audio_album_types`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `oac_archive`.`audio_album_types` ;
CREATE TABLE IF NOT EXISTS `oac_archive`.`audio_album_types` (
`id` INT NOT NULL AUTO_INCREMENT ,
`name` TEXT NOT NULL ,
PRIMARY KEY (`id`) )
ENGINE = MyISAM;
-- -----------------------------------------------------
-- Table `oac_archive`.`login_levels`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `oac_archive`.`login_levels` ;
CREATE TABLE IF NOT EXISTS `oac_archive`.`login_levels` (
`id` INT NOT NULL AUTO_INCREMENT ,
`name` TEXT NOT NULL ,
PRIMARY KEY (`id`) )
ENGINE = MyISAM;
-- -----------------------------------------------------
-- Table `oac_archive`.`audio_albums`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `oac_archive`.`audio_albums` ;
CREATE TABLE IF NOT EXISTS `oac_archive`.`audio_albums` (
`id` INT NOT NULL AUTO_INCREMENT ,
`audio_album_type_id` INT NOT NULL ,
`specified_audio_album_type` VARCHAR(50) NULL ,
`oac_ref_no` VARCHAR(45) NOT NULL ,
`source` VARCHAR(50) NULL ,
`date_acquired` DATE NULL ,
`collection_title` VARCHAR(50) NULL ,
`title` VARCHAR(50) NOT NULL ,
`description` TEXT NULL ,
`artists` VARCHAR(70) NULL ,
`series` VARCHAR(50) NULL ,
`label` VARCHAR(50) NULL ,
`publishers_catalogue_no` VARCHAR(45) NULL ,
`multipe_cds` BOOLEAN NULL ,
`release_date` DATE NULL ,
`recording_venue` VARCHAR(50) NULL ,
`size` VARCHAR(50) NULL ,
`duration` VARCHAR(50) NULL ,
`matrix_no` VARCHAR(45) NULL ,
`producer` VARCHAR(50) NULL ,
`copyright_start_date` DATE NULL ,
`copyright_holders` VARCHAR(50) NULL ,
`artists_url` VARCHAR(70) NULL ,
`recording_engineer` VARCHAR(50) NULL ,
`comments` TEXT NULL ,
`keywords` TEXT NULL ,
`digitizing_engineer` VARCHAR(50) NULL ,
`equipment` VARCHAR(50) NULL ,
`software_package` VARCHAR(50) NULL ,
`digital_artefact_link` VARCHAR(70) NULL ,
`oac_shop_url` VARCHAR(70) NULL ,
`login_level_id` INT NOT NULL ,
`compiler_id` INT NOT NULL ,
`specified_compiler` VARCHAR(50) NULL ,
`created` DATETIME NOT NULL ,
`modified` DATETIME NULL ,
PRIMARY KEY (`id`) ,
CONSTRAINT `compiler_id`
FOREIGN KEY (`compiler_id` )
REFERENCES `oac_archive`.`compilers` (`id` )
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `audio_album_type_id`
FOREIGN KEY (`audio_album_type_id` )
REFERENCES `oac_archive`.`audio_album_types` (`id` )
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `login_level_id`
FOREIGN KEY (`login_level_id` )
REFERENCES `oac_archive`.`login_levels` (`id` )
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = MyISAM;
CREATE INDEX `compiler_id` ON `oac_archive`.`audio_albums` (`compiler_id` ASC) ;
CREATE INDEX `audio_album_type_id` ON `oac_archive`.`audio_albums` (`audio_album_type_id` ASC) ;
CREATE INDEX `login_level_id` ON `oac_archive`.`audio_albums` (`login_level_id` ASC) ;
-- -----------------------------------------------------
-- Table `oac_archive`.`audio_tracks`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `oac_archive`.`audio_tracks` ;
CREATE TABLE IF NOT EXISTS `oac_archive`.`audio_tracks` (
`id` INT NOT NULL AUTO_INCREMENT ,
`track_no` INT NOT NULL ,
`title` VARCHAR(50) NULL ,
`primary_performers` VARCHAR(80) NULL ,
`primary_instruments` VARCHAR(80) NULL ,
`genre` VARCHAR(80) NULL ,
`duration` VARCHAR(80) NULL ,
`performance_date` DATE NULL ,
`composer` VARCHAR(50) NULL ,
`copyright_start_date` DATE NULL ,
`copyright_holder` VARCHAR(50) NULL ,
`comments` TEXT NULL ,
`digital_artefact_link` VARCHAR(80) NULL ,
`synonyms` TEXT NULL ,
`keywords` TEXT NULL ,
`audio_album_id` INT NOT NULL ,
`created` DATETIME NOT NULL ,
`modified` DATETIME NULL ,
PRIMARY KEY (`id`) ,
CONSTRAINT `audio_album_id`
FOREIGN KEY (`audio_album_id` )
REFERENCES `oac_archive`.`audio_albums` (`id` )
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = MyISAM;
CREATE INDEX `audio_album_id` ON `oac_archive`.`audio_tracks` (`audio_album_id` ASC) ;
-- -----------------------------------------------------
-- Table `oac_archive`.`doc_languages`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `oac_archive`.`doc_languages` ;
CREATE TABLE IF NOT EXISTS `oac_archive`.`doc_languages` (
`id` INT NOT NULL AUTO_INCREMENT ,
`name` TEXT NOT NULL ,
PRIMARY KEY (`id`) )
ENGINE = MyISAM;
-- -----------------------------------------------------
-- Table `oac_archive`.`doc_types`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `oac_archive`.`doc_types` ;
CREATE TABLE IF NOT EXISTS `oac_archive`.`doc_types` (
`id` INT NOT NULL AUTO_INCREMENT ,
`name` TEXT NOT NULL ,
PRIMARY KEY (`id`) )
ENGINE = MyISAM;
-- -----------------------------------------------------
-- Table `oac_archive`.`video_types`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `oac_archive`.`video_types` ;
CREATE TABLE IF NOT EXISTS `oac_archive`.`video_types` (
`id` INT NOT NULL AUTO_INCREMENT ,
`name` TEXT NULL ,
PRIMARY KEY (`id`) )
ENGINE = MyISAM;
-- -----------------------------------------------------
-- Table `oac_archive`.`video_albums`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `oac_archive`.`video_albums` ;
CREATE TABLE IF NOT EXISTS `oac_archive`.`video_albums` (
`id` INT NOT NULL AUTO_INCREMENT ,
`video_type_id` INT NOT NULL ,
`specified_video_type` VARCHAR(45) NULL ,
`oac_ref_no` VARCHAR(45) NOT NULL ,
`source` VARCHAR(50) NULL ,
`date_acquired` DATE NULL ,
`collection_title` VARCHAR(45) NULL ,
`title` VARCHAR(45) NOT NULL ,
`description` TEXT NULL ,
`artists` TEXT NULL ,
`series` VARCHAR(45) NULL ,
`label` VARCHAR(45) NULL ,
`publishers_catalogue_no` VARCHAR(45) NULL ,
`release_date` DATE NULL ,
`recording_venue` TEXT NULL ,
`size` VARCHAR(45) NULL ,
`duration` VARCHAR(45) NULL ,
`director` VARCHAR(45) NULL ,
`producer` VARCHAR(45) NULL ,
`production_crew` VARCHAR(75) NULL ,
`studio` VARCHAR(45) NULL ,
`copyright_holder` VARCHAR(45) NULL ,
`copyright_start_date` DATE NULL ,
`artist_url` VARCHAR(65) NULL ,
`comments` TEXT NULL ,
`keywords` TEXT NULL ,
`engineer` VARCHAR(45) NULL ,
`equipment` VARCHAR(45) NULL ,
`software_package` VARCHAR(45) NULL ,
`oac_url` VARCHAR(75) NULL ,
`specified_compiler` VARCHAR(45) NULL ,
`digital_artefact_link` VARCHAR(75) NULL ,
`audio_album_id` INT NULL ,
`login_level_id` INT NOT NULL ,
`compiler_id` INT NOT NULL ,
`created` DATETIME NOT NULL ,
`modified` DATETIME NULL ,
PRIMARY KEY (`id`) ,
CONSTRAINT `compiler_id`
FOREIGN KEY (`compiler_id` )
REFERENCES `oac_archive`.`compilers` (`id` )
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `video_type_id`
FOREIGN KEY (`video_type_id` )
REFERENCES `oac_archive`.`video_types` (`id` )
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `audio_album_id`
FOREIGN KEY (`audio_album_id` )
REFERENCES `oac_archive`.`audio_albums` (`id` )
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `login_level_id`
FOREIGN KEY (`login_level_id` )
REFERENCES `oac_archive`.`login_levels` (`id` )
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = MyISAM;
CREATE INDEX `compiler_id` ON `oac_archive`.`video_albums` (`compiler_id` ASC) ;
CREATE INDEX `video_type_id` ON `oac_archive`.`video_albums` (`video_type_id` ASC) ;
CREATE INDEX `audio_album_id` ON `oac_archive`.`video_albums` (`audio_album_id` ASC) ;
CREATE INDEX `login_level_id` ON `oac_archive`.`video_albums` (`login_level_id` ASC) ;
-- -----------------------------------------------------
-- Table `oac_archive`.`documents`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `oac_archive`.`documents` ;
CREATE TABLE IF NOT EXISTS `oac_archive`.`documents` (
`id` INT NOT NULL AUTO_INCREMENT ,
`oac_ref_no` VARCHAR(45) NOT NULL ,
`doc_type_id` INT NOT NULL ,
`specified_doc_type` VARCHAR(45) NULL ,
`collection_title` VARCHAR(50) NULL ,
`source` VARCHAR(50) NULL ,
`aquisition_date` DATE NULL ,
`title` VARCHAR(50) NOT NULL ,
`edition` VARCHAR(50) NULL ,
`authors` VARCHAR(50) NULL ,
`contributors` TEXT NULL ,
`publisher` VARCHAR(50) NULL ,
`publication_date` DATE NULL ,
`isbn_issn` VARCHAR(45) NULL ,
`series` VARCHAR(50) NULL ,
`description` TEXT NULL ,
`doc_language_id` INT NULL ,
`subject` VARCHAR(50) NULL ,
`copies` VARCHAR(50) NULL ,
`location` VARCHAR(50) NULL ,
`oac_url` VARCHAR(80) NULL ,
`digital_size` VARCHAR(50) NULL ,
`comments` TEXT NULL ,
`contents_page` VARCHAR(40) NULL ,
`keywords` TEXT NULL ,
`copyright_start_date` DATE NULL ,
`copyright_holder` VARCHAR(50) NULL ,
`digital_artefact_link` VARCHAR(75) NULL ,
`compiler_id` INT NOT NULL ,
`specified_compiler` VARCHAR(50) NULL ,
`video_album_id` INT NULL ,
`audio_album_id` INT NULL ,
`login_level_id` INT NOT NULL ,
`created` DATETIME NOT NULL ,
`modified` DATETIME NULL ,
PRIMARY KEY (`id`) ,
CONSTRAINT `compiler_id`
FOREIGN KEY (`compiler_id` )
REFERENCES `oac_archive`.`compilers` (`id` )
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `doc_language_id`
FOREIGN KEY (`doc_language_id` )
REFERENCES `oac_archive`.`doc_languages` (`id` )
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `doc_type_id`
FOREIGN KEY (`doc_type_id` )
REFERENCES `oac_archive`.`doc_types` (`id` )
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `audio_album_id`
FOREIGN KEY (`audio_album_id` )
REFERENCES `oac_archive`.`audio_albums` (`id` )
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `video_album_id`
FOREIGN KEY (`video_album_id` )
REFERENCES `oac_archive`.`video_albums` (`id` )
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `login_level_id`
FOREIGN KEY (`login_level_id` )
REFERENCES `oac_archive`.`login_levels` (`id` )
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = MyISAM;
CREATE INDEX `compiler_id` ON `oac_archive`.`documents` (`compiler_id` ASC) ;
CREATE INDEX `doc_language_id` ON `oac_archive`.`documents` (`doc_language_id` ASC) ;
CREATE INDEX `doc_type_id` ON `oac_archive`.`documents` (`doc_type_id` ASC) ;
CREATE INDEX `audio_album_id` ON `oac_archive`.`documents` (`audio_album_id` ASC) ;
CREATE INDEX `video_album_id` ON `oac_archive`.`documents` (`video_album_id` ASC) ;
CREATE INDEX `login_level_id` ON `oac_archive`.`documents` (`login_level_id` ASC) ;
-- -----------------------------------------------------
-- Table `oac_archive`.`photo_types`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `oac_archive`.`photo_types` ;
CREATE TABLE IF NOT EXISTS `oac_archive`.`photo_types` (
`id` INT NOT NULL AUTO_INCREMENT ,
`name` TEXT NULL ,
PRIMARY KEY (`id`) )
ENGINE = MyISAM;
-- -----------------------------------------------------
-- Table `oac_archive`.`photographs`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `oac_archive`.`photographs` ;
CREATE TABLE IF NOT EXISTS `oac_archive`.`photographs` (
`id` INT NOT NULL AUTO_INCREMENT ,
`oac_ref_no` VARCHAR(45) NOT NULL ,
`photo_type_id` INT NOT NULL ,
`specified_photo_type` VARCHAR(45) NULL ,
`collection_title` VARCHAR(50) NULL ,
`source` VARCHAR(60) NULL ,
`aquisition_date` DATETIME NULL ,
`title` VARCHAR(45) NOT NULL ,
`photographer` VARCHAR(45) NULL ,
`camera` VARCHAR(45) NULL ,
`subject_detail` VARCHAR(60) NULL ,
`date_taken` DATE NULL ,
`copies` VARCHAR(45) NULL ,
`copyright_start_date` DATE NULL ,
`copyright_holder` VARCHAR(50) NULL ,
`location` VARCHAR(45) NULL ,
`comments` TEXT NULL ,
`engineer` VARCHAR(45) NULL ,
`digital_size` VARCHAR(45) NULL ,
`equipment` VARCHAR(45) NULL ,
`software_package` VARCHAR(45) NULL ,
`digital_artefact_link` VARCHAR(45) NULL ,
`oac_url` VARCHAR(70) NULL ,
`audio_album_id` INT NULL ,
`compiler_id` INT NOT NULL ,
`keywords` TEXT NULL ,
`specified_compiler` VARCHAR(45) NULL ,
`login_level_id` INT NOT NULL ,
`document_id` INT NULL ,
`video_album_id` INT NULL ,
`created` DATETIME NOT NULL ,
`modified` DATETIME NULL ,
PRIMARY KEY (`id`) ,
CONSTRAINT `compiler_id`
FOREIGN KEY (`compiler_id` )
REFERENCES `oac_archive`.`compilers` (`id` )
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `photo_type_id`
FOREIGN KEY (`photo_type_id` )
REFERENCES `oac_archive`.`photo_types` (`id` )
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `audio_album_id`
FOREIGN KEY (`audio_album_id` )
REFERENCES `oac_archive`.`audio_albums` (`id` )
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `document_id`
FOREIGN KEY (`document_id` )
REFERENCES `oac_archive`.`documents` (`id` )
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `video_album_id`
FOREIGN KEY (`video_album_id` )
REFERENCES `oac_archive`.`video_albums` (`id` )
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `login_level_id`
FOREIGN KEY (`login_level_id` )
REFERENCES `oac_archive`.`login_levels` (`id` )
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = MyISAM;
CREATE INDEX `compiler_id` ON `oac_archive`.`photographs` (`compiler_id` ASC) ;
CREATE INDEX `photo_type_id` ON `oac_archive`.`photographs` (`photo_type_id` ASC) ;
CREATE INDEX `audio_album_id` ON `oac_archive`.`photographs` (`audio_album_id` ASC) ;
CREATE INDEX `document_id` ON `oac_archive`.`photographs` (`document_id` ASC) ;
CREATE INDEX `video_album_id` ON `oac_archive`.`photographs` (`video_album_id` ASC) ;
CREATE INDEX `login_level_id` ON `oac_archive`.`photographs` (`login_level_id` ASC) ;
-- -----------------------------------------------------
-- Table `oac_archive`.`video_tracks`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `oac_archive`.`video_tracks` ;
CREATE TABLE IF NOT EXISTS `oac_archive`.`video_tracks` (
`id` INT NOT NULL AUTO_INCREMENT ,
`track_no` INT NOT NULL ,
`title` VARCHAR(45) NULL ,
`primary_performers` VARCHAR(70) NULL ,
`primary_instruments` VARCHAR(70) NULL ,
`genre` VARCHAR(50) NULL ,
`duration` VARCHAR(45) NULL ,
`composer` VARCHAR(45) NULL ,
`performance_date` DATE NULL ,
`copyright_holders` VARCHAR(50) NULL ,
`copyright_start_date` DATE NULL ,
`comments` TEXT NULL ,
`keywords` TEXT NULL ,
`digital_artefact_link` VARCHAR(60) NULL ,
`video_album_id` INT NOT NULL ,
`synonyms` TEXT NULL ,
`created` DATETIME NULL ,
`modified` DATETIME NULL ,
PRIMARY KEY (`id`) ,
CONSTRAINT `video_album_id`
FOREIGN KEY (`video_album_id` )
REFERENCES `oac_archive`.`video_albums` (`id` )
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = MyISAM;
CREATE INDEX `video_album_id` ON `oac_archive`.`video_tracks` (`video_album_id` ASC) ;
-- -----------------------------------------------------
-- Table `oac_archive`.`map_types`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `oac_archive`.`map_types` ;
CREATE TABLE IF NOT EXISTS `oac_archive`.`map_types` (
`id` INT NOT NULL AUTO_INCREMENT ,
`name` TEXT NULL ,
PRIMARY KEY (`id`) )
ENGINE = MyISAM;
-- -----------------------------------------------------
-- Table `oac_archive`.`maps`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `oac_archive`.`maps` ;
CREATE TABLE IF NOT EXISTS `oac_archive`.`maps` (
`id` INT NOT NULL AUTO_INCREMENT ,
`oac_ref_no` VARCHAR(45) NOT NULL ,
`map_type_id` INT NOT NULL ,
`specified_map_type` VARCHAR(45) NULL ,
`source` VARCHAR(45) NULL ,
`date_acquired` DATE NULL ,
`collection_title` VARCHAR(45) NULL ,
`title` VARCHAR(45) NOT NULL ,
`scale` VARCHAR(45) NULL ,
`producer` VARCHAR(45) NULL ,
`date_produced` DATE NULL ,
`date_published` DATE NULL ,
`edition_date` DATE NULL ,
`sheet_number` INT NULL ,
`coordinates` VARCHAR(45) NULL ,
`special_purpose` VARCHAR(45) NULL ,
`sheet_size` VARCHAR(45) NULL ,
`publishers_cat_no` VARCHAR(45) NULL ,
`copyright_start_date` DATE NULL ,
`copyright_holders` VARCHAR(50) NULL ,
`description` TEXT NULL ,
`comments` TEXT NULL ,
`keywords` TEXT NULL ,
`digital_artefact_link` VARCHAR(50) NULL ,
`copies` VARCHAR(45) NULL ,
`compiler_id` INT NOT NULL ,
`specified_compiler` VARCHAR(50) NULL ,
`login_level_id` INT NOT NULL ,
`document_id` INT NULL ,
`created` DATETIME NOT NULL ,
`modified` DATETIME NULL ,
PRIMARY KEY (`id`) ,
CONSTRAINT `map_type_id`
FOREIGN KEY (`map_type_id` )
REFERENCES `oac_archive`.`map_types` (`id` )
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `compiler_id`
FOREIGN KEY (`compiler_id` )
REFERENCES `oac_archive`.`compilers` (`id` )
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `login_level_id`
FOREIGN KEY (`login_level_id` )
REFERENCES `oac_archive`.`login_levels` (`id` )
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `document_id`
FOREIGN KEY (`id` )
REFERENCES `oac_archive`.`documents` (`id` )
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = MyISAM;
CREATE TABLE IF NOT EXISTS `oac_archive`.`search_index` (
`id` int(11) NOT NULL auto_increment,
`model` varchar(255) NOT NULL,
`foreign_key` int(11) NOT NULL,
`data` text NOT NULL,
`name` varchar(255) default NULL,
`summary` text,
`url` text,
`active` tinyint(1) NOT NULL default '1',
`published` datetime default NULL,
`created` datetime default NULL,
`modified` datetime default NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `model` (`model`,`foreign_key`),
KEY `active` (`active`),
FULLTEXT KEY `data` (`data`)
) ENGINE=MyISAM;
CREATE INDEX `map_type_id` ON `oac_archive`.`maps` (`map_type_id` ASC) ;
CREATE INDEX `compiler_id` ON `oac_archive`.`maps` (`compiler_id` ASC) ;
CREATE INDEX `login_level_id` ON `oac_archive`.`maps` (`login_level_id` ASC) ;
CREATE INDEX `document_id` ON `oac_archive`.`maps` (`id` ASC) ;
SET SQL_MODE=@OLD_SQL_MODE;
SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;
|
use BIGGYM;
drop function if exists statuscode;
delimiter $$
create function statuscode (finalStatusCode varchar(64))
returns varchar(64)
begin
-- Initialise ..
-- Process ..
return
case
when (strisnumeric(finalStatusCode)) then
case
-- +--------+--------+--------+--------+--------+--------+----
when finalStatusCode = 2 then 'unique key field value(s) already match - no update required'
when finalStatusCode = 1 then 'unique key field values(s) already present in object'
when finalStatusCode = 0 then 'success'
when finalStatusCode = -1 then 'illegal or null character(s) in one or more field value(s)'
when finalStatusCode = -2 then 'no change or attempted duplicate of unique key field value(s)'
when finalStatusCode = -3 then 'anomalous data (likely duplicate) - transaction ignored'
when finalStatusCode = -4 then 'unexpected NULL value for one or more REFERENCEid(s)'
when finalStatusCode = -5 then 'database transaction problem'
when finalStatusCode = -6 then 'invalid date format used'
when finalStatusCode = -7 then 'unexpected NULL value for ObjectId and-or Reference Id(s)'
when finalStatusCode = -8 then 'conflicting Id for EXERCISE present - transaction aborted'
-- +--------+--------+--------+--------+--------+--------+----
else
concat('status code number of [', saynull(finalStatusCode), '] undefined')
end
else
concat('status code number of [', saynull(finalStatusCode), '] undefined')
end;
end $$
delimiter ;
/*
Sample Usage:
set @stCode='1';
select statuscode(@stCode);
set @stCode=1;
select statuscode(@stCode);
set @stCode=0;
select statuscode(@stCode);
set @stCode=-7;
select statuscode(@stCode);
set @stCode=-99;
select statuscode(@stCode);
set @stCode=NULL;
select statuscode(@stCode);
set @stCode='Turnips for tea';
select statuscode(@stCode);
*/
|
use HOMv18
insert into Kullanici(kullanici_id, kullanici_isim, sifre, e_mail) values (1, 'Merve Tahtaci', '12345a', 'tahtaci@gmail.com')
insert into Kullanici(kullanici_id, kullanici_isim, sifre, e_mail) values (2, 'Ozum Oral','123a','ozumoral@gmail.com')
insert into Kullanici(kullanici_id, kullanici_isim, sifre, e_mail) values (3, 'Hasan Erfenek','aaa111','erfenek@outlook.com')
insert into Kullanici(kullanici_id, kullanici_isim, sifre, e_mail) values (4, 'Eda Filiz','ksdfkd1','edafiliz16@gmail.com')
insert into Kullanici(kullanici_id, kullanici_isim, sifre, e_mail) values (5, 'Hazal Sunal', 'ffkdlf','sunal35@hotmail.com')
insert into Kullanici(kullanici_id, kullanici_isim, sifre, e_mail) values (6, 'Kemal Sunal', 'wdlf001','ksunal@hotmail.com')
insert into Kullanici(kullanici_id, kullanici_isim, sifre, e_mail) values (7, 'Sevcan Ölçüm', 'ölçüm11','olcum10@hotmail.com')
insert into Kullanici(kullanici_id, kullanici_isim, sifre, e_mail) values (8, 'Fikri Aktaş', 'furkan367','aktas367@hotmail.com')
insert into Kullanici(kullanici_id, kullanici_isim, sifre, e_mail) values (9, 'Mehmet Demir', 'dem11','mehdemir@hotmail.com')
insert into Kullanici(kullanici_id, kullanici_isim, sifre, e_mail) values (10,'Emine Bedel', 'emnafk12','emine@outlook.com')
insert into Kullanici(kullanici_id, kullanici_isim, sifre, e_mail) values (11, 'Halit Ergenç', 'bergüzar123', 'halitergenc@outlook.com')
insert into Kullanici(kullanici_id, kullanici_isim, sifre, e_mail) values (12, 'Selçuk Yöntem', 'askimemnu', 'selcukyontem@gmail.com')
insert into Kullanici(kullanici_id, kullanici_isim, sifre, e_mail) values (13, 'Zerrin Tekindor', 'ednanbey', 'tahtaci@gmail.com')
insert into Kullanici(kullanici_id, kullanici_isim, sifre, e_mail) values (14, 'Şeyma Subaşı', 'melisacun125', 'seymasubasi@yahoo.com')
insert into Company(company_id,company_name,aciklama,lokasyon,takipci_sayisi)values(1,'Tofaş','Türk Otomobil Fabrikası','Bursa',50000)
insert into Company(company_id,company_name,aciklama,lokasyon,takipci_sayisi)values(2,'Turk Telekom','Telekomünikasyon Şirketi','İstanbul',100000)
insert into Company(company_id,company_name,aciklama,lokasyon,takipci_sayisi)values(3,'Botart','Yapay Zeka Chatbot','İzmir',25)
insert into Company(company_id,company_name,aciklama,lokasyon,takipci_sayisi)values(4,'Medipol Sağlık Grubu','Kalbiniz kadar yakın','İstanbul',15000)
insert into Company(company_id,company_name,aciklama,lokasyon,takipci_sayisi)values(5,'Kanal D','Bizi İzlemeye devam edin..','İstanbul',12000)
insert into Okul(okul_id,okul_adi,aciklama,lokasyon,takipci_sayisi)values(1,'Ege Üniversitesi','hayallerinizdeki okul','İzmir',80000)
insert into Okul(okul_id,okul_adi,aciklama,lokasyon,takipci_sayisi)values(2,'İTÜ','teknik bir üniversite','İstanbul',100000)
insert into Okul(okul_id,okul_adi,aciklama,lokasyon,takipci_sayisi)values(3,'ODTÜ','soğuk ve gri bir hava hakim','Ankara',100000)
insert into Okul(okul_id,okul_adi,aciklama,lokasyon,takipci_sayisi)values(4,'9 Eylül','dağda..','İzmir',50000)
insert into Ilgi_Alani(ilgialani_id,kullanici_id,okul_id)values(1,1,1)
insert into Ilgi_Alani(ilgialani_id,kullanici_id,okul_id,company_id)values(2,2,1,2)
insert into Ilgi_Alani(ilgialani_id,kullanici_id,okul_id,company_id)values(3,3,3,3)
insert into Is_Ilani(ilan_id,company_id,baslik,aciklama)values(1,3,'DB Admin','Şirketimizde çalışacak Db Admin aranmaktadır.')
insert into Is_Ilani(ilan_id,company_id,baslik,aciklama)values(2,3,'Java Developer','Şirketimizde çalışacak Java Developer aranmaktadır.')
insert into Is_Ilani(ilan_id,company_id,baslik,aciklama)values(3,3,'C# Developer','Şirketimizde çalışacak C# Developer aranmaktadır.')
insert into Is_Ilani(ilan_id,company_id,baslik,aciklama)values(4,2,'Mobile Developer','Şirketimizde çalışacak Mobile Developer aranmaktadır.')
insert into Is_Ilani(ilan_id,company_id,baslik,aciklama)values(5,1,'Analist','Şirketimizde çalışacak Analist aranmaktadır.')
insert into Is_Ilani_Basvuru(ilan_id,kullanici_id) values(1,1)
insert into Is_Ilani_Basvuru(ilan_id,kullanici_id) values(1,3)
insert into Is_Ilani_Basvuru(ilan_id,kullanici_id) values(1,5)
insert into Is_Ilani_Basvuru(ilan_id,kullanici_id) values(1,6)
insert into Is_Ilani_Basvuru(ilan_id,kullanici_id) values(2,2)
insert into Is_Ilani_Basvuru(ilan_id,kullanici_id) values(2,8)
insert into Is_Ilani_Basvuru(ilan_id,kullanici_id) values(3,4)
insert into Yetenek(yetenek_id,yetenek_adi)values(1,'Java')
insert into Yetenek(yetenek_id,yetenek_adi)values(2,'C#')
insert into Yetenek(yetenek_id,yetenek_adi)values(3,'Database')
insert into Yetenek(yetenek_id,yetenek_adi)values(4,'Android')
insert into Yetenek(yetenek_id,yetenek_adi)values(5,'Swift')
insert into Yetenek(yetenek_id,yetenek_adi)values(6,'HTML')
insert into Yetenek(yetenek_id,yetenek_adi)values(7,'mySql')
insert into Yetenek(yetenek_id,yetenek_adi)values(8,'Marketing')
insert into Yetenek(yetenek_id,yetenek_adi)values(9,'Grup Çalışması')
insert into Kullanici_yetenek(kullanici_id,yetenek_id) values(1,3)
insert into Kullanici_yetenek(kullanici_id,yetenek_id) values(1,9)
insert into Kullanici_yetenek(kullanici_id,yetenek_id) values(3,1)
insert into Kullanici_yetenek(kullanici_id,yetenek_id) values(3,4)
insert into Kullanici_yetenek(kullanici_id,yetenek_id) values(2,2)
insert into Kullanici_yetenek(kullanici_id,yetenek_id) values(2,5)
insert into Kullanici_yetenek(kullanici_id,yetenek_id) values(5,8)
insert into Kullanici_yetenek(kullanici_id,yetenek_id) values(6,4)
insert into Kullanici_yetenek(kullanici_id,yetenek_id) values(7,2)
insert into Kullanici_yetenek(kullanici_id,yetenek_id) values(9,9)
insert into Kullanici_yetenek(kullanici_id,yetenek_id) values(10,3)
insert into Kullanici_yetenek(kullanici_id,yetenek_id) values(12,4)
insert into Kullanici_yetenek(kullanici_id,yetenek_id) values(8,2)
insert into Kullanici_yetenek(kullanici_id,yetenek_id) values(3,2)
insert into Yetenek_Onayi(yetenek_sahibi_id,onaylayan_kisi_id,yetenek_id)values(1,3,1)
insert into Yetenek_Onayi(yetenek_sahibi_id,onaylayan_kisi_id,yetenek_id)values(1,3,4)
insert into Yetenek_Onayi(yetenek_sahibi_id,onaylayan_kisi_id,yetenek_id)values(2,7,2)
insert into Yetenek_Onayi(yetenek_sahibi_id,onaylayan_kisi_id,yetenek_id)values(4,5,3)
insert into Is_Ilani_Yetenek(ilan_id,yetenek_id) values (1,3)
insert into Is_Ilani_Yetenek(ilan_id,yetenek_id) values (2,1)
insert into Is_Ilani_Yetenek(ilan_id,yetenek_id) values (3,2)
insert into Is_Ilani_Yetenek(ilan_id,yetenek_id) values (4,4)
insert into Is_Ilani_Yetenek(ilan_id,yetenek_id) values (4,5)
insert into Is_Ilani_Yetenek(ilan_id,yetenek_id) values (5,6)
insert into Profil(profil_id , kullanici_id, about_me , iliski) values (1, 1, '21/Bilmüh/Bursa', 'Karışık')
insert into Profil(profil_id , kullanici_id, about_me , iliski) values (2, 2, '22/Bilmüh/Antalya', 'Var')
insert into Profil(profil_id , kullanici_id, about_me , iliski) values (3, 3, '23/Bilmüh/Nazilli', 'Var')
insert into Profil(profil_id , kullanici_id, about_me , iliski) values (4, 4, '22/Bilmüh/İzmir', 'Var')
insert into Profil(profil_id , kullanici_id, about_me , iliski) values (5, 5, '22/Diş Hekimi/Bursa', 'Yok')
insert into Profil(profil_id , kullanici_id, about_me , iliski) values (6, 6, '22/Tıp Öğrencisi/Bursa', 'Yok')
insert into Profil(profil_id , kullanici_id, about_me , iliski) values (7, 7, '14/Lise Öğrencisi/Antalya', 'Yok')
insert into Profil(profil_id , kullanici_id, about_me , iliski) values (8, 8, '22/Bilmüh/Balıkesir', 'Karışık')
insert into Profil(profil_id , kullanici_id, about_me , iliski) values (9, 9, '61/Aşçı/İstanbul', 'Evli')
insert into Profil(profil_id , kullanici_id, about_me , iliski) values (10, 10, '33/Mafya ve Futbolcu/İstanbul', 'Evli')
insert into Profil(profil_id , kullanici_id, about_me , iliski) values (11, 11, '41/Oyuncu/İstanbul', 'Evli')
insert into Profil(profil_id , kullanici_id, about_me , iliski) values (12, 12, '55/Tiyatrocu/İstanbul', '-')
insert into Profil(profil_id , kullanici_id, about_me , iliski) values (13, 13, '50/Tiyatrocu/İstanbul', 'Evli')
insert into Profil(profil_id , kullanici_id, about_me , iliski) values (14, 14, '28/Blogger/İstanbul', 'Bekar')
insert into Bildirim(bildirim_id,kullanici_id,bildirim_icerik)values(1,1,'Profiliniz Görüntüleniyor')
insert into Bildirim(bildirim_id,kullanici_id,bildirim_icerik)values(2,1,'Hasan Erfeneki tanıyor musunuz?')
insert into Bildirim(bildirim_id,kullanici_id,bildirim_icerik)values(3,2,'Önder Topaloğlu adlı kişiden mesaj')
insert into Bildirim(bildirim_id,kullanici_id,bildirim_icerik) values (12, 1, 'Edanur Filiz seni Bursalılar grubuna davet etti.')
insert into Bildirim(bildirim_id, kullanici_id, bildirim_icerik) values (13, 2, 'Mustafa Ege Oral sana arkadaşlık isteği gönderdi.')
insert into Bildirim(bildirim_id, kullanici_id, bildirim_icerik) values (14, 3, 'İdil Sera Şahin sana Candy Crush daveti gönderdi.')
insert into Bildirim(bildirim_id, kullanici_id, bildirim_icerik) values (4, 4, 'Özüm Oral sana mesaj gönderdi.')
insert into Bildirim(bildirim_id, kullanici_id, bildirim_icerik) values (5, 10, 'İstanbuldaki çatışmada güvende olduğunu bildir!')
insert into Bildirim(bildirim_id, kullanici_id, bildirim_icerik) values (6, 11, 'İstanbuldaki çatışmada güvende olduğunu bildir!')
insert into Bildirim(bildirim_id, kullanici_id, bildirim_icerik) values (7, 14, 'Aylin Şahin fotoğrafını beğendi.')
insert into Bildirim(bildirim_id, kullanici_id, bildirim_icerik) values (8, 12, 'Tiyatro grubuna davet edildin.')
insert into Bildirim(bildirim_id, kullanici_id, bildirim_icerik) values (9, 13, 'Tiyatro grubuna davet edildin.')
insert into Bildirim(bildirim_id, kullanici_id, bildirim_icerik) values (10, 12, 'Futbolcular grubuna davet edildin.')
insert into Bildirim(bildirim_id, kullanici_id, bildirim_icerik) values (11, 12, 'Edanur Filiz seni Bursalılar grubuna davet etti.')
insert into Arkadaslar(kullanici_id, arkadas_id) values (1,13)
insert into Arkadaslar(kullanici_id, arkadas_id) values (1,6)
insert into Arkadaslar(kullanici_id, arkadas_id) values (1,3)
insert into Arkadaslar(kullanici_id, arkadas_id) values (1,5)
insert into Arkadaslar(kullanici_id, arkadas_id) values (2,4)
insert into Arkadaslar(kullanici_id, arkadas_id) values (2,7)
insert into Arkadaslar(kullanici_id, arkadas_id) values (2,8)
insert into Arkadaslar(kullanici_id, arkadas_id) values (3,2)
insert into Arkadaslar(kullanici_id, arkadas_id) values (8,3)
insert into Arkadaslar(kullanici_id, arkadas_id) values (4,7)
insert into Arkadaslar(kullanici_id, arkadas_id) values (7,1)
insert into Arkadaslar(kullanici_id, arkadas_id) values (4,10)
insert into Arkadaslar(kullanici_id, arkadas_id) values (5,6)
insert into Arkadaslar(kullanici_id, arkadas_id) values (12,13)
insert into Arkadaslar(kullanici_id, arkadas_id) values (12,11)
insert into Arkadaslar(kullanici_id, arkadas_id) values (9,10)
insert into Arkadaslar(kullanici_id, arkadas_id) values (9,14)
insert into Gizlilik(kullanici_id, yasakli_kisi_id) values (1,6)
insert into Gizlilik(kullanici_id, yasakli_kisi_id) values (1,9)
insert into Gizlilik(kullanici_id, yasakli_kisi_id)values (2,4)
insert into Gizlilik(kullanici_id, yasakli_kisi_id) values (2,7)
insert into Gizlilik(kullanici_id, yasakli_kisi_id) values (3,8)
insert into Fotograf_album(fotograf_album_id,kullanici_id,album_isim)values(1,1,'IBM')
insert into Fotograf_album(fotograf_album_id,kullanici_id,album_isim)values(2,2,'Turk Telekom')
insert into Fotograf_album(fotograf_album_id,kullanici_id,album_isim)values(3,3,'Yapay Zeka')
insert into Fotograf_album(fotograf_album_id,kullanici_id,album_isim)values(4,3,'database')
insert into Fotograf_album(fotograf_album_id,kullanici_id,album_isim)values(5,4,'kongre')
insert into Fotograf_album(fotograf_album_id,kullanici_id,album_isim)values(6,7,'görüntü işleme')
insert into Fotograf(fotograf_id,fotograf_album_id)values(1,1)
insert into Fotograf(fotograf_id,fotograf_album_id)values(2,1)
insert into Fotograf(fotograf_id,fotograf_album_id)values(3,3)
insert into Fotograf(fotograf_id,fotograf_album_id)values(4,4)
insert into Fotograf(fotograf_id,fotograf_album_id)values(5,5)
insert into Fotograf(fotograf_id,fotograf_album_id)values(6,6)
insert into Video(video_id,kullanici_id,video_adi)values(1,1,'data structures')
insert into Video(video_id,kullanici_id,video_adi)values(2,7,'tez')
insert into Video(video_id,kullanici_id,video_adi)values(3,4,'diş')
insert into Video(video_id,kullanici_id,video_adi)values(4,5,'tıp')
insert into Post(post_id,kullanici_id,post_icerik,begeni_sayisi)values(1,1,'mühendisler gününüz kutlu olsun!',4)
insert into Post(post_id,kullanici_id,post_icerik,album_id,begeni_sayisi)values(2,7,'Bugünkü kongremizden kareler',1,4)
insert into Post(post_id,kullanici_id,post_icerik,video_id,begeni_sayisi)values(3,3,'Yapay Zeka üzerine...',2,2)
insert into Post(post_id,kullanici_id,post_icerik,begeni_sayisi)values(4,10,'nefis yemek tarifleri için web sitem: www.eminebedel.com',2)
insert into Post_begeni(begeni_id,begenen_kisi_id,post_id)values(1,1,1)
insert into Post_begeni(begeni_id,begenen_kisi_id,post_id)values(2,1,1)
insert into Post_begeni(begeni_id,begenen_kisi_id,post_id)values(3,7,2)
insert into Post_begeni(begeni_id,begenen_kisi_id,post_id)values(4,3,3)
insert into Post_begeni(begeni_id,begenen_kisi_id,post_id)values(5,10,4)
insert into Post_begeni(begeni_id,begenen_kisi_id,post_id)values(6,7,2)
insert into Post_begeni(begeni_id,begenen_kisi_id,post_id)values(7,1,1)
insert into Post_begeni(begeni_id,begenen_kisi_id,post_id)values(8,1,1)
insert into Post_begeni(begeni_id,begenen_kisi_id,post_id)values(9,7,2)
insert into Post_begeni(begeni_id,begenen_kisi_id,post_id)values(10,3,3)
insert into Post_begeni(begeni_id,begenen_kisi_id,post_id)values(11,10,4)
insert into Post_begeni(begeni_id,begenen_kisi_id,post_id)values(12,7,2)
insert into Post_yorum(yorum_id,post_id,yorum_yapan_kisi_id,yorum)values(1,1,1,'teşekkür ederim,senin de!')
insert into Post_yorum(yorum_id,post_id,yorum_yapan_kisi_id,yorum)values(2,2,2,'harika görünüyor..')
insert into Post_yorum(yorum_id,post_id,yorum_yapan_kisi_id,yorum)values(3,3,3,'çok faydalı bir paylaşım')
insert into Post_yorum(yorum_id,post_id,yorum_yapan_kisi_id,yorum)values(4,4,10,'en kısa zamanda tariflerinizi deneyeceğim!')
insert into Post_yorum(yorum_id,post_id,yorum_yapan_kisi_id,yorum)values(5,1,1,'teşekkür ederim,senin de!')
insert into Post_yorum(yorum_id,post_id,yorum_yapan_kisi_id,yorum)values(6,2,2,'harika görünüyor..')
insert into Post_yorum(yorum_id,post_id,yorum_yapan_kisi_id,yorum)values(7,3,3,'çok faydalı bir paylaşım')
insert into Post_yorum(yorum_id,post_id,yorum_yapan_kisi_id,yorum)values(8,4,10,'en kısa zamanda tariflerinizi deneyeceğim!')
insert into Mesaj(mesaj_id, kullanici_id, kimden_id, icerik) values (1, 1, 10, 'Yarın halısahada beni izler misin :))')
insert into Mesaj(mesaj_id, kullanici_id, kimden_id, icerik) values (2, 1, 5, 'Eve gelirken ekmek al.')
insert into Mesaj(mesaj_id, kullanici_id, kimden_id, icerik) values (3, 2, 4, 'İyi ki varsın :)')
insert into Mesaj(mesaj_id, kullanici_id, kimden_id, icerik) values (4, 2, 7, 'Antalyaya gel!!!!')
insert into Mesaj(mesaj_id, kullanici_id, kimden_id, icerik) values (5, 6, 5, 'Elim kesildi napayım knk')
insert into Mesaj(mesaj_id, kullanici_id, kimden_id, icerik) values (6, 9, 8, 'Sizin yemeklerinize bayılıyorum :)')
insert into Mesaj(mesaj_id, kullanici_id, kimden_id, icerik) values (7, 3, 14, 'Selam, kodların çok güzel')
insert into Mesaj(mesaj_id, kullanici_id, kimden_id, icerik) values (8, 12, 11, 'Çok yetenekli oyuncularız be')
insert into Mesaj(mesaj_id, kullanici_id, kimden_id, icerik) values (9, 11, 12, 'Gerçekten öyleyiz abi')
insert into Mesaj(mesaj_id,kullanici_id,kimden_id,icerik)values(10,1,2,'Selam Merve,profilin harika gözüküyor..')
insert into Mesaj(mesaj_id,kullanici_id,kimden_id,icerik)values(11,2,1,'Selam Özüm,darısı sana!')
insert into Mesaj(mesaj_id,kullanici_id,kimden_id,icerik)values(12,10,7,'Emine hanım yemeklerinize bayılıyorum..')
insert into Mesaj(mesaj_id,kullanici_id,kimden_id,icerik)values(13,7,2,'Sevcan stajını hala yapmadın mı?')
insert into Mesaj(mesaj_id,kullanici_id,kimden_id,icerik)values(14,2,7,'Bu kış yapacağım.')
insert into Mesaj(mesaj_id,kullanici_id,kimden_id,icerik)values(15,3,8,'Yeni iş pozisyonunu tebrik ederim!')
insert into Dil(dil_id, dil_adi) values (1, 'Türkçe')
insert into Dil(dil_id, dil_adi) values (2, 'İngilizce')
insert into Dil(dil_id, dil_adi) values (3, 'Almanca')
insert into Dil(dil_id, dil_adi) values (4, 'Rusça')
insert into Dil(dil_id, dil_adi) values (5, 'Japonca')
insert into Kullanilan_Dil(dil_id, kullanici_id) values (1,1)
insert into Kullanilan_Dil(dil_id, kullanici_id) values (1,2)
insert into Kullanilan_Dil(dil_id, kullanici_id) values (2,3)
insert into Kullanilan_Dil(dil_id, kullanici_id) values (1,4)
insert into Kullanilan_Dil(dil_id, kullanici_id) values (4,5)
insert into Kullanilan_Dil(dil_id, kullanici_id) values (2,6)
insert into Kullanilan_Dil(dil_id, kullanici_id) values (1,7)
insert into Kullanilan_Dil(dil_id, kullanici_id) values (5,8)
insert into Kullanilan_Dil(dil_id, kullanici_id) values (3,9)
insert into Kullanilan_Dil(dil_id, kullanici_id) values (2,10)
insert into Kullanilan_Dil(dil_id, kullanici_id) values (4,11)
insert into Kullanilan_Dil(dil_id, kullanici_id) values (5,12)
insert into Kullanilan_Dil(dil_id, kullanici_id) values (3,13)
insert into Kullanilan_Dil(dil_id, kullanici_id) values (5,14)
insert into Topluluk(topluluk_id,topluluk_adi,aciklama)values(1,'Genç Girişimciler Topluluğu','Girişimcilik faaliyetleri hakkinda bilgi alın!')
insert into Topluluk(topluluk_id,topluluk_adi,aciklama)values(2,'Gastronomi','Yemek yapmayı öğrenin!')
insert into Topluluk(topluluk_id,topluluk_adi,aciklama)values(3,'IEEE','Institute of Engineers and Everyone Else')
insert into Topluluk(topluluk_id,topluluk_adi,aciklama)values(4,'Tıp Öğrencileri Topluluğu','3-2-1 Tıp!')
insert into Topluluk_Uyeleri(topluluk_id,kullanici_id)values(1,1)
insert into Topluluk_Uyeleri(topluluk_id,kullanici_id)values(2,10)
insert into Topluluk_Uyeleri(topluluk_id,kullanici_id)values(3,2)
insert into Topluluk_Uyeleri(topluluk_id,kullanici_id)values(4,5)
insert into Adres(adres_id, profil_id, adres) values (1, 1, 'İzmir- Mansuroğlu Mahallesi')
insert into Adres(adres_id, profil_id, adres) values (2, 2, 'İzmir- Kazım Dirik Mahallesi')
insert into Adres(adres_id, profil_id, adres) values (3, 3, 'İzmir- Altıntaş Mahallesi')
insert into Adres(adres_id, profil_id, adres) values (4, 4, 'İzmir- Bahriye Üçok Mahallesi')
insert into Adres(adres_id, profil_id, adres) values (5, 5, 'İzmir- Mansuroğlu Mahallesi')
insert into Adres(adres_id, profil_id, adres) values (6, 6, 'Bursa-Ataevler Mahallesi')
insert into Adres(adres_id, profil_id, adres) values (7, 7, 'Antalya-Zümrütova Mahallesi')
insert into Adres(adres_id, profil_id, adres) values (8, 8, 'İzmir- Ölçüm Mahallesi')
insert into Adres(adres_id, profil_id, adres) values (9, 9, 'Ankara- Emek Mahallesi')
insert into Adres(adres_id, profil_id, adres) values (10, 10,'İstanbul- Beykoz Mahallesi')
insert into Adres(adres_id, profil_id, adres) values (11, 11,'İstanbul- Acarkent Mahallesi')
insert into Adres(adres_id, profil_id, adres) values (12, 12,'İstanbul- Acarkent Mahallesi')
insert into Adres(adres_id, profil_id, adres) values (13, 13,'İstanbul- Florya Mahallesi')
insert into Adres(adres_id, profil_id, adres) values (14, 14,'İstanbul- Bebek Mahallesi')
insert into Fan_sayfa(fan_sayfa_id, web_adres) values (1, 'www.roleplay.com')
insert into Fan_sayfa(fan_sayfa_id, web_adres) values (2, 'www.playgame.com')
insert into Fan_sayfa(fan_sayfa_id, web_adres) values (3, 'www.nazilli.com')
insert into Fan_sayfa(fan_sayfa_id, web_adres) values (4, 'www.egeuniversitesi.com')
insert into Fan_sayfa(fan_sayfa_id, web_adres) values (5, 'www.travelling.com')
insert into Begenilen_fan_sayfa(fan_sayfa_id,kullanici_id) values (3,3)
insert into Begenilen_fan_sayfa(fan_sayfa_id,kullanici_id) values (1,2)
insert into Begenilen_fan_sayfa(fan_sayfa_id,kullanici_id) values (2,2)
insert into Begenilen_fan_sayfa(fan_sayfa_id,kullanici_id) values (3,2)
insert into Begenilen_fan_sayfa(fan_sayfa_id,kullanici_id) values (2,3)
insert into Begenilen_fan_sayfa(fan_sayfa_id,kullanici_id) values (3,5)
insert into Begenilen_fan_sayfa(fan_sayfa_id,kullanici_id) values (4,5)
insert into Begenilen_fan_sayfa(fan_sayfa_id,kullanici_id) values (4,6)
insert into Begenilen_fan_sayfa(fan_sayfa_id,kullanici_id) values (2,7)
insert into Begenilen_fan_sayfa(fan_sayfa_id,kullanici_id) values (3,8)
insert into Begenilen_fan_sayfa(fan_sayfa_id,kullanici_id) values (3,9)
insert into Deneyim(deneyim_id,kullanici_id,company_id,pozisyon,start_date,end_date)values(1,2,1,'İş Analisti',(convert (date, '10-10-2016', 105)),(convert (date, '10-12-2017', 105)))
insert into Deneyim(deneyim_id,kullanici_id,company_id,pozisyon,start_date,end_date)values(2,3,3,'Software Developer',(convert (date, '20-03-2017', 105)),(convert (date, '05-11-2018', 105)))
insert into Deneyim(deneyim_id,kullanici_id,company_id,pozisyon,start_date,end_date)values(3,10,5,'Nefis Tatlar Program',(convert (date, '15-01-2005', 105)),(convert (date, '20-12-2010', 105)))
insert into Deneyim(deneyim_id,kullanici_id,company_id,pozisyon,start_date,end_date)values(4,5,4,'Stajyer',(convert (date, '20-06-2018', 105)),(convert (date, '01-8-2018', 105)))
insert into Egitim(egitim_id,kullanici_id,okul_id,start_date,end_date)values(1,1,1,(convert (date, '27-08-2015', 105)),(convert (date, '07-07-2019', 105)))
insert into Egitim(egitim_id,kullanici_id,okul_id,start_date,end_date)values(2,2,1,(convert (date, '15-08-2012', 105)),(convert (date, '10-07-2016', 105)))
insert into Egitim(egitim_id,kullanici_id,okul_id,start_date,end_date)values(3,5,4,(convert (date, '28-07-2016', 105)),(convert (date, '11-08-2022', 105)))
insert into Egitim(egitim_id,kullanici_id,okul_id,start_date,end_date)values(4,3,3,(convert (date, '27-08-2013', 105)),(convert (date, '07-07-2017', 105)))
insert into Egitim(egitim_id,kullanici_id,okul_id,start_date,end_date)values(5,4,1,(convert (date, '20-07-2015', 105)),(convert (date, '10-08-2020', 105)))
insert into Egitim(egitim_id,kullanici_id,okul_id,start_date,end_date)values(6,8,2,(convert (date, '21-07-2015', 105)),(convert (date, '10-08-2023', 105)))
insert into Foto_tag(fotograf_id, etiketlenen_kisi) values (1, 1)
insert into Foto_tag(fotograf_id, etiketlenen_kisi) values (2, 2)
insert into Foto_tag(fotograf_id, etiketlenen_kisi) values (3, 3)
insert into Foto_tag(fotograf_id, etiketlenen_kisi) values (4, 4)
insert into Foto_tag(fotograf_id, etiketlenen_kisi) values (5, 5)
insert into Foto_tag(fotograf_id, etiketlenen_kisi) values (6, 6)
insert into Foto_tag(fotograf_id, etiketlenen_kisi) values (7, 7)
insert into Foto_tag(fotograf_id, etiketlenen_kisi) values (8, 8)
insert into Foto_tag(fotograf_id, etiketlenen_kisi) values (9, 9)
insert into Foto_tag(fotograf_id, etiketlenen_kisi) values (10, 9)
insert into Foto_tag(fotograf_id, etiketlenen_kisi) values (11, 10)
insert into Foto_tag(fotograf_id, etiketlenen_kisi) values (12, 10)
insert into Foto_tag(fotograf_id, etiketlenen_kisi) values (13, 11)
insert into Foto_tag(fotograf_id, etiketlenen_kisi) values (14, 12)
insert into Foto_tag(fotograf_id, etiketlenen_kisi) values (15, 13)
insert into Foto_tag(fotograf_id, etiketlenen_kisi) values (16, 14)
|
#订单详细表
CREATE TABLE orders_detail(
id INT AUTO_INCREMENT,
detail VARCHAR(2000),
order_id INT,
PRIMARY KEY(id)
);
CREATE TABLE orders_detail_1(
id INT AUTO_INCREMENT,
detail VARCHAR(2000),
order_id INT,
PRIMARY KEY(id)
);
CREATE TABLE orders_detail_2(
id INT AUTO_INCREMENT,
detail VARCHAR(2000),
order_id INT,
PRIMARY KEY(id)
); |
prompt PL/SQL Developer import file
prompt Created on 2008Äê10ÔÂ14ÈÕ by Administrator
set feedback off
set define off
prompt Disabling triggers for T_TIF_CFGTXFEE...
alter table T_TIF_CFGTXFEE disable all triggers;
prompt Deleting T_TIF_CFGTXFEE...
delete from T_TIF_CFGTXFEE;
commit;
prompt Loading T_TIF_CFGTXFEE...
insert into T_TIF_CFGTXFEE (FEE_TYPE, TX_CODE, FEE_LIST, IDXDBACTNO_LIST, IDXCRACTNO_LIST, FORMULA_LIST)
values (0, 847330, '72', '0', '1', '$0');
insert into T_TIF_CFGTXFEE (FEE_TYPE, TX_CODE, FEE_LIST, IDXDBACTNO_LIST, IDXCRACTNO_LIST, FORMULA_LIST)
values (0, 847105, '18,19,20,5,16,6,35,7,36,64,65', null, null, '$0*(1-@5),$0*(1-@5),$2*(1-@6),$0*@5*@1,$2*@6*@1,$0*@5*@2,$2*@6*@2,$0*@5*@3,$2*@6*@3,$4,$5');
insert into T_TIF_CFGTXFEE (FEE_TYPE, TX_CODE, FEE_LIST, IDXDBACTNO_LIST, IDXCRACTNO_LIST, FORMULA_LIST)
values (0, 847231, '59', null, null, '$0');
insert into T_TIF_CFGTXFEE (FEE_TYPE, TX_CODE, FEE_LIST, IDXDBACTNO_LIST, IDXCRACTNO_LIST, FORMULA_LIST)
values (0, 847232, '60', null, null, '$0');
insert into T_TIF_CFGTXFEE (FEE_TYPE, TX_CODE, FEE_LIST, IDXDBACTNO_LIST, IDXCRACTNO_LIST, FORMULA_LIST)
values (0, 930034, '1,64', null, null, '$0,$2');
insert into T_TIF_CFGTXFEE (FEE_TYPE, TX_CODE, FEE_LIST, IDXDBACTNO_LIST, IDXCRACTNO_LIST, FORMULA_LIST)
values (0, 930031, '15,65,64,10', null, null, '$0,$3,$2,$1');
insert into T_TIF_CFGTXFEE (FEE_TYPE, TX_CODE, FEE_LIST, IDXDBACTNO_LIST, IDXCRACTNO_LIST, FORMULA_LIST)
values (0, 843351, '67,68', null, null, '$0,$1');
insert into T_TIF_CFGTXFEE (FEE_TYPE, TX_CODE, FEE_LIST, IDXDBACTNO_LIST, IDXCRACTNO_LIST, FORMULA_LIST)
values (0, 843352, '69,70', null, null, '$0,$1');
insert into T_TIF_CFGTXFEE (FEE_TYPE, TX_CODE, FEE_LIST, IDXDBACTNO_LIST, IDXCRACTNO_LIST, FORMULA_LIST)
values (0, 849003, '71', null, null, '$0');
insert into T_TIF_CFGTXFEE (FEE_TYPE, TX_CODE, FEE_LIST, IDXDBACTNO_LIST, IDXCRACTNO_LIST, FORMULA_LIST)
values (0, 847116, '13,1', null, null, '20,$0-20');
insert into T_TIF_CFGTXFEE (FEE_TYPE, TX_CODE, FEE_LIST, IDXDBACTNO_LIST, IDXCRACTNO_LIST, FORMULA_LIST)
values (0, 847107, '5,6,7', '0,0,0', null, '$0*@1,$0*@2,$0*@3');
insert into T_TIF_CFGTXFEE (FEE_TYPE, TX_CODE, FEE_LIST, IDXDBACTNO_LIST, IDXCRACTNO_LIST, FORMULA_LIST)
values (17, 847124, '11,1,29,2,30,3', null, null, '20*@1,($0-20)*@1,20*@2,($0-20)*@2,20*@3,($0-20)*@3');
insert into T_TIF_CFGTXFEE (FEE_TYPE, TX_CODE, FEE_LIST, IDXDBACTNO_LIST, IDXCRACTNO_LIST, FORMULA_LIST)
values (19, 847126, '11,1,29,2,30,3', null, '-1,0,-1,0,-1,0', '0*@1,($0-0)*@1,0*@2,($0-0)*@2,0*@3,($0-0)*@3');
insert into T_TIF_CFGTXFEE (FEE_TYPE, TX_CODE, FEE_LIST, IDXDBACTNO_LIST, IDXCRACTNO_LIST, FORMULA_LIST)
values (12, 847101, '1,2,3', null, '0,0,0', '$0*@1,$0*@2,$0*@3');
insert into T_TIF_CFGTXFEE (FEE_TYPE, TX_CODE, FEE_LIST, IDXDBACTNO_LIST, IDXCRACTNO_LIST, FORMULA_LIST)
values (0, 930036, '9', null, '0', '$0');
insert into T_TIF_CFGTXFEE (FEE_TYPE, TX_CODE, FEE_LIST, IDXDBACTNO_LIST, IDXCRACTNO_LIST, FORMULA_LIST)
values (11, 847101, '1,2,3', null, '0,0,0', '$0*@1,$0*@2,$0*@3');
insert into T_TIF_CFGTXFEE (FEE_TYPE, TX_CODE, FEE_LIST, IDXDBACTNO_LIST, IDXCRACTNO_LIST, FORMULA_LIST)
values (0, 847183, '15', '0', '1', '$0');
insert into T_TIF_CFGTXFEE (FEE_TYPE, TX_CODE, FEE_LIST, IDXDBACTNO_LIST, IDXCRACTNO_LIST, FORMULA_LIST)
values (0, 8471040, '11,1', null, null, '20,$0-20');
insert into T_TIF_CFGTXFEE (FEE_TYPE, TX_CODE, FEE_LIST, IDXDBACTNO_LIST, IDXCRACTNO_LIST, FORMULA_LIST)
values (12, 240001, '22,21', null, '0,0', '$0*0,$0-$0*0');
insert into T_TIF_CFGTXFEE (FEE_TYPE, TX_CODE, FEE_LIST, IDXDBACTNO_LIST, IDXCRACTNO_LIST, FORMULA_LIST)
values (0, 240001, '21', null, '0', '$0');
insert into T_TIF_CFGTXFEE (FEE_TYPE, TX_CODE, FEE_LIST, IDXDBACTNO_LIST, IDXCRACTNO_LIST, FORMULA_LIST)
values (1, 847127, '48', '0', '1', '$0');
insert into T_TIF_CFGTXFEE (FEE_TYPE, TX_CODE, FEE_LIST, IDXDBACTNO_LIST, IDXCRACTNO_LIST, FORMULA_LIST)
values (0, 240104, '23', null, '0', '$0');
insert into T_TIF_CFGTXFEE (FEE_TYPE, TX_CODE, FEE_LIST, IDXDBACTNO_LIST, IDXCRACTNO_LIST, FORMULA_LIST)
values (12, 240104, '22,23', null, '0,0', '$0*0,$0-$0*0');
insert into T_TIF_CFGTXFEE (FEE_TYPE, TX_CODE, FEE_LIST, IDXDBACTNO_LIST, IDXCRACTNO_LIST, FORMULA_LIST)
values (0, 847201, '54', '0', '1', '$0');
insert into T_TIF_CFGTXFEE (FEE_TYPE, TX_CODE, FEE_LIST, IDXDBACTNO_LIST, IDXCRACTNO_LIST, FORMULA_LIST)
values (0, 847206, '55', '0', '1', '$0');
insert into T_TIF_CFGTXFEE (FEE_TYPE, TX_CODE, FEE_LIST, IDXDBACTNO_LIST, IDXCRACTNO_LIST, FORMULA_LIST)
values (0, 240157, '21', null, '0', '$0');
insert into T_TIF_CFGTXFEE (FEE_TYPE, TX_CODE, FEE_LIST, IDXDBACTNO_LIST, IDXCRACTNO_LIST, FORMULA_LIST)
values (12, 240157, '22,21', null, '0,0', '$0*0,$0-$0*0');
insert into T_TIF_CFGTXFEE (FEE_TYPE, TX_CODE, FEE_LIST, IDXDBACTNO_LIST, IDXCRACTNO_LIST, FORMULA_LIST)
values (0, 847106, '1,2,3', null, '0,0,0', '$0*@1,$0*@2,$0*@3');
insert into T_TIF_CFGTXFEE (FEE_TYPE, TX_CODE, FEE_LIST, IDXDBACTNO_LIST, IDXCRACTNO_LIST, FORMULA_LIST)
values (13, 847101, '1,2,3', null, '0,0,0', '$0*@1,$0*@2,$0*@3');
insert into T_TIF_CFGTXFEE (FEE_TYPE, TX_CODE, FEE_LIST, IDXDBACTNO_LIST, IDXCRACTNO_LIST, FORMULA_LIST)
values (14, 847101, '1,2,3', null, '0,0,0', '$0*@1,$0*@2,$0*@3');
insert into T_TIF_CFGTXFEE (FEE_TYPE, TX_CODE, FEE_LIST, IDXDBACTNO_LIST, IDXCRACTNO_LIST, FORMULA_LIST)
values (15, 847101, '1,2,3', null, '0,0,0', '$0*@1,$0*@2,$0*@3');
insert into T_TIF_CFGTXFEE (FEE_TYPE, TX_CODE, FEE_LIST, IDXDBACTNO_LIST, IDXCRACTNO_LIST, FORMULA_LIST)
values (16, 847101, '1,2,3', null, '0,0,0', '$0*@1,$0*@2,$0*@3');
insert into T_TIF_CFGTXFEE (FEE_TYPE, TX_CODE, FEE_LIST, IDXDBACTNO_LIST, IDXCRACTNO_LIST, FORMULA_LIST)
values (17, 847101, '1,2,3', null, '0,0,0', '$0*@1,$0*@2,$0*@3');
insert into T_TIF_CFGTXFEE (FEE_TYPE, TX_CODE, FEE_LIST, IDXDBACTNO_LIST, IDXCRACTNO_LIST, FORMULA_LIST)
values (18, 847183, '15,10', '0,0', '1,1', '$0,($0*0.099)*@4');
insert into T_TIF_CFGTXFEE (FEE_TYPE, TX_CODE, FEE_LIST, IDXDBACTNO_LIST, IDXCRACTNO_LIST, FORMULA_LIST)
values (0, 847220, '58', null, null, '$0');
insert into T_TIF_CFGTXFEE (FEE_TYPE, TX_CODE, FEE_LIST, IDXDBACTNO_LIST, IDXCRACTNO_LIST, FORMULA_LIST)
values (0, 847221, '58', null, null, '$0');
insert into T_TIF_CFGTXFEE (FEE_TYPE, TX_CODE, FEE_LIST, IDXDBACTNO_LIST, IDXCRACTNO_LIST, FORMULA_LIST)
values (1, 847222, '57', '0', '-1', '$0');
insert into T_TIF_CFGTXFEE (FEE_TYPE, TX_CODE, FEE_LIST, IDXDBACTNO_LIST, IDXCRACTNO_LIST, FORMULA_LIST)
values (1, 847223, '57', '0', '-1', '$0');
insert into T_TIF_CFGTXFEE (FEE_TYPE, TX_CODE, FEE_LIST, IDXDBACTNO_LIST, IDXCRACTNO_LIST, FORMULA_LIST)
values (17, 240001, '1,10', null, null, '$0*0,$0*0-@3');
insert into T_TIF_CFGTXFEE (FEE_TYPE, TX_CODE, FEE_LIST, IDXDBACTNO_LIST, IDXCRACTNO_LIST, FORMULA_LIST)
values (0, 847301, '54', '0', '-1', '$0');
insert into T_TIF_CFGTXFEE (FEE_TYPE, TX_CODE, FEE_LIST, IDXDBACTNO_LIST, IDXCRACTNO_LIST, FORMULA_LIST)
values (0, 847306, '56', '-1', '1', '$0');
insert into T_TIF_CFGTXFEE (FEE_TYPE, TX_CODE, FEE_LIST, IDXDBACTNO_LIST, IDXCRACTNO_LIST, FORMULA_LIST)
values (0, 930030, '54', '0', '-1', '$0');
insert into T_TIF_CFGTXFEE (FEE_TYPE, TX_CODE, FEE_LIST, IDXDBACTNO_LIST, IDXCRACTNO_LIST, FORMULA_LIST)
values (18, 847125, '1,11', null, null, '$0-20,20');
insert into T_TIF_CFGTXFEE (FEE_TYPE, TX_CODE, FEE_LIST, IDXDBACTNO_LIST, IDXCRACTNO_LIST, FORMULA_LIST)
values (18, 847124, '1,11', null, null, '($0-20)*@1,20*@1');
insert into T_TIF_CFGTXFEE (FEE_TYPE, TX_CODE, FEE_LIST, IDXDBACTNO_LIST, IDXCRACTNO_LIST, FORMULA_LIST)
values (0, 847132, '24,49,50', null, null, '$0*@1,$0*@2,$0*@3');
commit;
prompt 45 records loaded
prompt Enabling triggers for T_TIF_CFGTXFEE...
alter table T_TIF_CFGTXFEE enable all triggers;
set feedback on
set define on
prompt Done.
|
-- **********************************************
-- IT2351 Assignment 4 Part 4 - Abimael Rivera
-- Creating a select statement that returns the order_id and order_date columns to show when they will be approximately arriving.
-- Only for orders in March.
-- **********************************************
CREATE VIEW order_item_products AS
SELECT O.order_id, O.order_date, O.tax_amount, O.ship_date, product_name, item_price, discount_amount, (item_price-discount_amount) AS final_price, quantity, (item_price-discount_amount)*quantity AS item_total
FROM Orders O, Order_Items OI, Products P
WHERE O.order_id = OI.order_id AND OI.product_id = P.product_id;
|
# patch_50_51_b.sql
#
# title: protein_feature hit_name
#
# description:
# Rename hit_id column in protein_feature to hit_name
ALTER TABLE protein_feature DROP INDEX hid_index;
ALTER TABLE protein_feature CHANGE COLUMN hit_id hit_name VARCHAR(40) NOT NULL;
ALTER TABLE protein_feature ADD INDEX hitname_idx (hit_name);
# patch identifier
INSERT INTO meta (meta_key, meta_value) VALUES ('patch', 'patch_50_51_b.sql|protein_feature_hit_name');
|
--1
SELECT Employe.Sex as 'Стать', Count(*) as 'Кількість'
FROM Employe
Group by Employe.Sex
--2
SELECT [Department].[Name] AS "Департамент", Count([Department].[Id]) AS "Кількість співробітників"
FROM [Department] JOIN [Employe] ON [Department].[ID] = [Employe].[DepartmentID]
GROUP BY [Department].[Name]
--3
Select Employe.FName, Employe.LName, Department.Name, Position.Name
From [Department] JOIN [Employe] ON [Department].[ID] = [Employe].[DepartmentID]
join [Position] on Employe.Position=Position.Id
SELECT ctn AS "MAX"
FROM (
select count(*) as ctn
From Employe
group by Employe.DepartmentId, Employe.Position
) AS A
WHERE ctn = (
SELECT max(ctn)
FROM (
select count(*) as ctn
From Employe
group by Employe.DepartmentId, Employe.Position
)AS B
) |
-- Adicionar o primeiro usuário admin
INSERT INTO Admin (nome, login, senha, tipo) VALUES ('admin', 'admin', '$2y$12$UV.R6.1fzwWppWPwPipTWuP5ouXAtiSQYlkT2UufPqL95t4oeqMZa', 'A'); |
# ************************************************************
# Sequel Pro SQL dump
# Version 4541
#
# http://www.sequelpro.com/
# https://github.com/sequelpro/sequelpro
#
# Host: 127.0.0.1 (MySQL 5.5.5-10.2.12-MariaDB)
# Database: antrian-puskesmas
# Generation Time: 2018-05-23 16:51:17 +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 admin
# ------------------------------------------------------------
CREATE TABLE `admin` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`nama` varchar(255) NOT NULL DEFAULT '',
`alamat` text NOT NULL,
`no_hp` varchar(15) NOT NULL DEFAULT '',
`email` varchar(100) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
LOCK TABLES `admin` WRITE;
/*!40000 ALTER TABLE `admin` DISABLE KEYS */;
INSERT INTO `admin` (`id`, `nama`, `alamat`, `no_hp`, `email`)
VALUES
(2,'Administrators','JL Terusan Bendungan Sigura-gura D167 Malangs','082228069297','admins@gmail.com');
/*!40000 ALTER TABLE `admin` ENABLE KEYS */;
UNLOCK TABLES;
# Dump of table antrian
# ------------------------------------------------------------
CREATE TABLE `antrian` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`id_poli` int(10) unsigned NOT NULL,
`id_pasien` int(10) unsigned DEFAULT NULL,
`w_antrian` datetime DEFAULT NULL,
`no_antrian` int(11) NOT NULL DEFAULT 0,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
LOCK TABLES `antrian` WRITE;
/*!40000 ALTER TABLE `antrian` DISABLE KEYS */;
INSERT INTO `antrian` (`id`, `id_poli`, `id_pasien`, `w_antrian`, `no_antrian`)
VALUES
(2,2,5,'2018-05-02 16:51:11',1),
(3,2,1,'2018-05-02 18:05:22',1),
(4,2,1,'2018-05-02 18:05:24',1),
(5,1,5,'2018-05-02 18:09:40',1),
(6,4,5,'2018-05-02 18:24:35',1),
(7,2,5,'2018-05-02 18:26:19',1),
(8,3,5,'2018-05-02 18:28:07',1),
(9,1,5,'2018-05-09 16:43:31',1),
(10,3,6,'2018-05-10 12:30:00',1),
(11,2,1,'2018-05-19 17:53:31',1),
(12,2,2,'2018-05-19 17:53:38',1),
(13,2,2,'2018-05-20 00:55:51',1),
(14,2,2,'2018-05-20 00:56:00',2),
(15,2,1,'2018-05-20 00:58:47',3),
(16,2,2,'2018-05-20 00:58:50',4),
(17,2,2,'2018-05-20 01:00:45',5),
(19,2,NULL,'2018-05-20 01:33:43',7),
(20,2,NULL,'2018-05-20 01:37:02',8),
(22,1,NULL,'2018-05-20 01:56:24',1),
(23,1,NULL,'2018-05-20 01:56:26',2),
(24,1,NULL,'2018-05-20 01:56:35',3),
(25,3,NULL,'2018-05-20 01:56:40',1),
(26,1,NULL,'2018-05-20 01:58:24',4),
(27,2,NULL,'2018-05-20 02:10:28',9),
(28,2,NULL,'2018-05-20 02:10:30',10),
(29,1,NULL,'2018-05-20 02:10:36',5),
(30,1,NULL,'2018-05-20 02:11:23',6),
(31,2,NULL,'2018-05-20 02:12:03',11),
(32,1,NULL,'2018-05-20 02:13:14',7),
(33,1,NULL,'2018-05-20 02:13:27',8),
(34,1,NULL,'2018-05-20 02:16:28',9),
(35,1,NULL,'2018-05-20 02:18:24',10),
(36,1,NULL,'2018-05-20 02:19:09',11),
(37,1,NULL,'2018-05-20 02:19:20',12),
(38,1,NULL,'2018-05-20 02:19:47',13),
(39,1,NULL,'2018-05-20 02:20:25',14),
(40,1,NULL,'2018-05-20 02:21:00',15),
(41,1,NULL,'2018-05-20 02:22:32',16),
(42,1,NULL,'2018-05-20 02:23:18',17),
(43,5,NULL,'2018-05-20 02:24:45',1),
(44,2,NULL,'2018-05-20 02:24:53',12),
(45,3,NULL,'2018-05-20 02:25:02',2),
(46,3,NULL,'2018-05-20 02:25:07',3),
(47,2,NULL,'2018-05-20 02:25:15',13),
(48,3,NULL,'2018-05-20 02:25:19',4),
(49,2,NULL,'2018-05-20 02:25:43',14),
(50,1,NULL,'2018-05-20 02:25:49',18),
(51,2,NULL,'2018-05-20 02:27:28',15),
(52,3,NULL,'2018-05-20 02:27:35',5),
(53,5,NULL,'2018-05-20 02:27:40',2),
(54,2,NULL,'2018-05-21 15:11:31',1);
/*!40000 ALTER TABLE `antrian` ENABLE KEYS */;
UNLOCK TABLES;
# Dump of table apoteker
# ------------------------------------------------------------
CREATE TABLE `apoteker` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`nama` varchar(255) NOT NULL DEFAULT '',
`alamat` text NOT NULL,
`no_hp` varchar(15) NOT NULL DEFAULT '',
`email` varchar(100) NOT NULL DEFAULT '',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
LOCK TABLES `apoteker` WRITE;
/*!40000 ALTER TABLE `apoteker` DISABLE KEYS */;
INSERT INTO `apoteker` (`id`, `nama`, `alamat`, `no_hp`, `email`)
VALUES
(1,'Apotekers','Alamat Apotekers','082123212314','apotekers@gmail.com');
/*!40000 ALTER TABLE `apoteker` ENABLE KEYS */;
UNLOCK TABLES;
# Dump of table detail_resep_dokter
# ------------------------------------------------------------
CREATE TABLE `detail_resep_dokter` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`id_resep` int(10) unsigned NOT NULL,
`nama_obat` varchar(255) NOT NULL DEFAULT '',
`dosis` varchar(100) NOT NULL DEFAULT '',
`harga` bigint(20) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
# Dump of table masyarakat
# ------------------------------------------------------------
CREATE TABLE `masyarakat` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`nama` varchar(255) NOT NULL DEFAULT '',
`alamat` text NOT NULL,
`no_hp` varchar(15) NOT NULL DEFAULT '',
`email` varchar(100) NOT NULL DEFAULT '',
`kelamin` char(2) NOT NULL DEFAULT 'L',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
LOCK TABLES `masyarakat` WRITE;
/*!40000 ALTER TABLE `masyarakat` DISABLE KEYS */;
INSERT INTO `masyarakat` (`id`, `nama`, `alamat`, `no_hp`, `email`, `kelamin`)
VALUES
(1,'Dhimas Atha','JL Bunga Coklat 20 Malang','082228069292','athasamid@gmail.com','L');
/*!40000 ALTER TABLE `masyarakat` ENABLE KEYS */;
UNLOCK TABLES;
# Dump of table pasien
# ------------------------------------------------------------
CREATE TABLE `pasien` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`nama` varchar(255) NOT NULL DEFAULT '',
`alamat` text NOT NULL,
`kelamin` char(2) NOT NULL DEFAULT 'L',
`tgl_lahir` date NOT NULL DEFAULT '0000-00-00',
`tempat_lahir` varchar(100) NOT NULL DEFAULT '',
`no_askes` varchar(100) DEFAULT NULL,
`no_telp` varchar(13) DEFAULT NULL,
`id_masyarakat` int(10) unsigned NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
LOCK TABLES `pasien` WRITE;
/*!40000 ALTER TABLE `pasien` DISABLE KEYS */;
INSERT INTO `pasien` (`id`, `nama`, `alamat`, `kelamin`, `tgl_lahir`, `tempat_lahir`, `no_askes`, `no_telp`, `id_masyarakat`)
VALUES
(5,'Dhimas Atha Abdillah','JL Terusan Bendungan Sigura-gura Blok D167 Malang','L','1995-06-06','Bojonegoro','3522150606950005','082228069292',1),
(6,'G. W Arini','JL Bromo 30 Malang','P','1997-01-03','Kediri',NULL,'082228069293',1);
/*!40000 ALTER TABLE `pasien` ENABLE KEYS */;
UNLOCK TABLES;
# Dump of table poli
# ------------------------------------------------------------
DROP TABLE IF EXISTS `poli`;
CREATE TABLE `poli` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`nama` varchar(255) NOT NULL DEFAULT '',
`icon` varchar(255) NOT NULL DEFAULT '',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
LOCK TABLES `poli` WRITE;
/*!40000 ALTER TABLE `poli` DISABLE KEYS */;
INSERT INTO `poli` (`id`, `nama`, `icon`)
VALUES
(1,'POLI ANAK','images/icon-p.anak.png'),
(2,'POLI GIGI','images/icon-p.gigi.png'),
(3,'POLI UMUM','images/icon-p.umum.png'),
(4,'POLI MATA','images/icon-mcu.png'),
(5,'POLI THT','images/icon-p.bedah.png');
/*!40000 ALTER TABLE `poli` ENABLE KEYS */;
UNLOCK TABLES;
# Dump of table poli_dilayani
# ------------------------------------------------------------
CREATE TABLE `poli_dilayani` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`id_poli` int(10) unsigned NOT NULL,
`waktu` date NOT NULL,
`antrian` int(11) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
LOCK TABLES `poli_dilayani` WRITE;
/*!40000 ALTER TABLE `poli_dilayani` DISABLE KEYS */;
INSERT INTO `poli_dilayani` (`id`, `id_poli`, `waktu`, `antrian`)
VALUES
(1,3,'2018-05-10',30),
(2,2,'2018-05-20',4),
(3,1,'2018-05-20',17);
/*!40000 ALTER TABLE `poli_dilayani` ENABLE KEYS */;
UNLOCK TABLES;
# Dump of table resep_dokter
# ------------------------------------------------------------
CREATE TABLE `resep_dokter` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`id_antrian` int(10) unsigned NOT NULL,
`nama_dokter` varchar(255) DEFAULT NULL,
`nama_apoteker` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
# Dump of table user
# ------------------------------------------------------------
DROP TABLE IF EXISTS `user`;
CREATE TABLE `user` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`username` varchar(255) NOT NULL DEFAULT '',
`password` varchar(255) NOT NULL DEFAULT '',
`id_pemilik` int(10) unsigned NOT NULL,
`jenis_pemilik` varchar(100) NOT NULL DEFAULT '',
`fcm_id` text DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
LOCK TABLES `user` WRITE;
/*!40000 ALTER TABLE `user` DISABLE KEYS */;
INSERT INTO `user` (`id`, `username`, `password`, `id_pemilik`, `jenis_pemilik`, `fcm_id`)
VALUES
(1,'athasamid','$2y$10$Bkm3b6.39FBrkA5S/4tCSOjmYcf9MqlVC3PDTpKIW3ZjIVBLssAS6',1,'masyarakat',NULL),
(3,'admin','$2y$10$yTkqEyLQQe/GVBxClHArR.KrtQwxH8J8pVkR7MjoXoNbnNUSczzmK',2,'admin',NULL),
(7,'apoteker','$2y$10$56hpk5ACNr/Cs5/.HxpUNOnKrOvrO1BuQG25UhODehinhSZ8WBbku',1,'apoteker',NULL);
/*!40000 ALTER TABLE `user` 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 */;
|
SELECT
CAST(begin_interval_time AS DATE) begin_time
, metric_name
, metric_unit
, value
FROM
dba_hist_snapshot
NATURAL JOIN
dba_hist_sysmetric_history
WHERE
metric_name IN ('Logons Per Sec')
AND begin_interval_time > SYSDATE - 30
ORDER BY
metric_name
, begin_time
/
|
INSERT INTO organization VALUES (1, 0,'IT консалтинг', 'ООО "IT Консалтинг"', 'г. Москва, ул. Солянка, д.19, стр.1', '8-495-333-11-22', '0099887766', '112233445', TRUE);
INSERT INTO organization VALUES (2, 0, 'RusOil', 'ОАО "Russia Oil Group"', 'г. Смоленск, ул. Совободы, д.36', '8-4812-20-41-28', '0028301682', '745263871', TRUE);
INSERT INTO organization VALUES (3, 0,'4 колеса', 'ООО "4 колеса"', 'г.Санкт-Петербург, ул. Победы, д.28, стр.9', '8-812-763-11-72', '0028730173', '001029387', TRUE);
INSERT INTO offices VALUES (1, 0, 1, 'Офис продаж', 'г. Москва, ул. Новоалексеевская, д.12. кор.5', '8-495-239-09-60', TRUE);
INSERT INTO offices VALUES (1, 0, 2, 'Офис разработки', 'г. Москва, ул. Маломосковская, д.2. кор.2', '8-495-243-28-54', TRUE);
INSERT INTO offices VALUES (1, 0, 3, 'Офис безопасности', 'г. Москва, ул. Сароалексеевская, д.69. стр.1', '8-495-259-93-90', TRUE);
INSERT INTO offices VALUES (1, 0, 4, 'Офис логистики', 'г. Москва, ул. Ярославская, д.33. кор.9', '8-495-976-54-27', TRUE);
INSERT INTO offices VALUES (1, 0, 5, 'Бухгалтерия', 'г. Москва, ул. Константинова, д.27. стр.3', '8-495-834-29-41', TRUE);
INSERT INTO offices VALUES (2, 0, 6, 'Офис продаж', 'г. Смоленск, ул. Павлова, д.2', '8-4812-27-04-76', TRUE);
INSERT INTO offices VALUES (2, 0, 7, 'Офис разработки', 'г. Смоленск, ул. Некраова, д.54 кор.1', '8-4812-78-98-70', TRUE);
INSERT INTO offices VALUES (2, 0, 8, 'Офис безопасности', 'г. Смоленск, ул. Бородинская, д.9', '8-4812-47-23-12', TRUE);
INSERT INTO offices VALUES (2, 0, 9, 'Офис логистики', 'г. Смоленск, ул. Полтавская, д.4. стр.9', '8-4812-54-53-27', FALSE);
INSERT INTO offices VALUES (2, 0, 10, 'Бухгалтерия', 'г. Смоленск, ул. Назимова, д.40. кор.2', '8-4812-89-12-98', TRUE);
INSERT INTO offices VALUES (3, 0, 11, 'Офис продаж', 'г.Санкт-Петербург, ул. Пражская, д.46, кор.1', '8-812-567-87-82', TRUE);
INSERT INTO offices VALUES (3, 0, 12, 'Офис разработки', 'г. Санкт-Петербург, ул. Бухарестская, д.42 кор.2', '8-812-165-76-60', FALSE);
INSERT INTO offices VALUES (3, 0, 13, 'Офис безопасности', 'г. Санкт-Петербург, ул. Софийская, д.17', '8-812-493-56-32', TRUE);
INSERT INTO offices VALUES (3, 0, 14, 'Офис логистики', 'г. Санкт-Петербург, ул. Благодатная, д.87', '8-812-987-34-34', TRUE);
INSERT INTO offices VALUES (3, 0, 15, 'Бухгалтерия', 'г. Санкт-Петербург, ул. Решетникова, д.40. стр.7', '8-812-654-23-54', TRUE);
INSERT INTO docname VALUES (1, 0, 'Паспорт', 21);
INSERT INTO citizenship VALUES (1,0, 'Российская Федерация', 643);
INSERT INTO citizenship VALUES (2,0, 'Чехия', 203);
INSERT INTO citizenship VALUES (3,0, 'Польша', 616);
INSERT INTO citizenship VALUES (4,0, 'Финляндия', 246);
INSERT INTO docdata VALUES (1, 0,1, '4512 675443', '21.01.2003');
INSERT INTO docdata VALUES (2, 0,1, '4532 876523', '31.01.2005');
INSERT INTO docdata VALUES (3, 0,1, '4287 806452', '12.04.2009');
INSERT INTO docdata VALUES (4, 0,1, '4263 987253', '21.02.2010');
INSERT INTO docdata VALUES (5, 0,1, '4523 761092', '07.08.2000');
INSERT INTO docdata VALUES (6, 0,1, '4514 762099', '26.09.2009');
INSERT INTO docdata VALUES (7, 0,1, '4512 472500', '23.09.2011');
INSERT INTO docdata VALUES (8, 0,1, '4512 872344', '25.09.2009');
INSERT INTO docdata VALUES (9, 0,1, '4510 625530', '30.07.2012');
INSERT INTO docdata VALUES (10, 0,1, '4321 762081', '09.04.2011');
INSERT INTO docdata VALUES (11, 0,1, '4217 298734', '05.03.2008');
INSERT INTO docdata VALUES (12, 0,1, '4216 772244', '18.02.2009');
INSERT INTO docdata VALUES (13, 0,1, '4513 762098', '23.05.2011');
INSERT INTO docdata VALUES (14, 0,1, '4513 204750', '21.04.2013');
INSERT INTO docdata VALUES (15, 0,1, '4217 902374', '18.02.2002');
INSERT INTO docdata VALUES (16, 0,1, '4716 982094', '19.06.2009');
INSERT INTO docdata VALUES (17, 0,1, '4718 982763', '20.04.2010');
INSERT INTO docdata VALUES (18, 0,1, '4212 762937', '07.02.2009');
INSERT INTO docdata VALUES (19, 0,1, '4216 872091', '09.05.2013');
INSERT INTO docdata VALUES (20, 0,1, '4318 238405', '03.05.2012');
INSERT INTO docdata VALUES (21, 0,1, '4512 872034', '21.11.2010');
INSERT INTO docdata VALUES (22, 0,1, '4318 761023', '22.12.2011');
INSERT INTO docdata VALUES (23, 0,1, '4315 672934', '14.02.2012');
INSERT INTO docdata VALUES (24, 0,1, '4318 983443', '19.08.2011');
INSERT INTO docdata VALUES (25, 0,1, '4319 239845', '29.04.2010');
INSERT INTO docdata VALUES (26, 0,1, '4549 978123', '28.06.2009');
INSERT INTO docdata VALUES (27, 0,1, '4716 659823', '05.10.2014');
INSERT INTO docdata VALUES (28, 0,1, '4615 342518', '27.12.2013');
INSERT INTO docdata VALUES (29, 0,1, '4316 283648', '20.05.2011');
INSERT INTO docdata VALUES (30, 0,1, '4319 659026', '16.12.2012');
INSERT INTO users VALUES (1,0, 1, 'Денис', 'Воронов', 'Иванович', 'Эксперт', '8-915-090-89-09',1, TRUE);
INSERT INTO users VALUES (2,0, 1, 'Иван', 'Зайцев', 'Петрович', 'Руководитель', '8-916-090-89-09',2,TRUE);
INSERT INTO users VALUES (3,0,2, 'Анатолий', 'Иванов', 'Николаевич', 'Старший специалист', '8-915-564-79-97',1, TRUE);
INSERT INTO users VALUES (4,0,2, 'Николай', 'Голобородько', 'Наумович', 'Заместитель директора', '8-910-897-39-12',1, TRUE);
INSERT INTO users VALUES (5,0, 3, 'Елена', 'Веселовская', 'Тимофеевна', 'Директор', '8-916-542-87-31',1, TRUE);
INSERT INTO users VALUES (6,0, 3, 'Анастасия', 'Тимофеева', 'Максимовна', 'Специалист', '8-910-302-12-98',1, TRUE);
INSERT INTO users VALUES (7,0, 4, 'Олег', 'Арсеньев', 'Родионович', 'Эксперт', '8-926-987-12-13',1, TRUE);
INSERT INTO users VALUES (8,0, 4, 'Оксана', 'Цветкова', 'Денисовна', 'Руководитель', '8-928-873-12-43',3, TRUE);
INSERT INTO users VALUES (9,0, 5, 'Дарья', 'Мешкова', 'Даниловна', 'Старший специалист', '8-916-539-23-09',1,TRUE);
INSERT INTO users VALUES (10,0, 5, 'Юлия', 'Алексеева', 'Михайловна', 'Специалист', '8-910-876-22-98',1, TRUE);
INSERT INTO users VALUES (11,0, 6, 'Дмитрий', 'Дымов', 'Юрьевич', 'Специалист', '8-916-453-23-23',4,TRUE);
INSERT INTO users VALUES (12,0, 6, 'Михаил', 'Петров', 'Сергеевич', 'Эксперт', '8-910-232-65-98', TRUE);
INSERT INTO users VALUES (13,0, 7, 'Кирилл', 'Соловьев', 'Артемьевич', 'Специалист', '8-915-634-14-24',1, TRUE);
INSERT INTO users VALUES (14,0, 7, 'Ольга', 'Попова', 'Викторовна', 'Руководитель', '8-916-264-23-54',2, TRUE);
INSERT INTO users VALUES (15,0, 8, 'Максим', 'Олейников', 'Дмитриевич', 'Заместитель директора', '8-928-873-21-54',1,TRUE);
INSERT INTO users VALUES (16,0, 8, 'Федр', 'Сергеев', 'Иванович', 'Эксперт', '8-926-352-56-65',2,TRUE);
INSERT INTO users VALUES (17,0, 9, 'Валерия', 'Гусева', 'Анатоевна', 'Специалист', '8-926-342-86-23',1, FALSE);
INSERT INTO users VALUES (18,0, 9, 'Галина', 'Павлова', 'Романовна', 'Директор', '8-915-523-23-34',1, FALSE);
INSERT INTO users VALUES (19,0, 10, 'Сергей', 'Теплов', 'Александрович', 'Старший специалист', '8-915-634-75-45',1,TRUE);
INSERT INTO users VALUES (20,0, 10, 'Наталья', 'Маслова', 'Евгеньевна', 'Руководитель', '8-917-245-45-76',3, TRUE);
INSERT INTO users VALUES (21,0, 11, 'Екатерина', 'Григорьева', 'Матвеевна', 'Эксперт', '8-928-763-14-78',1, TRUE);
INSERT INTO users VALUES (22,0, 11, 'Анна', 'Умина', 'Владимировна', 'Специалист', '8-916-212-76-56',2, TRUE);
INSERT INTO users VALUES (23,0, 12, 'Мария', 'Башева', 'Эдуадорвна', 'Эксперт', '8-920-432-34-76',1, FALSE);
INSERT INTO users VALUES (24,0, 12, 'Виктор', 'Коростылев', 'Викторович', 'Заместитель директора', '8-928-432-34-87',3,FALSE);
INSERT INTO users VALUES (25,0, 13, 'Арсений', 'Майков', 'Романович', 'Старший специалист', '8-926-234-67-34',1,TRUE);
INSERT INTO users VALUES (26,0, 13, 'Алексей', 'Шевелев', 'Борисович', 'Директор', '8-926-234-67-34',1,TRUE);
INSERT INTO users VALUES (27,0, 14, 'Андней', 'Демин', 'Олегович', 'Эксперт', '8-926-234-67-34', 4,TRUE);
INSERT INTO users VALUES (28,0, 14, 'Татьяна', 'Маркова', 'Сергеевна', 'Руководитель', '8-926-234-67-34',1, TRUE);
INSERT INTO users VALUES (29,0, 15, 'Антон', 'Казаков', 'Александрович', 'Старший специалист', '8-926-234-67-34',1, TRUE);
INSERT INTO users VALUES (30,0, 15, 'Егор', 'Ковльчук', 'Владимирович', 'Руководитель', '8-926-234-67-34',3, TRUE); |
DROP DATABASE IF EXISTS blacksmith;
CREATE DATABASE blacksmith;
USE blacksmith;
CREATE TABLE products (
item_id INT NOT NULL AUTO_INCREMENT,
product_name VARCHAR(50) NULL,
product_category VARCHAR(50) NULL,
price DECIMAL(10,2) default 0,
stock_quantity INT(9) default 0,
PRIMARY KEY (item_id)
);
INSERT INTO products (product_name, product_category, price, stock_quantity)
values ('Iron Ore', 'Raw Materials', '3', '250');
INSERT INTO products (product_name, product_category, price, stock_quantity)
values ('Copper Ore', 'Raw Materials', '2', '312');
INSERT INTO products (product_name, product_category, price, stock_quantity)
values ('Wood Log', 'Raw Materials', '2', '402');
INSERT INTO products (product_name, product_category, price, stock_quantity)
values ('Iron Ingot', 'Materials', '5', '32');
INSERT INTO products (product_name, product_category, price, stock_quantity)
values ('Copper Ingot', 'Materials', '4', '45');
INSERT INTO products (product_name, product_category, price, stock_quantity)
values ('Timber', 'Materials', '4', '34');
INSERT INTO products (product_name, product_category, price, stock_quantity)
values ('Iron Blade', 'Weapon Parts', '15', '2');
INSERT INTO products (product_name, product_category, price, stock_quantity)
values ('Copper Blade', 'Weapon Parts', '12', '3');
INSERT INTO products (product_name, product_category, price, stock_quantity)
values ('Sword Hilt', 'Weapon Parts', '10', '8');
INSERT INTO products (product_name, product_category, price, stock_quantity)
values ('Iron Sword', 'Weapons', '55', '4');
INSERT INTO products (product_name, product_category, price, stock_quantity)
values ('Copper Sword', 'Weapons', '40', '8');
INSERT INTO products (product_name, product_category, price, stock_quantity)
values ('Hammer', 'Tools', '15', '1');
|
--This patch is to correct a problem with DBs which do not follow
--the standard naming convention(drosophila, c elegans). Non standard names result in new
--coord systems and seq_regions being generated when they are in fact the
--same as a previous release. This can cause data loaded on an old coord system
--not to be included in the new coord system, hence data will not be accessable using
--the latest dnadb.
--The fix is to simple patch the seq_region_ids in the feature tables affected.
--osr = old_seq_region
--nsr = new_seq_region
--This is a self join
--will give large product due to nr records!
--select osr.seq_region_id, nsr.seq_region_id, nsr.name from (select seq_region_id, name from seq_region where schema_build='55_54c') osr, (select seq_region_id, name from seq_region where schema_build='56_513a') nsr where osr.name=nsr.name;
--Could we nest a self join rather than deriving both tables?
--Or is this just hte same?
--select sr.old_seq_region_id, sr.new_seq_region_id, sr.name from (select sr2.seq_region_id as old_seq_region_id, sr1.seq_region_id as new_seq_region_id, sr2.name from seq_region sr2 join seq_region sr1 on sr1.name=sr2.name and sr2.schema_build='55_54c' and sr1.schema_build='56_513a') sr;
--No, this uses a key and one less derived table!
update external_feature ef, (select sr.old_seq_region_id as osr, sr.new_seq_region_id as nsr from (select sr2.seq_region_id as old_seq_region_id, sr1.seq_region_id as new_seq_region_id, sr2.name from seq_region sr2 join seq_region sr1 on sr1.name=sr2.name and sr2.schema_build='55_54c' and sr1.schema_build='56_513a') sr) sr3 set ef.seq_region_id=sr3.nsr where ef.seq_region_id=sr3.osr;
|
select `nationkey`, min(`nationkey`) over (partition by `regionkey` order by `comment` range between unbounded_preceding and unbounded_following) as `min`
from `tpch`.`tiny`.`nation` |
ALTER TABLE "group"
ADD COLUMN user_id INT NOT NULL DEFAULT 0; |
-- MySQL Administrator dump 1.4
--
-- ------------------------------------------------------
-- Server version 5.5.29
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
--
-- Create schema cb_bd_encuesta
--
CREATE DATABASE IF NOT EXISTS cb_bd_encuesta;
USE cb_bd_encuesta;
--
-- Definition of table `acceso`
--
DROP TABLE IF EXISTS `acceso`;
CREATE TABLE `acceso` (
`idAcceso` int(11) NOT NULL AUTO_INCREMENT,
`idMenu` int(11) NOT NULL,
`idCargo` int(11) NOT NULL,
`habilitado` varchar(45) DEFAULT NULL,
PRIMARY KEY (`idAcceso`),
UNIQUE KEY `fk_accesomenu_codcargo_codmenu` (`idMenu`,`idCargo`),
KEY `fk_codcargo_cargo_idx` (`idCargo`),
KEY `fk_codmenu_menu_idx` (`idMenu`),
CONSTRAINT `fk_codcargo_cargo` FOREIGN KEY (`idCargo`) REFERENCES `cargo` (`idCargo`) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT `fk_codmenu_menu` FOREIGN KEY (`idMenu`) REFERENCES `menu` (`idMenu`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=12 DEFAULT CHARSET=latin1;
--
-- Dumping data for table `acceso`
--
/*!40000 ALTER TABLE `acceso` DISABLE KEYS */;
INSERT INTO `acceso` (`idAcceso`,`idMenu`,`idCargo`,`habilitado`) VALUES
(1,1,1,'HABILITADO'),
(2,2,1,'HABILITADO'),
(3,3,1,'HABILITADO'),
(4,4,1,'HABILITADO'),
(5,1,2,'HABILITADO'),
(6,2,2,'HABILITADO'),
(7,3,2,'HABILITADO'),
(8,1,3,'HABILITADO'),
(9,2,3,'HABILITADO'),
(10,4,3,'HABILITADO'),
(11,5,1,'HABILITADO');
/*!40000 ALTER TABLE `acceso` ENABLE KEYS */;
--
-- Definition of table `alternativas`
--
DROP TABLE IF EXISTS `alternativas`;
CREATE TABLE `alternativas` (
`idAlternativas` int(11) NOT NULL,
`tipo_alternativa_d` int(11) DEFAULT NULL,
`tipo_respuesta_d` int(11) DEFAULT NULL,
`porcentaje` double DEFAULT NULL,
`puntaje` int(11) DEFAULT NULL,
`orden` int(11) DEFAULT NULL,
`alternativa` varchar(250) DEFAULT NULL,
`idPregunta` int(11) NOT NULL,
PRIMARY KEY (`idAlternativas`),
KEY `fk_Alternativas_Pregunta1_idx` (`idPregunta`),
CONSTRAINT `fk_Alternativas_Pregunta1` FOREIGN KEY (`idPregunta`) REFERENCES `pregunta` (`idPregunta`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `alternativas`
--
/*!40000 ALTER TABLE `alternativas` DISABLE KEYS */;
/*!40000 ALTER TABLE `alternativas` ENABLE KEYS */;
--
-- Definition of table `anio`
--
DROP TABLE IF EXISTS `anio`;
CREATE TABLE `anio` (
`idAnio` int(11) NOT NULL,
`idCiclo` int(11) NOT NULL,
`idCarrera` int(11) NOT NULL,
`ciclo_academico_d` int(11) DEFAULT NULL,
`idCurso` int(11) NOT NULL,
`fecha` datetime DEFAULT NULL,
`maximo_alumnos` int(11) DEFAULT NULL,
`minimo_alumnos` int(11) DEFAULT NULL,
`nombre_seccion` varchar(250) DEFAULT NULL,
`session_d` int(11) DEFAULT NULL,
PRIMARY KEY (`idAnio`),
KEY `fk_Anio_Ciclo1_idx` (`idCiclo`),
KEY `fk_Anio_Carrera1_idx` (`idCarrera`),
KEY `fk_Anio_Curso1_idx` (`idCurso`),
CONSTRAINT `fk_Anio_Carrera1` FOREIGN KEY (`idCarrera`) REFERENCES `carrera` (`idCarrera`) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT `fk_Anio_Ciclo1` FOREIGN KEY (`idCiclo`) REFERENCES `ciclo` (`idCiclo`) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT `fk_Anio_Curso1` FOREIGN KEY (`idCurso`) REFERENCES `curso` (`idCurso`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `anio`
--
/*!40000 ALTER TABLE `anio` DISABLE KEYS */;
/*!40000 ALTER TABLE `anio` ENABLE KEYS */;
--
-- Definition of table `asignacionprofesor`
--
DROP TABLE IF EXISTS `asignacionprofesor`;
CREATE TABLE `asignacionprofesor` (
`idAsignacionProfesor` int(11) NOT NULL,
`fecha` datetime DEFAULT NULL,
`idAnio` int(11) NOT NULL,
`idProfesor` int(11) NOT NULL,
PRIMARY KEY (`idAsignacionProfesor`),
KEY `fk_AsignacionProfesor_Anio1_idx` (`idAnio`),
KEY `fk_AsignacionProfesor_Usuario1_idx` (`idProfesor`),
CONSTRAINT `fk_AsignacionProfesor_Anio1` FOREIGN KEY (`idAnio`) REFERENCES `anio` (`idAnio`) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT `fk_AsignacionProfesor_Usuario1` FOREIGN KEY (`idProfesor`) REFERENCES `usuario` (`idUsuario`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `asignacionprofesor`
--
/*!40000 ALTER TABLE `asignacionprofesor` DISABLE KEYS */;
/*!40000 ALTER TABLE `asignacionprofesor` ENABLE KEYS */;
--
-- Definition of table `aula`
--
DROP TABLE IF EXISTS `aula`;
CREATE TABLE `aula` (
`idAula` int(11) NOT NULL,
`nombre` varchar(250) DEFAULT NULL,
`tipo_aula_d` int(11) DEFAULT NULL,
`capacidad` varchar(250) DEFAULT NULL,
`descripcion` varchar(250) DEFAULT NULL,
`observacion` varchar(250) DEFAULT NULL,
PRIMARY KEY (`idAula`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `aula`
--
/*!40000 ALTER TABLE `aula` DISABLE KEYS */;
/*!40000 ALTER TABLE `aula` ENABLE KEYS */;
--
-- Definition of table `cargo`
--
DROP TABLE IF EXISTS `cargo`;
CREATE TABLE `cargo` (
`idCargo` int(11) NOT NULL AUTO_INCREMENT,
`cargo` varchar(45) DEFAULT NULL,
PRIMARY KEY (`idCargo`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1;
--
-- Dumping data for table `cargo`
--
/*!40000 ALTER TABLE `cargo` DISABLE KEYS */;
INSERT INTO `cargo` (`idCargo`,`cargo`) VALUES
(1,'ADMINISTRADOR'),
(2,'DOCENTE'),
(3,'ALUMNO');
/*!40000 ALTER TABLE `cargo` ENABLE KEYS */;
--
-- Definition of table `carrera`
--
DROP TABLE IF EXISTS `carrera`;
CREATE TABLE `carrera` (
`idCarrera` int(11) NOT NULL,
`nombre` varchar(250) DEFAULT NULL,
`descripcion` varchar(250) DEFAULT NULL,
`obervacion` varchar(250) DEFAULT NULL,
`tipo_carrera_d` int(11) DEFAULT NULL,
PRIMARY KEY (`idCarrera`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `carrera`
--
/*!40000 ALTER TABLE `carrera` DISABLE KEYS */;
/*!40000 ALTER TABLE `carrera` ENABLE KEYS */;
--
-- Definition of table `ciclo`
--
DROP TABLE IF EXISTS `ciclo`;
CREATE TABLE `ciclo` (
`idCiclo` int(11) NOT NULL,
`modalidad_d` int(11) DEFAULT NULL,
`nombre` varchar(250) DEFAULT NULL,
`annio_d` int(11) DEFAULT NULL,
`numero_d` int(11) DEFAULT NULL,
`fecha` datetime DEFAULT NULL,
`estado_ciclo_d` int(11) DEFAULT NULL,
`habilitado` varchar(250) DEFAULT NULL,
PRIMARY KEY (`idCiclo`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `ciclo`
--
/*!40000 ALTER TABLE `ciclo` DISABLE KEYS */;
/*!40000 ALTER TABLE `ciclo` ENABLE KEYS */;
--
-- Definition of table `curso`
--
DROP TABLE IF EXISTS `curso`;
CREATE TABLE `curso` (
`idCurso` int(11) NOT NULL,
`curso` varchar(250) DEFAULT NULL,
`tipo_curso_d` int(11) DEFAULT NULL,
`curso_corto` varchar(250) DEFAULT NULL,
PRIMARY KEY (`idCurso`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `curso`
--
/*!40000 ALTER TABLE `curso` DISABLE KEYS */;
/*!40000 ALTER TABLE `curso` ENABLE KEYS */;
--
-- Definition of table `dominio`
--
DROP TABLE IF EXISTS `dominio`;
CREATE TABLE `dominio` (
`idDominio` int(11) NOT NULL,
`campo` varchar(250) DEFAULT NULL,
`valor` varchar(250) DEFAULT NULL,
`valor_corto` varchar(250) DEFAULT NULL,
`mas_datos` varchar(250) DEFAULT NULL,
`idDominio_sub` int(11) DEFAULT NULL,
`idDominio_hijo` int(11) DEFAULT NULL,
`obligatorio` varchar(250) DEFAULT NULL,
`habilitado` varchar(250) DEFAULT NULL,
PRIMARY KEY (`idDominio`),
KEY `fk_Dominio_Dominio_idx` (`idDominio_hijo`),
KEY `fk_Dominio_Dominio1_idx` (`idDominio_sub`),
CONSTRAINT `fk_Dominio_Dominio` FOREIGN KEY (`idDominio_hijo`) REFERENCES `dominio` (`idDominio`) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT `fk_Dominio_Dominio1` FOREIGN KEY (`idDominio_sub`) REFERENCES `dominio` (`idDominio`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `dominio`
--
/*!40000 ALTER TABLE `dominio` DISABLE KEYS */;
INSERT INTO `dominio` (`idDominio`,`campo`,`valor`,`valor_corto`,`mas_datos`,`idDominio_sub`,`idDominio_hijo`,`obligatorio`,`habilitado`) VALUES
(1,'SEXO',NULL,NULL,NULL,NULL,NULL,NULL,'HABILITADO'),
(2,'SEXO','MASCULINO','M',NULL,NULL,1,NULL,'HABILITADO'),
(3,'SEXO','FEMENINO','F',NULL,NULL,1,NULL,'HABILITADO');
/*!40000 ALTER TABLE `dominio` ENABLE KEYS */;
--
-- Definition of table `encuesta`
--
DROP TABLE IF EXISTS `encuesta`;
CREATE TABLE `encuesta` (
`idEncuesta` int(11) NOT NULL,
`idTipoEncuesta` int(11) NOT NULL,
`idAnio` int(11) NOT NULL,
`idNumeroEncuesta` int(11) NOT NULL,
PRIMARY KEY (`idEncuesta`),
KEY `fk_AsignacionEncuesta_Encuesta1_idx` (`idTipoEncuesta`),
KEY `fk_AsignacionEncuesta_Anio1_idx` (`idAnio`),
KEY `fk_Encuesta_NumeroEncuesta1_idx` (`idNumeroEncuesta`),
CONSTRAINT `fk_AsignacionEncuesta_Anio1` FOREIGN KEY (`idAnio`) REFERENCES `anio` (`idAnio`) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT `fk_AsignacionEncuesta_Encuesta1` FOREIGN KEY (`idTipoEncuesta`) REFERENCES `tipoencuesta` (`idEncuesta`) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT `fk_Encuesta_NumeroEncuesta1` FOREIGN KEY (`idNumeroEncuesta`) REFERENCES `numeroencuesta` (`idNumeroEncuesta`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `encuesta`
--
/*!40000 ALTER TABLE `encuesta` DISABLE KEYS */;
/*!40000 ALTER TABLE `encuesta` ENABLE KEYS */;
--
-- Definition of table `encuestaalumno`
--
DROP TABLE IF EXISTS `encuestaalumno`;
CREATE TABLE `encuestaalumno` (
`idEncuestaAlumno` int(11) NOT NULL,
`inicio_encuesta` datetime DEFAULT NULL,
`fin_encuesta` datetime DEFAULT NULL,
`resolvio_d` int(11) DEFAULT NULL,
`idEncuestaProfesor` int(11) NOT NULL,
`idAlumno` int(11) NOT NULL,
PRIMARY KEY (`idEncuestaAlumno`),
KEY `fk_EncuestaAlumno_EncuestaProfesor1_idx` (`idEncuestaProfesor`),
KEY `fk_EncuestaAlumno_Usuario1_idx` (`idAlumno`),
CONSTRAINT `fk_EncuestaAlumno_EncuestaProfesor1` FOREIGN KEY (`idEncuestaProfesor`) REFERENCES `encuestaprofesor` (`idEncuestaProfesor`) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT `fk_EncuestaAlumno_Usuario1` FOREIGN KEY (`idAlumno`) REFERENCES `usuario` (`idUsuario`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `encuestaalumno`
--
/*!40000 ALTER TABLE `encuestaalumno` DISABLE KEYS */;
/*!40000 ALTER TABLE `encuestaalumno` ENABLE KEYS */;
--
-- Definition of table `encuestaprofesor`
--
DROP TABLE IF EXISTS `encuestaprofesor`;
CREATE TABLE `encuestaprofesor` (
`idEncuestaProfesor` int(11) NOT NULL,
`idEncuesta` int(11) NOT NULL,
`idProfesor` int(11) NOT NULL,
PRIMARY KEY (`idEncuestaProfesor`),
KEY `fk_EncuestaProfesor_Encuesta1_idx` (`idEncuesta`),
KEY `fk_EncuestaProfesor_Usuario1_idx` (`idProfesor`),
CONSTRAINT `fk_EncuestaProfesor_Encuesta1` FOREIGN KEY (`idEncuesta`) REFERENCES `encuesta` (`idEncuesta`) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT `fk_EncuestaProfesor_Usuario1` FOREIGN KEY (`idProfesor`) REFERENCES `usuario` (`idUsuario`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `encuestaprofesor`
--
/*!40000 ALTER TABLE `encuestaprofesor` DISABLE KEYS */;
/*!40000 ALTER TABLE `encuestaprofesor` ENABLE KEYS */;
--
-- Definition of table `marcadas`
--
DROP TABLE IF EXISTS `marcadas`;
CREATE TABLE `marcadas` (
`idMarcadas` int(11) NOT NULL,
`idEncuestaAlumno` int(11) NOT NULL,
`idAlternativas` int(11) NOT NULL,
`tipo_respuesta_d` int(11) DEFAULT NULL,
PRIMARY KEY (`idMarcadas`),
KEY `fk_Respondidas_EncuestaAlumno1_idx` (`idEncuestaAlumno`),
KEY `fk_Marcadas_Alternativas1_idx` (`idAlternativas`),
CONSTRAINT `fk_Marcadas_Alternativas1` FOREIGN KEY (`idAlternativas`) REFERENCES `alternativas` (`idAlternativas`) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT `fk_Respondidas_EncuestaAlumno1` FOREIGN KEY (`idEncuestaAlumno`) REFERENCES `encuestaalumno` (`idEncuestaAlumno`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `marcadas`
--
/*!40000 ALTER TABLE `marcadas` DISABLE KEYS */;
/*!40000 ALTER TABLE `marcadas` ENABLE KEYS */;
--
-- Definition of table `matricula`
--
DROP TABLE IF EXISTS `matricula`;
CREATE TABLE `matricula` (
`idMatricula` int(11) NOT NULL,
`fecha` datetime DEFAULT NULL,
`idAsignacion` int(11) NOT NULL,
`idAlumno` int(11) NOT NULL,
PRIMARY KEY (`idMatricula`),
KEY `fk_Matricula_AsignacionProfesor1_idx` (`idAsignacion`),
KEY `fk_Matricula_Usuario1_idx` (`idAlumno`),
CONSTRAINT `fk_Matricula_AsignacionProfesor1` FOREIGN KEY (`idAsignacion`) REFERENCES `asignacionprofesor` (`idAsignacionProfesor`) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT `fk_Matricula_Usuario1` FOREIGN KEY (`idAlumno`) REFERENCES `usuario` (`idUsuario`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `matricula`
--
/*!40000 ALTER TABLE `matricula` DISABLE KEYS */;
/*!40000 ALTER TABLE `matricula` ENABLE KEYS */;
--
-- Definition of table `menu`
--
DROP TABLE IF EXISTS `menu`;
CREATE TABLE `menu` (
`idMenu` int(11) NOT NULL AUTO_INCREMENT,
`nom_menu` varchar(200) DEFAULT NULL,
`url_menu` varchar(200) DEFAULT NULL,
`icono_menu` varchar(200) DEFAULT NULL,
`tipo_menu` int(11) DEFAULT NULL,
`id_submenu` int(11) DEFAULT NULL,
`orden_menu` int(11) DEFAULT NULL,
`master_menu` int(11) DEFAULT NULL,
PRIMARY KEY (`idMenu`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=latin1;
--
-- Dumping data for table `menu`
--
/*!40000 ALTER TABLE `menu` DISABLE KEYS */;
INSERT INTO `menu` (`idMenu`,`nom_menu`,`url_menu`,`icono_menu`,`tipo_menu`,`id_submenu`,`orden_menu`,`master_menu`) VALUES
(1,'Inicio','#','fa fa-home',1,1,1,0),
(2,'Mantenimiento','#','fa fa-table',1,2,2,1),
(3,'Docente','#','#',2,1,3,1),
(4,'Alumno','#','#',2,1,4,1),
(5,'Dominio','inicio_dominio_buscar.html','#',2,1,5,1);
/*!40000 ALTER TABLE `menu` ENABLE KEYS */;
--
-- Definition of table `numeroencuesta`
--
DROP TABLE IF EXISTS `numeroencuesta`;
CREATE TABLE `numeroencuesta` (
`idNumeroEncuesta` int(11) NOT NULL,
`fecha` datetime DEFAULT NULL,
PRIMARY KEY (`idNumeroEncuesta`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `numeroencuesta`
--
/*!40000 ALTER TABLE `numeroencuesta` DISABLE KEYS */;
/*!40000 ALTER TABLE `numeroencuesta` ENABLE KEYS */;
--
-- Definition of table `pregunta`
--
DROP TABLE IF EXISTS `pregunta`;
CREATE TABLE `pregunta` (
`idPregunta` int(11) NOT NULL,
`tipo_pregunta_d` int(11) DEFAULT NULL,
`puntaje` int(11) DEFAULT NULL,
`orden` int(11) DEFAULT NULL,
`pregunta` varchar(250) DEFAULT NULL,
`pregunta_obligatoria_d` int(11) DEFAULT NULL,
`idNumeroEncuesta` int(11) NOT NULL,
PRIMARY KEY (`idPregunta`),
KEY `fk_Pregunta_NumeroEncuesta1_idx` (`idNumeroEncuesta`),
CONSTRAINT `fk_Pregunta_NumeroEncuesta1` FOREIGN KEY (`idNumeroEncuesta`) REFERENCES `numeroencuesta` (`idNumeroEncuesta`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `pregunta`
--
/*!40000 ALTER TABLE `pregunta` DISABLE KEYS */;
/*!40000 ALTER TABLE `pregunta` ENABLE KEYS */;
--
-- Definition of table `profesocurso`
--
DROP TABLE IF EXISTS `profesocurso`;
CREATE TABLE `profesocurso` (
`idProfesoCurso` int(11) NOT NULL,
`idProfesor` int(11) NOT NULL,
`idCurso` int(11) NOT NULL,
PRIMARY KEY (`idProfesoCurso`),
KEY `fk_Asignacion_Profesor_Usuario1_idx` (`idProfesor`),
KEY `fk_ProfesoCurso_Curso1_idx` (`idCurso`),
CONSTRAINT `fk_Asignacion_Profesor_Usuario1` FOREIGN KEY (`idProfesor`) REFERENCES `usuario` (`idUsuario`) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT `fk_ProfesoCurso_Curso1` FOREIGN KEY (`idCurso`) REFERENCES `curso` (`idCurso`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `profesocurso`
--
/*!40000 ALTER TABLE `profesocurso` DISABLE KEYS */;
/*!40000 ALTER TABLE `profesocurso` ENABLE KEYS */;
--
-- Definition of table `tipoencuesta`
--
DROP TABLE IF EXISTS `tipoencuesta`;
CREATE TABLE `tipoencuesta` (
`idEncuesta` int(11) NOT NULL,
`encuesta` varchar(250) DEFAULT NULL,
`idCiclo` int(11) NOT NULL,
`habilitado` varchar(250) DEFAULT NULL,
PRIMARY KEY (`idEncuesta`),
KEY `fk_Encuesta_Ciclo1_idx` (`idCiclo`),
CONSTRAINT `fk_Encuesta_Ciclo1` FOREIGN KEY (`idCiclo`) REFERENCES `ciclo` (`idCiclo`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `tipoencuesta`
--
/*!40000 ALTER TABLE `tipoencuesta` DISABLE KEYS */;
/*!40000 ALTER TABLE `tipoencuesta` ENABLE KEYS */;
--
-- Definition of table `usuario`
--
DROP TABLE IF EXISTS `usuario`;
CREATE TABLE `usuario` (
`idUsuario` int(11) NOT NULL,
`apellido_paterno` varchar(250) DEFAULT NULL,
`apellido_materno` varchar(250) DEFAULT NULL,
`nombre` varchar(250) DEFAULT NULL,
`user_name` varchar(250) DEFAULT NULL,
`pass_name` varchar(250) DEFAULT NULL,
`email` varchar(250) DEFAULT NULL,
`fecha_nac` datetime DEFAULT NULL,
`telefono` varchar(250) DEFAULT NULL,
`codigo` varchar(250) DEFAULT NULL,
`habilitado` varchar(250) DEFAULT NULL,
`tipo_usuario_d` int(11) DEFAULT NULL,
`idCargo` int(11) DEFAULT NULL,
PRIMARY KEY (`idUsuario`),
KEY `fk_cargo_usuario_idx` (`idCargo`),
CONSTRAINT `fk_cargo_usuario` FOREIGN KEY (`idCargo`) REFERENCES `cargo` (`idCargo`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `usuario`
--
/*!40000 ALTER TABLE `usuario` DISABLE KEYS */;
INSERT INTO `usuario` (`idUsuario`,`apellido_paterno`,`apellido_materno`,`nombre`,`user_name`,`pass_name`,`email`,`fecha_nac`,`telefono`,`codigo`,`habilitado`,`tipo_usuario_d`,`idCargo`) VALUES
(1,'Correa',NULL,NULL,'admin','admin',NULL,NULL,NULL,NULL,NULL,1,1);
/*!40000 ALTER TABLE `usuario` ENABLE KEYS */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
|
USE TelerikAcademy
SELECT TOP 5 *
FROM Employees
WHERE Salary > 50000
ORDER BY Salary DESC |
CREATE TRIGGER numeroVoo AFTER
INSERT ON voo
FOR EACH ROW
UPDATE pilotos p
set num_voos = num_voos + 1
where voo.piloto = p.codigo;
|
--
-- Update sql for MailWizz EMA from version 1.3.5.1 to 1.3.5.2
--
ALTER TABLE `list` ADD `merged` ENUM('yes','no') NOT NULL DEFAULT 'no' AFTER `opt_out`; |
-- phpMyAdmin SQL Dump
-- version 4.1.14
-- http://www.phpmyadmin.net
--
-- Host: 127.0.0.1
-- Generation Time: Mar 11, 2017 at 09:41 PM
-- Server version: 5.6.17
-- PHP Version: 5.5.12
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
--
-- Database: `db`
--
-- --------------------------------------------------------
--
-- Table structure for table `courses`
--
CREATE TABLE IF NOT EXISTS `courses` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`student_id` int(11) NOT NULL,
`course_name` varchar(20) NOT NULL,
`num_of_students` int(11) NOT NULL,
`max_num_of_students` int(11) NOT NULL,
`course_code` varchar(10) NOT NULL,
`grade` varchar(10) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;
--
-- Dumping data for table `courses`
--
INSERT INTO `courses` (`id`, `student_id`, `course_name`, `num_of_students`, `max_num_of_students`, `course_code`, `grade`) VALUES
(1, 21, 'Introduction to Mach', 0, 25, 'ENS202', 'A'),
(2, 21, 'Introduction to Data', 0, 25, 'DM401', 'A');
-- --------------------------------------------------------
--
-- Table structure for table `grades`
--
CREATE TABLE IF NOT EXISTS `grades` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`student_id` int(11) NOT NULL,
`course_id` int(11) NOT NULL,
`grade` varchar(2) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table `groups`
--
CREATE TABLE IF NOT EXISTS `groups` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(20) NOT NULL,
`permissions` text NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;
--
-- Dumping data for table `groups`
--
INSERT INTO `groups` (`id`, `name`, `permissions`) VALUES
(1, 'Standard User', ''),
(2, 'Administrator', '{\r\n"admin": 1,\r\n"moderator" : 1\r\n}');
-- --------------------------------------------------------
--
-- Table structure for table `users`
--
CREATE TABLE IF NOT EXISTS `users` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`username` varchar(20) NOT NULL,
`name` varchar(60) NOT NULL,
`email` varchar(255) NOT NULL,
`password` varchar(64) NOT NULL,
`salt` varchar(32) NOT NULL,
`joined` datetime NOT NULL,
`group` int(11) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=23 ;
-- --------------------------------------------------------
--
-- Table structure for table `users_session`
--
CREATE TABLE IF NOT EXISTS `users_session` (
`id` int(11) NOT NULL,
`user_id` int(11) NOT NULL,
`hash` varchar(64) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!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 */;
|
/*
结算中心-索赔金额,未收金额
*/
delimiter $
drop procedure if exists Proc_Settlements_SumClaimAmount $
create procedure Proc_Settlements_SumClaimAmount(sInvoiceNO varchar(255))
begin
declare fClaimAmount decimal(18,2);
set fClaimAmount=(Select Sum(ifnull(PayedAmount,0)) as PayedAmount From Complaints
Where InvoiceNo=sInvoiceNO);
Update Settlements set ClaimAmount=ifnull(fClaimAmount,0),RemainAccount=(ifnull(AccountReceivable,0)-ifnull(ReceivedAccount,0)-ifnull(fClaimAmount,0)) Where InvoiceNO=sInvoiceNO;
end $
delimiter ; |
create or replace view v_xtdlyh as
select b.de194,b.de193,b.de022 from cfg031 a ,jscs005 b where a.de194 = b.de194 and a.de022= b.de022 and jsde070 = 2
|
SELECT properties.id, properties.title, properties.cost_per_night, reservations.start_date, AVG(property_reviews.rating) as average_rating
FROM reservations
JOIN properties ON reservations.property_id = properties.id
JOIN property_reviews ON property_reviews.property_id = properties.id
WHERE reservations.guest_id = 1
AND end_date < now()::date
GROUP BY reservations.id, properties.id
ORDER BY start_date
LIMIT 10; |
-- OnlnPayCnclQuery
-- 23 line
-- getOnlnPayObjByGramNoQuery()
SELECT
A.PAY_NO ,
A.RCGN_NO ,
A.LOAN_NO ,
A.LOAN_SEQ ,
A.PAY_BSN_DIV_CD ,
A.CUST_NM ,
A.MNG_DEPT_CD ,
A.SETL_BANK_CD ,
A.SETL_ACNT_NO ,
A.DEPO_OWN_NO ,
A.DEPO_OWNNM ,
A.IAMT_MANMN ,
A.LOAN_PAMT ,
A.TRT_FEE ,
A.CPRT_FEE ,
A.STMP_FEE ,
A.TRAN_RQST_AMT ,
A.TRAN_RQST_DTTM ,
A.TRAN_PROC_DT ,
A.TR_BANK_CD ,
A.OAMT_FEE ,
A.GRAM_SEND_DTTM ,
A.GRAM_CHSE_NO ,
A.TR_STRT_TM ,
A.RSPN_CD ,
A.PROC_STAT_CD ,
A.OAMT_AFAMT ,
A.MNO_RQST_OBJ_FG ,
A.TRAN_IPSS_GRAM_NO ,
A.VOCH_JNL_LAST_SEQ ,
A.LOAN_CNT ,
B.BANK_CD ,
B.MO_ACNT_NO
FROM AUSER.ALOT_LOAN_ONLN_PAY A,
AUSER.ALOT_MO_ACNT_BASE B
WHERE
-- A.PROC_STAT_CD = '05' /*처리상태코드(완료)*/
-- AND
A.TRAN_PROC_DT = '2011-12-18' --?
AND A.GRAM_CHSE_NO = '200329025413000' --'200329020000157' --'200329020000156' --?
AND A.PAY_BSN_DIV_CD = B.BSN_DIV_CD
AND DECODE(A.SETL_BANK_CD, '021', '088', '026', '088', '088', '088', '020') = B.BANK_CD
ORDER BY A.PAY_NO
;
-- 78
-- getOnlnPayObjByPayNoQuery()
SELECT
A.PAY_NO ,
A.RCGN_NO ,
A.LOAN_NO ,
A.LOAN_SEQ ,
A.PAY_BSN_DIV_CD ,
A.CUST_NM ,
A.MNG_DEPT_CD ,
A.SETL_BANK_CD ,
A.SETL_ACNT_NO ,
A.DEPO_OWN_NO ,
A.DEPO_OWNNM ,
A.IAMT_MANMN ,
A.LOAN_PAMT ,
A.TRT_FEE ,
A.CPRT_FEE ,
A.STMP_FEE ,
A.TRAN_RQST_AMT ,
A.TRAN_RQST_DTTM ,
A.TRAN_PROC_DT ,
A.TR_BANK_CD ,
A.OAMT_FEE ,
A.GRAM_SEND_DTTM ,
A.GRAM_CHSE_NO ,
A.TR_STRT_TM ,
A.RSPN_CD ,
A.PROC_STAT_CD ,
A.OAMT_AFAMT ,
A.MNO_RQST_OBJ_FG ,
A.TRAN_IPSS_GRAM_NO ,
A.VOCH_JNL_LAST_SEQ ,
A.LOAN_CNT ,
B.BANK_CD ,
B.MO_ACNT_NO
FROM AUSER.ALOT_LOAN_ONLN_PAY A,
AUSER.ALOT_MO_ACNT_BASE B
WHERE
-- A.PROC_STAT_CD = '05' /*처리상태코드(완료)*/
-- AND
A.PAY_BSN_DIV_CD = B.BSN_DIV_CD
AND DECODE(A.SETL_BANK_CD, '021', '088', '026', '088', '088', '088', '020') = B.BANK_CD
AND A.TRAN_PROC_DT = '2011-12-17' --?
AND A.PAY_NO = '11121600000003' --?
ORDER BY A.PAY_NO
;
|
# ------------------------------- CRIAÇÃO DO AMBIENTE DE TRABALHO ------------------------------- #
CREATE SCHEMA projeto_cinema;
# ------------------------------- CRIAÇÃO DAS TABELAS ------------------------------- #
CREATE TABLE ator
(
ID INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
DRT VARCHAR(16),
Nome VARCHAR(128) NOT NULL,
Seguro_social VARCHAR(16) NOT NULL,
Nacionalidade VARCHAR(16),
Data_nasc DATE,
Sexo CHAR(4),
Tipo_Papel VARCHAR(32),
Quantidade_De_Atuacoes INT NOT NULL
);
CREATE TABLE estudio
(
ID INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
Nome VARCHAR(32) NOT NULL,
Proprietario VARCHAR(16) NOT NULL,
Data_fundacao DATE,
Quantidade_Filmes_Produzidos INT,
Quantidade_Filmes_Em_Producao INT,
Faturamento_anterior DECIMAL(16, 2)
);
CREATE TABLE filme
(
ID INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
Nome VARCHAR(128) NOT NULL,
Numero_registro VARCHAR(16) NOT NULL,
Categoria VARCHAR(16) NOT NULL,
Meses_Producao INT,
Ano_lancamento DATE,
Copywriting VARCHAR(16),
Custo DECIMAL(16, 2),
Sinopse VARCHAR(255),
Faturamento_total DECIMAL(16, 2),
Duracao time
);
CREATE TABLE personagem
(
ID INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
Nome_Personagem VARCHAR(128),
Cache DECIMAL(16, 2)
);
CREATE TABLE diretor
(
ID INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
Nome VARCHAR(128) NOT NULL,
Quantidade_Filmes INT NOT NULL
);
CREATE TABLE operador_de_camera
(
ID INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
Nome VARCHAR(128) NOT NULL
);
CREATE TABLE figurinista
(
ID INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
Nome VARCHAR(128) NOT NULL
);
CREATE TABLE maquiador
(
ID INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
Nome VARCHAR(128) NOT NULL
);
CREATE TABLE tecnico_De_Som
(
Nome VARCHAR(128),
ID INT NOT NULL AUTO_INCREMENT PRIMARY KEY
);
CREATE TABLE cenografo
(
Nome VARCHAR(128),
ID INT NOT NULL AUTO_INCREMENT PRIMARY KEY
);
CREATE TABLE roteirista
(
Nome VARCHAR(128),
ID INT NOT NULL AUTO_INCREMENT PRIMARY KEY
);
CREATE TABLE editor
(
Nome VARCHAR(128),
ID INT NOT NULL AUTO_INCREMENT PRIMARY KEY
);
CREATE TABLE personagem_filme
(
ID_personagem INT,
ID_filme INT,
PRIMARY KEY (ID_personagem, ID_filme),
FOREIGN KEY (ID_personagem) REFERENCES Personagem (ID),
FOREIGN KEY (ID_filme) REFERENCES Filme (ID)
);
CREATE TABLE ator_filme
(
ID_ator INT,
ID_filme INT,
PRIMARY KEY (ID_ator, ID_filme),
FOREIGN KEY (ID_ator) REFERENCES Ator (ID),
FOREIGN KEY (ID_filme) REFERENCES Filme (ID)
);
CREATE TABLE personagem_maquiador
(
ID_personagem INT,
ID_maquiador INT,
PRIMARY KEY (ID_personagem, ID_maquiador),
FOREIGN KEY (ID_personagem) REFERENCES Personagem (ID),
FOREIGN KEY (ID_maquiador) REFERENCES Maquiador (ID)
);
CREATE TABLE filme_diretor
(
ID_filme INT,
ID_diretor INT,
PRIMARY KEY (ID_filme, ID_diretor),
FOREIGN KEY (ID_filme) REFERENCES Filme (ID),
FOREIGN KEY (ID_diretor) REFERENCES Diretor (ID)
);
CREATE TABLE filme_Tecnico_De_Som
(
ID_filme INT,
ID_Tecnico_De_Som INT,
PRIMARY KEY (ID_filme, ID_Tecnico_De_Som),
FOREIGN KEY (ID_filme) REFERENCES Filme (ID),
FOREIGN KEY (ID_Tecnico_De_Som) REFERENCES Tecnico_De_Som (ID)
);
CREATE TABLE filme_roterista
(
ID_filme INT,
ID_roterista INT,
PRIMARY KEY (ID_filme, ID_roterista),
FOREIGN KEY (ID_filme) REFERENCES Filme (ID),
FOREIGN KEY (ID_roterista) REFERENCES Roteirista (ID)
);
CREATE TABLE filme_cenografo
(
ID_filme INT,
ID_cenografo INT,
PRIMARY KEY (ID_filme, ID_cenografo),
FOREIGN KEY (ID_filme) REFERENCES Filme (ID),
FOREIGN KEY (ID_cenografo) REFERENCES Cenografo (ID)
);
CREATE TABLE filme_editor
(
ID_filme INT,
ID_editor INT,
PRIMARY KEY (ID_filme, ID_editor),
FOREIGN KEY (ID_filme) REFERENCES Filme (ID),
FOREIGN KEY (ID_editor) REFERENCES Editor (ID)
);
CREATE TABLE filme_operador_camera
(
ID_filme INT,
ID_operador_camera INT,
PRIMARY KEY (ID_filme, ID_operador_camera),
FOREIGN KEY (ID_filme) REFERENCES Filme (ID),
FOREIGN KEY (ID_operador_camera) REFERENCES Operador_de_Camera (ID)
);
# ------------------------------- ALTERAÇÃO DAS TABELAS ------------------------------- #
/*
Para adicionar as chaves estrangeiras
*/
ALTER TABLE filme
ADD id_estudio INT;
ALTER TABLE filme
ADD CONSTRAINT FOREIGN KEY (id_estudio) REFERENCES estudio (ID);
ALTER TABLE personagem
ADD id_ator INT;
ALTER TABLE personagem
ADD CONSTRAINT FOREIGN KEY (id_ator) REFERENCES ator (ID);
ALTER TABLE personagem
ADD id_figurinista INT;
ALTER TABLE personagem
ADD CONSTRAINT FOREIGN KEY (id_figurinista) REFERENCES figurinista (ID);
# ------------------------------- POPULAÇÂO DAS TABELAS ------------------------------- #
INSERT INTO estudio(Nome, Proprietario, Data_fundacao, Quantidade_Filmes_Produzidos, Quantidade_Filmes_Em_Producao,
Faturamento_anterior)
VALUES ('Cameracao', 'Ines Brasil', '2005-08-31', 2, 0, 1900000),
('Filmorama', 'Homer Simpson', '2000-07-21', 5, 2, 26000000),
('Cultfilme', 'Jason Friday', '2017-01-16', 3, 0, 900000);
INSERT INTO filme(Nome, Numero_registro, Categoria, Meses_Producao, Ano_lancamento, Copywriting, Custo, Sinopse,
Faturamento_total, Duracao, id_estudio)
VALUES ('Limpadores', '02650', 'Acao', 21, '2021-01-20', '2658425', 1600000,
'A Terra sofre um ataque e Os Limpadores sao convocados para limpar a bagunca.', 2500000, '02:10:00', 1),
('Macadasgar', '59865', 'Comedia', 5, '2020-05-02', '65874', 850000,
'Os animais tentam fugir do zoologico e acabam caindo na ilha de Macadasgar.', 1000000, '02:00:03', 1),
('Purassic Jark', '12652', 'Aventura', 19, '1993-09-29', '268562', 2000000,
'Numa tentativa de criar um parque para dinossauros, dinossauros reais sao criados.', 3500000, '03:00:12', 3),
('Diterdivamente', '854692', 'Comedia', 12, '2019-11-03', '856632', 1000000,
'Mostra o trabalho das emocoes em diferentes fases da vida.', 2000000, '02:15:10', 2),
('Nem que o touro espirre', '741235', 'Comedia', 15, '2021-01-12', '963258', 2000000,
'O touro é raptado e outros touros vao atras dele.', 2500000, '02:10:10', 1),
('Rapidos e raivosos', '159654', 'Aventura', 16, '2020-07-08', '784263', 1250000,
'Filme que mostra as corridas de rua ilegais.', 3000000, '02:05:03', 3),
('Estar Guerras', '102301', 'Ficcao', 21, '1995-02-28', '231662', 2350000,
'Saga de filmes que trata sobre o universo e guerras galaticas.', 4000000, '03:00:05', 1),
('Rarry Pobre', '012456', 'Ficcao', 12, '1997-06-28', '743691', 900000,
'Acompanhe a saga do jovem Rarry descobrindo poderes magicos.', 2100000, '02:30:00', 2),
('Para metade dos garotos que ja chorei', '254987', 'Romance', 18, '2018-03-15', '032165', 2000000,
'Lara Jean tem cartas enviadas a garotos que ja chorou um dia.', 850000, '02:00:00', 3),
('O menino listrado de pijama', '741259', 'Drama', 24, '2004-11-23', '215069', 212000,
'Menino alemao fica amigo de um judeu e tentam manter a amizade com as diferencas.', 1500000, '02:32:00', 1);
INSERT INTO ator(DRT, Nome, Seguro_social, Nacionalidade, Data_nasc, Sexo, Tipo_Papel, Quantidade_De_Atuacoes)
VALUES ('000001', 'Hugo Barbosa', '051254', 'Alemao', '2000-07-21', 'M', 'Vilão', 1),
('000002', 'Isaac Barbosa', '254962', 'Estadunidense', '2001-01-16', 'M', 'Prefeito', 2),
('000003', 'Pedro Guerra', '589645', 'Brasileiro', '2000-09-04', 'M', 'Herói', 2),
('000004', 'João Pedro', '896542', 'Russo', '2000-01-11', 'M', 'Anti-herói', 2),
('000005', 'Marcia Imper Ator', '951236', 'Brasileiro', '1969-05-18', 'F', 'Vilão', 1),
('000006', 'La Nah Rhodes', '854796', 'Canadense', '1989-12-05', 'F', 'Herói', 1),
('000007', 'Saxa Grey', '856321', 'Russo', '1999-04-01', 'F', 'Cientista', 1),
('000008', 'Mia Kah Lifa', '741236', 'Alemao', '1979-05-03', 'F', 'Artista', 2),
('000009', 'He Lel', '964120', 'Judaico', '1950-08-25', 'M', 'Estrela da manhã', 1),
('000010', 'Lisa Ann', '145632', 'Estadunidense', '1970-12-25', 'F', 'Artista', 1);
INSERT INTO cenografo(Nome)
VALUES ('Marcos File Mion'),
('Lussiano Hulk'),
('Angelica Brito'),
('Ruth Raquel'),
('Ojuara');
INSERT INTO diretor(Nome, Quantidade_Filmes)
VALUES ('Pedro Miguel', 2),
('Casmiro Certezas', 1),
('Nobru Apelao', 3),
('Gaules', 2),
('Alanzoka', 1),
('Yo Da', 1);
INSERT INTO editor(Nome)
VALUES ('Lucas Brexe'),
('Pedro Vaqueiro'),
('Magrao');
INSERT INTO figurinista(Nome)
VALUES ('Ueslei Safadinho'),
('Juan Sanctana'),
('Kola');
INSERT INTO maquiador(Nome)
VALUES ('Tche Tche'),
('Bozzo'),
('Parati'),
('Paraca');
INSERT INTO personagem(Nome_Personagem, id_ator, id_figurinista, Cache)
VALUES ('Capitao Faxina', 5, 2, 5),
('Homem de Berro', 8, 2, 4),
('Xela o Leao', 2, 1, 150),
('Dino Saulo', 9, 1, 180),
('Raiva', 4, 1, 190),
('Fernando', 3, 3, 200000),
('Torrent', 6, 1, 1500),
('Paulo Walker', 7, 3, 1600),
('Ioda', 1, 3, 15000),
('Valder', 10, 1, 16000),
('Rarry', 2, 2, 1000),
('Larissa', 8, 2, 12000),
('Bruno War', 3, 3, 5000),
('Samuel Paz', 4, 3, 5000);
INSERT INTO roteirista(Nome)
VALUES ('Latino'),
('Miano');
INSERT INTO tecnico_De_Som(Nome)
VALUES ('Alan Brado'),
('Fizza Now'),
('Pecanha');
INSERT INTO operador_de_camera(Nome)
VALUES ('Alan'),
('Neide Costa');
INSERT INTO ator_filme(ID_ator, ID_filme)
VALUES (5, 1),
(8, 1),
(2, 2),
(9, 3),
(4, 4),
(3, 5),
(6, 6),
(7, 6),
(1, 7),
(10, 7),
(2, 8),
(8, 9),
(3, 10),
(4, 10);
INSERT INTO filme_cenografo(ID_filme, ID_cenografo)
VALUES (1, 3),
(2, 2),
(3, 3),
(4, 1),
(5, 1),
(6, 3),
(7, 2),
(8, 1),
(9, 2),
(10, 3);
INSERT INTO filme_diretor(ID_filme, ID_diretor)
VALUES (1, 1),
(2, 2),
(3, 3),
(4, 4),
(5, 4),
(6, 3),
(7, 3),
(8, 1),
(9, 5),
(10, 6);
INSERT INTO filme_operador_camera(ID_filme, ID_operador_camera)
VALUES (1, 1),
(2, 1),
(3, 2),
(4, 1),
(5, 1),
(6, 2),
(7, 2),
(8, 1),
(9, 2),
(10, 1);
INSERT INTO filme_roterista(ID_filme, ID_roterista)
VALUES (1, 2),
(2, 1),
(3, 2),
(4, 2),
(5, 1),
(6, 2),
(7, 1),
(8, 1),
(9, 2),
(10, 1);
INSERT INTO filme_tecnico_de_som(ID_filme, ID_Tecnico_De_Som)
VALUES (1, 1),
(2, 3),
(3, 2),
(4, 1),
(5, 3),
(6, 2),
(7, 2),
(8, 1),
(9, 3),
(10, 1);
INSERT INTO personagem_filme(ID_personagem, ID_filme)
VALUES (1, 1),
(2, 1),
(3, 2),
(4, 3),
(5, 4),
(6, 5),
(7, 6),
(8, 7),
(9, 7),
(10, 8),
(11, 8),
(12, 9),
(13, 10),
(14, 10);
INSERT INTO personagem_maquiador(ID_personagem, ID_maquiador)
VALUES (1, 4),
(2, 4),
(3, 2),
(4, 1),
(5, 2),
(6, 3),
(7, 4),
(8, 3),
(9, 3),
(10, 2),
(11, 1),
(12, 1),
(13, 1),
(14, 4);
# ------------------------------- CONSULTAS ------------------------------- #
# Estudio que produziu mais filmes
SELECT nome, MAX(Quantidade_Filmes_Produzidos) as quantidade
FROM estudio;
# Identificação de qual categoria de filmes é mais produzida nos estúdios de Hollywood
SELECT MAX(Categoria)
FROM filme;
# Relação, por categoria, do número de filmes produzido por cada estúdio
SELECT est.Nome, fil.Categoria, count(est.Nome)
FROM filme fil
LEFT JOIN estudio est ON fil.id_estudio = est.ID
GROUP BY fil.Categoria, est.Nome
ORDER BY est.Nome;
# Identificação do ator (ou atriz) mais jovem e o ator (ou atriz) mais velho(a) de Hollywood;
SELECT NOME, timestampdiff(YEAR, Data_nasc, NOW()) as idade
FROM ator
WHERE Data_nasc IN (SELECT MIN(Data_nasc) FROM ator)
OR Data_nasc IN (SELECT MAX(Data_nasc) FROM ator);
# Identificação do filme mais caro;
SELECT nome AS nome_do_filme, Custo AS valor
FROM filme
WHERE Custo IN (SELECT MAX(Custo) FROM filme);
# Identificação da idade média para um ator atuar como “Artista”.
SELECT SUM(timestampdiff(YEAR, Data_nasc, NOW())) / count(Tipo_Papel like 'Artista') AS idade
FROM ator
WHERE Tipo_Papel like 'Artista';
# Diretor com mais filmes
SELECT Nome, Quantidade_Filmes
FROM diretor
WHERE Quantidade_Filmes IN (SELECT MAX(Quantidade_Filmes) FROM diretor)
GROUP BY Nome;
# Filme com maior bilheteria
SELECT nome AS nome_do_filme, Faturamento_total AS valor
FROM filme
WHERE Faturamento_total IN (SELECT MAX(Faturamento_total) FROM filme);
# Ator (es) com menos filmes
SELECT nome, Quantidade_De_Atuacoes
FROM ator
WHERE Quantidade_De_Atuacoes IN (SELECT MIN(Quantidade_De_Atuacoes) FROM ator);
# Personagem do filme Limpadores com maior cache
SELECT p.Nome_Personagem, MAX(p.Cache)
FROM personagem_filme pf
LEFT JOIN personagem p ON pf.ID_personagem = p.ID
LEFT JOIN filme f ON pf.ID_filme = f.ID
WHERE f.Nome like 'Limp%'; |
INSERT INTO player VALUES (1, 'english@freemail.hu', 'USER', '$2a$10$8Kre7KpW8MXDqWJ3uh/a.eNiQAoeT0ONaZtg38UDm.Lz4U7o.LZSm', 'not_Shakespeare');
INSERT INTO player VALUES (2, 'berci@freemail.hu', 'USER', '$2a$10$8Kre7KpW8MXDqWJ3uh/a.eNiQAoeT0ONaZtg38UDm.Lz4U7o.LZSm', 'Farkas_Bertalan');
SELECT pg_catalog.setval('player_id_seq', 2, true);
|
-- MySQL dump 10.13 Distrib 8.0.22, for Win64 (x86_64)
--
-- Host: localhost Database: emp
-- ------------------------------------------------------
-- Server version 8.0.22
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!50503 SET NAMES 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 `user_details`
--
DROP TABLE IF EXISTS `user_details`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `user_details` (
`email_id` varchar(50) NOT NULL,
`password` varchar(50) NOT NULL,
`role_id` int NOT NULL,
`id` int NOT NULL,
PRIMARY KEY (`email_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `user_details`
--
LOCK TABLES `user_details` WRITE;
/*!40000 ALTER TABLE `user_details` DISABLE KEYS */;
INSERT INTO `user_details` VALUES ('abc@gmail.com','password',4,4),('admin@app.com','password',1,1),('megha@app.com','password',2,3),('rahul@app.com','password',6,6),('test@app.com','password',7,7),('user@app.com','password',2,2),('user1@app.com','password',2,2),('vishnu@app.com','password',1,8);
/*!40000 ALTER TABLE `user_details` 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 2021-01-16 18:42:44
|
drop table if exists stocks;
create table stocks (
name text primary key,
zone text not null,
date text not null
open real,
high real,
low real,
volume integer,
close real
);
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.