sql
stringlengths 6
1.05M
|
|---|
/*
Navicat MySQL Data Transfer
Source Server : local
Source Server Version : 50505
Source Host : localhost:3306
Source Database : bdplanificamype
Target Server Type : MYSQL
Target Server Version : 50505
File Encoding : 65001
Date: 2018-02-12 01:20:40
*/
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for articulo
-- ----------------------------
DROP TABLE IF EXISTS `articulo`;
CREATE TABLE `articulo` (
`idArticulo` int(11) NOT NULL AUTO_INCREMENT,
`nombre` varchar(50) NOT NULL,
`precioBase` double NOT NULL,
`stock` double NOT NULL,
`volumen` double NOT NULL,
`tiempoHorasAbastecer` int(11) DEFAULT NULL,
`combinable` tinyint(1) NOT NULL,
`minimoDivisible` double NOT NULL,
`activo` tinyint(1) NOT NULL,
`idMarca` int(11) NOT NULL,
`idTipoCarga` int(11) NOT NULL,
`idUnidadMedida` int(11) NOT NULL,
PRIMARY KEY (`idArticulo`),
KEY `FK_Articulo_Marca_idx` (`idMarca`),
KEY `FK_Articulo_TipoCarga_idx` (`idTipoCarga`),
KEY `FK_Articulo_UnidadMedida_idx` (`idUnidadMedida`),
CONSTRAINT `FK_Articulo_Marca` FOREIGN KEY (`idMarca`) REFERENCES `marca` (`idMarca`) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT `FK_Articulo_TipoCarga` FOREIGN KEY (`idTipoCarga`) REFERENCES `tipocarga` (`idTipoCarga`) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT `FK_Articulo_UnidadMedida` FOREIGN KEY (`idUnidadMedida`) REFERENCES `unidadmedida` (`idUnidadMedida`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=latin1;
-- ----------------------------
-- Records of articulo
-- ----------------------------
INSERT INTO `articulo` VALUES ('1', 'Cemento sol tipo 1', '28.5', '4445', '0.01', null, '1', '1', '1', '2', '1', '3');
INSERT INTO `articulo` VALUES ('2', 'Arena gruesa', '55.5', '4985', '1', null, '0', '0.5', '1', '6', '1', '2');
INSERT INTO `articulo` VALUES ('3', 'Arena fina', '50', '4996', '1', null, '0', '0.5', '1', '11', '1', '2');
INSERT INTO `articulo` VALUES ('4', 'Ladrillo pandereta', '0.5', '11000', '0.001', null, '1', '1', '1', '8', '1', '5');
INSERT INTO `articulo` VALUES ('5', 'Fierro de 1/2\"', '28.5', '4796', '0.01', null, '1', '1', '1', '9', '3', '4');
INSERT INTO `articulo` VALUES ('6', 'Fierro de 5/8\"', '54', '10950', '0.01', null, '1', '1', '1', '9', '3', '4');
INSERT INTO `articulo` VALUES ('7', 'Clavo 2\"', '4.5', '15000', '0', null, '1', '1', '1', '9', '2', '1');
INSERT INTO `articulo` VALUES ('8', 'Yeso', '0.5', '7000', '0', null, '1', '1', '1', '11', '2', '1');
-- ----------------------------
-- Table structure for cargo
-- ----------------------------
DROP TABLE IF EXISTS `cargo`;
CREATE TABLE `cargo` (
`idCargo` int(11) NOT NULL AUTO_INCREMENT,
`nombre` varchar(50) NOT NULL,
`descripcion` varchar(100) NOT NULL,
PRIMARY KEY (`idCargo`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1;
-- ----------------------------
-- Records of cargo
-- ----------------------------
INSERT INTO `cargo` VALUES ('1', 'Administrador del sistema', 'Persona que administra el sistema de informacion.');
INSERT INTO `cargo` VALUES ('2', 'Supervisor', 'Persona que se encarga de la planificacion de los pedidos');
INSERT INTO `cargo` VALUES ('3', 'Recepcionista', 'Persona que registra los nuevos pedidos ');
INSERT INTO `cargo` VALUES ('4', 'Chofer', 'Persona que se encarga de enviar los pedidos al cliente');
-- ----------------------------
-- Table structure for cliente
-- ----------------------------
DROP TABLE IF EXISTS `cliente`;
CREATE TABLE `cliente` (
`idCliente` int(11) NOT NULL AUTO_INCREMENT,
`nombres` varchar(100) DEFAULT NULL,
`apellidoPaterno` varchar(100) DEFAULT NULL,
`apellidoMaterno` varchar(100) DEFAULT NULL,
`razonSocial` varchar(100) DEFAULT NULL,
`numeroDocumento` varchar(20) NOT NULL,
`fechaNacimiento` datetime DEFAULT NULL,
`genero` tinyint(1) DEFAULT NULL,
`telefono` varchar(20) DEFAULT NULL,
`correo` varchar(100) DEFAULT NULL,
`direccion` varchar(100) NOT NULL,
`referencia` varchar(100) DEFAULT NULL,
`credito` tinyint(1) NOT NULL,
`idTipoDocumento` int(11) NOT NULL,
`idZona` int(11) NOT NULL,
PRIMARY KEY (`idCliente`),
KEY `FK_Cliente_TipoDocumento_idx` (`idTipoDocumento`),
KEY `FK_Cliente_Zona_idx` (`idZona`),
CONSTRAINT `FK_Cliente_TipoDocumento` FOREIGN KEY (`idTipoDocumento`) REFERENCES `tipodocumento` (`idTipoDocumento`) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT `FK_Cliente_Zona` FOREIGN KEY (`idZona`) REFERENCES `zona` (`idZona`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=latin1;
-- ----------------------------
-- Records of cliente
-- ----------------------------
INSERT INTO `cliente` VALUES ('1', 'Maria', 'Torres', 'Valencia', null, '88885554', '1999-11-09 00:00:00', '2', '478569856', '<EMAIL>', 'Mz A1 LT 1', 'cerca', '1', '1', '1');
INSERT INTO `cliente` VALUES ('2', 'Juan', 'Perez', 'Garcia', null, '45877785', '1997-02-04 00:00:00', '1', '222315698', '<EMAIL>', 'Mz A2 Lt2', 'cerca', '1', '1', '1');
INSERT INTO `cliente` VALUES ('3', 'Edgar', 'Espinza', 'Torres', null, '85558746', '1960-04-06 00:00:00', '1', '222315648', '<EMAIL>', 'Mz C3 Lt 3', 'cerca', '0', '1', '2');
INSERT INTO `cliente` VALUES ('4', 'yesenia', 'Perez', 'Aguilar', null, '33365295', '1979-02-13 00:00:00', '2', '236555459', '<EMAIL>', 'Mz D4 Lt 4', 'Cerca', '0', '1', '2');
INSERT INTO `cliente` VALUES ('5', 'luis', 'Rios', 'Alejos', null, '12345678', '1979-02-13 00:00:00', '2', '236555459', '<EMAIL>', 'av. siempre viva 301', 'Cerca', '0', '1', '3');
INSERT INTO `cliente` VALUES ('6', 'manuel', 'tupia', 'anticona', null, '12345679', '1979-02-13 00:00:00', '2', '236115459', '<EMAIL>', 'av. siempre viva 302', 'Cerca', '0', '1', '3');
INSERT INTO `cliente` VALUES ('7', 'juan', 'arenas', 'Iparraguirre', null, '12345671', '1979-02-13 00:00:00', '2', '236665459', '<EMAIL>', 'av. siempre viva 303', 'Cerca', '0', '1', '3');
INSERT INTO `cliente` VALUES ('8', 'jose', 'arguedas', 'arguedas', null, '12345675', '2018-02-12 00:00:00', '1', '1472589614', '', 'av. siempre viva 309', '', '0', '1', '3');
-- ----------------------------
-- Table structure for detallepedido
-- ----------------------------
DROP TABLE IF EXISTS `detallepedido`;
CREATE TABLE `detallepedido` (
`idPedido` int(11) NOT NULL,
`idArticulo` int(11) NOT NULL,
`cantidad` double NOT NULL,
`cantidadAtendida` double NOT NULL,
`precioUnitario` double NOT NULL,
`monto` double NOT NULL,
PRIMARY KEY (`idPedido`,`idArticulo`),
KEY `FK_DetallePedido_Articulo_idx` (`idArticulo`),
CONSTRAINT `FK_DetallePedido_Articulo` FOREIGN KEY (`idArticulo`) REFERENCES `articulo` (`idArticulo`) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT `FK_DetallePedido_Pedido` FOREIGN KEY (`idPedido`) REFERENCES `pedido` (`idPedido`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- ----------------------------
-- Records of detallepedido
-- ----------------------------
INSERT INTO `detallepedido` VALUES ('1', '1', '500', '0', '28.5', '14250');
INSERT INTO `detallepedido` VALUES ('1', '2', '10', '0', '55.5', '555');
INSERT INTO `detallepedido` VALUES ('1', '4', '5000', '0', '0.5', '2500');
INSERT INTO `detallepedido` VALUES ('1', '5', '200', '0', '28.5', '5700');
INSERT INTO `detallepedido` VALUES ('2', '1', '50', '0', '28.5', '1425');
INSERT INTO `detallepedido` VALUES ('2', '2', '4', '0', '55.5', '222');
INSERT INTO `detallepedido` VALUES ('2', '3', '2', '0', '50', '100');
INSERT INTO `detallepedido` VALUES ('3', '2', '1', '0', '55.5', '55.5');
INSERT INTO `detallepedido` VALUES ('3', '3', '2', '0', '50', '100');
INSERT INTO `detallepedido` VALUES ('3', '5', '4', '0', '28.5', '114');
INSERT INTO `detallepedido` VALUES ('3', '6', '50', '0', '54', '2700');
INSERT INTO `detallepedido` VALUES ('4', '1', '5', '0', '28.5', '142.5');
-- ----------------------------
-- Table structure for detalleviaje
-- ----------------------------
DROP TABLE IF EXISTS `detalleviaje`;
CREATE TABLE `detalleviaje` (
`idPedido` int(11) NOT NULL,
`idViaje` int(11) NOT NULL,
`idArticulo` int(11) NOT NULL,
`cantidad` double NOT NULL,
`cantidadDescargado` double NOT NULL,
PRIMARY KEY (`idPedido`,`idViaje`,`idArticulo`),
KEY `FK_DetalleViaje_Articulo_idx` (`idArticulo`),
KEY `FK_DetalleViaje_viaje_idx` (`idViaje`),
CONSTRAINT `FK_DetalleViaje_Articulo` FOREIGN KEY (`idArticulo`) REFERENCES `articulo` (`idArticulo`) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT `FK_DetalleViaje_PedidoXViaje_1` FOREIGN KEY (`idPedido`) REFERENCES `pedidoxviaje` (`idPedido`) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT `FK_DetalleViaje_PedidoXViaje_2` FOREIGN KEY (`idViaje`) REFERENCES `pedidoxviaje` (`idViaje`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- ----------------------------
-- Records of detalleviaje
-- ----------------------------
-- ----------------------------
-- Table structure for empleado
-- ----------------------------
DROP TABLE IF EXISTS `empleado`;
CREATE TABLE `empleado` (
`idEmpleado` int(11) NOT NULL AUTO_INCREMENT,
`nombres` varchar(100) NOT NULL,
`apellidoPaterno` varchar(100) NOT NULL,
`apellidoMaterno` varchar(100) NOT NULL,
`numeroDocumento` varchar(20) NOT NULL,
`correo` varchar(100) DEFAULT NULL,
`estado` varchar(50) NOT NULL,
`sueldo` double NOT NULL,
`licencia` varchar(50) DEFAULT NULL,
`fechaIngreso` datetime NOT NULL,
`fechaSalida` datetime DEFAULT NULL,
`idCargo` int(11) NOT NULL,
`idTipoDocumento` int(11) NOT NULL,
PRIMARY KEY (`idEmpleado`),
KEY `FK_Empleado_TipoDocumento_idx` (`idTipoDocumento`),
KEY `FK_Empleado_Cargo_idx` (`idCargo`),
CONSTRAINT `FK_Empleado_Cargo` FOREIGN KEY (`idCargo`) REFERENCES `cargo` (`idCargo`) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT `FK_Empleado_TipoDocumento` FOREIGN KEY (`idTipoDocumento`) REFERENCES `tipodocumento` (`idTipoDocumento`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1;
-- ----------------------------
-- Records of empleado
-- ----------------------------
INSERT INTO `empleado` VALUES ('1', '<NAME>', 'Espinoza', 'Torres', '46618582', '<EMAIL>', 'Activo', '500', null, '2016-05-01 00:00:00', null, '1', '1');
-- ----------------------------
-- Table structure for marca
-- ----------------------------
DROP TABLE IF EXISTS `marca`;
CREATE TABLE `marca` (
`idMarca` int(11) NOT NULL AUTO_INCREMENT,
`nombre` varchar(50) NOT NULL,
PRIMARY KEY (`idMarca`)
) ENGINE=InnoDB AUTO_INCREMENT=12 DEFAULT CHARSET=latin1;
-- ----------------------------
-- Records of marca
-- ----------------------------
INSERT INTO `marca` VALUES ('1', 'Otro');
INSERT INTO `marca` VALUES ('2', 'Sol');
INSERT INTO `marca` VALUES ('3', 'Andino');
INSERT INTO `marca` VALUES ('4', 'Matusita');
INSERT INTO `marca` VALUES ('5', 'Nicoll');
INSERT INTO `marca` VALUES ('6', 'Molina');
INSERT INTO `marca` VALUES ('7', 'Huachipa');
INSERT INTO `marca` VALUES ('8', 'Lark');
INSERT INTO `marca` VALUES ('9', 'Aceros arequipa');
INSERT INTO `marca` VALUES ('10', 'Eternit');
INSERT INTO `marca` VALUES ('11', 'Generico');
-- ----------------------------
-- Table structure for marcavehiculo
-- ----------------------------
DROP TABLE IF EXISTS `marcavehiculo`;
CREATE TABLE `marcavehiculo` (
`idMarcaVehiculo` int(11) NOT NULL AUTO_INCREMENT,
`nombre` varchar(50) NOT NULL,
PRIMARY KEY (`idMarcaVehiculo`)
) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=latin1;
-- ----------------------------
-- Records of marcavehiculo
-- ----------------------------
INSERT INTO `marcavehiculo` VALUES ('1', 'otro');
INSERT INTO `marcavehiculo` VALUES ('2', 'toyota');
INSERT INTO `marcavehiculo` VALUES ('3', 'mitsubishi');
INSERT INTO `marcavehiculo` VALUES ('4', 'izuzu');
INSERT INTO `marcavehiculo` VALUES ('5', 'volvo');
INSERT INTO `marcavehiculo` VALUES ('6', 'suzuki');
INSERT INTO `marcavehiculo` VALUES ('7', 'isuzu');
-- ----------------------------
-- Table structure for pedido
-- ----------------------------
DROP TABLE IF EXISTS `pedido`;
CREATE TABLE `pedido` (
`idPedido` int(11) NOT NULL AUTO_INCREMENT,
`fechaRegistro` datetime NOT NULL,
`fechaEnvio` datetime NOT NULL,
`montoTotal` double NOT NULL,
`montoPagado` double NOT NULL,
`estado` varchar(20) NOT NULL,
`telefono` varchar(15) DEFAULT NULL,
`direccion` varchar(100) NOT NULL,
`referencia` varchar(200) DEFAULT NULL,
`idZona` int(11) NOT NULL,
`idCliente` int(11) NOT NULL,
`idEmpleado` int(11) NOT NULL,
PRIMARY KEY (`idPedido`),
KEY `FK_Pedido_Cliente_idx` (`idCliente`),
KEY `FK_Pedido_Empleado_idx` (`idEmpleado`),
KEY `FK_Pedido_Zona_idx` (`idZona`),
CONSTRAINT `FK_Pedido_Cliente` FOREIGN KEY (`idCliente`) REFERENCES `cliente` (`idCliente`) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT `FK_Pedido_Empleado` FOREIGN KEY (`idEmpleado`) REFERENCES `empleado` (`idEmpleado`) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT `FK_Pedido_Zona` FOREIGN KEY (`idZona`) REFERENCES `zona` (`idZona`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1;
-- ----------------------------
-- Records of pedido
-- ----------------------------
INSERT INTO `pedido` VALUES ('1', '2018-02-12 00:41:28', '2018-02-12 00:00:00', '23005', '23000', 'Confirmado', '236115459', 'av. siempre viva 302', 'Cerca', '3', '6', '1');
INSERT INTO `pedido` VALUES ('2', '2018-02-12 00:49:18', '2018-02-12 00:00:00', '1747', '1747', 'Confirmado', '236555459', 'av. siempre viva 301', 'Cerca', '3', '5', '1');
INSERT INTO `pedido` VALUES ('3', '2018-02-12 00:50:41', '2018-02-12 00:00:00', '2969.5', '2970', 'Confirmado', '236665459', 'av. siempre viva 303', 'Cerca', '3', '7', '1');
INSERT INTO `pedido` VALUES ('4', '2018-02-12 01:02:01', '2018-02-12 00:00:00', '142.5', '142.5', 'Confirmado', '1472589614', 'av. siempre viva 309', '', '3', '8', '1');
-- ----------------------------
-- Table structure for pedidoxviaje
-- ----------------------------
DROP TABLE IF EXISTS `pedidoxviaje`;
CREATE TABLE `pedidoxviaje` (
`idPedido` int(11) NOT NULL,
`idViaje` int(11) NOT NULL,
`montoCobrado` double DEFAULT NULL,
`fechaAlmacen` datetime DEFAULT NULL,
`fechaUbicado` datetime DEFAULT NULL,
`fechaEntrega` datetime DEFAULT NULL,
`observaciones` varchar(200) DEFAULT NULL,
PRIMARY KEY (`idPedido`,`idViaje`),
KEY `FK_PedidoXViaje_Viaje_idx` (`idViaje`),
CONSTRAINT `FK_PedidoXViaje_Pedido` FOREIGN KEY (`idPedido`) REFERENCES `pedido` (`idPedido`) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT `FK_PedidoXViaje_Viaje` FOREIGN KEY (`idViaje`) REFERENCES `viaje` (`idViaje`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- ----------------------------
-- Records of pedidoxviaje
-- ----------------------------
-- ----------------------------
-- Table structure for tipocarga
-- ----------------------------
DROP TABLE IF EXISTS `tipocarga`;
CREATE TABLE `tipocarga` (
`idTipoCarga` int(11) NOT NULL AUTO_INCREMENT,
`nombre` varchar(50) NOT NULL,
`descripcion` varchar(100) DEFAULT NULL,
PRIMARY KEY (`idTipoCarga`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1;
-- ----------------------------
-- Records of tipocarga
-- ----------------------------
INSERT INTO `tipocarga` VALUES ('1', 'Carga normal', 'Es la carga que va en la tolva del camion');
INSERT INTO `tipocarga` VALUES ('2', 'Carga pequeña', 'Es la carga de poco volumen que puede ser transportado en la cabina.');
INSERT INTO `tipocarga` VALUES ('3', 'Carga aerea', 'Es la carga que va en la superior de la tolva.');
-- ----------------------------
-- Table structure for tipodocumento
-- ----------------------------
DROP TABLE IF EXISTS `tipodocumento`;
CREATE TABLE `tipodocumento` (
`idTipoDocumento` int(11) NOT NULL AUTO_INCREMENT,
`nombre` varchar(45) NOT NULL,
`descripcion` varchar(200) NOT NULL,
PRIMARY KEY (`idTipoDocumento`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1;
-- ----------------------------
-- Records of tipodocumento
-- ----------------------------
INSERT INTO `tipodocumento` VALUES ('1', 'DNI', 'Documento nacional de identidad de un ciudadano peruano');
INSERT INTO `tipodocumento` VALUES ('2', 'Pasaporte', 'Documento de identificación para los extranjeros');
-- ----------------------------
-- Table structure for tipovehiculo
-- ----------------------------
DROP TABLE IF EXISTS `tipovehiculo`;
CREATE TABLE `tipovehiculo` (
`idTipoVehiculo` int(11) NOT NULL AUTO_INCREMENT,
`nombre` varchar(50) NOT NULL,
`descripcion` varchar(100) DEFAULT NULL,
PRIMARY KEY (`idTipoVehiculo`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1;
-- ----------------------------
-- Records of tipovehiculo
-- ----------------------------
INSERT INTO `tipovehiculo` VALUES ('1', 'Camioneta pequeña', null);
INSERT INTO `tipovehiculo` VALUES ('2', 'Camioneta normal', null);
INSERT INTO `tipovehiculo` VALUES ('3', 'Camioneta grande', null);
-- ----------------------------
-- Table structure for tipovehiculoxtipocarga
-- ----------------------------
DROP TABLE IF EXISTS `tipovehiculoxtipocarga`;
CREATE TABLE `tipovehiculoxtipocarga` (
`idTipoVehiculo` int(11) NOT NULL,
`idTipoCarga` int(11) NOT NULL,
`volumen` double DEFAULT NULL,
PRIMARY KEY (`idTipoVehiculo`,`idTipoCarga`),
KEY `FK_TipoVehiculoXTipoCarga_TipoCarga_idx` (`idTipoCarga`),
CONSTRAINT `FK_TipoVehiculoXTipoCarga_TipoCarga` FOREIGN KEY (`idTipoCarga`) REFERENCES `tipocarga` (`idTipoCarga`) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT `FK_TipoVehiculoXTipoCarga_TipoVehiculo` FOREIGN KEY (`idTipoVehiculo`) REFERENCES `tipovehiculo` (`idTipoVehiculo`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- ----------------------------
-- Records of tipovehiculoxtipocarga
-- ----------------------------
INSERT INTO `tipovehiculoxtipocarga` VALUES ('1', '1', '2');
INSERT INTO `tipovehiculoxtipocarga` VALUES ('1', '2', '0.01');
INSERT INTO `tipovehiculoxtipocarga` VALUES ('1', '3', '1');
INSERT INTO `tipovehiculoxtipocarga` VALUES ('2', '1', '3');
INSERT INTO `tipovehiculoxtipocarga` VALUES ('2', '2', '0.01');
INSERT INTO `tipovehiculoxtipocarga` VALUES ('2', '3', '1.5');
INSERT INTO `tipovehiculoxtipocarga` VALUES ('3', '1', '4');
INSERT INTO `tipovehiculoxtipocarga` VALUES ('3', '2', '0.01');
INSERT INTO `tipovehiculoxtipocarga` VALUES ('3', '3', '1.7');
-- ----------------------------
-- Table structure for tipovehiculoxzona
-- ----------------------------
DROP TABLE IF EXISTS `tipovehiculoxzona`;
CREATE TABLE `tipovehiculoxzona` (
`idTipoVehiculo` int(11) NOT NULL,
`idZona` int(11) NOT NULL,
`Disponible` tinyint(1) NOT NULL,
PRIMARY KEY (`idTipoVehiculo`,`idZona`),
KEY `FK_TipoVehiculoXZona_Zona_idx` (`idZona`),
CONSTRAINT `FK_TipoVehiculoXZona_TipoVehiculo` FOREIGN KEY (`idTipoVehiculo`) REFERENCES `tipovehiculo` (`idTipoVehiculo`) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT `FK_TipoVehiculoXZona_Zona` FOREIGN KEY (`idZona`) REFERENCES `zona` (`idZona`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- ----------------------------
-- Records of tipovehiculoxzona
-- ----------------------------
-- ----------------------------
-- Table structure for unidadmedida
-- ----------------------------
DROP TABLE IF EXISTS `unidadmedida`;
CREATE TABLE `unidadmedida` (
`idUnidadMedida` int(11) NOT NULL AUTO_INCREMENT,
`nombre` varchar(100) NOT NULL,
PRIMARY KEY (`idUnidadMedida`)
) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=latin1;
-- ----------------------------
-- Records of unidadmedida
-- ----------------------------
INSERT INTO `unidadmedida` VALUES ('1', 'kg');
INSERT INTO `unidadmedida` VALUES ('2', 'm3');
INSERT INTO `unidadmedida` VALUES ('3', 'bolsa');
INSERT INTO `unidadmedida` VALUES ('4', 'varilla');
INSERT INTO `unidadmedida` VALUES ('5', 'unidad');
INSERT INTO `unidadmedida` VALUES ('6', 'lata');
INSERT INTO `unidadmedida` VALUES ('7', 'balon');
-- ----------------------------
-- Table structure for users
-- ----------------------------
DROP TABLE IF EXISTS `users`;
CREATE TABLE `users` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(100) NOT NULL,
`usuario` varchar(100) NOT NULL,
`password` varchar(100) NOT NULL,
`remember_token` varchar(100) DEFAULT NULL,
`idEmpleado` int(11) NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `usuario_UNIQUE` (`usuario`),
KEY `FK_Usuario_Empleado_idx` (`idEmpleado`),
CONSTRAINT `FK_Usuario_Empleado` FOREIGN KEY (`idEmpleado`) REFERENCES `empleado` (`idEmpleado`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1;
-- ----------------------------
-- Records of users
-- ----------------------------
INSERT INTO `users` VALUES ('1', '46618582', '46618582', '$2y$10$wezuiI.XdVAMmAowTqtvVe9OSJSAx3r4rdhBeg7ehskeIJPwaJ446', null, '1', null, null);
-- ----------------------------
-- Table structure for vehiculo
-- ----------------------------
DROP TABLE IF EXISTS `vehiculo`;
CREATE TABLE `vehiculo` (
`idVehiculo` int(11) NOT NULL AUTO_INCREMENT,
`nombre` varchar(50) NOT NULL,
`anio` varchar(50) DEFAULT NULL,
`modelo` varchar(50) DEFAULT NULL,
`placa` varchar(50) DEFAULT NULL,
`idMarcaVehiculo` int(11) NOT NULL,
`idTipoVehiculo` int(11) NOT NULL,
PRIMARY KEY (`idVehiculo`),
KEY `FK_Vehiculo_TipoVehiculo_idx` (`idTipoVehiculo`),
KEY `FK_Vehiculo_MarcaVehiculo_idx` (`idMarcaVehiculo`),
CONSTRAINT `FK_Vehiculo_MarcaVehiculo` FOREIGN KEY (`idMarcaVehiculo`) REFERENCES `marcavehiculo` (`idMarcaVehiculo`) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT `FK_Vehiculo_TipoVehiculo` FOREIGN KEY (`idTipoVehiculo`) REFERENCES `tipovehiculo` (`idTipoVehiculo`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=latin1;
-- ----------------------------
-- Records of vehiculo
-- ----------------------------
INSERT INTO `vehiculo` VALUES ('1', 'Azul pequeño 1', '2016', 'PEQ', 'PEQ101', '1', '1');
INSERT INTO `vehiculo` VALUES ('2', 'Azul pequeño 2', '2016', 'PEQ', 'PEQ102', '1', '1');
INSERT INTO `vehiculo` VALUES ('3', 'Azul mediano 1', '2015', 'MED', 'MED201', '1', '2');
INSERT INTO `vehiculo` VALUES ('4', 'Azul mediano 2', '2015', 'MED', 'MED202', '1', '2');
INSERT INTO `vehiculo` VALUES ('5', 'Azul grande 1', '2014', 'GRA', 'GRA301', '1', '3');
-- ----------------------------
-- Table structure for viaje
-- ----------------------------
DROP TABLE IF EXISTS `viaje`;
CREATE TABLE `viaje` (
`idViaje` int(11) NOT NULL AUTO_INCREMENT,
`fechaRegistro` datetime NOT NULL,
`fechaSalida` datetime DEFAULT NULL,
`fechaRetorno` datetime DEFAULT NULL,
`estado` varchar(50) NOT NULL,
`idVehiculo` int(11) DEFAULT NULL,
`idEmpleado` int(11) DEFAULT NULL,
`idTipoVehiculo` int(11) NOT NULL,
PRIMARY KEY (`idViaje`),
KEY `FK_Viaje_Empleado_idx` (`idEmpleado`),
KEY `FK_Viaje_Vehiculo_idx` (`idVehiculo`),
KEY `FK_Viaje_TipoVehiculo_idx` (`idTipoVehiculo`),
CONSTRAINT `FK_Viaje_Empleado` FOREIGN KEY (`idEmpleado`) REFERENCES `empleado` (`idEmpleado`) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT `FK_Viaje_TipoVehiculo` FOREIGN KEY (`idTipoVehiculo`) REFERENCES `tipovehiculo` (`idTipoVehiculo`) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT `FK_Viaje_Vehiculo` FOREIGN KEY (`idVehiculo`) REFERENCES `vehiculo` (`idVehiculo`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- ----------------------------
-- Records of viaje
-- ----------------------------
-- ----------------------------
-- Table structure for zona
-- ----------------------------
DROP TABLE IF EXISTS `zona`;
CREATE TABLE `zona` (
`idZona` int(11) NOT NULL AUTO_INCREMENT,
`nombre` varchar(50) NOT NULL,
`urbanizacion` varchar(50) NOT NULL,
`montoFlete` double NOT NULL,
PRIMARY KEY (`idZona`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=latin1;
-- ----------------------------
-- Records of zona
-- ----------------------------
INSERT INTO `zona` VALUES ('1', 'Casa blanca', 'Casa blanca', '15');
INSERT INTO `zona` VALUES ('2', 'Montenegro', 'Montenegro', '20');
INSERT INTO `zona` VALUES ('3', 'Cristo rey bajo', 'Cristo rey', '10');
INSERT INTO `zona` VALUES ('4', 'Cristo rey alto', 'Cristo rey', '15');
INSERT INTO `zona` VALUES ('5', '10 de octubre', '10 de octubre', '20');
|
-- phpMyAdmin SQL Dump
-- version 5.0.4
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Waktu pembuatan: 31 Jan 2022 pada 04.31
-- Versi server: 10.4.16-MariaDB
-- Versi PHP: 7.4.12
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: `pendataan_buku`
--
-- --------------------------------------------------------
--
-- Struktur dari tabel `migrations`
--
CREATE TABLE `migrations` (
`id` int(10) UNSIGNED NOT NULL,
`migration` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`batch` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data untuk tabel `migrations`
--
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES
(1, '2014_10_12_000000_create_users_table', 1),
(2, '2014_10_12_100000_create_password_resets_table', 1),
(3, '2022_01_28_072140_create_table_kategori', 2),
(6, '2022_01_28_090330_create_table_bukus', 3);
-- --------------------------------------------------------
--
-- Struktur dari tabel `m_buku`
--
CREATE TABLE `m_buku` (
`id` int(10) UNSIGNED NOT NULL,
`kategori` int(11) NOT NULL,
`judul` varchar(115) COLLATE utf8mb4_unicode_ci NOT NULL,
`keterangan` text COLLATE utf8mb4_unicode_ci NOT NULL,
`stock` int(11) NOT NULL,
`penulis` varchar(115) COLLATE utf8mb4_unicode_ci NOT NULL,
`gambar` text COLLATE utf8mb4_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data untuk tabel `m_buku`
--
INSERT INTO `m_buku` (`id`, `kategori`, `judul`, `keterangan`, `stock`, `penulis`, `gambar`, `created_at`, `updated_at`) VALUES
(10, 8, 'Into The Wild', '<p>Into the Wild yang ditulis pada 1996, adalah buku non-fiksi tentang kehidupan seorang hiker atau pejalan kaki asal Amerika, <NAME>.<br></p>', 10, '<NAME>', 'Into The Wild.jpg', '2022-01-28 22:07:08', '2022-01-28 22:07:08'),
(11, 8, 'The Lightning Thief', '<p>Film ini berawal dari cerita <NAME> (Logan Lerman), seorang anak remaja yang belum tahu sejarah keturunannya. Ia bahkan tidak tahu bahwa dirinya adalah keturunan Dewa Laut dari Yunani Kuno, Poseidon, dan seorang Demigod (setengah dewa setengah manusia)<br></p>', 5, '<NAME>', 'The Lightning Thief.jpg', '2022-01-30 20:30:00', '2022-01-30 20:30:00');
-- --------------------------------------------------------
--
-- Struktur dari tabel `m_kategori`
--
CREATE TABLE `m_kategori` (
`id` int(10) UNSIGNED NOT NULL,
`nama` varchar(115) COLLATE utf8mb4_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data untuk tabel `m_kategori`
--
INSERT INTO `m_kategori` (`id`, `nama`, `created_at`, `updated_at`) VALUES
(5, 'Komik', '2022-01-28 04:03:12', '2022-01-28 04:03:30'),
(7, 'Horor', '2022-01-28 07:28:40', '2022-01-28 07:28:40'),
(8, 'Adventure', '2022-01-28 07:28:55', '2022-01-28 07:28:55');
-- --------------------------------------------------------
--
-- Struktur dari tabel `password_resets`
--
CREATE TABLE `password_resets` (
`email` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`token` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- --------------------------------------------------------
--
-- Struktur dari tabel `users`
--
CREATE TABLE `users` (
`id` bigint(20) UNSIGNED NOT NULL,
`name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`email` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`email_verified_at` timestamp NULL DEFAULT NULL,
`password` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`remember_token` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data untuk tabel `users`
--
INSERT INTO `users` (`id`, `name`, `email`, `email_verified_at`, `password`, `remember_token`, `created_at`, `updated_at`) VALUES
(11, '<NAME>', '<EMAIL>', NULL, '$2y$10$aM5U9B68t7WWSjnhp/iEr.caMJjme.I.ye7sZvhTDeAyIiMmCDo4G', NULL, '2022-01-30 20:27:30', '2022-01-30 20:27:30');
--
-- Indexes for dumped tables
--
--
-- Indeks untuk tabel `migrations`
--
ALTER TABLE `migrations`
ADD PRIMARY KEY (`id`);
--
-- Indeks untuk tabel `m_buku`
--
ALTER TABLE `m_buku`
ADD PRIMARY KEY (`id`);
--
-- Indeks untuk tabel `m_kategori`
--
ALTER TABLE `m_kategori`
ADD PRIMARY KEY (`id`);
--
-- Indeks untuk tabel `password_resets`
--
ALTER TABLE `password_resets`
ADD KEY `password_resets_email_index` (`email`);
--
-- Indeks untuk tabel `users`
--
ALTER TABLE `users`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `users_email_unique` (`email`);
--
-- AUTO_INCREMENT untuk tabel yang dibuang
--
--
-- AUTO_INCREMENT untuk tabel `migrations`
--
ALTER TABLE `migrations`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7;
--
-- AUTO_INCREMENT untuk tabel `m_buku`
--
ALTER TABLE `m_buku`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=12;
--
-- AUTO_INCREMENT untuk tabel `m_kategori`
--
ALTER TABLE `m_kategori`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=11;
--
-- AUTO_INCREMENT untuk tabel `users`
--
ALTER TABLE `users`
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=12;
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
CREATE TABLE Companies
(
CompanyId int NOT NULL IDENTITY(1, 1) PRIMARY KEY,
CompanyName varchar(255) NOT NULL
)
CREATE TABLE Cars
(
CarId int NOT NULL IDENTITY(1, 1) PRIMARY KEY,
CarName varchar(255) NOT NULL,
CompanyId int FOREIGN KEY REFERENCES Companies(CompanyId) ON DELETE CASCADE
)
|
CREATE TABLE [dbo].[UserDownloads] (
[Id] INT NOT NULL,
[UserId] NVARCHAR (128) NOT NULL,
[DocumentId] NVARCHAR (128) NOT NULL,
[DateDownload] DATETIME NOT NULL,
[FileFormat] NVARCHAR (5) NULL,
CONSTRAINT [PK_dbo.UserDownloads] PRIMARY KEY CLUSTERED ([Id] ASC),
CONSTRAINT [FK_dbo.UserDownloads_dbo.Documents_Id] FOREIGN KEY ([DocumentId]) REFERENCES [dbo].[Documents] ([Id]),
CONSTRAINT [FK_dbo.UserDownloads_dbo.Users_Id] FOREIGN KEY ([UserId]) REFERENCES [dbo].[AspNetUsers] ([Id])
);
|
-- phpMyAdmin SQL Dump
-- version 5.0.2
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Jul 29, 2020 at 03:53 PM
-- Server version: 10.4.13-MariaDB
-- PHP Version: 7.4.8
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: `mypos`
--
-- --------------------------------------------------------
--
-- Table structure for table `customer`
--
CREATE TABLE `customer` (
`customer_id` int(11) NOT NULL,
`name` varchar(100) NOT NULL,
`gender` enum('L','P') NOT NULL,
`phone` varchar(15) NOT NULL,
`address` text NOT NULL,
`created` datetime NOT NULL DEFAULT current_timestamp(),
`updated` datetime DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `customer`
--
INSERT INTO `customer` (`customer_id`, `name`, `gender`, `phone`, `address`, `created`, `updated`) VALUES
(1, '<NAME>', 'L', '0812312731', 'Komplek Saadah 1\r\nJl.Muslim No.21A', '2020-07-27 21:42:47', '2020-07-29 15:02:44'),
(2, 'Khairani', 'L', '08317312312', 'Komplek Saadah 2\r\nJl.Muslim', '2020-07-27 21:53:39', '2020-07-27 15:54:08'),
(3, 'Zoelva', 'L', '08213121', 'Sungai Ulin', '2020-07-29 20:53:55', NULL),
(4, 'Hafiizh', 'L', '08123123123', 'Martapura Kota Kabupaten Banjar', '2020-07-29 20:54:25', NULL);
-- --------------------------------------------------------
--
-- Table structure for table `p_category`
--
CREATE TABLE `p_category` (
`category_id` int(11) NOT NULL,
`name` varchar(100) NOT NULL,
`created` datetime NOT NULL DEFAULT current_timestamp(),
`updated` datetime DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `p_category`
--
INSERT INTO `p_category` (`category_id`, `name`, `created`, `updated`) VALUES
(2, 'Makanan', '2020-07-27 22:07:25', NULL),
(3, 'Minuman', '2020-07-27 22:17:41', '2020-07-28 08:37:51');
-- --------------------------------------------------------
--
-- Table structure for table `p_item`
--
CREATE TABLE `p_item` (
`item_id` int(11) NOT NULL,
`barcode` varchar(100) DEFAULT NULL,
`name` varchar(100) DEFAULT NULL,
`category_id` int(11) NOT NULL,
`unit_id` int(11) NOT NULL,
`price` int(11) DEFAULT NULL,
`stock` int(10) NOT NULL DEFAULT 0,
`image` varchar(100) DEFAULT NULL,
`created` datetime NOT NULL DEFAULT current_timestamp(),
`updated` datetime DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `p_item`
--
INSERT INTO `p_item` (`item_id`, `barcode`, `name`, `category_id`, `unit_id`, `price`, `stock`, `image`, `created`, `updated`) VALUES
(2, 'A001', 'Indomie', 2, 2, 2000, 45, 'item200728-a2657ce050.png', '2020-07-28 12:17:45', '2020-07-28 17:03:28'),
(4, 'A002', '<NAME>', 3, 4, 12000, 13, 'item200728-5bec580e2b.jpg', '2020-07-28 12:20:29', '2020-07-28 17:03:37'),
(6, 'A003', '<NAME>', 3, 4, 3000, 0, 'item200728-f5e90357bf.jpg', '2020-07-28 14:37:42', '2020-07-28 17:03:44'),
(13, 'A006', 'Milo', 3, 4, 4000, 23, 'item200728-ca1e177e42.jpg', '2020-07-28 21:11:56', '2020-07-28 17:01:55'),
(14, 'A007', 'Biskuit roma', 2, 4, 40000, 42, 'item200728-4cc3498279.jpg', '2020-07-28 23:03:02', NULL),
(15, 'A008', 'kong guan', 2, 2, 100000, 14, 'item200728-1a39e7e4e4.jpg', '2020-07-28 23:04:38', NULL),
(16, 'A009', 'Ultramilk', 3, 4, 5000, 0, 'item200728-c4c7678125.jpg', '2020-07-28 23:06:20', NULL),
(17, 'A010', 'Oreo', 2, 4, 9000, 0, 'item200728-371e8b4699.jpg', '2020-07-28 23:07:34', NULL),
(18, 'A011', 'Biskuat', 2, 4, 12000, 0, 'item200728-09ac29eb16.jpg', '2020-07-28 23:08:44', NULL),
(19, 'A012', 'Aqua', 2, 4, 1000, 0, 'item200728-09583256bd.jpg', '2020-07-28 23:10:25', NULL),
(20, 'A013', 'Ades', 2, 4, 10000, 0, 'item200728-719e14a9d1.jpg', '2020-07-28 23:11:04', NULL),
(21, 'A014', 'bumbu nasi goreng', 2, 4, 9000, 0, 'item200728-50a117088f.jpg', '2020-07-28 23:13:09', NULL);
-- --------------------------------------------------------
--
-- Table structure for table `p_unit`
--
CREATE TABLE `p_unit` (
`unit_id` int(11) NOT NULL,
`name` varchar(100) NOT NULL,
`created` datetime NOT NULL DEFAULT current_timestamp(),
`updated` datetime DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `p_unit`
--
INSERT INTO `p_unit` (`unit_id`, `name`, `created`, `updated`) VALUES
(2, 'Kilogram', '2020-07-27 22:07:25', '2020-07-27 16:28:37'),
(4, 'Buah', '2020-07-27 22:28:43', NULL);
-- --------------------------------------------------------
--
-- Table structure for table `supplier`
--
CREATE TABLE `supplier` (
`supplier_id` int(11) NOT NULL,
`name` varchar(100) NOT NULL,
`phone` varchar(15) NOT NULL,
`address` varchar(200) NOT NULL,
`description` text DEFAULT NULL,
`created` datetime NOT NULL DEFAULT current_timestamp(),
`updated` datetime DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `supplier`
--
INSERT INTO `supplier` (`supplier_id`, `name`, `phone`, `address`, `description`, `created`, `updated`) VALUES
(1, '<NAME>', '0812312314', 'Komplek saadah 2', 'Toko Pakaian Muslim', '2020-07-27 14:06:19', '2020-07-27 14:24:45'),
(2, '<NAME>', '082137324', 'Komplek saadah 1, Jl.Muslim', NULL, '2020-07-27 14:06:19', NULL),
(4, '<NAME>', '081231231', 'Komplek saadah 3', 'Toko Handphone', '2020-07-27 20:03:40', NULL);
-- --------------------------------------------------------
--
-- Table structure for table `t_sale`
--
CREATE TABLE `t_sale` (
`sale_id` int(11) NOT NULL,
`invoice` varchar(50) NOT NULL,
`customer_id` int(11) DEFAULT NULL,
`total_price` int(11) NOT NULL,
`discount` int(11) NOT NULL,
`final_price` int(11) NOT NULL,
`cash` int(11) NOT NULL,
`remaining` int(11) NOT NULL,
`note` text NOT NULL,
`date` date NOT NULL,
`user_id` int(11) NOT NULL,
`created` datetime NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `t_sale`
--
INSERT INTO `t_sale` (`sale_id`, `invoice`, `customer_id`, `total_price`, `discount`, `final_price`, `cash`, `remaining`, `note`, `date`, `user_id`, `created`) VALUES
(1, 'MP2007290001', NULL, 234234, 2342, 234234, 23424, 23423, '', '2020-07-29', 1, '2020-07-29 21:20:40');
-- --------------------------------------------------------
--
-- Table structure for table `t_stock`
--
CREATE TABLE `t_stock` (
`stock_id` int(11) NOT NULL,
`item_id` int(11) NOT NULL,
`type` enum('in','out') NOT NULL,
`detail` varchar(200) NOT NULL,
`supplier_id` int(11) DEFAULT NULL,
`qty` int(10) NOT NULL,
`date` date NOT NULL,
`created` datetime NOT NULL DEFAULT current_timestamp(),
`user_id` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `t_stock`
--
INSERT INTO `t_stock` (`stock_id`, `item_id`, `type`, `detail`, `supplier_id`, `qty`, `date`, `created`, `user_id`) VALUES
(1, 2, 'in', 'Kulakan', 1, 20, '2020-07-29', '2020-07-29 13:43:12', 1),
(3, 4, 'in', 'Kulakan', 4, 13, '2020-07-29', '2020-07-29 14:45:43', 1),
(4, 13, 'in', 'Kulakan', 2, 23, '2020-07-29', '2020-07-29 14:46:00', 1),
(5, 14, 'in', 'Kulakan', 2, 42, '2020-07-29', '2020-07-29 14:46:14', 1),
(6, 2, 'in', 'Tambahan', 2, 25, '2020-07-29', '2020-07-29 15:01:14', 1),
(7, 15, 'in', 'Kulakan', 2, 15, '2020-07-29', '2020-07-29 15:01:25', 1),
(12, 2, 'in', 'Tambahan', 2, 21, '2020-07-29', '2020-07-29 16:27:54', 1),
(14, 15, 'out', 'Hilang', NULL, 1, '2020-07-29', '2020-07-29 16:29:57', 1),
(15, 2, 'out', 'Rusak', NULL, 5, '2020-07-29', '2020-07-29 16:34:14', 1);
-- --------------------------------------------------------
--
-- Table structure for table `user`
--
CREATE TABLE `user` (
`user_id` int(11) NOT NULL,
`username` varchar(40) NOT NULL,
`password` varchar(40) NOT NULL,
`name` varchar(100) NOT NULL,
`address` varchar(200) DEFAULT NULL,
`level` int(1) NOT NULL COMMENT '1:Admin, 2:Kasir'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `user`
--
INSERT INTO `user` (`user_id`, `username`, `password`, `name`, `address`, `level`) VALUES
(1, 'admin', '<PASSWORD>', '<NAME>', '<NAME>', 1),
(3, 'zoelva', '<PASSWORD>', '<NAME>', 'komplek saadah 2, jl.Muslimin', 2),
(5, 'khairani', '8cb2237d0679ca88db6464eac60da96345513964', '<NAME>', 'Komplek saadah 1', 2);
--
-- Indexes for dumped tables
--
--
-- Indexes for table `customer`
--
ALTER TABLE `customer`
ADD PRIMARY KEY (`customer_id`);
--
-- Indexes for table `p_category`
--
ALTER TABLE `p_category`
ADD PRIMARY KEY (`category_id`);
--
-- Indexes for table `p_item`
--
ALTER TABLE `p_item`
ADD PRIMARY KEY (`item_id`),
ADD UNIQUE KEY `barcode` (`barcode`),
ADD KEY `category_id` (`category_id`),
ADD KEY `unit_id` (`unit_id`);
--
-- Indexes for table `p_unit`
--
ALTER TABLE `p_unit`
ADD PRIMARY KEY (`unit_id`);
--
-- Indexes for table `supplier`
--
ALTER TABLE `supplier`
ADD PRIMARY KEY (`supplier_id`);
--
-- Indexes for table `t_sale`
--
ALTER TABLE `t_sale`
ADD PRIMARY KEY (`sale_id`);
--
-- Indexes for table `t_stock`
--
ALTER TABLE `t_stock`
ADD PRIMARY KEY (`stock_id`),
ADD KEY `item_id` (`item_id`),
ADD KEY `supplier_id` (`supplier_id`),
ADD KEY `user_id` (`user_id`);
--
-- Indexes for table `user`
--
ALTER TABLE `user`
ADD PRIMARY KEY (`user_id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `customer`
--
ALTER TABLE `customer`
MODIFY `customer_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
--
-- AUTO_INCREMENT for table `p_category`
--
ALTER TABLE `p_category`
MODIFY `category_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
--
-- AUTO_INCREMENT for table `p_item`
--
ALTER TABLE `p_item`
MODIFY `item_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=22;
--
-- AUTO_INCREMENT for table `p_unit`
--
ALTER TABLE `p_unit`
MODIFY `unit_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;
--
-- AUTO_INCREMENT for table `supplier`
--
ALTER TABLE `supplier`
MODIFY `supplier_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8;
--
-- AUTO_INCREMENT for table `t_sale`
--
ALTER TABLE `t_sale`
MODIFY `sale_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT for table `t_stock`
--
ALTER TABLE `t_stock`
MODIFY `stock_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=16;
--
-- AUTO_INCREMENT for table `user`
--
ALTER TABLE `user`
MODIFY `user_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;
--
-- Constraints for dumped tables
--
--
-- Constraints for table `p_item`
--
ALTER TABLE `p_item`
ADD CONSTRAINT `p_item_ibfk_1` FOREIGN KEY (`category_id`) REFERENCES `p_category` (`category_id`),
ADD CONSTRAINT `p_item_ibfk_2` FOREIGN KEY (`unit_id`) REFERENCES `p_unit` (`unit_id`);
--
-- Constraints for table `t_stock`
--
ALTER TABLE `t_stock`
ADD CONSTRAINT `t_stock_ibfk_1` FOREIGN KEY (`item_id`) REFERENCES `p_item` (`item_id`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `t_stock_ibfk_2` FOREIGN KEY (`supplier_id`) REFERENCES `supplier` (`supplier_id`),
ADD CONSTRAINT `t_stock_ibfk_3` FOREIGN KEY (`user_id`) REFERENCES `user` (`user_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 */;
|
-- randexpr1.test
--
-- db eval {SELECT t1.c+case when t1.a in (select max(coalesce((select coalesce((select coalesce((select max(19+case t1.f when a then e else t1.d end) from t1 where t1.d> -c),b) from t1 where (t1.c=e) and t1.f=17), -a) from t1 where (e not between e and 11)),t1.f)) & cast(avg(t1.a) AS integer)*max(t1.c) from t1 union select count(distinct c)-max(a) & min(t1.b) & (count(*))* -min(f) from t1) then t1.a when exists(select 1 from t1 where not exists(select 1 from t1 where -17>11)) then (13) else 13 end FROM t1 WHERE NOT (19=case when exists(select 1 from t1 where t1.f not between 11 and ~c+b-t1.c*case when t1.f<13+(t1.d) and -t1.f<17 or (b<>b) then ~d else t1.b end) or exists(select 1 from t1 where not exists(select 1 from t1 where t1.e=19)) then c+f*17 else t1.a end and t1.e<13)}
SELECT t1.c+case when t1.a in (select max(coalesce((select coalesce((select coalesce((select max(19+case t1.f when a then e else t1.d end) from t1 where t1.d> -c),b) from t1 where (t1.c=e) and t1.f=17), -a) from t1 where (e not between e and 11)),t1.f)) & cast(avg(t1.a) AS integer)*max(t1.c) from t1 union select count(distinct c)-max(a) & min(t1.b) & (count(*))* -min(f) from t1) then t1.a when exists(select 1 from t1 where not exists(select 1 from t1 where -17>11)) then (13) else 13 end FROM t1 WHERE NOT (19=case when exists(select 1 from t1 where t1.f not between 11 and ~c+b-t1.c*case when t1.f<13+(t1.d) and -t1.f<17 or (b<>b) then ~d else t1.b end) or exists(select 1 from t1 where not exists(select 1 from t1 where t1.e=19)) then c+f*17 else t1.a end and t1.e<13)
|
CREATE TABLE mto_service_items
(
id uuid PRIMARY KEY NOT NULL,
move_task_order_id uuid REFERENCES move_task_orders,
mto_shipment_id uuid REFERENCES mto_shipments,
re_service_id uuid REFERENCES re_services,
meta_id uuid NOT NULL,
meta_type text NOT NULL,
created_at timestamp WITH TIME ZONE NOT NULL,
updated_at timestamp WITH TIME ZONE NOT NULL
);
CREATE INDEX ON mto_service_items (move_task_order_id);
CREATE INDEX ON mto_service_items (mto_shipment_id);
CREATE INDEX ON mto_service_items (re_service_id);
|
SELECT DISTINCT(CITY)
FROM STATION
WHERE REGEXP_LIKE(CITY, '^[^AEIOU].*[^AEIOU]$', 'i');
|
delete from AD_TreeNodeMM where AD_Tree_ID=1000039;
delete from AD_Tree where AD_Tree_ID=1000039;
|
INSERT INTO organization_memberships(user_id, organization_id, member_role)
SELECT owner_id as user_id, id as organization_id, 1 FROM organizations;
ALTER TABLE organizations
DROP COLUMN owner_id;
|
INSERT INTO pet (ID, NAME, AGE, SPECIES) VALUES (PET_SEQUENCE.nextval, 'Totor', 6, 'hedgehog');
|
<gh_stars>1-10
CREATE TABLE IF NOT EXISTS FORMS(
id SERIAL PRIMARY KEY,
type varchar,
status varchar,
data varchar
);
|
INSERT INTO `t_xt_gnjs` VALUES ('1', '超级管理员', '', null, '1', '', '1', 'superadmin', null, null, 'N');
INSERT INTO `t_xt_gnjs` VALUES ('2', '普通员工', '', null, '1', '', '1', 'employee', null, null, 'N');
|
<reponame>trydofor/go-db-ack<filename>demo/sql/tree/test.sql
-- ENV "带空格的 时间" '2018-00-00 00:00:00'
-- ENV DATE_FROM '2018-11-23 12:34:56'
-- ENV ``SELECT YEAR(NOW())`` '2018-00-01 00:00:00'
-- STR USER built_env_user # 直接定义
-- STR HOST built_env_host # 直接定义
-- STR DATE built_env_date # 直接定义
-- STR '2018-00-01 00:00:00' $y4_table #重新定义,以使SQL语法正确。非加引号规则
DROP TABLE IF EXISTS `tx_parcel_$y4_table`;
CREATE TABLE `tx_parcel_$y4_table` LIKE tx_parcel;
-- 替换后
-- CREATE TABLE tx_parcel_2018 LIKE tx_parcel;
-- STR VAL[1] 990001 #直接定义。
-- STR "`COL[]` = VAL[]" "logno = -99009" #直接定义,脱壳,加引号,模式展开。
-- REF VAL[,\t] '多值占位值'
-- STR `COL[]` $COLX
SELECT * FROM tx_parcel WHERE create_time > '2018-11-23 12:34:56' LIMIT 2;
-- OUT FOR 990001
REPLACE INTO tx_parcel ($COLX) VALUES ('多值占位值');
-- 替换后
-- REPLACE INTO tx_parcel (`id`) VALUES ('多值占位值');
UPDATE tx_parcel SET logno = -99009 WHERE id = 990001;
-- 替换后
-- UPDATE tx_parcel SET `id` = VAL[1] ,`create_time` = VAL[2] /*循环加下去,逗号分割*/ WHERE id=990001;
-- RUN END 990001 # 在src上执行
-- OUT END 990001 # 也在 dst上执行
INSERT IGNORE INTO sys_hot_separation VALUES ('tx_parcel', 990001, NOW());
-- REF max_id 'tx_item_no.max_id'
select null as max_id;
-- RUN FOR 'tx_item_no.max_id'
replace into sys_hot_separation values ('tx_item_no', 'tx_item_no.max_id', now());
|
-- name: create-table-repos
CREATE TABLE IF NOT EXISTS repos (
repo_id SERIAL PRIMARY KEY
,repo_user_id INTEGER
,repo_owner VARCHAR(250)
,repo_name VARCHAR(250)
,repo_full_name VARCHAR(250)
,repo_avatar VARCHAR(500)
,repo_link VARCHAR(1000)
,repo_clone VARCHAR(1000)
,repo_branch VARCHAR(500)
,repo_timeout INTEGER
,repo_private BOOLEAN
,repo_trusted BOOLEAN
,repo_allow_pr BOOLEAN
,repo_allow_push BOOLEAN
,repo_allow_deploys BOOLEAN
,repo_allow_tags BOOLEAN
,repo_hash VARCHAR(500)
,repo_scm VARCHAR(50)
,repo_config_path VARCHAR(500)
,repo_gated BOOLEAN
,UNIQUE(repo_full_name)
);
|
CREATE VIEW view17 AS
SELECT 1 AS c1
FROM table63
UNION
SELECT 1 AS c1
FROM table320
UNION
SELECT 1 AS c1
FROM table467
UNION
SELECT 1 AS c1
FROM view48
UNION
SELECT 1 AS c1
FROM view60
UNION
SELECT 1 AS c1
FROM view33;
GO
|
CREATE TABLE test1 (a int, b text);
INSERT INTO test1 VALUES (1, 'one');
CREATE INDEX test1_a_idx ON test1 USING brin (a);
SELECT brin_page_type(get_raw_page('test1_a_idx', 0));
SELECT brin_page_type(get_raw_page('test1_a_idx', 1));
SELECT brin_page_type(get_raw_page('test1_a_idx', 2));
SELECT * FROM brin_metapage_info(get_raw_page('test1_a_idx', 0));
SELECT * FROM brin_metapage_info(get_raw_page('test1_a_idx', 1));
SELECT * FROM brin_revmap_data(get_raw_page('test1_a_idx', 0)) LIMIT 5;
SELECT * FROM brin_revmap_data(get_raw_page('test1_a_idx', 1)) LIMIT 5;
SELECT * FROM brin_page_items(get_raw_page('test1_a_idx', 2), 'test1_a_idx')
ORDER BY blknum, attnum LIMIT 5;
DROP TABLE test1;
|
create table face_info (
id serial primary key,
position_x float8,
position_y float8,
position_z float8,
generic_id int,
generic_name varchar(255),
generic_score float8,
specific_id int,
specific_name varchar(255),
specific_score float8,
width int,
height int,
age int,
gender varchar(255),
bgr bytea,
ros_timestamp float8
);
|
<filename>docker/mariadb/schema.sql
CREATE DATABASE IF NOT EXISTS lab2_php;
CREATE TABLE IF NOT EXISTS `lab2_php`.`urls` (
`id` INT UNSIGNED AUTO_INCREMENT,
`url` VARCHAR(255) DEFAULT '' NOT NULL,
`clicks` INT UNSIGNED DEFAULT '0' NOT NULL,
PRIMARY KEY(`id`)
) ENGINE=INNODB;
|
CREATE PROCEDURE dbo.usp_GetRecentAssessments (
@TeacherId INT
)
AS
BEGIN
SELECT TOP 10
sa.Id ,
ISNULL(sa.UpdatedOn, sa.CreatedOn) Updated ,
tcs.StudentName ,
at.AssessmentName AS Assessment
FROM
dbo.StudentAssessment sa
JOIN dbo.TeacherClassStudent tcs on sa.StudentId = tcs.Id
JOIN dbo.TeacherClass tc on tcs.TeacherClassId = tc.Id
JOIN dbo.AssessmentType at on sa.AssessmentTypeId = at.Id
WHERE
tc.TeacherId = @TeacherId
ORDER BY Updated DESC
END
|
use pettea;
/* mysql --host=mysql-vt2016.csc.kth.se */
/* TODO:
Add every game played to a table ALT get eBot working on server
*/
CREATE TABLE users(
uid VARCHAR(64) NOT NULL,
userName VARCHAR(64),
mmr int,
cs int,
cs1v1 int,
dota int,
dota1v1 int,
trivia int,
gamesPlayed int,
PRIMARY KEY (uid)
);
/*
UPDATE users SET cs = mmr, cs1v1 = 2500, dota = 2500, dota1v1 = 2500, trivia = 0;
UPDATE users SET cs = 2500, cs1v1 = 2500, dota = 2500, dota1v1 = 2500, trivia = 0, gamesPlayed = 0;
// This is left to do
ALTER TABLE users DROP mmr;
// New System to implement, easier to add new game rating
CREATE TABLE users(
uid VARCHAR(64) NOT NULL,
userName VARCHAR(64),
PRIMARY KEY (uid)
);
CREATE TABLE game(
gameName VARCHAR(64) NOT NULL,
PRIMARY KEY (gameName)
);
CREATE TABLE ratings(
uid VARCHAR(64) NOT NULL,
gameName VARCHAR(64) NOT NULL,
userName VARCHAR(64),
mmr int,
gamesPlayed int,
wins int,
losses int,
PRIMARY KEY (uid, gameName),
FOREIGN KEY (uid) REFERENCES users(uid),
FOREIGN KEY (gameName) REFERENCES game(gameName),
FOREIGN KEY (userName) REFERENCES users(userName)
);
*/
|
-- phpMyAdmin SQL Dump
-- version 5.0.2
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1:3306
-- Tempo de geração: 10-Jul-2021 às 20:53
-- Versão do servidor: 5.7.31
-- versão do PHP: 7.3.21
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Banco de dados: `projetophp3`
--
-- --------------------------------------------------------
--
-- Estrutura da tabela `carrinho_usuario`
--
DROP TABLE IF EXISTS `carrinho_usuario`;
CREATE TABLE IF NOT EXISTS `carrinho_usuario` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`nome` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
`preco` float NOT NULL,
`imagem` longblob NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- --------------------------------------------------------
--
-- Estrutura da tabela `livros_busca`
--
DROP TABLE IF EXISTS `livros_busca`;
CREATE TABLE IF NOT EXISTS `livros_busca` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`nome` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
`preco` float NOT NULL,
`imagem` longblob NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=20 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Extraindo dados da tabela `livros_busca`
--
INSERT INTO `livros_busca` (`id`, `nome`, `preco`, `imagem`) VALUES
(2, 'Colecao The Witcher', 179.99, 0x696d6167656e732f7468655f776974636865725f636f6c6563616f2e6a7067),
(3, 'Colecao <NAME>', 159.99, 0x696d6167656e732f68617272795f706f747465725f636f6c6563616f2e706e67),
(4, 'Sen<NAME> A Sociedade Do Anel', 49.99, 0x696d6167656e732f736f636965646164652d646f2d616e656c2e6a7067),
(5, 'Sen<NAME> Duas Torres', 49.99, 0x696d6167656e732f61732d647561732d746f727265732e6a7067),
(6, 'Sen<NAME> O Retorno Do Rei', 49.99, 0x696d6167656e732f7265746f726e6f2d646f2d7265692e6a7067),
(7, 'The Witcher O Ultimo Desejo', 39.99, 0x696d6167656e732f77697463686572312e6a7067),
(8, 'The Witcher A Espada Do Destino', 39.99, 0x696d6167656e732f77697463686572322e6a7067),
(9, 'The Witcher O Sangue Dos Elfos', 39.99, 0x696d6167656e732f77697463686572332e6a7067),
(10, 'The Witcher Tempo De Desprezo', 39.99, 0x696d6167656e732f77697463686572342e6a7067),
(11, 'The Witcher Batismo De Fogo', 39.99, 0x696d6167656e732f77697463686572352e6a7067),
(12, '<NAME>', 29.99, 0x696d6167656e732f6861727279312e6a7067),
(13, '<NAME>', 29.99, 0x696d6167656e732f6861727279322e6a7067),
(14, '<NAME> E o Prisioneiro De Azkaban', 29.99, 0x696d6167656e732f6861727279332e6a7067),
(15, '<NAME> E o Calice De Fofo', 29.99, 0x696d6167656e732f6861727279342e6a7067),
(16, '<NAME> E a Ordem Da Fenix', 29.99, 0x696d6167656e732f6861727279352e6a7067),
(17, '<NAME> E o <NAME>', 32.99, 0x696d6167656e732f6c616472616f2d64652d7261696f732e6a7067),
(18, '<NAME> E o <NAME>', 32.99, 0x696d6167656e732f6d61722d64652d6d6f6e7374726f732e6a7067),
(1, 'Colecao Senhor <NAME>', 199.99, 0x696d6167656e732f73656e686f725f636f6c6563616f2e706e67);
-- --------------------------------------------------------
--
-- Estrutura da tabela `usuarios_registro`
--
DROP TABLE IF EXISTS `usuarios_registro`;
CREATE TABLE IF NOT EXISTS `usuarios_registro` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`usuario` varchar(30) COLLATE utf8_unicode_ci NOT NULL,
`email` varchar(40) COLLATE utf8_unicode_ci NOT NULL,
`senha` varchar(32) COLLATE utf8_unicode_ci NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
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 */;
|
INSERT INTO patient_Treatment VALUES(1,100,'12-may-2017');
INSERT INTO patient_Treatment VALUES(2,101,'22-jun-2017');
INSERT INTO patient_Treatment VALUES(3,102,'30-may-2017');
INSERT INTO patient_Treatment VALUES(10,100,'03-may-2017');
INSERT INTO patient_Treatment VALUES(3,101,'30-may-2017');
INSERT INTO patient_Treatment VALUES(10,102,'03-may-2017');
|
<reponame>cwmaguire/budget
drop table if exists category_budget cascade;
drop table if exists budget_period cascade;
drop table if exists category_rule cascade;
drop table if exists transaction_category cascade;
drop table if exists category cascade;
drop table if exists transaction_child_member cascade;
drop table if exists transaction cascade;
|
SELECT COUNT(*)
FROM
site as s,
so_user as u1,
question as q1,
answer as a1,
tag as t1,
tag_question as tq1,
badge as b,
account as acc
WHERE
s.site_id = q1.site_id
AND s.site_id = u1.site_id
AND s.site_id = a1.site_id
AND s.site_id = t1.site_id
AND s.site_id = tq1.site_id
AND s.site_id = b.site_id
AND q1.id = tq1.question_id
AND q1.id = a1.question_id
AND a1.owner_user_id = u1.id
AND t1.id = tq1.tag_id
AND b.user_id = u1.id
AND acc.id = u1.account_id
AND (s.site_name in ('mathoverflow'))
AND (t1.name in ('co.combinatorics','nt.number-theory','reference-request'))
AND (q1.favorite_count >= 0)
AND (q1.favorite_count <= 1)
AND (u1.upvotes >= 0)
AND (u1.upvotes <= 100)
AND (b.name in ('Citizen Patrol','Critic','Curious','Custodian','Enlightened','Enthusiast','Good Answer','Good Question','Notable Question','Promoter','Revival','Tumbleweed'))
|
/*
Navicat Premium Data Transfer
Source Server : mysql local
Source Server Type : MySQL
Source Server Version : 50621
Source Host : localhost:3306
Source Schema : mdn120202021
Target Server Type : MySQL
Target Server Version : 50621
File Encoding : 65001
Date: 17/04/2021 15:16:27
*/
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for mec_interactive_appraisal
-- ----------------------------
DROP TABLE IF EXISTS `mec_interactive_appraisal`;
CREATE TABLE `mec_interactive_appraisal` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`id_interactive` int(11) NULL DEFAULT NULL,
`idResponse` int(255) NULL DEFAULT NULL,
`username` varchar(20) CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL DEFAULT NULL,
`file` varchar(255) CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL DEFAULT NULL,
`skor_temp` int(11) NOT NULL,
`skor_final` int(11) NOT NULL,
`date_create` datetime(0) NULL DEFAULT NULL,
`user_edit` varchar(20) CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL DEFAULT NULL,
`date_edit` datetime(0) NULL DEFAULT NULL,
`note` varchar(255) CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 9 CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Compact;
SET FOREIGN_KEY_CHECKS = 1;
|
create table SB_NEWS_NewsEntry (
uuid_ VARCHAR(75) null,
newsId LONG not null primary key,
groupId LONG,
companyId LONG,
userId LONG,
userName VARCHAR(75) null,
createDate DATE null,
modifiedDate DATE null,
title VARCHAR(75) null,
description VARCHAR(75) null
);
|
<reponame>joshtantan/bootcampx<filename>migrations/students_cohorts.sql
CREATE TABLE cohorts (
id SERIAL PRIMARY KEY NOT NULL,
name VARCHAR(255) NOT NULL,
start_date DATE,
end_date DATE
);
CREATE TABLE students (
id SERIAL PRIMARY KEY NOT NULL,
name VARCHAR(255) NOT NULL,
email VARCHAR(255),
phone VARCHAR(32),
github VARCHAR(255),
start_date DATE,
end_date DATE,
cohort_id INTEGER REFERENCES cohorts(id) ON DELETE CASCADE
);
|
<reponame>eytienne/esiee-RaPizz
DROP SCHEMA public CASCADE;
CREATE SCHEMA public;
|
CREATE TABLE [store].[Product] (
[ProductId] BIGINT IDENTITY (1, 1) NOT NULL,
[Name] NVARCHAR (255) NOT NULL,
[Description] NVARCHAR (MAX) NULL,
[IsActive] BIT DEFAULT ((1)) NULL,
[Price] MONEY CONSTRAINT [DF_Product_Price] DEFAULT ((20.00)) NULL,
CONSTRAINT [PK_Product] PRIMARY KEY CLUSTERED ([ProductId] ASC)
);
|
<filename>function/ti/getradiocarbonmethodstable.sql
CREATE OR REPLACE FUNCTION ti.getradiocarbonmethodstable()
RETURNS TABLE(radiocarbonmethodid integer, radiocarbonmethod character varying)
LANGUAGE sql
AS $function$
SELECT radiocarbonmethodid, radiocarbonmethod
FROM ndb.radiocarbonmethods;
$function$
|
\copy "aisles" from '/home/fotis/dev_projects/model-based-aqp/input/instacart_2017_05_01/aisles.csv' DELIMITER ',' CSV HEADER;
\copy "departments" from '/home/fotis/dev_projects/model-based-aqp/input/instacart_2017_05_01/departments.csv' DELIMITER ',' CSV HEADER;
\copy "order_products" from '/home/fotis/dev_projects/model-based-aqp/input/instacart_2017_05_01/order_products__prior.csv' DELIMITER ',' CSV HEADER;
\copy "orders" from '/home/fotis/dev_projects/model-based-aqp/input/instacart_2017_05_01/orders.csv' DELIMITER ',' CSV HEADER;
\copy "products" from '/home/fotis/dev_projects/model-based-aqp/input/instacart_2017_05_01/products.csv' DELIMITER ',' CSV HEADER;
copy aisles from 's3://instacart-sample/aisles.csv'
credentials 'aws_iam_role=arn:aws:iam::605088149509:role/myRedshiftRole'
DELIMITER ',' CSV IGNOREHEADER 1 region 'eu-west-1';
copy departments from 's3://instacart-sample/departments.csv'
credentials 'aws_iam_role=arn:aws:iam::605088149509:role/myRedshiftRole'
DELIMITER ',' CSV IGNOREHEADER 1 region 'eu-west-1';
copy order_products from 's3://instacart-sample/order_products__prior.csv'
credentials 'aws_iam_role=arn:aws:iam::605088149509:role/myRedshiftRole'
DELIMITER ',' CSV IGNOREHEADER 1 region 'eu-west-1';
copy orders from 's3://instacart-sample/orders.csv'
credentials 'aws_iam_role=arn:aws:iam::605088149509:role/myRedshiftRole'
DELIMITER ',' CSV IGNOREHEADER 1 region 'eu-west-1';
copy products from 's3://instacart-sample/products.csv'
credentials 'aws_iam_role=arn:aws:iam::605088149509:role/myRedshiftRole'
DELIMITER ',' CSV IGNOREHEADER 1 region 'eu-west-1';
|
<gh_stars>1-10
-- MySQL dump 10.13 Distrib 5.7.16, for Linux (x86_64)
--
-- Host: localhost Database: perflogs
-- ------------------------------------------------------
-- Server version 5.7.16-0ubuntu0.16.04.1
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
--
-- Table structure for table `log`
--
DROP TABLE IF EXISTS `log`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `log` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`version` decimal(10,2) NOT NULL,
`resx` int(11) NOT NULL,
`resy` int(11) NOT NULL,
`msaa` int(11) NOT NULL,
`fov` float NOT NULL,
`url` varchar(256) NOT NULL,
`hash` varchar(64) NOT NULL,
`minftCPU` float NOT NULL,
`medianftCPU` float NOT NULL,
`maxftCPU` float NOT NULL,
`minftGPU` float NOT NULL,
`medianftGPU` float NOT NULL,
`maxftGPU` float NOT NULL,
`OS` varchar(64) NOT NULL,
`sysmem` float NOT NULL,
`processorvendor` varchar(64) NOT NULL,
`processordevice` varchar(64) NOT NULL,
`gpuvendor` varchar(64) NOT NULL,
`gpudevice` varchar(64) NOT NULL,
`gpudriverversion` varchar(64) NOT NULL,
`rendermode` varchar(64) NOT NULL,
PRIMARY KEY (`id`),
KEY `timestamp` (`timestamp`),
KEY `version` (`version`),
KEY `url` (`url`),
KEY `resx` (`resx`),
KEY `resy` (`resy`)
) ENGINE=InnoDB AUTO_INCREMENT=2396 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `log`
--
LOCK TABLES `log` WRITE;
/*!40000 ALTER TABLE `log` DISABLE KEYS */;
/*!40000 ALTER TABLE `log` 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 2016-12-26 11:57:55
|
<reponame>iuri/tutortronics
-- getting rid of backslashes using for escaping
--
-- procedure drop_package/1
--
CREATE OR REPLACE FUNCTION drop_package(
package_name varchar
) RETURNS varchar AS $$
DECLARE
v_rec record;
v_drop_cmd varchar;
v_pkg_name varchar;
BEGIN
raise NOTICE 'DROP PACKAGE: %', package_name;
v_pkg_name := package_name || '__' || '%';
for v_rec in select proname
from pg_proc
where proname like v_pkg_name
order by proname
LOOP
raise NOTICE 'DROPPING FUNCTION: %', v_rec.proname;
v_drop_cmd := get_func_drop_command (v_rec.proname::varchar);
EXECUTE v_drop_cmd;
end loop;
if NOT FOUND then
raise NOTICE 'PACKAGE: % NOT FOUND', package_name;
else
raise NOTICE 'PACKAGE: %: DROPPED', package_name;
end if;
return null;
END;
$$ LANGUAGE plpgsql;
--
-- procedure get_func_definition/2
--
CREATE OR REPLACE FUNCTION get_func_definition(
fname varchar,
args oidvector
) RETURNS text AS $$
DECLARE
nargs integer default 0;
v_pos integer;
v_funcdef text default '';
v_args varchar;
v_one_arg varchar;
v_one_type varchar;
v_nargs integer;
v_src text;
v_rettype varchar;
BEGIN
select proargtypes, pronargs, number_src(prosrc),
(select typname from pg_type where oid = p.prorettype::integer)
into v_args, v_nargs, v_src, v_rettype
from pg_proc p
where proname = fname::name
and proargtypes = args;
v_funcdef := v_funcdef || '
create or replace function ' || fname || '(';
v_pos := position(' ' in v_args);
while nargs < v_nargs loop
nargs := nargs + 1;
if nargs = v_nargs then
v_one_arg := v_args;
v_args := '';
else
v_one_arg := substr(v_args, 1, v_pos - 1);
v_args := substr(v_args, v_pos + 1);
v_pos := position(' ' in v_args);
end if;
select case when nargs = 1
then typname
else ',' || typname
end into v_one_type
from pg_type
where oid = v_one_arg::integer;
v_funcdef := v_funcdef || v_one_type;
end loop;
v_funcdef := v_funcdef || ') returns ' || v_rettype || E' as ''\n' || v_src || ''' language ''plpgsql'';';
return v_funcdef;
END;
$$ LANGUAGE plpgsql stable strict;
-- geting right definition of function's arguments
select define_function_args('acs__add_user','user_id;null,object_type;user,creation_date;now(),creation_user;null,creation_ip;null,authority_id,username,email,url;null,first_names,last_name,password,<PASSWORD>,screen_name;null,email_verified_p;t,member_state;approved');
select define_function_args('acs__remove_user','user_id');
select define_function_args('acs__magic_object_id','name');
select define_function_args('acs_log__notice','log_key,message');
select define_function_args('acs_log__warn','log_key,message');
select define_function_args('acs_log__error','log_key,message');
select define_function_args('acs_log__debug','log_key,message');
select define_function_args('acs_object_type_get_tree_sortkey','object_type');
select define_function_args('acs_object_type__create_type','object_type,pretty_name,pretty_plural,supertype,table_name;null,id_column;null,package_name;null,abstract_p;f,type_extension_table;null,name_method;null,create_table_p;f,dynamic_p;f');
select define_function_args('acs_object_type__drop_type','object_type,drop_children_p;f,drop_table_p;f');
select define_function_args('acs_object_type__pretty_name','object_type');
select define_function_args('acs_object_type__is_subtype_p','object_type_1,object_type_2');
select define_function_args('acs_attribute__create_attribute','object_type,attribute_name,datatype,pretty_name,pretty_plural;null,table_name;null,column_name;null,default_value;null,min_n_values;1,max_n_values;1,sort_order;null,storage;type_specific,static_p;f,create_column_p;f,database_type;null,size;null,null_p;t,references;null,check_expr;null,column_spec;null');
select define_function_args('acs_attribute__drop_attribute','object_type,attribute_name,drop_column_p;f');
select define_function_args('acs_attribute__add_description','object_type,attribute_name,description_key,description');
select define_function_args('acs_attribute__drop_description','object_type,attribute_name,description_key');
select define_function_args('acs_datatype__date_output_function','attribute_name');
select define_function_args('acs_datatype__timestamp_output_function','attribute_name');
select define_function_args('acs_objects_get_tree_sortkey','object_id');
select define_function_args('acs_object__initialize_attributes','initialize_attributes__object_id');
select define_function_args('acs_object__new','object_id;null,object_type;acs_object,creation_date;now(),creation_user;null,creation_ip;null,context_id;null,security_inherit_p;t,title;null,package_id;null');
select define_function_args('acs_object__delete','object_id');
select define_function_args('acs_object__name','name__object_id');
select define_function_args('acs_object__default_name','default_name__object_id');
select define_function_args('acs_object__object_id','p_object_id');
select define_function_args('acs_object__package_id','object_id');
select define_function_args('acs_object__get_attribute_storage','object_id_in,attribute_name_in');
select define_function_args('acs_object__get_attr_storage_column','v_vals');
select define_function_args('acs_object__get_attr_storage_table','v_vals');
select define_function_args('acs_object__get_attr_storage_sql','v_vals');
select define_function_args('acs_object__get_attribute','object_id_in,attribute_name_in');
select define_function_args('acs_object__set_attribute','object_id_in,attribute_name_in,value_in');
select define_function_args('acs_object__check_context_index','check_context_index__object_id,check_context_index__ancestor_id,check_context_index__n_generations');
select define_function_args('acs_object__check_object_ancestors','object_id,ancestor_id,n_generations');
select define_function_args('acs_object__check_object_descendants','object_id,descendant_id,n_generations');
select define_function_args('acs_object__check_path','check_path__object_id,check_path__ancestor_id');
select define_function_args('acs_object__check_representation','check_representation__object_id');
select define_function_args('acs_object__update_last_modified','update_last_modified__object_id,update_last_modified__modifying_user,update_last_modified__modifying_ip,update_last_modified__last_modified;now()');
select define_function_args('acs_object_util__object_type_exist_p','object_type');
select define_function_args('acs_object_util__get_object_type','object_id');
select define_function_args('acs_object_util__type_ancestor_type_p','object_type1,object_type2');
select define_function_args('acs_object_util__object_ancestor_type_p','object_id,object_type');
select define_function_args('acs_object_util__object_type_p','object_id,object_type');
select define_function_args('priv_recurse_subtree','nkey,child_priv');
select define_function_args('acs_privilege__create_privilege','privilege,pretty_name;null,pretty_plural;null');
select define_function_args('acs_privilege__drop_privilege','privilege');
select define_function_args('acs_privilege__add_child','privilege,child_privilege');
select define_function_args('acs_privilege__remove_child','privilege,child_privilege');
select define_function_args('acs_permission__grant_permission','object_id,grantee_id,privilege');
select define_function_args('acs_permission__revoke_permission','object_id,grantee_id,privilege');
select define_function_args('acs_permission__permission_p','object_id,party_id,privilege');
select define_function_args('acs_rel_type__create_role','role,pretty_name;null,pretty_plural;null');
select define_function_args('acs_rel_type__drop_role','role');
select define_function_args('acs_rel_type__role_pretty_name','role');
select define_function_args('acs_rel_type__role_pretty_plural','role');
select define_function_args('acs_rel_type__create_type','rel_type,pretty_name,pretty_plural,supertype;relationship,table_name,id_column,package_name,object_type_one,role_one;null,min_n_rels_one,max_n_rels_one,object_type_two,role_two;null,min_n_rels_two,max_n_rels_two');
select define_function_args('acs_rel_type__drop_type','rel_type,cascade_p;f');
select define_function_args('acs_rel__new','rel_id;null,rel_type;relationship,object_id_one,object_id_two,context_id;null,creation_user;null,creation_ip;null');
select define_function_args('acs_rel__delete','rel_id');
select define_function_args('apm__register_package','package_key,pretty_name,pretty_plural,package_uri,package_type,initial_install_p;f,singleton_p;f,implements_subsite_p;f,inherit_templates_p;f,spec_file_path;null,spec_file_mtime;null');
select define_function_args('apm__update_package','package_key,pretty_name;null,pretty_plural;null,package_uri;null,package_type;null,initial_install_p;null,singleton_p;null,implements_subsite_p;f,inherit_templates_p;f,spec_file_path;null,spec_file_mtime;null');
select define_function_args('apm__unregister_package','package_key,cascade_p;t');
select define_function_args('apm__register_p','package_key');
select define_function_args('apm__register_application','package_key,pretty_name,pretty_plural,package_uri,initial_install_p;f,singleton_p;f,implements_subsite_p;f,inherit_templates_p;f,spec_file_path;null,spec_file_mtime;null');
select define_function_args('apm__unregister_application','package_key,cascade_p;f');
select define_function_args('apm__register_service','package_key,pretty_name,pretty_plural,package_uri,initial_install_p;f,singleton_p;f,implements_subsite_p;f,inherit_templates_p;f,spec_file_path;null,spec_file_mtime;null');
select define_function_args('apm__unregister_service','package_key,cascade_p;f');
select define_function_args('apm__register_parameter','parameter_id;null,package_key,parameter_name,description;null,scope,datatype;string,default_value;null,section_name;null,min_n_values;1,max_n_values;1');
select define_function_args('apm__update_parameter','parameter_id,parameter_name;null,description;null,datatype;string,default_value;null,section_name;null,min_n_values;1,max_n_values;1');
select define_function_args('apm__parameter_p','package_key,parameter_name');
select define_function_args('apm__unregister_parameter','parameter_id;null');
select define_function_args('apm__id_for_name','package_key,parameter_name');
select define_function_args('apm__get_value','package_key,parameter_name');
select define_function_args('apm__set_value','package_key,parameter_name,attr_value');
select define_function_args('apm_package__is_child','parent_package_key,child_package_key');
select define_function_args('apm_package__initialize_parameters','package_id,package_key');
select define_function_args('apm_package__new','package_id;null,instance_name;null,package_key,object_type;apm_package,creation_date;now(),creation_user;null,creation_ip;null,context_id;null');
select define_function_args('apm_package__delete','package_id');
select define_function_args('apm_package__initial_install_p','package_key');
select define_function_args('apm_package__singleton_p','package_key');
select define_function_args('apm_package__num_instances','package_key');
select define_function_args('apm_package__name','package_id');
select define_function_args('apm_package__highest_version','package_key');
select define_function_args('apm_package__parent_id','parent_id__package_id');
select define_function_args('apm_package_version__new','version_id;null,package_key,version_name;null,version_uri,summary,description_format,description,release_date,vendor,vendor_uri,auto_mount,installed_p;f,data_model_loaded_p;f');
select define_function_args('apm_package_version__delete','version_id');
select define_function_args('apm_package_version__enable','version_id');
select define_function_args('apm_package_version__disable','version_id');
select define_function_args('apm_package_version__copy','version_id,new_version_id;null,new_version_name,new_version_uri,copy_owners_p');
select define_function_args('apm_package_version__edit','new_version_id;null,version_id,version_name;null,version_uri,summary,description_format,description,release_date,vendor,vendor_uri,auto_mount,installed_p;f,data_model_loaded_p;f');
select define_function_args('apm_package_version__add_interface','interface_id;null,version_id,interface_uri,interface_version');
select define_function_args('apm_package_version__remove_interface','interface_uri,interface_version,version_id');
select define_function_args('apm_package_version__add_dependency','dependency_type,dependency_id;null,version_id,dependency_uri,dependency_version');
select define_function_args('apm_package_version__remove_dependency','dependency_uri,dependency_version,version_id');
select define_function_args('apm_package_version__sortable_version_name','version_name');
select define_function_args('apm_package_version__version_name_greater','version_name_one,version_name_two');
select define_function_args('apm_package_version__upgrade_p','path,initial_version_name,final_version_name');
select define_function_args('apm_package_version__upgrade','version_id');
select define_function_args('apm_package_type__create_type','package_key,pretty_name,pretty_plural,package_uri,package_type,initial_install_p,singleton_p,implements_subsite_p,inherit_templates_p,spec_file_path;null,spec_file_mtime;null');
select define_function_args('apm_package_type__update_type','package_key,pretty_name;null,pretty_plural;null,package_uri;null,package_type;null,initial_install_p;null,singleton_p;null,implements_subsite_p;null,inherit_templates_p;null,spec_file_path;null,spec_file_mtime;null');
select define_function_args('apm_package_type__drop_type','package_key,cascade_p;f');
select define_function_args('apm_package_type__num_parameters','package_key');
select define_function_args('apm_parameter_value__new','value_id;null,package_id,parameter_id,attr_value');
select define_function_args('apm_parameter_value__delete','value_id;null');
select define_function_args('apm_application__new','application_id;null,instance_name;null,package_key,object_type;apm_application,creation_date;now(),creation_user;null,creation_ip;null,context_id;null');
select define_function_args('apm_application__delete','application_id');
select define_function_args('apm_service__new','service_id;null,instance_name;null,package_key,object_type;apm_service,creation_date;now(),creation_user;null,creation_ip;null,context_id;null');
select define_function_args('apm_service__delete','service_id');
select define_function_args('authority__new','authority_id;null,object_type;authority,short_name,pretty_name,enabled_p;t,sort_order,auth_impl_id;null,pwd_impl_id;null,forgotten_pwd_url;null,change_pwd_url;null,register_impl_id;null,register_url;null,help_contact_text;null,creation_user;null,creation_ip;null,context_id;null');
select define_function_args('authority__del','authority_id');
select define_function_args('party__new','party_id;null,object_type;party,creation_date;now(),creation_user;null,creation_ip;null,email,url;null,context_id;null');
select define_function_args('party__delete','party_id');
select define_function_args('party__name','party_id');
select define_function_args('party__email','party_id');
select define_function_args('person__new','person_id;null,object_type;person,creation_date;now(),creation_user;null,creation_ip;null,email,url;null,first_names,last_name,context_id;null');
select define_function_args('person__delete','person_id');
select define_function_args('person__name','person_id');
select define_function_args('person__first_names','person_id');
select define_function_args('person__last_name','person_id');
select define_function_args('user__new','user_id,object_type;user,creation_date;now(),creation_user,creation_ip,authority_id,username,email,url,first_names,last_name,password,salt,screen_name,email_verified_p;t,context_id');
select define_function_args('acs_user__new','user_id;null,object_type;user,creation_date;now(),creation_user;null,creation_ip;null,authority_id,username,email,url;null,first_names,last_name,password,salt,screen_name;null,email_verified_p;t,context_id;null');
select define_function_args('acs_user__receives_alerts_p','user_id');
select define_function_args('acs_user__approve_email','user_id');
select define_function_args('acs_user__unapprove_email','user_id');
select define_function_args('acs_user__delete','user_id');
select define_function_args('composition_rel__new','rel_id;null,rel_type;composition_rel,object_id_one,object_id_two,creation_user;null,creation_ip;null');
select define_function_args('composition_rel__delete','rel_id');
select define_function_args('composition_rel__check_path_exists_p','component_id,container_id');
select define_function_args('composition_rel__check_index','component_id,container_id');
select define_function_args('composition_rel__check_representation','rel_id');
select define_function_args('membership_rel__new','rel_id;null,rel_type;membership_rel,object_id_one,object_id_two,member_state;approved,creation_user;null,creation_ip;null');
select define_function_args('membership_rel__ban','rel_id');
select define_function_args('membership_rel__approve','rel_id');
select define_function_args('membership_rel__reject','rel_id');
select define_function_args('membership_rel__unapprove','rel_id');
select define_function_args('membership_rel__deleted','rel_id');
select define_function_args('membership_rel__delete','rel_id');
select define_function_args('membership_rel__merge','rel_id');
select define_function_args('membership_rel__check_index','group_id,member_id,container_id');
select define_function_args('membership_rel__check_representation','rel_id');
select define_function_args('acs_group__new','group_id;null,object_type;group,creation_date;now(),creation_user;null,creation_ip;null,email;null,url;null,group_name,join_policy;null,context_id;null');
select define_function_args('acs_group__delete','group_id');
select define_function_args('acs_group__name','group_id');
select define_function_args('acs_group__member_p','party_id,group_id,cascade_membership');
select define_function_args('acs_group__check_representation','group_id');
select define_function_args('admin_rel__new','rel_id;null,rel_type;admin_rel,object_id_one,object_id_two,member_state;approved,creation_user;null,creation_ip;null');
select define_function_args('admin_rel__delete','rel_id');
select define_function_args('group_contains_p','group_id,component_id,rel_id');
select define_function_args('journal_entry__new','journal_id;null,object_id,action,action_pretty;null,creation_date;now(),creation_user;null,creation_ip;null,msg;null');
select define_function_args('journal_entry__delete','journal_id');
select define_function_args('journal_entry__delete_for_object','object_id');
select define_function_args('lob_get_data','lob_id');
select define_function_args('lob_copy','from_id,to_id');
select define_function_args('lob_length','id');
select define_function_args('instr','str,pat,dir,cnt');
select define_function_args('split','string,split_char,element');
select define_function_args('get_func_drop_command','fname');
select define_function_args('drop_package','package_name');
select define_function_args('number_src','v_src');
select define_function_args('get_func_definition','fname,args');
select define_function_args('get_func_header','fname,args');
select define_function_args('int_to_tree_key','intkey');
select define_function_args('tree_key_to_int','tree_key,level');
select define_function_args('tree_ancestor_key','tree_key,level');
select define_function_args('tree_root_key','tree_key');
select define_function_args('tree_leaf_key_to_int','tree_key');
select define_function_args('tree_next_key','parent_key,child_value');
select define_function_args('tree_increment_key','child_sort_key');
select define_function_args('tree_left','key');
select define_function_args('tree_right','key');
select define_function_args('tree_level','tree_key');
select define_function_args('tree_ancestor_p','potential_ancestor,potential_child');
select define_function_args('define_function_args','function,arg_list');
select define_function_args('trigger_type','tgtype');
select define_function_args('rel_constraint__new','constraint_id;null,constraint_type;rel_constraint,constraint_name,rel_segment,rel_side;two,required_rel_segment,context_id;null,creation_user;null,creation_ip;null');
select define_function_args('rel_constraint__delete','constraint_id');
select define_function_args('rel_constraint__get_constraint_id','rel_segment,rel_side,required_rel_segment');
select define_function_args('rel_constraint__violation','rel_id');
select define_function_args('rel_constraint__violation_if_removed','rel_id');
select define_function_args('rel_segment__new','segment_id;null,object_type;rel_segment,creation_date;now(),creation_user;null,creation_ip;null,email;null,url;null,segment_name,group_id,rel_type,context_id;null');
select define_function_args('rel_segment__delete','segment_id');
select define_function_args('rel_segment__get','group_id,rel_type');
select define_function_args('rel_segment__get_or_new','group_id,rel_type,segment_name;null');
select define_function_args('rel_segment__name','segment_id');
select define_function_args('party_approved_member__add_one','party_id,member_id,rel_id');
select define_function_args('party_approved_member__add','party_id,member_id,rel_id,rel_type');
select define_function_args('party_approved_member__remove_one','party_id,member_id,rel_id');
select define_function_args('party_approved_member__remove','party_id,member_id,rel_id,rel_type');
select define_function_args('site_node_object_map__new', 'object_id,node_id');
select define_function_args('site_node_object_map__del', 'object_id');
select define_function_args('site_node_get_tree_sortkey','node_id');
select define_function_args('site_node__new','node_id;null,parent_id;null,name,object_id;null,directory_p,pattern_p;f,creation_user;null,creation_ip;null');
select define_function_args('site_node__delete','node_id');
select define_function_args('site_node__find_pattern','node_id');
select define_function_args('site_node__node_id','url,parent_id;null');
select define_function_args('site_node__url','node_id');
select define_function_args('util__multiple_nextval','v_sequence_name,v_count');
select define_function_args('util__logical_negation','true_or_false');
--- getting triggers right ( names and return values )
CREATE OR REPLACE FUNCTION lobs_delete_tr() RETURNS trigger AS $$
BEGIN
delete from lob_data where lob_id = old.lob_id;
return old;
END;
$$ LANGUAGE plpgsql;
create trigger lobs_delete_tr before delete on lobs
for each row execute procedure lobs_delete_tr();
drop trigger lobs_delete_trig on lobs;
drop function on_lobs_delete();
|
-- MySQL Workbench Forward Engineering
SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;
SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL,ALLOW_INVALID_DATES';
-- -----------------------------------------------------
-- Schema pos_unoesc
-- -----------------------------------------------------
-- -----------------------------------------------------
-- Schema pos_unoesc
-- -----------------------------------------------------
CREATE SCHEMA IF NOT EXISTS `pos_unoesc` DEFAULT CHARACTER SET utf8 COLLATE utf8_bin ;
USE `pos_unoesc` ;
-- -----------------------------------------------------
-- Table `pos_unoesc`.`usuario`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `pos_unoesc`.`usuario` (
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
`email` VARCHAR(255) NOT NULL,
`senha` CHAR(95) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE INDEX `email_UNIQUE` (`email` ASC))
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `pos_unoesc`.`ocorrencia`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `pos_unoesc`.`ocorrencia` (
`id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
`usuario_id` INT UNSIGNED NOT NULL,
`dt_ocorrencia` DATETIME NOT NULL,
PRIMARY KEY (`id`),
INDEX `fk_ocorrencia_usuario_idx` (`usuario_id` ASC),
CONSTRAINT `fk_ocorrencia_usuario`
FOREIGN KEY (`usuario_id`)
REFERENCES `pos_unoesc`.`usuario` (`id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;
SET SQL_MODE=@OLD_SQL_MODE;
SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;
|
DROP TABLE IF EXISTS DK_021;
CREATE TABLE IF NOT EXISTS DK_021
(
id INTEGER NOT NULL,
num SMALLINT NOT NULL,
parentId INTEGER,
name VARCHAR(300) NOT NULL,
constraint code PRIMARY KEY(id,num),
constraint uniqueId UNIQUE(id)
)
|
declare
v_normal_object VARCHAR2(100):=apex_application.g_x01;
v_compare_version VARCHAR2(100):=apex_application.g_x02;
v_ret CLOB;
v_object AMB_OBJECT%ROWTYPE;
v_output CLOB;
begin
AMB_UTIL.set_ajax_header('text/xml');
IF v_compare_version IS NOT NULL AND v_compare_version<> AMB_CONSTANT.BUILD_IN_VERSION THEN
IF v_normal_object IS NOT NULL THEN
v_object:=AMB_BIZ_OBJECT.get_object(v_normal_object);
FOR co in (select * from AMB_OBJECT WHERE VERSION_ID=v_compare_version AND NAME=v_object.NAME AND TYPE=v_object.TYPE )
LOOP
v_ret:=co.ID;
END LOOP;
END IF;
END IF;
--build in schema object
IF v_compare_version = AMB_CONSTANT.BUILD_IN_VERSION THEN
v_object:=AMB_BIZ_OBJECT.get_object(v_normal_object);
v_ret:=v_object.NAME||'@'||v_object.TYPE;
END IF;
select XMLSerialize(DOCUMENT XMLElement("codes",XMLForest(v_ret as "unchange")) AS CLOB) INTO v_output from dual;
AMB_UTIL.print_clob(v_output);
EXCEPTION WHEN OTHERS THEN
v_output:='<fail>'||SQLERRM||'</fail>';
AMB_UTIL.print_clob(v_output);
end;
|
<reponame>VEuPathDB/offprint<filename>lib/sql/oprdb.create.userdb.user.sql
DEFINE user=&1
DEFINE passwd=&2
CREATE USER &&user IDENTIFIED BY &&passwd DEFAULT TABLESPACE USERS TEMPORARY TABLESPACE TEMP;
ALTER USER &&user ACCOUNT UNLOCK;
GRANT CREATE SESSION TO &&user;
GRANT RESOURCE TO &&user;
ALTER USER &&user DEFAULT ROLE ALL;
ALTER USER &&user QUOTA UNLIMITED ON USERS;
ALTER USER &&user QUOTA UNLIMITED ON GUS;
GRANT COMM_WDK_W TO &&user;
-- ACL used by EuPathDB /dashboard to run
-- select UTL_INADDR.get_host_name as server_name, UTL_INADDR.get_host_address as server_ip from dual;
-- (users.xml ACL must have already been created)
GRANT EXECUTE on utl_inaddr to &&user;
BEGIN DBMS_NETWORK_ACL_ADMIN.add_privilege (
acl => 'users.xml',
principal => UPPER('&&user'),
is_grant => TRUE,
privilege => 'resolve');
END;
/
|
create database job4j;
create table roles (
id serial primary key,
role varchar(2000)
);
create table users (
id serial primary key,
name varchar(2000),
role_id int references roles(id)
);
create table rules (
id serial primary key,
rule varchar(2000)
);
create table roles_and_rules (
id serial primary key,
role_id int references roles(id),
rule_id int references rules(id)
);
create table categories (
id serial primary key,
category varchar(2000)
);
create table states (
id serial primary key,
state varchar(2000)
);
create table items (
id serial primary key,
item varchar(2000),
user_id int references users(id),
category_id int references categories(id),
state_id int references states(id)
);
create table commentes (
id serial primary key,
comment varchar(2000),
item_id int references items(id)
);
create table attaches (
id serial primary key,
attache varchar(2000),
item_id int references items(id)
);
insert into roles(role) values('President');
insert into roles(role) values('Director');
insert into roles(role) values('Manager');
insert into roles(role) values('Worker');
insert into users(name, role_id) values('Zhenya', 13);
insert into users(name, role_id) values('Inna', 15);
insert into users(name, role_id) values('Max', 16);
insert into users(name, role_id) values('Petr', 14);
insert into rules(rule) values('with no restrictions');
insert into rules(rule) values('with restrictions');
insert into rules(rule) values('limited');
insert into roles_and_rules(role_id, rule_id) values(13, 4);
insert into roles_and_rules(role_id, rule_id) values(14, 4);
insert into roles_and_rules(role_id, rule_id) values(15, 5);
insert into roles_and_rules(role_id, rule_id) values(16, 6);
insert into categories(category) values('extra');
insert into categories(category) values('important');
insert into categories(category) values('normal');
insert into states(state) values('done');
insert into states(state) values('performed');
insert into states(state) values('pending');
insert into items(item, user_id, category_id, state_id) values('meeting', 7, 4, 6);
insert into items(item, user_id, category_id, state_id) values('delivery', 9, 6, 5);
insert into commentes(comment, item_id) values('everyone should be', 1);
insert into commentes(comment, item_id) values('do it every day', 2);
insert into attaches(attache, item_id) values('a lot of files', 4);
insert into attaches(attache, item_id) values('nothing', 5);
|
<filename>sql/2021/resource-hints/http_headers_hints_adoption.sql
#standardSQL
# Retrieves resource hints from HTTP headers
CREATE TEMPORARY FUNCTION getResourceHints(payload STRING)
RETURNS STRUCT<preload BOOLEAN, prefetch BOOLEAN, preconnect BOOLEAN, prerender BOOLEAN, `dns-prefetch` BOOLEAN, `modulepreload` BOOLEAN>
LANGUAGE js AS '''
var hints = ['preload', 'prefetch', 'preconnect', 'prerender', 'dns-prefetch', 'modulepreload'];
var re = new RegExp(`(${hints.map(hint => `\\\\b${hint}\\\\b`).join('|')})`, 'ig');
try {
var $ = JSON.parse(payload);
return $.response.headers.filter(({name, value}) => name.toLowerCase() == 'link' && re.test(value)).reduce((results, {name, value}) => {
var hint = value.match(re)[0].toLowerCase();
results[hint] = true;
return results;
}, {});
} catch (e) {
return hints.reduce((results, hint) => {
results[hint] = false;
return results;
}, {});
}
''' ;
SELECT
client,
COUNT(0) AS total,
COUNTIF(hints.preload) AS preload,
COUNTIF(hints.preload) / COUNT(0) AS pct_preload,
COUNTIF(hints.prefetch) AS prefetch,
COUNTIF(hints.prefetch) / COUNT(0) AS pct_prefetch,
COUNTIF(hints.preconnect) AS preconnect,
COUNTIF(hints.preconnect) / COUNT(0) AS pct_preconnect,
COUNTIF(hints.prerender) AS prerender,
COUNTIF(hints.prerender) / COUNT(0) AS pct_prerender,
COUNTIF(hints.`dns-prefetch`) AS dns_prefetch,
COUNTIF(hints.`dns-prefetch`) / COUNT(0) AS pct_dns_prefetch,
COUNTIF(hints.`modulepreload`) AS modulepreload,
COUNTIF(hints.`modulepreload`) / COUNT(0) AS pct_modulepreload
FROM (
SELECT
client,
getResourceHints(payload) AS hints
FROM
`httparchive.almanac.requests`
WHERE
payload IS NOT NULL AND
firstHtml
)
GROUP BY
client
|
<reponame>hashmapinc/HashmapAnalyticsFramework
CREATE TABLE IF NOT EXISTS metadata_config (
id varchar(31) NOT NULL CONSTRAINT metadata_config_pkey PRIMARY KEY,
owner_id varchar(31),
name varchar,
source_id varchar(31),
sink_id varchar(31)
);
CREATE TABLE IF NOT EXISTS metadata_resource_jdbc (
id varchar(31) NOT NULL CONSTRAINT jdbc_pkey PRIMARY KEY,
db_url varchar,
username varchar,
password varchar
);
CREATE TABLE IF NOT EXISTS metadata_resource_rest (
id varchar(31) NOT NULL CONSTRAINT rest_pkey PRIMARY KEY,
url varchar
);
CREATE TABLE IF NOT EXISTS metadata_query (
id varchar(31) NOT NULL,
query varchar NOT NULL,
metadata_id varchar(31) NOT NULL,
trigger_schdl varchar,
trigger_type varchar,
attribute varchar,
CONSTRAINT metadata_query_config_foreign_key foreign key (metadata_id) references metadata_config,
CONSTRAINT query_pkey UNIQUE (id, metadata_id, query)
);
|
DROP TABLE IF EXISTS `phpcms_mood`;
|
//// CHANGE name=change0
CREATE TABLE table410 (
id integer NOT NULL,
field1 character varying(30),
usertype0field usertype0,
usertype3field usertype3,
usertype7field usertype7
);
GO
//// CHANGE name=change1
ALTER TABLE ONLY table410
ADD CONSTRAINT table410_pkey PRIMARY KEY (id);
GO
|
select 'Age at Index' as category, count_value, min_value, max_value, avg_value, stdev_value, p10_value, p25_value,
median_value, p75_value, p90_value, 0 as concept_id
from @ohdsi_database_schema.heracles_results_dist
where analysis_id in (1801)
and cohort_definition_id = @cohortDefinitionId
|
\set ECHO none
\i sql/hashlib.sql
|
<filename>sql/_23_apricot_qa/_01_sql_extension3/_05_analytic_functions/_03_rank/cases/rank_prepare_limit.sql
--combination with limit clause and prepare statement
create table rank_limit(
col1 smallint auto_increment primary key,
col2 bigint not null,
col3 varchar default 'abc',
col4 timestamp default CURRENT_TIMESTAMP,
col5 bit(20)
);
insert into rank_limit(col2, col3, col4, col5) values(500, 'cubrid', '1990-10-10 18:19:29', B'0001');
insert into rank_limit(col2, col3, col4, col5) values(500, 'cubrid', '1990-11-10 18:19:29', B'0010');
insert into rank_limit(col2, col3, col4, col5) values(500, 'mysql', '1990-10-11 18:19:29', B'0100');
insert into rank_limit(col2, col3, col4, col5) values(500, 'cubrid', '1990-10-10 18:19:29', B'1000');
insert into rank_limit(col2, col3, col4, col5) values(500, 'cubrid', '1991-10-10 18:19:29', B'0011');
insert into rank_limit(col2, col3, col4, col5) values(501, 'oracle', '1990-10-10 18:19:29', B'0101');
insert into rank_limit(col2, col3, col4, col5) values(501, 'cubrid', '1992-10-10 18:19:29', B'1001');
insert into rank_limit(col2, col3, col4, col5) values(501, 'oracle', '1990-11-10 18:19:29', B'0110');
insert into rank_limit(col2, col3, col4, col5) values(501, 'mysql', '1990-10-10 18:19:29', B'1010');
insert into rank_limit(col2, col3, col4, col5) values(501, 'cubrid', '1990-10-10 18:19:29', B'1100');
insert into rank_limit(col2, col3, col4, col5) values(501, 'mysql', '1991-11-10 18:19:29', B'0111');
insert into rank_limit(col2, col3, col4, col5) values(502, 'cubrid', '1990-10-10 18:19:29', B'1110');
insert into rank_limit(col2, col3, col4, col5) values(502, 'mysql', '1990-10-10 18:19:29', B'1111');
insert into rank_limit(col2, col3, col4, col5) values(502, 'mysql', '1992-10-10 18:19:29', B'1010');
insert into rank_limit(col2, col3, col4, col5) values(503, 'mysql', '1992-10-10 18:19:29', B'0101');
insert into rank_limit(col2, col3, col4, col5) values(503, 'cubrid', '1990-10-10 18:19:29', B'1110');
insert into rank_limit(col2, col3, col4, col5) values(503, 'cubrid', '1990-10-10 18:19:29', B'0111');
insert into rank_limit(col2, col3, col4, col5) values(503, 'oracle', '1993-11-10 18:19:29', B'1101');
insert into rank_limit(col2, col3, col4, col5) values(503, 'oracle', '1993-10-10 18:19:29', B'0011');
insert into rank_limit(col2, col3, col4, col5) values(503, 'cubrid', '1993-11-10 18:19:29', B'0001');
insert into rank_limit(col2, col3, col4, col5) values(503, 'cubrid', '1992-10-10 18:19:29', B'1100');
insert into rank_limit(col2, col3, col4, col5) values(504, 'mysql', '1994-10-10 18:19:29', B'1011');
insert into rank_limit(col2, col3, col4, col5) values(504, 'mysql', '1990-10-10 18:19:29', null);
insert into rank_limit(col2, col3, col4, col5) values(504, 'cubrid', '1995-11-10 18:19:29', B'0110');
insert into rank_limit(col2, col3, col4, col5) values(505, 'cubrid', '1991-10-10 18:19:29', '');
insert into rank_limit(col2, col3, col4, col5) values(505, 'cubrid', '1996-10-10 18:19:29', B'1111');
insert into rank_limit(col2, col3, col4, col5) values(505, 'mysql', '1990-10-10 18:19:29', B'0100');
insert into rank_limit(col2, col3, col4, col5) values(505, 'cubrid', '1995-10-10 18:19:29', null);
insert into rank_limit(col2, col3, col4, col5) values(505, 'cubrid', '1990-10-10 18:19:29', B'1111');
--TEST: error, over() clause + order by
select *, rank() over() rank from rank_limit order by rank, col1 limit 20;
select *, rank() over() rank from rank_limit order by 6, col1 limit 10;
select col1, col2, col3, col4, rank() over() rank from rank_limit order by 1, 2, 3, 4, 5 limit 1;
--TEST: over(partition by order by) clause + order by
select *, rank() over(partition by col3 order by col1) from rank_limit order by col2, col1 limit -1;
select *, rank() over(partition by col4 order by col1) rank from rank_limit order by 4, rank, col2 limit 100;
select col3, col4, rank() over(partition by col4 order by col1) rank from rank_limit order by col1, rank limit 2;
select col3, col4, rank() over(partition by col3 order by col4, col5) from rank_limit order by col3, 3, col4 limit 3;
--TEST: over(order by) clause + order by
select col1, col2, col3, rank() over(order by col1) rank from rank_limit order by col3, col2, rank limit 10;
select col2, rank() over(order by col2) rank, col3 from rank_limit order by col3, col2, 2 desc limit 15;
select *, rank() over(order by col3 asc, col5 desc) from rank_limit order by col5 asc, col3 desc limit -100;
select *, rank() over(order by col1, col2, col3 desc, col4, col5), col3 from rank_limit order by 6, 5 desc, 4, 3, 2, 1 limit 30;
select col1, col2, rank() over(order by col2) from rank_limit order by 1, 2, 3 limit 20;
--TEST: over(partition by.. order by ..) clause + order by
prepare st from 'select *, rank() over(partition by col3 order by col1) from rank_limit order by 1, 2, 3, 4, 5, 6 limit ?';
execute st using 10;
prepare st from 'select *, rank() over(partition by col4 order by col4, col1 desc) rank from rank_limit order by 1, 2, 3, 4, 5, 6 limit ?';
execute st using 20;
prepare st from 'select col1, col3, col4, rank() over(partition by col4 order by col3, col2, col1 desc) rank from rank_limit order by 1, 2, 3, 4 limit ?';
execute st using 1;
prepare st from 'select col3, col4, col2, rank() over(partition by col3 order by col4) from rank_limit order by 1, 2, 3 limit ?';
execute st using 5;
prepare st from 'select col3, col4, col5, rank() over(partition by col4 order by col3, col2) from rank_limit order by 1, 2, 4 desc, 3 asc limit ?';
execute st using -1;
--TEST: over(partition by.. order by ..) clause + order by ... having ...
prepare st from 'select col1, col2, rank() over(partition by col1 order by col2) from rank_limit group by col1 having col1 > 500 order by col2 desc, col1 limit ?';
execute st using 1;
prepare st from 'select col5, col2, col4, rank() over(partition by col4 order by col4, col2, col5) from rank_limit group by col4 having right(clob_to_char(col5), 4) = '.com' order by 4, 3 desc, 2 asc, 1 limit ?';
execute st using 15;
prepare st from 'select col1, col2, col3, col4, col5, rank() over(partition by col3 order by col2 desc, col4, col5) from rank_limit group by col1, col2, col3, col4 having col2 in ('cubrid', 'mysql') and right(clob_to_char(col5), 12) = '@domainname.com' order by col3 desc, col2 asc, 6, 1 limit ?';
execute st using 30;
deallocate prepare st;
drop table rank_limit;
|
<filename>db_spk_electre.sql
-- phpMyAdmin SQL Dump
-- version 4.9.2
-- https://www.phpmyadmin.net/
--
-- Host: localhost
-- Generation Time: Feb 21, 2021 at 03:56 PM
-- Server version: 5.7.24
-- PHP Version: 7.2.19
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: `db_spk_electre`
--
-- --------------------------------------------------------
--
-- Table structure for table `tb_alternatif`
--
CREATE TABLE `tb_alternatif` (
`id_alternatif` int(11) NOT NULL,
`kd_alternatif` varchar(12) NOT NULL,
`id_user` int(11) DEFAULT NULL,
`nama` varchar(124) DEFAULT NULL,
`alamat` varchar(255) DEFAULT NULL,
`telepon` varchar(24) DEFAULT NULL,
`sertifikat` varchar(128) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `tb_anggota`
--
CREATE TABLE `tb_anggota` (
`id_anggota` int(11) NOT NULL,
`id_user` int(11) DEFAULT NULL,
`nik` varchar(255) DEFAULT NULL,
`nama_anggota` varchar(255) DEFAULT NULL,
`ttl` varchar(255) DEFAULT NULL,
`agama` varchar(255) DEFAULT NULL,
`alamat` varchar(255) DEFAULT NULL,
`st_perkawinan` varchar(255) DEFAULT NULL,
`pekerjaan` varchar(255) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `tb_detail_history`
--
CREATE TABLE `tb_detail_history` (
`id_detail` int(11) NOT NULL,
`kd_history` varchar(25) DEFAULT NULL,
`kd_alternatif` varchar(25) DEFAULT NULL,
`point` varchar(8) DEFAULT NULL,
`rank` varchar(8) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `tb_evaluasi`
--
CREATE TABLE `tb_evaluasi` (
`id_evaluasi` int(11) NOT NULL,
`kd_alternatif` varchar(8) NOT NULL,
`id_kriteria` varchar(8) NOT NULL,
`kd_subkriteria` varchar(8) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `tb_history`
--
CREATE TABLE `tb_history` (
`id_history` int(11) NOT NULL,
`kd_history` varchar(25) DEFAULT NULL,
`time_proc` varchar(25) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `tb_info_user`
--
CREATE TABLE `tb_info_user` (
`id_info` int(11) NOT NULL,
`id_user` int(11) DEFAULT NULL,
`nama_kelp` varchar(124) DEFAULT NULL,
`alamat` varchar(255) DEFAULT NULL,
`telepon` varchar(25) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `tb_kelompok`
--
CREATE TABLE `tb_kelompok` (
`id_kelompok` int(11) NOT NULL,
`id_user` int(11) DEFAULT NULL,
`nama_klp` varchar(255) DEFAULT NULL,
`prop_klp` varchar(128) DEFAULT NULL,
`akta_pengukuhan` varchar(128) DEFAULT NULL,
`akta_notaris` varchar(128) DEFAULT NULL,
`foto_kandang` varchar(128) DEFAULT NULL,
`sk_terdaftar` varchar(128) DEFAULT NULL,
`ss_lokasi` varchar(128) DEFAULT NULL,
`sertifikat` varchar(128) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `tb_kriteria`
--
CREATE TABLE `tb_kriteria` (
`id_kriteria` int(11) NOT NULL,
`kd_kriteria` varchar(8) DEFAULT NULL,
`nm_kriteria` varchar(124) DEFAULT NULL,
`weight` float DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `tb_kriteria`
--
INSERT INTO `tb_kriteria` (`id_kriteria`, `kd_kriteria`, `nm_kriteria`, `weight`) VALUES
(1, 'KRT001', 'Status Kelompok', 3),
(2, 'KRT002', 'Sertifikat Ternak', 4),
(3, 'KRT003', 'Sistem Pemeliharaan', 4),
(4, 'KRT004', 'Pelayanan Kesehatan', 3);
-- --------------------------------------------------------
--
-- Table structure for table `tb_subkriteria`
--
CREATE TABLE `tb_subkriteria` (
`id_subkriteria` int(11) NOT NULL,
`kd_subkriteria` varchar(8) DEFAULT NULL,
`kd_kriteria` varchar(8) DEFAULT NULL,
`nm_subkriteria` varchar(124) DEFAULT NULL,
`value` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `tb_subkriteria`
--
INSERT INTO `tb_subkriteria` (`id_subkriteria`, `kd_subkriteria`, `kd_kriteria`, `nm_subkriteria`, `value`) VALUES
(1, 'SUB001', 'KRT001', 'Kelas Pemula', 1),
(2, 'SUB002', 'KRT001', 'Kelas Lanjut', 2),
(3, 'SUB003', 'KRT001', 'Kelas Madya', 3),
(4, 'SUB004', 'KRT001', 'Kelas Mandiri', 4),
(5, 'SUB005', 'KRT002', 'Punya', 2),
(6, 'SUB006', 'KRT002', 'Tidak Punya', 1),
(9, 'SUB007', 'KRT003', 'Intensif', 1),
(10, 'SUB008', 'KRT003', 'Semi-intensif', 2),
(11, 'SUB009', 'KRT003', 'Ekstensif', 3),
(12, 'SUB010', 'KRT004', 'Vaksin / 1 tahun sekali', 3),
(13, 'SUB012', 'KRT004', 'Obat cacing / 6 bulan', 2),
(14, 'SUB013', 'KRT004', 'Vitamin / 3x sebulan', 1);
-- --------------------------------------------------------
--
-- Table structure for table `tb_token`
--
CREATE TABLE `tb_token` (
`id_token` int(11) NOT NULL,
`email` varchar(128) NOT NULL,
`token` varchar(255) NOT NULL,
`created` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `tb_users`
--
CREATE TABLE `tb_users` (
`id_users` int(11) NOT NULL,
`nama` varchar(50) DEFAULT NULL,
`email` varchar(50) DEFAULT NULL,
`username` varchar(20) DEFAULT NULL,
`password` varchar(255) DEFAULT NULL,
`level` enum('admin','users') DEFAULT NULL,
`status` int(1) DEFAULT NULL,
`created` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `tb_users`
--
INSERT INTO `tb_users` (`id_users`, `nama`, `email`, `username`, `password`, `level`, `status`, `created`) VALUES
(1, 'Administrator', '<EMAIL>', 'admin', <PASSWORD>', 'admin', 1, NULL);
--
-- Indexes for dumped tables
--
--
-- Indexes for table `tb_alternatif`
--
ALTER TABLE `tb_alternatif`
ADD PRIMARY KEY (`id_alternatif`,`kd_alternatif`) USING BTREE,
ADD KEY `kd_alternatif` (`kd_alternatif`),
ADD KEY `alt_to_user` (`id_user`);
--
-- Indexes for table `tb_anggota`
--
ALTER TABLE `tb_anggota`
ADD PRIMARY KEY (`id_anggota`),
ADD KEY `anggota_to_user` (`id_user`);
--
-- Indexes for table `tb_detail_history`
--
ALTER TABLE `tb_detail_history`
ADD PRIMARY KEY (`id_detail`),
ADD KEY `kd_history` (`kd_history`),
ADD KEY `kd_alternatif` (`kd_alternatif`) USING BTREE;
--
-- Indexes for table `tb_evaluasi`
--
ALTER TABLE `tb_evaluasi`
ADD PRIMARY KEY (`id_evaluasi`),
ADD KEY `kd_subkriteria` (`kd_subkriteria`),
ADD KEY `kd_alternatif` (`kd_alternatif`),
ADD KEY `id_kriteria` (`id_kriteria`);
--
-- Indexes for table `tb_history`
--
ALTER TABLE `tb_history`
ADD PRIMARY KEY (`id_history`),
ADD KEY `kd_history` (`kd_history`);
--
-- Indexes for table `tb_info_user`
--
ALTER TABLE `tb_info_user`
ADD PRIMARY KEY (`id_info`),
ADD KEY `info_user` (`id_user`);
--
-- Indexes for table `tb_kelompok`
--
ALTER TABLE `tb_kelompok`
ADD PRIMARY KEY (`id_kelompok`),
ADD KEY `klp_to_infuser` (`id_user`);
--
-- Indexes for table `tb_kriteria`
--
ALTER TABLE `tb_kriteria`
ADD PRIMARY KEY (`id_kriteria`),
ADD KEY `kd_kriteria` (`kd_kriteria`);
--
-- Indexes for table `tb_subkriteria`
--
ALTER TABLE `tb_subkriteria`
ADD PRIMARY KEY (`id_subkriteria`),
ADD KEY `kd_subkriteria` (`kd_subkriteria`),
ADD KEY `kd_kriteria` (`kd_kriteria`);
--
-- Indexes for table `tb_token`
--
ALTER TABLE `tb_token`
ADD PRIMARY KEY (`id_token`);
--
-- Indexes for table `tb_users`
--
ALTER TABLE `tb_users`
ADD PRIMARY KEY (`id_users`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `tb_alternatif`
--
ALTER TABLE `tb_alternatif`
MODIFY `id_alternatif` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=9;
--
-- AUTO_INCREMENT for table `tb_anggota`
--
ALTER TABLE `tb_anggota`
MODIFY `id_anggota` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=15;
--
-- AUTO_INCREMENT for table `tb_detail_history`
--
ALTER TABLE `tb_detail_history`
MODIFY `id_detail` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
--
-- AUTO_INCREMENT for table `tb_evaluasi`
--
ALTER TABLE `tb_evaluasi`
MODIFY `id_evaluasi` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=53;
--
-- AUTO_INCREMENT for table `tb_history`
--
ALTER TABLE `tb_history`
MODIFY `id_history` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT for table `tb_info_user`
--
ALTER TABLE `tb_info_user`
MODIFY `id_info` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7;
--
-- AUTO_INCREMENT for table `tb_kelompok`
--
ALTER TABLE `tb_kelompok`
MODIFY `id_kelompok` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8;
--
-- AUTO_INCREMENT for table `tb_kriteria`
--
ALTER TABLE `tb_kriteria`
MODIFY `id_kriteria` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
--
-- AUTO_INCREMENT for table `tb_subkriteria`
--
ALTER TABLE `tb_subkriteria`
MODIFY `id_subkriteria` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=15;
--
-- AUTO_INCREMENT for table `tb_token`
--
ALTER TABLE `tb_token`
MODIFY `id_token` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT for table `tb_users`
--
ALTER TABLE `tb_users`
MODIFY `id_users` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7;
--
-- Constraints for dumped tables
--
--
-- Constraints for table `tb_alternatif`
--
ALTER TABLE `tb_alternatif`
ADD CONSTRAINT `alt_to_user` FOREIGN KEY (`id_user`) REFERENCES `tb_users` (`id_users`) ON DELETE CASCADE;
--
-- Constraints for table `tb_anggota`
--
ALTER TABLE `tb_anggota`
ADD CONSTRAINT `anggota_to_user` FOREIGN KEY (`id_user`) REFERENCES `tb_users` (`id_users`) ON DELETE CASCADE;
--
-- Constraints for table `tb_detail_history`
--
ALTER TABLE `tb_detail_history`
ADD CONSTRAINT `kd_alternatif1` FOREIGN KEY (`kd_alternatif`) REFERENCES `tb_alternatif` (`kd_alternatif`) ON DELETE CASCADE,
ADD CONSTRAINT `kd_history` FOREIGN KEY (`kd_history`) REFERENCES `tb_history` (`kd_history`) ON DELETE CASCADE;
--
-- Constraints for table `tb_evaluasi`
--
ALTER TABLE `tb_evaluasi`
ADD CONSTRAINT `kd_alternatif` FOREIGN KEY (`kd_alternatif`) REFERENCES `tb_alternatif` (`kd_alternatif`) ON DELETE CASCADE,
ADD CONSTRAINT `kd_subkriteria` FOREIGN KEY (`kd_subkriteria`) REFERENCES `tb_subkriteria` (`kd_subkriteria`) ON DELETE CASCADE;
--
-- Constraints for table `tb_info_user`
--
ALTER TABLE `tb_info_user`
ADD CONSTRAINT `info_user` FOREIGN KEY (`id_user`) REFERENCES `tb_users` (`id_users`) ON DELETE CASCADE;
--
-- Constraints for table `tb_kelompok`
--
ALTER TABLE `tb_kelompok`
ADD CONSTRAINT `klp_to_infuser` FOREIGN KEY (`id_user`) REFERENCES `tb_info_user` (`id_user`) ON DELETE CASCADE;
--
-- Constraints for table `tb_subkriteria`
--
ALTER TABLE `tb_subkriteria`
ADD CONSTRAINT `subkrit_to_krit` FOREIGN KEY (`kd_kriteria`) REFERENCES `tb_kriteria` (`kd_kriteria`) ON DELETE CASCADE;
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
<gh_stars>0
INSERT INTO tb_funcionario VALUES
('8859483743','1973-05-16','Maria','R','Oliveira',
'Rua Altamira 23',18000, 'F', '8859483743', 1);
UPDATE tb_funcionario SET NUMERO_DEPARTAMENTO = 2
WHERE CPF = '8859483743';
UPDATE tb_funcionario SET SALARIO = 1.1 * SALARIO
WHERE NUMERO_DEPARTAMENTO = 1;
INSERT INTO tb_funcionario
(CPF, DATA_NASCIMENTO, PRIMEIRO_NOME, NOME_MEIO, ULTIMO_NOME,
ENDERECO, CPF_SUPERVISOR, SALARIO, SEXO, NUMERO_DEPARTAMENTO)
VALUES
('35785747845','1987-09-11','Marcelo','V','Silva',
'Rua Utubaiana', '3248493205', 12000, 'F', 1);
UPDATE tb_funcionario SET ENDERECO = 'Av Sousa Numero 100',
SALARIO = 13000 WHERE CPF = '35785747845';
|
-- MySQL dump 10.13 Distrib 5.6.35, for osx10.9 (x86_64)
--
-- Host: localhost Database: laraclassified
-- ------------------------------------------------------
-- Server version 5.6.35
/*!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 */;
--
-- Dumping data for table `<<prefix>>subadmin1`
--
/*!40000 ALTER TABLE `<<prefix>>subadmin1` DISABLE KEYS */;
INSERT INTO `<<prefix>>subadmin1` VALUES (3337,'TD.13','TD','Salamat','Salamat',1);
INSERT INTO `<<prefix>>subadmin1` VALUES (3338,'TD.12','TD','Ouadaï','Ouadai',1);
INSERT INTO `<<prefix>>subadmin1` VALUES (3339,'TD.02','TD','Wadi Fira','Wadi Fira',1);
INSERT INTO `<<prefix>>subadmin1` VALUES (3340,'TD.14','TD','Tandjilé','Tandjile',1);
INSERT INTO `<<prefix>>subadmin1` VALUES (3341,'TD.17','TD','Moyen-Chari','Moyen-Chari',1);
INSERT INTO `<<prefix>>subadmin1` VALUES (3342,'TD.16','TD','Mayo-Kebbi Est','Mayo-Kebbi Est',1);
INSERT INTO `<<prefix>>subadmin1` VALUES (3343,'TD.09','TD','Logone Oriental','Logone Oriental',1);
INSERT INTO `<<prefix>>subadmin1` VALUES (3344,'TD.08','TD','Logone Occidental','Logone Occidental',1);
INSERT INTO `<<prefix>>subadmin1` VALUES (3345,'TD.07','TD','Lac','Lac',1);
INSERT INTO `<<prefix>>subadmin1` VALUES (3346,'TD.06','TD','Kanem','Kanem',1);
INSERT INTO `<<prefix>>subadmin1` VALUES (3347,'TD.05','TD','Guéra','Guera',1);
INSERT INTO `<<prefix>>subadmin1` VALUES (3348,'TD.15','TD','Chari-Baguirmi','Chari-Baguirmi',1);
INSERT INTO `<<prefix>>subadmin1` VALUES (3349,'TD.01','TD','Batha','Batha',1);
INSERT INTO `<<prefix>>subadmin1` VALUES (3350,'TD.23','TD','Borkou','Borkou',1);
INSERT INTO `<<prefix>>subadmin1` VALUES (3351,'TD.18','TD','Hadjer-Lamis','Hadjer-Lamis',1);
INSERT INTO `<<prefix>>subadmin1` VALUES (3352,'TD.19','TD','Mandoul','Mandoul',1);
INSERT INTO `<<prefix>>subadmin1` VALUES (3353,'TD.20','TD','Mayo-Kebbi Ouest','Mayo-Kebbi Ouest',1);
INSERT INTO `<<prefix>>subadmin1` VALUES (3354,'TD.21','TD','N’Djaména','N\'Djamena',1);
INSERT INTO `<<prefix>>subadmin1` VALUES (3355,'TD.22','TD','Barh el Gazel','<NAME>',1);
INSERT INTO `<<prefix>>subadmin1` VALUES (3356,'TD.25','TD','Sila','Sila',1);
INSERT INTO `<<prefix>>subadmin1` VALUES (3357,'TD.26','TD','Tibesti','Tibesti',1);
INSERT INTO `<<prefix>>subadmin1` VALUES (3358,'TD.28','TD','Ennedi-Ouest','Ennedi-Ouest',1);
INSERT INTO `<<prefix>>subadmin1` VALUES (3359,'TD.27','TD','Ennedi-Est','Ennedi-Est',1);
/*!40000 ALTER TABLE `<<prefix>>subadmin1` ENABLE KEYS */;
--
-- Dumping data for table `<<prefix>>subadmin2`
--
/*!40000 ALTER TABLE `<<prefix>>subadmin2` DISABLE KEYS */;
INSERT INTO `<<prefix>>subadmin2` VALUES (36385,'TD.13.243701','TD','TD.13','<NAME>','<NAME>',1);
INSERT INTO `<<prefix>>subadmin2` VALUES (36386,'TD.15.7670580','TD','TD.15','Baguirmi','Baguirmi',1);
INSERT INTO `<<prefix>>subadmin2` VALUES (36387,'TD.15.7670581','TD','TD.15','Dababa','Dababa',1);
INSERT INTO `<<prefix>>subadmin2` VALUES (36388,'TD.16.7670584','TD','TD.16','Mayo-Boneye','Mayo-Boneye',1);
INSERT INTO `<<prefix>>subadmin2` VALUES (36389,'TD.14.7670586','TD','TD.14','Tandjilé Est','Tandjile Est',1);
INSERT INTO `<<prefix>>subadmin2` VALUES (36390,'TD.17.7731692','TD','TD.17','<NAME>','<NAME>',1);
INSERT INTO `<<prefix>>subadmin2` VALUES (36391,'TD.09.7731693','TD','TD.09','Monts de Lam','Monts de Lam',1);
INSERT INTO `<<prefix>>subadmin2` VALUES (36392,'TD.09.7731694','TD','TD.09','Nya Pendé','Nya Pende',1);
INSERT INTO `<<prefix>>subadmin2` VALUES (36393,'TD.09.7731695','TD','TD.09','Lanya','Lanya',1);
INSERT INTO `<<prefix>>subadmin2` VALUES (36394,'TD.09.7731696','TD','TD.09','Pendé','Pende',1);
INSERT INTO `<<prefix>>subadmin2` VALUES (36395,'TD.17.7731697','TD','TD.17','Mandoul Oriental','Mandoul Oriental',1);
INSERT INTO `<<prefix>>subadmin2` VALUES (36396,'TD.17.7732962','TD','TD.17','Koumra','Koumra',1);
INSERT INTO `<<prefix>>subadmin2` VALUES (36397,'TD.17.7732963','TD','TD.17','Bessada','Bessada',1);
INSERT INTO `<<prefix>>subadmin2` VALUES (36398,'TD.17.7732972','TD','TD.17','Bedaya','Bedaya',1);
INSERT INTO `<<prefix>>subadmin2` VALUES (36399,'TD.17.7732974','TD','TD.17','Djoli','Djoli',1);
INSERT INTO `<<prefix>>subadmin2` VALUES (36400,'TD.17.7732975','TD','TD.17','Balimba','Balimba',1);
INSERT INTO `<<prefix>>subadmin2` VALUES (36401,'TD.17.7732978','TD','TD.17','Sarh','Sarh',1);
INSERT INTO `<<prefix>>subadmin2` VALUES (36402,'TD.09.7732980','TD','TD.09','Doba','Doba',1);
INSERT INTO `<<prefix>>subadmin2` VALUES (36403,'TD.08.7871202','TD','TD.08','Lac Wey','Lac Wey',1);
INSERT INTO `<<prefix>>subadmin2` VALUES (36404,'TD.08.8250831','TD','TD.08','Dodje','Dodje',1);
INSERT INTO `<<prefix>>subadmin2` VALUES (36405,'TD.08.8250832','TD','TD.08','Ngourkosso','Ngourkosso',1);
INSERT INTO `<<prefix>>subadmin2` VALUES (36406,'TD.09.8250833','TD','TD.09','La Nya Pende','La Nya Pende',1);
INSERT INTO `<<prefix>>subadmin2` VALUES (36407,'TD.17.8250834','TD','TD.17','Lac Iro','Lac Iro',1);
INSERT INTO `<<prefix>>subadmin2` VALUES (36408,'TD.17.8250835','TD','TD.17','Grande Sido','Grande Sido',1);
INSERT INTO `<<prefix>>subadmin2` VALUES (36409,'TD.17.8250836','TD','TD.17','Mandoul Occidental','Mandoul Occidental',1);
INSERT INTO `<<prefix>>subadmin2` VALUES (36410,'TD.17.8250837','TD','TD.17','Barh Sara','Barh Sara',1);
INSERT INTO `<<prefix>>subadmin2` VALUES (36411,'TD.14.8250838','TD','TD.14','<NAME>','T<NAME>',1);
INSERT INTO `<<prefix>>subadmin2` VALUES (36412,'TD.15.8335048','TD','TD.15','Mansaba','Mansaba',1);
INSERT INTO `<<prefix>>subadmin2` VALUES (36413,'TD.01.8659322','TD','TD.01','Batha','Batha',1);
INSERT INTO `<<prefix>>subadmin2` VALUES (36414,'TD.12.8659323','TD','TD.12','Ouara','Ouara',1);
INSERT INTO `<<prefix>>subadmin2` VALUES (36415,'TD.15.8693069','TD','TD.15','Dagana District','Dagana District',1);
INSERT INTO `<<prefix>>subadmin2` VALUES (36416,'TD.06.8693073','TD','TD.06','Rig-Rig','Rig-Rig',1);
INSERT INTO `<<prefix>>subadmin2` VALUES (36417,'TD.09.8693074','TD','TD.09','Mamdi Department','Mamdi Department',1);
INSERT INTO `<<prefix>>subadmin2` VALUES (36418,'TD.15.9072808','TD','TD.15','Loug Chari','Loug Chari',1);
INSERT INTO `<<prefix>>subadmin2` VALUES (36419,'TD.05.9166522','TD','TD.05','Barh Signaka','Barh Signaka',1);
INSERT INTO `<<prefix>>subadmin2` VALUES (36420,'TD.01.9166643','TD','TD.01','Fitri','Fitri',1);
INSERT INTO `<<prefix>>subadmin2` VALUES (36421,'TD.15.9166667','TD','TD.15','Chari','Chari',1);
INSERT INTO `<<prefix>>subadmin2` VALUES (36422,'TD.02.10377074','TD','TD.02','Kobé','Kobe',1);
INSERT INTO `<<prefix>>subadmin2` VALUES (36423,'TD.12.10377165','TD','TD.12','Assoungha Department','Assoungha Department',1);
INSERT INTO `<<prefix>>subadmin2` VALUES (36424,'TD.13.10399865','TD','TD.13','Barh Azoum','Barh Azoum',1);
INSERT INTO `<<prefix>>subadmin2` VALUES (36425,'TD.07.10400441','TD','TD.07','Wayi','Wayi',1);
INSERT INTO `<<prefix>>subadmin2` VALUES (36426,'TD.05.10400446','TD','TD.05','Abtouyour','Abtouyour',1);
/*!40000 ALTER TABLE `<<prefix>>subadmin2` ENABLE KEYS */;
--
-- Dumping data for table `<<prefix>>cities`
--
/*!40000 ALTER TABLE `<<prefix>>cities` DISABLE KEYS */;
INSERT INTO `<<prefix>>cities` VALUES (243787,'TD','Goz Beïda','Goz Beida',12.2248,21.4103,'P','PPLA','TD.25',NULL,1000,'Africa/Ndjamena',1,'2014-09-04 23:00:00','2014-09-04 23:00:00');
INSERT INTO `<<prefix>>cities` VALUES (244128,'TD','Fada','Fada',17.1854,21.5811,'P','PPLA','TD.28',NULL,23786,'Africa/Ndjamena',1,'2014-09-04 23:00:00','2014-09-04 23:00:00');
INSERT INTO `<<prefix>>cities` VALUES (244878,'TD','Biltine','Biltine',14.5279,20.9275,'P','PPLA','TD.02',NULL,11000,'Africa/Ndjamena',1,'2017-05-07 23:00:00','2017-05-07 23:00:00');
INSERT INTO `<<prefix>>cities` VALUES (245338,'TD','Am Timan','Am Timan',11.0297,20.2827,'P','PPLA','TD.13',NULL,28885,'Africa/Ndjamena',1,'2012-01-17 23:00:00','2012-01-17 23:00:00');
INSERT INTO `<<prefix>>cities` VALUES (245669,'TD','Adré','Adre',13.4665,22.1987,'P','PPL','TD.12',NULL,11928,'Africa/Ndjamena',1,'2017-06-06 23:00:00','2017-06-06 23:00:00');
INSERT INTO `<<prefix>>cities` VALUES (245785,'TD','Abéché','Abeche',13.8292,20.8324,'P','PPLA','TD.12',NULL,74188,'Africa/Ndjamena',1,'2017-05-29 23:00:00','2017-05-29 23:00:00');
INSERT INTO `<<prefix>>cities` VALUES (2425791,'TD','Sarh','Sarh',9.1429,18.3923,'P','PPLA','TD.17',NULL,102528,'Africa/Ndjamena',1,'2017-05-29 23:00:00','2017-05-29 23:00:00');
INSERT INTO `<<prefix>>cities` VALUES (2426240,'TD','Pala','Pala',9.3642,14.9046,'P','PPLA','TD.20',NULL,35466,'Africa/Ndjamena',1,'2012-01-17 23:00:00','2012-01-17 23:00:00');
INSERT INTO `<<prefix>>cities` VALUES (2426370,'TD','Oum Hadjer','Oum Hadjer',13.2954,19.6966,'P','PPL','TD.01',NULL,19271,'Africa/Ndjamena',1,'2012-01-17 23:00:00','2012-01-17 23:00:00');
INSERT INTO `<<prefix>>cities` VALUES (2427036,'TD','Ngama','Ngama',11.7833,17.1667,'P','PPL','TD.15',NULL,12438,'Africa/Ndjamena',1,'2006-01-16 23:00:00','2006-01-16 23:00:00');
INSERT INTO `<<prefix>>cities` VALUES (2427123,'TD','N\'Djamena','N\'Djamena',12.1067,15.0444,'P','PPLC','TD.15',NULL,721081,'Africa/Ndjamena',1,'2017-09-26 23:00:00','2017-09-26 23:00:00');
INSERT INTO `<<prefix>>cities` VALUES (2427336,'TD','Moussoro','Moussoro',13.6414,16.4894,'P','PPLA','TD.22',NULL,15190,'Africa/Ndjamena',1,'2014-09-04 23:00:00','2014-09-04 23:00:00');
INSERT INTO `<<prefix>>cities` VALUES (2427455,'TD','Moundou','Moundou',8.56667,16.0833,'P','PPLA','TD.08',NULL,135167,'Africa/Ndjamena',1,'2012-01-17 23:00:00','2012-01-17 23:00:00');
INSERT INTO `<<prefix>>cities` VALUES (2427637,'TD','Mongo','Mongo',12.1844,18.693,'P','PPLA','TD.05',NULL,27763,'Africa/Ndjamena',1,'2012-01-17 23:00:00','2012-01-17 23:00:00');
INSERT INTO `<<prefix>>cities` VALUES (2427697,'TD','Moïssala','Moissala',8.3404,17.7663,'P','PPL','TD.19',NULL,11264,'Africa/Ndjamena',1,'2012-01-17 23:00:00','2012-01-17 23:00:00');
INSERT INTO `<<prefix>>cities` VALUES (2427949,'TD','Melfi','Melfi',11.0598,17.9355,'P','PPL','TD.05',NULL,5784,'Africa/Ndjamena',1,'2012-01-17 23:00:00','2012-01-17 23:00:00');
INSERT INTO `<<prefix>>cities` VALUES (2428042,'TD','Mboursou Léré','Mboursou Lere',9.7639,14.1539,'P','PPL','TD.20',NULL,17132,'Africa/Ndjamena',1,'2010-11-28 23:00:00','2010-11-28 23:00:00');
INSERT INTO `<<prefix>>cities` VALUES (2428216,'TD','Massenya','Massenya',11.4039,16.1705,'P','PPLA','TD.15',NULL,3680,'Africa/Ndjamena',1,'2012-01-17 23:00:00','2012-01-17 23:00:00');
INSERT INTO `<<prefix>>cities` VALUES (2428228,'TD','Massakory','Massakory',12.996,15.7293,'P','PPLA','TD.18',NULL,15406,'Africa/Ndjamena',1,'2012-01-17 23:00:00','2012-01-17 23:00:00');
INSERT INTO `<<prefix>>cities` VALUES (2428231,'TD','Massaguet','Massaguet',12.4755,15.4365,'P','PPL','TD.18',NULL,17906,'Africa/Ndjamena',1,'2012-01-17 23:00:00','2012-01-17 23:00:00');
INSERT INTO `<<prefix>>cities` VALUES (2428394,'TD','Mao','Mao',14.1212,15.3103,'P','PPLA','TD.06',NULL,18031,'Africa/Ndjamena',1,'2012-01-17 23:00:00','2012-01-17 23:00:00');
INSERT INTO `<<prefix>>cities` VALUES (2429296,'TD','Laï','Lai',9.3972,16.3007,'P','PPLA','TD.14',NULL,19382,'Africa/Ndjamena',1,'2017-07-15 23:00:00','2017-07-15 23:00:00');
INSERT INTO `<<prefix>>cities` VALUES (2429344,'TD','Kyabé','Kyabe',9.45149,18.9449,'P','PPL','TD.17',NULL,16177,'Africa/Ndjamena',1,'2012-01-17 23:00:00','2012-01-17 23:00:00');
INSERT INTO `<<prefix>>cities` VALUES (2429605,'TD','Koumra','Koumra',8.91256,17.5539,'P','PPLA','TD.19',NULL,36263,'Africa/Ndjamena',1,'2012-01-17 23:00:00','2012-01-17 23:00:00');
INSERT INTO `<<prefix>>cities` VALUES (2430506,'TD','Kelo','Kelo',9.30859,15.8066,'P','PPL','TD.14',NULL,42533,'Africa/Ndjamena',1,'2012-01-17 23:00:00','2012-01-17 23:00:00');
INSERT INTO `<<prefix>>cities` VALUES (2431573,'TD','Guelendeng','Guelendeng',10.9176,15.5501,'P','PPL','TD.16',NULL,11379,'Africa/Ndjamena',1,'2012-01-17 23:00:00','2012-01-17 23:00:00');
INSERT INTO `<<prefix>>cities` VALUES (2431724,'TD','Gounou Gaya','Gounou Gaya',9.6294,15.5132,'P','PPL','TD.16',NULL,9521,'Africa/Ndjamena',1,'2012-01-17 23:00:00','2012-01-17 23:00:00');
INSERT INTO `<<prefix>>cities` VALUES (2431736,'TD','Goundi','Goundi',9.36267,17.366,'P','PPL','TD.19',NULL,10052,'Africa/Ndjamena',1,'2012-01-17 23:00:00','2012-01-17 23:00:00');
INSERT INTO `<<prefix>>cities` VALUES (2432678,'TD','Faya-Largeau','Faya-Largeau',17.9257,19.1043,'P','PPLA','TD.23',NULL,13400,'Africa/Ndjamena',1,'2014-05-28 23:00:00','2014-05-28 23:00:00');
INSERT INTO `<<prefix>>cities` VALUES (2433055,'TD','Dourbali','Dourbali',11.8091,15.8632,'P','PPL','TD.15',NULL,17682,'Africa/Ndjamena',1,'2012-01-17 23:00:00','2012-01-17 23:00:00');
INSERT INTO `<<prefix>>cities` VALUES (2433437,'TD','Doba','Doba',8.65,16.85,'P','PPLA','TD.09',NULL,24336,'Africa/Ndjamena',1,'2012-01-17 23:00:00','2012-01-17 23:00:00');
INSERT INTO `<<prefix>>cities` VALUES (2434584,'TD','Bousso','Bousso',10.4847,16.7108,'P','PPL','TD.15',NULL,13555,'Africa/Ndjamena',1,'2013-05-08 23:00:00','2013-05-08 23:00:00');
INSERT INTO `<<prefix>>cities` VALUES (2434910,'TD','Bongor','Bongor',10.2806,15.3722,'P','PPLA','TD.16',NULL,27770,'Africa/Ndjamena',1,'2012-01-17 23:00:00','2012-01-17 23:00:00');
INSERT INTO `<<prefix>>cities` VALUES (2434979,'TD','Bol','Bol',13.4586,14.7147,'P','PPLA','TD.07',NULL,11700,'Africa/Ndjamena',1,'2017-05-29 23:00:00','2017-05-29 23:00:00');
INSERT INTO `<<prefix>>cities` VALUES (2434985,'TD','Bokoro','Bokoro',12.3781,17.0588,'P','PPL','TD.18',NULL,14723,'Africa/Ndjamena',1,'2014-06-27 23:00:00','2014-06-27 23:00:00');
INSERT INTO `<<prefix>>cities` VALUES (2435124,'TD','Bitkine','Bitkine',11.9801,18.2138,'P','PPL','TD.05',NULL,18495,'Africa/Ndjamena',1,'2012-01-17 23:00:00','2012-01-17 23:00:00');
INSERT INTO `<<prefix>>cities` VALUES (2435474,'TD','Béré','Bere',9.3202,16.1552,'P','PPL','TD.14',NULL,14666,'Africa/Ndjamena',1,'2006-01-16 23:00:00','2006-01-16 23:00:00');
INSERT INTO `<<prefix>>cities` VALUES (2435508,'TD','Benoy','Benoy',8.98327,16.3199,'P','PPL','TD.08',NULL,15717,'Africa/Ndjamena',1,'2012-01-17 23:00:00','2012-01-17 23:00:00');
INSERT INTO `<<prefix>>cities` VALUES (2435708,'TD','Beïnamar','Beinamar',8.6698,15.3813,'P','PPL','TD.08',NULL,7445,'Africa/Ndjamena',1,'2013-04-03 23:00:00','2013-04-03 23:00:00');
INSERT INTO `<<prefix>>cities` VALUES (2435837,'TD','Béboto','Beboto',8.26681,16.939,'P','PPL','TD.09',NULL,5432,'Africa/Ndjamena',1,'2012-01-17 23:00:00','2012-01-17 23:00:00');
INSERT INTO `<<prefix>>cities` VALUES (2435854,'TD','Bébédja','Bebedja',8.6761,16.566,'P','PPL','TD.09',NULL,12671,'Africa/Ndjamena',1,'2012-01-17 23:00:00','2012-01-17 23:00:00');
INSERT INTO `<<prefix>>cities` VALUES (2435976,'TD','Bardaï','Bardai',21.3549,17.0012,'P','PPLA','TD.26',NULL,0,'Africa/Ndjamena',1,'2014-09-04 23:00:00','2014-09-04 23:00:00');
INSERT INTO `<<prefix>>cities` VALUES (2436400,'TD','Ati','Ati',13.2154,18.3353,'P','PPLA','TD.01',NULL,24074,'Africa/Ndjamena',1,'2012-01-17 23:00:00','2012-01-17 23:00:00');
INSERT INTO `<<prefix>>cities` VALUES (9534257,'TD','Am Djarass','Am Djarass',16.0659,22.8431,'P','PPLA','TD.27',NULL,0,'Africa/Ndjamena',1,'2014-09-07 23:00:00','2014-09-07 23:00:00');
/*!40000 ALTER TABLE `<<prefix>>cities` ENABLE KEYS */;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed
|
<filename>sql_scripts/SEWA_Hackathon.sql<gh_stars>0
-- CREATE DATABASE `sewa` /*!40100 DEFAULT CHARACTER SET utf8 */;
set foreign_key_checks=0;
DROP TABLE IF exists category;
CREATE TABLE `category` (
`categoryid` int(11) NOT NULL AUTO_INCREMENT,
`category_name` varchar(255) DEFAULT NULL,
PRIMARY KEY (`categoryid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
DROP TABLE IF exists subcategory;
CREATE TABLE `subcategory` (
`subcategoryid` INT NOT NULL AUTO_INCREMENT,
`subcategory_name` VARCHAR(255) NULL,
`categoryid` INT NOT NULL,
PRIMARY KEY (`subcategoryid`),
INDEX `categoryid_idx` (`categoryid` ASC),
CONSTRAINT `categoryid`
FOREIGN KEY (`categoryid`)
REFERENCES `category` (`categoryid`)
ON DELETE CASCADE
ON UPDATE CASCADE);
DROP TABLE IF exists user;
CREATE TABLE `user` (
`userid` int(11) NOT NULL AUTO_INCREMENT,
#`username` bigint(20) NOT NULL UNIQUE,
`username` bigint(20) NOT NULL,
`password` text NOT NULL,
`name` varchar(150) DEFAULT NULL,
`phone` varchar(50) DEFAULT NULL,
`address` varchar(100) DEFAULT NULL,
`area` varchar(100) NOT NULL,
`city` varchar(100) NOT NULL,
`state` varchar(100) NOT NULL,
`country` varchar(100) NOT NULL,
`postalcode` varchar(50) DEFAULT NULL,
`coordinates` varchar(255) DEFAULT NULL,
PRIMARY KEY (`userid`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8;
DROP TABLE IF exists service;
CREATE TABLE `service` (
`serviceid` INT NOT NULL AUTO_INCREMENT,
`servicename` VARCHAR(255) NULL,
`categoryid` INT NOT NULL,
`subcategoryid` INT NULL,
`details` VARCHAR(255) NULL DEFAULT NULL,
`userid` INT NULL,
PRIMARY KEY (`serviceid`),
INDEX `categoryid_idx` (`categoryid` ASC),
INDEX `subcategoryid_idx` (`subcategoryid` ASC),
INDEX `userid_idx` (`userid` ASC),
CONSTRAINT `categoryid_fk`
FOREIGN KEY (`categoryid`)
REFERENCES `sewa`.`Category` (`categoryid`)
ON DELETE CASCADE
ON UPDATE CASCADE,
CONSTRAINT `subcategoryid_fk`
FOREIGN KEY (`subcategoryid`)
REFERENCES `sewa`.`SubCategory` (`subcategoryid`)
ON DELETE CASCADE
ON UPDATE CASCADE,
CONSTRAINT `userid_fk`
FOREIGN KEY (`userid`)
REFERENCES `sewa`.`user` (`userid`)
ON DELETE CASCADE
ON UPDATE CASCADE);
DROP TABLE IF exists job;
CREATE TABLE `job` (
`jobid` INT NOT NULL AUTO_INCREMENT,
`title` VARCHAR(255) NOT NULL,
`details` VARCHAR(255) NULL,
`serviceid` INT NOT NULL,
PRIMARY KEY (`jobid`),
INDEX `serviceid_idx` (`serviceid` ASC),
CONSTRAINT `serviceid_fk`
FOREIGN KEY (`serviceid`)
REFERENCES `sewa`.`service` (`serviceid`)
ON DELETE CASCADE
ON UPDATE CASCADE);
DROP TABLE IF EXISTS country;
CREATE TABLE `country` (
`countryid` INT NOT NULL AUTO_INCREMENT,
`countryname` VARCHAR(255) NULL,
PRIMARY KEY (`countryid`));
DROP TABLE IF exists state;
CREATE TABLE `state` (
`stateid` int(11) NOT NULL AUTO_INCREMENT,
`statename` varchar(255) NOT NULL,
`countryid` int(11) NOT NULL,
PRIMARY KEY (`stateid`),
KEY `countryid_fk_idx` (`countryid`),
CONSTRAINT `countryid_fk` FOREIGN KEY (`countryid`) REFERENCES `country` (`countryid`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
DROP TABLE IF exists city;
CREATE TABLE `city` (
`cityid` INT NOT NULL AUTO_INCREMENT,
`cityname` VARCHAR(255) NOT NULL,
`stateid` INT NOT NULL,
PRIMARY KEY (`cityid`),
INDEX `stateid_fk_idx` (`stateid` ASC),
CONSTRAINT `stateid_fk`
FOREIGN KEY (`stateid`)
REFERENCES `sewa`.`state` (`stateid`)
ON DELETE NO ACTION
ON UPDATE NO ACTION);
DROP TABLE IF exists area;
CREATE TABLE `area` (
`areaid` INT NOT NULL AUTO_INCREMENT,
`areaname` VARCHAR(255) NULL,
`cityid` INT NOT NULL,
PRIMARY KEY (`areaid`),
INDEX `cityid_fk_idx` (`cityid` ASC),
CONSTRAINT `cityid_fk`
FOREIGN KEY (`cityid`)
REFERENCES `sewa`.`city` (`cityid`)
ON DELETE NO ACTION
ON UPDATE NO ACTION);
-- Data
INSERT INTO `country` (`countryname`) VALUES ('India'), ('US'), ('China'), ('Canada');
INSERT INTO `state` ( `statename`,`countryid`) VALUES
('ANDHRA PRADESH',1),
('ASSAM',1),
('ARUNACHAL PRADESH',1),
('BIHAR',1),
('GUJRAT',1),
('HARYANA',1),
('HIMACHAL PRADESH',1),
('JAMMU & KASHMIR',1),
('KARNATAKA',1),
('KERALA',1),
('MADHYA PRADESH',1),
('MAHARASHTRA',1),
('MANIPUR',1),
('MEGHALAYA',1),
('MIZORAM',1),
('NAGALAND',1),
('ORISSA',1),
('PUNJAB',1),
('RAJASTHAN',1),
('SIKKIM',1),
('TAMIL NADU',1),
('TRIPURA',1),
('UTTAR PRADESH',1),
('WEST BENGAL',1),
('DELHI',1),
('GOA',1),
('PONDICHERY',1),
('LAKSHDWEEP',1),
('DAMAN & DIU',1),
('DADRA & NAGAR',1),
('CHANDIGARH',1),
('ANDAMAN & NICOBAR',1),
('UTTARANCHAL',1),
('JHARKHAND',1),
('CHATTISGARH',1);
INSERT INTO `city` ( `cityname`,`stateid`) VALUES
('Mumbai', 12),
('Pune', 12),
('Kolhapur', 12),
('Nagpur', 12),
('Sangli', 12),
('Satara', 12),
('Jalgaon', 12),
('Latur', 12),
('Aurangabad', 12),
('Beed', 12),
('Usmanabad', 12),
('Solapur', 12),
('Karad', 12),
('Ratnagiri', 12),
('Dapoli', 12),
('Alibaug', 12);
INSERT INTO `area` ( `areaname`,`cityid`) VALUES
('Bavdhan', 2),
('Kothrud', 2),
('Swargate', 2),
('Katraj', 2),
('Dhankawadi', 2),
('Indiranagar', 2),
('<NAME>', 2),
('Hingane', 2),
('Ambegaon', 2),
('Erandawane', 2),
('Paud Road', 2),
('Karvenagar', 2),
('Waraje', 2),
('<NAME>', 2),
('Naray<NAME>', 2),
('Tilak Road', 2);
INSERT INTO `category` ( `category_name`) VALUES
('Arts, crafts, and collectibles'),
('Baby'),
('Beauty and fragrances'),
('Books and magazines'),
('Business to business'),
('Clothing, accessories, and shoes'),
('Computers, accessories, and services'),
('Education'),
('Electronics and telecom'),
('Entertainment and media'),
('Financial services and products'),
('Food retail and service'),
('Gifts and flowers'),
('Government'),
('Health and personal care'),
('Home and garden'),
('Nonprofit'),
('Pets and animals'),
('Religion and spirituality'),
('Retail'),
('Services - other'),
('Sports and outdoors'),
('Toys and hobbies'),
('Travel'),
('Vehicle sales'),
('Vehicle service and accessories');
INSERT INTO `subcategory` ( `subcategory_name`,`categoryid`) VALUES
('Antiques',1),
('Art and craft supplies',1),
('Art dealers and galleries',1),
('Camera and photographic supplies',1),
('Digital art',1),
('Memorabilia',1),
('Music store (instruments and sheet music)',1),
('Sewing, needlework, and fabrics',1),
('Stamp and coin',1),
('Stationary, printing and writing paper',1),
('Vintage and collectibles',1),
('Clothing',2),
('Furniture',2),
('Baby products (other)',2),
('Safety and health',2),
('Bath and body',3),
('Fragrances and perfumes',3),
('Makeup and cosmetics',3),
('Audio books',4),
('Digital content',4),
('Educational and textbooks',4),
('Fiction and nonfiction',4),
('Magazines',4),
('Publishing and printing',4),
('Rare and used books',4),
('Accounting',5),
('Advertising',5),
('Agricultural',5),
('Architectural, engineering, and surveying services',5),
('Chemicals and allied products',5),
('Commercial photography, art, and graphics',5),
('Construction',5),
('Consulting services',5),
('Educational services',5),
('Equipment rentals and leasing services',5),
('Equipment repair services',5),
('Hiring services',5),
('Industrial and manufacturing supplies',5),
('Mailing lists',5),
('Marketing',5),
('Multi-level marketing',5),
('Office and commercial furniture',5),
('Office supplies and equipment',5),
('Publishing and printing',5),
('Quick copy and reproduction services',5),
('Shipping and packing',5),
('Stenographic and secretarial support services',5),
('Wholesale',5),
('Children\'s clothing',6),
('Men\'s clothing',6),
('Women\'s clothing',6),
('Shoes',6),
('Military and civil service uniforms',6),
('Accessories',6),
('Retail (fine jewelry and watches)',6),
('Wholesale (precious stones and metals)',6),
('Fashion jewelry',6),
('Computer and data processing services',7),
('Desktops, laptops, and notebooks',7),
('Digital content',7),
('eCommerce services',7),
('Maintenance and repair services',7),
('Monitors and projectors',7),
('Networking',7),
('Online gaming',7),
('Parts and accessories',7),
('Peripherals',7),
('Software',7),
('Training services',7),
('Web hosting and design',7),
('Business and secretarial schools',8),
('Child daycare services',8),
('Colleges and universities',8),
('Dance halls, studios, and schools',8),
('Elementary and secondary schools',8),
('Vocational and trade schools',8),
('Cameras, camcorders, and equipment',9),
('Cell phones, PDAs, and pagers',9),
('General electronic accessories',9),
('Home audio',9),
('Home electronics',9),
('Security and surveillance',9),
('Telecommunication equipment and sales',9),
('Telecommunication services',9),
('Telephone cards',9),
('Memorabilia',10),
('Movie tickets',10),
('Movies (DVDs, videotapes)',10),
('Music (CDs, cassettes and albums)',10),
('Cable, satellite, and other pay TV and radio',10),
('Adult digital content',10),
('Concert tickets',10),
('Theater tickets',10),
('Toys and games',10),
('Slot machines',10),
('Digital content',10),
('Entertainers',10),
('Gambling',10),
('Online games',10),
('Video games and systems',10),
('Accounting',11),
('Collection agency',11),
('Commodities and futures exchange',11),
('Consumer credit reporting agencies',11),
('Debt counseling service',11),
('Credit union',11),
('Currency dealer and currency exchange',11),
('Escrow',11),
('Finance company',11),
('Financial and investment advice',11),
('Insurance (auto and home)',11),
('Insurance (life and annuity)',11),
('Investments (general)',11),
('Money service business',11),
('Mortgage brokers or dealers',11),
('Online gaming currency',11),
('Paycheck lender or cash advance',11),
('Prepaid and stored value cards',11),
('Real estate agent',11),
('Remittance',11),
('Rental property management',11),
('Security brokers and dealers',11),
('Wire transfer and money order',11),
('Alcoholic beverages',12),
('Catering services',12),
('Coffee and tea',12),
('Gourmet foods',12),
('Specialty and miscellaneous food stores',12),
('Restaurant',12),
('Tobacco',12),
('Vitamins and supplements',12),
('Florist',13),
('Gift, card, novelty, and souvenir shops',13),
('Gourmet foods',13),
('Nursery plants and flowers',13),
('Party supplies',13),
('Government services (not elsewhere classified)',14),
('Drugstore (excluding prescription drugs)',15),
('Drugstore (including prescription drugs)',15),
('Dental care',15),
('Medical care',15),
('Medical equipment and supplies',15),
('Vision care',15),
('Vitamins and supplements',15),
('Antiques',16),
('Appliances',16),
('Art dealers and galleries',16),
('Bed and bath',16),
('Construction material',16),
('Drapery, window covering, and upholstery',16),
('Exterminating and disinfecting services',16),
('Fireplace, and fireplace screens',16),
('Furniture',16),
('Garden supplies',16),
('Glass, paint, and wallpaper',16),
('Hardware and tools',16),
('Home decor',16),
('Housewares',16),
('Kitchenware',16),
('Landscaping',16),
('Rugs and carpets',16),
('Security and surveillance equipment',16),
('Swimming pools and spas',16),
('Charity',17),
('Political',17),
('Religious',17),
('Other',17),
('Personal',17),
('Educational',17),
('Medication and supplements',18),
('Pet shops, pet food, and supplies',18),
('Specialty or rare pets',18),
('Veterinary services',18),
('Membership services',19),
('Merchandise',19),
('Services (not elsewhere classified)',19),
('Chemicals and allied products',20),
('Department store',20),
('Discount store',20),
('Durable goods',20),
('Non-durable goods',20),
('Used and secondhand store',20),
('Variety store',20),
('Advertising',21),
('Shopping services and buying clubs',21),
('Career services',21),
('Carpentry',21),
('Plumbing',21),
('Child care services',21),
('Cleaning and maintenance',21),
('Commercial photography',21),
('Computer and data processing services',21),
('Computer network services',21),
('Consulting services',21),
('Counseling services',21),
('Courier services',21),
('Dental care',21),
('eCommerce services',21),
('Electrical and small appliance repair',21),
('Entertainment',21),
('Equipment rental and leasing services',21),
('Event and wedding planning',21),
('Gambling',21),
('General contractors',21),
('Graphic and commercial design',21),
('Health and beauty spas',21),
('IDs, licenses, and passports',21),
('Importing and exporting',21),
('Information retrieval services',21),
('Insurance - auto and home',21),
('Insurance - life and annuity',21),
('Landscaping and horticultural',21),
('Legal services and attorneys',21),
('Local delivery service',21),
('Lottery and contests',21),
('Medical care',21),
('Membership clubs and organizations',21),
('Misc. publishing and printing',21),
('Moving and storage',21),
('Online dating',21),
('Photofinishing',21),
('Photographic studios - portraits',21),
('Protective and security services',21),
('Quick copy and reproduction services',21),
('Radio, television, and stereo repair',21),
('Real estate agent',21),
('Rental property management',21),
('Reupholstery and furniture repair',21),
('Services (not elsewhere classified)',21),
('Shipping and packing',21),
('Swimming pool services',21),
('Tailors and alterations',21),
('Telecommunication service',21),
('Utilities',21),
('Vision care',21),
('Watch, clock, and jewelry repair',21),
('Athletic shoes',22),
('Bicycle shop, service, and repair',22),
('Boating, sailing and accessories',22),
('Camping and outdoors',22),
('Dance halls, studios, and schools',22),
('Exercise and fitness',22),
('Fan gear and memorabilia',22),
('Firearm accessories',22),
('Firearms',22),
('Hunting',22),
('Knives',22),
('Martial arts weapons',22),
('Sport games and toys',22),
('Sporting equipment',22),
('Swimming pools and spas',22),
('Arts and crafts',23),
('Camera and photographic supplies',23),
('Hobby, toy, and game shops',23),
('Memorabilia',23),
('Music store - instruments and sheet music',23),
('Stamp and coin',23),
('Stationary, printing, and writing paper',23),
('Vintage and collectibles',23),
('Video games and systems',23),
('Airline',24),
('Auto rental',24),
('Bus line',24),
('Cruises',24),
('Lodging and accommodations',24),
('Luggage and leather goods',24),
('Recreational services',24),
('Sporting and recreation camps',24),
('Taxicabs and limousines',24),
('Timeshares',24),
('Tours',24),
('Trailer parks or campgrounds',24),
('Transportation services - other',24),
('Travel agency',24),
('Auto dealer - new and used',25),
('Auto dealer - used only',25),
('Aviation',25),
('Boat dealer',25),
('Mobile home dealer',25),
('Motorcycle dealer',25),
('Recreational and utility trailer dealer',25),
('Recreational vehicle dealer',25),
('Vintage and collectibles',25),
('New parts and supplies - motor vehicle',26),
('Used parts - motor vehicle',26),
('Audio and video',26),
('Auto body repair and paint',26),
('Auto rental',26),
('Auto service',26),
('Automotive tire supply and service',26),
('Boat rental and leases',26),
('Car wash',26),
('Motor home and recreational vehicle rental',26),
('Tools and equipment',26),
('Towing service',26),
('Truck and utility trailer rental',26),
('Accessories',26);
set foreign_key_checks=1;
|
<reponame>developersworkspace/EPONS
-- Fix Epsilon Scale
DECLARE @id uniqueidentifier, @active uniqueidentifier, @actid uniqueidentifier
SELECT @id = lis.ParentId,
@active = lis.StatusId,
@actid = lis.LastUpdateAccountId
FROM ListItem lip
INNER JOIN ListItem lis ON (lip.ParentId IS NULL AND lip.Name = 'Scale' AND lis.Name = 'Gamma' AND lis.ParentId = lip.ListItemId);
INSERT INTO ListItem (ParentId, Code, Name, Description, StatusId, LastUpdateTimestamp, LastUpdateAccountId)
VALUES (@id, 'Epsilon', 'Epsilon','Epsilon', @active, current_timestamp, @actid)
SELECT @id = ListItemId
FROM ListItem
WHERE ParentId = @id AND Name = 'Epsilon'
INSERT INTO ListItem (ParentId, SortOrder, Code, Name, [Description], StatusId, LastUpdateTimestamp, LastUpdateAccountId)
VALUES
(@id, 1, 'Motivation', 'Motivation (generating drive) ', 'Motivation refers to the subject''s ability to generate drive to master certain goals or skills. The drive may be from within (such as a need to succeed) or encouraged by external factors (such as incentives or remuneration) or both.', @active, current_timestamp, @actid),
(@id, 2, 'WorkTolerance', 'Work Tolerance (maintaining effort) ', 'Work Tolerance refers to the subject''s ability to maintain effort over time and complete the task without any obvious evidence of physical fatigue (e.g. pausing to rest) or mental fatigue (e.g. drifting concentration).', @active, current_timestamp, @actid),
(@id, 3, 'PersonalPresentation', 'Personal Presentation (adjusting personal attitudes)', 'Personal presentation refers to the subject''s ability to adjust his personal attitudes in order to fit the job requirements - such as appropriate dress code, accountability, responsibility, self control, the degree to which work is valued and keeping to schedules (e.g. punctuality and attendance).', @active, current_timestamp, @actid),
(@id, 4, 'SocialPresentation', 'Social Presentaion (adjusting social skills)', 'Social presentation refers to the subject''s ability to adjust his social skills to fit into the team work required by the job - such as acceptance of supervision, attitude towards peers, superiors and subordinates, cooperation, verbal and non-verbal communication and respecting interdependency.', @active, current_timestamp, @actid),
(@id, 5, 'WorkCompetence', 'Work Competence (integrating skills)', 'Work competence refers to the subject''s ability to integrate all the skills required by the job - such as following instructions, handling stress and pressure, recognizing mistakes and making corrections, flexibility, concentration and retention of information, handling repetition and variation of tasks, and maintaining practical arrangements, rules and regulations.', @active, current_timestamp, @actid),
(@id, 6, 'WorkSkill', 'Work Skill / Knowledge (job ease)', 'Work skill/knowledge refers to the subject''s ability to perform the job with ease due to acquired skill and familiarity as a result of training and/or experience.', @active, current_timestamp, @actid),
(@id, 7, 'Productivity', 'Productivity (work speed)', 'Productivity refers to the subject''s ability to maintain an acceptable work speed - such as maintaining the required standards (e.g. quality and/or quantity) at acceptable norms (e.g. time frames and /or speed).', @active, current_timestamp, @actid)
INSERT INTO ListItem (ParentId,Name, Value, StatusId, LastUpdateTimestamp, LastUpdateAccountId)
SELECT ListItemId, 'Motivation1', 1, StatusId, current_timestamp, LastUpdateAccountId
FROM ListItem
WHERE ParentId = @id AND Code = 'Motivation'
INSERT INTO ListItem (ParentId,Name, Value, StatusId, LastUpdateTimestamp, LastUpdateAccountId)
SELECT ListItemId, 'Motivation2', 2, StatusId, current_timestamp, LastUpdateAccountId
FROM ListItem
WHERE ParentId = @id AND Code = 'Motivation'
INSERT INTO ListItem (ParentId,Name, Value, StatusId, LastUpdateTimestamp, LastUpdateAccountId)
SELECT ListItemId, 'Motivation3', 3, StatusId, current_timestamp, LastUpdateAccountId
FROM ListItem
WHERE ParentId = @id AND Code = 'Motivation'
INSERT INTO ListItem (ParentId,Name, Value, StatusId, LastUpdateTimestamp, LastUpdateAccountId)
SELECT ListItemId, 'Motivation4', 4, StatusId, current_timestamp, LastUpdateAccountId
FROM ListItem
WHERE ParentId = @id AND Code = 'Motivation'
INSERT INTO ListItem (ParentId,Name, Value, StatusId, LastUpdateTimestamp, LastUpdateAccountId)
SELECT ListItemId, 'Motivation5', 5, StatusId, current_timestamp, LastUpdateAccountId
FROM ListItem
WHERE ParentId = @id AND Code = 'Motivation'
INSERT INTO ListItem (ParentId,Name, Value, StatusId, LastUpdateTimestamp, LastUpdateAccountId)
SELECT ListItemId, 'Motivation6', 6, StatusId, current_timestamp, LastUpdateAccountId
FROM ListItem
WHERE ParentId = @id AND Code = 'Motivation'
INSERT INTO ListItem (ParentId,Name, Value, StatusId, LastUpdateTimestamp, LastUpdateAccountId)
SELECT ListItemId, 'Motivation7', 7, StatusId, current_timestamp, LastUpdateAccountId
FROM ListItem
WHERE ParentId = @id AND Code = 'Motivation'
INSERT INTO ListItem (ParentId,Name, Value, StatusId, LastUpdateTimestamp, LastUpdateAccountId)
SELECT ListItemId, 'WorkTolerance1', 1, StatusId, current_timestamp, LastUpdateAccountId
FROM ListItem
WHERE ParentId = @id AND Code = 'WorkTolerance'
INSERT INTO ListItem (ParentId,Name, Value, StatusId, LastUpdateTimestamp, LastUpdateAccountId)
SELECT ListItemId, 'WorkTolerance2', 2, StatusId, current_timestamp, LastUpdateAccountId
FROM ListItem
WHERE ParentId = @id AND Code = 'WorkTolerance'
INSERT INTO ListItem (ParentId,Name, Value, StatusId, LastUpdateTimestamp, LastUpdateAccountId)
SELECT ListItemId, 'WorkTolerance3', 3, StatusId, current_timestamp, LastUpdateAccountId
FROM ListItem
WHERE ParentId = @id AND Code = 'WorkTolerance'
INSERT INTO ListItem (ParentId,Name, Value, StatusId, LastUpdateTimestamp, LastUpdateAccountId)
SELECT ListItemId, 'WorkTolerance4', 4, StatusId, current_timestamp, LastUpdateAccountId
FROM ListItem
WHERE ParentId = @id AND Code = 'WorkTolerance'
INSERT INTO ListItem (ParentId,Name, Value, StatusId, LastUpdateTimestamp, LastUpdateAccountId)
SELECT ListItemId, 'WorkTolerance5', 5, StatusId, current_timestamp, LastUpdateAccountId
FROM ListItem
WHERE ParentId = @id AND Code = 'WorkTolerance'
INSERT INTO ListItem (ParentId,Name, Value, StatusId, LastUpdateTimestamp, LastUpdateAccountId)
SELECT ListItemId, 'WorkTolerance6', 6, StatusId, current_timestamp, LastUpdateAccountId
FROM ListItem
WHERE ParentId = @id AND Code = 'WorkTolerance'
INSERT INTO ListItem (ParentId,Name, Value, StatusId, LastUpdateTimestamp, LastUpdateAccountId)
SELECT ListItemId, 'WorkTolerance7', 7, StatusId, current_timestamp, LastUpdateAccountId
FROM ListItem
WHERE ParentId = @id AND Code = 'WorkTolerance'
INSERT INTO ListItem (ParentId,Name, Value, StatusId, LastUpdateTimestamp, LastUpdateAccountId)
SELECT ListItemId, 'PersonalPresentation1', 1, StatusId, current_timestamp, LastUpdateAccountId
FROM ListItem
WHERE ParentId = @id AND Code = 'PersonalPresentation'
INSERT INTO ListItem (ParentId,Name, Value, StatusId, LastUpdateTimestamp, LastUpdateAccountId)
SELECT ListItemId, 'PersonalPresentation2', 2, StatusId, current_timestamp, LastUpdateAccountId
FROM ListItem
WHERE ParentId = @id AND Code = 'PersonalPresentation'
INSERT INTO ListItem (ParentId,Name, Value, StatusId, LastUpdateTimestamp, LastUpdateAccountId)
SELECT ListItemId, 'PersonalPresentation3', 3, StatusId, current_timestamp, LastUpdateAccountId
FROM ListItem
WHERE ParentId = @id AND Code = 'PersonalPresentation'
INSERT INTO ListItem (ParentId,Name, Value, StatusId, LastUpdateTimestamp, LastUpdateAccountId)
SELECT ListItemId, 'PersonalPresentation4', 4, StatusId, current_timestamp, LastUpdateAccountId
FROM ListItem
WHERE ParentId = @id AND Code = 'PersonalPresentation'
INSERT INTO ListItem (ParentId,Name, Value, StatusId, LastUpdateTimestamp, LastUpdateAccountId)
SELECT ListItemId, 'PersonalPresentation5', 5, StatusId, current_timestamp, LastUpdateAccountId
FROM ListItem
WHERE ParentId = @id AND Code = 'PersonalPresentation'
INSERT INTO ListItem (ParentId,Name, Value, StatusId, LastUpdateTimestamp, LastUpdateAccountId)
SELECT ListItemId, 'PersonalPresentation6', 6, StatusId, current_timestamp, LastUpdateAccountId
FROM ListItem
WHERE ParentId = @id AND Code = 'PersonalPresentation'
INSERT INTO ListItem (ParentId,Name, Value, StatusId, LastUpdateTimestamp, LastUpdateAccountId)
SELECT ListItemId, 'PersonalPresentation7', 7, StatusId, current_timestamp, LastUpdateAccountId
FROM ListItem
WHERE ParentId = @id AND Code = 'PersonalPresentation'
INSERT INTO ListItem (ParentId,Name, Value, StatusId, LastUpdateTimestamp, LastUpdateAccountId)
SELECT ListItemId, 'SocialPresentation1', 1, StatusId, current_timestamp, LastUpdateAccountId
FROM ListItem
WHERE ParentId = @id AND Code = 'SocialPresentation'
INSERT INTO ListItem (ParentId,Name, Value, StatusId, LastUpdateTimestamp, LastUpdateAccountId)
SELECT ListItemId, 'SocialPresentation2', 2, StatusId, current_timestamp, LastUpdateAccountId
FROM ListItem
WHERE ParentId = @id AND Code = 'SocialPresentation'
INSERT INTO ListItem (ParentId,Name, Value, StatusId, LastUpdateTimestamp, LastUpdateAccountId)
SELECT ListItemId, 'SocialPresentation3', 3, StatusId, current_timestamp, LastUpdateAccountId
FROM ListItem
WHERE ParentId = @id AND Code = 'SocialPresentation'
INSERT INTO ListItem (ParentId,Name, Value, StatusId, LastUpdateTimestamp, LastUpdateAccountId)
SELECT ListItemId, 'SocialPresentation4', 4, StatusId, current_timestamp, LastUpdateAccountId
FROM ListItem
WHERE ParentId = @id AND Code = 'SocialPresentation'
INSERT INTO ListItem (ParentId,Name, Value, StatusId, LastUpdateTimestamp, LastUpdateAccountId)
SELECT ListItemId, 'SocialPresentation5', 5, StatusId, current_timestamp, LastUpdateAccountId
FROM ListItem
WHERE ParentId = @id AND Code = 'SocialPresentation'
INSERT INTO ListItem (ParentId,Name, Value, StatusId, LastUpdateTimestamp, LastUpdateAccountId)
SELECT ListItemId, 'SocialPresentation6', 6, StatusId, current_timestamp, LastUpdateAccountId
FROM ListItem
WHERE ParentId = @id AND Code = 'SocialPresentation'
INSERT INTO ListItem (ParentId,Name, Value, StatusId, LastUpdateTimestamp, LastUpdateAccountId)
SELECT ListItemId, 'SocialPresentation7', 7, StatusId, current_timestamp, LastUpdateAccountId
FROM ListItem
WHERE ParentId = @id AND Code = 'SocialPresentation'
INSERT INTO ListItem (ParentId,Name, Value, StatusId, LastUpdateTimestamp, LastUpdateAccountId)
SELECT ListItemId, 'WorkCompetence1', 1, StatusId, current_timestamp, LastUpdateAccountId
FROM ListItem
WHERE ParentId = @id AND Code = 'WorkCompetence'
INSERT INTO ListItem (ParentId,Name, Value, StatusId, LastUpdateTimestamp, LastUpdateAccountId)
SELECT ListItemId, 'WorkCompetence2', 2, StatusId, current_timestamp, LastUpdateAccountId
FROM ListItem
WHERE ParentId = @id AND Code = 'WorkCompetence'
INSERT INTO ListItem (ParentId,Name, Value, StatusId, LastUpdateTimestamp, LastUpdateAccountId)
SELECT ListItemId, 'WorkCompetence3', 3, StatusId, current_timestamp, LastUpdateAccountId
FROM ListItem
WHERE ParentId = @id AND Code = 'WorkCompetence'
INSERT INTO ListItem (ParentId,Name, Value, StatusId, LastUpdateTimestamp, LastUpdateAccountId)
SELECT ListItemId, 'WorkCompetence4', 4, StatusId, current_timestamp, LastUpdateAccountId
FROM ListItem
WHERE ParentId = @id AND Code = 'WorkCompetence'
INSERT INTO ListItem (ParentId,Name, Value, StatusId, LastUpdateTimestamp, LastUpdateAccountId)
SELECT ListItemId, 'WorkCompetence5', 5, StatusId, current_timestamp, LastUpdateAccountId
FROM ListItem
WHERE ParentId = @id AND Code = 'WorkCompetence'
INSERT INTO ListItem (ParentId,Name, Value, StatusId, LastUpdateTimestamp, LastUpdateAccountId)
SELECT ListItemId, 'WorkCompetence6', 6, StatusId, current_timestamp, LastUpdateAccountId
FROM ListItem
WHERE ParentId = @id AND Code = 'WorkCompetence'
INSERT INTO ListItem (ParentId,Name, Value, StatusId, LastUpdateTimestamp, LastUpdateAccountId)
SELECT ListItemId, 'WorkCompetence7', 7, StatusId, current_timestamp, LastUpdateAccountId
FROM ListItem
WHERE ParentId = @id AND Code = 'WorkCompetence'
INSERT INTO ListItem (ParentId,Name, Value, StatusId, LastUpdateTimestamp, LastUpdateAccountId)
SELECT ListItemId, 'WorkSkill1', 1, StatusId, current_timestamp, LastUpdateAccountId
FROM ListItem
WHERE ParentId = @id AND Code = 'WorkSkill'
INSERT INTO ListItem (ParentId,Name, Value, StatusId, LastUpdateTimestamp, LastUpdateAccountId)
SELECT ListItemId, 'WorkSkill2', 2, StatusId, current_timestamp, LastUpdateAccountId
FROM ListItem
WHERE ParentId = @id AND Code = 'WorkSkill'
INSERT INTO ListItem (ParentId,Name, Value, StatusId, LastUpdateTimestamp, LastUpdateAccountId)
SELECT ListItemId, 'WorkSkill3', 3, StatusId, current_timestamp, LastUpdateAccountId
FROM ListItem
WHERE ParentId = @id AND Code = 'WorkSkill'
INSERT INTO ListItem (ParentId,Name, Value, StatusId, LastUpdateTimestamp, LastUpdateAccountId)
SELECT ListItemId, 'WorkSkill4', 4, StatusId, current_timestamp, LastUpdateAccountId
FROM ListItem
WHERE ParentId = @id AND Code = 'WorkSkill'
INSERT INTO ListItem (ParentId,Name, Value, StatusId, LastUpdateTimestamp, LastUpdateAccountId)
SELECT ListItemId, 'WorkSkill5', 5, StatusId, current_timestamp, LastUpdateAccountId
FROM ListItem
WHERE ParentId = @id AND Code = 'WorkSkill'
INSERT INTO ListItem (ParentId,Name, Value, StatusId, LastUpdateTimestamp, LastUpdateAccountId)
SELECT ListItemId, 'WorkSkill6', 6, StatusId, current_timestamp, LastUpdateAccountId
FROM ListItem
WHERE ParentId = @id AND Code = 'WorkSkill'
INSERT INTO ListItem (ParentId,Name, Value, StatusId, LastUpdateTimestamp, LastUpdateAccountId)
SELECT ListItemId, 'WorkSkill7', 7, StatusId, current_timestamp, LastUpdateAccountId
FROM ListItem
WHERE ParentId = @id AND Code = 'WorkSkill'
INSERT INTO ListItem (ParentId,Name, Value, StatusId, LastUpdateTimestamp, LastUpdateAccountId)
SELECT ListItemId, 'Productivity1', 1, StatusId, current_timestamp, LastUpdateAccountId
FROM ListItem
WHERE ParentId = @id AND Code = 'Productivity'
INSERT INTO ListItem (ParentId,Name, Value, StatusId, LastUpdateTimestamp, LastUpdateAccountId)
SELECT ListItemId, 'Productivity2', 2, StatusId, current_timestamp, LastUpdateAccountId
FROM ListItem
WHERE ParentId = @id AND Code = 'Productivity'
INSERT INTO ListItem (ParentId,Name, Value, StatusId, LastUpdateTimestamp, LastUpdateAccountId)
SELECT ListItemId, 'Productivity3', 3, StatusId, current_timestamp, LastUpdateAccountId
FROM ListItem
WHERE ParentId = @id AND Code = 'Productivity'
INSERT INTO ListItem (ParentId,Name, Value, StatusId, LastUpdateTimestamp, LastUpdateAccountId)
SELECT ListItemId, 'Productivity4', 4, StatusId, current_timestamp, LastUpdateAccountId
FROM ListItem
WHERE ParentId = @id AND Code = 'Productivity'
INSERT INTO ListItem (ParentId,Name, Value, StatusId, LastUpdateTimestamp, LastUpdateAccountId)
SELECT ListItemId, 'Productivity5', 5, StatusId, current_timestamp, LastUpdateAccountId
FROM ListItem
WHERE ParentId = @id AND Code = 'Productivity'
INSERT INTO ListItem (ParentId,Name, Value, StatusId, LastUpdateTimestamp, LastUpdateAccountId)
SELECT ListItemId, 'Productivity6', 6, StatusId, current_timestamp, LastUpdateAccountId
FROM ListItem
WHERE ParentId = @id AND Code = 'Productivity'
INSERT INTO ListItem (ParentId,Name, Value, StatusId, LastUpdateTimestamp, LastUpdateAccountId)
SELECT ListItemId, 'Productivity7', 7, StatusId, current_timestamp, LastUpdateAccountId
FROM ListItem
WHERE ParentId = @id AND Code = 'Productivity'
-- Funder Explainations
INSERT INTO ListItem (ParentId,Name, Description, StatusId, LastUpdateTimestamp, LastUpdateAccountId)
SELECT ListItemId, 'Motivation1FE', 'The subject is unaware and not attempting to be motivated at all.', StatusId, current_timestamp, LastUpdateAccountId
FROM ListItem
WHERE ParentId = @id AND Code = 'Motivation'
INSERT INTO ListItem (ParentId,Name, Description, StatusId, LastUpdateTimestamp, LastUpdateAccountId)
SELECT ListItemId, 'Motivation2FE', 'The subject is aware, but he is not attempting to be motivated at all.', StatusId, current_timestamp, LastUpdateAccountId
FROM ListItem
WHERE ParentId = @id AND Code = 'Motivation'
INSERT INTO ListItem (ParentId,Name, Description, StatusId, LastUpdateTimestamp, LastUpdateAccountId)
SELECT ListItemId, 'Motivation3FE', 'The subject is aware and with a helper he is successful to be motivated 10-49% of the time.', StatusId, current_timestamp, LastUpdateAccountId
FROM ListItem
WHERE ParentId = @id AND Code = 'Motivation'
INSERT INTO ListItem (ParentId,Name, Description, StatusId, LastUpdateTimestamp, LastUpdateAccountId)
SELECT ListItemId, 'Motivation4FE', 'The subject is aware and with a helper he is successful to be motivated 50-90% of the time.', StatusId, current_timestamp, LastUpdateAccountId
FROM ListItem
WHERE ParentId = @id AND Code = 'Motivation'
INSERT INTO ListItem (ParentId,Name, Description, StatusId, LastUpdateTimestamp, LastUpdateAccountId)
SELECT ListItemId, 'Motivation5FE', 'The subject is aware and with a helper he is successful to be motivated 90% + of the time.', StatusId, current_timestamp, LastUpdateAccountId
FROM ListItem
WHERE ParentId = @id AND Code = 'Motivation'
INSERT INTO ListItem (ParentId,Name, Description, StatusId, LastUpdateTimestamp, LastUpdateAccountId)
SELECT ListItemId, 'Motivation6FE', '', StatusId, current_timestamp, LastUpdateAccountId
FROM ListItem
WHERE ParentId = @id AND Code = 'Motivation'
INSERT INTO ListItem (ParentId,Name, Description, StatusId, LastUpdateTimestamp, LastUpdateAccountId)
SELECT ListItemId, 'Motivation7FE', 'OK - Can do everything.', StatusId, current_timestamp, LastUpdateAccountId
FROM ListItem
WHERE ParentId = @id AND Code = 'Motivation'
INSERT INTO ListItem (ParentId,Name, Description, StatusId, LastUpdateTimestamp, LastUpdateAccountId)
SELECT ListItemId, 'WorkTolerance1FE', 'The subject is unaware and not attempting to succeed with work endurance.', StatusId, current_timestamp, LastUpdateAccountId
FROM ListItem
WHERE ParentId = @id AND Code = 'WorkTolerance'
INSERT INTO ListItem (ParentId,Name, Description, StatusId, LastUpdateTimestamp, LastUpdateAccountId)
SELECT ListItemId, 'WorkTolerance2FE', 'The subject is aware, but he is not attempting to succeed with work endurance.', StatusId, current_timestamp, LastUpdateAccountId
FROM ListItem
WHERE ParentId = @id AND Code = 'WorkTolerance'
INSERT INTO ListItem (ParentId,Name, Description, StatusId, LastUpdateTimestamp, LastUpdateAccountId)
SELECT ListItemId, 'WorkTolerance3FE', 'The subject is aware and with a helper he is successful with work endurance 10-49% of the time.', StatusId, current_timestamp, LastUpdateAccountId
FROM ListItem
WHERE ParentId = @id AND Code = 'WorkTolerance'
INSERT INTO ListItem (ParentId,Name, Description, StatusId, LastUpdateTimestamp, LastUpdateAccountId)
SELECT ListItemId, 'WorkTolerance4FE', 'The subject is aware and with a helper he is successful with work endurance 50-90% of the time.', StatusId, current_timestamp, LastUpdateAccountId
FROM ListItem
WHERE ParentId = @id AND Code = 'WorkTolerance'
INSERT INTO ListItem (ParentId,Name, Description, StatusId, LastUpdateTimestamp, LastUpdateAccountId)
SELECT ListItemId, 'WorkTolerance5FE', 'The subject is aware and with a helper he is successful with work endurance 90% + of the time.', StatusId, current_timestamp, LastUpdateAccountId
FROM ListItem
WHERE ParentId = @id AND Code = 'WorkTolerance'
INSERT INTO ListItem (ParentId,Name, Description, StatusId, LastUpdateTimestamp, LastUpdateAccountId)
SELECT ListItemId, 'WorkTolerance6FE', '', StatusId, current_timestamp, LastUpdateAccountId
FROM ListItem
WHERE ParentId = @id AND Code = 'WorkTolerance'
INSERT INTO ListItem (ParentId,Name, Description, StatusId, LastUpdateTimestamp, LastUpdateAccountId)
SELECT ListItemId, 'WorkTolerance7FE', 'OK - Can do everything.', StatusId, current_timestamp, LastUpdateAccountId
FROM ListItem
WHERE ParentId = @id AND Code = 'WorkTolerance'
INSERT INTO ListItem (ParentId,Name, Description, StatusId, LastUpdateTimestamp, LastUpdateAccountId)
SELECT ListItemId, 'PersonalPresentation1FE', 'The subject is unaware and not attempting to succeed with personal presentation.', StatusId, current_timestamp, LastUpdateAccountId
FROM ListItem
WHERE ParentId = @id AND Code = 'PersonalPresentation'
INSERT INTO ListItem (ParentId,Name, Description, StatusId, LastUpdateTimestamp, LastUpdateAccountId)
SELECT ListItemId, 'PersonalPresentation2FE', 'The subject is aware, but he is not attempting to succeed with personal presentation.', StatusId, current_timestamp, LastUpdateAccountId
FROM ListItem
WHERE ParentId = @id AND Code = 'PersonalPresentation'
INSERT INTO ListItem (ParentId,Name, Description, StatusId, LastUpdateTimestamp, LastUpdateAccountId)
SELECT ListItemId, 'PersonalPresentation3FE', 'The subject is aware and with a helper is successful with personal presentation 10-49% of the time.', StatusId, current_timestamp, LastUpdateAccountId
FROM ListItem
WHERE ParentId = @id AND Code = 'PersonalPresentation'
INSERT INTO ListItem (ParentId,Name, Description, StatusId, LastUpdateTimestamp, LastUpdateAccountId)
SELECT ListItemId, 'PersonalPresentation4FE', 'The subject is aware and with a helper is successful with personal presentation 50-90% of the time.', StatusId, current_timestamp, LastUpdateAccountId
FROM ListItem
WHERE ParentId = @id AND Code = 'PersonalPresentation'
INSERT INTO ListItem (ParentId,Name, Description, StatusId, LastUpdateTimestamp, LastUpdateAccountId)
SELECT ListItemId, 'PersonalPresentation5FE', 'The subject is aware and with a helper is successful with personal presentation 90% + of the time.', StatusId, current_timestamp, LastUpdateAccountId
FROM ListItem
WHERE ParentId = @id AND Code = 'PersonalPresentation'
INSERT INTO ListItem (ParentId,Name, Description, StatusId, LastUpdateTimestamp, LastUpdateAccountId)
SELECT ListItemId, 'PersonalPresentation6FE', '', StatusId, current_timestamp, LastUpdateAccountId
FROM ListItem
WHERE ParentId = @id AND Code = 'PersonalPresentation'
INSERT INTO ListItem (ParentId,Name, Description, StatusId, LastUpdateTimestamp, LastUpdateAccountId)
SELECT ListItemId, 'PersonalPresentation7FE', 'OK - Can do everything.', StatusId, current_timestamp, LastUpdateAccountId
FROM ListItem
WHERE ParentId = @id AND Code = 'PersonalPresentation'
INSERT INTO ListItem (ParentId,Name, Description, StatusId, LastUpdateTimestamp, LastUpdateAccountId)
SELECT ListItemId, 'SocialPresentation1FE', 'The subject is unaware and not attempting to succeed with social presentation.', StatusId, current_timestamp, LastUpdateAccountId
FROM ListItem
WHERE ParentId = @id AND Code = 'SocialPresentation'
INSERT INTO ListItem (ParentId,Name, Description, StatusId, LastUpdateTimestamp, LastUpdateAccountId)
SELECT ListItemId, 'SocialPresentation2FE', 'The subject is aware, but is not attempting to succeed with social presentation.', StatusId, current_timestamp, LastUpdateAccountId
FROM ListItem
WHERE ParentId = @id AND Code = 'SocialPresentation'
INSERT INTO ListItem (ParentId,Name, Description, StatusId, LastUpdateTimestamp, LastUpdateAccountId)
SELECT ListItemId, 'SocialPresentation3FE', 'The subject is aware and with a helper is successful with social presentation 10-49% of the time.', StatusId, current_timestamp, LastUpdateAccountId
FROM ListItem
WHERE ParentId = @id AND Code = 'SocialPresentation'
INSERT INTO ListItem (ParentId,Name, Description, StatusId, LastUpdateTimestamp, LastUpdateAccountId)
SELECT ListItemId, 'SocialPresentation4FE', 'The subject is aware and with a helper is successful with social presentation 50-90% of the time.', StatusId, current_timestamp, LastUpdateAccountId
FROM ListItem
WHERE ParentId = @id AND Code = 'SocialPresentation'
INSERT INTO ListItem (ParentId,Name, Description, StatusId, LastUpdateTimestamp, LastUpdateAccountId)
SELECT ListItemId, 'SocialPresentation5FE', 'The subject is aware and with a helper is successful with social presentation 90% + of the time.', StatusId, current_timestamp, LastUpdateAccountId
FROM ListItem
WHERE ParentId = @id AND Code = 'SocialPresentation'
INSERT INTO ListItem (ParentId,Name, Description, StatusId, LastUpdateTimestamp, LastUpdateAccountId)
SELECT ListItemId, 'SocialPresentation6FE', '', StatusId, current_timestamp, LastUpdateAccountId
FROM ListItem
WHERE ParentId = @id AND Code = 'SocialPresentation'
INSERT INTO ListItem (ParentId,Name, Description, StatusId, LastUpdateTimestamp, LastUpdateAccountId)
SELECT ListItemId, 'SocialPresentation7FE', 'OK - Can do everything.', StatusId, current_timestamp, LastUpdateAccountId
FROM ListItem
WHERE ParentId = @id AND Code = 'SocialPresentation'
INSERT INTO ListItem (ParentId,Name, Description, StatusId, LastUpdateTimestamp, LastUpdateAccountId)
SELECT ListItemId, 'WorkCompetence1FE', 'The subject is unaware and not attempting to succeed with the work competence.', StatusId, current_timestamp, LastUpdateAccountId
FROM ListItem
WHERE ParentId = @id AND Code = 'WorkCompetence'
INSERT INTO ListItem (ParentId,Name, Description, StatusId, LastUpdateTimestamp, LastUpdateAccountId)
SELECT ListItemId, 'WorkCompetence2FE', 'The subject is aware, but not attempting to succeed with the work competence.', StatusId, current_timestamp, LastUpdateAccountId
FROM ListItem
WHERE ParentId = @id AND Code = 'WorkCompetence'
INSERT INTO ListItem (ParentId,Name, Description, StatusId, LastUpdateTimestamp, LastUpdateAccountId)
SELECT ListItemId, 'WorkCompetence3FE', 'The subject is aware and with a helper is successful with the work competence 10-49% of the time.', StatusId, current_timestamp, LastUpdateAccountId
FROM ListItem
WHERE ParentId = @id AND Code = 'WorkCompetence'
INSERT INTO ListItem (ParentId,Name, Description, StatusId, LastUpdateTimestamp, LastUpdateAccountId)
SELECT ListItemId, 'WorkCompetence4FE', 'The subject is aware and with a helper is successful with the work competence 50-90% of the time.', StatusId, current_timestamp, LastUpdateAccountId
FROM ListItem
WHERE ParentId = @id AND Code = 'WorkCompetence'
INSERT INTO ListItem (ParentId,Name, Description, StatusId, LastUpdateTimestamp, LastUpdateAccountId)
SELECT ListItemId, 'WorkCompetence5FE', 'The subject is aware and with a helper is successful with the work competence 90% + of the time.', StatusId, current_timestamp, LastUpdateAccountId
FROM ListItem
WHERE ParentId = @id AND Code = 'WorkCompetence'
INSERT INTO ListItem (ParentId,Name, Description, StatusId, LastUpdateTimestamp, LastUpdateAccountId)
SELECT ListItemId, 'WorkCompetence6FE', '', StatusId, current_timestamp, LastUpdateAccountId
FROM ListItem
WHERE ParentId = @id AND Code = 'WorkCompetence'
INSERT INTO ListItem (ParentId,Name, Description, StatusId, LastUpdateTimestamp, LastUpdateAccountId)
SELECT ListItemId, 'WorkCompetence7FE', 'OK - Can do everything.', StatusId, current_timestamp, LastUpdateAccountId
FROM ListItem
WHERE ParentId = @id AND Code = 'WorkCompetence'
INSERT INTO ListItem (ParentId,Name, Description, StatusId, LastUpdateTimestamp, LastUpdateAccountId)
SELECT ListItemId, 'WorkSkill1FE', 'The subject is unaware and not attempting to succeed with the work skill/knowledge.', StatusId, current_timestamp, LastUpdateAccountId
FROM ListItem
WHERE ParentId = @id AND Code = 'WorkSkill'
INSERT INTO ListItem (ParentId,Name, Description, StatusId, LastUpdateTimestamp, LastUpdateAccountId)
SELECT ListItemId, 'WorkSkill2FE', 'The subject is aware, but not attempting to succeed with the work skill/knowledge.', StatusId, current_timestamp, LastUpdateAccountId
FROM ListItem
WHERE ParentId = @id AND Code = 'WorkSkill'
INSERT INTO ListItem (ParentId,Name, Description, StatusId, LastUpdateTimestamp, LastUpdateAccountId)
SELECT ListItemId, 'WorkSkill3FE', 'The subject is aware and with a helper is successful with the work skill/knowledge 10-49% of the time.', StatusId, current_timestamp, LastUpdateAccountId
FROM ListItem
WHERE ParentId = @id AND Code = 'WorkSkill'
INSERT INTO ListItem (ParentId,Name, Description, StatusId, LastUpdateTimestamp, LastUpdateAccountId)
SELECT ListItemId, 'WorkSkill4FE', 'The subject is aware and with a helper is successful with the work skill/knowledge 50-90% of the time.', StatusId, current_timestamp, LastUpdateAccountId
FROM ListItem
WHERE ParentId = @id AND Code = 'WorkSkill'
INSERT INTO ListItem (ParentId,Name, Description, StatusId, LastUpdateTimestamp, LastUpdateAccountId)
SELECT ListItemId, 'WorkSkill5FE', 'The subject is aware and with a helper is successful with the work skill/knowledge 90% +of the time.', StatusId, current_timestamp, LastUpdateAccountId
FROM ListItem
WHERE ParentId = @id AND Code = 'WorkSkill'
INSERT INTO ListItem (ParentId,Name, Description, StatusId, LastUpdateTimestamp, LastUpdateAccountId)
SELECT ListItemId, 'WorkSkill6FE', '', StatusId, current_timestamp, LastUpdateAccountId
FROM ListItem
WHERE ParentId = @id AND Code = 'WorkSkill'
INSERT INTO ListItem (ParentId,Name, Description, StatusId, LastUpdateTimestamp, LastUpdateAccountId)
SELECT ListItemId, 'WorkSkill7FE', 'OK - Can do everything.', StatusId, current_timestamp, LastUpdateAccountId
FROM ListItem
WHERE ParentId = @id AND Code = 'WorkSkill'
INSERT INTO ListItem (ParentId,Name, Description, StatusId, LastUpdateTimestamp, LastUpdateAccountId)
SELECT ListItemId, 'Productivity1FE', 'The subject is unaware and not attempting to be productive at all.', StatusId, current_timestamp, LastUpdateAccountId
FROM ListItem
WHERE ParentId = @id AND Code = 'Productivity'
INSERT INTO ListItem (ParentId,Name, Description, StatusId, LastUpdateTimestamp, LastUpdateAccountId)
SELECT ListItemId, 'Productivity2FE', 'The subject is aware, but he is not attempting to be productive at all.', StatusId, current_timestamp, LastUpdateAccountId
FROM ListItem
WHERE ParentId = @id AND Code = 'Productivity'
INSERT INTO ListItem (ParentId,Name, Description, StatusId, LastUpdateTimestamp, LastUpdateAccountId)
SELECT ListItemId, 'Productivity3FE', 'The subject is aware and with a helper is successful with the productivity 10-49% of the time.', StatusId, current_timestamp, LastUpdateAccountId
FROM ListItem
WHERE ParentId = @id AND Code = 'Productivity'
INSERT INTO ListItem (ParentId,Name, Description, StatusId, LastUpdateTimestamp, LastUpdateAccountId)
SELECT ListItemId, 'Productivity4FE', 'The subject is aware and with a helper is successful with the productivity 50-90% of the time.', StatusId, current_timestamp, LastUpdateAccountId
FROM ListItem
WHERE ParentId = @id AND Code = 'Productivity'
INSERT INTO ListItem (ParentId,Name, Description, StatusId, LastUpdateTimestamp, LastUpdateAccountId)
SELECT ListItemId, 'Productivity5FE', 'The subject is aware and with a helper is successful with the productivity 90% + of the time.', StatusId, current_timestamp, LastUpdateAccountId
FROM ListItem
WHERE ParentId = @id AND Code = 'Productivity'
INSERT INTO ListItem (ParentId,Name, Description, StatusId, LastUpdateTimestamp, LastUpdateAccountId)
SELECT ListItemId, 'Productivity6FE', '', StatusId, current_timestamp, LastUpdateAccountId
FROM ListItem
WHERE ParentId = @id AND Code = 'Productivity'
INSERT INTO ListItem (ParentId,Name, Description, StatusId, LastUpdateTimestamp, LastUpdateAccountId)
SELECT ListItemId, 'Productivity7FE', 'OK - Can do everything.', StatusId, current_timestamp, LastUpdateAccountId
FROM ListItem
WHERE ParentId = @id AND Code = 'Productivity'
|
<reponame>quis/registers-frontend
SELECT registers.id AS register_id,
registers.name,
CAST(register_name_data.data->'register-name' AS varchar) AS register_name,
CAST(register_description_data.data->'text' AS varchar) AS register_description
FROM registers
LEFT JOIN
(SELECT register_id,
DATA
FROM records
WHERE KEY = 'register-name' AND ENTRY_TYPE='system' ) AS register_name_data ON register_name_data.register_id = registers.id
LEFT JOIN
(SELECT KEY,
DATA
FROM records) AS register_description_data ON register_description_data.key = 'register:' || registers.slug;
|
\i table_car.sql
\set variables_file car_ids.list
\set variables_target car_ids
\i load_variables_file.sql
SELECT extract(year FROM delivered) AS year,
sum(list_price) AS list_price,
sum(value) AS value
FROM car
WHERE car_id IN (:car_ids)
GROUP BY extract(year FROM delivered);
|
<reponame>originalix/HTML-CSS-Prictice<gh_stars>10-100
DROP TABLE IF EXISTS entries;
CREATE TABLE entries (
id INTEGER PRIMARY KEY AUTOINCREMENT,
title STRING NOT NULL,
text STRING NOT NULL
);
|
-- phpMyAdmin SQL Dump
-- version 4.9.5
-- https://www.phpmyadmin.net/
--
-- Host: localhost:3306
-- Waktu pembuatan: 15 Jul 2021 pada 14.38
-- Versi server: 5.7.24
-- Versi PHP: 7.4.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: `db_siwikode`
--
-- --------------------------------------------------------
--
-- Struktur dari tabel `jenis_kuliner`
--
CREATE TABLE `jenis_kuliner` (
`id` int(11) NOT NULL,
`nama` varchar(45) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data untuk tabel `jenis_kuliner`
--
INSERT INTO `jenis_kuliner` (`id`, `nama`) VALUES
(1, 'Kedai/Cafe'),
(2, 'Restaurant'),
(3, 'Pasar Kaget');
-- --------------------------------------------------------
--
-- Struktur dari tabel `jenis_wisata`
--
CREATE TABLE `jenis_wisata` (
`id` int(11) NOT NULL,
`nama` varchar(30) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data untuk tabel `jenis_wisata`
--
INSERT INTO `jenis_wisata` (`id`, `nama`) VALUES
(1, 'Argo Wisata'),
(2, 'Kuliner'),
(3, 'Taman Wisata'),
(4, 'Museum'),
(5, 'Water Park / Kol<NAME>');
-- --------------------------------------------------------
--
-- Struktur dari tabel `profesi`
--
CREATE TABLE `profesi` (
`id` int(11) NOT NULL,
`nama` varchar(20) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data untuk tabel `profesi`
--
INSERT INTO `profesi` (`id`, `nama`) VALUES
(1, 'Artist'),
(2, 'Pejabat'),
(3, 'Mahasiswa'),
(4, 'Pegawai Swasta'),
(11, 'Umum');
-- --------------------------------------------------------
--
-- Struktur dari tabel `testimoni`
--
CREATE TABLE `testimoni` (
`id` int(11) NOT NULL,
`nama` varchar(45) DEFAULT NULL,
`email` varchar(45) DEFAULT NULL,
`wisata_id` int(11) NOT NULL,
`profesi_id` int(11) NOT NULL,
`rating` smallint(6) DEFAULT NULL,
`komentar` text
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Struktur dari tabel `user`
--
CREATE TABLE `user` (
`id_user` int(11) NOT NULL,
`email` varchar(50) NOT NULL,
`password` varchar(80) NOT NULL,
`level` enum('user','admin') NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data untuk tabel `user`
--
INSERT INTO `user` (`id_user`, `email`, `password`, `level`) VALUES
(1, '<EMAIL>', '<PASSWORD>', 'user');
-- --------------------------------------------------------
--
-- Struktur dari tabel `wisata`
--
CREATE TABLE `wisata` (
`id` int(11) NOT NULL,
`jenis_wisata_id` int(11) NOT NULL,
`jenis_kuliner_id` int(11) NOT NULL,
`foto` text NOT NULL,
`nama` varchar(100) DEFAULT NULL,
`deskripsi` text,
`fasilitas` text,
`bintang` smallint(6) DEFAULT NULL,
`kontak` varchar(45) DEFAULT NULL,
`alamat` varchar(45) DEFAULT NULL,
`latlong` varchar(20) DEFAULT NULL,
`email` varchar(45) DEFAULT NULL,
`web` varchar(45) DEFAULT NULL,
`tipe` enum('wisata','kuliner') NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data untuk tabel `wisata`
--
INSERT INTO `wisata` (`id`, `jenis_wisata_id`, `jenis_kuliner_id`, `foto`, `nama`, `deskripsi`, `fasilitas`, `bintang`, `kontak`, `alamat`, `latlong`, `email`, `web`, `tipe`) VALUES
(1, 2, 2, 'assets/img/restaurant_1.jpg', 'Pondok Ikan Gurame', 'Di siang hari yang terik memang paling pas untuk mencari tempat sejuk yang bisa sekaligus menikmati tempat makan enak. Itu bisa kamu dapatkan saat datang ke Pondok Ikan Gurame. Walaupun tidak menggunakan pendingin ruangan, tempat makan ini terasa nyaman dan sejuk karena di sekitarnya banyak memiliki tumbuhan hijau dan tempat makan lesehan. ', NULL, 10, NULL, NULL, NULL, NULL, NULL, 'kuliner'),
(2, 1, 3, 'assets/img/restaurant_2.jpg', 'Wisata Alam Kampung 99 Pepohonan', 'Cocok untuk mereka yang mencari suasana tenang, damai dan terasa sejuk setelah beraktivitas cukup padat dalam satu minggu penuh.Kampung 99 Pepohonan ini merupakan tempat hunian sekaligus rekreasi yang berkonsep menyatu dengan alam.\r\n\r\nLokasi ini juga dikenal dengan nama kampung Rusa yang dekat dengan Masjid <NAME>. Kampung 99 Pepohonan ini berada di Jalan KH Muhasan II, kelurahan Maruyung Kecamatan Limo. Wisatawan bisa datang dengan anak-anak kecil yang akan menyukai lingkungan ini.', NULL, 10, NULL, NULL, NULL, NULL, NULL, 'wisata'),
(3, 1, 3, 'assets/img/restaurant_3.jpg', 'Water Park Ceria', 'Lokasi wahana bermain air ini berdekatan dengan Universitas Indonesia. Dari UI Anda bisa menuju ke daerah Haji Amat 1, kemudian belok kanan ke arah jalan H. <NAME>. Selanjutnya masuk melalui kawasan Ahmad Dahlan III, barulan ambil jalur ke jalan K.H.M. Usman. Anda langsung bisa melihat sebuah plang yang menunjukkan Waterpark Ceria Depok.\r\n\r\nWisata air ini didominasi oleh wahana permainan seperti perosotan berbagai bentuk dan ukuran. Ada pula ember tumpah serta kolam arus yang menambah keceriaan liburan Anda kali ini. Pengelola wisata juga menyediakan fasilitas yang memadai, mulai dari toilet bersih hingga kamar ganti. Selain itu terdapat foodcourt yang siap mengisi perut kosong dengan harga terjangkau.', NULL, 10, NULL, NULL, NULL, NULL, NULL, 'wisata'),
(4, 4, 3, 'assets/img/restaurant_1.jpg', 'Masjid Kubah Emas', 'Lebih tepatnya, mereka yang datang ke Masjid Kubah Emas ini tak hanya untuk beribadah tetapi juga wisata religi. Namanya adalah Masjid K<NAME> atau Masjid D<NAME> yang menjadi masjid kebanggaan kota Depok. Diresmikan di tanggal 31 Desember 2006 dan menjadi yang termegah di kawasan Asia Tenggara. Kubahnya mengacu pada kubah masjid-masjid di Persia dan India dengan balutan mozaik yang berlapiskan emas serta materialnya didatangkan langsung dari Itali.\r\n\r\nMasjid menawan ini juga menjadi daya tarik wisatawan yang datang untuk melaksanakan Shalat atau sekadar melihat bangunan masjid yang megah. Masjid Kubah Emas berada di jalan Raya Maruyung, Limo Depok. Setiap harinya selalu ramai dengan para jemaah baik dari warga sekitar ataupun pengunjung dari luar Depok.', NULL, 10, NULL, NULL, NULL, NULL, NULL, 'wisata');
--
-- Indexes for dumped tables
--
--
-- Indeks untuk tabel `jenis_kuliner`
--
ALTER TABLE `jenis_kuliner`
ADD PRIMARY KEY (`id`);
--
-- Indeks untuk tabel `jenis_wisata`
--
ALTER TABLE `jenis_wisata`
ADD PRIMARY KEY (`id`);
--
-- Indeks untuk tabel `profesi`
--
ALTER TABLE `profesi`
ADD PRIMARY KEY (`id`);
--
-- Indeks untuk tabel `testimoni`
--
ALTER TABLE `testimoni`
ADD PRIMARY KEY (`id`),
ADD KEY `wisata_id` (`wisata_id`),
ADD KEY `profesi_id` (`profesi_id`);
--
-- Indeks untuk tabel `user`
--
ALTER TABLE `user`
ADD PRIMARY KEY (`id_user`);
--
-- Indeks untuk tabel `wisata`
--
ALTER TABLE `wisata`
ADD PRIMARY KEY (`id`),
ADD KEY `jenis_wisata_id` (`jenis_wisata_id`),
ADD KEY `jenis_kuliner_id` (`jenis_kuliner_id`);
--
-- AUTO_INCREMENT untuk tabel yang dibuang
--
--
-- AUTO_INCREMENT untuk tabel `jenis_kuliner`
--
ALTER TABLE `jenis_kuliner`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
--
-- AUTO_INCREMENT untuk tabel `jenis_wisata`
--
ALTER TABLE `jenis_wisata`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;
--
-- AUTO_INCREMENT untuk tabel `profesi`
--
ALTER TABLE `profesi`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=12;
--
-- AUTO_INCREMENT untuk tabel `testimoni`
--
ALTER TABLE `testimoni`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT untuk tabel `user`
--
ALTER TABLE `user`
MODIFY `id_user` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT untuk tabel `wisata`
--
ALTER TABLE `wisata`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
--
-- Ketidakleluasaan untuk tabel pelimpahan (Dumped Tables)
--
--
-- Ketidakleluasaan untuk tabel `testimoni`
--
ALTER TABLE `testimoni`
ADD CONSTRAINT `fk_testimoni_profesi1` FOREIGN KEY (`profesi_id`) REFERENCES `profesi` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
ADD CONSTRAINT `fk_testimoni_wisata1` FOREIGN KEY (`wisata_id`) REFERENCES `wisata` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION;
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 */;
|
<filename>files/VLF_usage_before_after_active_VLF.sql<gh_stars>1-10
-- from
-- https://docs.microsoft.com/en-us/sql/relational-databases/system-dynamic-management-views/sys-dm-db-log-info-transact-sql?view=sql-server-ver15
-- doesn't work in SQL Server 2014
use [mydatabase]
;WITH cte_vlf AS (
SELECT ROW_NUMBER() OVER(ORDER BY vlf_begin_offset) AS vlfid, DB_NAME(database_id) AS [Database Name], vlf_sequence_number, vlf_active, vlf_begin_offset, vlf_size_mb
FROM sys.dm_db_log_info(DEFAULT)),
cte_vlf_cnt AS (SELECT [Database Name], COUNT(vlf_sequence_number) AS vlf_count,
(SELECT COUNT(vlf_sequence_number) FROM cte_vlf WHERE vlf_active = 0) AS vlf_count_inactive,
(SELECT COUNT(vlf_sequence_number) FROM cte_vlf WHERE vlf_active = 1) AS vlf_count_active,
(SELECT MIN(vlfid) FROM cte_vlf WHERE vlf_active = 1) AS ordinal_min_vlf_active,
(SELECT MIN(vlf_sequence_number) FROM cte_vlf WHERE vlf_active = 1) AS min_vlf_active,
(SELECT MAX(vlfid) FROM cte_vlf WHERE vlf_active = 1) AS ordinal_max_vlf_active,
(SELECT MAX(vlf_sequence_number) FROM cte_vlf WHERE vlf_active = 1) AS max_vlf_active
FROM cte_vlf
GROUP BY [Database Name])
SELECT [Database Name], vlf_count, min_vlf_active, ordinal_min_vlf_active, max_vlf_active, ordinal_max_vlf_active,
((ordinal_min_vlf_active-1)*100.00/vlf_count) AS free_log_pct_before_active_log,
((ordinal_max_vlf_active-(ordinal_min_vlf_active-1))*100.00/vlf_count) AS active_log_pct,
((vlf_count-ordinal_max_vlf_active)*100.00/vlf_count) AS free_log_pct_after_active_log
FROM cte_vlf_cnt
GO
|
CREATE PROCEDURE [dbo].[x360ce_UpdateSummariesTable]
@inserted x360ce_SummariesTableType READONLY,
@deleted x360ce_SummariesTableType READONLY,
@updateAll bit = 0
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
/*
-- To update all records run:
DECLARE @updated as x360ce_SummariesTableType
exec [dbo].[x360ce_UpdateSummariesTable] @updated, @updated, 1
*/
IF @updateAll = 1
BEGIN
-- Declare temp table
DECLARE @summaries AS x360ce_SummariesTableType
-- Fill table with records.
INSERT INTO @summaries(ProductGuid, ProductName, [FileName], FileProductName, PadSettingChecksum)
SELECT ProductGuid, ProductName, [FileName], FileProductName, PadSettingChecksum
FROM (
SELECT ProductGuid, ProductName, [FileName], FileProductName, PadSettingChecksum FROM dbo.x360ce_Settings
) t1
GROUP BY ProductGuid, ProductName, [FileName], FileProductName, PadSettingChecksum
-- Execute procedure.
EXEC [dbo].[x360ce_UpdateSummariesTable] @summaries, @summaries
RETURN 0
END
-- Delete redundant records.
DELETE s
FROM [dbo].[x360ce_Summaries] s
-- Limit select to updated records only.
--INNER JOIN @settings t0 ON
INNER JOIN @deleted t0 ON
t0.ProductGuid = s.ProductGuid AND
t0.[FileName] = s.[FileName] AND
t0.FileProductName = s.FileProductName AND
t0.PadSettingChecksum = s.PadSettingChecksum
-- Join Settings table to check if they exist.
LEFT JOIN [dbo].[x360ce_Settings] t1 ON
t1.ProductGuid = s.ProductGuid AND
t1.[FileName] = s.[FileName] AND
t1.FileProductName = s.FileProductName AND
t1.PadSettingChecksum = s.PadSettingChecksum
WHERE t1.SettingId IS NULL
PRINT 'DELETED: ' + CAST(@@ROWCOUNT as varchar)
-- Insert missing records.
INSERT INTO [dbo].[x360ce_Summaries] (ProductGuid, ProductName, [FileName], FileProductName, PadSettingChecksum, Users)
SELECT t3.ProductGuid, p.ProductName, t3.[FileName], t3.FileProductName, t3.PadSettingChecksum, 1 AS Users
FROM (
SELECT t2.ProductGuid, t2.[FileName], t2.FileProductName, t2.PadSettingChecksum
FROM (
SELECT t1.ProductGuid, t1.[FileName], t1.FileProductName, t1.PadSettingChecksum
FROM @inserted t1
LEFT JOIN [dbo].[x360ce_Summaries] s ON
t1.ProductGuid = s.ProductGuid AND
t1.[FileName] = s.[FileName] AND
t1.FileProductName = s.FileProductName AND
t1.PadSettingChecksum = s.PadSettingChecksum
WHERE s.SummaryId is null) t2
GROUP BY ProductGuid, [FileName], FileProductName, PadSettingChecksum
) t3
LEFT JOIN [dbo].[x360ce_Products] p ON
t3.ProductGuid = p.ProductGuid
PRINT 'INSERTED: ' + CAST(@@ROWCOUNT as varchar)
-- Update records
UPDATE t1 SET
t1.[Users] = t3.Users,
t1.DateUpdated = GETDATE()
FROM [dbo].[x360ce_Summaries] t1
INNER JOIN (
SELECT ProductGuid, [FileName], FileProductName, PadSettingChecksum, COUNT(*) AS Users FROM (
SELECT t1.ProductGuid, t1.[FileName], t1.FileProductName, t1.PadSettingChecksum FROM (
SELECT ProductGuid, [FileName], FileProductName, PadSettingChecksum FROM @inserted UNION
SELECT ProductGuid, [FileName], FileProductName, PadSettingChecksum FROM @deleted
) t1
INNER JOIN [dbo].[x360ce_Settings] s ON
t1.ProductGuid = s.ProductGuid AND
t1.[FileName] = s.[FileName] AND
t1.FileProductName = s.FileProductName AND
t1.PadSettingChecksum = s.PadSettingChecksum
) t2
GROUP BY ProductGuid, [FileName], FileProductName, PadSettingChecksum
) t3 ON
t1.ProductGuid = t3.ProductGuid AND
t1.[FileName] = t3.[FileName] AND
t1.FileProductName = t3.FileProductName AND
t1.PadSettingChecksum = t3.PadSettingChecksum
PRINT 'UPDATED: ' + CAST(@@ROWCOUNT as varchar)
END
|
-- Retourne les autorisations des utilisateurs
SELECT use.usename AS subject,
nsp.nspname AS namespace,
c.relname AS item,
c.relkind AS type,
use2.usename AS owner,
c.relacl,
(use2.usename != use.usename
AND c.relacl::text !~ ('({|,)' || use.usename || '=')) AS public
FROM pg_user use
CROSS JOIN pg_class c
LEFT JOIN pg_namespace nsp
ON (c.relnamespace = nsp.oid)
LEFT JOIN pg_user use2
ON (c.relowner = use2.usesysid)
WHERE c.relowner = use.usesysid
OR c.relacl::text ~ ('({|,)(|' || use.usename || ')=')
ORDER BY subject, namespace, item;
|
INSERT INTO e_resource (id,created_time,creator_id,modified_time,modifier_id,available,name,parent_id,permission,resource_type,url,cls,lable_key,sort_num,access_code,system_id) VALUES ('com_xx_demo_test_customer',NULL,NULL,NULL,NULL,1,'客户','demo',NULL,'MENU','demo-ui/demo/test/customer_index.html','menu-icon fa fa-caret-right','menu.demo.test.customer_manage',20,NULL,'demo');
INSERT INTO e_menu_i18n (id,key_,lang_,value_,system_code) VALUES ('menu.demo.test.customer_manage','menu.demo.test.customer_manage','','客户管理','demo');
INSERT INTO e_menu_i18n (id,key_,lang_,value_,system_code) VALUES ('menu.demo.test.customer_manage_zh_CN','menu.demo.test.customer_manage','zh_CN','客户管理','demo');
INSERT INTO e_menu_i18n (id,key_,lang_,value_,system_code) VALUES ('menu.demo.test.customer_manage_en_US','menu.demo.test.customer_manage','en_US','Customer MGT','demo');
INSERT INTO e_resource (id,created_time,creator_id,modified_time,modifier_id,available,name,parent_id,permission,resource_type,url,cls,lable_key,sort_num,access_code,system_id) VALUES ('com_xx_demo_test_customer_add',NULL,NULL,NULL,NULL,1,'新增','com_xx_demo_test_customer',NULL,'BUTTON','customer/save',NULL,'menu.add',NULL,'customer:save','demo');
INSERT INTO e_resource (id,created_time,creator_id,modified_time,modifier_id,available,name,parent_id,permission,resource_type,url,cls,lable_key,sort_num,access_code,system_id) VALUES ('com_xx_demo_test_customer_edit',NULL,NULL,NULL,NULL,1,'编辑','com_xx_demo_test_customer',NULL,'BUTTON','customer/update',NULL,'menu.edit',NULL,'customer:update','demo');
INSERT INTO e_resource (id,created_time,creator_id,modified_time,modifier_id,available,name,parent_id,permission,resource_type,url,cls,lable_key,sort_num,access_code,system_id) VALUES ('com_xx_demo_test_customer_delete',NULL,NULL,NULL,NULL,1,'删除','com_xx_demo_test_customer',NULL,'BUTTON','customer/delete',NULL,'menu.delete',NULL,'customer:delete','demo');
|
<reponame>mwernli/digilog-crawling<filename>flyway/flywaymigrations/V0.0008__user_table.sql
DROP TABLE IF EXISTS digilog.user;
CREATE TABLE IF NOT EXISTS digilog.user
(
id serial NOT NULL PRIMARY KEY,
username varchar NOT NULL,
email varchar NOT NULL,
pw_hash varchar NOT NULL,
UNIQUE (username),
UNIQUE (email)
);
|
INSERT INTO books
(title, author_id, isbn, year_pub)
VALUES('The Trial', '1', '0805210407', '1995'),
('The Metamorphosis', '1', '0553213695', '1995'),
('America', '1', '0805210644', '1995');
|
<gh_stars>0
-- main insert -- 16385 rows
INSERT INTO gnaf.localities(locality_pid, locality_name, postcode, state, latitude, longitude, locality_class, reliability, geom)
SELECT loc.locality_pid,
loc.locality_name,
loc.primary_postcode AS postcode,
st.state_abbreviation AS state,
avg(pnt.latitude) as latitude,
avg(pnt.longitude) as longitude,
aut.name AS locality_class,
loc.gnaf_reliability_code,
st_setsrid(st_makepoint(avg(pnt.longitude), avg(pnt.latitude)), 4283) AS geom
FROM raw_gnaf.locality AS loc
INNER JOIN raw_gnaf.state AS st ON loc.state_pid = st.state_pid
INNER JOIN raw_gnaf.locality_class_aut AS aut ON loc.locality_class_code = aut.code
LEFT OUTER JOIN raw_gnaf.locality_point AS pnt ON loc.locality_pid = pnt.locality_pid
GROUP BY loc.locality_pid,
loc.locality_name,
loc.primary_postcode,
st.state_abbreviation,
aut.name,
loc.gnaf_reliability_code
--HAVING count(*) > 1
ORDER BY st.state_abbreviation,
loc.locality_name,
loc.primary_postcode;
-- standardise locality names to check for uniqueness and for address validation purposes
UPDATE gnaf.localities SET std_locality_name = REPLACE(locality_name, '''','') WHERE POSITION('''' IN locality_name) > 0;
UPDATE gnaf.localities SET std_locality_name = REPLACE(locality_name, '-','') WHERE POSITION('-' IN locality_name) > 0;
UPDATE gnaf.localities SET std_locality_name = REPLACE(locality_name, '.','') WHERE POSITION('.' IN locality_name) > 0;
UPDATE gnaf.localities SET std_locality_name = REPLACE(locality_name, 'ST ','SAINT ') WHERE LEFT(locality_name, 3) = 'ST ';
UPDATE gnaf.localities SET std_locality_name = REPLACE(locality_name, ' ST ',' SAINT ') WHERE locality_name LIKE '% ST %';
UPDATE gnaf.localities SET std_locality_name = 'EAST ' || LEFT(locality_name, LENGTH(locality_name) - 5) WHERE RIGHT(locality_name, 5) = ' EAST';
UPDATE gnaf.localities SET std_locality_name = 'WEST ' || LEFT(locality_name, LENGTH(locality_name) - 5) WHERE RIGHT(locality_name, 5) = ' WEST';
UPDATE gnaf.localities SET std_locality_name = 'NORTH ' || LEFT(locality_name, LENGTH(locality_name) - 6) WHERE RIGHT(locality_name, 6) = ' NORTH';
UPDATE gnaf.localities SET std_locality_name = 'SOUTH ' || LEFT(locality_name, LENGTH(locality_name) - 6) WHERE RIGHT(locality_name, 6) = ' SOUTH';
UPDATE gnaf.localities SET std_locality_name = 'UPPER ' || LEFT(locality_name, LENGTH(locality_name) - 6) WHERE RIGHT(locality_name, 6) = ' UPPER';
UPDATE gnaf.localities SET std_locality_name = 'LOWER ' || LEFT(locality_name, LENGTH(locality_name) - 6) WHERE RIGHT(locality_name, 6) = ' LOWER';
UPDATE gnaf.localities SET std_locality_name = 'CENTRAL ' || LEFT(locality_name, LENGTH(locality_name) - 8) WHERE RIGHT(locality_name, 8) = ' CENTRAL';
UPDATE gnaf.localities SET std_locality_name = LEFT(locality_name, LENGTH(locality_name) - 5) WHERE RIGHT(locality_name, 5) = ' CITY' AND locality_name <> 'BRISBANE CITY';
-- update the leftovers to just their name
UPDATE gnaf.localities SET std_locality_name = locality_name WHERE std_locality_name = ''; -- 15213
-- set unique locality/state combination flag -- 15453 rows
UPDATE gnaf.localities AS loc
SET unique_locality_state = 'Y'
FROM (
SELECT Count(*) AS cnt
,std_locality_name
,state
FROM gnaf.localities
GROUP BY std_locality_name,
state
) AS sqt2
WHERE loc.std_locality_name = sqt2.std_locality_name
AND loc.state = sqt2.state
AND sqt2.cnt = 1;
|
-- Copyright [1999-2014] Wellcome Trust Sanger Institute and the EMBL-European Bioinformatics Institute
--
-- 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.
CREATE TABLE session (
session_id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
db_release INT(10) NOT NULL,
host VARCHAR(255),
config TEXT,
PRIMARY KEY (session_id)
);
CREATE TABLE report (
report_id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
first_session_id INT(10) UNSIGNED NOT NULL,
last_session_id INT(10) UNSIGNED NOT NULL,
database_name VARCHAR(255),
species VARCHAR(255),
database_type VARCHAR(255),
timestamp DATETIME,
testcase VARCHAR(255),
result ENUM("PROBLEM", "CORRECT", "WARNING", "INFO"),
text TEXT,
team_responsible VARCHAR(255),
created DATETIME,
PRIMARY KEY (report_id),
KEY first_session_idx(first_session_id),
KEY last_session_idx(last_session_id),
KEY testcase_idx(testcase),
KEY database_name_idx(database_name),
KEY species_idx(species),
KEY result_idx(result),
KEY text_idx(text(255))
);
CREATE TABLE annotation (
annotation_id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
report_id INT(10) UNSIGNED NOT NULL,
person VARCHAR(255),
action ENUM("manual_ok", "under_review", "note", "healthcheck_bug", "manual_ok_all_releases", "manual_ok_this_assembly", "manual_ok_this_genebuild"),
comment VARCHAR(255),
created_at TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00',
modified_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
created_by VARCHAR(255),
modified_by VARCHAR(255),
PRIMARY KEY (annotation_id),
KEY action_idx (action),
KEY report_idx (report_id)
);
CREATE VIEW recent_session AS
SELECT s.*,
MIN(r.timestamp) AS start_time,
MAX(r.timestamp) AS end_time,
TIMEDIFF(MAX(r.timestamp), MIN(r.timestamp)) AS duration
FROM session s, report r
WHERE s.session_id=(SELECT MAX(session_id) FROM session)
AND r.last_session_id=s.session_id
AND r.text LIKE '#%'
GROUP BY r.last_session_id;
CREATE VIEW session_v AS
SELECT s.*,
MIN(r.timestamp) AS start_time,
MAX(r.timestamp) AS end_time,
TIMEDIFF(MAX(r.timestamp), MIN(r.timestamp)) AS duration
FROM session s, report r
WHERE s.session_id=r.last_session_id
AND r.text LIKE '#%'
GROUP BY r.last_session_id;
CREATE VIEW session_v2 AS
SELECT s.session_id,
MAX(r.timestamp) AS end_time
FROM session s, report r
WHERE s.session_id=r.last_session_id
AND r.text LIKE '#%'
GROUP BY r.last_session_id;
CREATE VIEW timings AS
SELECT last_session_id, database_name, species, database_type, testcase,
MIN(timestamp) AS start_time,
MAX(timestamp) AS end_time,
TIMEDIFF(MAX(timestamp), MIN(timestamp)) AS duration
FROM report
WHERE text LIKE '#%'
GROUP BY last_session_id, database_name, testcase;
|
/*
Navicat Premium Data Transfer
Source Server : 本机mysql
Source Server Type : MySQL
Source Server Version : 50724
Source Host : localhost:3306
Source Schema : pigxx_zipkin
Target Server Type : MySQL
Target Server Version : 50724
File Encoding : 65001
Date: 22/02/2019 11:44:20
*/
USE pigxx_zipkin;
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for zipkin_annotations
-- ----------------------------
DROP TABLE IF EXISTS `zipkin_annotations`;
CREATE TABLE `zipkin_annotations` (
`trace_id_high` bigint(20) NOT NULL DEFAULT 0 COMMENT 'If non zero, this means the trace uses 128 bit traceIds instead of 64 bit',
`trace_id` bigint(20) NOT NULL COMMENT 'coincides with zipkin_spans.trace_id',
`span_id` bigint(20) NOT NULL COMMENT 'coincides with zipkin_spans.id',
`a_key` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT 'BinaryAnnotation.key or Annotation.value if type == -1',
`a_value` blob NULL COMMENT 'BinaryAnnotation.value(), which must be smaller than 64KB',
`a_type` int(11) NOT NULL COMMENT 'BinaryAnnotation.type() or -1 if Annotation',
`a_timestamp` bigint(20) NULL DEFAULT NULL COMMENT 'Used to implement TTL; Annotation.timestamp or zipkin_spans.timestamp',
`endpoint_ipv4` int(11) NULL DEFAULT NULL COMMENT 'Null when Binary/Annotation.endpoint is null',
`endpoint_ipv6` binary(16) NULL DEFAULT NULL COMMENT 'Null when Binary/Annotation.endpoint is null, or no IPv6 address',
`endpoint_port` smallint(6) NULL DEFAULT NULL COMMENT 'Null when Binary/Annotation.endpoint is null',
`endpoint_service_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT 'Null when Binary/Annotation.endpoint is null',
UNIQUE INDEX `trace_id_high`(`trace_id_high`, `trace_id`, `span_id`, `a_key`, `a_timestamp`) USING BTREE COMMENT 'Ignore insert on duplicate',
INDEX `trace_id_high_2`(`trace_id_high`, `trace_id`, `span_id`) USING BTREE COMMENT 'for joining with zipkin_spans',
INDEX `trace_id_high_3`(`trace_id_high`, `trace_id`) USING BTREE COMMENT 'for getTraces/ByIds',
INDEX `endpoint_service_name`(`endpoint_service_name`) USING BTREE COMMENT 'for getTraces and getServiceNames',
INDEX `a_type`(`a_type`) USING BTREE COMMENT 'for getTraces',
INDEX `a_key`(`a_key`) USING BTREE COMMENT 'for getTraces',
INDEX `trace_id`(`trace_id`, `span_id`, `a_key`) USING BTREE COMMENT 'for dependencies job'
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compressed;
-- ----------------------------
-- Table structure for zipkin_dependencies
-- ----------------------------
DROP TABLE IF EXISTS `zipkin_dependencies`;
CREATE TABLE `zipkin_dependencies` (
`day` date NOT NULL,
`parent` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
`child` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
`call_count` bigint(20) NULL DEFAULT NULL,
`error_count` bigint(20) NULL DEFAULT NULL,
UNIQUE INDEX `day`(`day`, `parent`, `child`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compressed;
-- ----------------------------
-- Table structure for zipkin_spans
-- ----------------------------
DROP TABLE IF EXISTS `zipkin_spans`;
CREATE TABLE `zipkin_spans` (
`trace_id_high` bigint(20) NOT NULL DEFAULT 0 COMMENT 'If non zero, this means the trace uses 128 bit traceIds instead of 64 bit',
`trace_id` bigint(20) NOT NULL,
`id` bigint(20) NOT NULL,
`name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
`parent_id` bigint(20) NULL DEFAULT NULL,
`debug` bit(1) NULL DEFAULT NULL,
`start_ts` bigint(20) NULL DEFAULT NULL COMMENT 'Span.timestamp(): epoch micros used for endTs query and to implement TTL',
`duration` bigint(20) NULL DEFAULT NULL COMMENT 'Span.duration(): micros used for minDuration and maxDuration query',
UNIQUE INDEX `trace_id_high`(`trace_id_high`, `trace_id`, `id`) USING BTREE COMMENT 'ignore insert on duplicate',
INDEX `trace_id_high_2`(`trace_id_high`, `trace_id`, `id`) USING BTREE COMMENT 'for joining with zipkin_annotations',
INDEX `trace_id_high_3`(`trace_id_high`, `trace_id`) USING BTREE COMMENT 'for getTracesByIds',
INDEX `name`(`name`) USING BTREE COMMENT 'for getTraces and getSpanNames',
INDEX `start_ts`(`start_ts`) USING BTREE COMMENT 'for getTraces ordering and range'
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compressed;
SET FOREIGN_KEY_CHECKS = 1;
|
DELETE FROM transference;
DELETE FROM debit;
DELETE FROM credit;
DELETE FROM account;
DELETE FROM customer;
|
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [incodeCommChannel].[CommunicationChannel](
[id] [bigint] IDENTITY(1,1) NOT NULL,
[notes] [text] NULL,
[purpose] [varchar](30) NOT NULL,
[type] [varchar](30) NOT NULL,
[version] [bigint] NOT NULL,
[discriminator] [varchar](255) NOT NULL,
[phoneNumber] [varchar](20) NULL,
[emailAddress] [varchar](254) NULL,
[addressComponents] [text] NULL,
[addressLine1] [varchar](50) NULL,
[addressLine2] [varchar](50) NULL,
[addressLine3] [varchar](50) NULL,
[addressLine4] [varchar](50) NULL,
[country] [varchar](50) NULL,
[formattedAddress] [varchar](254) NULL,
[geocodeApiResponseAsJson] [text] NULL,
[latLng] [varchar](255) NULL,
[placeId] [varchar](255) NULL,
[postalCode] [varchar](12) NULL,
CONSTRAINT [CommunicationChannel_PK] PRIMARY KEY CLUSTERED
(
[id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [EmailAddress_emailAddress_IDX] ON [incodeCommChannel].[CommunicationChannel]
(
[emailAddress] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [PhoneNumber_phoneNumber_IDX] ON [incodeCommChannel].[CommunicationChannel]
(
[phoneNumber] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [PostalAddress_formattedAddress_idx] ON [incodeCommChannel].[CommunicationChannel]
(
[formattedAddress] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [PostalAddress_unq_idx] ON [incodeCommChannel].[CommunicationChannel]
(
[placeId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
CREATE TABLE [incodeCommChannel].[CommunicationChannelOwnerLink](
[id] [bigint] IDENTITY(1,1) NOT NULL,
[communicationChannelId] [bigint] NOT NULL,
[communicationChannelType] [varchar](30) NOT NULL,
[ownerStr] [varchar](2000) NOT NULL,
CONSTRAINT [CommunicationChannelOwnerLink_PK] PRIMARY KEY CLUSTERED
(
[id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY],
CONSTRAINT [CommunicationChannelOwnerLink_commchannel_UNQ] UNIQUE NONCLUSTERED
(
[communicationChannelId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [CommunicationChannelOwnerLink_main_idx] ON [incodeCommChannel].[CommunicationChannelOwnerLink]
(
[ownerStr] ASC,
[communicationChannelType] ASC,
[communicationChannelId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
ALTER TABLE [incodeCommChannel].[CommunicationChannelOwnerLink] WITH CHECK ADD CONSTRAINT [CommunicationChannelOwnerLink_FK1] FOREIGN KEY([communicationChannelId])
REFERENCES [incodeCommChannel].[CommunicationChannel] ([id])
GO
ALTER TABLE [incodeCommChannel].[CommunicationChannelOwnerLink] CHECK CONSTRAINT [CommunicationChannelOwnerLink_FK1]
GO
|
CREATE INDEX "IX_CFK_LOCALITY" ON "TAB_MEDIA_REL_FKEY" ("CFK_LOCALITY")
|
<filename>database/migration_spellitemsubclass.sql
SET @CPT=0;
INSERT INTO jangosworld.spellitemsubclass (fk_spell, fk_itemclass, fk_itemsubclass)
SELECT
id as fk_spell,
equippedItemClass as fk_itemclass,
NULL as fk_itemsubclass
FROM dbc.dbc0_spell
WHERE equippedItemClass <> 0 AND equippedItemSubClass = 0;
SET @CPT=1;
INSERT INTO jangosworld.spellitemsubclass (fk_spell, fk_itemclass, fk_itemsubclass)
SELECT
id as fk_spell,
equippedItemClass as fk_itemclass,
(@CPT-1) as fk_itemsubclass
FROM dbc.dbc0_spell
WHERE equippedItemClass <> 0 AND (equippedItemSubClass >> (@CPT-1) & b'1') = 1;
SET @CPT=2;
INSERT INTO jangosworld.spellitemsubclass (fk_spell, fk_itemclass, fk_itemsubclass)
SELECT
id as fk_spell,
equippedItemClass as fk_itemclass,
(@CPT-1) as fk_itemsubclass
FROM dbc.dbc0_spell
WHERE equippedItemClass <> 0 AND (equippedItemSubClass >> (@CPT-1) & b'1') = 1;
SET @CPT=3;
INSERT INTO jangosworld.spellitemsubclass (fk_spell, fk_itemclass, fk_itemsubclass)
SELECT
id as fk_spell,
equippedItemClass as fk_itemclass,
(@CPT-1) as fk_itemsubclass
FROM dbc.dbc0_spell
WHERE equippedItemClass <> 0 AND (equippedItemSubClass >> (@CPT-1) & b'1') = 1;
SET @CPT=4;
INSERT INTO jangosworld.spellitemsubclass (fk_spell, fk_itemclass, fk_itemsubclass)
SELECT
id as fk_spell,
equippedItemClass as fk_itemclass,
(@CPT-1) as fk_itemsubclass
FROM dbc.dbc0_spell
WHERE equippedItemClass <> 0 AND (equippedItemSubClass >> (@CPT-1) & b'1') = 1;
SET @CPT=5;
INSERT INTO jangosworld.spellitemsubclass (fk_spell, fk_itemclass, fk_itemsubclass)
SELECT
id as fk_spell,
equippedItemClass as fk_itemclass,
(@CPT-1) as fk_itemsubclass
FROM dbc.dbc0_spell
WHERE equippedItemClass <> 0 AND (equippedItemSubClass >> (@CPT-1) & b'1') = 1;
SET @CPT=6;
INSERT INTO jangosworld.spellitemsubclass (fk_spell, fk_itemclass, fk_itemsubclass)
SELECT
id as fk_spell,
equippedItemClass as fk_itemclass,
(@CPT-1) as fk_itemsubclass
FROM dbc.dbc0_spell
WHERE equippedItemClass <> 0 AND (equippedItemSubClass >> (@CPT-1) & b'1') = 1;
SET @CPT=7;
INSERT INTO jangosworld.spellitemsubclass (fk_spell, fk_itemclass, fk_itemsubclass)
SELECT
id as fk_spell,
equippedItemClass as fk_itemclass,
(@CPT-1) as fk_itemsubclass
FROM dbc.dbc0_spell
WHERE equippedItemClass <> 0 AND (equippedItemSubClass >> (@CPT-1) & b'1') = 1;
SET @CPT=8;
INSERT INTO jangosworld.spellitemsubclass (fk_spell, fk_itemclass, fk_itemsubclass)
SELECT
id as fk_spell,
equippedItemClass as fk_itemclass,
(@CPT-1) as fk_itemsubclass
FROM dbc.dbc0_spell
WHERE equippedItemClass <> 0 AND (equippedItemSubClass >> (@CPT-1) & b'1') = 1;
SET @CPT=9;
INSERT INTO jangosworld.spellitemsubclass (fk_spell, fk_itemclass, fk_itemsubclass)
SELECT
id as fk_spell,
equippedItemClass as fk_itemclass,
(@CPT-1) as fk_itemsubclass
FROM dbc.dbc0_spell
WHERE equippedItemClass <> 0 AND (equippedItemSubClass >> (@CPT-1) & b'1') = 1;
SET @CPT=10;
INSERT INTO jangosworld.spellitemsubclass (fk_spell, fk_itemclass, fk_itemsubclass)
SELECT
id as fk_spell,
equippedItemClass as fk_itemclass,
(@CPT-1) as fk_itemsubclass
FROM dbc.dbc0_spell
WHERE equippedItemClass <> 0 AND (equippedItemSubClass >> (@CPT-1) & b'1') = 1;
SET @CPT=11;
INSERT INTO jangosworld.spellitemsubclass (fk_spell, fk_itemclass, fk_itemsubclass)
SELECT
id as fk_spell,
equippedItemClass as fk_itemclass,
(@CPT-1) as fk_itemsubclass
FROM dbc.dbc0_spell
WHERE equippedItemClass <> 0 AND (equippedItemSubClass >> (@CPT-1) & b'1') = 1;
SET @CPT=12;
INSERT INTO jangosworld.spellitemsubclass (fk_spell, fk_itemclass, fk_itemsubclass)
SELECT
id as fk_spell,
equippedItemClass as fk_itemclass,
(@CPT-1) as fk_itemsubclass
FROM dbc.dbc0_spell
WHERE equippedItemClass <> 0 AND (equippedItemSubClass >> (@CPT-1) & b'1') = 1;
SET @CPT=13;
INSERT INTO jangosworld.spellitemsubclass (fk_spell, fk_itemclass, fk_itemsubclass)
SELECT
id as fk_spell,
equippedItemClass as fk_itemclass,
(@CPT-1) as fk_itemsubclass
FROM dbc.dbc0_spell
WHERE equippedItemClass <> 0 AND (equippedItemSubClass >> (@CPT-1) & b'1') = 1;
SET @CPT=13;
INSERT INTO jangosworld.spellitemsubclass (fk_spell, fk_itemclass, fk_itemsubclass)
SELECT
id as fk_spell,
equippedItemClass as fk_itemclass,
(@CPT-1) as fk_itemsubclass
FROM dbc.dbc0_spell
WHERE equippedItemClass <> 0 AND (equippedItemSubClass >> (@CPT-1) & b'1') = 1;
SET @CPT=14;
INSERT INTO jangosworld.spellitemsubclass (fk_spell, fk_itemclass, fk_itemsubclass)
SELECT
id as fk_spell,
equippedItemClass as fk_itemclass,
(@CPT-1) as fk_itemsubclass
FROM dbc.dbc0_spell
WHERE equippedItemClass <> 0 AND (equippedItemSubClass >> (@CPT-1) & b'1') = 1;
SET @CPT=15;
INSERT INTO jangosworld.spellitemsubclass (fk_spell, fk_itemclass, fk_itemsubclass)
SELECT
id as fk_spell,
equippedItemClass as fk_itemclass,
(@CPT-1) as fk_itemsubclass
FROM dbc.dbc0_spell
WHERE equippedItemClass <> 0 AND (equippedItemSubClass >> (@CPT-1) & b'1') = 1;
SET @CPT=16;
INSERT INTO jangosworld.spellitemsubclass (fk_spell, fk_itemclass, fk_itemsubclass)
SELECT
id as fk_spell,
equippedItemClass as fk_itemclass,
(@CPT-1) as fk_itemsubclass
FROM dbc.dbc0_spell
WHERE equippedItemClass <> 0 AND (equippedItemSubClass >> (@CPT-1) & b'1') = 1;
SET @CPT=17;
INSERT INTO jangosworld.spellitemsubclass (fk_spell, fk_itemclass, fk_itemsubclass)
SELECT
id as fk_spell,
equippedItemClass as fk_itemclass,
(@CPT-1) as fk_itemsubclass
FROM dbc.dbc0_spell
WHERE equippedItemClass <> 0 AND (equippedItemSubClass >> (@CPT-1) & b'1') = 1;
SET @CPT=18;
INSERT INTO jangosworld.spellitemsubclass (fk_spell, fk_itemclass, fk_itemsubclass)
SELECT
id as fk_spell,
equippedItemClass as fk_itemclass,
(@CPT-1) as fk_itemsubclass
FROM dbc.dbc0_spell
WHERE equippedItemClass <> 0 AND (equippedItemSubClass >> (@CPT-1) & b'1') = 1;
SET @CPT=19;
INSERT INTO jangosworld.spellitemsubclass (fk_spell, fk_itemclass, fk_itemsubclass)
SELECT
id as fk_spell,
equippedItemClass as fk_itemclass,
(@CPT-1) as fk_itemsubclass
FROM dbc.dbc0_spell
WHERE equippedItemClass <> 0 AND (equippedItemSubClass >> (@CPT-1) & b'1') = 1;
SET @CPT=20;
INSERT INTO jangosworld.spellitemsubclass (fk_spell, fk_itemclass, fk_itemsubclass)
SELECT
id as fk_spell,
equippedItemClass as fk_itemclass,
(@CPT-1) as fk_itemsubclass
FROM dbc.dbc0_spell
WHERE equippedItemClass <> 0 AND (equippedItemSubClass >> (@CPT-1) & b'1') = 1;
SET @CPT=21;
INSERT INTO jangosworld.spellitemsubclass (fk_spell, fk_itemclass, fk_itemsubclass)
SELECT
id as fk_spell,
equippedItemClass as fk_itemclass,
(@CPT-1) as fk_itemsubclass
FROM dbc.dbc0_spell
WHERE equippedItemClass <> 0 AND (equippedItemSubClass >> (@CPT-1) & b'1') = 1;
|
<reponame>tonic889/mifosx<gh_stars>100-1000
INSERT INTO `c_configuration` (`id`, `name`,`value`, `enabled`, `description`)
VALUES (NULL, 'min-clients-in-group', '5', '0',"Minimum number of Clients that a Group should have");
INSERT INTO `c_configuration` (`id`, `name`, `value`, `enabled`, `description`)
VALUES (NULL, 'max-clients-in-group', '5', '0', "Maximum number of Clients that a Group can have");
ALTER TABLE `m_group_level`
DROP COLUMN `min_clients`,
DROP COLUMN `max_clients`;
|
<gh_stars>10-100
--Get the number of events without a session and the ones with a session by eventDate.
--At least some events should come from the client and have a sessionID set.
SELECT eventDate,
count(*)-count(sessionId) AS 'sessionless events',
count(sessionID) AS 'session events',
round((count(*)-count(sessionId))/count(*) * 100,2.0) AS 'percentage'
FROM EVENTS
GROUP BY eventDate
ORDER BY eventDate DESC
|
<reponame>arshinalbab/mlp
UPDATE applications
SET config = '{
"sections": [
{
"name": "Routers",
"href": "/routers"
},
{
"name": "Ensemblers",
"href": "/ensemblers"
},
{
"name": "Ensembling Jobs",
"href": "/jobs"
},
{
"name": "Experiments",
"href": "/experiments"
}
]
}' WHERE name = 'Turing';
|
ALTER TABLE "selfservice_verification_flows" ADD COLUMN "via" TEXT NOT NULL DEFAULT 'email'
|
<filename>Aggregate_Stored_Procedures/KilkariThematicContentCurrentFinancialYear.sql
CREATE DEFINER=`etluser`@`%` PROCEDURE `KilkariThematicContentCurrentFinancialYear`()
BEGIN
DECLARE dt DATETIME;
DECLARE i INT;
DECLARE currdate DATETIME;
SET dt = (select cast(last_etl_time as datetime) from ETL_info_table where table_id = 131);
set currdate = (select concat(year(CURDATE()), '-', month(CURDATE()), '-', '01 00:00:00'));
SET i = 1;
WHILE i< 2 DO
SET i=i+1;
DELETE from agg_kilkari_thematic_content where period_type = 'CURRENT FINANCIAL YEAR';
TRUNCATE TABLE agg_kilkari_thematic_content_financial_year_temp;
insert into agg_kilkari_thematic_content_financial_year_temp(state_id, district_id, healthBlock_id, date,message_week_number,unique_beneficiaries_called, calls_answered, minutes_consumed)
select
bt.state_id, bt.district_id, bt.healthBlock_id,
dt as date,
substring_index(bm.contentFile,'_',1) as weekId,
COUNT(DISTINCT bm.beneficiaryTracking_id) as unique_beneficiaries_called,
COUNT(case when bm.call_status = 'SUCCESS' then bm.id end) as calls_answered,
ROUND(SUM(case when bm.call_status = 'SUCCESS' then bm.msg_duration end)/60,2) as minutes_consumed FROM beneficiary_call_measure bm LEFT JOIN beneficiary_tracker bt on bt.id = bm.beneficiaryTracking_id LEFT JOIN dim_theme th on th.message_id = substring_index(bm.contentFile, '.',1)
where bm.modificationDate >= dt and bm.modificationDate < currdate and bm.call_source = 'OBD' group by substring_index(bm.contentFile, '_',1), bt.state_id, bt.district_id, bt.healthBlock_id;
insert into agg_kilkari_thematic_content(location_type, location_id, date, message_week_number,unique_beneficiaries_called, calls_answered, minutes_consumed,period_type)
select 'NATIONAL' as location_type, 0, date,message_week_number, sum(unique_beneficiaries_called), sum(calls_answered), sum(minutes_consumed),'CURRENT FINANCIAL YEAR' as period_type from agg_kilkari_thematic_content_financial_year_temp group by message_week_number
UNION ALL
select 'STATE' as location_type, state_id, date,message_week_number, sum(unique_beneficiaries_called), sum(calls_answered), sum(minutes_consumed),'CURRENT FINANCIAL YEAR' as period_type from agg_kilkari_thematic_content_financial_year_temp group by state_id, message_week_number
UNION ALL
select 'DISTRICT' as location_type, district_id, date,message_week_number, sum(unique_beneficiaries_called), sum(calls_answered), sum(minutes_consumed),'CURRENT FINANCIAL YEAR' as period_type from agg_kilkari_thematic_content_financial_year_temp group by district_id, message_week_number
UNION ALL
select 'BLOCK' as location_type, healthBlock_id, date,message_week_number, sum(unique_beneficiaries_called), sum(calls_answered), sum(minutes_consumed),'CURRENT FINANCIAL YEAR' as period_type from agg_kilkari_thematic_content_financial_year_temp group by healthBlock_id, message_week_number;
update ETL_info_table set last_etl_time = currdate where table_id = 128;
END WHILE;
END
|
USE [$(database)]
GO
-------------------------------------------------------------------------------
PRINT 'Debut VUES'
GO
-------------------------------------------------------------------------------
/****** Object: Index [CIDX_DimDate_PartnerCK] Script Date: 01/06/2020 20:28:19 ******/
DROP INDEX IF EXISTS [CIDX_DimDate_PartnerCK] ON [dim].[VwDimDate] WITH ( ONLINE = OFF )
GO
/****** Object: View [dim].[VwDimDate] Script Date: 01/06/2020 20:28:19 ******/
DROP VIEW IF EXISTS [dim].[VwDimDate]
GO
/****** Object: View [dim].[VwDimDate] Script Date: 01/06/2020 20:28:19 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
--DROP VIEW dim.VwDimDate
/****** Object: Index [PK__DimDate__40DF45E3B5664BC6] Script Date: 01/06/2020 19:59:22 ******/
--ALTER TABLE [dim].[DimDate] DROP CONSTRAINT [PK__DimDate__40DF45E3B5664BC6] WITH ( ONLINE = OFF )
CREATE VIEW [dim].[VwDimDate]
WITH SCHEMABINDING
AS
SELECT
[DateKey]
,[Date]
,[FullDateUK]
,[FullDateUSA]
,[DayOfMonth]
,[DaySuffix]
,[DayName]
,[DayOfWeekUSA]
,[DayOfWeekUK]
,[DayOfWeekInMonth]
,[DayOfWeekInYear]
,[DayOfQuarter]
,[DayOfYear]
,[WeekOfMonth]
,[WeekOfQuarter]
,[WeekOfYear]
,[Month]
,[MonthName]
,[MonthOfQuarter]
,[Quarter]
,[QuarterName]
,[Year]
,[YearName]
,[MonthYear]
,[MMYYYY]
,[FirstDayOfMonth]
,[LastDayOfMonth]
,[FirstDayOfQuarter]
,[LastDayOfQuarter]
,[FirstDayOfYear]
,[LastDayOfYear]
,[IsHolidayUSA]
,[IsWeekday]
,[HolidayUSA]
,[IsHolidayUK]
,[HolidayUK]
,[FiscalDayOfYear]
,[FiscalWeekOfYear]
,[FiscalMonth]
,[FiscalQuarter]
,[FiscalQuarterName]
,[FiscalYear]
,[FiscalYearName]
,[FiscalMonthYear]
,[FiscalMMYYYY]
,[FiscalFirstDayOfMonth]
,[FiscalLastDayOfMonth]
,[FiscalFirstDayOfQuarter]
,[FiscalLastDayOfQuarter]
,[FiscalFirstDayOfYear]
,[FiscalLastDayOfYear]
FROM [dim].[Date]
GO
SET ARITHABORT ON
SET CONCAT_NULL_YIELDS_NULL ON
SET QUOTED_IDENTIFIER ON
SET ANSI_NULLS ON
SET ANSI_PADDING ON
SET ANSI_WARNINGS ON
SET NUMERIC_ROUNDABORT OFF
GO
/****** Object: Index [CIDX_DimDate_PartnerCK] Script Date: 01/06/2020 20:28:19 ******/
CREATE UNIQUE CLUSTERED INDEX [CIDX_DimDate_PartnerCK] ON [dim].[VwDimDate]
(
[DateKey] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object: View [vw].[SHA1Columns] Script Date: 08/07/2020 18:38:13 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object: View [vw].[SHA1Columns] Script Date: 10/07/2020 17:56:57 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [vw].[SHA1Columns]
AS
SELECT STRING_AGG(COLUMN_NAME,',') AS COLUMN_NAME ,TABLE_SCHEMA, TABLE_NAME
FROM INFORMATION_SCHEMA.COLUMNS S
WHERE S.COLUMN_NAME NOT IN ('UniqueKey','ID','UniqueRow')
GROUP BY TABLE_SCHEMA, TABLE_NAME;
GO
-------------------------------------------------------------------------------
PRINT 'Fin VUES'
GO
-------------------------------------------------------------------------------
|
<gh_stars>0
-- XII)
-- Contrainte : requêtes équivalentes sans null, mais différentes avec
-- Séléctionne les comptes ayant fait une commande mais n'ayant pas de panier,
-- mais ne marche pas à cause des null
-- Remarque :
SELECT DISTINCT c.id_compte
FROM commandes c
WHERE c.id_compte NOT IN (
SELECT p.id_compte FROM panier p);
|
create table Image(
Id int identity(1,1) Primary key,
ImageUrl nvarchar(400),
ProductId int FOREIGN KEY REFERENCES Product(ProductId)
)
GO
insert into Image(ImageUrl, ProductId) values
('/images/iphone8.jpg','2'),
('/images/iphonex.jpg','1'),
('/images/samsung-phone.jpg','3'),
('/images/htc.jpg','4'),
('/images/ipad.jpg','5'),
('/images/samsung-tablet.jpg','6'),
('/images/iphone-protector.jpg','7'),
('/images/headphone.jpg','8'),
('/images/samsung-watch.jpg','12')
|
DROP PROCEDURE IF EXISTS simple_loop
$$
CREATE PROCEDURE simple_loop()
DETERMINISTIC
BEGIN
DECLARE counter INT DEFAULT 0;
simple_loop: LOOP
SET counter=counter+1;
IF counter=10 THEN
LEAVE simple_loop;
END IF;
END LOOP simple_loop;
SELECT 'I can count to 10';
END;
$$
|
<reponame>sogis-oereb/oereb-gretljobs
DELETE FROM
arp_nutzungsplanung_kanton_oerebv2.transferstruktur_geometrie
;
DELETE FROM
arp_nutzungsplanung_kanton_oerebv2.transferstruktur_hinweisvorschrift
;
DELETE FROM
arp_nutzungsplanung_kanton_oerebv2.localiseduri
;
DELETE FROM
arp_nutzungsplanung_kanton_oerebv2.multilingualuri
;
DELETE FROM
arp_nutzungsplanung_kanton_oerebv2.dokumente_dokument
;
DELETE FROM
arp_nutzungsplanung_kanton_oerebv2.transferstruktur_eigentumsbeschraenkung
;
DELETE FROM
arp_nutzungsplanung_kanton_oerebv2.transferstruktur_legendeeintrag
;
DELETE FROM
arp_nutzungsplanung_kanton_oerebv2.transferstruktur_darstellungsdienst
;
|
<filename>data/Dump20201223.sql
UPDATE tbl_baiviet SET Soluotxem = 102 WHERE (Idbaiviet = 11);
drop procedure if exists Sp_capnhatluotxem;
delimiter //
create procedure Sp_capnhatluotxem(in id int)
begin
update tbl_baiviet set Soluotxem = (Soluotxem + 1) where Idbaiviet = id;
end //
delimiter ;
call Sp_capnhatluotxem(11);
ALTER TABLE tbl_baiviet
DROP FOREIGN KEY fk_Tentaikhoan_Baiviet;
ALTER TABLE tbl_baiviet
CHANGE COLUMN Soluotxem Soluotxem INT NULL DEFAULT 0 ,
CHANGE COLUMN Tieudebaiviet Tieudebaiviet TEXT NOT NULL ,
CHANGE COLUMN Tentaikhoan Tentaikhoan VARCHAR(255) NOT NULL ;
ALTER TABLE tbl_baiviet
ADD CONSTRAINT fk_Tentaikhoan_Baiviet
FOREIGN KEY (Tentaikhoan)
REFERENCES tbl_taikhoan (Tentaikhoan);
drop procedure if exists Sp_Themhashtag;
delimiter //
CREATE PROCEDURE Sp_Themhashtag(in newidbv int, in tenhtg varchar(255),in tag varchar(255))
begin
declare idt int;
declare idbv int;
if newidbv = 0 then
select max(Idbaiviet) from tbl_baiviet into idbv;
else
set idbv = newidbv;
end if;
if exists(select Tentag from tbl_hashtag where Tentag=tag) then
select Idtag from tbl_hashtag where Tentag=tag into idt;
insert into tbl_tagbaiviet (Idtag,Idbaiviet) values (idt,idbv);
else
insert into tbl_hashtag(Tentag,tenhashtag) values (tag,tenhtg);
select max(Idtag) from tbl_hashtag into idt ;
insert into tbl_tagbaiviet (Idtag,Idbaiviet) values (idt,idbv);
end if;
end //
delimiter ;
|
<reponame>RollingSoftware/L2J_HighFive_Hardcore
alter table `fort` add `blood` int(3) NOT NULL DEFAULT 0 after `castleId`;
|
use Northwind
GO
DROP database ToDo
GO
CREATE database ToDo
GO
use ToDo
GO
CREATE TABLE Categories
(
[CategoryID] INT NOT NULL IDENTITY PRIMARY KEY,
[CategoryName] NVARCHAR(50) NULL,
);
GO
CREATE TABLE Users
(
[UserID] INT NOT NULL IDENTITY PRIMARY KEY,
[UserName] NVARCHAR(50) NULL,
);
GO
CREATE TABLE Tasks
(
[TaskId] INT NOT NULL IDENTITY PRIMARY KEY,
[TaskDescription] NVARCHAR(50) NULL,
[Done] bit NULL,
[DateStarted] DATE NOT NULL,
[DateFinished] DATE NULL,
[CategoryID] INT NULL FOREIGN KEY REFERENCES Categories(CategoryID),
[UserID] INT NULL FOREIGN KEY REFERENCES Users(UserID),
);
INSERT INTO Categories (CategoryName) VALUES ('Home');
INSERT INTO Categories (CategoryName) VALUES ('Work');
INSERT INTO Categories (CategoryName) VALUES ('Leisure');
INSERT INTO Categories (CategoryName) VALUES ('Hobbies');
INSERT INTO Users (UserName) VALUES ('Alex');
INSERT INTO Users (UserName) VALUES ('Bob');
INSERT INTO Users (UserName) VALUES ('Henry');
INSERT INTO Tasks (TaskDescription, Done, DateStarted, DateFinished, CategoryID, UserID) VALUES ('ForWork', 'true', GETDATE(), GETDATE(), 2, 1);
INSERT INTO Tasks (TaskDescription, Done, DateStarted, DateFinished, CategoryID, UserID) VALUES ('ForHome', 'False', GETDATE(), GETDATE(), 1, 2);
INSERT INTO Tasks (TaskDescription, Done, DateStarted, DateFinished, CategoryID, UserID) VALUES ('ForWork', 'True', dateadd(d,-1,getdate()), GETDATE(), 2, 3);
|
<filename>db/schema.sql<gh_stars>1-10
-- Drops the db if it exists currently --
DROP DATABASE IF EXISTS pets_db;
-- Creates the database --
CREATE DATABASE pets_db;
|
<reponame>empiricaldataman/TestRepo
/*-----------------------------------------------------------------------------------------------
NAME: FindWhatIsBlocking.sql
MODIFIED BY: <NAME>
EMAIL: <EMAIL>
DESCRIPTION:
-------------------------------------------------------------------------------------------------
DATE MODIFIED DESCRIPTION
-------------------------------------------------------------------------------------------------
02.12.2012 SYoung Initial creation.
-------------------------------------------------------------------------------------------------
DISCLAIMER: The AUTHOR ASSUMES NO RESPONSIBILITY FOR ANYTHING, including the destruction of
personal property, creating singularities, making deep fried chicken, causing your
toilet to explode, making your animals spin around like mad, causing hair loss,
killing your buzz or ANYTHING else that can be thought up.
-----------------------------------------------------------------------------------------------*/
:CONNECT <server_name, sysname, SQL_Server_Instance>
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED
SELECT B.session_id [BlockingSessionID]
, S.login_name [BlockingUser]
, BSQL.[text] [BlockingSQL]
, W.wait_type [WhyBlocked]
, BL.session_id [BlockedSessionID]
, USER_NAME(BL.[user_id]) [BlockedUSer]
, BLSQL.[text] [BlockedSQL]
, DB_NAME(BL.database_id) [DatabaseName]
FROM sys.dm_exec_connections B
INNER JOIN sys.dm_exec_requests BL ON B.session_id = BL.blocking_session_ID
INNER JOIN sys.dm_os_waiting_tasks W ON BL.session_id = W.session_ID
RIGHT JOIN sys.dm_exec_sessions S ON BL.session_ID = S.session_ID
CROSS APPLY sys.dm_exec_sql_text(B.most_recent_sql_handle) BSQL
CROSS APPLY sys.dm_exec_sql_text(BL.sql_handle) BLSQL
ORDER BY BlockingSessionID, BlockedSessionID;
GO
|
BEGIN;
CREATE TYPE sponsorship_level AS ENUM ('platinum', 'gold', 'silver', 'bronze');
CREATE TABLE sponsor(
id SERIAL PRIMARY KEY,
name TEXT NOT NULL,
address TEXT NOT NULL,
website TEXT NOT NULL,
conference_id SERIAL NOT NULL REFERENCES conference(id),
sponsorship_level sponsorship_level NOT NULL
);
CREATE TYPE role AS ENUM ('marketing', 'logistics', 'technical', 'other', 'sole_contact');
CREATE TABLE sponsor_contact_information(
id SERIAL PRIMARY KEY,
name TEXT NOT NULL,
role role NOT NULL,
email TEXT NULL,
phone TEXT NULL,
sponsor_id SERIAL NOT NULL REFERENCES sponsor(id)
);
INSERT INTO sponsor (
name,
address,
website,
conference_id,
sponsorship_level
) VALUES (
'Google',
'Google Plaza, Google Town, G00 G13',
'https://www.google.com',
1,
'platinum'
);
INSERT INTO sponsor (
name,
address,
website,
conference_id,
sponsorship_level
) VALUES (
'1Password',
'The Crypt, Qwerty Town, 123 456',
'https://www.1password.com',
1,
'gold'
);
INSERT INTO sponsor (
name,
address,
website,
conference_id,
sponsorship_level
) VALUES (
'Sourcegraph',
'Universal House, Code Creek, Search Street, 533728',
'https://www.sourcegraph.com',
1,
'silver'
);
INSERT INTO sponsor (
name,
address,
website,
conference_id,
sponsorship_level
) VALUES (
'Sonobi',
'So Office, Nobi Building, 500081',
'https://www.sonobi.com',
1,
'bronze'
);
INSERT INTO sponsor_contact_information (
name,
role,
email,
phone,
sponsor_id
) VALUES (
'<NAME>',
'sole_contact',
'<EMAIL>',
'600613',
1
);
INSERT INTO sponsor_contact_information (
name,
role,
email,
phone,
sponsor_id
) VALUES (
'<NAME>',
'technical',
'<EMAIL>',
'9455',
2
);
INSERT INTO sponsor_contact_information (
name,
role,
email,
phone,
sponsor_id
) VALUES (
'<NAME>',
'logistics',
'<EMAIL>',
'888888888',
2
);
INSERT INTO sponsor_contact_information (
name,
role,
email,
phone,
sponsor_id
) VALUES (
'<NAME>',
'technical',
'<EMAIL>',
'666666',
3
);
INSERT INTO sponsor_contact_information (
name,
role,
email,
phone,
sponsor_id
) VALUES (
'<NAME>',
'marketing',
'<EMAIL>',
'87654321',
4
);
INSERT INTO sponsor_contact_information (
name,
role,
email,
phone,
sponsor_id
) VALUES (
'<NAME>',
'other',
'<EMAIL>',
'5554325',
4
);
COMMIT;
|
<reponame>CSCfi/antero
USE [VipunenTK_DW]
GO
/****** Object: StoredProcedure [dbo].[p_lataa_f_2_4efg] Script Date: 26.10.2017 16:28:25 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[p_lataa_f_2_4efg] AS
--execute VipunenTK_DW.dbo.p_lataa_OTV_f_2_4
TRUNCATE TABLE VipunenTK.dbo.f_2_4efg_Lukiokoulutuksen_ja_ammatillisen_koulutuksen_tutkinnot
INSERT INTO VipunenTK.dbo.f_2_4efg_Lukiokoulutuksen_ja_ammatillisen_koulutuksen_tutkinnot
SELECT
f.tilastointivuosi
,f.tilv_date
,f.lahde,lahde_id = coalesce(d1.id,-1)
,f.koulutuksen_jarjestaja
,koulutuksen_jarjestaja_id = coalesce(d3.id,-1)
,koulutuksen_jarjestaja_historia_id = coalesce(d3h.id,-1)
,f.oppisopimuskoulutuksen_jarjestaja
,oppisopimuskoulutuksen_jarjestaja_id = coalesce(d4.id,-1)
,oppisopimuskoulutuksen_jarjestaja_historia_id = coalesce(d4h.id,-1)
,f.koulutusluokitus
,koulutusluokitus_id = coalesce(d5.id,-1)
,koulutusluokitus_historia_id = coalesce(d5h.id,-1)
,f.tutkintonimike_ammpk
,tutkintonimike_ammpk_id = coalesce(d6.id,-1)
,f.koulutusohjelma_ammpk
,koulutusohjelma_ammpk_id = coalesce(d7.id,-1)
,f.ammatillisen_koulutuksen_koulutuslaji
,ammatillisen_koulutuksen_koulutuslaji_id = coalesce(d8.id,-1)
,f.opetussuunnitelmaperusteinen_koulutus_nayttotutkintoon_valmistava_koulutus
,opetussuunnitelmaperusteinen_koulutus_nayttotutkintoon_valmistava_koulutus_id = coalesce(d9.id,-1)
,f.koulutuksen_kieli
,koulutuksen_kieli_id = coalesce(d10.id,-1)
,f.koulutuksen_kunta
,koulutuksen_kunta_id = coalesce(d11.id,-1)
,koulutuksen_kunta_historia_id = coalesce(d11h.id,-1)
,f.opetushallinnon_koulutus
,opetushallinnon_koulutus_id = coalesce(d12.id,-1)
,f.sukupuoli
,sukupuoli_id = coalesce(d13.id,-1)
,f.aidinkieli_versio1
,aidinkieli_versio1_id = coalesce(d14.id,-1)
,f.aikuisopiskelija
,aikuisopiskelija_id = coalesce(d17.id,-1)
,f.nuorten_aikuisten_koulutus
,nuorten_aikuisten_koulutus_id = coalesce(d18.id,-1)
,f.ika_kirjoihintulovuonna
,ika_kirjoihintulovuonna_id = coalesce(d19.id,-1)
,ikaryhma_kirjoihintulovuonna_id = coalesce(d19_2.id,-1)
,f.ika
,ika_id = coalesce(d20.id,-1)
,ikaryhma_id = coalesce(d20_2.id,-1)
,f.lukumaara
,f.koulutuksen_tutkinnon_aloitusvuosi
,koulutuksen_tutkinnon_aloitusvuosi_id = coalesce(d21.kausi_id,'-1')
,f.koulutuksen_tutkinnon_aloituskausi
,koulutuksen_tutkinnon_aloituskausi_id = coalesce(d22.kausi_id,'-1')
,f.ov_hyvaksiluettu_ennen
,f.ov_hyvaksiluettu_aikana
,f.ov_suoritettu_koulutuksen_aikana
,f.ov_yhteensa
,f.ov_tyossaoppiminen
,f.lkm_ammattiosaaminen
,f.lkm_opintokokonaisuus
,f.lkm_tutkintojen_osat
,f.rahoituslahde_amm
,rahoituslahde_amm_id = coalesce(d24.id,-1)
,f.vayla_nayttotutkintoon
,vayla_nayttotutkintoon_id = coalesce(d25.id,-1)
,f.tutkinnon_tavoite
,tutkinnon_tavoite_id = coalesce(d28.id,-1)
,f.tutkinnon_toteuma
,tutkinnon_toteuma_id = coalesce(d29.id,-1)
,f.tietolahde
,f.rivinumero
,f.aineistotunnus
,f.koulutussektori
,koulutussektori_id = coalesce(d36.id,-1)
,f.koulutuksen_jarjestamismuoto
,koulutuksen_jarjestamismuoto_id = coalesce(d38.id,-1)
,f.ammatillinen_peruskoulutus_lisakoulutus
,ammatillinen_peruskoulutus_lisakoulutus_id = coalesce(d39.id,-1)
,f.koulutuksen_tavoite_toteuma
,koulutuksen_tavoite_toteuma_id = coalesce(d40.id,-1)
,f.tutkinnot
,aineisto_id = -1
,aineisto_OTV_id = coalesce(d42.id,-1)
,koulutuksen_jarjestaja_kunta_id = coalesce(d51.id,-1)
,koulutuksen_jarjestaja_kunta_historia_id = coalesce(d51h.id,-1)
,nuorten_aikuisten_koulutus_amm_id = coalesce(d53.id, -1)
,koulutuslaji_OKM_id = coalesce(d54.id, -1)
,yht_koulutuksen_jarjestaja_id = coalesce(d55.id, -1)
,yht_koulutuksen_jarjestaja_historia_id = coalesce(d55h.id, -1)
,yht_koulutuksen_jarjestaja_kunta_id = coalesce(d57.id,-1)
,yht_koulutuksen_jarjestaja_kunta_historia_id = coalesce(d57h.id,-1)
,yht_koulutuksen_kunta_id = coalesce(d59.id,-1)
,yht_koulutuksen_kunta_historia_id = coalesce(d59h.id,-1)
,hallinnonala2_id = coalesce(d12b.id,-1)
--into [VipunenTK].[dbo].[f_2_4efg_Lukiokoulutuksen_ja_ammatillisen_koulutuksen_tutkinnot]
FROM VipunenTK_DW.[dbo].[v_f_2_4efg_Lukiokoulutuksen_ja_ammatillisen_koulutuksen_tutkinnot] AS f
LEFT JOIN VipunenTK..d_lahde AS d1 ON d1.lahde_koodi=f.lahde AND f.tilv_date between d1.alkaa and d1.paattyy
LEFT JOIN VipunenTK..d_oppilaitoksen_taustatiedot AS d3 ON d3.oppilaitos_avain=f.koulutuksen_jarjestaja
LEFT JOIN VipunenTK..d_oppilaitoksen_taustatiedot AS d4 ON d4.oppilaitos_avain=f.oppisopimuskoulutuksen_jarjestaja
LEFT JOIN VipunenTK..d_oppilaitoksen_taustatiedot_historia AS d3h ON d3h.oppilaitos_avain=f.koulutuksen_jarjestaja AND f.tilv_date between d3h.alkaa and d3h.paattyy
LEFT JOIN VipunenTK..d_oppilaitoksen_taustatiedot_historia AS d4h ON d4h.oppilaitos_avain=f.oppisopimuskoulutuksen_jarjestaja AND f.tilv_date between d4h.alkaa and d4h.paattyy
LEFT JOIN VipunenTK..d_koulutusluokitus AS d5 ON d5.koulutusluokitus_avain=f.koulutusluokitus
LEFT JOIN VipunenTK..d_koulutusluokitus_historia AS d5h ON d5h.koulutusluokitus_avain=f.koulutusluokitus AND f.tilv_date between d5h.alkaa and d5h.paattyy
LEFT JOIN VipunenTK..d_tutkintonimike_ammpk AS d6 ON d6.tutkintonimike_ammpk_koodi=f.tutkintonimike_ammpk AND f.tilv_date between d6.alkaa and d6.paattyy
LEFT JOIN VipunenTK..d_koulutusohjelma_ammpk AS d7 ON d7.koulutusohjelma_ammpk_koodi=(case when f.koulutusohjelma_ammpk='9999' then '-1' else f.koulutusohjelma_ammpk end) AND f.tilv_date between d7.alkaa and d7.paattyy
LEFT JOIN VipunenTK..d_ammatillisen_koulutuksen_koulutuslaji AS d8 ON d8.ammatillisen_koulutuksen_koulutuslaji_koodi=f.ammatillisen_koulutuksen_koulutuslaji AND f.tilv_date between d8.alkaa and d8.paattyy
LEFT JOIN VipunenTK..d_opetussuunnitelmaperusteinen_koulutus_nayttotutkintoon_valmistava_koulutus AS d9 ON d9.opetussuunnitelmaperusteinen_koulutus_nayttotutkintoon_valmistava_koulutus_koodi=f.opetussuunnitelmaperusteinen_koulutus_nayttotutkintoon_valmistava_koulutus AND f.tilv_date between d9.alkaa and d9.paattyy
LEFT JOIN VipunenTK..d_kieli AS d10 ON d10.kieli_koodi=f.koulutuksen_kieli AND f.tilv_date between d10.alkaa and d10.paattyy
LEFT JOIN VipunenTK..d_alueluokitus AS d11 ON d11.alueluokitus_avain=f.koulutuksen_kunta
LEFT JOIN VipunenTK..d_alueluokitus_historia AS d11h ON d11h.alueluokitus_avain=f.koulutuksen_kunta AND f.tilv_date between d11h.alkaa and d11h.paattyy
LEFT JOIN VipunenTK..d_opetushallinnon_koulutus AS d12 ON d12.opetushallinnon_koulutus_koodi=f.opetushallinnon_koulutus AND f.tilv_date between d12.alkaa and d12.paattyy
LEFT JOIN VipunenTK..d_hallinnonala2 d12b ON d12b.hallinnonala_koodi=f.hallinnonala2 AND f.tilv_date between d12b.alkaa and d12b.paattyy
LEFT JOIN VipunenTK..d_sukupuoli AS d13 ON d13.sukupuoli_koodi=f.sukupuoli AND f.tilv_date between d13.alkaa and d13.paattyy
LEFT JOIN VipunenTK..d_aidinkieli_versio1 AS d14 ON d14.aidinkieli_versio1_koodi=f.aidinkieli_versio1 AND f.tilv_date between d14.alkaa and d14.paattyy
LEFT JOIN VipunenTK..d_aikuisopiskelija AS d17 ON d17.aikuisopiskelija_koodi=f.aikuisopiskelija AND f.tilv_date between d17.alkaa and d17.paattyy
LEFT JOIN VipunenTK..d_nuorten_aikuisten_koulutus AS d18 ON d18.nuorten_aikuisten_koulutus_koodi=f.nuorten_aikuisten_koulutus AND f.tilv_date between d18.alkaa and d18.paattyy
LEFT JOIN VipunenTK..d_ika AS d19 ON d19.ika_avain=f.ika_kirjoihintulovuonna
LEFT JOIN VipunenTK..d_ika AS d19_2 ON d19_2.ika_avain=f.ikaryhma_kirjoihintulovuonna
LEFT JOIN VipunenTK..d_ika AS d20 ON d20.ika_avain=f.ika
LEFT JOIN VipunenTK..d_ika AS d20_2 ON d20_2.ika_avain=f.ikaryhma
LEFT JOIN VipunenTK..d_kausi AS d21 ON d21.kausi_id =(case when isnull(f.koulutuksen_tutkinnon_aloitusvuosi,'') in ('9999','XXXX','') then '-1' else f.koulutuksen_tutkinnon_aloitusvuosi end)
LEFT JOIN VipunenTK..d_kausi AS d22 ON d22.kausi_id =(case
when isnull(f.koulutuksen_tutkinnon_aloitusvuosi,'') in ('9999','XXXX','') then '-1'
when isnull(f.koulutuksen_tutkinnon_aloituskausi,'') in ('9','X','') then '-1'
else f.koulutuksen_tutkinnon_aloitusvuosi+f.koulutuksen_tutkinnon_aloituskausi end)
LEFT JOIN VipunenTK..d_rahoituslahde_amm AS d24 ON d24.rahoituslahde_amm_koodi=f.rahoituslahde_amm AND f.tilv_date between d24.alkaa and d24.paattyy
LEFT JOIN VipunenTK..d_vayla_nayttotutkintoon AS d25 ON d25.vayla_nayttotutkintoon_koodi=f.vayla_nayttotutkintoon AND f.tilv_date between d25.alkaa and d25.paattyy
LEFT JOIN VipunenTK..d_tutkinnon_tavoite AS d28 ON d28.tutkinnon_tavoite_koodi=f.tutkinnon_tavoite AND f.tilv_date between d28.alkaa and d28.paattyy
LEFT JOIN VipunenTK..d_tutkinnon_toteuma AS d29 ON d29.tutkinnon_toteuma_koodi=f.tutkinnon_toteuma AND f.tilv_date between d29.alkaa and d29.paattyy
LEFT JOIN VipunenTK..d_koulutussektori AS d36 ON d36.koulutussektori_koodi=f.koulutussektori AND f.tilv_date between d36.alkaa and d36.paattyy
LEFT JOIN VipunenTK..d_koulutuksen_jarjestamismuoto AS d38 ON d38.koulutuksen_jarjestamismuoto_koodi=f.koulutuksen_jarjestamismuoto AND f.tilv_date between d38.alkaa and d38.paattyy
LEFT JOIN VipunenTK..d_ammatillinen_peruskoulutus_lisakoulutus AS d39 ON d39.ammatillinen_peruskoulutus_lisakoulutus_koodi=f.ammatillinen_peruskoulutus_lisakoulutus AND f.tilv_date between d39.alkaa and d39.paattyy
LEFT JOIN VipunenTK..d_koulutuksen_tavoite_toteuma AS d40 ON d40.koulutuksen_tavoite_toteuma_koodi=f.koulutuksen_tavoite_toteuma AND f.tilv_date between d40.alkaa and d40.paattyy
LEFT JOIN VipunenTK..d_aineisto_OTV AS d42 ON d42.aineisto_koodi=f.aineistotunnus AND f.tilv_date between d42.alkaa and d42.paattyy
/* koulutuksen järjestäjän sijaintikunta */
LEFT JOIN VipunenTK..d_alueluokitus AS d51 ON d51.alueluokitus_avain =
(select sijaintikuntakoodi from vipunentk..d_oppilaitoksen_taustatiedot where oppilaitos_avain = f.koulutuksen_jarjestaja)
LEFT JOIN VipunenTK..d_alueluokitus_historia AS d51h ON d51h.alueluokitus_avain =
(select sijaintikuntakoodi from vipunentk..d_oppilaitoksen_taustatiedot where oppilaitos_avain = f.koulutuksen_jarjestaja AND f.tilv_date between d51h.alkaa and d51h.paattyy)
AND f.tilv_date between d51h.alkaa and d51h.paattyy
LEFT JOIN VipunenTK..d_nuorten_aikuisten_koulutus_amm as d53 on d53.nuorten_aikuisten_koulutus_amm_koodi = f.nuorten_aikuisten_koulutus_amm
LEFT JOIN VipunenTK..d_koulutuslaji_okm AS d54 ON d54.koulutuslaji_okm_avain = f.koulutuslaji_OKM_avain
/*********** yhteinen koulutuksen järjestäjä, oppilaitos & niihin liittyvät aluetiedot -- Lasse 3.9.2015 ***********/
LEFT JOIN VipunenTK..d_oppilaitoksen_taustatiedot AS d55 ON d55.oppilaitos_avain=f.yhtjarj
LEFT JOIN VipunenTK..d_oppilaitoksen_taustatiedot_historia AS d55h ON d55h.oppilaitos_avain=f.yhtjarj AND f.tilv_date between d55h.alkaa and d55h.paattyy
/* yhteisen koulutuksen järjestäjän sijaintikunta */
LEFT JOIN VipunenTK..d_alueluokitus AS d57 ON d57.alueluokitus_avain =
(select koulutuksen_jarjestajan_ksijaintikuntakoodi from vipunentk..d_oppilaitoksen_taustatiedot where oppilaitos_avain = f.yhtjarj)
LEFT JOIN VipunenTK..d_alueluokitus_historia AS d57h ON d57h.alueluokitus_avain =
(select koulutuksen_jarjestajan_ksijaintikuntakoodi from vipunentk..d_oppilaitoksen_taustatiedot where oppilaitos_avain = f.yhtjarj AND f.tilv_date between d57h.alkaa and d57h.paattyy)
AND f.tilv_date between d57h.alkaa and d57h.paattyy
/* yhteisen koulutuksen sijaintikunta */
LEFT JOIN VipunenTK..d_alueluokitus AS d59 ON d59.alueluokitus_avain = f.yht_koulutuksen_kunta
LEFT JOIN VipunenTK..d_alueluokitus_historia AS d59h ON d59h.alueluokitus_avain = f.yht_koulutuksen_kunta AND f.tilv_date between d59h.alkaa and d59h.paattyy
GO
USE [ANTERO]
|
<reponame>seut/cr8<filename>specs/sql/create_countries.sql
create table countries (
"areaInSqKm" real,
capital text,
continent text,
"continentName" text,
"countryCode" text,
"countryName" text,
"currencyCode" text,
east real,
"fipsCode" text,
"isoAlpha3" text,
"isoNumeric" text,
languages text,
north real,
population integer,
south real,
west real
);
|
<gh_stars>10-100
create or replace package pit_table_pkg
as
/** Implementation package for type PIT_TABLE */
/** Method to write log information to table PIT_TABLE_LOG
* %param p_message Instance of MESSAGE_TYPE to persist
* %usage Method implements the LOG member procedure of type PIT_TABLE and
* writes the message attributes to table.
*/
procedure log(
p_message in message_type);
/** Method to write log state information to table PIT_TABLE_PARAMS
* %param p_log_state LOG_STATE_TYPE with ID, severity and an instance of MSG_PARAMS
* %usage Is used to log a state of an arbitrary amount of key-value-pairs to a table.
*/
procedure log(
p_log_state log_state_type);
/** Method to purge log information from tables PIT_TABLE_LOG, PIT_TABLE_CALL_STACK and PIT_TABLE_PARAMS
* %param p_date_until Date up to which the log entries are to be deleted
* %param [p_severity_greater_equal] Severity up to which the log entries are to be deleted
* %usage Method implements the PURGE member procedure of type PIT_TABLE and
* removes entries from the tables according to the filter set by P_DATE_UNTIL and P_SEVERITY_GREATER_EQUAL.
* Entries from PIT_TABLE_CALL_STACK and PIT_TABLE_PARAMS are not filterd by P_SEVERITY_GREATER_EQUAL but only by date.
*/
procedure purge(
p_date_until in date,
p_severity_greater_equal in number default null);
/** Method to write call stack information on enter to tables PIT_TABLE_CALL_STACK and PIT_TABLE_PARAMS
* %param p_call_stack Instance of CALL_STACK_TYPE to persist
* %usage Method implements the ENTER member procedure of type PIT_TABLE and
* writes the call stack type attributes to table.
*/
procedure enter(
p_call_stack in call_stack_type);
/** Method to write call stack information on leave to tables PIT_TABLE_CALL_STACK and PIT_TABLE_PARAMS
* %param p_call_stack Instance of CALL_STACK_TYPE to persist
* %usage Method implements the LEAVE member procedure of type PIT_TABLE and
* writes the call stack type attributes to table.
*/
procedure leave(
p_call_stack in call_stack_type);
/** Initialization method for PIT_TABLE output module
* %usage Method implements the parameterless constructor method of PIT_TABLE
*/
procedure initialize_module(
self in out pit_table);
end pit_table_pkg;
/
|
<filename>src/test/resources/randexpr1.test_733.sql
-- randexpr1.test
--
-- db eval {SELECT case when (19*b)+11*~f-coalesce((select max(11) from t1 where f<>case when case 17 when 11 then 17 else c end-11 in (t1.c,c,t1.e) and 19=t1.a or 17<=e or e<=19 then 19 & c when t1.b=t1.f then d else 19 end or t1.e not in (13,19,c)),b) & -c not between -e and -a then (t1.c) else t1.d end FROM t1 WHERE NOT (c in (select case abs((count(*))) when -max(t1.c) | abs(abs(+count(*)))-~case (case -max(e) when max(11)- -count(*) then ((max(t1.e))) else count(*) end) when count(distinct t1.e) then cast(avg(f) AS integer) else cast(avg(t1.c) AS integer) end* -cast(avg(f) AS integer) then max(f) else (max(b)) end from t1 union select (max(13)) from t1) and not exists(select 1 from t1 where case when t1.e<=19-b then c else c end in (select c from t1 union select (select -((count(distinct t1.d))) from t1)-t1.b from t1)))}
SELECT case when (19*b)+11*~f-coalesce((select max(11) from t1 where f<>case when case 17 when 11 then 17 else c end-11 in (t1.c,c,t1.e) and 19=t1.a or 17<=e or e<=19 then 19 & c when t1.b=t1.f then d else 19 end or t1.e not in (13,19,c)),b) & -c not between -e and -a then (t1.c) else t1.d end FROM t1 WHERE NOT (c in (select case abs((count(*))) when -max(t1.c) | abs(abs(+count(*)))-~case (case -max(e) when max(11)- -count(*) then ((max(t1.e))) else count(*) end) when count(distinct t1.e) then cast(avg(f) AS integer) else cast(avg(t1.c) AS integer) end* -cast(avg(f) AS integer) then max(f) else (max(b)) end from t1 union select (max(13)) from t1) and not exists(select 1 from t1 where case when t1.e<=19-b then c else c end in (select c from t1 union select (select -((count(distinct t1.d))) from t1)-t1.b from t1)))
|
<reponame>jdkoren/sqlite-parser<gh_stars>100-1000
-- vtab2.test
--
-- execsql {
-- CREATE VIRTUAL TABLE vars USING tclvar;
-- SELECT * FROM vars WHERE name='abc';
-- }
CREATE VIRTUAL TABLE vars USING tclvar;
SELECT * FROM vars WHERE name='abc';
|
/*
Enter your query here.
*/
select distinct city from station where id % 2 = 0;
|
CREATE DATABASE IF NOT EXISTS `bank` /*!40100 DEFAULT CHARACTER SET utf8 */;
USE `bank`;
-- MySQL dump 10.13 Distrib 8.0.15, for Win64 (x86_64)
--
-- Host: localhost Database: bank
-- ------------------------------------------------------
-- Server version 8.0.15
/*!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 */;
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 `account`
--
DROP TABLE IF EXISTS `account`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
SET character_set_client = utf8mb4 ;
CREATE TABLE `account` (
`idaccount` int(11) NOT NULL AUTO_INCREMENT,
`code_account` varchar(45) DEFAULT NULL,
`email_account` varchar(45) DEFAULT NULL,
`login_account` varchar(45) DEFAULT NULL,
PRIMARY KEY (`idaccount`),
UNIQUE KEY `idaccount_UNIQUE` (`idaccount`)
) ENGINE=InnoDB AUTO_INCREMENT=14 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `account`
--
LOCK TABLES `account` WRITE;
/*!40000 ALTER TABLE `account` DISABLE KEYS */;
INSERT INTO `account` VALUES (10,'user_943','<EMAIL>','anna'),(11,'user_285','<EMAIL>','david'),(12,'user_864','<EMAIL>','roma'),(13,'user_601','<EMAIL>','andrey');
/*!40000 ALTER TABLE `account` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `account_operation`
--
DROP TABLE IF EXISTS `account_operation`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
SET character_set_client = utf8mb4 ;
CREATE TABLE `account_operation` (
`idaccount_operation` int(11) NOT NULL AUTO_INCREMENT,
`date_operation` varchar(45) DEFAULT NULL,
`message` varchar(45) DEFAULT NULL,
`account_idaccount` int(11) NOT NULL,
PRIMARY KEY (`idaccount_operation`),
UNIQUE KEY `idaccount_operation_UNIQUE` (`idaccount_operation`),
KEY `fk_account_operation_account1_idx` (`account_idaccount`),
CONSTRAINT `fk_account_operation_account1` FOREIGN KEY (`account_idaccount`) REFERENCES `account` (`idaccount`)
) ENGINE=InnoDB AUTO_INCREMENT=56 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `account_operation`
--
LOCK TABLES `account_operation` WRITE;
/*!40000 ALTER TABLE `account_operation` DISABLE KEYS */;
INSERT INTO `account_operation` VALUES (3,'11-05-2020 10:19:53:82','Registration new account.',10),(4,'11-05-2020 10:19:53:226','Open current account.',10),(5,'11-05-2020 10:20:43:981','Registration new account.',11),(6,'11-05-2020 10:20:44:137','Open current account.',11),(7,'22-05-2020 22:41:20:64','Registration new account.',12),(8,'22-05-2020 22:41:20:438','Open current account.',12),(9,'27-05-2020 15:05:25:61','Registration new account.',13),(10,'27-05-2020 15:05:25:273','Open current account.',13),(12,'27-05-2020 20:20:09:642','Open current account.',12),(13,'27-05-2020 20:28:53:283','Open current account.',10),(14,'28-05-2020 22:00:18:359','Current account is closed.',10),(15,'28-05-2020 22:00:38:690','Open current account.',10),(16,'28-05-2020 22:00:50:112','Open current account.',10),(17,'28-05-2020 22:52:11:437','Current account is closed.',10),(18,'28-05-2020 23:04:42:626','Current account is closed.',10),(19,'30-05-2020 19:53:34:383','Open current account.',10),(20,'30-05-2020 19:53:56:02','Current account is closed.',10),(21,'19-06-2020 19:56:37:405','Open current account.',10),(22,'19-06-2020 19:56:50:601','Current account is closed.',10),(23,'19-06-2020 19:56:58:960','Current account is closed.',10),(24,'19-06-2020 20:00:06:982','Current account is closed.',10),(25,'19-06-2020 20:00:15:761','Open current account.',10),(26,'19-06-2020 20:00:26:813','Current account is closed.',10),(27,'19-06-2020 20:00:33:33','Current account is closed.',10),(28,'19-06-2020 20:02:58:372','Current account is closed.',10),(29,'19-06-2020 20:03:09:424','Open current account.',10),(30,'19-06-2020 20:03:17:966','Current account is closed.',10),(31,'19-06-2020 20:03:22:742','Current account is closed.',10),(32,'19-06-2020 20:05:13:625','Open current account.',10),(33,'19-06-2020 20:05:27:534','Open current account.',10),(34,'19-06-2020 20:05:36:219','Current account is closed.',10),(35,'19-06-2020 21:25:04:565','Deposit account is closed.',10),(36,'19-06-2020 21:25:08:455','Deposit account is closed.',10),(37,'19-06-2020 21:32:14:549','Deposit account is closed.',10),(38,'19-06-2020 21:52:41:803','Open deposit account.',10),(39,'19-06-2020 22:13:59:645','Open deposit account.',10),(40,'19-06-2020 22:14:18:501','Deposit account is closed.',10),(41,'19-06-2020 22:19:06:908','Deposit account is closed.',10),(42,'19-06-2020 22:20:33:630','Open deposit account.',10),(43,'19-06-2020 22:20:57:111','Current account is closed.',10),(44,'22-06-2020 21:07:13:623','Open deposit account.',10),(45,'22-06-2020 22:09:41:482','Open deposit account.',10),(46,'22-06-2020 22:16:32:31','Deposit account is closed.',10),(47,'22-06-2020 22:16:40:816','Deposit account is closed.',10),(48,'22-06-2020 22:17:02:424','Open deposit account.',10),(49,'22-06-2020 22:17:28:708','Open deposit account.',10),(50,'23-06-2020 11:07:13:328','Open deposit account.',10),(51,'25-06-2020 22:28:58:604','Open deposit account.',10),(52,'25-06-2020 23:09:52:720','Open deposit account.',10),(53,'25-06-2020 23:11:12:583','Deposit account is closed.',10),(54,'25-06-2020 23:11:22:550','Deposit account is closed.',10),(55,'25-06-2020 23:30:23:687','Open deposit account.',10);
/*!40000 ALTER TABLE `account_operation` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `credit_account`
--
DROP TABLE IF EXISTS `credit_account`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
SET character_set_client = utf8mb4 ;
CREATE TABLE `credit_account` (
`idcredit` int(11) NOT NULL AUTO_INCREMENT,
`credit_amount` double DEFAULT NULL,
`credit_percent` int(11) DEFAULT NULL,
`credit_type` varchar(45) DEFAULT NULL,
`credit_term` int(11) DEFAULT NULL,
`account_idaccount` int(11) NOT NULL,
`credit_account_status` int(11) DEFAULT NULL,
PRIMARY KEY (`idcredit`),
UNIQUE KEY `idcredit_UNIQUE` (`idcredit`),
KEY `fk_credit_account_account1_idx` (`account_idaccount`),
CONSTRAINT `fk_credit_account_account1` FOREIGN KEY (`account_idaccount`) REFERENCES `account` (`idaccount`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `credit_account`
--
LOCK TABLES `credit_account` WRITE;
/*!40000 ALTER TABLE `credit_account` DISABLE KEYS */;
/*!40000 ALTER TABLE `credit_account` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `current_account`
--
DROP TABLE IF EXISTS `current_account`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
SET character_set_client = utf8mb4 ;
CREATE TABLE `current_account` (
`idcurrent` int(11) NOT NULL AUTO_INCREMENT,
`current_currency` varchar(5) DEFAULT NULL,
`currency_number` varchar(50) DEFAULT NULL,
`current_amount` double DEFAULT NULL,
`account_idaccount` int(11) NOT NULL,
`current_account_status` int(11) DEFAULT NULL,
PRIMARY KEY (`idcurrent`),
UNIQUE KEY `idcurrent_UNIQUE` (`idcurrent`),
KEY `fk_current_account_account1_idx` (`account_idaccount`),
CONSTRAINT `fk_current_account_account1` FOREIGN KEY (`account_idaccount`) REFERENCES `account` (`idaccount`)
) ENGINE=InnoDB AUTO_INCREMENT=20 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `current_account`
--
LOCK TABLES `current_account` WRITE;
/*!40000 ALTER TABLE `current_account` DISABLE KEYS */;
INSERT INTO `current_account` VALUES (5,'UAH','UA63200',10000.34,10,1),(6,'UAH','UA50886',0,11,1),(7,'UAH','UA17562',0,12,1),(8,'UAH','UA52352',0,13,1),(10,'EUR','UA16200',0,12,1),(11,'USD','UA38319',0,10,0),(12,'USD','UA44335',125372,10,1),(13,'EUR','UA79759',0,10,0),(14,'EUR','UA85954',0,10,0),(15,'EUR','UA42665',0,10,0),(16,'UAH','UA73550',0,10,0),(17,'USD','UA40337',0,10,0),(18,'UAH','UA30078',0,10,0),(19,'EUR','UA27979',0,10,1);
/*!40000 ALTER TABLE `current_account` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `deposit_account`
--
DROP TABLE IF EXISTS `deposit_account`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
SET character_set_client = utf8mb4 ;
CREATE TABLE `deposit_account` (
`iddeposit` int(11) NOT NULL AUTO_INCREMENT,
`deposit_currency` varchar(5) DEFAULT NULL,
`deposit_type` varchar(45) DEFAULT NULL,
`deposit_term` varchar(5) DEFAULT NULL,
`deposit_number` varchar(45) DEFAULT NULL,
`deposit_amount` double DEFAULT NULL,
`deposit_percent` double DEFAULT NULL,
`account_idaccount` int(11) NOT NULL,
`deposit_account_status` int(11) DEFAULT NULL,
PRIMARY KEY (`iddeposit`),
UNIQUE KEY `iddeposit_UNIQUE` (`iddeposit`),
KEY `fk_deposit_account_account1_idx` (`account_idaccount`),
CONSTRAINT `fk_deposit_account_account1` FOREIGN KEY (`account_idaccount`) REFERENCES `account` (`idaccount`)
) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `deposit_account`
--
LOCK TABLES `deposit_account` WRITE;
/*!40000 ALTER TABLE `deposit_account` DISABLE KEYS */;
INSERT INTO `deposit_account` VALUES (3,'UAH','CLASSIC','12','UA18830D',0,9,10,0),(4,'UAH','CLASSIC','6','UA84273D',0,5.5,10,0),(5,'USD','CLASSIC','3','UA79365D',0,3,10,0),(6,'EUR','CLASSIC','1','UA68331D',0,1.5,10,1),(7,'EUR','CLASSIC','9','UA55530D',0,7.25,10,1),(8,'UAH','CLASSIC','12','UA28575D',0,9,10,1),(9,'UAH','SAVINGS','3','UA31488D',0,3.25,10,1),(10,'UAH','CLASSIC','1','UA47583D',0,1.5,10,0),(11,'UAH','CLASSIC','1','UA76633D',0,1.5,10,0),(12,'UAH','CLASSIC','1','UA33654D',0,1.5,10,1);
/*!40000 ALTER TABLE `deposit_account` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `user`
--
DROP TABLE IF EXISTS `user`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
SET character_set_client = utf8mb4 ;
CREATE TABLE `user` (
`iduser` int(11) NOT NULL AUTO_INCREMENT,
`role` varchar(45) NOT NULL,
`first_name` varchar(45) DEFAULT NULL,
`last_name` varchar(45) DEFAULT NULL,
`email` varchar(45) DEFAULT NULL,
`phone` varchar(45) DEFAULT NULL,
`login` varchar(45) NOT NULL,
`password` varchar(45) NOT NULL,
PRIMARY KEY (`iduser`),
UNIQUE KEY `iduser_UNIQUE` (`iduser`)
) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `user`
--
LOCK TABLES `user` WRITE;
/*!40000 ALTER TABLE `user` DISABLE KEYS */;
INSERT INTO `user` VALUES (1,'ADMIN','Alec','Syd','<EMAIL>','+38(050)1234567','admin','admin'),(13,'USER','Anna','Syd','<EMAIL>','+38(067)9876532','anna','123'),(14,'USER','David','Syd','<EMAIL>','+38(097)1478523','david','456'),(15,'USER','Roman','Deineka','<EMAIL>','+38(097)1478523','roma','789'),(16,'USER','Andey','Deineka','<EMAIL>','+38(050)5757855','andrey','147');
/*!40000 ALTER TABLE `user` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `user_has_account`
--
DROP TABLE IF EXISTS `user_has_account`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
SET character_set_client = utf8mb4 ;
CREATE TABLE `user_has_account` (
`user_iduser` int(11) NOT NULL,
`account_idaccount` int(11) NOT NULL,
PRIMARY KEY (`user_iduser`,`account_idaccount`),
KEY `fk_user_has_account_account1_idx` (`account_idaccount`),
KEY `fk_user_has_account_user_idx` (`user_iduser`),
CONSTRAINT `fk_user_has_account_account1` FOREIGN KEY (`account_idaccount`) REFERENCES `account` (`idaccount`),
CONSTRAINT `fk_user_has_account_user` FOREIGN KEY (`user_iduser`) REFERENCES `user` (`iduser`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `user_has_account`
--
LOCK TABLES `user_has_account` WRITE;
/*!40000 ALTER TABLE `user_has_account` DISABLE KEYS */;
INSERT INTO `user_has_account` VALUES (13,10),(14,11),(15,12),(16,13);
/*!40000 ALTER TABLE `user_has_account` 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-10-26 14:10:28
|
-- Substitute your parameter values in the connector configurations below.
-- If you do not want to connect to a real data source, remove the CREATE SOURCE CONNECTOR commands,
-- and add the INSERT INTO commands to insert mock data into the streams
|
--Contact View
SELECT c1.Id, FirstName, LastName, Address1, Address2, Notes, ZipCode, HomePhone, WorkPhone, CellPhone, EMail, CityId, c2.Name as CityName, StateId, s.Name as StateName, c1.Active, c1.ModifiedDt, c1.CreateDt
FROM Contact c1 JOIN City c2 ON (c2.Id = c1.CityId) JOIN State s ON (s.Id = c2.StateId)
WHERE c1.Active=1
--Testing
DECLARE @p1 NVARCHAR (25),
@p2 NVARCHAR (30),
@p3 NVARCHAR (40),
@p4 NVARCHAR (30),
@p5 NVARCHAR (150),
@p6 NVARCHAR (10),
@p7 NVARCHAR (10),
@p8 NVARCHAR (10),
@p9 NVARCHAR (10),
@p10 NVARCHAR (4000),
@p11 INT;
SET @p1 = "New";
SET @p2 = "User";
SET @p3 = "Address1";
SET @p4 = "Address2";
SET @p5 = "Note 1";
SET @p6 = "99999";
SET @p7 = "8005551212";
SET @p8 = "8005551212";
SET @p9 = "8005551212";
SET @p10 = "<EMAIL>";
SET @p11 = 1;
INSERT INTO Contact (FirstName, LastName, Address1, Address2, Notes, ZipCode, HomePhone, WorkPhone, CellPhone, EMail, CityId, Active, ModifiedDt, CreateDt)
OUTPUT INSERTED.Id
VALUES (@p1, @p2, @p3, @p4, @p5, @p6, @p7, @p8, @p9, @p10, @p11, 1, GETDATE(), GETDATE())
|
<reponame>jcgarciaa/carbon-identity-framework
CREATE OR REPLACE PROCEDURE WSO2_CONFIRMATION_CODE_CLEANUP_SP IS
i INT := 0;
chunk_size INT := 5000;
number_of_rows INT := 0;
BEGIN
SELECT COUNT(*) INTO number_of_rows from ALL_TABLES where table_name = upper('TEMP_REG_RESOURCE_INVALID_ID');
IF (number_of_rows = 1) then
EXECUTE IMMEDIATE 'DROP TABLE TEMP_REG_RESOURCE_INVALID_ID';
COMMIT;
END if;
EXECUTE IMMEDIATE 'CREATE TABLE TEMP_REG_RESOURCE_INVALID_ID (REG_PROPERTY_ID INTEGER)';
COMMIT;
EXECUTE IMMEDIATE 'INSERT INTO TEMP_REG_RESOURCE_INVALID_ID (REG_PROPERTY_ID)
SELECT REG_PROPERTY_ID
FROM REG_RESOURCE_PROPERTY
WHERE REG_PROPERTY_ID NOT IN (
SELECT REG_PROPERTY_ID FROM REG_RESOURCE_PROPERTY
INNER JOIN REG_RESOURCE
ON REG_RESOURCE_PROPERTY.REG_PATH_ID = REG_RESOURCE.REG_PATH_ID
UNION
SELECT REG_PROPERTY_ID FROM REG_RESOURCE_PROPERTY
INNER JOIN REG_RESOURCE
ON REG_RESOURCE_PROPERTY.REG_VERSION = REG_RESOURCE.REG_VERSION
)';
COMMIT;
EXECUTE IMMEDIATE 'SELECT COUNT(*) FROM TEMP_REG_RESOURCE_INVALID_ID' INTO number_of_rows;
WHILE (i <= number_of_rows/chunk_size) LOOP
EXECUTE IMMEDIATE 'DELETE
FROM REG_RESOURCE_PROPERTY
WHERE REG_PROPERTY_ID
IN (
SELECT REG_RESOURCE_PROPERTY.REG_PROPERTY_ID
FROM REG_RESOURCE_PROPERTY
INNER JOIN TEMP_REG_RESOURCE_INVALID_ID
ON REG_RESOURCE_PROPERTY.REG_PROPERTY_ID = TEMP_REG_RESOURCE_INVALID_ID.REG_PROPERTY_ID
FETCH FIRST '||chunk_size||' ROWS ONLY
)';
COMMIT;
DBMS_LOCK.sleep(2);
EXECUTE IMMEDIATE 'DELETE
FROM REG_PROPERTY
WHERE REG_ID
IN (
SELECT REG_PROPERTY.REG_ID
FROM REG_PROPERTY
INNER JOIN TEMP_REG_RESOURCE_INVALID_ID
ON REG_PROPERTY.REG_ID = TEMP_REG_RESOURCE_INVALID_ID.REG_PROPERTY_ID
FETCH FIRST '||chunk_size||' ROWS ONLY
)';
COMMIT;
i := i + 1;
DBMS_LOCK.sleep(2);
END LOOP;
EXECUTE IMMEDIATE 'DROP TABLE TEMP_REG_RESOURCE_INVALID_ID';
COMMIT;
END;
EXEC WSO2_REG_PROPERTY_CLEANUP();
|
create table sla_incident (id bigint not null auto_increment, created_date datetime, last_modified_date datetime, closed_date datetime, primary key (id));
create table sla_incident_repositories (sla_incident_id bigint not null, repository_id bigint not null, primary key (sla_incident_id, repository_id));
alter table sla_incident_repositories add constraint FK__SLA_INCIDENT_REPOSITORIES__REPOSITORY__ID foreign key (repository_id) references repository (id);
alter table sla_incident_repositories add constraint FK__SLA_INCIDENT_REPOSITORIES__SLA_INCIDENT__ID foreign key (sla_incident_id) references sla_incident (id);
|
select sql_text,is_shareable,is_bind_aware,child_number,sql_plan_baseline from v$sql
where sql_text like '%SPM%';
|
<gh_stars>0
-- MySQL Workbench Forward Engineering
SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;
SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION';
-- -----------------------------------------------------
-- Schema mydb
-- -----------------------------------------------------
-- -----------------------------------------------------
-- Schema test
-- -----------------------------------------------------
-- -----------------------------------------------------
-- Schema test
-- -----------------------------------------------------
CREATE SCHEMA IF NOT EXISTS `test` DEFAULT CHARACTER SET utf8 COLLATE utf8_bin ;
USE `test` ;
-- -----------------------------------------------------
-- Table `test`.`users_info`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `test`.`users_info` (
`id` INT NOT NULL AUTO_INCREMENT,
`user_name` VARCHAR(256) NOT NULL,
`user_surname` VARCHAR(256) NOT NULL,
`user_patronymic` VARCHAR(256) NULL DEFAULT NULL,
`user_role` VARCHAR(64) NOT NULL,
`user_birth_date` DATE NOT NULL,
`user_creation_date` DATE NOT NULL,
`record_update_date` DATE NOT NULL,
`link_to_the_image` VARCHAR(256) NOT NULL,
`link_to_the_table_users` VARCHAR(256) NOT NULL,
PRIMARY KEY (`id`))
ENGINE = InnoDB
DEFAULT CHARACTER SET = utf8
COLLATE = utf8_bin;
SET SQL_MODE=@OLD_SQL_MODE;
SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;
|
CREATE TABLE `blog_post` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`title` VARCHAR(255) NOT NULL,
`alias` VARCHAR(255) NOT NULL,
`anons` TEXT NOT NULL,
`content` MEDIUMTEXT NOT NULL,
`author_id` int(11) DEFAULT NULL,
`status` SMALLINT NOT NULL DEFAULT '0',
`created_at` int(11) NOT NULL,
`updated_at` int(11) NOT NULL,
`category_id` int(11) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `status` (`status`),
KEY `created_at` (`created_at`),
KEY `updated_at` (`updated_at`)
) ENGINE=InnoDB default charset=utf8 auto_increment=1;
CREATE TABLE `blog_category` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` VARCHAR(100) NOT NULL,
`alias` VARCHAR(100) NOT NULL,
`description` VARCHAR(255),
PRIMARY KEY (`id`),
UNIQUE KEY `alias` (`alias`)
) ENGINE=InnoDB default charset=utf8 auto_increment=1;
INSERT INTO `blog_category` (`id`, `name`, `alias`,`description`) VALUES('1','Программирование','programming','');
CREATE TABLE `blog_tags` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` VARCHAR(100) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `name` (`name`)
) ENGINE=InnoDB default charset=utf8 auto_increment=1;
CREATE TABLE `blog_post_tags` (
`tag_id` int(11),
`post_id` int(11)
) ENGINE=InnoDB default charset=utf8 auto_increment=1;
ALTER TABLE `blog_post`
ADD CONSTRAINT `FK-blog_post-category_id-blog_category-id` FOREIGN KEY (`category_id`) REFERENCES `blog_category` (`id`) ON DELETE SET NULL ON UPDATE CASCADE;
ALTER TABLE `blog_post_tags`
ADD CONSTRAINT `FK-blog_post_tags-tag_id-blog_tags-id` FOREIGN KEY (`tag_id`) REFERENCES `blog_tags` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
ALTER TABLE `blog_post_tags`
ADD CONSTRAINT `FK-blog_post_tags-post_id-blog_post-id` FOREIGN KEY (`post_id`) REFERENCES `blog_post` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
ALTER TABLE `blog_post`
ADD CONSTRAINT `FK-blog_post-author_id-user-id` FOREIGN KEY (`author_id`) REFERENCES `user` (`id`) ON DELETE SET NULL ON UPDATE CASCADE;
|
<reponame>dunarel/dunphd-thesis
checkpoint defrag
backup database to '/root/devel/backup/db_srv/' blocking
select hpf.fen_no,
hpf.fen_idx_min,
hpf.fen_idx_max
from hgt_par_fens hpf
where hpf.win_status = 'designed' and
hpf.gene_id = 110 and
hpf.win_size = 10
order by hpf.fen_no
select *
from
(
select ggv_com.gene_id,
ggv_com.PROK_GROUP_SOURCE_ID,
ggv_com.PROK_GROUP_DEST_ID,
ggv_com.val as com_val,
ggv_par.val as par_val,
greatest(nvl(ggv_com.val,0),nvl(ggv_par.val,0)) as val
from HGT_COM_GENE_GROUPS_VALS ggv_com
full outer join HGT_PAR_GENE_GROUPS_VALS ggv_par on ggv_par.GENE_ID = ggv_com.GENE_ID and
ggv_par.PROK_GROUP_SOURCE_ID = ggv_com.PROK_GROUP_SOURCE_ID and
ggv_par.PROK_GROUP_DEST_ID = ggv_com.PROK_GROUP_DEST_ID
)
where PROK_GROUP_SOURCE_ID = 8 and
PROK_GROUP_DEST_ID = 17
select ggv_com.gene_id,
ggv_com.PROK_GROUP_SOURCE_ID,
ggv_com.PROK_GROUP_DEST_ID,
ggv_com.val as com_val,
ggv_par.val as par_val,
greatest(nvl(ggv_com.val,0),nvl(ggv_par.val,0)) as val
from HGT_COM_GENE_GROUPS_VALS ggv_com
full outer join HGT_PAR_GENE_GROUPS_VALS ggv_par on ggv_par.GENE_ID = ggv_com.GENE_ID and
ggv_par.PROK_GROUP_SOURCE_ID = ggv_com.PROK_GROUP_SOURCE_ID and
ggv_par.PROK_GROUP_DEST_ID = ggv_com.PROK_GROUP_DEST_ID
where PROK_GROUP_SOURCE_ID = 8 and
PROK_GROUP_DEST_ID = 17
select ggv_com.gene_id,
ggv_com.PROK_GROUP_SOURCE_ID,
ggv_com.PROK_GROUP_DEST_ID,
ggv_com.val as com_val,
ggv_par.val as par_val,
greatest(nvl(ggv_com.val,0),nvl(ggv_par.val,0)) as val
from HGT_COM_GENE_GROUPS_VALS ggv_com
full outer join HGT_PAR_GENE_GROUPS_VALS ggv_par on ggv_par.GENE_ID = ggv_com.GENE_ID and
ggv_par.PROK_GROUP_SOURCE_ID = ggv_com.PROK_GROUP_SOURCE_ID and
ggv_par.PROK_GROUP_DEST_ID = ggv_com.PROK_GROUP_DEST_ID
where ggv_par.PROK_GROUP_SOURCE_ID = 8 and
ggv_par.PROK_GROUP_DEST_ID = 17
select un.gene_id,
un.PROK_GROUP_SOURCE_ID,
un.PROK_GROUP_DEST_ID,
max(val)
from
(
select gene_id,
PROK_GROUP_SOURCE_ID,
PROK_GROUP_DEST_ID,
VAL
from HGT_COM_GENE_GROUPS_VALS
union
select gene_id,
PROK_GROUP_SOURCE_ID,
PROK_GROUP_DEST_ID,
VAL
from HGT_PAR_GENE_GROUPS_VALS
) un
where un.PROK_GROUP_SOURCE_ID = 8 and
un.PROK_GROUP_DEST_ID = 17
group by un.gene_id,
un.PROK_GROUP_SOURCE_ID,
un.PROK_GROUP_DEST_ID
order by un.gene_id,
un.PROK_GROUP_SOURCE_ID,
un.PROK_GROUP_DEST_ID
select ggv_par.gene_id,
ggv_par.PROK_GROUP_SOURCE_ID,
ggv_par.PROK_GROUP_DEST_ID,
ggv_par.VAL
from HGT_PAR_GENE_GROUPS_VALS ggv_par
select sum(ggv_com.VAL)
from HGT_COM_GENE_GROUPS_VALS ggv_com
select sum(ggv_par.VAL)
from HGT_PAR_GENE_GROUPS_VALS ggv_par
select un.gene_id,
un.PROK_GROUP_SOURCE_ID,
un.PROK_GROUP_DEST_ID,
max(val) as val
from
(
select gene_id,
PROK_GROUP_SOURCE_ID,
PROK_GROUP_DEST_ID,
VAL
from HGT_COM_GENE_GROUPS_VALS
union
select gene_id,
PROK_GROUP_SOURCE_ID,
PROK_GROUP_DEST_ID,
VAL
from HGT_PAR_GENE_GROUPS_VALS
) un
group by un.gene_id,
un.PROK_GROUP_SOURCE_ID,
un.PROK_GROUP_DEST_ID
order by un.gene_id,
un.PROK_GROUP_SOURCE_ID,
un.PROK_GROUP_DEST_ID
|
<filename>software/upt/uptEAR/scripts/DataPrimingOracle.sql
/*L
Copyright Ekagra Software Technologies Ltd.
Copyright SAIC, SAIC-Frederick
Distributed under the OSI-approved BSD 3-Clause License.
See http://ncip.github.com/common-security-module/LICENSE.txt for details.
L*/
--
-- The following entries creates a super admin application incase you decide
-- to use this database to run UPT also. In that case you need to provide
-- the project login id and name for the super admin.
-- However in incase you are using this database just to host the application's
-- authorization schema, these enteries are not used and hence they can be left as
-- it is.
--
insert into csm_application(APPLICATION_ID, APPLICATION_NAME,APPLICATION_DESCRIPTION,DECLARATIVE_FLAG,ACTIVE_FLAG,UPDATE_DATE)
values (1, 'csmupt','UPT Super Admin Application',0,0,sysdate)
/
select CSM_APPLICATI_APPLICATION__SEQ.nextval from dual
/
INSERT INTO CSM_USER (USER_ID, LOGIN_NAME, MIGRATED_FLAG, FIRST_NAME, LAST_NAME, ORGANIZATION, DEPARTMENT, TITLE, PHONE_NUMBER, PASSWORD, EMAIL_ID, START_DATE, END_DATE, UPDATE_DATE, PREMGRT_LOGIN_NAME, PASSWORD_EXPIRED, PASSWORD_EXPIRY_DATE, FIRST_TIME_LOGIN, ACTIVE_FLAG)
VALUES('1','SuperAdmin','0','aSxDyZ0AlthARx8irRHBhg==','YCwS7U4EuXsCiGXf1QMALA==','','','','','5kJqWYBdWCphljGP2pGUGg==','',NULL,NULL,sysdate,'','0','12-AUG-2013','0','1')
/
select CSM_USER_USER_ID_SEQ.nextval from dual
/
insert into csm_protection_element(PROTECTION_ELEMENT_ID, PROTECTION_ELEMENT_NAME,PROTECTION_ELEMENT_DESCRIPTION,OBJECT_ID,APPLICATION_ID,UPDATE_DATE)
values(1, 'csmupt','UPT Super Admin Application','csmupt',1,sysdate)
/
select CSM_PROTECTIO_PROTECTION_E_SEQ.nextval from dual
/
insert into csm_user_pe(USER_PROTECTION_ELEMENT_ID, PROTECTION_ELEMENT_ID,USER_ID)
values(1,1,1)
/
select CSM_USER_PE_USER_PROTECTIO_SEQ.nextval from dual
/
--
-- The following entry is for your application.
-- Replace <<application_context>> with your application's context name.
--
INSERT INTO csm_application(APPLICATION_ID, APPLICATION_NAME,APPLICATION_DESCRIPTION,DECLARATIVE_FLAG,ACTIVE_FLAG,UPDATE_DATE)
VALUES (2, '<<application_context_name>>','Application Description',0,0,sysdate)
/
select CSM_APPLICATI_APPLICATION__SEQ.nextval from dual
/
insert into csm_protection_element(PROTECTION_ELEMENT_ID, PROTECTION_ELEMENT_NAME,PROTECTION_ELEMENT_DESCRIPTION,OBJECT_ID,APPLICATION_ID,UPDATE_DATE)
values(2, '<<application_context_name>>','<<application_context_name>> Admin Application','<<application_context_name>>',1,sysdate)
/
select CSM_PROTECTIO_PROTECTION_E_SEQ.nextval from dual
/
--
-- The following entries are Common Set of Privileges
--
INSERT INTO csm_privilege (privilege_id, privilege_name, privilege_description, update_date)
VALUES(1,'CREATE','This privilege grants permission to a user to create an entity. This entity can be an object, a database entry, or a resource such as a network connection', sysdate)
/
SELECT CSM_PRIVILEGE_PRIVILEGE_ID_SEQ.nextval FROM dual
/
INSERT INTO csm_privilege (privilege_id, privilege_name, privilege_description, update_date)
VALUES(2,'ACCESS','This privilege allows a user to access a particular resource. Eg. network connection, database connection, socket, module of the application, or even the application itself', sysdate)
/
SELECT CSM_PRIVILEGE_PRIVILEGE_ID_SEQ.nextval FROM dual
/
INSERT INTO csm_privilege (privilege_id, privilege_name, privilege_description, update_date)
VALUES(3,'READ','This privilege permits the user to read data from a file, URL, socket, database, or an object. This can be used at an entity level signifying that the user is allowed to read a data row or object', sysdate)
/
SELECT CSM_PRIVILEGE_PRIVILEGE_ID_SEQ.nextval FROM dual
/
INSERT INTO csm_privilege (privilege_id, privilege_name, privilege_description, update_date)
VALUES(4,'WRITE','This privilege allows a user to write data to a file, URL, socket, database, or object. At an entity level it signified if user is allowed to write a data database row or object', sysdate)
/
SELECT CSM_PRIVILEGE_PRIVILEGE_ID_SEQ.nextval FROM dual
/
INSERT INTO csm_privilege (privilege_id, privilege_name, privilege_description, update_date)
VALUES(5,'UPDATE','This privilege grants permission At an entity level it signified if user is allowed to update and modify data for a particular entity.', sysdate)
/
SELECT CSM_PRIVILEGE_PRIVILEGE_ID_SEQ.nextval FROM dual
/
INSERT INTO csm_privilege (privilege_id, privilege_name, privilege_description, update_date)
VALUES(6,'DELETE','This privilege permits a user to delete a logical entity. This entity can be an object, a database entry, a resource such as a network connection, etc', sysdate)
/
SELECT CSM_PRIVILEGE_PRIVILEGE_ID_SEQ.nextval FROM dual
/
INSERT INTO csm_privilege (privilege_id, privilege_name, privilege_description, update_date)
VALUES(7,'EXECUTE','This privilege allows a user to execute a particular resource. The resource can be a method, function, behavior of the application, URL, button etc', sysdate)
/
SELECT CSM_PRIVILEGE_PRIVILEGE_ID_SEQ.nextval FROM dual
/
INSERT INTO CSM_PROTECTION_GROUP (PROTECTION_GROUP_ID, PROTECTION_GROUP_NAME, PROTECTION_GROUP_DESCRIPTION, APPLICATION_ID, LARGE_ELEMENT_COUNT_FLAG, UPDATE_DATE)
VALUES(1, 'UPT_UI_USERS_LINK', 'Protection Group representing User link in UPT. Do not change the name.', 1, 0, sysdate)
/
INSERT INTO CSM_PROTECTION_GROUP (PROTECTION_GROUP_ID, PROTECTION_GROUP_NAME, PROTECTION_GROUP_DESCRIPTION, APPLICATION_ID, LARGE_ELEMENT_COUNT_FLAG, UPDATE_DATE)
VALUES(2, 'UPT_UI_PROTECTION_ELEMENTS_LINK', 'Protection Group representing Protection Element link in UPT. Do not change the name.', 1, 0, sysdate)
/
INSERT INTO CSM_PROTECTION_GROUP (PROTECTION_GROUP_ID, PROTECTION_GROUP_NAME, PROTECTION_GROUP_DESCRIPTION, APPLICATION_ID, LARGE_ELEMENT_COUNT_FLAG, UPDATE_DATE)
VALUES(3, 'UPT_UI_PRIVILEGES_LINK', 'Protection Group representing Privilege link in UPT. Do not change the name.', 1, 0, sysdate)
/
INSERT INTO CSM_PROTECTION_GROUP (PROTECTION_GROUP_ID, PROTECTION_GROUP_NAME, PROTECTION_GROUP_DESCRIPTION, APPLICATION_ID, LARGE_ELEMENT_COUNT_FLAG, UPDATE_DATE)
VALUES(4, 'UPT_UI_GROUPS_LINK', 'Protection Group representing Group link in UPT. Do not change the name.', 1, 0, sysdate)
/
INSERT INTO CSM_PROTECTION_GROUP (PROTECTION_GROUP_ID, PROTECTION_GROUP_NAME, PROTECTION_GROUP_DESCRIPTION, APPLICATION_ID, LARGE_ELEMENT_COUNT_FLAG, UPDATE_DATE)
VALUES(5, 'UPT_UI_PROTECTION_GROUPS_LINK', 'Protection Group representing Protection Group link in UPT. Do not change the name.', 1, 0, sysdate)
/
INSERT INTO CSM_PROTECTION_GROUP (PROTECTION_GROUP_ID, PROTECTION_GROUP_NAME, PROTECTION_GROUP_DESCRIPTION, APPLICATION_ID, LARGE_ELEMENT_COUNT_FLAG, UPDATE_DATE)
VALUES(6, 'UPT_UI_ROLE_LINK', 'Protection Group representing Role link in UPT. Do not change the name.', 1, 0, sysdate)
/
INSERT INTO CSM_PROTECTION_GROUP (PROTECTION_GROUP_ID, PROTECTION_GROUP_NAME, PROTECTION_GROUP_DESCRIPTION, APPLICATION_ID, LARGE_ELEMENT_COUNT_FLAG, UPDATE_DATE)
VALUES(7, 'UPT_UI_INSTANCE_LEVEL_LINK', 'Protection Group representing Instance Level link in UPT. Do not change the name.', 1, 0, sysdate)
/
INSERT INTO CSM_CONFIGURATION_PROPS (PROPERTY_KEY, PROPERTY_VALUE) VALUES('ALLOWED_ATTEMPTS','3')
/
INSERT INTO CSM_CONFIGURATION_PROPS (PROPERTY_KEY, PROPERTY_VALUE) VALUES('ALLOWED_LOGIN_TIME','600000')
/
INSERT INTO CSM_CONFIGURATION_PROPS (PROPERTY_KEY, PROPERTY_VALUE) VALUES('PASSWORD_EXPIRY_DAYS','60')
/
INSERT INTO CSM_CONFIGURATION_PROPS (PROPERTY_KEY, PROPERTY_VALUE) VALUES('PASSWORD_LOCKOUT_TIME','180<PASSWORD>')
/
INSERT INTO CSM_CONFIGURATION_PROPS (PROPERTY_KEY, PROPERTY_VALUE) VALUES('PASSWORD_MATCH_NUM','2')
/
INSERT INTO CSM_CONFIGURATION_PROPS (PROPERTY_KEY, PROPERTY_VALUE) VALUES('AES_ENCRYPTION_KEY','super secret')
/
INSERT INTO CSM_CONFIGURATION_PROPS (PROPERTY_KEY, PROPERTY_VALUE) VALUES('PASSWORD_PATTERN_MATCH','(?=.*[A-Z])(?=.*\\d)(.{8,})$')
/
INSERT INTO CSM_CONFIGURATION_PROPS (PROPERTY_KEY, PROPERTY_VALUE) VALUES('PASSWORD_PATTERN_DESCRIPTION','At least one Upper case Alphabet, at least one lowercase, at least one number and minimum 8 characters length')
/
COMMIT
/
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.