blob_id stringlengths 40 40 | language stringclasses 1
value | repo_name stringlengths 5 133 | path stringlengths 3 276 | src_encoding stringclasses 33
values | length_bytes int64 23 9.61M | score float64 2.52 5.28 | int_score int64 3 5 | detected_licenses listlengths 0 44 | license_type stringclasses 2
values | text stringlengths 23 9.43M | download_success bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|
631bde6b4690cb28962cade5608fcc929995a959 | SQL | Jensonmathew25/programs | /program10.sql | UTF-8 | 632 | 3.515625 | 4 | [] | no_license | CREATE TABLE customers(ID INT,Name CHAR(20),Age INT,Address CHAR(50),Salary INT PRIMARY KEY(ID));
INSERT INTO customers VALUES(1,"Rahul",27,"Delhi",15000);
INSERT INTO customers VALUES(2,"Sachin",29,"Ahmedabad",20000);
INSERT INTO customers VALUES(3,"James",35,"Chennai",25000);
SELECT * FROM customers;
DECLARE
total_rows number(2);
BEGIN
UPDATE customers
SET Salary=Salary+5000;
IF sql%notfound THEN
dbms_output.put_line('no customers updated');
ELSIF sql%found THEN
total_rows:=sql%rowcount;
dbms_output.put_line(total_rows||'customers updated');
END IF;
END;
/
SELECT * FROM customers; | true |
0e299049fec72edf5d7b9a81200bbd13032aef48 | SQL | MashaN2004/MPIT-Lotus | /hackaton.sql | UTF-8 | 2,893 | 3.234375 | 3 | [] | no_license | -- phpMyAdmin SQL Dump
-- version 4.7.7
-- https://www.phpmyadmin.net/
--
-- Хост: 127.0.0.1:3306
-- Время создания: Апр 18 2021 г., 03:45
-- Версия сервера: 5.6.38
-- Версия PHP: 5.5.38
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 */;
--
-- База данных: `hackaton`
--
-- --------------------------------------------------------
--
-- Структура таблицы `questions`
--
CREATE TABLE `questions` (
`heading` varchar(355) NOT NULL,
`user_id` varchar(10) NOT NULL,
`question` varchar(355) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Дамп данных таблицы `questions`
--
INSERT INTO `questions` (`heading`, `user_id`, `question`) VALUES
('Ответ', '1', 'тебе нужно прыгнуть три раза'),
('Ответ', '1', 'тебе нужно прыгнуть три раза'),
('ХАКЕРЫ ПРЕСЛЕДУЮТ МЕНЯ?', '1', 'Большинство хакеров не заинтересованы в среднем пользователе, они преследуют более крупные цели, но вы можете стать целью по той или иной причине. Вообще, среднестатистический пользователь будет подвергаться масштабному нападению только при фишинговой или подобной атаке по всей стране.');
-- --------------------------------------------------------
--
-- Структура таблицы `users`
--
CREATE TABLE `users` (
`id` int(10) NOT NULL,
`name` varchar(355) NOT NULL,
`password` varchar(30) NOT NULL,
`email` varchar(355) NOT NULL,
`avatar` varchar(50) NOT NULL,
`phone` varchar(50) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Дамп данных таблицы `users`
--
INSERT INTO `users` (`id`, `name`, `password`, `email`, `avatar`, `phone`) VALUES
(1, 'pro228', '12', 'fedya@mail.ru', 'img/1.jpg', '89148234526');
--
-- Индексы сохранённых таблиц
--
--
-- Индексы таблицы `users`
--
ALTER TABLE `users`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT для сохранённых таблиц
--
--
-- AUTO_INCREMENT для таблицы `users`
--
ALTER TABLE `users`
MODIFY `id` int(10) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
| true |
331835c8e05ce2eb6c52301a2514a1f9597c463b | SQL | bakriridhwan/dispertangan | /pw2.sql | UTF-8 | 8,649 | 2.796875 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"MIT"
] | permissive | -- phpMyAdmin SQL Dump
-- version 5.0.2
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Jan 10, 2021 at 08:48 PM
-- Server version: 10.4.14-MariaDB
-- PHP Version: 7.4.10
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Database: `pw2`
--
-- --------------------------------------------------------
--
-- Table structure for table `datacenter`
--
CREATE TABLE `datacenter` (
`id` int(11) NOT NULL,
`tahun` varchar(128) NOT NULL,
`bulan` varchar(128) NOT NULL,
`bidang` varchar(128) NOT NULL,
`judul` varchar(128) NOT NULL,
`file` varchar(256) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `datacenter`
--
INSERT INTO `datacenter` (`id`, `tahun`, `bulan`, `bidang`, `judul`, `file`) VALUES
(14, '2016', 'Januari', 'Ketahanan Pangan', 'Luas Panen, Produksi dan Produktivitas Tanaman Palawija', 't1_3.pdf'),
(15, '2011', 'Januari', 'Pertanian', 'Angka Tetap Tanaman Sayur 2011', 'atap_sayur2011.pdf'),
(16, '2010', 'Maret', 'Pertanian', 'Angka Tetap Tanaman Buah 2010', 'atap_buah2010.pdf'),
(17, '2009', 'April', 'Perikanan', 'Tabel Produksi Daging di DIY', 'tabel_6_produksi_daging_kab_kota_di_diy.pdf'),
(18, '2013', 'April', 'Ketahanan Pangan', 'Luas Panen Tanaman Padi dan Palawija per sub Round', '16-18_2013_(1).pdf'),
(19, '2014', 'April', 'Ketahanan Pangan', 'Luas Panen Tanaman Padi dan Palawija per sub Round', 't4_6kota.pdf'),
(20, '2011', 'November', 'Pertanian', 'Angka Tetap Tanaman Obat tahun 2011', 'atap_tobat2011.pdf'),
(21, '2010', 'Agustus', 'Pertanian', 'Angka Tetap Tanaman Hias tahun 2010', 'atap_flori_10.pdf'),
(22, '2006', 'Juni', 'Perikanan', 'Produksi Daging, Telur dan Susu', 'hal6.pdf'),
(23, '2005', 'Juli', 'Perikanan', 'Populasi Ternak Kecil, Besar dan Unggas', 'tb1.pdf'),
(24, '2021', 'Januari', 'Pertanian', 'File coba 1', 'FILE_1.docx'),
(25, '2020', 'Februari', 'Perikanan', 'File coba 2', 'FILE_2.docx'),
(26, '2019', 'Maret', 'Ketahanan Pangan', 'File coba 3', 'FILE_3.docx'),
(27, '2018', 'April', 'Pertanian', 'File coba 4', 'FILE_4.pdf'),
(28, '2017', 'Mei', 'Perikanan', 'File coba 5', 'FILE_5.pdf'),
(29, '2021', 'Desember', 'Ketahanan Pangan', 'File coba 6 Update', 'FILE_61.pdf');
-- --------------------------------------------------------
--
-- Table structure for table `user`
--
CREATE TABLE `user` (
`id` int(11) NOT NULL,
`name` varchar(128) NOT NULL,
`email` varchar(128) NOT NULL,
`image` varchar(128) NOT NULL,
`password` varchar(256) NOT NULL,
`role_id` int(11) NOT NULL,
`is_active` int(1) NOT NULL,
`date_created` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `user`
--
INSERT INTO `user` (`id`, `name`, `email`, `image`, `password`, `role_id`, `is_active`, `date_created`) VALUES
(1, 'Bima Pramudya Asadulloh', 'prambima@gmail.com', 'Bima-Pramudya-Asaddulloh1.jpg', '$2y$10$Rl44p5CInyd1HSNMfF8jDO576KaBeLX1V2rZSN4FilUh5Y/JDXuGi', 2, 1, 1609886667),
(2, 'Bakri Ahmad Ridhwan', 'bakri@gmail.com', 'Bakri_Ar_on_Instagram___Foto_Lawas_--__Bu6Kf4RAz5J_0(JPG).jpg', '$2y$10$dFOTFHsMrwhqK5ZWmnr/hegp7cV/X3XWKi.sQR3D04nmRYah1iB1q', 1, 1, 1609886725),
(4, 'David Dzakiy Al Maghribi', 'daviddzakiy@gmail.com', 'default.jpg', '$2y$10$8zFjw3qGPo.u4qS6o02Kcemcizp6Sft/QHXSnANdfeXlr/bX0.UxG', 2, 1, 1609898532),
(8, 'Firman Asharudin', 'firman@gmail.com', '38_AMIKOMY.png', '$2y$10$f9ty5SEdOOsHxX6tM8P4EOLeYmxOs0lUgIu/H.M2ExREbNdRv9y2q', 2, 1, 1610052627),
(20, 'Wahid Kurnia Mahardika', 'dhika@gmail.com', 'default.jpg', '$2y$10$w2.lOK0MqHJO8/dFaRbG4.YWBel0ysomyprJL0ahs8H0HhBXbpyUS', 2, 1, 1610251418),
(21, 'Rosyid Majid', 'rosyid@gmail.com', 'default.jpg', '$2y$10$upzxmdIiteQaI9TgRlWkDubD6QBMUnmQc5.wKZZXAb2k3c/iAr2pC', 2, 1, 1610251440),
(22, 'Firman Asharudin2', 'firman2@gmail.com', '38_AMIKOMY1.png', '$2y$10$zDNYEFMsUoDCfAKp/WPRdegkPdL5dHoWzmrFoAOMTxQ0yl8OoPybm', 1, 1, 1610252508),
(23, 'Testing testing', 'testing@gmail.com', 'default.jpg', '$2y$10$DBuNOBac2ZSvId6OcGIBHO0w5r94/VgINZN6XmDjyQPOFDLs.H076', 2, 1, 1610305850);
-- --------------------------------------------------------
--
-- Table structure for table `user_access_menu`
--
CREATE TABLE `user_access_menu` (
`id` int(11) NOT NULL,
`role_id` int(11) NOT NULL,
`menu_id` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `user_access_menu`
--
INSERT INTO `user_access_menu` (`id`, `role_id`, `menu_id`) VALUES
(1, 1, 1),
(2, 1, 2),
(3, 2, 2),
(4, 1, 3),
(6, 1, 5),
(7, 2, 5);
-- --------------------------------------------------------
--
-- Table structure for table `user_menu`
--
CREATE TABLE `user_menu` (
`id` int(11) NOT NULL,
`menu` varchar(128) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `user_menu`
--
INSERT INTO `user_menu` (`id`, `menu`) VALUES
(1, 'Admin'),
(2, 'User'),
(3, 'Menu'),
(5, 'Data Center'),
(7, 'Testing'),
(8, 'Testing Update 2');
-- --------------------------------------------------------
--
-- Table structure for table `user_role`
--
CREATE TABLE `user_role` (
`id` int(11) NOT NULL,
`role` varchar(128) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `user_role`
--
INSERT INTO `user_role` (`id`, `role`) VALUES
(1, 'Administrator'),
(2, 'Member'),
(3, 'Mahasiswa Test'),
(5, 'Dosen'),
(8, 'Testing');
-- --------------------------------------------------------
--
-- Table structure for table `user_sub_menu`
--
CREATE TABLE `user_sub_menu` (
`id` int(11) NOT NULL,
`menu_id` int(11) NOT NULL,
`title` varchar(128) NOT NULL,
`url` varchar(128) NOT NULL,
`icon` varchar(128) NOT NULL,
`is_active` int(1) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `user_sub_menu`
--
INSERT INTO `user_sub_menu` (`id`, `menu_id`, `title`, `url`, `icon`, `is_active`) VALUES
(1, 1, 'Dashboard', 'admin', 'fas fa-home', 1),
(2, 2, 'My Profile', 'user/tampilkanProfil', 'fas fa-user', 1),
(3, 2, 'Edit Profile', 'user/edit', 'fas fa-user-edit', 1),
(4, 3, 'Menu Management', 'menu', 'fas fa-folder', 1),
(5, 3, 'Submenu Management', 'menu/submenu', 'fas fa-folder-open', 1),
(7, 1, 'Role', 'admin/role', 'fas fa-fw fa-user-tie', 1),
(8, 2, 'Change Password', 'user/changepassword', 'fas fa-key', 1),
(9, 5, 'Data', 'user/tampilkanData', 'fas fa-database', 1),
(10, 1, 'Management Data', 'admin/mUser', 'fas fa-users', 1),
(12, 1, 'Coba', 'coba/coba', 'fab fa-youtube', 0);
-- --------------------------------------------------------
--
-- Table structure for table `user_token`
--
CREATE TABLE `user_token` (
`id` int(11) NOT NULL,
`email` varchar(128) NOT NULL,
`token` varchar(128) NOT NULL,
`date_created` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Indexes for dumped tables
--
--
-- Indexes for table `datacenter`
--
ALTER TABLE `datacenter`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `user`
--
ALTER TABLE `user`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `user_access_menu`
--
ALTER TABLE `user_access_menu`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `user_menu`
--
ALTER TABLE `user_menu`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `user_role`
--
ALTER TABLE `user_role`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `user_sub_menu`
--
ALTER TABLE `user_sub_menu`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `user_token`
--
ALTER TABLE `user_token`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `datacenter`
--
ALTER TABLE `datacenter`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=30;
--
-- AUTO_INCREMENT for table `user`
--
ALTER TABLE `user`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=24;
--
-- AUTO_INCREMENT for table `user_access_menu`
--
ALTER TABLE `user_access_menu`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8;
--
-- AUTO_INCREMENT for table `user_menu`
--
ALTER TABLE `user_menu`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=9;
--
-- AUTO_INCREMENT for table `user_role`
--
ALTER TABLE `user_role`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=9;
--
-- AUTO_INCREMENT for table `user_sub_menu`
--
ALTER TABLE `user_sub_menu`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=13;
--
-- AUTO_INCREMENT for table `user_token`
--
ALTER TABLE `user_token`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=9;
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
| true |
028be81108d99e8359a978725eb327bfb0f39a26 | SQL | wvlvik/callme | /aes-sample/db/callmewx_scans.sql | UTF-8 | 1,418 | 2.84375 | 3 | [] | no_license | -- phpMyAdmin SQL Dump
-- version 4.2.9
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Jun 14, 2018 at 04:15 PM
-- Server version: 5.5.40
-- PHP Version: 5.4.33
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: `wxcallme`
--
-- --------------------------------------------------------
--
-- Table structure for table `callmewx_scans`
--
CREATE TABLE IF NOT EXISTS `callmewx_scans` (
`id` int(11) NOT NULL,
`nickname` varchar(64) NOT NULL,
`supercode_id` varchar(64) NOT NULL,
`scan_position` varchar(64) NOT NULL,
`create_date` bigint(128) NOT NULL
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
--
-- Indexes for dumped tables
--
--
-- Indexes for table `callmewx_scans`
--
ALTER TABLE `callmewx_scans`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `callmewx_scans`
--
ALTER TABLE `callmewx_scans`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=1;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
| true |
b18c662ae7345b8fb4f4d68500cb9830e76aece0 | SQL | snoow/swganh_database | /swganh_static/scripts/travel_planet_routes.sql | UTF-8 | 3,911 | 3.25 | 3 | [] | no_license | -- ---------------------------------------------------------------------------------------
-- This source file is part of SWG:ANH (Star Wars Galaxies - A New Hope - Server Emulator)
--
-- For more information, visit http://www.swganh.com
--
-- Copyright (c) 2006 - 2012 The SWG:ANH Team
-- ---------------------------------------------------------------------------------------
-- This library is free software; you can redistribute it and/or
-- modify it under the terms of the GNU Lesser General Public
-- License as published by the Free Software Foundation; either
-- version 2.1 of the License, or (at your option) any later version.
--
-- This library is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-- Lesser General Public License for more details.
--
-- You should have received a copy of the GNU Lesser General Public
-- License along with this library; if not, write to the Free Software
-- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-- ---------------------------------------------------------------------------------------
/*!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 */;
USE swganh_static;
--
-- Table structure for table `travel_planet_routes`
--
DROP TABLE IF EXISTS `travel_planet_routes`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `travel_planet_routes` (
`srcId` int(11) NOT NULL COMMENT 'Source Planet ID',
`destId` int(11) NOT NULL DEFAULT '0' COMMENT 'Destination Planet ID',
`price` int(11) unsigned NOT NULL DEFAULT '1000' COMMENT 'Travel Route Price',
PRIMARY KEY (`srcId`,`destId`),
KEY `travel_route_destination_planet_id` (`destId`),
CONSTRAINT `travel_route_destination_planet_id` FOREIGN KEY (`destId`) REFERENCES `planet` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `travel_route_source_planet_id` FOREIGN KEY (`srcId`) REFERENCES `planet` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `travel_planet_routes`
--
LOCK TABLES `travel_planet_routes` WRITE;
/*!40000 ALTER TABLE `travel_planet_routes` DISABLE KEYS */;
INSERT INTO `travel_planet_routes` VALUES (0,0,100),
(0,1,1000),
(0,2,2000),
(0,3,4000),
(0,5,500),
(0,7,300),
(0,8,600),
(0,9,3000),
(0,42,1250),
(1,0,1000),
(1,1,100),
(2,0,2000),
(2,2,100),
(3,0,4000),
(3,3,100),
(3,5,1750),
(4,4,100),
(4,5,1250),
(4,8,1250),
(5,0,500),
(5,3,1750),
(5,4,1250),
(5,5,100),
(5,6,300),
(5,8,500),
(6,5,300),
(6,6,100),
(7,0,300),
(7,7,100),
(8,0,600),
(8,4,1250),
(8,5,500),
(8,8,100),
(9,0,3000),
(9,9,100),
(42,0,1250),
(42,42,100);
/*!40000 ALTER TABLE `travel_planet_routes` 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 2012-08-27 9:42:10
| true |
86128ca87cf0126a36d26ef822ea723313bedc47 | SQL | tatenda11/school-social-network | /dbs/fi_messages.sql | UTF-8 | 2,484 | 2.984375 | 3 | [] | no_license | -- phpMyAdmin SQL Dump
-- version 4.5.1
-- http://www.phpmyadmin.net
--
-- Host: 127.0.0.1
-- Generation Time: Apr 26, 2016 at 07:51 PM
-- Server version: 10.1.10-MariaDB
-- PHP Version: 5.6.19
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Database: `solusi_fi2`
--
-- --------------------------------------------------------
--
-- Table structure for table `fi_messages`
--
CREATE TABLE `fi_messages` (
`messageId` int(11) NOT NULL,
`userTo` int(5) NOT NULL,
`userFrom` int(5) NOT NULL,
`attachment` varchar(255) NOT NULL,
`message` text NOT NULL,
`sentDate` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`status` enum('P','O') NOT NULL DEFAULT 'P'
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `fi_messages`
--
INSERT INTO `fi_messages` (`messageId`, `userTo`, `userFrom`, `attachment`, `message`, `sentDate`, `status`) VALUES
(1, 1, 4, '', 'nice job on the site', '2016-04-17 13:28:08', 'P'),
(2, 4, 6, '', 'ko ndeipi', '2016-04-17 18:59:29', 'P'),
(3, 4, 1, '', 'hey maya kokusataura nevamwe ndozvinei', '2016-04-18 05:03:40', 'P'),
(4, 4, 1, '', 'Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor.\n', '2016-04-18 14:11:09', 'P'),
(15, 6, 4, '', 'zvirisei claud', '2016-04-19 17:22:10', 'P'),
(16, 6, 4, '', 'zvirisei claud', '2016-04-20 06:02:57', 'P'),
(17, 1, 4, '', 'ndimi marova imi', '2016-04-20 06:03:22', 'P'),
(18, 1, 4, '', 'ndeipi tatenda', '2016-04-20 18:00:07', 'P'),
(19, 4, 1, '', 'maya zvirisei', '2016-04-21 06:17:59', 'P'),
(20, 4, 1, '', 'hey maya watapp', '2016-04-21 08:58:30', 'P');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `fi_messages`
--
ALTER TABLE `fi_messages`
ADD PRIMARY KEY (`messageId`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `fi_messages`
--
ALTER TABLE `fi_messages`
MODIFY `messageId` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=21;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
| true |
a61b2aae9f2befdf4ad75711ee4ea6717d2655fb | SQL | rajuneelam/Student_Portal_web | /data/srs_db.sql/srs_db_prerequisites.sql | UTF-8 | 2,557 | 3 | 3 | [] | no_license | -- MySQL dump 10.13 Distrib 8.0.23, for Win64 (x86_64)
--
-- Host: localhost Database: srs_db
-- ------------------------------------------------------
-- Server version 8.0.23
/*!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 `prerequisites`
--
DROP TABLE IF EXISTS `prerequisites`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `prerequisites` (
`dept_code` varchar(4) NOT NULL,
`course_no` smallint NOT NULL,
`pre_dept_code` varchar(4) NOT NULL,
`pre_course_no` smallint NOT NULL,
PRIMARY KEY (`dept_code`,`course_no`,`pre_dept_code`,`pre_course_no`),
KEY `pre_dept_code` (`pre_dept_code`,`pre_course_no`),
CONSTRAINT `prerequisites_ibfk_1` FOREIGN KEY (`dept_code`, `course_no`) REFERENCES `courses` (`dept_code`, `course_no`) ON DELETE CASCADE,
CONSTRAINT `prerequisites_ibfk_2` FOREIGN KEY (`pre_dept_code`, `pre_course_no`) REFERENCES `courses` (`dept_code`, `course_no`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `prerequisites`
--
LOCK TABLES `prerequisites` WRITE;
/*!40000 ALTER TABLE `prerequisites` DISABLE KEYS */;
INSERT INTO `prerequisites` VALUES ('CS',552,'CS',240),('Math',314,'Math',221),('CS',432,'Math',314),('CS',532,'Math',314);
/*!40000 ALTER TABLE `prerequisites` 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-04-06 10:34:24
| true |
321a32c2488f7f21c1c7a0218497f5dbee9c57d4 | SQL | open-fred/db | /preprocessing/supply/forwind_oeko_renewable_feedin_per_federalstate.sql | UTF-8 | 3,935 | 3.328125 | 3 | [] | no_license | /*
A description of the module (short but could be more than one line).
Modules names should have short, all-lowercase names.
The module name may have underscores if this improves readability.
__copyright__ = "Copyright Reiner Lemoine Institut gGmbH"
__license__ = "GNU Affero General Public License Version 3 (AGPL-3.0)"
__url__ = "https://github.com/openego/data_processing/blob/master/LICENSE"
__author__ = "KilianZimmerer"
__contains__ = "url"
*/
-- metadata
COMMENT ON TABLE supply.forwind_oeko_renewable_feedin_per_federalstate IS '{
"title": "Data record for generic feed-in time series from 2020 to 2050 for PV, wind onshore and wind offshore per federal state",
"description": "Datensatz fuer generische Einspeisezeitreihen 2020 bis 2050 f\u00fcr PV, Wind Onshore und Wind Offshore pro Bundesland",
"language": [ "eng", "ger" ],
"spatial": {
"location": "",
"extend": "germany",
"resolution": "federal state"},
"temporal": {
"reference_date": "2016-11-23",
"start": "",
"end": "",
"resolution": ""},
"sources": [
{"name": "\u00d6ko-Institut e.V.",
"description": "Daten zur Einspeisung erneuerbarer Energien",
"url": "https://www.oeko.de/aktuelles/2016/daten-zur-einspeisung-erneuerbarer-energien/",
"license": "",
"copyright": ""},
{"name": "\u00d6ko-Institut e.V.",
"description": "ForWind & \u00d6ko-Institut (2016): Generische Einspeisezeitreihen der Photovoltaik auf Bundeslandebene f\u00fcr Deutschland im Zeitraum 2020 bis 2050.",
"url": "https://www.oeko.de/aktuelles/2016/daten-zur-einspeisung-erneuerbarer-energien/",
"license": "",
"copyright": ""},
{"name": "\u00d6ko-Institut e.V.",
"description": "Datensatz_fuer_generische_Einspeisezeitreihen_der_Offshore_Windenergie_2020_bis_2050.xlsx",
"url": "",
"license": "",
"copyright": ""},
{"name": "\u00d6ko-Institut e.V.",
"description": "Datensatz_fuer_generische_Einspeisezeitreihen_der_Onshore_Windenergie_2020_bis_2050.xlsx",
"url": "",
"license": "",
"copyright": ""},
{"name": "\u00d6ko-Institut e.V.",
"description": "Datensatz_fuer_generische_Einspeisezeitreihen_der_Photovoltaik_2020_bis_2050.xlsx",
"url": "",
"license": "",
"copyright": ""}],
"license": {
"id": "GPL-3.0",
"name": "CC BY-SA 3.0",
"version": "3.0",
"url": "https://creativecommons.org/licenses/by-sa/3.0/",
"instruction": "Dieses Werk bzw. dieser Inhalt steht unter einer Creative Commons Namensnennung, Weitergabe unter gleichen Bedingungen 3.0 Lizenz (CC-BY-SA 3.0) - \u00d6ko-Institut e.V. 2016",
"copyright": ""},
"contributors": [
{"name": "Ludwig H\u00fclk",
"email": "ludwig.huelk@rl-institut.de",
"date": "1-25-6--20",
"comment": "import data"},
{"name": "Ludwig H\u00fclk",
"email": "ludwig.huelk@rl-institut.de",
"date": "2-08-6--20",
"comment": "updated metadata"},
{"name": "Kilian Zimmerer",
"email": "",
"date": "2017-10-17",
"comment": "Update metadata to v1.3"}],
"resources": [
{"name": "supply.forwind_oeko_renewable_feedin_per_federalstate",
"format": "PostgreSQL",
"fields": [
{"name": "id",
"description": "unique identifier",
"unit": ""},
{"name": "technology",
"description": "renewable PV, wind onshore, wind offshore",
"unit": ""},
{"name": "factor",
"description": "normiert (standardised), skaliert (scaled)",
"unit": ""}]}],
"metadata_version": "1.3"}';
| true |
e6a9abca793649070627137eb8826a0f5448d528 | SQL | cnslyq/ts | /sql/stock_ddl.sql | UTF-8 | 636 | 2.890625 | 3 | [] | no_license | drop table if exists stock_info;
create table stock_info(
`id` bigint(20) primary key not null auto_increment,
`code` varchar(8),
`name` varchar(16),
`industry` int(8),
`concept` varchar(256),
`area` int(6),
`is_sme` int(1),
`is_gem` int(1),
`is_risk` int(1),
`is_hs300` int(1),
`is_sz50` int(1),
`is_zz500` int(1),
`is_stop` int(1),
`is_pause` int(1),
`hs300_date` date,
`hs300_weight` double,
`list_date` date,
`stop_date` date,
`pause_date` date,
`create_date` timestamp not null default CURRENT_TIMESTAMP,
`update_date` timestamp
) ENGINE=InnoDB;
alter table stock_info add index stock_info_code_idx (`code`);
| true |
49012b5734295867e7fb6066c0a46f6345371995 | SQL | joseluisescobar09/proyecto_integrador | /proyecto.sql | UTF-8 | 755 | 3.328125 | 3 | [] | no_license | CREATE TABLE IF NOT EXISTS accounts (
id_usuario INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
nombre VARCHAR(30) NOT NULL,
apellido_paterno VARCHAR(30) NOT NULL,
apellido_materno VARCHAR(30) NOT NULL,
fecha_nacimiento CHAR(15) NOT NULL,
genero TEXT CHECK( genero IN ('H','M') ) NOT NULL,
email VARCHAR(60) UNIQUE NOT NULL,
contrasena VARCHAR(100) NOT NULL
);
CREATE TABLE IF NOT EXISTS registros_usuarios (
id_register INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
register_date DATE NOT NULL,
register_time TIME NOT NULL
);
CREATE TRIGGER usuarios_registrados AFTER INSERT ON accounts
BEGIN
INSERT INTO registros_usuarios (register_date, register_time) VALUES (DATE('now'), TIME('now') );
END; | true |
2e1f5eb4a504fa687b5c700737c476705f8c8077 | SQL | mastorakakis/Private-School | /Database/selections.sql | UTF-8 | 3,672 | 4.1875 | 4 | [] | no_license | -- List of all students------------
SELECT st_id 'Student ID',
concat(first_name, ' ', last_name) 'Full Name',
date_of_birth 'Birth Date',
tuition_fees 'Tuition Fees'
FROM students;
-- Lists of all trainers-------------
SELECT t_id 'Trainer ID',
concat(first_name, ' ', last_name) 'Full Name',
t_subject Subject
FROM trainers;
-- List of all assignments------------
SELECT a_id 'Assignment ID',
title Title,
t_description Description,
total_mark 'Total Mark',
oral_mark 'Oral Mark',
submission_date 'Submission Date'
FROM assignments;
-- List of all courses------------------
SELECT c_id 'Course ID',
title Title,
stream_name Stream,
type_name Type,
start_date 'Start Date',
end_date 'End Date'
FROM courses
NATURAL JOIN streams
NATURAL JOIN c_types
ORDER BY c_id;
-- All students per course------------
SELECT title 'Course Title',
stream_name Stream,
type_name Type,
concat(first_name, ' ', last_name) 'Full Name'
FROM students
INNER JOIN students_course USING (st_id)
INNER JOIN courses USING (c_id)
INNER JOIN streams USING (stream_id)
INNER JOIN c_types USING (type_id)
ORDER BY courses.title, stream, type, first_name;
-- All trainers per course----------------
SELECT title 'Course Title',
stream_name Stream,
type_name Type,
concat(first_name, ' ', last_name) 'Full Name',
t_subject 'Subject'
FROM trainers
INNER JOIN trainers_course USING (t_id)
INNER JOIN courses USING (c_id)
INNER JOIN streams USING (stream_id)
INNER JOIN c_types USING (type_id)
ORDER BY courses.title, stream, type, first_name;
-- All assignments per course---------------
SELECT courses.title 'Course Title',
stream_name Stream,
type_name Type,
assignments.title Title,
t_description Description
FROM assignments
INNER JOIN assignments_course USING (a_id)
INNER JOIN courses USING (c_id)
INNER JOIN streams USING (stream_id)
INNER JOIN c_types USING (type_id)
ORDER BY courses.title, stream, type;
-- All assignments per course per student---------
SELECT courses.title 'Course Title',
stream_name Stream,
type_name Type,
assignments.title Assignment,
last_name 'Last Name',
first_name 'First Name'
FROM assignments
INNER JOIN assignments_course USING (a_id)
INNER JOIN courses USING (c_id)
INNER JOIN streams USING (stream_id)
INNER JOIN c_types USING (type_id)
INNER JOIN students_course USING (c_id)
INNER JOIN students USING (st_id)
ORDER BY courses.title, Stream, Type, assignments.title;
-- All students that belong to more than one courses--------
SELECT concat(first_name, ' ', last_name) 'Full Name',
title 'Course Title',
stream_name Stream,
type_name Type
FROM students
INNER JOIN students_course USING (st_id)
INNER JOIN courses USING (c_id)
INNER JOIN streams USING (stream_id)
INNER JOIN c_types USING (type_id)
where students.st_id in (SELECT st_id
FROM students_course
GROUP BY st_id
HAVING COUNT(st_id) > 1)
ORDER BY first_name;
-- ----Java Objectives------------------------------------
-- SELECT ob_id, title FROM common_objectives
-- LEFT JOIN streams USING (stream_id)
-- UNION
-- SELECT j_ob_id, title FROM java_objectives
-- LEFT JOIN streams USING (stream_id)
-- ORDER BY ob_id;
-- -- ---C# Objectives----------------------------------------
-- SELECT ob_id, title FROM common_objectives
-- LEFT JOIN streams USING (stream_id)
-- UNION
-- SELECT c_ob_id, title FROM c_objectives
-- LEFT JOIN streams USING (stream_id)
-- ORDER BY ob_id; | true |
83096c7f3f779c08d29d5f10e85b9f3f7fb21bf1 | SQL | Maxxx-zh/SQL-Fundamentals- | /SQL Fundamentals.sql | UTF-8 | 5,778 | 4.375 | 4 | [] | no_license | -- Start ##
SELECT *
FROM recent_grads
-- First Query ##
select * from recent_grads;
-- The LIMIT Clause ##
SELECT *
FROM recent_grads
LIMIT 5;
-- Selecting Specific Columns ##
SELECT Major , ShareWomen
FROM recent_grads
--
SELECT name , tagline , contributed_by
FROM beers
LIMIT 10;
-- Filtering Rows Using WHERE ##
SELECT Major , ShareWomen
FROM recent_grads
WHERE ShareWomen < 0.5
-- Expressing Multiple Filter Criteria Using 'AND' ##
SELECT Major , Major_category , Median,ShareWomen
FROM recent_grads
WHERE ShareWomen > 0.5 AND Median > 50000
-- Returning One of Several Conditions With OR ##
SELECT Major,Median,Unemployed
FROM recent_grads
WHERE Median >= 10000
OR Men > Women
LIMIT 20;
-- Grouping Operators with Parentheses ##
SELECT Major,Major_category,ShareWomen,Unemployment_rate
FROM recent_grads
WHERE Major_category = 'Engineering'
AND (ShareWomen > 0.5
OR Unemployment_rate < 0.051 )
-- Ordering Results Using ORDER BY ##
SELECT Major, ShareWomen, Unemployment_rate
FROM recent_grads
WHERE ShareWomen > 0.3
AND Unemployment_rate < 0.1
ORDER BY ShareWomen DESC
-- Practice Writing a Query ##
SELECT Major_category, Major, Unemployment_rate
FROM recent_grads
WHERE Major_category IN ('Engineering' , 'Physical Sciences')
ORDER BY Unemployment_rate ;
------------------------------------------------------------------------------------------------
-- A Simple Question ##
SELECT MIN(Unemployment_rate)
FROM recent_grads
-- Aggregate Functions ##
SELECT SUM(Total)
FROM recent_grads
-- Order of Execution ##
SELECT COUNT(Major)
FROM recent_grads
WHERE ShareWomen < 0.5
-- Missing Values ##
SELECT COUNT(*),COUNT(Unemployment_rate)
FROM recent_grads
-- Combining Multiple Aggregation Functions ##
SELECT AVG(Total) , MIN(Men) , MAX(Women)
FROM recent_grads
-- Customising the Results ##
SELECT COUNT(*) AS 'Number of Majors' , MAX(Unemployment_rate) AS 'Highest Unemployment Rate'
FROM recent_grads
-- Counting Unique Values ##
SELECT COUNT(DISTINCT Major) AS 'unique_majors' ,
COUNT(DISTINCT Major_category) AS 'unique_major_categories',
COUNT(DISTINCT Major_code) AS 'unique_major_codes'
FROM recent_grads
-- String Functions and Operations ##
SELECT 'Major: ' || LOWER(Major) AS 'Major',Total,Men,Women,Unemployment_rate,LENGTH(Major) AS 'Length_of_name'
FROM recent_grads
ORDER BY Unemployment_rate DESC;
-- Performing Arithmetic in SQL ##
SELECT Major , Major_category , P75th - P25th AS 'quartile_spread'
FROM recent_grads
ORDER BY quartile_spread
LIMIT 20;
----------------------------------------------------------------
-- If/Then in SQL ##
SELECT CASE
WHEN Sample_size < 200 THEN 'Small'
WHEN Sample_size >=200 AND Sample_size < 1000 THEN 'Medium'
WHEN Sample_size >=1000 THEN 'Large'
END AS Sample_category
FROM recent_grads
-- Dissecting CASE ##
SELECT Major , Sample_size ,
CASE
WHEN Sample_size < 200 THEN 'Small'
WHEN Sample_size >= 200 AND Sample_size < 1000 THEN 'Medium'
ELSE 'Large'
END AS Sample_category
FROM recent_grads
-- Calculating Group-Level Summary Statistics ##
SELECT Major_category , SUM(Total) AS Total_graduates
FROM recent_grads
GROUP BY Major_category
-- GROUP BY Visual Breakdown ##
SELECT Major_category , AVG(ShareWomen) AS Average_women
FROM recent_grads
GROUP BY Major_category
-- Multiple Summary Statistics by Group ##
SELECT Major_category , SUM(Women) AS Total_women , AVG(ShareWomen) AS Mean_women , SUM(Total) * AVG(ShareWomen) AS Estimate_women
FROM recent_grads
GROUP BY Major_category
-- Multiple Group Columns ##
SELECT Major_category , Sample_category , AVG(ShareWomen) AS Mean_women , SUM(Total) AS Total_graduates
FROM new_grads
GROUP BY Major_category , Sample_category
-- Querying Virtual Columns With the HAVING Statement ##
SELECT Major_category , AVG(Low_wage_jobs)/AVG(Total) AS Share_low_wage
FROM new_grads
GROUP BY Major_category
HAVING Share_low_wage > .1
-- Rounding Results With the ROUND() Function ##
SELECT ROUND(ShareWomen,4) AS Rounded_women , Major_category
FROM new_grads
LIMIT 10
-- Nesting functions ##
SELECT Major_category, ROUND(AVG(College_jobs) / AVG(Total),3) AS Share_degree_jobs
FROM new_grads
GROUP BY Major_category
HAVING Share_degree_jobs < .3
-- Casting ##
SELECT Major_category,CAST(SUM(Women) AS FLOAT)/CAST(SUM(Total) AS FLOAT) AS SW
FROM new_grads
GROUP BY Major_category
ORDER BY SW
----------------------------------------------------------------
-- Writing More Complex Queries ##
SELECT Major , ShareWomen
FROM recent_grads
WHERE ShareWomen > 0.5225502029537575
-- Subqueries ##
SELECT Major , Unemployment_rate
FROM recent_grads
WHERE Unemployment_rate < (
SELECT AVG(Unemployment_rate)
FROM recent_grads)
-- Subquery in SELECT ##
SELECT CAST(COUNT(*) AS FLOAT) /
CAST((SELECT COUNT(*)
FROM recent_grads
) AS FLOAT) AS proportion_abv_avg
FROM recent_grads
WHERE ShareWomen > (SELECT AVG(ShareWomen)
FROM recent_grads
);
-- The IN Operator ##
SELECT Major_category , Major
FROM recent_grads
WHERE Major_category IN ('Business','Humanities & Liberal Arts','Education')
-- Returning Multiple Results in Subqueries ##
SELECT Major_category, Major
FROM recent_grads
WHERE Major_category IN('Business', 'Humanities & Liberal Arts','Education');
-- Building Complex Subqueries ##
SELECT AVG(CAST(Sample_size AS FLOAT) / CAST(Total AS FLOAT)) AS avg_ratio
FROM recent_grads
-- Practice Integrating A Subquery With The Outer Query ##
SELECT Major , Major_category , (SELECT CAST(Sample_size AS FLOAT) / CAST(Total AS FLOAT)) AS ratio
FROM recent_grads
WHERE ratio > (SELECT AVG(CAST(Sample_size AS FLOAT) / CAST(Total AS FLOAT)) AS avg_ratio
FROM recent_grads)
| true |
dcdeb7bf235b94c7c7c1c542e6f6970630eb5e36 | SQL | towenxie/tncrawler | /db/baidudb.sql | UTF-8 | 1,161 | 3.09375 | 3 | [] | no_license | CREATE DATABASE IF NOT EXISTS `baidudb`;
USE `baidudb`;
--
-- Table structure for table `resitem`
--
DROP TABLE IF EXISTS `resitem`;
CREATE TABLE `resitem` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(200) DEFAULT NULL,
`last_update` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=9666 DEFAULT CHARSET=utf8;
--
-- Table structure for table `baiduitem`
--
DROP TABLE IF EXISTS `baiduitem`;
CREATE TABLE `baiduitem` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(200) DEFAULT NULL,
`url` longtext,
`text` longtext,
`last_update` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
) ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8 ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Table structure for table `proxy`
--
DROP TABLE IF EXISTS `proxy`;
CREATE TABLE `proxy` (
`id` varchar(45) NOT NULL,
`ip` varchar(45) DEFAULT NULL,
`port` varchar(45) DEFAULT NULL,
`last_update` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
| true |
da5000f8d00af8ed6c7c863e874731cd7da9a3e4 | SQL | madararoz/EasyShopper | /src/main/resources/database.sql | UTF-8 | 483 | 3.34375 | 3 | [] | no_license | create database if not exists EasyShopper;
use EasyShopper;
create table if not exists products(
id int not null auto_increment,
name varchar(80) not null,
price decimal(10,2) not null,
quantity int,
cost decimal(10,2) not null,
primary key(id)
);
SELECT * FROM products;
create table if not exists users (
id int not null auto_increment,
name varchar(40) not null,
email varchar(50) not null,
password varchar(30) not null,
balance int,
primary key(id)
);
SELECT * FROM users;
| true |
c4797051cce5442199b409fd11580ae4235518c4 | SQL | LucaMD/SRL | /SEPSIS/MIMIC_sql/gcs_all.sql | UTF-8 | 951 | 3.90625 | 4 | [] | no_license | set search_path to mimiciii;
DROP MATERIALIZED VIEW IF EXISTS gcs CASCADE;
create materialized view gcs as
WITH agetbl AS
(
SELECT ad.subject_id
FROM admissions ad
INNER JOIN patients p
ON ad.subject_id = p.subject_id
WHERE
-- filter to only adults
EXTRACT(EPOCH FROM (ad.admittime - p.dob))/60.0/60.0/24.0/365.242 > 15
-- group by subject_id to ensure there is only 1 subject_id per row
group by ad.subject_id
)
, gcs as
(
SELECT ce.subject_id, ce.hadm_id, ce.icustay_id, ce.itemid, ce.charttime, ce.value, ce.valuenum
FROM chartevents ce
INNER JOIN agetbl
ON ce.subject_id = agetbl.subject_id
WHERE itemid IN
(
454 -- "Motor Response"
, 223900 -- "GCS - Motor Response"
)
)
SELECT * from gcs
group by gcs.subject_id, itemid, gcs.hadm_id, gcs.icustay_id, gcs.charttime, gcs.value, gcs.valuenum
order by gcs.subject_id, itemid, gcs.hadm_id, gcs.icustay_id, gcs.charttime; | true |
53f7b3f9849d58f9c457a121bc11b6332aef8023 | SQL | ekeh77/Pracktice-Class | /Database/0422연습용~1.sql | UHC | 7,586 | 2.875 | 3 | [] | no_license | CREATE TABLE G_CLASS
(
CLASS_ID CHAR(5) NOT NULL,
CLASS_NAME VARCHAR(30) NOT NULL,
YEAR_PRICE NUMBER(10) NOT NULL
);
INSERT INTO (CLASS_ID, CLASS_NAME, YEAR_PRICE) VALUES ('CL001','',10000000);
INSERT INTO (CLASS_ID, CLASS_NAME, YEAR_PRICE) VALUES ('CL002','',7000000);
INSERT INTO (CLASS_ID, CLASS_NAME, YEAR_PRICE) VALUES ('CL003','',6000000);
INSERT INTO (CLASS_ID, CLASS_NAME, YEAR_PRICE) VALUES ('CL004','',5000000);
INSERT INTO (CLASS_ID, CLASS_NAME, YEAR_PRICE) VALUES ('CL005','븮',4000000);
INSERT INTO (CLASS_ID, CLASS_NAME, YEAR_PRICE) VALUES ('CL006','',3000000);
INSERT INTO (CLASS_ID, CLASS_NAME, YEAR_PRICE) VALUES ('CL007','',2000000);
CREATE TABLE G_PART
(
PART_ID CHAR(5) NOT NULL,
PART_NAME VARCHAR(30) NOT NULL,
PART_LVL NUMBER(3) NOT NULL,
PART_SEQ NUMBER(3) NOT NULL,
PARENT_PART_ID CHAR(5) NULL
);
INSERT INTO (PART_ID, PART_NAME, PART_LVE, PART_SEQ, PARENT_PART_ID) VALUES('PT001','ROOT', 0, 1, NULL);
INSERT INTO (PART_ID, PART_NAME, PART_LVE, PART_SEQ, PARENT_PART_ID) VALUES('PT002','üλ', 1, 2, 'PT001');
INSERT INTO (PART_ID, PART_NAME, PART_LVE, PART_SEQ, PARENT_PART_ID) VALUES('PT003','üȹ', 1, 1, 'PT001');
INSERT INTO (PART_ID, PART_NAME, PART_LVE, PART_SEQ, PARENT_PART_ID) VALUES('PT004','üǸź', 1, 3, 'PT001');
INSERT INTO (PART_ID, PART_NAME, PART_LVE, PART_SEQ, PARENT_PART_ID) VALUES('PT005','Ǹź', 2, 6, 'PT004');
INSERT INTO (PART_ID, PART_NAME, PART_LVE, PART_SEQ, PARENT_PART_ID) VALUES('PT006','ij־Ǹź', 2, 7, 'PT004');
INSERT INTO (PART_ID, PART_NAME, PART_LVE, PART_SEQ, PARENT_PART_ID) VALUES('PT007','÷Ǹź', 2, 1, 'PT004');
INSERT INTO (PART_ID, PART_NAME, PART_LVE, PART_SEQ, PARENT_PART_ID) VALUES('PT008','Ǹź', 2, 2, 'PT004');
INSERT INTO (PART_ID, PART_NAME, PART_LVE, PART_SEQ, PARENT_PART_ID) VALUES('PT009','Ǹź', 2, 8, 'PT004');
INSERT INTO (PART_ID, PART_NAME, PART_LVE, PART_SEQ, PARENT_PART_ID) VALUES('PT010','庥óǸź', 2, 5, 'PT004');
INSERT INTO (PART_ID, PART_NAME, PART_LVE, PART_SEQ, PARENT_PART_ID) VALUES('PT011','ù̼Ǹź', 2, 3, 'PT004');
INSERT INTO (PART_ID, PART_NAME, PART_LVE, PART_SEQ, PARENT_PART_ID) VALUES('PT012','̵Ǹź', 2, 4, 'PT004');
INSERT INTO (PART_ID, PART_NAME, PART_LVE, PART_SEQ, PARENT_PART_ID) VALUES('PT013','FPSǸź', 2, 10, 'PT004');
INSERT INTO (PART_ID, PART_NAME, PART_LVE, PART_SEQ, PARENT_PART_ID) VALUES('PT014','ȣǸź', 2, 9, 'PT004');
INSERT INTO (PART_ID, PART_NAME, PART_LVE, PART_SEQ, PARENT_PART_ID) VALUES('PT015','Ǹű', 3, 1, 'PT005');
INSERT INTO (PART_ID, PART_NAME, PART_LVE, PART_SEQ, PARENT_PART_ID) VALUES('PT016','ǹ', 3, 2, 'PT005');
INSERT INTO (PART_ID, PART_NAME, PART_LVE, PART_SEQ, PARENT_PART_ID) VALUES('PT017','', 3, 3, 'PT005');
INSERT INTO (PART_ID, PART_NAME, PART_LVE, PART_SEQ, PARENT_PART_ID) VALUES('PT018','', 3, 4, 'PT005');
INSERT INTO (PART_ID, PART_NAME, PART_LVE, PART_SEQ, PARENT_PART_ID) VALUES('PT019','FPSǸű', 3, 1, 'PT013');
INSERT INTO (PART_ID, PART_NAME, PART_LVE, PART_SEQ, PARENT_PART_ID) VALUES('PT020','FPS', 3, 2, 'PT013');
INSERT INTO (PART_ID, PART_NAME, PART_LVE, PART_SEQ, PARENT_PART_ID) VALUES('PT021','FPS', 3, 3, 'PT013');
INSERT INTO (PART_ID, PART_NAME, PART_LVE, PART_SEQ, PARENT_PART_ID) VALUES('PT017','-1', 4, 1, 'PT018');
INSERT INTO (PART_ID, PART_NAME, PART_LVE, PART_SEQ, PARENT_PART_ID) VALUES('PT017','-2', 4, 2, 'PT018');
CREATE TABLE G_EMPLOYEE
(
E_ID CHAR(5) NOT NULL,
E_NAME VARCHAR(30) NOT NULL,
CLASS_ID CHAR(5) NOT NULL,
PART_ID CHAR(5) NOT NULL
)
INSERT INTO G_EMPLOYEE (E_ID, E_NAME, CLASS_ID, PART_ID) VALUES('E0001','Ÿ','CL001', 'PT001');
INSERT INTO G_EMPLOYEE (E_ID, E_NAME, CLASS_ID, PART_ID) VALUES('E0002','Ŀǵ弾','CL002', 'PT002');
INSERT INTO G_EMPLOYEE (E_ID, E_NAME, CLASS_ID, PART_ID) VALUES('E0003','ؼ','CL002', 'PT003');
INSERT INTO G_EMPLOYEE (E_ID, E_NAME, CLASS_ID, PART_ID) VALUES('E0004','ó','CL002', 'PT004');
INSERT INTO G_EMPLOYEE (E_ID, E_NAME, CLASS_ID, PART_ID) VALUES('E0005','','CL002', 'PT004');
INSERT INTO G_EMPLOYEE (E_ID, E_NAME, CLASS_ID, PART_ID) VALUES('E0006','۸','CL002', 'PT004');
INSERT INTO G_EMPLOYEE (E_ID, E_NAME, CLASS_ID, PART_ID) VALUES('E0007','','CL002', 'PT004');
INSERT INTO G_EMPLOYEE (E_ID, E_NAME, CLASS_ID, PART_ID) VALUES('E0008','Ŀ','CL002', 'PT004');
INSERT INTO G_EMPLOYEE (E_ID, E_NAME, CLASS_ID, PART_ID) VALUES('E0009','','CL002', 'PT004');
INSERT INTO G_EMPLOYEE (E_ID, E_NAME, CLASS_ID, PART_ID) VALUES('E0010','Żũ','CL002', 'PT004');
INSERT INTO G_EMPLOYEE (E_ID, E_NAME, CLASS_ID, PART_ID) VALUES('E0011','ٿ췯','CL002', 'PT004');
INSERT INTO G_EMPLOYEE (E_ID, E_NAME, CLASS_ID, PART_ID) VALUES('E0012','','CL002', 'PT004');
INSERT INTO G_EMPLOYEE (E_ID, E_NAME, CLASS_ID, PART_ID) VALUES('E0013','Ʈũ','CL002', 'PT004');
INSERT INTO G_EMPLOYEE (E_ID, E_NAME, CLASS_ID, PART_ID) VALUES('E0014','','CL002', 'PT004');
INSERT INTO G_EMPLOYEE (E_ID, E_NAME, CLASS_ID, PART_ID) VALUES('E0015','ū','CL002', 'PT004');
INSERT INTO G_EMPLOYEE (E_ID, E_NAME, CLASS_ID, PART_ID) VALUES('E0016','Ǯ','CL002', 'PT004');
INSERT INTO G_EMPLOYEE (E_ID, E_NAME, CLASS_ID, PART_ID) VALUES('E0017','Ż','CL002', 'PT004');
INSERT INTO G_EMPLOYEE (E_ID, E_NAME, CLASS_ID, PART_ID) VALUES('E0018','','CL002', 'PT004');
INSERT INTO G_EMPLOYEE (E_ID, E_NAME, CLASS_ID, PART_ID) VALUES('E0019','','CL002', 'PT004');
INSERT INTO G_EMPLOYEE (E_ID, E_NAME, CLASS_ID, PART_ID) VALUES('E0020','̺','CL002', 'PT004');
INSERT INTO G_EMPLOYEE (E_ID, E_NAME, CLASS_ID, PART_ID) VALUES('E0021','ij','CL002', 'PT004');
INSERT INTO G_EMPLOYEE (E_ID, E_NAME, CLASS_ID, PART_ID) VALUES('E0022','','CL002', 'PT004');
INSERT INTO G_EMPLOYEE (E_ID, E_NAME, CLASS_ID, PART_ID) VALUES('E0023','','CL002', 'PT004');
INSERT INTO G_EMPLOYEE (E_ID, E_NAME, CLASS_ID, PART_ID) VALUES('E0024','ij','CL002', 'PT004');
INSERT INTO G_EMPLOYEE (E_ID, E_NAME, CLASS_ID, PART_ID) VALUES('E0025','ī','CL002', 'PT004');
INSERT INTO G_EMPLOYEE (E_ID, E_NAME, CLASS_ID, PART_ID) VALUES('E0026','','CL002', 'PT004');
INSERT INTO G_EMPLOYEE (E_ID, E_NAME, CLASS_ID, PART_ID) VALUES('E0027','̾','CL002', 'PT004');
INSERT INTO G_EMPLOYEE (E_ID, E_NAME, CLASS_ID, PART_ID) VALUES('E0028','ó','CL002', 'PT004');
INSERT INTO G_EMPLOYEE (E_ID, E_NAME, CLASS_ID, PART_ID) VALUES('E0029','','CL002', 'PT004');
INSERT INTO G_EMPLOYEE (E_ID, E_NAME, CLASS_ID, PART_ID) VALUES('E0030','ũ','CL002', 'PT004');
INSERT INTO G_EMPLOYEE (E_ID, E_NAME, CLASS_ID, PART_ID) VALUES('E0031','Ʈ','CL002', 'PT004');
INSERT INTO G_EMPLOYEE (E_ID, E_NAME, CLASS_ID, PART_ID) VALUES('E0032','ó','CL002', 'PT004');
INSERT INTO G_EMPLOYEE (E_ID, E_NAME, CLASS_ID, PART_ID) VALUES('E0033','ó','CL002', 'PT004');
INSERT INTO G_EMPLOYEE (E_ID, E_NAME, CLASS_ID, PART_ID) VALUES('E0034','ó','CL002', 'PT004');
INSERT INTO G_EMPLOYEE (E_ID, E_NAME, CLASS_ID, PART_ID) VALUES('E0035','ó','CL002', 'PT004');
| true |
92df4a80a629f615e25bf317fb3f41e9c5199c6c | SQL | ralfsilvadba/Database | /Oracle/Administration/vdg.sql | UTF-8 | 495 | 2.953125 | 3 | [] | no_license | clear columns
column TOTAL_MB format 999,999,999,999.99
column FREE_MB format 999,999,999,999.99
column "USADO" format 999,999,999,999.99
column "% FREE" format 999.99
compute sum of TOTAL_MB on report
compute sum of FREE_MB on report
compute sum of "USADO" on report
break on report
set lines 200 pages 100
select NAME,
TOTAL_MB,
FREE_MB,
TOTAL_MB-FREE_MB USADO,
round((FREE_MB/TOTAL_MB)*100) "% FREE"
from v$ASM_DISKGROUP
order by 5;
ttitle off
clear columns
| true |
7df54778a5daa84bd3f5f6a75ed52503a36603d6 | SQL | surya-9556/Day15_Task | /SQLQuery8.sql | UTF-8 | 246 | 3.1875 | 3 | [] | no_license | use pubs
create table tblMovie
(id int identity(1,1) primary key,
name varchar(20),
duration float)
select * from tblMovie
update tblMovie set name = 'x-men first class' where id = '9'
insert into tblMovie(name,duration) values('x-men',123.2) | true |
1a0bdd839b16cffa96d4c48d29786448c8381e90 | SQL | alanjj22/ADAPT | /Sprint 1 Book Rental B9/Learning Outcome 3/Books Availed by Most of the users.sql | UTF-8 | 355 | 3.59375 | 4 | [] | no_license | /* Fetch the book which was availed for rent by most users */
select * from book
where book_id = (select book_id from book_rental
group by book_id having count(*)=
(select * from (select count(*)
from book_rental group by book_id
order by count(*)desc)where rownum<=1)); | true |
7afbccf6b7b36987efb97ddc7a0b8cca5c863907 | SQL | Lemas97/Score4-Api | /DB/score4_schema.sql | UTF-8 | 4,362 | 3.078125 | 3 | [] | no_license | -- phpMyAdmin SQL Dump
-- version 5.0.3
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Jan 04, 2021 at 12:21 PM
-- Server version: 10.4.14-MariaDB
-- PHP Version: 7.2.34
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: `score4`
--
CREATE DATABASE IF NOT EXISTS `score4` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
USE `score4`;
-- --------------------------------------------------------
--
-- Table structure for table `board`
--
CREATE TABLE `board` (
`x` int(11) NOT NULL,
`y` int(11) NOT NULL,
`piece_color` enum('R','Y') DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `board`
--
INSERT INTO `board` (`x`, `y`, `piece_color`) VALUES
(1, 1, ''),
(1, 2, ''),
(1, 3, ''),
(1, 4, ''),
(1, 5, ''),
(1, 6, ''),
(2, 1, ''),
(2, 2, ''),
(2, 3, ''),
(2, 4, ''),
(2, 5, ''),
(2, 6, ''),
(3, 1, ''),
(3, 2, ''),
(3, 3, ''),
(3, 4, ''),
(3, 5, ''),
(3, 6, ''),
(4, 1, ''),
(4, 2, ''),
(4, 3, ''),
(4, 4, ''),
(4, 5, ''),
(4, 6, ''),
(5, 1, ''),
(5, 2, ''),
(5, 3, ''),
(5, 4, ''),
(5, 5, ''),
(5, 6, ''),
(6, 1, ''),
(6, 2, ''),
(6, 3, ''),
(6, 4, ''),
(6, 5, ''),
(6, 6, ''),
(7, 1, ''),
(7, 2, ''),
(7, 3, ''),
(7, 4, ''),
(7, 5, ''),
(7, 6, '');
-- --------------------------------------------------------
--
-- Table structure for table `board_empty`
--
CREATE TABLE `board_empty` (
`x` int(11) NOT NULL,
`y` int(11) NOT NULL,
`piece_color` varchar(30) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `board_empty`
--
INSERT INTO `board_empty` (`x`, `y`, `piece_color`) VALUES
(1, 1, ''),
(1, 2, ''),
(1, 3, ''),
(1, 4, ''),
(1, 5, ''),
(1, 6, ''),
(2, 1, ''),
(2, 2, ''),
(2, 3, ''),
(2, 4, ''),
(2, 5, ''),
(2, 6, ''),
(3, 1, ''),
(3, 2, ''),
(3, 3, ''),
(3, 4, ''),
(3, 5, ''),
(3, 6, ''),
(4, 1, ''),
(4, 2, ''),
(4, 3, ''),
(4, 4, ''),
(4, 5, ''),
(4, 6, ''),
(5, 1, ''),
(5, 2, ''),
(5, 3, ''),
(5, 4, ''),
(5, 5, ''),
(5, 6, ''),
(6, 1, ''),
(6, 2, ''),
(6, 3, ''),
(6, 4, ''),
(6, 5, ''),
(6, 6, ''),
(7, 1, ''),
(7, 2, ''),
(7, 3, ''),
(7, 4, ''),
(7, 5, ''),
(7, 6, '');
-- --------------------------------------------------------
--
-- Table structure for table `game_status`
--
CREATE TABLE `game_status` (
`turn` enum('R','Y') NOT NULL DEFAULT 'R',
`win` enum('R','Y') DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `game_status`
--
INSERT INTO `game_status` (`turn`, `win`) VALUES
('R', NULL);
-- --------------------------------------------------------
--
-- Table structure for table `player`
--
CREATE TABLE `player` (
`playerID` varchar(30) NOT NULL,
`username` varchar(30) NOT NULL,
`password` varchar(50) NOT NULL,
`status` int(11) DEFAULT 0,
`color` varchar(45) DEFAULT 'null'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `player`
--
INSERT INTO `player` (`playerID`, `username`, `password`, `status`, `color`) VALUES
('5fd39a9e4576d', 'lemas97', '123', 1, 'Y'),
('6ga09se7il36d', 'george', '123', 1, 'R');
-- --------------------------------------------------------
--
-- Table structure for table `topofx`
--
CREATE TABLE `topofx` (
`x` int(11) NOT NULL,
`top` int(11) DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `topofx`
--
INSERT INTO `topofx` (`x`, `top`) VALUES
(1, 0),
(2, 0),
(3, 0),
(4, 0),
(5, 0),
(6, 0),
(7, 0);
--
-- Indexes for dumped tables
--
--
-- Indexes for table `board`
--
ALTER TABLE `board`
ADD PRIMARY KEY (`x`,`y`);
--
-- Indexes for table `board_empty`
--
ALTER TABLE `board_empty`
ADD PRIMARY KEY (`x`,`y`);
--
-- Indexes for table `player`
--
ALTER TABLE `player`
ADD PRIMARY KEY (`playerID`),
ADD UNIQUE KEY `username` (`username`),
ADD UNIQUE KEY `playerID` (`playerID`);
--
-- Indexes for table `topofx`
--
ALTER TABLE `topofx`
ADD PRIMARY KEY (`x`);
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
| true |
881f0ccfc54ba760e20c739c45fe6898decade86 | SQL | 13816016736/yaoyy | /res/yaoyy/doc/sql/v0.3.sql | UTF-8 | 11,317 | 3.4375 | 3 | [] | no_license | DROP TABLE IF EXISTS `area`;
CREATE TABLE `area` (
`id` int(10) NOT NULL COMMENT 'ID',
`areaname` varchar(50) NOT NULL COMMENT '栏目名',
`parentid` int(10) NOT NULL COMMENT '父栏目',
`shortname` varchar(50) DEFAULT NULL,
`areacode` int(6) DEFAULT NULL,
`zipcode` int(10) DEFAULT NULL,
`pinyin` varchar(100) DEFAULT NULL,
`lng` varchar(20) DEFAULT NULL,
`lat` varchar(20) DEFAULT NULL,
`level` tinyint(1) NOT NULL,
`position` varchar(255) NOT NULL,
`sort` tinyint(3) unsigned DEFAULT '50' COMMENT '排序',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='区域code表';
CREATE TABLE `order_invoice` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(32) DEFAULT NULL COMMENT '单位名称',
`type` int(11) DEFAULT NULL COMMENT '1.个人发票 2.增值税发票',
`content` varchar(256) DEFAULT NULL COMMENT '发票内容',
`identifier` varchar(64) DEFAULT NULL COMMENT '纳税人识别码',
`registered_address` varchar(64) DEFAULT NULL COMMENT '注册地址',
`registered_tel` varchar(15) DEFAULT NULL COMMENT '注册电话',
`bank_name` varchar(32) DEFAULT NULL COMMENT '开户银行',
`bank_account` varchar(32) DEFAULT NULL COMMENT '银行账户',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=38 DEFAULT CHARSET=utf8 COMMENT='发票';
CREATE TABLE `shipping_address` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`user_id` int(11) DEFAULT NULL,
`is_default` bit(1) DEFAULT NULL COMMENT '是否默认地址\n 1 默认',
`consignee` varchar(32) DEFAULT NULL COMMENT '收货人',
`postcode` varchar(20) DEFAULT NULL COMMENT '邮编',
`tel` varchar(12) DEFAULT NULL COMMENT '手机号码',
`area_id` int(11) DEFAULT NULL COMMENT '所在区域',
`detail` varchar(64) DEFAULT NULL COMMENT '详细地址',
`create_time` datetime DEFAULT NULL,
`aliases` varchar(12) DEFAULT NULL COMMENT '别名',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=85 DEFAULT CHARSET=utf8 COMMENT='收货地址';
CREATE TABLE `shipping_address_history` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`user_id` int(11) DEFAULT NULL,
`consignee` varchar(32) DEFAULT NULL COMMENT '收货人',
`postcode` varchar(20) DEFAULT NULL,
`tel` varchar(12) DEFAULT NULL COMMENT '手机号码',
`area_id` int(11) DEFAULT NULL,
`area` varchar(32) DEFAULT NULL COMMENT '所在区域',
`detail` varchar(64) DEFAULT NULL COMMENT '详细地址',
`create_time` datetime DEFAULT NULL,
`aliases` varchar(12) DEFAULT NULL COMMENT '别名',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=185 DEFAULT CHARSET=utf8 COMMENT='历史收货地址';
ALTER TABLE `pick`
ADD COLUMN `shipping_costs` decimal(11,2) NULL DEFAULT NULL COMMENT '运费' AFTER `status`,
ADD COLUMN `bagging` decimal(11,2) NULL DEFAULT NULL COMMENT '包装费' AFTER `shipping_costs`,
ADD COLUMN `checking` decimal(11,2) NULL DEFAULT NULL COMMENT '检测费' AFTER `bagging`,
ADD COLUMN `taxation` decimal(11,2) NULL DEFAULT NULL COMMENT '税费' AFTER `checking`,
ADD COLUMN `settle_type` int(5) NULL DEFAULT NULL COMMENT '结算方式:0:全款,1:保证金,2:账期' AFTER `taxation`,
ADD COLUMN `deposit` decimal(11,2) NULL DEFAULT NULL COMMENT '保证金' AFTER `settle_type`,
ADD COLUMN `bill_time` int(6) NULL DEFAULT NULL COMMENT '账期时间单位天' AFTER `deposit`,
ADD COLUMN `addr_history_id` int(11) NULL DEFAULT NULL COMMENT '对应下单地址记录里面的id' AFTER `bill_time`,
ADD COLUMN `remark` varchar(512) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注' AFTER `addr_history_id`,
ADD COLUMN `amounts_payable` decimal(10,2) NULL DEFAULT NULL COMMENT '实际应付' AFTER `remark`,
ADD COLUMN `member_id` int(11) NULL DEFAULT NULL COMMENT '操作人id' AFTER `amounts_payable`,
ADD COLUMN `sum` decimal(10,2) NULL DEFAULT NULL COMMENT '商品合计' AFTER `member_id`,
ADD COLUMN `expire_date` datetime NULL DEFAULT NULL COMMENT '订单过期时间' AFTER `sum`,
ADD COLUMN `delivery_date` datetime NULL DEFAULT NULL COMMENT '发货时间' AFTER `sum`;
CREATE TABLE `account_bill` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`code` varchar(255) DEFAULT NULL COMMENT '账单编号',
`order_id` int(11) DEFAULT NULL COMMENT '订单号',
`user_id` int(11) DEFAULT NULL COMMENT '用户ID',
`bill_time` int(11) DEFAULT NULL COMMENT '账单时间',
`amounts_payable` decimal(10,2) DEFAULT NULL COMMENT '应付',
`already_payable` decimal(10,2) DEFAULT NULL COMMENT '已付',
`status` tinyint(2) DEFAULT NULL COMMENT '状态(0:未结清,1:已结清)',
`repay_time` datetime DEFAULT NULL COMMENT '还款时间',
`member_id` int(11) DEFAULT NULL COMMENT '操作人',
`create_date` datetime DEFAULT NULL COMMENT '创建时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='账单表';
CREATE TABLE `logistical` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`order_id` int(11) DEFAULT NULL,
`ship_date` datetime DEFAULT NULL COMMENT '发货日期',
`picture_url` varchar(255) DEFAULT NULL COMMENT '发货单据图片',
`content` varchar(512) DEFAULT NULL,
`create_date` datetime DEFAULT NULL COMMENT '创建时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='物流';
CREATE TABLE `pay_account` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`receive_bank` varchar(255) DEFAULT NULL COMMENT '收款银行',
`receive_account` varchar(255) DEFAULT NULL COMMENT '收款账户',
`receive_bank_card` varchar(255) DEFAULT NULL COMMENT '收款银行卡号',
`create_date` datetime DEFAULT NULL COMMENT '创建时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='支付账户表';
CREATE TABLE `pay_document` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`pay_record_id` int(11) NOT NULL,
`path` varchar(255) NOT NULL,
`create_date` datetime NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='支付凭证表';
CREATE TABLE `pay_record` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`pay_code` varchar(255) DEFAULT NULL COMMENT '支付流水号',
`code` varchar(255) NOT NULL COMMENT '订单编号或者账单编号',
`order_id` int(11) DEFAULT NULL COMMENT '关联订单',
`code_type` int(5) DEFAULT NULL COMMENT '单号类型:0:订单,1:账单',
`account_bill_id` int(11) DEFAULT NULL COMMENT '关联账单',
`payment_id` int(11) DEFAULT NULL COMMENT '三方支付id',
`actual_payment` decimal(11,2) DEFAULT NULL COMMENT '实付金额',
`pay_bank` varchar(255) DEFAULT NULL COMMENT '开户行',
`pay_account` varchar(255) DEFAULT NULL COMMENT '开户人',
`pay_bank_card` varchar(255) DEFAULT NULL COMMENT '银行卡号',
`user_id` int(11) NOT NULL COMMENT '用户id',
`payment_time` datetime NOT NULL COMMENT '支付时间',
`status` tinyint(2) NOT NULL DEFAULT '0' COMMENT '0付款待确认,1支付成功,2支付失败',
`pay_type` int(5) DEFAULT NULL COMMENT '支付渠道 :0,线下转账,1支付宝支付,2.微信支付',
`member_id` int(11) DEFAULT NULL COMMENT '操作者id',
`operate_time` datetime DEFAULT NULL COMMENT '操作时间',
`create_time` datetime NOT NULL COMMENT '创建时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='支付记录表';
CREATE TABLE `payment` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`user_id` int(11) DEFAULT NULL COMMENT '用户id',
`pay_type` int(5) DEFAULT NULL COMMENT '支付方式',
`status` int(5) DEFAULT NULL COMMENT '支付状态',
`money` decimal(10,2) DEFAULT NULL COMMENT '支付金额',
`trade_no` varchar(64) DEFAULT NULL COMMENT '支付宝/微信交易号',
`out_trade_no` varchar(255) DEFAULT NULL COMMENT '提供给第三方支付的订单号,必须唯一',
`remark` varchar(255) DEFAULT NULL,
`in_param` text COMMENT '返回参数',
`out_param` text COMMENT '传出参数',
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
`callback_time` datetime DEFAULT NULL COMMENT '回调时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='线上支付表';
ALTER TABLE `yaoyy`.`order_invoice`
ADD COLUMN `order_id` INT NULL COMMENT '订单ID' AFTER `bank_account`;
INSERT INTO `yaoyy`.`resources` (`id`, `name`, `type`, `path`, `pid`, `permission`, `create_date`) VALUES ('34', '账单流水管理', 'button', '', '0', 'pay:index', '2016-12-27 10:13:21');
INSERT INTO `yaoyy`.`resources` (`id`, `name`, `type`, `path`, `pid`, `permission`, `create_date`) VALUES ('35', '交易流水列表', 'button', '', '34', 'payRecord:list', '2016-12-27 10:14:03');
INSERT INTO `yaoyy`.`resources` (`id`, `name`, `type`, `path`, `pid`, `permission`, `create_date`) VALUES ('36', '交易流水详情', 'button', '', '34', 'payRecord:detail', '2016-12-27 10:14:39');
ALTER TABLE `yaoyy`.`pick`
CHANGE COLUMN `shipping_costs` `shipping_costs` DECIMAL(11,2) NULL DEFAULT 0 COMMENT '运费' ,
CHANGE COLUMN `bagging` `bagging` DECIMAL(11,2) NULL DEFAULT 0 COMMENT '包装费' ,
CHANGE COLUMN `checking` `checking` DECIMAL(11,2) NULL DEFAULT 0 COMMENT '检测费' ,
CHANGE COLUMN `taxation` `taxation` DECIMAL(11,2) NULL DEFAULT 0 COMMENT '税费' ,
CHANGE COLUMN `deposit` `deposit` DECIMAL(11,2) NULL DEFAULT 0 COMMENT '保证金' ,
CHANGE COLUMN `amounts_payable` `amounts_payable` DECIMAL(10,2) NULL DEFAULT 0 COMMENT '实际应付' ,
CHANGE COLUMN `sum` `sum` DECIMAL(10,2) NULL DEFAULT 0 COMMENT '商品合计' ;
#新增加的
INSERT INTO `yaoyy`.`resources` (`id`, `name`, `type`, `path`, `pid`, `permission`, `create_date`) VALUES ('37', '账单列表', 'button', '', '34', 'bill:list', '2017-01-03 09:52:46');
INSERT INTO `yaoyy`.`resources` (`id`, `name`, `type`, `path`, `pid`, `permission`, `create_date`) VALUES ('38', '账单详情', 'button', '', '34', 'bill:detail', '2017-01-03 09:53:20');
ALTER TABLE `payment`
MODIFY COLUMN `status` int(5) NULL DEFAULT 0 COMMENT '支付状态' AFTER `pay_type`;
#20170103
CREATE TABLE `yaoyy`.`setting` (
`id` INT NOT NULL,
`consumer_hotline` VARCHAR(45) NOT NULL COMMENT '客服电话',
`pay_account` VARCHAR(64) NULL COMMENT '账户名称',
`pay_bank_card` VARCHAR(32) NULL COMMENT '账号',
`pay_bank` VARCHAR(64) NULL COMMENT '开户行',
PRIMARY KEY (`id`))
COMMENT = 'Boos 系统配置信息';
ALTER TABLE `yaoyy`.`setting`
CHANGE COLUMN `id` `id` INT(11) NOT NULL AUTO_INCREMENT ,
CHANGE COLUMN `consumer_hotline` `consumer_hotline` VARCHAR(45) NULL COMMENT '客服电话' ;
INSERT INTO `yaoyy`.`resources` (`name`, `type`, `pid`, `permission`, `create_date`) VALUES ('系统设置', 'button', '0', 'setting:all', '2017-01-03 09:53:20');
ALTER TABLE `payment`
ADD COLUMN `type` int(5) NULL DEFAULT 0 COMMENT '0,账单支付1,订单支付' AFTER `status`;
ALTER TABLE `payment`
ADD COLUMN `order_id` int(11) NULL DEFAULT NULL COMMENT '订单id' AFTER `type`,
ADD COLUMN `bill_id` int(11) NULL DEFAULT NULL COMMENT '账单id' AFTER `order_id`;
ALTER TABLE `yaoyy`.`account_bill`
ADD COLUMN `update_date` DATETIME NULL COMMENT '更新时间' AFTER `create_date`;
#账单更新时间数据更新
update account_bill set update_date = create_date where id > 10;
ALTER TABLE `yaoyy`.`pick_commodity`
CHANGE COLUMN `price` `price` DECIMAL(10,2) NULL DEFAULT NULL ,
CHANGE COLUMN `total` `total` DECIMAL(20,2) NULL DEFAULT NULL ;
| true |
674bd1e8e42ebdd2865e878983e012996ae1eb91 | SQL | zoyron/oneauth | /migrations/075-to-076.sql | UTF-8 | 184 | 2.53125 | 3 | [] | no_license | CREATE TABLE IF NOT EXISTS whitelist_domains (
id SERIAL PRIMARY KEY,
domain VARCHAR(256) UNIQUE NOT NULL,
"createdAt" TIMESTAMPTZ NOT NULL,
"updatedAt" TIMESTAMPTZ NOT NULL
)
| true |
6cb6a9561b0db32a42325a453f2489977fb43037 | SQL | slastenovd/test2 | /dz9-mysqli/install.sql | UTF-8 | 6,521 | 3.3125 | 3 | [] | no_license | -- Adminer 4.2.3 MySQL dump
SET NAMES utf8;
SET time_zone = '+00:00';
SET foreign_key_checks = 0;
SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO';
DROP DATABASE IF EXISTS `%database_name%`;
CREATE DATABASE `%database_name%` /*!40100 DEFAULT CHARACTER SET utf8 */;
USE `%database_name%`;
DROP TABLE IF EXISTS `ads`;
CREATE TABLE `ads` (
`ad_id` int(11) NOT NULL AUTO_INCREMENT,
`private` tinyint(4) NOT NULL DEFAULT '0',
`seller_name` varchar(50) NOT NULL,
`manager` varchar(50) NOT NULL,
`email` varchar(50) NOT NULL,
`allow_mails` tinyint(4) NOT NULL DEFAULT '0',
`phone` varchar(15) NOT NULL,
`location_id` int(11) NOT NULL,
`metro_id` int(11) NOT NULL,
`subcategory_id` tinyint(4) NOT NULL,
`title` varchar(255) NOT NULL,
`description` tinytext NOT NULL,
`price` int(11) NOT NULL,
`date_change` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`ad_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
INSERT INTO `ads` (`ad_id`, `private`, `seller_name`, `manager`, `email`, `allow_mails`, `phone`, `location_id`, `metro_id`, `subcategory_id`, `title`, `description`, `price`, `date_change`) VALUES
(1, 0, 'Дмитрий', 'Иван иванов', 'ds_dimka@mail.ru', 1, '+79622976146', 641800, 2025, 9, 'Suzuki Escudo', '11111', 25563, '2016-01-12 11:24:23'),
(3, 1, 'James Bond', 'Дмитрий', 'Alex@alex.ru', 1, '89622976146', 641510, 2017, 9, 'Автомобиль', 'кккее', 555, '2016-01-12 04:07:10'),
(4, 0, 'Николай', '', '', 1, '', 641510, 2017, 24, 'Квартира в центре', '', 7, '2016-01-12 11:23:53'),
(5, 0, 'Владимир', 'Дмитрий', 'vova@kremlin.ru', 1, '+7 988 877 23-3', 641520, 2017, 116, 'Нефть', '', 2400, '2016-01-12 11:22:59');
DROP TABLE IF EXISTS `categories`;
CREATE TABLE `categories` (
`category_id` int(11) NOT NULL AUTO_INCREMENT,
`category_name` varchar(25) NOT NULL,
PRIMARY KEY (`category_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
INSERT INTO `categories` (`category_id`, `category_name`) VALUES
(1, 'Транспорт'),
(2, 'Недвижимость'),
(3, 'Работа'),
(4, 'Услуги'),
(5, 'Личные вещи'),
(6, 'Для дома и дачи'),
(7, 'Бытовая электроника'),
(8, 'Хобби и отдых'),
(9, 'Животные'),
(10, 'Для бизнеса');
DROP TABLE IF EXISTS `cities`;
CREATE TABLE `cities` (
`city_id` int(11) NOT NULL AUTO_INCREMENT,
`city_name` varchar(20) NOT NULL,
PRIMARY KEY (`city_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
INSERT INTO `cities` (`city_id`, `city_name`) VALUES
(641490, ' Барабинск'),
(641510, ' Бердск'),
(641520, ' Черепаново'),
(641600, ' Искитим'),
(641630, ' Колывань'),
(641680, ' Краснообск'),
(641710, ' Куйбышев'),
(641760, ' Мошково'),
(641780, ' Новосибирск'),
(641790, ' Обь'),
(641800, ' Ордынское'),
(641970, ' Бердск');
DROP TABLE IF EXISTS `metro_stations`;
CREATE TABLE `metro_stations` (
`metro_station_id` int(11) NOT NULL AUTO_INCREMENT,
`metro_station_name` varchar(25) NOT NULL,
PRIMARY KEY (`metro_station_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
INSERT INTO `metro_stations` (`metro_station_id`, `metro_station_name`) VALUES
(2017, 'Заельцовская'),
(2018, 'Гагаринская'),
(2019, 'Красный проспект'),
(2020, 'Площадь Ленина'),
(2021, 'Октябрьская'),
(2022, 'Речной вокзал'),
(2023, 'Студенческая'),
(2024, 'Площадь Маркса'),
(2025, 'Площадь Гарина-Михайловск'),
(2026, 'Сибирская'),
(2027, 'Маршала Покрышкина'),
(2028, 'Берёзовая роща'),
(2029, 'Золотая Нива');
DROP TABLE IF EXISTS `subcategories`;
CREATE TABLE `subcategories` (
`subcategory_id` int(11) NOT NULL AUTO_INCREMENT,
`category_id` int(11) NOT NULL,
`subcategory_name` varchar(25) NOT NULL,
PRIMARY KEY (`subcategory_id`),
KEY `category_id` (`category_id`),
CONSTRAINT `subcategories_ibfk_1` FOREIGN KEY (`category_id`) REFERENCES `categories` (`category_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
INSERT INTO `subcategories` (`subcategory_id`, `category_id`, `subcategory_name`) VALUES
(9, 1, 'Автомобили с пробегом'),
(10, 1, 'Запчасти и аксессуары'),
(11, 1, 'Водный транспорт'),
(14, 1, 'Мотоциклы и мототехника'),
(19, 6, 'Ремонт и строительство'),
(20, 6, 'Мебель и интерьер'),
(21, 6, 'Бытовая техника'),
(23, 2, 'Комнаты'),
(24, 2, 'Квартиры'),
(25, 2, 'Дома, дачи, коттеджи'),
(26, 2, 'Земельные участки'),
(27, 5, 'Одежда, обувь, аксессуары'),
(28, 5, 'Часы и украшения'),
(29, 5, 'Детская одежда и обувь'),
(30, 5, 'Товары для детей и игрушк'),
(31, 7, 'Настольные компьютеры'),
(32, 7, 'Аудио и видео'),
(33, 8, 'Билеты и путешествия'),
(34, 8, 'Велосипеды'),
(36, 8, 'Коллекционирование'),
(38, 8, 'Музыкальные инструменты'),
(39, 8, 'Спорт и отдых'),
(40, 10, 'Оборудование для бизнеса'),
(42, 2, 'Коммерческая недвижимость'),
(81, 1, 'Грузовики и спецтехника'),
(82, 6, 'Продукты питания'),
(83, 8, 'Книги и журналы'),
(84, 7, 'Телефоны'),
(85, 2, 'Гаражи и машиноместа'),
(86, 2, 'Недвижимость за рубежом'),
(87, 6, 'Посуда и товары для кухни'),
(88, 5, 'Красота и здоровье'),
(89, 9, 'Собаки'),
(90, 9, 'Кошки'),
(91, 9, 'Птицы'),
(92, 9, 'Аквариум'),
(93, 9, 'Другие животные'),
(94, 9, 'Товары для животных'),
(96, 7, 'Планшеты и электронные кн'),
(97, 7, 'Игры, приставки и програм'),
(98, 7, 'Ноутбуки'),
(99, 7, 'Оргтехника и расходники'),
(101, 7, 'Товары для компьютера'),
(102, 8, 'Охота и рыбалка'),
(103, 8, 'Знакомства'),
(105, 7, 'Фототехника'),
(106, 6, 'Растения'),
(109, 1, 'Новые автомобили'),
(111, 3, 'Вакансии'),
(112, 3, 'Резюме'),
(114, 4, 'Предложения услуг'),
(115, 4, 'Запросы на услуги'),
(116, 10, 'Готовый бизнес');
-- 2016-01-12 11:27:11 | true |
14dd6e39fc1f5baf9103af31ac55df6dabf70dbd | SQL | RubenLopezMompean/golden_race | /db_goldenrace.sql | UTF-8 | 3,441 | 3.25 | 3 | [] | no_license | -- phpMyAdmin SQL Dump
-- version 5.1.0
-- https://www.phpmyadmin.net/
--
-- Servidor: 127.0.0.1
-- Tiempo de generación: 02-05-2021 a las 23:15:32
-- Versión del servidor: 10.4.18-MariaDB
-- Versión de PHP: 8.0.3
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Base de datos: `db_goldenrace`
--
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `ticket`
--
CREATE TABLE `ticket` (
`id` int(11) NOT NULL,
`creation_date` date DEFAULT NULL,
`total_amount` double NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Volcado de datos para la tabla `ticket`
--
INSERT INTO `ticket` (`id`, `creation_date`, `total_amount`) VALUES
(1, '2021-05-02', 8),
(2, '2021-04-01', 5),
(3, '2021-05-01', 3),
(4, '2021-02-01', 2);
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `ticket_details`
--
CREATE TABLE `ticket_details` (
`ticket_id` int(11) NOT NULL,
`details_lineid` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `ticket_line`
--
CREATE TABLE `ticket_line` (
`lineid` int(11) NOT NULL,
`ticketid` int(11) NOT NULL,
`amount` double NOT NULL,
`description` varchar(255) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Volcado de datos para la tabla `ticket_line`
--
INSERT INTO `ticket_line` (`lineid`, `ticketid`, `amount`, `description`) VALUES
(1, 1, 5, 'First time'),
(2, 1, 3, 'prueba'),
(3, 3, 1, 'First time'),
(4, 3, 1, 'Second time'),
(5, 3, 1, 'Third time'),
(6, 4, 2, 'Only one time'),
(7, 2, 5, 'Second ticket');
--
-- Índices para tablas volcadas
--
--
-- Indices de la tabla `ticket`
--
ALTER TABLE `ticket`
ADD PRIMARY KEY (`id`);
--
-- Indices de la tabla `ticket_details`
--
ALTER TABLE `ticket_details`
ADD UNIQUE KEY `UK_ghbeq5ddm4x7wrl11vo8g5dmf` (`details_lineid`),
ADD KEY `FKb1br3oee2cdhs88ogtbk15n1s` (`ticket_id`);
--
-- Indices de la tabla `ticket_line`
--
ALTER TABLE `ticket_line`
ADD PRIMARY KEY (`lineid`),
ADD KEY `fticketid` (`ticketid`);
--
-- AUTO_INCREMENT de las tablas volcadas
--
--
-- AUTO_INCREMENT de la tabla `ticket`
--
ALTER TABLE `ticket`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
--
-- AUTO_INCREMENT de la tabla `ticket_line`
--
ALTER TABLE `ticket_line`
MODIFY `lineid` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8;
--
-- Restricciones para tablas volcadas
--
--
-- Filtros para la tabla `ticket_details`
--
ALTER TABLE `ticket_details`
ADD CONSTRAINT `FKb1br3oee2cdhs88ogtbk15n1s` FOREIGN KEY (`ticket_id`) REFERENCES `ticket` (`id`),
ADD CONSTRAINT `FKffc3bastrukhor123eht43jsf` FOREIGN KEY (`details_lineid`) REFERENCES `ticket_line` (`lineid`);
--
-- Filtros para la tabla `ticket_line`
--
ALTER TABLE `ticket_line`
ADD CONSTRAINT `fticketid` FOREIGN KEY (`ticketid`) REFERENCES `ticket` (`id`);
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
| true |
cc1118ebac9afdee9e23b105f613edea67b2ed16 | SQL | IndulisErgis/ABF | /dbo/Views/Alp_lkpArAlpCheckServiceProcessed.sql | UTF-8 | 462 | 2.984375 | 3 | [] | no_license | CREATE VIEW dbo.Alp_lkpArAlpCheckServiceProcessed
AS
SELECT dbo.ALP_tblArAlpSiteRecBillServ .Processed, dbo.Alp_tblArAlpSite.SiteId
FROM dbo.ALP_tblArAlpSiteRecBill INNER JOIN
dbo.Alp_tblArAlpSiteRecBillServ ON dbo.ALP_tblArAlpSiteRecBill.RecBillId = dbo.Alp_tblArAlpSiteRecBillServ.RecBillId INNER JOIN
dbo.Alp_tblArAlpSite ON dbo.ALP_tblArAlpSiteRecBill.SiteId = dbo.ALP_tblArAlpSite .SiteId | true |
1dfafd06a7290ed6025d32abce53da7d7a125d83 | SQL | YingchuLo/leetcode_sql | /sql.sql | UTF-8 | 1,777 | 4.21875 | 4 | [] | no_license | #175
select firstname, lastname,city, state
from person p left join
address a
on
p.personid=a.personid
#176
SELECT max(Salary) as SecondHighestSalary
FROM Employee
WHERE Salary < (SELECT max(Salary) FROM Employee)
#177
CREATE FUNCTION getNthHighestSalary(N INT) RETURNS INT
BEGIN
SET N = N - 1;
RETURN (
# Write your MySQL query statement below.
SELECT (
SELECT DISTINCT Salary FROM Employee
ORDER BY Salary DESC
LIMIT 1 OFFSET N
) AS getNthHighestSalary
);
END
#178
#an @ sign to suggest user-defined variable
#:=is used as assignment operator like ==
SELECT
Score,
@rank := @rank + (@prev != (@prev := Score)) Rank
FROM
Scores,
(SELECT @rank := 0, @prev := -1) init
ORDER BY Score desc
#185
select d.name Department, e1.name Employee, e1.salary Salary
from department d
join employee e1
on d.id=e1.departmentid
where 3 > (select count( distinct e2.salary)
from employee e2
where e2.salary>e1.salary
and e1.departmentid=e2.departmentid
)
#181
select e1.name Employee
from employee e1,employee e2
where e1.managerid=e2.id
and e1.salary>e2.salary
#595
select name, population, area
from world
where population > 25000000
or area > 3000000
#184
select d.name Department, e.name Employee,e.salary Salary
from employee e
join department d
on e.departmentid=d.id
where (e.departmentid, e.salary) in
(select
e1.departmentid,max(e1.salary)
from
employee e1
group by
departmentid)
#180
select distinct l1.num ConsecutiveNums
from
logs l1,
logs l2,
logs l3
where
l2.id=l1.id+1
and l3.id=l2.id+1
and l1.num=l2.num
and l2.num=l3.num
| true |
342a3b5b042758185564d9161e6106b900eb9e49 | SQL | vatic/books | /src/db/sql/create_tables.sql | UTF-8 | 607 | 3.859375 | 4 | [] | no_license | DROP TABLE IF EXISTS `books`;
DROP TABLE IF EXISTS `authors`;
CREATE TABLE
`authors` (
`id` INT NOT NULL AUTO_INCREMENT,
`name` VARCHAR(255) NOT NULL,
PRIMARY KEY(`id`)
);
CREATE TABLE
`books` (
`id` INT NOT NULL AUTO_INCREMENT,
`title` VARCHAR(255) NOT NULL,
`date` DATE NOT NULL,
`author_id` INT NOT NULL,
`description` TEXT,
`image` VARCHAR(255),
PRIMARY KEY(`id`),
INDEX author_index (author_id),
FOREIGN KEY (author_id)
REFERENCES authors(id)
ON DELETE CASCADE
);
| true |
36c89466197ba6e93ea7925bcb52e8ad82e88040 | SQL | NikitaChernyavskii/mtg-collector | /DataBase/Create_Card_table_03082017.1406.sql | UTF-8 | 1,155 | 2.65625 | 3 | [] | no_license | CREATE TABLE [Card]
(
Id uniqueidentifier NOT NULL,
MtgJsonId NVARCHAR(40) NOT NULL,
CardSetId uniqueidentifier NOT NULL,
Layout NVARCHAR(150) NULL,
Name NVARCHAR(150) NOT NULL,
Names NVARCHAR(350) NULL, -- array
ManaCost NVARCHAR(150) NULL,
Cmc FLOAT NULL,
Colors NVARCHAR(150) NULL, -- array
ColorIdentity NVARCHAR(150) NULL, -- array
Type NVARCHAR(150) NULL,
Supertypes NVARCHAR(250) NULL, -- array
Types NVARCHAR(250) NULL, -- array
Subtypes NVARCHAR(250) NULL, -- array
Rarity NVARCHAR(150) NULL,
Text NVARCHAR(MAX) NULL,
Flavor NVARCHAR(MAX) NULL,
Artist NVARCHAR(150) NULL,
Number NVARCHAR(150) NULL,
Power NVARCHAR(150) NULL,
Toughness NVARCHAR(150) NULL,
Loyalty INT NULL,
Multiverseid INT NOT NULL,
Variations NVARCHAR(150) NULL, -- array
ImageName NVARCHAR(150) NOT NULL,
Watermark NVARCHAR(150) NULL,
Border NVARCHAR(150) NULL,
Timeshifted BIT NULL,
Reserved BIT NULL,
ReleaseDate NVARCHAR(150) NULL
CONSTRAINT pk_Card_Id PRIMARY KEY (Id),
CONSTRAINT fk_Card_CardSetId FOREIGN KEY (CardSetId) REFERENCES dbo.CardSet (Id)
)
--DROP TABLE CARD | true |
895378959a6db657c61b75618e55fec034bf7b3b | SQL | laluhaenol12/tugasweb | /webd_haenol.sql | UTF-8 | 2,663 | 3.234375 | 3 | [] | no_license | -- phpMyAdmin SQL Dump
-- version 5.0.2
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Dec 29, 2020 at 12:00 PM
-- Server version: 10.4.14-MariaDB
-- PHP Version: 7.4.10
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Database: `webd_haenol`
--
-- --------------------------------------------------------
--
-- Table structure for table `dosen`
--
CREATE TABLE `dosen` (
`nip` int(5) NOT NULL,
`nama_dosen` varchar(256) NOT NULL,
`alamat` text NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `dosen`
--
INSERT INTO `dosen` (`nip`, `nama_dosen`, `alamat`) VALUES
(112233, 'Fajar', 'Sumbawa'),
(112234, 'Indra', 'Lombok Timur');
-- --------------------------------------------------------
--
-- Table structure for table `mahasiswa`
--
CREATE TABLE `mahasiswa` (
`nim` int(5) NOT NULL,
`nama_mahasiswa` varchar(256) NOT NULL,
`prodi` varchar(100) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `mahasiswa`
--
INSERT INTO `mahasiswa` (`nim`, `nama_mahasiswa`, `prodi`) VALUES
(1810530204, 'Azzahabi Rozaq', 'S1 ILKOM'),
(1810530205, 'Lalu Haenol Zihadi', 'S1 ILKOM');
-- --------------------------------------------------------
--
-- Table structure for table `perwalian`
--
CREATE TABLE `perwalian` (
`id` int(11) NOT NULL,
`dosen_nip` int(5) NOT NULL,
`mahasiswa_nim` int(5) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Indexes for dumped tables
--
--
-- Indexes for table `dosen`
--
ALTER TABLE `dosen`
ADD PRIMARY KEY (`nip`);
--
-- Indexes for table `mahasiswa`
--
ALTER TABLE `mahasiswa`
ADD PRIMARY KEY (`nim`);
--
-- Indexes for table `perwalian`
--
ALTER TABLE `perwalian`
ADD PRIMARY KEY (`id`),
ADD KEY `dosen_nip` (`dosen_nip`),
ADD KEY `mahasiswa_nim` (`mahasiswa_nim`);
--
-- Constraints for dumped tables
--
--
-- Constraints for table `perwalian`
--
ALTER TABLE `perwalian`
ADD CONSTRAINT `perwalian_ibfk_1` FOREIGN KEY (`dosen_nip`) REFERENCES `dosen` (`nip`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `perwalian_ibfk_2` FOREIGN KEY (`mahasiswa_nim`) REFERENCES `mahasiswa` (`nim`) 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 */;
| true |
d67a6c7f05b5bebac7993ea76009deb140f16283 | SQL | leonardomontagna/RipeTO | /RipeTO/out/artifacts/RipeTO_war_exploded/WEB-INF/lib/ripetizioni.sql | UTF-8 | 5,049 | 3.109375 | 3 | [] | no_license | -- phpMyAdmin SQL Dump
-- version 5.0.1
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Creato il: Giu 30, 2020 alle 18:48
-- Versione del server: 10.4.11-MariaDB
-- Versione PHP: 7.4.3
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Database: `ripetizioni`
--
-- --------------------------------------------------------
--
-- Struttura della tabella `corsi`
--
CREATE TABLE `corsi` (
`id_corso` int(8) NOT NULL,
`titolo` varchar(20) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dump dei dati per la tabella `corsi`
--
INSERT INTO `corsi` (`id_corso`, `titolo`) VALUES
(111, 'IUM'),
(123, 'RO'),
(222, 'Matematica Discreta'),
(333, 'Reti I'),
(444, 'Sistemi Intelligenti'),
(456, 'Prog I'),
(666, 'Logica'),
(777, 'Prog 3'),
(888, 'Android');
-- --------------------------------------------------------
--
-- Struttura della tabella `docenti`
--
CREATE TABLE `docenti` (
`id_docente` int(8) NOT NULL,
`nome` varchar(50) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dump dei dati per la tabella `docenti`
--
INSERT INTO `docenti` (`id_docente`, `nome`) VALUES
(111, 'Viviana Patti'),
(222, 'Andrea Mori'),
(333, 'Marco Botta'),
(444, 'Cristina Baroglio'),
(555, 'Mario Coppo'),
(777, 'Liliana Ardissono'),
(888, 'Marino Segnan'),
(999, 'Roberto Aringhieri');
-- --------------------------------------------------------
--
-- Struttura della tabella `lezioni`
--
CREATE TABLE `lezioni` (
`id_lezione` int(8) NOT NULL,
`id_docente` int(8) NOT NULL,
`id_corso` int(8) NOT NULL,
`data` varchar(20) NOT NULL,
`ora` varchar(20) NOT NULL,
`stato` varchar(20) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dump dei dati per la tabella `lezioni`
--
INSERT INTO `lezioni` (`id_lezione`, `id_docente`, `id_corso`, `data`, `ora`, `stato`) VALUES
(933, 333, 222, 'Martedi', 'dalle 16 alle 17', 'disponibile'),
(935, 111, 888, 'Venerdi', 'dalle 15 alle 16', 'disponibile'),
(936, 777, 456, 'Lunedi', 'dalle 15 alle 16', 'disponibile');
-- --------------------------------------------------------
--
-- Struttura della tabella `ripetizioni`
--
CREATE TABLE `ripetizioni` (
`id_prenotazione` int(8) NOT NULL,
`id_utente` int(8) NOT NULL,
`nome` varchar(50) NOT NULL,
`titolo` varchar(50) NOT NULL,
`data` varchar(50) NOT NULL,
`ora` varchar(50) NOT NULL,
`stato` varchar(50) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dump dei dati per la tabella `ripetizioni`
--
INSERT INTO `ripetizioni` (`id_prenotazione`, `id_utente`, `nome`, `titolo`, `data`, `ora`, `stato`) VALUES
(46, 858344, 'Marino Segnan', 'Android', 'Lunedi', 'dalle 15 alle 16', 'effettuata');
-- --------------------------------------------------------
--
-- Struttura della tabella `utenti`
--
CREATE TABLE `utenti` (
`id_utente` int(8) NOT NULL,
`email` varchar(50) NOT NULL,
`password` varchar(50) NOT NULL,
`nome` varchar(50) NOT NULL,
`cognome` varchar(50) NOT NULL,
`ruolo` varchar(50) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dump dei dati per la tabella `utenti`
--
INSERT INTO `utenti` (`id_utente`, `email`, `password`, `nome`, `cognome`, `ruolo`) VALUES
(849566, 'riccardovicario@gmail.com', 'riccardovicario1', 'riccardo', 'vicario', 'utente'),
(858344, 'danielrusso@gmail.com', 'danielrusso1', 'daniel', 'russo', 'utente'),
(868455, 'leonardomontagna@gmail.com', 'leonardomontagna1', 'leonardo', 'montagna', 'amministratore');
--
-- Indici per le tabelle scaricate
--
--
-- Indici per le tabelle `corsi`
--
ALTER TABLE `corsi`
ADD PRIMARY KEY (`id_corso`);
--
-- Indici per le tabelle `docenti`
--
ALTER TABLE `docenti`
ADD PRIMARY KEY (`id_docente`);
--
-- Indici per le tabelle `lezioni`
--
ALTER TABLE `lezioni`
ADD PRIMARY KEY (`id_lezione`,`id_docente`,`id_corso`,`data`,`ora`);
--
-- Indici per le tabelle `ripetizioni`
--
ALTER TABLE `ripetizioni`
ADD PRIMARY KEY (`id_prenotazione`,`id_utente`,`nome`,`titolo`,`data`,`ora`,`stato`),
ADD KEY `d_utente_key` (`id_utente`);
--
-- Indici per le tabelle `utenti`
--
ALTER TABLE `utenti`
ADD PRIMARY KEY (`id_utente`,`email`,`password`);
--
-- AUTO_INCREMENT per le tabelle scaricate
--
--
-- AUTO_INCREMENT per la tabella `lezioni`
--
ALTER TABLE `lezioni`
MODIFY `id_lezione` int(8) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=937;
--
-- AUTO_INCREMENT per la tabella `ripetizioni`
--
ALTER TABLE `ripetizioni`
MODIFY `id_prenotazione` int(8) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=47;
--
-- Limiti per le tabelle scaricate
--
--
-- Limiti per la tabella `ripetizioni`
--
ALTER TABLE `ripetizioni`
ADD CONSTRAINT `d_utente_key` FOREIGN KEY (`id_utente`) REFERENCES `utenti` (`id_utente`);
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
| true |
df64a94c031e64c27650026e78f5bd3da11c5d7b | SQL | j19791/PL-SQL | /aula2_bloco_insert.sql | ISO-8859-1 | 706 | 2.9375 | 3 | [] | no_license | DECLARE --declarao das variveis, j inicializando-as - s obrigatrio DECLARE qdo for utilizar variaveis
--v_id number(5) := 1;
--v_descricao varchar2(100) := 'varejo';
--melhorando a definio do tipo da varivel p/ que seja sempre compatvel com a definio da coluna no banco
v_id segmercado.id%type := 2;
v_descricao segmercado.descricao%type := 'atacado';
BEGIN
--insert inicia a transao automaticamente
INSERT INTO segmercado VALUES (v_id, upper(v_descricao)); --upper fora a insero de dados em maiuscula p/ manter um padro de armazenamento
COMMIT; --encerra a transao, confirmando
END;
select * from SEGMERCADO; | true |
bf76b38f036d60e79d439f9d4117e7e00bdb06e6 | SQL | tanbinh123/Restaurant | /src/main/resources/db/populateDB.sql | UTF-8 | 1,339 | 3.484375 | 3 | [] | no_license | DELETE
FROM user_roles;
DELETE
FROM votes;
DELETE
FROM dishes;
DELETE
from restaurants;
DELETE
FROM users;
ALTER SEQUENCE global_seq RESTART WITH 1;
INSERT INTO users (name, email, password)
VALUES ('User1', 'user1@mail.ru', '{noop}password1'),
('User2', 'user2@mail.ru', '{noop}password2'),
('User3', 'user3@mail.ru', '{noop}password3'),
('Admin', 'admin@gmail.com', '{noop}admin');
INSERT INTO user_roles (role, user_id)
VALUES ('USER', 1),
('USER', 2),
('USER', 3),
('ADMIN', 4),
('USER', 4);
INSERT INTO restaurants (name)
VALUES ('restaurant1'),
('Restaurant2'),
('Restaurant3'),
('Restaurant4');
INSERT INTO dishes (name, price, date, restaurant_id)
VALUES ('dish1_rest1', 10.00, '2020-03-05', 5),
('Dish2_rest1', 15.00, '2020-03-05', 5),
('Dish3_rest1', 15.00, '2020-03-06', 5),
('Dish1_rest2', 5.00, '2020-03-05', 6),
('Dish1_rest4', 7.00, '2020-03-05', 8),
('dish4_rest1', 20.70, CURRENT_DATE, 5),
('Dish5_rest1', 50.00, CURRENT_DATE, 5),
('Dish2_rest2', 10.00, CURRENT_DATE, 6);
INSERT INTO votes (date, user_id, restaurant_id)
VALUES ('2020-03-05', 1, 5),
('2020-03-05', 3, 5),
('2020-03-05', 2, 6),
('2020-03-06', 1, 5),
('2020-03-06', 4, 5),
(CURRENT_DATE, 1, 5),
(CURRENT_DATE, 4, 5);
| true |
d41eefb61fae29cbb0421db0cac0b811ef61600d | SQL | tomihasa/citibike-nyc | /scripts/aggregate_trips.sql | UTF-8 | 1,049 | 3.796875 | 4 | [] | no_license | -- create trips table
create table trips (
"tripduration" numeric,
"starttime" timestamp,
"stoptime" timestamp,
"start station id" varchar,
"start station name" varchar,
"start station latitude" numeric,
"start station longitude" numeric,
"end station id" varchar,
"end station name" varchar,
"end station latitude" numeric,
"end station longitude" numeric,
"bikeid" varchar,
"usertype" varchar,
"birth year" varchar,
"gender" varchar
);
-- copy trips data to trips table
copy trips from '/data/201805-citibike-tripdata.csv' delimiter ',' csv header;
-- create table trips_count
create table trips_count (station_id varchar, trips_count integer, ts timestamp);
-- create timescaledb hypertable
select create_hypertable('trips_count', 'ts');
-- aggregate trips into trips_count table
insert into trips_count select
"end station id" as station_id,
count(date_trunc('hour', stoptime)) as trips_count,
date_trunc('hour', stoptime) as ts
from trips
group by
station_id, date_trunc('hour', stoptime);
| true |
dfea7a9710c4f2c50f291f6030c0074bbf76485e | SQL | jesterfs/easycal-api | /seeds/seed.easycal.sql | UTF-8 | 920 | 2.96875 | 3 | [] | no_license | INSERT INTO members (name, email, password)
VALUES
('Bob', 'bob@gmail.com', 'password1'),
('Fred', 'fred@gmail.com', 'password2'),
('Stan', 'stan@gmail.com', 'password3'),
('Sally', 'sally@gmail.com', 'password4'),
('Deb', 'deb@gmail.com', 'password5'),
('Mary', 'mary@gmail.com', 'password6');
INSERT INTO calendars (name, owner)
VALUES
('Calendar1', 1),
('Calendar2', 1),
('Calendar3', 2);
INSERT INTO member_calenders (member_id, calendar_id)
VALUES
(1, 1),
(1, 2),
(1, 3),
(2, 2),
(2, 3),
(2, 1),
(3, 1),
(4, 1),
(5, 2),
(6, 3);
INSERT INTO events (name, start_time, end_time, calendar_id, owner_id)
VALUES
('Staff Meeting', '2020-10-01 12:00:00', '2020-10-01 13:00:00', 1, 1),
('Performance Review', '2020-10-02 12:00:00', '2020-10-02 13:00:00', 2, 2),
('Inventory', '2020-10-04 12:00:00', '2020-10-04 13:00:00', 3, 2);
INSERT INTO member_events (member_id, event_id)
VALUES
(1, 1),
(2, 2),
(5, 2),
(3, 1),
(4, 1),
(5, 1),
(1, 3),
(2, 3);
| true |
e285850bea74930f35aadf7bd9cb98c2ccacdbad | SQL | kematuGit/yonglin | /one/yonglin.sql | UTF-8 | 3,563 | 3.515625 | 4 | [] | no_license | /*
Navicat MySQL Data Transfer
Source Server : yonglin
Source Server Version : 50162
Source Host : localhost:3306
Source Database : yonglin
Target Server Type : MYSQL
Target Server Version : 50162
File Encoding : 65001
Date: 2017-02-15 23:02:08
*/
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for area
-- ----------------------------
DROP TABLE IF EXISTS `area`;
CREATE TABLE `area` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'id',
`num` varchar(16) DEFAULT NULL COMMENT '区域编号',
`name` varchar(32) DEFAULT NULL COMMENT '区域名称',
`remark` varchar(32) DEFAULT NULL COMMENT '区域备注',
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------
-- Table structure for product
-- ----------------------------
DROP TABLE IF EXISTS `product`;
CREATE TABLE `product` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'id',
`sort` int(11) DEFAULT NULL COMMENT '序号',
`material_num` varchar(16) DEFAULT NULL COMMENT '材料牌号',
`name` varchar(32) DEFAULT NULL COMMENT '产品名称',
`pic_num` varchar(16) DEFAULT NULL COMMENT '图号',
`remark` varchar(32) DEFAULT NULL COMMENT '备注',
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------
-- Table structure for storage
-- ----------------------------
DROP TABLE IF EXISTS `storage`;
CREATE TABLE `storage` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'id',
`order_num` varchar(16) NOT NULL COMMENT '入库单号',
`excute_time` datetime NOT NULL COMMENT '(入库/出库/盘点)日期',
`product_id` int(11) DEFAULT NULL COMMENT '产品ID',
`material_report_num` varchar(16) DEFAULT NULL,
`production_batch` varchar(32) DEFAULT NULL COMMENT '产品批次',
`storage_num` int(11) DEFAULT NULL COMMENT '入库数量',
`contract_num` varchar(32) DEFAULT NULL COMMENT '合同号',
`remark` varchar(32) DEFAULT NULL COMMENT '备注',
`storage_type` tinyint(1) DEFAULT NULL COMMENT '1:入库 2:出库 3:盘点',
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------
-- Table structure for storage_rack
-- ----------------------------
DROP TABLE IF EXISTS `storage_rack`;
CREATE TABLE `storage_rack` (
`id` int(11) DEFAULT NULL COMMENT 'id',
`storage_id` int(11) DEFAULT NULL COMMENT '库存ID',
`area_id` int(11) DEFAULT NULL,
`row` int(3) DEFAULT NULL COMMENT '行',
`column` int(3) DEFAULT NULL,
`put_num` int(11) DEFAULT NULL COMMENT '放置数量',
`remark` varchar(32) DEFAULT NULL COMMENT ' 备注',
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
`create_time` datetime DEFAULT NULL COMMENT '创建时间'
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/**20170221*/
ALTER TABLE `product`
ADD COLUMN `in_storage_count` INT(10) NULL COMMENT '入库总数量' AFTER `remark`,
ADD COLUMN `out_storage_count` INT(10) NULL COMMENT '出库总数量' AFTER `in_storage_count`,
ADD COLUMN `check_storage_count` INT(10) NULL COMMENT '盘点总数量' AFTER `out_storage_count`;
SELECT `DEFAULT_COLLATION_NAME` FROM `information_schema`.`SCHEMATA` WHERE `SCHEMA_NAME`='yonglin'; | true |
9d0998d0e5452127795e4a6a2d0a9cb8878b8ecf | SQL | jxiaoyu/LeetCode-practice | /database/Second Highest Salary.sql | UTF-8 | 572 | 3.9375 | 4 | [] | no_license | # 这题明明是 Nth Highest Salary 的特例,但不知道为什么 Nth 那道就不需要 if 判断
# Write your MySQL query statement below
SELECT
IF (
COUNT(Salary) >= 0,
Salary,
NULL
)
FROM
(
SELECT DISTINCT
Salary
FROM
Employee
ORDER BY
Salary DESC
LIMIT 1,
1
) AS Unique_Salary;
# 另一种写法
SELECT
max(Salary) AS SecondHighestSalary
FROM
Employee
WHERE
Salary < (
SELECT
max(Salary)
FROM
Employee
) | true |
77b579a1d476045e2d556c99053597c301c7831a | SQL | andrei-kolesnik/leetcode | /sql/175.Combine-Two-Tables.SQL | UTF-8 | 227 | 3.296875 | 3 | [] | no_license | -- LeetCode # 175: Combine Two Tables
-- https://leetcode.com/problems/combine-two-tables
SELECT
P.FirstName,
P.LastName,
A.City,
A.State
FROM
Person P LEFT OUTER JOIN Address A ON P.PersonID = A.PersonID
| true |
d8e265387c91ab541c8f11288c97a5107013e39e | SQL | Irisss666/spaceX-database-system | /MYSQL-scripts/Rockets.sql | UTF-8 | 730 | 2.8125 | 3 | [] | no_license | USE `SpaceX-DB`;
CREATE TABLE Rockets (rocket_id VARCHAR(24) NOT NULL PRIMARY KEY,name VARCHAR(20),type VARCHAR(10),active VARCHAR(10),country VARCHAR(40),
company VARCHAR(20), cost_per_launch INTEGER);
INSERT INTO Rockets VALUES ('5e9d0d95eda69955f709d1eb','Falcon 1','rocket','False','Republic of the Marshall Islands','SpaceX',6700000);
INSERT INTO Rockets VALUES ('5e9d0d95eda69973a809d1ec','Falcon 9','rocket','True','United States','SpaceX', 50000000);
INSERT INTO Rockets VALUES ('5e9d0d95eda69974db09d1ed','Falcon Heavy','rocket','True','United States','SpaceX', 90000000);
INSERT INTO Rockets VALUES ('5e9d0d96eda699382d09d1ee','Starship','rocket','False','United States','SpaceX', 7000000);
SELECT * FROM Rockets
| true |
752b3ea6e314ec36d76bb0adac261f65da7f25f5 | SQL | RolandoAndrade/minerucab | /queries/entrega/PRUEBAS.SQL | UTF-8 | 108 | 3.3125 | 3 | [] | no_license | SELECT R.*,A.*
FROM ROL R, ROL_ACCI RA, ACCION A
WHERE R.r_id_rol=RA.rol_id AND RA.accion_id = A.a_id_accion | true |
efb030c85ec12cc1dd12c7837c69c5ce073cf42e | SQL | exequielarroyo/ReservationSystem | /MySQL database/reservationsystem.sql | UTF-8 | 2,521 | 3.3125 | 3 | [] | no_license | /*
SQLyog Community v13.1.7 (64 bit)
MySQL - 8.0.21 : Database - reservationsystem
*********************************************************************
*/
/*!40101 SET NAMES utf8 */;
/*!40101 SET SQL_MODE=''*/;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
CREATE DATABASE /*!32312 IF NOT EXISTS*/`reservationsystem` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='N' */;
USE `reservationsystem`;
/*Table structure for table `room` */
DROP TABLE IF EXISTS `room`;
CREATE TABLE `room` (
`roomID` int NOT NULL AUTO_INCREMENT,
`roomNumber` int DEFAULT NULL,
`roomPersonCount` int DEFAULT NULL,
`roomStatus` varchar(24) DEFAULT NULL,
`roomPrice` decimal(6,2) DEFAULT NULL,
`roomDetails` varchar(100) DEFAULT NULL,
`roomOutDate` date DEFAULT NULL,
`roomInDate` date DEFAULT NULL,
PRIMARY KEY (`roomID`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*Data for the table `room` */
insert into `room`(`roomID`,`roomNumber`,`roomPersonCount`,`roomStatus`,`roomPrice`,`roomDetails`,`roomOutDate`,`roomInDate`) values
(1,103,5,'Available',999.99,'Maganda po ito','2021-03-01','2021-02-22');
/*Table structure for table `user` */
DROP TABLE IF EXISTS `user`;
CREATE TABLE `user` (
`userID` int NOT NULL AUTO_INCREMENT,
`userName` varchar(24) DEFAULT NULL,
`userPassword` varchar(24) DEFAULT NULL,
`userFirstName` varchar(24) DEFAULT NULL,
`userLastName` varchar(24) DEFAULT NULL,
`userNumber` varchar(11) DEFAULT NULL,
`userSex` varchar(6) DEFAULT NULL,
`userBirthdate` date DEFAULT NULL,
`userEmail` varchar(50) DEFAULT NULL,
`userType` varchar(10) DEFAULT NULL,
PRIMARY KEY (`userID`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*Data for the table `user` */
insert into `user`(`userID`,`userName`,`userPassword`,`userFirstName`,`userLastName`,`userNumber`,`userSex`,`userBirthdate`,`userEmail`,`userType`) values
(1,'master','1234','Exequiel','Arroyo','09123456789','Male','2021-02-22','zekielarroyo@gmail.com','admin');
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
| true |
ca7c355b471ce9cfa026ee0b05ec1cbd341c9741 | SQL | sinsys/taskmon_server | /db/migrations/001.do.create-tasks-table.sql | UTF-8 | 314 | 2.984375 | 3 | [] | no_license | CREATE TABLE tasks (
id INTEGER PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY,
title TEXT NOT NULL,
content TEXT,
date_modified TIMESTAMPTZ DEFAULT now() NOT NULL,
date_created TIMESTAMPTZ DEFAULT now() NOT NULL,
date_due TIMESTAMPTZ DEFAULT (now() + interval '1 day 2 hours 30 minutes')
);
| true |
6cfc39d176876835bf9bd8db3c9aad05e41bb389 | SQL | CUBRID/cubrid-testcases | /sql/_04_operator_function/_01_all_types/_002_arithmetic_op/cases/1046.sql | UTF-8 | 830 | 3.09375 | 3 | [
"BSD-3-Clause"
] | permissive | --test numeric data type by '+','-','*','/' operators with smallint,int,numeric,float,monetary,double data type value
create class func_02 ( a smallint, b int, c numeric(38,10), d float, e monetary, f double );
insert into func_02 values ( 0,0,0,0,0,0);
insert into func_02(a) values ( null);
insert into func_02 values ( 1,1,1,1,1,1);
insert into func_02 values ( 127,10000,987654321.123456789,987654321.123,987654321.987,987654321.123);
insert into func_02 values (-127,-10000,-987654321.123456789,-987654321.123, -987654321.987,-987654321.123);
select a+b+c+d+e+f from func_02 order by 1 ;
select a+b+c+d+e+f+1 from func_02 order by 1;
select a-b from func_02 order by 1;
select a*b from func_02 order by 1;
select a+a+a+a+a+a from func_02 order by 1 ;
select d+d+f+f+f+f from func_02 order by 1;
drop class func_02;
| true |
81c589dfd07820ea6332657c4464aea153b2f3d0 | SQL | jorgevalentin/docsis-provisioning | /sources/sql/database/500application/050subscriber.sql | UTF-8 | 1,089 | 2.71875 | 3 | [] | no_license | -- $Id$
create table {:SCHEMA:}subscriber (
subscriberid integer not null unique,
name varchar(256) not null,
primarylocationid int8 REFERENCES {:SCHEMA:}objectids ON DELETE SET NULL ON UPDATE CASCADE NULL,
postaladdress varchar(512) null,
info text null,
email varchar(128)[] null,
telephone varchar(32)[] null
) inherits ({:SCHEMA:}"object");
SELECT {:SCHEMA:}setup_object_subtable ( 'subscriber' );
create table {:SCHEMA:}service (
subscriberid int8 REFERENCES {:SCHEMA:}objectids ON DELETE CASCADE ON UPDATE CASCADE NOT NULL,
typeofservice int8 REFERENCES {:SCHEMA:}objectids ON DELETE SET NULL ON UPDATE CASCADE NULL,
classofservice int8 REFERENCES {:SCHEMA:}objectids ON DELETE SET NULL ON UPDATE CASCADE NULL,
parentservice int8 REFERENCES {:SCHEMA:}objectids ON DELETE CASCADE ON UPDATE CASCADE NULL,
locationid int8 REFERENCES {:SCHEMA:}objectids ON DELETE SET NULL ON UPDATE CASCADE NOT NULL,
handle varchar(24) NULL,
status smallint not null default 1
) inherits ({:SCHEMA:}"object");
SELECT {:SCHEMA:}setup_object_subtable ( 'service' );
| true |
399bcd0607129edfaaa8ddd4a5a9082553f419dd | SQL | Lexa-san/mvc-example | /db/asolovev_kplus.sql | UTF-8 | 3,693 | 3.875 | 4 | [
"MIT"
] | permissive | DROP DATABASE IF EXISTS asolovev_kplus;
CREATE DATABASE IF NOT EXISTS asolovev_kplus
DEFAULT CHARACTER SET utf8
DEFAULT COLLATE utf8_general_ci;
USE `asolovev_kplus` ;
DROP TABLE IF EXISTS `chess_grid`;
CREATE TABLE IF NOT EXISTS `chess_grid` (
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
`name` CHAR(2) NOT NULL,
`horizontal` TINYINT(1) UNSIGNED NOT NULL,
`vertical` TINYINT(1) UNSIGNED NOT NULL,
PRIMARY KEY (`id`))
ENGINE = InnoDB;
CREATE UNIQUE INDEX `name_UNIQUE` ON `chess_grid` (`name` ASC);
DROP TABLE IF EXISTS `chess_figure`;
CREATE TABLE IF NOT EXISTS `chess_figure` (
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
`name` CHAR(1) NOT NULL,
PRIMARY KEY (`id`))
ENGINE = InnoDB;
CREATE UNIQUE INDEX `name_UNIQUE` ON `chess_figure` (`name` ASC);
DROP TABLE IF EXISTS `chess_position`;
CREATE TABLE IF NOT EXISTS `chess_position` (
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
`name` VARCHAR(64) NOT NULL,
PRIMARY KEY (`id`))
ENGINE = InnoDB;
DROP TABLE IF EXISTS `chess_position_plan`;
CREATE TABLE IF NOT EXISTS `chess_position_plan` (
`position_id` INT UNSIGNED NOT NULL,
`grid_id` INT UNSIGNED NOT NULL,
`figure_id` INT UNSIGNED NOT NULL,
`color` CHAR(1) NOT NULL,
CONSTRAINT `fk_chess_position_plan_chess_position`
FOREIGN KEY (`position_id`) REFERENCES `chess_position` (`id`) ON DELETE CASCADE ON UPDATE RESTRICT,
CONSTRAINT `fk_chess_position_plan_chess_grid1`
FOREIGN KEY (`grid_id`) REFERENCES `chess_grid` (`id`) ON DELETE CASCADE ON UPDATE RESTRICT,
CONSTRAINT `fk_chess_position_plan_chess_figure1`
FOREIGN KEY (`figure_id`) REFERENCES `chess_figure` (`id`) ON DELETE CASCADE ON UPDATE RESTRICT)
ENGINE = InnoDB;
CREATE UNIQUE INDEX `figure_grid_position_UNIQUE` ON `chess_position_plan` (`position_id`, `grid_id`, `figure_id`);
INSERT INTO chess_figure (id, name)
VALUES (1, 'K'), (2, 'Q'), (3, 'R'), (4, 'N'), (5, 'B'), (6, 'p')
;
INSERT INTO chess_position (name)
VALUES ('Пустая доска'), ('Начальная позиция')
;
INSERT INTO chess_grid (name, horizontal, vertical)
VALUES
('a8', 1, 8), ('b8', 2, 8), ('c8', 3, 8), ('d8', 4, 8), ('e8', 5, 8), ('f8', 6, 8), ('g8', 7, 8), ('h8', 8, 8),
('a7', 1, 7), ('b7', 2, 7), ('c7', 3, 7), ('d7', 4, 7), ('e7', 5, 7), ('f7', 6, 7), ('g7', 7, 7), ('h7', 8, 7),
('a6', 1, 6), ('b6', 2, 6), ('c6', 3, 6), ('d6', 4, 6), ('e6', 5, 6), ('f6', 6, 6), ('g6', 7, 6), ('h6', 8, 6),
('a5', 1, 5), ('b5', 2, 5), ('c5', 3, 5), ('d5', 4, 5), ('e5', 5, 5), ('f5', 6, 5), ('g5', 7, 5), ('h5', 8, 5),
('a4', 1, 4), ('b4', 2, 4), ('c4', 3, 4), ('d4', 4, 4), ('e4', 5, 4), ('f4', 6, 4), ('g4', 7, 4), ('h4', 8, 4),
('a3', 1, 3), ('b3', 2, 3), ('c3', 3, 3), ('d3', 4, 3), ('e3', 5, 3), ('f3', 6, 3), ('g3', 7, 3), ('h3', 8, 3),
('a2', 1, 2), ('b2', 2, 2), ('c2', 3, 2), ('d2', 4, 2), ('e2', 5, 2), ('f2', 6, 2), ('g2', 7, 2), ('h2', 8, 2),
('a1', 1, 1), ('b1', 2, 1), ('c1', 3, 1), ('d1', 4, 1), ('e1', 5, 1), ('f1', 6, 1), ('g1', 7, 1), ('h1', 8, 1)
;
INSERT INTO chess_position_plan (position_id, grid_id, figure_id, color)
VALUES
(2, 1, 3, 'b'), (2, 2, 4, 'b'), (2, 3, 5, 'b'), (2, 4, 2, 'b'), (2, 5, 1, 'b'), (2, 6, 5, 'b'), (2, 7, 4, 'b'), (2, 8, 3, 'b'),
(2, 9, 6, 'b'), (2, 10, 6, 'b'), (2, 11, 6, 'b'), (2, 12, 6, 'b'), (2, 13, 6, 'b'), (2, 14, 6, 'b'), (2, 15, 6, 'b'), (2, 16, 6, 'b'),
(2, 49, 6, 'w'), (2, 50, 6, 'w'), (2, 51, 6, 'w'), (2, 52, 6, 'w'), (2, 53, 6, 'w'), (2, 54, 6, 'w'), (2, 55, 6, 'w'), (2, 56, 6, 'w'),
(2, 57, 3, 'w'), (2, 58, 4, 'w'), (2, 59, 5, 'w'), (2, 60, 2, 'w'), (2, 61, 1, 'w'), (2, 62, 5, 'w'), (2, 63, 4, 'w'), (2, 64, 3, 'w')
;
| true |
72f2ac081b5ec99283ba4a6adffc5da0e46de095 | SQL | azavea/pfb | /stress_residential.sql | UTF-8 | 1,678 | 3.40625 | 3 | [
"Apache-2.0"
] | permissive | ----------------------------------------
-- INPUTS
-- location: neighborhood
-- notes: residential streets with bike lanes of any type
-- are scored as tertiary streets
----------------------------------------
UPDATE neighborhood_ways SET ft_seg_stress = NULL, tf_seg_stress = NULL
WHERE functional_class = 'residential'
AND (ft_bike_infra IS NULL OR ft_bike_infra NOT IN ('track','buffered_lane','lane'))
AND (tf_bike_infra IS NULL OR tf_bike_infra NOT IN ('track','buffered_lane','lane'))
AND (ft_lanes IS NULL OR ft_lanes = 1)
AND (ft_lanes IS NULL OR tf_lanes = 1)
AND (speed_limit IS NULL OR speed_limit <= 30);
-- no additional information
UPDATE neighborhood_ways
SET ft_seg_stress = 1,
tf_seg_stress = 1
WHERE functional_class = 'residential'
AND (ft_bike_infra IS NULL OR ft_bike_infra NOT IN ('track','buffered_lane','lane'))
AND (tf_bike_infra IS NULL OR tf_bike_infra NOT IN ('track','buffered_lane','lane'))
AND (ft_lanes IS NULL OR ft_lanes = 1)
AND (ft_lanes IS NULL OR tf_lanes = 1)
AND (speed_limit IS NULL OR speed_limit <= 30);
-- stress increase for narrow one way and parking on both sides
UPDATE neighborhood_ways
SET ft_seg_stress = 2,
tf_seg_stress = 2
WHERE functional_class = 'residential'
AND (ft_bike_infra IS NULL OR ft_bike_infra NOT IN ('track','buffered_lane','lane'))
AND (tf_bike_infra IS NULL OR tf_bike_infra NOT IN ('track','buffered_lane','lane'))
AND (ft_lanes IS NULL OR ft_lanes = 1)
AND (ft_lanes IS NULL OR tf_lanes = 1)
AND (speed_limit IS NULL OR speed_limit <= 30)
AND width_ft <= 26
AND ft_park = 1
AND tf_park = 1;
| true |
a4bfe26b519995a42b455be1e9bf0973df23c05d | SQL | Deptfortransport/SJP | /SJP/CodeBase/SJP/DataBases/PermanentPortal/Schema Objects/Schemas/dbo/Programmability/Stored Procedures/SelectGroupPropertiesWithPartnerId.proc.sql | UTF-8 | 401 | 2.703125 | 3 | [] | no_license |
---------------------------------------------------------------------
-- Update to SelectGroupPropertiesWithPartnerId Proc
---------------------------------------------------------------------
CREATE PROCEDURE SelectGroupPropertiesWithPartnerId
(
@GID char(50)
)
AS
BEGIN
SELECT (CAST(PartnerId AS varchar(10)) + '.' + PNAME) AS PNAME, PVALUE, ThemeId
FROM PROPERTIES P
WHERE P.GID = @GID
END | true |
d6dc9b20812b87fb025a0bd274fcce8465c33662 | SQL | mashikr/PDO-CRUD-app | /database.sql | UTF-8 | 1,802 | 3.1875 | 3 | [] | no_license | -- phpMyAdmin SQL Dump
-- version 5.0.2
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Aug 09, 2020 at 12:22 PM
-- Server version: 10.4.13-MariaDB
-- PHP Version: 7.4.7
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: `pdo_crud`
--
-- --------------------------------------------------------
--
-- Table structure for table `users`
--
CREATE TABLE `users` (
`id` int(11) NOT NULL,
`first` varchar(15) NOT NULL,
`last` varchar(15) NOT NULL,
`phone` varchar(15) NOT NULL,
`email` varchar(25) NOT NULL,
`gender` varchar(10) NOT NULL,
`age` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `users`
--
INSERT INTO `users` (`id`, `first`, `last`, `phone`, `email`, `gender`, `age`) VALUES
(1, 'Ashik', 'Rahman', '01712327242', 'ashik@gmail.com', 'Male', 23),
(2, 'Asif', 'Mahmud', '018xxxxxxxx', 'asif@gmail.com', 'Male', 22),
(4, 'Kamruzzaman', 'Forhad', '018147xxxxxxx', 'forhad@gmail.com', 'Male', 23),
(8, 'Nahid', 'Aslam', '017xxxxxxxxxxx', 'nahid@yahoo.com', 'Male', 23);
--
-- Indexes for dumped tables
--
--
-- Indexes for table `users`
--
ALTER TABLE `users`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `users`
--
ALTER TABLE `users`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=9;
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
| true |
90d8f20672d7e24af79d4ce3df14c24874daa381 | SQL | Vivovim/perljournals | /SQL CODE/myjournalsJournals.sql | UTF-8 | 1,019 | 2.609375 | 3 | [] | no_license | -- phpMyAdmin SQL Dump
-- version 3.3.9
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Jun 17, 2018 at 06:51 PM
-- Server version: 5.5.20
-- PHP Version: 5.3.10
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: `myjournals`
--
-- --------------------------------------------------------
--
-- Table structure for table `data`
--
CREATE TABLE IF NOT EXISTS `data` (
`recid` int(10) NOT NULL AUTO_INCREMENT,
`date` varchar(255) NOT NULL,
`time` varchar(255) NOT NULL,
`duration` varchar(255) NOT NULL,
`wc` varchar(255) NOT NULL,
`wpm` varchar(255) NOT NULL,
`catagory` varchar(255) NOT NULL,
`subject` varchar(255) NOT NULL,
`body` blob NOT NULL,
`test` int(10) NOT NULL,
PRIMARY KEY (`recid`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
| true |
9550e098585770182a283dd13ba2153b409851f4 | SQL | csaszarhunor/hr_db | /basic_select.sql | UTF-8 | 597 | 3.375 | 3 | [] | no_license | SELECT DISTINCT DEPARTMENT_ID FROM employees;
SELECT * FROM employees GROUP BY FIRST_NAME DESC;
SELECT SUM(SALARY) FROM employees;
SELECT MAX(SALARY), MIN(SALARY) FROM employees;
SELECT AVG(SALARY), COUNT(EMPLOYEE_ID) FROM employees;
SELECT COUNT(EMPLOYEE_ID) FROM employees;
SELECT COUNT(JOB_ID) FROM employees;
SELECT UPPER(FIRST_NAME) FROM employees;
SELECT SUBSTRING(FIRST_NAME, 1, 3) FROM employees;
SELECT CONCAT(FIRST_NAME, " ", LAST_NAME) FROM employees;
SELECT TRIM(FIRST_NAME) FROM employees;
SELECT LENGTH(FIRST_NAME), LENGTH(LAST_NAME) FROM employees;
SELECT * FROM employees LIMIT 10; | true |
f795fb954587e6e3f42022898d8b3f7eb919e885 | SQL | Metro-state/ICS311-group-project | /sql/omdb_sql_queries.sql | UTF-8 | 2,667 | 4 | 4 | [] | no_license | INSERT INTO movies VALUES (1002, 'Frozen', 'Frozen', 1995);
INSERT INTO songs VALUES (2, 'Let it go', 'Let it Go', 'The snow glows white on the mountain tonight. Not a footprint to be seen');
INSERT INTO movie_song VALUES (1002, 2);
INSERT INTO movie_trivia VALUES (1002, 1, 'Blob');
INSERT INTO movie_trivia VALUES (1002, 2, 'Blob 2');
INSERT INTO movie_trivia VALUES (1001, 3, 'Blob 2');
INSERT INTO movie_keywords VALUES (1002, 'let it go');
INSERT INTO movie_keywords VALUES (1002, 'disney');
INSERT INTO movie_keywords VALUES (1002, 'anna');
INSERT INTO movie_media VALUES (1, 'something1.jpeg', 'poster', 1002);
INSERT INTO movie_media VALUES (2, 'something2.jpeg', 'poster', 1002);
INSERT INTO movie_media VALUES (3, 'something3.jpeg', 'poster', 1002);
INSERT INTO movie_media VALUES (4, 'something4.jpeg', 'poster', 1002);
INSERT INTO movie_people VALUES (1002, 1, 'Directory', '');
INSERT INTO movie_people VALUES (1002, 2, 'Lead Actor', '');
-- Query 7.33
SELECT movies.movie_id,
native_name,
english_name,
year_made,
tag_line,
language,
country,
genre,
plot,
(SELECT COUNT(*)
FROM movie_trivia
WHERE movie_id = movies.movie_id
) AS movie_trivia_count,
(SELECT COUNT(*)
FROM movie_keywords
WHERE movie_id = movies.movie_id
) AS movie_keyword_count,
(SELECT COUNT(*)
FROM movie_media
WHERE movie_id = movies.movie_id
) AS movie_media_count,
(SELECT COUNT(*)
FROM songs
LEFT OUTER JOIN movie_song ON (songs.song_id = movie_song.song_id)
WHERE movie_song.movie_id = movies.movie_id
) AS movie_song_count,
(SELECT COUNT(*)
FROM people
LEFT OUTER JOIN movie_people ON (people.people_id = movie_people.people_id)
WHERE movies.movie_id = movie_people.movie_id
) AS movie_people_count
FROM movies
LEFT OUTER JOIN movie_data ON (movies.movie_id = movie_data.movie_id)
WHERE movies.movie_id = 1002;
-- Query 7.37
SELECT *
FROM movies
LEFT OUTER JOIN movie_song ON (movies.movie_id = movie_song.movie_id)
LEFT OUTER JOIN songs ON (movie_song.song_id = songs.song_id)
WHERE movies.english_name = 'Frozen' AND lyrics LIKE '% snow glows %';
-- Query 7.47
SELECT *
FROM movies
INNER JOIN movie_people ON (movies.movie_id = movie_people.movie_id)
WHERE role = 'Lead Actor' AND people_id = 2;
-- Query 7.52: Give me a summary of the song count by the “theme”
SELECT COALESCE(NULLIF(songs.theme, ''), '(This is an empty string)') AS theme_name, COUNT(song_id)
FROM songs
GROUP BY theme;
-- Query 7.55
SELECT *
FROM movies
INNER JOIN movie_data ON (movies.movie_id = movie_data.movie_id)
WHERE movie_data.genre = "Animation";
| true |
7f494f3349dc594ce89b32cbad607906ad89d1bd | SQL | svetlimladenov/Databases-Basics---MS-SQL-Server | /03.Built-in functions/Exercises Built-in functions/Part IV – Date Functions Queries.sql | UTF-8 | 337 | 3.3125 | 3 | [
"MIT"
] | permissive | USE Orders
--Problem 16. Orders Table
SELECT ProductName,
OrderDate,
DATEADD(DAY,3,OrderDate) AS [Pay Due],
DATEADD(MONTH,1,OrderDate) AS [Deliver Due]
FROM Orders
--Problem 17. People Table
CREATE TABLE People (
Id INT IDENTITY PRIMARY KEY,
Name NVARCHAR NOT NULL,
Birthdate DATETIME NOT NULL
)
SELECT * FROM People
| true |
6e4aa78a11e59d97dcab348847dc83d8e09f5819 | SQL | ashwinp94/StudentExercisesP4 | /StudentExercises.sql | UTF-8 | 3,744 | 3.828125 | 4 | [] | no_license | --Create new tables
CREATE TABLE Cohort (
Id INTEGER NOT NULL PRIMARY KEY IDENTITY,
CohortName VARCHAR(55) NOT NULL,
);
CREATE TABLE Exercise (
Id INTEGER NOT NULL PRIMARY KEY IDENTITY,
ExerciseName VARCHAR(55) NOT NULL,
[Language] VARCHAR(55) NOT NULL,
);
CREATE TABLE Student (
Id INTEGER NOT NULL PRIMARY KEY IDENTITY,
FirstName VARCHAR(55) NOT NULL,
LastName VARCHAR(55) NOT NULL,
SlackHandle VARCHAR(55) NOT NULL,
CohortId INTEGER NOT NULL,
CONSTRAINT FK_Student_Cohort FOREIGN KEY(CohortId) REFERENCES Cohort(Id),
);
CREATE TABLE Instructor (
Id INTEGER NOT NULL PRIMARY KEY IDENTITY,
FirstName VARCHAR(55) NOT NULL,
LastName VARCHAR(55) NOT NULL,
SlackHandle VARCHAR(55) NOT NULL,
CohortId INTEGER NOT NULL,
CONSTRAINT FK_Instructor_Cohort FOREIGN KEY(CohortId) REFERENCES Cohort(Id),
);
CREATE TABLE AssignedExercises (
Id INTEGER NOT NULL PRIMARY KEY IDENTITY,
StudentId INTEGER NOT NULL,
ExerciseId INTEGER,
CONSTRAINT FK_AssignedExercises_Exercise FOREIGN KEY(ExerciseId) REFERENCES Exercise(Id),
CONSTRAINT FK_AssignedExercises_Student FOREIGN KEY(StudentId) REFERENCES Student(Id),
);
-- Add some data to the tables
INSERT INTO Cohort (CohortName) VALUES ('Cohort 29');
INSERT INTO Cohort (CohortName) VALUES ('Cohort 30');
INSERT INTO Cohort (CohortName) VALUES ('Cohort 31');
INSERT INTO Exercise(ExerciseName, [Language]) VALUES ('Lists', 'C#');
INSERT INTO Exercise(ExerciseName, [Language]) VALUES ('Dictionary', 'C#');
INSERT INTO Exercise(ExerciseName, [Language]) VALUES ('Ternary Traveler', 'Javascript');
INSERT INTO Exercise(ExerciseName, [Language]) VALUES ('Deleting Data', 'Javascript');
INSERT INTO Exercise(ExerciseName, [Language]) VALUES ('REACT: Conditional Routing', 'REACT');
INSERT INTO Exercise(ExerciseName, [Language]) VALUES ('REACT: URL Routing', 'REACT');
INSERT INTO Student (FirstName, LastName, SlackHandle, CohortId) VALUES ('Ashwin', 'Prakash', 'ashwinp94', 1);
INSERT INTO Student (FirstName, LastName, SlackHandle, CohortId) VALUES ('Mary', 'Remo', 'MaryRemo', 1);
INSERT INTO Student (FirstName, LastName, SlackHandle, CohortId) VALUES ('Brian', 'Neal', 'BrianNeal', 2);
INSERT INTO Student (FirstName, LastName, SlackHandle, CohortId) VALUES ('Ryan', 'Dillinger', 'RyanDillinger', 2);
INSERT INTO Student (FirstName, LastName, SlackHandle, CohortId) VALUES ('Michael', 'Yankura', 'MichaelYankura', 3);
INSERT INTO Student (FirstName, LastName, SlackHandle, CohortId) VALUES ('Chris', 'Morgan', 'ChrisMorgan', 3);
INSERT INTO Instructor (FirstName, LastName, SlackHandle, CohortId) VALUES ('Jisie', 'Davids', 'JisieDavid', 3);
INSERT INTO Instructor (FirstName, LastName, SlackHandle, CohortId) VALUES ('Andy', 'Collins', 'AndyCollins', 1);
INSERT INTO Instructor (FirstName, LastName, SlackHandle, CohortId) VALUES ('Steve', 'Brownlee', 'steve', 2);
INSERT INTO Instructor (FirstName, LastName, SlackHandle, CohortId) VALUES ('Leah', 'Gwin', 'LGwin', 1);
INSERT INTO AssignedExercises(StudentId, ExerciseId) VALUES (1, 1);
INSERT INTO AssignedExercises(StudentId, ExerciseId) VALUES (1, 2);
INSERT INTO AssignedExercises(StudentId, ExerciseId) VALUES (2, 1);
INSERT INTO AssignedExercises(StudentId, ExerciseId) VALUES (2, 2);
INSERT INTO AssignedExercises(StudentId, ExerciseId) VALUES (3, 3);
INSERT INTO AssignedExercises(StudentId, ExerciseId) VALUES (3, 4);
INSERT INTO AssignedExercises(StudentId, ExerciseId) VALUES (4, 3);
INSERT INTO AssignedExercises(StudentId, ExerciseId) VALUES (4, 4);
INSERT INTO AssignedExercises(StudentId, ExerciseId) VALUES (5, 5);
INSERT INTO AssignedExercises(StudentId, ExerciseId) VALUES (5, 6);
INSERT INTO AssignedExercises(StudentId, ExerciseId) VALUES (6, 5);
| true |
e37e84d5850a2a56b699742de7d39ac9e6f4992e | SQL | slezhnev/Financial-ARM | /scripts/old/createRoles.sql | UTF-8 | 534 | 2.515625 | 3 | [] | no_license | CREATE ROLE "armDirectors"
NOSUPERUSER INHERIT NOCREATEDB CREATEROLE;
CREATE ROLE "armUsers"
NOSUPERUSER INHERIT NOCREATEDB NOCREATEROLE;
ALTER DEFAULT PRIVILEGES
GRANT INSERT, SELECT, UPDATE, DELETE, TRUNCATE, REFERENCES, TRIGGER ON TABLES
TO postgres;
ALTER DEFAULT PRIVILEGES
GRANT INSERT, SELECT, UPDATE, DELETE, TRUNCATE, REFERENCES, TRIGGER ON TABLES
TO "armDirectors";
ALTER DEFAULT PRIVILEGES
GRANT INSERT, SELECT, UPDATE, DELETE, TRUNCATE, REFERENCES, TRIGGER ON TABLES
TO "armUsers"; | true |
7371736ec9668c7f56da496939a3f1a2180d4fe6 | SQL | zabir110/Online-Job-Portal | /ww.sql | UTF-8 | 453 | 2.609375 | 3 | [] | no_license | set serveroutput on
declare
f utl_file.file_type;
cursor c1 is select * from selection;
begin
f:=utl_file.fopen('DATABASE','ss.csv','w');
utl_file.put(f,'j'||','||'com'||','||'us');
utl_file.new_line(f);
for record in c1
loop
DBMS_OUTPUT.PUT_LINE (record.job_id || ',' || record.com_name || ',' || record.user_id);
--utl_file.put(f,record.job_id||','||record.com_name||','||record.user_id);
utl_file.new_line(f);
end loop;
end; | true |
d1b0983090e9a67cafab7c460b7ccefc3b74668c | SQL | hsson428/ssac-academy | /workspace/db/new-02.sql | UTF-8 | 2,894 | 4.53125 | 5 | [] | no_license | USE sqldb;
-- 1. 다음과 같은 속성을 가진 NewCustomer 테이블을 생성하시오.
-- custid(고객번호) - INTEGER, 기본키
-- name(이름) – VARCHAR(40)
-- address(주소) – VARCHAR(40)
-- phone(전화번호) – VARCHAR(30)
CREATE TABLE new_customer
(
custid int primary key auto_increment,
custname varchar(40) not null,
address varchar(50) null,
phone varchar(30) null
);
-- 3. 다음과 같은 속성을 가진 NewBook 테이블을 생성하시오.
-- bookid(도서번호)-INTEGER
-- bookname(도서이름)-VARCHAR(20)
-- publisher(출판사)-VARCHAR(20)
-- price(가격)-INTEGER
CREATE TABLE new_book
(
bookid int primary key auto_increment,
bookname varchar(20) not null,
publisher varchar(20) not null,
price int not null
);
-- 2. 다음과 같은 속성을 가진 NewOrders 테이블을 생성하시오.
-- orderid(주문번호) - INTEGER, 기본키
-- custid(고객번호) - INTEGER, NOT NULL 제약조건, 외래키(new_customer.custid, 연쇄삭제)
-- bookid(도서번호) - INTEGER, NOT NULL 제약조건, 외래키(new_book.bookid 연쇄삭제)
-- saleprice(판매가격) - INTEGER
-- orderdate(판매일자) – DATE
-- drop table new_orders;
CREATE TABLE new_orders
(
orderid int primary key auto_increment,
custid int not null,
bookid int not null,
saleprice int not null,
orderdate date null,
constraint fk_orders_to_customer FOREIGN KEY (custid) REFERENCES new_customer(custid),
constraint fk_orders_to_book FOREIGN KEY (bookid) REFERENCES new_book(bookid)
);
-- 4. NewBook 테이블에 VARCHAR(13)의 자료형을 가진 isbn 속성을 추가하시오.
ALTER TABLE new_book
ADD isbn VARCHAR(13) NOT NULL UNIQUE;
-- 5. NewBook 테이블의 isbn 속성의 데이터 타입을 INTEGER형으로 변경하시오.
ALTER TABLE new_book
MODIFY isbn INT NOT NULL;
desc new_book;
-- 6. NewBook 테이블의 isbn 속성을 삭제하시오.
ALTER TABLE new_book
DROP COLUMN isbn;
-- 7. NewBook 테이블의 bookid 속성에 NOT NULL 제약조건을 적용하시오.
-- 8. NewBook 테이블의 bookid 속성을 기본키로 변경하시오.
-- 9. NewBook 테이블을 삭제하시오
-- 만약 삭제가 거절된다면 원인을 파악하고 관련된 테이블을 같이 삭제하시오(NewOrders 테이블이 NewCustomer를 참조하고 있음).
DROP TABLE new_book;
-- 10. NewCustomer 테이블을 삭제하시오.
-- 만약 삭제가 거절된다면 원인을 파악하고 관련된 테이블을 같이 삭제하시오(NewOrders 테이블이 NewCustomer를 참조하고 있음).
DROP TABLE new_customer;
DROP TABLE new_orders;
DROP TABLE new_book;
DROP TABLE new_customer;
use employees;
select * from employees limit 10;
select * from salaries;
select s.*, e.first_name, e.last_name
from employees e, salaries s
where e.emp_no = s.emp_no;
| true |
db08e65351b2cb5c06506dae6aa90da69d00a769 | SQL | erkn50/XoopsCore | /htdocs/modules/page/sql/mysql.sql | UTF-8 | 2,999 | 3.109375 | 3 | [] | no_license | CREATE TABLE `page_content` (
`content_id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`content_title` varchar(255) NOT NULL DEFAULT '',
`content_shorttext` text NOT NULL,
`content_text` text NOT NULL,
`content_create` int(10) NOT NULL DEFAULT '0',
`content_author` int(11) NOT NULL DEFAULT '0',
`content_status` tinyint(1) NOT NULL DEFAULT '0',
`content_hits` int(11) unsigned NOT NULL DEFAULT '0',
`content_rating` double(6,4) NOT NULL DEFAULT '0.0000',
`content_votes` int(11) unsigned NOT NULL DEFAULT '0',
`content_comments` int(11) unsigned NOT NULL DEFAULT '0',
`content_mkeyword` text NOT NULL,
`content_mdescription` text NOT NULL,
`content_maindisplay` tinyint(1) NOT NULL DEFAULT '0',
`content_weight` int(5) NOT NULL DEFAULT '0',
`content_dopdf` tinyint(1) NOT NULL DEFAULT '0',
`content_doprint` tinyint(1) NOT NULL DEFAULT '0',
`content_dosocial` tinyint(1) NOT NULL DEFAULT '0',
`content_doinfo` tinyint(1) NOT NULL DEFAULT '0',
`content_doauthor` tinyint(1) NOT NULL DEFAULT '0',
`content_dodate` tinyint(1) NOT NULL DEFAULT '0',
`content_domail` tinyint(1) NOT NULL DEFAULT '0',
`content_dohits` tinyint(1) NOT NULL DEFAULT '0',
`content_dorating` tinyint(1) NOT NULL DEFAULT '0',
`content_docoms` tinyint(1) NOT NULL DEFAULT '0',
`content_doncoms` tinyint(1) NOT NULL DEFAULT '0',
`content_dotitle` tinyint(1) NOT NULL DEFAULT '0',
`content_donotifications` tinyint(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`content_id`),
KEY `content_title` (`content_title`(250)),
KEY `content_create` (`content_create`),
KEY `content_author` (`content_author`),
KEY `content_status` (`content_status`),
KEY `content_hits` (`content_hits`),
KEY `content_rating` (`content_rating`)
) ENGINE=MyISAM;
CREATE TABLE `page_rating` (
`rating_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`rating_content_id` int(10) unsigned DEFAULT NULL,
`rating_uid` int(10) unsigned DEFAULT NULL,
`rating_rating` int(2) DEFAULT NULL,
`rating_ip` varchar(60) NOT NULL DEFAULT '',
`rating_date` int(10) unsigned DEFAULT NULL,
PRIMARY KEY (`rating_id`),
KEY `rating_content_id` (`rating_content_id`),
KEY `rating_uid` (`rating_uid`)
) ENGINE=MyISAM;
CREATE TABLE `page_related` (
`related_id` int(8) unsigned NOT NULL AUTO_INCREMENT,
`related_name` varchar(255) NOT NULL DEFAULT '',
`related_domenu` tinyint(1) NOT NULL DEFAULT '0',
`related_navigation` tinyint(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`related_id`),
KEY `related_name` (`related_name`(40))
) ENGINE=MyISAM;
CREATE TABLE `page_related_link` (
`link_id` int(8) unsigned NOT NULL AUTO_INCREMENT,
`link_related_id` int(5) unsigned NOT NULL DEFAULT '0',
`link_content_id` int(5) unsigned NOT NULL DEFAULT '0',
`link_weight` int(5) NOT NULL DEFAULT '0',
PRIMARY KEY (`link_id`),
KEY `link_related_id` (`link_related_id`),
KEY `link_content_id` (`link_content_id`)
) ENGINE=MyISAM;
| true |
01e80b294d585f2c971e0862661d3cdba97a76e3 | SQL | silence-do-good/stress-test-Postgres-and-MySQL | /dump/high/day16/select1759.sql | UTF-8 | 178 | 2.65625 | 3 | [] | no_license |
SELECT timeStamp, temperature FROM ThermometerOBSERVATION o
WHERE timestamp>'2017-11-15T17:59:00Z' AND timestamp<'2017-11-16T17:59:00Z' AND temperature>=35 AND temperature<=39
| true |
96fec98581ab806f046f37be164639d3cf95e6d3 | SQL | cha63506/upload-162 | /schema.sql | UTF-8 | 562 | 2.6875 | 3 | [] | no_license | DROP TABLE IF EXISTS `upload_file`;
CREATE TABLE `upload_file` (
`id` int(11) NOT NULL auto_increment,
`token_upload` int(11) NOT NULL,
`token_download` int(11) NOT NULL,
`created` int(11) NOT NULL,
`uploaded` int(11) NOT NULL,
`file` varchar(255) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
DROP TABLE IF EXISTS `upload_token`;
CREATE TABLE `upload_token` (
`id` int(11) NOT NULL auto_increment,
`token` varchar(6) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `token` (`token`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
| true |
384013811c857fdffc2a7d8a52573b08476ae49f | SQL | asv765/aConverter | /aConverterClassLibrary/Resources/StoredProcs/CNV/CNV_CNV_00910_ADDCHARS.sql | UTF-8 | 1,007 | 2.90625 | 3 | [] | no_license | SET TERM ^ ;
create or alter procedure CNV$CNV_00910_ADDCHARS (
NEEDDELETE smallint = 0)
as
BEGIN
IF (needdelete = 1) THEN
DELETE FROM abonentadditionalchars AD where AD.lshet IN (SELECT LSHET FROM cnv$aaddchar);
merge into abonentadditionalchars ad
using cnv$aaddchar ca on ca.lshet = ad.lshet and ca.addcharcd = ad.additionalcharcd
when matched then
update set ad.significance = ca."VALUE"
when not matched then
insert(additionalcharcd, lshet, significance)
values(ca.addcharcd, ca.lshet, ca."VALUE");
END^
SET TERM ; ^
/* Following GRANT statetements are generated automatically */
GRANT SELECT,DELETE ON LCHARSDOUBLEVALUES TO PROCEDURE CNV$CNV_00900_LCHARS;
GRANT SELECT ON CNV$LCHARS TO PROCEDURE CNV$CNV_00900_LCHARS;
GRANT SELECT,INSERT,DELETE ON DOCUMENTS TO PROCEDURE CNV$CNV_00900_LCHARS;
GRANT SELECT,INSERT ON LCHARSABONENTLIST TO PROCEDURE CNV$CNV_00900_LCHARS;
/* Existing privileges on this procedure */
GRANT EXECUTE ON PROCEDURE CNV$CNV_00900_LCHARS TO SYSDBA;
| true |
94ecea1a7057ec8fee8cfce32bd52f81028eae5a | SQL | vivekvppanneerselvam/DTInvoice | /src/resources/sql/db-ddl.sql | UTF-8 | 6,386 | 3.421875 | 3 | [] | no_license | -- ============================
-- This file was created using Derby's dblook utility.
-- Timestamp: 2016-09-23 12:17:00.024
-- Source database is: e:\learning\javafx\fxbilling\database\db
-- Connection URL is: jdbc:derby:e:\learning\javafx\fxbilling\database\db
-- appendLogs: false
-- ----------------------------------------------
-- DDL Statements for schemas
-- ----------------------------------------------
CREATE SCHEMA "DTINVIOCE";
-- ----------------------------------------------
-- DDL Statements for functions
-- ----------------------------------------------
CREATE FUNCTION "APP"."CUSTOMER_OPENING_BALANCE" ("CUSTOMERID" INTEGER) RETURNS DECIMAL(11,2) LANGUAGE JAVA PARAMETER STYLE JAVA READS SQL DATA CALLED ON NULL INPUT EXTERNAL NAME 'fom.dt.storeproc.DBMethods.getCustomerOpeningBalance' ;
CREATE FUNCTION "APP"."CUSTOMER_BALANCE" ("CUSTOMERID" INTEGER,"ENDDATESTRING" CHAR(10)) RETURNS DECIMAL(11,2) LANGUAGE JAVA PARAMETER STYLE JAVA READS SQL DATA CALLED ON NULL INPUT EXTERNAL NAME 'com.dt.storeproc.DBMethods.getCustomerBalance' ;
CREATE FUNCTION "APP"."INVOICE_TOTAL" ("INVOICENUMBER" INTEGER) RETURNS DECIMAL(11,2) LANGUAGE JAVA PARAMETER STYLE JAVA READS SQL DATA CALLED ON NULL INPUT EXTERNAL NAME 'com.dt.storeproc.DBMethods.getInvoiceTotal' ;
-- ----------------------------------------------
-- DDL Statements for tables
-- ----------------------------------------------
CREATE TABLE "APP"."USER_DETAILS" ("USER_ID" VARCHAR(70) NOT NULL, "USER_NAME" VARCHAR(120) NOT NULL, "USER_ROLE" VARCHAR(70) NOT NULL, "PASSWORD" VARCHAR(70) NOT NULL);
CREATE TABLE "APP"."FIRM_DETAILS" ("FIRM_NAME" VARCHAR(70) NOT NULL, "ADDRESS" VARCHAR(120) NOT NULL, "PHONE_NUMBERS" VARCHAR(120), "EMAIL_ADDRESS" VARCHAR(50), "LOGO" BLOB(524288));
CREATE TABLE "APP"."MEASUREMENT_UNITS" ("ID" INTEGER NOT NULL GENERATED ALWAYS AS IDENTITY (START WITH 1, INCREMENT BY 1), "NAME" VARCHAR(40) NOT NULL, "ABBREVIATION" VARCHAR(15));
CREATE TABLE "APP"."CUSTOMERS" ("CUST_ID" INTEGER NOT NULL GENERATED ALWAYS AS IDENTITY (START WITH 1, INCREMENT BY 1), "NAME" VARCHAR(70) NOT NULL, "CITY" VARCHAR(40), "PHONE_NUMBERS" VARCHAR(120), "OPENING_BALANCE" DECIMAL(10,2), "BALANCE_TYPE" CHAR(1));
CREATE TABLE "APP"."ITEMS" ("ID" INTEGER NOT NULL GENERATED ALWAYS AS IDENTITY (START WITH 1, INCREMENT BY 1), "NAME" VARCHAR(150) NOT NULL);
CREATE TABLE "APP"."PAYMENTS" ("ID" INTEGER NOT NULL GENERATED ALWAYS AS IDENTITY (START WITH 1, INCREMENT BY 1), "CUSTOMERID" INTEGER NOT NULL, "PAYMENTDATE" DATE NOT NULL, "AMOUNT" DECIMAL(12,2), "PAYMENTMODE" VARCHAR(20) NOT NULL);
CREATE TABLE "APP"."INVOICES" ("ID" INTEGER NOT NULL GENERATED ALWAYS AS IDENTITY (START WITH 1, INCREMENT BY 1), "INVOICEDATE" DATE NOT NULL, "ISCASHINVOICE" BOOLEAN NOT NULL, "CUSTOMERID" INTEGER, "DISCOUNT" DECIMAL(8,2), "ADDITIONALCHARGE" DECIMAL(8,2));
CREATE TABLE "APP"."INVOICE_ITEMS" ("INVOICE_ID" INTEGER NOT NULL, "ITEM_ID" INTEGER NOT NULL, "RATE" DECIMAL(8,2) NOT NULL, "MEASUREMENT_UNIT" INTEGER NOT NULL, "QUANTITY" DECIMAL(9,3) NOT NULL);
CREATE TABLE "APP"."PAYMENT_DETAILS" ("PAYMENTID" INTEGER NOT NULL, "INSTRUMENTNUMBER" VARCHAR(15) NOT NULL, "INSTRUMENTDATE" DATE NOT NULL, "DRAWANATBANK" VARCHAR(100), "AMOUNTREALISED" BOOLEAN DEFAULT false);
-- ----------------------------------------------
-- DDL Statements for indexes
-- ----------------------------------------------
CREATE INDEX "APP"."IDX_INVOICES_INVOICEDATE" ON "APP"."INVOICES" ("INVOICEDATE");
CREATE INDEX "APP"."IDX_INVOICES_ISCASHINVOICE" ON "APP"."INVOICES" ("ISCASHINVOICE");
CREATE INDEX "APP"."IDX_PAYMENT_DETAILS_AMOUNTREALISED" ON "APP"."PAYMENT_DETAILS" ("AMOUNTREALISED");
CREATE INDEX "APP"."IDX_PAYMENTS_PAYMENTMODE" ON "APP"."PAYMENTS" ("PAYMENTMODE");
CREATE INDEX "APP"."IDX_PAYMENTS_AMOUNT" ON "APP"."PAYMENTS" ("AMOUNT");
CREATE INDEX "APP"."IDX_PAYMENTS_PAYMENTDATE" ON "APP"."PAYMENTS" ("PAYMENTDATE");
-- ----------------------------------------------
-- DDL Statements for keys
-- ----------------------------------------------
-- PRIMARY/UNIQUE
ALTER TABLE "APP"."INVOICES" ADD CONSTRAINT "INVOICES_PK_ID" PRIMARY KEY ("ID");
ALTER TABLE "APP"."CUSTOMERS" ADD CONSTRAINT "SQL160228221537110" PRIMARY KEY ("CUST_ID");
ALTER TABLE "APP"."CUSTOMERS" ADD CONSTRAINT "UNIQUE_NAME" UNIQUE ("NAME");
ALTER TABLE "APP"."MEASUREMENT_UNITS" ADD CONSTRAINT "PK_UOM" PRIMARY KEY ("ID");
ALTER TABLE "APP"."MEASUREMENT_UNITS" ADD CONSTRAINT "UNQ_UOM_NAME" UNIQUE ("NAME");
ALTER TABLE "APP"."ITEMS" ADD CONSTRAINT "ITEMS_PK_ID" PRIMARY KEY ("ID");
ALTER TABLE "APP"."ITEMS" ADD CONSTRAINT "ITEMS_UNQ_NAME" UNIQUE ("NAME");
ALTER TABLE "APP"."PAYMENTS" ADD CONSTRAINT "PAYMENTS_PK_ID" PRIMARY KEY ("ID");
ALTER TABLE "APP"."INVOICE_ITEMS" ADD CONSTRAINT "INVOICE_ITEMS_PK" PRIMARY KEY ("INVOICE_ID", "ITEM_ID");
-- FOREIGN
ALTER TABLE "APP"."INVOICES" ADD CONSTRAINT "INVOICES_FK_CUSTOMERID" FOREIGN KEY ("CUSTOMERID") REFERENCES "APP"."CUSTOMERS" ("CUST_ID") ON DELETE RESTRICT ON UPDATE NO ACTION;
ALTER TABLE "APP"."PAYMENT_DETAILS" ADD CONSTRAINT "PAYMENT_DETAILS_FK_PAYMENTID" FOREIGN KEY ("PAYMENTID") REFERENCES "APP"."PAYMENTS" ("ID") ON DELETE CASCADE ON UPDATE RESTRICT;
ALTER TABLE "APP"."PAYMENTS" ADD CONSTRAINT "PAYMENTS_FK_CUSTOMERID" FOREIGN KEY ("CUSTOMERID") REFERENCES "APP"."CUSTOMERS" ("CUST_ID") ON DELETE RESTRICT ON UPDATE NO ACTION;
ALTER TABLE "APP"."INVOICE_ITEMS" ADD CONSTRAINT "INVOICE_ITEMS_FK_INVOICE_ID" FOREIGN KEY ("INVOICE_ID") REFERENCES "APP"."INVOICES" ("ID") ON DELETE CASCADE ON UPDATE NO ACTION;
ALTER TABLE "APP"."INVOICE_ITEMS" ADD CONSTRAINT "INVOICE_ITEMS_FK_ITEM_ID" FOREIGN KEY ("ITEM_ID") REFERENCES "APP"."ITEMS" ("ID") ON DELETE RESTRICT ON UPDATE NO ACTION;
ALTER TABLE "APP"."INVOICE_ITEMS" ADD CONSTRAINT "INVOICE_ITEMS_FK_UOM" FOREIGN KEY ("MEASUREMENT_UNIT") REFERENCES "APP"."MEASUREMENT_UNITS" ("ID") ON DELETE RESTRICT ON UPDATE NO ACTION;
-- ----------------------------------------------
-- DDL Statements for checks
-- ----------------------------------------------
ALTER TABLE "APP"."CUSTOMERS" ADD CONSTRAINT "VALID_BALANCE_TYPE" CHECK (upper(balance_type) in ('C', 'D'));
ALTER TABLE "APP"."PAYMENTS" ADD CONSTRAINT "PAYMENTS_CK_AMOUNT" CHECK (amount > 0.0);
ALTER TABLE "APP"."PAYMENTS" ADD CONSTRAINT "PAYMENTS_CHECK_PAYMENTMODE" CHECK (lower(paymentMode) in ('cash', 'cheque', 'dd','banktransfer'));
| true |
6b97e59ce83f73080776620d92b0ae6ec042b901 | SQL | nehemiasblanco95/Appsiste | /bd/nldgobmx_beneficiariosdif.sql | UTF-8 | 71,492 | 2.734375 | 3 | [] | no_license | -- phpMyAdmin SQL Dump
-- version 4.5.1
-- http://www.phpmyadmin.net
--
-- Host: 127.0.0.1
-- Generation Time: Nov 30, 2018 at 10:20 PM
-- Server version: 10.1.16-MariaDB
-- PHP Version: 5.6.24
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Database: `nldgobmx_beneficiariosdif`
--
-- --------------------------------------------------------
--
-- Table structure for table `areas`
--
CREATE TABLE `areas` (
`idarea` int(11) NOT NULL,
`nombre` varchar(100) COLLATE utf8_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Dumping data for table `areas`
--
INSERT INTO `areas` (`idarea`, `nombre`) VALUES
(1, 'Jurídico');
-- --------------------------------------------------------
--
-- Table structure for table `codigopostal`
--
CREATE TABLE `codigopostal` (
`idCodigoPostal` int(11) NOT NULL,
`CodigoPostal` varchar(8) CHARACTER SET utf8 COLLATE utf8_spanish_ci DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Dumping data for table `codigopostal`
--
INSERT INTO `codigopostal` (`idCodigoPostal`, `CodigoPostal`) VALUES
(1, '88000'),
(2, '88009'),
(3, '88020'),
(4, '88030'),
(5, '88040'),
(6, '88060'),
(7, '88070'),
(8, '88100'),
(9, '88105'),
(10, '88110'),
(11, '88120'),
(12, '88123'),
(13, '88124'),
(14, '88125'),
(15, '88126'),
(16, '88130'),
(17, '88134'),
(18, '88135'),
(19, '88136'),
(20, '88140'),
(21, '88144'),
(22, '88145'),
(23, '88146'),
(24, '88147'),
(25, '88150'),
(26, '88160'),
(27, '88170'),
(28, '88176'),
(29, '88177'),
(30, '88179'),
(31, '88180'),
(32, '88184'),
(33, '88185'),
(34, '88186'),
(35, '88187'),
(36, '88190'),
(37, '88194'),
(38, '88195'),
(39, '88200'),
(40, '88209'),
(41, '88210'),
(42, '88220'),
(43, '88230'),
(44, '88240'),
(45, '88250'),
(46, '88260'),
(47, '88270'),
(48, '88274'),
(49, '88275'),
(50, '88276'),
(51, '88277'),
(52, '88278'),
(53, '88280'),
(54, '88283'),
(55, '88284'),
(56, '88285'),
(57, '88287'),
(58, '88289'),
(59, '88290'),
(60, '88293'),
(61, '88294'),
(62, '88295'),
(63, '88296'),
(64, '88298'),
(65, '88299'),
(66, '88350');
-- --------------------------------------------------------
--
-- Table structure for table `colonias`
--
CREATE TABLE `colonias` (
`Idcolonia` int(11) NOT NULL,
`IdTipoAsentamiento` int(11) NOT NULL,
`IdCodigoPostal` int(11) NOT NULL,
`idsector` int(11) NOT NULL,
`Colonia` varchar(200) CHARACTER SET utf8 COLLATE utf8_spanish_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Dumping data for table `colonias`
--
INSERT INTO `colonias` (`Idcolonia`, `IdTipoAsentamiento`, `IdCodigoPostal`, `idsector`, `Colonia`) VALUES
(1, 2, 54, 6, '150 Aniversario'),
(2, 5, 1, 6, '1º de Enero'),
(3, 3, 54, 6, '1º de Mayo'),
(4, 3, 17, 6, '20 de Noviembre'),
(5, 5, 1, 6, '5 de Mayo'),
(6, 2, 1, 6, 'Adán de Hoyos'),
(7, 1, 2, 6, 'Aeropuerto (Quetzalcóatl)'),
(8, 5, 64, 6, 'Agrónomos'),
(9, 3, 13, 6, 'Alianza para la producción'),
(10, 5, 61, 6, 'Alijadores'),
(11, 3, 59, 6, 'Alonso Gutiérrez'),
(12, 3, 8, 6, 'AltaVista'),
(13, 5, 60, 6, 'América No. 1'),
(14, 5, 63, 6, 'América No. 2'),
(15, 5, 1, 6, 'América No. 3'),
(16, 5, 65, 6, 'América No. 4'),
(17, 5, 1, 6, 'América No. 5'),
(18, 3, 18, 6, 'Américo Villarreal Guerra'),
(19, 5, 1, 6, 'Ampliación Concordia'),
(20, 5, 1, 6, 'Ampliación el Nogal'),
(21, 3, 1, 6, 'Ampliación Granjas Treviño'),
(22, 5, 1, 6, 'Ampliación Los Encinos'),
(23, 5, 28, 6, 'Ampliación Tercer Milenio'),
(24, 2, 1, 6, 'Ampliación Voluntad y Trabajo III'),
(25, 3, 46, 6, 'Anáhuac'),
(26, 3, 37, 6, 'Anáhuac Sur'),
(27, 3, 30, 6, 'Anexo Reforma Urbana'),
(28, 3, 1, 6, 'Anexo Roma'),
(29, 2, 1, 6, 'Anexo Roma II'),
(30, 3, 1, 6, 'Antiguos Patios y Talleres de F.F.C.C.'),
(31, 3, 29, 6, 'Arturo Cortes Villada'),
(32, 5, 24, 6, 'Ayuntamiento 77'),
(33, 5, 48, 6, 'Balcones del Boulevard'),
(34, 5, 59, 6, 'Balcones del Valle'),
(35, 2, 1, 6, 'Bayito 2'),
(36, 3, 30, 6, 'Bellavista'),
(37, 2, 1, 6, 'Benigna Hernández'),
(38, 3, 30, 6, 'Bertha de Avellano'),
(39, 2, 56, 6, 'Blanca Navidad'),
(40, 5, 50, 6, 'Bonanza'),
(41, 5, 63, 6, 'Bosques del Sur'),
(42, 5, 1, 6, 'Brisas del Lago'),
(43, 3, 11, 6, 'Buenavista'),
(44, 3, 16, 6, 'Buenos Aires'),
(45, 5, 1, 6, 'Bugambilias'),
(46, 3, 53, 6, 'Burócratas'),
(47, 3, 52, 6, 'Campestre'),
(48, 5, 1, 6, 'Campo Real'),
(49, 5, 64, 6, 'Candelario Perales'),
(50, 5, 27, 6, 'Cantaros'),
(51, 5, 48, 6, 'Casa Linda'),
(52, 5, 1, 6, 'Casa Linda II'),
(53, 3, 53, 6, 'Central 2000'),
(54, 6, 1, 6, 'Centro'),
(55, 5, 49, 6, 'Centro Comercial Reforma'),
(56, 3, 23, 6, 'Claudette'),
(57, 5, 53, 6, 'Club de Leones'),
(58, 3, 8, 6, 'CNOP'),
(59, 5, 65, 6, 'Colinas de San Javier'),
(60, 5, 1, 6, 'Colinas del Arroyo Seco'),
(61, 5, 51, 6, 'Colinas del Sur'),
(62, 5, 57, 6, 'Comunidad de Viviendas Unidas'),
(63, 3, 51, 6, 'Concordia'),
(64, 3, 29, 6, 'Constitucional 1 y 2'),
(65, 5, 12, 6, 'Cumbres'),
(66, 3, 29, 6, 'Daniel Covarrubias'),
(67, 3, 10, 6, 'Del Maestro'),
(68, 5, 56, 6, 'Del Valle'),
(69, 5, 58, 6, 'Don Ramón Salcido'),
(70, 5, 1, 6, 'Echegaray'),
(71, 5, 50, 6, 'Edén Country Villas'),
(72, 4, 28, 6, 'El Bayito'),
(73, 5, 56, 6, 'El Campanario'),
(74, 3, 60, 6, 'El Caporal'),
(75, 3, 62, 6, 'El Capulín'),
(76, 5, 23, 6, 'El Caracol'),
(77, 5, 50, 6, 'El Cortijo'),
(78, 5, 50, 6, 'El Edén'),
(79, 5, 28, 6, 'El Francés y Buenos Aires'),
(80, 5, 59, 6, 'El Nogal'),
(81, 5, 60, 6, 'El Pedregal Residencial'),
(82, 4, 12, 6, 'El Progreso'),
(83, 5, 29, 6, 'El Progreso'),
(84, 3, 25, 6, 'El Remolino'),
(85, 5, 53, 6, 'El Río'),
(86, 3, 62, 6, 'El Triunfo'),
(87, 5, 57, 6, 'Electricistas'),
(88, 3, 21, 6, 'Emiliano Zapata'),
(89, 3, 55, 6, 'Emiliano Zapata II'),
(90, 3, 62, 6, 'Enrique Cárdenas González'),
(91, 3, 5, 6, 'Ferrocarril'),
(92, 3, 53, 6, 'Ferrocarrilera'),
(93, 3, 55, 6, 'Francisco Villa'),
(94, 3, 54, 6, 'Francisco Villa 2'),
(95, 3, 46, 6, 'González'),
(96, 5, 50, 6, 'Gran Boulevard'),
(97, 3, 1, 6, 'Granjas Económicas'),
(98, 3, 62, 6, 'Granjas Económicas 1'),
(99, 3, 62, 6, 'Granjas Económicas 2'),
(100, 3, 60, 6, 'Granjas Guzmán'),
(101, 3, 62, 6, 'Granjas Regina'),
(102, 3, 61, 6, 'Granjas Treviño'),
(103, 5, 1, 6, 'Guardiola'),
(104, 3, 44, 6, 'Guerrero'),
(105, 3, 12, 6, 'Guerreros del Sol'),
(106, 5, 59, 6, 'Hacienda de la Concordia'),
(107, 5, 41, 6, 'Hacienda J. Longoria'),
(108, 5, 62, 6, 'Haciendas de San Agustín'),
(109, 3, 26, 6, 'Hidalgo'),
(110, 3, 27, 6, 'Hipódromo'),
(111, 3, 3, 6, 'Independencia'),
(112, 2, 1, 6, 'Independencia Nacional'),
(113, 5, 49, 6, 'INFONAVIT Fundadores'),
(114, 2, 56, 6, 'Insurgentes'),
(115, 5, 62, 6, 'ITAVU'),
(116, 3, 46, 6, 'Jardín'),
(117, 3, 20, 6, 'Jardín Juvencia'),
(118, 5, 51, 6, 'Jardines de la Hacienda'),
(119, 5, 1, 6, 'Jardines de Oradel'),
(120, 3, 45, 6, 'Jesús García'),
(121, 3, 40, 6, 'Juárez'),
(122, 3, 43, 6, 'Junta Federal de Mejoras Materiales'),
(123, 3, 64, 6, 'La Concordia'),
(124, 4, 66, 6, 'La Cruz'),
(125, 3, 38, 6, 'La Esperanza'),
(126, 5, 35, 6, 'La Fe'),
(127, 5, 1, 6, 'La Fe II'),
(128, 3, 14, 6, 'La Joya'),
(129, 5, 29, 6, 'La Nueva Victoria'),
(130, 3, 59, 6, 'La Paz'),
(131, 3, 30, 6, 'La Sandía'),
(132, 5, 59, 6, 'Lagos'),
(133, 5, 49, 6, 'Las Alamedas'),
(134, 5, 1, 6, 'Las Alamedas II'),
(135, 3, 21, 6, 'Las Alazanas'),
(136, 5, 30, 6, 'Las Arboledas'),
(137, 5, 47, 6, 'Las Flores'),
(138, 5, 24, 6, 'Las Lomas'),
(139, 5, 62, 6, 'Las Piedritas'),
(140, 5, 25, 6, 'Las Tinajitas'),
(141, 3, 32, 6, 'Las Torres'),
(142, 5, 51, 6, 'Las Viñas'),
(143, 5, 48, 6, 'Lic. Benito Juárez'),
(144, 3, 13, 6, 'Lic. Daniel Hernández Isais'),
(145, 3, 17, 6, 'Lic. Luis Donaldo Colosio'),
(146, 3, 38, 6, 'Loma Bonita'),
(147, 5, 41, 6, 'Lomas del Poniente'),
(148, 3, 63, 6, 'Lomas del Popo'),
(149, 5, 22, 6, 'Lomas del Rey'),
(150, 5, 30, 6, 'Lomas del Rio Bravo'),
(151, 2, 56, 6, 'Lomas del Rosario'),
(152, 5, 63, 6, 'Los Agaves'),
(153, 3, 47, 6, 'Los Álamos'),
(154, 5, 56, 6, 'Los Ángeles'),
(155, 3, 12, 6, 'Los Arcos'),
(156, 2, 30, 6, 'Los Artistas'),
(157, 2, 1, 6, 'Los Artistas II'),
(158, 5, 59, 6, 'Los Aztecas'),
(159, 5, 59, 6, 'Los Encinos'),
(160, 5, 59, 6, 'Los Fresnos'),
(161, 5, 21, 6, 'Los Garza'),
(162, 5, 59, 6, 'Los Presidentes'),
(163, 5, 29, 6, 'Los Sánchez'),
(164, 5, 11, 6, 'Maclovio Herrera'),
(165, 3, 47, 6, 'Madero'),
(166, 3, 55, 6, 'Manuel Cavazos Lerma'),
(167, 5, 28, 6, 'María Luisa'),
(168, 3, 41, 6, 'Matamoros'),
(169, 5, 1, 6, 'Media Luna'),
(170, 3, 53, 6, 'México'),
(171, 3, 44, 6, 'Mier y Terán'),
(172, 4, 66, 6, 'Miguel Alemán (El Carrizo)'),
(173, 3, 58, 6, 'Militar'),
(174, 3, 20, 6, 'Militar II'),
(175, 3, 36, 6, 'Mirador'),
(176, 5, 63, 6, 'Misión de San Mauricio'),
(177, 3, 45, 6, 'Morelos'),
(178, 2, 29, 6, 'Naciones Unidas'),
(179, 3, 19, 6, 'Nueva Era'),
(180, 3, 22, 6, 'Nueva España'),
(181, 5, 5, 6, 'Ojo Caliente'),
(182, 2, 29, 6, 'Othón Chávez'),
(183, 3, 42, 6, 'Palacios'),
(184, 5, 49, 6, 'Parque Industrial FINSA'),
(185, 5, 33, 6, 'Parque Industrial Los 2 Laredo'),
(186, 5, 27, 6, 'Parque Industrial O. Longoria'),
(187, 5, 48, 6, 'Parque Industrial Rio Bravo'),
(188, 5, 34, 6, 'Parque Industrial Rio Grande'),
(189, 5, 51, 6, 'Parque Modulo Industrial Américas'),
(190, 5, 56, 6, 'Parque Oradel'),
(191, 3, 1, 6, 'Patios de F.F.C.C.'),
(192, 5, 12, 6, 'Pavorreales'),
(193, 3, 60, 6, 'Pedregal'),
(194, 3, 20, 6, 'Peña Benavides'),
(195, 3, 44, 6, 'Postal'),
(196, 2, 29, 6, 'Praderas del Mezquital'),
(197, 5, 49, 6, 'Privanzas'),
(198, 5, 1, 6, 'Proyecto Luz'),
(199, 5, 1, 6, 'Puerta de Hierro'),
(200, 3, 28, 6, 'Recinto Fiscal'),
(201, 3, 30, 6, 'Reforma Urbana'),
(202, 5, 51, 6, 'Residencial Longoria'),
(203, 3, 44, 6, 'Riberas del Bravo'),
(204, 5, 48, 6, 'Río Bravo'),
(205, 3, 25, 6, 'Roma'),
(206, 3, 1, 6, 'Roma II'),
(207, 3, 31, 6, 'Rosita'),
(208, 5, 21, 6, 'San Andrés'),
(209, 3, 43, 6, 'San José'),
(210, 3, 39, 6, 'San Rafael'),
(211, 2, 1, 6, 'San Roberto'),
(212, 5, 48, 6, 'Santa Anita'),
(213, 5, 61, 6, 'Santa Cecilia'),
(214, 5, 59, 6, 'Santa Elena'),
(215, 5, 1, 6, 'Santa Eugenia'),
(216, 5, 59, 6, 'Santa Martha'),
(217, 3, 15, 6, 'Santiago M. Beldén'),
(218, 3, 43, 6, 'Sistema de Agua y Saneamiento'),
(219, 3, 14, 6, 'Sistema Merlín'),
(220, 5, 9, 6, 'Solidaridad'),
(221, 5, 1, 6, 'Solidaridad II'),
(222, 3, 57, 6, 'SUTERM I'),
(223, 3, 47, 6, 'SUTERM II'),
(224, 3, 22, 6, 'Tamaulipas'),
(225, 5, 28, 6, 'Tercer Milenio'),
(226, 5, 1, 6, 'Tierra Cruz'),
(227, 5, 29, 6, 'Toboganes'),
(228, 5, 59, 6, 'Tulipanes'),
(229, 3, 18, 6, 'Unidad Nacional'),
(230, 3, 37, 6, 'Unión'),
(231, 3, 28, 6, 'Unión Del Recuerdo'),
(232, 5, 62, 6, 'Valle Dorado'),
(233, 5, 62, 6, 'Valle Elizondo'),
(234, 5, 50, 6, 'Valle Real'),
(235, 5, 56, 6, 'Valles de Anáhuac'),
(236, 5, 60, 6, 'Valles del Paraíso'),
(237, 5, 62, 6, 'Vamos Tamaulipas'),
(238, 3, 54, 6, 'Vamos Tamaulipas'),
(239, 3, 15, 6, 'Vicente Mendoza'),
(240, 3, 4, 6, 'Victoria'),
(241, 5, 59, 6, 'Villa del Lago'),
(242, 5, 59, 6, 'Villas de la Concordia'),
(243, 5, 18, 6, 'Villas de la Fe'),
(244, 5, 12, 6, 'Villas de San Francisco'),
(245, 5, 54, 6, 'Villas de San Miguel'),
(246, 5, 56, 6, 'Villas del Oradel'),
(247, 5, 12, 6, 'Villas del Progreso'),
(248, 5, 45, 6, 'Villas del Sol'),
(249, 3, 22, 6, 'Virreyes'),
(250, 5, 48, 6, 'Vista Hermosa'),
(251, 3, 7, 6, 'Viveros'),
(252, 3, 29, 6, 'Voluntad y Trabajo'),
(253, 3, 1, 6, 'Voluntad y Trabajo III'),
(254, 3, 1, 6, 'Voluntad y Trabajo IV'),
(255, 3, 6, 6, 'Zaragoza'),
(256, 5, 38, 6, 'Zona de Tolerancia'),
(257, 2, 3, 6, 'NA');
-- --------------------------------------------------------
--
-- Stand-in structure for view `estudios_paginado`
--
CREATE TABLE `estudios_paginado` (
`folio` varchar(50)
,`solicitante` varchar(302)
,`idarea` int(11)
,`area` varchar(100)
);
-- --------------------------------------------------------
--
-- Table structure for table `estudio_socioeconomico`
--
CREATE TABLE `estudio_socioeconomico` (
`idestudio_socioeconomico` int(55) NOT NULL,
`folio` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
`fecha_nacimiento` datetime NOT NULL,
`idarea` int(11) NOT NULL,
`nombre` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
`paterno` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
`materno` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
`edad` int(3) NOT NULL,
`ine` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
`curp` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
`calle` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
`numero` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
`entre_calles` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
`idcolonia` varchar(11) COLLATE utf8_unicode_ci NOT NULL,
`referencia` varchar(200) COLLATE utf8_unicode_ci NOT NULL,
`nacimiento_localidad` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
`nacimiento_municipio` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
`entidad` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
`pais` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
`idestado_civil` int(11) NOT NULL,
`leer_escribir` int(1) NOT NULL,
`escolaridad` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
`discapacidad` int(1) NOT NULL,
`discapacidad_especifique` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
`telefono` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
`telefono_familia` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
`celular` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
`personas_sueldo` varchar(10) COLLATE utf8_unicode_ci NOT NULL,
`sueldo_mensual_familiar` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
`pago_agua` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
`pago_luz` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
`pago_comida` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
`pago_ropa` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
`pago_pasajes` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
`pago_renta` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
`pago_medicamentos` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
`pago_estudios` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
`pago_otros_gastos` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
`fuente_ingresos` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
`monto_mensual` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
`fuente_ingresos_otro` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
`monto_mensual_otro` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
`seguro_especifique` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
`huerto_familiar` int(1) NOT NULL,
`idtipo_apoyo` int(11) NOT NULL,
`observaciones` varchar(500) COLLATE utf8_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `es_beneficiarios`
--
CREATE TABLE `es_beneficiarios` (
`ides_beneficiario` int(55) NOT NULL,
`idestudio_socioeconomico` int(55) NOT NULL,
`nombre` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
`paterno` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
`materno` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
`fecha_n` datetime NOT NULL,
`edad` int(3) NOT NULL,
`curp` varchar(18) COLLATE utf8_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `es_respuestas`
--
CREATE TABLE `es_respuestas` (
`ides_respuesta` int(255) NOT NULL,
`idestudio_socioeconomico` int(255) NOT NULL,
`idpregunta` int(25) NOT NULL,
`idrespuesta` int(25) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `preguntas`
--
CREATE TABLE `preguntas` (
`idpregunta` int(25) NOT NULL,
`idseccion` int(25) NOT NULL,
`pregunta` varchar(200) COLLATE utf8_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Dumping data for table `preguntas`
--
INSERT INTO `preguntas` (`idpregunta`, `idseccion`, `pregunta`) VALUES
(1, 1, 'Seguro Médico:'),
(2, 2, 'Su vivienda es:'),
(3, 2, 'Muros:'),
(4, 2, 'Techos:'),
(5, 2, 'Pisos:'),
(6, 2, 'Vivienda cuenta con:'),
(7, 2, 'En esta vivienda el agua para beber es de:'),
(8, 2, 'Esta vivienda tiene drenaje o desagüe conectado a:'),
(9, 2, 'Esta vivienda obtiene luz de:'),
(10, 3, 'Su hogar cuenta con:'),
(11, 3, 'Combustible que utiliza para cocinar:');
-- --------------------------------------------------------
--
-- Table structure for table `respuestas`
--
CREATE TABLE `respuestas` (
`idrespuesta` int(25) NOT NULL,
`idpregunta` int(25) NOT NULL,
`respuesta` varchar(100) COLLATE utf8_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Dumping data for table `respuestas`
--
INSERT INTO `respuestas` (`idrespuesta`, `idpregunta`, `respuesta`) VALUES
(118, 1, 'IMSS'),
(119, 1, 'ISSTE'),
(120, 1, 'Seguro Popular'),
(121, 1, 'PEMEX'),
(122, 1, 'Otro'),
(123, 2, 'Propia'),
(124, 2, 'Rentada'),
(125, 2, 'Prestada'),
(126, 2, 'Como prestación de un trabajo'),
(127, 3, 'Lámina'),
(128, 3, 'Madera'),
(129, 3, 'Block'),
(130, 3, 'Ladrillo'),
(131, 3, 'Cartón'),
(132, 3, 'Hule'),
(133, 4, 'Lámina'),
(134, 4, 'Teja'),
(135, 4, 'Cemento'),
(136, 4, 'Cartón'),
(137, 4, 'Hule'),
(138, 4, 'Madera'),
(139, 5, 'Tierra'),
(140, 5, 'Cemento Firme'),
(141, 5, 'Mosaico'),
(142, 5, 'Madera'),
(143, 6, 'Cuartos'),
(144, 6, 'Comedor'),
(145, 6, 'Sala'),
(146, 6, 'Cocina'),
(147, 6, 'Regadera'),
(148, 6, 'Letrina'),
(149, 6, 'Pasillo'),
(150, 6, 'Patio'),
(151, 6, 'Cochera'),
(152, 6, 'Sanitario'),
(153, 6, 'Cuarto de Servicio'),
(154, 7, 'Red pública dentro de la vivienda'),
(155, 7, 'Entubada en el terreno'),
(156, 7, 'Llave Pública'),
(157, 7, 'De otra vivienda'),
(158, 7, 'Una pipa'),
(159, 7, 'Comprada en garrafón'),
(160, 8, 'Red pública'),
(161, 8, 'Fosa séptica'),
(162, 8, 'No tiene drenaje'),
(163, 9, 'Energía Eléctrica'),
(164, 9, 'Celda Solar'),
(165, 9, 'Lámpara de baterías'),
(166, 9, 'Velas o veladoras'),
(175, 10, 'Lavadora'),
(176, 10, 'Refrigerador'),
(177, 10, 'Cama'),
(178, 10, 'Estufa'),
(179, 10, 'T.V.'),
(180, 10, 'Radio'),
(181, 10, 'Computadora'),
(182, 10, 'Internet'),
(183, 10, 'Línea Telefónica'),
(184, 10, 'Celular'),
(185, 10, 'VHS o DVD'),
(186, 10, 'Boiler'),
(187, 10, 'Automóvil'),
(188, 10, 'Camioneta'),
(189, 11, 'Leña'),
(190, 11, 'Carbón'),
(191, 11, 'Gas'),
(192, 11, 'Parrilla Eléctrica'),
(193, 11, 'Papel o cartón');
-- --------------------------------------------------------
--
-- Table structure for table `roles`
--
CREATE TABLE `roles` (
`idrol` int(11) NOT NULL,
`rol` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
`config` int(1) NOT NULL,
`reportes` int(1) NOT NULL,
`activo` int(1) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Dumping data for table `roles`
--
INSERT INTO `roles` (`idrol`, `rol`, `config`, `reportes`, `activo`) VALUES
(1, 'ADMINISTRADOR', 1, 1, 1),
(2, 'JEFE DE AREA', 1, 1, 1),
(3, 'CAPTURISTA', 0, 0, 1);
-- --------------------------------------------------------
--
-- Table structure for table `secciones`
--
CREATE TABLE `secciones` (
`idseccion` int(25) NOT NULL,
`nombre` varchar(200) COLLATE utf8_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Dumping data for table `secciones`
--
INSERT INTO `secciones` (`idseccion`, `nombre`) VALUES
(1, 'DATOS GENERALES'),
(2, 'CARACTERÍSTICAS Y SERVICIOS CON LOS QUE CUENTA LA VIVIENDA'),
(3, 'EQUIPAMIENTO DE LA VIVIENDA');
-- --------------------------------------------------------
--
-- Table structure for table `tipo_asentamiento`
--
CREATE TABLE `tipo_asentamiento` (
`IdTipoAsentamiento` int(11) NOT NULL,
`TipoAsentamiento` varchar(50) CHARACTER SET utf8 COLLATE utf8_spanish_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Dumping data for table `tipo_asentamiento`
--
INSERT INTO `tipo_asentamiento` (`IdTipoAsentamiento`, `TipoAsentamiento`) VALUES
(1, 'Aeropuerto'),
(2, 'Asentamiento Irregular'),
(3, 'Colonia'),
(4, 'Ejido'),
(5, 'Fraccionamiento'),
(6, 'Sector');
-- --------------------------------------------------------
--
-- Table structure for table `usuarios`
--
CREATE TABLE `usuarios` (
`idusuario` int(50) NOT NULL,
`nombre` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
`correo` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
`password` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
`idrol` int(1) NOT NULL,
`activo` int(1) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Dumping data for table `usuarios`
--
INSERT INTO `usuarios` (`idusuario`, `nombre`, `correo`, `password`, `idrol`, `activo`) VALUES
(2, 'admin', 'admin@correo.com', '21232f297a57a5a743894a0e4a801fc3', 1, 1);
-- --------------------------------------------------------
--
-- Stand-in structure for view `view_estudios_paginado`
--
CREATE TABLE `view_estudios_paginado` (
`folio` varchar(50)
,`solicitante` varchar(302)
,`idarea` int(11)
,`area` varchar(100)
);
-- --------------------------------------------------------
--
-- Table structure for table `ws_access`
--
CREATE TABLE `ws_access` (
`id` int(11) UNSIGNED NOT NULL,
`key` varchar(40) CHARACTER SET utf8 NOT NULL DEFAULT '',
`all_access` tinyint(1) NOT NULL DEFAULT '0',
`controller` varchar(50) CHARACTER SET utf8 NOT NULL DEFAULT '',
`date_created` datetime DEFAULT NULL,
`date_modified` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Dumping data for table `ws_access`
--
INSERT INTO `ws_access` (`id`, `key`, `all_access`, `controller`, `date_created`, `date_modified`) VALUES
(3, 'dc176c2d6fc496288e6ee81e35c8ffe3', 0, '/Beneficiarios', '2018-02-02 00:00:00', '2018-11-23 20:21:07');
-- --------------------------------------------------------
--
-- Table structure for table `ws_keys`
--
CREATE TABLE `ws_keys` (
`id` int(11) NOT NULL,
`user_id` int(11) NOT NULL,
`key` varchar(40) CHARACTER SET utf8 NOT NULL,
`level` int(2) NOT NULL,
`ignore_limits` tinyint(1) NOT NULL DEFAULT '0',
`is_private_key` tinyint(1) NOT NULL DEFAULT '0',
`ip_addresses` text CHARACTER SET utf8,
`date_created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Dumping data for table `ws_keys`
--
INSERT INTO `ws_keys` (`id`, `user_id`, `key`, `level`, `ignore_limits`, `is_private_key`, `ip_addresses`, `date_created`) VALUES
(1, 1, 'dc176c2d6fc496288e6ee81e35c8ffe3', 1, 0, 0, NULL, '2018-01-29 12:16:47');
-- --------------------------------------------------------
--
-- Table structure for table `ws_logs`
--
CREATE TABLE `ws_logs` (
`id` int(11) NOT NULL,
`uri` varchar(255) CHARACTER SET utf8 NOT NULL,
`method` varchar(6) CHARACTER SET utf8 NOT NULL,
`params` text CHARACTER SET utf8,
`api_key` varchar(40) CHARACTER SET utf8 NOT NULL,
`ip_address` varchar(45) CHARACTER SET utf8 NOT NULL,
`time` int(11) NOT NULL,
`rtime` float DEFAULT NULL,
`authorized` varchar(1) CHARACTER SET utf8 NOT NULL,
`response_code` smallint(3) DEFAULT '0',
`fecha` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Dumping data for table `ws_logs`
--
INSERT INTO `ws_logs` (`id`, `uri`, `method`, `params`, `api_key`, `ip_address`, `time`, `rtime`, `authorized`, `response_code`, `fecha`) VALUES
(789, 'Beneficiarios/login', 'get', '{"Host":"localhost","Connection":"keep-alive","Upgrade-Insecure-Requests":"1","User-Agent":"Mozilla\\/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit\\/537.36 (KHTML, like Gecko) Chrome\\/70.0.3538.102 Safari\\/537.36","Accept":"text\\/html,application\\/xhtml+xml,application\\/xml;q=0.9,image\\/webp,image\\/apng,*\\/*;q=0.8","Accept-Encoding":"gzip, deflate, br","Accept-Language":"en-US,en;q=0.9,es;q=0.8","Cookie":"_ga=GA1.1.1220884428.1523629369; ciNav=no; _gauges_unique_year=1; _gauges_unique=1","X-Hola-Unblocker-Bext":"reqid 171303: before request, vpn is not allowed, send headers","X-Hola-Request-Id":"171303"}', '', '::1', 1543003238, 0.0243351, '0', 403, '2018-11-23 20:00:38'),
(790, 'Beneficiarios/login', 'get', '{"Host":"localhost","Connection":"keep-alive","Upgrade-Insecure-Requests":"1","User-Agent":"Mozilla\\/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit\\/537.36 (KHTML, like Gecko) Chrome\\/70.0.3538.102 Safari\\/537.36","Accept":"text\\/html,application\\/xhtml+xml,application\\/xml;q=0.9,image\\/webp,image\\/apng,*\\/*;q=0.8","Accept-Encoding":"gzip, deflate, br","Accept-Language":"en-US,en;q=0.9,es;q=0.8","Cookie":"_ga=GA1.1.1220884428.1523629369; ciNav=no; _gauges_unique_year=1; _gauges_unique=1","X-Hola-Unblocker-Bext":"reqid 176567: before request, vpn is not allowed, send headers","X-Hola-Request-Id":"176567"}', '', '::1', 1543004011, 0.0369101, '0', 403, '2018-11-23 20:13:31'),
(791, 'Beneficiarios/login', 'post', '{"Host":"localhost","Connection":"keep-alive","Content-Length":"48","Pragma":"no-cache","Cache-Control":"no-cache","Accept":"application\\/json, text\\/plain, *\\/*","Origin":"http:\\/\\/localhost:4200","Authorization":"null","beneficiarios":"dc176c2d6fc496288e6ee81e35c8ffe3","User-Agent":"Mozilla\\/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit\\/537.36 (KHTML, like Gecko) Chrome\\/70.0.3538.102 Safari\\/537.36","Content-Type":"application\\/json","Referer":"http:\\/\\/localhost:4200\\/","Accept-Encoding":"gzip, deflate, br","Accept-Language":"en-US,en;q=0.9,es;q=0.8","X-Hola-Unblocker-Bext":"reqid 178296: before request, vpn is not allowed, send headers","X-Hola-Request-Id":"178296","correo":"admin@correo.com","password":"admin"}', '', '::1', 1543004226, 0.035753, '0', 403, '2018-11-23 20:17:06'),
(792, 'Beneficiarios/login', 'post', '{"Host":"localhost","Connection":"keep-alive","Content-Length":"48","Pragma":"no-cache","Cache-Control":"no-cache","Accept":"application\\/json, text\\/plain, *\\/*","Origin":"http:\\/\\/localhost:4200","Authorization":"null","beneficiarios":"dc176c2d6fc496288e6ee81e35c8ffe3","User-Agent":"Mozilla\\/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit\\/537.36 (KHTML, like Gecko) Chrome\\/70.0.3538.102 Safari\\/537.36","Content-Type":"application\\/json","Referer":"http:\\/\\/localhost:4200\\/","Accept-Encoding":"gzip, deflate, br","Accept-Language":"en-US,en;q=0.9,es;q=0.8","X-Hola-Unblocker-Bext":"reqid 180120: before request, vpn is not allowed, send headers","X-Hola-Request-Id":"180120","correo":"admin@correo.com","password":"admin"}', '', '::1', 1543004491, 0.0373318, '0', 403, '2018-11-23 20:21:31'),
(793, 'Beneficiarios/login', 'get', '{"Host":"localhost","Connection":"keep-alive","Upgrade-Insecure-Requests":"1","User-Agent":"Mozilla\\/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit\\/537.36 (KHTML, like Gecko) Chrome\\/70.0.3538.102 Safari\\/537.36","Accept":"text\\/html,application\\/xhtml+xml,application\\/xml;q=0.9,image\\/webp,image\\/apng,*\\/*;q=0.8","Accept-Encoding":"gzip, deflate, br","Accept-Language":"en-US,en;q=0.9,es;q=0.8","Cookie":"_ga=GA1.1.1220884428.1523629369; ciNav=no; _gauges_unique_year=1; _gauges_unique=1","X-Hola-Unblocker-Bext":"reqid 180203: before request, vpn is not allowed, send headers","X-Hola-Request-Id":"180203"}', '', '::1', 1543004502, 0.0369282, '0', 403, '2018-11-23 20:21:42'),
(794, 'Beneficiarios/login', 'post', '{"Host":"localhost","Connection":"keep-alive","Content-Length":"48","Pragma":"no-cache","Cache-Control":"no-cache","Accept":"application\\/json, text\\/plain, *\\/*","Origin":"http:\\/\\/localhost:4200","Authorization":"null","beneficiarios":"dc176c2d6fc496288e6ee81e35c8ffe3","User-Agent":"Mozilla\\/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit\\/537.36 (KHTML, like Gecko) Chrome\\/70.0.3538.102 Safari\\/537.36","Content-Type":"application\\/json","Referer":"http:\\/\\/localhost:4200\\/","Accept-Encoding":"gzip, deflate, br","Accept-Language":"en-US,en;q=0.9,es;q=0.8","X-Hola-Unblocker-Bext":"reqid 181408: before request, vpn is not allowed, send headers","X-Hola-Request-Id":"181408","correo":"admin@correo.com","password":"admin"}', '', '::1', 1543004687, 0.03654, '0', 403, '2018-11-23 20:24:47'),
(795, 'Beneficiarios/login', 'post', '{"Host":"localhost","Connection":"keep-alive","Content-Length":"48","Pragma":"no-cache","Cache-Control":"no-cache","Accept":"application\\/json, text\\/plain, *\\/*","Origin":"http:\\/\\/localhost:4200","Authorization":"null","beneficiarios":"dc176c2d6fc496288e6ee81e35c8ffe3","User-Agent":"Mozilla\\/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit\\/537.36 (KHTML, like Gecko) Chrome\\/70.0.3538.102 Safari\\/537.36","Content-Type":"application\\/json","Referer":"http:\\/\\/localhost:4200\\/","Accept-Encoding":"gzip, deflate, br","Accept-Language":"en-US,en;q=0.9,es;q=0.8","X-Hola-Unblocker-Bext":"reqid 182539: before request, vpn is not allowed, send headers","X-Hola-Request-Id":"182539","correo":"admin@correo.com","password":"admin"}', '', '::1', 1543004850, 0.0252099, '0', 403, '2018-11-23 20:27:30'),
(796, 'Beneficiarios/login', 'post', '{"Host":"localhost","Connection":"keep-alive","Content-Length":"48","Pragma":"no-cache","Cache-Control":"no-cache","Accept":"application\\/json, text\\/plain, *\\/*","Origin":"http:\\/\\/localhost:4200","Authorization":"null","beneficiarios":"dc176c2d6fc496288e6ee81e35c8ffe3","User-Agent":"Mozilla\\/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit\\/537.36 (KHTML, like Gecko) Chrome\\/70.0.3538.102 Safari\\/537.36","Content-Type":"application\\/json","Referer":"http:\\/\\/localhost:4200\\/","Accept-Encoding":"gzip, deflate, br","Accept-Language":"en-US,en;q=0.9,es;q=0.8","X-Hola-Unblocker-Bext":"reqid 185488: before request, vpn is not allowed, send headers","X-Hola-Request-Id":"185488","correo":"admin@correo.com","password":"admin"}', '', '::1', 1543005201, 0.037488, '0', 403, '2018-11-23 20:33:21'),
(797, 'Beneficiarios/login', 'post', '{"Host":"localhost","Connection":"keep-alive","Content-Length":"48","Pragma":"no-cache","Cache-Control":"no-cache","Accept":"application\\/json, text\\/plain, *\\/*","Origin":"http:\\/\\/localhost:4200","Authorization":"null","beneficiarios":"dc176c2d6fc496288e6ee81e35c8ffe3","User-Agent":"Mozilla\\/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit\\/537.36 (KHTML, like Gecko) Chrome\\/70.0.3538.102 Safari\\/537.36","Content-Type":"application\\/json","Referer":"http:\\/\\/localhost:4200\\/","Accept-Encoding":"gzip, deflate, br","Accept-Language":"en-US,en;q=0.9,es;q=0.8","X-Hola-Unblocker-Bext":"reqid 186359: before request, vpn is not allowed, send headers","X-Hola-Request-Id":"186359","correo":"admin@correo.com","password":"admin"}', 'dc176c2d6fc496288e6ee81e35c8ffe3', '::1', 1543005331, 0.039974, '1', 401, '2018-11-23 20:35:31'),
(798, 'Beneficiarios/login', 'post', '{"Host":"localhost","Connection":"keep-alive","Content-Length":"48","Pragma":"no-cache","Cache-Control":"no-cache","Accept":"application\\/json, text\\/plain, *\\/*","Origin":"http:\\/\\/localhost:4200","Authorization":"null","beneficiarios":"dc176c2d6fc496288e6ee81e35c8ffe3","User-Agent":"Mozilla\\/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit\\/537.36 (KHTML, like Gecko) Chrome\\/70.0.3538.102 Safari\\/537.36","Content-Type":"application\\/json","Referer":"http:\\/\\/localhost:4200\\/","Accept-Encoding":"gzip, deflate, br","Accept-Language":"en-US,en;q=0.9,es;q=0.8","X-Hola-Unblocker-Bext":"reqid 186824: before request, vpn is not allowed, send headers","X-Hola-Request-Id":"186824","correo":"admin@correo.com","password":"admin"}', 'dc176c2d6fc496288e6ee81e35c8ffe3', '::1', 1543005406, 0.036696, '1', 401, '2018-11-23 20:36:46'),
(799, 'Beneficiarios/login', 'post', '{"Host":"localhost","Connection":"keep-alive","Content-Length":"48","Pragma":"no-cache","Cache-Control":"no-cache","Accept":"application\\/json, text\\/plain, *\\/*","Origin":"http:\\/\\/localhost:4200","Authorization":"null","beneficiarios":"dc176c2d6fc496288e6ee81e35c8ffe3","User-Agent":"Mozilla\\/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit\\/537.36 (KHTML, like Gecko) Chrome\\/70.0.3538.102 Safari\\/537.36","Content-Type":"application\\/json","Referer":"http:\\/\\/localhost:4200\\/","Accept-Encoding":"gzip, deflate, br","Accept-Language":"en-US,en;q=0.9,es;q=0.8","X-Hola-Unblocker-Bext":"reqid 187505: before request, vpn is not allowed, send headers","X-Hola-Request-Id":"187505","correo":"admin@correo.com","password":"admin"}', 'dc176c2d6fc496288e6ee81e35c8ffe3', '::1', 1543005505, 0.0304768, '1', 200, '2018-11-23 20:38:25'),
(800, 'Beneficiarios/login', 'post', '{"Host":"localhost","Connection":"keep-alive","Content-Length":"48","Pragma":"no-cache","Cache-Control":"no-cache","Accept":"application\\/json, text\\/plain, *\\/*","Origin":"http:\\/\\/localhost:4200","Authorization":"null","beneficiarios":"dc176c2d6fc496288e6ee81e35c8ffe3","User-Agent":"Mozilla\\/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit\\/537.36 (KHTML, like Gecko) Chrome\\/70.0.3538.102 Safari\\/537.36","Content-Type":"application\\/json","Referer":"http:\\/\\/localhost:4200\\/","Accept-Encoding":"gzip, deflate, br","Accept-Language":"en-US,en;q=0.9,es;q=0.8","X-Hola-Unblocker-Bext":"reqid 187919: before request, vpn is not allowed, send headers","X-Hola-Request-Id":"187919","correo":"admin@correo.com","password":"admin"}', 'dc176c2d6fc496288e6ee81e35c8ffe3', '::1', 1543005566, 0.0354271, '1', 200, '2018-11-23 20:39:26'),
(801, 'Beneficiarios/login', 'post', '{"Host":"localhost","Connection":"keep-alive","Content-Length":"48","Pragma":"no-cache","Cache-Control":"no-cache","Accept":"application\\/json, text\\/plain, *\\/*","Origin":"http:\\/\\/localhost:4200","Authorization":"null","beneficiarios":"dc176c2d6fc496288e6ee81e35c8ffe3","User-Agent":"Mozilla\\/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit\\/537.36 (KHTML, like Gecko) Chrome\\/70.0.3538.102 Safari\\/537.36","Content-Type":"application\\/json","Referer":"http:\\/\\/localhost:4200\\/","Accept-Encoding":"gzip, deflate, br","Accept-Language":"en-US,en;q=0.9,es;q=0.8","X-Hola-Unblocker-Bext":"reqid 197095: before request, vpn is not allowed, send headers","X-Hola-Request-Id":"197095","correo":"admin@correo.com","password":"admin"}', 'dc176c2d6fc496288e6ee81e35c8ffe3', '::1', 1543006945, NULL, '1', 0, '2018-11-23 21:02:25'),
(802, 'Beneficiarios/login', 'post', '{"Host":"localhost","Connection":"keep-alive","Content-Length":"48","Pragma":"no-cache","Cache-Control":"no-cache","Accept":"application\\/json, text\\/plain, *\\/*","Origin":"http:\\/\\/localhost:4200","Authorization":"null","beneficiarios":"dc176c2d6fc496288e6ee81e35c8ffe3","User-Agent":"Mozilla\\/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit\\/537.36 (KHTML, like Gecko) Chrome\\/70.0.3538.102 Safari\\/537.36","Content-Type":"application\\/json","Referer":"http:\\/\\/localhost:4200\\/","Accept-Encoding":"gzip, deflate, br","Accept-Language":"en-US,en;q=0.9,es;q=0.8","X-Hola-Unblocker-Bext":"reqid 197914: before request, vpn is not allowed, send headers","X-Hola-Request-Id":"197914","correo":"admin@correo.com","password":"admin"}', 'dc176c2d6fc496288e6ee81e35c8ffe3', '::1', 1543007066, 0.027796, '1', 200, '2018-11-23 21:04:26'),
(803, 'Beneficiarios/login', 'post', '{"Host":"localhost","Connection":"keep-alive","Content-Length":"48","Accept":"application\\/json, text\\/plain, *\\/*","Origin":"http:\\/\\/localhost:4200","Authorization":"null","beneficiarios":"dc176c2d6fc496288e6ee81e35c8ffe3","User-Agent":"Mozilla\\/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit\\/537.36 (KHTML, like Gecko) Chrome\\/70.0.3538.102 Safari\\/537.36","Content-Type":"application\\/json","Referer":"http:\\/\\/localhost:4200\\/","Accept-Encoding":"gzip, deflate, br","Accept-Language":"en-US,en;q=0.9,es;q=0.8","X-Hola-Unblocker-Bext":"reqid 200205: before request, vpn is not allowed, send headers","X-Hola-Request-Id":"200205","correo":"admin@correo.com","password":"admin"}', 'dc176c2d6fc496288e6ee81e35c8ffe3', '::1', 1543007368, 0.038142, '1', 200, '2018-11-23 21:09:28'),
(804, 'Beneficiarios/login', 'post', '{"Host":"localhost","Connection":"keep-alive","Content-Length":"48","Pragma":"no-cache","Cache-Control":"no-cache","Accept":"application\\/json, text\\/plain, *\\/*","Origin":"http:\\/\\/localhost:4200","Authorization":"null","beneficiarios":"dc176c2d6fc496288e6ee81e35c8ffe3","User-Agent":"Mozilla\\/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit\\/537.36 (KHTML, like Gecko) Chrome\\/70.0.3538.102 Safari\\/537.36","Content-Type":"application\\/json","Referer":"http:\\/\\/localhost:4200\\/","Accept-Encoding":"gzip, deflate, br","Accept-Language":"en-US,en;q=0.9,es;q=0.8","X-Hola-Unblocker-Bext":"reqid 200539: before request, vpn is not allowed, send headers","X-Hola-Request-Id":"200539","correo":"admin@correo.com","password":"admin"}', 'dc176c2d6fc496288e6ee81e35c8ffe3', '::1', 1543007419, 0.0274341, '1', 200, '2018-11-23 21:10:19'),
(805, 'Beneficiarios/login', 'post', '{"Host":"localhost","Connection":"keep-alive","Content-Length":"48","Accept":"application\\/json, text\\/plain, *\\/*","Origin":"http:\\/\\/localhost:4200","Authorization":"null","beneficiarios":"dc176c2d6fc496288e6ee81e35c8ffe3","User-Agent":"Mozilla\\/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit\\/537.36 (KHTML, like Gecko) Chrome\\/70.0.3538.102 Safari\\/537.36","Content-Type":"application\\/json","Referer":"http:\\/\\/localhost:4200\\/","Accept-Encoding":"gzip, deflate, br","Accept-Language":"en-US,en;q=0.9,es;q=0.8","X-Hola-Unblocker-Bext":"reqid 55015: before request, vpn is not allowed, send headers","X-Hola-Request-Id":"55015","correo":"admin@correo.com","password":"admin"}', 'dc176c2d6fc496288e6ee81e35c8ffe3', '::1', 1543250013, 0.0363121, '1', 200, '2018-11-26 16:33:33'),
(806, 'Beneficiarios/login', 'post', '{"Host":"localhost","Connection":"keep-alive","Content-Length":"48","Accept":"application\\/json, text\\/plain, *\\/*","Origin":"http:\\/\\/localhost:4200","Authorization":"null","beneficiarios":"dc176c2d6fc496288e6ee81e35c8ffe3","User-Agent":"Mozilla\\/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit\\/537.36 (KHTML, like Gecko) Chrome\\/70.0.3538.102 Safari\\/537.36","Content-Type":"application\\/json","Referer":"http:\\/\\/localhost:4200\\/","Accept-Encoding":"gzip, deflate, br","Accept-Language":"en-US,en;q=0.9,es;q=0.8","X-Hola-Unblocker-Bext":"reqid 55256: before request, vpn is not allowed, send headers","X-Hola-Request-Id":"55256","correo":"admin@correo.com","password":"admin"}', 'dc176c2d6fc496288e6ee81e35c8ffe3', '::1', 1543250050, 0.0377579, '1', 200, '2018-11-26 16:34:10'),
(807, 'Beneficiarios/login', 'post', '{"Host":"localhost","Connection":"keep-alive","Content-Length":"48","Accept":"application\\/json, text\\/plain, *\\/*","Origin":"http:\\/\\/localhost:4200","Authorization":"null","beneficiarios":"dc176c2d6fc496288e6ee81e35c8ffe3","User-Agent":"Mozilla\\/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit\\/537.36 (KHTML, like Gecko) Chrome\\/70.0.3538.102 Safari\\/537.36","Content-Type":"application\\/json","Referer":"http:\\/\\/localhost:4200\\/","Accept-Encoding":"gzip, deflate, br","Accept-Language":"en-US,en;q=0.9,es;q=0.8","X-Hola-Unblocker-Bext":"reqid 59017: before request, vpn is not allowed, send headers","X-Hola-Request-Id":"59017","correo":"admin@correo.com","password":"admin"}', 'dc176c2d6fc496288e6ee81e35c8ffe3', '::1', 1543250580, 0.030869, '1', 200, '2018-11-26 16:43:00'),
(808, 'Beneficiarios/login', 'post', '{"Host":"localhost","Connection":"keep-alive","Content-Length":"48","Pragma":"no-cache","Cache-Control":"no-cache","Accept":"application\\/json, text\\/plain, *\\/*","Origin":"http:\\/\\/localhost:4200","Authorization":"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE1NDMyNTA1ODAsImV4cCI6MTU0MzI3OTM4MCwiZGF0YSI6eyJpZHVzdWFyaW8iOiIyIiwibm9tYnJlIjoiYWRtaW4iLCJjb3JyZW8iOiJhZG1pbkBjb3JyZW8uY29tIiwicm9sZSI6IjEifSwibWVudSI6W3sicGF0aCI6Ilwvc3RhcnRlciIsInRpdGxlIjoiSW5pY2lvIiwiaWNvbiI6Im1kaSBtZGktaG9tZSIsImNsYXNzIjoiIiwibGFiZWwiOiIiLCJsYWJlbENsYXNzIjoiIiwiZXh0cmFsaW5rIjpmYWxzZSwic3VibWVudSI6W119LHsicGF0aCI6IlwvZXNvY2lvZWNvbm9taWNvIiwidGl0bGUiOiJFc3R1ZGlvIiwiaWNvbiI6Im1kaSBtZGktcGVuY2lsLWNpcmNsZSIsImNsYXNzIjoiIiwibGFiZWwiOiIiLCJsYWJlbENsYXNzIjoiIiwiZXh0cmFsaW5rIjpmYWxzZSwic3VibWVudSI6W119LHsicGF0aCI6IiIsInRpdGxlIjoiQ29uZmlndXJhY2lvbiIsImljb24iOiJtZGkgbWRpLXNldHRpbmdzIiwiY2xhc3MiOiJoYXMtYXJyb3ciLCJsYWJlbCI6IiIsImxhYmVsQ2xhc3MiOiIiLCJleHRyYWxpbmsiOmZhbHNlLCJzdWJtZW51IjpbeyJwYXRoIjoiXC91c3VhcmlvcyIsInRpdGxlIjoiVXN1YXJpb3MiLCJpY29uIjoibWRpIG1kaS1hY2NvdW50IiwiY2xhc3MiOiIiLCJsYWJlbCI6IiIsImxhYmVsQ2xhc3MiOiIiLCJleHRyYWxpbmsiOmZhbHNlLCJzdWJtZW51IjpbXX1dfV19.t7L6rAGXjd5GP2Pj1rHa1zBD8Vit0Lce40_LXAYrlH0","beneficiarios":"dc176c2d6fc496288e6ee81e35c8ffe3","User-Agent":"Mozilla\\/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit\\/537.36 (KHTML, like Gecko) Chrome\\/70.0.3538.102 Safari\\/537.36","Content-Type":"application\\/json","Referer":"http:\\/\\/localhost:4200\\/","Accept-Encoding":"gzip, deflate, br","Accept-Language":"en-US,en;q=0.9,es;q=0.8","X-Hola-Unblocker-Bext":"reqid 60096: before request, vpn is not allowed, send headers","X-Hola-Request-Id":"60096","correo":"admin@correo.com","password":"admin"}', 'dc176c2d6fc496288e6ee81e35c8ffe3', '::1', 1543250732, 0.0403352, '1', 200, '2018-11-26 16:45:32'),
(809, 'Beneficiarios/login', 'post', '{"Host":"localhost","Connection":"keep-alive","Content-Length":"48","Pragma":"no-cache","Cache-Control":"no-cache","Accept":"application\\/json, text\\/plain, *\\/*","Origin":"http:\\/\\/localhost:4200","Authorization":"null","beneficiarios":"dc176c2d6fc496288e6ee81e35c8ffe3","User-Agent":"Mozilla\\/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit\\/537.36 (KHTML, like Gecko) Chrome\\/70.0.3538.102 Safari\\/537.36","Content-Type":"application\\/json","Referer":"http:\\/\\/localhost:4200\\/","Accept-Encoding":"gzip, deflate, br","Accept-Language":"en-US,en;q=0.9,es;q=0.8","X-Hola-Unblocker-Bext":"reqid 64992: before request, vpn is not allowed, send headers","X-Hola-Request-Id":"64992","correo":"admin@correo.com","password":"admin"}', 'dc176c2d6fc496288e6ee81e35c8ffe3', '::1', 1543251301, 0.0303898, '1', 200, '2018-11-26 16:55:01'),
(810, 'Beneficiarios/login', 'post', '{"Host":"localhost","Connection":"keep-alive","Content-Length":"48","Pragma":"no-cache","Cache-Control":"no-cache","Accept":"application\\/json, text\\/plain, *\\/*","Origin":"http:\\/\\/localhost:4200","Authorization":"null","beneficiarios":"dc176c2d6fc496288e6ee81e35c8ffe3","User-Agent":"Mozilla\\/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit\\/537.36 (KHTML, like Gecko) Chrome\\/70.0.3538.102 Safari\\/537.36","Content-Type":"application\\/json","Referer":"http:\\/\\/localhost:4200\\/","Accept-Encoding":"gzip, deflate, br","Accept-Language":"en-US,en;q=0.9,es;q=0.8","X-Hola-Unblocker-Bext":"reqid 161777: before request, vpn is not allowed, send headers","X-Hola-Request-Id":"161777","correo":"admin@correo.com","password":"admin"}', 'dc176c2d6fc496288e6ee81e35c8ffe3', '::1', 1543264209, 0.0344748, '1', 200, '2018-11-26 20:30:09'),
(811, 'Beneficiarios/login', 'post', '{"Host":"localhost","Connection":"keep-alive","Content-Length":"48","Accept":"application\\/json, text\\/plain, *\\/*","Origin":"http:\\/\\/localhost:4200","Authorization":"null","beneficiarios":"dc176c2d6fc496288e6ee81e35c8ffe3","User-Agent":"Mozilla\\/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit\\/537.36 (KHTML, like Gecko) Chrome\\/70.0.3538.110 Safari\\/537.36","Content-Type":"application\\/json","Referer":"http:\\/\\/localhost:4200\\/","Accept-Encoding":"gzip, deflate, br","Accept-Language":"en-US,en;q=0.9,es;q=0.8","correo":"admin@correo.com","password":"admin"}', 'dc176c2d6fc496288e6ee81e35c8ffe3', '::1', 1543332404, 0.0376139, '1', 200, '2018-11-27 15:26:44'),
(812, 'Beneficiarios/estudiosp', 'post', '{"Host":"localhost","Connection":"keep-alive","Content-Length":"123","Accept":"application\\/json, text\\/plain, *\\/*","Origin":"http:\\/\\/localhost:4200","Authorization":"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE1NDMzMzI0MDQsImV4cCI6MTU0MzM2MTIwNCwiZGF0YSI6eyJpZHVzdWFyaW8iOiIyIiwibm9tYnJlIjoiYWRtaW4iLCJjb3JyZW8iOiJhZG1pbkBjb3JyZW8uY29tIiwicm9sZSI6IjEifSwibWVudSI6W3sicGF0aCI6Ilwvc3RhcnRlciIsInRpdGxlIjoiSW5pY2lvIiwiaWNvbiI6Im1kaSBtZGktaG9tZSIsImNsYXNzIjoiIiwibGFiZWwiOiIiLCJsYWJlbENsYXNzIjoiIiwiZXh0cmFsaW5rIjpmYWxzZSwic3VibWVudSI6W119LHsicGF0aCI6IlwvZXNvY2lvZWNvbm9taWNvIiwidGl0bGUiOiJFc3R1ZGlvIiwiaWNvbiI6Im1kaSBtZGktcGVuY2lsLWNpcmNsZSIsImNsYXNzIjoiIiwibGFiZWwiOiIiLCJsYWJlbENsYXNzIjoiIiwiZXh0cmFsaW5rIjpmYWxzZSwic3VibWVudSI6W119LHsicGF0aCI6IiIsInRpdGxlIjoiQ29uZmlndXJhY2lvbiIsImljb24iOiJtZGkgbWRpLXNldHRpbmdzIiwiY2xhc3MiOiJoYXMtYXJyb3ciLCJsYWJlbCI6IiIsImxhYmVsQ2xhc3MiOiIiLCJleHRyYWxpbmsiOmZhbHNlLCJzdWJtZW51IjpbeyJwYXRoIjoiXC91c3VhcmlvcyIsInRpdGxlIjoiVXN1YXJpb3MiLCJpY29uIjoibWRpIG1kaS1hY2NvdW50IiwiY2xhc3MiOiIiLCJsYWJlbCI6IiIsImxhYmVsQ2xhc3MiOiIiLCJleHRyYWxpbmsiOmZhbHNlLCJzdWJtZW51IjpbXX1dfV19.K5SEYKapHa2TnSL9XI7ZqHczJh83cV8VS-UhRaNdQlo","beneficiarios":"dc176c2d6fc496288e6ee81e35c8ffe3","User-Agent":"Mozilla\\/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit\\/537.36 (KHTML, like Gecko) Chrome\\/70.0.3538.110 Safari\\/537.36","Content-Type":"application\\/json","Referer":"http:\\/\\/localhost:4200\\/","Accept-Encoding":"gzip, deflate, br","Accept-Language":"en-US,en;q=0.9,es;q=0.8","pagina":1,"por_pagina":20,"filtros":{"folio":"","nombre":"","area":""},"order":{"sortBy":"folio","sortDirection":"desc"}}', 'dc176c2d6fc496288e6ee81e35c8ffe3', '::1', 1543338086, NULL, '1', 0, '2018-11-27 17:01:26'),
(813, 'Beneficiarios/estudiosp', 'post', '{"Host":"localhost","Connection":"keep-alive","Content-Length":"123","Accept":"application\\/json, text\\/plain, *\\/*","Origin":"http:\\/\\/localhost:4200","Authorization":"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE1NDMzMzI0MDQsImV4cCI6MTU0MzM2MTIwNCwiZGF0YSI6eyJpZHVzdWFyaW8iOiIyIiwibm9tYnJlIjoiYWRtaW4iLCJjb3JyZW8iOiJhZG1pbkBjb3JyZW8uY29tIiwicm9sZSI6IjEifSwibWVudSI6W3sicGF0aCI6Ilwvc3RhcnRlciIsInRpdGxlIjoiSW5pY2lvIiwiaWNvbiI6Im1kaSBtZGktaG9tZSIsImNsYXNzIjoiIiwibGFiZWwiOiIiLCJsYWJlbENsYXNzIjoiIiwiZXh0cmFsaW5rIjpmYWxzZSwic3VibWVudSI6W119LHsicGF0aCI6IlwvZXNvY2lvZWNvbm9taWNvIiwidGl0bGUiOiJFc3R1ZGlvIiwiaWNvbiI6Im1kaSBtZGktcGVuY2lsLWNpcmNsZSIsImNsYXNzIjoiIiwibGFiZWwiOiIiLCJsYWJlbENsYXNzIjoiIiwiZXh0cmFsaW5rIjpmYWxzZSwic3VibWVudSI6W119LHsicGF0aCI6IiIsInRpdGxlIjoiQ29uZmlndXJhY2lvbiIsImljb24iOiJtZGkgbWRpLXNldHRpbmdzIiwiY2xhc3MiOiJoYXMtYXJyb3ciLCJsYWJlbCI6IiIsImxhYmVsQ2xhc3MiOiIiLCJleHRyYWxpbmsiOmZhbHNlLCJzdWJtZW51IjpbeyJwYXRoIjoiXC91c3VhcmlvcyIsInRpdGxlIjoiVXN1YXJpb3MiLCJpY29uIjoibWRpIG1kaS1hY2NvdW50IiwiY2xhc3MiOiIiLCJsYWJlbCI6IiIsImxhYmVsQ2xhc3MiOiIiLCJleHRyYWxpbmsiOmZhbHNlLCJzdWJtZW51IjpbXX1dfV19.K5SEYKapHa2TnSL9XI7ZqHczJh83cV8VS-UhRaNdQlo","beneficiarios":"dc176c2d6fc496288e6ee81e35c8ffe3","User-Agent":"Mozilla\\/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit\\/537.36 (KHTML, like Gecko) Chrome\\/70.0.3538.110 Safari\\/537.36","Content-Type":"application\\/json","Referer":"http:\\/\\/localhost:4200\\/","Accept-Encoding":"gzip, deflate, br","Accept-Language":"en-US,en;q=0.9,es;q=0.8","pagina":1,"por_pagina":20,"filtros":{"folio":"","nombre":"","area":""},"order":{"sortBy":"folio","sortDirection":"desc"}}', 'dc176c2d6fc496288e6ee81e35c8ffe3', '::1', 1543338086, NULL, '1', 0, '2018-11-27 17:01:26'),
(814, 'Beneficiarios/estudiosp', 'post', '{"Host":"localhost","Connection":"keep-alive","Content-Length":"123","Accept":"application\\/json, text\\/plain, *\\/*","Origin":"http:\\/\\/localhost:4200","Authorization":"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE1NDMzMzI0MDQsImV4cCI6MTU0MzM2MTIwNCwiZGF0YSI6eyJpZHVzdWFyaW8iOiIyIiwibm9tYnJlIjoiYWRtaW4iLCJjb3JyZW8iOiJhZG1pbkBjb3JyZW8uY29tIiwicm9sZSI6IjEifSwibWVudSI6W3sicGF0aCI6Ilwvc3RhcnRlciIsInRpdGxlIjoiSW5pY2lvIiwiaWNvbiI6Im1kaSBtZGktaG9tZSIsImNsYXNzIjoiIiwibGFiZWwiOiIiLCJsYWJlbENsYXNzIjoiIiwiZXh0cmFsaW5rIjpmYWxzZSwic3VibWVudSI6W119LHsicGF0aCI6IlwvZXNvY2lvZWNvbm9taWNvIiwidGl0bGUiOiJFc3R1ZGlvIiwiaWNvbiI6Im1kaSBtZGktcGVuY2lsLWNpcmNsZSIsImNsYXNzIjoiIiwibGFiZWwiOiIiLCJsYWJlbENsYXNzIjoiIiwiZXh0cmFsaW5rIjpmYWxzZSwic3VibWVudSI6W119LHsicGF0aCI6IiIsInRpdGxlIjoiQ29uZmlndXJhY2lvbiIsImljb24iOiJtZGkgbWRpLXNldHRpbmdzIiwiY2xhc3MiOiJoYXMtYXJyb3ciLCJsYWJlbCI6IiIsImxhYmVsQ2xhc3MiOiIiLCJleHRyYWxpbmsiOmZhbHNlLCJzdWJtZW51IjpbeyJwYXRoIjoiXC91c3VhcmlvcyIsInRpdGxlIjoiVXN1YXJpb3MiLCJpY29uIjoibWRpIG1kaS1hY2NvdW50IiwiY2xhc3MiOiIiLCJsYWJlbCI6IiIsImxhYmVsQ2xhc3MiOiIiLCJleHRyYWxpbmsiOmZhbHNlLCJzdWJtZW51IjpbXX1dfV19.K5SEYKapHa2TnSL9XI7ZqHczJh83cV8VS-UhRaNdQlo","beneficiarios":"dc176c2d6fc496288e6ee81e35c8ffe3","User-Agent":"Mozilla\\/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit\\/537.36 (KHTML, like Gecko) Chrome\\/70.0.3538.110 Safari\\/537.36","Content-Type":"application\\/json","Referer":"http:\\/\\/localhost:4200\\/","Accept-Encoding":"gzip, deflate, br","Accept-Language":"en-US,en;q=0.9,es;q=0.8","pagina":1,"por_pagina":20,"filtros":{"folio":"","nombre":"","area":""},"order":{"sortBy":"folio","sortDirection":"desc"}}', 'dc176c2d6fc496288e6ee81e35c8ffe3', '::1', 1543338107, NULL, '1', 0, '2018-11-27 17:01:47'),
(815, 'Beneficiarios/estudiosp', 'post', '{"Host":"localhost","Connection":"keep-alive","Content-Length":"123","Accept":"application\\/json, text\\/plain, *\\/*","Origin":"http:\\/\\/localhost:4200","Authorization":"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE1NDMzMzI0MDQsImV4cCI6MTU0MzM2MTIwNCwiZGF0YSI6eyJpZHVzdWFyaW8iOiIyIiwibm9tYnJlIjoiYWRtaW4iLCJjb3JyZW8iOiJhZG1pbkBjb3JyZW8uY29tIiwicm9sZSI6IjEifSwibWVudSI6W3sicGF0aCI6Ilwvc3RhcnRlciIsInRpdGxlIjoiSW5pY2lvIiwiaWNvbiI6Im1kaSBtZGktaG9tZSIsImNsYXNzIjoiIiwibGFiZWwiOiIiLCJsYWJlbENsYXNzIjoiIiwiZXh0cmFsaW5rIjpmYWxzZSwic3VibWVudSI6W119LHsicGF0aCI6IlwvZXNvY2lvZWNvbm9taWNvIiwidGl0bGUiOiJFc3R1ZGlvIiwiaWNvbiI6Im1kaSBtZGktcGVuY2lsLWNpcmNsZSIsImNsYXNzIjoiIiwibGFiZWwiOiIiLCJsYWJlbENsYXNzIjoiIiwiZXh0cmFsaW5rIjpmYWxzZSwic3VibWVudSI6W119LHsicGF0aCI6IiIsInRpdGxlIjoiQ29uZmlndXJhY2lvbiIsImljb24iOiJtZGkgbWRpLXNldHRpbmdzIiwiY2xhc3MiOiJoYXMtYXJyb3ciLCJsYWJlbCI6IiIsImxhYmVsQ2xhc3MiOiIiLCJleHRyYWxpbmsiOmZhbHNlLCJzdWJtZW51IjpbeyJwYXRoIjoiXC91c3VhcmlvcyIsInRpdGxlIjoiVXN1YXJpb3MiLCJpY29uIjoibWRpIG1kaS1hY2NvdW50IiwiY2xhc3MiOiIiLCJsYWJlbCI6IiIsImxhYmVsQ2xhc3MiOiIiLCJleHRyYWxpbmsiOmZhbHNlLCJzdWJtZW51IjpbXX1dfV19.K5SEYKapHa2TnSL9XI7ZqHczJh83cV8VS-UhRaNdQlo","beneficiarios":"dc176c2d6fc496288e6ee81e35c8ffe3","User-Agent":"Mozilla\\/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit\\/537.36 (KHTML, like Gecko) Chrome\\/70.0.3538.110 Safari\\/537.36","Content-Type":"application\\/json","Referer":"http:\\/\\/localhost:4200\\/","Accept-Encoding":"gzip, deflate, br","Accept-Language":"en-US,en;q=0.9,es;q=0.8","pagina":1,"por_pagina":20,"filtros":{"folio":"","nombre":"","area":""},"order":{"sortBy":"folio","sortDirection":"desc"}}', 'dc176c2d6fc496288e6ee81e35c8ffe3', '::1', 1543338107, NULL, '1', 0, '2018-11-27 17:01:47'),
(816, 'Beneficiarios/login', 'post', '{"Host":"localhost","Connection":"keep-alive","Content-Length":"51","Accept":"application\\/json, text\\/plain, *\\/*","Origin":"http:\\/\\/localhost:4200","Authorization":"null","beneficiarios":"dc176c2d6fc496288e6ee81e35c8ffe3","User-Agent":"Mozilla\\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\\/537.36 (KHTML, like Gecko) Chrome\\/70.0.3538.102 Safari\\/537.36","Content-Type":"application\\/json","Referer":"http:\\/\\/localhost:4200\\/","Accept-Encoding":"gzip, deflate, br","Accept-Language":"en,es-419;q=0.9,es;q=0.8,en-US;q=0.7","correo":"cardenas@correo.com","password":"admin"}', 'dc176c2d6fc496288e6ee81e35c8ffe3', '::1', 1543344090, 0.14796, '1', 401, '2018-11-27 18:41:30'),
(817, 'Beneficiarios/login', 'post', '{"Host":"localhost","Connection":"keep-alive","Content-Length":"51","Accept":"application\\/json, text\\/plain, *\\/*","Origin":"http:\\/\\/localhost:4200","Authorization":"null","beneficiarios":"dc176c2d6fc496288e6ee81e35c8ffe3","User-Agent":"Mozilla\\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\\/537.36 (KHTML, like Gecko) Chrome\\/70.0.3538.102 Safari\\/537.36","Content-Type":"application\\/json","Referer":"http:\\/\\/localhost:4200\\/","Accept-Encoding":"gzip, deflate, br","Accept-Language":"en,es-419;q=0.9,es;q=0.8,en-US;q=0.7","correo":"cardenas@correo.com","password":"admin"}', 'dc176c2d6fc496288e6ee81e35c8ffe3', '::1', 1543344093, 0.26618, '1', 401, '2018-11-27 18:41:33'),
(818, 'Beneficiarios/login', 'post', '{"Host":"localhost","Connection":"keep-alive","Content-Length":"48","Pragma":"no-cache","Cache-Control":"no-cache","Accept":"application\\/json, text\\/plain, *\\/*","Origin":"http:\\/\\/localhost:4200","Authorization":"null","beneficiarios":"dc176c2d6fc496288e6ee81e35c8ffe3","User-Agent":"Mozilla\\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\\/537.36 (KHTML, like Gecko) Chrome\\/70.0.3538.102 Safari\\/537.36","Content-Type":"application\\/json","Referer":"http:\\/\\/localhost:4200\\/","Accept-Encoding":"gzip, deflate, br","Accept-Language":"en,es-419;q=0.9,es;q=0.8,en-US;q=0.7","correo":"admin@correo.com","password":"admin"}', 'dc176c2d6fc496288e6ee81e35c8ffe3', '::1', 1543344110, 0.173129, '1', 200, '2018-11-27 18:41:50'),
(819, 'Beneficiarios/login', 'post', '{"Host":"localhost","Connection":"keep-alive","Content-Length":"48","Pragma":"no-cache","Cache-Control":"no-cache","Accept":"application\\/json, text\\/plain, *\\/*","Origin":"http:\\/\\/localhost:4200","Authorization":"null","beneficiarios":"dc176c2d6fc496288e6ee81e35c8ffe3","User-Agent":"Mozilla\\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\\/537.36 (KHTML, like Gecko) Chrome\\/70.0.3538.102 Safari\\/537.36","Content-Type":"application\\/json","Referer":"http:\\/\\/localhost:4200\\/","Accept-Encoding":"gzip, deflate, br","Accept-Language":"en,es-419;q=0.9,es;q=0.8,en-US;q=0.7","correo":"admin@correo.com","password":"admin"}', 'dc176c2d6fc496288e6ee81e35c8ffe3', '::1', 1543344196, 0.171937, '1', 200, '2018-11-27 18:43:16'),
(820, 'Beneficiarios/estudiosp', 'post', '{"Host":"localhost","Connection":"keep-alive","Content-Length":"123","Pragma":"no-cache","Cache-Control":"no-cache","Accept":"application\\/json, text\\/plain, *\\/*","Origin":"http:\\/\\/localhost:4200","Authorization":"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE1NDMzNDQxOTYsImV4cCI6MTU0MzM3Mjk5NiwiZGF0YSI6eyJpZHVzdWFyaW8iOiIyIiwibm9tYnJlIjoiYWRtaW4iLCJjb3JyZW8iOiJhZG1pbkBjb3JyZW8uY29tIiwicm9sZSI6IjEifSwibWVudSI6W3sicGF0aCI6Ilwvc3RhcnRlciIsInRpdGxlIjoiSW5pY2lvIiwiaWNvbiI6Im1kaSBtZGktaG9tZSIsImNsYXNzIjoiIiwibGFiZWwiOiIiLCJsYWJlbENsYXNzIjoiIiwiZXh0cmFsaW5rIjpmYWxzZSwic3VibWVudSI6W119LHsicGF0aCI6IlwvZXNvY2lvZWNvbm9taWNvIiwidGl0bGUiOiJFc3R1ZGlvIiwiaWNvbiI6Im1kaSBtZGktcGVuY2lsLWNpcmNsZSIsImNsYXNzIjoiIiwibGFiZWwiOiIiLCJsYWJlbENsYXNzIjoiIiwiZXh0cmFsaW5rIjpmYWxzZSwic3VibWVudSI6W119LHsicGF0aCI6IiIsInRpdGxlIjoiQ29uZmlndXJhY2lvbiIsImljb24iOiJtZGkgbWRpLXNldHRpbmdzIiwiY2xhc3MiOiJoYXMtYXJyb3ciLCJsYWJlbCI6IiIsImxhYmVsQ2xhc3MiOiIiLCJleHRyYWxpbmsiOmZhbHNlLCJzdWJtZW51IjpbeyJwYXRoIjoiXC91c3VhcmlvcyIsInRpdGxlIjoiVXN1YXJpb3MiLCJpY29uIjoibWRpIG1kaS1hY2NvdW50IiwiY2xhc3MiOiIiLCJsYWJlbCI6IiIsImxhYmVsQ2xhc3MiOiIiLCJleHRyYWxpbmsiOmZhbHNlLCJzdWJtZW51IjpbXX1dfV19.Klu25hHP8-sU6Sg7Yk5xmpgKAk7VGnp6BJPftTWZ1tA","beneficiarios":"dc176c2d6fc496288e6ee81e35c8ffe3","User-Agent":"Mozilla\\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\\/537.36 (KHTML, like Gecko) Chrome\\/70.0.3538.102 Safari\\/537.36","Content-Type":"application\\/json","Referer":"http:\\/\\/localhost:4200\\/","Accept-Encoding":"gzip, deflate, br","Accept-Language":"en,es-419;q=0.9,es;q=0.8,en-US;q=0.7","pagina":1,"por_pagina":20,"filtros":{"folio":"","nombre":"","area":""},"order":{"sortBy":"folio","sortDirection":"desc"}}', 'dc176c2d6fc496288e6ee81e35c8ffe3', '::1', 1543344203, NULL, '1', 0, '2018-11-27 18:43:23'),
(821, 'Beneficiarios/estudiosp', 'post', '{"Host":"localhost","Connection":"keep-alive","Content-Length":"123","Pragma":"no-cache","Cache-Control":"no-cache","Accept":"application\\/json, text\\/plain, *\\/*","Origin":"http:\\/\\/localhost:4200","Authorization":"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE1NDMzNDQxOTYsImV4cCI6MTU0MzM3Mjk5NiwiZGF0YSI6eyJpZHVzdWFyaW8iOiIyIiwibm9tYnJlIjoiYWRtaW4iLCJjb3JyZW8iOiJhZG1pbkBjb3JyZW8uY29tIiwicm9sZSI6IjEifSwibWVudSI6W3sicGF0aCI6Ilwvc3RhcnRlciIsInRpdGxlIjoiSW5pY2lvIiwiaWNvbiI6Im1kaSBtZGktaG9tZSIsImNsYXNzIjoiIiwibGFiZWwiOiIiLCJsYWJlbENsYXNzIjoiIiwiZXh0cmFsaW5rIjpmYWxzZSwic3VibWVudSI6W119LHsicGF0aCI6IlwvZXNvY2lvZWNvbm9taWNvIiwidGl0bGUiOiJFc3R1ZGlvIiwiaWNvbiI6Im1kaSBtZGktcGVuY2lsLWNpcmNsZSIsImNsYXNzIjoiIiwibGFiZWwiOiIiLCJsYWJlbENsYXNzIjoiIiwiZXh0cmFsaW5rIjpmYWxzZSwic3VibWVudSI6W119LHsicGF0aCI6IiIsInRpdGxlIjoiQ29uZmlndXJhY2lvbiIsImljb24iOiJtZGkgbWRpLXNldHRpbmdzIiwiY2xhc3MiOiJoYXMtYXJyb3ciLCJsYWJlbCI6IiIsImxhYmVsQ2xhc3MiOiIiLCJleHRyYWxpbmsiOmZhbHNlLCJzdWJtZW51IjpbeyJwYXRoIjoiXC91c3VhcmlvcyIsInRpdGxlIjoiVXN1YXJpb3MiLCJpY29uIjoibWRpIG1kaS1hY2NvdW50IiwiY2xhc3MiOiIiLCJsYWJlbCI6IiIsImxhYmVsQ2xhc3MiOiIiLCJleHRyYWxpbmsiOmZhbHNlLCJzdWJtZW51IjpbXX1dfV19.Klu25hHP8-sU6Sg7Yk5xmpgKAk7VGnp6BJPftTWZ1tA","beneficiarios":"dc176c2d6fc496288e6ee81e35c8ffe3","User-Agent":"Mozilla\\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\\/537.36 (KHTML, like Gecko) Chrome\\/70.0.3538.102 Safari\\/537.36","Content-Type":"application\\/json","Referer":"http:\\/\\/localhost:4200\\/","Accept-Encoding":"gzip, deflate, br","Accept-Language":"en,es-419;q=0.9,es;q=0.8,en-US;q=0.7","pagina":1,"por_pagina":20,"filtros":{"folio":"","nombre":"","area":""},"order":{"sortBy":"folio","sortDirection":"desc"}}', 'dc176c2d6fc496288e6ee81e35c8ffe3', '::1', 1543344203, NULL, '1', 0, '2018-11-27 18:43:23'),
(822, 'Beneficiarios/login', 'post', '{"Host":"localhost","Connection":"keep-alive","Content-Length":"48","Pragma":"no-cache","Cache-Control":"no-cache","Accept":"application\\/json, text\\/plain, *\\/*","Origin":"http:\\/\\/localhost:4200","Authorization":"null","beneficiarios":"dc176c2d6fc496288e6ee81e35c8ffe3","User-Agent":"Mozilla\\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\\/537.36 (KHTML, like Gecko) Chrome\\/70.0.3538.102 Safari\\/537.36","Content-Type":"application\\/json","Referer":"http:\\/\\/localhost:4200\\/","Accept-Encoding":"gzip, deflate, br","Accept-Language":"en,es-419;q=0.9,es;q=0.8,en-US;q=0.7","correo":"admin@correo.com","password":"admin"}', 'dc176c2d6fc496288e6ee81e35c8ffe3', '::1', 1543344373, 0.26483, '1', 200, '2018-11-27 18:46:13'),
(823, 'Beneficiarios/login', 'post', '{"Host":"localhost","Connection":"keep-alive","Content-Length":"48","Pragma":"no-cache","Cache-Control":"no-cache","Accept":"application\\/json, text\\/plain, *\\/*","Origin":"http:\\/\\/localhost:4200","Authorization":"null","beneficiarios":"dc176c2d6fc496288e6ee81e35c8ffe3","User-Agent":"Mozilla\\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\\/537.36 (KHTML, like Gecko) Chrome\\/70.0.3538.102 Safari\\/537.36","Content-Type":"application\\/json","Referer":"http:\\/\\/localhost:4200\\/","Accept-Encoding":"gzip, deflate, br","Accept-Language":"en,es-419;q=0.9,es;q=0.8,en-US;q=0.7","correo":"admin@correo.com","password":"admin"}', 'dc176c2d6fc496288e6ee81e35c8ffe3', '::1', 1543344414, 0.260504, '1', 200, '2018-11-27 18:46:54'),
(824, 'Beneficiarios/login', 'post', '{"Host":"localhost","Connection":"keep-alive","Content-Length":"48","Pragma":"no-cache","Cache-Control":"no-cache","Accept":"application\\/json, text\\/plain, *\\/*","Origin":"http:\\/\\/localhost:4200","Authorization":"null","beneficiarios":"dc176c2d6fc496288e6ee81e35c8ffe3","User-Agent":"Mozilla\\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\\/537.36 (KHTML, like Gecko) Chrome\\/70.0.3538.102 Safari\\/537.36","Content-Type":"application\\/json","Referer":"http:\\/\\/localhost:4200\\/","Accept-Encoding":"gzip, deflate, br","Accept-Language":"en,es-419;q=0.9,es;q=0.8,en-US;q=0.7","correo":"admin@correo.com","password":"admin"}', 'dc176c2d6fc496288e6ee81e35c8ffe3', '::1', 1543344677, 0.291025, '1', 200, '2018-11-27 18:51:17'),
(825, 'Beneficiarios/login', 'post', '{"Host":"localhost","Connection":"keep-alive","Content-Length":"48","Pragma":"no-cache","Cache-Control":"no-cache","Accept":"application\\/json, text\\/plain, *\\/*","Origin":"http:\\/\\/localhost:4200","Authorization":"null","beneficiarios":"dc176c2d6fc496288e6ee81e35c8ffe3","User-Agent":"Mozilla\\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\\/537.36 (KHTML, like Gecko) Chrome\\/70.0.3538.102 Safari\\/537.36","Content-Type":"application\\/json","Referer":"http:\\/\\/localhost:4200\\/","Accept-Encoding":"gzip, deflate, br","Accept-Language":"en,es-419;q=0.9,es;q=0.8,en-US;q=0.7","correo":"admin@correo.com","password":"admin"}', 'dc176c2d6fc496288e6ee81e35c8ffe3', '::1', 1543344702, 0.135354, '1', 200, '2018-11-27 18:51:42'),
(826, 'Beneficiarios/login', 'post', '{"Host":"localhost","Connection":"keep-alive","Content-Length":"48","Pragma":"no-cache","Cache-Control":"no-cache","Accept":"application\\/json, text\\/plain, *\\/*","Origin":"http:\\/\\/localhost:4200","Authorization":"null","beneficiarios":"dc176c2d6fc496288e6ee81e35c8ffe3","User-Agent":"Mozilla\\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\\/537.36 (KHTML, like Gecko) Chrome\\/70.0.3538.102 Safari\\/537.36","Content-Type":"application\\/json","Referer":"http:\\/\\/localhost:4200\\/","Accept-Encoding":"gzip, deflate, br","Accept-Language":"en,es-419;q=0.9,es;q=0.8,en-US;q=0.7","correo":"admin@correo.com","password":"admin"}', 'dc176c2d6fc496288e6ee81e35c8ffe3', '::1', 1543344782, 0.126863, '1', 200, '2018-11-27 18:53:02'),
(827, 'Beneficiarios/estudiosp', 'post', '{"Host":"localhost","Connection":"keep-alive","Content-Length":"123","Pragma":"no-cache","Cache-Control":"no-cache","Accept":"application\\/json, text\\/plain, *\\/*","Origin":"http:\\/\\/localhost:4200","Authorization":"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE1NDMzNDQ3ODIsImV4cCI6MTU0MzM3MzU4MiwiZGF0YSI6eyJpZHVzdWFyaW8iOiIyIiwibm9tYnJlIjoiYWRtaW4iLCJjb3JyZW8iOiJhZG1pbkBjb3JyZW8uY29tIiwicm9sZSI6IjEifSwibWVudSI6W3sicGF0aCI6Ilwvc3RhcnRlciIsInRpdGxlIjoiSW5pY2lvIiwiaWNvbiI6Im1kaSBtZGktaG9tZSIsImNsYXNzIjoiIiwibGFiZWwiOiIiLCJsYWJlbENsYXNzIjoiIiwiZXh0cmFsaW5rIjpmYWxzZSwic3VibWVudSI6W119LHsicGF0aCI6IlwvZXNvY2lvZWNvbm9taWNvIiwidGl0bGUiOiJFc3R1ZGlvIiwiaWNvbiI6Im1kaSBtZGktcGVuY2lsLWNpcmNsZSIsImNsYXNzIjoiIiwibGFiZWwiOiIiLCJsYWJlbENsYXNzIjoiIiwiZXh0cmFsaW5rIjpmYWxzZSwic3VibWVudSI6W119LHsicGF0aCI6IiIsInRpdGxlIjoiQ29uZmlndXJhY2lvbiIsImljb24iOiJtZGkgbWRpLXNldHRpbmdzIiwiY2xhc3MiOiJoYXMtYXJyb3ciLCJsYWJlbCI6IiIsImxhYmVsQ2xhc3MiOiIiLCJleHRyYWxpbmsiOmZhbHNlLCJzdWJtZW51IjpbeyJwYXRoIjoiXC91c3VhcmlvcyIsInRpdGxlIjoiVXN1YXJpb3MiLCJpY29uIjoibWRpIG1kaS1hY2NvdW50IiwiY2xhc3MiOiIiLCJsYWJlbCI6IiIsImxhYmVsQ2xhc3MiOiIiLCJleHRyYWxpbmsiOmZhbHNlLCJzdWJtZW51IjpbXX1dfV19.Y4x-65Rrq7YHpra3kCPi3PHOYrt5_niHtI7TmSXRuOA","beneficiarios":"dc176c2d6fc496288e6ee81e35c8ffe3","User-Agent":"Mozilla\\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\\/537.36 (KHTML, like Gecko) Chrome\\/70.0.3538.102 Safari\\/537.36","Content-Type":"application\\/json","Referer":"http:\\/\\/localhost:4200\\/","Accept-Encoding":"gzip, deflate, br","Accept-Language":"en,es-419;q=0.9,es;q=0.8,en-US;q=0.7","pagina":1,"por_pagina":20,"filtros":{"folio":"","nombre":"","area":""},"order":{"sortBy":"folio","sortDirection":"desc"}}', 'dc176c2d6fc496288e6ee81e35c8ffe3', '::1', 1543344847, 0.206552, '1', 401, '2018-11-27 18:54:07'),
(828, 'Beneficiarios/estudiosp', 'post', '{"Host":"localhost","Connection":"keep-alive","Content-Length":"123","Pragma":"no-cache","Cache-Control":"no-cache","Accept":"application\\/json, text\\/plain, *\\/*","Origin":"http:\\/\\/localhost:4200","Authorization":"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE1NDMzNDQ3ODIsImV4cCI6MTU0MzM3MzU4MiwiZGF0YSI6eyJpZHVzdWFyaW8iOiIyIiwibm9tYnJlIjoiYWRtaW4iLCJjb3JyZW8iOiJhZG1pbkBjb3JyZW8uY29tIiwicm9sZSI6IjEifSwibWVudSI6W3sicGF0aCI6Ilwvc3RhcnRlciIsInRpdGxlIjoiSW5pY2lvIiwiaWNvbiI6Im1kaSBtZGktaG9tZSIsImNsYXNzIjoiIiwibGFiZWwiOiIiLCJsYWJlbENsYXNzIjoiIiwiZXh0cmFsaW5rIjpmYWxzZSwic3VibWVudSI6W119LHsicGF0aCI6IlwvZXNvY2lvZWNvbm9taWNvIiwidGl0bGUiOiJFc3R1ZGlvIiwiaWNvbiI6Im1kaSBtZGktcGVuY2lsLWNpcmNsZSIsImNsYXNzIjoiIiwibGFiZWwiOiIiLCJsYWJlbENsYXNzIjoiIiwiZXh0cmFsaW5rIjpmYWxzZSwic3VibWVudSI6W119LHsicGF0aCI6IiIsInRpdGxlIjoiQ29uZmlndXJhY2lvbiIsImljb24iOiJtZGkgbWRpLXNldHRpbmdzIiwiY2xhc3MiOiJoYXMtYXJyb3ciLCJsYWJlbCI6IiIsImxhYmVsQ2xhc3MiOiIiLCJleHRyYWxpbmsiOmZhbHNlLCJzdWJtZW51IjpbeyJwYXRoIjoiXC91c3VhcmlvcyIsInRpdGxlIjoiVXN1YXJpb3MiLCJpY29uIjoibWRpIG1kaS1hY2NvdW50IiwiY2xhc3MiOiIiLCJsYWJlbCI6IiIsImxhYmVsQ2xhc3MiOiIiLCJleHRyYWxpbmsiOmZhbHNlLCJzdWJtZW51IjpbXX1dfV19.Y4x-65Rrq7YHpra3kCPi3PHOYrt5_niHtI7TmSXRuOA","beneficiarios":"dc176c2d6fc496288e6ee81e35c8ffe3","User-Agent":"Mozilla\\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\\/537.36 (KHTML, like Gecko) Chrome\\/70.0.3538.102 Safari\\/537.36","Content-Type":"application\\/json","Referer":"http:\\/\\/localhost:4200\\/","Accept-Encoding":"gzip, deflate, br","Accept-Language":"en,es-419;q=0.9,es;q=0.8,en-US;q=0.7","pagina":1,"por_pagina":20,"filtros":{"folio":"","nombre":"","area":""},"order":{"sortBy":"folio","sortDirection":"desc"}}', 'dc176c2d6fc496288e6ee81e35c8ffe3', '::1', 1543344847, 0.236965, '1', 401, '2018-11-27 18:54:07'),
(829, 'Beneficiarios/estudiosp', 'post', '{"Host":"localhost","Connection":"keep-alive","Content-Length":"123","Pragma":"no-cache","Cache-Control":"no-cache","Accept":"application\\/json, text\\/plain, *\\/*","Origin":"http:\\/\\/localhost:4200","Authorization":"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE1NDMzNDQ3ODIsImV4cCI6MTU0MzM3MzU4MiwiZGF0YSI6eyJpZHVzdWFyaW8iOiIyIiwibm9tYnJlIjoiYWRtaW4iLCJjb3JyZW8iOiJhZG1pbkBjb3JyZW8uY29tIiwicm9sZSI6IjEifSwibWVudSI6W3sicGF0aCI6Ilwvc3RhcnRlciIsInRpdGxlIjoiSW5pY2lvIiwiaWNvbiI6Im1kaSBtZGktaG9tZSIsImNsYXNzIjoiIiwibGFiZWwiOiIiLCJsYWJlbENsYXNzIjoiIiwiZXh0cmFsaW5rIjpmYWxzZSwic3VibWVudSI6W119LHsicGF0aCI6IlwvZXNvY2lvZWNvbm9taWNvIiwidGl0bGUiOiJFc3R1ZGlvIiwiaWNvbiI6Im1kaSBtZGktcGVuY2lsLWNpcmNsZSIsImNsYXNzIjoiIiwibGFiZWwiOiIiLCJsYWJlbENsYXNzIjoiIiwiZXh0cmFsaW5rIjpmYWxzZSwic3VibWVudSI6W119LHsicGF0aCI6IiIsInRpdGxlIjoiQ29uZmlndXJhY2lvbiIsImljb24iOiJtZGkgbWRpLXNldHRpbmdzIiwiY2xhc3MiOiJoYXMtYXJyb3ciLCJsYWJlbCI6IiIsImxhYmVsQ2xhc3MiOiIiLCJleHRyYWxpbmsiOmZhbHNlLCJzdWJtZW51IjpbeyJwYXRoIjoiXC91c3VhcmlvcyIsInRpdGxlIjoiVXN1YXJpb3MiLCJpY29uIjoibWRpIG1kaS1hY2NvdW50IiwiY2xhc3MiOiIiLCJsYWJlbCI6IiIsImxhYmVsQ2xhc3MiOiIiLCJleHRyYWxpbmsiOmZhbHNlLCJzdWJtZW51IjpbXX1dfV19.Y4x-65Rrq7YHpra3kCPi3PHOYrt5_niHtI7TmSXRuOA","beneficiarios":"dc176c2d6fc496288e6ee81e35c8ffe3","User-Agent":"Mozilla\\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\\/537.36 (KHTML, like Gecko) Chrome\\/70.0.3538.102 Safari\\/537.36","Content-Type":"application\\/json","Referer":"http:\\/\\/localhost:4200\\/","Accept-Encoding":"gzip, deflate, br","Accept-Language":"en,es-419;q=0.9,es;q=0.8,en-US;q=0.7","pagina":1,"por_pagina":20,"filtros":{"folio":"","nombre":"","area":""},"order":{"sortBy":"folio","sortDirection":"desc"}}', 'dc176c2d6fc496288e6ee81e35c8ffe3', '::1', 1543344850, 0.141722, '1', 401, '2018-11-27 18:54:10'),
(830, 'Beneficiarios/estudiosp', 'post', '{"Host":"localhost","Connection":"keep-alive","Content-Length":"123","Pragma":"no-cache","Cache-Control":"no-cache","Accept":"application\\/json, text\\/plain, *\\/*","Origin":"http:\\/\\/localhost:4200","Authorization":"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE1NDMzNDQ3ODIsImV4cCI6MTU0MzM3MzU4MiwiZGF0YSI6eyJpZHVzdWFyaW8iOiIyIiwibm9tYnJlIjoiYWRtaW4iLCJjb3JyZW8iOiJhZG1pbkBjb3JyZW8uY29tIiwicm9sZSI6IjEifSwibWVudSI6W3sicGF0aCI6Ilwvc3RhcnRlciIsInRpdGxlIjoiSW5pY2lvIiwiaWNvbiI6Im1kaSBtZGktaG9tZSIsImNsYXNzIjoiIiwibGFiZWwiOiIiLCJsYWJlbENsYXNzIjoiIiwiZXh0cmFsaW5rIjpmYWxzZSwic3VibWVudSI6W119LHsicGF0aCI6IlwvZXNvY2lvZWNvbm9taWNvIiwidGl0bGUiOiJFc3R1ZGlvIiwiaWNvbiI6Im1kaSBtZGktcGVuY2lsLWNpcmNsZSIsImNsYXNzIjoiIiwibGFiZWwiOiIiLCJsYWJlbENsYXNzIjoiIiwiZXh0cmFsaW5rIjpmYWxzZSwic3VibWVudSI6W119LHsicGF0aCI6IiIsInRpdGxlIjoiQ29uZmlndXJhY2lvbiIsImljb24iOiJtZGkgbWRpLXNldHRpbmdzIiwiY2xhc3MiOiJoYXMtYXJyb3ciLCJsYWJlbCI6IiIsImxhYmVsQ2xhc3MiOiIiLCJleHRyYWxpbmsiOmZhbHNlLCJzdWJtZW51IjpbeyJwYXRoIjoiXC91c3VhcmlvcyIsInRpdGxlIjoiVXN1YXJpb3MiLCJpY29uIjoibWRpIG1kaS1hY2NvdW50IiwiY2xhc3MiOiIiLCJsYWJlbCI6IiIsImxhYmVsQ2xhc3MiOiIiLCJleHRyYWxpbmsiOmZhbHNlLCJzdWJtZW51IjpbXX1dfV19.Y4x-65Rrq7YHpra3kCPi3PHOYrt5_niHtI7TmSXRuOA","beneficiarios":"dc176c2d6fc496288e6ee81e35c8ffe3","User-Agent":"Mozilla\\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\\/537.36 (KHTML, like Gecko) Chrome\\/70.0.3538.102 Safari\\/537.36","Content-Type":"application\\/json","Referer":"http:\\/\\/localhost:4200\\/","Accept-Encoding":"gzip, deflate, br","Accept-Language":"en,es-419;q=0.9,es;q=0.8,en-US;q=0.7","pagina":1,"por_pagina":20,"filtros":{"folio":"","nombre":"","area":""},"order":{"sortBy":"folio","sortDirection":"desc"}}', 'dc176c2d6fc496288e6ee81e35c8ffe3', '::1', 1543344850, 0.178377, '1', 401, '2018-11-27 18:54:10'),
(831, 'Beneficiarios/estudiosp', 'post', '{"Host":"localhost","Connection":"keep-alive","Content-Length":"123","Pragma":"no-cache","Cache-Control":"no-cache","Accept":"application\\/json, text\\/plain, *\\/*","Origin":"http:\\/\\/localhost:4200","Authorization":"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE1NDMzNDQ3ODIsImV4cCI6MTU0MzM3MzU4MiwiZGF0YSI6eyJpZHVzdWFyaW8iOiIyIiwibm9tYnJlIjoiYWRtaW4iLCJjb3JyZW8iOiJhZG1pbkBjb3JyZW8uY29tIiwicm9sZSI6IjEifSwibWVudSI6W3sicGF0aCI6Ilwvc3RhcnRlciIsInRpdGxlIjoiSW5pY2lvIiwiaWNvbiI6Im1kaSBtZGktaG9tZSIsImNsYXNzIjoiIiwibGFiZWwiOiIiLCJsYWJlbENsYXNzIjoiIiwiZXh0cmFsaW5rIjpmYWxzZSwic3VibWVudSI6W119LHsicGF0aCI6IlwvZXNvY2lvZWNvbm9taWNvIiwidGl0bGUiOiJFc3R1ZGlvIiwiaWNvbiI6Im1kaSBtZGktcGVuY2lsLWNpcmNsZSIsImNsYXNzIjoiIiwibGFiZWwiOiIiLCJsYWJlbENsYXNzIjoiIiwiZXh0cmFsaW5rIjpmYWxzZSwic3VibWVudSI6W119LHsicGF0aCI6IiIsInRpdGxlIjoiQ29uZmlndXJhY2lvbiIsImljb24iOiJtZGkgbWRpLXNldHRpbmdzIiwiY2xhc3MiOiJoYXMtYXJyb3ciLCJsYWJlbCI6IiIsImxhYmVsQ2xhc3MiOiIiLCJleHRyYWxpbmsiOmZhbHNlLCJzdWJtZW51IjpbeyJwYXRoIjoiXC91c3VhcmlvcyIsInRpdGxlIjoiVXN1YXJpb3MiLCJpY29uIjoibWRpIG1kaS1hY2NvdW50IiwiY2xhc3MiOiIiLCJsYWJlbCI6IiIsImxhYmVsQ2xhc3MiOiIiLCJleHRyYWxpbmsiOmZhbHNlLCJzdWJtZW51IjpbXX1dfV19.Y4x-65Rrq7YHpra3kCPi3PHOYrt5_niHtI7TmSXRuOA","beneficiarios":"dc176c2d6fc496288e6ee81e35c8ffe3","User-Agent":"Mozilla\\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\\/537.36 (KHTML, like Gecko) Chrome\\/70.0.3538.102 Safari\\/537.36","Content-Type":"application\\/json","Referer":"http:\\/\\/localhost:4200\\/","Accept-Encoding":"gzip, deflate, br","Accept-Language":"en,es-419;q=0.9,es;q=0.8,en-US;q=0.7","pagina":1,"por_pagina":20,"filtros":{"folio":"","nombre":"","area":""},"order":{"sortBy":"folio","sortDirection":"desc"}}', 'dc176c2d6fc496288e6ee81e35c8ffe3', '::1', 1543349440, 0.154968, '1', 401, '2018-11-27 20:10:40'),
(832, 'Beneficiarios/estudiosp', 'post', '{"Host":"localhost","Connection":"keep-alive","Content-Length":"123","Pragma":"no-cache","Cache-Control":"no-cache","Accept":"application\\/json, text\\/plain, *\\/*","Origin":"http:\\/\\/localhost:4200","Authorization":"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE1NDMzNDQ3ODIsImV4cCI6MTU0MzM3MzU4MiwiZGF0YSI6eyJpZHVzdWFyaW8iOiIyIiwibm9tYnJlIjoiYWRtaW4iLCJjb3JyZW8iOiJhZG1pbkBjb3JyZW8uY29tIiwicm9sZSI6IjEifSwibWVudSI6W3sicGF0aCI6Ilwvc3RhcnRlciIsInRpdGxlIjoiSW5pY2lvIiwiaWNvbiI6Im1kaSBtZGktaG9tZSIsImNsYXNzIjoiIiwibGFiZWwiOiIiLCJsYWJlbENsYXNzIjoiIiwiZXh0cmFsaW5rIjpmYWxzZSwic3VibWVudSI6W119LHsicGF0aCI6IlwvZXNvY2lvZWNvbm9taWNvIiwidGl0bGUiOiJFc3R1ZGlvIiwiaWNvbiI6Im1kaSBtZGktcGVuY2lsLWNpcmNsZSIsImNsYXNzIjoiIiwibGFiZWwiOiIiLCJsYWJlbENsYXNzIjoiIiwiZXh0cmFsaW5rIjpmYWxzZSwic3VibWVudSI6W119LHsicGF0aCI6IiIsInRpdGxlIjoiQ29uZmlndXJhY2lvbiIsImljb24iOiJtZGkgbWRpLXNldHRpbmdzIiwiY2xhc3MiOiJoYXMtYXJyb3ciLCJsYWJlbCI6IiIsImxhYmVsQ2xhc3MiOiIiLCJleHRyYWxpbmsiOmZhbHNlLCJzdWJtZW51IjpbeyJwYXRoIjoiXC91c3VhcmlvcyIsInRpdGxlIjoiVXN1YXJpb3MiLCJpY29uIjoibWRpIG1kaS1hY2NvdW50IiwiY2xhc3MiOiIiLCJsYWJlbCI6IiIsImxhYmVsQ2xhc3MiOiIiLCJleHRyYWxpbmsiOmZhbHNlLCJzdWJtZW51IjpbXX1dfV19.Y4x-65Rrq7YHpra3kCPi3PHOYrt5_niHtI7TmSXRuOA","beneficiarios":"dc176c2d6fc496288e6ee81e35c8ffe3","User-Agent":"Mozilla\\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\\/537.36 (KHTML, like Gecko) Chrome\\/70.0.3538.102 Safari\\/537.36","Content-Type":"application\\/json","Referer":"http:\\/\\/localhost:4200\\/","Accept-Encoding":"gzip, deflate, br","Accept-Language":"en,es-419;q=0.9,es;q=0.8,en-US;q=0.7","pagina":1,"por_pagina":20,"filtros":{"folio":"","nombre":"","area":""},"order":{"sortBy":"folio","sortDirection":"desc"}}', 'dc176c2d6fc496288e6ee81e35c8ffe3', '::1', 1543349440, 0.176481, '1', 401, '2018-11-27 20:10:40');
INSERT INTO `ws_logs` (`id`, `uri`, `method`, `params`, `api_key`, `ip_address`, `time`, `rtime`, `authorized`, `response_code`, `fecha`) VALUES
(833, 'Beneficiarios/estudiosp', 'post', '{"Host":"localhost","Connection":"keep-alive","Content-Length":"123","Pragma":"no-cache","Cache-Control":"no-cache","Accept":"application\\/json, text\\/plain, *\\/*","Origin":"http:\\/\\/localhost:4200","Authorization":"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE1NDMzNDQ3ODIsImV4cCI6MTU0MzM3MzU4MiwiZGF0YSI6eyJpZHVzdWFyaW8iOiIyIiwibm9tYnJlIjoiYWRtaW4iLCJjb3JyZW8iOiJhZG1pbkBjb3JyZW8uY29tIiwicm9sZSI6IjEifSwibWVudSI6W3sicGF0aCI6Ilwvc3RhcnRlciIsInRpdGxlIjoiSW5pY2lvIiwiaWNvbiI6Im1kaSBtZGktaG9tZSIsImNsYXNzIjoiIiwibGFiZWwiOiIiLCJsYWJlbENsYXNzIjoiIiwiZXh0cmFsaW5rIjpmYWxzZSwic3VibWVudSI6W119LHsicGF0aCI6IlwvZXNvY2lvZWNvbm9taWNvIiwidGl0bGUiOiJFc3R1ZGlvIiwiaWNvbiI6Im1kaSBtZGktcGVuY2lsLWNpcmNsZSIsImNsYXNzIjoiIiwibGFiZWwiOiIiLCJsYWJlbENsYXNzIjoiIiwiZXh0cmFsaW5rIjpmYWxzZSwic3VibWVudSI6W119LHsicGF0aCI6IiIsInRpdGxlIjoiQ29uZmlndXJhY2lvbiIsImljb24iOiJtZGkgbWRpLXNldHRpbmdzIiwiY2xhc3MiOiJoYXMtYXJyb3ciLCJsYWJlbCI6IiIsImxhYmVsQ2xhc3MiOiIiLCJleHRyYWxpbmsiOmZhbHNlLCJzdWJtZW51IjpbeyJwYXRoIjoiXC91c3VhcmlvcyIsInRpdGxlIjoiVXN1YXJpb3MiLCJpY29uIjoibWRpIG1kaS1hY2NvdW50IiwiY2xhc3MiOiIiLCJsYWJlbCI6IiIsImxhYmVsQ2xhc3MiOiIiLCJleHRyYWxpbmsiOmZhbHNlLCJzdWJtZW51IjpbXX1dfV19.Y4x-65Rrq7YHpra3kCPi3PHOYrt5_niHtI7TmSXRuOA","beneficiarios":"dc176c2d6fc496288e6ee81e35c8ffe3","User-Agent":"Mozilla\\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\\/537.36 (KHTML, like Gecko) Chrome\\/70.0.3538.102 Safari\\/537.36","Content-Type":"application\\/json","Referer":"http:\\/\\/localhost:4200\\/","Accept-Encoding":"gzip, deflate, br","Accept-Language":"en,es-419;q=0.9,es;q=0.8,en-US;q=0.7","pagina":1,"por_pagina":20,"filtros":{"folio":"","nombre":"","area":""},"order":{"sortBy":"folio","sortDirection":"desc"}}', 'dc176c2d6fc496288e6ee81e35c8ffe3', '::1', 1543349476, 0.159428, '1', 401, '2018-11-27 20:11:16'),
(834, 'Beneficiarios/estudiosp', 'post', '{"Host":"localhost","Connection":"keep-alive","Content-Length":"123","Pragma":"no-cache","Cache-Control":"no-cache","Accept":"application\\/json, text\\/plain, *\\/*","Origin":"http:\\/\\/localhost:4200","Authorization":"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE1NDMzNDQ3ODIsImV4cCI6MTU0MzM3MzU4MiwiZGF0YSI6eyJpZHVzdWFyaW8iOiIyIiwibm9tYnJlIjoiYWRtaW4iLCJjb3JyZW8iOiJhZG1pbkBjb3JyZW8uY29tIiwicm9sZSI6IjEifSwibWVudSI6W3sicGF0aCI6Ilwvc3RhcnRlciIsInRpdGxlIjoiSW5pY2lvIiwiaWNvbiI6Im1kaSBtZGktaG9tZSIsImNsYXNzIjoiIiwibGFiZWwiOiIiLCJsYWJlbENsYXNzIjoiIiwiZXh0cmFsaW5rIjpmYWxzZSwic3VibWVudSI6W119LHsicGF0aCI6IlwvZXNvY2lvZWNvbm9taWNvIiwidGl0bGUiOiJFc3R1ZGlvIiwiaWNvbiI6Im1kaSBtZGktcGVuY2lsLWNpcmNsZSIsImNsYXNzIjoiIiwibGFiZWwiOiIiLCJsYWJlbENsYXNzIjoiIiwiZXh0cmFsaW5rIjpmYWxzZSwic3VibWVudSI6W119LHsicGF0aCI6IiIsInRpdGxlIjoiQ29uZmlndXJhY2lvbiIsImljb24iOiJtZGkgbWRpLXNldHRpbmdzIiwiY2xhc3MiOiJoYXMtYXJyb3ciLCJsYWJlbCI6IiIsImxhYmVsQ2xhc3MiOiIiLCJleHRyYWxpbmsiOmZhbHNlLCJzdWJtZW51IjpbeyJwYXRoIjoiXC91c3VhcmlvcyIsInRpdGxlIjoiVXN1YXJpb3MiLCJpY29uIjoibWRpIG1kaS1hY2NvdW50IiwiY2xhc3MiOiIiLCJsYWJlbCI6IiIsImxhYmVsQ2xhc3MiOiIiLCJleHRyYWxpbmsiOmZhbHNlLCJzdWJtZW51IjpbXX1dfV19.Y4x-65Rrq7YHpra3kCPi3PHOYrt5_niHtI7TmSXRuOA","beneficiarios":"dc176c2d6fc496288e6ee81e35c8ffe3","User-Agent":"Mozilla\\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\\/537.36 (KHTML, like Gecko) Chrome\\/70.0.3538.102 Safari\\/537.36","Content-Type":"application\\/json","Referer":"http:\\/\\/localhost:4200\\/","Accept-Encoding":"gzip, deflate, br","Accept-Language":"en,es-419;q=0.9,es;q=0.8,en-US;q=0.7","pagina":1,"por_pagina":20,"filtros":{"folio":"","nombre":"","area":""},"order":{"sortBy":"folio","sortDirection":"desc"}}', 'dc176c2d6fc496288e6ee81e35c8ffe3', '::1', 1543349476, 0.252913, '1', 401, '2018-11-27 20:11:16'),
(835, 'Beneficiarios/login', 'post', '{"Host":"localhost","Connection":"keep-alive","Content-Length":"51","Accept":"application\\/json, text\\/plain, *\\/*","Origin":"http:\\/\\/localhost:4200","Authorization":"null","beneficiarios":"dc176c2d6fc496288e6ee81e35c8ffe3","User-Agent":"Mozilla\\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\\/537.36 (KHTML, like Gecko) Chrome\\/70.0.3538.102 Safari\\/537.36","Content-Type":"application\\/json","Referer":"http:\\/\\/localhost:4200\\/","Accept-Encoding":"gzip, deflate, br","Accept-Language":"en,es-419;q=0.9,es;q=0.8,en-US;q=0.7","correo":"cardenas@correo.com","password":"admin"}', 'dc176c2d6fc496288e6ee81e35c8ffe3', '::1', 1543413745, 0.751108, '1', 401, '2018-11-28 14:02:25'),
(836, 'Beneficiarios/login', 'post', '{"Host":"localhost","Connection":"keep-alive","Content-Length":"51","Pragma":"no-cache","Cache-Control":"no-cache","Accept":"application\\/json, text\\/plain, *\\/*","Origin":"http:\\/\\/localhost:4200","Authorization":"null","beneficiarios":"dc176c2d6fc496288e6ee81e35c8ffe3","User-Agent":"Mozilla\\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\\/537.36 (KHTML, like Gecko) Chrome\\/70.0.3538.102 Safari\\/537.36","Content-Type":"application\\/json","Referer":"http:\\/\\/localhost:4200\\/","Accept-Encoding":"gzip, deflate, br","Accept-Language":"en,es-419;q=0.9,es;q=0.8,en-US;q=0.7","correo":"cardenas@correo.com","password":"admin"}', 'dc176c2d6fc496288e6ee81e35c8ffe3', '::1', 1543413754, 0.274469, '1', 401, '2018-11-28 14:02:34'),
(837, 'Beneficiarios/login', 'post', '{"Host":"localhost","Connection":"keep-alive","Content-Length":"48","Pragma":"no-cache","Cache-Control":"no-cache","Accept":"application\\/json, text\\/plain, *\\/*","Origin":"http:\\/\\/localhost:4200","Authorization":"null","beneficiarios":"dc176c2d6fc496288e6ee81e35c8ffe3","User-Agent":"Mozilla\\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\\/537.36 (KHTML, like Gecko) Chrome\\/70.0.3538.102 Safari\\/537.36","Content-Type":"application\\/json","Referer":"http:\\/\\/localhost:4200\\/","Accept-Encoding":"gzip, deflate, br","Accept-Language":"en,es-419;q=0.9,es;q=0.8,en-US;q=0.7","correo":"admin@correo.com","password":"admin"}', 'dc176c2d6fc496288e6ee81e35c8ffe3', '::1', 1543413759, 0.339854, '1', 200, '2018-11-28 14:02:39'),
(838, 'Beneficiarios/login', 'post', '{"Host":"localhost","Connection":"keep-alive","Content-Length":"48","Pragma":"no-cache","Cache-Control":"no-cache","Accept":"application\\/json, text\\/plain, *\\/*","Origin":"http:\\/\\/localhost:4200","Authorization":"null","beneficiarios":"dc176c2d6fc496288e6ee81e35c8ffe3","User-Agent":"Mozilla\\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\\/537.36 (KHTML, like Gecko) Chrome\\/70.0.3538.110 Safari\\/537.36","Content-Type":"application\\/json","Referer":"http:\\/\\/localhost:4200\\/","Accept-Encoding":"gzip, deflate, br","Accept-Language":"en,es-419;q=0.9,es;q=0.8,en-US;q=0.7","correo":"admin@correo.com","password":"admin"}', 'dc176c2d6fc496288e6ee81e35c8ffe3', '::1', 1543502156, 0.612224, '1', 200, '2018-11-29 14:35:56'),
(839, 'Beneficiarios/login', 'post', '{"Host":"localhost","Connection":"keep-alive","Content-Length":"48","Pragma":"no-cache","Cache-Control":"no-cache","Accept":"application\\/json, text\\/plain, *\\/*","Origin":"http:\\/\\/localhost:4200","Authorization":"null","beneficiarios":"dc176c2d6fc496288e6ee81e35c8ffe3","User-Agent":"Mozilla\\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\\/537.36 (KHTML, like Gecko) Chrome\\/70.0.3538.110 Safari\\/537.36","Content-Type":"application\\/json","Referer":"http:\\/\\/localhost:4200\\/","Accept-Encoding":"gzip, deflate, br","Accept-Language":"en,es-419;q=0.9,es;q=0.8,en-US;q=0.7","correo":"admin@correo.com","password":"admin"}', 'dc176c2d6fc496288e6ee81e35c8ffe3', '::1', 1543524346, 0.209468, '1', 200, '2018-11-29 20:45:46'),
(840, 'Beneficiarios/login', 'post', '{"Host":"localhost","Connection":"keep-alive","Content-Length":"47","Accept":"application\\/json, text\\/plain, *\\/*","Origin":"http:\\/\\/localhost:4200","Authorization":"null","beneficiarios":"dc176c2d6fc496288e6ee81e35c8ffe3","User-Agent":"Mozilla\\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\\/537.36 (KHTML, like Gecko) Chrome\\/70.0.3538.110 Safari\\/537.36","Content-Type":"application\\/json","Referer":"http:\\/\\/localhost:4200\\/","Accept-Encoding":"gzip, deflate, br","Accept-Language":"en,es-419;q=0.9,es;q=0.8,en-US;q=0.7","correo":"demo@correo.com","password":"admin"}', 'dc176c2d6fc496288e6ee81e35c8ffe3', '::1', 1543526449, 0.189987, '1', 401, '2018-11-29 21:20:49'),
(841, 'Beneficiarios/login', 'post', '{"Host":"localhost","Connection":"keep-alive","Content-Length":"48","Accept":"application\\/json, text\\/plain, *\\/*","Origin":"http:\\/\\/localhost:4200","Authorization":"null","beneficiarios":"dc176c2d6fc496288e6ee81e35c8ffe3","User-Agent":"Mozilla\\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\\/537.36 (KHTML, like Gecko) Chrome\\/70.0.3538.110 Safari\\/537.36","Content-Type":"application\\/json","Referer":"http:\\/\\/localhost:4200\\/","Accept-Encoding":"gzip, deflate, br","Accept-Language":"en,es-419;q=0.9,es;q=0.8,en-US;q=0.7","correo":"admin@correo.com","password":"admin"}', 'dc176c2d6fc496288e6ee81e35c8ffe3', '::1', 1543526453, 0.266353, '1', 200, '2018-11-29 21:20:53'),
(842, 'Beneficiarios/login', 'post', '{"Host":"localhost","Connection":"keep-alive","Content-Length":"48","Accept":"application\\/json, text\\/plain, *\\/*","Origin":"http:\\/\\/localhost:4200","Authorization":"null","beneficiarios":"dc176c2d6fc496288e6ee81e35c8ffe3","User-Agent":"Mozilla\\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\\/537.36 (KHTML, like Gecko) Chrome\\/70.0.3538.110 Safari\\/537.36","Content-Type":"application\\/json","Referer":"http:\\/\\/localhost:4200\\/","Accept-Encoding":"gzip, deflate, br","Accept-Language":"en,es-419;q=0.9,es;q=0.8,en-US;q=0.7","correo":"admin@correo.com","password":"admin"}', 'dc176c2d6fc496288e6ee81e35c8ffe3', '::1', 1543588629, 0.582937, '1', 200, '2018-11-30 14:37:09');
-- --------------------------------------------------------
--
-- Structure for view `estudios_paginado`
--
DROP TABLE IF EXISTS `estudios_paginado`;
CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `estudios_paginado` AS select `e`.`folio` AS `folio`,concat(`e`.`nombre`,' ',`e`.`paterno`,' ',`e`.`materno`) AS `solicitante`,`a`.`idarea` AS `idarea`,`a`.`nombre` AS `area` from (`estudio_socioeconomico` `e` left join `areas` `a` on((`e`.`idarea` = `a`.`idarea`))) ;
-- --------------------------------------------------------
--
-- Structure for view `view_estudios_paginado`
--
DROP TABLE IF EXISTS `view_estudios_paginado`;
CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `view_estudios_paginado` AS select `e`.`folio` AS `folio`,concat(`e`.`nombre`,' ',`e`.`paterno`,' ',`e`.`materno`) AS `solicitante`,`a`.`idarea` AS `idarea`,`a`.`nombre` AS `area` from (`estudio_socioeconomico` `e` left join `areas` `a` on((`e`.`idarea` = `a`.`idarea`))) ;
--
-- Indexes for dumped tables
--
--
-- Indexes for table `areas`
--
ALTER TABLE `areas`
ADD PRIMARY KEY (`idarea`);
--
-- Indexes for table `codigopostal`
--
ALTER TABLE `codigopostal`
ADD PRIMARY KEY (`idCodigoPostal`);
--
-- Indexes for table `colonias`
--
ALTER TABLE `colonias`
ADD PRIMARY KEY (`Idcolonia`),
ADD KEY `IdCodigoPostal` (`IdCodigoPostal`),
ADD KEY `IdTipoAsentamiento` (`IdTipoAsentamiento`),
ADD KEY `idsector` (`idsector`);
--
-- Indexes for table `estudio_socioeconomico`
--
ALTER TABLE `estudio_socioeconomico`
ADD PRIMARY KEY (`idestudio_socioeconomico`);
--
-- Indexes for table `es_respuestas`
--
ALTER TABLE `es_respuestas`
ADD PRIMARY KEY (`ides_respuesta`);
--
-- Indexes for table `preguntas`
--
ALTER TABLE `preguntas`
ADD PRIMARY KEY (`idpregunta`);
--
-- Indexes for table `respuestas`
--
ALTER TABLE `respuestas`
ADD PRIMARY KEY (`idrespuesta`);
--
-- Indexes for table `roles`
--
ALTER TABLE `roles`
ADD PRIMARY KEY (`idrol`);
--
-- Indexes for table `secciones`
--
ALTER TABLE `secciones`
ADD PRIMARY KEY (`idseccion`);
--
-- Indexes for table `tipo_asentamiento`
--
ALTER TABLE `tipo_asentamiento`
ADD PRIMARY KEY (`IdTipoAsentamiento`);
--
-- Indexes for table `usuarios`
--
ALTER TABLE `usuarios`
ADD PRIMARY KEY (`idusuario`);
--
-- Indexes for table `ws_access`
--
ALTER TABLE `ws_access`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `ws_keys`
--
ALTER TABLE `ws_keys`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `ws_logs`
--
ALTER TABLE `ws_logs`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `areas`
--
ALTER TABLE `areas`
MODIFY `idarea` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT for table `codigopostal`
--
ALTER TABLE `codigopostal`
MODIFY `idCodigoPostal` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=67;
--
-- AUTO_INCREMENT for table `colonias`
--
ALTER TABLE `colonias`
MODIFY `Idcolonia` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=258;
--
-- AUTO_INCREMENT for table `estudio_socioeconomico`
--
ALTER TABLE `estudio_socioeconomico`
MODIFY `idestudio_socioeconomico` int(55) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `es_respuestas`
--
ALTER TABLE `es_respuestas`
MODIFY `ides_respuesta` int(255) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `preguntas`
--
ALTER TABLE `preguntas`
MODIFY `idpregunta` int(25) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=12;
--
-- AUTO_INCREMENT for table `respuestas`
--
ALTER TABLE `respuestas`
MODIFY `idrespuesta` int(25) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=194;
--
-- AUTO_INCREMENT for table `roles`
--
ALTER TABLE `roles`
MODIFY `idrol` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
--
-- AUTO_INCREMENT for table `secciones`
--
ALTER TABLE `secciones`
MODIFY `idseccion` int(25) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
--
-- AUTO_INCREMENT for table `tipo_asentamiento`
--
ALTER TABLE `tipo_asentamiento`
MODIFY `IdTipoAsentamiento` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7;
--
-- AUTO_INCREMENT for table `usuarios`
--
ALTER TABLE `usuarios`
MODIFY `idusuario` int(50) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT for table `ws_access`
--
ALTER TABLE `ws_access`
MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
--
-- AUTO_INCREMENT for table `ws_keys`
--
ALTER TABLE `ws_keys`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT for table `ws_logs`
--
ALTER TABLE `ws_logs`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=843;
--
-- Constraints for dumped tables
--
--
-- Constraints for table `colonias`
--
ALTER TABLE `colonias`
ADD CONSTRAINT `colonias_ibfk_1` FOREIGN KEY (`IdCodigoPostal`) REFERENCES `codigopostal` (`idCodigoPostal`) ON UPDATE CASCADE,
ADD CONSTRAINT `colonias_ibfk_2` FOREIGN KEY (`IdTipoAsentamiento`) REFERENCES `tipo_asentamiento` (`IdTipoAsentamiento`) ON UPDATE CASCADE;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
| true |
b8fefbae01c3e311fcc5e2c0ab48ce7baac318f3 | SQL | garciandcruz/BurgerLog | /db/schema.sql | UTF-8 | 315 | 2.953125 | 3 | [] | no_license | CREATE DATABASE burgers_db;
USE burgers_db;
CREATE TABLE burgers
(
id int NOT NULL
AUTO_INCREMENT,
burger_name varchar
(255) NOT NULL,
eaten BOOLEAN DEFAULT false,
PRIMARY KEY
(id)
);
INSERT INTO burgers
(burger_name)
VALUES
('Hamburger'),
('Cheeseburger'),
('Mookie'),
('Bacon Cheeseburger');
| true |
01ba86c869371e709351b43abff97262317babb9 | SQL | BugIsComing/mybatisDemo | /src/main/resources/SQL/phone.sql | UTF-8 | 516 | 2.9375 | 3 | [] | no_license | drop table phone_user;
create table phone_user (
user_id integer ,
name varchar(20),
PRIMARY KEY (user_id)
);
INSERT INTO `phone_user` VALUES (1, 'LC');
INSERT INTO `phone_user` VALUES (2, 'LCLC');
drop table phone;
create table phone (
phone_id integer ,
phone_number varchar(20),
user_id integer,
PRIMARY KEY (phone_id)
);
INSERT INTO `phone` VALUES (1, '1234', 1);
INSERT INTO `phone` VALUES (2, '12345', 2);
INSERT INTO `phone` VALUES (3, '9875', 1);
INSERT INTO `phone` VALUES (4, '34345', 2);
| true |
9238356522027aac74c5047d2e63bd0932ccc5e3 | SQL | radtek/abs3 | /sql/mmfo/bars/Procedure/p_ff1_nn.sql | WINDOWS-1251 | 37,146 | 3 | 3 | [] | no_license |
PROMPT =====================================================================================
PROMPT *** Run *** ========== Scripts /Sql/BARS/Procedure/P_FF1_NN.sql =========*** Run ***
PROMPT =====================================================================================
PROMPT *** Create procedure P_FF1_NN ***
CREATE OR REPLACE PROCEDURE BARS.P_FF1_NN (dat_ DATE,
sheme_ VARCHAR2 DEFAULT 'G') IS
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% DESCRIPTION : #F1
% COPYRIGHT : Copyright UNITY-BARS Limited, 1999. All Rights Reserved.
% VERSION : 01/06/2018 (10/07/2017)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
: Dat_ -
sheme_ -
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
01.06.2018 2909 2924 ( . REF
2924 2625)
( OPER NLSA='2909...' NLSB='2625...')
2625
02.03.2017 TAG='52A'
29.04.2015 2909 3739 - KL_FF1
3 "CFB", "CFO", "CFC"
2620,2625,2909 3739
12.03.2015 12 804. .
08.01.2015 . 59
804
09.12.2014 . D6#71
( /.) D6#70
29.10.2014
(
)
10.10.2014
. "F1"
"I04","I05"
19.09.2014 c 23.09.2014 Dat1_
( )
(Dat1_ := Dat_)
08.07.2014 VIEW PROVODKI PROVODKI_OTC
27.06.2014 "I04","I05" . "F1"
30.04.2014 2620 3739
KL_FF1
04.02.2014 M37, MMV, CN3, CN4 . D_1PB, D_REF
. DATT ( ),
REFT ( ) ..
CN3, CN4 .
13.12.2013 . D_1PB #F1
D_1PB, D_REF
02.12.2013 - 15.11.2013
15.11.2014 - - KL_FF1 NLSD='2909' NLSK='3739'
OB22='18'
" "
27.09.2013 - CN3, CN4 ( )
. "D_1PB"-
"D_REF"-
31.07.2013 - M37, MMV ( )
. "D_1PB"-
"D_REF"-
29.04.2013 - 2909400129 2620 2924
" " . KOD_G
(/ )
17.04.2013 - 2924 1919
('%%','%%','%transfer%')
03.01.2013 -
01.01.201 ( ) ..
24.12.2012 - 2909 2900 - " "
42 41 ( )
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
kodf_ VARCHAR2 (2) := 'F1';
sql_z VARCHAR2 (200);
typ_ NUMBER;
flag_ NUMBER;
ko_ VARCHAR2 (2); -- ii i i
ko_1 VARCHAR2 (2); -- ii i i
kod_b_ VARCHAR2 (10); --
nam_b VARCHAR2 (70); --
kod_g_ Varchar2 (3);
kod_g_pb1 Varchar2 (3);
n_ NUMBER := 4;
acc_ NUMBER;
acc1_ NUMBER;
acck_ NUMBER;
kv_ NUMBER;
kv1_ NUMBER;
nls_ VARCHAR2 (15);
nls1_ VARCHAR2 (15);
nlsk_ VARCHAR2 (15);
nlsk1_ VARCHAR2 (15);
nbuc1_ VARCHAR2 (20);
nbuc_ VARCHAR2 (20);
country_ VARCHAR2 (3);
d060_ NUMBER;
rnk_ NUMBER;
okpo_ VARCHAR2 (14);
nmk_ VARCHAR2 (70);
k040_ VARCHAR2 (3);
val_ VARCHAR2 (70);
tg_ VARCHAR2 (70);
fdat_ DATE;
fdat_CN3 DATE;
data_ DATE;
dat1_ DATE;
dat2_ DATE;
kolvo_ NUMBER;
sum0_ DECIMAL (24);
sumk0_ DECIMAL (24);
kodp_ VARCHAR2 (12);
znap_ VARCHAR2 (70);
tag_ VARCHAR2 (5);
d#73_ Varchar2(3);
kodn_ Varchar2(7);
userid_ NUMBER;
ref_ NUMBER;
rez_ number;
rez1_ number;
mfo_ number;
mfou_ number;
tt_ varchar2(3);
ttd_ varchar2(3);
nlsdd_ varchar2(20);
formOk_ boolean;
accdd_ number;
nazn_ varchar2(160);
comm_ varchar2(200);
value_ varchar2(200);
atrt_ varchar2(50);
pasp_ varchar2(20);
paspn_ varchar2(20);
pr_pasp_ number;
flag_f_ number := 0;
last_dayF date;
god_ varchar2(4);
one_day_ date;
tobo_ varchar2(30);
ref_m37 number;
dat_m37 date;
swift_k_ VARCHAR2 (12);
ob22_ VARCHAR2 (2);
-- i ii i i
CURSOR opl_dok
IS
SELECT t.ko, t.rnk, t.fdat, t.REF, t.tt, t.accd, t.nlsd, t.kv, t.acck, t.nlsk,
t.s_nom, t.s_eqv, t.nazn, t.branch
FROM OTCN_PROV_TEMP t
WHERE t.nlsd is not null
and t.nlsk is not null;
-------------------------------------------------------------------
PROCEDURE p_ins (p_kodp_ IN VARCHAR2, p_znap_ IN VARCHAR2)
IS
l_kodp_ VARCHAR2 (12);
BEGIN
l_kodp_ := p_kodp_ ;
comm_ := substr(trim('i = '||rez_||
' . = '||trim(pasp_)||
' N . = '||trim(paspn_)||
' '||trim(atrt_)||
' '||trim(nazn_) ) ,1 ,200);
INSERT INTO rnbu_trace
(nls, kv, odate, kodp, znap, nbuc, ref, rnk, comm, tobo )
VALUES
(nls1_, kv_, fdat_, l_kodp_, p_znap_, nbuc_, ref_, rnk_, comm_, tobo_ ) ;
END;
-------------------------------------------------------------------
-----------------------------------------------------------------------------
BEGIN
commit;
EXECUTE IMMEDIATE 'ALTER SESSION ENABLE PARALLEL DML';
EXECUTE IMMEDIATE 'ALTER SESSION SET NLS_NUMERIC_CHARACTERS=''.,''';
-------------------------------------------------------------------
userid_ := user_id;
EXECUTE IMMEDIATE 'TRUNCATE TABLE RNBU_TRACE';
EXECUTE IMMEDIATE 'TRUNCATE TABLE otcn_prov_temp';
-------------------------------------------------------------------
--
mfo_ := F_Ourmfo ();
-- ""
BEGIN
SELECT mfou
INTO mfou_
FROM BANKS
WHERE mfo = mfo_;
EXCEPTION
WHEN NO_DATA_FOUND
THEN
mfou_ := mfo_;
END;
-------------------------------------------------------------------
Dat1_ := TRUNC(Dat_,'MM');
select min(fdat)
into Dat1_
from fdat
where fdat >= Dat1_;
IF dat_ > to_date('22092014','ddmmyyyy')
THEN
Dat1_ := Dat_;
END IF;
god_ := TO_CHAR(Dat_,'YYYY');
IF to_char(dat_,'MM')='12'
THEN
god_ := to_char(to_number(god_)+1);
END IF;
last_dayF := last_day(Dat_);
one_day_ := to_date('01' || to_char(add_months(dat_,1),'MM') || god_,'ddmmyyyy');
dat2_ := one_day_;
-- ?
SELECT COUNT (*)
INTO kolvo_
FROM holiday
WHERE holiday = dat2_ AND kv = 980;
-- ,
IF kolvo_ <> 0
THEN
IF to_char(dat_,'MM') = '12'
THEN
select min(fdat)
into one_day_
from fdat
where fdat > dat2_;
ELSE
select min(fdat)
into one_day_
from fdat
where fdat >= dat2_;
END IF;
END IF;
-- ( 08.09.2010)
IF Dat_ = to_date('08092010','ddmmyyyy')
THEN
Dat1_ := Dat_;
END IF;
--
p_proc_set (kodf_, sheme_, nbuc1_, typ_);
nbuc_ := nbuc1_;
-- ,
-- i ii i i
-- i ( i i i)
IF mfou_ = 300465 and mfo_ = mfou_ then
INSERT INTO OTCN_PROV_TEMP
(ko, rnk, fdat, REF, tt, accd, nlsd, kv, acck, nlsk, s_nom, s_eqv, nazn, branch)
SELECT *
FROM ( -- i
SELECT 1 ko,
(case when o.nbsd IN ('2620','2902','2924') then o.rnkd else o.rnkk end) rnk,
o.fdat, o.ref, o.tt, o.accd, o.nlsd, o.kv,
o.acck, o.nlsk,
o.s * 100 s_nom,
gl.p_icurval (o.kv, o.s * 100, o.fdat) s_eqv, o.nazn, o.branch
FROM provodki_otc o
WHERE o.fdat = Dat_
AND o.kv != 980
AND (mfou_ = 300465 and mfo_ = mfou_)
AND (o.nbsd IN ('2620','2902','2924') AND
o.nbsk IN ('1500','1919','2909')
or
o.nbsd IN ('1001','1002') AND
o.nbsk IN ('1919','2909')
)
AND (LOWER (o.nazn) LIKE '%%' OR
LOWER (o.nazn) LIKE '%%' OR
LOWER (o.nazn) LIKE '%transfer%')
UNION
SELECT 1 ko,
(case when o.nbsd IN ('2620','2902','2924') then o.rnkd else o.rnkk end) rnk,
o.fdat, o.ref, o.tt, o.accd, o.nlsd, o.kv,
o.acck, o.nlsk,
o.s * 100 s_nom,
gl.p_icurval (o.kv, o.s * 100, o.fdat) s_eqv, o.nazn, o.branch
FROM provodki_otc o, kl_ff1 k
WHERE o.fdat = Dat_
AND o.kv != 980
AND (mfou_ = 300465 and mfo_ = mfou_)
AND (o.nbsd IN ('1001','1002') AND
o.nbsk = '2909'
or
o.nbsd IN ('2620','2902','2924') AND
o.nbsk IN ('1500','1919','2909'))
AND o.nlsd LIKE k.nlsd || '%'
AND o.nlsk LIKE k.nlsk || '%'
AND trim(k.ob22) is null
UNION
SELECT 1 ko, o.rnkk rnk, o.fdat, o.ref, o.tt, o.accd, o.nlsd, o.kv,
o.acck, o.nlsk,
o.s * 100 s_nom,
gl.p_icurval (o.kv, o.s * 100, o.fdat) s_eqv, o.nazn, o.branch
FROM provodki_otc o, kl_ff1 k
WHERE o.fdat = Dat_
AND o.kv != 980
AND (mfou_ = 300465 and mfo_ = mfou_)
AND o.nbsd IN ('1001','1002')
AND o.nbsk = '2909'
AND o.nlsd LIKE k.nlsd || '%'
AND o.nlsk LIKE k.nlsk || '%'
AND NVL(k.ob22, o.ob22k) = o.ob22k
UNION
-- i ( i)
SELECT 2 ko, o.rnkk rnk, o.fdat, o.ref, o.tt, o.accd, o.nlsd, o.kv,
o.acck, o.nlsk,
o.s * 100 s_nom,
gl.p_icurval (o.kv, o.s * 100, o.fdat) s_eqv, o.nazn, o.branch
FROM provodki_otc o
WHERE o.fdat = Dat_
AND o.kv != 980
AND (mfou_ = 300465 and mfo_ = mfou_)
AND (o.nbsd IN ('1500','1600','2603','3720','3739','3900',
'2809','2909','1919')
AND o.nbsk IN ('2620','2625','2924') )
AND (LOWER (o.nazn) LIKE '%%' OR
LOWER (o.nazn) LIKE '%%' OR
LOWER (o.nazn) LIKE '%transfer%')
UNION
SELECT 2 ko, o.rnkd rnk, o.fdat, o.ref, o.tt, o.accd, o.nlsd, o.kv,
o.acck, o.nlsk,
o.s * 100 s_nom,
gl.p_icurval (o.kv, o.s * 100, o.fdat) s_eqv, o.nazn, o.branch
FROM provodki_otc o
WHERE o.fdat = Dat_
AND o.kv != 980
AND (mfou_ = 300465 and mfo_ = mfou_)
AND (o.nbsd IN ('2809','2909') AND
o.nbsk IN ('1001','1002') )
AND (LOWER (o.nazn) LIKE '%%' OR
LOWER (o.nazn) LIKE '%%' OR
LOWER (o.nazn) LIKE '%transfer%')
AND (LOWER (o.nazn) NOT LIKE '%____%' OR
LOWER (o.nazn) NOT LIKE '%___%')
UNION
SELECT 2 ko, o.rnkd rnk, o.fdat, o.ref, o.tt, o.accd, o.nlsd, o.kv,
o.acck, o.nlsk,
o.s * 100 s_nom,
gl.p_icurval (o.kv, o.s * 100, o.fdat) s_eqv, o.nazn, o.branch
FROM provodki_otc o, kl_ff1 k
WHERE o.fdat = Dat_
AND o.kv != 980
AND (mfou_ = 300465 and mfo_ = mfou_)
AND o.nbsd IN ('2809', '2909')
AND o.nbsk IN ('1001','1002')
AND o.nlsd LIKE k.nlsd || '%'
AND o.nlsk LIKE k.nlsk || '%'
AND trim(k.ob22) is null
UNION
SELECT 2 ko, o.rnkk rnk, o.fdat, o.ref, o.tt, o.accd, o.nlsd, o.kv,
o.acck, o.nlsk,
o.s * 100 s_nom,
gl.p_icurval (o.kv, o.s * 100, o.fdat) s_eqv, o.nazn, o.branch
FROM provodki_otc o, kl_ff1 k
WHERE o.fdat = Dat_
AND o.kv != 980
AND (mfou_ = 300465 and mfo_ = mfou_)
AND o.nbsd IN ('1500','1600','2603', '3720','3739','3900',
'2809','2909','1919')
AND o.nbsk IN ('2620','2625','2924')
AND o.nlsd LIKE k.nlsd || '%'
AND o.nlsk LIKE k.nlsk || '%'
AND trim(k.ob22) is null
UNION
SELECT 2 ko, o.rnkk rnk, o.fdat, o.ref, o.tt, o.accd, o.nlsd, o.kv,
o.acck, o.nlsk,
o.s * 100 s_nom,
gl.p_icurval (o.kv, o.s * 100, o.fdat) s_eqv, o.nazn, o.branch
FROM provodki_otc o, kl_ff1 k
WHERE o.fdat = Dat_
AND o.kv != 980
AND (mfou_ = 300465 and mfo_ = mfou_)
-- 2809, 2909 1001,1002 OB22
AND o.nbsd IN ('2809', '2909')
AND o.nbsk IN ('1001','1002','2620','2625','2902','2909','2924')
AND o.nlsd LIKE k.nlsd || '%'
AND o.nlsk LIKE k.nlsk || '%'
AND NVL(k.ob22,o.ob22d) = o.ob22d)
where upper(nazn) not like '%(VO70040)%';
ELSIF (mfo_ <> mfou_ and mfou_ in (300465)) THEN
INSERT /*+APPEND */
INTO OTCN_PROV_TEMP
(ko, rnk, fdat, REF, tt, accd, nlsd, kv, acck, nlsk, s_nom, s_eqv, nazn, branch)
SELECT /*+noparallel*/ *
FROM (-- I ? I i
SELECT
1 ko,
o.rnkd rnk, o.fdat, o.ref, o.tt, o.accd, o.nlsd, o.kv,
o.acck, o.nlsk,
o.s * 100 s_nom,
gl.p_icurval (o.kv, o.s * 100, o.fdat) s_eqv, o.nazn, o.branch
FROM provodki_otc o, kl_ff1 k
WHERE o.fdat = Dat_
AND o.kv != 980
-- 1001,1002 2909 OB22
AND o.nlsd LIKE k.nlsd || '%'
AND o.nlsk LIKE k.nlsk || '%'
and k.ob22 is not null
AND k.ob22 = o.ob22k
AND NVL(k.tt,o.tt) = o.tt
UNION ALL
-- i ( i)
SELECT 2 ko, o.rnkk rnk, o.fdat, o.ref, o.tt, o.accd, o.nlsd, o.kv,
o.acck, o.nlsk,
o.s * 100 s_nom,
gl.p_icurval (o.kv, o.s * 100, o.fdat) s_eqv, o.nazn, o.branch
FROM provodki_otc o, kl_ff1 k
WHERE o.fdat = Dat_
AND o.kv != 980
-- 2809, 2909 1001,1002 OB22
AND o.nlsd LIKE k.nlsd || '%'
AND o.nlsk LIKE k.nlsk || '%'
and k.ob22 is not null
AND k.ob22 = o.ob22d
AND NVL(k.tt,o.tt) = o.tt)
where upper(nazn) not like '%(VO70040)%';
END IF;
commit;
-- - KL_FF1
DELETE FROM OTCN_PROV_TEMP
WHERE ref in (select o.ref
from otcn_prov_temp o, kl_ff1 f
where substr(trim(o.nlsd),1,length(trim(f.nlsd))) = trim(f.nlsd)
and substr(trim(o.nlsk),1,length(trim(f.nlsk))) = trim(f.nlsk)
and NVL(trim(f.tt),o.tt) = o.tt
and f.pr_del = 0);
-- 2909 2909 OB22 != '24'
for k in (select o.ref REF, trim(o.nlsd) NLSD, trim(o.nlsk) NLSK,
NVL(trim(s.ob22),'00') OB22
from otcn_prov_temp o, specparam_int s
where o.nlsd LIKE '2909%'
and o.nlsk LIKE '2909%'
and o.acck = s.acc(+) )
loop
if k.ob22 != '24' then
DELETE FROM OTCN_PROV_TEMP
WHERE ref = k.ref;
end if;
end loop;
--
DELETE FROM otcn_prov_temp
WHERE ref in ( select o.ref
from otcn_prov_temp o, oper p
where o.ref = p.ref
and p.sos <> 5);
-- 2909 2900
DELETE FROM otcn_prov_temp
WHERE nlsd like '2909%'
and nlsk like '2900%'
and lower (nazn) like ('%% %');
-- 2620 2909 .... ....
DELETE FROM otcn_prov_temp
WHERE nlsd like '2620%'
and nlsk like '2909%'
and tt like 'DP%'
and lower (nazn) like ('% % %');
if mfou_ = 300465 then
-- I
for k in ( select o.ref REF, o.nlsd, o.nlsk, o.fdat
from otcn_prov_temp o
where (o.nlsd LIKE '2809%' OR o.nlsd like '2909%')
and o.nlsk LIKE '100%'
and o.tt in ('M37','MMV','CN3','CN4') )
loop
begin
select trim(w.value),
to_date(substr(replace(replace(trim(w1.value), ',','/'),'.','/'),1,10), 'dd/mm/yyyy')
into ref_m37, dat_m37
from operw w, operw w1
where w.ref = k.ref
and (w.tag like 'D_REF%' or w.tag like 'REFT%')
and w1.ref = k.ref
and (w1.tag like 'D_1PB%' or w1.tag like 'DATT%');
--
BEGIN
select fdat
into fdat_CN3
from otcn_prov_temp
where ref = ref_m37;
EXCEPTION WHEN NO_DATA_FOUND THEN
fdat_CN3 := dat_m37;
end;
-- 10/10/2014 ..
--
if (k.fdat = dat_m37) OR (k.fdat = fdat_CN3) then
delete from otcn_prov_temp
where ref in (k.ref, ref_m37);
end if;
EXCEPTION
WHEN NO_DATA_FOUND THEN
null;
when others then
raise_application_error(-20000, ' = '||to_char(k.ref)||
': . D_1PB(DATT) D_REF(REFT)! '||sqlerrm);
end;
end loop;
end if;
-- RNK OTCN_PROV_TEMP RNK 2625
for k in ( select * from otcn_prov_temp
where nlsd like '2909%'
and nlsk like '2924%'
)
loop
begin
select p.rnkk
into rnk_
from provodki_otc p
where p.fdat = Dat_
and p.ref = k.ref
and p.nlsd like k.nlsk || '%'
and p.nlsk like '2625%'
and p.kv = k.kv
and p.s*100 = k.s_nom
and rownum = 1;
update otcn_prov_temp t set t.rnk = rnk_
where t.ref = k.ref
and t.nlsd like '2909%'
and t.nlsk like '2924%';
exception when no_data_found then
BEGIN
select a.rnk
into rnk_
from oper o, accounts a
where o.vdat = dat_
and o.ref = k.ref
and trim(o.nlsb) = trim(a.nls)
and o.nlsb like '2625%'
and o.kv = a.kv;
update otcn_prov_temp t set t.rnk = rnk_
where t.ref = k.ref
and t.nlsd like '2909%'
and t.nlsk like '2924%';
exception when no_data_found then
BEGIN
select p.rnkk
into rnk_
from provodki_otc p, operw w
where p.fdat = dat_
and ( (p.nlsd like '2924%' and p.nlsk like '2625%') OR
(p.nlsd like '3739%' and p.nlsk like '2909%')
)
and p.kv = k.kv
and p.s*100 = k.s_nom
and w.ref = k.ref
and w.tag like '59%'
and p.nlsk = substr(w.value,2,14)
and rownum =1;
update otcn_prov_temp t set t.rnk = rnk_
where t.ref = k.ref
and t.nlsd like '2909%'
and t.nlsk like '2924%';
exception when no_data_found then
null;
END;
END;
end;
end loop;
-- i i. i ( i i. )
OPEN opl_dok;
LOOP
FETCH opl_dok
INTO d060_, rnk_, fdat_, ref_, tt_, acc_, nls_, kv_, acck_, nlsk_,
sum0_, sumk0_, nazn_, tobo_;
EXIT WHEN opl_dok%NOTFOUND;
comm_ := '';
pasp_ := '';
paspn_ := '';
pr_pasp_ := 0;
atrt_ := '';
d#73_ := null;
BEGIN
select 2 - mod(codcagent,2)
INTO rez_
from customer
where rnk = rnk_;
EXCEPTION WHEN NO_DATA_FOUND THEN
rez_ := 1;
END;
BEGIN
select substr(trim(value),1,50)
INTO atrt_
from operw
where ref = ref_
and trim(tag) = 'ATRT';
EXCEPTION WHEN NO_DATA_FOUND THEN
atrt_ := '';
END;
BEGIN
select 1
INTO rez1_
from operw
where ref = ref_
and trim(tag) = 'ATRT'
and (((UPPER(trim(value)) LIKE '%%' OR
UPPER(trim(value)) LIKE '%%') AND
UPPER(trim(value)) NOT LIKE '%%') OR
UPPER(trim(value)) LIKE '%%');
pr_pasp_ := 1;
EXCEPTION WHEN NO_DATA_FOUND THEN
BEGIN
select 1
INTO rez1_
from operw
where ref = ref_
and trim(tag) = 'NATIO'
and (UPPER(trim(value)) LIKE '%%' OR
UPPER(trim(value)) LIKE '%804%');
pr_pasp_ := 1;
EXCEPTION WHEN NO_DATA_FOUND THEN
BEGIN
select 1
INTO rez1_
from operw
where ref = ref_
and trim(tag) LIKE '%PASP%'
and substr(UPPER(trim(value)),1,1) in
('','','','','?','I','','','','','','')
and ROWNUM = 1 ;
pr_pasp_ := 1;
EXCEPTION WHEN NO_DATA_FOUND THEN
BEGIN
select 2
INTO rez1_
from operw
where ref = ref_
and trim(tag) = 'ATRT'
and (((UPPER(trim(value)) LIKE '%%' OR
UPPER(trim(value)) LIKE '%%') AND
UPPER(trim(value)) LIKE '%%') OR
(UPPER(trim(value)) NOT LIKE '%%' and
UPPER(trim(value)) NOT LIKE '%%'));
EXCEPTION WHEN NO_DATA_FOUND THEN
rez1_ := null;
END;
END;
END;
END;
IF pr_pasp_ = 0
THEN
BEGIN
select 2
INTO rez1_
from operw
where ref = ref_
and trim(tag) = 'NATIO'
and trim(value) is not null
and UPPER(trim(value)) NOT LIKE '%%'
and UPPER(trim(value)) NOT LIKE '%804%';
EXCEPTION WHEN NO_DATA_FOUND THEN
null;
END;
END IF;
IF rez1_ is not null
THEN
rez_ := rez1_;
END IF;
d#73_ := null;
kod_g_ := null;
kod_g_pb1 := null;
IF sum0_ <> 0 THEN
for k in (select * from operw where ref=ref_ and tag like 'PASP%')
loop
if k.tag = 'PASP' then
pasp_ := substr(trim(k.value),1,20);
end if;
if k.tag = 'PASPN' then
paspn_ := substr(trim(k.value),1,20);
end if;
end loop;
BEGIN
select substr(trim(value),1,1), substr(trim(value),1,10)
INTO D#73_, value_
from operw
where ref = ref_
and tag = 'REZID' ;
if D#73_ not in ('1','2') then
if LOWER(value_) like '%%' then
D#73_ := '2';
else
D#73_ := '1';
end if;
end if;
EXCEPTION WHEN NO_DATA_FOUND THEN
BEGIN
select '1'
INTO D#73_
from operw
where ref = ref_
and tag LIKE '%OKPO%'
and rownum = 1;
EXCEPTION WHEN NO_DATA_FOUND THEN
d#73_ := null;
END;
END;
IF d060_ = 1 or ( d060_ = 2 and nls_ like '2909%' and nlsk_ like '3739%') THEN
kod_g_ := f_nbur_get_kod_g(ref_, 2);
country_ := nvl(kod_g_, '000');
if mfou_ = 300465 and d#73_ is not null then
rez_ := d#73_;
end if;
if nls_ like '100%' or nls_ like '262%' or nls_ like '2900%' or nls_ like '2902%' or nls_ like '2924%' then
acc1_ := acc_;
nls1_ := nls_;
else
acc1_ := acck_;
nls1_ := nlsk_;
end if;
IF typ_ > 0 THEN
nbuc_ := NVL (f_codobl_tobo (acc1_, typ_), nbuc1_);
ELSE
nbuc_ := nbuc1_;
END IF;
if nls_ like '2909%' then
select ob22
into ob22_
from accounts
where acc = acc_;
end if;
IF nls_ not like '26%' and
nls_ not like '29%' or
nls_ like '2909%' and ob22_ = '35' --
THEN
kodp_ := '1' || '11' || to_char(rez_) || lpad(to_char(kv_),3,'0') || country_;
if kod_g_ is null or (kod_g_ is not null and kod_g_ != '804') then
--
p_ins (kodp_, to_char(sum0_) );
end if;
ELSE
if kod_g_ is null or (kod_g_ is not null and kod_g_ != '804') then
kodp_ := '1' || '12' || to_char(rez_) || lpad(to_char(kv_),3,'0') || country_;
--
p_ins (kodp_, to_char(sum0_) );
end if;
END IF;
ELSE
kod_g_ := f_nbur_get_kod_g(ref_, 1);
country_ := nvl(kod_g_, '000');
if d#73_ is not null then
rez_ := d#73_;
end if;
if nlsk_ like '100%' or nlsk_ like '262%' or nlsk_ like '2902%' or nlsk_ like '2924%' then
acc1_ := acck_;
nls1_ := nlsk_;
else
acc1_ := acc_;
nls1_ := nls_;
end if;
IF typ_ > 0 THEN
nbuc_ := NVL (f_codobl_tobo (acc1_, typ_), nbuc1_);
ELSE
nbuc_ := nbuc1_;
END IF;
if kod_g_ is null or (kod_g_ is not null and kod_g_ != '804') then
if nlsk_ like '262%' or nlsk_ like '2900%' or nlsk_ like '2924%' then
kodp_ := '1' || '42' || to_char(rez_) || lpad(to_char(kv_),3,'0') || country_;
--
p_ins (kodp_, to_char(sum0_) );
else
kodp_ := '1' || '41' || to_char(rez_) || lpad(to_char(kv_),3,'0') || country_;
--
p_ins (kodp_, to_char(sum0_) );
end if;
end if;
END IF;
END IF;
END LOOP;
CLOSE opl_dok;
---------------------------------------------------
DELETE FROM tmp_nbu
WHERE kodf = kodf_ AND datf = dat_;
---------------------------------------------------
INSERT INTO tmp_nbu (kodp, datf, kodf, znap, nbuc)
SELECT kodp, dat_, kodf_, SUM(to_number(znap)), nbuc
FROM rnbu_trace
WHERE userid = userid_
GROUP BY KODP,NBUC;
----------------------------------------
END p_ff1_nn;
/
show err;
PROMPT *** Create grants P_FF1_NN ***
grant EXECUTE on P_FF1_NN to BARS_ACCESS_DEFROLE;
grant EXECUTE on P_FF1_NN to WR_ALL_RIGHTS;
PROMPT =====================================================================================
PROMPT *** End *** ========== Scripts /Sql/BARS/Procedure/P_FF1_NN.sql =========*** End ***
PROMPT =====================================================================================
| true |
e618657f98d637f513e8fee037ed638a4a897a84 | SQL | WebMobileDeveloper/codeigniter | /migrations/2015-06-07-new-auth-user-changes.sql | UTF-8 | 1,341 | 3.046875 | 3 | [] | no_license | ALTER TABLE `users` ADD `uuid` VARCHAR( 200 ) NOT NULL AFTER `id`;
ALTER TABLE `users` ADD `phone_number` VARCHAR( 30 ) NOT NULL AFTER `last_name`;
ALTER TABLE `users` ADD `role_id` TINYINT NOT NULL AFTER `last_name`;
ALTER TABLE `users` ADD `password` VARCHAR( 100 ) NOT NULL AFTER `email`;
ALTER TABLE `users` ADD `salt` VARCHAR( 100 ) NOT NULL AFTER `email`;
ALTER TABLE `users` ADD `terms_accepted` TINYINT NOT NULL AFTER `email`;
ALTER TABLE `users` ADD `modified` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP AFTER `global_user_id`;
ALTER TABLE `users` ADD `created` DATETIME NOT NULL AFTER `global_user_id`;
CREATE TABLE `application_terms` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`terms` text NOT NULL,
`is_default` tinyint(1) NOT NULL DEFAULT '0',
`status` tinyint(1) NOT NULL DEFAULT '0',
`date_time` int(11) NOT NULL DEFAULT '0',
`terms_type` tinyint(1) NOT NULL DEFAULT '0',
`terms_length` varchar(20) NOT NULL,
`version` varchar(25) NOT NULL,
`date` date NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE `user_login_records` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`user_id` int(11) NOT NULL,
`login_datetime` datetime NOT NULL,
`ip` varchar(150) DEFAULT NULL,
`user_agent` varchar(300) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8; | true |
230d2c9c36a81dd129723f5e584611481ec33096 | SQL | DabAroundTheNeck/INFI | /sql/procedures.sql | UTF-8 | 1,478 | 4.25 | 4 | [] | no_license | DROP PROCEDURE if exists `getSubjectsLessons`;
CREATE PROCEDURE `getSubjectsLessons`()
NOT DETERMINISTIC
READS SQL DATA
SQL SECURITY DEFINER
SELECT subjects.id, subjects.lvnr, subjects.title, subjects.groups_required, teachers.short, lessons.hours, lessons.group FROM subjects
INNER JOIN lessons
ON subjects.id = lessons.id_subjects
INNER JOIN teachers
ON lessons.id_teachers = teachers.id
ORDER BY `subjects`.`lvnr` ASC;
DROP PROCEDURE if exists `insertTeacher`;
CREATE PROCEDURE `insertTeacher`(
IN `f_name` CHAR(100),
IN `l_name` CHAR(100),
IN `short` CHAR(100)
)
NOT DETERMINISTIC
MODIFIES SQL DATA
SQL SECURITY DEFINER
INSERT INTO `teachers` (`f_name`, `l_name`, `short`) VALUES (l_name, f_name, short);
DROP PROCEDURE if exists `insertSubjects`;
CREATE PROCEDURE `insertSubjects`(
IN `lvnr` CHAR(100),
IN `title` CHAR(100),
IN `groups_required` INT(11)
)
NOT DETERMINISTIC
MODIFIES SQL DATA
SQL SECURITY DEFINER
INSERT INTO `subjects` (`lvnr`, `title`, `groups_required`) VALUES (lvnr, title, groups_required);
DROP PROCEDURE if exists `insertLessons`;
DELIMITER $$
CREATE PROCEDURE `insertLessons`(
IN `id_teachers` INT(11),
IN `hours` INT(11),
IN `groups` CHAR(100),
IN `id_subjects` INT(11)
)
Begin
INSERT INTO `lessons` (`id_teachers`, `hours`, `group`, `id_subjects`) VALUES (id_teachers, hours, groups, id_subjects);
SELECT `short` FROM `teachers`
WHERE id = `id_teachers`;
End$$
DELIMITER ; | true |
5679e09cf1b0a29cb6700b13e55ba467cc8c2fbe | SQL | davidpoza/summerproject | /mysql/wimc.sql | UTF-8 | 1,334 | 3.78125 | 4 | [] | no_license | CREATE TABLE `users` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`user` varchar(20) COLLATE utf8_spanish_ci DEFAULT NULL,
`password` varchar(200) COLLATE utf8_spanish_ci DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 COLLATE=utf8_spanish_ci;
CREATE TABLE `sensors` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(50) COLLATE utf8_spanish_ci NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_spanish_ci;
CREATE TABLE `users-sensors` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`user_id` int(11) NOT NULL,
`sensor_id` int(11) NOT NULL,
PRIMARY KEY (`id`),
KEY `sensor_id` (`sensor_id`),
KEY `user_id` (`user_id`),
CONSTRAINT `users-sensors_ibfk_1` FOREIGN KEY (`sensor_id`) REFERENCES `sensors` (`id`),
CONSTRAINT `users-sensors_ibfk_2` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_spanish_ci;
CREATE TABLE `positions` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`lat` float NOT NULL,
`lon` float NOT NULL,
`sensor_id` int(11) NOT NULL,
`date_time` datetime NOT NULL,
PRIMARY KEY (`id`),
KEY `sensor_id` (`sensor_id`),
CONSTRAINT `positions_ibfk_1` FOREIGN KEY (`sensor_id`) REFERENCES `sensors` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_spanish_ci;
| true |
72f647f439f27659ce926b71d7db96eec62aa83e | SQL | ndxt/centit-workflow | /centit-workflow-module/src/sqlScript/数据库初始化/oracle/createTablesOracle.sql | UTF-8 | 29,527 | 2.703125 | 3 | [] | no_license | drop view F_V_LASTVERSIONFLOW;
drop view V_INNER_USER_TASK_LIST;
drop view V_USER_TASK_LIST;
drop view v_node_instdetail;
drop table WF_ACTION_LOG cascade constraints;
drop table WF_ACTION_TASK cascade constraints;
drop table WF_FLOW_DEFINE cascade constraints;
drop table WF_FLOW_INSTANCE cascade constraints;
drop table WF_FLOW_STAGE cascade constraints;
drop table WF_FLOW_VARIABLE cascade constraints;
drop table WF_INST_ATTENTION cascade constraints;
drop table WF_MANAGE_ACTION cascade constraints;
drop table WF_NODE cascade constraints;
drop table WF_NODE_INSTANCE cascade constraints;
drop table WF_ROLE_RELEGATE cascade constraints;
drop table WF_RUNTIME_WARNING cascade constraints;
drop table WF_STAGE_INSTANCE cascade constraints;
drop table WF_TEAM cascade constraints;
drop table WF_TRANSITION cascade constraints;
drop table WF_Task_Move cascade constraints;
drop table WF_organize cascade constraints;
drop sequence S_ACTIONLOGNO;
drop sequence S_ACTIONTASKNO;
drop sequence S_FLOWDEFNO;
drop sequence S_FLOWINSTNO;
drop sequence S_MANAGERACTIONNO;
drop sequence S_NODEINSTNO;
drop sequence S_RELEGATENO;
drop sequence S_WARNING_NO;
create sequence S_FLOWDEFINE
increment by 1
start with 1;
create sequence S_ACTIONLOGNO
increment by 1
start with 1;
create sequence S_ACTIONTASKNO
increment by 1
start with 1;
create sequence S_FLOWDEFNO
increment by 1
start with 1;
create sequence S_FLOWINSTNO
increment by 1
start with 1;
create sequence S_MANAGERACTIONNO
increment by 1
start with 1;
create sequence S_NODEINSTNO
increment by 1
start with 1;
create sequence S_RELEGATENO;
create sequence S_WARNING_NO;
create table WF_ACTION_LOG (
ACTIONID NUMBER(12) not null,
NODEINSTID NUMBER(12),
ACTIONTYPE VARCHAR2(2) not null,
ACTIONTIME DATE not null,
USERCODE VARCHAR2(8),
ROLETYPE VARCHAR2(8),
ROLECODE VARCHAR2(32),
GRANTOR VARCHAR2(8),
constraint PK_WF_ACTION_LOG primary key (ACTIONID)
);
comment on column WF_ACTION_LOG.ACTIONTYPE is
'创建流程同时创建首节点 W
创建节点 C
更改数据 U
提交节点 S
挂起节点 A
唤醒节点 R
终止节点 E';
create table WF_ACTION_TASK (
TASKID NUMBER(12) not null,
NODEINSTID NUMBER(12),
ASSIGNTIME DATE not null,
EXPIRETIME DATE,
USERCODE VARCHAR2(8),
ROLETYPE VARCHAR2(8),
ROLECODE VARCHAR2(32),
TASKSTATE CHAR,
ISVALID char,
AUTHDESC VARCHAR2(255),
constraint PK_WF_ACTION_TASK primary key (TASKID)
);
comment on column WF_ACTION_TASK.TASKSTATE is
'A:已分配 C:已完成(提交)W: 已委托给别人';
comment on column WF_ACTION_TASK.ISVALID is
'T F 可以删除,也可以使失效,根据业务需要设定';
comment on column WF_ACTION_TASK.AUTHDESC is
'可以是权限引擎自动分配,也可以是管理员指定';
create table WF_FLOW_DEFINE (
WFCODE VARCHAR2(8) not null,
VERSION NUMBER(4) not null,
WFNAME VARCHAR2(120),
WFCLASS VARCHAR2(4) not null,
WFPublishDate date,
WFSTATE char,
WFDESC VARCHAR2(500),
WFXMLDESC CLOB,
TimeLimit VARCHAR2(20),
ExpireOpt CHAR,
OptID VARCHAR2(32),
ATPUBLISHDATE date,
constraint PK_WF_FLOW_DEFINE primary key (WFCODE,VERSION)
);
comment on table WF_FLOW_DEFINE is
'现有 业务后有流程,一个流程必需绑定到一个业务,否则,无法找到对应的业务变量来进行流转';
comment on column WF_FLOW_DEFINE.WFCODE is
'同一个代码的流程应该只有一个有效的版本';
comment on column WF_FLOW_DEFINE.VERSION is
'版本号为 0 的为草稿, 有效版本号从 1 开始';
comment on column WF_FLOW_DEFINE.WFCLASS is
'暂未使用';
comment on column WF_FLOW_DEFINE.WFPublishDate is
'发布时间,也是启用时间';
comment on column WF_FLOW_DEFINE.WFSTATE is
'A 草稿 B 正常 C 过期 D 禁用 E 已发布 (A,E仅对0版本有效)';
comment on column WF_FLOW_DEFINE.WFXMLDESC is
'图形定义界面生成的XML文件';
comment on column WF_FLOW_DEFINE.TimeLimit is
'一小时计,8小时为一天,小数点后面为分钟,比如0.30表示30分钟';
comment on column WF_FLOW_DEFINE.ExpireOpt is
'N:通知, O:不处理 , S:挂起,E:终止';
create table WF_FLOW_INSTANCE (
WFINSTID NUMBER(12) not null,
VERSION NUMBER(4),
WFCODE VARCHAR2(8),
WfOptName VARCHAR2(100),
WfOptTag VARCHAR2(100),
CREATETIME DATE not null,
isTimer CHAR,
promiseTime NUMBER(10),
timeLimit NUMBER(10),
lastupdateuser VARCHAR2(8),
lastupdatetime DATE,
INSTSTATE CHAR,
ISSUBINST CHAR,
PREINSTID NUMBER(16),
PRENODEINSTID NUMBER(16),
UNITCODE VARCHAR2(8),
USERCODE VARCHAR2(8),
constraint PK_WF_FLOW_INSTANCE primary key (WFINSTID)
);
comment on column WF_FLOW_INSTANCE.WFCODE is
'同一个代码的流程应该只有一个有效的版本';
comment on column WF_FLOW_INSTANCE.WfOptName is
'这个名称用户 查找流程信息';
comment on column WF_FLOW_INSTANCE.WfOptTag is
'这个标记用户 查找流程信息,比如办件代码,有业务系统自己解释';
comment on column WF_FLOW_INSTANCE.promiseTime is
'承诺时间 1天8小时,1小时60 分钟 这儿按照分钟计算';
comment on column WF_FLOW_INSTANCE.INSTSTATE is
' N 正常 C 完成 P 暂停 挂起 F 强行结束
';
comment on column WF_FLOW_INSTANCE.ISSUBINST is
'Y 是的 N 不是';
create table WF_FLOW_STAGE (
STAGEID number(12) not null,
VERSION NUMBER(4),
WFCODE VARCHAR2(8),
STAGECODE varchar2(32) not null,
STAGENAME varchar2(60),
isAccountTime CHAR,
LimitType CHAR,
TimeLimit VARCHAR2(20),
ExpireOpt CHAR,
constraint PK_WF_FLOW_STAGE primary key (STAGEID)
);
comment on column WF_FLOW_STAGE.VERSION is
'版本号为 0 的为草稿, 有效版本号从 1 开始';
comment on column WF_FLOW_STAGE.WFCODE is
'同一个代码的流程应该只有一个有效的版本';
comment on column WF_FLOW_STAGE.isAccountTime is
'改是否记入(流程)时间 T/F';
comment on column WF_FLOW_STAGE.LimitType is
'期限类别 I : 未设置(ignore 默认 )、N 无 (无期限 none ) 、C 固定期限 cycle';
comment on column WF_FLOW_STAGE.TimeLimit is
'5D4H 这样的表达式';
comment on column WF_FLOW_STAGE.ExpireOpt is
'N:通知, O:不处理 , S:挂起,E:终止(流程), C:完成(强制提交,提交失败就挂起)';
create table WF_FLOW_VARIABLE (
WFINSTID NUMBER(12) not null,
RunToken VARCHAR2(20) not null,
VARNAME VARCHAR2(50) not null,
VARVALUE VARCHAR2(256) not null,
VarType CHAR not null,
constraint PK_WF_FLOW_VARIABLE primary key (WFINSTID, RunToken, VARNAME)
);
create table WF_INST_ATTENTION (
WFINSTID NUMBER(12) not null,
userCode varchar2(8) not null,
attsettime DATE,
attsetuser varchar2(8),
attsetMemo varchar2(255),
constraint PK_WF_INST_ATTENTION primary key (userCode, WFINSTID)
);
comment on table WF_INST_ATTENTION is
'关注有个问题,就是一个关注人如何才可写多条意见,看来还是要写到 OPT_IDEA_INFO 中
这个表暂时不用,用 工作流 的关注';
create table WF_MANAGE_ACTION (
ACTIONID NUMBER(12) not null,
WFINSTID NUMBER(12),
NODEINSTID NUMBER(12),
ACTIONTYPE VARCHAR2(2) not null,
ACTIONTIME DATE not null,
USERCODE VARCHAR2(8),
ROLETYPE VARCHAR2(8),
ROLECODE VARCHAR2(32),
ADMINDESC VARCHAR2(1000),
constraint SYS_C0021281 primary key (ACTIONID)
);
comment on column WF_MANAGE_ACTION.NODEINSTID is
'如果是对节点实例的管理,这个就有值';
comment on column WF_MANAGE_ACTION.ACTIONTYPE is
'对流程管理操作用大写字母,对节点管理操作用小写字母
S s: 状态变更, 超时唤醒、 使失效、 使一个正常的节点变为游离状态 、 是游离节点失效
c: 创建节点 、创建一个游离节点 创建(任意)指定节点
R : 流转管理,包括 强行回退 、强行提交
T t: 期限管理 、 设置期限
a: 节点任务管理 分配任务、 删除任务 、 禁用任务
U u: 变更属性''';
create table WF_NODE (
NODEID NUMBER(12) not null,
WFCODE VARCHAR2(8),
VERSION NUMBER(4),
NODETYPE VARCHAR2(1) not null,
NODENAME VARCHAR2(120),
OPTTYPE VARCHAR2(1),
OPTCODE VARCHAR2(16),
OPTBEAN VARCHAR2(100),
OPTPARAM VARCHAR2(100),
SUBWFCODE VARCHAR2(8),
ROUTERTYPE VARCHAR2(1)
constraint CKC_ROUTERTYPE_WF_NODE check (ROUTERTYPE is null or (ROUTERTYPE in ('D','E','G','H','R','S'))),
ROLETYPE VARCHAR2(8),
ROLECODE VARCHAR2(32),
UNITEXP VARCHAR2(64),
POWEREXP VARCHAR2(512),
multiInstType CHAR
constraint CKC_MULTIINSTTYPE_WF_NODE check (multiInstType is null or (multiInstType in ('D','U','V'))),
multiInstParam VARCHAR2(512),
convergeType CHAR,
convergeParam VARCHAR2(64),
NODEDESC VARCHAR2(500),
isAccountTime CHAR,
LimitType CHAR,
TimeLimit VARCHAR2(20),
inheritType CHAR,
inheritNodeCode VARCHAR2(20),
ExpireOpt CHAR,
WarningRule CHAR
constraint CKC_WARNINGRULE_WF_NODE check (WarningRule is null or (WarningRule in ('R','L','P'))),
WarningParam VARCHAR2(20),
isTrunkLine CHAR,
STAGECODE VARCHAR2(32),
NODECODE VARCHAR2(20),
RISKINFO VARCHAR2(4),
constraint PK_WF_NODE primary key (NODEID)
);
comment on column WF_NODE.NODEID is
'有一个特殊的节点创建节点(000001),它对应的权限用来检验是否有申请的权利';
comment on column WF_NODE.WFCODE is
'同一个代码的流程应该只有一个有效的版本';
comment on column WF_NODE.NODETYPE is
'A:开始 B:首节点 C:业务节点 F结束 R: 路由节点 。
这个类别是不可以变更的,在画图页面上可以不显示,首节点不需要设置,在流程发布时和开始节点直接相连的节点就是首节点,这个节点必需是业务节点。';
comment on column WF_NODE.OPTTYPE is
'A:一般 B:抢先机制 C:多人操作 D: 自动执行 E哑元(可用于嵌套汇聚) S:子流程 ';
comment on column WF_NODE.OPTBEAN is
'自动执行节点需要,或者路由判断bean';
comment on column WF_NODE.SUBWFCODE is
'子流程和业务操作只有一个有效,都是为了指定业务节点的活动';
comment on column WF_NODE.ROUTERTYPE is
'D:分支 E:汇聚 G 多实例节点 H并行 R 游离 S:同步';
comment on column WF_NODE.ROLETYPE is
'xz gw bj en';
comment on column WF_NODE.multiInstType is
'D 机构, U 人员 , V 变量';
comment on column WF_NODE.multiInstParam is
'自定义变量表达,用于多实例节点的分支';
comment on column WF_NODE.convergeType is
'所有都完成, 至少有X完成,至多有X未完成,完成比率达到X , 外埠判断';
comment on column WF_NODE.isAccountTime is
'改是否记入时间 T/F';
comment on column WF_NODE.LimitType is
'期限类别 I : 未设置(ignore 默认 )、N 无 (无期限 none ) 、
F 每实例固定期限 fix 、C 节点固定期限 cycle、
';
comment on column WF_NODE.TimeLimit is
'5D4H 这样的表达式';
comment on column WF_NODE.inheritType is
'0 不集成 1 继承前一个节点 2 继承指定节点';
comment on column WF_NODE.inheritNodeCode is
'继承环节代码';
comment on column WF_NODE.ExpireOpt is
'N:通知, O:不处理 , S:挂起,E:终止(流程), C:完成(强制提交,提交失败就挂起)';
comment on column WF_NODE.WarningRule is
'R:运行时间 L:剩余时间 P:比率';
comment on column WF_NODE.WarningParam is
'是一个时间字符串 或者 数值';
comment on column WF_NODE.isTrunkLine is
'T / F';
create table WF_NODE_INSTANCE (
NODEINSTID NUMBER(12) not null,
WFINSTID NUMBER(12),
NODEID NUMBER(12),
CREATETIME DATE,
STARTTIME DATE,
isTimer CHAR,
promiseTime NUMBER(10),
timeLimit NUMBER(10),
PREVNODEINSTID NUMBER(12),
NODESTATE VARCHAR(2),
SUBWFINSTID NUMBER(12),
UNITCODE VARCHAR2(8),
STAGECODE varchar2(32),
ROLETYPE VARCHAR2(8),
ROLECODE VARCHAR2(32),
USERCODE VARCHAR2(8),
NODEPARAM VARCHAR2(128),
TRANSID NUMBER(12),
TASKASSIGNED VARCHAR(1) default 'F',
RunToken VARCHAR2(20),
GRANTOR VARCHAR2(8),
lastupdateuser VARCHAR2(8),
lastupdatetime DATE,
constraint PK_WF_NODE_INSTANCE primary key (NODEINSTID)
);
comment on column WF_NODE_INSTANCE.NODEID is
'有一个特殊的节点创建节点(000001),它对应的权限用来检验是否有申请的权利';
comment on column WF_NODE_INSTANCE.promiseTime is
'承诺时间 1天8小时,1小时60 分钟 这儿按照分钟计算';
comment on column WF_NODE_INSTANCE.NODESTATE is
' * N 正常 B 已回退 C 完成 F被强制结束
* P 暂停 W 等待子流程返回 S 等等前置节点(可能是多个)完成';
comment on column WF_NODE_INSTANCE.ROLETYPE is
'xz gw bj en';
comment on column WF_NODE_INSTANCE.TRANSID is
'由哪一条路径创建的';
comment on column WF_NODE_INSTANCE.TASKASSIGNED is
'T: 通过 tasklist 分配, D:通过 岗位、行政角色 自动匹配 S:静态代办(usercode)';
comment on column WF_NODE_INSTANCE.RunToken is
'令牌: T* 表示正常运行的节点 R* 表示游离节点 L* 表示临时插入的节点';
create table WF_ROLE_RELEGATE (
RELEGATENO NUMBER(12) not null,
GRANTOR VARCHAR2(8) not null,
GRANTEE VARCHAR2(8) not null,
ISVALID CHAR default 'T' not null,
Recorder VARCHAR2(8),
RELEGATETIME DATE not null,
EXPIRETIME DATE,
UNITCODE VARCHAR2(8),
ROLETYPE VARCHAR2(8),
ROLECODE VARCHAR2(32),
RecordDate DATE,
grantDesc VARCHAR2(256),
constraint PK_WF_ROLE_RELEGATE primary key (RELEGATENO)
);
comment on column WF_ROLE_RELEGATE.ISVALID is
'T:生效 F:无效';
create table WF_RUNTIME_WARNING (
WARNINGID NUMBER(12) not null,
WFINSTID NUMBER(12),
NODEINSTID NUMBER(12) not null,
FLOWSTAGE VARCHAR2(4),
OBJTYPE CHAR
constraint CKC_OBJTYPE_WF_RUNTI check (OBJTYPE is null or (OBJTYPE in ('F','N','P'))),
WARNINGTYPE CHAR
constraint CKC_WARNINGTYPE_WF_RUNTI check (WARNINGTYPE is null or (WARNINGTYPE in ('W','A','N','O'))),
WARNINGSTATE CHAR default 'N'
constraint CKC_WARNINGSTATE_WF_RUNTI check (WARNINGSTATE is null or (WARNINGSTATE in ('D','C','F','N'))),
WARNINGCODE VARCHAR2(16),
WARNINGTIME DATE,
WARNINGIDMSG VARCHAR2(500),
NOTICESTATE CHAR default '0'
constraint CKC_NOTICESTATE_WF_RUNTI check (NOTICESTATE is null or (NOTICESTATE in ('0','1','2'))),
SENDMSGTIME DATE,
SENDUSERS VARCHAR2(100),
constraint PK_WF_RUNTIME_WARNING primary key (WARNINGID)
);
comment on column WF_RUNTIME_WARNING.WARNINGID is
'sequence : S_WARNING_NO';
comment on column WF_RUNTIME_WARNING.OBJTYPE is
'F : 工作流 N :节点 P:阶段';
comment on column WF_RUNTIME_WARNING.WARNINGTYPE is
'W,预警 A 报警 N 提醒 O 其他';
comment on column WF_RUNTIME_WARNING.WARNINGSTATE is
'D 摘牌 C 纠正 F 督办 N 未处理';
comment on column WF_RUNTIME_WARNING.WARNINGCODE is
'ALTER_EXPIRED : 时间超期报警
WARN_EXPIRED : 时间超期预警';
comment on column WF_RUNTIME_WARNING.NOTICESTATE is
'0 待发送 1 已发送 2 发送消息失败';
comment on column WF_RUNTIME_WARNING.SENDUSERS is
'可以是多个人用逗号隔开';
create table WF_STAGE_INSTANCE (
WFINSTID NUMBER(12) not null,
STAGEID number(12) not null,
STAGECODE varchar2(32) not null,
STAGENAME varchar2(60),
beginTime date,
stageBegin CHAR,
promiseTime NUMBER(10),
timeLimit NUMBER(10),
lastupdatetime DATE,
constraint PK_WF_STAGE_INSTANCE primary key (WFINSTID, STAGEID)
);
comment on table WF_STAGE_INSTANCE is
'在流程创建时同时创建这个流程所有的阶段';
comment on column WF_STAGE_INSTANCE.stageBegin is
'0 还没有进入, 1 已经进入';
comment on column WF_STAGE_INSTANCE.promiseTime is
'承诺时间 1天8小时,1小时60 分钟 这儿按照分钟计算';
create table WF_TEAM (
WFINSTID NUMBER(12) not null,
USERCODE VARCHAR2(8) not null,
ROLECODE VARCHAR2(32) not null,
AUTHDESC VARCHAR2(255),
AUTHTIME Date default sysdate not null,
constraint PK_WF_TEAM primary key (WFINSTID, USERCODE, ROLECODE)
);
comment on table WF_TEAM is
'这个表有业务系统写入,流程引擎只负责读取';
create table WF_TRANSITION (
TRANSID NUMBER(12) not null,
VERSION NUMBER(4),
WFCODE VARCHAR2(8),
TRANSCLASS VARCHAR2(4),
TRANSNAME VARCHAR2(120),
STARTNODEID NUMBER(12),
ENDNODEID NUMBER(12),
TRANSCONDITION VARCHAR2(500),
TRANSDESC VARCHAR2(500),
isAccountTime CHAR,
LimitType CHAR,
TimeLimit VARCHAR2(20),
inheritType CHAR,
inheritNodeCode VARCHAR2(20),
canignore CHAR default 'T' not null
constraint CKC_CANIGNORE_WF_TRANS check (canignore in ('T','F')),
constraint PK_WF_TRANSITION primary key (TRANSID)
);
comment on column WF_TRANSITION.WFCODE is
'同一个代码的流程应该只有一个有效的版本';
comment on column WF_TRANSITION.TRANSCLASS is
'暂未使用';
comment on column WF_TRANSITION.STARTNODEID is
'有一个特殊的节点创建节点(000001),它对应的权限用来检验是否有申请的权利';
comment on column WF_TRANSITION.ENDNODEID is
'有一个特殊的节点创建节点(000001),它对应的权限用来检验是否有申请的权利';
comment on column WF_TRANSITION.TRANSCONDITION is
'a>500 && b<300';
comment on column WF_TRANSITION.isAccountTime is
'改是否记入时间 T/F I 忽略';
comment on column WF_TRANSITION.LimitType is
'期限类别 I : 未设置(ignore 默认 )、N 无 (无期限 none ) 、
F 每实例固定期限 fix 、C 节点固定期限 cycle、
';
comment on column WF_TRANSITION.TimeLimit is
'5D4H 这样的表达式';
comment on column WF_TRANSITION.inheritType is
'0 不集成 1 继承前一个节点 2 继承指定节点';
comment on column WF_TRANSITION.inheritNodeCode is
'继承环节代码';
comment on column WF_TRANSITION.canignore is
'T可以忽略 F 不可以忽略 是否可以忽略运行';
create table WF_Task_Move (
move_no number(12) not null,
from_user Varchar2(8),
to_user Varchar2(8),
move_desc Varchar2(1024),
oper_user Varchar2(8),
oper_date date,
constraint PK_WF_TASK_MOVE primary key (move_no)
);
create table WF_organize (
WFINSTID NUMBER(12) not null,
UNITCODE VARCHAR2(8) not null,
ROLECODE VARCHAR2(32) not null,
AUTHDESC VARCHAR2(255),
AUTHTIME Date default sysdate not null,
constraint PK_WF_ORGANIZE primary key (WFINSTID, UNITCODE, ROLECODE)
);
create or replace view F_V_LASTVERSIONFLOW as
select a.WFCODE,
b.version,
a.WFNAME,
a.WFCLASS,
b.WFSTATE,
a.WFDESC,
a.WFXMLDESC,
a.TimeLimit,
a.ExpireOpt,
a.OptID,
a.WFPublishDate,
a.ATPUBLISHDATE
from (select wfcode, max(version) as version
from wf_flow_define group by wfcode)
lastVersion
join wf_flow_define a
on a.wfcode = lastVersion.wfcode and a.version=0
join wf_flow_define b
on lastVersion.wfcode = b.wfcode and lastVersion.version=b.version;
comment on column F_V_LASTVERSIONFLOW.WFCODE is
'同一个代码的流程应该只有一个有效的版本';
comment on column F_V_LASTVERSIONFLOW.VERSION is
'版本号为 0 的为草稿, 有效版本号从 1 开始';
comment on column F_V_LASTVERSIONFLOW.WFCLASS is
'暂未使用';
comment on column F_V_LASTVERSIONFLOW.WFSTATE is
'A 草稿 B 正常 C 过期 D 禁用 E 已发布 (A,E仅对0版本有效)';
comment on column F_V_LASTVERSIONFLOW.WFXMLDESC is
'图形定义界面生成的XML文件';
comment on column F_V_LASTVERSIONFLOW.TimeLimit is
'一小时计,8小时为一天,小数点后面为分钟,比如0.30表示30分钟';
comment on column F_V_LASTVERSIONFLOW.ExpireOpt is
'N:通知, O:不处理 , S:挂起,E:终止';
comment on column F_V_LASTVERSIONFLOW.WFPublishDate is
'发布时间,也是启用时间';
create or replace view f_v_wf_optdef_url_map as
select c.opturl || b.opturl as optdefurl, b.optreq, b.optcode,
b.optdesc,b.optMethod , c.optid,b.OptName
from F_OPTDEF b join f_optinfo c
on (b.optid = c.optid)
where c.OptType = 'W'
and c.opturl <> '...' and b.optreq is not null
;
create or replace view V_INNER_USER_TASK_LIST as
select a.WFINSTID,w.WFCODE,w.version, w.WfOptName,w.wfOptTag,a.nodeinstid, nvl(a.UnitCode,nvl(w.UnitCode,'0000000')) as UnitCode,
a.usercode,c.ROLETYPE,c.ROLECODE,'一般任务' as AUTHDESC, c.nodecode,
c.NodeName,c.NodeType,c.OptType as NODEOPTTYPE,d.optid,d.OptName,d.OptName as MethodName,
d.optdefurl as OptUrl,d.optMethod,c.OptParam ,d.OptDesc,a.CREATETIME,a.PromiseTime,a.TIMELIMIT,
c.OPTCODE,c.ExpireOpt,c.STAGECODE,a.lastupdateuser,a.lastupdatetime,w.inststate
from WF_NODE_INSTANCE a join WF_FLOW_INSTANCE w on (a.WFINSTID=w.WFINSTID)
join WF_NODE c on (a.NODEID=c.NODEID)
join f_v_wf_optdef_url_map d on (c.OPTCODE=d.OPTCODE)
where /*c.NODETYPE<>'R' and --游离节点不会创建时实例*/
a.NODESTATE='N' and w.INSTSTATE='N' and a.TASKASSIGNED='S'
union all
select a.WFINSTID,w.WFCODE,w.version, w.WfOptName,w.wfOptTag,a.nodeinstid, nvl(a.UnitCode,nvl(w.UnitCode,'0000000')) as UnitCode,
b.usercode,b.ROLETYPE,b.ROLECODE,b.AUTHDESC, c.nodecode,
c.NodeName,c.NodeType,c.OptType as NODEOPTTYPE,d.optid,d.OptName,d.OptName as MethodName,
d.optdefurl as OptUrl,d.optMethod,c.OptParam ,d.OptDesc,a.CREATETIME,a.PromiseTime,a.TIMELIMIT,
c.OPTCODE,c.ExpireOpt,c.STAGECODE,a.lastupdateuser,a.lastupdatetime,w.inststate
from WF_NODE_INSTANCE a join WF_FLOW_INSTANCE w on (a.WFINSTID=w.WFINSTID)
join WF_ACTION_TASK b on (a.NODEINSTID=b.NODEINSTID)
join WF_NODE c on (a.NODEID=c.NODEID)
join f_v_wf_optdef_url_map d on (c.OPTCODE=d.OPTCODE)
where a.NODESTATE='N' and w.INSTSTATE='N' and a.TASKASSIGNED='T'
and b.ISVALID='T' and b.TASKSTATE='A' and (b.EXPIRETIME is null or b.EXPIRETIME>sysdate)
union all
select a.WFINSTID,w.WFCODE,w.version,w.WfOptName,w.wfOptTag,a.nodeinstid, b.UnitCode ,
b.usercode,c.ROLETYPE,c.ROLECODE, '系统指定' as AUTHDESC, c.nodecode,
c.NodeName,c.NodeType,c.OptType as NODEOPTTYPE,d.optid,d.OptName,d.OptName as MethodName,
d.optdefurl as OptUrl,d.optMethod,c.OptParam,d.OptDesc,a.CREATETIME,a.PromiseTime,a.timelimit,
c.OPTCODE,c.ExpireOpt,c.STAGECODE,a.lastupdateuser,a.lastupdatetime,w.inststate
from WF_NODE_INSTANCE a join WF_FLOW_INSTANCE w on (a.WFINSTID=w.WFINSTID)
join WF_NODE c on (a.NODEID=c.NODEID)
join f_v_wf_optdef_url_map d on (c.OPTCODE=d.OPTCODE) , F_USERUNIT b
where a.NODESTATE='N' and w.INSTSTATE='N' and a.TASKASSIGNED='D' and
(a.UNITCODE is null or a.UNITCODE=b.UNITCODE) and
( (c.ROLETYPE='gw' and c.ROLECODE=b.UserStation) or
(c.ROLETYPE='xz' and c.ROLECODE=b.UserRank) );
create or replace view V_USER_TASK_LIST as
select rownum as taskid,t.WFINSTID,t.WFCODE,t.version,t.WFOPTNAME as WFNAME, t.WFOPTNAME,t.WFOPTTAG,t.NODEINSTID,t.UNITCODE,t.USERCODE,
t.ROLETYPE,t.ROLECODE,t.AUTHDESC,t.nodecode, t.NODENAME,t.NODETYPE,t.NODEOPTTYPE,t.OPTID,t.OPTNAME,
t.METHODNAME,t.OPTURL,t.OPTMETHOD,t.OPTPARAM,t.OPTDESC,t.CREATETIME,t.PROMISETIME,
t.TIMELIMIT,t.OPTCODE,t.EXPIREOPT,t.STAGECODE,t.GRANTOR,t.LASTUPDATEUSER,t.LASTUPDATETIME ,t.inststate
from
(select a.WFINSTID,a.WFCODE,a.version, a.WfOptName, a.wfOptTag, a.nodeinstid, a.UnitCode, a.usercode, a.ROLETYPE, a.ROLECODE,
a.AUTHDESC,a.nodecode, a.NodeName, a.NodeType, a.NODEOPTTYPE, a.optid, a.OptName, a.MethodName, a.OptUrl, a.optMethod,
a.OptParam, a.OptDesc, a.CREATETIME, a.promisetime, a.timelimit, a.OPTCODE, a.ExpireOpt, a.STAGECODE,
null as GRANTOR, a.lastupdateuser, a.lastupdatetime , a.inststate
from V_INNER_USER_TASK_LIST a
union select a.WFINSTID,a.WFCODE,a.version, a.WfOptName, a.wfOptTag, a.nodeinstid, a.UnitCode, b.grantee as usercode, a.ROLETYPE, a.ROLECODE,
a.AUTHDESC,a.nodecode, a.NodeName, a.NodeType, a.NODEOPTTYPE, a.optid, a.OptName, a.MethodName, a.OptUrl, a.optMethod,
a.OptParam, a.OptDesc, a.CREATETIME, a.promisetime, a.timelimit, a.OPTCODE, a.ExpireOpt, a.STAGECODE,
b.GRANTOR, a.lastupdateuser, a.lastupdatetime , a.inststate
from V_INNER_USER_TASK_LIST a, WF_ROLE_RELEGATE b
where b.IsValid = 'T' and b.RELEGATETIME <= sysdate and
( b.EXPIRETIME is null or b.EXPIRETIME >= sysdate) and
a.usercode = b.GRANTOR and ( b.UNITCODE is null or b.UNITCODE = a.UnitCode)
and ( b.ROLETYPE is null or ( b.ROLETYPE = a.ROLETYPE and ( b.ROLECODE is null or b.ROLECODE = a.ROLECODE) ) ))
t;
create or replace view v_node_instdetail as
select f.wfoptname,f.wfopttag,n.nodename,n.roletype,n.rolecode,
d.OptName,d.OptName as MethodName,d.OptDefUrl as OptUrl,d.optMethod,n.optparam,
t.NODEINSTID, t.WFINSTID, t.NODEID, t.CREATETIME, t.PREVNODEINSTID, t.NODESTATE,
t.SUBWFINSTID, t.UNITCODE, t.TRANSID, t.TASKASSIGNED,
t.RUNTOKEN, t.TIMELIMIT, t.LASTUPDATEUSER, t.LASTUPDATETIME, t.ISTIMER, t.PROMISETIME, n.STAGECODE
from wf_node_instance t
join wf_node n on t.nodeid = n.nodeid
join f_v_wf_optdef_url_map d on (n.OPTCODE=d.OPTCODE)
join wf_flow_instance f on t.wfinstid = f.wfinstid
with read only;
comment on table v_node_instdetail is
'包括流程信息、操作信息的视图';
--工作流业务定义
CREATE TABLE WF_OPTINFO (
OPT_ID VARCHAR2(32 BYTE) NOT NULL ,
OPT_NAME VARCHAR2(100 BYTE) NOT NULL ,
OPT_URL VARCHAR2(256 BYTE) NULL ,
UPDATE_DATE DATE NULL
);
--工作流业务操作定义
CREATE TABLE WF_OPTDEF (
OPT_CODE VARCHAR2(32 BYTE) NOT NULL ,
OPT_ID VARCHAR2(32 BYTE) NULL ,
OPT_NAME VARCHAR2(100 BYTE) NULL ,
OPT_METHOD VARCHAR2(50 BYTE) NULL ,
UPDATE_DATE DATE NULL
);
ALTER TABLE WF_OPTDEF ADD CHECK (OPT_CODE IS NOT NULL);
ALTER TABLE WF_OPTDEF ADD PRIMARY KEY (OPT_CODE);
ALTER TABLE WF_OPTINFO ADD CHECK (OPT_ID IS NOT NULL);
ALTER TABLE WF_OPTINFO ADD CHECK (OPT_NAME IS NOT NULL);
ALTER TABLE WF_OPTINFO ADD PRIMARY KEY (OPT_ID);
-- Create sequence
create sequence S_WFOPTDEF
minvalue 1
maxvalue 999999999
start with 58
increment by 1
nocache;
-- Create sequence
create sequence S_WFOPTINFO
minvalue 1
maxvalue 999999999
start with 43
increment by 1
nocache;
| true |
cc26ec1529c2613555eecbd0ddac4f18cdb49af8 | SQL | matrix-org/synapse | /synapse/storage/schema/main/full_schemas/16/im.sql | UTF-8 | 3,631 | 3.6875 | 4 | [
"Apache-2.0"
] | permissive | /* Copyright 2014-2016 OpenMarket Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* We used to create tables called room_hosts and feedback,
* but these are no longer used and are removed in delta 54.
*/
CREATE TABLE IF NOT EXISTS events(
stream_ordering INTEGER PRIMARY KEY,
topological_ordering BIGINT NOT NULL,
event_id TEXT NOT NULL,
type TEXT NOT NULL,
room_id TEXT NOT NULL,
-- 'content' used to be created NULLable, but as of delta 50 we drop that constraint.
-- the hack we use to drop the constraint doesn't work for an in-memory sqlite
-- database, which breaks the sytests. Hence, we no longer make it nullable.
content TEXT,
unrecognized_keys TEXT,
processed BOOL NOT NULL,
outlier BOOL NOT NULL,
depth BIGINT DEFAULT 0 NOT NULL,
UNIQUE (event_id)
);
CREATE INDEX events_stream_ordering ON events (stream_ordering);
CREATE INDEX events_topological_ordering ON events (topological_ordering);
CREATE INDEX events_order ON events (topological_ordering, stream_ordering);
CREATE INDEX events_room_id ON events (room_id);
CREATE INDEX events_order_room ON events (
room_id, topological_ordering, stream_ordering
);
CREATE TABLE IF NOT EXISTS event_json(
event_id TEXT NOT NULL,
room_id TEXT NOT NULL,
internal_metadata TEXT NOT NULL,
json TEXT NOT NULL,
UNIQUE (event_id)
);
CREATE INDEX event_json_room_id ON event_json(room_id);
CREATE TABLE IF NOT EXISTS state_events(
event_id TEXT NOT NULL,
room_id TEXT NOT NULL,
type TEXT NOT NULL,
state_key TEXT NOT NULL,
prev_state TEXT,
UNIQUE (event_id)
);
CREATE INDEX state_events_room_id ON state_events (room_id);
CREATE INDEX state_events_type ON state_events (type);
CREATE INDEX state_events_state_key ON state_events (state_key);
CREATE TABLE IF NOT EXISTS current_state_events(
event_id TEXT NOT NULL,
room_id TEXT NOT NULL,
type TEXT NOT NULL,
state_key TEXT NOT NULL,
UNIQUE (event_id),
UNIQUE (room_id, type, state_key)
);
CREATE INDEX current_state_events_room_id ON current_state_events (room_id);
CREATE INDEX current_state_events_type ON current_state_events (type);
CREATE INDEX current_state_events_state_key ON current_state_events (state_key);
CREATE TABLE IF NOT EXISTS room_memberships(
event_id TEXT NOT NULL,
user_id TEXT NOT NULL,
sender TEXT NOT NULL,
room_id TEXT NOT NULL,
membership TEXT NOT NULL,
UNIQUE (event_id)
);
CREATE INDEX room_memberships_room_id ON room_memberships (room_id);
CREATE INDEX room_memberships_user_id ON room_memberships (user_id);
CREATE TABLE IF NOT EXISTS topics(
event_id TEXT NOT NULL,
room_id TEXT NOT NULL,
topic TEXT NOT NULL,
UNIQUE (event_id)
);
CREATE INDEX topics_room_id ON topics(room_id);
CREATE TABLE IF NOT EXISTS room_names(
event_id TEXT NOT NULL,
room_id TEXT NOT NULL,
name TEXT NOT NULL,
UNIQUE (event_id)
);
CREATE INDEX room_names_room_id ON room_names(room_id);
CREATE TABLE IF NOT EXISTS rooms(
room_id TEXT PRIMARY KEY NOT NULL,
is_public BOOL,
creator TEXT
);
| true |
8565b5ffd87d343c839feb1a3fa6c6eeed06cf76 | SQL | silence-do-good/stress-test-Postgres-and-MySQL | /dump/low/day16/select2018.sql | UTF-8 | 178 | 2.625 | 3 | [] | no_license |
SELECT timeStamp, temperature FROM ThermometerOBSERVATION o
WHERE timestamp>'2017-11-15T20:18:00Z' AND timestamp<'2017-11-16T20:18:00Z' AND temperature>=22 AND temperature<=56
| true |
c4504fc72255b8cedbb23c5d78b2ee58fdd45e09 | SQL | adamszpilewicz/job | /json_unnest_20200315.sql | UTF-8 | 1,229 | 3.390625 | 3 | [] | no_license | with json as
(
SELECT
split(json_extract(json_data, '$.page_1_gbv_nonperf.gross_balance_value'), ',') as gross_balance_value,
split(json_extract(json_data, '$.page_1_gbv_nonperf.performing_class'), ',') as performing_class,
split(json_extract(json_data, '$.page_1_gbv_nonperf.pk_snapshot_date'), ',') as pk_snapshot_date,
split(json_extract(json_data, '$.page_1_gbv_nonperf.segment'), ',') as segment
FROM (
select * from `ordinal-crowbar-271216.dl_layer0.dim_testing`
)
)
select cast(REGEXP_EXTRACT(replace(gross_balance_value,'}','') , r':(.*)') as float64) as gross_balance_value ,
cast(REGEXP_EXTRACT(replace(performing_class,'}','') , r':(.*)') as string) as performing_class,
cast(REGEXP_EXTRACT(replace(replace(pk_snapshot_date,'}','') ,'"',''), r':(.*)') as string) as pk_snapshot_date ,
cast(REGEXP_EXTRACT(replace(segment,'}','') , r':(.*)') as string) as segment
from json, unnest(gross_balance_value) gross_balance_value with offset as pos0 ,
unnest(performing_class) performing_class with offset as pos1 ,
unnest(pk_snapshot_date) pk_snapshot_date with offset as pos2 ,
unnest(segment) segment with offset as pos3
where pos0=pos1
and pos1=pos2
and pos2=pos3
| true |
9385fc6b2e39d6d396ae9a0b3f72b29add132174 | SQL | ffakenz/DAS | /project/workspace/concesionarias/db/src/main/resources/liquibase/procedures/scenarios/planes/update_plan.sql | UTF-8 | 310 | 2.625 | 3 | [] | no_license | CREATE PROCEDURE update_plan (
@id BIGINT
, @estado VARCHAR(100)
, @fecha_ultima_actualizacion DATETIME
)
AS
UPDATE dbo.planes
SET estado = @estado
, fecha_ultima_actualizacion = @fecha_ultima_actualizacion
WHERE id = @id | true |
595cc8b6c75635ca4a5019eecdb0aa13f3c4ab63 | SQL | string-maaz/Buy-Care | /boilerplate/transit_final_products.sql | UTF-8 | 2,746 | 3.21875 | 3 | [
"MIT"
] | permissive | -- phpMyAdmin SQL Dump
-- version 4.5.2
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Jan 07, 2016 at 05:05 AM
-- Server version: 5.7.9-log
-- PHP Version: 5.6.11
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Database: `boilerplate`
--
-- --------------------------------------------------------
--
-- Table structure for table `transit_final_products`
--
CREATE TABLE `transit_final_products` (
`id` int(11) NOT NULL,
`transit_report_id` int(11) NOT NULL,
`product_name` varchar(255) NOT NULL,
`supplier_product_name` varchar(255) NOT NULL,
`sku` varchar(50) NOT NULL,
`product_id` int(11) NOT NULL,
`supplier_code` varchar(255) DEFAULT NULL,
`qty` int(11) NOT NULL,
`supplier_price` decimal(19,2) NOT NULL,
`subtotal` decimal(19,2) NOT NULL,
`vat` decimal(19,2) NOT NULL,
`created_at` datetime NOT NULL,
`updated_at` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `transit_final_products`
--
INSERT INTO `transit_final_products` (`id`, `transit_report_id`, `product_name`, `supplier_product_name`, `sku`, `product_id`, `supplier_code`, `qty`, `supplier_price`, `subtotal`, `vat`, `created_at`, `updated_at`) VALUES
(1, 25, '', 'amazon', 'GG-G1ME-H8RZ', 1, 'HBSupplies.co.uk', 1, '123.00', '123.00', '24.60', '0000-00-00 00:00:00', '0000-00-00 00:00:00'),
(2, 25, '', 'amazon', '9N-SZR0-W76W', 1, 'HBSupplies.co.uk', 1, '66.00', '66.00', '13.20', '0000-00-00 00:00:00', '0000-00-00 00:00:00'),
(3, 25, '', 'amazon', '100001010', 1, 'HBSupplies.co.uk', 1, '8.00', '8.00', '1.60', '0000-00-00 00:00:00', '0000-00-00 00:00:00');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `transit_final_products`
--
ALTER TABLE `transit_final_products`
ADD PRIMARY KEY (`id`),
ADD KEY `FKtransit_fi60360` (`transit_report_id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `transit_final_products`
--
ALTER TABLE `transit_final_products`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
--
-- Constraints for dumped tables
--
--
-- Constraints for table `transit_final_products`
--
ALTER TABLE `transit_final_products`
ADD CONSTRAINT `transit_final_products_ibfk_1` FOREIGN KEY (`transit_report_id`) REFERENCES `transit_final_reports` (`id`);
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
| true |
7a23eb43918d95e285b177c5e4be9bff00387a84 | SQL | gabrielkulp/community-garden | /sample_sql/ddq.sql | UTF-8 | 3,958 | 4.0625 | 4 | [] | no_license | DROP TABLE IF EXISTS people_plots;
DROP TABLE IF EXISTS plants;
DROP TABLE IF EXISTS tools;
DROP TABLE IF EXISTS people;
DROP TABLE IF EXISTS plots;
DROP TABLE IF EXISTS varieties;
-- DDQs
CREATE TABLE people (
person_id INTEGER PRIMARY KEY AUTOINCREMENT,
first_name VARCHAR(100) NOT NULL,
last_name VARCHAR(100) NOT NULL,
email VARCHAR(100) NOT NULL,
UNIQUE (first_name, last_name)
);
CREATE TABLE plots (
plot_id INTEGER PRIMARY KEY AUTOINCREMENT,
length FLOAT NOT NULL,
width FLOAT NOT NULL,
location VARCHAR(100) NOT NULL,
UNIQUE (location)
);
CREATE TABLE varieties (
variety_id INTEGER PRIMARY KEY AUTOINCREMENT,
name VARCHAR(100) NOT NULL,
season VARCHAR(100) NOT NULL,
UNIQUE (name)
);
CREATE TABLE plants (
plant_id INTEGER PRIMARY KEY AUTOINCREMENT,
variety_id INTEGER NOT NULL,
plot_id INTEGER NOT NULL,
FOREIGN KEY (variety_id) REFERENCES varieties (variety_id),
FOREIGN KEY (plot_id) REFERENCES plots (plot_id)
);
CREATE TABLE tools (
tool_id INTEGER PRIMARY KEY AUTOINCREMENT,
name VARCHAR(100) NOT NULL,
`condition` INTEGER NOT NULL DEFAULT (1), -- condition is reserved word
person_id INTEGER, -- nullable b/c can be not checked out
FOREIGN KEY (person_id) REFERENCES people (person_id)
);
CREATE TABLE people_plots (
people_plot_id INTEGER PRIMARY KEY AUTOINCREMENT,
person_id INTEGER NOT NULL,
plot_id INTEGER NOT NULL,
FOREIGN KEY (person_id) REFERENCES people (person_id),
FOREIGN KEY (plot_id) REFERENCES plots (plot_id)
);
-- Default Data
-- Add People
INSERT INTO people (first_name, last_name, email) VALUES ('Harold', 'Miller', 'harold.miller@email.corp');
INSERT INTO people (first_name, last_name, email) VALUES ('Nancy', 'Mulligan', 'nancy.mulligan@email.corp');
-- Add Plots
INSERT INTO plots (length, width, location) VALUES (9.0, 5.0, 'Near shed');
INSERT INTO plots (length, width, location) VALUES (3.0, 3.0, 'North of gate');
-- Build M:M for People/Plots
INSERT INTO people_plots (person_id, plot_id) VALUES ((
SELECT person_id FROM people WHERE first_name = 'Harold' AND last_name = 'Miller'
), (
SELECT plot_id FROM plots WHERE location = 'Near shed'
);
INSERT INTO people_plots (person_id, plot_id) VALUES ((
SELECT person_id FROM people WHERE first_name = 'Nancy' AND last_name = 'Mulligan'
), (
SELECT plot_id FROM plots WHERE location = 'North of gate'
);
-- Add Varieties
INSERT INTO varieties (name, season) VALUES ('Argentina Cherry Tomato', 'Late Summer');
INSERT INTO varieties (name, season) VALUES ('Esterina Tomato', 'Early Fall');
INSERT INTO varieties (name, season) VALUES ('Emerald Evergreen Tomato', 'Late Spring');
INSERT INTO varieties (name, season) VALUES ('Virginia Sweets Tomato', 'Late Summer');
INSERT INTO varieties (name, season) VALUES ('Rosella Tomato', 'Late Fall');
INSERT INTO varieties (name, season) VALUES ('Ace Tomato', 'Early Fall');
INSERT INTO varieties (name, season) VALUES ('Maya Tomato', 'Early Fall');
INSERT INTO varieties (name, season) VALUES ('Miroma Tomato', 'Early Fall');
-- Add Plants (M:1 with Varieties, 1:M with Plots)
INSERT INTO plants (variety_id, plot_id) VALUES ((
SELECT variety_id FROM varieties WHERE name = 'Ace Tomato'
), (
SELECT plot_id FROM plots WHERE location = 'Near shed'
));
INSERT INTO plants (variety_id, plot_id) VALUES ((
SELECT variety_id FROM varieties WHERE name = 'Maya Tomato'
), (
SELECT plot_id FROM plots WHERE location = 'Near shed'
));
INSERT INTO plants (variety_id, plot_id) VALUES ((
SELECT variety_id FROM varieties WHERE name = 'Miroma Tomato'
), (
SELECT plot_id FROM plots WHERE location = 'Near shed'
));
-- Add Tools (M:1 with People)
INSERT INTO tools (name, `condition`) VALUES ('Trowel', 3);
INSERT INTO tools (name, `condition`, person_id) VALUES ('Watering can', 4, (
SELECT person_id FROM people WHERE first_name = 'Harold' and last_name = 'Miller'
));
INSERT INTO tools (name, `condition`, person_id) VALUES ('Shears', 1, (
SELECT person_id FROM people WHERE first_name = 'Nancy' and last_name = 'Mulligan'
));
| true |
963b884def973a69c30db09cdc02280d84d46b94 | SQL | Lightwing-Ng/LeetCodeSQL-master | /620有趣的电影.sql | UTF-8 | 1,906 | 3.734375 | 4 | [] | no_license | /*
某城市开了一家新的电影院,吸引了很多人过来看电影。该电影院特别注意用户体验,专门有个 LED显示板做电影推荐,上面公布着影评和相关电影描述。
作为该电影院的信息部主管,您需要编写一个 SQL查询,找出所有影片描述为非 boring (不无聊) 的并且 id 为奇数 的影片,结果请按等级 rating 排列。
例如,下表 Cinema:
+---------+-----------+--------------+-----------+
| id | movie | description | rating |
+---------+-----------+--------------+-----------+
| 1 | War | great 3D | 8.9 |
| 2 | Science | fiction | 8.5 |
| 3 | irish | boring | 6.2 |
| 4 | Ice song | Fantacy | 8.6 |
| 5 | House card| Interesting| 9.1 |
+---------+-----------+--------------+-----------+
对于上面的例子,则正确的输出是为:
+---------+-----------+--------------+-----------+
| id | movie | description | rating |
+---------+-----------+--------------+-----------+
| 5 | House card| Interesting| 9.1 |
| 1 | War | great 3D | 8.9 |
+---------+-----------+--------------+-----------+
*/
DROP TABLE IF EXISTS `Cinema`;
CREATE TABLE IF NOT EXISTS Cinema (
id int,
movie varchar(255),
description varchar(255),
rating float(2, 1)
);
TRUNCATE TABLE Cinema;
INSERT INTO Cinema (id, movie, description, rating)
VALUES ('1', 'War', 'great 3D', '8.9'),
('2', 'Science', 'fiction', '8.5'),
('3', 'Irish', 'boring', '6.2'),
('4', 'Ice song', 'Fantacy', '8.6'),
('5', 'House card', 'Interesting', '9.1');
SELECT *
FROM Cinema;
SELECT *
FROM Cinema
WHERE description != 'boring'
AND MOD(id, 2) != 0
ORDER BY rating DESC;
SELECT *
FROM Cinema
WHERE id % 2 = 1
AND description <> "boring"
ORDER BY rating DESC; | true |
dd0439bc9195604cd6659de45db847b93d1ea4f8 | SQL | lzzzzzz/jianxun | /src/test/resources/db/schema.sql | UTF-8 | 4,762 | 3.578125 | 4 | [] | no_license | SET NAMES utf8;
SET FOREIGN_KEY_CHECKS = 0;
DROP TABLE IF EXISTS `dictionary`;
CREATE TABLE `dictionary` (
`dic_key` varchar(64) NOT NULL comment '词典名,词典值的拼音',
`parent_key` varchar(64) DEFAULT NULL comment '词典父id',
`name` varchar(32) NOT NULL comment '词典值最多8个汉字',
`en_name` varchar(32) comment '英文词典值最多8个汉字',
`data` text DEFAULT NULL comment '扩展数据字段',
`sort_order` int(11) NOT NULL DEFAULT 0 comment '排序',
`created_time` datetime DEFAULT NULL,
`updated_time` datetime NULL DEFAULT NULL,
`deleted` tinyint(1) NOT NULL DEFAULT '0' comment '删除状态',
`version` int(11) DEFAULT 1 comment '乐观锁',
`operator` varchar(32) DEFAULT NULL comment '操作人员',
PRIMARY KEY (`dic_key`)
) COMMENT='词典表' ENGINE=InnoDB DEFAULT CHARSET=utf8 ;
-- ----------------------------
-- Table structure for `user`
-- ----------------------------
DROP TABLE IF EXISTS `user`;
CREATE TABLE `user` (
`id` varchar(32) NOT NULL COMMENT 'id',
`nick_name` varchar(15) DEFAULT NULL COMMENT '昵称',
`number` varchar(32) DEFAULT NULL COMMENT '用户名或房间编号',
`device_token` varchar(64) NOT NULL COMMENT '设备唯一识别码',
`ip_address` varchar(15) DEFAULT NULL COMMENT 'ip地址',
`mac_address` varchar(32) DEFAULT NULL COMMENT 'mac地址',
`max_number` int(3) DEFAULT '10' COMMENT '最大连接数',
`join_number` varchar(32) DEFAULT NULL COMMENT '当前加入的房间编号',
`platform` varchar(15) DEFAULT NULL COMMENT '平台',
`status` tinyint(1) NOT NULL DEFAULT '0' COMMENT '当前状态(在线、下线(房间解散))',
`locked` tinyint(1) DEFAULT '0' COMMENT '账户锁定状态',
`created_time` datetime NOT NULL,
`updated_time` datetime NOT NULL,
PRIMARY KEY (`id`)
) COMMENT = '用户表' ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------
-- Table structure for user
-- ----------------------------
DROP TABLE IF EXISTS `app_version`;
CREATE TABLE `app_version` (
`id` varchar(32) NOT NULL COMMENT 'id',
`type` varchar(64) DEFAULT NULL COMMENT 'app类型:ANDROID_PHONE,IPHONE,ANDROIDPAD, IPAD',
`version_code` varchar(64) DEFAULT NULL COMMENT 'TYPE_HOME_PAGE',
`version_name` varchar(64) DEFAULT NULL COMMENT '用户类型:TYPE_USER, TYPE_STAFF, TYPE_ADMIN',
`url` varchar(512) DEFAULT NULL COMMENT '下载地址',
`created_time` datetime DEFAULT NULL ,
`updated_time` datetime DEFAULT NULL ,
`need_update` tinyint(1) NOT NULL DEFAULT '0' comment '是否需要强制更新',
`deleted` tinyint(1) NOT NULL DEFAULT '0' comment '删除状态',
`version` int(11) DEFAULT 1 COMMENT '乐观锁',
`operator` varchar(32) DEFAULT NULL COMMENT '操作人员',
PRIMARY KEY (`id`)
) COMMENT = 'APP版本表' ENGINE=InnoDB DEFAULT CHARSET=utf8;
DROP TABLE IF EXISTS `operate_log`;
CREATE TABLE `operate_log` (
`id` varchar(32) NOT NULL ,
`staff_id` varchar(32) NOT NULL DEFAULT '' comment '工作人员id',
`ip_address` varchar(64) NOT NULL DEFAULT '' comment '操作人ip',
`content` TEXT NOT NULL COMMENT '日志内容',
`created_time` datetime DEFAULT NULL,
`operator` varchar(32) comment '操作人员',
PRIMARY KEY (`id`)
)COMMENT='操作日志' ENGINE=InnoDB DEFAULT CHARSET=utf8 ;
DROP TABLE IF EXISTS `resources`;
CREATE TABLE `resources` (
`id` varchar(32)NOT NULL,
`oss_key` varchar(255) NOT NULL COMMENT '阿里云OSS保存key',
`resource_type` varchar(64) DEFAULT NULL COMMENT '文件类型',
`name` varchar(150) NOT NULL COMMENT '文件名称',
`size` varchar(64) NOT NULL COMMENT '文件大小',
`duration` varchar(15) DEFAULT NULL COMMENT '时长',
`url` varchar(255) NOT NULL COMMENT '文件访问url',
`created_time` datetime DEFAULT NULL COMMENT '创建时间',
`updated_time` datetime DEFAULT NULL COMMENT '更新时间',
`deleted` tinyint(1) DEFAULT 0 COMMENT '删除状态',
`version` int(11) DEFAULT 1 COMMENT '乐观锁',
`operator` varchar(32) DEFAULT NULL COMMENT '操作人员id',
PRIMARY KEY (`id`)
) COMMENT = '资源文件' ENGINE = InnoDB DEFAULT CHARSET=utf8;
DROP TABLE IF EXISTS `foreign_resource`;
CREATE TABLE `foreign_resource` (
`id` varchar(32)NOT NULL,
`resource_id` varchar(32) NOT NULL COMMENT '阿里云OSS保存key',
`foreign_id` varchar(32) DEFAULT NULL COMMENT '外部类型id',
`foreign_type` varchar(50) DEFAULT NULL COMMENT '外部类型名',
`params` varchar(150) NOT NULL COMMENT '文件名称',
`created_time` datetime DEFAULT NULL COMMENT '创建时间',
`operator` varchar(32) DEFAULT NULL COMMENT '操作人员id',
PRIMARY KEY (`id`)
) COMMENT = '资源文件关联表' ENGINE = InnoDB DEFAULT CHARSET=utf8; | true |
396e073a07a7291bb3970c9c80c1f686ffc4bcc2 | SQL | johnny9052/LoginMasterPageDAO | /Recursos/sql/script.sql | UTF-8 | 556 | 3.28125 | 3 | [] | no_license |
Create table Estudiante(
id SERIAL,
codigo varchar(20),
nombre varchar(30),
apellido varchar(50),
cedula varchar(20),
edad integer,
semestre integer,
CONSTRAINT estudiante_pkey PRIMARY KEY (id)
);
CREATE TABLE usuario
(
nickname varchar(15),
nombre varchar(50),
password varchar(50),
primary key(nickname)
)
CREATE TABLE departamento(
id serial primary key,
nombre varchar(20)
);
create table municipio(
id serial primary key,
nombre varchar(20),
id_depto integer,
foreign key(id_depto) references departamento(id)
) | true |
a5e51f64637c337f5bdbaf91213c2f0eb5b8d505 | SQL | aizuon/Keeper | /db/db.sql | UTF-8 | 1,803 | 3.140625 | 3 | [] | no_license | -- --------------------------------------------------------
-- Host: 127.0.0.1
-- Server version: 10.5.5-MariaDB - mariadb.org binary distribution
-- Server OS: Win64
-- HeidiSQL Version: 11.0.0.5919
-- --------------------------------------------------------
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET NAMES utf8 */;
/*!50503 SET NAMES utf8mb4 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
-- Dumping database structure for keeper
CREATE DATABASE IF NOT EXISTS `keeper` /*!40100 DEFAULT CHARACTER SET utf8 */;
USE `keeper`;
-- Dumping structure for table keeper.accounts
CREATE TABLE IF NOT EXISTS `accounts` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`user_id` int(10) unsigned NOT NULL,
`account` varchar(50) NOT NULL,
`account_id` varchar(50) NOT NULL,
`account_password` text NOT NULL,
PRIMARY KEY (`id`),
KEY `FK_users_passwords` (`user_id`),
CONSTRAINT `FK_users_passwords` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- Data exporting was unselected.
-- Dumping structure for table keeper.users
CREATE TABLE IF NOT EXISTS `users` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`username` varchar(50) NOT NULL,
`password` varchar(60) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `username` (`username`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- Data exporting was unselected.
/*!40101 SET SQL_MODE=IFNULL(@OLD_SQL_MODE, '') */;
/*!40014 SET FOREIGN_KEY_CHECKS=IF(@OLD_FOREIGN_KEY_CHECKS IS NULL, 1, @OLD_FOREIGN_KEY_CHECKS) */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
| true |
0674d96fa695d85a8dc93fe7129c0684efecf2be | SQL | PandaPoPy/Wonder | /install.sql | UTF-8 | 1,238 | 2.984375 | 3 | [] | no_license | -- phpMyAdmin SQL Dump
-- version 4.0.10deb1
-- http://www.phpmyadmin.net
--
-- Client: localhost
-- Généré le: Ven 07 Novembre 2014 à 14:49
-- Version du serveur: 5.5.37-0ubuntu0.14.04.1
-- Version de PHP: 5.5.9-1ubuntu4.1
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
--
-- Base de données: `wonder`
--
-- --------------------------------------------------------
--
-- Structure de la table `news`
--
CREATE TABLE IF NOT EXISTS `news` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`titre` varchar(100) NOT NULL,
`texte` text NOT NULL,
`image` varchar(100) NOT NULL,
`date` datetime NOT NULL,
`auteur` varchar(100) NOT NULL,
`extrait` varchar(150) NOT NULL,
PRIMARY KEY (`id`),
KEY `auteur` (`auteur`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
| true |
50690ce0704897039b5582b5a5076942eefb3902 | SQL | DGO911/Banco-de-Dados | /Filtro_horimetro.sql | UTF-8 | 287 | 3.40625 | 3 | [] | no_license | Select a.has_data, a.vei_codigo, b.vei_identificacao_empresa,c.car_numero,a.has_horimetro from gtw_historico_abastecimento a
join gtw_veiculo b on a.vei_codigo = b.vei_codigo
join gtw_cartao c on a.CAR_CODIGO_ABASTECIDO = c.car_codigo
where has_horimetro like '19304%' order by 1 desc; | true |
732131e18e390ea2f82bfc8127c08673ad89fe96 | SQL | LoonyPandora/VegRev | /database/schema.sql | UTF-8 | 12,773 | 3.171875 | 3 | [
"MIT"
] | permissive | # ************************************************************
# Sequel Pro SQL dump
# Version 4096
#
# http://www.sequelpro.com/
# http://code.google.com/p/sequel-pro/
#
# Host: 127.0.0.1 (MySQL 10.0.11-MariaDB-log)
# Database: vegrev
# Generation Time: 2014-06-06 17:34:16 +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 board_read_receipts
# ------------------------------------------------------------
DROP TABLE IF EXISTS `board_read_receipts`;
CREATE TABLE `board_read_receipts` (
`board_id` varchar(32) NOT NULL DEFAULT '',
`user_id` int(11) NOT NULL,
`read_time` datetime NOT NULL,
UNIQUE KEY `board_id` (`board_id`,`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
# Dump of table boards
# ------------------------------------------------------------
DROP TABLE IF EXISTS `boards`;
CREATE TABLE `boards` (
`board_id` varchar(32) NOT NULL,
`board_title` varchar(255) NOT NULL,
`board_icon` varchar(255) NOT NULL,
`category_id` varchar(32) NOT NULL,
`vip_only` tinyint(4) DEFAULT NULL,
`mods_only` tinyint(4) DEFAULT NULL,
`board_guest_hidden` tinyint(4) DEFAULT NULL,
`no_new_user_threads` tinyint(4) DEFAULT NULL,
`board_position` int(11) NOT NULL,
`board_description` varchar(255) NOT NULL,
`board_message_total` int(11) NOT NULL DEFAULT '0',
`board_thread_total` int(11) NOT NULL DEFAULT '0',
`board_last_post_time` int(10) NOT NULL DEFAULT '0',
`board_last_post_id` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`board_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
# Dump of table categories
# ------------------------------------------------------------
DROP TABLE IF EXISTS `categories`;
CREATE TABLE `categories` (
`category_id` varchar(32) NOT NULL,
`category_title` varchar(255) NOT NULL,
`category_description` varchar(255) NOT NULL,
`cat_guest_hidden` tinyint(4) DEFAULT NULL,
PRIMARY KEY (`category_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
# Dump of table error_log
# ------------------------------------------------------------
DROP TABLE IF EXISTS `error_log`;
CREATE TABLE `error_log` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`error` text,
`env` text,
`get` text,
`post` text,
`viewer` text,
`error_date` datetime NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
# Dump of table forum_stats
# ------------------------------------------------------------
DROP TABLE IF EXISTS `forum_stats`;
CREATE TABLE `forum_stats` (
`forum_total_posts` int(11) NOT NULL DEFAULT '0',
`forum_total_threads` int(11) NOT NULL DEFAULT '0',
`forum_total_photos` int(11) NOT NULL DEFAULT '0',
`forum_total_users` int(11) NOT NULL DEFAULT '0',
`forum_total_shouts` int(11) NOT NULL DEFAULT '0',
`forum_max_online` int(11) NOT NULL DEFAULT '0',
`forum_max_online_time` int(10) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
# Dump of table messages
# ------------------------------------------------------------
DROP TABLE IF EXISTS `messages`;
CREATE TABLE `messages` (
`message_id` int(11) NOT NULL AUTO_INCREMENT,
`user_id` int(11) NOT NULL,
`thread_id` int(11) NOT NULL,
`message_ip` varchar(15) NOT NULL,
`message_time` int(10) NOT NULL,
`edited_time` int(10) DEFAULT NULL,
`editor_id` int(11) DEFAULT NULL,
`message_deleted` tinyint(4) DEFAULT '0',
`attachment` varchar(255) DEFAULT NULL,
`message_body` text NOT NULL,
PRIMARY KEY (`message_id`),
KEY `messages_user_id` (`user_id`),
KEY `messages_thread_id` (`thread_id`),
KEY `messages_message_time` (`message_time`),
KEY `messages_message_deleted` (`message_deleted`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
# Dump of table pm_messages
# ------------------------------------------------------------
DROP TABLE IF EXISTS `pm_messages`;
CREATE TABLE `pm_messages` (
`pm_message_id` int(11) NOT NULL AUTO_INCREMENT,
`pm_sender_id` int(11) NOT NULL,
`pm_receiver_id` int(11) NOT NULL,
`pm_thread_id` int(11) NOT NULL,
`pm_ip` varchar(15) NOT NULL,
`pm_post_time` int(10) NOT NULL,
`pm_body` text NOT NULL,
PRIMARY KEY (`pm_message_id`),
KEY `pm_messages_pm_sender_id` (`pm_sender_id`),
KEY `pm_messages_pm_receiver_id` (`pm_receiver_id`),
KEY `pm_messages_pm_thread_id` (`pm_thread_id`),
KEY `pm_messages_pm_post_time` (`pm_post_time`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
# Dump of table pm_threads
# ------------------------------------------------------------
DROP TABLE IF EXISTS `pm_threads`;
CREATE TABLE `pm_threads` (
`pm_thread_id` int(11) NOT NULL AUTO_INCREMENT,
`pm_subject` varchar(255) NOT NULL DEFAULT '(No Subject)',
`pm_sender_id` int(11) NOT NULL,
`pm_receiver_id` int(11) NOT NULL,
`pm_sender_unread` int(11) DEFAULT '0',
`pm_receiver_unread` int(11) DEFAULT '0',
`pm_total_messages` int(11) DEFAULT '0',
`pm_sender_delete` tinyint(4) DEFAULT '0',
`pm_receiver_delete` tinyint(4) DEFAULT '0',
`pm_sender_archive` tinyint(4) DEFAULT '0',
`pm_receiver_archive` tinyint(4) DEFAULT '0',
`pm_last_msg_time` int(10) NOT NULL DEFAULT '0',
`pm_last_poster_id` int(11) NOT NULL,
PRIMARY KEY (`pm_thread_id`),
KEY `pm_threads_pm_sender_id` (`pm_sender_id`),
KEY `pm_threads_pm_receiver_id` (`pm_receiver_id`),
KEY `pm_threads_pm_last_msg_time` (`pm_last_msg_time`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
# Dump of table poll_options
# ------------------------------------------------------------
DROP TABLE IF EXISTS `poll_options`;
CREATE TABLE `poll_options` (
`poll_option_id` int(11) NOT NULL AUTO_INCREMENT,
`thread_id` int(11) NOT NULL,
`poll_option` varchar(255) NOT NULL,
PRIMARY KEY (`poll_option_id`),
KEY `poll_options_thread_id` (`thread_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
# Dump of table poll_votes
# ------------------------------------------------------------
DROP TABLE IF EXISTS `poll_votes`;
CREATE TABLE `poll_votes` (
`thread_id` int(11) NOT NULL DEFAULT '0',
`user_id` int(11) NOT NULL DEFAULT '0',
`poll_option_id` int(11) NOT NULL DEFAULT '0',
`poll_ip_address` varchar(15) NOT NULL DEFAULT '0',
KEY `poll_votes_thread_id` (`thread_id`),
KEY `poll_votes_poll_option_id` (`poll_option_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
# Dump of table polls
# ------------------------------------------------------------
DROP TABLE IF EXISTS `polls`;
CREATE TABLE `polls` (
`thread_id` int(11) NOT NULL AUTO_INCREMENT,
`question` varchar(255) NOT NULL,
`poll_locked` tinyint(4) DEFAULT '0',
`multi` tinyint(4) DEFAULT '0',
`private` tinyint(4) DEFAULT '0',
`user_id` int(11) NOT NULL,
`poll_start_time` int(10) NOT NULL,
PRIMARY KEY (`thread_id`),
KEY `polls_poll_start_time` (`poll_start_time`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
# Dump of table post_groups
# ------------------------------------------------------------
DROP TABLE IF EXISTS `post_groups`;
CREATE TABLE `post_groups` (
`post_group_id` int(11) NOT NULL AUTO_INCREMENT,
`posts_required` int(11) NOT NULL DEFAULT '0',
`post_group_title` varchar(255) NOT NULL,
`post_group_image` varchar(32) DEFAULT NULL,
`post_group_color` varchar(16) DEFAULT NULL,
PRIMARY KEY (`post_group_id`),
KEY `post_group_post_group_id` (`post_group_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
# Dump of table session
# ------------------------------------------------------------
DROP TABLE IF EXISTS `session`;
CREATE TABLE `session` (
`id` varchar(32) NOT NULL DEFAULT '',
`user_id` int(11) DEFAULT NULL,
`date_online` datetime DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
# Dump of table shoutbox
# ------------------------------------------------------------
DROP TABLE IF EXISTS `shoutbox`;
CREATE TABLE `shoutbox` (
`shout_id` int(11) NOT NULL AUTO_INCREMENT,
`user_id` int(11) NOT NULL,
`shout_ip_address` varchar(15) NOT NULL,
`shout_time` int(10) NOT NULL,
`shout_deleted` tinyint(4) DEFAULT '0',
`shout_body` varchar(255) NOT NULL,
PRIMARY KEY (`shout_id`),
KEY `shoutbox_user_id` (`user_id`),
KEY `shoutbox_shout_time` (`shout_time`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
# Dump of table special_groups
# ------------------------------------------------------------
DROP TABLE IF EXISTS `special_groups`;
CREATE TABLE `special_groups` (
`spec_group_id` int(11) NOT NULL AUTO_INCREMENT,
`spec_group_title` varchar(255) NOT NULL,
`spec_group_image` varchar(32) DEFAULT NULL,
`group_can_mod` tinyint(4) DEFAULT '0',
`group_can_admin` tinyint(4) DEFAULT '0',
`spec_group_color` varchar(16) DEFAULT NULL,
PRIMARY KEY (`spec_group_id`),
KEY `spec_group_spec_group_id` (`spec_group_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
# Dump of table thread_read_receipts
# ------------------------------------------------------------
DROP TABLE IF EXISTS `thread_read_receipts`;
CREATE TABLE `thread_read_receipts` (
`thread_id` varchar(32) NOT NULL DEFAULT '',
`user_id` int(11) NOT NULL,
`read_time` datetime NOT NULL,
UNIQUE KEY `thread_id` (`thread_id`,`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
# Dump of table threads
# ------------------------------------------------------------
DROP TABLE IF EXISTS `threads`;
CREATE TABLE `threads` (
`thread_id` int(11) NOT NULL AUTO_INCREMENT,
`thread_subject` varchar(255) NOT NULL DEFAULT '(No Subject)',
`board_id` varchar(32) DEFAULT NULL,
`thread_starter_id` int(11) NOT NULL,
`thread_locked` int(11) DEFAULT NULL,
`thread_star` int(11) DEFAULT NULL,
`thread_deleted` int(11) DEFAULT NULL,
`thread_views` int(11) NOT NULL DEFAULT '0',
`thread_messages` int(11) NOT NULL DEFAULT '1',
`thread_icon` varchar(32) DEFAULT NULL,
`thread_last_message_time` int(11) NOT NULL DEFAULT '0',
`thread_last_user_id` int(11) NOT NULL,
`thread_first_message_id` int(11) NOT NULL,
PRIMARY KEY (`thread_id`),
KEY `threads_thread_last_message_time` (`thread_last_message_time`),
KEY `threads_thread_star` (`thread_star`),
KEY `threads_thread_deleted` (`thread_deleted`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
# Dump of table users
# ------------------------------------------------------------
DROP TABLE IF EXISTS `users`;
CREATE TABLE `users` (
`user_id` int(11) NOT NULL AUTO_INCREMENT,
`user_name` varchar(64) NOT NULL,
`display_name` varchar(64) NOT NULL,
`real_name` varchar(64) DEFAULT NULL,
`email` varchar(255) NOT NULL,
`password` varchar(32) NOT NULL,
`bcrypt_password` varchar(72) NOT NULL DEFAULT '',
`hide_email` tinyint(4) DEFAULT '0',
`pm_notify` tinyint(4) DEFAULT '0',
`stealth_login` tinyint(4) DEFAULT '0',
`spec_group_id` int(11) DEFAULT '0',
`template` varchar(32) DEFAULT NULL,
`language` varchar(32) DEFAULT NULL,
`tumblr` varchar(255) DEFAULT NULL,
`last_fm` varchar(255) DEFAULT NULL,
`homepage` varchar(255) DEFAULT NULL,
`icq` varchar(16) DEFAULT NULL,
`msn` varchar(255) DEFAULT NULL,
`yim` varchar(255) DEFAULT NULL,
`aim` varchar(255) DEFAULT NULL,
`gtalk` varchar(255) DEFAULT NULL,
`skype` varchar(255) DEFAULT NULL,
`twitter` varchar(255) DEFAULT NULL,
`flickr` varchar(255) DEFAULT NULL,
`deviantart` varchar(255) DEFAULT NULL,
`vimeo` varchar(255) DEFAULT NULL,
`youtube` varchar(255) DEFAULT NULL,
`facebook` varchar(255) DEFAULT NULL,
`myspace` varchar(255) DEFAULT NULL,
`bebo` varchar(255) DEFAULT NULL,
`avatar` varchar(255) DEFAULT NULL,
`usertext` varchar(255) DEFAULT NULL,
`signature` text,
`biography` text,
`gender` varchar(255) DEFAULT NULL,
`birthday` varchar(10) DEFAULT NULL,
`timezone` varchar(10) DEFAULT NULL,
`reg_time` int(10) NOT NULL,
`last_online` int(10) DEFAULT '0',
`last_ip` varchar(15) DEFAULT '0',
`user_post_num` int(11) DEFAULT '0',
`user_shout_num` int(11) DEFAULT '0',
`user_deleted` tinyint(4) DEFAULT '0',
`user_private` tinyint(4) DEFAULT '0',
PRIMARY KEY (`user_id`),
UNIQUE KEY `user_name` (`user_name`),
UNIQUE KEY `email` (`email`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
| true |
d7d828e5cff885b3ca58fec43b744209d149317c | SQL | wilsonjuniordev/algafood-api | /src/main/resources/db/migration/V005__cria-tabelas-pedido-item-pedido.sql | UTF-8 | 1,568 | 3.46875 | 3 | [
"MIT"
] | permissive | create table pedido (
id bigserial not null,
subtotal numeric(10, 2) not null,
taxa_frete numeric(10, 2) not null,
valor_total numeric(10, 2) not null,
restaurante_id int8 not null,
usuario_cliente_id int8 not null,
forma_pagamento_id int8 not null,
endereco_cidade_id int8 not null,
endereco_cep varchar(9) not null,
endereco_logradouro varchar(100) not null,
endereco_numero varchar(20) not null,
endereco_complemento varchar(60),
endereco_bairro varchar(60) not null,
status varchar(10) not null,
data_criacao timestamp(0) not null,
data_confirmacao timestamp(0),
data_cancelamento timestamp(0),
data_entrega timestamp(0),
primary key (id),
constraint fk_pedido_restaurante foreign key (restaurante_id) references restaurante (id),
constraint fk_pedido_usuario_cliente foreign key (usuario_cliente_id) references usuario (id),
constraint fk_pedido_forma_pagamento foreign key (forma_pagamento_id) references forma_pagamento (id)
);
create table item_pedido (
id bigserial not null,
quantidade int4 not null,
preco_unitario numeric(10, 2) not null,
preco_total numeric(10, 2) not null,
observacao varchar(255),
pedido_id int8 not null,
produto_id int8 not null,
primary key (id),
constraint uk_item_pedido_produto unique (pedido_id, produto_id),
constraint fk_item_pedido_pedido foreign key (pedido_id) references pedido (id),
constraint fk_item_pedido_produto foreign key (produto_id) references produto (id)
);
| true |
886a40f2785378f38cbc6824e3fd2ab74ceb0920 | SQL | luisSolares98/grigingo | /sql/1.0.sql | UTF-8 | 3,717 | 3.375 | 3 | [] | no_license | create database gringingo;
use gringingo;
create table usuarios(
id int primary key auto_increment,
nombre text,
apellido text,
nick text,
password text,
vida int,
experiencia int
);
create table premios(
id int primary key auto_increment,
nombre text,
img text
);
create table desafios(
id int primary key auto_increment,
nombre text,
premio_id int,
foreign key (premio_id) references premios(id)
);
create table desafio_usuario(
id int primary key auto_increment,
desafio_id int not null,
usuario_id int not null,
foreign key (desafio_id) references desafios(id),
foreign key (usuario_id) references usuarios(id)
);
create table niveles(
id int primary key auto_increment,
nombre text
);
create table lecciones(
id int primary key auto_increment,
nombre text,
img text,
nivel_id int,
foreign key (nivel_id) references niveles(id)
);
create table leccion_usuario(
id int primary key auto_increment,
leccion_id int not null,
usuario_id int not null,
foreign key (leccion_id) references lecciones(id),
foreign key (usuario_id) references usuarios(id)
);
create table preguntas(
id int primary key auto_increment,
detalle text,
tipo text,
leccion_id int not null,
foreign key (leccion_id) references lecciones(id)
);
create table respuestas(
id int primary key auto_increment,
nombre text,
correpta bool,
pregunta_id int not null,
foreign key (pregunta_id) references preguntas(id)
);
create table ligas(
id int primary key auto_increment,
nombre text,
puntos int
);
insert into ligas values
(default, "Oro", 200),
(default, "Plata", 100),
(default, "Bronce", 50);
insert into niveles values
(default, "Leccion 1"),
(default, "Leccion 2");
insert into lecciones values
(default, "Saludos", "",1),
(default, "Familia", "",2),
(default, "Menu", "",2);
insert into preguntas values
(1, 'Traducir a ingles [Buenos días]',"opciones", 1),
(2, 'Traducir a ingles [Mucho gusto]',"opciones", 1),
(3, 'Traducir a ingles [Bienvenido a Bolivia]',"opciones", 1),
(4, 'Traducir a español [Good morning!]',"opciones", 1),
(5, 'Traducir a Ingles [Yo soy de Bolivia.]',"opciones", 1),
(6, 'Escribe [Bienvenido] en ingles ',"comparar", 1),
(7, 'Escribe [Mucho gusto] en ingles ',"comparar", 1);
insert into respuestas values
(default, "Good morning",true,1),
(default, "Good night",false,1),
(default, "Good evening",false,1);
insert into respuestas values
(default, "Nice to meet you.",true,2),
(default, "I meet you.",false,2),
(default, "Nice to meet your.",false,2);
insert into respuestas values
(default, "Welcome to Bolivia",true,3),
(default, "Welcome from Bolivia",false,3),
(default, "Welcome to Bolivian",false,3);
insert into respuestas values
(default, "Good morning",false,4),
(default, "Good night",true,4),
(default, "Good evening",false,4);
insert into respuestas values
(default, "Welcome to Bolivia.",false,5),
(default, "I am from Bolivia.",true,5),
(default, "I am Bolivia.",false,5);
insert into respuestas values (default, "Welcome",true,6);
insert into respuestas values (default, "Nice to meet you.",true,7);
DELIMITER $$
drop PROCEDURE if exists sp_usuario_insert;$$
CREATE PROCEDURE sp_usuario_insert(_nombre TEXT, _apellido TEXT, _nick text, _password text) BEGIN
INSERT into usuarios values (DEFAULT, _nombre, _apellido, _nick, sha1(_password), 0, 0);
select * from usuarios where id = LAST_INSERT_ID();
END$$
DELIMITER $$
drop PROCEDURE if exists sp_usuario_selectByLogin;$$
CREATE PROCEDURE sp_usuario_selectByLogin (_nick TEXT,_password TEXT) BEGIN
SELECT id, nombre, apellido, nick, vida, experiencia from usuarios where nick like _nick and password like sha1(_password);
END$$ | true |
9c6d49e4cfa6b7cff94a0be8df2fcbd946e1ea74 | SQL | henriquesan14/sistemaphp | /clinicaphp.sql | UTF-8 | 4,063 | 3.203125 | 3 | [] | no_license | -- phpMyAdmin SQL Dump
-- version 4.8.2
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: 04-Dez-2018 às 19:12
-- Versão do servidor: 10.1.34-MariaDB
-- PHP Version: 7.2.8
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Database: `clinicaphp`
--
-- --------------------------------------------------------
--
-- Estrutura da tabela `consulta`
--
CREATE TABLE `consulta` (
`id` int(11) NOT NULL,
`data` date NOT NULL,
`turno` varchar(50) NOT NULL,
`idMedico` int(11) NOT NULL,
`idPaciente` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Extraindo dados da tabela `consulta`
--
INSERT INTO `consulta` (`id`, `data`, `turno`, `idMedico`, `idPaciente`) VALUES
(1, '2018-12-04', 'manha', 1, 1),
(2, '2018-12-04', 'manha', 1, 1),
(3, '2018-12-04', 'tarde', 2, 2),
(4, '2018-12-04', 'manha', 1, 1),
(5, '2018-12-27', 'manha', 1, 1);
-- --------------------------------------------------------
--
-- Estrutura da tabela `medico`
--
CREATE TABLE `medico` (
`id` int(11) NOT NULL,
`nome` varchar(100) NOT NULL,
`especialidade` varchar(100) NOT NULL,
`crm` varchar(50) NOT NULL,
`cpf` varchar(11) NOT NULL,
`telefone` varchar(12) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Extraindo dados da tabela `medico`
--
INSERT INTO `medico` (`id`, `nome`, `especialidade`, `crm`, `cpf`, `telefone`) VALUES
(1, 'henrique', 'CARDIO', '1111111111', '11111111111', '0000000000'),
(2, 'sergio ramos', 'nutricionista', '1111111111', '11111111111', '0000000000');
-- --------------------------------------------------------
--
-- Estrutura da tabela `paciente`
--
CREATE TABLE `paciente` (
`id` int(11) NOT NULL,
`nome` varchar(100) NOT NULL,
`cpf` varchar(11) NOT NULL,
`rg` varchar(14) NOT NULL,
`telefone` varchar(12) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Extraindo dados da tabela `paciente`
--
INSERT INTO `paciente` (`id`, `nome`, `cpf`, `rg`, `telefone`) VALUES
(1, 'henrique', '11111111111', '11111111111', '0000000000'),
(2, 'henrique santos', '11111111111', '11111111111', '0000000000'),
(3, 'henrique', '11111111111', '11111111111', '0000000000');
-- --------------------------------------------------------
--
-- Estrutura da tabela `usuario`
--
CREATE TABLE `usuario` (
`id` int(11) NOT NULL,
`nome` varchar(100) NOT NULL,
`email` varchar(100) NOT NULL,
`senha` varchar(32) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Extraindo dados da tabela `usuario`
--
INSERT INTO `usuario` (`id`, `nome`, `email`, `senha`) VALUES
(1, 'henrique', 'ricogx@hotmail.com', '123456'),
(2, 'henrique', 'ricogx2@hotmail.com', '123456');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `consulta`
--
ALTER TABLE `consulta`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `medico`
--
ALTER TABLE `medico`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `paciente`
--
ALTER TABLE `paciente`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `usuario`
--
ALTER TABLE `usuario`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `consulta`
--
ALTER TABLE `consulta`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;
--
-- AUTO_INCREMENT for table `medico`
--
ALTER TABLE `medico`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT for table `paciente`
--
ALTER TABLE `paciente`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
--
-- AUTO_INCREMENT for table `usuario`
--
ALTER TABLE `usuario`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
| true |
2617f694a7accc5b0e7bab713df0a6b37ccc3cb7 | SQL | ruanhq/Leetcode | /SQL/1173.sql | UTF-8 | 275 | 2.953125 | 3 | [] | no_license | #1173.Immediate Food Delivery I
SELECT ROUND(AVG(CASE WHEN order_date = customer_pref_delivery_date
THEN 1 ELSE 0 END) * 100, 2) AS immediate_percentage
FROM delivery;
#It may not be the optimal solution in consideration of the potential ties. | true |
e2b6def2c4ad4f289c827dc16f50e95484d55e37 | SQL | chenchotshering/StdsMgt | /database/sms_information_schema_views.sql | UTF-8 | 190,029 | 2.890625 | 3 | [] | no_license | INSERT INTO information_schema.views (table_catalog, table_schema, table_name, view_definition, check_option, is_updatable, is_insertable_into, is_trigger_updatable, is_trigger_deletable, is_trigger_insertable_into) VALUES ('sms', 'pg_catalog', 'pg_shadow', ' SELECT pg_authid.rolname AS usename,
pg_authid.oid AS usesysid,
pg_authid.rolcreatedb AS usecreatedb,
pg_authid.rolsuper AS usesuper,
pg_authid.rolreplication AS userepl,
pg_authid.rolbypassrls AS usebypassrls,
pg_authid.rolpassword AS passwd,
pg_authid.rolvaliduntil AS valuntil,
s.setconfig AS useconfig
FROM (pg_authid
LEFT JOIN pg_db_role_setting s ON (((pg_authid.oid = s.setrole) AND (s.setdatabase = (0)::oid))))
WHERE pg_authid.rolcanlogin;', 'NONE', 'NO', 'NO', 'NO', 'NO', 'NO');
INSERT INTO information_schema.views (table_catalog, table_schema, table_name, view_definition, check_option, is_updatable, is_insertable_into, is_trigger_updatable, is_trigger_deletable, is_trigger_insertable_into) VALUES ('sms', 'pg_catalog', 'pg_roles', ' SELECT pg_authid.rolname,
pg_authid.rolsuper,
pg_authid.rolinherit,
pg_authid.rolcreaterole,
pg_authid.rolcreatedb,
pg_authid.rolcanlogin,
pg_authid.rolreplication,
pg_authid.rolconnlimit,
''********''::text AS rolpassword,
pg_authid.rolvaliduntil,
pg_authid.rolbypassrls,
s.setconfig AS rolconfig,
pg_authid.oid
FROM (pg_authid
LEFT JOIN pg_db_role_setting s ON (((pg_authid.oid = s.setrole) AND (s.setdatabase = (0)::oid))));', 'NONE', 'NO', 'NO', 'NO', 'NO', 'NO');
INSERT INTO information_schema.views (table_catalog, table_schema, table_name, view_definition, check_option, is_updatable, is_insertable_into, is_trigger_updatable, is_trigger_deletable, is_trigger_insertable_into) VALUES ('sms', 'pg_catalog', 'pg_settings', ' SELECT a.name,
a.setting,
a.unit,
a.category,
a.short_desc,
a.extra_desc,
a.context,
a.vartype,
a.source,
a.min_val,
a.max_val,
a.enumvals,
a.boot_val,
a.reset_val,
a.sourcefile,
a.sourceline,
a.pending_restart
FROM pg_show_all_settings() a(name, setting, unit, category, short_desc, extra_desc, context, vartype, source, min_val, max_val, enumvals, boot_val, reset_val, sourcefile, sourceline, pending_restart);', 'NONE', 'NO', 'NO', 'NO', 'NO', 'NO');
INSERT INTO information_schema.views (table_catalog, table_schema, table_name, view_definition, check_option, is_updatable, is_insertable_into, is_trigger_updatable, is_trigger_deletable, is_trigger_insertable_into) VALUES ('sms', 'pg_catalog', 'pg_file_settings', ' SELECT a.sourcefile,
a.sourceline,
a.seqno,
a.name,
a.setting,
a.applied,
a.error
FROM pg_show_all_file_settings() a(sourcefile, sourceline, seqno, name, setting, applied, error);', 'NONE', 'NO', 'NO', 'NO', 'NO', 'NO');
INSERT INTO information_schema.views (table_catalog, table_schema, table_name, view_definition, check_option, is_updatable, is_insertable_into, is_trigger_updatable, is_trigger_deletable, is_trigger_insertable_into) VALUES ('sms', 'pg_catalog', 'pg_hba_file_rules', ' SELECT a.line_number,
a.type,
a.database,
a.user_name,
a.address,
a.netmask,
a.auth_method,
a.options,
a.error
FROM pg_hba_file_rules() a(line_number, type, database, user_name, address, netmask, auth_method, options, error);', 'NONE', 'NO', 'NO', 'NO', 'NO', 'NO');
INSERT INTO information_schema.views (table_catalog, table_schema, table_name, view_definition, check_option, is_updatable, is_insertable_into, is_trigger_updatable, is_trigger_deletable, is_trigger_insertable_into) VALUES ('sms', 'pg_catalog', 'pg_config', ' SELECT pg_config.name,
pg_config.setting
FROM pg_config() pg_config(name, setting);', 'NONE', 'NO', 'NO', 'NO', 'NO', 'NO');
INSERT INTO information_schema.views (table_catalog, table_schema, table_name, view_definition, check_option, is_updatable, is_insertable_into, is_trigger_updatable, is_trigger_deletable, is_trigger_insertable_into) VALUES ('sms', 'pg_catalog', 'pg_shmem_allocations', ' SELECT pg_get_shmem_allocations.name,
pg_get_shmem_allocations.off,
pg_get_shmem_allocations.size,
pg_get_shmem_allocations.allocated_size
FROM pg_get_shmem_allocations() pg_get_shmem_allocations(name, off, size, allocated_size);', 'NONE', 'NO', 'NO', 'NO', 'NO', 'NO');
INSERT INTO information_schema.views (table_catalog, table_schema, table_name, view_definition, check_option, is_updatable, is_insertable_into, is_trigger_updatable, is_trigger_deletable, is_trigger_insertable_into) VALUES ('sms', 'pg_catalog', 'pg_prepared_statements', ' SELECT p.name,
p.statement,
p.prepare_time,
p.parameter_types,
p.from_sql
FROM pg_prepared_statement() p(name, statement, prepare_time, parameter_types, from_sql);', 'NONE', 'NO', 'NO', 'NO', 'NO', 'NO');
INSERT INTO information_schema.views (table_catalog, table_schema, table_name, view_definition, check_option, is_updatable, is_insertable_into, is_trigger_updatable, is_trigger_deletable, is_trigger_insertable_into) VALUES ('sms', 'pg_catalog', 'pg_stat_progress_vacuum', ' SELECT s.pid,
s.datid,
d.datname,
s.relid,
CASE s.param1
WHEN 0 THEN ''initializing''::text
WHEN 1 THEN ''scanning heap''::text
WHEN 2 THEN ''vacuuming indexes''::text
WHEN 3 THEN ''vacuuming heap''::text
WHEN 4 THEN ''cleaning up indexes''::text
WHEN 5 THEN ''truncating heap''::text
WHEN 6 THEN ''performing final cleanup''::text
ELSE NULL::text
END AS phase,
s.param2 AS heap_blks_total,
s.param3 AS heap_blks_scanned,
s.param4 AS heap_blks_vacuumed,
s.param5 AS index_vacuum_count,
s.param6 AS max_dead_tuples,
s.param7 AS num_dead_tuples
FROM (pg_stat_get_progress_info(''VACUUM''::text) s(pid, datid, relid, param1, param2, param3, param4, param5, param6, param7, param8, param9, param10, param11, param12, param13, param14, param15, param16, param17, param18, param19, param20)
LEFT JOIN pg_database d ON ((s.datid = d.oid)));', 'NONE', 'NO', 'NO', 'NO', 'NO', 'NO');
INSERT INTO information_schema.views (table_catalog, table_schema, table_name, view_definition, check_option, is_updatable, is_insertable_into, is_trigger_updatable, is_trigger_deletable, is_trigger_insertable_into) VALUES ('sms', 'pg_catalog', 'pg_replication_origin_status', ' SELECT pg_show_replication_origin_status.local_id,
pg_show_replication_origin_status.external_id,
pg_show_replication_origin_status.remote_lsn,
pg_show_replication_origin_status.local_lsn
FROM pg_show_replication_origin_status() pg_show_replication_origin_status(local_id, external_id, remote_lsn, local_lsn);', 'NONE', 'NO', 'NO', 'NO', 'NO', 'NO');
INSERT INTO information_schema.views (table_catalog, table_schema, table_name, view_definition, check_option, is_updatable, is_insertable_into, is_trigger_updatable, is_trigger_deletable, is_trigger_insertable_into) VALUES ('sms', 'pg_catalog', 'pg_stat_progress_cluster', ' SELECT s.pid,
s.datid,
d.datname,
s.relid,
CASE s.param1
WHEN 1 THEN ''CLUSTER''::text
WHEN 2 THEN ''VACUUM FULL''::text
ELSE NULL::text
END AS command,
CASE s.param2
WHEN 0 THEN ''initializing''::text
WHEN 1 THEN ''seq scanning heap''::text
WHEN 2 THEN ''index scanning heap''::text
WHEN 3 THEN ''sorting tuples''::text
WHEN 4 THEN ''writing new heap''::text
WHEN 5 THEN ''swapping relation files''::text
WHEN 6 THEN ''rebuilding index''::text
WHEN 7 THEN ''performing final cleanup''::text
ELSE NULL::text
END AS phase,
(s.param3)::oid AS cluster_index_relid,
s.param4 AS heap_tuples_scanned,
s.param5 AS heap_tuples_written,
s.param6 AS heap_blks_total,
s.param7 AS heap_blks_scanned,
s.param8 AS index_rebuild_count
FROM (pg_stat_get_progress_info(''CLUSTER''::text) s(pid, datid, relid, param1, param2, param3, param4, param5, param6, param7, param8, param9, param10, param11, param12, param13, param14, param15, param16, param17, param18, param19, param20)
LEFT JOIN pg_database d ON ((s.datid = d.oid)));', 'NONE', 'NO', 'NO', 'NO', 'NO', 'NO');
INSERT INTO information_schema.views (table_catalog, table_schema, table_name, view_definition, check_option, is_updatable, is_insertable_into, is_trigger_updatable, is_trigger_deletable, is_trigger_insertable_into) VALUES ('sms', 'pg_catalog', 'pg_stat_progress_create_index', ' SELECT s.pid,
s.datid,
d.datname,
s.relid,
(s.param7)::oid AS index_relid,
CASE s.param1
WHEN 1 THEN ''CREATE INDEX''::text
WHEN 2 THEN ''CREATE INDEX CONCURRENTLY''::text
WHEN 3 THEN ''REINDEX''::text
WHEN 4 THEN ''REINDEX CONCURRENTLY''::text
ELSE NULL::text
END AS command,
CASE s.param10
WHEN 0 THEN ''initializing''::text
WHEN 1 THEN ''waiting for writers before build''::text
WHEN 2 THEN (''building index''::text || COALESCE(('': ''::text || pg_indexam_progress_phasename((s.param9)::oid, s.param11)), ''''::text))
WHEN 3 THEN ''waiting for writers before validation''::text
WHEN 4 THEN ''index validation: scanning index''::text
WHEN 5 THEN ''index validation: sorting tuples''::text
WHEN 6 THEN ''index validation: scanning table''::text
WHEN 7 THEN ''waiting for old snapshots''::text
WHEN 8 THEN ''waiting for readers before marking dead''::text
WHEN 9 THEN ''waiting for readers before dropping''::text
ELSE NULL::text
END AS phase,
s.param4 AS lockers_total,
s.param5 AS lockers_done,
s.param6 AS current_locker_pid,
s.param16 AS blocks_total,
s.param17 AS blocks_done,
s.param12 AS tuples_total,
s.param13 AS tuples_done,
s.param14 AS partitions_total,
s.param15 AS partitions_done
FROM (pg_stat_get_progress_info(''CREATE INDEX''::text) s(pid, datid, relid, param1, param2, param3, param4, param5, param6, param7, param8, param9, param10, param11, param12, param13, param14, param15, param16, param17, param18, param19, param20)
LEFT JOIN pg_database d ON ((s.datid = d.oid)));', 'NONE', 'NO', 'NO', 'NO', 'NO', 'NO');
INSERT INTO information_schema.views (table_catalog, table_schema, table_name, view_definition, check_option, is_updatable, is_insertable_into, is_trigger_updatable, is_trigger_deletable, is_trigger_insertable_into) VALUES ('sms', 'pg_catalog', 'pg_stat_progress_basebackup', ' SELECT s.pid,
CASE s.param1
WHEN 0 THEN ''initializing''::text
WHEN 1 THEN ''waiting for checkpoint to finish''::text
WHEN 2 THEN ''estimating backup size''::text
WHEN 3 THEN ''streaming database files''::text
WHEN 4 THEN ''waiting for wal archiving to finish''::text
WHEN 5 THEN ''transferring wal files''::text
ELSE NULL::text
END AS phase,
CASE s.param2
WHEN ''-1''::integer THEN NULL::bigint
ELSE s.param2
END AS backup_total,
s.param3 AS backup_streamed,
s.param4 AS tablespaces_total,
s.param5 AS tablespaces_streamed
FROM pg_stat_get_progress_info(''BASEBACKUP''::text) s(pid, datid, relid, param1, param2, param3, param4, param5, param6, param7, param8, param9, param10, param11, param12, param13, param14, param15, param16, param17, param18, param19, param20);', 'NONE', 'NO', 'NO', 'NO', 'NO', 'NO');
INSERT INTO information_schema.views (table_catalog, table_schema, table_name, view_definition, check_option, is_updatable, is_insertable_into, is_trigger_updatable, is_trigger_deletable, is_trigger_insertable_into) VALUES ('sms', 'pg_catalog', 'pg_user_mappings', ' SELECT u.oid AS umid,
s.oid AS srvid,
s.srvname,
u.umuser,
CASE
WHEN (u.umuser = (0)::oid) THEN ''public''::name
ELSE a.rolname
END AS usename,
CASE
WHEN (((u.umuser <> (0)::oid) AND (a.rolname = CURRENT_USER) AND (pg_has_role(s.srvowner, ''USAGE''::text) OR has_server_privilege(s.oid, ''USAGE''::text))) OR ((u.umuser = (0)::oid) AND pg_has_role(s.srvowner, ''USAGE''::text)) OR ( SELECT pg_authid.rolsuper
FROM pg_authid
WHERE (pg_authid.rolname = CURRENT_USER))) THEN u.umoptions
ELSE NULL::text[]
END AS umoptions
FROM ((pg_user_mapping u
JOIN pg_foreign_server s ON ((u.umserver = s.oid)))
LEFT JOIN pg_authid a ON ((a.oid = u.umuser)));', 'NONE', 'NO', 'NO', 'NO', 'NO', 'NO');
INSERT INTO information_schema.views (table_catalog, table_schema, table_name, view_definition, check_option, is_updatable, is_insertable_into, is_trigger_updatable, is_trigger_deletable, is_trigger_insertable_into) VALUES ('sms', 'pg_catalog', 'pg_group', ' SELECT pg_authid.rolname AS groname,
pg_authid.oid AS grosysid,
ARRAY( SELECT pg_auth_members.member
FROM pg_auth_members
WHERE (pg_auth_members.roleid = pg_authid.oid)) AS grolist
FROM pg_authid
WHERE (NOT pg_authid.rolcanlogin);', 'NONE', 'YES', 'YES', 'NO', 'NO', 'NO');
INSERT INTO information_schema.views (table_catalog, table_schema, table_name, view_definition, check_option, is_updatable, is_insertable_into, is_trigger_updatable, is_trigger_deletable, is_trigger_insertable_into) VALUES ('sms', 'pg_catalog', 'pg_user', ' SELECT pg_shadow.usename,
pg_shadow.usesysid,
pg_shadow.usecreatedb,
pg_shadow.usesuper,
pg_shadow.userepl,
pg_shadow.usebypassrls,
''********''::text AS passwd,
pg_shadow.valuntil,
pg_shadow.useconfig
FROM pg_shadow;', 'NONE', 'NO', 'NO', 'NO', 'NO', 'NO');
INSERT INTO information_schema.views (table_catalog, table_schema, table_name, view_definition, check_option, is_updatable, is_insertable_into, is_trigger_updatable, is_trigger_deletable, is_trigger_insertable_into) VALUES ('sms', 'pg_catalog', 'pg_policies', ' SELECT n.nspname AS schemaname,
c.relname AS tablename,
pol.polname AS policyname,
CASE
WHEN pol.polpermissive THEN ''PERMISSIVE''::text
ELSE ''RESTRICTIVE''::text
END AS permissive,
CASE
WHEN (pol.polroles = ''{0}''::oid[]) THEN (string_to_array(''public''::text, ''''::text))::name[]
ELSE ARRAY( SELECT pg_authid.rolname
FROM pg_authid
WHERE (pg_authid.oid = ANY (pol.polroles))
ORDER BY pg_authid.rolname)
END AS roles,
CASE pol.polcmd
WHEN ''r''::"char" THEN ''SELECT''::text
WHEN ''a''::"char" THEN ''INSERT''::text
WHEN ''w''::"char" THEN ''UPDATE''::text
WHEN ''d''::"char" THEN ''DELETE''::text
WHEN ''*''::"char" THEN ''ALL''::text
ELSE NULL::text
END AS cmd,
pg_get_expr(pol.polqual, pol.polrelid) AS qual,
pg_get_expr(pol.polwithcheck, pol.polrelid) AS with_check
FROM ((pg_policy pol
JOIN pg_class c ON ((c.oid = pol.polrelid)))
LEFT JOIN pg_namespace n ON ((n.oid = c.relnamespace)));', 'NONE', 'NO', 'NO', 'NO', 'NO', 'NO');
INSERT INTO information_schema.views (table_catalog, table_schema, table_name, view_definition, check_option, is_updatable, is_insertable_into, is_trigger_updatable, is_trigger_deletable, is_trigger_insertable_into) VALUES ('sms', 'pg_catalog', 'pg_rules', ' SELECT n.nspname AS schemaname,
c.relname AS tablename,
r.rulename,
pg_get_ruledef(r.oid) AS definition
FROM ((pg_rewrite r
JOIN pg_class c ON ((c.oid = r.ev_class)))
LEFT JOIN pg_namespace n ON ((n.oid = c.relnamespace)))
WHERE (r.rulename <> ''_RETURN''::name);', 'NONE', 'NO', 'NO', 'NO', 'NO', 'NO');
INSERT INTO information_schema.views (table_catalog, table_schema, table_name, view_definition, check_option, is_updatable, is_insertable_into, is_trigger_updatable, is_trigger_deletable, is_trigger_insertable_into) VALUES ('sms', 'pg_catalog', 'pg_views', ' SELECT n.nspname AS schemaname,
c.relname AS viewname,
pg_get_userbyid(c.relowner) AS viewowner,
pg_get_viewdef(c.oid) AS definition
FROM (pg_class c
LEFT JOIN pg_namespace n ON ((n.oid = c.relnamespace)))
WHERE (c.relkind = ''v''::"char");', 'NONE', 'NO', 'NO', 'NO', 'NO', 'NO');
INSERT INTO information_schema.views (table_catalog, table_schema, table_name, view_definition, check_option, is_updatable, is_insertable_into, is_trigger_updatable, is_trigger_deletable, is_trigger_insertable_into) VALUES ('sms', 'pg_catalog', 'pg_tables', ' SELECT n.nspname AS schemaname,
c.relname AS tablename,
pg_get_userbyid(c.relowner) AS tableowner,
t.spcname AS tablespace,
c.relhasindex AS hasindexes,
c.relhasrules AS hasrules,
c.relhastriggers AS hastriggers,
c.relrowsecurity AS rowsecurity
FROM ((pg_class c
LEFT JOIN pg_namespace n ON ((n.oid = c.relnamespace)))
LEFT JOIN pg_tablespace t ON ((t.oid = c.reltablespace)))
WHERE (c.relkind = ANY (ARRAY[''r''::"char", ''p''::"char"]));', 'NONE', 'NO', 'NO', 'NO', 'NO', 'NO');
INSERT INTO information_schema.views (table_catalog, table_schema, table_name, view_definition, check_option, is_updatable, is_insertable_into, is_trigger_updatable, is_trigger_deletable, is_trigger_insertable_into) VALUES ('sms', 'pg_catalog', 'pg_matviews', ' SELECT n.nspname AS schemaname,
c.relname AS matviewname,
pg_get_userbyid(c.relowner) AS matviewowner,
t.spcname AS tablespace,
c.relhasindex AS hasindexes,
c.relispopulated AS ispopulated,
pg_get_viewdef(c.oid) AS definition
FROM ((pg_class c
LEFT JOIN pg_namespace n ON ((n.oid = c.relnamespace)))
LEFT JOIN pg_tablespace t ON ((t.oid = c.reltablespace)))
WHERE (c.relkind = ''m''::"char");', 'NONE', 'NO', 'NO', 'NO', 'NO', 'NO');
INSERT INTO information_schema.views (table_catalog, table_schema, table_name, view_definition, check_option, is_updatable, is_insertable_into, is_trigger_updatable, is_trigger_deletable, is_trigger_insertable_into) VALUES ('sms', 'pg_catalog', 'pg_indexes', ' SELECT n.nspname AS schemaname,
c.relname AS tablename,
i.relname AS indexname,
t.spcname AS tablespace,
pg_get_indexdef(i.oid) AS indexdef
FROM ((((pg_index x
JOIN pg_class c ON ((c.oid = x.indrelid)))
JOIN pg_class i ON ((i.oid = x.indexrelid)))
LEFT JOIN pg_namespace n ON ((n.oid = c.relnamespace)))
LEFT JOIN pg_tablespace t ON ((t.oid = i.reltablespace)))
WHERE ((c.relkind = ANY (ARRAY[''r''::"char", ''m''::"char", ''p''::"char"])) AND (i.relkind = ANY (ARRAY[''i''::"char", ''I''::"char"])));', 'NONE', 'NO', 'NO', 'NO', 'NO', 'NO');
INSERT INTO information_schema.views (table_catalog, table_schema, table_name, view_definition, check_option, is_updatable, is_insertable_into, is_trigger_updatable, is_trigger_deletable, is_trigger_insertable_into) VALUES ('sms', 'pg_catalog', 'pg_sequences', ' SELECT n.nspname AS schemaname,
c.relname AS sequencename,
pg_get_userbyid(c.relowner) AS sequenceowner,
(s.seqtypid)::regtype AS data_type,
s.seqstart AS start_value,
s.seqmin AS min_value,
s.seqmax AS max_value,
s.seqincrement AS increment_by,
s.seqcycle AS cycle,
s.seqcache AS cache_size,
CASE
WHEN has_sequence_privilege(c.oid, ''SELECT,USAGE''::text) THEN pg_sequence_last_value((c.oid)::regclass)
ELSE NULL::bigint
END AS last_value
FROM ((pg_sequence s
JOIN pg_class c ON ((c.oid = s.seqrelid)))
LEFT JOIN pg_namespace n ON ((n.oid = c.relnamespace)))
WHERE ((NOT pg_is_other_temp_schema(n.oid)) AND (c.relkind = ''S''::"char"));', 'NONE', 'NO', 'NO', 'NO', 'NO', 'NO');
INSERT INTO information_schema.views (table_catalog, table_schema, table_name, view_definition, check_option, is_updatable, is_insertable_into, is_trigger_updatable, is_trigger_deletable, is_trigger_insertable_into) VALUES ('sms', 'pg_catalog', 'pg_stats', ' SELECT n.nspname AS schemaname,
c.relname AS tablename,
a.attname,
s.stainherit AS inherited,
s.stanullfrac AS null_frac,
s.stawidth AS avg_width,
s.stadistinct AS n_distinct,
CASE
WHEN (s.stakind1 = 1) THEN s.stavalues1
WHEN (s.stakind2 = 1) THEN s.stavalues2
WHEN (s.stakind3 = 1) THEN s.stavalues3
WHEN (s.stakind4 = 1) THEN s.stavalues4
WHEN (s.stakind5 = 1) THEN s.stavalues5
ELSE NULL::anyarray
END AS most_common_vals,
CASE
WHEN (s.stakind1 = 1) THEN s.stanumbers1
WHEN (s.stakind2 = 1) THEN s.stanumbers2
WHEN (s.stakind3 = 1) THEN s.stanumbers3
WHEN (s.stakind4 = 1) THEN s.stanumbers4
WHEN (s.stakind5 = 1) THEN s.stanumbers5
ELSE NULL::real[]
END AS most_common_freqs,
CASE
WHEN (s.stakind1 = 2) THEN s.stavalues1
WHEN (s.stakind2 = 2) THEN s.stavalues2
WHEN (s.stakind3 = 2) THEN s.stavalues3
WHEN (s.stakind4 = 2) THEN s.stavalues4
WHEN (s.stakind5 = 2) THEN s.stavalues5
ELSE NULL::anyarray
END AS histogram_bounds,
CASE
WHEN (s.stakind1 = 3) THEN s.stanumbers1[1]
WHEN (s.stakind2 = 3) THEN s.stanumbers2[1]
WHEN (s.stakind3 = 3) THEN s.stanumbers3[1]
WHEN (s.stakind4 = 3) THEN s.stanumbers4[1]
WHEN (s.stakind5 = 3) THEN s.stanumbers5[1]
ELSE NULL::real
END AS correlation,
CASE
WHEN (s.stakind1 = 4) THEN s.stavalues1
WHEN (s.stakind2 = 4) THEN s.stavalues2
WHEN (s.stakind3 = 4) THEN s.stavalues3
WHEN (s.stakind4 = 4) THEN s.stavalues4
WHEN (s.stakind5 = 4) THEN s.stavalues5
ELSE NULL::anyarray
END AS most_common_elems,
CASE
WHEN (s.stakind1 = 4) THEN s.stanumbers1
WHEN (s.stakind2 = 4) THEN s.stanumbers2
WHEN (s.stakind3 = 4) THEN s.stanumbers3
WHEN (s.stakind4 = 4) THEN s.stanumbers4
WHEN (s.stakind5 = 4) THEN s.stanumbers5
ELSE NULL::real[]
END AS most_common_elem_freqs,
CASE
WHEN (s.stakind1 = 5) THEN s.stanumbers1
WHEN (s.stakind2 = 5) THEN s.stanumbers2
WHEN (s.stakind3 = 5) THEN s.stanumbers3
WHEN (s.stakind4 = 5) THEN s.stanumbers4
WHEN (s.stakind5 = 5) THEN s.stanumbers5
ELSE NULL::real[]
END AS elem_count_histogram
FROM (((pg_statistic s
JOIN pg_class c ON ((c.oid = s.starelid)))
JOIN pg_attribute a ON (((c.oid = a.attrelid) AND (a.attnum = s.staattnum))))
LEFT JOIN pg_namespace n ON ((n.oid = c.relnamespace)))
WHERE ((NOT a.attisdropped) AND has_column_privilege(c.oid, a.attnum, ''select''::text) AND ((c.relrowsecurity = false) OR (NOT row_security_active(c.oid))));', 'NONE', 'NO', 'NO', 'NO', 'NO', 'NO');
INSERT INTO information_schema.views (table_catalog, table_schema, table_name, view_definition, check_option, is_updatable, is_insertable_into, is_trigger_updatable, is_trigger_deletable, is_trigger_insertable_into) VALUES ('sms', 'pg_catalog', 'pg_stats_ext', ' SELECT cn.nspname AS schemaname,
c.relname AS tablename,
sn.nspname AS statistics_schemaname,
s.stxname AS statistics_name,
pg_get_userbyid(s.stxowner) AS statistics_owner,
( SELECT array_agg(a.attname ORDER BY a.attnum) AS array_agg
FROM (unnest(s.stxkeys) k(k)
JOIN pg_attribute a ON (((a.attrelid = s.stxrelid) AND (a.attnum = k.k))))) AS attnames,
s.stxkind AS kinds,
sd.stxdndistinct AS n_distinct,
sd.stxddependencies AS dependencies,
m.most_common_vals,
m.most_common_val_nulls,
m.most_common_freqs,
m.most_common_base_freqs
FROM (((((pg_statistic_ext s
JOIN pg_class c ON ((c.oid = s.stxrelid)))
JOIN pg_statistic_ext_data sd ON ((s.oid = sd.stxoid)))
LEFT JOIN pg_namespace cn ON ((cn.oid = c.relnamespace)))
LEFT JOIN pg_namespace sn ON ((sn.oid = s.stxnamespace)))
LEFT JOIN LATERAL ( SELECT array_agg(pg_mcv_list_items."values") AS most_common_vals,
array_agg(pg_mcv_list_items.nulls) AS most_common_val_nulls,
array_agg(pg_mcv_list_items.frequency) AS most_common_freqs,
array_agg(pg_mcv_list_items.base_frequency) AS most_common_base_freqs
FROM pg_mcv_list_items(sd.stxdmcv) pg_mcv_list_items(index, "values", nulls, frequency, base_frequency)) m ON ((sd.stxdmcv IS NOT NULL)))
WHERE ((NOT (EXISTS ( SELECT 1
FROM (unnest(s.stxkeys) k(k)
JOIN pg_attribute a ON (((a.attrelid = s.stxrelid) AND (a.attnum = k.k))))
WHERE (NOT has_column_privilege(c.oid, a.attnum, ''select''::text))))) AND ((c.relrowsecurity = false) OR (NOT row_security_active(c.oid))));', 'NONE', 'NO', 'NO', 'NO', 'NO', 'NO');
INSERT INTO information_schema.views (table_catalog, table_schema, table_name, view_definition, check_option, is_updatable, is_insertable_into, is_trigger_updatable, is_trigger_deletable, is_trigger_insertable_into) VALUES ('sms', 'pg_catalog', 'pg_publication_tables', ' SELECT p.pubname,
n.nspname AS schemaname,
c.relname AS tablename
FROM pg_publication p,
LATERAL pg_get_publication_tables((p.pubname)::text) gpt(relid),
(pg_class c
JOIN pg_namespace n ON ((n.oid = c.relnamespace)))
WHERE (c.oid = gpt.relid);', 'NONE', 'NO', 'NO', 'NO', 'NO', 'NO');
INSERT INTO information_schema.views (table_catalog, table_schema, table_name, view_definition, check_option, is_updatable, is_insertable_into, is_trigger_updatable, is_trigger_deletable, is_trigger_insertable_into) VALUES ('sms', 'pg_catalog', 'pg_locks', ' SELECT l.locktype,
l.database,
l.relation,
l.page,
l.tuple,
l.virtualxid,
l.transactionid,
l.classid,
l.objid,
l.objsubid,
l.virtualtransaction,
l.pid,
l.mode,
l.granted,
l.fastpath
FROM pg_lock_status() l(locktype, database, relation, page, tuple, virtualxid, transactionid, classid, objid, objsubid, virtualtransaction, pid, mode, granted, fastpath);', 'NONE', 'NO', 'NO', 'NO', 'NO', 'NO');
INSERT INTO information_schema.views (table_catalog, table_schema, table_name, view_definition, check_option, is_updatable, is_insertable_into, is_trigger_updatable, is_trigger_deletable, is_trigger_insertable_into) VALUES ('sms', 'pg_catalog', 'pg_cursors', ' SELECT c.name,
c.statement,
c.is_holdable,
c.is_binary,
c.is_scrollable,
c.creation_time
FROM pg_cursor() c(name, statement, is_holdable, is_binary, is_scrollable, creation_time);', 'NONE', 'NO', 'NO', 'NO', 'NO', 'NO');
INSERT INTO information_schema.views (table_catalog, table_schema, table_name, view_definition, check_option, is_updatable, is_insertable_into, is_trigger_updatable, is_trigger_deletable, is_trigger_insertable_into) VALUES ('sms', 'pg_catalog', 'pg_available_extensions', ' SELECT e.name,
e.default_version,
x.extversion AS installed_version,
e.comment
FROM (pg_available_extensions() e(name, default_version, comment)
LEFT JOIN pg_extension x ON ((e.name = x.extname)));', 'NONE', 'NO', 'NO', 'NO', 'NO', 'NO');
INSERT INTO information_schema.views (table_catalog, table_schema, table_name, view_definition, check_option, is_updatable, is_insertable_into, is_trigger_updatable, is_trigger_deletable, is_trigger_insertable_into) VALUES ('sms', 'pg_catalog', 'pg_available_extension_versions', ' SELECT e.name,
e.version,
(x.extname IS NOT NULL) AS installed,
e.superuser,
e.trusted,
e.relocatable,
e.schema,
e.requires,
e.comment
FROM (pg_available_extension_versions() e(name, version, superuser, trusted, relocatable, schema, requires, comment)
LEFT JOIN pg_extension x ON (((e.name = x.extname) AND (e.version = x.extversion))));', 'NONE', 'NO', 'NO', 'NO', 'NO', 'NO');
INSERT INTO information_schema.views (table_catalog, table_schema, table_name, view_definition, check_option, is_updatable, is_insertable_into, is_trigger_updatable, is_trigger_deletable, is_trigger_insertable_into) VALUES ('sms', 'pg_catalog', 'pg_prepared_xacts', ' SELECT p.transaction,
p.gid,
p.prepared,
u.rolname AS owner,
d.datname AS database
FROM ((pg_prepared_xact() p(transaction, gid, prepared, ownerid, dbid)
LEFT JOIN pg_authid u ON ((p.ownerid = u.oid)))
LEFT JOIN pg_database d ON ((p.dbid = d.oid)));', 'NONE', 'NO', 'NO', 'NO', 'NO', 'NO');
INSERT INTO information_schema.views (table_catalog, table_schema, table_name, view_definition, check_option, is_updatable, is_insertable_into, is_trigger_updatable, is_trigger_deletable, is_trigger_insertable_into) VALUES ('sms', 'pg_catalog', 'pg_seclabels', ' SELECT l.objoid,
l.classoid,
l.objsubid,
CASE
WHEN (rel.relkind = ANY (ARRAY[''r''::"char", ''p''::"char"])) THEN ''table''::text
WHEN (rel.relkind = ''v''::"char") THEN ''view''::text
WHEN (rel.relkind = ''m''::"char") THEN ''materialized view''::text
WHEN (rel.relkind = ''S''::"char") THEN ''sequence''::text
WHEN (rel.relkind = ''f''::"char") THEN ''foreign table''::text
ELSE NULL::text
END AS objtype,
rel.relnamespace AS objnamespace,
CASE
WHEN pg_table_is_visible(rel.oid) THEN quote_ident((rel.relname)::text)
ELSE ((quote_ident((nsp.nspname)::text) || ''.''::text) || quote_ident((rel.relname)::text))
END AS objname,
l.provider,
l.label
FROM ((pg_seclabel l
JOIN pg_class rel ON (((l.classoid = rel.tableoid) AND (l.objoid = rel.oid))))
JOIN pg_namespace nsp ON ((rel.relnamespace = nsp.oid)))
WHERE (l.objsubid = 0)
UNION ALL
SELECT l.objoid,
l.classoid,
l.objsubid,
''column''::text AS objtype,
rel.relnamespace AS objnamespace,
((
CASE
WHEN pg_table_is_visible(rel.oid) THEN quote_ident((rel.relname)::text)
ELSE ((quote_ident((nsp.nspname)::text) || ''.''::text) || quote_ident((rel.relname)::text))
END || ''.''::text) || (att.attname)::text) AS objname,
l.provider,
l.label
FROM (((pg_seclabel l
JOIN pg_class rel ON (((l.classoid = rel.tableoid) AND (l.objoid = rel.oid))))
JOIN pg_attribute att ON (((rel.oid = att.attrelid) AND (l.objsubid = att.attnum))))
JOIN pg_namespace nsp ON ((rel.relnamespace = nsp.oid)))
WHERE (l.objsubid <> 0)
UNION ALL
SELECT l.objoid,
l.classoid,
l.objsubid,
CASE pro.prokind
WHEN ''a''::"char" THEN ''aggregate''::text
WHEN ''f''::"char" THEN ''function''::text
WHEN ''p''::"char" THEN ''procedure''::text
WHEN ''w''::"char" THEN ''window''::text
ELSE NULL::text
END AS objtype,
pro.pronamespace AS objnamespace,
(((
CASE
WHEN pg_function_is_visible(pro.oid) THEN quote_ident((pro.proname)::text)
ELSE ((quote_ident((nsp.nspname)::text) || ''.''::text) || quote_ident((pro.proname)::text))
END || ''(''::text) || pg_get_function_arguments(pro.oid)) || '')''::text) AS objname,
l.provider,
l.label
FROM ((pg_seclabel l
JOIN pg_proc pro ON (((l.classoid = pro.tableoid) AND (l.objoid = pro.oid))))
JOIN pg_namespace nsp ON ((pro.pronamespace = nsp.oid)))
WHERE (l.objsubid = 0)
UNION ALL
SELECT l.objoid,
l.classoid,
l.objsubid,
CASE
WHEN (typ.typtype = ''d''::"char") THEN ''domain''::text
ELSE ''type''::text
END AS objtype,
typ.typnamespace AS objnamespace,
CASE
WHEN pg_type_is_visible(typ.oid) THEN quote_ident((typ.typname)::text)
ELSE ((quote_ident((nsp.nspname)::text) || ''.''::text) || quote_ident((typ.typname)::text))
END AS objname,
l.provider,
l.label
FROM ((pg_seclabel l
JOIN pg_type typ ON (((l.classoid = typ.tableoid) AND (l.objoid = typ.oid))))
JOIN pg_namespace nsp ON ((typ.typnamespace = nsp.oid)))
WHERE (l.objsubid = 0)
UNION ALL
SELECT l.objoid,
l.classoid,
l.objsubid,
''large object''::text AS objtype,
NULL::oid AS objnamespace,
(l.objoid)::text AS objname,
l.provider,
l.label
FROM (pg_seclabel l
JOIN pg_largeobject_metadata lom ON ((l.objoid = lom.oid)))
WHERE ((l.classoid = (''pg_largeobject''::regclass)::oid) AND (l.objsubid = 0))
UNION ALL
SELECT l.objoid,
l.classoid,
l.objsubid,
''language''::text AS objtype,
NULL::oid AS objnamespace,
quote_ident((lan.lanname)::text) AS objname,
l.provider,
l.label
FROM (pg_seclabel l
JOIN pg_language lan ON (((l.classoid = lan.tableoid) AND (l.objoid = lan.oid))))
WHERE (l.objsubid = 0)
UNION ALL
SELECT l.objoid,
l.classoid,
l.objsubid,
''schema''::text AS objtype,
nsp.oid AS objnamespace,
quote_ident((nsp.nspname)::text) AS objname,
l.provider,
l.label
FROM (pg_seclabel l
JOIN pg_namespace nsp ON (((l.classoid = nsp.tableoid) AND (l.objoid = nsp.oid))))
WHERE (l.objsubid = 0)
UNION ALL
SELECT l.objoid,
l.classoid,
l.objsubid,
''event trigger''::text AS objtype,
NULL::oid AS objnamespace,
quote_ident((evt.evtname)::text) AS objname,
l.provider,
l.label
FROM (pg_seclabel l
JOIN pg_event_trigger evt ON (((l.classoid = evt.tableoid) AND (l.objoid = evt.oid))))
WHERE (l.objsubid = 0)
UNION ALL
SELECT l.objoid,
l.classoid,
l.objsubid,
''publication''::text AS objtype,
NULL::oid AS objnamespace,
quote_ident((p.pubname)::text) AS objname,
l.provider,
l.label
FROM (pg_seclabel l
JOIN pg_publication p ON (((l.classoid = p.tableoid) AND (l.objoid = p.oid))))
WHERE (l.objsubid = 0)
UNION ALL
SELECT l.objoid,
l.classoid,
0 AS objsubid,
''subscription''::text AS objtype,
NULL::oid AS objnamespace,
quote_ident((s.subname)::text) AS objname,
l.provider,
l.label
FROM (pg_shseclabel l
JOIN pg_subscription s ON (((l.classoid = s.tableoid) AND (l.objoid = s.oid))))
UNION ALL
SELECT l.objoid,
l.classoid,
0 AS objsubid,
''database''::text AS objtype,
NULL::oid AS objnamespace,
quote_ident((dat.datname)::text) AS objname,
l.provider,
l.label
FROM (pg_shseclabel l
JOIN pg_database dat ON (((l.classoid = dat.tableoid) AND (l.objoid = dat.oid))))
UNION ALL
SELECT l.objoid,
l.classoid,
0 AS objsubid,
''tablespace''::text AS objtype,
NULL::oid AS objnamespace,
quote_ident((spc.spcname)::text) AS objname,
l.provider,
l.label
FROM (pg_shseclabel l
JOIN pg_tablespace spc ON (((l.classoid = spc.tableoid) AND (l.objoid = spc.oid))))
UNION ALL
SELECT l.objoid,
l.classoid,
0 AS objsubid,
''role''::text AS objtype,
NULL::oid AS objnamespace,
quote_ident((rol.rolname)::text) AS objname,
l.provider,
l.label
FROM (pg_shseclabel l
JOIN pg_authid rol ON (((l.classoid = rol.tableoid) AND (l.objoid = rol.oid))));', 'NONE', 'NO', 'NO', 'NO', 'NO', 'NO');
INSERT INTO information_schema.views (table_catalog, table_schema, table_name, view_definition, check_option, is_updatable, is_insertable_into, is_trigger_updatable, is_trigger_deletable, is_trigger_insertable_into) VALUES ('sms', 'pg_catalog', 'pg_statio_user_tables', ' SELECT pg_statio_all_tables.relid,
pg_statio_all_tables.schemaname,
pg_statio_all_tables.relname,
pg_statio_all_tables.heap_blks_read,
pg_statio_all_tables.heap_blks_hit,
pg_statio_all_tables.idx_blks_read,
pg_statio_all_tables.idx_blks_hit,
pg_statio_all_tables.toast_blks_read,
pg_statio_all_tables.toast_blks_hit,
pg_statio_all_tables.tidx_blks_read,
pg_statio_all_tables.tidx_blks_hit
FROM pg_statio_all_tables
WHERE ((pg_statio_all_tables.schemaname <> ALL (ARRAY[''pg_catalog''::name, ''information_schema''::name])) AND (pg_statio_all_tables.schemaname !~ ''^pg_toast''::text));', 'NONE', 'NO', 'NO', 'NO', 'NO', 'NO');
INSERT INTO information_schema.views (table_catalog, table_schema, table_name, view_definition, check_option, is_updatable, is_insertable_into, is_trigger_updatable, is_trigger_deletable, is_trigger_insertable_into) VALUES ('sms', 'pg_catalog', 'pg_stat_all_indexes', ' SELECT c.oid AS relid,
i.oid AS indexrelid,
n.nspname AS schemaname,
c.relname,
i.relname AS indexrelname,
pg_stat_get_numscans(i.oid) AS idx_scan,
pg_stat_get_tuples_returned(i.oid) AS idx_tup_read,
pg_stat_get_tuples_fetched(i.oid) AS idx_tup_fetch
FROM (((pg_class c
JOIN pg_index x ON ((c.oid = x.indrelid)))
JOIN pg_class i ON ((i.oid = x.indexrelid)))
LEFT JOIN pg_namespace n ON ((n.oid = c.relnamespace)))
WHERE (c.relkind = ANY (ARRAY[''r''::"char", ''t''::"char", ''m''::"char"]));', 'NONE', 'NO', 'NO', 'NO', 'NO', 'NO');
INSERT INTO information_schema.views (table_catalog, table_schema, table_name, view_definition, check_option, is_updatable, is_insertable_into, is_trigger_updatable, is_trigger_deletable, is_trigger_insertable_into) VALUES ('sms', 'pg_catalog', 'pg_timezone_abbrevs', ' SELECT pg_timezone_abbrevs.abbrev,
pg_timezone_abbrevs.utc_offset,
pg_timezone_abbrevs.is_dst
FROM pg_timezone_abbrevs() pg_timezone_abbrevs(abbrev, utc_offset, is_dst);', 'NONE', 'NO', 'NO', 'NO', 'NO', 'NO');
INSERT INTO information_schema.views (table_catalog, table_schema, table_name, view_definition, check_option, is_updatable, is_insertable_into, is_trigger_updatable, is_trigger_deletable, is_trigger_insertable_into) VALUES ('sms', 'pg_catalog', 'pg_timezone_names', ' SELECT pg_timezone_names.name,
pg_timezone_names.abbrev,
pg_timezone_names.utc_offset,
pg_timezone_names.is_dst
FROM pg_timezone_names() pg_timezone_names(name, abbrev, utc_offset, is_dst);', 'NONE', 'NO', 'NO', 'NO', 'NO', 'NO');
INSERT INTO information_schema.views (table_catalog, table_schema, table_name, view_definition, check_option, is_updatable, is_insertable_into, is_trigger_updatable, is_trigger_deletable, is_trigger_insertable_into) VALUES ('sms', 'pg_catalog', 'pg_stat_sys_indexes', ' SELECT pg_stat_all_indexes.relid,
pg_stat_all_indexes.indexrelid,
pg_stat_all_indexes.schemaname,
pg_stat_all_indexes.relname,
pg_stat_all_indexes.indexrelname,
pg_stat_all_indexes.idx_scan,
pg_stat_all_indexes.idx_tup_read,
pg_stat_all_indexes.idx_tup_fetch
FROM pg_stat_all_indexes
WHERE ((pg_stat_all_indexes.schemaname = ANY (ARRAY[''pg_catalog''::name, ''information_schema''::name])) OR (pg_stat_all_indexes.schemaname ~ ''^pg_toast''::text));', 'NONE', 'NO', 'NO', 'NO', 'NO', 'NO');
INSERT INTO information_schema.views (table_catalog, table_schema, table_name, view_definition, check_option, is_updatable, is_insertable_into, is_trigger_updatable, is_trigger_deletable, is_trigger_insertable_into) VALUES ('sms', 'pg_catalog', 'pg_stat_all_tables', ' SELECT c.oid AS relid,
n.nspname AS schemaname,
c.relname,
pg_stat_get_numscans(c.oid) AS seq_scan,
pg_stat_get_tuples_returned(c.oid) AS seq_tup_read,
(sum(pg_stat_get_numscans(i.indexrelid)))::bigint AS idx_scan,
((sum(pg_stat_get_tuples_fetched(i.indexrelid)))::bigint + pg_stat_get_tuples_fetched(c.oid)) AS idx_tup_fetch,
pg_stat_get_tuples_inserted(c.oid) AS n_tup_ins,
pg_stat_get_tuples_updated(c.oid) AS n_tup_upd,
pg_stat_get_tuples_deleted(c.oid) AS n_tup_del,
pg_stat_get_tuples_hot_updated(c.oid) AS n_tup_hot_upd,
pg_stat_get_live_tuples(c.oid) AS n_live_tup,
pg_stat_get_dead_tuples(c.oid) AS n_dead_tup,
pg_stat_get_mod_since_analyze(c.oid) AS n_mod_since_analyze,
pg_stat_get_ins_since_vacuum(c.oid) AS n_ins_since_vacuum,
pg_stat_get_last_vacuum_time(c.oid) AS last_vacuum,
pg_stat_get_last_autovacuum_time(c.oid) AS last_autovacuum,
pg_stat_get_last_analyze_time(c.oid) AS last_analyze,
pg_stat_get_last_autoanalyze_time(c.oid) AS last_autoanalyze,
pg_stat_get_vacuum_count(c.oid) AS vacuum_count,
pg_stat_get_autovacuum_count(c.oid) AS autovacuum_count,
pg_stat_get_analyze_count(c.oid) AS analyze_count,
pg_stat_get_autoanalyze_count(c.oid) AS autoanalyze_count
FROM ((pg_class c
LEFT JOIN pg_index i ON ((c.oid = i.indrelid)))
LEFT JOIN pg_namespace n ON ((n.oid = c.relnamespace)))
WHERE (c.relkind = ANY (ARRAY[''r''::"char", ''t''::"char", ''m''::"char"]))
GROUP BY c.oid, n.nspname, c.relname;', 'NONE', 'NO', 'NO', 'NO', 'NO', 'NO');
INSERT INTO information_schema.views (table_catalog, table_schema, table_name, view_definition, check_option, is_updatable, is_insertable_into, is_trigger_updatable, is_trigger_deletable, is_trigger_insertable_into) VALUES ('sms', 'pg_catalog', 'pg_stat_xact_all_tables', ' SELECT c.oid AS relid,
n.nspname AS schemaname,
c.relname,
pg_stat_get_xact_numscans(c.oid) AS seq_scan,
pg_stat_get_xact_tuples_returned(c.oid) AS seq_tup_read,
(sum(pg_stat_get_xact_numscans(i.indexrelid)))::bigint AS idx_scan,
((sum(pg_stat_get_xact_tuples_fetched(i.indexrelid)))::bigint + pg_stat_get_xact_tuples_fetched(c.oid)) AS idx_tup_fetch,
pg_stat_get_xact_tuples_inserted(c.oid) AS n_tup_ins,
pg_stat_get_xact_tuples_updated(c.oid) AS n_tup_upd,
pg_stat_get_xact_tuples_deleted(c.oid) AS n_tup_del,
pg_stat_get_xact_tuples_hot_updated(c.oid) AS n_tup_hot_upd
FROM ((pg_class c
LEFT JOIN pg_index i ON ((c.oid = i.indrelid)))
LEFT JOIN pg_namespace n ON ((n.oid = c.relnamespace)))
WHERE (c.relkind = ANY (ARRAY[''r''::"char", ''t''::"char", ''m''::"char"]))
GROUP BY c.oid, n.nspname, c.relname;', 'NONE', 'NO', 'NO', 'NO', 'NO', 'NO');
INSERT INTO information_schema.views (table_catalog, table_schema, table_name, view_definition, check_option, is_updatable, is_insertable_into, is_trigger_updatable, is_trigger_deletable, is_trigger_insertable_into) VALUES ('sms', 'pg_catalog', 'pg_stat_sys_tables', ' SELECT pg_stat_all_tables.relid,
pg_stat_all_tables.schemaname,
pg_stat_all_tables.relname,
pg_stat_all_tables.seq_scan,
pg_stat_all_tables.seq_tup_read,
pg_stat_all_tables.idx_scan,
pg_stat_all_tables.idx_tup_fetch,
pg_stat_all_tables.n_tup_ins,
pg_stat_all_tables.n_tup_upd,
pg_stat_all_tables.n_tup_del,
pg_stat_all_tables.n_tup_hot_upd,
pg_stat_all_tables.n_live_tup,
pg_stat_all_tables.n_dead_tup,
pg_stat_all_tables.n_mod_since_analyze,
pg_stat_all_tables.n_ins_since_vacuum,
pg_stat_all_tables.last_vacuum,
pg_stat_all_tables.last_autovacuum,
pg_stat_all_tables.last_analyze,
pg_stat_all_tables.last_autoanalyze,
pg_stat_all_tables.vacuum_count,
pg_stat_all_tables.autovacuum_count,
pg_stat_all_tables.analyze_count,
pg_stat_all_tables.autoanalyze_count
FROM pg_stat_all_tables
WHERE ((pg_stat_all_tables.schemaname = ANY (ARRAY[''pg_catalog''::name, ''information_schema''::name])) OR (pg_stat_all_tables.schemaname ~ ''^pg_toast''::text));', 'NONE', 'NO', 'NO', 'NO', 'NO', 'NO');
INSERT INTO information_schema.views (table_catalog, table_schema, table_name, view_definition, check_option, is_updatable, is_insertable_into, is_trigger_updatable, is_trigger_deletable, is_trigger_insertable_into) VALUES ('sms', 'pg_catalog', 'pg_stat_xact_sys_tables', ' SELECT pg_stat_xact_all_tables.relid,
pg_stat_xact_all_tables.schemaname,
pg_stat_xact_all_tables.relname,
pg_stat_xact_all_tables.seq_scan,
pg_stat_xact_all_tables.seq_tup_read,
pg_stat_xact_all_tables.idx_scan,
pg_stat_xact_all_tables.idx_tup_fetch,
pg_stat_xact_all_tables.n_tup_ins,
pg_stat_xact_all_tables.n_tup_upd,
pg_stat_xact_all_tables.n_tup_del,
pg_stat_xact_all_tables.n_tup_hot_upd
FROM pg_stat_xact_all_tables
WHERE ((pg_stat_xact_all_tables.schemaname = ANY (ARRAY[''pg_catalog''::name, ''information_schema''::name])) OR (pg_stat_xact_all_tables.schemaname ~ ''^pg_toast''::text));', 'NONE', 'NO', 'NO', 'NO', 'NO', 'NO');
INSERT INTO information_schema.views (table_catalog, table_schema, table_name, view_definition, check_option, is_updatable, is_insertable_into, is_trigger_updatable, is_trigger_deletable, is_trigger_insertable_into) VALUES ('sms', 'pg_catalog', 'pg_stat_user_tables', ' SELECT pg_stat_all_tables.relid,
pg_stat_all_tables.schemaname,
pg_stat_all_tables.relname,
pg_stat_all_tables.seq_scan,
pg_stat_all_tables.seq_tup_read,
pg_stat_all_tables.idx_scan,
pg_stat_all_tables.idx_tup_fetch,
pg_stat_all_tables.n_tup_ins,
pg_stat_all_tables.n_tup_upd,
pg_stat_all_tables.n_tup_del,
pg_stat_all_tables.n_tup_hot_upd,
pg_stat_all_tables.n_live_tup,
pg_stat_all_tables.n_dead_tup,
pg_stat_all_tables.n_mod_since_analyze,
pg_stat_all_tables.n_ins_since_vacuum,
pg_stat_all_tables.last_vacuum,
pg_stat_all_tables.last_autovacuum,
pg_stat_all_tables.last_analyze,
pg_stat_all_tables.last_autoanalyze,
pg_stat_all_tables.vacuum_count,
pg_stat_all_tables.autovacuum_count,
pg_stat_all_tables.analyze_count,
pg_stat_all_tables.autoanalyze_count
FROM pg_stat_all_tables
WHERE ((pg_stat_all_tables.schemaname <> ALL (ARRAY[''pg_catalog''::name, ''information_schema''::name])) AND (pg_stat_all_tables.schemaname !~ ''^pg_toast''::text));', 'NONE', 'NO', 'NO', 'NO', 'NO', 'NO');
INSERT INTO information_schema.views (table_catalog, table_schema, table_name, view_definition, check_option, is_updatable, is_insertable_into, is_trigger_updatable, is_trigger_deletable, is_trigger_insertable_into) VALUES ('sms', 'pg_catalog', 'pg_stat_xact_user_tables', ' SELECT pg_stat_xact_all_tables.relid,
pg_stat_xact_all_tables.schemaname,
pg_stat_xact_all_tables.relname,
pg_stat_xact_all_tables.seq_scan,
pg_stat_xact_all_tables.seq_tup_read,
pg_stat_xact_all_tables.idx_scan,
pg_stat_xact_all_tables.idx_tup_fetch,
pg_stat_xact_all_tables.n_tup_ins,
pg_stat_xact_all_tables.n_tup_upd,
pg_stat_xact_all_tables.n_tup_del,
pg_stat_xact_all_tables.n_tup_hot_upd
FROM pg_stat_xact_all_tables
WHERE ((pg_stat_xact_all_tables.schemaname <> ALL (ARRAY[''pg_catalog''::name, ''information_schema''::name])) AND (pg_stat_xact_all_tables.schemaname !~ ''^pg_toast''::text));', 'NONE', 'NO', 'NO', 'NO', 'NO', 'NO');
INSERT INTO information_schema.views (table_catalog, table_schema, table_name, view_definition, check_option, is_updatable, is_insertable_into, is_trigger_updatable, is_trigger_deletable, is_trigger_insertable_into) VALUES ('sms', 'pg_catalog', 'pg_statio_all_tables', ' SELECT c.oid AS relid,
n.nspname AS schemaname,
c.relname,
(pg_stat_get_blocks_fetched(c.oid) - pg_stat_get_blocks_hit(c.oid)) AS heap_blks_read,
pg_stat_get_blocks_hit(c.oid) AS heap_blks_hit,
(sum((pg_stat_get_blocks_fetched(i.indexrelid) - pg_stat_get_blocks_hit(i.indexrelid))))::bigint AS idx_blks_read,
(sum(pg_stat_get_blocks_hit(i.indexrelid)))::bigint AS idx_blks_hit,
(pg_stat_get_blocks_fetched(t.oid) - pg_stat_get_blocks_hit(t.oid)) AS toast_blks_read,
pg_stat_get_blocks_hit(t.oid) AS toast_blks_hit,
(pg_stat_get_blocks_fetched(x.indexrelid) - pg_stat_get_blocks_hit(x.indexrelid)) AS tidx_blks_read,
pg_stat_get_blocks_hit(x.indexrelid) AS tidx_blks_hit
FROM ((((pg_class c
LEFT JOIN pg_index i ON ((c.oid = i.indrelid)))
LEFT JOIN pg_class t ON ((c.reltoastrelid = t.oid)))
LEFT JOIN pg_index x ON ((t.oid = x.indrelid)))
LEFT JOIN pg_namespace n ON ((n.oid = c.relnamespace)))
WHERE (c.relkind = ANY (ARRAY[''r''::"char", ''t''::"char", ''m''::"char"]))
GROUP BY c.oid, n.nspname, c.relname, t.oid, x.indexrelid;', 'NONE', 'NO', 'NO', 'NO', 'NO', 'NO');
INSERT INTO information_schema.views (table_catalog, table_schema, table_name, view_definition, check_option, is_updatable, is_insertable_into, is_trigger_updatable, is_trigger_deletable, is_trigger_insertable_into) VALUES ('sms', 'pg_catalog', 'pg_statio_sys_tables', ' SELECT pg_statio_all_tables.relid,
pg_statio_all_tables.schemaname,
pg_statio_all_tables.relname,
pg_statio_all_tables.heap_blks_read,
pg_statio_all_tables.heap_blks_hit,
pg_statio_all_tables.idx_blks_read,
pg_statio_all_tables.idx_blks_hit,
pg_statio_all_tables.toast_blks_read,
pg_statio_all_tables.toast_blks_hit,
pg_statio_all_tables.tidx_blks_read,
pg_statio_all_tables.tidx_blks_hit
FROM pg_statio_all_tables
WHERE ((pg_statio_all_tables.schemaname = ANY (ARRAY[''pg_catalog''::name, ''information_schema''::name])) OR (pg_statio_all_tables.schemaname ~ ''^pg_toast''::text));', 'NONE', 'NO', 'NO', 'NO', 'NO', 'NO');
INSERT INTO information_schema.views (table_catalog, table_schema, table_name, view_definition, check_option, is_updatable, is_insertable_into, is_trigger_updatable, is_trigger_deletable, is_trigger_insertable_into) VALUES ('sms', 'pg_catalog', 'pg_stat_user_indexes', ' SELECT pg_stat_all_indexes.relid,
pg_stat_all_indexes.indexrelid,
pg_stat_all_indexes.schemaname,
pg_stat_all_indexes.relname,
pg_stat_all_indexes.indexrelname,
pg_stat_all_indexes.idx_scan,
pg_stat_all_indexes.idx_tup_read,
pg_stat_all_indexes.idx_tup_fetch
FROM pg_stat_all_indexes
WHERE ((pg_stat_all_indexes.schemaname <> ALL (ARRAY[''pg_catalog''::name, ''information_schema''::name])) AND (pg_stat_all_indexes.schemaname !~ ''^pg_toast''::text));', 'NONE', 'NO', 'NO', 'NO', 'NO', 'NO');
INSERT INTO information_schema.views (table_catalog, table_schema, table_name, view_definition, check_option, is_updatable, is_insertable_into, is_trigger_updatable, is_trigger_deletable, is_trigger_insertable_into) VALUES ('sms', 'pg_catalog', 'pg_statio_all_indexes', ' SELECT c.oid AS relid,
i.oid AS indexrelid,
n.nspname AS schemaname,
c.relname,
i.relname AS indexrelname,
(pg_stat_get_blocks_fetched(i.oid) - pg_stat_get_blocks_hit(i.oid)) AS idx_blks_read,
pg_stat_get_blocks_hit(i.oid) AS idx_blks_hit
FROM (((pg_class c
JOIN pg_index x ON ((c.oid = x.indrelid)))
JOIN pg_class i ON ((i.oid = x.indexrelid)))
LEFT JOIN pg_namespace n ON ((n.oid = c.relnamespace)))
WHERE (c.relkind = ANY (ARRAY[''r''::"char", ''t''::"char", ''m''::"char"]));', 'NONE', 'NO', 'NO', 'NO', 'NO', 'NO');
INSERT INTO information_schema.views (table_catalog, table_schema, table_name, view_definition, check_option, is_updatable, is_insertable_into, is_trigger_updatable, is_trigger_deletable, is_trigger_insertable_into) VALUES ('sms', 'pg_catalog', 'pg_statio_sys_indexes', ' SELECT pg_statio_all_indexes.relid,
pg_statio_all_indexes.indexrelid,
pg_statio_all_indexes.schemaname,
pg_statio_all_indexes.relname,
pg_statio_all_indexes.indexrelname,
pg_statio_all_indexes.idx_blks_read,
pg_statio_all_indexes.idx_blks_hit
FROM pg_statio_all_indexes
WHERE ((pg_statio_all_indexes.schemaname = ANY (ARRAY[''pg_catalog''::name, ''information_schema''::name])) OR (pg_statio_all_indexes.schemaname ~ ''^pg_toast''::text));', 'NONE', 'NO', 'NO', 'NO', 'NO', 'NO');
INSERT INTO information_schema.views (table_catalog, table_schema, table_name, view_definition, check_option, is_updatable, is_insertable_into, is_trigger_updatable, is_trigger_deletable, is_trigger_insertable_into) VALUES ('sms', 'pg_catalog', 'pg_statio_user_indexes', ' SELECT pg_statio_all_indexes.relid,
pg_statio_all_indexes.indexrelid,
pg_statio_all_indexes.schemaname,
pg_statio_all_indexes.relname,
pg_statio_all_indexes.indexrelname,
pg_statio_all_indexes.idx_blks_read,
pg_statio_all_indexes.idx_blks_hit
FROM pg_statio_all_indexes
WHERE ((pg_statio_all_indexes.schemaname <> ALL (ARRAY[''pg_catalog''::name, ''information_schema''::name])) AND (pg_statio_all_indexes.schemaname !~ ''^pg_toast''::text));', 'NONE', 'NO', 'NO', 'NO', 'NO', 'NO');
INSERT INTO information_schema.views (table_catalog, table_schema, table_name, view_definition, check_option, is_updatable, is_insertable_into, is_trigger_updatable, is_trigger_deletable, is_trigger_insertable_into) VALUES ('sms', 'pg_catalog', 'pg_statio_all_sequences', ' SELECT c.oid AS relid,
n.nspname AS schemaname,
c.relname,
(pg_stat_get_blocks_fetched(c.oid) - pg_stat_get_blocks_hit(c.oid)) AS blks_read,
pg_stat_get_blocks_hit(c.oid) AS blks_hit
FROM (pg_class c
LEFT JOIN pg_namespace n ON ((n.oid = c.relnamespace)))
WHERE (c.relkind = ''S''::"char");', 'NONE', 'NO', 'NO', 'NO', 'NO', 'NO');
INSERT INTO information_schema.views (table_catalog, table_schema, table_name, view_definition, check_option, is_updatable, is_insertable_into, is_trigger_updatable, is_trigger_deletable, is_trigger_insertable_into) VALUES ('sms', 'pg_catalog', 'pg_statio_sys_sequences', ' SELECT pg_statio_all_sequences.relid,
pg_statio_all_sequences.schemaname,
pg_statio_all_sequences.relname,
pg_statio_all_sequences.blks_read,
pg_statio_all_sequences.blks_hit
FROM pg_statio_all_sequences
WHERE ((pg_statio_all_sequences.schemaname = ANY (ARRAY[''pg_catalog''::name, ''information_schema''::name])) OR (pg_statio_all_sequences.schemaname ~ ''^pg_toast''::text));', 'NONE', 'NO', 'NO', 'NO', 'NO', 'NO');
INSERT INTO information_schema.views (table_catalog, table_schema, table_name, view_definition, check_option, is_updatable, is_insertable_into, is_trigger_updatable, is_trigger_deletable, is_trigger_insertable_into) VALUES ('sms', 'pg_catalog', 'pg_statio_user_sequences', ' SELECT pg_statio_all_sequences.relid,
pg_statio_all_sequences.schemaname,
pg_statio_all_sequences.relname,
pg_statio_all_sequences.blks_read,
pg_statio_all_sequences.blks_hit
FROM pg_statio_all_sequences
WHERE ((pg_statio_all_sequences.schemaname <> ALL (ARRAY[''pg_catalog''::name, ''information_schema''::name])) AND (pg_statio_all_sequences.schemaname !~ ''^pg_toast''::text));', 'NONE', 'NO', 'NO', 'NO', 'NO', 'NO');
INSERT INTO information_schema.views (table_catalog, table_schema, table_name, view_definition, check_option, is_updatable, is_insertable_into, is_trigger_updatable, is_trigger_deletable, is_trigger_insertable_into) VALUES ('sms', 'pg_catalog', 'pg_stat_activity', ' SELECT s.datid,
d.datname,
s.pid,
s.leader_pid,
s.usesysid,
u.rolname AS usename,
s.application_name,
s.client_addr,
s.client_hostname,
s.client_port,
s.backend_start,
s.xact_start,
s.query_start,
s.state_change,
s.wait_event_type,
s.wait_event,
s.state,
s.backend_xid,
s.backend_xmin,
s.query,
s.backend_type
FROM ((pg_stat_get_activity(NULL::integer) s(datid, pid, usesysid, application_name, state, query, wait_event_type, wait_event, xact_start, query_start, backend_start, state_change, client_addr, client_hostname, client_port, backend_xid, backend_xmin, backend_type, ssl, sslversion, sslcipher, sslbits, sslcompression, ssl_client_dn, ssl_client_serial, ssl_issuer_dn, gss_auth, gss_princ, gss_enc, leader_pid)
LEFT JOIN pg_database d ON ((s.datid = d.oid)))
LEFT JOIN pg_authid u ON ((s.usesysid = u.oid)));', 'NONE', 'NO', 'NO', 'NO', 'NO', 'NO');
INSERT INTO information_schema.views (table_catalog, table_schema, table_name, view_definition, check_option, is_updatable, is_insertable_into, is_trigger_updatable, is_trigger_deletable, is_trigger_insertable_into) VALUES ('sms', 'pg_catalog', 'pg_stat_replication', ' SELECT s.pid,
s.usesysid,
u.rolname AS usename,
s.application_name,
s.client_addr,
s.client_hostname,
s.client_port,
s.backend_start,
s.backend_xmin,
w.state,
w.sent_lsn,
w.write_lsn,
w.flush_lsn,
w.replay_lsn,
w.write_lag,
w.flush_lag,
w.replay_lag,
w.sync_priority,
w.sync_state,
w.reply_time
FROM ((pg_stat_get_activity(NULL::integer) s(datid, pid, usesysid, application_name, state, query, wait_event_type, wait_event, xact_start, query_start, backend_start, state_change, client_addr, client_hostname, client_port, backend_xid, backend_xmin, backend_type, ssl, sslversion, sslcipher, sslbits, sslcompression, ssl_client_dn, ssl_client_serial, ssl_issuer_dn, gss_auth, gss_princ, gss_enc, leader_pid)
JOIN pg_stat_get_wal_senders() w(pid, state, sent_lsn, write_lsn, flush_lsn, replay_lsn, write_lag, flush_lag, replay_lag, sync_priority, sync_state, reply_time) ON ((s.pid = w.pid)))
LEFT JOIN pg_authid u ON ((s.usesysid = u.oid)));', 'NONE', 'NO', 'NO', 'NO', 'NO', 'NO');
INSERT INTO information_schema.views (table_catalog, table_schema, table_name, view_definition, check_option, is_updatable, is_insertable_into, is_trigger_updatable, is_trigger_deletable, is_trigger_insertable_into) VALUES ('sms', 'pg_catalog', 'pg_stat_slru', ' SELECT s.name,
s.blks_zeroed,
s.blks_hit,
s.blks_read,
s.blks_written,
s.blks_exists,
s.flushes,
s.truncates,
s.stats_reset
FROM pg_stat_get_slru() s(name, blks_zeroed, blks_hit, blks_read, blks_written, blks_exists, flushes, truncates, stats_reset);', 'NONE', 'NO', 'NO', 'NO', 'NO', 'NO');
INSERT INTO information_schema.views (table_catalog, table_schema, table_name, view_definition, check_option, is_updatable, is_insertable_into, is_trigger_updatable, is_trigger_deletable, is_trigger_insertable_into) VALUES ('sms', 'pg_catalog', 'pg_stat_wal_receiver', ' SELECT s.pid,
s.status,
s.receive_start_lsn,
s.receive_start_tli,
s.written_lsn,
s.flushed_lsn,
s.received_tli,
s.last_msg_send_time,
s.last_msg_receipt_time,
s.latest_end_lsn,
s.latest_end_time,
s.slot_name,
s.sender_host,
s.sender_port,
s.conninfo
FROM pg_stat_get_wal_receiver() s(pid, status, receive_start_lsn, receive_start_tli, written_lsn, flushed_lsn, received_tli, last_msg_send_time, last_msg_receipt_time, latest_end_lsn, latest_end_time, slot_name, sender_host, sender_port, conninfo)
WHERE (s.pid IS NOT NULL);', 'NONE', 'NO', 'NO', 'NO', 'NO', 'NO');
INSERT INTO information_schema.views (table_catalog, table_schema, table_name, view_definition, check_option, is_updatable, is_insertable_into, is_trigger_updatable, is_trigger_deletable, is_trigger_insertable_into) VALUES ('sms', 'pg_catalog', 'pg_stat_subscription', ' SELECT su.oid AS subid,
su.subname,
st.pid,
st.relid,
st.received_lsn,
st.last_msg_send_time,
st.last_msg_receipt_time,
st.latest_end_lsn,
st.latest_end_time
FROM (pg_subscription su
LEFT JOIN pg_stat_get_subscription(NULL::oid) st(subid, relid, pid, received_lsn, last_msg_send_time, last_msg_receipt_time, latest_end_lsn, latest_end_time) ON ((st.subid = su.oid)));', 'NONE', 'NO', 'NO', 'NO', 'NO', 'NO');
INSERT INTO information_schema.views (table_catalog, table_schema, table_name, view_definition, check_option, is_updatable, is_insertable_into, is_trigger_updatable, is_trigger_deletable, is_trigger_insertable_into) VALUES ('sms', 'pg_catalog', 'pg_stat_ssl', ' SELECT s.pid,
s.ssl,
s.sslversion AS version,
s.sslcipher AS cipher,
s.sslbits AS bits,
s.sslcompression AS compression,
s.ssl_client_dn AS client_dn,
s.ssl_client_serial AS client_serial,
s.ssl_issuer_dn AS issuer_dn
FROM pg_stat_get_activity(NULL::integer) s(datid, pid, usesysid, application_name, state, query, wait_event_type, wait_event, xact_start, query_start, backend_start, state_change, client_addr, client_hostname, client_port, backend_xid, backend_xmin, backend_type, ssl, sslversion, sslcipher, sslbits, sslcompression, ssl_client_dn, ssl_client_serial, ssl_issuer_dn, gss_auth, gss_princ, gss_enc, leader_pid)
WHERE (s.client_port IS NOT NULL);', 'NONE', 'NO', 'NO', 'NO', 'NO', 'NO');
INSERT INTO information_schema.views (table_catalog, table_schema, table_name, view_definition, check_option, is_updatable, is_insertable_into, is_trigger_updatable, is_trigger_deletable, is_trigger_insertable_into) VALUES ('sms', 'pg_catalog', 'pg_stat_gssapi', ' SELECT s.pid,
s.gss_auth AS gss_authenticated,
s.gss_princ AS principal,
s.gss_enc AS encrypted
FROM pg_stat_get_activity(NULL::integer) s(datid, pid, usesysid, application_name, state, query, wait_event_type, wait_event, xact_start, query_start, backend_start, state_change, client_addr, client_hostname, client_port, backend_xid, backend_xmin, backend_type, ssl, sslversion, sslcipher, sslbits, sslcompression, ssl_client_dn, ssl_client_serial, ssl_issuer_dn, gss_auth, gss_princ, gss_enc, leader_pid)
WHERE (s.client_port IS NOT NULL);', 'NONE', 'NO', 'NO', 'NO', 'NO', 'NO');
INSERT INTO information_schema.views (table_catalog, table_schema, table_name, view_definition, check_option, is_updatable, is_insertable_into, is_trigger_updatable, is_trigger_deletable, is_trigger_insertable_into) VALUES ('sms', 'pg_catalog', 'pg_replication_slots', ' SELECT l.slot_name,
l.plugin,
l.slot_type,
l.datoid,
d.datname AS database,
l.temporary,
l.active,
l.active_pid,
l.xmin,
l.catalog_xmin,
l.restart_lsn,
l.confirmed_flush_lsn,
l.wal_status,
l.safe_wal_size
FROM (pg_get_replication_slots() l(slot_name, plugin, slot_type, datoid, temporary, active, active_pid, xmin, catalog_xmin, restart_lsn, confirmed_flush_lsn, wal_status, safe_wal_size)
LEFT JOIN pg_database d ON ((l.datoid = d.oid)));', 'NONE', 'NO', 'NO', 'NO', 'NO', 'NO');
INSERT INTO information_schema.views (table_catalog, table_schema, table_name, view_definition, check_option, is_updatable, is_insertable_into, is_trigger_updatable, is_trigger_deletable, is_trigger_insertable_into) VALUES ('sms', 'pg_catalog', 'pg_stat_database', ' SELECT d.oid AS datid,
d.datname,
CASE
WHEN (d.oid = (0)::oid) THEN 0
ELSE pg_stat_get_db_numbackends(d.oid)
END AS numbackends,
pg_stat_get_db_xact_commit(d.oid) AS xact_commit,
pg_stat_get_db_xact_rollback(d.oid) AS xact_rollback,
(pg_stat_get_db_blocks_fetched(d.oid) - pg_stat_get_db_blocks_hit(d.oid)) AS blks_read,
pg_stat_get_db_blocks_hit(d.oid) AS blks_hit,
pg_stat_get_db_tuples_returned(d.oid) AS tup_returned,
pg_stat_get_db_tuples_fetched(d.oid) AS tup_fetched,
pg_stat_get_db_tuples_inserted(d.oid) AS tup_inserted,
pg_stat_get_db_tuples_updated(d.oid) AS tup_updated,
pg_stat_get_db_tuples_deleted(d.oid) AS tup_deleted,
pg_stat_get_db_conflict_all(d.oid) AS conflicts,
pg_stat_get_db_temp_files(d.oid) AS temp_files,
pg_stat_get_db_temp_bytes(d.oid) AS temp_bytes,
pg_stat_get_db_deadlocks(d.oid) AS deadlocks,
pg_stat_get_db_checksum_failures(d.oid) AS checksum_failures,
pg_stat_get_db_checksum_last_failure(d.oid) AS checksum_last_failure,
pg_stat_get_db_blk_read_time(d.oid) AS blk_read_time,
pg_stat_get_db_blk_write_time(d.oid) AS blk_write_time,
pg_stat_get_db_stat_reset_time(d.oid) AS stats_reset
FROM ( SELECT 0 AS oid,
NULL::name AS datname
UNION ALL
SELECT pg_database.oid,
pg_database.datname
FROM pg_database) d;', 'NONE', 'NO', 'NO', 'NO', 'NO', 'NO');
INSERT INTO information_schema.views (table_catalog, table_schema, table_name, view_definition, check_option, is_updatable, is_insertable_into, is_trigger_updatable, is_trigger_deletable, is_trigger_insertable_into) VALUES ('sms', 'pg_catalog', 'pg_stat_database_conflicts', ' SELECT d.oid AS datid,
d.datname,
pg_stat_get_db_conflict_tablespace(d.oid) AS confl_tablespace,
pg_stat_get_db_conflict_lock(d.oid) AS confl_lock,
pg_stat_get_db_conflict_snapshot(d.oid) AS confl_snapshot,
pg_stat_get_db_conflict_bufferpin(d.oid) AS confl_bufferpin,
pg_stat_get_db_conflict_startup_deadlock(d.oid) AS confl_deadlock
FROM pg_database d;', 'NONE', 'YES', 'YES', 'NO', 'NO', 'NO');
INSERT INTO information_schema.views (table_catalog, table_schema, table_name, view_definition, check_option, is_updatable, is_insertable_into, is_trigger_updatable, is_trigger_deletable, is_trigger_insertable_into) VALUES ('sms', 'pg_catalog', 'pg_stat_user_functions', ' SELECT p.oid AS funcid,
n.nspname AS schemaname,
p.proname AS funcname,
pg_stat_get_function_calls(p.oid) AS calls,
pg_stat_get_function_total_time(p.oid) AS total_time,
pg_stat_get_function_self_time(p.oid) AS self_time
FROM (pg_proc p
LEFT JOIN pg_namespace n ON ((n.oid = p.pronamespace)))
WHERE ((p.prolang <> (12)::oid) AND (pg_stat_get_function_calls(p.oid) IS NOT NULL));', 'NONE', 'NO', 'NO', 'NO', 'NO', 'NO');
INSERT INTO information_schema.views (table_catalog, table_schema, table_name, view_definition, check_option, is_updatable, is_insertable_into, is_trigger_updatable, is_trigger_deletable, is_trigger_insertable_into) VALUES ('sms', 'pg_catalog', 'pg_stat_xact_user_functions', ' SELECT p.oid AS funcid,
n.nspname AS schemaname,
p.proname AS funcname,
pg_stat_get_xact_function_calls(p.oid) AS calls,
pg_stat_get_xact_function_total_time(p.oid) AS total_time,
pg_stat_get_xact_function_self_time(p.oid) AS self_time
FROM (pg_proc p
LEFT JOIN pg_namespace n ON ((n.oid = p.pronamespace)))
WHERE ((p.prolang <> (12)::oid) AND (pg_stat_get_xact_function_calls(p.oid) IS NOT NULL));', 'NONE', 'NO', 'NO', 'NO', 'NO', 'NO');
INSERT INTO information_schema.views (table_catalog, table_schema, table_name, view_definition, check_option, is_updatable, is_insertable_into, is_trigger_updatable, is_trigger_deletable, is_trigger_insertable_into) VALUES ('sms', 'pg_catalog', 'pg_stat_archiver', ' SELECT s.archived_count,
s.last_archived_wal,
s.last_archived_time,
s.failed_count,
s.last_failed_wal,
s.last_failed_time,
s.stats_reset
FROM pg_stat_get_archiver() s(archived_count, last_archived_wal, last_archived_time, failed_count, last_failed_wal, last_failed_time, stats_reset);', 'NONE', 'NO', 'NO', 'NO', 'NO', 'NO');
INSERT INTO information_schema.views (table_catalog, table_schema, table_name, view_definition, check_option, is_updatable, is_insertable_into, is_trigger_updatable, is_trigger_deletable, is_trigger_insertable_into) VALUES ('sms', 'pg_catalog', 'pg_stat_bgwriter', ' SELECT pg_stat_get_bgwriter_timed_checkpoints() AS checkpoints_timed,
pg_stat_get_bgwriter_requested_checkpoints() AS checkpoints_req,
pg_stat_get_checkpoint_write_time() AS checkpoint_write_time,
pg_stat_get_checkpoint_sync_time() AS checkpoint_sync_time,
pg_stat_get_bgwriter_buf_written_checkpoints() AS buffers_checkpoint,
pg_stat_get_bgwriter_buf_written_clean() AS buffers_clean,
pg_stat_get_bgwriter_maxwritten_clean() AS maxwritten_clean,
pg_stat_get_buf_written_backend() AS buffers_backend,
pg_stat_get_buf_fsync_backend() AS buffers_backend_fsync,
pg_stat_get_buf_alloc() AS buffers_alloc,
pg_stat_get_bgwriter_stat_reset_time() AS stats_reset;', 'NONE', 'NO', 'NO', 'NO', 'NO', 'NO');
INSERT INTO information_schema.views (table_catalog, table_schema, table_name, view_definition, check_option, is_updatable, is_insertable_into, is_trigger_updatable, is_trigger_deletable, is_trigger_insertable_into) VALUES ('sms', 'pg_catalog', 'pg_stat_progress_analyze', ' SELECT s.pid,
s.datid,
d.datname,
s.relid,
CASE s.param1
WHEN 0 THEN ''initializing''::text
WHEN 1 THEN ''acquiring sample rows''::text
WHEN 2 THEN ''acquiring inherited sample rows''::text
WHEN 3 THEN ''computing statistics''::text
WHEN 4 THEN ''computing extended statistics''::text
WHEN 5 THEN ''finalizing analyze''::text
ELSE NULL::text
END AS phase,
s.param2 AS sample_blks_total,
s.param3 AS sample_blks_scanned,
s.param4 AS ext_stats_total,
s.param5 AS ext_stats_computed,
s.param6 AS child_tables_total,
s.param7 AS child_tables_done,
(s.param8)::oid AS current_child_table_relid
FROM (pg_stat_get_progress_info(''ANALYZE''::text) s(pid, datid, relid, param1, param2, param3, param4, param5, param6, param7, param8, param9, param10, param11, param12, param13, param14, param15, param16, param17, param18, param19, param20)
LEFT JOIN pg_database d ON ((s.datid = d.oid)));', 'NONE', 'NO', 'NO', 'NO', 'NO', 'NO');
INSERT INTO information_schema.views (table_catalog, table_schema, table_name, view_definition, check_option, is_updatable, is_insertable_into, is_trigger_updatable, is_trigger_deletable, is_trigger_insertable_into) VALUES ('sms', 'information_schema', 'columns', ' SELECT (current_database())::information_schema.sql_identifier AS table_catalog,
(nc.nspname)::information_schema.sql_identifier AS table_schema,
(c.relname)::information_schema.sql_identifier AS table_name,
(a.attname)::information_schema.sql_identifier AS column_name,
(a.attnum)::information_schema.cardinal_number AS ordinal_position,
(
CASE
WHEN (a.attgenerated = ''''::"char") THEN pg_get_expr(ad.adbin, ad.adrelid)
ELSE NULL::text
END)::information_schema.character_data AS column_default,
(
CASE
WHEN (a.attnotnull OR ((t.typtype = ''d''::"char") AND t.typnotnull)) THEN ''NO''::text
ELSE ''YES''::text
END)::information_schema.yes_or_no AS is_nullable,
(
CASE
WHEN (t.typtype = ''d''::"char") THEN
CASE
WHEN ((bt.typelem <> (0)::oid) AND (bt.typlen = ''-1''::integer)) THEN ''ARRAY''::text
WHEN (nbt.nspname = ''pg_catalog''::name) THEN format_type(t.typbasetype, NULL::integer)
ELSE ''USER-DEFINED''::text
END
ELSE
CASE
WHEN ((t.typelem <> (0)::oid) AND (t.typlen = ''-1''::integer)) THEN ''ARRAY''::text
WHEN (nt.nspname = ''pg_catalog''::name) THEN format_type(a.atttypid, NULL::integer)
ELSE ''USER-DEFINED''::text
END
END)::information_schema.character_data AS data_type,
(information_schema._pg_char_max_length(information_schema._pg_truetypid(a.*, t.*), information_schema._pg_truetypmod(a.*, t.*)))::information_schema.cardinal_number AS character_maximum_length,
(information_schema._pg_char_octet_length(information_schema._pg_truetypid(a.*, t.*), information_schema._pg_truetypmod(a.*, t.*)))::information_schema.cardinal_number AS character_octet_length,
(information_schema._pg_numeric_precision(information_schema._pg_truetypid(a.*, t.*), information_schema._pg_truetypmod(a.*, t.*)))::information_schema.cardinal_number AS numeric_precision,
(information_schema._pg_numeric_precision_radix(information_schema._pg_truetypid(a.*, t.*), information_schema._pg_truetypmod(a.*, t.*)))::information_schema.cardinal_number AS numeric_precision_radix,
(information_schema._pg_numeric_scale(information_schema._pg_truetypid(a.*, t.*), information_schema._pg_truetypmod(a.*, t.*)))::information_schema.cardinal_number AS numeric_scale,
(information_schema._pg_datetime_precision(information_schema._pg_truetypid(a.*, t.*), information_schema._pg_truetypmod(a.*, t.*)))::information_schema.cardinal_number AS datetime_precision,
(information_schema._pg_interval_type(information_schema._pg_truetypid(a.*, t.*), information_schema._pg_truetypmod(a.*, t.*)))::information_schema.character_data AS interval_type,
(NULL::integer)::information_schema.cardinal_number AS interval_precision,
(NULL::name)::information_schema.sql_identifier AS character_set_catalog,
(NULL::name)::information_schema.sql_identifier AS character_set_schema,
(NULL::name)::information_schema.sql_identifier AS character_set_name,
(
CASE
WHEN (nco.nspname IS NOT NULL) THEN current_database()
ELSE NULL::name
END)::information_schema.sql_identifier AS collation_catalog,
(nco.nspname)::information_schema.sql_identifier AS collation_schema,
(co.collname)::information_schema.sql_identifier AS collation_name,
(
CASE
WHEN (t.typtype = ''d''::"char") THEN current_database()
ELSE NULL::name
END)::information_schema.sql_identifier AS domain_catalog,
(
CASE
WHEN (t.typtype = ''d''::"char") THEN nt.nspname
ELSE NULL::name
END)::information_schema.sql_identifier AS domain_schema,
(
CASE
WHEN (t.typtype = ''d''::"char") THEN t.typname
ELSE NULL::name
END)::information_schema.sql_identifier AS domain_name,
(current_database())::information_schema.sql_identifier AS udt_catalog,
(COALESCE(nbt.nspname, nt.nspname))::information_schema.sql_identifier AS udt_schema,
(COALESCE(bt.typname, t.typname))::information_schema.sql_identifier AS udt_name,
(NULL::name)::information_schema.sql_identifier AS scope_catalog,
(NULL::name)::information_schema.sql_identifier AS scope_schema,
(NULL::name)::information_schema.sql_identifier AS scope_name,
(NULL::integer)::information_schema.cardinal_number AS maximum_cardinality,
(a.attnum)::information_schema.sql_identifier AS dtd_identifier,
(''NO''::character varying)::information_schema.yes_or_no AS is_self_referencing,
(
CASE
WHEN (a.attidentity = ANY (ARRAY[''a''::"char", ''d''::"char"])) THEN ''YES''::text
ELSE ''NO''::text
END)::information_schema.yes_or_no AS is_identity,
(
CASE a.attidentity
WHEN ''a''::"char" THEN ''ALWAYS''::text
WHEN ''d''::"char" THEN ''BY DEFAULT''::text
ELSE NULL::text
END)::information_schema.character_data AS identity_generation,
(seq.seqstart)::information_schema.character_data AS identity_start,
(seq.seqincrement)::information_schema.character_data AS identity_increment,
(seq.seqmax)::information_schema.character_data AS identity_maximum,
(seq.seqmin)::information_schema.character_data AS identity_minimum,
(
CASE
WHEN seq.seqcycle THEN ''YES''::text
ELSE ''NO''::text
END)::information_schema.yes_or_no AS identity_cycle,
(
CASE
WHEN (a.attgenerated <> ''''::"char") THEN ''ALWAYS''::text
ELSE ''NEVER''::text
END)::information_schema.character_data AS is_generated,
(
CASE
WHEN (a.attgenerated <> ''''::"char") THEN pg_get_expr(ad.adbin, ad.adrelid)
ELSE NULL::text
END)::information_schema.character_data AS generation_expression,
(
CASE
WHEN ((c.relkind = ANY (ARRAY[''r''::"char", ''p''::"char"])) OR ((c.relkind = ANY (ARRAY[''v''::"char", ''f''::"char"])) AND pg_column_is_updatable((c.oid)::regclass, a.attnum, false))) THEN ''YES''::text
ELSE ''NO''::text
END)::information_schema.yes_or_no AS is_updatable
FROM ((((((pg_attribute a
LEFT JOIN pg_attrdef ad ON (((a.attrelid = ad.adrelid) AND (a.attnum = ad.adnum))))
JOIN (pg_class c
JOIN pg_namespace nc ON ((c.relnamespace = nc.oid))) ON ((a.attrelid = c.oid)))
JOIN (pg_type t
JOIN pg_namespace nt ON ((t.typnamespace = nt.oid))) ON ((a.atttypid = t.oid)))
LEFT JOIN (pg_type bt
JOIN pg_namespace nbt ON ((bt.typnamespace = nbt.oid))) ON (((t.typtype = ''d''::"char") AND (t.typbasetype = bt.oid))))
LEFT JOIN (pg_collation co
JOIN pg_namespace nco ON ((co.collnamespace = nco.oid))) ON (((a.attcollation = co.oid) AND ((nco.nspname <> ''pg_catalog''::name) OR (co.collname <> ''default''::name)))))
LEFT JOIN (pg_depend dep
JOIN pg_sequence seq ON (((dep.classid = (''pg_class''::regclass)::oid) AND (dep.objid = seq.seqrelid) AND (dep.deptype = ''i''::"char")))) ON (((dep.refclassid = (''pg_class''::regclass)::oid) AND (dep.refobjid = c.oid) AND (dep.refobjsubid = a.attnum))))
WHERE ((NOT pg_is_other_temp_schema(nc.oid)) AND (a.attnum > 0) AND (NOT a.attisdropped) AND (c.relkind = ANY (ARRAY[''r''::"char", ''v''::"char", ''f''::"char", ''p''::"char"])) AND (pg_has_role(c.relowner, ''USAGE''::text) OR has_column_privilege(c.oid, a.attnum, ''SELECT, INSERT, UPDATE, REFERENCES''::text)));', 'NONE', 'NO', 'NO', 'NO', 'NO', 'NO');
INSERT INTO information_schema.views (table_catalog, table_schema, table_name, view_definition, check_option, is_updatable, is_insertable_into, is_trigger_updatable, is_trigger_deletable, is_trigger_insertable_into) VALUES ('sms', 'information_schema', 'information_schema_catalog_name', ' SELECT (current_database())::information_schema.sql_identifier AS catalog_name;', 'NONE', 'NO', 'NO', 'NO', 'NO', 'NO');
INSERT INTO information_schema.views (table_catalog, table_schema, table_name, view_definition, check_option, is_updatable, is_insertable_into, is_trigger_updatable, is_trigger_deletable, is_trigger_insertable_into) VALUES ('sms', 'information_schema', 'collations', ' SELECT (current_database())::information_schema.sql_identifier AS collation_catalog,
(nc.nspname)::information_schema.sql_identifier AS collation_schema,
(c.collname)::information_schema.sql_identifier AS collation_name,
(''NO PAD''::character varying)::information_schema.character_data AS pad_attribute
FROM pg_collation c,
pg_namespace nc
WHERE ((c.collnamespace = nc.oid) AND (c.collencoding = ANY (ARRAY[''-1''::integer, ( SELECT pg_database.encoding
FROM pg_database
WHERE (pg_database.datname = current_database()))])));', 'NONE', 'NO', 'NO', 'NO', 'NO', 'NO');
INSERT INTO information_schema.views (table_catalog, table_schema, table_name, view_definition, check_option, is_updatable, is_insertable_into, is_trigger_updatable, is_trigger_deletable, is_trigger_insertable_into) VALUES ('sms', 'information_schema', 'applicable_roles', ' SELECT (a.rolname)::information_schema.sql_identifier AS grantee,
(b.rolname)::information_schema.sql_identifier AS role_name,
(
CASE
WHEN m.admin_option THEN ''YES''::text
ELSE ''NO''::text
END)::information_schema.yes_or_no AS is_grantable
FROM ((pg_auth_members m
JOIN pg_authid a ON ((m.member = a.oid)))
JOIN pg_authid b ON ((m.roleid = b.oid)))
WHERE pg_has_role(a.oid, ''USAGE''::text);', 'NONE', 'NO', 'NO', 'NO', 'NO', 'NO');
INSERT INTO information_schema.views (table_catalog, table_schema, table_name, view_definition, check_option, is_updatable, is_insertable_into, is_trigger_updatable, is_trigger_deletable, is_trigger_insertable_into) VALUES ('sms', 'information_schema', 'administrable_role_authorizations', ' SELECT applicable_roles.grantee,
applicable_roles.role_name,
applicable_roles.is_grantable
FROM information_schema.applicable_roles
WHERE ((applicable_roles.is_grantable)::text = ''YES''::text);', 'NONE', 'NO', 'NO', 'NO', 'NO', 'NO');
INSERT INTO information_schema.views (table_catalog, table_schema, table_name, view_definition, check_option, is_updatable, is_insertable_into, is_trigger_updatable, is_trigger_deletable, is_trigger_insertable_into) VALUES ('sms', 'information_schema', 'column_privileges', ' SELECT (u_grantor.rolname)::information_schema.sql_identifier AS grantor,
(grantee.rolname)::information_schema.sql_identifier AS grantee,
(current_database())::information_schema.sql_identifier AS table_catalog,
(nc.nspname)::information_schema.sql_identifier AS table_schema,
(x.relname)::information_schema.sql_identifier AS table_name,
(x.attname)::information_schema.sql_identifier AS column_name,
(x.prtype)::information_schema.character_data AS privilege_type,
(
CASE
WHEN (pg_has_role(x.grantee, x.relowner, ''USAGE''::text) OR x.grantable) THEN ''YES''::text
ELSE ''NO''::text
END)::information_schema.yes_or_no AS is_grantable
FROM ( SELECT pr_c.grantor,
pr_c.grantee,
a.attname,
pr_c.relname,
pr_c.relnamespace,
pr_c.prtype,
pr_c.grantable,
pr_c.relowner
FROM ( SELECT pg_class.oid,
pg_class.relname,
pg_class.relnamespace,
pg_class.relowner,
(aclexplode(COALESCE(pg_class.relacl, acldefault(''r''::"char", pg_class.relowner)))).grantor AS grantor,
(aclexplode(COALESCE(pg_class.relacl, acldefault(''r''::"char", pg_class.relowner)))).grantee AS grantee,
(aclexplode(COALESCE(pg_class.relacl, acldefault(''r''::"char", pg_class.relowner)))).privilege_type AS privilege_type,
(aclexplode(COALESCE(pg_class.relacl, acldefault(''r''::"char", pg_class.relowner)))).is_grantable AS is_grantable
FROM pg_class
WHERE (pg_class.relkind = ANY (ARRAY[''r''::"char", ''v''::"char", ''f''::"char", ''p''::"char"]))) pr_c(oid, relname, relnamespace, relowner, grantor, grantee, prtype, grantable),
pg_attribute a
WHERE ((a.attrelid = pr_c.oid) AND (a.attnum > 0) AND (NOT a.attisdropped))
UNION
SELECT pr_a.grantor,
pr_a.grantee,
pr_a.attname,
c.relname,
c.relnamespace,
pr_a.prtype,
pr_a.grantable,
c.relowner
FROM ( SELECT a.attrelid,
a.attname,
(aclexplode(COALESCE(a.attacl, acldefault(''c''::"char", cc.relowner)))).grantor AS grantor,
(aclexplode(COALESCE(a.attacl, acldefault(''c''::"char", cc.relowner)))).grantee AS grantee,
(aclexplode(COALESCE(a.attacl, acldefault(''c''::"char", cc.relowner)))).privilege_type AS privilege_type,
(aclexplode(COALESCE(a.attacl, acldefault(''c''::"char", cc.relowner)))).is_grantable AS is_grantable
FROM (pg_attribute a
JOIN pg_class cc ON ((a.attrelid = cc.oid)))
WHERE ((a.attnum > 0) AND (NOT a.attisdropped))) pr_a(attrelid, attname, grantor, grantee, prtype, grantable),
pg_class c
WHERE ((pr_a.attrelid = c.oid) AND (c.relkind = ANY (ARRAY[''r''::"char", ''v''::"char", ''f''::"char", ''p''::"char"])))) x,
pg_namespace nc,
pg_authid u_grantor,
( SELECT pg_authid.oid,
pg_authid.rolname
FROM pg_authid
UNION ALL
SELECT (0)::oid AS oid,
''PUBLIC''::name) grantee(oid, rolname)
WHERE ((x.relnamespace = nc.oid) AND (x.grantee = grantee.oid) AND (x.grantor = u_grantor.oid) AND (x.prtype = ANY (ARRAY[''INSERT''::text, ''SELECT''::text, ''UPDATE''::text, ''REFERENCES''::text])) AND (pg_has_role(u_grantor.oid, ''USAGE''::text) OR pg_has_role(grantee.oid, ''USAGE''::text) OR (grantee.rolname = ''PUBLIC''::name)));', 'NONE', 'NO', 'NO', 'NO', 'NO', 'NO');
INSERT INTO information_schema.views (table_catalog, table_schema, table_name, view_definition, check_option, is_updatable, is_insertable_into, is_trigger_updatable, is_trigger_deletable, is_trigger_insertable_into) VALUES ('sms', 'information_schema', 'attributes', ' SELECT (current_database())::information_schema.sql_identifier AS udt_catalog,
(nc.nspname)::information_schema.sql_identifier AS udt_schema,
(c.relname)::information_schema.sql_identifier AS udt_name,
(a.attname)::information_schema.sql_identifier AS attribute_name,
(a.attnum)::information_schema.cardinal_number AS ordinal_position,
(pg_get_expr(ad.adbin, ad.adrelid))::information_schema.character_data AS attribute_default,
(
CASE
WHEN (a.attnotnull OR ((t.typtype = ''d''::"char") AND t.typnotnull)) THEN ''NO''::text
ELSE ''YES''::text
END)::information_schema.yes_or_no AS is_nullable,
(
CASE
WHEN ((t.typelem <> (0)::oid) AND (t.typlen = ''-1''::integer)) THEN ''ARRAY''::text
WHEN (nt.nspname = ''pg_catalog''::name) THEN format_type(a.atttypid, NULL::integer)
ELSE ''USER-DEFINED''::text
END)::information_schema.character_data AS data_type,
(information_schema._pg_char_max_length(information_schema._pg_truetypid(a.*, t.*), information_schema._pg_truetypmod(a.*, t.*)))::information_schema.cardinal_number AS character_maximum_length,
(information_schema._pg_char_octet_length(information_schema._pg_truetypid(a.*, t.*), information_schema._pg_truetypmod(a.*, t.*)))::information_schema.cardinal_number AS character_octet_length,
(NULL::name)::information_schema.sql_identifier AS character_set_catalog,
(NULL::name)::information_schema.sql_identifier AS character_set_schema,
(NULL::name)::information_schema.sql_identifier AS character_set_name,
(
CASE
WHEN (nco.nspname IS NOT NULL) THEN current_database()
ELSE NULL::name
END)::information_schema.sql_identifier AS collation_catalog,
(nco.nspname)::information_schema.sql_identifier AS collation_schema,
(co.collname)::information_schema.sql_identifier AS collation_name,
(information_schema._pg_numeric_precision(information_schema._pg_truetypid(a.*, t.*), information_schema._pg_truetypmod(a.*, t.*)))::information_schema.cardinal_number AS numeric_precision,
(information_schema._pg_numeric_precision_radix(information_schema._pg_truetypid(a.*, t.*), information_schema._pg_truetypmod(a.*, t.*)))::information_schema.cardinal_number AS numeric_precision_radix,
(information_schema._pg_numeric_scale(information_schema._pg_truetypid(a.*, t.*), information_schema._pg_truetypmod(a.*, t.*)))::information_schema.cardinal_number AS numeric_scale,
(information_schema._pg_datetime_precision(information_schema._pg_truetypid(a.*, t.*), information_schema._pg_truetypmod(a.*, t.*)))::information_schema.cardinal_number AS datetime_precision,
(information_schema._pg_interval_type(information_schema._pg_truetypid(a.*, t.*), information_schema._pg_truetypmod(a.*, t.*)))::information_schema.character_data AS interval_type,
(NULL::integer)::information_schema.cardinal_number AS interval_precision,
(current_database())::information_schema.sql_identifier AS attribute_udt_catalog,
(nt.nspname)::information_schema.sql_identifier AS attribute_udt_schema,
(t.typname)::information_schema.sql_identifier AS attribute_udt_name,
(NULL::name)::information_schema.sql_identifier AS scope_catalog,
(NULL::name)::information_schema.sql_identifier AS scope_schema,
(NULL::name)::information_schema.sql_identifier AS scope_name,
(NULL::integer)::information_schema.cardinal_number AS maximum_cardinality,
(a.attnum)::information_schema.sql_identifier AS dtd_identifier,
(''NO''::character varying)::information_schema.yes_or_no AS is_derived_reference_attribute
FROM ((((pg_attribute a
LEFT JOIN pg_attrdef ad ON (((a.attrelid = ad.adrelid) AND (a.attnum = ad.adnum))))
JOIN (pg_class c
JOIN pg_namespace nc ON ((c.relnamespace = nc.oid))) ON ((a.attrelid = c.oid)))
JOIN (pg_type t
JOIN pg_namespace nt ON ((t.typnamespace = nt.oid))) ON ((a.atttypid = t.oid)))
LEFT JOIN (pg_collation co
JOIN pg_namespace nco ON ((co.collnamespace = nco.oid))) ON (((a.attcollation = co.oid) AND ((nco.nspname <> ''pg_catalog''::name) OR (co.collname <> ''default''::name)))))
WHERE ((a.attnum > 0) AND (NOT a.attisdropped) AND (c.relkind = ''c''::"char") AND (pg_has_role(c.relowner, ''USAGE''::text) OR has_type_privilege(c.reltype, ''USAGE''::text)));', 'NONE', 'NO', 'NO', 'NO', 'NO', 'NO');
INSERT INTO information_schema.views (table_catalog, table_schema, table_name, view_definition, check_option, is_updatable, is_insertable_into, is_trigger_updatable, is_trigger_deletable, is_trigger_insertable_into) VALUES ('sms', 'information_schema', 'collation_character_set_applicability', ' SELECT (current_database())::information_schema.sql_identifier AS collation_catalog,
(nc.nspname)::information_schema.sql_identifier AS collation_schema,
(c.collname)::information_schema.sql_identifier AS collation_name,
(NULL::name)::information_schema.sql_identifier AS character_set_catalog,
(NULL::name)::information_schema.sql_identifier AS character_set_schema,
(getdatabaseencoding())::information_schema.sql_identifier AS character_set_name
FROM pg_collation c,
pg_namespace nc
WHERE ((c.collnamespace = nc.oid) AND (c.collencoding = ANY (ARRAY[''-1''::integer, ( SELECT pg_database.encoding
FROM pg_database
WHERE (pg_database.datname = current_database()))])));', 'NONE', 'NO', 'NO', 'NO', 'NO', 'NO');
INSERT INTO information_schema.views (table_catalog, table_schema, table_name, view_definition, check_option, is_updatable, is_insertable_into, is_trigger_updatable, is_trigger_deletable, is_trigger_insertable_into) VALUES ('sms', 'information_schema', 'character_sets', ' SELECT (NULL::name)::information_schema.sql_identifier AS character_set_catalog,
(NULL::name)::information_schema.sql_identifier AS character_set_schema,
(getdatabaseencoding())::information_schema.sql_identifier AS character_set_name,
(
CASE
WHEN (getdatabaseencoding() = ''UTF8''::name) THEN ''UCS''::name
ELSE getdatabaseencoding()
END)::information_schema.sql_identifier AS character_repertoire,
(getdatabaseencoding())::information_schema.sql_identifier AS form_of_use,
(current_database())::information_schema.sql_identifier AS default_collate_catalog,
(nc.nspname)::information_schema.sql_identifier AS default_collate_schema,
(c.collname)::information_schema.sql_identifier AS default_collate_name
FROM (pg_database d
LEFT JOIN (pg_collation c
JOIN pg_namespace nc ON ((c.collnamespace = nc.oid))) ON (((d.datcollate = c.collcollate) AND (d.datctype = c.collctype))))
WHERE (d.datname = current_database())
ORDER BY (char_length((c.collname)::text)) DESC, c.collname
LIMIT 1;', 'NONE', 'NO', 'NO', 'NO', 'NO', 'NO');
INSERT INTO information_schema.views (table_catalog, table_schema, table_name, view_definition, check_option, is_updatable, is_insertable_into, is_trigger_updatable, is_trigger_deletable, is_trigger_insertable_into) VALUES ('sms', 'information_schema', 'check_constraint_routine_usage', ' SELECT (current_database())::information_schema.sql_identifier AS constraint_catalog,
(nc.nspname)::information_schema.sql_identifier AS constraint_schema,
(c.conname)::information_schema.sql_identifier AS constraint_name,
(current_database())::information_schema.sql_identifier AS specific_catalog,
(np.nspname)::information_schema.sql_identifier AS specific_schema,
(nameconcatoid(p.proname, p.oid))::information_schema.sql_identifier AS specific_name
FROM pg_namespace nc,
pg_constraint c,
pg_depend d,
pg_proc p,
pg_namespace np
WHERE ((nc.oid = c.connamespace) AND (c.contype = ''c''::"char") AND (c.oid = d.objid) AND (d.classid = (''pg_constraint''::regclass)::oid) AND (d.refobjid = p.oid) AND (d.refclassid = (''pg_proc''::regclass)::oid) AND (p.pronamespace = np.oid) AND pg_has_role(p.proowner, ''USAGE''::text));', 'NONE', 'NO', 'NO', 'NO', 'NO', 'NO');
INSERT INTO information_schema.views (table_catalog, table_schema, table_name, view_definition, check_option, is_updatable, is_insertable_into, is_trigger_updatable, is_trigger_deletable, is_trigger_insertable_into) VALUES ('sms', 'information_schema', 'check_constraints', ' SELECT (current_database())::information_schema.sql_identifier AS constraint_catalog,
(rs.nspname)::information_schema.sql_identifier AS constraint_schema,
(con.conname)::information_schema.sql_identifier AS constraint_name,
("substring"(pg_get_constraintdef(con.oid), 7))::information_schema.character_data AS check_clause
FROM (((pg_constraint con
LEFT JOIN pg_namespace rs ON ((rs.oid = con.connamespace)))
LEFT JOIN pg_class c ON ((c.oid = con.conrelid)))
LEFT JOIN pg_type t ON ((t.oid = con.contypid)))
WHERE (pg_has_role(COALESCE(c.relowner, t.typowner), ''USAGE''::text) AND (con.contype = ''c''::"char"))
UNION
SELECT (current_database())::information_schema.sql_identifier AS constraint_catalog,
(n.nspname)::information_schema.sql_identifier AS constraint_schema,
(((((((n.oid)::text || ''_''::text) || (r.oid)::text) || ''_''::text) || (a.attnum)::text) || ''_not_null''::text))::information_schema.sql_identifier AS constraint_name,
(((a.attname)::text || '' IS NOT NULL''::text))::information_schema.character_data AS check_clause
FROM pg_namespace n,
pg_class r,
pg_attribute a
WHERE ((n.oid = r.relnamespace) AND (r.oid = a.attrelid) AND (a.attnum > 0) AND (NOT a.attisdropped) AND a.attnotnull AND (r.relkind = ANY (ARRAY[''r''::"char", ''p''::"char"])) AND pg_has_role(r.relowner, ''USAGE''::text));', 'NONE', 'NO', 'NO', 'NO', 'NO', 'NO');
INSERT INTO information_schema.views (table_catalog, table_schema, table_name, view_definition, check_option, is_updatable, is_insertable_into, is_trigger_updatable, is_trigger_deletable, is_trigger_insertable_into) VALUES ('sms', 'information_schema', 'column_column_usage', ' SELECT (current_database())::information_schema.sql_identifier AS table_catalog,
(n.nspname)::information_schema.sql_identifier AS table_schema,
(c.relname)::information_schema.sql_identifier AS table_name,
(ac.attname)::information_schema.sql_identifier AS column_name,
(ad.attname)::information_schema.sql_identifier AS dependent_column
FROM pg_namespace n,
pg_class c,
pg_depend d,
pg_attribute ac,
pg_attribute ad
WHERE ((n.oid = c.relnamespace) AND (c.oid = ac.attrelid) AND (c.oid = ad.attrelid) AND (d.classid = (''pg_class''::regclass)::oid) AND (d.refclassid = (''pg_class''::regclass)::oid) AND (d.objid = d.refobjid) AND (c.oid = d.objid) AND (d.objsubid = ad.attnum) AND (d.refobjsubid = ac.attnum) AND (ad.attgenerated <> ''''::"char") AND pg_has_role(c.relowner, ''USAGE''::text));', 'NONE', 'NO', 'NO', 'NO', 'NO', 'NO');
INSERT INTO information_schema.views (table_catalog, table_schema, table_name, view_definition, check_option, is_updatable, is_insertable_into, is_trigger_updatable, is_trigger_deletable, is_trigger_insertable_into) VALUES ('sms', 'information_schema', 'column_domain_usage', ' SELECT (current_database())::information_schema.sql_identifier AS domain_catalog,
(nt.nspname)::information_schema.sql_identifier AS domain_schema,
(t.typname)::information_schema.sql_identifier AS domain_name,
(current_database())::information_schema.sql_identifier AS table_catalog,
(nc.nspname)::information_schema.sql_identifier AS table_schema,
(c.relname)::information_schema.sql_identifier AS table_name,
(a.attname)::information_schema.sql_identifier AS column_name
FROM pg_type t,
pg_namespace nt,
pg_class c,
pg_namespace nc,
pg_attribute a
WHERE ((t.typnamespace = nt.oid) AND (c.relnamespace = nc.oid) AND (a.attrelid = c.oid) AND (a.atttypid = t.oid) AND (t.typtype = ''d''::"char") AND (c.relkind = ANY (ARRAY[''r''::"char", ''v''::"char", ''f''::"char", ''p''::"char"])) AND (a.attnum > 0) AND (NOT a.attisdropped) AND pg_has_role(t.typowner, ''USAGE''::text));', 'NONE', 'NO', 'NO', 'NO', 'NO', 'NO');
INSERT INTO information_schema.views (table_catalog, table_schema, table_name, view_definition, check_option, is_updatable, is_insertable_into, is_trigger_updatable, is_trigger_deletable, is_trigger_insertable_into) VALUES ('sms', 'information_schema', 'column_udt_usage', ' SELECT (current_database())::information_schema.sql_identifier AS udt_catalog,
(COALESCE(nbt.nspname, nt.nspname))::information_schema.sql_identifier AS udt_schema,
(COALESCE(bt.typname, t.typname))::information_schema.sql_identifier AS udt_name,
(current_database())::information_schema.sql_identifier AS table_catalog,
(nc.nspname)::information_schema.sql_identifier AS table_schema,
(c.relname)::information_schema.sql_identifier AS table_name,
(a.attname)::information_schema.sql_identifier AS column_name
FROM pg_attribute a,
pg_class c,
pg_namespace nc,
((pg_type t
JOIN pg_namespace nt ON ((t.typnamespace = nt.oid)))
LEFT JOIN (pg_type bt
JOIN pg_namespace nbt ON ((bt.typnamespace = nbt.oid))) ON (((t.typtype = ''d''::"char") AND (t.typbasetype = bt.oid))))
WHERE ((a.attrelid = c.oid) AND (a.atttypid = t.oid) AND (nc.oid = c.relnamespace) AND (a.attnum > 0) AND (NOT a.attisdropped) AND (c.relkind = ANY (ARRAY[''r''::"char", ''v''::"char", ''f''::"char", ''p''::"char"])) AND pg_has_role(COALESCE(bt.typowner, t.typowner), ''USAGE''::text));', 'NONE', 'NO', 'NO', 'NO', 'NO', 'NO');
INSERT INTO information_schema.views (table_catalog, table_schema, table_name, view_definition, check_option, is_updatable, is_insertable_into, is_trigger_updatable, is_trigger_deletable, is_trigger_insertable_into) VALUES ('sms', 'information_schema', 'constraint_column_usage', ' SELECT (current_database())::information_schema.sql_identifier AS table_catalog,
(x.tblschema)::information_schema.sql_identifier AS table_schema,
(x.tblname)::information_schema.sql_identifier AS table_name,
(x.colname)::information_schema.sql_identifier AS column_name,
(current_database())::information_schema.sql_identifier AS constraint_catalog,
(x.cstrschema)::information_schema.sql_identifier AS constraint_schema,
(x.cstrname)::information_schema.sql_identifier AS constraint_name
FROM ( SELECT DISTINCT nr.nspname,
r.relname,
r.relowner,
a.attname,
nc.nspname,
c.conname
FROM pg_namespace nr,
pg_class r,
pg_attribute a,
pg_depend d,
pg_namespace nc,
pg_constraint c
WHERE ((nr.oid = r.relnamespace) AND (r.oid = a.attrelid) AND (d.refclassid = (''pg_class''::regclass)::oid) AND (d.refobjid = r.oid) AND (d.refobjsubid = a.attnum) AND (d.classid = (''pg_constraint''::regclass)::oid) AND (d.objid = c.oid) AND (c.connamespace = nc.oid) AND (c.contype = ''c''::"char") AND (r.relkind = ANY (ARRAY[''r''::"char", ''p''::"char"])) AND (NOT a.attisdropped))
UNION ALL
SELECT nr.nspname,
r.relname,
r.relowner,
a.attname,
nc.nspname,
c.conname
FROM pg_namespace nr,
pg_class r,
pg_attribute a,
pg_namespace nc,
pg_constraint c
WHERE ((nr.oid = r.relnamespace) AND (r.oid = a.attrelid) AND (nc.oid = c.connamespace) AND (r.oid =
CASE c.contype
WHEN ''f''::"char" THEN c.confrelid
ELSE c.conrelid
END) AND (a.attnum = ANY (
CASE c.contype
WHEN ''f''::"char" THEN c.confkey
ELSE c.conkey
END)) AND (NOT a.attisdropped) AND (c.contype = ANY (ARRAY[''p''::"char", ''u''::"char", ''f''::"char"])) AND (r.relkind = ANY (ARRAY[''r''::"char", ''p''::"char"])))) x(tblschema, tblname, tblowner, colname, cstrschema, cstrname)
WHERE pg_has_role(x.tblowner, ''USAGE''::text);', 'NONE', 'NO', 'NO', 'NO', 'NO', 'NO');
INSERT INTO information_schema.views (table_catalog, table_schema, table_name, view_definition, check_option, is_updatable, is_insertable_into, is_trigger_updatable, is_trigger_deletable, is_trigger_insertable_into) VALUES ('sms', 'information_schema', 'constraint_table_usage', ' SELECT (current_database())::information_schema.sql_identifier AS table_catalog,
(nr.nspname)::information_schema.sql_identifier AS table_schema,
(r.relname)::information_schema.sql_identifier AS table_name,
(current_database())::information_schema.sql_identifier AS constraint_catalog,
(nc.nspname)::information_schema.sql_identifier AS constraint_schema,
(c.conname)::information_schema.sql_identifier AS constraint_name
FROM pg_constraint c,
pg_namespace nc,
pg_class r,
pg_namespace nr
WHERE ((c.connamespace = nc.oid) AND (r.relnamespace = nr.oid) AND (((c.contype = ''f''::"char") AND (c.confrelid = r.oid)) OR ((c.contype = ANY (ARRAY[''p''::"char", ''u''::"char"])) AND (c.conrelid = r.oid))) AND (r.relkind = ANY (ARRAY[''r''::"char", ''p''::"char"])) AND pg_has_role(r.relowner, ''USAGE''::text));', 'NONE', 'NO', 'NO', 'NO', 'NO', 'NO');
INSERT INTO information_schema.views (table_catalog, table_schema, table_name, view_definition, check_option, is_updatable, is_insertable_into, is_trigger_updatable, is_trigger_deletable, is_trigger_insertable_into) VALUES ('sms', 'information_schema', 'domain_constraints', ' SELECT (current_database())::information_schema.sql_identifier AS constraint_catalog,
(rs.nspname)::information_schema.sql_identifier AS constraint_schema,
(con.conname)::information_schema.sql_identifier AS constraint_name,
(current_database())::information_schema.sql_identifier AS domain_catalog,
(n.nspname)::information_schema.sql_identifier AS domain_schema,
(t.typname)::information_schema.sql_identifier AS domain_name,
(
CASE
WHEN con.condeferrable THEN ''YES''::text
ELSE ''NO''::text
END)::information_schema.yes_or_no AS is_deferrable,
(
CASE
WHEN con.condeferred THEN ''YES''::text
ELSE ''NO''::text
END)::information_schema.yes_or_no AS initially_deferred
FROM pg_namespace rs,
pg_namespace n,
pg_constraint con,
pg_type t
WHERE ((rs.oid = con.connamespace) AND (n.oid = t.typnamespace) AND (t.oid = con.contypid) AND (pg_has_role(t.typowner, ''USAGE''::text) OR has_type_privilege(t.oid, ''USAGE''::text)));', 'NONE', 'NO', 'NO', 'NO', 'NO', 'NO');
INSERT INTO information_schema.views (table_catalog, table_schema, table_name, view_definition, check_option, is_updatable, is_insertable_into, is_trigger_updatable, is_trigger_deletable, is_trigger_insertable_into) VALUES ('sms', 'information_schema', 'domain_udt_usage', ' SELECT (current_database())::information_schema.sql_identifier AS udt_catalog,
(nbt.nspname)::information_schema.sql_identifier AS udt_schema,
(bt.typname)::information_schema.sql_identifier AS udt_name,
(current_database())::information_schema.sql_identifier AS domain_catalog,
(nt.nspname)::information_schema.sql_identifier AS domain_schema,
(t.typname)::information_schema.sql_identifier AS domain_name
FROM pg_type t,
pg_namespace nt,
pg_type bt,
pg_namespace nbt
WHERE ((t.typnamespace = nt.oid) AND (t.typbasetype = bt.oid) AND (bt.typnamespace = nbt.oid) AND (t.typtype = ''d''::"char") AND pg_has_role(bt.typowner, ''USAGE''::text));', 'NONE', 'NO', 'NO', 'NO', 'NO', 'NO');
INSERT INTO information_schema.views (table_catalog, table_schema, table_name, view_definition, check_option, is_updatable, is_insertable_into, is_trigger_updatable, is_trigger_deletable, is_trigger_insertable_into) VALUES ('sms', 'information_schema', 'domains', ' SELECT (current_database())::information_schema.sql_identifier AS domain_catalog,
(nt.nspname)::information_schema.sql_identifier AS domain_schema,
(t.typname)::information_schema.sql_identifier AS domain_name,
(
CASE
WHEN ((t.typelem <> (0)::oid) AND (t.typlen = ''-1''::integer)) THEN ''ARRAY''::text
WHEN (nbt.nspname = ''pg_catalog''::name) THEN format_type(t.typbasetype, NULL::integer)
ELSE ''USER-DEFINED''::text
END)::information_schema.character_data AS data_type,
(information_schema._pg_char_max_length(t.typbasetype, t.typtypmod))::information_schema.cardinal_number AS character_maximum_length,
(information_schema._pg_char_octet_length(t.typbasetype, t.typtypmod))::information_schema.cardinal_number AS character_octet_length,
(NULL::name)::information_schema.sql_identifier AS character_set_catalog,
(NULL::name)::information_schema.sql_identifier AS character_set_schema,
(NULL::name)::information_schema.sql_identifier AS character_set_name,
(
CASE
WHEN (nco.nspname IS NOT NULL) THEN current_database()
ELSE NULL::name
END)::information_schema.sql_identifier AS collation_catalog,
(nco.nspname)::information_schema.sql_identifier AS collation_schema,
(co.collname)::information_schema.sql_identifier AS collation_name,
(information_schema._pg_numeric_precision(t.typbasetype, t.typtypmod))::information_schema.cardinal_number AS numeric_precision,
(information_schema._pg_numeric_precision_radix(t.typbasetype, t.typtypmod))::information_schema.cardinal_number AS numeric_precision_radix,
(information_schema._pg_numeric_scale(t.typbasetype, t.typtypmod))::information_schema.cardinal_number AS numeric_scale,
(information_schema._pg_datetime_precision(t.typbasetype, t.typtypmod))::information_schema.cardinal_number AS datetime_precision,
(information_schema._pg_interval_type(t.typbasetype, t.typtypmod))::information_schema.character_data AS interval_type,
(NULL::integer)::information_schema.cardinal_number AS interval_precision,
(t.typdefault)::information_schema.character_data AS domain_default,
(current_database())::information_schema.sql_identifier AS udt_catalog,
(nbt.nspname)::information_schema.sql_identifier AS udt_schema,
(bt.typname)::information_schema.sql_identifier AS udt_name,
(NULL::name)::information_schema.sql_identifier AS scope_catalog,
(NULL::name)::information_schema.sql_identifier AS scope_schema,
(NULL::name)::information_schema.sql_identifier AS scope_name,
(NULL::integer)::information_schema.cardinal_number AS maximum_cardinality,
(1)::information_schema.sql_identifier AS dtd_identifier
FROM (((pg_type t
JOIN pg_namespace nt ON ((t.typnamespace = nt.oid)))
JOIN (pg_type bt
JOIN pg_namespace nbt ON ((bt.typnamespace = nbt.oid))) ON (((t.typbasetype = bt.oid) AND (t.typtype = ''d''::"char"))))
LEFT JOIN (pg_collation co
JOIN pg_namespace nco ON ((co.collnamespace = nco.oid))) ON (((t.typcollation = co.oid) AND ((nco.nspname <> ''pg_catalog''::name) OR (co.collname <> ''default''::name)))))
WHERE (pg_has_role(t.typowner, ''USAGE''::text) OR has_type_privilege(t.oid, ''USAGE''::text));', 'NONE', 'NO', 'NO', 'NO', 'NO', 'NO');
INSERT INTO information_schema.views (table_catalog, table_schema, table_name, view_definition, check_option, is_updatable, is_insertable_into, is_trigger_updatable, is_trigger_deletable, is_trigger_insertable_into) VALUES ('sms', 'information_schema', 'enabled_roles', ' SELECT (a.rolname)::information_schema.sql_identifier AS role_name
FROM pg_authid a
WHERE pg_has_role(a.oid, ''USAGE''::text);', 'NONE', 'NO', 'NO', 'NO', 'NO', 'NO');
INSERT INTO information_schema.views (table_catalog, table_schema, table_name, view_definition, check_option, is_updatable, is_insertable_into, is_trigger_updatable, is_trigger_deletable, is_trigger_insertable_into) VALUES ('sms', 'information_schema', 'key_column_usage', ' SELECT (current_database())::information_schema.sql_identifier AS constraint_catalog,
(ss.nc_nspname)::information_schema.sql_identifier AS constraint_schema,
(ss.conname)::information_schema.sql_identifier AS constraint_name,
(current_database())::information_schema.sql_identifier AS table_catalog,
(ss.nr_nspname)::information_schema.sql_identifier AS table_schema,
(ss.relname)::information_schema.sql_identifier AS table_name,
(a.attname)::information_schema.sql_identifier AS column_name,
((ss.x).n)::information_schema.cardinal_number AS ordinal_position,
(
CASE
WHEN (ss.contype = ''f''::"char") THEN information_schema._pg_index_position(ss.conindid, ss.confkey[(ss.x).n])
ELSE NULL::integer
END)::information_schema.cardinal_number AS position_in_unique_constraint
FROM pg_attribute a,
( SELECT r.oid AS roid,
r.relname,
r.relowner,
nc.nspname AS nc_nspname,
nr.nspname AS nr_nspname,
c.oid AS coid,
c.conname,
c.contype,
c.conindid,
c.confkey,
c.confrelid,
information_schema._pg_expandarray(c.conkey) AS x
FROM pg_namespace nr,
pg_class r,
pg_namespace nc,
pg_constraint c
WHERE ((nr.oid = r.relnamespace) AND (r.oid = c.conrelid) AND (nc.oid = c.connamespace) AND (c.contype = ANY (ARRAY[''p''::"char", ''u''::"char", ''f''::"char"])) AND (r.relkind = ANY (ARRAY[''r''::"char", ''p''::"char"])) AND (NOT pg_is_other_temp_schema(nr.oid)))) ss
WHERE ((ss.roid = a.attrelid) AND (a.attnum = (ss.x).x) AND (NOT a.attisdropped) AND (pg_has_role(ss.relowner, ''USAGE''::text) OR has_column_privilege(ss.roid, a.attnum, ''SELECT, INSERT, UPDATE, REFERENCES''::text)));', 'NONE', 'NO', 'NO', 'NO', 'NO', 'NO');
INSERT INTO information_schema.views (table_catalog, table_schema, table_name, view_definition, check_option, is_updatable, is_insertable_into, is_trigger_updatable, is_trigger_deletable, is_trigger_insertable_into) VALUES ('sms', 'information_schema', 'parameters', ' SELECT (current_database())::information_schema.sql_identifier AS specific_catalog,
(ss.n_nspname)::information_schema.sql_identifier AS specific_schema,
(nameconcatoid(ss.proname, ss.p_oid))::information_schema.sql_identifier AS specific_name,
((ss.x).n)::information_schema.cardinal_number AS ordinal_position,
(
CASE
WHEN (ss.proargmodes IS NULL) THEN ''IN''::text
WHEN (ss.proargmodes[(ss.x).n] = ''i''::"char") THEN ''IN''::text
WHEN (ss.proargmodes[(ss.x).n] = ''o''::"char") THEN ''OUT''::text
WHEN (ss.proargmodes[(ss.x).n] = ''b''::"char") THEN ''INOUT''::text
WHEN (ss.proargmodes[(ss.x).n] = ''v''::"char") THEN ''IN''::text
WHEN (ss.proargmodes[(ss.x).n] = ''t''::"char") THEN ''OUT''::text
ELSE NULL::text
END)::information_schema.character_data AS parameter_mode,
(''NO''::character varying)::information_schema.yes_or_no AS is_result,
(''NO''::character varying)::information_schema.yes_or_no AS as_locator,
(NULLIF(ss.proargnames[(ss.x).n], ''''::text))::information_schema.sql_identifier AS parameter_name,
(
CASE
WHEN ((t.typelem <> (0)::oid) AND (t.typlen = ''-1''::integer)) THEN ''ARRAY''::text
WHEN (nt.nspname = ''pg_catalog''::name) THEN format_type(t.oid, NULL::integer)
ELSE ''USER-DEFINED''::text
END)::information_schema.character_data AS data_type,
(NULL::integer)::information_schema.cardinal_number AS character_maximum_length,
(NULL::integer)::information_schema.cardinal_number AS character_octet_length,
(NULL::name)::information_schema.sql_identifier AS character_set_catalog,
(NULL::name)::information_schema.sql_identifier AS character_set_schema,
(NULL::name)::information_schema.sql_identifier AS character_set_name,
(NULL::name)::information_schema.sql_identifier AS collation_catalog,
(NULL::name)::information_schema.sql_identifier AS collation_schema,
(NULL::name)::information_schema.sql_identifier AS collation_name,
(NULL::integer)::information_schema.cardinal_number AS numeric_precision,
(NULL::integer)::information_schema.cardinal_number AS numeric_precision_radix,
(NULL::integer)::information_schema.cardinal_number AS numeric_scale,
(NULL::integer)::information_schema.cardinal_number AS datetime_precision,
(NULL::character varying)::information_schema.character_data AS interval_type,
(NULL::integer)::information_schema.cardinal_number AS interval_precision,
(current_database())::information_schema.sql_identifier AS udt_catalog,
(nt.nspname)::information_schema.sql_identifier AS udt_schema,
(t.typname)::information_schema.sql_identifier AS udt_name,
(NULL::name)::information_schema.sql_identifier AS scope_catalog,
(NULL::name)::information_schema.sql_identifier AS scope_schema,
(NULL::name)::information_schema.sql_identifier AS scope_name,
(NULL::integer)::information_schema.cardinal_number AS maximum_cardinality,
((ss.x).n)::information_schema.sql_identifier AS dtd_identifier,
(
CASE
WHEN pg_has_role(ss.proowner, ''USAGE''::text) THEN pg_get_function_arg_default(ss.p_oid, (ss.x).n)
ELSE NULL::text
END)::information_schema.character_data AS parameter_default
FROM pg_type t,
pg_namespace nt,
( SELECT n.nspname AS n_nspname,
p.proname,
p.oid AS p_oid,
p.proowner,
p.proargnames,
p.proargmodes,
information_schema._pg_expandarray(COALESCE(p.proallargtypes, (p.proargtypes)::oid[])) AS x
FROM pg_namespace n,
pg_proc p
WHERE ((n.oid = p.pronamespace) AND (pg_has_role(p.proowner, ''USAGE''::text) OR has_function_privilege(p.oid, ''EXECUTE''::text)))) ss
WHERE ((t.oid = (ss.x).x) AND (t.typnamespace = nt.oid));', 'NONE', 'NO', 'NO', 'NO', 'NO', 'NO');
INSERT INTO information_schema.views (table_catalog, table_schema, table_name, view_definition, check_option, is_updatable, is_insertable_into, is_trigger_updatable, is_trigger_deletable, is_trigger_insertable_into) VALUES ('sms', 'information_schema', 'referential_constraints', ' SELECT (current_database())::information_schema.sql_identifier AS constraint_catalog,
(ncon.nspname)::information_schema.sql_identifier AS constraint_schema,
(con.conname)::information_schema.sql_identifier AS constraint_name,
(
CASE
WHEN (npkc.nspname IS NULL) THEN NULL::name
ELSE current_database()
END)::information_schema.sql_identifier AS unique_constraint_catalog,
(npkc.nspname)::information_schema.sql_identifier AS unique_constraint_schema,
(pkc.conname)::information_schema.sql_identifier AS unique_constraint_name,
(
CASE con.confmatchtype
WHEN ''f''::"char" THEN ''FULL''::text
WHEN ''p''::"char" THEN ''PARTIAL''::text
WHEN ''s''::"char" THEN ''NONE''::text
ELSE NULL::text
END)::information_schema.character_data AS match_option,
(
CASE con.confupdtype
WHEN ''c''::"char" THEN ''CASCADE''::text
WHEN ''n''::"char" THEN ''SET NULL''::text
WHEN ''d''::"char" THEN ''SET DEFAULT''::text
WHEN ''r''::"char" THEN ''RESTRICT''::text
WHEN ''a''::"char" THEN ''NO ACTION''::text
ELSE NULL::text
END)::information_schema.character_data AS update_rule,
(
CASE con.confdeltype
WHEN ''c''::"char" THEN ''CASCADE''::text
WHEN ''n''::"char" THEN ''SET NULL''::text
WHEN ''d''::"char" THEN ''SET DEFAULT''::text
WHEN ''r''::"char" THEN ''RESTRICT''::text
WHEN ''a''::"char" THEN ''NO ACTION''::text
ELSE NULL::text
END)::information_schema.character_data AS delete_rule
FROM ((((((pg_namespace ncon
JOIN pg_constraint con ON ((ncon.oid = con.connamespace)))
JOIN pg_class c ON (((con.conrelid = c.oid) AND (con.contype = ''f''::"char"))))
LEFT JOIN pg_depend d1 ON (((d1.objid = con.oid) AND (d1.classid = (''pg_constraint''::regclass)::oid) AND (d1.refclassid = (''pg_class''::regclass)::oid) AND (d1.refobjsubid = 0))))
LEFT JOIN pg_depend d2 ON (((d2.refclassid = (''pg_constraint''::regclass)::oid) AND (d2.classid = (''pg_class''::regclass)::oid) AND (d2.objid = d1.refobjid) AND (d2.objsubid = 0) AND (d2.deptype = ''i''::"char"))))
LEFT JOIN pg_constraint pkc ON (((pkc.oid = d2.refobjid) AND (pkc.contype = ANY (ARRAY[''p''::"char", ''u''::"char"])) AND (pkc.conrelid = con.confrelid))))
LEFT JOIN pg_namespace npkc ON ((pkc.connamespace = npkc.oid)))
WHERE (pg_has_role(c.relowner, ''USAGE''::text) OR has_table_privilege(c.oid, ''INSERT, UPDATE, DELETE, TRUNCATE, REFERENCES, TRIGGER''::text) OR has_any_column_privilege(c.oid, ''INSERT, UPDATE, REFERENCES''::text));', 'NONE', 'NO', 'NO', 'NO', 'NO', 'NO');
INSERT INTO information_schema.views (table_catalog, table_schema, table_name, view_definition, check_option, is_updatable, is_insertable_into, is_trigger_updatable, is_trigger_deletable, is_trigger_insertable_into) VALUES ('sms', 'information_schema', 'role_column_grants', ' SELECT column_privileges.grantor,
column_privileges.grantee,
column_privileges.table_catalog,
column_privileges.table_schema,
column_privileges.table_name,
column_privileges.column_name,
column_privileges.privilege_type,
column_privileges.is_grantable
FROM information_schema.column_privileges
WHERE (((column_privileges.grantor)::name IN ( SELECT enabled_roles.role_name
FROM information_schema.enabled_roles)) OR ((column_privileges.grantee)::name IN ( SELECT enabled_roles.role_name
FROM information_schema.enabled_roles)));', 'NONE', 'NO', 'NO', 'NO', 'NO', 'NO');
INSERT INTO information_schema.views (table_catalog, table_schema, table_name, view_definition, check_option, is_updatable, is_insertable_into, is_trigger_updatable, is_trigger_deletable, is_trigger_insertable_into) VALUES ('sms', 'information_schema', 'routine_privileges', ' SELECT (u_grantor.rolname)::information_schema.sql_identifier AS grantor,
(grantee.rolname)::information_schema.sql_identifier AS grantee,
(current_database())::information_schema.sql_identifier AS specific_catalog,
(n.nspname)::information_schema.sql_identifier AS specific_schema,
(nameconcatoid(p.proname, p.oid))::information_schema.sql_identifier AS specific_name,
(current_database())::information_schema.sql_identifier AS routine_catalog,
(n.nspname)::information_schema.sql_identifier AS routine_schema,
(p.proname)::information_schema.sql_identifier AS routine_name,
(''EXECUTE''::character varying)::information_schema.character_data AS privilege_type,
(
CASE
WHEN (pg_has_role(grantee.oid, p.proowner, ''USAGE''::text) OR p.grantable) THEN ''YES''::text
ELSE ''NO''::text
END)::information_schema.yes_or_no AS is_grantable
FROM ( SELECT pg_proc.oid,
pg_proc.proname,
pg_proc.proowner,
pg_proc.pronamespace,
(aclexplode(COALESCE(pg_proc.proacl, acldefault(''f''::"char", pg_proc.proowner)))).grantor AS grantor,
(aclexplode(COALESCE(pg_proc.proacl, acldefault(''f''::"char", pg_proc.proowner)))).grantee AS grantee,
(aclexplode(COALESCE(pg_proc.proacl, acldefault(''f''::"char", pg_proc.proowner)))).privilege_type AS privilege_type,
(aclexplode(COALESCE(pg_proc.proacl, acldefault(''f''::"char", pg_proc.proowner)))).is_grantable AS is_grantable
FROM pg_proc) p(oid, proname, proowner, pronamespace, grantor, grantee, prtype, grantable),
pg_namespace n,
pg_authid u_grantor,
( SELECT pg_authid.oid,
pg_authid.rolname
FROM pg_authid
UNION ALL
SELECT (0)::oid AS oid,
''PUBLIC''::name) grantee(oid, rolname)
WHERE ((p.pronamespace = n.oid) AND (grantee.oid = p.grantee) AND (u_grantor.oid = p.grantor) AND (p.prtype = ''EXECUTE''::text) AND (pg_has_role(u_grantor.oid, ''USAGE''::text) OR pg_has_role(grantee.oid, ''USAGE''::text) OR (grantee.rolname = ''PUBLIC''::name)));', 'NONE', 'NO', 'NO', 'NO', 'NO', 'NO');
INSERT INTO information_schema.views (table_catalog, table_schema, table_name, view_definition, check_option, is_updatable, is_insertable_into, is_trigger_updatable, is_trigger_deletable, is_trigger_insertable_into) VALUES ('sms', 'information_schema', 'role_routine_grants', ' SELECT routine_privileges.grantor,
routine_privileges.grantee,
routine_privileges.specific_catalog,
routine_privileges.specific_schema,
routine_privileges.specific_name,
routine_privileges.routine_catalog,
routine_privileges.routine_schema,
routine_privileges.routine_name,
routine_privileges.privilege_type,
routine_privileges.is_grantable
FROM information_schema.routine_privileges
WHERE (((routine_privileges.grantor)::name IN ( SELECT enabled_roles.role_name
FROM information_schema.enabled_roles)) OR ((routine_privileges.grantee)::name IN ( SELECT enabled_roles.role_name
FROM information_schema.enabled_roles)));', 'NONE', 'NO', 'NO', 'NO', 'NO', 'NO');
INSERT INTO information_schema.views (table_catalog, table_schema, table_name, view_definition, check_option, is_updatable, is_insertable_into, is_trigger_updatable, is_trigger_deletable, is_trigger_insertable_into) VALUES ('sms', 'information_schema', 'routines', ' SELECT (current_database())::information_schema.sql_identifier AS specific_catalog,
(n.nspname)::information_schema.sql_identifier AS specific_schema,
(nameconcatoid(p.proname, p.oid))::information_schema.sql_identifier AS specific_name,
(current_database())::information_schema.sql_identifier AS routine_catalog,
(n.nspname)::information_schema.sql_identifier AS routine_schema,
(p.proname)::information_schema.sql_identifier AS routine_name,
(
CASE p.prokind
WHEN ''f''::"char" THEN ''FUNCTION''::text
WHEN ''p''::"char" THEN ''PROCEDURE''::text
ELSE NULL::text
END)::information_schema.character_data AS routine_type,
(NULL::name)::information_schema.sql_identifier AS module_catalog,
(NULL::name)::information_schema.sql_identifier AS module_schema,
(NULL::name)::information_schema.sql_identifier AS module_name,
(NULL::name)::information_schema.sql_identifier AS udt_catalog,
(NULL::name)::information_schema.sql_identifier AS udt_schema,
(NULL::name)::information_schema.sql_identifier AS udt_name,
(
CASE
WHEN (p.prokind = ''p''::"char") THEN NULL::text
WHEN ((t.typelem <> (0)::oid) AND (t.typlen = ''-1''::integer)) THEN ''ARRAY''::text
WHEN (nt.nspname = ''pg_catalog''::name) THEN format_type(t.oid, NULL::integer)
ELSE ''USER-DEFINED''::text
END)::information_schema.character_data AS data_type,
(NULL::integer)::information_schema.cardinal_number AS character_maximum_length,
(NULL::integer)::information_schema.cardinal_number AS character_octet_length,
(NULL::name)::information_schema.sql_identifier AS character_set_catalog,
(NULL::name)::information_schema.sql_identifier AS character_set_schema,
(NULL::name)::information_schema.sql_identifier AS character_set_name,
(NULL::name)::information_schema.sql_identifier AS collation_catalog,
(NULL::name)::information_schema.sql_identifier AS collation_schema,
(NULL::name)::information_schema.sql_identifier AS collation_name,
(NULL::integer)::information_schema.cardinal_number AS numeric_precision,
(NULL::integer)::information_schema.cardinal_number AS numeric_precision_radix,
(NULL::integer)::information_schema.cardinal_number AS numeric_scale,
(NULL::integer)::information_schema.cardinal_number AS datetime_precision,
(NULL::character varying)::information_schema.character_data AS interval_type,
(NULL::integer)::information_schema.cardinal_number AS interval_precision,
(
CASE
WHEN (nt.nspname IS NOT NULL) THEN current_database()
ELSE NULL::name
END)::information_schema.sql_identifier AS type_udt_catalog,
(nt.nspname)::information_schema.sql_identifier AS type_udt_schema,
(t.typname)::information_schema.sql_identifier AS type_udt_name,
(NULL::name)::information_schema.sql_identifier AS scope_catalog,
(NULL::name)::information_schema.sql_identifier AS scope_schema,
(NULL::name)::information_schema.sql_identifier AS scope_name,
(NULL::integer)::information_schema.cardinal_number AS maximum_cardinality,
(
CASE
WHEN (p.prokind <> ''p''::"char") THEN 0
ELSE NULL::integer
END)::information_schema.sql_identifier AS dtd_identifier,
(
CASE
WHEN (l.lanname = ''sql''::name) THEN ''SQL''::text
ELSE ''EXTERNAL''::text
END)::information_schema.character_data AS routine_body,
(
CASE
WHEN pg_has_role(p.proowner, ''USAGE''::text) THEN p.prosrc
ELSE NULL::text
END)::information_schema.character_data AS routine_definition,
(
CASE
WHEN (l.lanname = ''c''::name) THEN p.prosrc
ELSE NULL::text
END)::information_schema.character_data AS external_name,
(upper((l.lanname)::text))::information_schema.character_data AS external_language,
(''GENERAL''::character varying)::information_schema.character_data AS parameter_style,
(
CASE
WHEN (p.provolatile = ''i''::"char") THEN ''YES''::text
ELSE ''NO''::text
END)::information_schema.yes_or_no AS is_deterministic,
(''MODIFIES''::character varying)::information_schema.character_data AS sql_data_access,
(
CASE
WHEN (p.prokind <> ''p''::"char") THEN
CASE
WHEN p.proisstrict THEN ''YES''::text
ELSE ''NO''::text
END
ELSE NULL::text
END)::information_schema.yes_or_no AS is_null_call,
(NULL::character varying)::information_schema.character_data AS sql_path,
(''YES''::character varying)::information_schema.yes_or_no AS schema_level_routine,
(0)::information_schema.cardinal_number AS max_dynamic_result_sets,
(NULL::character varying)::information_schema.yes_or_no AS is_user_defined_cast,
(NULL::character varying)::information_schema.yes_or_no AS is_implicitly_invocable,
(
CASE
WHEN p.prosecdef THEN ''DEFINER''::text
ELSE ''INVOKER''::text
END)::information_schema.character_data AS security_type,
(NULL::name)::information_schema.sql_identifier AS to_sql_specific_catalog,
(NULL::name)::information_schema.sql_identifier AS to_sql_specific_schema,
(NULL::name)::information_schema.sql_identifier AS to_sql_specific_name,
(''NO''::character varying)::information_schema.yes_or_no AS as_locator,
(NULL::timestamp with time zone)::information_schema.time_stamp AS created,
(NULL::timestamp with time zone)::information_schema.time_stamp AS last_altered,
(NULL::character varying)::information_schema.yes_or_no AS new_savepoint_level,
(''NO''::character varying)::information_schema.yes_or_no AS is_udt_dependent,
(NULL::character varying)::information_schema.character_data AS result_cast_from_data_type,
(NULL::character varying)::information_schema.yes_or_no AS result_cast_as_locator,
(NULL::integer)::information_schema.cardinal_number AS result_cast_char_max_length,
(NULL::integer)::information_schema.cardinal_number AS result_cast_char_octet_length,
(NULL::name)::information_schema.sql_identifier AS result_cast_char_set_catalog,
(NULL::name)::information_schema.sql_identifier AS result_cast_char_set_schema,
(NULL::name)::information_schema.sql_identifier AS result_cast_char_set_name,
(NULL::name)::information_schema.sql_identifier AS result_cast_collation_catalog,
(NULL::name)::information_schema.sql_identifier AS result_cast_collation_schema,
(NULL::name)::information_schema.sql_identifier AS result_cast_collation_name,
(NULL::integer)::information_schema.cardinal_number AS result_cast_numeric_precision,
(NULL::integer)::information_schema.cardinal_number AS result_cast_numeric_precision_radix,
(NULL::integer)::information_schema.cardinal_number AS result_cast_numeric_scale,
(NULL::integer)::information_schema.cardinal_number AS result_cast_datetime_precision,
(NULL::character varying)::information_schema.character_data AS result_cast_interval_type,
(NULL::integer)::information_schema.cardinal_number AS result_cast_interval_precision,
(NULL::name)::information_schema.sql_identifier AS result_cast_type_udt_catalog,
(NULL::name)::information_schema.sql_identifier AS result_cast_type_udt_schema,
(NULL::name)::information_schema.sql_identifier AS result_cast_type_udt_name,
(NULL::name)::information_schema.sql_identifier AS result_cast_scope_catalog,
(NULL::name)::information_schema.sql_identifier AS result_cast_scope_schema,
(NULL::name)::information_schema.sql_identifier AS result_cast_scope_name,
(NULL::integer)::information_schema.cardinal_number AS result_cast_maximum_cardinality,
(NULL::name)::information_schema.sql_identifier AS result_cast_dtd_identifier
FROM (((pg_namespace n
JOIN pg_proc p ON ((n.oid = p.pronamespace)))
JOIN pg_language l ON ((p.prolang = l.oid)))
LEFT JOIN (pg_type t
JOIN pg_namespace nt ON ((t.typnamespace = nt.oid))) ON (((p.prorettype = t.oid) AND (p.prokind <> ''p''::"char"))))
WHERE (pg_has_role(p.proowner, ''USAGE''::text) OR has_function_privilege(p.oid, ''EXECUTE''::text));', 'NONE', 'NO', 'NO', 'NO', 'NO', 'NO');
INSERT INTO information_schema.views (table_catalog, table_schema, table_name, view_definition, check_option, is_updatable, is_insertable_into, is_trigger_updatable, is_trigger_deletable, is_trigger_insertable_into) VALUES ('sms', 'information_schema', 'schemata', ' SELECT (current_database())::information_schema.sql_identifier AS catalog_name,
(n.nspname)::information_schema.sql_identifier AS schema_name,
(u.rolname)::information_schema.sql_identifier AS schema_owner,
(NULL::name)::information_schema.sql_identifier AS default_character_set_catalog,
(NULL::name)::information_schema.sql_identifier AS default_character_set_schema,
(NULL::name)::information_schema.sql_identifier AS default_character_set_name,
(NULL::character varying)::information_schema.character_data AS sql_path
FROM pg_namespace n,
pg_authid u
WHERE ((n.nspowner = u.oid) AND (pg_has_role(n.nspowner, ''USAGE''::text) OR has_schema_privilege(n.oid, ''CREATE, USAGE''::text)));', 'NONE', 'NO', 'NO', 'NO', 'NO', 'NO');
INSERT INTO information_schema.views (table_catalog, table_schema, table_name, view_definition, check_option, is_updatable, is_insertable_into, is_trigger_updatable, is_trigger_deletable, is_trigger_insertable_into) VALUES ('sms', 'information_schema', 'tables', ' SELECT (current_database())::information_schema.sql_identifier AS table_catalog,
(nc.nspname)::information_schema.sql_identifier AS table_schema,
(c.relname)::information_schema.sql_identifier AS table_name,
(
CASE
WHEN (nc.oid = pg_my_temp_schema()) THEN ''LOCAL TEMPORARY''::text
WHEN (c.relkind = ANY (ARRAY[''r''::"char", ''p''::"char"])) THEN ''BASE TABLE''::text
WHEN (c.relkind = ''v''::"char") THEN ''VIEW''::text
WHEN (c.relkind = ''f''::"char") THEN ''FOREIGN''::text
ELSE NULL::text
END)::information_schema.character_data AS table_type,
(NULL::name)::information_schema.sql_identifier AS self_referencing_column_name,
(NULL::character varying)::information_schema.character_data AS reference_generation,
(
CASE
WHEN (t.typname IS NOT NULL) THEN current_database()
ELSE NULL::name
END)::information_schema.sql_identifier AS user_defined_type_catalog,
(nt.nspname)::information_schema.sql_identifier AS user_defined_type_schema,
(t.typname)::information_schema.sql_identifier AS user_defined_type_name,
(
CASE
WHEN ((c.relkind = ANY (ARRAY[''r''::"char", ''p''::"char"])) OR ((c.relkind = ANY (ARRAY[''v''::"char", ''f''::"char"])) AND ((pg_relation_is_updatable((c.oid)::regclass, false) & 8) = 8))) THEN ''YES''::text
ELSE ''NO''::text
END)::information_schema.yes_or_no AS is_insertable_into,
(
CASE
WHEN (t.typname IS NOT NULL) THEN ''YES''::text
ELSE ''NO''::text
END)::information_schema.yes_or_no AS is_typed,
(NULL::character varying)::information_schema.character_data AS commit_action
FROM ((pg_namespace nc
JOIN pg_class c ON ((nc.oid = c.relnamespace)))
LEFT JOIN (pg_type t
JOIN pg_namespace nt ON ((t.typnamespace = nt.oid))) ON ((c.reloftype = t.oid)))
WHERE ((c.relkind = ANY (ARRAY[''r''::"char", ''v''::"char", ''f''::"char", ''p''::"char"])) AND (NOT pg_is_other_temp_schema(nc.oid)) AND (pg_has_role(c.relowner, ''USAGE''::text) OR has_table_privilege(c.oid, ''SELECT, INSERT, UPDATE, DELETE, TRUNCATE, REFERENCES, TRIGGER''::text) OR has_any_column_privilege(c.oid, ''SELECT, INSERT, UPDATE, REFERENCES''::text)));', 'NONE', 'NO', 'NO', 'NO', 'NO', 'NO');
INSERT INTO information_schema.views (table_catalog, table_schema, table_name, view_definition, check_option, is_updatable, is_insertable_into, is_trigger_updatable, is_trigger_deletable, is_trigger_insertable_into) VALUES ('sms', 'information_schema', 'sequences', ' SELECT (current_database())::information_schema.sql_identifier AS sequence_catalog,
(nc.nspname)::information_schema.sql_identifier AS sequence_schema,
(c.relname)::information_schema.sql_identifier AS sequence_name,
(format_type(s.seqtypid, NULL::integer))::information_schema.character_data AS data_type,
(information_schema._pg_numeric_precision(s.seqtypid, ''-1''::integer))::information_schema.cardinal_number AS numeric_precision,
(2)::information_schema.cardinal_number AS numeric_precision_radix,
(0)::information_schema.cardinal_number AS numeric_scale,
(s.seqstart)::information_schema.character_data AS start_value,
(s.seqmin)::information_schema.character_data AS minimum_value,
(s.seqmax)::information_schema.character_data AS maximum_value,
(s.seqincrement)::information_schema.character_data AS increment,
(
CASE
WHEN s.seqcycle THEN ''YES''::text
ELSE ''NO''::text
END)::information_schema.yes_or_no AS cycle_option
FROM pg_namespace nc,
pg_class c,
pg_sequence s
WHERE ((c.relnamespace = nc.oid) AND (c.relkind = ''S''::"char") AND (NOT (EXISTS ( SELECT 1
FROM pg_depend
WHERE ((pg_depend.classid = (''pg_class''::regclass)::oid) AND (pg_depend.objid = c.oid) AND (pg_depend.deptype = ''i''::"char"))))) AND (NOT pg_is_other_temp_schema(nc.oid)) AND (c.oid = s.seqrelid) AND (pg_has_role(c.relowner, ''USAGE''::text) OR has_sequence_privilege(c.oid, ''SELECT, UPDATE, USAGE''::text)));', 'NONE', 'NO', 'NO', 'NO', 'NO', 'NO');
INSERT INTO information_schema.views (table_catalog, table_schema, table_name, view_definition, check_option, is_updatable, is_insertable_into, is_trigger_updatable, is_trigger_deletable, is_trigger_insertable_into) VALUES ('sms', 'information_schema', 'table_constraints', ' SELECT (current_database())::information_schema.sql_identifier AS constraint_catalog,
(nc.nspname)::information_schema.sql_identifier AS constraint_schema,
(c.conname)::information_schema.sql_identifier AS constraint_name,
(current_database())::information_schema.sql_identifier AS table_catalog,
(nr.nspname)::information_schema.sql_identifier AS table_schema,
(r.relname)::information_schema.sql_identifier AS table_name,
(
CASE c.contype
WHEN ''c''::"char" THEN ''CHECK''::text
WHEN ''f''::"char" THEN ''FOREIGN KEY''::text
WHEN ''p''::"char" THEN ''PRIMARY KEY''::text
WHEN ''u''::"char" THEN ''UNIQUE''::text
ELSE NULL::text
END)::information_schema.character_data AS constraint_type,
(
CASE
WHEN c.condeferrable THEN ''YES''::text
ELSE ''NO''::text
END)::information_schema.yes_or_no AS is_deferrable,
(
CASE
WHEN c.condeferred THEN ''YES''::text
ELSE ''NO''::text
END)::information_schema.yes_or_no AS initially_deferred,
(''YES''::character varying)::information_schema.yes_or_no AS enforced
FROM pg_namespace nc,
pg_namespace nr,
pg_constraint c,
pg_class r
WHERE ((nc.oid = c.connamespace) AND (nr.oid = r.relnamespace) AND (c.conrelid = r.oid) AND (c.contype <> ALL (ARRAY[''t''::"char", ''x''::"char"])) AND (r.relkind = ANY (ARRAY[''r''::"char", ''p''::"char"])) AND (NOT pg_is_other_temp_schema(nr.oid)) AND (pg_has_role(r.relowner, ''USAGE''::text) OR has_table_privilege(r.oid, ''INSERT, UPDATE, DELETE, TRUNCATE, REFERENCES, TRIGGER''::text) OR has_any_column_privilege(r.oid, ''INSERT, UPDATE, REFERENCES''::text)))
UNION ALL
SELECT (current_database())::information_schema.sql_identifier AS constraint_catalog,
(nr.nspname)::information_schema.sql_identifier AS constraint_schema,
(((((((nr.oid)::text || ''_''::text) || (r.oid)::text) || ''_''::text) || (a.attnum)::text) || ''_not_null''::text))::information_schema.sql_identifier AS constraint_name,
(current_database())::information_schema.sql_identifier AS table_catalog,
(nr.nspname)::information_schema.sql_identifier AS table_schema,
(r.relname)::information_schema.sql_identifier AS table_name,
(''CHECK''::character varying)::information_schema.character_data AS constraint_type,
(''NO''::character varying)::information_schema.yes_or_no AS is_deferrable,
(''NO''::character varying)::information_schema.yes_or_no AS initially_deferred,
(''YES''::character varying)::information_schema.yes_or_no AS enforced
FROM pg_namespace nr,
pg_class r,
pg_attribute a
WHERE ((nr.oid = r.relnamespace) AND (r.oid = a.attrelid) AND a.attnotnull AND (a.attnum > 0) AND (NOT a.attisdropped) AND (r.relkind = ANY (ARRAY[''r''::"char", ''p''::"char"])) AND (NOT pg_is_other_temp_schema(nr.oid)) AND (pg_has_role(r.relowner, ''USAGE''::text) OR has_table_privilege(r.oid, ''INSERT, UPDATE, DELETE, TRUNCATE, REFERENCES, TRIGGER''::text) OR has_any_column_privilege(r.oid, ''INSERT, UPDATE, REFERENCES''::text)));', 'NONE', 'NO', 'NO', 'NO', 'NO', 'NO');
INSERT INTO information_schema.views (table_catalog, table_schema, table_name, view_definition, check_option, is_updatable, is_insertable_into, is_trigger_updatable, is_trigger_deletable, is_trigger_insertable_into) VALUES ('sms', 'information_schema', 'transforms', ' SELECT (current_database())::information_schema.sql_identifier AS udt_catalog,
(nt.nspname)::information_schema.sql_identifier AS udt_schema,
(t.typname)::information_schema.sql_identifier AS udt_name,
(current_database())::information_schema.sql_identifier AS specific_catalog,
(np.nspname)::information_schema.sql_identifier AS specific_schema,
(nameconcatoid(p.proname, p.oid))::information_schema.sql_identifier AS specific_name,
(l.lanname)::information_schema.sql_identifier AS group_name,
(''FROM SQL''::character varying)::information_schema.character_data AS transform_type
FROM (((((pg_type t
JOIN pg_transform x ON ((t.oid = x.trftype)))
JOIN pg_language l ON ((x.trflang = l.oid)))
JOIN pg_proc p ON (((x.trffromsql)::oid = p.oid)))
JOIN pg_namespace nt ON ((t.typnamespace = nt.oid)))
JOIN pg_namespace np ON ((p.pronamespace = np.oid)))
UNION
SELECT (current_database())::information_schema.sql_identifier AS udt_catalog,
(nt.nspname)::information_schema.sql_identifier AS udt_schema,
(t.typname)::information_schema.sql_identifier AS udt_name,
(current_database())::information_schema.sql_identifier AS specific_catalog,
(np.nspname)::information_schema.sql_identifier AS specific_schema,
(nameconcatoid(p.proname, p.oid))::information_schema.sql_identifier AS specific_name,
(l.lanname)::information_schema.sql_identifier AS group_name,
(''TO SQL''::character varying)::information_schema.character_data AS transform_type
FROM (((((pg_type t
JOIN pg_transform x ON ((t.oid = x.trftype)))
JOIN pg_language l ON ((x.trflang = l.oid)))
JOIN pg_proc p ON (((x.trftosql)::oid = p.oid)))
JOIN pg_namespace nt ON ((t.typnamespace = nt.oid)))
JOIN pg_namespace np ON ((p.pronamespace = np.oid)))
ORDER BY 1, 2, 3, 7, 8;', 'NONE', 'NO', 'NO', 'NO', 'NO', 'NO');
INSERT INTO information_schema.views (table_catalog, table_schema, table_name, view_definition, check_option, is_updatable, is_insertable_into, is_trigger_updatable, is_trigger_deletable, is_trigger_insertable_into) VALUES ('sms', 'information_schema', 'table_privileges', ' SELECT (u_grantor.rolname)::information_schema.sql_identifier AS grantor,
(grantee.rolname)::information_schema.sql_identifier AS grantee,
(current_database())::information_schema.sql_identifier AS table_catalog,
(nc.nspname)::information_schema.sql_identifier AS table_schema,
(c.relname)::information_schema.sql_identifier AS table_name,
(c.prtype)::information_schema.character_data AS privilege_type,
(
CASE
WHEN (pg_has_role(grantee.oid, c.relowner, ''USAGE''::text) OR c.grantable) THEN ''YES''::text
ELSE ''NO''::text
END)::information_schema.yes_or_no AS is_grantable,
(
CASE
WHEN (c.prtype = ''SELECT''::text) THEN ''YES''::text
ELSE ''NO''::text
END)::information_schema.yes_or_no AS with_hierarchy
FROM ( SELECT pg_class.oid,
pg_class.relname,
pg_class.relnamespace,
pg_class.relkind,
pg_class.relowner,
(aclexplode(COALESCE(pg_class.relacl, acldefault(''r''::"char", pg_class.relowner)))).grantor AS grantor,
(aclexplode(COALESCE(pg_class.relacl, acldefault(''r''::"char", pg_class.relowner)))).grantee AS grantee,
(aclexplode(COALESCE(pg_class.relacl, acldefault(''r''::"char", pg_class.relowner)))).privilege_type AS privilege_type,
(aclexplode(COALESCE(pg_class.relacl, acldefault(''r''::"char", pg_class.relowner)))).is_grantable AS is_grantable
FROM pg_class) c(oid, relname, relnamespace, relkind, relowner, grantor, grantee, prtype, grantable),
pg_namespace nc,
pg_authid u_grantor,
( SELECT pg_authid.oid,
pg_authid.rolname
FROM pg_authid
UNION ALL
SELECT (0)::oid AS oid,
''PUBLIC''::name) grantee(oid, rolname)
WHERE ((c.relnamespace = nc.oid) AND (c.relkind = ANY (ARRAY[''r''::"char", ''v''::"char", ''f''::"char", ''p''::"char"])) AND (c.grantee = grantee.oid) AND (c.grantor = u_grantor.oid) AND (c.prtype = ANY (ARRAY[''INSERT''::text, ''SELECT''::text, ''UPDATE''::text, ''DELETE''::text, ''TRUNCATE''::text, ''REFERENCES''::text, ''TRIGGER''::text])) AND (pg_has_role(u_grantor.oid, ''USAGE''::text) OR pg_has_role(grantee.oid, ''USAGE''::text) OR (grantee.rolname = ''PUBLIC''::name)));', 'NONE', 'NO', 'NO', 'NO', 'NO', 'NO');
INSERT INTO information_schema.views (table_catalog, table_schema, table_name, view_definition, check_option, is_updatable, is_insertable_into, is_trigger_updatable, is_trigger_deletable, is_trigger_insertable_into) VALUES ('sms', 'information_schema', 'role_table_grants', ' SELECT table_privileges.grantor,
table_privileges.grantee,
table_privileges.table_catalog,
table_privileges.table_schema,
table_privileges.table_name,
table_privileges.privilege_type,
table_privileges.is_grantable,
table_privileges.with_hierarchy
FROM information_schema.table_privileges
WHERE (((table_privileges.grantor)::name IN ( SELECT enabled_roles.role_name
FROM information_schema.enabled_roles)) OR ((table_privileges.grantee)::name IN ( SELECT enabled_roles.role_name
FROM information_schema.enabled_roles)));', 'NONE', 'NO', 'NO', 'NO', 'NO', 'NO');
INSERT INTO information_schema.views (table_catalog, table_schema, table_name, view_definition, check_option, is_updatable, is_insertable_into, is_trigger_updatable, is_trigger_deletable, is_trigger_insertable_into) VALUES ('sms', 'information_schema', 'udt_privileges', ' SELECT (u_grantor.rolname)::information_schema.sql_identifier AS grantor,
(grantee.rolname)::information_schema.sql_identifier AS grantee,
(current_database())::information_schema.sql_identifier AS udt_catalog,
(n.nspname)::information_schema.sql_identifier AS udt_schema,
(t.typname)::information_schema.sql_identifier AS udt_name,
(''TYPE USAGE''::character varying)::information_schema.character_data AS privilege_type,
(
CASE
WHEN (pg_has_role(grantee.oid, t.typowner, ''USAGE''::text) OR t.grantable) THEN ''YES''::text
ELSE ''NO''::text
END)::information_schema.yes_or_no AS is_grantable
FROM ( SELECT pg_type.oid,
pg_type.typname,
pg_type.typnamespace,
pg_type.typtype,
pg_type.typowner,
(aclexplode(COALESCE(pg_type.typacl, acldefault(''T''::"char", pg_type.typowner)))).grantor AS grantor,
(aclexplode(COALESCE(pg_type.typacl, acldefault(''T''::"char", pg_type.typowner)))).grantee AS grantee,
(aclexplode(COALESCE(pg_type.typacl, acldefault(''T''::"char", pg_type.typowner)))).privilege_type AS privilege_type,
(aclexplode(COALESCE(pg_type.typacl, acldefault(''T''::"char", pg_type.typowner)))).is_grantable AS is_grantable
FROM pg_type) t(oid, typname, typnamespace, typtype, typowner, grantor, grantee, prtype, grantable),
pg_namespace n,
pg_authid u_grantor,
( SELECT pg_authid.oid,
pg_authid.rolname
FROM pg_authid
UNION ALL
SELECT (0)::oid AS oid,
''PUBLIC''::name) grantee(oid, rolname)
WHERE ((t.typnamespace = n.oid) AND (t.typtype = ''c''::"char") AND (t.grantee = grantee.oid) AND (t.grantor = u_grantor.oid) AND (t.prtype = ''USAGE''::text) AND (pg_has_role(u_grantor.oid, ''USAGE''::text) OR pg_has_role(grantee.oid, ''USAGE''::text) OR (grantee.rolname = ''PUBLIC''::name)));', 'NONE', 'NO', 'NO', 'NO', 'NO', 'NO');
INSERT INTO information_schema.views (table_catalog, table_schema, table_name, view_definition, check_option, is_updatable, is_insertable_into, is_trigger_updatable, is_trigger_deletable, is_trigger_insertable_into) VALUES ('sms', 'information_schema', 'triggered_update_columns', ' SELECT (current_database())::information_schema.sql_identifier AS trigger_catalog,
(n.nspname)::information_schema.sql_identifier AS trigger_schema,
(t.tgname)::information_schema.sql_identifier AS trigger_name,
(current_database())::information_schema.sql_identifier AS event_object_catalog,
(n.nspname)::information_schema.sql_identifier AS event_object_schema,
(c.relname)::information_schema.sql_identifier AS event_object_table,
(a.attname)::information_schema.sql_identifier AS event_object_column
FROM pg_namespace n,
pg_class c,
pg_trigger t,
( SELECT ta0.tgoid,
(ta0.tgat).x AS tgattnum,
(ta0.tgat).n AS tgattpos
FROM ( SELECT pg_trigger.oid AS tgoid,
information_schema._pg_expandarray(pg_trigger.tgattr) AS tgat
FROM pg_trigger) ta0) ta,
pg_attribute a
WHERE ((n.oid = c.relnamespace) AND (c.oid = t.tgrelid) AND (t.oid = ta.tgoid) AND ((a.attrelid = t.tgrelid) AND (a.attnum = ta.tgattnum)) AND (NOT t.tgisinternal) AND (NOT pg_is_other_temp_schema(n.oid)) AND (pg_has_role(c.relowner, ''USAGE''::text) OR has_column_privilege(c.oid, a.attnum, ''INSERT, UPDATE, REFERENCES''::text)));', 'NONE', 'NO', 'NO', 'NO', 'NO', 'NO');
INSERT INTO information_schema.views (table_catalog, table_schema, table_name, view_definition, check_option, is_updatable, is_insertable_into, is_trigger_updatable, is_trigger_deletable, is_trigger_insertable_into) VALUES ('sms', 'information_schema', 'triggers', ' SELECT (current_database())::information_schema.sql_identifier AS trigger_catalog,
(n.nspname)::information_schema.sql_identifier AS trigger_schema,
(t.tgname)::information_schema.sql_identifier AS trigger_name,
(em.text)::information_schema.character_data AS event_manipulation,
(current_database())::information_schema.sql_identifier AS event_object_catalog,
(n.nspname)::information_schema.sql_identifier AS event_object_schema,
(c.relname)::information_schema.sql_identifier AS event_object_table,
(rank() OVER (PARTITION BY (n.nspname)::information_schema.sql_identifier, (c.relname)::information_schema.sql_identifier, em.num, ((t.tgtype)::integer & 1), ((t.tgtype)::integer & 66) ORDER BY t.tgname))::information_schema.cardinal_number AS action_order,
(
CASE
WHEN pg_has_role(c.relowner, ''USAGE''::text) THEN (regexp_match(pg_get_triggerdef(t.oid), ''.{35,} WHEN \((.+)\) EXECUTE FUNCTION''::text))[1]
ELSE NULL::text
END)::information_schema.character_data AS action_condition,
("substring"(pg_get_triggerdef(t.oid), ("position"("substring"(pg_get_triggerdef(t.oid), 48), ''EXECUTE FUNCTION''::text) + 47)))::information_schema.character_data AS action_statement,
(
CASE ((t.tgtype)::integer & 1)
WHEN 1 THEN ''ROW''::text
ELSE ''STATEMENT''::text
END)::information_schema.character_data AS action_orientation,
(
CASE ((t.tgtype)::integer & 66)
WHEN 2 THEN ''BEFORE''::text
WHEN 64 THEN ''INSTEAD OF''::text
ELSE ''AFTER''::text
END)::information_schema.character_data AS action_timing,
(t.tgoldtable)::information_schema.sql_identifier AS action_reference_old_table,
(t.tgnewtable)::information_schema.sql_identifier AS action_reference_new_table,
(NULL::name)::information_schema.sql_identifier AS action_reference_old_row,
(NULL::name)::information_schema.sql_identifier AS action_reference_new_row,
(NULL::timestamp with time zone)::information_schema.time_stamp AS created
FROM pg_namespace n,
pg_class c,
pg_trigger t,
( VALUES (4,''INSERT''::text), (8,''DELETE''::text), (16,''UPDATE''::text)) em(num, text)
WHERE ((n.oid = c.relnamespace) AND (c.oid = t.tgrelid) AND (((t.tgtype)::integer & em.num) <> 0) AND (NOT t.tgisinternal) AND (NOT pg_is_other_temp_schema(n.oid)) AND (pg_has_role(c.relowner, ''USAGE''::text) OR has_table_privilege(c.oid, ''INSERT, UPDATE, DELETE, TRUNCATE, REFERENCES, TRIGGER''::text) OR has_any_column_privilege(c.oid, ''INSERT, UPDATE, REFERENCES''::text)));', 'NONE', 'NO', 'NO', 'NO', 'NO', 'NO');
INSERT INTO information_schema.views (table_catalog, table_schema, table_name, view_definition, check_option, is_updatable, is_insertable_into, is_trigger_updatable, is_trigger_deletable, is_trigger_insertable_into) VALUES ('sms', 'information_schema', 'usage_privileges', ' SELECT (u.rolname)::information_schema.sql_identifier AS grantor,
(''PUBLIC''::name)::information_schema.sql_identifier AS grantee,
(current_database())::information_schema.sql_identifier AS object_catalog,
(n.nspname)::information_schema.sql_identifier AS object_schema,
(c.collname)::information_schema.sql_identifier AS object_name,
(''COLLATION''::character varying)::information_schema.character_data AS object_type,
(''USAGE''::character varying)::information_schema.character_data AS privilege_type,
(''NO''::character varying)::information_schema.yes_or_no AS is_grantable
FROM pg_authid u,
pg_namespace n,
pg_collation c
WHERE ((u.oid = c.collowner) AND (c.collnamespace = n.oid) AND (c.collencoding = ANY (ARRAY[''-1''::integer, ( SELECT pg_database.encoding
FROM pg_database
WHERE (pg_database.datname = current_database()))])))
UNION ALL
SELECT (u_grantor.rolname)::information_schema.sql_identifier AS grantor,
(grantee.rolname)::information_schema.sql_identifier AS grantee,
(current_database())::information_schema.sql_identifier AS object_catalog,
(n.nspname)::information_schema.sql_identifier AS object_schema,
(t.typname)::information_schema.sql_identifier AS object_name,
(''DOMAIN''::character varying)::information_schema.character_data AS object_type,
(''USAGE''::character varying)::information_schema.character_data AS privilege_type,
(
CASE
WHEN (pg_has_role(grantee.oid, t.typowner, ''USAGE''::text) OR t.grantable) THEN ''YES''::text
ELSE ''NO''::text
END)::information_schema.yes_or_no AS is_grantable
FROM ( SELECT pg_type.oid,
pg_type.typname,
pg_type.typnamespace,
pg_type.typtype,
pg_type.typowner,
(aclexplode(COALESCE(pg_type.typacl, acldefault(''T''::"char", pg_type.typowner)))).grantor AS grantor,
(aclexplode(COALESCE(pg_type.typacl, acldefault(''T''::"char", pg_type.typowner)))).grantee AS grantee,
(aclexplode(COALESCE(pg_type.typacl, acldefault(''T''::"char", pg_type.typowner)))).privilege_type AS privilege_type,
(aclexplode(COALESCE(pg_type.typacl, acldefault(''T''::"char", pg_type.typowner)))).is_grantable AS is_grantable
FROM pg_type) t(oid, typname, typnamespace, typtype, typowner, grantor, grantee, prtype, grantable),
pg_namespace n,
pg_authid u_grantor,
( SELECT pg_authid.oid,
pg_authid.rolname
FROM pg_authid
UNION ALL
SELECT (0)::oid AS oid,
''PUBLIC''::name) grantee(oid, rolname)
WHERE ((t.typnamespace = n.oid) AND (t.typtype = ''d''::"char") AND (t.grantee = grantee.oid) AND (t.grantor = u_grantor.oid) AND (t.prtype = ''USAGE''::text) AND (pg_has_role(u_grantor.oid, ''USAGE''::text) OR pg_has_role(grantee.oid, ''USAGE''::text) OR (grantee.rolname = ''PUBLIC''::name)))
UNION ALL
SELECT (u_grantor.rolname)::information_schema.sql_identifier AS grantor,
(grantee.rolname)::information_schema.sql_identifier AS grantee,
(current_database())::information_schema.sql_identifier AS object_catalog,
(''''::name)::information_schema.sql_identifier AS object_schema,
(fdw.fdwname)::information_schema.sql_identifier AS object_name,
(''FOREIGN DATA WRAPPER''::character varying)::information_schema.character_data AS object_type,
(''USAGE''::character varying)::information_schema.character_data AS privilege_type,
(
CASE
WHEN (pg_has_role(grantee.oid, fdw.fdwowner, ''USAGE''::text) OR fdw.grantable) THEN ''YES''::text
ELSE ''NO''::text
END)::information_schema.yes_or_no AS is_grantable
FROM ( SELECT pg_foreign_data_wrapper.fdwname,
pg_foreign_data_wrapper.fdwowner,
(aclexplode(COALESCE(pg_foreign_data_wrapper.fdwacl, acldefault(''F''::"char", pg_foreign_data_wrapper.fdwowner)))).grantor AS grantor,
(aclexplode(COALESCE(pg_foreign_data_wrapper.fdwacl, acldefault(''F''::"char", pg_foreign_data_wrapper.fdwowner)))).grantee AS grantee,
(aclexplode(COALESCE(pg_foreign_data_wrapper.fdwacl, acldefault(''F''::"char", pg_foreign_data_wrapper.fdwowner)))).privilege_type AS privilege_type,
(aclexplode(COALESCE(pg_foreign_data_wrapper.fdwacl, acldefault(''F''::"char", pg_foreign_data_wrapper.fdwowner)))).is_grantable AS is_grantable
FROM pg_foreign_data_wrapper) fdw(fdwname, fdwowner, grantor, grantee, prtype, grantable),
pg_authid u_grantor,
( SELECT pg_authid.oid,
pg_authid.rolname
FROM pg_authid
UNION ALL
SELECT (0)::oid AS oid,
''PUBLIC''::name) grantee(oid, rolname)
WHERE ((u_grantor.oid = fdw.grantor) AND (grantee.oid = fdw.grantee) AND (fdw.prtype = ''USAGE''::text) AND (pg_has_role(u_grantor.oid, ''USAGE''::text) OR pg_has_role(grantee.oid, ''USAGE''::text) OR (grantee.rolname = ''PUBLIC''::name)))
UNION ALL
SELECT (u_grantor.rolname)::information_schema.sql_identifier AS grantor,
(grantee.rolname)::information_schema.sql_identifier AS grantee,
(current_database())::information_schema.sql_identifier AS object_catalog,
(''''::name)::information_schema.sql_identifier AS object_schema,
(srv.srvname)::information_schema.sql_identifier AS object_name,
(''FOREIGN SERVER''::character varying)::information_schema.character_data AS object_type,
(''USAGE''::character varying)::information_schema.character_data AS privilege_type,
(
CASE
WHEN (pg_has_role(grantee.oid, srv.srvowner, ''USAGE''::text) OR srv.grantable) THEN ''YES''::text
ELSE ''NO''::text
END)::information_schema.yes_or_no AS is_grantable
FROM ( SELECT pg_foreign_server.srvname,
pg_foreign_server.srvowner,
(aclexplode(COALESCE(pg_foreign_server.srvacl, acldefault(''S''::"char", pg_foreign_server.srvowner)))).grantor AS grantor,
(aclexplode(COALESCE(pg_foreign_server.srvacl, acldefault(''S''::"char", pg_foreign_server.srvowner)))).grantee AS grantee,
(aclexplode(COALESCE(pg_foreign_server.srvacl, acldefault(''S''::"char", pg_foreign_server.srvowner)))).privilege_type AS privilege_type,
(aclexplode(COALESCE(pg_foreign_server.srvacl, acldefault(''S''::"char", pg_foreign_server.srvowner)))).is_grantable AS is_grantable
FROM pg_foreign_server) srv(srvname, srvowner, grantor, grantee, prtype, grantable),
pg_authid u_grantor,
( SELECT pg_authid.oid,
pg_authid.rolname
FROM pg_authid
UNION ALL
SELECT (0)::oid AS oid,
''PUBLIC''::name) grantee(oid, rolname)
WHERE ((u_grantor.oid = srv.grantor) AND (grantee.oid = srv.grantee) AND (srv.prtype = ''USAGE''::text) AND (pg_has_role(u_grantor.oid, ''USAGE''::text) OR pg_has_role(grantee.oid, ''USAGE''::text) OR (grantee.rolname = ''PUBLIC''::name)))
UNION ALL
SELECT (u_grantor.rolname)::information_schema.sql_identifier AS grantor,
(grantee.rolname)::information_schema.sql_identifier AS grantee,
(current_database())::information_schema.sql_identifier AS object_catalog,
(n.nspname)::information_schema.sql_identifier AS object_schema,
(c.relname)::information_schema.sql_identifier AS object_name,
(''SEQUENCE''::character varying)::information_schema.character_data AS object_type,
(''USAGE''::character varying)::information_schema.character_data AS privilege_type,
(
CASE
WHEN (pg_has_role(grantee.oid, c.relowner, ''USAGE''::text) OR c.grantable) THEN ''YES''::text
ELSE ''NO''::text
END)::information_schema.yes_or_no AS is_grantable
FROM ( SELECT pg_class.oid,
pg_class.relname,
pg_class.relnamespace,
pg_class.relkind,
pg_class.relowner,
(aclexplode(COALESCE(pg_class.relacl, acldefault(''r''::"char", pg_class.relowner)))).grantor AS grantor,
(aclexplode(COALESCE(pg_class.relacl, acldefault(''r''::"char", pg_class.relowner)))).grantee AS grantee,
(aclexplode(COALESCE(pg_class.relacl, acldefault(''r''::"char", pg_class.relowner)))).privilege_type AS privilege_type,
(aclexplode(COALESCE(pg_class.relacl, acldefault(''r''::"char", pg_class.relowner)))).is_grantable AS is_grantable
FROM pg_class) c(oid, relname, relnamespace, relkind, relowner, grantor, grantee, prtype, grantable),
pg_namespace n,
pg_authid u_grantor,
( SELECT pg_authid.oid,
pg_authid.rolname
FROM pg_authid
UNION ALL
SELECT (0)::oid AS oid,
''PUBLIC''::name) grantee(oid, rolname)
WHERE ((c.relnamespace = n.oid) AND (c.relkind = ''S''::"char") AND (c.grantee = grantee.oid) AND (c.grantor = u_grantor.oid) AND (c.prtype = ''USAGE''::text) AND (pg_has_role(u_grantor.oid, ''USAGE''::text) OR pg_has_role(grantee.oid, ''USAGE''::text) OR (grantee.rolname = ''PUBLIC''::name)));', 'NONE', 'NO', 'NO', 'NO', 'NO', 'NO');
INSERT INTO information_schema.views (table_catalog, table_schema, table_name, view_definition, check_option, is_updatable, is_insertable_into, is_trigger_updatable, is_trigger_deletable, is_trigger_insertable_into) VALUES ('sms', 'information_schema', 'role_udt_grants', ' SELECT udt_privileges.grantor,
udt_privileges.grantee,
udt_privileges.udt_catalog,
udt_privileges.udt_schema,
udt_privileges.udt_name,
udt_privileges.privilege_type,
udt_privileges.is_grantable
FROM information_schema.udt_privileges
WHERE (((udt_privileges.grantor)::name IN ( SELECT enabled_roles.role_name
FROM information_schema.enabled_roles)) OR ((udt_privileges.grantee)::name IN ( SELECT enabled_roles.role_name
FROM information_schema.enabled_roles)));', 'NONE', 'NO', 'NO', 'NO', 'NO', 'NO');
INSERT INTO information_schema.views (table_catalog, table_schema, table_name, view_definition, check_option, is_updatable, is_insertable_into, is_trigger_updatable, is_trigger_deletable, is_trigger_insertable_into) VALUES ('sms', 'information_schema', 'role_usage_grants', ' SELECT usage_privileges.grantor,
usage_privileges.grantee,
usage_privileges.object_catalog,
usage_privileges.object_schema,
usage_privileges.object_name,
usage_privileges.object_type,
usage_privileges.privilege_type,
usage_privileges.is_grantable
FROM information_schema.usage_privileges
WHERE (((usage_privileges.grantor)::name IN ( SELECT enabled_roles.role_name
FROM information_schema.enabled_roles)) OR ((usage_privileges.grantee)::name IN ( SELECT enabled_roles.role_name
FROM information_schema.enabled_roles)));', 'NONE', 'NO', 'NO', 'NO', 'NO', 'NO');
INSERT INTO information_schema.views (table_catalog, table_schema, table_name, view_definition, check_option, is_updatable, is_insertable_into, is_trigger_updatable, is_trigger_deletable, is_trigger_insertable_into) VALUES ('sms', 'information_schema', 'user_defined_types', ' SELECT (current_database())::information_schema.sql_identifier AS user_defined_type_catalog,
(n.nspname)::information_schema.sql_identifier AS user_defined_type_schema,
(c.relname)::information_schema.sql_identifier AS user_defined_type_name,
(''STRUCTURED''::character varying)::information_schema.character_data AS user_defined_type_category,
(''YES''::character varying)::information_schema.yes_or_no AS is_instantiable,
(NULL::character varying)::information_schema.yes_or_no AS is_final,
(NULL::character varying)::information_schema.character_data AS ordering_form,
(NULL::character varying)::information_schema.character_data AS ordering_category,
(NULL::name)::information_schema.sql_identifier AS ordering_routine_catalog,
(NULL::name)::information_schema.sql_identifier AS ordering_routine_schema,
(NULL::name)::information_schema.sql_identifier AS ordering_routine_name,
(NULL::character varying)::information_schema.character_data AS reference_type,
(NULL::character varying)::information_schema.character_data AS data_type,
(NULL::integer)::information_schema.cardinal_number AS character_maximum_length,
(NULL::integer)::information_schema.cardinal_number AS character_octet_length,
(NULL::name)::information_schema.sql_identifier AS character_set_catalog,
(NULL::name)::information_schema.sql_identifier AS character_set_schema,
(NULL::name)::information_schema.sql_identifier AS character_set_name,
(NULL::name)::information_schema.sql_identifier AS collation_catalog,
(NULL::name)::information_schema.sql_identifier AS collation_schema,
(NULL::name)::information_schema.sql_identifier AS collation_name,
(NULL::integer)::information_schema.cardinal_number AS numeric_precision,
(NULL::integer)::information_schema.cardinal_number AS numeric_precision_radix,
(NULL::integer)::information_schema.cardinal_number AS numeric_scale,
(NULL::integer)::information_schema.cardinal_number AS datetime_precision,
(NULL::character varying)::information_schema.character_data AS interval_type,
(NULL::integer)::information_schema.cardinal_number AS interval_precision,
(NULL::name)::information_schema.sql_identifier AS source_dtd_identifier,
(NULL::name)::information_schema.sql_identifier AS ref_dtd_identifier
FROM pg_namespace n,
pg_class c,
pg_type t
WHERE ((n.oid = c.relnamespace) AND (t.typrelid = c.oid) AND (c.relkind = ''c''::"char") AND (pg_has_role(t.typowner, ''USAGE''::text) OR has_type_privilege(t.oid, ''USAGE''::text)));', 'NONE', 'NO', 'NO', 'NO', 'NO', 'NO');
INSERT INTO information_schema.views (table_catalog, table_schema, table_name, view_definition, check_option, is_updatable, is_insertable_into, is_trigger_updatable, is_trigger_deletable, is_trigger_insertable_into) VALUES ('sms', 'information_schema', 'view_column_usage', ' SELECT DISTINCT (current_database())::information_schema.sql_identifier AS view_catalog,
(nv.nspname)::information_schema.sql_identifier AS view_schema,
(v.relname)::information_schema.sql_identifier AS view_name,
(current_database())::information_schema.sql_identifier AS table_catalog,
(nt.nspname)::information_schema.sql_identifier AS table_schema,
(t.relname)::information_schema.sql_identifier AS table_name,
(a.attname)::information_schema.sql_identifier AS column_name
FROM pg_namespace nv,
pg_class v,
pg_depend dv,
pg_depend dt,
pg_class t,
pg_namespace nt,
pg_attribute a
WHERE ((nv.oid = v.relnamespace) AND (v.relkind = ''v''::"char") AND (v.oid = dv.refobjid) AND (dv.refclassid = (''pg_class''::regclass)::oid) AND (dv.classid = (''pg_rewrite''::regclass)::oid) AND (dv.deptype = ''i''::"char") AND (dv.objid = dt.objid) AND (dv.refobjid <> dt.refobjid) AND (dt.classid = (''pg_rewrite''::regclass)::oid) AND (dt.refclassid = (''pg_class''::regclass)::oid) AND (dt.refobjid = t.oid) AND (t.relnamespace = nt.oid) AND (t.relkind = ANY (ARRAY[''r''::"char", ''v''::"char", ''f''::"char", ''p''::"char"])) AND (t.oid = a.attrelid) AND (dt.refobjsubid = a.attnum) AND pg_has_role(t.relowner, ''USAGE''::text));', 'NONE', 'NO', 'NO', 'NO', 'NO', 'NO');
INSERT INTO information_schema.views (table_catalog, table_schema, table_name, view_definition, check_option, is_updatable, is_insertable_into, is_trigger_updatable, is_trigger_deletable, is_trigger_insertable_into) VALUES ('sms', 'information_schema', 'view_routine_usage', ' SELECT DISTINCT (current_database())::information_schema.sql_identifier AS table_catalog,
(nv.nspname)::information_schema.sql_identifier AS table_schema,
(v.relname)::information_schema.sql_identifier AS table_name,
(current_database())::information_schema.sql_identifier AS specific_catalog,
(np.nspname)::information_schema.sql_identifier AS specific_schema,
(nameconcatoid(p.proname, p.oid))::information_schema.sql_identifier AS specific_name
FROM pg_namespace nv,
pg_class v,
pg_depend dv,
pg_depend dp,
pg_proc p,
pg_namespace np
WHERE ((nv.oid = v.relnamespace) AND (v.relkind = ''v''::"char") AND (v.oid = dv.refobjid) AND (dv.refclassid = (''pg_class''::regclass)::oid) AND (dv.classid = (''pg_rewrite''::regclass)::oid) AND (dv.deptype = ''i''::"char") AND (dv.objid = dp.objid) AND (dp.classid = (''pg_rewrite''::regclass)::oid) AND (dp.refclassid = (''pg_proc''::regclass)::oid) AND (dp.refobjid = p.oid) AND (p.pronamespace = np.oid) AND pg_has_role(p.proowner, ''USAGE''::text));', 'NONE', 'NO', 'NO', 'NO', 'NO', 'NO');
INSERT INTO information_schema.views (table_catalog, table_schema, table_name, view_definition, check_option, is_updatable, is_insertable_into, is_trigger_updatable, is_trigger_deletable, is_trigger_insertable_into) VALUES ('sms', 'information_schema', 'view_table_usage', ' SELECT DISTINCT (current_database())::information_schema.sql_identifier AS view_catalog,
(nv.nspname)::information_schema.sql_identifier AS view_schema,
(v.relname)::information_schema.sql_identifier AS view_name,
(current_database())::information_schema.sql_identifier AS table_catalog,
(nt.nspname)::information_schema.sql_identifier AS table_schema,
(t.relname)::information_schema.sql_identifier AS table_name
FROM pg_namespace nv,
pg_class v,
pg_depend dv,
pg_depend dt,
pg_class t,
pg_namespace nt
WHERE ((nv.oid = v.relnamespace) AND (v.relkind = ''v''::"char") AND (v.oid = dv.refobjid) AND (dv.refclassid = (''pg_class''::regclass)::oid) AND (dv.classid = (''pg_rewrite''::regclass)::oid) AND (dv.deptype = ''i''::"char") AND (dv.objid = dt.objid) AND (dv.refobjid <> dt.refobjid) AND (dt.classid = (''pg_rewrite''::regclass)::oid) AND (dt.refclassid = (''pg_class''::regclass)::oid) AND (dt.refobjid = t.oid) AND (t.relnamespace = nt.oid) AND (t.relkind = ANY (ARRAY[''r''::"char", ''v''::"char", ''f''::"char", ''p''::"char"])) AND pg_has_role(t.relowner, ''USAGE''::text));', 'NONE', 'NO', 'NO', 'NO', 'NO', 'NO');
INSERT INTO information_schema.views (table_catalog, table_schema, table_name, view_definition, check_option, is_updatable, is_insertable_into, is_trigger_updatable, is_trigger_deletable, is_trigger_insertable_into) VALUES ('sms', 'information_schema', 'foreign_tables', ' SELECT _pg_foreign_tables.foreign_table_catalog,
_pg_foreign_tables.foreign_table_schema,
_pg_foreign_tables.foreign_table_name,
_pg_foreign_tables.foreign_server_catalog,
_pg_foreign_tables.foreign_server_name
FROM information_schema._pg_foreign_tables;', 'NONE', 'NO', 'NO', 'NO', 'NO', 'NO');
INSERT INTO information_schema.views (table_catalog, table_schema, table_name, view_definition, check_option, is_updatable, is_insertable_into, is_trigger_updatable, is_trigger_deletable, is_trigger_insertable_into) VALUES ('sms', 'information_schema', 'views', ' SELECT (current_database())::information_schema.sql_identifier AS table_catalog,
(nc.nspname)::information_schema.sql_identifier AS table_schema,
(c.relname)::information_schema.sql_identifier AS table_name,
(
CASE
WHEN pg_has_role(c.relowner, ''USAGE''::text) THEN pg_get_viewdef(c.oid)
ELSE NULL::text
END)::information_schema.character_data AS view_definition,
(
CASE
WHEN (''check_option=cascaded''::text = ANY (c.reloptions)) THEN ''CASCADED''::text
WHEN (''check_option=local''::text = ANY (c.reloptions)) THEN ''LOCAL''::text
ELSE ''NONE''::text
END)::information_schema.character_data AS check_option,
(
CASE
WHEN ((pg_relation_is_updatable((c.oid)::regclass, false) & 20) = 20) THEN ''YES''::text
ELSE ''NO''::text
END)::information_schema.yes_or_no AS is_updatable,
(
CASE
WHEN ((pg_relation_is_updatable((c.oid)::regclass, false) & 8) = 8) THEN ''YES''::text
ELSE ''NO''::text
END)::information_schema.yes_or_no AS is_insertable_into,
(
CASE
WHEN (EXISTS ( SELECT 1
FROM pg_trigger
WHERE ((pg_trigger.tgrelid = c.oid) AND (((pg_trigger.tgtype)::integer & 81) = 81)))) THEN ''YES''::text
ELSE ''NO''::text
END)::information_schema.yes_or_no AS is_trigger_updatable,
(
CASE
WHEN (EXISTS ( SELECT 1
FROM pg_trigger
WHERE ((pg_trigger.tgrelid = c.oid) AND (((pg_trigger.tgtype)::integer & 73) = 73)))) THEN ''YES''::text
ELSE ''NO''::text
END)::information_schema.yes_or_no AS is_trigger_deletable,
(
CASE
WHEN (EXISTS ( SELECT 1
FROM pg_trigger
WHERE ((pg_trigger.tgrelid = c.oid) AND (((pg_trigger.tgtype)::integer & 69) = 69)))) THEN ''YES''::text
ELSE ''NO''::text
END)::information_schema.yes_or_no AS is_trigger_insertable_into
FROM pg_namespace nc,
pg_class c
WHERE ((c.relnamespace = nc.oid) AND (c.relkind = ''v''::"char") AND (NOT pg_is_other_temp_schema(nc.oid)) AND (pg_has_role(c.relowner, ''USAGE''::text) OR has_table_privilege(c.oid, ''SELECT, INSERT, UPDATE, DELETE, TRUNCATE, REFERENCES, TRIGGER''::text) OR has_any_column_privilege(c.oid, ''SELECT, INSERT, UPDATE, REFERENCES''::text)));', 'NONE', 'NO', 'NO', 'NO', 'NO', 'NO');
INSERT INTO information_schema.views (table_catalog, table_schema, table_name, view_definition, check_option, is_updatable, is_insertable_into, is_trigger_updatable, is_trigger_deletable, is_trigger_insertable_into) VALUES ('sms', 'information_schema', 'data_type_privileges', ' SELECT (current_database())::information_schema.sql_identifier AS object_catalog,
x.objschema AS object_schema,
x.objname AS object_name,
(x.objtype)::information_schema.character_data AS object_type,
x.objdtdid AS dtd_identifier
FROM ( SELECT attributes.udt_schema,
attributes.udt_name,
''USER-DEFINED TYPE''::text AS text,
attributes.dtd_identifier
FROM information_schema.attributes
UNION ALL
SELECT columns.table_schema,
columns.table_name,
''TABLE''::text AS text,
columns.dtd_identifier
FROM information_schema.columns
UNION ALL
SELECT domains.domain_schema,
domains.domain_name,
''DOMAIN''::text AS text,
domains.dtd_identifier
FROM information_schema.domains
UNION ALL
SELECT parameters.specific_schema,
parameters.specific_name,
''ROUTINE''::text AS text,
parameters.dtd_identifier
FROM information_schema.parameters
UNION ALL
SELECT routines.specific_schema,
routines.specific_name,
''ROUTINE''::text AS text,
routines.dtd_identifier
FROM information_schema.routines) x(objschema, objname, objtype, objdtdid);', 'NONE', 'NO', 'NO', 'NO', 'NO', 'NO');
INSERT INTO information_schema.views (table_catalog, table_schema, table_name, view_definition, check_option, is_updatable, is_insertable_into, is_trigger_updatable, is_trigger_deletable, is_trigger_insertable_into) VALUES ('sms', 'information_schema', '_pg_user_mappings', ' SELECT um.oid,
um.umoptions,
um.umuser,
(COALESCE(u.rolname, ''PUBLIC''::name))::information_schema.sql_identifier AS authorization_identifier,
s.foreign_server_catalog,
s.foreign_server_name,
s.authorization_identifier AS srvowner
FROM (pg_user_mapping um
LEFT JOIN pg_authid u ON ((u.oid = um.umuser))),
information_schema._pg_foreign_servers s
WHERE (s.oid = um.umserver);', 'NONE', 'NO', 'NO', 'NO', 'NO', 'NO');
INSERT INTO information_schema.views (table_catalog, table_schema, table_name, view_definition, check_option, is_updatable, is_insertable_into, is_trigger_updatable, is_trigger_deletable, is_trigger_insertable_into) VALUES ('sms', 'information_schema', 'element_types', ' SELECT (current_database())::information_schema.sql_identifier AS object_catalog,
(n.nspname)::information_schema.sql_identifier AS object_schema,
x.objname AS object_name,
(x.objtype)::information_schema.character_data AS object_type,
(x.objdtdid)::information_schema.sql_identifier AS collection_type_identifier,
(
CASE
WHEN (nbt.nspname = ''pg_catalog''::name) THEN format_type(bt.oid, NULL::integer)
ELSE ''USER-DEFINED''::text
END)::information_schema.character_data AS data_type,
(NULL::integer)::information_schema.cardinal_number AS character_maximum_length,
(NULL::integer)::information_schema.cardinal_number AS character_octet_length,
(NULL::name)::information_schema.sql_identifier AS character_set_catalog,
(NULL::name)::information_schema.sql_identifier AS character_set_schema,
(NULL::name)::information_schema.sql_identifier AS character_set_name,
(
CASE
WHEN (nco.nspname IS NOT NULL) THEN current_database()
ELSE NULL::name
END)::information_schema.sql_identifier AS collation_catalog,
(nco.nspname)::information_schema.sql_identifier AS collation_schema,
(co.collname)::information_schema.sql_identifier AS collation_name,
(NULL::integer)::information_schema.cardinal_number AS numeric_precision,
(NULL::integer)::information_schema.cardinal_number AS numeric_precision_radix,
(NULL::integer)::information_schema.cardinal_number AS numeric_scale,
(NULL::integer)::information_schema.cardinal_number AS datetime_precision,
(NULL::character varying)::information_schema.character_data AS interval_type,
(NULL::integer)::information_schema.cardinal_number AS interval_precision,
(NULL::character varying)::information_schema.character_data AS domain_default,
(current_database())::information_schema.sql_identifier AS udt_catalog,
(nbt.nspname)::information_schema.sql_identifier AS udt_schema,
(bt.typname)::information_schema.sql_identifier AS udt_name,
(NULL::name)::information_schema.sql_identifier AS scope_catalog,
(NULL::name)::information_schema.sql_identifier AS scope_schema,
(NULL::name)::information_schema.sql_identifier AS scope_name,
(NULL::integer)::information_schema.cardinal_number AS maximum_cardinality,
((''a''::text || (x.objdtdid)::text))::information_schema.sql_identifier AS dtd_identifier
FROM pg_namespace n,
pg_type at,
pg_namespace nbt,
pg_type bt,
(( SELECT c.relnamespace,
(c.relname)::information_schema.sql_identifier AS relname,
CASE
WHEN (c.relkind = ''c''::"char") THEN ''USER-DEFINED TYPE''::text
ELSE ''TABLE''::text
END AS "case",
a.attnum,
a.atttypid,
a.attcollation
FROM pg_class c,
pg_attribute a
WHERE ((c.oid = a.attrelid) AND (c.relkind = ANY (ARRAY[''r''::"char", ''v''::"char", ''f''::"char", ''c''::"char", ''p''::"char"])) AND (a.attnum > 0) AND (NOT a.attisdropped))
UNION ALL
SELECT t.typnamespace,
(t.typname)::information_schema.sql_identifier AS typname,
''DOMAIN''::text AS text,
1,
t.typbasetype,
t.typcollation
FROM pg_type t
WHERE (t.typtype = ''d''::"char")
UNION ALL
SELECT ss.pronamespace,
(nameconcatoid(ss.proname, ss.oid))::information_schema.sql_identifier AS nameconcatoid,
''ROUTINE''::text AS text,
(ss.x).n AS n,
(ss.x).x AS x,
0
FROM ( SELECT p.pronamespace,
p.proname,
p.oid,
information_schema._pg_expandarray(COALESCE(p.proallargtypes, (p.proargtypes)::oid[])) AS x
FROM pg_proc p) ss
UNION ALL
SELECT p.pronamespace,
(nameconcatoid(p.proname, p.oid))::information_schema.sql_identifier AS nameconcatoid,
''ROUTINE''::text AS text,
0,
p.prorettype,
0
FROM pg_proc p) x(objschema, objname, objtype, objdtdid, objtypeid, objcollation)
LEFT JOIN (pg_collation co
JOIN pg_namespace nco ON ((co.collnamespace = nco.oid))) ON (((x.objcollation = co.oid) AND ((nco.nspname <> ''pg_catalog''::name) OR (co.collname <> ''default''::name)))))
WHERE ((n.oid = x.objschema) AND (at.oid = x.objtypeid) AND ((at.typelem <> (0)::oid) AND (at.typlen = ''-1''::integer)) AND (at.typelem = bt.oid) AND (nbt.oid = bt.typnamespace) AND ((n.nspname, (x.objname)::name, x.objtype, ((x.objdtdid)::information_schema.sql_identifier)::name) IN ( SELECT data_type_privileges.object_schema,
data_type_privileges.object_name,
data_type_privileges.object_type,
data_type_privileges.dtd_identifier
FROM information_schema.data_type_privileges)));', 'NONE', 'NO', 'NO', 'NO', 'NO', 'NO');
INSERT INTO information_schema.views (table_catalog, table_schema, table_name, view_definition, check_option, is_updatable, is_insertable_into, is_trigger_updatable, is_trigger_deletable, is_trigger_insertable_into) VALUES ('sms', 'information_schema', '_pg_foreign_table_columns', ' SELECT n.nspname,
c.relname,
a.attname,
a.attfdwoptions
FROM pg_foreign_table t,
pg_authid u,
pg_namespace n,
pg_class c,
pg_attribute a
WHERE ((u.oid = c.relowner) AND (pg_has_role(c.relowner, ''USAGE''::text) OR has_column_privilege(c.oid, a.attnum, ''SELECT, INSERT, UPDATE, REFERENCES''::text)) AND (n.oid = c.relnamespace) AND (c.oid = t.ftrelid) AND (c.relkind = ''f''::"char") AND (a.attrelid = c.oid) AND (a.attnum > 0));', 'NONE', 'NO', 'NO', 'NO', 'NO', 'NO');
INSERT INTO information_schema.views (table_catalog, table_schema, table_name, view_definition, check_option, is_updatable, is_insertable_into, is_trigger_updatable, is_trigger_deletable, is_trigger_insertable_into) VALUES ('sms', 'information_schema', 'column_options', ' SELECT (current_database())::information_schema.sql_identifier AS table_catalog,
(c.nspname)::information_schema.sql_identifier AS table_schema,
(c.relname)::information_schema.sql_identifier AS table_name,
(c.attname)::information_schema.sql_identifier AS column_name,
((pg_options_to_table(c.attfdwoptions)).option_name)::information_schema.sql_identifier AS option_name,
((pg_options_to_table(c.attfdwoptions)).option_value)::information_schema.character_data AS option_value
FROM information_schema._pg_foreign_table_columns c;', 'NONE', 'NO', 'NO', 'NO', 'NO', 'NO');
INSERT INTO information_schema.views (table_catalog, table_schema, table_name, view_definition, check_option, is_updatable, is_insertable_into, is_trigger_updatable, is_trigger_deletable, is_trigger_insertable_into) VALUES ('sms', 'information_schema', '_pg_foreign_data_wrappers', ' SELECT w.oid,
w.fdwowner,
w.fdwoptions,
(current_database())::information_schema.sql_identifier AS foreign_data_wrapper_catalog,
(w.fdwname)::information_schema.sql_identifier AS foreign_data_wrapper_name,
(u.rolname)::information_schema.sql_identifier AS authorization_identifier,
(''c''::character varying)::information_schema.character_data AS foreign_data_wrapper_language
FROM pg_foreign_data_wrapper w,
pg_authid u
WHERE ((u.oid = w.fdwowner) AND (pg_has_role(w.fdwowner, ''USAGE''::text) OR has_foreign_data_wrapper_privilege(w.oid, ''USAGE''::text)));', 'NONE', 'NO', 'NO', 'NO', 'NO', 'NO');
INSERT INTO information_schema.views (table_catalog, table_schema, table_name, view_definition, check_option, is_updatable, is_insertable_into, is_trigger_updatable, is_trigger_deletable, is_trigger_insertable_into) VALUES ('sms', 'information_schema', 'foreign_data_wrapper_options', ' SELECT w.foreign_data_wrapper_catalog,
w.foreign_data_wrapper_name,
((pg_options_to_table(w.fdwoptions)).option_name)::information_schema.sql_identifier AS option_name,
((pg_options_to_table(w.fdwoptions)).option_value)::information_schema.character_data AS option_value
FROM information_schema._pg_foreign_data_wrappers w;', 'NONE', 'NO', 'NO', 'NO', 'NO', 'NO');
INSERT INTO information_schema.views (table_catalog, table_schema, table_name, view_definition, check_option, is_updatable, is_insertable_into, is_trigger_updatable, is_trigger_deletable, is_trigger_insertable_into) VALUES ('sms', 'information_schema', 'user_mapping_options', ' SELECT um.authorization_identifier,
um.foreign_server_catalog,
um.foreign_server_name,
(opts.option_name)::information_schema.sql_identifier AS option_name,
(
CASE
WHEN (((um.umuser <> (0)::oid) AND ((um.authorization_identifier)::name = CURRENT_USER)) OR ((um.umuser = (0)::oid) AND pg_has_role((um.srvowner)::name, ''USAGE''::text)) OR ( SELECT pg_authid.rolsuper
FROM pg_authid
WHERE (pg_authid.rolname = CURRENT_USER))) THEN opts.option_value
ELSE NULL::text
END)::information_schema.character_data AS option_value
FROM information_schema._pg_user_mappings um,
LATERAL pg_options_to_table(um.umoptions) opts(option_name, option_value);', 'NONE', 'NO', 'NO', 'NO', 'NO', 'NO');
INSERT INTO information_schema.views (table_catalog, table_schema, table_name, view_definition, check_option, is_updatable, is_insertable_into, is_trigger_updatable, is_trigger_deletable, is_trigger_insertable_into) VALUES ('sms', 'information_schema', 'foreign_data_wrappers', ' SELECT w.foreign_data_wrapper_catalog,
w.foreign_data_wrapper_name,
w.authorization_identifier,
(NULL::character varying)::information_schema.character_data AS library_name,
w.foreign_data_wrapper_language
FROM information_schema._pg_foreign_data_wrappers w;', 'NONE', 'NO', 'NO', 'NO', 'NO', 'NO');
INSERT INTO information_schema.views (table_catalog, table_schema, table_name, view_definition, check_option, is_updatable, is_insertable_into, is_trigger_updatable, is_trigger_deletable, is_trigger_insertable_into) VALUES ('sms', 'information_schema', '_pg_foreign_servers', ' SELECT s.oid,
s.srvoptions,
(current_database())::information_schema.sql_identifier AS foreign_server_catalog,
(s.srvname)::information_schema.sql_identifier AS foreign_server_name,
(current_database())::information_schema.sql_identifier AS foreign_data_wrapper_catalog,
(w.fdwname)::information_schema.sql_identifier AS foreign_data_wrapper_name,
(s.srvtype)::information_schema.character_data AS foreign_server_type,
(s.srvversion)::information_schema.character_data AS foreign_server_version,
(u.rolname)::information_schema.sql_identifier AS authorization_identifier
FROM pg_foreign_server s,
pg_foreign_data_wrapper w,
pg_authid u
WHERE ((w.oid = s.srvfdw) AND (u.oid = s.srvowner) AND (pg_has_role(s.srvowner, ''USAGE''::text) OR has_server_privilege(s.oid, ''USAGE''::text)));', 'NONE', 'NO', 'NO', 'NO', 'NO', 'NO');
INSERT INTO information_schema.views (table_catalog, table_schema, table_name, view_definition, check_option, is_updatable, is_insertable_into, is_trigger_updatable, is_trigger_deletable, is_trigger_insertable_into) VALUES ('sms', 'information_schema', 'foreign_server_options', ' SELECT s.foreign_server_catalog,
s.foreign_server_name,
((pg_options_to_table(s.srvoptions)).option_name)::information_schema.sql_identifier AS option_name,
((pg_options_to_table(s.srvoptions)).option_value)::information_schema.character_data AS option_value
FROM information_schema._pg_foreign_servers s;', 'NONE', 'NO', 'NO', 'NO', 'NO', 'NO');
INSERT INTO information_schema.views (table_catalog, table_schema, table_name, view_definition, check_option, is_updatable, is_insertable_into, is_trigger_updatable, is_trigger_deletable, is_trigger_insertable_into) VALUES ('sms', 'information_schema', 'foreign_servers', ' SELECT _pg_foreign_servers.foreign_server_catalog,
_pg_foreign_servers.foreign_server_name,
_pg_foreign_servers.foreign_data_wrapper_catalog,
_pg_foreign_servers.foreign_data_wrapper_name,
_pg_foreign_servers.foreign_server_type,
_pg_foreign_servers.foreign_server_version,
_pg_foreign_servers.authorization_identifier
FROM information_schema._pg_foreign_servers;', 'NONE', 'NO', 'NO', 'NO', 'NO', 'NO');
INSERT INTO information_schema.views (table_catalog, table_schema, table_name, view_definition, check_option, is_updatable, is_insertable_into, is_trigger_updatable, is_trigger_deletable, is_trigger_insertable_into) VALUES ('sms', 'information_schema', '_pg_foreign_tables', ' SELECT (current_database())::information_schema.sql_identifier AS foreign_table_catalog,
(n.nspname)::information_schema.sql_identifier AS foreign_table_schema,
(c.relname)::information_schema.sql_identifier AS foreign_table_name,
t.ftoptions,
(current_database())::information_schema.sql_identifier AS foreign_server_catalog,
(s.srvname)::information_schema.sql_identifier AS foreign_server_name,
(u.rolname)::information_schema.sql_identifier AS authorization_identifier
FROM pg_foreign_table t,
pg_foreign_server s,
pg_foreign_data_wrapper w,
pg_authid u,
pg_namespace n,
pg_class c
WHERE ((w.oid = s.srvfdw) AND (u.oid = c.relowner) AND (pg_has_role(c.relowner, ''USAGE''::text) OR has_table_privilege(c.oid, ''SELECT, INSERT, UPDATE, DELETE, TRUNCATE, REFERENCES, TRIGGER''::text) OR has_any_column_privilege(c.oid, ''SELECT, INSERT, UPDATE, REFERENCES''::text)) AND (n.oid = c.relnamespace) AND (c.oid = t.ftrelid) AND (c.relkind = ''f''::"char") AND (s.oid = t.ftserver));', 'NONE', 'NO', 'NO', 'NO', 'NO', 'NO');
INSERT INTO information_schema.views (table_catalog, table_schema, table_name, view_definition, check_option, is_updatable, is_insertable_into, is_trigger_updatable, is_trigger_deletable, is_trigger_insertable_into) VALUES ('sms', 'information_schema', 'user_mappings', ' SELECT _pg_user_mappings.authorization_identifier,
_pg_user_mappings.foreign_server_catalog,
_pg_user_mappings.foreign_server_name
FROM information_schema._pg_user_mappings;', 'NONE', 'NO', 'NO', 'NO', 'NO', 'NO');
INSERT INTO information_schema.views (table_catalog, table_schema, table_name, view_definition, check_option, is_updatable, is_insertable_into, is_trigger_updatable, is_trigger_deletable, is_trigger_insertable_into) VALUES ('sms', 'information_schema', 'foreign_table_options', ' SELECT t.foreign_table_catalog,
t.foreign_table_schema,
t.foreign_table_name,
((pg_options_to_table(t.ftoptions)).option_name)::information_schema.sql_identifier AS option_name,
((pg_options_to_table(t.ftoptions)).option_value)::information_schema.character_data AS option_value
FROM information_schema._pg_foreign_tables t;', 'NONE', 'NO', 'NO', 'NO', 'NO', 'NO'); | true |
dceed5312191c63bf9dfc84e8b1654b7004dde38 | SQL | cuba-platform/cuba | /modules/core/db/update/postgres/01/01-210-updateTabNameInSysFolder.sql | UTF-8 | 228 | 2.6875 | 3 | [
"Apache-2.0"
] | permissive | -- Description: update tab_name in sys_folder : for search folder,
-- which haven't tab name,put to tab name name of folder + '.tabName'
UPDATE sys_folder
SET tab_name = name || '.tabName'
WHERE tab_name IS NULL AND type='S'; | true |
4f54235bf99af5c28636acd74fa97367ca80a64a | SQL | kimhongsik33/plsql | /No11_10.sql | SHIFT_JIS | 1,984 | 3.28125 | 3 | [] | no_license | --No11-10.LIMITL[[hBSELECT
SET SERVEROUTPUT ON
DECLARE
TYPE emp_rec IS TABLE OF emp%ROWTYPE;
v_emp_arr emp_rec;
c_size_limit CONSTANT PLS_INTEGER := 10;
v_fetched PLS_INTEGER;
CURSOR c IS
SELECT *
FROM emp;
BEGIN
v_fetched := 0;
OPEN c; --CURSOR OPEN
LOOP
FETCH c BULK COLLECT INTO v_emp_arr
LIMIT c_size_limit; -- LIMITgpĈœǂݎő匏𐧌B
DBMS_OUTPUT.PUT_LINE(v_emp_arr.COUNT||'');
IF 0 < v_emp_arr.COUNT THEN
FOR i IN v_emp_arr.FIRST .. v_emp_arr.LAST
LOOP
DBMS_OUTPUT.PUT_LINE(CHR(9)||'='||TO_CHAR(v_fetched+i, '99')||' Јԍ='||v_emp_arr(i).empno||',O='||v_emp_arr(i).ename);
END LOOP;
v_fetched := c%ROWCOUNT; --ꂽ
END IF;
EXIT WHEN c%NOTFOUND; --ȏf[^ȂΏIB
END LOOP;
CLOSE c;
END;
--ȉA
--SQL> @C:\kim\tech\plsql\Chapter11\No11_10.sql
-- 51 /
--10
-- = 1 Јԍ=7369,O=SMITH
-- = 2 Јԍ=7499,O=ALLEN
-- = 3 Јԍ=7521,O=WARD
-- = 4 Јԍ=7566,O=JONES
-- = 5 Јԍ=7654,O=MARTIN
-- = 6 Јԍ=7698,O=BLAKE
-- = 7 Јԍ=7782,O=CLARK
-- = 8 Јԍ=7788,O=SCOTT
-- = 9 Јԍ=7839,O=KING
-- = 10 Јԍ=7844,O=TURNER
--5
-- = 11 Јԍ=7876,O=ADAMS
-- = 12 Јԍ=7900,O=JAMES
-- = 13 Јԍ=7902,O=FORD
-- = 14 Јԍ=7934,O=MILLER
-- = 15 Јԍ=9000,O=HONG
--
--PL/SQLvV[WɊ܂B
--
--SQL>
| true |
d490033173da80186ecabe91ab60dcb70bb160c1 | SQL | mbougie/gibbs | /projects/usxp/stages/deliverables/x_to_crop/x_to_crops_counts.sql | UTF-8 | 975 | 2.71875 | 3 | [] | no_license | SELECT
'wetland'::text as nc_group,
sum(s35_ytc30_2008to2017_mmu5_bfc.acres) as acres
FROM
counts_cdl.s35_ytc30_2008to2017_mmu5_bfc
WHERE value IN (83,87,190,195)
UNION
SELECT
'shrubland'::text as nc_group,
sum(s35_ytc30_2008to2017_mmu5_bfc.acres) as acres
FROM
counts_cdl.s35_ytc30_2008to2017_mmu5_bfc
WHERE value IN (64,65,131,152)
UNION
SELECT
'forest'::text as nc_group,
sum(s35_ytc30_2008to2017_mmu5_bfc.acres) as acres
FROM
counts_cdl.s35_ytc30_2008to2017_mmu5_bfc
WHERE value IN (63,141,142,143)
UNION
SELECT
'grassland'::text as nc_group,
sum(s35_ytc30_2008to2017_mmu5_bfc.acres) as acres
FROM
counts_cdl.s35_ytc30_2008to2017_mmu5_bfc
WHERE value IN (37,62,171,176,181)
--instance = {'series':'s35', 'scale':{'3km':100}, 'reclass':{'forest':[[63,1],[141,1],[142,1],[143,1]], 'wetland':[[83,1],[87,1],[190,1],[195,1]], 'grassland':[[37,1],[62,1],[171,1],[176,1],[181,1]], 'shrubland':[[64,1],[65,1],[131,1],[152,1]]} }
| true |
8ce562327c0eaf1595319a40ac82c66bef440c48 | SQL | Manojkumarupm/ADO-Disconnect-Example | /ADO.sql | UTF-8 | 814 | 3.125 | 3 | [] | no_license | use fse
Create table ProductDetails (ProductId INT, ProductName VARCHAR(30),SupplierID VARCHAR(10))
Create table Supplierinfo (SupplierId VARCHAR(10),SupplierName VARCHAR(50),Address VARCHAR(255),City VARCHAR(30),ContactNumber VARCHAR(15),Email VARCHAR(30))
Create table ProductDetails (ProductId, ProductName,SupplierID )
Supplierinfo (Supplier_ID ,Supplier_Name ,Address ,City,ContactNumber,Email
@Supplier_ID ,@Supplier_Name ,@Address ,@City,@ContactNumber,@Email
SELECT * FROM Supplierinfo
Create table Category (
CategoryCode VARCHAR(20),CategoryName VARCHAR(50),Division VARCHAR(10),Region VARCHAR(20),SupplierId VARCHAR(10),SupplierName VARCHAR(50))
INSERT INTO Category (CategoryCode,CategoryName,Division,Region,SupplierId,SupplierName)
VALUES ('1','Healthcare','MDU','South','1','Hindustan') | true |
6a3b95bfe218d37fd0f5f459d26db24f908bbc86 | SQL | medonagy45/node-test | /db/scheme.sql | UTF-8 | 572 | 3.453125 | 3 | [] | no_license |
SET sql_notes = 0;
CREATE TABLE IF NOT EXISTS `author` (
`idAuthor` int NOT NULL AUTO_INCREMENT,
`name` varchar(45) DEFAULT NULL,
`jobTitle` varchar(45) DEFAULT NULL,
PRIMARY KEY (`idAuthor`)
) ;
CREATE TABLE IF NOT EXISTS `article` (
`idArticle` int NOT NULL AUTO_INCREMENT,
`title` varchar(45) DEFAULT NULL,
`body` varchar(45) DEFAULT NULL,
`likes` int DEFAULT NULL,
`comments` varchar(45) DEFAULT NULL,
`authorIdAuthor` int DEFAULT NULL,
PRIMARY KEY (`idArticle`),
FOREIGN KEY (authorIdAuthor) REFERENCES author(idAuthor)
) ;
SET sql_notes = 1; | true |
29cf058e2c733d3b1fdc56c0e835ec1d58f6b3bd | SQL | zenithshrestha37/sqlbasics | /orders.sql | UTF-8 | 992 | 3.828125 | 4 | [] | no_license | /* #1 */
CREATE TABLE orders (
order_id SERIAL PRIMARY KEY,
person_id INT,
product_name VARCHAR(20),
product_price FLOAT,
quantity INT
);
/* #2 */
insert into orders (person_id, product_name, product_price,quantity)
values (34, 'Soccer Ball', 24.5, 2);
insert into orders (person_id, product_name, product_price,quantity)
values (34, 'Baseball bat', 22, 1);
insert into orders (person_id, product_name, product_price,quantity)
values (124, 'Banana', 3.99, 6);
insert into orders (person_id, product_name, product_price,quantity)
values (125, 'Apple', 5.29, 5);
insert into orders (person_id, product_name, product_price,quantity)
values (126, 'Volleyball', 28.99, 1);
/* #3 */
select * from orders;
/* #4 */
select sum(quantity) from orders;
/* #5 */
select sum(product_price*quantity) from orders;
/* #6 */
select sum(product_price * quantity) from orders
where person_id = 34;
/* The value of person_id depends on what IDs you used. Use a valid ID from your table */
| true |
2dd5c807beba7fc351404abb630246e105c89bcd | SQL | hz2657/SQL-everyday | /HackerRank/Ollivander's Inventory.sql | UTF-8 | 301 | 3.75 | 4 | [] | no_license | SELECT W.id, WP.age, W.coins_needed, W.power
FROM Wands W, Wands_Property WP
WHERE W.code = WP.code
AND WP.is_evil = 0
AND W.coins_needed IN
(SELECT MIN(coins_needed)
FROM Wands W1 JOIN Wands_Property WP1 USING(code)
WHERE W.power=W1.power AND WP.age = WP1.age
)
ORDER BY W.power DESC, WP.age DESC
| true |
db4c951b7d8349946f483cc960b2657639b8d643 | SQL | Najah-Shanableh/lead-public | /aux/assessor_summary.sql | UTF-8 | 1,061 | 3.59375 | 4 | [] | no_license | drop table if exists aux.assessor_summary;
create table aux.assessor_summary as (
select substring(house_num from 6)::int || ' ' || st_dir || ' ' || st_name || ' ' || st_suffix as address,
max((CASE WHEN bldg_sq_ft::int != '0' THEN bldg_sq_ft ELSE null END)::int) bldg_sq_ft,
max((CASE WHEN land_sq_ft::int != '0' THEN land_sq_ft ELSE null END)::int) land_sq_ft,
max((CASE WHEN "land_AV"::int != '0' THEN "land_AV" ELSE null END)::int) land_value,
max((CASE WHEN "Imp_Value"::int != '0' THEN "Imp_Value" ELSE null END)::int) improvement_value,
max((CASE WHEN "total_Value"::int != '0' THEN "total_Value" ELSE null END)::int) total_value,
bool_or(substring(imp_class for 1) in ('2','9')) as residential,
max(nullif(age,'000')::int) as age,
array_agg(distinct imp_class) as classes,
array_agg(distinct substring(imp_class for 1)) as class_types
from input.assessor
where city = 'CHICAGO'
group by substring(house_num from 6)::int || ' ' || st_dir || ' ' || st_name || ' ' || st_suffix
);
alter table aux.assessor_summary add unique (address);
| true |
5511f99b6440752ba42f60f86038477adc72bc89 | SQL | dineshkummarc/cuyahoga-1 | /Web/Install/Modules/Database/postgresql/1.5.0.sql | UTF-8 | 5,377 | 2.953125 | 3 | [
"BSD-3-Clause"
] | permissive | -- first set sequence values, otherwise the inserts will fail due to violation of the pk_constraint
SELECT setval('cuyahoga_moduletype_moduletypeid_seq', (SELECT max(moduletypeid) FROM cuyahoga_moduletype));
SELECT setval('cuyahoga_modulesetting_modulesettingid_seq', (SELECT max(modulesettingid) FROM cuyahoga_modulesetting));
/*
* Sitemap module
*/
INSERT INTO cuyahoga_moduletype (name, assemblyname, classname, path, editpath, inserttimestamp, updatetimestamp)
VALUES ('Sitemap', 'Cuyahoga.Modules', 'Cuyahoga.Modules.Sitemap.SitemapModule', 'Modules/Sitemap/SitemapControl.ascx', NULL, '2005-10-20 14:36:28.324', '2005-10-20 14:36:28.324');
/*
* Language switcher settings
*/
INSERT INTO cuyahoga_modulesetting (moduletypeid, name, friendlyname, settingdatatype, iscustomtype, isrequired)
SELECT moduletypeid, 'DISPLAY_MODE', 'Display mode', 'Cuyahoga.Modules.LanguageSwitcher.DisplayMode', true, true
FROM cuyahoga_moduletype
WHERE name = 'LanguageSwitcher';
INSERT INTO cuyahoga_modulesetting (moduletypeid, name, friendlyname, settingdatatype, iscustomtype, isrequired)
SELECT moduletypeid, 'REDIRECT_TO_USER_LANGUAGE', 'Redirect user to browser language when possible?', 'Cuyahoga.Modules.LanguageSwitcher.DisplayMode', false, true
FROM cuyahoga_moduletype
WHERE name = 'LanguageSwitcher';
INSERT INTO cuyahoga_sectionsetting (sectionid, name, value)
SELECT sectionid, 'DISPLAY_MODE', 'DropDown'
FROM cuyahoga_section s
INNER JOIN cuyahoga_moduletype m on m.moduletypeid = s.moduletypeid
WHERE m.Name = 'LanguageSwitcher';
INSERT INTO cuyahoga_sectionsetting (sectionid, name, value)
SELECT sectionid, 'REDIRECT_TO_USER_LANGUAGE', 'False'
FROM cuyahoga_section s
INNER JOIN cuyahoga_moduletype m on m.moduletypeid = s.moduletypeid
WHERE m.Name = 'LanguageSwitcher';
/*
* Move Articles and RemoteContent modules to their own assemblies
*/
UPDATE cuyahoga_moduletype SET assemblyname = 'Cuyahoga.Modules.Articles' WHERE name = 'Articles';
INSERT INTO cuyahoga_version (assembly, major, minor, patch) VALUES ('Cuyahoga.Modules.Articles', 1, 5, 0);
UPDATE cuyahoga_moduletype SET assemblyname = 'Cuyahoga.Modules.RemoteContent' WHERE name = 'RemoteContent';
INSERT INTO cuyahoga_version (assembly, major, minor, patch) VALUES ('Cuyahoga.Modules.RemoteContent', 1, 5, 0);
/*
* Add new settings to Articles module and add the IArticleDao module service
*/
INSERT INTO cuyahoga_modulesetting (moduletypeid, name, friendlyname, settingdatatype, iscustomtype, isrequired)
SELECT moduletypeid, 'SHOW_ARCHIVE', 'Show link to archived articles', 'System.Boolean', false, true
FROM cuyahoga_moduletype
WHERE name = 'Articles';
INSERT INTO cuyahoga_modulesetting (moduletypeid, name, friendlyname, settingdatatype, iscustomtype, isrequired)
SELECT moduletypeid, 'SHOW_DATETIME', 'Show publish date and time', 'System.Boolean', false, true
FROM cuyahoga_moduletype
WHERE name = 'Articles';
INSERT INTO cuyahoga_modulesetting (moduletypeid, name, friendlyname, settingdatatype, iscustomtype, isrequired)
SELECT moduletypeid, 'SHOW_CATEGORY', 'Show category', 'System.Boolean', false, true
FROM cuyahoga_moduletype
WHERE name = 'Articles';
INSERT INTO cuyahoga_modulesetting (moduletypeid, name, friendlyname, settingdatatype, iscustomtype, isrequired)
SELECT moduletypeid, 'SHOW_AUTHOR', 'Show author', 'System.Boolean', false, true
FROM cuyahoga_moduletype
WHERE name = 'Articles';
INSERT INTO cuyahoga_moduleservice (moduletypeid, servicekey, servicetype, classtype)
SELECT moduletypeid, 'articles.articledao', 'Cuyahoga.Modules.Articles.DataAccess.IArticleDao, Cuyahoga.Modules.Articles', 'Cuyahoga.Modules.Articles.DataAccess.ArticleDao, Cuyahoga.Modules.Articles'
FROM cuyahoga_moduletype
WHERE name = 'Articles';
INSERT INTO cuyahoga_sectionsetting (sectionid, name, value)
SELECT sectionid, 'SHOW_ARCHIVE', 'False'
FROM cuyahoga_section s
INNER JOIN cuyahoga_moduletype m on m.moduletypeid = s.moduletypeid
WHERE m.Name = 'Articles';
INSERT INTO cuyahoga_sectionsetting (sectionid, name, value)
SELECT sectionid, 'SHOW_DATETIME', 'True'
FROM cuyahoga_section s
INNER JOIN cuyahoga_moduletype m on m.moduletypeid = s.moduletypeid
WHERE m.Name = 'Articles';
INSERT INTO cuyahoga_sectionsetting (sectionid, name, value)
SELECT sectionid, 'SHOW_CATEGORY', 'True'
FROM cuyahoga_section s
INNER JOIN cuyahoga_moduletype m on m.moduletypeid = s.moduletypeid
WHERE m.Name = 'Articles';
INSERT INTO cuyahoga_sectionsetting (sectionid, name, value)
SELECT sectionid, 'SHOW_AUTHOR', 'True'
FROM cuyahoga_section s
INNER JOIN cuyahoga_moduletype m on m.moduletypeid = s.moduletypeid
WHERE m.Name = 'Articles';
/*
* Add siteid FK to ArticleCategory
*/
ALTER TABLE cm_articlecategory
ADD COLUMN siteid int4;
-- by default, all categories are linked to the first site
UPDATE cm_articlecategory
SET siteid = (SELECT MIN(siteid) FROM cuyahoga_site);
ALTER TABLE cm_articlecategory
ALTER COLUMN siteid SET NOT NULL;
ALTER TABLE cm_articlecategory
ADD CONSTRAINT FK_articlecategory_site_siteid
FOREIGN KEY (siteid) REFERENCES cuyahoga_site (siteid);
/*
* Version
*/
UPDATE cuyahoga_version SET major = 1, minor = 5, patch = 0 WHERE assembly = 'Cuyahoga.Modules'; | true |
eddb28db11744f86f7a5fbe42c7048aee086026c | SQL | katherinevfry/Chinook | /line_item_track_artist.sql | UTF-8 | 225 | 3.5625 | 4 | [] | no_license | SELECT InvoiceId,
t.Name AS TrackName,
ar.Name AS ArtistName
FROM InvoiceLine il
JOIN Track t
ON il.TrackId = t.TrackId
JOIN Album al
ON al.AlbumId = t.AlbumId
JOIN Artist ar
ON ar.ArtistId = al.ArtistId
ORDER BY InvoiceId
| true |
8094d593452125fb0642e18947d34a1deec0c3d3 | SQL | cinnamong/dpool | /cosmos/colorsize.sql | UTF-8 | 1,023 | 2.8125 | 3 | [] | no_license | -- MySQL dump 10.9
--
-- Host: localhost Database: yesusa
-- ------------------------------------------------------
-- Server version 4.1.10
/*!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' */;
--
-- Table structure for table `wiz_colorsize`
--
DROP TABLE IF EXISTS `wiz_colorsize`;
CREATE TABLE `wiz_colorsize` (
`idx` int(10) NOT NULL auto_increment,
`ProdInc` int(10) default NULL,
`MallID` varchar(30) default NULL,
`ColorTxt` varchar(50) default NULL,
`BigImg` text,
`SwatchImg` text,
`ZoomImg1` text,
`ZoomImg2` text,
`SizeList` text,
PRIMARY KEY (`idx`),
KEY `prdcode` (`ProdInc`)
); | true |
22087aa6d4f3bdead63cebd5ea2ae0c7d171136b | SQL | ElderVivot/ConversorTron | /SQLs/fun_pessoal.sql | UTF-8 | 575 | 3.828125 | 4 | [] | no_license | SELECT pessoa.*,
(SELECT MAX(tel.numtel)
FROM TBLTEL as tel
WHERE tel.codpes = pessoa.codpes
AND tel.tippes = pessoa.tippes) as telefone_pessoa,
(SELECT MAX(cid.dddcid)
FROM TBLCID as cid
WHERE cid.codcid = (SELECT MAX(tel.codcid)
FROM TBLTEL as tel
WHERE tel.codpes = pessoa.codpes
AND tel.tippes = pessoa.tippes) ) as ddd_pessoa
FROM tblpes as pessoa
WHERE pessoa.tippes = 'F'
ORDER BY pessoa.codpes, pessoa.tippes
| true |
5983628088f9ac8b9f59fd2a7ce37a7c3798a212 | SQL | pratikdp707/social-app-schema-mysql | /social-media-schema.sql | UTF-8 | 8,602 | 4.09375 | 4 | [] | no_license |
-- creation of schema for social media app
create schema socialAppSchema;
use socialAppSchema;
-- creation of table for user details
CREATE TABLE `socialappschema`.`user_profile` (
`user_id` INT NOT NULL AUTO_INCREMENT,
`email` VARCHAR(45) NULL,
`username` VARCHAR(45) NULL,
`password` VARCHAR(45) NULL,
`first_name` VARCHAR(45) NULL,
`last_name` VARCHAR(45) NULL,
`gender` VARCHAR(45) NULL,
`dob` VARCHAR(45) NULL,
PRIMARY KEY (`user_id`));
-- creation of profile status table for users
CREATE TABLE `socialappschema`.`profile_status` (
`user_id` INT NOT NULL,
`active_status` VARCHAR(45) NOT NULL DEFAULT 'no',
CONSTRAINT `user_id`
FOREIGN KEY (`user_id`)
REFERENCES `socialappschema`.`user_profile` (`user_id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION);
-- creation of friends table for user
CREATE TABLE `socialappschema`.`friends` (
`id` INT NOT NULL AUTO_INCREMENT,
`friend_id` VARCHAR(45) NOT NULL,
`friend_name` VARCHAR(45) NOT NULL,
`user` INT NOT NULL,
`created_at` VARCHAR(45) NOT NULL,
PRIMARY KEY (`id`),
INDEX `user_idx` (`user` ASC) VISIBLE,
CONSTRAINT `user`
FOREIGN KEY (`user`)
REFERENCES `socialappschema`.`user_profile` (`user_id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION);
ALTER TABLE `socialappschema`.`friends`
CHANGE COLUMN `created_at` `created_at` VARCHAR(45) NOT NULL DEFAULT 'CURRENT_TIMESTAMP' ;
ALTER TABLE `socialappschema`.`friends`
CHANGE COLUMN `created_at` `created_at` DATETIME NOT NULL DEFAULT 'CURRENT_TIMESTAMP' ;
-- creation of posts table for user
CREATE TABLE `socialappschema`.`posts` (
`post_id` INT NOT NULL AUTO_INCREMENT,
`content` VARCHAR(200) NOT NULL,
`user_id_from` INT NOT NULL,
`created_at` DATETIME NOT NULL,
PRIMARY KEY (`post_id`),
INDEX `user_id_from_idx` (`user_id_from` ASC) VISIBLE,
CONSTRAINT `user_id_from`
FOREIGN KEY (`user_id_from`)
REFERENCES `socialappschema`.`user_profile` (`user_id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION);
ALTER TABLE `socialappschema`.`posts`
CHANGE COLUMN `created_at` `created_at` DATETIME NULL DEFAULT CURRENT_TIMESTAMP ;
-- creation of comments table for user
CREATE TABLE `socialappschema`.`comments` (
`comment_id` INT NOT NULL AUTO_INCREMENT,
`post_id` INT NOT NULL,
`user_id_from` INT NOT NULL,
`content` VARCHAR(200) NOT NULL,
`created_at` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`comment_id`),
INDEX `on_post_idx` (`post_id` ASC) VISIBLE,
INDEX `comment_from_user_idx` (`user_id_from` ASC) VISIBLE,
CONSTRAINT `on_post`
FOREIGN KEY (`post_id`)
REFERENCES `socialappschema`.`posts` (`post_id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `comment_from_user`
FOREIGN KEY (`user_id_from`)
REFERENCES `socialappschema`.`user_profile` (`user_id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION);
-- creation of likes table for user
CREATE TABLE `socialappschema`.`likes` (
`id` INT NOT NULL AUTO_INCREMENT,
`post_id` INT NOT NULL,
`user_id` INT NOT NULL,
`created_at` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
INDEX `like_on_post_idx` (`post_id` ASC) VISIBLE,
INDEX `user_liked_idx` (`user_id` ASC) VISIBLE,
CONSTRAINT `like_on_post`
FOREIGN KEY (`post_id`)
REFERENCES `socialappschema`.`posts` (`post_id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `user_liked`
FOREIGN KEY (`user_id`)
REFERENCES `socialappschema`.`user_profile` (`user_id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION);
-- creation of login details column for user
CREATE TABLE `socialappschema`.`login_details` (
`id` INT NOT NULL AUTO_INCREMENT,
`user_id` INT NOT NULL,
`login_at` DATETIME NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
INDEX `login_user_idx` (`user_id` ASC) VISIBLE,
CONSTRAINT `login_user`
FOREIGN KEY (`user_id`)
REFERENCES `socialappschema`.`user_profile` (`user_id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION);
-- inserting data into user_profile table
insert into user_profile(user_id,email,username,password,first_name,last_name,gender,dob) values('1','abc@gmail.com','abc','abc123','abc','xyz','male','12-98-2001');
insert into user_profile(email,username,password,first_name,last_name,gender,dob) values('def@gmail.com','def','def123','def','xyz','male','12-12-2003');
insert into user_profile(email,username,password,first_name,last_name,gender,dob) values('ghi@gmail.com','ghi','ghi123','ghi','xyz','male','12-12-2004');
insert into user_profile(email,username,password,first_name,last_name,gender,dob) values('jkl@gmail.com','jkl','jkl123','jkl','xyz','male','12-12-2005');
insert into user_profile(email,username,password,first_name,last_name,gender,dob) values('mno@gmail.com','mno','mno123','mno','xyz','male','12-12-2006');
-- inserting data into profile_status table
insert into profile_status(user_id, active_status) values(1,'yes');
insert into profile_status(user_id) values(2);
insert into profile_status(user_id, active_status) values(3,'yes');
insert into profile_status(user_id, active_status) values(4,'yes');
insert into profile_status(user_id) values(5);
-- inserting data into login details table
insert into login_details(user_id) values(1);
insert into login_details(user_id) values(2);
insert into login_details(user_id) values(3);
insert into login_details(user_id) values(4);
insert into login_details(user_id) values(5);
insert into login_details(user_id) values(1);
insert into login_details(user_id) values(3);
insert into login_details(user_id) values(4);
-- inserting data into friends table
insert into friends(friend_id, friend_name, user) values(1, 'abc', 2);
insert into friends(friend_id, friend_name, user) values(1, 'abc', 4);
insert into friends(friend_id, friend_name, user) values(2, 'def', 1);
insert into friends(friend_id, friend_name, user) values(4, 'jkl', 1);
insert into friends(friend_id, friend_name, user) values(10, 'asa', 1);
insert into friends(friend_id, friend_name, user) values(22, 'yybgf', 5);
-- inserting data into posts table
insert into posts(content, user_id_from) values('Pakistan defeats India for the very first time',1);
insert into posts(content, user_id_from) values('Will Aryan Khan get bail ? ',2);
insert into posts(content, user_id_from) values('Is Ananya Panday involved in drugs racket?',4);
insert into posts(content, user_id_from) values('Ajay Pawar asks BJP to prove the charges agains him !',5);
-- inserting data into comments table
insert into comments(post_id, user_id_from, content) values(1,2,'Well Played Boys!!!');
insert into comments(post_id, user_id_from, content) values(1,4,'Babar and Rizwan just nailed yesterday');
insert into comments(post_id, user_id_from, content) values(2,1,'He should not get bail if he is really involved into this');
insert into comments(post_id, user_id_from, content) values(4,4,'BJP cant prove the charges against Ajay as all the charges are nullable');
insert into comments(post_id, user_id_from, content) values(3,5,'Yes, I heard a news stating Ananya helped Aryan in gettin drugs');
insert into comments(post_id, user_id_from, content) values(1,4,'Hard luck Boys!');
insert into comments(post_id, user_id_from, content) values(4,4,'BJP vs NCP never gonna end!');
-- inserting data into likes table
insert into likes(post_id, user_id) values(1,2);
insert into likes(post_id, user_id) values(1,4);
insert into likes(post_id, user_id) values(2,1);
insert into likes(post_id, user_id) values(2,3);
insert into likes(post_id, user_id) values(3,1);
insert into likes(post_id, user_id) values(3,5);
insert into likes(post_id, user_id) values(4,5);
-- QUERIES
-- 1. in friends table list the data which are matched with user profile id
select distinct friends.friend_id, friend_name from friends JOIN user_profile on friends.friend_id = user_profile.user_id;
-- 2. display all the posts of user id 5
select * from posts where user_id_from = 5;
-- 3. write a query that matching the words or character with %gmail%
select * from user_profile where email like '%gmail%';
-- 4. limit the display data from the table comments for 3 which belongs to user 4
select * from comments where user_id_from = 4 order by created_at desc limit 3;
-- 5. combile profile_status and user_profile and login_details display matchin records
select u.user_id, u.email, u.username, u.first_name, u.last_name, p.active_status, max(l.login_at) from user_profile u, profile_status p, login_details l
where u.user_id=p.user_id and p.active_status = 'yes' and l.user_id = p.user_id group by u.user_id;
| true |
74cf6c2ec17646e353eebd50c4bac0cec33df7e2 | SQL | romarioarruda/cod3r-cursos | /banco-relacional/consultaComJoins.sql | UTF-8 | 447 | 2.765625 | 3 | [] | no_license | select * from cidades;
select * from prefeitos;
select * from cidades as c inner join prefeitos as p on c.id = p.cidade_id;
select * from cidades as c left outer join prefeitos as p on c.id = p.cidade_id;
select * from cidades as c right join prefeitos as p on c.id = p.cidade_id;
select * from cidades as c left outer join prefeitos as p on c.id = p.cidade_id
union
select * from cidades as c right join prefeitos as p on c.id = p.cidade_id; | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.