blob_id stringlengths 40 40 | language stringclasses 1
value | repo_name stringlengths 5 133 | path stringlengths 3 276 | src_encoding stringclasses 33
values | length_bytes int64 23 9.61M | score float64 2.52 5.28 | int_score int64 3 5 | detected_licenses listlengths 0 44 | license_type stringclasses 2
values | text stringlengths 23 9.43M | download_success bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|
618bd24e0b0de6198c59de59a328f72b57a9295d | SQL | EderLukas/Portfolio | /SQL_MariaDB/some_queries.sql | UTF-8 | 2,705 | 3.609375 | 4 | [
"MIT"
] | permissive | /*Aufg 4 a-c*/
SELECT mabt_fk AS 'Abt-Nr.'
FROM mitarbeiter;
SELECT mabt_fk AS 'Abt-Nr',
mname AS 'Mitarbeiter',
mfunktion AS 'Funktion'
FROM mitarbeiter;
SELECT mabt_fk AS 'Abt-Nr.',
mname AS 'Mitarbeiter',
mlohn AS 'Lohn'
FROM mitarbeiter
ORDER BY mabt_fk ASC, Lohn DESC;
/*Aufg 5 a-d*/
SELECT mname AS 'Name',
mfunktion AS 'Funktion',
mlohn AS 'Lohn'
FROM mitarbeiter
WHERE mfunktion='Vorsitz VR' AND mlohn > 1400.00;
SELECT mname AS 'Name',
mfunktion AS 'Funktion',
mlohn AS 'Lohn'
FROM mitarbeiter
WHERE mfunktion = 'Vorsitz VR' OR mfunktion = 'Sachbearbeiter'
AND mlohn > 1400;
SELECT mname AS 'Mitarbeiter',
mfunktion AS 'Funktion',
mabt_fk AS 'Abt.-Nr.',
meintritt AS 'Eintritt'
FROM mitarbeiter
WHERE meintritt BETWEEN '1997-12-01' AND '1998-05-31'
ORDER BY meintritt DESC;
SELECT mname AS 'Name',
mabt_fk AS 'Abt.-Nr.',
mlohn*12 AS 'Total Bezug'
FROM mitarbeiter
WHERE mlohn*12 < 20000.00
AND mabt_fk BETWEEN 10 AND 20
ORDER BY mlohn*12 DESC;
/*Aufg 6 a bis d*/
SELECT mname AS 'Name',
(mlohn*12)+100 AS 'Jahreslohn'
FROM mitarbeiter
ORDER BY (mlohn*12)+100 DESC;
SELECT mname AS 'Name',
TRUNCATE(mlohn + 100, 0) AS 'Monatslohn + 100',
TRUNCATE((mlohn+100)*12, 0) AS 'Jahreslohn + 100 pro Monat'
FROM mitarbeiter
WHERE TRUNCATE((mlohn+100)*12, 0) BETWEEN 15000 AND 20000
ORDER BY TRUNCATE((mlohn+100)*12, 0) DESC;
SELECT mname AS 'Name',
mlohn AS 'Monatslohn',
mlohn+mprov AS 'Monatslohn + Provision'
FROM mitarbeiter
WHERE mabt_fk = 30
ORDER BY mlohn+mprov DESC;
SELECT mname AS 'Name',
mlohn*12 AS 'Jahreslohn',
CASE WHEN mprov IS NULL THEN TRUNCATE((12*mlohn)+0,0)
ELSE truncate((12*mlohn)+mprov, 0) END AS 'Jahreslohn + Provision'
FROM mitarbeiter
ORDER BY mlohn+mprov DESC;
SELECT mname AS 'Mitarbeiter',
mlohn AS 'Monatslohn',
TRUNCATE(mlohn/12, 0) AS '1/12 Monatslohn',
TRUNCATE(mlohn%12, 2) AS 'Rest der Division'
FROM mitarbeiter;
/*Aufg 7 a bis g*/
/*____________*/
/*Aufg 8 a bis d*/
SELECT mabt_fk AS 'Abt.-Nr.',
mname AS 'Name',
MAX(mlohn) AS 'hoechster Lohn'
FROM mitarbeiter
GROUP BY mabt_fk
ORDER BY mabt_fk;
SELECT mabt_fk AS 'Abt.-Nr.',
mname AS 'Name',
MAX(mlohn) AS 'hoechster Lohn',
ROUND(AVG(mlohn), 2) AS 'Durchschnittslohn',
COUNT(mname) AS 'Anzahl Mitarbeiter'
FROM mitarbeiter
GROUP BY mabt_fk
ORDER BY mabt_fk;
SELECT mabt_fk AS 'Abteilung',
CASE WHEN mprov IS NULL THEN "keine Provision"
ELSE COUNT(mprov) END AS 'Provision'
FROM mitarbeiter
GROUP BY mabt_fk;
SELECT
CASE WHEN SUM(12*mlohn)+SUM(mprov) IS NULL THEN SUM((12*mlohn)+0)
ELSE SUM(12*mlohn)+SUM(mprov) END AS 'Lohnsumme alle'
FROM mitarbeiter; | true |
63be30fb0341d924fc18d75ef1197a50b04663d5 | SQL | CarlosTenorio/Triviadisimos | /bdtriviadisimos.sql | UTF-8 | 45,399 | 3.4375 | 3 | [] | no_license | --
-- Base de datos: `bdtriviadisimos`
--
CREATE DATABASE IF NOT EXISTS `bdtriviadisimos`;
USE `bdtriviadisimos`;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `categoria`
--
CREATE TABLE IF NOT EXISTS `categoria` (
`ID_Categoria` int(15) NOT NULL,
`ID_Mundo` int(15) NOT NULL,
`Nombre_Categoria` varchar(50) COLLATE utf8_spanish_ci NOT NULL
) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=utf8 COLLATE=utf8_spanish_ci;
--
-- Volcado de datos para la tabla `categoria`
--
INSERT INTO `categoria` (`ID_Categoria`, `ID_Mundo`, `Nombre_Categoria`) VALUES
(1, 1, 'Ciencia'),
(2, 1, 'Historia'),
(3, 1, 'Arte y literatura'),
(4, 1, 'Espectáculos'),
(5, 1, 'Deportes'),
(6, 1, 'Geografía'),
(7, 2, 'Maravilloso mundo de Disney'),
(8, 2, 'Monstruos y villanos'),
(9, 2, 'Héroes y heroínas'),
(10, 2, 'Lugares y objetos'),
(11, 2, 'Estrellas secundarias'),
(12, 2, 'Había una vez');
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `estadistica`
--
CREATE TABLE IF NOT EXISTS `estadistica` (
`ID_Jugador` int(15) NOT NULL,
`ID_Categoria` int(15) NOT NULL,
`Numero_Acertadas` int(15) NOT NULL,
`Numero_Falladas` int(15) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_spanish_ci;
--
-- Volcado de datos para la tabla `estadistica`
--
INSERT INTO `estadistica` (`ID_Jugador`, `ID_Categoria`, `Numero_Acertadas`, `Numero_Falladas`) VALUES
(2, 1, 1, 1),
(2, 2, 1, 1),
(2, 3, 2, 0),
(2, 4, 1, 0),
(2, 5, 3, 0),
(2, 6, 4, 3),
(2, 7, 3, 0),
(2, 8, 2, 0),
(2, 9, 1, 0),
(2, 10, 2, 0),
(2, 11, 1, 0),
(2, 12, 1, 0),
(4, 2, 1, 3),
(4, 3, 0, 1),
(4, 4, 1, 1),
(4, 6, 0, 1),
(4, 7, 0, 1),
(4, 8, 3, 0),
(4, 9, 1, 1),
(4, 10, 2, 0),
(4, 11, 1, 0);
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `intervencion`
--
CREATE TABLE IF NOT EXISTS `intervencion` (
`Acertada` int(1) NOT NULL COMMENT 'Si(1) / No(0)',
`ID_Participacion` int(15) NOT NULL,
`ID_Pregunta` int(15) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_spanish_ci;
--
-- Volcado de datos para la tabla `intervencion`
--
INSERT INTO `intervencion` (`Acertada`, `ID_Participacion`, `ID_Pregunta`) VALUES
(0, 41, 13),
(1, 46, 33),
(1, 46, 89),
(1, 46, 90),
(0, 46, 87),
(1, 43, 139),
(1, 43, 165),
(0, 43, 121),
(1, 47, 69),
(1, 47, 119),
(1, 47, 142),
(1, 47, 153),
(1, 47, 170),
(1, 47, 171),
(1, 47, 151),
(1, 47, 147),
(1, 47, 153),
(1, 47, 98),
(0, 41, 111),
(0, 42, 86),
(0, 46, 85),
(1, 48, 12),
(0, 48, 87),
(1, 41, 111),
(0, 41, 114),
(0, 42, 110),
(1, 46, 81),
(1, 46, 41),
(1, 46, 53),
(1, 46, 108),
(1, 46, 85),
(1, 46, 3),
(0, 46, 26),
(1, 44, 177),
(1, 44, 66),
(1, 44, 144),
(1, 44, 123),
(1, 44, 166),
(0, 44, 162),
(0, 48, 117),
(1, 41, 57),
(0, 41, 50),
(1, 46, 32),
(1, 46, 31);
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `jugador`
--
CREATE TABLE IF NOT EXISTS `jugador` (
`ID_Jugador` int(15) NOT NULL,
`Nick` varchar(50) COLLATE utf8_spanish_ci NOT NULL,
`Nombre` varchar(50) COLLATE utf8_spanish_ci NOT NULL,
`Apellidos` varchar(50) COLLATE utf8_spanish_ci NOT NULL,
`Contraseña` varchar(50) COLLATE utf8_spanish_ci NOT NULL,
`Email` varchar(50) COLLATE utf8_spanish_ci NOT NULL,
`URL_ImagenJugador` varchar(255) COLLATE utf8_spanish_ci NOT NULL,
`Partidas_Ganadas` int(15) NOT NULL,
`Partidas_Perdidas` int(15) NOT NULL,
`ID_Privilegio` int(15) NOT NULL DEFAULT '2',
`ID_Nivel` int(15) NOT NULL DEFAULT '4'
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8 COLLATE=utf8_spanish_ci;
--
-- Volcado de datos para la tabla `jugador`
--
INSERT INTO `jugador` (`ID_Jugador`, `Nick`, `Nombre`, `Apellidos`, `Contraseña`, `Email`, `URL_ImagenJugador`, `Partidas_Ganadas`, `Partidas_Perdidas`, `ID_Privilegio`, `ID_Nivel`) VALUES
(1, 'Carlos342', 'Carlos', 'Tenorio Pérez', 'carlos', 'carlos342@gmail.com', 'Carlos342', 0, 0, 1, 4),
(2, 'joan', 'joan', 'martin', 'hola', 'joan@hotmail.com', 'joan', 2, 0, 1, 4),
(3, 'Espe22', 'Espe', 'espe', 'jaja', 'jaja@hotmail.com', 'Espe22', 0, 0, 2, 4),
(4, 'paco', 'paquito', 'guti', 'paquito', 'pacopaco@gmail.com', 'paco', 0, 2, 2, 4);
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `mundo`
--
CREATE TABLE IF NOT EXISTS `mundo` (
`ID_Mundo` int(15) NOT NULL,
`Nombre_Mundo` varchar(50) COLLATE utf8_spanish_ci NOT NULL,
`URL_ImagenMundo` varchar(255) COLLATE utf8_spanish_ci NOT NULL
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 COLLATE=utf8_spanish_ci;
--
-- Volcado de datos para la tabla `mundo`
--
INSERT INTO `mundo` (`ID_Mundo`, `Nombre_Mundo`, `URL_ImagenMundo`) VALUES
(1, 'Normal', '/mundoNormal.png'),
(2, 'Disney', '/mundoDisney.png');
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `nivel`
--
CREATE TABLE IF NOT EXISTS `nivel` (
`ID_Nivel` int(15) NOT NULL,
`Tipo_Nivel` varchar(50) COLLATE utf8_spanish_ci NOT NULL,
`URL_Imagen` varchar(255) COLLATE utf8_spanish_ci NOT NULL
) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8 COLLATE=utf8_spanish_ci;
--
-- Volcado de datos para la tabla `nivel`
--
INSERT INTO `nivel` (`ID_Nivel`, `Tipo_Nivel`, `URL_Imagen`) VALUES
(1, 'Maestro', 'Maestro.png'),
(2, 'Crack', 'Crack.png'),
(3, 'Figura', 'Figura.png'),
(4, 'Principiante', 'Principiante.png'),
(5, 'Fantasma', 'Fantasma.png'),
(6, 'Débil', 'Débil.png'),
(7, 'Siguiente', 'Siguiente.png');
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `participacion`
--
CREATE TABLE IF NOT EXISTS `participacion` (
`ID_Participacion` int(15) NOT NULL,
`ID_Jugador` int(15) NOT NULL,
`ID_Partida` int(15) NOT NULL,
`Turno` int(1) NOT NULL
) ENGINE=InnoDB AUTO_INCREMENT=52 DEFAULT CHARSET=utf8 COLLATE=utf8_spanish_ci;
--
-- Volcado de datos para la tabla `participacion`
--
INSERT INTO `participacion` (`ID_Participacion`, `ID_Jugador`, `ID_Partida`, `Turno`) VALUES
(41, 4, 23, 0),
(42, 4, 24, 1),
(43, 4, 25, 0),
(44, 4, 26, 0),
(45, 4, 27, 1),
(46, 2, 23, 1),
(47, 2, 25, 1),
(48, 2, 24, 0),
(49, 3, 27, 0),
(50, 3, 26, 1),
(51, 2, 28, 1);
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `partida`
--
CREATE TABLE IF NOT EXISTS `partida` (
`ID_Partida` int(15) NOT NULL,
`Fecha_Inicio` timestamp NULL DEFAULT NULL,
`Fecha_Final` timestamp NULL DEFAULT NULL,
`Estado_Partida` enum('En espera','Iniciada','Finalizada') COLLATE utf8_spanish_ci NOT NULL,
`ID_Mundo` int(15) NOT NULL
) ENGINE=InnoDB AUTO_INCREMENT=29 DEFAULT CHARSET=utf8 COLLATE=utf8_spanish_ci;
--
-- Volcado de datos para la tabla `partida`
--
INSERT INTO `partida` (`ID_Partida`, `Fecha_Inicio`, `Fecha_Final`, `Estado_Partida`, `ID_Mundo`) VALUES
(23, '2016-01-15 15:40:16', '2016-01-15 16:03:55', 'Finalizada', 1),
(24, '2016-01-15 15:40:22', NULL, 'Iniciada', 1),
(25, '2016-01-15 15:40:19', '2016-01-15 15:43:40', 'Finalizada', 2),
(26, '2016-01-15 15:48:25', NULL, 'Iniciada', 2),
(27, '2016-01-15 15:48:23', NULL, 'Iniciada', 1),
(28, NULL, NULL, 'En espera', 1);
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `pregunta`
--
CREATE TABLE IF NOT EXISTS `pregunta` (
`ID_Pregunta` int(15) NOT NULL,
`Text_Pregunta` varchar(255) COLLATE utf8_spanish_ci NOT NULL,
`ID_Categoria` int(15) NOT NULL
) ENGINE=InnoDB AUTO_INCREMENT=180 DEFAULT CHARSET=utf8 COLLATE=utf8_spanish_ci;
--
-- Volcado de datos para la tabla `pregunta`
--
INSERT INTO `pregunta` (`ID_Pregunta`, `Text_Pregunta`, `ID_Categoria`) VALUES
(1, '¿A quién era atribuido "El coloso"?', 3),
(2, '¿A qué estilo pertenecen San Salvador de Valdediós y San Miguel de Lillo?', 3),
(3, '¿En qué destacó Filippo Brunelleschi?', 3),
(4, 'Autor de: El rapto de Proserpina', 3),
(5, 'Autor de: El sueño de Jacob.', 3),
(6, 'Autor de: El teatro de máscaras.', 3),
(7, 'Autor de: Tres mendigos.', 3),
(8, '(El Señor de los Anillos) ¿Cuál fue el último cumpleaños que celebró Bilbo Bolsón en Bolsón Cerrado?', 3),
(9, '(Siglo XIV) Autor: "África", poema épico sobre Escipión (Escrita en latín)', 3),
(10, '¿A qué edad escribió Carmen Laforet "Nada"?', 3),
(11, '¿A qué edad murió el poeta gaditano Rafael Alberti?', 3),
(12, '¿A qué época pertenece la literatura de la escolástica?', 3),
(13, '¿A qué generación literaria perteneció Valle-Inclán?', 3),
(14, '¿A qué movimiento literario pertenece Góngora?', 3),
(15, '¿A qué movimiento literario pertenece Quevedo?', 3),
(16, 'Conjunto de polvo, gas y estrellas de miles de parsecs de diámetro', 1),
(17, 'Derivada de 100', 1),
(18, 'Filósofo griego fundador de la filosofía científica', 1),
(19, 'Inventor del pararrayos', 1),
(20, 'Número siguiente a la sucesión: 1-1-2-3-5-8-13', 1),
(21, '¿En qué mes se produce el equinoccio de primavera?', 1),
(22, '¿Qué planeta del Sistema Solar es el cuarto más cercano al Sol?', 1),
(23, '¿Qué fenómeno atmosférico es el que se produce más frecuentemente en la Luna?', 1),
(24, 'Un circuito boost es un...', 1),
(25, 'En la elección de muestras, ¿a qué se le llama N', 1),
(26, 'Acabado que se da a los papeles brillantes secándolos en contacto con una superficie cromada muy pulida y por lo general caliente.', 1),
(27, '¿A cuántos años-luz equivalen un parsec?', 1),
(28, '¿A cuántos grados centígrados está el núcleo del Sol?', 1),
(29, '¿A cuántos grados Kelvin corresponden 0 grados centigrados?', 1),
(30, '¿A cuántos metros del suelo debe situarse una gárita meteorológica para que puedan ser homologadas sus mediciones?', 1),
(31, '¿Quién dijo "se puede aprender mucho de la Tierra mirándola desde el espacio"?', 1),
(32, '¿Quién ganó el trofeo Zamora en la temporada 1986/87?', 5),
(33, '¿A qué jugador del Madrid partió por la mitad Romario con su regate de cola de vaca?', 5),
(34, '¿A qué ciclista español le llamaron El Extraterrestre?', 5),
(35, '¿A qué ciudad se marchó Ronaldo tras dejar el Barcelona?', 5),
(36, '¿A qué corresponden las siglas ATP?', 5),
(37, '¿A qué deporte jugaban en el Mar Valencia cuando se nacionalizaron Vera Samoilova y Natalia Morskova?', 5),
(38, '¿A qué equipo de rugby se les llama los Springboks?', 5),
(39, '¿A qué equipo del fútbol argentino lo llaman "Cuervos"?', 5),
(40, '¿A qué equipo del fútbol argentino lo llaman "El Fortin"?', 5),
(41, '¿A qué equipo francés se marcharon Arteta y De Lucas?', 5),
(42, '¿A qué equipo marchó Paulo Futre después del Atlético de Madrid?', 5),
(43, '¿A qué equipo metió Ronaldo su primer gol después de su desafortunada lesión (Temp. 2001/02)?', 5),
(44, '¿A qué herramienta sustituyó la "shistera" en algunos juegos de pelota?', 5),
(45, '¿A qué llamaban gambeteo los futbolistas argentinos?', 5),
(46, '¿A qué otro deporte es aficionado Michael Jordan?', 5),
(47, '¿Cómo se llama la película dirigida por Kubrick ambientada en la I Guerra Mundial?', 4),
(48, '¿Cómo se llama la primera película de Harry Potter?', 4),
(49, '¿En qué película Julia Roberts ejerce la profesión "más antigua del mundo"?', 4),
(50, 'Completa el nombre: Polanski y...', 4),
(51, 'Ian McCulloch fue vocalista de?', 4),
(52, '¿A qué grupo pertenecía Nacho Goberna?', 4),
(53, '¿A qué cantante acompañaban Los Trogloditas?', 4),
(54, '¿A qué cantante le llamaron "la voz de la generación X"?', 4),
(55, '¿A qué ciudad española dedicó Joaquín Rodrigo su famoso concierto?', 4),
(56, '¿A qué compositor está dedicada la Marcha Fúnebre inserta en el segundo movimiento de la Sinfonía nº 7 de Anton Bruckner (1883), fallecido mientras este la componía?', 4),
(57, 'A qué corresponden las iniciales B. B. de B. B. King?', 4),
(58, '¿A qué edad comenzó con la música Stevie Wonder?', 4),
(59, '¿A qué edad falleció Bob Marley?', 4),
(60, '¿A qué edad falleció Elvis Presley?', 4),
(61, '¿A qué grado de la escala nos referimos si hablamos de una dominante?', 4),
(62, '¿A qué grupo asociarías "Quadrophenia"?', 4),
(63, '¿Qué clase de animales son Reina, Princesa y Duquesa?', 11),
(64, '¿Cuál es el único enanito al que solo se le oye cuando llora y estornuda?', 11),
(65, '¿A quién llama Peter Pan "Bacalao"?', 11),
(66, '¿Quién cambia de forma constantemente debido a que las partes de su cuerpo son móviles?', 11),
(67, '¿De qué se da cuenta Buzz Lightyear cuando ve un anuncio de televión?', 11),
(68, '¿Quién canta "Qué festín"?', 11),
(69, '¿Qué clase de animal es Diana, la mascota de Alicia?', 11),
(70, '¿Qué estaba persiguiendo Dama cuando fue atrapada por el perrero?', 11),
(71, '¿Para qué han ido a África Jane y el profesor Porter?', 11),
(72, '¿Qué es Filoctetes?', 11),
(73, '¿De qué clase de pájaro proviene la pluma "mágica"?', 11),
(74, '¿Quién es el mejor amigo de Abu?', 11),
(75, '¿Qué clase de animal es la mascota de Merlín?', 11),
(76, '¿Para quién firma Timoteo un contrato en Hollywood?', 11),
(77, '¿Qué clase de animal desea Ratigan que piense la gente que es?', 11),
(78, '¡¡¡Vacaciones en Polinesia!!! ¿En qué continente estoy?', 6),
(79, '¿A cuántos países pertenece la selva del Amazonas?', 6),
(80, '¿A dónde llegó el explorador noruego Roald Amundsen en 1911?', 6),
(81, '¿A cuántos kilómetros de Madrid se encuentra la ciudad de Móstoles?', 6),
(82, '¿A cuántos metros sobre el nivel del mar (aproximandamente) está situada la ciudad de Zamora?', 6),
(83, '¿A qué archipiélago pertenece la isla Alegranza?', 6),
(84, '¿A qué archipiélago pertenecen Java, Bali, Timor y las Molucas, entre otras?', 6),
(85, '¿A qué comunidad pertenece el pantano de Tanes?', 6),
(86, '¿A qué continente llegó por primera vez en 1831 el inglés John Biscoe?', 6),
(87, '¿A qué desértico estado norteamericano pertenece la ciudad de Casa Grande?', 6),
(88, '¿A qué dos países pertenece la isla Grande Tierra del Fuego?', 6),
(89, '¿A qué estado de EE.UU. corresponden las siglas ME?', 6),
(90, '¿A qué estado pertenece la ciudad de Eilat junto al mar Rojo?', 6),
(91, 'En Pocahontas, ¿a quién se agarra Miko para poder realizar su gran salto?', 12),
(92, 'En la Bella Durmiente, ¿cómo despierta el principe a la princesa?', 12),
(93, '¿Por qué tiene celos de Blancanieves la Malvada Reina?', 12),
(94, '¿Quién es el amor de Lady Marian?', 12),
(95, '¿De qué color es el pelo de Cruella?', 12),
(96, '¿Cuál fue la primera película en la que participó Buzz Lightyear?', 12),
(97, '¿Qué clase de arma utiliza Tarzán?', 12),
(98, '¿Cuál es el nombre del grupo de mujeres que canta en Hércules?', 12),
(99, '¿Qué ven Dumbo y Timoteo después de beber demasiado champán?', 12),
(100, '¿Cuál es el nombre de la familia de Mulán?', 12),
(101, '¿Quién convierte a Abu en un elefante?', 12),
(102, '¿Qué personaje narra la historia en "El libro de la Selva"?', 12),
(103, '¿Debajo de qué tipo de planta se besan Woody y Betty?', 12),
(104, '¿Qué cualidad conserva Hércules cuando se convierte en humano?', 12),
(105, '¿Cómo se llama el oso protagonista de "El libro de la Selva"?', 12),
(106, '¿A dónde fueron deportados los judíos tras la conquista de Jerusalén por Nabucodonosor?', 2),
(107, '¿A dónde se traslada la Casa de la Contratación en 1717 desde Sevilla?', 2),
(108, '¿A qué ciudad actual corresponde la romana Gades?', 2),
(109, '¿Qué faraón murió en el año 1325 a.C.?', 2),
(110, '¿A favor de qué pretendiente a la corona se puso la nobleza española durante la guerra de Sucesión?', 2),
(111, '¿A la muerte de qué emperador el archiduque Carlos heredó el trono de Austria', 2),
(112, '¿A principios de qué siglo tuvo lugar el reinado de Nabucodonosor II?', 2),
(113, '¿A qué bando se unió Asturias cuando se produjo el levantamiento con el que comienza la Guerra Civil?', 2),
(114, 'A qué ciudad actual corresponde la antigua Mainake (griega)?', 2),
(115, '¿A qué ciudad actual corresponde la romana Gades?', 2),
(116, '¿A qué cultura pertenece el yacimiento de Toscanos?', 2),
(117, '¿A qué dinastía pertenece la esfinge de Gizeh?', 2),
(118, '¿A qué dinastía perteneció Isabel I de Inglaterra?', 2),
(119, '¿Qué le gusta a Miko?', 9),
(120, '¿Cuántos años cumple la Princesa cuando el Hada Buena prepara su fiesta de cumpleaños?', 9),
(121, '¿A qué enanito le obligan a lavarse las manos antes de comer?', 9),
(122, '¿Quién salva a Peter Pan de la bomba del Capitán Garfio?', 9),
(123, '¿Qué clase de animal es la mascota de Yasmín, Rajá?', 9),
(124, '¿Quién intenta rescatar a Buzz del juego de la grúa?', 9),
(125, '¿Por quién se cambia Bella como prisionera en el castillo de Bestia?', 9),
(126, '¿Qué lleva puesto Hércules para que Afrodita crea que puede ser un dios?', 9),
(127, '¿Dónde escribe Mulán algunas notas de su visita a la casamentera?', 9),
(128, '¿Qué tiene Hades en lugar de pelo?', 9),
(129, '¿Qué objeto perteneciente a Penny fue encontrado en la tienda de Madame Medusa?', 9),
(130, '¿Qué intenta robar Aby, y casi provoca que él y Aladdín queden atrapados en la cueva?', 9),
(131, '¿En qué criatura del mar se convierte Merlín cuando Madam Mim se transforma en una serpiente?', 9),
(132, '¿De qué cosa tiene miedo Khan?', 9),
(133, '¿Quién tiene un ama de llaves llamada Carlotta?', 9),
(134, '¿Qué sacan de la mina los enanitos de Blancanieves?', 10),
(135, '¿Qué busca Peter Pan en casa de los Darling?', 10),
(136, 'En Aladdín, ¿cuál es el nombre de la hija del Sultán?', 10),
(137, 'En Toy Story, ¿qué es Hamm?', 10),
(138, '¿Qué clase de gato es el de "Alicia en el país de las maravillas"?', 10),
(139, '¿Qué clase de perro es Dama?', 10),
(140, '¿A quién entrena Filoctetes para que se convierta en estrella?', 10),
(141, '¿Qué nombre recive el perro de Mulán?', 10),
(142, '¿Quién se transforma en elefante en "Aladdín"?', 10),
(143, '¿Cuál es la parte de Kaa que cambia de color cuando hipnotiza Mowgli?', 10),
(144, '¿En qué película se conocen Úrsula y el Rey Tritón?', 10),
(145, '¿A qué héroe intenta destruir Hades?', 10),
(146, '¿Con qué animales baila Baloo "Quiero ser como tú"?', 10),
(147, '¿En que se convierte Madam Mim rompiendo sus propias reglas del juego?', 10),
(148, '¿En qué estación del año está de caza Amos Slade?', 10),
(149, '¿Cuál es el nombre del pájaro amigo de Pocahontas?', 7),
(150, '¿Qué cambia constantemente de color a medida que el Principe y la Princesa bailan al final de la película?', 7),
(151, '¿A qué considera Cruela de Vil su "único y verdadero amor"?', 7),
(152, '¿Cuál es el único de los 7 enanitos que no tiene barba?', 7),
(153, '¿A quién castiga Peter Pan por ser malvada?', 7),
(154, 'Según Buzz Lightyear, ¿quiénes están intentando contactar con él?', 7),
(155, '¿Cómo se llama el padre de Bella?', 7),
(156, '¿A quién hace tropezar el Gato de los Deseos mientras esta haciendo trampas jugando al croquet?', 7),
(157, '¿De qué raza son los gatos que tía Sara lleva con ella?', 7),
(158, '¿Qué clase de animal es Tantor?', 7),
(159, '¿Cómo se aparece el dios Zeus en la tierra?', 7),
(160, '¿Qué animales celebran sus reuniones en la Roca del Consejo?', 7),
(161, '¿A quién pertenece la voz que roba Úrsula?', 7),
(162, '¿En casa de quién entra Grillo para escapar del halcón?', 7),
(163, '¿Cuál es el animal cuya forma tiene el trono del Sultán?', 7),
(164, 'En Pocahontas, ¿qué clase de animal es Miko?', 8),
(165, '¿Cómo se llama el Principe de la Bella Durmiente?', 8),
(166, '¿Cómo se llama el enanito que usa gafas?', 8),
(167, '¿Cómo se llama la luminosa amiga de Peter Pan?', 8),
(168, '¿Qué canción cantan Aladdín y Yasmín sobre la alfombra mágica?', 8),
(169, '¿Qué celebra Andy cuando le regalan a Buzz?', 8),
(170, 'Según Gastón, ¿qué debe hacer Bella para liberar a su padre?', 8),
(171, '¿Cuál es la última parte en desaparecer de todo el cuerpo de El Gato de los Deseos?', 8),
(172, '¿Cuántos cachorros tienen Dama y Vagabundo?', 8),
(173, '¿A quién lleva Timoteo a ver a Dumbo cuando necesita cariño?', 8),
(174, '¿Quél personaje llega al palacio del Sultán montado en un elefante?', 8),
(175, '¿Dónde se encuentra Grillo por primera vez con Merlín?', 8),
(176, '¿Qué es Shere Khan?', 8),
(177, '¿De qué color es la pluma de Dumbo?', 8),
(178, '¿A quién llama Bagheera "holgazán de la selva"?', 8),
(179, '¿De quién es el disco "Mind Games"?', 4);
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `privilegio`
--
CREATE TABLE IF NOT EXISTS `privilegio` (
`ID_Privilegio` int(15) NOT NULL,
`Tipo_Privilegio` varchar(50) COLLATE utf8_spanish_ci NOT NULL
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 COLLATE=utf8_spanish_ci;
--
-- Volcado de datos para la tabla `privilegio`
--
INSERT INTO `privilegio` (`ID_Privilegio`, `Tipo_Privilegio`) VALUES
(1, 'admin'),
(2, 'user');
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `respuesta`
--
CREATE TABLE IF NOT EXISTS `respuesta` (
`ID_Respuesta` int(15) NOT NULL,
`ID_Pregunta` int(15) NOT NULL,
`Texto_Respuesta` varchar(255) COLLATE utf8_spanish_ci NOT NULL,
`Correcta` int(15) NOT NULL COMMENT 'SI(1) / NO (0)'
) ENGINE=InnoDB AUTO_INCREMENT=717 DEFAULT CHARSET=utf8 COLLATE=utf8_spanish_ci;
--
-- Volcado de datos para la tabla `respuesta`
--
INSERT INTO `respuesta` (`ID_Respuesta`, `ID_Pregunta`, `Texto_Respuesta`, `Correcta`) VALUES
(1, 1, 'Francisco de Goya', 1),
(2, 1, 'Pablo Picasso', 0),
(3, 1, 'José Domínguez Bécquer', 0),
(4, 1, 'Federico Madrazo', 0),
(5, 2, 'Prerrománico', 1),
(6, 2, 'Románico', 0),
(7, 2, 'Gótico', 0),
(8, 2, 'Islámico', 0),
(9, 3, 'Arquitectura', 1),
(10, 3, 'Pintura', 0),
(11, 3, 'Música', 0),
(12, 3, 'Escritura', 0),
(13, 4, 'Petrus Paulus Rubens', 1),
(14, 4, 'Andre Derain', 0),
(15, 4, 'Goya', 0),
(16, 4, 'Pieter Brueguel', 0),
(17, 5, 'Josep de Ribera', 1),
(18, 5, 'Petrus Paulus Rubens', 0),
(19, 5, 'Goya', 0),
(20, 5, 'Pieter Brueguel', 0),
(21, 6, 'James Ensor', 1),
(22, 6, 'Petrus Paulus Rubens', 0),
(23, 6, 'Goya', 0),
(24, 6, 'Pieter Brueguel', 0),
(25, 7, 'Giacomo Ceruti', 1),
(26, 7, 'Goya', 0),
(27, 7, 'Lucio Fontana', 0),
(28, 7, 'Tiziano', 0),
(29, 8, 'Centesimodecimoprimero', 1),
(30, 8, 'Centesimodecimosegundorimero', 0),
(31, 8, 'Centesimodecimotercero', 0),
(32, 8, 'Centesimodecimocuarto', 0),
(33, 9, 'Petrarca', 1),
(34, 9, 'Giovanni Boccaccio', 0),
(35, 9, 'Alfonso IV', 0),
(36, 9, 'Aguilar', 0),
(37, 10, '23', 1),
(38, 10, '58', 0),
(39, 10, '63', 0),
(40, 10, '74', 0),
(41, 11, '96', 1),
(42, 11, '45', 0),
(43, 11, '50', 0),
(44, 11, '47', 0),
(45, 12, 'Baja Edad Media', 1),
(46, 12, 'Griega', 0),
(47, 12, 'Romana', 0),
(48, 12, 'Egipcia', 0),
(49, 13, 'Del 98', 1),
(50, 13, 'Del 27', 0),
(51, 13, 'Del 52', 0),
(52, 13, 'Del 36', 0),
(53, 14, 'Barroco', 1),
(54, 14, 'Romanticismo', 0),
(55, 14, 'Impresionismo', 0),
(56, 14, 'Ilustrismo', 0),
(57, 15, 'Barroco', 1),
(58, 15, 'Romanticismo', 0),
(59, 15, 'Impresionismo', 0),
(60, 15, 'Ilustrismo', 0),
(61, 16, 'Galaxia', 1),
(62, 16, 'Sistema solar', 0),
(63, 16, 'Cinturón de asteroides', 0),
(64, 16, 'Nebulosa', 0),
(65, 17, '0', 1),
(66, 17, 'x', 0),
(67, 17, '10', 0),
(68, 17, '-1', 0),
(69, 18, 'Aristóteles', 1),
(70, 18, 'Platón', 0),
(71, 18, 'Kant', 0),
(72, 18, 'Sócrates', 0),
(73, 19, 'Benjamin Franklin', 1),
(74, 19, 'Isaac Newton', 0),
(75, 19, 'Albert Einstein', 0),
(76, 19, 'Nikola Tesla', 0),
(77, 20, '21', 1),
(78, 20, '13', 0),
(79, 20, '14', 0),
(80, 20, '16', 0),
(81, 21, 'Marzo', 1),
(82, 21, 'Abril', 0),
(83, 21, 'Mayo', 0),
(84, 21, 'Diciembre', 0),
(85, 22, 'Marte', 1),
(86, 22, 'La Tierra', 0),
(87, 22, 'Júpiter', 0),
(88, 22, 'Mercurio', 0),
(89, 23, 'Ninguno', 1),
(90, 23, 'Viento', 0),
(91, 23, 'Lluvia', 0),
(92, 23, 'Colisión de meteoritos', 0),
(93, 24, 'Elevador', 1),
(94, 24, 'Microondas', 0),
(95, 24, 'Rampa', 0),
(96, 24, 'Resistencia', 0),
(97, 25, 'Total Poblacional', 1),
(98, 25, 'El conjunto activo', 0),
(99, 25, 'La moda', 0),
(100, 25, 'Ninguna de las otras', 0),
(101, 26, 'Esmaltado', 1),
(102, 26, 'Alumbrado', 0),
(103, 26, 'Abrillantado', 0),
(104, 26, 'Coso', 0),
(105, 27, '3,26', 1),
(106, 27, '5', 0),
(107, 27, '8,2', 0),
(108, 27, '91', 0),
(109, 28, '40000000', 1),
(110, 28, '2000', 0),
(111, 28, '50005', 0),
(112, 28, '8888878', 0),
(113, 29, '273', 1),
(114, 29, '372', 0),
(115, 29, '384', 0),
(116, 29, '33', 0),
(117, 30, '1,5', 1),
(118, 30, '5', 0),
(119, 30, '25', 0),
(120, 30, '3,3', 0),
(121, 31, 'Carl Sagan', 1),
(122, 31, 'Stephen Hawking', 0),
(123, 31, 'Neil Amstrong', 0),
(124, 31, 'Buzz Aldrin', 0),
(125, 32, 'Andoni Zubizarreta', 1),
(126, 32, 'Juan Carlos Ablanedo', 0),
(127, 32, 'Paco Buyo', 0),
(128, 32, 'Abel Resino', 0),
(129, 33, 'Rafael Alkorta', 1),
(130, 33, 'Sergio Ramos', 0),
(131, 33, 'Fernando Hierro', 0),
(132, 33, 'Mikel Goikoetxea', 0),
(133, 34, 'Miguel Indurain', 1),
(134, 34, 'Eddy Mercks', 0),
(135, 34, 'Alberto contador', 0),
(136, 34, 'Bernard Hinault', 0),
(137, 35, 'Milan', 1),
(138, 35, 'Paris', 0),
(139, 35, 'Portugal', 0),
(140, 35, 'Francia', 0),
(141, 36, 'Asociacion Tenistas Profesionales', 1),
(142, 36, 'Asociacion Tenistas Paralímpicos', 0),
(143, 36, 'Asociacion de tangas pequeños', 0),
(144, 36, 'Asociación de triatletas profesionales', 0),
(145, 37, 'Balonmano', 1),
(146, 37, 'Tenis', 0),
(147, 37, 'Futbol', 0),
(148, 37, 'Hockey', 0),
(149, 38, 'Sudáfrica', 1),
(150, 38, 'Reino Unido', 0),
(151, 38, 'Australia', 0),
(152, 38, 'Alemania', 0),
(153, 39, 'Club Atletico San Lorenzo de almagro', 1),
(154, 39, 'Club Atlético Boca Juniors', 0),
(155, 39, 'Club Atlético River Plate', 0),
(156, 39, 'Club Atlético Independiente', 0),
(157, 40, 'Club Atletico Velez Sarsfield', 1),
(158, 40, 'Club Atletico San Lorenzo de almagro', 0),
(159, 40, 'Club Atlético Boca Juniors', 0),
(160, 40, 'Club Atlético River Plate', 0),
(161, 41, 'Paris Saint Germain', 1),
(162, 41, 'Paris FC?', 0),
(163, 41, 'RCF Paris', 0),
(164, 41, 'Gallia Club Paris', 0),
(165, 42, 'Benfica', 1),
(166, 42, 'Fútbol Club Barcelona', 0),
(167, 42, 'Madrid', 0),
(168, 42, 'Paris Saint Germain', 0),
(169, 43, 'Brescia', 1),
(170, 43, 'Fútbol Club Barcelona', 0),
(171, 43, 'Madrid', 0),
(172, 43, 'Club Atletico San Lorenzo de almagro', 0),
(173, 44, 'Guante', 1),
(174, 44, 'Carrito', 0),
(175, 44, 'Escoba', 0),
(176, 44, 'Trapo', 0),
(177, 45, 'Regate', 1),
(178, 45, 'Caño', 0),
(179, 45, 'Bicicleta', 0),
(180, 45, 'Gol', 0),
(181, 46, 'Golf', 1),
(182, 46, 'Futbol americano', 0),
(183, 46, 'VolleyBall', 0),
(184, 46, 'Natación', 0),
(185, 47, 'Senderos de gloria', 1),
(186, 47, 'La gran ilusion', 0),
(187, 47, 'El sargento York', 0),
(188, 47, 'Capitán Conan', 0),
(189, 48, 'Harry Potter y la priedra filosofal', 1),
(190, 48, 'Harry Potter', 0),
(191, 48, 'Harry Potter y la cámara secreta', 0),
(192, 48, 'Harry Potter y el cáliz de fuego', 0),
(193, 49, 'Pretty Woman', 1),
(194, 49, 'Secret in their eyes', 0),
(195, 49, 'Nothing Hill', 0),
(196, 49, 'Come, reza, ama', 0),
(197, 50, 'El ardor', 1),
(198, 50, 'La broma', 0),
(199, 50, 'La ilusión', 0),
(200, 50, 'El reto', 0),
(201, 51, 'Echo and The Bunnymen', 1),
(202, 51, 'Riot Die', 0),
(203, 51, 'Guns and Roses', 0),
(204, 51, 'Black Violets', 0),
(205, 52, 'La dama se esconde', 1),
(206, 52, 'Uno más', 0),
(207, 52, 'El perro que ladra', 0),
(208, 52, 'Viento gris', 0),
(209, 53, 'Loquillo', 1),
(210, 53, 'Fito', 0),
(211, 53, 'Manuel Carrasco', 0),
(212, 53, 'Camarón', 0),
(213, 54, 'Kurt Cobain', 1),
(214, 54, 'Elvis', 0),
(215, 54, 'Lady Gaga', 0),
(216, 54, 'Madonna', 0),
(217, 55, 'Aranjuez', 1),
(218, 55, 'Sevilla', 0),
(219, 55, 'Toledo', 0),
(220, 55, 'Palma de Mallorca', 0),
(221, 56, 'Richard Wagner', 1),
(222, 56, 'Johann Sebastian Bach', 0),
(223, 56, 'Ludwig van Beethoven', 0),
(224, 56, 'Wolfgang Amadeus Mozart', 0),
(225, 57, 'Blues Boy', 1),
(226, 57, 'Blue Baby', 0),
(227, 57, 'Baby Baby', 0),
(228, 57, 'Blue Boy', 0),
(229, 58, '10', 1),
(230, 58, '15', 0),
(231, 58, '21', 0),
(232, 58, '5', 0),
(233, 59, '36', 1),
(234, 59, '23', 0),
(235, 59, '58', 0),
(236, 59, '75', 0),
(237, 60, '42', 1),
(238, 60, '35', 0),
(239, 60, '28', 0),
(240, 60, '55', 0),
(241, 61, 'Quinto', 1),
(242, 61, 'Cuarto', 0),
(243, 61, 'Segundo', 0),
(244, 61, 'Primero', 0),
(245, 62, 'The Who', 1),
(246, 62, 'Nirvana', 0),
(247, 62, 'Queen', 0),
(248, 62, 'Guns and Roses', 0),
(249, 63, 'Vacas', 1),
(250, 63, 'Perros', 0),
(251, 63, 'Gatos', 0),
(252, 63, 'Ratones', 0),
(253, 64, 'Mudito', 1),
(254, 64, 'Gruños', 0),
(255, 64, 'Dormilón', 0),
(256, 64, 'Sabiondo', 0),
(257, 65, 'Al Capitán Garfio', 1),
(258, 65, 'A Campanilla', 0),
(259, 65, 'A Wendy', 0),
(260, 65, 'A Nibs', 0),
(261, 66, 'Sr. Patata', 1),
(262, 66, 'Sheriff Woody', 0),
(263, 66, 'Buzz Lightyear', 0),
(264, 66, 'Rex', 0),
(265, 67, 'De que es un juguete', 1),
(266, 67, 'De que es un marciano', 0),
(267, 67, 'De que no puede volar', 0),
(268, 67, 'De que es verde', 0),
(269, 68, 'Lumiere', 1),
(270, 68, 'La bella', 0),
(271, 68, 'La bestia', 0),
(272, 68, 'Gastón', 0),
(273, 69, 'Un gatito', 1),
(274, 69, 'Un conejo', 0),
(275, 69, 'Una oruga', 0),
(276, 69, 'Una liebre', 0),
(277, 70, 'Gallinas', 1),
(278, 70, 'Gatos', 0),
(279, 70, 'Ratones', 0),
(280, 70, 'Perros', 0),
(281, 71, 'Para estudiar a los gorilas', 1),
(282, 71, 'Por turismo', 0),
(283, 71, 'Para secuestrar animales', 0),
(284, 71, 'Para conocer a Tarzán', 0),
(285, 72, 'Un sátiro', 1),
(286, 72, 'Un cíclope', 0),
(287, 72, 'Una musa', 0),
(288, 72, 'Un duende', 0),
(289, 73, 'De un cuervo', 1),
(290, 73, 'De un gorrión', 0),
(291, 73, 'De un águila', 0),
(292, 73, 'De una cacatúa', 0),
(293, 74, 'Aladdín', 1),
(294, 74, 'Yasmín', 0),
(295, 74, 'El sultán', 0),
(296, 74, 'El genio', 0),
(297, 75, 'Un búho', 1),
(298, 75, 'Un pez', 0),
(299, 75, 'Un gato', 0),
(300, 75, 'Un perro', 0),
(301, 76, 'Para Dumbo', 1),
(302, 76, 'Para la madre de Dumbo', 0),
(303, 76, 'Para el cuervo Jim', 0),
(304, 76, 'Para la elefanta Giddy', 0),
(305, 77, 'Un ratón', 1),
(306, 77, 'Un perro', 0),
(307, 77, 'Un gato', 0),
(308, 77, 'Un pez', 0),
(309, 78, 'Oceanía', 1),
(310, 78, 'Europa', 0),
(311, 78, 'Asia', 0),
(312, 78, 'América', 0),
(313, 79, '8', 1),
(314, 79, '1', 0),
(315, 79, '6', 0),
(316, 79, '5', 0),
(317, 80, 'Polo Sur', 1),
(318, 80, 'Polo Norte', 0),
(319, 80, 'Australia', 0),
(320, 80, 'A la cima del Monte Everest', 0),
(321, 81, '18', 1),
(322, 81, '23', 0),
(323, 81, '125', 0),
(324, 81, '85', 0),
(325, 82, '650', 1),
(326, 82, '258', 0),
(327, 82, '350', 0),
(328, 82, '880', 0),
(329, 83, 'Islas Canarias', 1),
(330, 83, 'Islas baleares', 0),
(331, 83, 'Isla de San Martín', 0),
(332, 83, 'Isla Antigua', 0),
(333, 84, 'Indonesia', 1),
(334, 84, 'Antillas', 0),
(335, 84, 'Islas Seychelles', 0),
(336, 84, 'Islas Baleares', 0),
(337, 85, 'Asturias', 1),
(338, 85, 'Galicia', 0),
(339, 85, 'Vigo', 0),
(340, 85, 'Cuenca', 0),
(341, 86, 'Antártida', 1),
(342, 86, 'Europa', 0),
(343, 86, 'América', 0),
(344, 86, 'Oceanía', 0),
(345, 87, 'Arizona', 1),
(346, 87, 'Texas', 0),
(347, 87, 'Nueva York', 0),
(348, 87, 'Conetica', 0),
(349, 88, 'Argentina y Chile', 1),
(350, 88, 'Panama y Chile', 0),
(351, 88, 'Chile y México', 0),
(352, 88, 'Argentina y Urugay', 0),
(353, 89, 'Maine', 1),
(354, 89, 'Texas', 0),
(355, 89, 'Minesota', 0),
(356, 89, 'Cansas', 0),
(357, 90, 'Israel', 1),
(358, 90, 'España', 0),
(359, 90, 'Portugal', 0),
(360, 90, 'Egipto', 0),
(361, 91, 'A Flit', 1),
(362, 91, 'A Pocahontas', 0),
(363, 91, 'A John Smith', 0),
(364, 91, 'A la abuela Sauce', 0),
(365, 92, 'Besándola', 1),
(366, 92, 'Convirtiéndose en sapo', 0),
(367, 92, 'Matando al dragón', 0),
(368, 92, 'Regalándole un anillo', 0),
(369, 93, 'Porque es más hermosa que ella', 1),
(370, 93, 'Porque es más alta que ella', 0),
(371, 93, 'Porque es más fea que ella', 0),
(372, 93, 'Porque no le gustan las manzanas', 0),
(373, 94, 'Robin Hood', 1),
(374, 94, 'Sheriff Woody', 0),
(375, 94, 'Tarzán', 0),
(376, 94, 'Hércules', 0),
(377, 95, 'Una mitad blanco y la otra negro', 1),
(378, 95, 'Blanco', 0),
(379, 95, 'Negro', 0),
(380, 95, 'Azul', 0),
(381, 96, 'Toy Story', 1),
(382, 96, 'Toy Story 2', 0),
(383, 96, 'Toy Story 3', 0),
(384, 96, 'ET', 0),
(385, 97, 'Una lanza', 1),
(386, 97, 'Un martillo', 0),
(387, 97, 'Una pistola', 0),
(388, 97, 'Un hacha', 0),
(389, 98, 'Las Musas', 1),
(390, 98, 'Las Blueses', 0),
(391, 98, 'Las Cruisers', 0),
(392, 98, 'Las Lupis', 0),
(393, 99, 'Elefantes rosas', 1),
(394, 99, 'Perros verdes', 0),
(395, 99, 'Ratones gigantes', 0),
(396, 99, 'Gatos azules', 0),
(397, 100, 'Fa', 1),
(398, 100, 'La', 0),
(399, 100, 'Ka', 0),
(400, 100, 'Pa', 0),
(401, 101, 'El Genio', 1),
(402, 101, 'Aladdín', 0),
(403, 101, 'Yasmín', 0),
(404, 101, 'La Alfombra', 0),
(405, 102, 'Bagheera', 1),
(406, 102, 'Baloo', 0),
(407, 102, 'Mowgli', 0),
(408, 102, 'Kaa', 0),
(409, 103, 'De muérdago', 1),
(410, 103, 'De geranios', 0),
(411, 103, 'De margaritas', 0),
(412, 103, 'De rosas', 0),
(413, 104, 'Su fuerza', 1),
(414, 104, 'Su belleza', 0),
(415, 104, 'Superpoderes', 0),
(416, 104, 'Saltar muy alto', 0),
(417, 105, 'Baloo', 1),
(418, 105, 'Mowgli', 0),
(419, 105, 'Kaa', 0),
(420, 105, 'Bagheera', 0),
(421, 106, 'Babilonia', 1),
(422, 106, 'Asiria', 0),
(423, 106, 'Egipto', 0),
(424, 106, 'Mesopotamia', 0),
(425, 107, 'Cádiz', 1),
(426, 107, 'Málaga', 0),
(427, 107, 'Almería', 0),
(428, 107, 'Badajoz', 0),
(429, 108, 'Cádiz', 1),
(430, 108, 'Málaga', 0),
(431, 108, 'Sevilla', 0),
(432, 108, 'Segovia', 0),
(433, 109, 'Tutankamon', 1),
(434, 109, 'Cleopatra', 0),
(435, 109, 'Ramses II', 0),
(436, 109, 'Nefertiti', 0),
(437, 110, 'Archiduque Carlos', 1),
(438, 110, 'Alfonso X', 0),
(439, 110, 'Victor IV', 0),
(440, 110, 'Carlos II', 0),
(441, 111, 'Jose I', 1),
(442, 111, 'Calos II', 0),
(443, 111, 'Vistor IV', 0),
(444, 111, 'Carlos V', 0),
(445, 112, 'VI A.C', 1),
(446, 112, 'II A.C', 0),
(447, 112, 'II D.C', 0),
(448, 112, 'VI D.C', 0),
(449, 113, 'Republicano', 1),
(450, 113, 'Pistoleros', 0),
(451, 113, 'Fascista', 0),
(452, 113, 'Neutro', 0),
(453, 114, 'Málaga', 1),
(454, 114, 'Sevilla', 0),
(455, 114, 'Ceuta', 0),
(456, 114, 'Mallorca', 0),
(457, 115, 'Cádiz', 1),
(458, 115, 'Madrid', 0),
(459, 115, 'Bilbao', 0),
(460, 115, 'Melilla', 0),
(461, 116, 'Fenicia', 1),
(462, 116, 'Griega', 0),
(463, 116, 'Romana', 0),
(464, 116, 'Ibérica', 0),
(465, 117, 'IV', 1),
(466, 117, 'II', 0),
(467, 117, 'I', 0),
(468, 117, 'V', 0),
(469, 118, 'Tudor', 1),
(470, 118, 'Vulturi', 0),
(471, 118, 'Costas', 0),
(472, 118, 'Felas', 0),
(473, 119, 'Montones de comida', 1),
(474, 119, 'Montones de juguetes', 0),
(475, 119, 'Montones de deportes', 0),
(476, 119, 'Montones de árboles', 0),
(477, 120, '16', 1),
(478, 120, '17', 0),
(479, 120, '18', 0),
(480, 120, '20', 0),
(481, 121, 'A Gruñón', 1),
(482, 121, 'A Mudito', 0),
(483, 121, 'A Sabiondo', 0),
(484, 121, 'A dormilón', 0),
(485, 122, 'Campanilla', 1),
(486, 122, 'Wendy', 0),
(487, 122, 'Los Niños Perdidos', 0),
(488, 122, 'John Darling', 0),
(489, 123, 'Un tigre', 1),
(490, 123, 'Un león', 0),
(491, 123, 'Un elefante', 0),
(492, 123, 'Un mapache', 0),
(493, 124, 'Woody', 1),
(494, 124, 'Slinky', 0),
(495, 124, 'Betty', 0),
(496, 124, 'Rex', 0),
(497, 125, 'Por su padre', 1),
(498, 125, 'Por Gastón', 0),
(499, 125, 'Por Maurice', 0),
(500, 125, 'Por Babette', 0),
(501, 126, 'Un medallón', 1),
(502, 126, 'Un halo', 0),
(503, 126, 'Una corona', 0),
(504, 126, 'Un bastón', 0),
(505, 127, 'En su brazo', 1),
(506, 127, 'En un papel', 0),
(507, 127, 'En una piedra', 0),
(508, 127, 'En arcilla', 0),
(509, 128, 'Llamas', 1),
(510, 128, 'Agua', 0),
(511, 128, 'Nubel', 0),
(512, 128, 'Arcoiris', 0),
(513, 129, 'Un libro', 1),
(514, 129, 'Un osito de peluche', 0),
(515, 129, 'Una cinta de pelo', 0),
(516, 129, 'Un collar', 0),
(517, 130, 'Una gema', 1),
(518, 130, 'Una lámpara', 0),
(519, 130, 'Una alfombra', 0),
(520, 130, 'Un collar', 0),
(521, 131, 'En un cangrejo', 1),
(522, 131, 'En un pez', 0),
(523, 131, 'En un perro', 0),
(524, 131, 'En un gallo', 0),
(525, 132, 'Del fuego', 1),
(526, 132, 'De los bichos', 0),
(527, 132, 'De los humanos', 0),
(528, 132, 'De las serpientes', 0),
(529, 133, 'El Rey Tritón', 1),
(530, 133, 'Úrsula', 0),
(531, 133, 'El Príncipe Eric', 0),
(532, 133, 'Ariel', 0),
(533, 134, 'Diamantes', 1),
(534, 134, 'Carbón', 0),
(535, 134, 'Oro', 0),
(536, 134, 'Manzanas', 0),
(537, 135, 'Su sombra', 1),
(538, 135, 'A Wendy', 0),
(539, 135, 'Al Capitán Garfio', 0),
(540, 135, 'A Campanilla', 0),
(541, 136, 'Yasmín', 1),
(542, 136, 'Esmeralda', 0),
(543, 136, 'Wendy', 0),
(544, 136, 'Aurora', 0),
(545, 137, 'Una hucha con forma de cerdito', 1),
(546, 137, 'Un perro', 0),
(547, 137, 'Un tiranosaurio de plástico', 0),
(548, 137, 'El jefe de la armada de soldados de plástico', 0),
(549, 138, 'El Gato de los Deseos', 1),
(550, 138, 'Un gato persa', 0),
(551, 138, 'Un gato siamés', 0),
(552, 138, 'Un gato bengala', 0),
(553, 139, 'Un cocker spaniel', 1),
(554, 139, 'Un bull terrier', 0),
(555, 139, 'Un perro tejonero', 0),
(556, 139, 'Un chihuahua', 0),
(557, 140, 'A Hércules', 1),
(558, 140, 'A Zeus', 0),
(559, 140, 'A Apolo', 0),
(560, 140, 'A Hades', 0),
(561, 141, 'Hermanito', 1),
(562, 141, 'Perrito', 0),
(563, 141, 'Amiguito', 0),
(564, 141, 'Enanito', 0),
(565, 142, 'Abu', 1),
(566, 142, 'Yafar', 0),
(567, 142, 'Aladdín', 0),
(568, 142, 'El genio', 0),
(569, 143, 'Sus ojos', 1),
(570, 143, 'Su pelo', 0),
(571, 143, 'Su piel', 0),
(572, 143, 'Su nariz', 0),
(573, 144, 'En la Sirenita', 1),
(574, 144, 'En Tarzán', 0),
(575, 144, 'En Aladdín', 0),
(576, 144, 'En Toy Story', 0),
(577, 145, 'A Hércules', 1),
(578, 145, 'A Zeus', 0),
(579, 145, 'A Apolo', 0),
(580, 145, 'A Hermes', 0),
(581, 146, 'Con los monos', 1),
(582, 146, 'Con Kaa', 0),
(583, 146, 'Con Mowgli', 0),
(584, 146, 'Con Bagheera', 0),
(585, 147, 'En un dragón', 1),
(586, 147, 'En un pez', 0),
(587, 147, 'En un perro', 0),
(588, 147, 'En un gato', 0),
(589, 148, 'En invierno', 1),
(590, 148, 'En otoño', 0),
(591, 148, 'En primavera', 0),
(592, 148, 'En verano', 0),
(593, 149, 'Flit', 1),
(594, 149, 'Flirt', 0),
(595, 149, 'Fast', 0),
(596, 149, 'Flot', 0),
(597, 150, 'El vestido de la Bella Durmiente', 1),
(598, 150, 'La corona de la Bella Durmiente', 0),
(599, 150, 'Los zapatos de la Bella Durmiente', 0),
(600, 150, 'La piel de la Bella Durmiente', 0),
(601, 151, 'A los abrigos de piel', 1),
(602, 151, 'A los cachorros', 0),
(603, 151, 'A Pongo', 0),
(604, 151, 'A Nanny', 0),
(605, 152, 'Mudito', 1),
(606, 152, 'Gruñón', 0),
(607, 152, 'Dormilón', 0),
(608, 152, 'Sabiondo', 0),
(609, 153, 'A Campanilla', 1),
(610, 153, 'A Wendy', 0),
(611, 153, 'A los piratas', 0),
(612, 153, 'A los Niños Perdidos', 0),
(613, 154, 'El Comando Espacial', 1),
(614, 154, 'Los Cadetes Espaciales', 0),
(615, 154, 'Los Millennium Bugs', 0),
(616, 154, 'Los Antiguos Astronautas', 0),
(617, 155, 'Maurice', 1),
(618, 155, 'Horacio', 0),
(619, 155, 'Boris', 0),
(620, 155, 'Gastón', 0),
(621, 156, 'A la Reina', 1),
(622, 156, 'A Alicia', 0),
(623, 156, 'A Diana', 0),
(624, 156, 'A la oruga', 0),
(625, 157, 'Siameses', 1),
(626, 157, 'Persas', 0),
(627, 157, 'Bengala', 0),
(628, 157, 'Esfinge', 0),
(629, 158, 'Un elefante', 1),
(630, 158, 'Un perro', 0),
(631, 158, 'Un ratón', 0),
(632, 158, 'Un gato', 0),
(633, 159, 'Como una estatua', 1),
(634, 159, 'Como un animal', 0),
(635, 159, 'Con un humano', 0),
(636, 159, 'Ninguna de las otras', 0),
(637, 160, 'Lobos', 1),
(638, 160, 'Tigres', 0),
(639, 160, 'Monos', 0),
(640, 160, 'Perros', 0),
(641, 161, 'A Ariel', 1),
(642, 161, 'A Sebastián', 0),
(643, 161, 'Al príncipe Eric', 0),
(644, 161, 'Al rey Trintón', 0),
(645, 162, 'De Madam Mim', 1),
(646, 162, 'De Merlín', 0),
(647, 162, 'De Sir Ector', 0),
(648, 162, 'Del Rey Arturo', 0),
(649, 163, 'De elefante', 1),
(650, 163, 'De pájaro', 0),
(651, 163, 'De ratón', 0),
(652, 163, 'De león', 0),
(653, 164, 'Un mapache', 1),
(654, 164, 'Un oso', 0),
(655, 164, 'Un conejo', 0),
(656, 164, 'Un perro', 0),
(657, 165, 'Felipe', 1),
(658, 165, 'Carlos', 0),
(659, 165, 'Andrés', 0),
(660, 165, 'Juan', 0),
(661, 166, 'Sabio', 1),
(662, 166, 'Mudito', 0),
(663, 166, 'Gruñón', 0),
(664, 166, 'Dormilón', 0),
(665, 167, 'Campanilla', 1),
(666, 167, 'Wendy', 0),
(667, 167, 'John', 0),
(668, 167, 'Michael', 0),
(669, 168, 'Un mundo ideal', 1),
(670, 168, 'Una alfombra idea', 0),
(671, 168, 'Un genio genial', 0),
(672, 168, 'El bazar', 0),
(673, 169, 'Su cumpleaños', 1),
(674, 169, 'La Navidad', 0),
(675, 169, 'Los reyes magos', 0),
(676, 169, 'Su santo', 0),
(677, 170, 'Casarse con él', 1),
(678, 170, 'Matar a la Bestia', 0),
(679, 170, 'Darle su herencia', 0),
(680, 170, 'Ninguna de las otras', 0),
(681, 171, 'La sonrisa', 1),
(682, 171, 'Los ojos', 0),
(683, 171, 'Las patas', 0),
(684, 171, 'La cabeza', 0),
(685, 172, 'Cuatro', 1),
(686, 172, 'Dos', 0),
(687, 172, 'Seis', 0),
(688, 172, 'Tres', 0),
(689, 173, 'A su madre', 1),
(690, 173, 'A su padre', 0),
(691, 173, 'A los payasos', 0),
(692, 173, 'Ninguna de las otras', 0),
(693, 174, 'Aladdín', 1),
(694, 174, 'El genio', 0),
(695, 174, 'Abu', 0),
(696, 174, 'Yasmín', 0),
(697, 175, 'En el bosque', 1),
(698, 175, 'En la playa', 0),
(699, 175, 'En una cueva', 0),
(700, 175, 'En una casa', 0),
(701, 176, 'Un tigre', 1),
(702, 176, 'Un león', 0),
(703, 176, 'Un oso', 0),
(704, 176, 'Una serpiente', 0),
(705, 177, 'Negra', 1),
(706, 177, 'Blanca', 0),
(707, 177, 'Azul', 0),
(708, 177, 'Roja', 0),
(709, 178, 'A Baloo', 1),
(710, 178, 'A Mowgli', 0),
(711, 178, 'A Kaa', 0),
(712, 178, 'A Shere Khan', 0),
(713, 179, 'John Lennon', 1),
(714, 179, 'Elvis Presley', 0),
(715, 179, 'Madonna', 0),
(716, 179, 'The Queen', 0);
--
-- Índices para tablas volcadas
--
--
-- Indices de la tabla `categoria`
--
ALTER TABLE `categoria`
ADD PRIMARY KEY (`ID_Categoria`),
ADD KEY `ID_Mundo` (`ID_Mundo`);
--
-- Indices de la tabla `estadistica`
--
ALTER TABLE `estadistica`
ADD PRIMARY KEY (`ID_Jugador`,`ID_Categoria`);
--
-- Indices de la tabla `intervencion`
--
ALTER TABLE `intervencion`
ADD KEY `ID_Participacion` (`ID_Participacion`),
ADD KEY `ID_Pregunta` (`ID_Pregunta`);
--
-- Indices de la tabla `jugador`
--
ALTER TABLE `jugador`
ADD PRIMARY KEY (`ID_Jugador`),
ADD KEY `ID_Privilegio` (`ID_Privilegio`),
ADD KEY `ID_Nivel` (`ID_Nivel`);
--
-- Indices de la tabla `mundo`
--
ALTER TABLE `mundo`
ADD PRIMARY KEY (`ID_Mundo`);
--
-- Indices de la tabla `nivel`
--
ALTER TABLE `nivel`
ADD PRIMARY KEY (`ID_Nivel`);
--
-- Indices de la tabla `participacion`
--
ALTER TABLE `participacion`
ADD PRIMARY KEY (`ID_Participacion`),
ADD KEY `ID_Jugador` (`ID_Jugador`),
ADD KEY `ID_Partida` (`ID_Partida`);
--
-- Indices de la tabla `partida`
--
ALTER TABLE `partida`
ADD PRIMARY KEY (`ID_Partida`),
ADD KEY `ID_Mundo` (`ID_Mundo`);
--
-- Indices de la tabla `pregunta`
--
ALTER TABLE `pregunta`
ADD PRIMARY KEY (`ID_Pregunta`),
ADD KEY `ID_Categoria` (`ID_Categoria`);
--
-- Indices de la tabla `privilegio`
--
ALTER TABLE `privilegio`
ADD PRIMARY KEY (`ID_Privilegio`);
--
-- Indices de la tabla `respuesta`
--
ALTER TABLE `respuesta`
ADD PRIMARY KEY (`ID_Respuesta`),
ADD KEY `ID_Pregunta` (`ID_Pregunta`);
--
-- AUTO_INCREMENT de las tablas volcadas
--
--
-- AUTO_INCREMENT de la tabla `categoria`
--
ALTER TABLE `categoria`
MODIFY `ID_Categoria` int(15) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=13;
--
-- AUTO_INCREMENT de la tabla `jugador`
--
ALTER TABLE `jugador`
MODIFY `ID_Jugador` int(15) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=5;
--
-- AUTO_INCREMENT de la tabla `mundo`
--
ALTER TABLE `mundo`
MODIFY `ID_Mundo` int(15) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT de la tabla `nivel`
--
ALTER TABLE `nivel`
MODIFY `ID_Nivel` int(15) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=8;
--
-- AUTO_INCREMENT de la tabla `participacion`
--
ALTER TABLE `participacion`
MODIFY `ID_Participacion` int(15) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=52;
--
-- AUTO_INCREMENT de la tabla `partida`
--
ALTER TABLE `partida`
MODIFY `ID_Partida` int(15) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=29;
--
-- AUTO_INCREMENT de la tabla `pregunta`
--
ALTER TABLE `pregunta`
MODIFY `ID_Pregunta` int(15) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=180;
--
-- AUTO_INCREMENT de la tabla `privilegio`
--
ALTER TABLE `privilegio`
MODIFY `ID_Privilegio` int(15) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT de la tabla `respuesta`
--
ALTER TABLE `respuesta`
MODIFY `ID_Respuesta` int(15) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=717;
--
-- Restricciones para tablas volcadas
--
--
-- Filtros para la tabla `categoria`
--
ALTER TABLE `categoria`
ADD CONSTRAINT `categoria_ibfk_1` FOREIGN KEY (`ID_Mundo`) REFERENCES `mundo` (`ID_Mundo`);
--
-- Filtros para la tabla `intervencion`
--
ALTER TABLE `intervencion`
ADD CONSTRAINT `intervencion_ibfk_1` FOREIGN KEY (`ID_Participacion`) REFERENCES `participacion` (`ID_Participacion`),
ADD CONSTRAINT `intervencion_ibfk_2` FOREIGN KEY (`ID_Pregunta`) REFERENCES `pregunta` (`ID_Pregunta`);
--
-- Filtros para la tabla `jugador`
--
ALTER TABLE `jugador`
ADD CONSTRAINT `jugador_ibfk_1` FOREIGN KEY (`ID_Privilegio`) REFERENCES `privilegio` (`ID_Privilegio`),
ADD CONSTRAINT `jugador_ibfk_2` FOREIGN KEY (`ID_Nivel`) REFERENCES `nivel` (`ID_Nivel`);
--
-- Filtros para la tabla `participacion`
--
ALTER TABLE `participacion`
ADD CONSTRAINT `participacion_ibfk_1` FOREIGN KEY (`ID_Jugador`) REFERENCES `jugador` (`ID_Jugador`),
ADD CONSTRAINT `participacion_ibfk_2` FOREIGN KEY (`ID_Partida`) REFERENCES `partida` (`ID_Partida`);
--
-- Filtros para la tabla `partida`
--
ALTER TABLE `partida`
ADD CONSTRAINT `partida_ibfk_1` FOREIGN KEY (`ID_Mundo`) REFERENCES `mundo` (`ID_Mundo`);
--
-- Filtros para la tabla `pregunta`
--
ALTER TABLE `pregunta`
ADD CONSTRAINT `pregunta_ibfk_1` FOREIGN KEY (`ID_Categoria`) REFERENCES `categoria` (`ID_Categoria`);
--
-- Filtros para la tabla `respuesta`
--
ALTER TABLE `respuesta`
ADD CONSTRAINT `respuesta_ibfk_1` FOREIGN KEY (`ID_Pregunta`) REFERENCES `pregunta` (`ID_Pregunta`); | true |
0ec17acb22b68a492dc25cae57d23b94cd27ed0d | SQL | RobinLenin/siaa | /app/tributacion/scripts/comprobante_electronico.sql | UTF-8 | 862 | 3.046875 | 3 | [] | no_license | CREATE TABLE sri_servicios.comprobante_electronico
(
id serial NOT NULL,
comprobante_id integer NOT NULL,
numero_documento character varying(17) NOT NULL,
clave_acceso character varying(49),
numero_autorizacion character varying(49),
fecha_autorizacion timestamp without time zone,
estado varchar(1),
tipo varchar(1),
error_autorizacion text,
fecha_envia timestamp without time zone,
CONSTRAINT pk_comprobante_electronico PRIMARY KEY (id),
CONSTRAINT fk_tributacion_comprobante_id FOREIGN KEY (comprobante_id) REFERENCES public.tributacion_comprobante (id) MATCH SIMPLE ON UPDATE NO ACTION ON DELETE NO ACTION
);
ALTER TABLE sri_servicios.comprobante_electronico OWNER TO siaaf;
GRANT ALL ON TABLE sri_servicios.comprobante_electronico TO siaaf;
GRANT SELECT, UPDATE ON TABLE sri_servicios.comprobante_electronico TO siaaf_sri_servicios; | true |
caf90c6939fb6e730fc5e5cc4db7240f026bb275 | SQL | gladiopeace/digital-data-syn | /documents/oms/TB_HRBAO.SQL | GB18030 | 2,561 | 3.1875 | 3 | [] | no_license | /*
================================================================================
ṹ:TB_HRBAO
ṹ:Աнµ
ṹĿ:
================================================================================
*/
drop sequence SEQ_TB_HRBAO;
drop index AK_TB_HRBAO;
drop table TB_HRBAO;
create table TB_HRBAO (
HRBAO_ID INTEGER not null, /*ԱнµID */
HRBAO001 INTEGER not null, /*ԱнµͷID */
HRBAO002 INTEGER not null, /*ԱID */
HRBAO003 INTEGER not null, /*нID */
HRBAO004 INTEGER not null, /*ID */
HRBAO005 NUMBER(12,2) not null, /*˰ǰ */
HRBAO006 NUMBER(12,2) not null, /*˰ */
HRBAO007 NUMBER(12,2) not null, /*˰ */
HRBAO008 NUMBER(12,2) not null, /*˰ */
HRBAO009 NUMBER(12,2) not null, /*۳ */
HRBAO010 NUMBER(12,2) not null, /*ʵܶ */
HRBAO011 VARCHAR2(255) not null, /*ע */
CREATE_USER VARCHAR2(12), /*Ա */
USER_GROUP VARCHAR2(12), /*Ա */
CREATE_DATE DATE, /* */
MODIFIER VARCHAR2(12), /*Ա */
MODI_DATE DATE, /* */
FLAG NUMBER(1), /*״̬ */
constraint PK_TB_HRBAO primary key (HRBAO_ID)
);
create unique index AK_TB_HRBAO on TB_HRBAO (HRBAO001);
create sequence SEQ_TB_HRBAO minvalue 1 maxvalue 9999999999999999999999999999 start with 1 increment by 1 nocache;
grant select on TB_HRBAO to public;
grant index on TB_HRBAO to public;
grant update on TB_HRBAO to public;
grant delete on TB_HRBAO to public;
grant insert on TB_HRBAO to public;
grant select on SEQ_TB_HRBAO to public; | true |
fd24ad94bd439d2af8984c8317e53f576ea7eefd | SQL | ccquach/tsql-fundamentals | /02 Single-table Queries/06 Working with Character Data.sql | UTF-8 | 3,154 | 4.15625 | 4 | [] | no_license | /* Collation */
-- Get supported collations and their descriptions
SELECT name
, description
FROM sys.fn_helpcollations();
-- Convert collation of an expression
SELECT empid
, firstname
, lastname
FROM HR.Employees
WHERE lastname = N'davis'; -- default database collation is case INSENSITIVE
SELECT empid
, firstname
, lastname
FROM HR.Employees
WHERE lastname COLLATE Latin1_General_CS_AS = N'davis'; -- returns empty set when case SENSITIVE comparison
/* Operators and functions */
-- Concatenate with plus-sign (+) operator
SELECT empid
, firstname + N' ' + lastname AS fullname
FROM HR.Employees;
-- Concatenation with NULL yields NULL
SELECT custid
, country
, region
, city
, country + N', ' + region + N', ' + city AS location
FROM Sales.Customers;
SELECT custid
, country
, region
, city
, country + COALESCE(N', ' + region, N'') + N', ' + city AS location
FROM Sales.Customers;
-- Concatenation using CONCAT function
SELECT custid
, country
, region
, city
, CONCAT(country, N', ' + region, N', ' + city) AS location
FROM Sales.Customers;
-- SUBSTRING function
SELECT SUBSTRING('abcde', 1, 3);
-- LEFT and RIGHT functions
SELECT LEFT('abcde', 3);
SELECT RIGHT('abcde', 3);
-- LEN and DATALENGTH functions
SELECT LEN(N'abcde '); -- EXCLUDES trailing blanks, so returns 5 (characters)
SELECT DATALENGTH(N'abcde '); -- INCLUDES trailing blanks, so returns 14 (bytes)
-- CHARINDEX function
SELECT CHARINDEX(' ', 'Itzik Ben-Gan');
-- PATINDEX function (pattern)
SELECT PATINDEX('%[0-9]%', 'abcd123efgh');
-- REPLACE function
SELECT REPLACE('1-a 2-b', '-', ':');
SELECT empid
, lastname
, LEN(lastname) - LEN(replace(lastname, 'e', '')) AS numoccur
FROM HR.Employees;
-- REPLICATE function
SELECT REPLICATE('abc', 3);
SELECT supplierid
, RIGHT(REPLICATE('0', 9) + CAST(supplierid AS VARCHAR(10)), 10) AS strsupplierid
FROM Production.Suppliers;
-- STUFF function
SELECT STUFF('xyz', 2, 1, 'abc');
-- UPPER and LOWER functions
SELECT UPPER('Itzik Ben-Gan');
SELECT LOWER('Itzik Ben-Gan');
-- LTRIM and RTRIM functions
SELECT RTRIM(LTRIM(' abc ')); -- remove both leading and trailing spaces
-- FORMAT function
SELECT format(1759, '0000000000');
SELECT format(1759, 'd10');
-- STRING_SPLIT function (SQL Server 2016)
SELECT CAST(value AS INT) AS myvalue
FROM STRING_SPLIT('10248,10249,10250', ',') AS S;
/* LIKE predicate */
-- % (percent) wildcard: represents string of any size, including empty string
SELECT empid
, lastname
FROM HR.Employees
WHERE lastname LIKE N'D%'; -- starts with 'D'
-- _ (underscore) wildcard: represents single character
SELECT empid
, lastname
FROM HR.Employees
WHERE lastname LIKE N'_e%'; -- second letter is 'e'
-- [] (list of characters) wildcard
SELECT empid
, lastname
FROM HR.Employees
WHERE lastname LIKE N'[ABC]%';
-- [<char>-<char>] (range of characters) wildcard
SELECT empid
, lastname
FROM HR.Employees
WHERE lastname LIKE N'[A-E]%';
-- [^<char list or range>] (not specified char) wildcard
SELECT empid
, lastname
FROM HR.Employees
WHERE lastname LIKE N'[^A-E]%'; | true |
0fc458ce8de4c7e71ee4789769bd01283f5f4f25 | SQL | LondiweN/SQLBeginnerWork | /chapter 6/page 247.sql | UTF-8 | 1,043 | 2.875 | 3 | [] | no_license | UPDATE movie_table
SET category =
CASE
WHEN drama = ‘T’ AND rating = ‘R’ THEN ‘drama-r’
WHEN comedy = ‘T’ AND rating = ‘R’ THEN ‘comedy-r’
WHEN action = ‘T’ AND rating = ‘R’ THEN ‘action-r’
WHEN gore = ‘T’ AND rating = ‘R’ THEN ‘horror-r’
WHEN scifi = ‘T’ AND rating = ‘R’ THEN ‘scifi-r’
WHEN category = ‘misc’ AND rating = ‘G’ THEN ‘family’
END;
---------------------------------------------------------------------------------------
UPDATE movie_table
SET category =
CASE
WHEN category = ‘drama-r’ THEN ‘drama’
WHEN category = ‘comedy-r’ THEN ‘comedy’
WHEN category = ‘action-r’ THEN ‘action’
WHEN category = ‘horror-r’ THEN ‘horror’
WHEN category = ‘scifi-r’ THEN ‘scifi’
END;
------------------------------------------------------------------------------------
ALTER TABLE movie_table
DROP COLUMN drama,
DROP COLUMN comedy,
DROP COLUMN action,
DROP COLUMN gore,
DROP COLUMN scifi,
DROP COLUMN for_kids,
DROP COLUMN cartoon; | true |
17bcdde194331877e6128987beab2f5a3247c897 | SQL | vrdel/isabella-users | /frontend/helpers/dbcreate.sql | UTF-8 | 422 | 2.859375 | 3 | [] | no_license | CREATE TABLE users
(
user_id INTEGER PRIMARY KEY,
username TEXT,
home INTEGER,
shared INTEGER,
pass INTEGER,
passvalue TEXT,
sge INTEGER,
maillist INTEGER,
email INTEGER
);
CREATE TABLE prio
(
prio_id INTEGER PRIMARY KEY,
project_name TEXT,
papers INTEGER,
prio INTEGER,
user_id INTEGER REFERENCES users(user_id)
);
CREATE INDEX idx_users_name ON users(username);
| true |
eeb8d5b28747acac844379fe8b4f852e0ec420e6 | SQL | dhxoghks95/sql_start | /입문/63_69.sql | UHC | 1,330 | 3.921875 | 4 | [] | no_license | SELECT e.ename as ̸, e.job as , e.sal as , d.loc as μġ
FROM emp e join dept d
USING (deptno)
WHERE e.job = 'SALESMAN';
SELECT e.ename as ̸, e.job as , e.sal as , d.loc as μġ
FROM emp e natural join dept d
WHERE e.job = 'SALESMAN';
SELECT e.ename as ̸, e.job as , d.loc as μġ
FROM emp e natural join dept d
WHERE e.job = 'SALESMAN' and deptno = 30;
SELECT e.ename as ̸, e.job as , e.sal as , d.loc as μġ
FROM emp e RIGHT OUTER JOIN dept d
ON (e.deptno = d.deptno);
SELECT e.ename as ̸, e.job as , e.sal as , d.loc as μġ
FROM emp e LEFT OUTER JOIN dept d
ON (e.deptno = d.deptno);
SELECT e.ename as ̸, e.job as , e.sal as , d.loc as μġ
FROM emp e FULL OUTER JOIN dept d
ON (e.deptno = d.deptno);
SELECT deptno, sum(sal)
FROM emp
GROUP BY deptno
UNION ALL
SELECT TO_NUMBER(null) as deptno, sum(sal)
FROM emp;
SELECT deptno, sum(sal)
FROM emp
GROUP BY deptno
UNION
SELECT null as deptno, sum(sal)
FROM emp;
SELECT ename, sal, job, deptno
FROM emp
WHERE deptno in (10,20)
INTERSECT
SELECT ename, sal, job, deptno
FROM emp
WHERE deptno in (20,30); | true |
037989f1645fe0c091bb0b7ead94a423269dd8b7 | SQL | shreyade/Online-Store | /updatedProcedureE.sql | UTF-8 | 3,239 | 4.0625 | 4 | [] | no_license | CREATE OR REPLACE PROCEDURE printInfo (custIdInput IN INTEGER, startDateInput IN DATE)
AS
startDate DATE;
custIdLocal INTEGER;
custNameLocal VARCHAR(20);
phoneEmailLocal VARCHAR(30);
custAddressLocal VARCHAR(30);
orderIdLocal INTEGER;
itemIdLocal INTEGER;
itemTypeLocal VARCHAR(15);
priceLocal NUMERIC(10,2);
orderDateLocal DATE;
shippedDateLocal DATE;
CURSOR orderIdCursor IS
SELECT orderId
FROM itemOrder
WHERE custId = custIdInput AND orderDate >= startDateInput;
CURSOR itemIdCursor IS
SELECT itemId
FROM orderHas
WHERE orderId = orderIdLocal;
totalPrice NUMERIC(10,2);
itemsTotal NUMERIC(10,2);
orderTotal NUMERIC(10,2);
tax NUMERIC(10,2);
shippingFee NUMERIC(10,2);
discount NUMERIC(10,2);
grandTotal NUMERIC(10,2);
BEGIN
custIdLocal := custIdInput;
grandTotal := 0;
itemsTotal := 0;
SELECT custName INTO custNameLocal
FROM customerAll
WHERE custId = custIdLocal;
SELECT phoneEmail INTO phoneEmailLocal
FROM customerAll
WHERE custId = custIdLocal;
SELECT custAddress INTO custAddressLocal
FROM customerAll
WHERE custId = custIdLocal;
DBMS_OUTPUT.PUT_LINE('Customer Id: ' || custIdLocal);
DBMS_OUTPUT.PUT_LINE('Customer Name: ' || custNameLocal);
DBMS_OUTPUT.PUT_LINE('Customer Phone or Email: ' || phoneEmailLocal);
DBMS_OUTPUT.PUT_LINE('Customer Address: ' || custAddressLocal);
dbms_output.put_line(chr(10));
OPEN orderIdCursor;
LOOP
FETCH orderIdCursor INTO orderIdLocal;
EXIT WHEN orderIdCursor%NOTFOUND;
DBMS_OUTPUT.PUT_LINE('Order Id: ' || orderIdLocal);
SELECT orderDate INTO orderDateLocal
FROM itemOrder
WHERE orderId = orderIdLocal;
SELECT shippedDate INTO shippedDateLocal
FROM itemOrder
WHERE orderId = orderIdLocal;
DBMS_OUTPUT.PUT_LINE('Order Date: ' || orderDateLocal);
DBMS_OUTPUT.PUT_LINE('Shipped Date: ' || shippedDateLocal);
dbms_output.put_line(chr(10));
OPEN itemIdCursor;
LOOP
FETCH itemIdCursor INTO itemIdLocal;
EXIT WHEN itemIdCursor%NOTFOUND;
DBMS_OUTPUT.PUT_LINE('Item Id: ' || itemIdLocal);
SELECT itemType into itemTypeLocal
FROM storeItems
WHERE itemId = itemIdLocal;
SELECT price into priceLocal
FROM storeItems
WHERE itemId = itemIdLocal;
DBMS_OUTPUT.PUT_LINE('Item Name: ' || itemTypeLocal);
DBMS_OUTPUT.PUT_LINE('Item Price: ' || priceLocal);
dbms_output.put_line(chr(10));
END LOOP;
CLOSE itemIdCursor;
SELECT getItemsTotal(orderIdLocal) INTO totalPrice
FROM dual;
SELECT getTotal(orderIdLocal) INTO orderTotal
FROM dual;
SELECT getTax(orderIdLocal) INTO tax
FROM dual;
SELECT getDiscount(orderIdLocal) INTO discount
FROM dual;
itemsTotal := itemsTotal + totalPrice;
grandTotal := grandTotal + orderTotal;
DBMS_OUTPUT.PUT_LINE('Items Total: ' || itemsTotal);
DBMS_OUTPUT.PUT_LINE('Grand Total: ' || grandTotal);
DBMS_OUTPUT.PUT_LINE('Tax: ' || tax);
DBMS_OUTPUT.PUT_LINE('Discount: ' || discount);
END LOOP;
CLOSE orderIdCursor;
startDate := startDateInput;
END;
/
show errors;
/* so you need to get the orderIds where cust id = input and orderDate > startdate */
/* that would be a cursor */
/* then for each thing in that you would have to have a loop inside
printing each item */
execute printInfo(111, DATE '12-12-12'); | true |
3483b85ef4ba7379d65fb9c543d0c15734ab22ed | SQL | thierrysutter/siteClub | /document/script_bdd.sql | ISO-8859-1 | 23,444 | 3.453125 | 3 | [] | no_license | DROP DATABASE IF EXISTS SITE;
CREATE DATABASE SITE CHARACTER SET 'utf8';
USE SITE;
DROP TABLE IF EXISTS SAISON;
CREATE TABLE SAISON (
ID INTEGER(11) NOT NULL AUTO_INCREMENT,
LIBELLE VARCHAR(100) NOT NULL,
ETAT SMALLINT(6) NOT NULL,
AUTEUR_MAJ VARCHAR(25) NOT NULL,
DERNIERE_MAJ TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (ID)
) ENGINE=INNODB
AUTO_INCREMENT=1
DEFAULT CHARSET='utf8'
COLLATE='utf8_general_ci'
;
DROP TABLE IF EXISTS CATEGORIE;
CREATE TABLE CATEGORIE (
ID INTEGER(11) NOT NULL AUTO_INCREMENT,
LIBELLE VARCHAR(100) NOT NULL,
ANNEE_DEBUT SMALLINT(6) NOT NULL,
ANNEE_FIN SMALLINT(6) NOT NULL,
AUTEUR_MAJ VARCHAR(25) NOT NULL,
DERNIERE_MAJ TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (ID)
) ENGINE=INNODB
AUTO_INCREMENT=1
DEFAULT CHARSET='utf8'
COLLATE='utf8_general_ci'
;
DROP TABLE IF EXISTS DIVISION;
CREATE TABLE DIVISION (
ID INTEGER(11) NOT NULL AUTO_INCREMENT,
LIBELLE VARCHAR(100) NOT NULL,
CATEGORIE SMALLINT(6) NOT NULL,
AUTEUR_MAJ VARCHAR(25) NOT NULL,
DERNIERE_MAJ TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (ID)
) ENGINE=INNODB
AUTO_INCREMENT=1
DEFAULT CHARSET='utf8'
COLLATE='utf8_general_ci'
;
DROP TABLE IF EXISTS FONCTION;
CREATE TABLE FONCTION (
ID INTEGER(11) NOT NULL AUTO_INCREMENT,
LIBELLE VARCHAR(100) NOT NULL,
AUTEUR_MAJ VARCHAR(25) NOT NULL,
DERNIERE_MAJ TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (ID)
) ENGINE=INNODB
AUTO_INCREMENT=1
DEFAULT CHARSET='utf8'
COLLATE='utf8_general_ci'
;
DROP TABLE IF EXISTS POSTE;
CREATE TABLE POSTE (
ID INTEGER(11) NOT NULL AUTO_INCREMENT,
LIBELLE VARCHAR(100) NOT NULL,
AUTEUR_MAJ VARCHAR(25) NOT NULL,
DERNIERE_MAJ TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (ID)
) ENGINE=INNODB
AUTO_INCREMENT=1
DEFAULT CHARSET='utf8'
COLLATE='utf8_general_ci'
;
DROP TABLE IF EXISTS MEMBRE;
CREATE TABLE MEMBRE (
LOGIN VARCHAR(25) NOT NULL,
PASSWORD VARCHAR(64) NOT NULL,
ACTIF SMALLINT(6) NOT NULL,
NB_ECHEC SMALLINT(6) NOT NULL,
PWD_USAGE_UNIQUE SMALLINT(6) NOT NULL,
DATE_EXPIRATION DATE NOT NULL,
EMAIL VARCHAR(100) NOT NULL,
DERNIERE_CONNEXION DATETIME NOT NULL ,
DERNIERE_MAJ TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (LOGIN)
) ENGINE=INNODB
DEFAULT CHARSET='utf8'
COLLATE='utf8_general_ci'
;
DROP TABLE IF EXISTS MENU;
CREATE TABLE MENU (
ID INTEGER(11) NOT NULL AUTO_INCREMENT,
LIBELLE VARCHAR(100) NOT NULL,
URL TEXT NOT NULL,
ICONE VARCHAR(100) NOT NULL,
ORDRE SMALLINT(6) NOT NULL,
ACTIF SMALLINT(6) NOT NULL,
AUTEUR_MAJ VARCHAR(25) NOT NULL,
DERNIERE_MAJ TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (ID)
) ENGINE=INNODB
AUTO_INCREMENT=1
DEFAULT CHARSET='utf8'
COLLATE='utf8_general_ci'
;
DROP TABLE IF EXISTS SPONSOR;
CREATE TABLE SPONSOR (
ID INTEGER(11) NOT NULL AUTO_INCREMENT,
NOM VARCHAR(100) NOT NULL,
URL TEXT NOT NULL,
VIGNETTE VARCHAR(100) NOT NULL,
ADRESSE VARCHAR(100) default null,
CP VARCHAR(10) default null,
VILLE VARCHAR(100) default null,
TEL VARCHAR(12) default null,
FAX VARCHAR(12) default null,
EMAIL VARCHAR(100) default null,
AUTEUR_MAJ VARCHAR(25) NOT NULL,
DERNIERE_MAJ TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (ID)
) ENGINE=INNODB
AUTO_INCREMENT=1
DEFAULT CHARSET='utf8'
COLLATE='utf8_general_ci'
;
DROP TABLE IF EXISTS ARTICLE;
CREATE TABLE ARTICLE (
ID INTEGER(11) NOT NULL AUTO_INCREMENT,
TITRE VARCHAR(100) NOT NULL,
TEXTE TEXT NOT NULL,
PHOTO VARCHAR(100) NOT NULL,
LIEN VARCHAR(100) NOT NULL,
STATUT SMALLINT(6) NOT NULL,
DATE_PARUTION DATETIME NOT NULL,
AUTEUR VARCHAR(25) NOT NULL,
DERNIERE_MAJ TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (ID)
) ENGINE=INNODB
AUTO_INCREMENT=1
DEFAULT CHARSET='utf8'
COLLATE='utf8_general_ci'
;
DROP TABLE IF EXISTS COMPETITION;
CREATE TABLE COMPETITION (
ID INTEGER(11) NOT NULL AUTO_INCREMENT,
LIBELLE VARCHAR(100) NOT NULL,
CATEGORIE SMALLINT(6) NOT NULL,
DIVISION SMALLINT(6) NOT NULL,
SAISON SMALLINT(6) NOT NULL,
AUTEUR_MAJ VARCHAR(25) NOT NULL,
DERNIERE_MAJ TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (ID)
) ENGINE=INNODB
AUTO_INCREMENT=1
DEFAULT CHARSET='utf8'
COLLATE='utf8_general_ci'
;
DROP TABLE IF EXISTS RENCONTRE;
CREATE TABLE RENCONTRE (
ID INTEGER(11) NOT NULL AUTO_INCREMENT,
COMPETITION SMALLINT(6) NOT NULL,
JOUR DATE NOT NULL,
EQUIPE_DOM VARCHAR(50) NOT NULL,
EQUIPE_EXT VARCHAR(50) NOT NULL,
SCORE_DOM SMALLINT(6) NOT NULL,
SCORE_EXT SMALLINT(6) NOT NULL,
STATUT SMALLINT(6) NOT NULL DEFAULT 0,
AUTEUR_MAJ VARCHAR(25) NOT NULL,
DERNIERE_MAJ TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (ID)
) ENGINE=INNODB
AUTO_INCREMENT=1
DEFAULT CHARSET='utf8'
COLLATE='utf8_general_ci'
;
-- dernier match jou
SELECT rencontre.*
FROM `rencontre` , (select max(id) as id, competition from rencontre where statut=1 group by competition) tmp
WHERE tmp.id=rencontre.id and tmp.competition=rencontre.competition;
-- prochain match
SELECT rencontre.*
FROM `rencontre` , (select min(id) as id, competition from rencontre where statut=0 group by competition) tmp
WHERE tmp.id=rencontre.id and tmp.competition=rencontre.competition;
DROP TABLE IF EXISTS INDIVIDU;
CREATE TABLE INDIVIDU (
ID INTEGER(11) NOT NULL AUTO_INCREMENT,
NOM VARCHAR(50) NOT NULL,
PRENOM VARCHAR(50) NOT NULL,
AGE INTEGER(11) ,
DATE_NAISSANCE DATETIME ,
FONCTION INTEGER(11),
CATEGORIE INTEGER(11),
POSTE INTEGER(11),
TAILLE INTEGER(11),
POIDS INTEGER(11),
MEILLEUR_PIED VARCHAR(1),
NUMERO_LICENCE INTEGER(11),
AUTEUR_MAJ VARCHAR(25) NOT NULL,
DERNIERE_MAJ TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (ID)
) ENGINE=INNODB
AUTO_INCREMENT=1
DEFAULT CHARSET='utf8'
COLLATE='utf8_general_ci'
;
-- REQUETE STAFF SENIORS
SELECT individu.id, individu.nom, individu.prenom, individu.age, individu.date_naissance as dateNaissance, fonction.libelle as libelleFonction, individu.numero_licence as numeroLicence
FROM individu, fonction
WHERE CATEGORIE=9 AND FONCTION in (10, 11)
AND fonction.ID=individu.FONCTION
;
-- REQUETE JOUEURS SENIORS
SELECT individu.id, individu.nom, individu.prenom, individu.age, individu.date_naissance as dateNaissance, poste.libelle as libellePoste, individu.numero_licence as numeroLicence, individu.taille, individu.poids, individu.meilleur_pied as meilleurPied
FROM individu, poste
WHERE CATEGORIE=9 AND FONCTION in (12)
AND poste.ID=individu.POSTE
;
--
-- Contenu de la table `article`
--
INSERT INTO `article` (`ID`, `TITRE`, `TEXTE`, `PHOTO`, `LIEN`, `STATUT`, `DATE_PARUTION`, `AUTEUR`, `DERNIERE_MAJ`) VALUES
(1, 'Tournoi Besanon pour les U13', 'Les jeunes U13 du club en tournoi Besanon pendant le xeek end de la Pentecote.', '', '', 1, '2014-10-04 14:45:00', 'ADMIN', '2014-10-04 12:46:16'),
(2, 'Coupe de Moselle', 'Les sniors A finaliste de la coupe de Moselle 2014. L''quipe B s''est quant elle incline en 1/2 finale de la coupe des quipes rserves.', '', '', 1, '2014-10-04 14:45:30', 'ADMIN', '2014-10-04 12:46:16'),
(3, 'Sniors B', 'Les sniors B montent en 2me division de district.', '', '', 1, '2014-10-04 14:46:00', 'ADMIN', '2014-10-04 12:47:49'),
(4, 'Monte en PHR', 'Les sniors A retrouvent niveau Promotion d''Honneur Rgionale aprs une trs belle saison.', 'images/monteePHR.jpg', '', 1, '2014-10-04 14:46:30', 'ADMIN', '2014-10-04 12:47:49'),
(5, 'Inscriptions 2014/2015', 'Pour tous renseignements, contactez nous au 03 87 37 04 34 ou remplissez ce <a href="#">formulaire</a>.', 'images/featured-side-3.jpg', '', 1, '2014-10-04 14:47:00', 'ADMIN', '2014-10-04 12:49:25'),
(6, 'Bilan de la saison 2013/2014', 'Le bilan du club est trs bon en cette fin de saison avec la monte des 2 quipes sniors dont l''quipe A qui retrouve la PHR (Ligue) comme espr en dbut de saison.', 'images/featured-side-2.jpg', '', 1, '2014-10-04 14:47:30', 'ADMIN', '2014-10-04 12:49:25'),
(7, 'Fte du foot 2014', 'Comme chaque anne, le club a organis sa fte du football.', 'images/choucroute.gif', '', 1, '2014-10-04 14:48:00', 'ADMIN', '2014-10-04 12:50:41'),
(8, 'Reprise saison 2014/2015', 'Le premier entrainement de la nouvelle saison a eu lieu le dimanche 27/07/2014.', 'images/travaux_stade.jpg', '', 1, '2014-10-04 14:48:30', 'ADMIN', '2014-10-04 12:50:41'),
(9, 'Reprise section jeunes', 'Les jeunes joueurs de l''cole de foot (U6 U13) ont repris le chemin des entrainements depuis la fin du mois d''aot.', 'images/repriseJeunes2014.jpg', '', 1, '2014-10-04 14:49:00', 'ADMIN', '2014-10-04 12:51:27');
-- --------------------------------------------------------
--
-- Contenu de la table `categorie`
--
INSERT INTO `categorie` (`ID`, `LIBELLE`, `ANNEE_DEBUT`, `ANNEE_FIN`, `AUTEUR_MAJ`, `DERNIERE_MAJ`) VALUES
(1, 'U7', 2008, 2009, 'ADMIN', '2014-10-04 11:50:25'),
(2, 'U9', 2006, 2007, 'ADMIN', '2014-10-04 11:50:25'),
(3, 'U11', 2004, 2005, 'ADMIN', '2014-10-04 11:51:02'),
(4, 'U13', 2002, 2003, 'ADMIN', '2014-10-04 11:51:02'),
(5, 'U15', 2000, 2001, 'ADMIN', '2014-10-04 11:51:43'),
(6, 'U17', 1998, 1999, 'ADMIN', '2014-10-04 11:51:43'),
(7, 'U19', 1996, 1997, 'ADMIN', '2014-10-04 11:52:20'),
(8, 'U20', 1995, 1995, 'ADMIN', '2014-10-04 11:52:20'),
(9, 'SENIOR', 1980, 1994, 'ADMIN', '2014-10-04 11:55:49'),
(10, 'VETERAN', 1901, 1979, 'ADMIN', '2014-10-04 11:57:14');
-- --------------------------------------------------------
--
-- Contenu de la table `competition`
--
INSERT INTO `competition` (`ID`, `LIBELLE`, `CATEGORIE`, `DIVISION`, `SAISON`, `AUTEUR_MAJ`, `DERNIERE_MAJ`) VALUES
(1, 'PHR GROUPE C', 9, 9, 1, 'ADMIN', '2014-10-04 15:43:59'),
(2, '2EME DIV. GROUPE D', 9, 11, 1, 'ADMIN', '2014-10-04 15:43:59'),
(3, 'U15 MOSELLE GROUPE F', 5, 23, 1, 'ADMIN', '2014-10-04 15:50:26'),
(4, 'U13 EXCELLENCE GROUPE D', 4, 26, 1, 'ADMIN', '2014-10-04 15:50:26');
-- --------------------------------------------------------
--
-- Contenu de la table `division`
--
INSERT INTO `division` (`ID`, `LIBELLE`, `CATEGORIE`, `AUTEUR_MAJ`, `DERNIERE_MAJ`) VALUES
(1, 'LIGUE 1', 9, 'ADMIN', '2014-10-04 12:59:22'),
(2, 'LIGUE 2', 9, 'ADMIN', '2014-10-04 12:59:22'),
(3, 'NATIONAL', 9, 'ADMIN', '2014-10-04 12:59:45'),
(4, 'CFA', 9, 'ADMIN', '2014-10-04 12:59:45'),
(5, 'CFA 2', 9, 'ADMIN', '2014-10-04 13:00:06'),
(6, 'DIVISION HONNEUR', 9, 'ADMIN', '2014-10-04 13:00:06'),
(7, 'DIVISION HONNEUR REGIONAL', 9, 'ADMIN', '2014-10-04 13:00:28'),
(8, 'PROMOTION HONNEUR', 9, 'ADMIN', '2014-10-04 13:00:28'),
(9, 'PROMOTION HONNEUR REGIONAL', 9, 'ADMIN', '2014-10-04 13:00:54'),
(10, '1ERE DIVISION', 9, 'ADMIN', '2014-10-04 13:08:27'),
(11, '2EME DIVISION', 9, 'ADMIN', '2014-10-04 13:08:27'),
(12, '3EME DIVISION', 9, 'ADMIN', '2014-10-04 13:08:27'),
(13, '4EME DIVISION', 9, 'ADMIN', '2014-10-04 13:08:27'),
(14, 'DIVISION HONNEUR', 7, 'ADMIN', '2014-10-04 13:03:23'),
(15, 'HONNEUR REGIONAL', 7, 'ADMIN', '2014-10-04 13:03:23'),
(16, 'MOSELLE', 7, 'ADMIN', '2014-10-04 13:04:17'),
(17, 'DIVISION HONNEUR', 6, 'ADMIN', '2014-10-04 13:04:17'),
(18, 'HONNEUR REGIONAL', 6, 'ADMIN', '2014-10-04 13:04:45'),
(19, 'MOSELLE', 6, 'ADMIN', '2014-10-04 13:04:45'),
(20, 'DIVISION HONNEUR', 5, 'ADMIN', '2014-10-04 13:05:13'),
(21, 'HONNEUR REGIONAL', 5, 'ADMIN', '2014-10-04 13:05:13'),
(22, 'PROMOTION HONNEUR', 5, 'ADMIN', '2014-10-04 13:05:39'),
(23, 'MOSELLE', 5, 'ADMIN', '2014-10-04 13:05:39'),
(24, 'HONNEUR', 4, 'ADMIN', '2014-10-04 13:06:33'),
(25, 'HONNEUR REGIONAL', 4, 'ADMIN', '2014-10-04 13:06:33'),
(26, 'EXCELLENCE', 4, 'ADMIN', '2014-10-04 13:06:47'),
(27, 'PROMOTION', 4, 'ADMIN', '2014-10-04 13:06:47'),
(28, 'INTERREGIONAL', 5, 'ADMIN', '2014-10-04 13:07:34');
-- --------------------------------------------------------
--
-- Contenu de la table `fonction`
--
INSERT INTO `fonction` (`ID`, `LIBELLE`, `AUTEUR_MAJ`, `DERNIERE_MAJ`) VALUES
(1, 'PRESIDENT', 'ADMIN', '2014-10-04 13:11:46'),
(2, 'VICE PRESIDENT', 'ADMIN', '2014-10-04 13:11:46'),
(3, 'TRESORIER', 'ADMIN', '2014-10-04 13:11:46'),
(4, 'INTENDANT', 'ADMIN', '2014-10-04 13:11:46'),
(5, 'SECRETAIRE', 'ADMIN', '2014-10-04 13:11:46'),
(6, 'MANAGER GENERAL', 'ADMIN', '2014-10-04 13:11:46'),
(7, 'MANAGER GEENRAL JEUNES', 'ADMIN', '2014-10-04 13:11:46'),
(8, 'REFERENT ARBITRE', 'ADMIN', '2014-10-04 13:11:46'),
(9, 'ARBITRE', 'ADMIN', '2014-10-04 13:11:46'),
(10, 'EDUCATEUR', 'ADMIN', '2014-10-04 13:11:46'),
(11, 'DIRIGEANT', 'ADMIN', '2014-10-04 13:12:16'),
(12, 'JOUEUR', 'ADMIN', '2014-10-04 13:12:16');
-- --------------------------------------------------------
--
-- Contenu de la table `membre`
--
INSERT INTO `membre` (`LOGIN`, `PASSWORD`, `ACTIF`, `NB_ECHEC`, `PWD_USAGE_UNIQUE`, `DATE_EXPIRATION`, `EMAIL`, `DERNIERE_CONNEXION`, `DERNIERE_MAJ`) VALUES
('test', '9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08', 1, 0, 0, '2999-12-31', 'sutter.thierry@gmail.com', '2014-10-04 15:28:08', '2014-10-04 13:28:08');
-- --------------------------------------------------------
--
-- Contenu de la table `menu`
--
INSERT INTO `menu` (`ID`, `LIBELLE`, `URL`, `ICONE`, `ORDRE`, `ACTIF`, `AUTEUR_MAJ`, `DERNIERE_MAJ`) VALUES
(1, 'ACCUEIL', 'accueil.php', '', 1, 1, 'ADMIN', '2014-10-04 12:33:48'),
(2, 'CLUB', 'club.php', '', 2, 1, 'ADMIN', '2014-10-04 12:33:48'),
(3, 'EFFECTIFS', 'joueurs&staffs.php', '', 3, 1, 'ADMIN', '2014-10-04 12:34:50'),
(4, 'ECOLE DE FOOT', 'ecoledefoot.php', '', 4, 1, 'ADMIN', '2014-10-04 12:34:50'),
(5, 'AGENDA', 'calendrier.php', '', 5, 1, 'ADMIN', '2014-10-04 12:35:36'),
(6, 'EVENEMENTS', 'evenements.php', '', 6, 1, 'ADMIN', '2014-10-04 12:35:36'),
(7, 'SPONSORS', 'sponsors.php', '', 7, 1, 'ADMIN', '2014-10-04 12:36:17'),
(8, 'CONTACT', 'contact.php', '', 8, 1, 'ADMIN', '2014-10-04 12:36:17'),
(9, 'PRESSE', 'presse.php', '', 9, 0, 'ADMIN', '2014-10-04 12:37:03'),
(10, 'VIDEOS', 'videos.php', '', 10, 0, 'ADMIN', '2014-10-04 12:37:03'),
(11, 'BOUTIQUE', 'boutique.php', '', 11, 0, 'ADMIN', '2014-10-04 12:37:35'),
(12, 'ADMINISTRATION', '', '', 12, 0, 'ADMIN', '2014-10-04 12:39:07');
-- --------------------------------------------------------
--
-- Contenu de la table `poste`
--
INSERT INTO `poste` (`ID`, `LIBELLE`, `AUTEUR_MAJ`, `DERNIERE_MAJ`) VALUES
(1, 'GARDIEN', 'ADMIN', '2014-10-04 13:14:05'),
(2, 'DEFENSEUR LATERAL', 'ADMIN', '2014-10-04 13:14:05'),
(3, 'DEFENSEUR CENTRAL', 'ADMIN', '2014-10-04 13:14:05'),
(4, 'MILIEU DEFENSIF', 'ADMIN', '2014-10-04 13:14:05'),
(5, 'MILIEU LATERAL', 'ADMIN', '2014-10-04 13:14:05'),
(6, 'MILIEU OFFENSIF', 'ADMIN', '2014-10-04 13:14:05'),
(7, 'AILIER', 'ADMIN', '2014-10-04 13:14:05'),
(8, 'AVANT CENTRE', 'ADMIN', '2014-10-04 13:14:05');
-- --------------------------------------------------------
--
-- Contenu de la table `rencontre`
--
INSERT INTO `rencontre` (`ID`, `COMPETITION`, `JOUR`, `EQUIPE_DOM`, `EQUIPE_EXT`, `SCORE_DOM`, `SCORE_EXT`, `STATUT`, `AUTEUR_MAJ`, `DERNIERE_MAJ`) VALUES
(1, 1, '2014-08-31', 'ST JULIEN', 'ES WOIPPY', 2, 1, 1, 'ADMIN', '2014-10-04 14:54:08'),
(2, 1, '2014-09-07', 'LAXOU SAPINIERE', 'ST JULIEN', 0, 2, 1, 'ADMIN', '2014-10-04 14:54:08'),
(3, 1, '2014-09-21', 'ST JULIEN', 'ST MIHIEL', 0, 1, 1, 'ADMIN', '2014-10-04 14:54:08'),
(4, 1, '2014-10-05', 'DELME SOLGNE', 'ST JULIEN', 0, 0, 0, 'ADMIN', '2014-10-04 14:54:08'),
(5, 1, '2014-10-19', 'ST JULIEN', 'VELAINES', 0, 0, 0, 'ADMIN', '2014-10-04 14:54:08'),
(6, 1, '2014-10-26', 'ST JULIEN', 'VILLEY ST ETIENNE', 0, 0, 0, 'ADMIN', '2014-10-04 14:54:08'),
(7, 1, '2014-11-02', 'NEUVES MAISONS 2', 'ST JULIEN', 0, 0, 0, 'ADMIN', '2014-10-04 14:54:08'),
(8, 1, '2014-11-09', 'ST JULIEN', 'TRONVILLE', 0, 0, 0, 'ADMIN', '2014-10-04 14:54:08'),
(9, 1, '2014-11-23', 'HANNONVILLE', 'ST JULIEN', 0, 0, 0, 'ADMIN', '2014-10-04 14:54:08'),
(10, 1, '2014-11-30', 'ST JULIEN', 'RICHARDMENIL', 0, 0, 0, 'ADMIN', '2014-10-04 14:54:08'),
(11, 1, '2014-12-14', 'DEVANT LES PONTS', 'ST JULIEN', 0, 0, 0, 'ADMIN', '2014-10-04 14:57:30'),
(12, 1, '2015-02-22', 'ST JULIEN', 'LAXOU SAPINIERE', 0, 0, 0, 'ADMIN', '2014-10-04 14:57:30'),
(13, 1, '2015-03-01', 'ST MIHIEL', 'ST JULIEN', 0, 0, 0, 'ADMN', '2014-10-04 14:57:30'),
(14, 1, '2015-03-08', 'ST JULIEN', 'DELME SOLGNE', 0, 0, 0, 'ADMIN', '2014-10-04 14:57:30'),
(15, 1, '2015-03-15', 'VELAINES', 'ST JULIEN', 0, 0, 0, 'ADMIN', '2014-10-04 14:57:30'),
(16, 1, '2015-03-29', 'VILLEY ST ETIENNE', 'ST JULIEN', 0, 0, 0, 'ADMIN', '2014-10-04 14:57:30'),
(17, 1, '2015-04-12', 'ST JULIEN', 'NEUVES MAISONS 2', 0, 0, 0, 'ADMIN', '2014-10-04 14:57:30'),
(18, 1, '2015-04-26', 'TRONVILLE', 'ST JULIEN', 0, 0, 0, 'ADMIN', '2014-10-04 14:57:30'),
(19, 1, '2015-05-03', 'ST JULIEN', 'HANNONVILLE', 0, 0, 0, 'ADMIN', '2014-10-04 14:57:30'),
(20, 1, '2015-05-10', 'RICHARMENIL', 'ST JULIEN', 0, 0, 0, 'ADMIN', '2014-10-04 14:57:30'),
(21, 1, '2015-05-17', 'ST JULIEN', 'DEVANT LES PONTS', 0, 0, 0, 'ADMIN', '2014-10-04 14:58:14'),
(22, 1, '2015-05-31', 'ES WOIPPY', 'ST JULIEN', 0, 0, 0, 'ADMIN', '2014-10-04 14:58:14'),
(23, 2, '2014-08-31', 'DEVANT LES PONTS 2', 'ST JULIEN 2', 5, 1, 1, 'ADMIN', '2014-10-04 15:04:43'),
(24, 2, '2014-09-07', 'ST JULIEN 2', 'LA MAXE', 1, 5, 1, 'ADMIN', '2014-10-04 15:04:43'),
(25, 2, '2014-09-21', 'MOULINS LES METZ', 'ST JULIEN 2', 2, 2, 1, 'ADMIN', '2014-10-04 15:04:43'),
(26, 2, '2014-10-05', 'ST JULIEN 2', 'VIGY', 0, 0, 0, 'ADMIN', '2014-10-04 15:04:43'),
(27, 2, '2014-10-19', 'LES COTEAUX', 'ST JULIEN 2', 0, 0, 0, 'AMIN', '2014-10-04 15:04:43'),
(28, 2, '2014-10-26', 'CO METZ 2', 'ST JULIEN 2', 0, 0, 0, 'ADMIN', '2014-10-04 15:04:43'),
(29, 2, '2014-11-02', 'ST JULIEN 2', 'PIERREVILLERS', 0, 0, 0, 'ADMIN', '2014-10-04 15:04:43'),
(30, 2, '2014-11-09', 'CUVRY', 'ST JULIEN 2', 0, 0, 0, 'ADMIN', '2014-10-04 15:04:43'),
(31, 2, '2014-11-23', 'ST JULIEN 2', 'ES MAIZIERES 2', 0, 0, 0, 'ADMIN', '2014-10-04 15:04:43'),
(32, 2, '2015-08-03', 'LA MAXE', 'ST JULIEN 2', 0, 0, 0, 'ADMIN', '2014-10-04 15:04:43'),
(33, 2, '2015-03-15', 'ST JULIEN 2', 'MOULINS LES METZ', 0, 0, 0, 'ADMIN', '2014-10-04 15:04:43'),
(34, 2, '2015-03-29', 'VIGY', 'ST JULIEN 2', 0, 0, 0, 'ADMIN', '2014-10-04 15:04:43'),
(35, 2, '2015-04-12', 'ST JULIEN 2', 'LES COTEAUX', 0, 0, 0, 'ADMIN', '2014-10-04 15:04:43'),
(36, 2, '2015-04-26', 'ST JULIEN 2', 'CO METZ 2', 0, 0, 0, 'ADMIN', '2014-10-04 15:04:43'),
(37, 2, '2015-05-03', 'PIERREVILLERS', 'ST JULIEN 2', 0, 0, 0, 'ADMIN', '2014-10-04 15:04:43'),
(38, 2, '2015-05-10', 'ST JULIEN 2', 'CUVRY', 0, 0, 0, 'ADMIN', '2014-10-04 15:04:43'),
(39, 2, '2015-05-17', 'ES MAIZIERES 2', 'ST JULIEN 2', 0, 0, 0, 'ADMIN', '2014-10-04 15:04:43'),
(40, 2, '2015-05-31', 'ST JULIEN 2', 'DEVANT LES PONTS 2', 0, 0, 0, 'ADMIN', '2014-10-04 15:04:43'),
(41, 3, '2014-09-14', 'MOULINS LES METZ', 'ST JULIEN', 6, 1, 1, 'ADMIN', '2014-10-04 15:55:52'),
(42, 3, '2014-09-20', 'ST JULIEN', 'MARLY 2', 6, 1, 1, 'ADMIN', '2014-10-04 15:55:52'),
(43, 3, '2014-09-24', 'BAN ST MARTIN', 'ST JULIEN', 1, 5, 1, 'ADMIN', '2014-10-04 15:55:52'),
(44, 3, '2014-10-11', 'NOVEANT', 'ST JULIEN', 0, 0, 0, 'ADMIN', '2014-10-04 15:55:52'),
(45, 3, '2014-10-25', 'ST JULIEN', 'ES WOIPPY', 0, 0, 0, 'ADMIN', '2014-10-04 15:55:52'),
(46, 3, '2014-11-11', 'MONTIGNY LES METZ', 'ST JULIEN', 0, 0, 0, 'ADMIN', '2014-10-04 15:55:52'),
(47, 3, '2014-11-15', 'ST JULIEN', 'PLANTIERES 2', 0, 0, 0, 'ADMIN', '2014-10-04 15:55:52'),
(48, 3, '2014-11-23', 'PELTRE', 'ST JULIEN', 0, 0, 0, 'ADMIN', '2014-10-04 15:55:52'),
(49, 3, '2014-11-29', 'ST JULIEN', 'ES METZ 2', 0, 0, 0, 'ADMIN', '2014-10-04 15:55:52'),
(50, 4, '2014-09-13', 'ST JULIEN', 'APM 3', 5, 6, 1, 'ADMIN', '2014-10-04 15:58:36'),
(51, 4, '2014-09-20', 'BECHY', 'ST JULIEN', 3, 2, 1, 'ADMIN', '2014-10-04 15:58:36'),
(52, 4, '2014-09-27', 'ST JULIEN', 'COURCELLES / NIED 2', 11, 0, 1, 'ADMIN', '2014-10-04 15:58:36'),
(53, 4, '2014-10-11', 'ST JULIEN', 'MOULINS LES METZ', 0, 0, 0, 'ADMIN', '2014-10-04 15:58:36'),
(54, 4, '2014-11-08', 'ESAP', 'ST JULIEN', 0, 0, 0, 'ADMIN', '2014-10-04 15:58:36'),
(55, 4, '2014-11-15', 'ST JULIEN', 'ES WOIPPY', 0, 0, 0, 'ADMIN', '2014-10-04 15:58:36'),
(56, 4, '2014-11-22', 'MONTIGNY LES METZ 2', 'ST JULIEN', 0, 0, 0, 'ADMIN', '2014-10-04 15:58:36');
-- --------------------------------------------------------
--
-- Contenu de la table `saison`
--
INSERT INTO `saison` (`ID`, `LIBELLE`, `ETAT`, `AUTEUR_MAJ`, `DERNIERE_MAJ`) VALUES
(1, '2014', 1, 'ADMIN', '2014-10-04 11:47:41'),
(2, '2015', 0, 'ADMIN', '2014-10-04 11:47:41');
-- --------------------------------------------------------
--
-- Contenu de la table `sponsor`
--
INSERT INTO `sponsor` (`ID`, `NOM`, `URL`, `VIGNETTE`, `ADRESSE`, `CP`, `VILLE`, `TEL`, `FAX`, `EMAIL`, `AUTEUR_MAJ`, `DERNIERE_MAJ`) VALUES
(1, 'Kinepolis Saint Julien Les Metz', 'http://kinepolis.fr/splash?destination=cinemas/kinepolis-st-julien-les-metz', 'images/kinepolis.jpg', '10 AVENUE PAUL LANGEVIN', '57070', 'SAINT JULIEN LES METZ', '0387758450', '0387758456', '', 'ADMIN', '2014-10-28 15:50:08'),
(2, 'Credit Mutuel', 'https://www.creditmutuel.fr/', 'images/creditMutuel.jpg', '28 RUE JEAN BURGER', '57070', 'SAINT JULIEN LES METZ', '0820000130', '0387761683', '05004@creditmutuel.fr', 'ADMIN', '2014-10-28 15:40:28'),
(3, 'Placards MAGE', 'http://www.placardsmage.fr/', 'images/mage_2014.jpg', 'LA BELLE FONTAINE', '57155', 'MARLY', '0387664207', '0387663904', '', 'ADMIN', '2014-10-28 15:43:13'),
(4, 'Groupe Salmon', 'http://www.groupe-salmon.fr/', 'images/salmon.jpg', '28 AVENUE DE THIONVILLE', '57140', 'METZ WOIPPY', '0387325261', '0387310374', 'salmon@groupe-salmon.fr', 'ADMIN', '2014-10-28 15:41:55'),
(5, 'Lori''s Sports', 'http://www.lori-s.fr/', 'images/lorissports.jpg', '38 ROUTE DE PLAPEVILLE', '57050', 'LE BAN SAINT MARTIN', '0387301031', '', 'loris4@wanadoo.fr', 'ADMIN', '2014-10-28 15:44:55'),
(6, 'Sport 2000', 'http://www.sport2000.fr/', 'images/sport2000.jpg', '4 RUE DE BOUSSE', '57300', 'MONDELANGE', '0387714630', '0387719445', 'sport2000bureaumondelange@hotmail.fr', 'ADMIN', '2014-10-28 15:48:50'),
(7, 'Super U', 'http://www.magasins-u.com/superu-saintjulienlesmetz', 'images/superU.jpg', 'RUE FRANCOIS SIMON', '57070', 'SAINT JULIEN LES METZ', '0387762302', '', '', 'ADMIN', '2014-10-28 15:46:19'),
(8, 'Fédération Française de Football', 'http://www.fff.fr', 'images/fff.jpg', '87 BOULEVARD DE GRENELLE', '75738', 'PARIS CEDEX 15', '0144317300', '0144317373', NULL, 'ADMIN', '2014-10-30 10:23:41'),
(9, 'Ligue Lorraine de Football', 'http://lorraine.fff.fr', 'images/llf.png', '1 RUE DE LA GRANDE DOUVE', '54250', 'CHAMPIGNEULLES', '0383918002', '0383901824', 'secretariat@lorraine.fff.fr', 'ADMIN', '2014-10-30 10:23:41'),
(10, 'District Mosellan de Football', 'http://moselle.fff.fr', 'images/dmf.gif', '49 RUE DU GENERAL METMAN', '57070', 'METZ', '0387755311', '0387363140', 'secretariat@moselle.fff.fr', 'ADMIN', '2014-10-30 12:26:23'),
(11, 'Ville de Saint Julien Lès Metz', 'http://mairie-stjulienlesmetz.fr/', 'images/ville.jpg', '108 RUE GENERAL DIOU', '57070', 'SAINT JULIEN LES METZ', '0387740717', '0387754038', 'mairie.st-julien@wanadoo.fr', 'ADMIN', '2014-10-30 10:23:41');
| true |
b0186cf581547becbaed474c052bea3a4c4b890e | SQL | Willremi/Groupe6 | /ExercicesBDD/product.sql | UTF-8 | 2,330 | 3.5 | 4 | [] | no_license | -- MySQL Script generated by MySQL Workbench
-- Mon Mar 30 14:17:17 2020
-- Model: New Model Version: 1.0
-- MySQL Workbench Forward Engineering
SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;
SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION';
-- -----------------------------------------------------
-- Schema Product
-- -----------------------------------------------------
DROP SCHEMA IF EXISTS `Product` ;
-- -----------------------------------------------------
-- Schema Product
-- -----------------------------------------------------
CREATE SCHEMA IF NOT EXISTS `Product` DEFAULT CHARACTER SET utf8 ;
USE `Product` ;
-- -----------------------------------------------------
-- Table `Product`.`Category`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `Product`.`Category` ;
CREATE TABLE IF NOT EXISTS `Product`.`Category` (
`idCategory` INT NOT NULL AUTO_INCREMENT,
`NomCat` VARCHAR(255) NOT NULL,
`typeCat` VARCHAR(255) NOT NULL,
`statutCat` INT NULL,
`dateAddCat` DATE NOT NULL,
`dateUpdateCat` DATE NULL,
PRIMARY KEY (`idCategory`),
UNIQUE INDEX `idCategory_UNIQUE` (`idCategory` ASC))
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `Product`.`Product`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `Product`.`Product` ;
CREATE TABLE IF NOT EXISTS `Product`.`Product` (
`idProduct` INT NOT NULL AUTO_INCREMENT,
`nomProduct` VARCHAR(255) NOT NULL,
`prixProduct` DECIMAL UNSIGNED NOT NULL,
`dateAjoutProduct` DATE NOT NULL,
`dateModifProduct` DATE NULL,
`statutProduc` INT NULL,
`Category_idCategory` INT NOT NULL,
PRIMARY KEY (`idProduct`, `Category_idCategory`),
UNIQUE INDEX `idProduct_UNIQUE` (`idProduct` ASC),
INDEX `fk_Product_Category_idx` (`Category_idCategory` ASC),
CONSTRAINT `fk_Product_Category`
FOREIGN KEY (`Category_idCategory`)
REFERENCES `Product`.`Category` (`idCategory`)
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;
| true |
41bd6f3c1ad6ba5ec34a121f3685dd50e3c0ce43 | SQL | kongyew/gpdb | /src/test/tinc/tincrepo/mpp/gpdb/tests/storage/filerep_end_to_end/resync/sql/resync_drop_col_heap_with_default.sql | UTF-8 | 120,505 | 3.046875 | 3 | [
"Apache-2.0",
"LicenseRef-scancode-generic-cla",
"PostgreSQL",
"LicenseRef-scancode-other-copyleft",
"metamail",
"BSD-3-Clause",
"LicenseRef-scancode-openssl",
"LicenseRef-scancode-other-permissive",
"ISC",
"Python-2.0",
"bzip2-1.0.6",
"LicenseRef-scancode-ssleay-windows",
"LicenseRef-scanco... | permissive | -- start_ignore
SET gp_create_table_random_default_distribution=off;
-- end_ignore
--
-- RESYNC TABLE resync_drop_column_heap_default1
--
CREATE TABLE resync_drop_column_heap_default1 ( a int,col001 char DEFAULT 'z',col002 numeric,col003 boolean DEFAULT false,col004 bit(3) DEFAULT '111',col005 text DEFAULT 'pookie', col006 integer[] DEFAULT '{5, 4, 3, 2, 1}', col007 character varying(512) DEFAULT 'Now is the time', col008 character varying DEFAULT 'Now is the time', col009 character varying(512)[], col010 numeric(8),col011 int,col012 double precision, col013 bigint, col014 char(8), col015 bytea,col016 timestamp with time zone,col017 interval, col018 cidr, col019 inet, col020 macaddr,col021 serial ,col022 money,col023 bigserial, col024 timetz,col025 circle, col026 box, col027 name,col028 path, col029 int2,
col031 bit varying(256),col032 date, col034 lseg,col035 point,col036 polygon,col037 real,col039 time, col040 timestamp );
INSERT INTO resync_drop_column_heap_default1 VALUES (generate_series(1,10) ,'a',11,true,'111', '1_one', '{1,2,3,4,5}', 'Hello .. how are you', 'Hello .. how are you', '{one,two,three,four,five}', 12345678, 1, 111.1111, 11, '1_one_11', 'd','2001-12-13 01:51:15+1359', '11', '0.0.0.0', '0.0.0.0', 'AA:AA:AA:AA:AA:AA', generate_series(1,10), '34.23', generate_series(1,10), '00:00:00+1359', '((2,2),1)', '((1,2),(2,1))', 'hello', '((1,2),(2,1))', 11, '010101', '2001-12-13', '((1,1),(2,2))', '(1,1)', '((1,2),(2,3),(3,4),(4,3),(3,2),(2,1))', 111111, '23:00:00', '2001-12-13 01:51:15');
SELECT count(*) FROM resync_drop_column_heap_default1;
--
-- RESYNC TABLE resync_drop_column_heap_default2
--
CREATE TABLE resync_drop_column_heap_default2 ( a int,col001 char DEFAULT 'z',col002 numeric,col003 boolean DEFAULT false,col004 bit(3) DEFAULT '111',col005 text DEFAULT 'pookie', col006 integer[] DEFAULT '{5, 4, 3, 2, 1}', col007 character varying(512) DEFAULT 'Now is the time', col008 character varying DEFAULT 'Now is the time', col009 character varying(512)[], col010 numeric(8),col011 int,col012 double precision, col013 bigint, col014 char(8), col015 bytea,col016 timestamp with time zone,col017 interval, col018 cidr, col019 inet, col020 macaddr,col021 serial ,col022 money,col023 bigserial, col024 timetz,col025 circle, col026 box, col027 name,col028 path, col029 int2,
col031 bit varying(256),col032 date, col034 lseg,col035 point,col036 polygon,col037 real,col039 time, col040 timestamp );
INSERT INTO resync_drop_column_heap_default2 VALUES (generate_series(1,10) ,'a',11,true,'111', '1_one', '{1,2,3,4,5}', 'Hello .. how are you', 'Hello .. how are you', '{one,two,three,four,five}', 12345678, 1, 111.1111, 11, '1_one_11', 'd','2001-12-13 01:51:15+1359', '11', '0.0.0.0', '0.0.0.0', 'AA:AA:AA:AA:AA:AA', generate_series(1,10), '34.23', generate_series(1,10), '00:00:00+1359', '((2,2),1)', '((1,2),(2,1))', 'hello', '((1,2),(2,1))', 11, '010101', '2001-12-13', '((1,1),(2,2))', '(1,1)', '((1,2),(2,3),(3,4),(4,3),(3,2),(2,1))', 111111, '23:00:00', '2001-12-13 01:51:15');
SELECT count(*) FROM resync_drop_column_heap_default2;
--
-- RESYNC TABLE resync_drop_column_heap_default3
--
CREATE TABLE resync_drop_column_heap_default3 ( a int,col001 char DEFAULT 'z',col002 numeric,col003 boolean DEFAULT false,col004 bit(3) DEFAULT '111',col005 text DEFAULT 'pookie', col006 integer[] DEFAULT '{5, 4, 3, 2, 1}', col007 character varying(512) DEFAULT 'Now is the time', col008 character varying DEFAULT 'Now is the time', col009 character varying(512)[], col010 numeric(8),col011 int,col012 double precision, col013 bigint, col014 char(8), col015 bytea,col016 timestamp with time zone,col017 interval, col018 cidr, col019 inet, col020 macaddr,col021 serial ,col022 money,col023 bigserial, col024 timetz,col025 circle, col026 box, col027 name,col028 path, col029 int2,
col031 bit varying(256),col032 date, col034 lseg,col035 point,col036 polygon,col037 real,col039 time, col040 timestamp );
INSERT INTO resync_drop_column_heap_default3 VALUES (generate_series(1,10) ,'a',11,true,'111', '1_one', '{1,2,3,4,5}', 'Hello .. how are you', 'Hello .. how are you', '{one,two,three,four,five}', 12345678, 1, 111.1111, 11, '1_one_11', 'd','2001-12-13 01:51:15+1359', '11', '0.0.0.0', '0.0.0.0', 'AA:AA:AA:AA:AA:AA', generate_series(1,10), '34.23', generate_series(1,10), '00:00:00+1359', '((2,2),1)', '((1,2),(2,1))', 'hello', '((1,2),(2,1))', 11, '010101', '2001-12-13', '((1,1),(2,2))', '(1,1)', '((1,2),(2,3),(3,4),(4,3),(3,2),(2,1))', 111111, '23:00:00', '2001-12-13 01:51:15');
SELECT count(*) FROM resync_drop_column_heap_default3;
--
-- RESYNC TABLE - used for insert select
--
CREATE TABLE resync_heap_drop ( a int,col001 char DEFAULT 'z',col002 numeric,col003 boolean DEFAULT false,col004 bit(3) DEFAULT '111',col005 text DEFAULT 'pookie', col006 integer[] DEFAULT '{5, 4, 3, 2, 1}', col007 character varying(512) DEFAULT 'Now is the time', col008 character varying DEFAULT 'Now is the time', col009 character varying(512)[], col010 numeric(8),col011 int,col012 double precision, col013 bigint, col014 char(8), col015 bytea,col016 timestamp with time zone,col017 interval, col018 cidr, col019 inet, col020 macaddr,col021 serial ,col022 money,col023 bigserial, col024 timetz,col025 circle, col026 box, col027 name,col028 path, col029 int2,
col031 bit varying(256),col032 date, col034 lseg,col035 point,col036 polygon,col037 real,col039 time, col040 timestamp );
INSERT INTO resync_heap_drop VALUES (generate_series(1,10) ,'a',11,true,'111', '1_one', '{1,2,3,4,5}', 'Hello .. how are you', 'Hello .. how are you', '{one,two,three,four,five}', 12345678, 1, 111.1111, 11, '1_one_11', 'd','2001-12-13 01:51:15+1359', '11', '0.0.0.0', '0.0.0.0', 'AA:AA:AA:AA:AA:AA', generate_series(1,10), '34.23', generate_series(1,10), '00:00:00+1359', '((2,2),1)', '((1,2),(2,1))', 'hello', '((1,2),(2,1))', 11, '010101', '2001-12-13', '((1,1),(2,2))', '(1,1)', '((1,2),(2,3),(3,4),(4,3),(3,2),(2,1))', 111111, '23:00:00', '2001-12-13 01:51:15');
SELECT count(*) FROM resync_heap_drop;
--
--
--
-- DROP ALL COLUMN WITH DEFAULT TO - > RESYNC TABLE resync_drop_column_heap_default1
--
--
--
ALTER TABLE resync_drop_column_heap_default1 DROP COLUMN col001;
INSERT INTO resync_drop_column_heap_default1 VALUES (generate_series(1,10) ,11,true,'111', '1_one', '{1,2,3,4,5}', 'Hello .. how are you', 'Hello .. how are you', '{one,two,three,four,five}', 12345678, 1, 111.1111, 11, '1_one_11', 'd','2001-12-13 01:51:15+1359', '11', '0.0.0.0', '0.0.0.0', 'AA:AA:AA:AA:AA:AA', generate_series(1,10), '34.23', generate_series(1,10), '00:00:00+1359', '((2,2),1)', '((1,2),(2,1))', 'hello', '((1,2),(2,1))', 11, '010101', '2001-12-13', '((1,1),(2,2))', '(1,1)', '((1,2),(2,3),(3,4),(4,3),(3,2),(2,1))', 111111, '23:00:00', '2001-12-13 01:51:15');
SELECT count(*) FROM resync_drop_column_heap_default1;
INSERT INTO resync_drop_column_heap_default1 SELECT a,col002 , col003, col004, col005, col006, col007 , col008, col009, col010, col011,col012 ,col013, col014, col015 , col016, col017 ,col018 ,col019, col020, col021, col022, col023, col024, col025 , col026, col027 , col028, col029 , col031, col032 , col034 , col035, col036 , col037, col039 , col040 from resync_heap_drop;
SELECT count(*) FROM resync_drop_column_heap_default1;
--
--
ALTER TABLE resync_drop_column_heap_default1 DROP COLUMN col002;
INSERT INTO resync_drop_column_heap_default1 VALUES (generate_series(1,10) ,true,'111', '1_one', '{1,2,3,4,5}', 'Hello .. how are you', 'Hello .. how are you', '{one,two,three,four,five}', 12345678, 1, 111.1111, 11, '1_one_11', 'd','2001-12-13 01:51:15+1359', '11', '0.0.0.0', '0.0.0.0', 'AA:AA:AA:AA:AA:AA', generate_series(1,10), '34.23', generate_series(1,10), '00:00:00+1359', '((2,2),1)', '((1,2),(2,1))', 'hello', '((1,2),(2,1))', 11, '010101', '2001-12-13', '((1,1),(2,2))', '(1,1)', '((1,2),(2,3),(3,4),(4,3),(3,2),(2,1))', 111111, '23:00:00', '2001-12-13 01:51:15');
SELECT count(*) FROM resync_drop_column_heap_default1;
INSERT INTO resync_drop_column_heap_default1 SELECT a,col003, col004, col005, col006, col007 , col008, col009, col010, col011,col012 ,col013, col014, col015 , col016, col017 ,col018 ,col019, col020, col021, col022, col023, col024, col025 , col026, col027 , col028, col029 , col031, col032 , col034 , col035, col036 , col037, col039 , col040 from resync_heap_drop;
SELECT count(*) FROM resync_drop_column_heap_default1;
--
--
ALTER TABLE resync_drop_column_heap_default1 DROP COLUMN col003;
INSERT INTO resync_drop_column_heap_default1 VALUES (generate_series(1,10) ,'111', '1_one', '{1,2,3,4,5}', 'Hello .. how are you', 'Hello .. how are you', '{one,two,three,four,five}', 12345678, 1, 111.1111, 11, '1_one_11', 'd','2001-12-13 01:51:15+1359', '11', '0.0.0.0', '0.0.0.0', 'AA:AA:AA:AA:AA:AA', generate_series(1,10), '34.23', generate_series(1,10), '00:00:00+1359', '((2,2),1)', '((1,2),(2,1))', 'hello', '((1,2),(2,1))', 11, '010101', '2001-12-13', '((1,1),(2,2))', '(1,1)', '((1,2),(2,3),(3,4),(4,3),(3,2),(2,1))', 111111, '23:00:00', '2001-12-13 01:51:15');
SELECT count(*) FROM resync_drop_column_heap_default1;
INSERT INTO resync_drop_column_heap_default1 SELECT a,col004, col005, col006, col007 , col008, col009, col010, col011,col012 ,col013, col014, col015 , col016, col017 ,col018 ,col019, col020, col021, col022, col023, col024, col025 , col026, col027 , col028, col029 , col031, col032 , col034 , col035, col036 , col037, col039 , col040 from resync_heap_drop;
SELECT count(*) FROM resync_drop_column_heap_default1;
--
--
ALTER TABLE resync_drop_column_heap_default1 DROP COLUMN col004;
INSERT INTO resync_drop_column_heap_default1 VALUES (generate_series(1,10) ,'1_one', '{1,2,3,4,5}', 'Hello .. how are you', 'Hello .. how are you', '{one,two,three,four,five}', 12345678, 1, 111.1111, 11, '1_one_11', 'd','2001-12-13 01:51:15+1359', '11', '0.0.0.0', '0.0.0.0', 'AA:AA:AA:AA:AA:AA', generate_series(1,10), '34.23', generate_series(1,10), '00:00:00+1359', '((2,2),1)', '((1,2),(2,1))', 'hello', '((1,2),(2,1))', 11, '010101', '2001-12-13', '((1,1),(2,2))', '(1,1)', '((1,2),(2,3),(3,4),(4,3),(3,2),(2,1))', 111111, '23:00:00', '2001-12-13 01:51:15');
SELECT count(*) FROM resync_drop_column_heap_default1;
INSERT INTO resync_drop_column_heap_default1 SELECT a,col005, col006, col007 , col008, col009, col010, col011,col012 ,col013, col014, col015 , col016, col017 ,col018 ,col019, col020, col021, col022, col023, col024, col025 , col026, col027 , col028, col029 , col031, col032 , col034 , col035, col036 , col037, col039 , col040 from resync_heap_drop;
SELECT count(*) FROM resync_drop_column_heap_default1;
--
--
ALTER TABLE resync_drop_column_heap_default1 DROP COLUMN col005;
INSERT INTO resync_drop_column_heap_default1 VALUES (generate_series(1,10) , '{1,2,3,4,5}', 'Hello .. how are you', 'Hello .. how are you', '{one,two,three,four,five}', 12345678, 1, 111.1111, 11, '1_one_11', 'd','2001-12-13 01:51:15+1359', '11', '0.0.0.0', '0.0.0.0', 'AA:AA:AA:AA:AA:AA', generate_series(1,10), '34.23', generate_series(1,10), '00:00:00+1359', '((2,2),1)', '((1,2),(2,1))', 'hello', '((1,2),(2,1))', 11, '010101', '2001-12-13', '((1,1),(2,2))', '(1,1)', '((1,2),(2,3),(3,4),(4,3),(3,2),(2,1))', 111111, '23:00:00', '2001-12-13 01:51:15');
SELECT count(*) FROM resync_drop_column_heap_default1;
INSERT INTO resync_drop_column_heap_default1 SELECT a,col006, col007 , col008, col009, col010, col011,col012 ,col013, col014, col015 , col016, col017 ,col018 ,col019, col020, col021, col022, col023, col024, col025 , col026, col027 , col028, col029 , col031, col032 , col034 , col035, col036 , col037, col039 , col040 from resync_heap_drop;
SELECT count(*) FROM resync_drop_column_heap_default1;
--
--
ALTER TABLE resync_drop_column_heap_default1 DROP COLUMN col006;
INSERT INTO resync_drop_column_heap_default1 VALUES (generate_series(1,10) , 'Hello .. how are you', 'Hello .. how are you', '{one,two,three,four,five}', 12345678, 1, 111.1111, 11, '1_one_11', 'd','2001-12-13 01:51:15+1359', '11', '0.0.0.0', '0.0.0.0', 'AA:AA:AA:AA:AA:AA', generate_series(1,10), '34.23', generate_series(1,10), '00:00:00+1359', '((2,2),1)', '((1,2),(2,1))', 'hello', '((1,2),(2,1))', 11, '010101', '2001-12-13', '((1,1),(2,2))', '(1,1)', '((1,2),(2,3),(3,4),(4,3),(3,2),(2,1))', 111111, '23:00:00', '2001-12-13 01:51:15');
SELECT count(*) FROM resync_drop_column_heap_default1;
INSERT INTO resync_drop_column_heap_default1 SELECT a, col007 , col008, col009, col010, col011,col012 ,col013, col014, col015 , col016, col017 ,col018 ,col019, col020, col021, col022, col023, col024, col025 , col026, col027 , col028, col029 , col031, col032 , col034 , col035, col036 , col037, col039 , col040 from resync_heap_drop;
SELECT count(*) FROM resync_drop_column_heap_default1;
--
--
ALTER TABLE resync_drop_column_heap_default1 DROP COLUMN col007;
INSERT INTO resync_drop_column_heap_default1 VALUES (generate_series(1,10) , 'Hello .. how are you', '{one,two,three,four,five}', 12345678, 1, 111.1111, 11, '1_one_11', 'd','2001-12-13 01:51:15+1359', '11', '0.0.0.0', '0.0.0.0', 'AA:AA:AA:AA:AA:AA', generate_series(1,10), '34.23', generate_series(1,10), '00:00:00+1359', '((2,2),1)', '((1,2),(2,1))', 'hello', '((1,2),(2,1))', 11, '010101', '2001-12-13', '((1,1),(2,2))', '(1,1)', '((1,2),(2,3),(3,4),(4,3),(3,2),(2,1))', 111111, '23:00:00', '2001-12-13 01:51:15');
SELECT count(*) FROM resync_drop_column_heap_default1;
INSERT INTO resync_drop_column_heap_default1 SELECT a, col008, col009, col010, col011,col012 ,col013, col014, col015 , col016, col017 ,col018 ,col019, col020, col021, col022, col023, col024, col025 , col026, col027 , col028, col029 , col031, col032 , col034 , col035, col036 , col037, col039 , col040 from resync_heap_drop;
SELECT count(*) FROM resync_drop_column_heap_default1;
--
--
ALTER TABLE resync_drop_column_heap_default1 DROP COLUMN col008;
INSERT INTO resync_drop_column_heap_default1 VALUES (generate_series(1,10) ,'{one,two,three,four,five}', 12345678, 1, 111.1111, 11, '1_one_11', 'd','2001-12-13 01:51:15+1359', '11', '0.0.0.0', '0.0.0.0', 'AA:AA:AA:AA:AA:AA', generate_series(1,10), '34.23', generate_series(1,10), '00:00:00+1359', '((2,2),1)', '((1,2),(2,1))', 'hello', '((1,2),(2,1))', 11, '010101', '2001-12-13', '((1,1),(2,2))', '(1,1)', '((1,2),(2,3),(3,4),(4,3),(3,2),(2,1))', 111111, '23:00:00', '2001-12-13 01:51:15');
SELECT count(*) FROM resync_drop_column_heap_default1;
INSERT INTO resync_drop_column_heap_default1 SELECT a, col009, col010, col011,col012 ,col013, col014, col015 , col016, col017 ,col018 ,col019, col020, col021, col022, col023, col024, col025 , col026, col027 , col028, col029 , col031, col032 , col034 , col035, col036 , col037, col039 , col040 from resync_heap_drop;
SELECT count(*) FROM resync_drop_column_heap_default1;
--
--
ALTER TABLE resync_drop_column_heap_default1 DROP COLUMN col009;
INSERT INTO resync_drop_column_heap_default1 VALUES (generate_series(1,10) ,12345678, 1, 111.1111, 11, '1_one_11', 'd','2001-12-13 01:51:15+1359', '11', '0.0.0.0', '0.0.0.0', 'AA:AA:AA:AA:AA:AA', generate_series(1,10), '34.23', generate_series(1,10), '00:00:00+1359', '((2,2),1)', '((1,2),(2,1))', 'hello', '((1,2),(2,1))', 11, '010101', '2001-12-13', '((1,1),(2,2))', '(1,1)', '((1,2),(2,3),(3,4),(4,3),(3,2),(2,1))', 111111, '23:00:00', '2001-12-13 01:51:15');
SELECT count(*) FROM resync_drop_column_heap_default1;
INSERT INTO resync_drop_column_heap_default1 SELECT a,col010, col011,col012 ,col013, col014, col015 , col016, col017 ,col018 ,col019, col020, col021, col022, col023, col024, col025 , col026, col027 , col028, col029 , col031, col032 , col034 , col035, col036 , col037, col039 , col040 from resync_heap_drop;
SELECT count(*) FROM resync_drop_column_heap_default1;
--
--
ALTER TABLE resync_drop_column_heap_default1 DROP COLUMN col010;
INSERT INTO resync_drop_column_heap_default1 VALUES (generate_series(1,10) ,1, 111.1111, 11, '1_one_11', 'd','2001-12-13 01:51:15+1359', '11', '0.0.0.0', '0.0.0.0', 'AA:AA:AA:AA:AA:AA', generate_series(1,10), '34.23', generate_series(1,10), '00:00:00+1359', '((2,2),1)', '((1,2),(2,1))', 'hello', '((1,2),(2,1))', 11, '010101', '2001-12-13', '((1,1),(2,2))', '(1,1)', '((1,2),(2,3),(3,4),(4,3),(3,2),(2,1))', 111111, '23:00:00', '2001-12-13 01:51:15');
SELECT count(*) FROM resync_drop_column_heap_default1;
INSERT INTO resync_drop_column_heap_default1 SELECT a,col011,col012 ,col013, col014, col015 , col016, col017 ,col018 ,col019, col020, col021, col022, col023, col024, col025 , col026, col027 , col028, col029 , col031, col032 , col034 , col035, col036 , col037, col039 , col040 from resync_heap_drop;
SELECT count(*) FROM resync_drop_column_heap_default1;
--
--
ALTER TABLE resync_drop_column_heap_default1 DROP COLUMN col011;
INSERT INTO resync_drop_column_heap_default1 VALUES (generate_series(1,10) , 111.1111, 11, '1_one_11', 'd','2001-12-13 01:51:15+1359', '11', '0.0.0.0', '0.0.0.0', 'AA:AA:AA:AA:AA:AA', generate_series(1,10), '34.23', generate_series(1,10), '00:00:00+1359', '((2,2),1)', '((1,2),(2,1))', 'hello', '((1,2),(2,1))', 11, '010101', '2001-12-13', '((1,1),(2,2))', '(1,1)', '((1,2),(2,3),(3,4),(4,3),(3,2),(2,1))', 111111, '23:00:00', '2001-12-13 01:51:15');
SELECT count(*) FROM resync_drop_column_heap_default1;
INSERT INTO resync_drop_column_heap_default1 SELECT a,col012 ,col013, col014, col015 , col016, col017 ,col018 ,col019, col020, col021, col022, col023, col024, col025 , col026, col027 , col028, col029 , col031, col032 , col034 , col035, col036 , col037, col039 , col040 from resync_heap_drop;
SELECT count(*) FROM resync_drop_column_heap_default1;
--
--
ALTER TABLE resync_drop_column_heap_default1 DROP COLUMN col012;
INSERT INTO resync_drop_column_heap_default1 VALUES (generate_series(1,10) , 11, '1_one_11', 'd','2001-12-13 01:51:15+1359', '11', '0.0.0.0', '0.0.0.0', 'AA:AA:AA:AA:AA:AA', generate_series(1,10), '34.23', generate_series(1,10), '00:00:00+1359', '((2,2),1)', '((1,2),(2,1))', 'hello', '((1,2),(2,1))', 11, '010101', '2001-12-13', '((1,1),(2,2))', '(1,1)', '((1,2),(2,3),(3,4),(4,3),(3,2),(2,1))', 111111, '23:00:00', '2001-12-13 01:51:15');
SELECT count(*) FROM resync_drop_column_heap_default1;
INSERT INTO resync_drop_column_heap_default1 SELECT a,col013, col014, col015 , col016, col017 ,col018 ,col019, col020, col021, col022, col023, col024, col025 , col026, col027 , col028, col029 , col031, col032 , col034 , col035, col036 , col037, col039 , col040 from resync_heap_drop;
SELECT count(*) FROM resync_drop_column_heap_default1;
--
--
ALTER TABLE resync_drop_column_heap_default1 DROP COLUMN col013;
INSERT INTO resync_drop_column_heap_default1 VALUES (generate_series(1,10) ,'1_one_11', 'd','2001-12-13 01:51:15+1359', '11', '0.0.0.0', '0.0.0.0', 'AA:AA:AA:AA:AA:AA', generate_series(1,10), '34.23', generate_series(1,10), '00:00:00+1359', '((2,2),1)', '((1,2),(2,1))', 'hello', '((1,2),(2,1))', 11, '010101', '2001-12-13', '((1,1),(2,2))', '(1,1)', '((1,2),(2,3),(3,4),(4,3),(3,2),(2,1))', 111111, '23:00:00', '2001-12-13 01:51:15');
SELECT count(*) FROM resync_drop_column_heap_default1;
INSERT INTO resync_drop_column_heap_default1 SELECT a,col014, col015 , col016, col017 ,col018 ,col019, col020, col021, col022, col023, col024, col025 , col026, col027 , col028, col029 , col031, col032 , col034 , col035, col036 , col037, col039 , col040 from resync_heap_drop;
SELECT count(*) FROM resync_drop_column_heap_default1;
--
--
ALTER TABLE resync_drop_column_heap_default1 DROP COLUMN col014;
INSERT INTO resync_drop_column_heap_default1 VALUES (generate_series(1,10) ,'d','2001-12-13 01:51:15+1359', '11', '0.0.0.0', '0.0.0.0', 'AA:AA:AA:AA:AA:AA', generate_series(1,10), '34.23', generate_series(1,10), '00:00:00+1359', '((2,2),1)', '((1,2),(2,1))', 'hello', '((1,2),(2,1))', 11, '010101', '2001-12-13', '((1,1),(2,2))', '(1,1)', '((1,2),(2,3),(3,4),(4,3),(3,2),(2,1))', 111111, '23:00:00', '2001-12-13 01:51:15');
SELECT count(*) FROM resync_drop_column_heap_default1;
INSERT INTO resync_drop_column_heap_default1 SELECT a, col015 , col016, col017 ,col018 ,col019, col020, col021, col022, col023, col024, col025 , col026, col027 , col028, col029 , col031, col032 , col034 , col035, col036 , col037, col039 , col040 from resync_heap_drop;
SELECT count(*) FROM resync_drop_column_heap_default1;
--
--
ALTER TABLE resync_drop_column_heap_default1 DROP COLUMN col015;
INSERT INTO resync_drop_column_heap_default1 VALUES (generate_series(1,10) ,'2001-12-13 01:51:15+1359', '11', '0.0.0.0', '0.0.0.0', 'AA:AA:AA:AA:AA:AA', generate_series(1,10), '34.23', generate_series(1,10), '00:00:00+1359', '((2,2),1)', '((1,2),(2,1))', 'hello', '((1,2),(2,1))', 11, '010101', '2001-12-13', '((1,1),(2,2))', '(1,1)', '((1,2),(2,3),(3,4),(4,3),(3,2),(2,1))', 111111, '23:00:00', '2001-12-13 01:51:15');
SELECT count(*) FROM resync_drop_column_heap_default1;
INSERT INTO resync_drop_column_heap_default1 SELECT a,col016, col017 ,col018 ,col019, col020, col021, col022, col023, col024, col025 , col026, col027 , col028, col029 , col031, col032 , col034 , col035, col036 , col037, col039 , col040 from resync_heap_drop;
SELECT count(*) FROM resync_drop_column_heap_default1;
--
--
ALTER TABLE resync_drop_column_heap_default1 DROP COLUMN col016;
INSERT INTO resync_drop_column_heap_default1 VALUES (generate_series(1,10) , '11', '0.0.0.0', '0.0.0.0', 'AA:AA:AA:AA:AA:AA', generate_series(1,10), '34.23', generate_series(1,10), '00:00:00+1359', '((2,2),1)', '((1,2),(2,1))', 'hello', '((1,2),(2,1))', 11, '010101', '2001-12-13', '((1,1),(2,2))', '(1,1)', '((1,2),(2,3),(3,4),(4,3),(3,2),(2,1))', 111111, '23:00:00', '2001-12-13 01:51:15');
SELECT count(*) FROM resync_drop_column_heap_default1;
INSERT INTO resync_drop_column_heap_default1 SELECT a, col017 ,col018 ,col019, col020, col021, col022, col023, col024, col025 , col026, col027 , col028, col029 , col031, col032 , col034 , col035, col036 , col037, col039 , col040 from resync_heap_drop;
SELECT count(*) FROM resync_drop_column_heap_default1;
--
--
ALTER TABLE resync_drop_column_heap_default1 DROP COLUMN col017;
INSERT INTO resync_drop_column_heap_default1 VALUES (generate_series(1,10) ,'0.0.0.0','0.0.0.0', 'AA:AA:AA:AA:AA:AA', generate_series(1,10), '34.23', generate_series(1,10), '00:00:00+1359', '((2,2),1)', '((1,2),(2,1))', 'hello', '((1,2),(2,1))', 11, '010101', '2001-12-13', '((1,1),(2,2))', '(1,1)', '((1,2),(2,3),(3,4),(4,3),(3,2),(2,1))', 111111, '23:00:00', '2001-12-13 01:51:15');
SELECT count(*) FROM resync_drop_column_heap_default1;
INSERT INTO resync_drop_column_heap_default1 SELECT a,col018 ,col019, col020, col021, col022, col023, col024, col025 , col026, col027 , col028, col029 , col031, col032 , col034 , col035, col036 , col037, col039 , col040 from resync_heap_drop;
SELECT count(*) FROM resync_drop_column_heap_default1;
--
--
ALTER TABLE resync_drop_column_heap_default1 DROP COLUMN col018;
INSERT INTO resync_drop_column_heap_default1 VALUES (generate_series(1,10) ,'0.0.0.0', 'AA:AA:AA:AA:AA:AA', generate_series(1,10), '34.23', generate_series(1,10), '00:00:00+1359', '((2,2),1)', '((1,2),(2,1))', 'hello', '((1,2),(2,1))', 11, '010101', '2001-12-13', '((1,1),(2,2))', '(1,1)', '((1,2),(2,3),(3,4),(4,3),(3,2),(2,1))', 111111, '23:00:00', '2001-12-13 01:51:15');
SELECT count(*) FROM resync_drop_column_heap_default1;
INSERT INTO resync_drop_column_heap_default1 SELECT a,col019, col020, col021, col022, col023, col024, col025 , col026, col027 , col028, col029 , col031, col032 , col034 , col035, col036 , col037, col039 , col040 from resync_heap_drop;
SELECT count(*) FROM resync_drop_column_heap_default1;
--
--
ALTER TABLE resync_drop_column_heap_default1 DROP COLUMN col019;
INSERT INTO resync_drop_column_heap_default1 VALUES (generate_series(1,10) ,'AA:AA:AA:AA:AA:AA', generate_series(1,10), '34.23', generate_series(1,10), '00:00:00+1359', '((2,2),1)', '((1,2),(2,1))', 'hello', '((1,2),(2,1))', 11, '010101', '2001-12-13', '((1,1),(2,2))', '(1,1)', '((1,2),(2,3),(3,4),(4,3),(3,2),(2,1))', 111111, '23:00:00', '2001-12-13 01:51:15');
SELECT count(*) FROM resync_drop_column_heap_default1;
INSERT INTO resync_drop_column_heap_default1 SELECT a,col020, col021, col022, col023, col024, col025 , col026, col027 , col028, col029 , col031, col032 , col034 , col035, col036 , col037, col039 , col040 from resync_heap_drop;
SELECT count(*) FROM resync_drop_column_heap_default1;
--
--
ALTER TABLE resync_drop_column_heap_default1 DROP COLUMN col020;
INSERT INTO resync_drop_column_heap_default1 VALUES (generate_series(1,10) , generate_series(1,10), '34.23', generate_series(1,10), '00:00:00+1359', '((2,2),1)', '((1,2),(2,1))', 'hello', '((1,2),(2,1))', 11, '010101', '2001-12-13', '((1,1),(2,2))', '(1,1)', '((1,2),(2,3),(3,4),(4,3),(3,2),(2,1))', 111111, '23:00:00', '2001-12-13 01:51:15');
SELECT count(*) FROM resync_drop_column_heap_default1;
INSERT INTO resync_drop_column_heap_default1 SELECT a, col021, col022, col023, col024, col025 , col026, col027 , col028, col029 , col031, col032 , col034 , col035, col036 , col037, col039 , col040 from resync_heap_drop;
SELECT count(*) FROM resync_drop_column_heap_default1;
--
--
ALTER TABLE resync_drop_column_heap_default1 DROP COLUMN col021;
INSERT INTO resync_drop_column_heap_default1 VALUES (generate_series(1,10), '34.23', generate_series(1,10), '00:00:00+1359', '((2,2),1)', '((1,2),(2,1))', 'hello', '((1,2),(2,1))', 11, '010101', '2001-12-13', '((1,1),(2,2))', '(1,1)', '((1,2),(2,3),(3,4),(4,3),(3,2),(2,1))', 111111, '23:00:00', '2001-12-13 01:51:15');
SELECT count(*) FROM resync_drop_column_heap_default1;
INSERT INTO resync_drop_column_heap_default1 SELECT a, col022, col023, col024, col025 , col026, col027 , col028, col029 , col031, col032 , col034 , col035, col036 , col037, col039 , col040 from resync_heap_drop;
SELECT count(*) FROM resync_drop_column_heap_default1;
--
--
ALTER TABLE resync_drop_column_heap_default1 DROP COLUMN col022;
INSERT INTO resync_drop_column_heap_default1 VALUES (generate_series(1,10) , generate_series(1,10),'00:00:00+1359', '((2,2),1)', '((1,2),(2,1))', 'hello', '((1,2),(2,1))', 11, '010101', '2001-12-13', '((1,1),(2,2))', '(1,1)', '((1,2),(2,3),(3,4),(4,3),(3,2),(2,1))', 111111, '23:00:00', '2001-12-13 01:51:15');
SELECT count(*) FROM resync_drop_column_heap_default1;
INSERT INTO resync_drop_column_heap_default1 SELECT a, col023, col024, col025 , col026, col027 , col028, col029 , col031, col032 , col034 , col035, col036 , col037, col039 , col040 from resync_heap_drop;
SELECT count(*) FROM resync_drop_column_heap_default1;
--
--
ALTER TABLE resync_drop_column_heap_default1 DROP COLUMN col023;
INSERT INTO resync_drop_column_heap_default1 VALUES (generate_series(1,10) , '00:00:00+1359', '((2,2),1)', '((1,2),(2,1))', 'hello', '((1,2),(2,1))', 11, '010101', '2001-12-13', '((1,1),(2,2))', '(1,1)', '((1,2),(2,3),(3,4),(4,3),(3,2),(2,1))', 111111, '23:00:00', '2001-12-13 01:51:15');
SELECT count(*) FROM resync_drop_column_heap_default1;
INSERT INTO resync_drop_column_heap_default1 SELECT a,col024, col025 , col026, col027 , col028, col029 , col031, col032 , col034 , col035, col036 , col037, col039 , col040 from resync_heap_drop;
SELECT count(*) FROM resync_drop_column_heap_default1;
--
--
ALTER TABLE resync_drop_column_heap_default1 DROP COLUMN col024;
INSERT INTO resync_drop_column_heap_default1 VALUES (generate_series(1,10) , '((2,2),1)','((1,2),(2,1))', 'hello', '((1,2),(2,1))', 11, '010101', '2001-12-13', '((1,1),(2,2))', '(1,1)', '((1,2),(2,3),(3,4),(4,3),(3,2),(2,1))', 111111, '23:00:00', '2001-12-13 01:51:15');
SELECT count(*) FROM resync_drop_column_heap_default1;
INSERT INTO resync_drop_column_heap_default1 SELECT a,col025 , col026, col027 , col028, col029 , col031, col032 , col034 , col035, col036 , col037, col039 , col040 from resync_heap_drop;
SELECT count(*) FROM resync_drop_column_heap_default1;
--
--
ALTER TABLE resync_drop_column_heap_default1 DROP COLUMN col025;
INSERT INTO resync_drop_column_heap_default1 VALUES (generate_series(1,10) , '((1,2),(2,1))', 'hello', '((1,2),(2,1))', 11, '010101', '2001-12-13', '((1,1),(2,2))', '(1,1)', '((1,2),(2,3),(3,4),(4,3),(3,2),(2,1))', 111111, '23:00:00', '2001-12-13 01:51:15');
SELECT count(*) FROM resync_drop_column_heap_default1;
INSERT INTO resync_drop_column_heap_default1 SELECT a,col026, col027 , col028, col029 , col031, col032 , col034 , col035, col036 , col037, col039 , col040 from resync_heap_drop;
SELECT count(*) FROM resync_drop_column_heap_default1;
--
--
ALTER TABLE resync_drop_column_heap_default1 DROP COLUMN col026;
INSERT INTO resync_drop_column_heap_default1 VALUES (generate_series(1,10) ,'hello', '((1,2),(2,1))', 11, '010101', '2001-12-13', '((1,1),(2,2))', '(1,1)', '((1,2),(2,3),(3,4),(4,3),(3,2),(2,1))', 111111, '23:00:00', '2001-12-13 01:51:15');
SELECT count(*) FROM resync_drop_column_heap_default1;
INSERT INTO resync_drop_column_heap_default1 SELECT a,col027 , col028, col029 , col031, col032 , col034 , col035, col036 , col037, col039 , col040 from resync_heap_drop;
SELECT count(*) FROM resync_drop_column_heap_default1;
--
--
ALTER TABLE resync_drop_column_heap_default1 DROP COLUMN col027;
INSERT INTO resync_drop_column_heap_default1 VALUES (generate_series(1,10) ,'((1,2),(2,1))',11, '010101', '2001-12-13', '((1,1),(2,2))', '(1,1)', '((1,2),(2,3),(3,4),(4,3),(3,2),(2,1))', 111111, '23:00:00', '2001-12-13 01:51:15');
SELECT count(*) FROM resync_drop_column_heap_default1;
INSERT INTO resync_drop_column_heap_default1 SELECT a,col028, col029 , col031, col032 , col034 , col035, col036 , col037, col039 , col040 from resync_heap_drop;
SELECT count(*) FROM resync_drop_column_heap_default1;
--
--
ALTER TABLE resync_drop_column_heap_default1 DROP COLUMN col028;
INSERT INTO resync_drop_column_heap_default1 VALUES (generate_series(1,10) , 11, '010101', '2001-12-13', '((1,1),(2,2))', '(1,1)', '((1,2),(2,3),(3,4),(4,3),(3,2),(2,1))', 111111, '23:00:00', '2001-12-13 01:51:15');
SELECT count(*) FROM resync_drop_column_heap_default1;
INSERT INTO resync_drop_column_heap_default1 SELECT a,col029 , col031, col032 , col034 , col035, col036 , col037, col039 , col040 from resync_heap_drop;
SELECT count(*) FROM resync_drop_column_heap_default1;
--
--
ALTER TABLE resync_drop_column_heap_default1 DROP COLUMN col029;
INSERT INTO resync_drop_column_heap_default1 VALUES (generate_series(1,10) , '010101', '2001-12-13', '((1,1),(2,2))', '(1,1)', '((1,2),(2,3),(3,4),(4,3),(3,2),(2,1))', 111111, '23:00:00', '2001-12-13 01:51:15');
SELECT count(*) FROM resync_drop_column_heap_default1;
INSERT INTO resync_drop_column_heap_default1 SELECT a, col031, col032 , col034 , col035, col036 , col037, col039 , col040 from resync_heap_drop;
SELECT count(*) FROM resync_drop_column_heap_default1;
--
--
ALTER TABLE resync_drop_column_heap_default1 DROP COLUMN col031;
INSERT INTO resync_drop_column_heap_default1 VALUES (generate_series(1,10) , '2001-12-13', '((1,1),(2,2))', '(1,1)', '((1,2),(2,3),(3,4),(4,3),(3,2),(2,1))', 111111, '23:00:00', '2001-12-13 01:51:15');
SELECT count(*) FROM resync_drop_column_heap_default1;
INSERT INTO resync_drop_column_heap_default1 SELECT a, col032 , col034 , col035, col036 , col037, col039 , col040 from resync_heap_drop;
SELECT count(*) FROM resync_drop_column_heap_default1;
--
--
ALTER TABLE resync_drop_column_heap_default1 DROP COLUMN col032;
INSERT INTO resync_drop_column_heap_default1 VALUES (generate_series(1,10) , '((1,1),(2,2))','(1,1)', '((1,2),(2,3),(3,4),(4,3),(3,2),(2,1))', 111111, '23:00:00', '2001-12-13 01:51:15');
SELECT count(*) FROM resync_drop_column_heap_default1;
INSERT INTO resync_drop_column_heap_default1 SELECT a,col034 , col035, col036 , col037, col039 , col040 from resync_heap_drop;
SELECT count(*) FROM resync_drop_column_heap_default1;
--
--
ALTER TABLE resync_drop_column_heap_default1 DROP COLUMN col034;
INSERT INTO resync_drop_column_heap_default1 VALUES (generate_series(1,10) , '(1,1)','((1,2),(2,3),(3,4),(4,3),(3,2),(2,1))', 111111, '23:00:00', '2001-12-13 01:51:15');
SELECT count(*) FROM resync_drop_column_heap_default1;
INSERT INTO resync_drop_column_heap_default1 SELECT a,col035, col036 , col037, col039 , col040 from resync_heap_drop;
SELECT count(*) FROM resync_drop_column_heap_default1;
--
--
ALTER TABLE resync_drop_column_heap_default1 DROP COLUMN col035;
INSERT INTO resync_drop_column_heap_default1 VALUES (generate_series(1,10) ,'((1,2),(2,3),(3,4),(4,3),(3,2),(2,1))', 111111, '23:00:00', '2001-12-13 01:51:15');
SELECT count(*) FROM resync_drop_column_heap_default1;
INSERT INTO resync_drop_column_heap_default1 SELECT a, col036 , col037, col039 , col040 from resync_heap_drop;
SELECT count(*) FROM resync_drop_column_heap_default1;
--
--
ALTER TABLE resync_drop_column_heap_default1 DROP COLUMN col036;
INSERT INTO resync_drop_column_heap_default1 VALUES (generate_series(1,10) , 111111,'23:00:00', '2001-12-13 01:51:15');
SELECT count(*) FROM resync_drop_column_heap_default1;
INSERT INTO resync_drop_column_heap_default1 SELECT a, col037, col039 , col040 from resync_heap_drop;
SELECT count(*) FROM resync_drop_column_heap_default1;
--
--
ALTER TABLE resync_drop_column_heap_default1 DROP COLUMN col037;
INSERT INTO resync_drop_column_heap_default1 VALUES (generate_series(1,10) , '23:00:00', '2001-12-13 01:51:15');
SELECT count(*) FROM resync_drop_column_heap_default1;
INSERT INTO resync_drop_column_heap_default1 SELECT a,col039 , col040 from resync_heap_drop;
SELECT count(*) FROM resync_drop_column_heap_default1;
--
--
ALTER TABLE resync_drop_column_heap_default1 DROP COLUMN col039;
INSERT INTO resync_drop_column_heap_default1 VALUES (generate_series(1,10) , '2001-12-13 01:51:15');
SELECT count(*) FROM resync_drop_column_heap_default1;
INSERT INTO resync_drop_column_heap_default1 SELECT a,col040 from resync_heap_drop;
SELECT count(*) FROM resync_drop_column_heap_default1;
--
--
ALTER TABLE resync_drop_column_heap_default1 DROP COLUMN col040;
INSERT INTO resync_drop_column_heap_default1 VALUES (generate_series(1,10) );
SELECT count(*) FROM resync_drop_column_heap_default1;
INSERT INTO resync_drop_column_heap_default1 SELECT a from resync_heap_drop;
SELECT count(*) FROM resync_drop_column_heap_default1;
--
--
--
-- DROP ALL COLUMN WITH DEFAULT TO - > CT TABLE ct_drop_column_heap_default3
--
--
--
ALTER TABLE ct_drop_column_heap_default3 DROP COLUMN col001;
INSERT INTO ct_drop_column_heap_default3 VALUES (generate_series(1,10) ,11,true,'111', '1_one', '{1,2,3,4,5}', 'Hello .. how are you', 'Hello .. how are you', '{one,two,three,four,five}', 12345678, 1, 111.1111, 11, '1_one_11', 'd','2001-12-13 01:51:15+1359', '11', '0.0.0.0', '0.0.0.0', 'AA:AA:AA:AA:AA:AA', generate_series(1,10), '34.23', generate_series(1,10), '00:00:00+1359', '((2,2),1)', '((1,2),(2,1))', 'hello', '((1,2),(2,1))', 11, '010101', '2001-12-13', '((1,1),(2,2))', '(1,1)', '((1,2),(2,3),(3,4),(4,3),(3,2),(2,1))', 111111, '23:00:00', '2001-12-13 01:51:15');
SELECT count(*) FROM ct_drop_column_heap_default3;
INSERT INTO ct_drop_column_heap_default3 SELECT a,col002 , col003, col004, col005, col006, col007 , col008, col009, col010, col011,col012 ,col013, col014, col015 , col016, col017 ,col018 ,col019, col020, col021, col022, col023, col024, col025 , col026, col027 , col028, col029 , col031, col032 , col034 , col035, col036 , col037, col039 , col040 from ct_heap_drop;
SELECT count(*) FROM ct_drop_column_heap_default3;
--
--
ALTER TABLE ct_drop_column_heap_default3 DROP COLUMN col002;
INSERT INTO ct_drop_column_heap_default3 VALUES (generate_series(1,10) ,true,'111', '1_one', '{1,2,3,4,5}', 'Hello .. how are you', 'Hello .. how are you', '{one,two,three,four,five}', 12345678, 1, 111.1111, 11, '1_one_11', 'd','2001-12-13 01:51:15+1359', '11', '0.0.0.0', '0.0.0.0', 'AA:AA:AA:AA:AA:AA', generate_series(1,10), '34.23', generate_series(1,10), '00:00:00+1359', '((2,2),1)', '((1,2),(2,1))', 'hello', '((1,2),(2,1))', 11, '010101', '2001-12-13', '((1,1),(2,2))', '(1,1)', '((1,2),(2,3),(3,4),(4,3),(3,2),(2,1))', 111111, '23:00:00', '2001-12-13 01:51:15');
SELECT count(*) FROM ct_drop_column_heap_default3;
INSERT INTO ct_drop_column_heap_default3 SELECT a,col003, col004, col005, col006, col007 , col008, col009, col010, col011,col012 ,col013, col014, col015 , col016, col017 ,col018 ,col019, col020, col021, col022, col023, col024, col025 , col026, col027 , col028, col029 , col031, col032 , col034 , col035, col036 , col037, col039 , col040 from ct_heap_drop;
SELECT count(*) FROM ct_drop_column_heap_default3;
--
--
ALTER TABLE ct_drop_column_heap_default3 DROP COLUMN col003;
INSERT INTO ct_drop_column_heap_default3 VALUES (generate_series(1,10) ,'111', '1_one', '{1,2,3,4,5}', 'Hello .. how are you', 'Hello .. how are you', '{one,two,three,four,five}', 12345678, 1, 111.1111, 11, '1_one_11', 'd','2001-12-13 01:51:15+1359', '11', '0.0.0.0', '0.0.0.0', 'AA:AA:AA:AA:AA:AA', generate_series(1,10), '34.23', generate_series(1,10), '00:00:00+1359', '((2,2),1)', '((1,2),(2,1))', 'hello', '((1,2),(2,1))', 11, '010101', '2001-12-13', '((1,1),(2,2))', '(1,1)', '((1,2),(2,3),(3,4),(4,3),(3,2),(2,1))', 111111, '23:00:00', '2001-12-13 01:51:15');
SELECT count(*) FROM ct_drop_column_heap_default3;
INSERT INTO ct_drop_column_heap_default3 SELECT a,col004, col005, col006, col007 , col008, col009, col010, col011,col012 ,col013, col014, col015 , col016, col017 ,col018 ,col019, col020, col021, col022, col023, col024, col025 , col026, col027 , col028, col029 , col031, col032 , col034 , col035, col036 , col037, col039 , col040 from ct_heap_drop;
SELECT count(*) FROM ct_drop_column_heap_default3;
--
--
ALTER TABLE ct_drop_column_heap_default3 DROP COLUMN col004;
INSERT INTO ct_drop_column_heap_default3 VALUES (generate_series(1,10) ,'1_one', '{1,2,3,4,5}', 'Hello .. how are you', 'Hello .. how are you', '{one,two,three,four,five}', 12345678, 1, 111.1111, 11, '1_one_11', 'd','2001-12-13 01:51:15+1359', '11', '0.0.0.0', '0.0.0.0', 'AA:AA:AA:AA:AA:AA', generate_series(1,10), '34.23', generate_series(1,10), '00:00:00+1359', '((2,2),1)', '((1,2),(2,1))', 'hello', '((1,2),(2,1))', 11, '010101', '2001-12-13', '((1,1),(2,2))', '(1,1)', '((1,2),(2,3),(3,4),(4,3),(3,2),(2,1))', 111111, '23:00:00', '2001-12-13 01:51:15');
SELECT count(*) FROM ct_drop_column_heap_default3;
INSERT INTO ct_drop_column_heap_default3 SELECT a,col005, col006, col007 , col008, col009, col010, col011,col012 ,col013, col014, col015 , col016, col017 ,col018 ,col019, col020, col021, col022, col023, col024, col025 , col026, col027 , col028, col029 , col031, col032 , col034 , col035, col036 , col037, col039 , col040 from ct_heap_drop;
SELECT count(*) FROM ct_drop_column_heap_default3;
--
--
ALTER TABLE ct_drop_column_heap_default3 DROP COLUMN col005;
INSERT INTO ct_drop_column_heap_default3 VALUES (generate_series(1,10) , '{1,2,3,4,5}', 'Hello .. how are you', 'Hello .. how are you', '{one,two,three,four,five}', 12345678, 1, 111.1111, 11, '1_one_11', 'd','2001-12-13 01:51:15+1359', '11', '0.0.0.0', '0.0.0.0', 'AA:AA:AA:AA:AA:AA', generate_series(1,10), '34.23', generate_series(1,10), '00:00:00+1359', '((2,2),1)', '((1,2),(2,1))', 'hello', '((1,2),(2,1))', 11, '010101', '2001-12-13', '((1,1),(2,2))', '(1,1)', '((1,2),(2,3),(3,4),(4,3),(3,2),(2,1))', 111111, '23:00:00', '2001-12-13 01:51:15');
SELECT count(*) FROM ct_drop_column_heap_default3;
INSERT INTO ct_drop_column_heap_default3 SELECT a,col006, col007 , col008, col009, col010, col011,col012 ,col013, col014, col015 , col016, col017 ,col018 ,col019, col020, col021, col022, col023, col024, col025 , col026, col027 , col028, col029 , col031, col032 , col034 , col035, col036 , col037, col039 , col040 from ct_heap_drop;
SELECT count(*) FROM ct_drop_column_heap_default3;
--
--
ALTER TABLE ct_drop_column_heap_default3 DROP COLUMN col006;
INSERT INTO ct_drop_column_heap_default3 VALUES (generate_series(1,10) , 'Hello .. how are you', 'Hello .. how are you', '{one,two,three,four,five}', 12345678, 1, 111.1111, 11, '1_one_11', 'd','2001-12-13 01:51:15+1359', '11', '0.0.0.0', '0.0.0.0', 'AA:AA:AA:AA:AA:AA', generate_series(1,10), '34.23', generate_series(1,10), '00:00:00+1359', '((2,2),1)', '((1,2),(2,1))', 'hello', '((1,2),(2,1))', 11, '010101', '2001-12-13', '((1,1),(2,2))', '(1,1)', '((1,2),(2,3),(3,4),(4,3),(3,2),(2,1))', 111111, '23:00:00', '2001-12-13 01:51:15');
SELECT count(*) FROM ct_drop_column_heap_default3;
INSERT INTO ct_drop_column_heap_default3 SELECT a, col007 , col008, col009, col010, col011,col012 ,col013, col014, col015 , col016, col017 ,col018 ,col019, col020, col021, col022, col023, col024, col025 , col026, col027 , col028, col029 , col031, col032 , col034 , col035, col036 , col037, col039 , col040 from ct_heap_drop;
SELECT count(*) FROM ct_drop_column_heap_default3;
--
--
ALTER TABLE ct_drop_column_heap_default3 DROP COLUMN col007;
INSERT INTO ct_drop_column_heap_default3 VALUES (generate_series(1,10) , 'Hello .. how are you', '{one,two,three,four,five}', 12345678, 1, 111.1111, 11, '1_one_11', 'd','2001-12-13 01:51:15+1359', '11', '0.0.0.0', '0.0.0.0', 'AA:AA:AA:AA:AA:AA', generate_series(1,10), '34.23', generate_series(1,10), '00:00:00+1359', '((2,2),1)', '((1,2),(2,1))', 'hello', '((1,2),(2,1))', 11, '010101', '2001-12-13', '((1,1),(2,2))', '(1,1)', '((1,2),(2,3),(3,4),(4,3),(3,2),(2,1))', 111111, '23:00:00', '2001-12-13 01:51:15');
SELECT count(*) FROM ct_drop_column_heap_default3;
INSERT INTO ct_drop_column_heap_default3 SELECT a, col008, col009, col010, col011,col012 ,col013, col014, col015 , col016, col017 ,col018 ,col019, col020, col021, col022, col023, col024, col025 , col026, col027 , col028, col029 , col031, col032 , col034 , col035, col036 , col037, col039 , col040 from ct_heap_drop;
SELECT count(*) FROM ct_drop_column_heap_default3;
--
--
ALTER TABLE ct_drop_column_heap_default3 DROP COLUMN col008;
INSERT INTO ct_drop_column_heap_default3 VALUES (generate_series(1,10) ,'{one,two,three,four,five}', 12345678, 1, 111.1111, 11, '1_one_11', 'd','2001-12-13 01:51:15+1359', '11', '0.0.0.0', '0.0.0.0', 'AA:AA:AA:AA:AA:AA', generate_series(1,10), '34.23', generate_series(1,10), '00:00:00+1359', '((2,2),1)', '((1,2),(2,1))', 'hello', '((1,2),(2,1))', 11, '010101', '2001-12-13', '((1,1),(2,2))', '(1,1)', '((1,2),(2,3),(3,4),(4,3),(3,2),(2,1))', 111111, '23:00:00', '2001-12-13 01:51:15');
SELECT count(*) FROM ct_drop_column_heap_default3;
INSERT INTO ct_drop_column_heap_default3 SELECT a, col009, col010, col011,col012 ,col013, col014, col015 , col016, col017 ,col018 ,col019, col020, col021, col022, col023, col024, col025 , col026, col027 , col028, col029 , col031, col032 , col034 , col035, col036 , col037, col039 , col040 from ct_heap_drop;
SELECT count(*) FROM ct_drop_column_heap_default3;
--
--
ALTER TABLE ct_drop_column_heap_default3 DROP COLUMN col009;
INSERT INTO ct_drop_column_heap_default3 VALUES (generate_series(1,10) ,12345678, 1, 111.1111, 11, '1_one_11', 'd','2001-12-13 01:51:15+1359', '11', '0.0.0.0', '0.0.0.0', 'AA:AA:AA:AA:AA:AA', generate_series(1,10), '34.23', generate_series(1,10), '00:00:00+1359', '((2,2),1)', '((1,2),(2,1))', 'hello', '((1,2),(2,1))', 11, '010101', '2001-12-13', '((1,1),(2,2))', '(1,1)', '((1,2),(2,3),(3,4),(4,3),(3,2),(2,1))', 111111, '23:00:00', '2001-12-13 01:51:15');
SELECT count(*) FROM ct_drop_column_heap_default3;
INSERT INTO ct_drop_column_heap_default3 SELECT a,col010, col011,col012 ,col013, col014, col015 , col016, col017 ,col018 ,col019, col020, col021, col022, col023, col024, col025 , col026, col027 , col028, col029 , col031, col032 , col034 , col035, col036 , col037, col039 , col040 from ct_heap_drop;
SELECT count(*) FROM ct_drop_column_heap_default3;
--
--
ALTER TABLE ct_drop_column_heap_default3 DROP COLUMN col010;
INSERT INTO ct_drop_column_heap_default3 VALUES (generate_series(1,10) ,1, 111.1111, 11, '1_one_11', 'd','2001-12-13 01:51:15+1359', '11', '0.0.0.0', '0.0.0.0', 'AA:AA:AA:AA:AA:AA', generate_series(1,10), '34.23', generate_series(1,10), '00:00:00+1359', '((2,2),1)', '((1,2),(2,1))', 'hello', '((1,2),(2,1))', 11, '010101', '2001-12-13', '((1,1),(2,2))', '(1,1)', '((1,2),(2,3),(3,4),(4,3),(3,2),(2,1))', 111111, '23:00:00', '2001-12-13 01:51:15');
SELECT count(*) FROM ct_drop_column_heap_default3;
INSERT INTO ct_drop_column_heap_default3 SELECT a,col011,col012 ,col013, col014, col015 , col016, col017 ,col018 ,col019, col020, col021, col022, col023, col024, col025 , col026, col027 , col028, col029 , col031, col032 , col034 , col035, col036 , col037, col039 , col040 from ct_heap_drop;
SELECT count(*) FROM ct_drop_column_heap_default3;
--
--
ALTER TABLE ct_drop_column_heap_default3 DROP COLUMN col011;
INSERT INTO ct_drop_column_heap_default3 VALUES (generate_series(1,10) , 111.1111, 11, '1_one_11', 'd','2001-12-13 01:51:15+1359', '11', '0.0.0.0', '0.0.0.0', 'AA:AA:AA:AA:AA:AA', generate_series(1,10), '34.23', generate_series(1,10), '00:00:00+1359', '((2,2),1)', '((1,2),(2,1))', 'hello', '((1,2),(2,1))', 11, '010101', '2001-12-13', '((1,1),(2,2))', '(1,1)', '((1,2),(2,3),(3,4),(4,3),(3,2),(2,1))', 111111, '23:00:00', '2001-12-13 01:51:15');
SELECT count(*) FROM ct_drop_column_heap_default3;
INSERT INTO ct_drop_column_heap_default3 SELECT a,col012 ,col013, col014, col015 , col016, col017 ,col018 ,col019, col020, col021, col022, col023, col024, col025 , col026, col027 , col028, col029 , col031, col032 , col034 , col035, col036 , col037, col039 , col040 from ct_heap_drop;
SELECT count(*) FROM ct_drop_column_heap_default3;
--
--
ALTER TABLE ct_drop_column_heap_default3 DROP COLUMN col012;
INSERT INTO ct_drop_column_heap_default3 VALUES (generate_series(1,10) , 11, '1_one_11', 'd','2001-12-13 01:51:15+1359', '11', '0.0.0.0', '0.0.0.0', 'AA:AA:AA:AA:AA:AA', generate_series(1,10), '34.23', generate_series(1,10), '00:00:00+1359', '((2,2),1)', '((1,2),(2,1))', 'hello', '((1,2),(2,1))', 11, '010101', '2001-12-13', '((1,1),(2,2))', '(1,1)', '((1,2),(2,3),(3,4),(4,3),(3,2),(2,1))', 111111, '23:00:00', '2001-12-13 01:51:15');
SELECT count(*) FROM ct_drop_column_heap_default3;
INSERT INTO ct_drop_column_heap_default3 SELECT a,col013, col014, col015 , col016, col017 ,col018 ,col019, col020, col021, col022, col023, col024, col025 , col026, col027 , col028, col029 , col031, col032 , col034 , col035, col036 , col037, col039 , col040 from ct_heap_drop;
SELECT count(*) FROM ct_drop_column_heap_default3;
--
--
ALTER TABLE ct_drop_column_heap_default3 DROP COLUMN col013;
INSERT INTO ct_drop_column_heap_default3 VALUES (generate_series(1,10) ,'1_one_11', 'd','2001-12-13 01:51:15+1359', '11', '0.0.0.0', '0.0.0.0', 'AA:AA:AA:AA:AA:AA', generate_series(1,10), '34.23', generate_series(1,10), '00:00:00+1359', '((2,2),1)', '((1,2),(2,1))', 'hello', '((1,2),(2,1))', 11, '010101', '2001-12-13', '((1,1),(2,2))', '(1,1)', '((1,2),(2,3),(3,4),(4,3),(3,2),(2,1))', 111111, '23:00:00', '2001-12-13 01:51:15');
SELECT count(*) FROM ct_drop_column_heap_default3;
INSERT INTO ct_drop_column_heap_default3 SELECT a,col014, col015 , col016, col017 ,col018 ,col019, col020, col021, col022, col023, col024, col025 , col026, col027 , col028, col029 , col031, col032 , col034 , col035, col036 , col037, col039 , col040 from ct_heap_drop;
SELECT count(*) FROM ct_drop_column_heap_default3;
--
--
ALTER TABLE ct_drop_column_heap_default3 DROP COLUMN col014;
INSERT INTO ct_drop_column_heap_default3 VALUES (generate_series(1,10) ,'d','2001-12-13 01:51:15+1359', '11', '0.0.0.0', '0.0.0.0', 'AA:AA:AA:AA:AA:AA', generate_series(1,10), '34.23', generate_series(1,10), '00:00:00+1359', '((2,2),1)', '((1,2),(2,1))', 'hello', '((1,2),(2,1))', 11, '010101', '2001-12-13', '((1,1),(2,2))', '(1,1)', '((1,2),(2,3),(3,4),(4,3),(3,2),(2,1))', 111111, '23:00:00', '2001-12-13 01:51:15');
SELECT count(*) FROM ct_drop_column_heap_default3;
INSERT INTO ct_drop_column_heap_default3 SELECT a, col015 , col016, col017 ,col018 ,col019, col020, col021, col022, col023, col024, col025 , col026, col027 , col028, col029 , col031, col032 , col034 , col035, col036 , col037, col039 , col040 from ct_heap_drop;
SELECT count(*) FROM ct_drop_column_heap_default3;
--
--
ALTER TABLE ct_drop_column_heap_default3 DROP COLUMN col015;
INSERT INTO ct_drop_column_heap_default3 VALUES (generate_series(1,10) ,'2001-12-13 01:51:15+1359', '11', '0.0.0.0', '0.0.0.0', 'AA:AA:AA:AA:AA:AA', generate_series(1,10), '34.23', generate_series(1,10), '00:00:00+1359', '((2,2),1)', '((1,2),(2,1))', 'hello', '((1,2),(2,1))', 11, '010101', '2001-12-13', '((1,1),(2,2))', '(1,1)', '((1,2),(2,3),(3,4),(4,3),(3,2),(2,1))', 111111, '23:00:00', '2001-12-13 01:51:15');
SELECT count(*) FROM ct_drop_column_heap_default3;
INSERT INTO ct_drop_column_heap_default3 SELECT a,col016, col017 ,col018 ,col019, col020, col021, col022, col023, col024, col025 , col026, col027 , col028, col029 , col031, col032 , col034 , col035, col036 , col037, col039 , col040 from ct_heap_drop;
SELECT count(*) FROM ct_drop_column_heap_default3;
--
--
ALTER TABLE ct_drop_column_heap_default3 DROP COLUMN col016;
INSERT INTO ct_drop_column_heap_default3 VALUES (generate_series(1,10) , '11', '0.0.0.0', '0.0.0.0', 'AA:AA:AA:AA:AA:AA', generate_series(1,10), '34.23', generate_series(1,10), '00:00:00+1359', '((2,2),1)', '((1,2),(2,1))', 'hello', '((1,2),(2,1))', 11, '010101', '2001-12-13', '((1,1),(2,2))', '(1,1)', '((1,2),(2,3),(3,4),(4,3),(3,2),(2,1))', 111111, '23:00:00', '2001-12-13 01:51:15');
SELECT count(*) FROM ct_drop_column_heap_default3;
INSERT INTO ct_drop_column_heap_default3 SELECT a, col017 ,col018 ,col019, col020, col021, col022, col023, col024, col025 , col026, col027 , col028, col029 , col031, col032 , col034 , col035, col036 , col037, col039 , col040 from ct_heap_drop;
SELECT count(*) FROM ct_drop_column_heap_default3;
--
--
ALTER TABLE ct_drop_column_heap_default3 DROP COLUMN col017;
INSERT INTO ct_drop_column_heap_default3 VALUES (generate_series(1,10) ,'0.0.0.0','0.0.0.0', 'AA:AA:AA:AA:AA:AA', generate_series(1,10), '34.23', generate_series(1,10), '00:00:00+1359', '((2,2),1)', '((1,2),(2,1))', 'hello', '((1,2),(2,1))', 11, '010101', '2001-12-13', '((1,1),(2,2))', '(1,1)', '((1,2),(2,3),(3,4),(4,3),(3,2),(2,1))', 111111, '23:00:00', '2001-12-13 01:51:15');
SELECT count(*) FROM ct_drop_column_heap_default3;
INSERT INTO ct_drop_column_heap_default3 SELECT a,col018 ,col019, col020, col021, col022, col023, col024, col025 , col026, col027 , col028, col029 , col031, col032 , col034 , col035, col036 , col037, col039 , col040 from ct_heap_drop;
SELECT count(*) FROM ct_drop_column_heap_default3;
--
--
ALTER TABLE ct_drop_column_heap_default3 DROP COLUMN col018;
INSERT INTO ct_drop_column_heap_default3 VALUES (generate_series(1,10) ,'0.0.0.0', 'AA:AA:AA:AA:AA:AA', generate_series(1,10), '34.23', generate_series(1,10), '00:00:00+1359', '((2,2),1)', '((1,2),(2,1))', 'hello', '((1,2),(2,1))', 11, '010101', '2001-12-13', '((1,1),(2,2))', '(1,1)', '((1,2),(2,3),(3,4),(4,3),(3,2),(2,1))', 111111, '23:00:00', '2001-12-13 01:51:15');
SELECT count(*) FROM ct_drop_column_heap_default3;
INSERT INTO ct_drop_column_heap_default3 SELECT a,col019, col020, col021, col022, col023, col024, col025 , col026, col027 , col028, col029 , col031, col032 , col034 , col035, col036 , col037, col039 , col040 from ct_heap_drop;
SELECT count(*) FROM ct_drop_column_heap_default3;
--
--
ALTER TABLE ct_drop_column_heap_default3 DROP COLUMN col019;
INSERT INTO ct_drop_column_heap_default3 VALUES (generate_series(1,10) ,'AA:AA:AA:AA:AA:AA', generate_series(1,10), '34.23', generate_series(1,10), '00:00:00+1359', '((2,2),1)', '((1,2),(2,1))', 'hello', '((1,2),(2,1))', 11, '010101', '2001-12-13', '((1,1),(2,2))', '(1,1)', '((1,2),(2,3),(3,4),(4,3),(3,2),(2,1))', 111111, '23:00:00', '2001-12-13 01:51:15');
SELECT count(*) FROM ct_drop_column_heap_default3;
INSERT INTO ct_drop_column_heap_default3 SELECT a,col020, col021, col022, col023, col024, col025 , col026, col027 , col028, col029 , col031, col032 , col034 , col035, col036 , col037, col039 , col040 from ct_heap_drop;
SELECT count(*) FROM ct_drop_column_heap_default3;
--
--
ALTER TABLE ct_drop_column_heap_default3 DROP COLUMN col020;
INSERT INTO ct_drop_column_heap_default3 VALUES (generate_series(1,10) , generate_series(1,10), '34.23', generate_series(1,10), '00:00:00+1359', '((2,2),1)', '((1,2),(2,1))', 'hello', '((1,2),(2,1))', 11, '010101', '2001-12-13', '((1,1),(2,2))', '(1,1)', '((1,2),(2,3),(3,4),(4,3),(3,2),(2,1))', 111111, '23:00:00', '2001-12-13 01:51:15');
SELECT count(*) FROM ct_drop_column_heap_default3;
INSERT INTO ct_drop_column_heap_default3 SELECT a, col021, col022, col023, col024, col025 , col026, col027 , col028, col029 , col031, col032 , col034 , col035, col036 , col037, col039 , col040 from ct_heap_drop;
SELECT count(*) FROM ct_drop_column_heap_default3;
--
--
ALTER TABLE ct_drop_column_heap_default3 DROP COLUMN col021;
INSERT INTO ct_drop_column_heap_default3 VALUES (generate_series(1,10), '34.23', generate_series(1,10), '00:00:00+1359', '((2,2),1)', '((1,2),(2,1))', 'hello', '((1,2),(2,1))', 11, '010101', '2001-12-13', '((1,1),(2,2))', '(1,1)', '((1,2),(2,3),(3,4),(4,3),(3,2),(2,1))', 111111, '23:00:00', '2001-12-13 01:51:15');
SELECT count(*) FROM ct_drop_column_heap_default3;
INSERT INTO ct_drop_column_heap_default3 SELECT a, col022, col023, col024, col025 , col026, col027 , col028, col029 , col031, col032 , col034 , col035, col036 , col037, col039 , col040 from ct_heap_drop;
SELECT count(*) FROM ct_drop_column_heap_default3;
--
--
ALTER TABLE ct_drop_column_heap_default3 DROP COLUMN col022;
INSERT INTO ct_drop_column_heap_default3 VALUES (generate_series(1,10) , generate_series(1,10),'00:00:00+1359', '((2,2),1)', '((1,2),(2,1))', 'hello', '((1,2),(2,1))', 11, '010101', '2001-12-13', '((1,1),(2,2))', '(1,1)', '((1,2),(2,3),(3,4),(4,3),(3,2),(2,1))', 111111, '23:00:00', '2001-12-13 01:51:15');
SELECT count(*) FROM ct_drop_column_heap_default3;
INSERT INTO ct_drop_column_heap_default3 SELECT a, col023, col024, col025 , col026, col027 , col028, col029 , col031, col032 , col034 , col035, col036 , col037, col039 , col040 from ct_heap_drop;
SELECT count(*) FROM ct_drop_column_heap_default3;
--
--
ALTER TABLE ct_drop_column_heap_default3 DROP COLUMN col023;
INSERT INTO ct_drop_column_heap_default3 VALUES (generate_series(1,10) , '00:00:00+1359', '((2,2),1)', '((1,2),(2,1))', 'hello', '((1,2),(2,1))', 11, '010101', '2001-12-13', '((1,1),(2,2))', '(1,1)', '((1,2),(2,3),(3,4),(4,3),(3,2),(2,1))', 111111, '23:00:00', '2001-12-13 01:51:15');
SELECT count(*) FROM ct_drop_column_heap_default3;
INSERT INTO ct_drop_column_heap_default3 SELECT a,col024, col025 , col026, col027 , col028, col029 , col031, col032 , col034 , col035, col036 , col037, col039 , col040 from ct_heap_drop;
SELECT count(*) FROM ct_drop_column_heap_default3;
--
--
ALTER TABLE ct_drop_column_heap_default3 DROP COLUMN col024;
INSERT INTO ct_drop_column_heap_default3 VALUES (generate_series(1,10) , '((2,2),1)','((1,2),(2,1))', 'hello', '((1,2),(2,1))', 11, '010101', '2001-12-13', '((1,1),(2,2))', '(1,1)', '((1,2),(2,3),(3,4),(4,3),(3,2),(2,1))', 111111, '23:00:00', '2001-12-13 01:51:15');
SELECT count(*) FROM ct_drop_column_heap_default3;
INSERT INTO ct_drop_column_heap_default3 SELECT a,col025 , col026, col027 , col028, col029 , col031, col032 , col034 , col035, col036 , col037, col039 , col040 from ct_heap_drop;
SELECT count(*) FROM ct_drop_column_heap_default3;
--
--
ALTER TABLE ct_drop_column_heap_default3 DROP COLUMN col025;
INSERT INTO ct_drop_column_heap_default3 VALUES (generate_series(1,10) , '((1,2),(2,1))', 'hello', '((1,2),(2,1))', 11, '010101', '2001-12-13', '((1,1),(2,2))', '(1,1)', '((1,2),(2,3),(3,4),(4,3),(3,2),(2,1))', 111111, '23:00:00', '2001-12-13 01:51:15');
SELECT count(*) FROM ct_drop_column_heap_default3;
INSERT INTO ct_drop_column_heap_default3 SELECT a,col026, col027 , col028, col029 , col031, col032 , col034 , col035, col036 , col037, col039 , col040 from ct_heap_drop;
SELECT count(*) FROM ct_drop_column_heap_default3;
--
--
ALTER TABLE ct_drop_column_heap_default3 DROP COLUMN col026;
INSERT INTO ct_drop_column_heap_default3 VALUES (generate_series(1,10) ,'hello', '((1,2),(2,1))', 11, '010101', '2001-12-13', '((1,1),(2,2))', '(1,1)', '((1,2),(2,3),(3,4),(4,3),(3,2),(2,1))', 111111, '23:00:00', '2001-12-13 01:51:15');
SELECT count(*) FROM ct_drop_column_heap_default3;
INSERT INTO ct_drop_column_heap_default3 SELECT a,col027 , col028, col029 , col031, col032 , col034 , col035, col036 , col037, col039 , col040 from ct_heap_drop;
SELECT count(*) FROM ct_drop_column_heap_default3;
--
--
ALTER TABLE ct_drop_column_heap_default3 DROP COLUMN col027;
INSERT INTO ct_drop_column_heap_default3 VALUES (generate_series(1,10) ,'((1,2),(2,1))',11, '010101', '2001-12-13', '((1,1),(2,2))', '(1,1)', '((1,2),(2,3),(3,4),(4,3),(3,2),(2,1))', 111111, '23:00:00', '2001-12-13 01:51:15');
SELECT count(*) FROM ct_drop_column_heap_default3;
INSERT INTO ct_drop_column_heap_default3 SELECT a,col028, col029 , col031, col032 , col034 , col035, col036 , col037, col039 , col040 from ct_heap_drop;
SELECT count(*) FROM ct_drop_column_heap_default3;
--
--
ALTER TABLE ct_drop_column_heap_default3 DROP COLUMN col028;
INSERT INTO ct_drop_column_heap_default3 VALUES (generate_series(1,10) , 11, '010101', '2001-12-13', '((1,1),(2,2))', '(1,1)', '((1,2),(2,3),(3,4),(4,3),(3,2),(2,1))', 111111, '23:00:00', '2001-12-13 01:51:15');
SELECT count(*) FROM ct_drop_column_heap_default3;
INSERT INTO ct_drop_column_heap_default3 SELECT a,col029 , col031, col032 , col034 , col035, col036 , col037, col039 , col040 from ct_heap_drop;
SELECT count(*) FROM ct_drop_column_heap_default3;
--
--
ALTER TABLE ct_drop_column_heap_default3 DROP COLUMN col029;
INSERT INTO ct_drop_column_heap_default3 VALUES (generate_series(1,10) , '010101', '2001-12-13', '((1,1),(2,2))', '(1,1)', '((1,2),(2,3),(3,4),(4,3),(3,2),(2,1))', 111111, '23:00:00', '2001-12-13 01:51:15');
SELECT count(*) FROM ct_drop_column_heap_default3;
INSERT INTO ct_drop_column_heap_default3 SELECT a, col031, col032 , col034 , col035, col036 , col037, col039 , col040 from ct_heap_drop;
SELECT count(*) FROM ct_drop_column_heap_default3;
--
--
ALTER TABLE ct_drop_column_heap_default3 DROP COLUMN col031;
INSERT INTO ct_drop_column_heap_default3 VALUES (generate_series(1,10) , '2001-12-13', '((1,1),(2,2))', '(1,1)', '((1,2),(2,3),(3,4),(4,3),(3,2),(2,1))', 111111, '23:00:00', '2001-12-13 01:51:15');
SELECT count(*) FROM ct_drop_column_heap_default3;
INSERT INTO ct_drop_column_heap_default3 SELECT a, col032 , col034 , col035, col036 , col037, col039 , col040 from ct_heap_drop;
SELECT count(*) FROM ct_drop_column_heap_default3;
--
--
ALTER TABLE ct_drop_column_heap_default3 DROP COLUMN col032;
INSERT INTO ct_drop_column_heap_default3 VALUES (generate_series(1,10) , '((1,1),(2,2))','(1,1)', '((1,2),(2,3),(3,4),(4,3),(3,2),(2,1))', 111111, '23:00:00', '2001-12-13 01:51:15');
SELECT count(*) FROM ct_drop_column_heap_default3;
INSERT INTO ct_drop_column_heap_default3 SELECT a,col034 , col035, col036 , col037, col039 , col040 from ct_heap_drop;
SELECT count(*) FROM ct_drop_column_heap_default3;
--
--
ALTER TABLE ct_drop_column_heap_default3 DROP COLUMN col034;
INSERT INTO ct_drop_column_heap_default3 VALUES (generate_series(1,10) , '(1,1)','((1,2),(2,3),(3,4),(4,3),(3,2),(2,1))', 111111, '23:00:00', '2001-12-13 01:51:15');
SELECT count(*) FROM ct_drop_column_heap_default3;
INSERT INTO ct_drop_column_heap_default3 SELECT a,col035, col036 , col037, col039 , col040 from ct_heap_drop;
SELECT count(*) FROM ct_drop_column_heap_default3;
--
--
ALTER TABLE ct_drop_column_heap_default3 DROP COLUMN col035;
INSERT INTO ct_drop_column_heap_default3 VALUES (generate_series(1,10) ,'((1,2),(2,3),(3,4),(4,3),(3,2),(2,1))', 111111, '23:00:00', '2001-12-13 01:51:15');
SELECT count(*) FROM ct_drop_column_heap_default3;
INSERT INTO ct_drop_column_heap_default3 SELECT a, col036 , col037, col039 , col040 from ct_heap_drop;
SELECT count(*) FROM ct_drop_column_heap_default3;
--
--
ALTER TABLE ct_drop_column_heap_default3 DROP COLUMN col036;
INSERT INTO ct_drop_column_heap_default3 VALUES (generate_series(1,10) , 111111,'23:00:00', '2001-12-13 01:51:15');
SELECT count(*) FROM ct_drop_column_heap_default3;
INSERT INTO ct_drop_column_heap_default3 SELECT a, col037, col039 , col040 from ct_heap_drop;
SELECT count(*) FROM ct_drop_column_heap_default3;
--
--
ALTER TABLE ct_drop_column_heap_default3 DROP COLUMN col037;
INSERT INTO ct_drop_column_heap_default3 VALUES (generate_series(1,10) , '23:00:00', '2001-12-13 01:51:15');
SELECT count(*) FROM ct_drop_column_heap_default3;
INSERT INTO ct_drop_column_heap_default3 SELECT a,col039 , col040 from ct_heap_drop;
SELECT count(*) FROM ct_drop_column_heap_default3;
--
--
ALTER TABLE ct_drop_column_heap_default3 DROP COLUMN col039;
INSERT INTO ct_drop_column_heap_default3 VALUES (generate_series(1,10) , '2001-12-13 01:51:15');
SELECT count(*) FROM ct_drop_column_heap_default3;
INSERT INTO ct_drop_column_heap_default3 SELECT a,col040 from ct_heap_drop;
SELECT count(*) FROM ct_drop_column_heap_default3;
--
--
ALTER TABLE ct_drop_column_heap_default3 DROP COLUMN col040;
INSERT INTO ct_drop_column_heap_default3 VALUES (generate_series(1,10) );
SELECT count(*) FROM ct_drop_column_heap_default3;
INSERT INTO ct_drop_column_heap_default3 SELECT a from ct_heap_drop;
SELECT count(*) FROM ct_drop_column_heap_default3;
--
--
--
-- DROP ALL COLUMN WITH DEFAULT TO - > CK_SYNC1 TABLE ck_sync1_drop_column_heap_default5
--
--
--
ALTER TABLE ck_sync1_drop_column_heap_default5 DROP COLUMN col001;
INSERT INTO ck_sync1_drop_column_heap_default5 VALUES (generate_series(1,10) ,11,true,'111', '1_one', '{1,2,3,4,5}', 'Hello .. how are you', 'Hello .. how are you', '{one,two,three,four,five}', 12345678, 1, 111.1111, 11, '1_one_11', 'd','2001-12-13 01:51:15+1359', '11', '0.0.0.0', '0.0.0.0', 'AA:AA:AA:AA:AA:AA', generate_series(1,10), '34.23', generate_series(1,10), '00:00:00+1359', '((2,2),1)', '((1,2),(2,1))', 'hello', '((1,2),(2,1))', 11, '010101', '2001-12-13', '((1,1),(2,2))', '(1,1)', '((1,2),(2,3),(3,4),(4,3),(3,2),(2,1))', 111111, '23:00:00', '2001-12-13 01:51:15');
SELECT count(*) FROM ck_sync1_drop_column_heap_default5;
INSERT INTO ck_sync1_drop_column_heap_default5 SELECT a,col002 , col003, col004, col005, col006, col007 , col008, col009, col010, col011,col012 ,col013, col014, col015 , col016, col017 ,col018 ,col019, col020, col021, col022, col023, col024, col025 , col026, col027 , col028, col029 , col031, col032 , col034 , col035, col036 , col037, col039 , col040 from ck_sync1_heap_drop;
SELECT count(*) FROM ck_sync1_drop_column_heap_default5;
--
--
ALTER TABLE ck_sync1_drop_column_heap_default5 DROP COLUMN col002;
INSERT INTO ck_sync1_drop_column_heap_default5 VALUES (generate_series(1,10) ,true,'111', '1_one', '{1,2,3,4,5}', 'Hello .. how are you', 'Hello .. how are you', '{one,two,three,four,five}', 12345678, 1, 111.1111, 11, '1_one_11', 'd','2001-12-13 01:51:15+1359', '11', '0.0.0.0', '0.0.0.0', 'AA:AA:AA:AA:AA:AA', generate_series(1,10), '34.23', generate_series(1,10), '00:00:00+1359', '((2,2),1)', '((1,2),(2,1))', 'hello', '((1,2),(2,1))', 11, '010101', '2001-12-13', '((1,1),(2,2))', '(1,1)', '((1,2),(2,3),(3,4),(4,3),(3,2),(2,1))', 111111, '23:00:00', '2001-12-13 01:51:15');
SELECT count(*) FROM ck_sync1_drop_column_heap_default5;
INSERT INTO ck_sync1_drop_column_heap_default5 SELECT a,col003, col004, col005, col006, col007 , col008, col009, col010, col011,col012 ,col013, col014, col015 , col016, col017 ,col018 ,col019, col020, col021, col022, col023, col024, col025 , col026, col027 , col028, col029 , col031, col032 , col034 , col035, col036 , col037, col039 , col040 from ck_sync1_heap_drop;
SELECT count(*) FROM ck_sync1_drop_column_heap_default5;
--
--
ALTER TABLE ck_sync1_drop_column_heap_default5 DROP COLUMN col003;
INSERT INTO ck_sync1_drop_column_heap_default5 VALUES (generate_series(1,10) ,'111', '1_one', '{1,2,3,4,5}', 'Hello .. how are you', 'Hello .. how are you', '{one,two,three,four,five}', 12345678, 1, 111.1111, 11, '1_one_11', 'd','2001-12-13 01:51:15+1359', '11', '0.0.0.0', '0.0.0.0', 'AA:AA:AA:AA:AA:AA', generate_series(1,10), '34.23', generate_series(1,10), '00:00:00+1359', '((2,2),1)', '((1,2),(2,1))', 'hello', '((1,2),(2,1))', 11, '010101', '2001-12-13', '((1,1),(2,2))', '(1,1)', '((1,2),(2,3),(3,4),(4,3),(3,2),(2,1))', 111111, '23:00:00', '2001-12-13 01:51:15');
SELECT count(*) FROM ck_sync1_drop_column_heap_default5;
INSERT INTO ck_sync1_drop_column_heap_default5 SELECT a,col004, col005, col006, col007 , col008, col009, col010, col011,col012 ,col013, col014, col015 , col016, col017 ,col018 ,col019, col020, col021, col022, col023, col024, col025 , col026, col027 , col028, col029 , col031, col032 , col034 , col035, col036 , col037, col039 , col040 from ck_sync1_heap_drop;
SELECT count(*) FROM ck_sync1_drop_column_heap_default5;
--
--
ALTER TABLE ck_sync1_drop_column_heap_default5 DROP COLUMN col004;
INSERT INTO ck_sync1_drop_column_heap_default5 VALUES (generate_series(1,10) ,'1_one', '{1,2,3,4,5}', 'Hello .. how are you', 'Hello .. how are you', '{one,two,three,four,five}', 12345678, 1, 111.1111, 11, '1_one_11', 'd','2001-12-13 01:51:15+1359', '11', '0.0.0.0', '0.0.0.0', 'AA:AA:AA:AA:AA:AA', generate_series(1,10), '34.23', generate_series(1,10), '00:00:00+1359', '((2,2),1)', '((1,2),(2,1))', 'hello', '((1,2),(2,1))', 11, '010101', '2001-12-13', '((1,1),(2,2))', '(1,1)', '((1,2),(2,3),(3,4),(4,3),(3,2),(2,1))', 111111, '23:00:00', '2001-12-13 01:51:15');
SELECT count(*) FROM ck_sync1_drop_column_heap_default5;
INSERT INTO ck_sync1_drop_column_heap_default5 SELECT a,col005, col006, col007 , col008, col009, col010, col011,col012 ,col013, col014, col015 , col016, col017 ,col018 ,col019, col020, col021, col022, col023, col024, col025 , col026, col027 , col028, col029 , col031, col032 , col034 , col035, col036 , col037, col039 , col040 from ck_sync1_heap_drop;
SELECT count(*) FROM ck_sync1_drop_column_heap_default5;
--
--
ALTER TABLE ck_sync1_drop_column_heap_default5 DROP COLUMN col005;
INSERT INTO ck_sync1_drop_column_heap_default5 VALUES (generate_series(1,10) , '{1,2,3,4,5}', 'Hello .. how are you', 'Hello .. how are you', '{one,two,three,four,five}', 12345678, 1, 111.1111, 11, '1_one_11', 'd','2001-12-13 01:51:15+1359', '11', '0.0.0.0', '0.0.0.0', 'AA:AA:AA:AA:AA:AA', generate_series(1,10), '34.23', generate_series(1,10), '00:00:00+1359', '((2,2),1)', '((1,2),(2,1))', 'hello', '((1,2),(2,1))', 11, '010101', '2001-12-13', '((1,1),(2,2))', '(1,1)', '((1,2),(2,3),(3,4),(4,3),(3,2),(2,1))', 111111, '23:00:00', '2001-12-13 01:51:15');
SELECT count(*) FROM ck_sync1_drop_column_heap_default5;
INSERT INTO ck_sync1_drop_column_heap_default5 SELECT a,col006, col007 , col008, col009, col010, col011,col012 ,col013, col014, col015 , col016, col017 ,col018 ,col019, col020, col021, col022, col023, col024, col025 , col026, col027 , col028, col029 , col031, col032 , col034 , col035, col036 , col037, col039 , col040 from ck_sync1_heap_drop;
SELECT count(*) FROM ck_sync1_drop_column_heap_default5;
--
--
ALTER TABLE ck_sync1_drop_column_heap_default5 DROP COLUMN col006;
INSERT INTO ck_sync1_drop_column_heap_default5 VALUES (generate_series(1,10) , 'Hello .. how are you', 'Hello .. how are you', '{one,two,three,four,five}', 12345678, 1, 111.1111, 11, '1_one_11', 'd','2001-12-13 01:51:15+1359', '11', '0.0.0.0', '0.0.0.0', 'AA:AA:AA:AA:AA:AA', generate_series(1,10), '34.23', generate_series(1,10), '00:00:00+1359', '((2,2),1)', '((1,2),(2,1))', 'hello', '((1,2),(2,1))', 11, '010101', '2001-12-13', '((1,1),(2,2))', '(1,1)', '((1,2),(2,3),(3,4),(4,3),(3,2),(2,1))', 111111, '23:00:00', '2001-12-13 01:51:15');
SELECT count(*) FROM ck_sync1_drop_column_heap_default5;
INSERT INTO ck_sync1_drop_column_heap_default5 SELECT a, col007 , col008, col009, col010, col011,col012 ,col013, col014, col015 , col016, col017 ,col018 ,col019, col020, col021, col022, col023, col024, col025 , col026, col027 , col028, col029 , col031, col032 , col034 , col035, col036 , col037, col039 , col040 from ck_sync1_heap_drop;
SELECT count(*) FROM ck_sync1_drop_column_heap_default5;
--
--
ALTER TABLE ck_sync1_drop_column_heap_default5 DROP COLUMN col007;
INSERT INTO ck_sync1_drop_column_heap_default5 VALUES (generate_series(1,10) , 'Hello .. how are you', '{one,two,three,four,five}', 12345678, 1, 111.1111, 11, '1_one_11', 'd','2001-12-13 01:51:15+1359', '11', '0.0.0.0', '0.0.0.0', 'AA:AA:AA:AA:AA:AA', generate_series(1,10), '34.23', generate_series(1,10), '00:00:00+1359', '((2,2),1)', '((1,2),(2,1))', 'hello', '((1,2),(2,1))', 11, '010101', '2001-12-13', '((1,1),(2,2))', '(1,1)', '((1,2),(2,3),(3,4),(4,3),(3,2),(2,1))', 111111, '23:00:00', '2001-12-13 01:51:15');
SELECT count(*) FROM ck_sync1_drop_column_heap_default5;
INSERT INTO ck_sync1_drop_column_heap_default5 SELECT a, col008, col009, col010, col011,col012 ,col013, col014, col015 , col016, col017 ,col018 ,col019, col020, col021, col022, col023, col024, col025 , col026, col027 , col028, col029 , col031, col032 , col034 , col035, col036 , col037, col039 , col040 from ck_sync1_heap_drop;
SELECT count(*) FROM ck_sync1_drop_column_heap_default5;
--
--
ALTER TABLE ck_sync1_drop_column_heap_default5 DROP COLUMN col008;
INSERT INTO ck_sync1_drop_column_heap_default5 VALUES (generate_series(1,10) ,'{one,two,three,four,five}', 12345678, 1, 111.1111, 11, '1_one_11', 'd','2001-12-13 01:51:15+1359', '11', '0.0.0.0', '0.0.0.0', 'AA:AA:AA:AA:AA:AA', generate_series(1,10), '34.23', generate_series(1,10), '00:00:00+1359', '((2,2),1)', '((1,2),(2,1))', 'hello', '((1,2),(2,1))', 11, '010101', '2001-12-13', '((1,1),(2,2))', '(1,1)', '((1,2),(2,3),(3,4),(4,3),(3,2),(2,1))', 111111, '23:00:00', '2001-12-13 01:51:15');
SELECT count(*) FROM ck_sync1_drop_column_heap_default5;
INSERT INTO ck_sync1_drop_column_heap_default5 SELECT a, col009, col010, col011,col012 ,col013, col014, col015 , col016, col017 ,col018 ,col019, col020, col021, col022, col023, col024, col025 , col026, col027 , col028, col029 , col031, col032 , col034 , col035, col036 , col037, col039 , col040 from ck_sync1_heap_drop;
SELECT count(*) FROM ck_sync1_drop_column_heap_default5;
--
--
ALTER TABLE ck_sync1_drop_column_heap_default5 DROP COLUMN col009;
INSERT INTO ck_sync1_drop_column_heap_default5 VALUES (generate_series(1,10) ,12345678, 1, 111.1111, 11, '1_one_11', 'd','2001-12-13 01:51:15+1359', '11', '0.0.0.0', '0.0.0.0', 'AA:AA:AA:AA:AA:AA', generate_series(1,10), '34.23', generate_series(1,10), '00:00:00+1359', '((2,2),1)', '((1,2),(2,1))', 'hello', '((1,2),(2,1))', 11, '010101', '2001-12-13', '((1,1),(2,2))', '(1,1)', '((1,2),(2,3),(3,4),(4,3),(3,2),(2,1))', 111111, '23:00:00', '2001-12-13 01:51:15');
SELECT count(*) FROM ck_sync1_drop_column_heap_default5;
INSERT INTO ck_sync1_drop_column_heap_default5 SELECT a,col010, col011,col012 ,col013, col014, col015 , col016, col017 ,col018 ,col019, col020, col021, col022, col023, col024, col025 , col026, col027 , col028, col029 , col031, col032 , col034 , col035, col036 , col037, col039 , col040 from ck_sync1_heap_drop;
SELECT count(*) FROM ck_sync1_drop_column_heap_default5;
--
--
ALTER TABLE ck_sync1_drop_column_heap_default5 DROP COLUMN col010;
INSERT INTO ck_sync1_drop_column_heap_default5 VALUES (generate_series(1,10) ,1, 111.1111, 11, '1_one_11', 'd','2001-12-13 01:51:15+1359', '11', '0.0.0.0', '0.0.0.0', 'AA:AA:AA:AA:AA:AA', generate_series(1,10), '34.23', generate_series(1,10), '00:00:00+1359', '((2,2),1)', '((1,2),(2,1))', 'hello', '((1,2),(2,1))', 11, '010101', '2001-12-13', '((1,1),(2,2))', '(1,1)', '((1,2),(2,3),(3,4),(4,3),(3,2),(2,1))', 111111, '23:00:00', '2001-12-13 01:51:15');
SELECT count(*) FROM ck_sync1_drop_column_heap_default5;
INSERT INTO ck_sync1_drop_column_heap_default5 SELECT a,col011,col012 ,col013, col014, col015 , col016, col017 ,col018 ,col019, col020, col021, col022, col023, col024, col025 , col026, col027 , col028, col029 , col031, col032 , col034 , col035, col036 , col037, col039 , col040 from ck_sync1_heap_drop;
SELECT count(*) FROM ck_sync1_drop_column_heap_default5;
--
--
ALTER TABLE ck_sync1_drop_column_heap_default5 DROP COLUMN col011;
INSERT INTO ck_sync1_drop_column_heap_default5 VALUES (generate_series(1,10) , 111.1111, 11, '1_one_11', 'd','2001-12-13 01:51:15+1359', '11', '0.0.0.0', '0.0.0.0', 'AA:AA:AA:AA:AA:AA', generate_series(1,10), '34.23', generate_series(1,10), '00:00:00+1359', '((2,2),1)', '((1,2),(2,1))', 'hello', '((1,2),(2,1))', 11, '010101', '2001-12-13', '((1,1),(2,2))', '(1,1)', '((1,2),(2,3),(3,4),(4,3),(3,2),(2,1))', 111111, '23:00:00', '2001-12-13 01:51:15');
SELECT count(*) FROM ck_sync1_drop_column_heap_default5;
INSERT INTO ck_sync1_drop_column_heap_default5 SELECT a,col012 ,col013, col014, col015 , col016, col017 ,col018 ,col019, col020, col021, col022, col023, col024, col025 , col026, col027 , col028, col029 , col031, col032 , col034 , col035, col036 , col037, col039 , col040 from ck_sync1_heap_drop;
SELECT count(*) FROM ck_sync1_drop_column_heap_default5;
--
--
ALTER TABLE ck_sync1_drop_column_heap_default5 DROP COLUMN col012;
INSERT INTO ck_sync1_drop_column_heap_default5 VALUES (generate_series(1,10) , 11, '1_one_11', 'd','2001-12-13 01:51:15+1359', '11', '0.0.0.0', '0.0.0.0', 'AA:AA:AA:AA:AA:AA', generate_series(1,10), '34.23', generate_series(1,10), '00:00:00+1359', '((2,2),1)', '((1,2),(2,1))', 'hello', '((1,2),(2,1))', 11, '010101', '2001-12-13', '((1,1),(2,2))', '(1,1)', '((1,2),(2,3),(3,4),(4,3),(3,2),(2,1))', 111111, '23:00:00', '2001-12-13 01:51:15');
SELECT count(*) FROM ck_sync1_drop_column_heap_default5;
INSERT INTO ck_sync1_drop_column_heap_default5 SELECT a,col013, col014, col015 , col016, col017 ,col018 ,col019, col020, col021, col022, col023, col024, col025 , col026, col027 , col028, col029 , col031, col032 , col034 , col035, col036 , col037, col039 , col040 from ck_sync1_heap_drop;
SELECT count(*) FROM ck_sync1_drop_column_heap_default5;
--
--
ALTER TABLE ck_sync1_drop_column_heap_default5 DROP COLUMN col013;
INSERT INTO ck_sync1_drop_column_heap_default5 VALUES (generate_series(1,10) ,'1_one_11', 'd','2001-12-13 01:51:15+1359', '11', '0.0.0.0', '0.0.0.0', 'AA:AA:AA:AA:AA:AA', generate_series(1,10), '34.23', generate_series(1,10), '00:00:00+1359', '((2,2),1)', '((1,2),(2,1))', 'hello', '((1,2),(2,1))', 11, '010101', '2001-12-13', '((1,1),(2,2))', '(1,1)', '((1,2),(2,3),(3,4),(4,3),(3,2),(2,1))', 111111, '23:00:00', '2001-12-13 01:51:15');
SELECT count(*) FROM ck_sync1_drop_column_heap_default5;
INSERT INTO ck_sync1_drop_column_heap_default5 SELECT a,col014, col015 , col016, col017 ,col018 ,col019, col020, col021, col022, col023, col024, col025 , col026, col027 , col028, col029 , col031, col032 , col034 , col035, col036 , col037, col039 , col040 from ck_sync1_heap_drop;
SELECT count(*) FROM ck_sync1_drop_column_heap_default5;
--
--
ALTER TABLE ck_sync1_drop_column_heap_default5 DROP COLUMN col014;
INSERT INTO ck_sync1_drop_column_heap_default5 VALUES (generate_series(1,10) ,'d','2001-12-13 01:51:15+1359', '11', '0.0.0.0', '0.0.0.0', 'AA:AA:AA:AA:AA:AA', generate_series(1,10), '34.23', generate_series(1,10), '00:00:00+1359', '((2,2),1)', '((1,2),(2,1))', 'hello', '((1,2),(2,1))', 11, '010101', '2001-12-13', '((1,1),(2,2))', '(1,1)', '((1,2),(2,3),(3,4),(4,3),(3,2),(2,1))', 111111, '23:00:00', '2001-12-13 01:51:15');
SELECT count(*) FROM ck_sync1_drop_column_heap_default5;
INSERT INTO ck_sync1_drop_column_heap_default5 SELECT a, col015 , col016, col017 ,col018 ,col019, col020, col021, col022, col023, col024, col025 , col026, col027 , col028, col029 , col031, col032 , col034 , col035, col036 , col037, col039 , col040 from ck_sync1_heap_drop;
SELECT count(*) FROM ck_sync1_drop_column_heap_default5;
--
--
ALTER TABLE ck_sync1_drop_column_heap_default5 DROP COLUMN col015;
INSERT INTO ck_sync1_drop_column_heap_default5 VALUES (generate_series(1,10) ,'2001-12-13 01:51:15+1359', '11', '0.0.0.0', '0.0.0.0', 'AA:AA:AA:AA:AA:AA', generate_series(1,10), '34.23', generate_series(1,10), '00:00:00+1359', '((2,2),1)', '((1,2),(2,1))', 'hello', '((1,2),(2,1))', 11, '010101', '2001-12-13', '((1,1),(2,2))', '(1,1)', '((1,2),(2,3),(3,4),(4,3),(3,2),(2,1))', 111111, '23:00:00', '2001-12-13 01:51:15');
SELECT count(*) FROM ck_sync1_drop_column_heap_default5;
INSERT INTO ck_sync1_drop_column_heap_default5 SELECT a,col016, col017 ,col018 ,col019, col020, col021, col022, col023, col024, col025 , col026, col027 , col028, col029 , col031, col032 , col034 , col035, col036 , col037, col039 , col040 from ck_sync1_heap_drop;
SELECT count(*) FROM ck_sync1_drop_column_heap_default5;
--
--
ALTER TABLE ck_sync1_drop_column_heap_default5 DROP COLUMN col016;
INSERT INTO ck_sync1_drop_column_heap_default5 VALUES (generate_series(1,10) , '11', '0.0.0.0', '0.0.0.0', 'AA:AA:AA:AA:AA:AA', generate_series(1,10), '34.23', generate_series(1,10), '00:00:00+1359', '((2,2),1)', '((1,2),(2,1))', 'hello', '((1,2),(2,1))', 11, '010101', '2001-12-13', '((1,1),(2,2))', '(1,1)', '((1,2),(2,3),(3,4),(4,3),(3,2),(2,1))', 111111, '23:00:00', '2001-12-13 01:51:15');
SELECT count(*) FROM ck_sync1_drop_column_heap_default5;
INSERT INTO ck_sync1_drop_column_heap_default5 SELECT a, col017 ,col018 ,col019, col020, col021, col022, col023, col024, col025 , col026, col027 , col028, col029 , col031, col032 , col034 , col035, col036 , col037, col039 , col040 from ck_sync1_heap_drop;
SELECT count(*) FROM ck_sync1_drop_column_heap_default5;
--
--
ALTER TABLE ck_sync1_drop_column_heap_default5 DROP COLUMN col017;
INSERT INTO ck_sync1_drop_column_heap_default5 VALUES (generate_series(1,10) ,'0.0.0.0','0.0.0.0', 'AA:AA:AA:AA:AA:AA', generate_series(1,10), '34.23', generate_series(1,10), '00:00:00+1359', '((2,2),1)', '((1,2),(2,1))', 'hello', '((1,2),(2,1))', 11, '010101', '2001-12-13', '((1,1),(2,2))', '(1,1)', '((1,2),(2,3),(3,4),(4,3),(3,2),(2,1))', 111111, '23:00:00', '2001-12-13 01:51:15');
SELECT count(*) FROM ck_sync1_drop_column_heap_default5;
INSERT INTO ck_sync1_drop_column_heap_default5 SELECT a,col018 ,col019, col020, col021, col022, col023, col024, col025 , col026, col027 , col028, col029 , col031, col032 , col034 , col035, col036 , col037, col039 , col040 from ck_sync1_heap_drop;
SELECT count(*) FROM ck_sync1_drop_column_heap_default5;
--
--
ALTER TABLE ck_sync1_drop_column_heap_default5 DROP COLUMN col018;
INSERT INTO ck_sync1_drop_column_heap_default5 VALUES (generate_series(1,10) ,'0.0.0.0', 'AA:AA:AA:AA:AA:AA', generate_series(1,10), '34.23', generate_series(1,10), '00:00:00+1359', '((2,2),1)', '((1,2),(2,1))', 'hello', '((1,2),(2,1))', 11, '010101', '2001-12-13', '((1,1),(2,2))', '(1,1)', '((1,2),(2,3),(3,4),(4,3),(3,2),(2,1))', 111111, '23:00:00', '2001-12-13 01:51:15');
SELECT count(*) FROM ck_sync1_drop_column_heap_default5;
INSERT INTO ck_sync1_drop_column_heap_default5 SELECT a,col019, col020, col021, col022, col023, col024, col025 , col026, col027 , col028, col029 , col031, col032 , col034 , col035, col036 , col037, col039 , col040 from ck_sync1_heap_drop;
SELECT count(*) FROM ck_sync1_drop_column_heap_default5;
--
--
ALTER TABLE ck_sync1_drop_column_heap_default5 DROP COLUMN col019;
INSERT INTO ck_sync1_drop_column_heap_default5 VALUES (generate_series(1,10) ,'AA:AA:AA:AA:AA:AA', generate_series(1,10), '34.23', generate_series(1,10), '00:00:00+1359', '((2,2),1)', '((1,2),(2,1))', 'hello', '((1,2),(2,1))', 11, '010101', '2001-12-13', '((1,1),(2,2))', '(1,1)', '((1,2),(2,3),(3,4),(4,3),(3,2),(2,1))', 111111, '23:00:00', '2001-12-13 01:51:15');
SELECT count(*) FROM ck_sync1_drop_column_heap_default5;
INSERT INTO ck_sync1_drop_column_heap_default5 SELECT a,col020, col021, col022, col023, col024, col025 , col026, col027 , col028, col029 , col031, col032 , col034 , col035, col036 , col037, col039 , col040 from ck_sync1_heap_drop;
SELECT count(*) FROM ck_sync1_drop_column_heap_default5;
--
--
ALTER TABLE ck_sync1_drop_column_heap_default5 DROP COLUMN col020;
INSERT INTO ck_sync1_drop_column_heap_default5 VALUES (generate_series(1,10) , generate_series(1,10), '34.23', generate_series(1,10), '00:00:00+1359', '((2,2),1)', '((1,2),(2,1))', 'hello', '((1,2),(2,1))', 11, '010101', '2001-12-13', '((1,1),(2,2))', '(1,1)', '((1,2),(2,3),(3,4),(4,3),(3,2),(2,1))', 111111, '23:00:00', '2001-12-13 01:51:15');
SELECT count(*) FROM ck_sync1_drop_column_heap_default5;
INSERT INTO ck_sync1_drop_column_heap_default5 SELECT a, col021, col022, col023, col024, col025 , col026, col027 , col028, col029 , col031, col032 , col034 , col035, col036 , col037, col039 , col040 from ck_sync1_heap_drop;
SELECT count(*) FROM ck_sync1_drop_column_heap_default5;
--
--
ALTER TABLE ck_sync1_drop_column_heap_default5 DROP COLUMN col021;
INSERT INTO ck_sync1_drop_column_heap_default5 VALUES (generate_series(1,10), '34.23', generate_series(1,10), '00:00:00+1359', '((2,2),1)', '((1,2),(2,1))', 'hello', '((1,2),(2,1))', 11, '010101', '2001-12-13', '((1,1),(2,2))', '(1,1)', '((1,2),(2,3),(3,4),(4,3),(3,2),(2,1))', 111111, '23:00:00', '2001-12-13 01:51:15');
SELECT count(*) FROM ck_sync1_drop_column_heap_default5;
INSERT INTO ck_sync1_drop_column_heap_default5 SELECT a, col022, col023, col024, col025 , col026, col027 , col028, col029 , col031, col032 , col034 , col035, col036 , col037, col039 , col040 from ck_sync1_heap_drop;
SELECT count(*) FROM ck_sync1_drop_column_heap_default5;
--
--
ALTER TABLE ck_sync1_drop_column_heap_default5 DROP COLUMN col022;
INSERT INTO ck_sync1_drop_column_heap_default5 VALUES (generate_series(1,10) , generate_series(1,10),'00:00:00+1359', '((2,2),1)', '((1,2),(2,1))', 'hello', '((1,2),(2,1))', 11, '010101', '2001-12-13', '((1,1),(2,2))', '(1,1)', '((1,2),(2,3),(3,4),(4,3),(3,2),(2,1))', 111111, '23:00:00', '2001-12-13 01:51:15');
SELECT count(*) FROM ck_sync1_drop_column_heap_default5;
INSERT INTO ck_sync1_drop_column_heap_default5 SELECT a, col023, col024, col025 , col026, col027 , col028, col029 , col031, col032 , col034 , col035, col036 , col037, col039 , col040 from ck_sync1_heap_drop;
SELECT count(*) FROM ck_sync1_drop_column_heap_default5;
--
--
ALTER TABLE ck_sync1_drop_column_heap_default5 DROP COLUMN col023;
INSERT INTO ck_sync1_drop_column_heap_default5 VALUES (generate_series(1,10) , '00:00:00+1359', '((2,2),1)', '((1,2),(2,1))', 'hello', '((1,2),(2,1))', 11, '010101', '2001-12-13', '((1,1),(2,2))', '(1,1)', '((1,2),(2,3),(3,4),(4,3),(3,2),(2,1))', 111111, '23:00:00', '2001-12-13 01:51:15');
SELECT count(*) FROM ck_sync1_drop_column_heap_default5;
INSERT INTO ck_sync1_drop_column_heap_default5 SELECT a,col024, col025 , col026, col027 , col028, col029 , col031, col032 , col034 , col035, col036 , col037, col039 , col040 from ck_sync1_heap_drop;
SELECT count(*) FROM ck_sync1_drop_column_heap_default5;
--
--
ALTER TABLE ck_sync1_drop_column_heap_default5 DROP COLUMN col024;
INSERT INTO ck_sync1_drop_column_heap_default5 VALUES (generate_series(1,10) , '((2,2),1)','((1,2),(2,1))', 'hello', '((1,2),(2,1))', 11, '010101', '2001-12-13', '((1,1),(2,2))', '(1,1)', '((1,2),(2,3),(3,4),(4,3),(3,2),(2,1))', 111111, '23:00:00', '2001-12-13 01:51:15');
SELECT count(*) FROM ck_sync1_drop_column_heap_default5;
INSERT INTO ck_sync1_drop_column_heap_default5 SELECT a,col025 , col026, col027 , col028, col029 , col031, col032 , col034 , col035, col036 , col037, col039 , col040 from ck_sync1_heap_drop;
SELECT count(*) FROM ck_sync1_drop_column_heap_default5;
--
--
ALTER TABLE ck_sync1_drop_column_heap_default5 DROP COLUMN col025;
INSERT INTO ck_sync1_drop_column_heap_default5 VALUES (generate_series(1,10) , '((1,2),(2,1))', 'hello', '((1,2),(2,1))', 11, '010101', '2001-12-13', '((1,1),(2,2))', '(1,1)', '((1,2),(2,3),(3,4),(4,3),(3,2),(2,1))', 111111, '23:00:00', '2001-12-13 01:51:15');
SELECT count(*) FROM ck_sync1_drop_column_heap_default5;
INSERT INTO ck_sync1_drop_column_heap_default5 SELECT a,col026, col027 , col028, col029 , col031, col032 , col034 , col035, col036 , col037, col039 , col040 from ck_sync1_heap_drop;
SELECT count(*) FROM ck_sync1_drop_column_heap_default5;
--
--
ALTER TABLE ck_sync1_drop_column_heap_default5 DROP COLUMN col026;
INSERT INTO ck_sync1_drop_column_heap_default5 VALUES (generate_series(1,10) ,'hello', '((1,2),(2,1))', 11, '010101', '2001-12-13', '((1,1),(2,2))', '(1,1)', '((1,2),(2,3),(3,4),(4,3),(3,2),(2,1))', 111111, '23:00:00', '2001-12-13 01:51:15');
SELECT count(*) FROM ck_sync1_drop_column_heap_default5;
INSERT INTO ck_sync1_drop_column_heap_default5 SELECT a,col027 , col028, col029 , col031, col032 , col034 , col035, col036 , col037, col039 , col040 from ck_sync1_heap_drop;
SELECT count(*) FROM ck_sync1_drop_column_heap_default5;
--
--
ALTER TABLE ck_sync1_drop_column_heap_default5 DROP COLUMN col027;
INSERT INTO ck_sync1_drop_column_heap_default5 VALUES (generate_series(1,10) ,'((1,2),(2,1))',11, '010101', '2001-12-13', '((1,1),(2,2))', '(1,1)', '((1,2),(2,3),(3,4),(4,3),(3,2),(2,1))', 111111, '23:00:00', '2001-12-13 01:51:15');
SELECT count(*) FROM ck_sync1_drop_column_heap_default5;
INSERT INTO ck_sync1_drop_column_heap_default5 SELECT a,col028, col029 , col031, col032 , col034 , col035, col036 , col037, col039 , col040 from ck_sync1_heap_drop;
SELECT count(*) FROM ck_sync1_drop_column_heap_default5;
--
--
ALTER TABLE ck_sync1_drop_column_heap_default5 DROP COLUMN col028;
INSERT INTO ck_sync1_drop_column_heap_default5 VALUES (generate_series(1,10) , 11, '010101', '2001-12-13', '((1,1),(2,2))', '(1,1)', '((1,2),(2,3),(3,4),(4,3),(3,2),(2,1))', 111111, '23:00:00', '2001-12-13 01:51:15');
SELECT count(*) FROM ck_sync1_drop_column_heap_default5;
INSERT INTO ck_sync1_drop_column_heap_default5 SELECT a,col029 , col031, col032 , col034 , col035, col036 , col037, col039 , col040 from ck_sync1_heap_drop;
SELECT count(*) FROM ck_sync1_drop_column_heap_default5;
--
--
ALTER TABLE ck_sync1_drop_column_heap_default5 DROP COLUMN col029;
INSERT INTO ck_sync1_drop_column_heap_default5 VALUES (generate_series(1,10) , '010101', '2001-12-13', '((1,1),(2,2))', '(1,1)', '((1,2),(2,3),(3,4),(4,3),(3,2),(2,1))', 111111, '23:00:00', '2001-12-13 01:51:15');
SELECT count(*) FROM ck_sync1_drop_column_heap_default5;
INSERT INTO ck_sync1_drop_column_heap_default5 SELECT a, col031, col032 , col034 , col035, col036 , col037, col039 , col040 from ck_sync1_heap_drop;
SELECT count(*) FROM ck_sync1_drop_column_heap_default5;
--
--
ALTER TABLE ck_sync1_drop_column_heap_default5 DROP COLUMN col031;
INSERT INTO ck_sync1_drop_column_heap_default5 VALUES (generate_series(1,10) , '2001-12-13', '((1,1),(2,2))', '(1,1)', '((1,2),(2,3),(3,4),(4,3),(3,2),(2,1))', 111111, '23:00:00', '2001-12-13 01:51:15');
SELECT count(*) FROM ck_sync1_drop_column_heap_default5;
INSERT INTO ck_sync1_drop_column_heap_default5 SELECT a, col032 , col034 , col035, col036 , col037, col039 , col040 from ck_sync1_heap_drop;
SELECT count(*) FROM ck_sync1_drop_column_heap_default5;
--
--
ALTER TABLE ck_sync1_drop_column_heap_default5 DROP COLUMN col032;
INSERT INTO ck_sync1_drop_column_heap_default5 VALUES (generate_series(1,10) , '((1,1),(2,2))','(1,1)', '((1,2),(2,3),(3,4),(4,3),(3,2),(2,1))', 111111, '23:00:00', '2001-12-13 01:51:15');
SELECT count(*) FROM ck_sync1_drop_column_heap_default5;
INSERT INTO ck_sync1_drop_column_heap_default5 SELECT a,col034 , col035, col036 , col037, col039 , col040 from ck_sync1_heap_drop;
SELECT count(*) FROM ck_sync1_drop_column_heap_default5;
--
--
ALTER TABLE ck_sync1_drop_column_heap_default5 DROP COLUMN col034;
INSERT INTO ck_sync1_drop_column_heap_default5 VALUES (generate_series(1,10) , '(1,1)','((1,2),(2,3),(3,4),(4,3),(3,2),(2,1))', 111111, '23:00:00', '2001-12-13 01:51:15');
SELECT count(*) FROM ck_sync1_drop_column_heap_default5;
INSERT INTO ck_sync1_drop_column_heap_default5 SELECT a,col035, col036 , col037, col039 , col040 from ck_sync1_heap_drop;
SELECT count(*) FROM ck_sync1_drop_column_heap_default5;
--
--
ALTER TABLE ck_sync1_drop_column_heap_default5 DROP COLUMN col035;
INSERT INTO ck_sync1_drop_column_heap_default5 VALUES (generate_series(1,10) ,'((1,2),(2,3),(3,4),(4,3),(3,2),(2,1))', 111111, '23:00:00', '2001-12-13 01:51:15');
SELECT count(*) FROM ck_sync1_drop_column_heap_default5;
INSERT INTO ck_sync1_drop_column_heap_default5 SELECT a, col036 , col037, col039 , col040 from ck_sync1_heap_drop;
SELECT count(*) FROM ck_sync1_drop_column_heap_default5;
--
--
ALTER TABLE ck_sync1_drop_column_heap_default5 DROP COLUMN col036;
INSERT INTO ck_sync1_drop_column_heap_default5 VALUES (generate_series(1,10) , 111111,'23:00:00', '2001-12-13 01:51:15');
SELECT count(*) FROM ck_sync1_drop_column_heap_default5;
INSERT INTO ck_sync1_drop_column_heap_default5 SELECT a, col037, col039 , col040 from ck_sync1_heap_drop;
SELECT count(*) FROM ck_sync1_drop_column_heap_default5;
--
--
ALTER TABLE ck_sync1_drop_column_heap_default5 DROP COLUMN col037;
INSERT INTO ck_sync1_drop_column_heap_default5 VALUES (generate_series(1,10) , '23:00:00', '2001-12-13 01:51:15');
SELECT count(*) FROM ck_sync1_drop_column_heap_default5;
INSERT INTO ck_sync1_drop_column_heap_default5 SELECT a,col039 , col040 from ck_sync1_heap_drop;
SELECT count(*) FROM ck_sync1_drop_column_heap_default5;
--
--
ALTER TABLE ck_sync1_drop_column_heap_default5 DROP COLUMN col039;
INSERT INTO ck_sync1_drop_column_heap_default5 VALUES (generate_series(1,10) , '2001-12-13 01:51:15');
SELECT count(*) FROM ck_sync1_drop_column_heap_default5;
INSERT INTO ck_sync1_drop_column_heap_default5 SELECT a,col040 from ck_sync1_heap_drop;
SELECT count(*) FROM ck_sync1_drop_column_heap_default5;
--
--
ALTER TABLE ck_sync1_drop_column_heap_default5 DROP COLUMN col040;
INSERT INTO ck_sync1_drop_column_heap_default5 VALUES (generate_series(1,10) );
SELECT count(*) FROM ck_sync1_drop_column_heap_default5;
INSERT INTO ck_sync1_drop_column_heap_default5 SELECT a from ck_sync1_heap_drop;
SELECT count(*) FROM ck_sync1_drop_column_heap_default5;
--
--
--
-- DROP ALL COLUMN WITH DEFAULT TO - > SYNC1 TABLE sync1_drop_column_heap_default6
--
--
--
ALTER TABLE sync1_drop_column_heap_default6 DROP COLUMN col001;
INSERT INTO sync1_drop_column_heap_default6 VALUES (generate_series(1,10) ,11,true,'111', '1_one', '{1,2,3,4,5}', 'Hello .. how are you', 'Hello .. how are you', '{one,two,three,four,five}', 12345678, 1, 111.1111, 11, '1_one_11', 'd','2001-12-13 01:51:15+1359', '11', '0.0.0.0', '0.0.0.0', 'AA:AA:AA:AA:AA:AA', generate_series(1,10), '34.23', generate_series(1,10), '00:00:00+1359', '((2,2),1)', '((1,2),(2,1))', 'hello', '((1,2),(2,1))', 11, '010101', '2001-12-13', '((1,1),(2,2))', '(1,1)', '((1,2),(2,3),(3,4),(4,3),(3,2),(2,1))', 111111, '23:00:00', '2001-12-13 01:51:15');
SELECT count(*) FROM sync1_drop_column_heap_default6;
INSERT INTO sync1_drop_column_heap_default6 SELECT a,col002 , col003, col004, col005, col006, col007 , col008, col009, col010, col011,col012 ,col013, col014, col015 , col016, col017 ,col018 ,col019, col020, col021, col022, col023, col024, col025 , col026, col027 , col028, col029 , col031, col032 , col034 , col035, col036 , col037, col039 , col040 from sync1_heap_drop;
SELECT count(*) FROM sync1_drop_column_heap_default6;
--
--
ALTER TABLE sync1_drop_column_heap_default6 DROP COLUMN col002;
INSERT INTO sync1_drop_column_heap_default6 VALUES (generate_series(1,10) ,true,'111', '1_one', '{1,2,3,4,5}', 'Hello .. how are you', 'Hello .. how are you', '{one,two,three,four,five}', 12345678, 1, 111.1111, 11, '1_one_11', 'd','2001-12-13 01:51:15+1359', '11', '0.0.0.0', '0.0.0.0', 'AA:AA:AA:AA:AA:AA', generate_series(1,10), '34.23', generate_series(1,10), '00:00:00+1359', '((2,2),1)', '((1,2),(2,1))', 'hello', '((1,2),(2,1))', 11, '010101', '2001-12-13', '((1,1),(2,2))', '(1,1)', '((1,2),(2,3),(3,4),(4,3),(3,2),(2,1))', 111111, '23:00:00', '2001-12-13 01:51:15');
SELECT count(*) FROM sync1_drop_column_heap_default6;
INSERT INTO sync1_drop_column_heap_default6 SELECT a,col003, col004, col005, col006, col007 , col008, col009, col010, col011,col012 ,col013, col014, col015 , col016, col017 ,col018 ,col019, col020, col021, col022, col023, col024, col025 , col026, col027 , col028, col029 , col031, col032 , col034 , col035, col036 , col037, col039 , col040 from sync1_heap_drop;
SELECT count(*) FROM sync1_drop_column_heap_default6;
--
--
ALTER TABLE sync1_drop_column_heap_default6 DROP COLUMN col003;
INSERT INTO sync1_drop_column_heap_default6 VALUES (generate_series(1,10) ,'111', '1_one', '{1,2,3,4,5}', 'Hello .. how are you', 'Hello .. how are you', '{one,two,three,four,five}', 12345678, 1, 111.1111, 11, '1_one_11', 'd','2001-12-13 01:51:15+1359', '11', '0.0.0.0', '0.0.0.0', 'AA:AA:AA:AA:AA:AA', generate_series(1,10), '34.23', generate_series(1,10), '00:00:00+1359', '((2,2),1)', '((1,2),(2,1))', 'hello', '((1,2),(2,1))', 11, '010101', '2001-12-13', '((1,1),(2,2))', '(1,1)', '((1,2),(2,3),(3,4),(4,3),(3,2),(2,1))', 111111, '23:00:00', '2001-12-13 01:51:15');
SELECT count(*) FROM sync1_drop_column_heap_default6;
INSERT INTO sync1_drop_column_heap_default6 SELECT a,col004, col005, col006, col007 , col008, col009, col010, col011,col012 ,col013, col014, col015 , col016, col017 ,col018 ,col019, col020, col021, col022, col023, col024, col025 , col026, col027 , col028, col029 , col031, col032 , col034 , col035, col036 , col037, col039 , col040 from sync1_heap_drop;
SELECT count(*) FROM sync1_drop_column_heap_default6;
--
--
ALTER TABLE sync1_drop_column_heap_default6 DROP COLUMN col004;
INSERT INTO sync1_drop_column_heap_default6 VALUES (generate_series(1,10) ,'1_one', '{1,2,3,4,5}', 'Hello .. how are you', 'Hello .. how are you', '{one,two,three,four,five}', 12345678, 1, 111.1111, 11, '1_one_11', 'd','2001-12-13 01:51:15+1359', '11', '0.0.0.0', '0.0.0.0', 'AA:AA:AA:AA:AA:AA', generate_series(1,10), '34.23', generate_series(1,10), '00:00:00+1359', '((2,2),1)', '((1,2),(2,1))', 'hello', '((1,2),(2,1))', 11, '010101', '2001-12-13', '((1,1),(2,2))', '(1,1)', '((1,2),(2,3),(3,4),(4,3),(3,2),(2,1))', 111111, '23:00:00', '2001-12-13 01:51:15');
SELECT count(*) FROM sync1_drop_column_heap_default6;
INSERT INTO sync1_drop_column_heap_default6 SELECT a,col005, col006, col007 , col008, col009, col010, col011,col012 ,col013, col014, col015 , col016, col017 ,col018 ,col019, col020, col021, col022, col023, col024, col025 , col026, col027 , col028, col029 , col031, col032 , col034 , col035, col036 , col037, col039 , col040 from sync1_heap_drop;
SELECT count(*) FROM sync1_drop_column_heap_default6;
--
--
ALTER TABLE sync1_drop_column_heap_default6 DROP COLUMN col005;
INSERT INTO sync1_drop_column_heap_default6 VALUES (generate_series(1,10) , '{1,2,3,4,5}', 'Hello .. how are you', 'Hello .. how are you', '{one,two,three,four,five}', 12345678, 1, 111.1111, 11, '1_one_11', 'd','2001-12-13 01:51:15+1359', '11', '0.0.0.0', '0.0.0.0', 'AA:AA:AA:AA:AA:AA', generate_series(1,10), '34.23', generate_series(1,10), '00:00:00+1359', '((2,2),1)', '((1,2),(2,1))', 'hello', '((1,2),(2,1))', 11, '010101', '2001-12-13', '((1,1),(2,2))', '(1,1)', '((1,2),(2,3),(3,4),(4,3),(3,2),(2,1))', 111111, '23:00:00', '2001-12-13 01:51:15');
SELECT count(*) FROM sync1_drop_column_heap_default6;
INSERT INTO sync1_drop_column_heap_default6 SELECT a,col006, col007 , col008, col009, col010, col011,col012 ,col013, col014, col015 , col016, col017 ,col018 ,col019, col020, col021, col022, col023, col024, col025 , col026, col027 , col028, col029 , col031, col032 , col034 , col035, col036 , col037, col039 , col040 from sync1_heap_drop;
SELECT count(*) FROM sync1_drop_column_heap_default6;
--
--
ALTER TABLE sync1_drop_column_heap_default6 DROP COLUMN col006;
INSERT INTO sync1_drop_column_heap_default6 VALUES (generate_series(1,10) , 'Hello .. how are you', 'Hello .. how are you', '{one,two,three,four,five}', 12345678, 1, 111.1111, 11, '1_one_11', 'd','2001-12-13 01:51:15+1359', '11', '0.0.0.0', '0.0.0.0', 'AA:AA:AA:AA:AA:AA', generate_series(1,10), '34.23', generate_series(1,10), '00:00:00+1359', '((2,2),1)', '((1,2),(2,1))', 'hello', '((1,2),(2,1))', 11, '010101', '2001-12-13', '((1,1),(2,2))', '(1,1)', '((1,2),(2,3),(3,4),(4,3),(3,2),(2,1))', 111111, '23:00:00', '2001-12-13 01:51:15');
SELECT count(*) FROM sync1_drop_column_heap_default6;
INSERT INTO sync1_drop_column_heap_default6 SELECT a, col007 , col008, col009, col010, col011,col012 ,col013, col014, col015 , col016, col017 ,col018 ,col019, col020, col021, col022, col023, col024, col025 , col026, col027 , col028, col029 , col031, col032 , col034 , col035, col036 , col037, col039 , col040 from sync1_heap_drop;
SELECT count(*) FROM sync1_drop_column_heap_default6;
--
--
ALTER TABLE sync1_drop_column_heap_default6 DROP COLUMN col007;
INSERT INTO sync1_drop_column_heap_default6 VALUES (generate_series(1,10) , 'Hello .. how are you', '{one,two,three,four,five}', 12345678, 1, 111.1111, 11, '1_one_11', 'd','2001-12-13 01:51:15+1359', '11', '0.0.0.0', '0.0.0.0', 'AA:AA:AA:AA:AA:AA', generate_series(1,10), '34.23', generate_series(1,10), '00:00:00+1359', '((2,2),1)', '((1,2),(2,1))', 'hello', '((1,2),(2,1))', 11, '010101', '2001-12-13', '((1,1),(2,2))', '(1,1)', '((1,2),(2,3),(3,4),(4,3),(3,2),(2,1))', 111111, '23:00:00', '2001-12-13 01:51:15');
SELECT count(*) FROM sync1_drop_column_heap_default6;
INSERT INTO sync1_drop_column_heap_default6 SELECT a, col008, col009, col010, col011,col012 ,col013, col014, col015 , col016, col017 ,col018 ,col019, col020, col021, col022, col023, col024, col025 , col026, col027 , col028, col029 , col031, col032 , col034 , col035, col036 , col037, col039 , col040 from sync1_heap_drop;
SELECT count(*) FROM sync1_drop_column_heap_default6;
--
--
ALTER TABLE sync1_drop_column_heap_default6 DROP COLUMN col008;
INSERT INTO sync1_drop_column_heap_default6 VALUES (generate_series(1,10) ,'{one,two,three,four,five}', 12345678, 1, 111.1111, 11, '1_one_11', 'd','2001-12-13 01:51:15+1359', '11', '0.0.0.0', '0.0.0.0', 'AA:AA:AA:AA:AA:AA', generate_series(1,10), '34.23', generate_series(1,10), '00:00:00+1359', '((2,2),1)', '((1,2),(2,1))', 'hello', '((1,2),(2,1))', 11, '010101', '2001-12-13', '((1,1),(2,2))', '(1,1)', '((1,2),(2,3),(3,4),(4,3),(3,2),(2,1))', 111111, '23:00:00', '2001-12-13 01:51:15');
SELECT count(*) FROM sync1_drop_column_heap_default6;
INSERT INTO sync1_drop_column_heap_default6 SELECT a, col009, col010, col011,col012 ,col013, col014, col015 , col016, col017 ,col018 ,col019, col020, col021, col022, col023, col024, col025 , col026, col027 , col028, col029 , col031, col032 , col034 , col035, col036 , col037, col039 , col040 from sync1_heap_drop;
SELECT count(*) FROM sync1_drop_column_heap_default6;
--
--
ALTER TABLE sync1_drop_column_heap_default6 DROP COLUMN col009;
INSERT INTO sync1_drop_column_heap_default6 VALUES (generate_series(1,10) ,12345678, 1, 111.1111, 11, '1_one_11', 'd','2001-12-13 01:51:15+1359', '11', '0.0.0.0', '0.0.0.0', 'AA:AA:AA:AA:AA:AA', generate_series(1,10), '34.23', generate_series(1,10), '00:00:00+1359', '((2,2),1)', '((1,2),(2,1))', 'hello', '((1,2),(2,1))', 11, '010101', '2001-12-13', '((1,1),(2,2))', '(1,1)', '((1,2),(2,3),(3,4),(4,3),(3,2),(2,1))', 111111, '23:00:00', '2001-12-13 01:51:15');
SELECT count(*) FROM sync1_drop_column_heap_default6;
INSERT INTO sync1_drop_column_heap_default6 SELECT a,col010, col011,col012 ,col013, col014, col015 , col016, col017 ,col018 ,col019, col020, col021, col022, col023, col024, col025 , col026, col027 , col028, col029 , col031, col032 , col034 , col035, col036 , col037, col039 , col040 from sync1_heap_drop;
SELECT count(*) FROM sync1_drop_column_heap_default6;
--
--
ALTER TABLE sync1_drop_column_heap_default6 DROP COLUMN col010;
INSERT INTO sync1_drop_column_heap_default6 VALUES (generate_series(1,10) ,1, 111.1111, 11, '1_one_11', 'd','2001-12-13 01:51:15+1359', '11', '0.0.0.0', '0.0.0.0', 'AA:AA:AA:AA:AA:AA', generate_series(1,10), '34.23', generate_series(1,10), '00:00:00+1359', '((2,2),1)', '((1,2),(2,1))', 'hello', '((1,2),(2,1))', 11, '010101', '2001-12-13', '((1,1),(2,2))', '(1,1)', '((1,2),(2,3),(3,4),(4,3),(3,2),(2,1))', 111111, '23:00:00', '2001-12-13 01:51:15');
SELECT count(*) FROM sync1_drop_column_heap_default6;
INSERT INTO sync1_drop_column_heap_default6 SELECT a,col011,col012 ,col013, col014, col015 , col016, col017 ,col018 ,col019, col020, col021, col022, col023, col024, col025 , col026, col027 , col028, col029 , col031, col032 , col034 , col035, col036 , col037, col039 , col040 from sync1_heap_drop;
SELECT count(*) FROM sync1_drop_column_heap_default6;
--
--
ALTER TABLE sync1_drop_column_heap_default6 DROP COLUMN col011;
INSERT INTO sync1_drop_column_heap_default6 VALUES (generate_series(1,10) , 111.1111, 11, '1_one_11', 'd','2001-12-13 01:51:15+1359', '11', '0.0.0.0', '0.0.0.0', 'AA:AA:AA:AA:AA:AA', generate_series(1,10), '34.23', generate_series(1,10), '00:00:00+1359', '((2,2),1)', '((1,2),(2,1))', 'hello', '((1,2),(2,1))', 11, '010101', '2001-12-13', '((1,1),(2,2))', '(1,1)', '((1,2),(2,3),(3,4),(4,3),(3,2),(2,1))', 111111, '23:00:00', '2001-12-13 01:51:15');
SELECT count(*) FROM sync1_drop_column_heap_default6;
INSERT INTO sync1_drop_column_heap_default6 SELECT a,col012 ,col013, col014, col015 , col016, col017 ,col018 ,col019, col020, col021, col022, col023, col024, col025 , col026, col027 , col028, col029 , col031, col032 , col034 , col035, col036 , col037, col039 , col040 from sync1_heap_drop;
SELECT count(*) FROM sync1_drop_column_heap_default6;
--
--
ALTER TABLE sync1_drop_column_heap_default6 DROP COLUMN col012;
INSERT INTO sync1_drop_column_heap_default6 VALUES (generate_series(1,10) , 11, '1_one_11', 'd','2001-12-13 01:51:15+1359', '11', '0.0.0.0', '0.0.0.0', 'AA:AA:AA:AA:AA:AA', generate_series(1,10), '34.23', generate_series(1,10), '00:00:00+1359', '((2,2),1)', '((1,2),(2,1))', 'hello', '((1,2),(2,1))', 11, '010101', '2001-12-13', '((1,1),(2,2))', '(1,1)', '((1,2),(2,3),(3,4),(4,3),(3,2),(2,1))', 111111, '23:00:00', '2001-12-13 01:51:15');
SELECT count(*) FROM sync1_drop_column_heap_default6;
INSERT INTO sync1_drop_column_heap_default6 SELECT a,col013, col014, col015 , col016, col017 ,col018 ,col019, col020, col021, col022, col023, col024, col025 , col026, col027 , col028, col029 , col031, col032 , col034 , col035, col036 , col037, col039 , col040 from sync1_heap_drop;
SELECT count(*) FROM sync1_drop_column_heap_default6;
--
--
ALTER TABLE sync1_drop_column_heap_default6 DROP COLUMN col013;
INSERT INTO sync1_drop_column_heap_default6 VALUES (generate_series(1,10) ,'1_one_11', 'd','2001-12-13 01:51:15+1359', '11', '0.0.0.0', '0.0.0.0', 'AA:AA:AA:AA:AA:AA', generate_series(1,10), '34.23', generate_series(1,10), '00:00:00+1359', '((2,2),1)', '((1,2),(2,1))', 'hello', '((1,2),(2,1))', 11, '010101', '2001-12-13', '((1,1),(2,2))', '(1,1)', '((1,2),(2,3),(3,4),(4,3),(3,2),(2,1))', 111111, '23:00:00', '2001-12-13 01:51:15');
SELECT count(*) FROM sync1_drop_column_heap_default6;
INSERT INTO sync1_drop_column_heap_default6 SELECT a,col014, col015 , col016, col017 ,col018 ,col019, col020, col021, col022, col023, col024, col025 , col026, col027 , col028, col029 , col031, col032 , col034 , col035, col036 , col037, col039 , col040 from sync1_heap_drop;
SELECT count(*) FROM sync1_drop_column_heap_default6;
--
--
ALTER TABLE sync1_drop_column_heap_default6 DROP COLUMN col014;
INSERT INTO sync1_drop_column_heap_default6 VALUES (generate_series(1,10) ,'d','2001-12-13 01:51:15+1359', '11', '0.0.0.0', '0.0.0.0', 'AA:AA:AA:AA:AA:AA', generate_series(1,10), '34.23', generate_series(1,10), '00:00:00+1359', '((2,2),1)', '((1,2),(2,1))', 'hello', '((1,2),(2,1))', 11, '010101', '2001-12-13', '((1,1),(2,2))', '(1,1)', '((1,2),(2,3),(3,4),(4,3),(3,2),(2,1))', 111111, '23:00:00', '2001-12-13 01:51:15');
SELECT count(*) FROM sync1_drop_column_heap_default6;
INSERT INTO sync1_drop_column_heap_default6 SELECT a, col015 , col016, col017 ,col018 ,col019, col020, col021, col022, col023, col024, col025 , col026, col027 , col028, col029 , col031, col032 , col034 , col035, col036 , col037, col039 , col040 from sync1_heap_drop;
SELECT count(*) FROM sync1_drop_column_heap_default6;
--
--
ALTER TABLE sync1_drop_column_heap_default6 DROP COLUMN col015;
INSERT INTO sync1_drop_column_heap_default6 VALUES (generate_series(1,10) ,'2001-12-13 01:51:15+1359', '11', '0.0.0.0', '0.0.0.0', 'AA:AA:AA:AA:AA:AA', generate_series(1,10), '34.23', generate_series(1,10), '00:00:00+1359', '((2,2),1)', '((1,2),(2,1))', 'hello', '((1,2),(2,1))', 11, '010101', '2001-12-13', '((1,1),(2,2))', '(1,1)', '((1,2),(2,3),(3,4),(4,3),(3,2),(2,1))', 111111, '23:00:00', '2001-12-13 01:51:15');
SELECT count(*) FROM sync1_drop_column_heap_default6;
INSERT INTO sync1_drop_column_heap_default6 SELECT a,col016, col017 ,col018 ,col019, col020, col021, col022, col023, col024, col025 , col026, col027 , col028, col029 , col031, col032 , col034 , col035, col036 , col037, col039 , col040 from sync1_heap_drop;
SELECT count(*) FROM sync1_drop_column_heap_default6;
--
--
ALTER TABLE sync1_drop_column_heap_default6 DROP COLUMN col016;
INSERT INTO sync1_drop_column_heap_default6 VALUES (generate_series(1,10) , '11', '0.0.0.0', '0.0.0.0', 'AA:AA:AA:AA:AA:AA', generate_series(1,10), '34.23', generate_series(1,10), '00:00:00+1359', '((2,2),1)', '((1,2),(2,1))', 'hello', '((1,2),(2,1))', 11, '010101', '2001-12-13', '((1,1),(2,2))', '(1,1)', '((1,2),(2,3),(3,4),(4,3),(3,2),(2,1))', 111111, '23:00:00', '2001-12-13 01:51:15');
SELECT count(*) FROM sync1_drop_column_heap_default6;
INSERT INTO sync1_drop_column_heap_default6 SELECT a, col017 ,col018 ,col019, col020, col021, col022, col023, col024, col025 , col026, col027 , col028, col029 , col031, col032 , col034 , col035, col036 , col037, col039 , col040 from sync1_heap_drop;
SELECT count(*) FROM sync1_drop_column_heap_default6;
--
--
ALTER TABLE sync1_drop_column_heap_default6 DROP COLUMN col017;
INSERT INTO sync1_drop_column_heap_default6 VALUES (generate_series(1,10) ,'0.0.0.0','0.0.0.0', 'AA:AA:AA:AA:AA:AA', generate_series(1,10), '34.23', generate_series(1,10), '00:00:00+1359', '((2,2),1)', '((1,2),(2,1))', 'hello', '((1,2),(2,1))', 11, '010101', '2001-12-13', '((1,1),(2,2))', '(1,1)', '((1,2),(2,3),(3,4),(4,3),(3,2),(2,1))', 111111, '23:00:00', '2001-12-13 01:51:15');
SELECT count(*) FROM sync1_drop_column_heap_default6;
INSERT INTO sync1_drop_column_heap_default6 SELECT a,col018 ,col019, col020, col021, col022, col023, col024, col025 , col026, col027 , col028, col029 , col031, col032 , col034 , col035, col036 , col037, col039 , col040 from sync1_heap_drop;
SELECT count(*) FROM sync1_drop_column_heap_default6;
--
--
ALTER TABLE sync1_drop_column_heap_default6 DROP COLUMN col018;
INSERT INTO sync1_drop_column_heap_default6 VALUES (generate_series(1,10) ,'0.0.0.0', 'AA:AA:AA:AA:AA:AA', generate_series(1,10), '34.23', generate_series(1,10), '00:00:00+1359', '((2,2),1)', '((1,2),(2,1))', 'hello', '((1,2),(2,1))', 11, '010101', '2001-12-13', '((1,1),(2,2))', '(1,1)', '((1,2),(2,3),(3,4),(4,3),(3,2),(2,1))', 111111, '23:00:00', '2001-12-13 01:51:15');
SELECT count(*) FROM sync1_drop_column_heap_default6;
INSERT INTO sync1_drop_column_heap_default6 SELECT a,col019, col020, col021, col022, col023, col024, col025 , col026, col027 , col028, col029 , col031, col032 , col034 , col035, col036 , col037, col039 , col040 from sync1_heap_drop;
SELECT count(*) FROM sync1_drop_column_heap_default6;
--
--
ALTER TABLE sync1_drop_column_heap_default6 DROP COLUMN col019;
INSERT INTO sync1_drop_column_heap_default6 VALUES (generate_series(1,10) ,'AA:AA:AA:AA:AA:AA', generate_series(1,10), '34.23', generate_series(1,10), '00:00:00+1359', '((2,2),1)', '((1,2),(2,1))', 'hello', '((1,2),(2,1))', 11, '010101', '2001-12-13', '((1,1),(2,2))', '(1,1)', '((1,2),(2,3),(3,4),(4,3),(3,2),(2,1))', 111111, '23:00:00', '2001-12-13 01:51:15');
SELECT count(*) FROM sync1_drop_column_heap_default6;
INSERT INTO sync1_drop_column_heap_default6 SELECT a,col020, col021, col022, col023, col024, col025 , col026, col027 , col028, col029 , col031, col032 , col034 , col035, col036 , col037, col039 , col040 from sync1_heap_drop;
SELECT count(*) FROM sync1_drop_column_heap_default6;
--
--
ALTER TABLE sync1_drop_column_heap_default6 DROP COLUMN col020;
INSERT INTO sync1_drop_column_heap_default6 VALUES (generate_series(1,10) , generate_series(1,10), '34.23', generate_series(1,10), '00:00:00+1359', '((2,2),1)', '((1,2),(2,1))', 'hello', '((1,2),(2,1))', 11, '010101', '2001-12-13', '((1,1),(2,2))', '(1,1)', '((1,2),(2,3),(3,4),(4,3),(3,2),(2,1))', 111111, '23:00:00', '2001-12-13 01:51:15');
SELECT count(*) FROM sync1_drop_column_heap_default6;
INSERT INTO sync1_drop_column_heap_default6 SELECT a, col021, col022, col023, col024, col025 , col026, col027 , col028, col029 , col031, col032 , col034 , col035, col036 , col037, col039 , col040 from sync1_heap_drop;
SELECT count(*) FROM sync1_drop_column_heap_default6;
--
--
ALTER TABLE sync1_drop_column_heap_default6 DROP COLUMN col021;
INSERT INTO sync1_drop_column_heap_default6 VALUES (generate_series(1,10), '34.23', generate_series(1,10), '00:00:00+1359', '((2,2),1)', '((1,2),(2,1))', 'hello', '((1,2),(2,1))', 11, '010101', '2001-12-13', '((1,1),(2,2))', '(1,1)', '((1,2),(2,3),(3,4),(4,3),(3,2),(2,1))', 111111, '23:00:00', '2001-12-13 01:51:15');
SELECT count(*) FROM sync1_drop_column_heap_default6;
INSERT INTO sync1_drop_column_heap_default6 SELECT a, col022, col023, col024, col025 , col026, col027 , col028, col029 , col031, col032 , col034 , col035, col036 , col037, col039 , col040 from sync1_heap_drop;
SELECT count(*) FROM sync1_drop_column_heap_default6;
--
--
ALTER TABLE sync1_drop_column_heap_default6 DROP COLUMN col022;
INSERT INTO sync1_drop_column_heap_default6 VALUES (generate_series(1,10) , generate_series(1,10),'00:00:00+1359', '((2,2),1)', '((1,2),(2,1))', 'hello', '((1,2),(2,1))', 11, '010101', '2001-12-13', '((1,1),(2,2))', '(1,1)', '((1,2),(2,3),(3,4),(4,3),(3,2),(2,1))', 111111, '23:00:00', '2001-12-13 01:51:15');
SELECT count(*) FROM sync1_drop_column_heap_default6;
INSERT INTO sync1_drop_column_heap_default6 SELECT a, col023, col024, col025 , col026, col027 , col028, col029 , col031, col032 , col034 , col035, col036 , col037, col039 , col040 from sync1_heap_drop;
SELECT count(*) FROM sync1_drop_column_heap_default6;
--
--
ALTER TABLE sync1_drop_column_heap_default6 DROP COLUMN col023;
INSERT INTO sync1_drop_column_heap_default6 VALUES (generate_series(1,10) , '00:00:00+1359', '((2,2),1)', '((1,2),(2,1))', 'hello', '((1,2),(2,1))', 11, '010101', '2001-12-13', '((1,1),(2,2))', '(1,1)', '((1,2),(2,3),(3,4),(4,3),(3,2),(2,1))', 111111, '23:00:00', '2001-12-13 01:51:15');
SELECT count(*) FROM sync1_drop_column_heap_default6;
INSERT INTO sync1_drop_column_heap_default6 SELECT a,col024, col025 , col026, col027 , col028, col029 , col031, col032 , col034 , col035, col036 , col037, col039 , col040 from sync1_heap_drop;
SELECT count(*) FROM sync1_drop_column_heap_default6;
--
--
ALTER TABLE sync1_drop_column_heap_default6 DROP COLUMN col024;
INSERT INTO sync1_drop_column_heap_default6 VALUES (generate_series(1,10) , '((2,2),1)','((1,2),(2,1))', 'hello', '((1,2),(2,1))', 11, '010101', '2001-12-13', '((1,1),(2,2))', '(1,1)', '((1,2),(2,3),(3,4),(4,3),(3,2),(2,1))', 111111, '23:00:00', '2001-12-13 01:51:15');
SELECT count(*) FROM sync1_drop_column_heap_default6;
INSERT INTO sync1_drop_column_heap_default6 SELECT a,col025 , col026, col027 , col028, col029 , col031, col032 , col034 , col035, col036 , col037, col039 , col040 from sync1_heap_drop;
SELECT count(*) FROM sync1_drop_column_heap_default6;
--
--
ALTER TABLE sync1_drop_column_heap_default6 DROP COLUMN col025;
INSERT INTO sync1_drop_column_heap_default6 VALUES (generate_series(1,10) , '((1,2),(2,1))', 'hello', '((1,2),(2,1))', 11, '010101', '2001-12-13', '((1,1),(2,2))', '(1,1)', '((1,2),(2,3),(3,4),(4,3),(3,2),(2,1))', 111111, '23:00:00', '2001-12-13 01:51:15');
SELECT count(*) FROM sync1_drop_column_heap_default6;
INSERT INTO sync1_drop_column_heap_default6 SELECT a,col026, col027 , col028, col029 , col031, col032 , col034 , col035, col036 , col037, col039 , col040 from sync1_heap_drop;
SELECT count(*) FROM sync1_drop_column_heap_default6;
--
--
ALTER TABLE sync1_drop_column_heap_default6 DROP COLUMN col026;
INSERT INTO sync1_drop_column_heap_default6 VALUES (generate_series(1,10) ,'hello', '((1,2),(2,1))', 11, '010101', '2001-12-13', '((1,1),(2,2))', '(1,1)', '((1,2),(2,3),(3,4),(4,3),(3,2),(2,1))', 111111, '23:00:00', '2001-12-13 01:51:15');
SELECT count(*) FROM sync1_drop_column_heap_default6;
INSERT INTO sync1_drop_column_heap_default6 SELECT a,col027 , col028, col029 , col031, col032 , col034 , col035, col036 , col037, col039 , col040 from sync1_heap_drop;
SELECT count(*) FROM sync1_drop_column_heap_default6;
--
--
ALTER TABLE sync1_drop_column_heap_default6 DROP COLUMN col027;
INSERT INTO sync1_drop_column_heap_default6 VALUES (generate_series(1,10) ,'((1,2),(2,1))',11, '010101', '2001-12-13', '((1,1),(2,2))', '(1,1)', '((1,2),(2,3),(3,4),(4,3),(3,2),(2,1))', 111111, '23:00:00', '2001-12-13 01:51:15');
SELECT count(*) FROM sync1_drop_column_heap_default6;
INSERT INTO sync1_drop_column_heap_default6 SELECT a,col028, col029 , col031, col032 , col034 , col035, col036 , col037, col039 , col040 from sync1_heap_drop;
SELECT count(*) FROM sync1_drop_column_heap_default6;
--
--
ALTER TABLE sync1_drop_column_heap_default6 DROP COLUMN col028;
INSERT INTO sync1_drop_column_heap_default6 VALUES (generate_series(1,10) , 11, '010101', '2001-12-13', '((1,1),(2,2))', '(1,1)', '((1,2),(2,3),(3,4),(4,3),(3,2),(2,1))', 111111, '23:00:00', '2001-12-13 01:51:15');
SELECT count(*) FROM sync1_drop_column_heap_default6;
INSERT INTO sync1_drop_column_heap_default6 SELECT a,col029 , col031, col032 , col034 , col035, col036 , col037, col039 , col040 from sync1_heap_drop;
SELECT count(*) FROM sync1_drop_column_heap_default6;
--
--
ALTER TABLE sync1_drop_column_heap_default6 DROP COLUMN col029;
INSERT INTO sync1_drop_column_heap_default6 VALUES (generate_series(1,10) , '010101', '2001-12-13', '((1,1),(2,2))', '(1,1)', '((1,2),(2,3),(3,4),(4,3),(3,2),(2,1))', 111111, '23:00:00', '2001-12-13 01:51:15');
SELECT count(*) FROM sync1_drop_column_heap_default6;
INSERT INTO sync1_drop_column_heap_default6 SELECT a, col031, col032 , col034 , col035, col036 , col037, col039 , col040 from sync1_heap_drop;
SELECT count(*) FROM sync1_drop_column_heap_default6;
--
--
ALTER TABLE sync1_drop_column_heap_default6 DROP COLUMN col031;
INSERT INTO sync1_drop_column_heap_default6 VALUES (generate_series(1,10) , '2001-12-13', '((1,1),(2,2))', '(1,1)', '((1,2),(2,3),(3,4),(4,3),(3,2),(2,1))', 111111, '23:00:00', '2001-12-13 01:51:15');
SELECT count(*) FROM sync1_drop_column_heap_default6;
INSERT INTO sync1_drop_column_heap_default6 SELECT a, col032 , col034 , col035, col036 , col037, col039 , col040 from sync1_heap_drop;
SELECT count(*) FROM sync1_drop_column_heap_default6;
--
--
ALTER TABLE sync1_drop_column_heap_default6 DROP COLUMN col032;
INSERT INTO sync1_drop_column_heap_default6 VALUES (generate_series(1,10) , '((1,1),(2,2))','(1,1)', '((1,2),(2,3),(3,4),(4,3),(3,2),(2,1))', 111111, '23:00:00', '2001-12-13 01:51:15');
SELECT count(*) FROM sync1_drop_column_heap_default6;
INSERT INTO sync1_drop_column_heap_default6 SELECT a,col034 , col035, col036 , col037, col039 , col040 from sync1_heap_drop;
SELECT count(*) FROM sync1_drop_column_heap_default6;
--
--
ALTER TABLE sync1_drop_column_heap_default6 DROP COLUMN col034;
INSERT INTO sync1_drop_column_heap_default6 VALUES (generate_series(1,10) , '(1,1)','((1,2),(2,3),(3,4),(4,3),(3,2),(2,1))', 111111, '23:00:00', '2001-12-13 01:51:15');
SELECT count(*) FROM sync1_drop_column_heap_default6;
INSERT INTO sync1_drop_column_heap_default6 SELECT a,col035, col036 , col037, col039 , col040 from sync1_heap_drop;
SELECT count(*) FROM sync1_drop_column_heap_default6;
--
--
ALTER TABLE sync1_drop_column_heap_default6 DROP COLUMN col035;
INSERT INTO sync1_drop_column_heap_default6 VALUES (generate_series(1,10) ,'((1,2),(2,3),(3,4),(4,3),(3,2),(2,1))', 111111, '23:00:00', '2001-12-13 01:51:15');
SELECT count(*) FROM sync1_drop_column_heap_default6;
INSERT INTO sync1_drop_column_heap_default6 SELECT a, col036 , col037, col039 , col040 from sync1_heap_drop;
SELECT count(*) FROM sync1_drop_column_heap_default6;
--
--
ALTER TABLE sync1_drop_column_heap_default6 DROP COLUMN col036;
INSERT INTO sync1_drop_column_heap_default6 VALUES (generate_series(1,10) , 111111,'23:00:00', '2001-12-13 01:51:15');
SELECT count(*) FROM sync1_drop_column_heap_default6;
INSERT INTO sync1_drop_column_heap_default6 SELECT a, col037, col039 , col040 from sync1_heap_drop;
SELECT count(*) FROM sync1_drop_column_heap_default6;
--
--
ALTER TABLE sync1_drop_column_heap_default6 DROP COLUMN col037;
INSERT INTO sync1_drop_column_heap_default6 VALUES (generate_series(1,10) , '23:00:00', '2001-12-13 01:51:15');
SELECT count(*) FROM sync1_drop_column_heap_default6;
INSERT INTO sync1_drop_column_heap_default6 SELECT a,col039 , col040 from sync1_heap_drop;
SELECT count(*) FROM sync1_drop_column_heap_default6;
--
--
ALTER TABLE sync1_drop_column_heap_default6 DROP COLUMN col039;
INSERT INTO sync1_drop_column_heap_default6 VALUES (generate_series(1,10) , '2001-12-13 01:51:15');
SELECT count(*) FROM sync1_drop_column_heap_default6;
INSERT INTO sync1_drop_column_heap_default6 SELECT a,col040 from sync1_heap_drop;
SELECT count(*) FROM sync1_drop_column_heap_default6;
--
--
ALTER TABLE sync1_drop_column_heap_default6 DROP COLUMN col040;
INSERT INTO sync1_drop_column_heap_default6 VALUES (generate_series(1,10) );
SELECT count(*) FROM sync1_drop_column_heap_default6;
INSERT INTO sync1_drop_column_heap_default6 SELECT a from sync1_heap_drop;
SELECT count(*) FROM sync1_drop_column_heap_default6;
| true |
c761068f7f12353b9b10d2a8acbf93e514a4d0d5 | SQL | bmcculley/nameapp | /db.sql | UTF-8 | 639 | 3.53125 | 4 | [] | no_license | SET SESSION storage_engine = "InnoDB";
SET SESSION time_zone = "+0:00";
ALTER DATABASE CHARACTER SET "utf8";
DROP TABLE IF EXISTS persons;
CREATE TABLE persons (
id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
author_id INT NOT NULL REFERENCES users(id),
firstname VARCHAR(100) NOT NULL,
lastname VARCHAR(100) NOT NULL,
dob DATE NOT NULL,
zip_code VARCHAR(50) NOT NULL
);
DROP TABLE IF EXISTS users;
CREATE TABLE users (
id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
email VARCHAR(100) NOT NULL UNIQUE,
name VARCHAR(100) NOT NULL,
hashed_password VARCHAR(100) NOT NULL,
access_level INT NOT NULL
);
| true |
36303373d128caa4b4eb7cd50e1cd5432bdaf28d | SQL | Jeromepullen/SQL-Projects | /Udemy SQL Course/selecting_data_using_like.sql | UTF-8 | 402 | 3.03125 | 3 | [] | no_license | USE coffee_store;
-- SELECT USING LIKE
/*
% any number of characters
_ a single character
*/
SELECT * FROM customers
WHERE last_name LIKE 'W%';
SELECT * FROM customers
WHERE first_name LIKE '_o_';
SELECT * FROM customers
WHERE first_name LIKE '_o%';
SELECT * FROM products
WHERE price LIKE '3%'; -- need to enclose in quotes when using LIKE even though a numeric column
| true |
c645bff94b2d360232dea164a719bb6f82e2134c | SQL | KarthikGangadhar/sql-design | /queries/create and load/gta_table.sql | UTF-8 | 318 | 2.6875 | 3 | [
"MIT"
] | permissive | CREATE TABLE `doctoraldb`.`gta` (
`SectionId` VARCHAR(45) NOT NULL,
`MonthlyPay` INT NOT NULL,
`StudentId` VARCHAR(45) NULL,
PRIMARY KEY (`SectionId`),
FOREIGN KEY (`SectionId`) REFERENCES `doctoraldb`.`section` (`SectionId`),
FOREIGN KEY (`StudentId`) REFERENCES `doctoraldb`.`phdstudent` (`StudentId`));
| true |
51a79553a26c3ac590e893ab2bb0e3e4bc54150c | SQL | radtek/abs3 | /sql/mmfo/bars/Function/f_op_kas.sql | UTF-8 | 1,708 | 3.03125 | 3 | [] | no_license |
PROMPT =====================================================================================
PROMPT *** Run *** ========== Scripts /Sql/BARS/function/f_op_kas.sql =========*** Run *** =
PROMPT =====================================================================================
CREATE OR REPLACE FUNCTION BARS.F_OP_KAS (ref_ in NUMBER,stmt_ in NUMBER)
return number is
kas number ;
kol number ;
begin
begin
kol:=0;
select count(*) into kol from opldok o,accounts a
where o.ref=ref_ and o.stmt=stmt_ and a.acc=o.acc(+)
and exists (select o.acc from opldok o,accounts a
where o.ref=ref_ and o.stmt=stmt_ and a.acc=o.acc(+)
and SUBSTR(a.nls,1,2)='10'
and SUBSTR(a.nls,1,4) not in ('1005','1007')
);
exception when NO_DATA_FOUND THEN kas:=1 ;
end ;
if kol<>0 then kas:=2; -- KAS
else kas:=1; -- NOT KAS
end if;
RETURN kas;
end f_op_kas;
/
show err;
PROMPT *** Create grants F_OP_KAS ***
grant EXECUTE on F_OP_KAS to ABS_ADMIN;
grant EXECUTE on F_OP_KAS to BARS_ACCESS_DEFROLE;
grant EXECUTE on F_OP_KAS to RPBN001;
grant EXECUTE on F_OP_KAS to WR_ALL_RIGHTS;
PROMPT =====================================================================================
PROMPT *** End *** ========== Scripts /Sql/BARS/function/f_op_kas.sql =========*** End *** =
PROMPT =====================================================================================
| true |
3f042ef9455ad9ce23be7c3353696233912725a2 | SQL | Marcalzotto/Proyecto_egdo | /egdo_db_script/bdd_integrada/egdo_db (2).sql | UTF-8 | 18,665 | 3.25 | 3 | [] | no_license | /*create database egdo_db;
use egdo_db;*/
-- phpMyAdmin SQL Dump
-- version 4.1.14
-- http://www.phpmyadmin.net
--
-- Servidor: 127.0.0.1
-- Tiempo de generación: 14-07-2016 a las 06:55:35
-- Versión del servidor: 5.6.16
-- Versión de PHP: 5.5.12
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
--
-- Base de datos: `egdo_db`
--
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `actividad`
--
CREATE TABLE IF NOT EXISTS `actividad` (
`id_actividad` int(11) NOT NULL AUTO_INCREMENT,
`nombre_actividad` varchar(45) DEFAULT NULL,
PRIMARY KEY (`id_actividad`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Volcado de datos para la tabla `actividad`
--
/*INSERT INTO `actividad` (`id_actividad`, `nombre_actividad`) VALUES
(1, 'info-viaje');*/
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `agenda`
--
CREATE TABLE IF NOT EXISTS `agenda` (
`id_agenda` int(11) NOT NULL AUTO_INCREMENT,
`nombre_evento` varchar(45) DEFAULT NULL,
`fecha_hora` datetime DEFAULT NULL,
`detalle` varchar(45) DEFAULT NULL,
`icono` tinyblob,
`color` varchar(45) DEFAULT NULL,
`id_usuario` int(11) DEFAULT NULL,
`id_actividad` int(11) DEFAULT NULL,
PRIMARY KEY (`id_agenda`),
KEY `id_usuario` (`id_usuario`),
KEY `id_actividad` (`id_actividad`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `calificacion`
--
CREATE TABLE IF NOT EXISTS `calificacion` (
`id_calificacion` int(11) NOT NULL AUTO_INCREMENT,
`id_usuario` int(11) DEFAULT NULL,
`id_empresa` int(11) DEFAULT NULL,
PRIMARY KEY (`id_calificacion`),
KEY `id_usuario` (`id_usuario`),
KEY `id_empresa` (`id_empresa`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `codigo_disenio`
--
CREATE TABLE IF NOT EXISTS `codigo_disenio` (
`id_codigo_disenio` int(11) NOT NULL AUTO_INCREMENT,
`descripcion` varchar(45) DEFAULT NULL,
PRIMARY KEY (`id_codigo_disenio`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `comentario`
--
CREATE TABLE IF NOT EXISTS `comentario` (
`id_comentario` int(11) NOT NULL AUTO_INCREMENT,
`comentario` varchar(45) DEFAULT NULL,
`fecha_hora` datetime DEFAULT NULL,
`id_usuario` int(11) DEFAULT NULL,
`id_actividad` int(11) DEFAULT NULL,
PRIMARY KEY (`id_comentario`),
KEY `id_usuario` (`id_usuario`),
KEY `id_actividad` (`id_actividad`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `curso`
--
CREATE TABLE IF NOT EXISTS `curso` (
`id_curso` int(11) NOT NULL AUTO_INCREMENT,
`nombre_escuela` varchar(45) DEFAULT NULL,
`localidad` varchar(70) DEFAULT NULL,
`curso_anio` int(3) DEFAULT NULL,
`curso_letra` varchar(3) DEFAULT NULL,
`cant_alumnos` int(11) DEFAULT NULL,
`fecha_creacion` datetime DEFAULT NULL,
PRIMARY KEY (`id_curso`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `disenio`
--
CREATE TABLE IF NOT EXISTS `disenio` (
`id_disenio` int(11) NOT NULL AUTO_INCREMENT,
`codigo_tipo` int(11) NOT NULL,
`disenio_frontal` mediumblob NOT NULL,
`ancho_frontal` smallint(3) NOT NULL,
`alto_frontal` smallint(3) NOT NULL,
`nombre_imagen` varchar(50) NOT NULL,
`tipo_frontal` varchar(20) NOT NULL,
`disenio_impresion` mediumblob NOT NULL,
`ancho_impresion` smallint(3) NOT NULL,
`alto_impresion` smallint(3) NOT NULL,
`nombre_impresion` varchar(50) NOT NULL,
`tipo_impresion` varchar(20) NOT NULL,
`id_usuario_subio` int(11) NOT NULL,
`id_votacion` int(11) NOT NULL,
`cantidad_votos` int(11) NOT NULL,
`votos_segunda_instancia` int(11) NOT NULL,
`votacion_pertenece` int(11) NOT NULL,
PRIMARY KEY (`id_disenio`),
KEY `codigo_tipo` (`codigo_tipo`),
KEY `votacion_pertenece` (`votacion_pertenece`),
KEY `id_votacion` (`id_votacion`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `empresa`
--
CREATE TABLE IF NOT EXISTS `empresa` (
`id_empresa` int(11) NOT NULL AUTO_INCREMENT,
`nombre_empresa` varchar(45) DEFAULT NULL,
`telefono` varchar(11) DEFAULT NULL,
`calle` varchar(45) DEFAULT NULL,
`altura` int(11) DEFAULT NULL,
`localidad` varchar(45) DEFAULT NULL,
`codigo_postal` int(11) DEFAULT NULL,
`partido` varchar(45) DEFAULT NULL,
`provincia` varchar(45) DEFAULT NULL,
`email` varchar(45) DEFAULT NULL,
`pagina_web` varchar(45) DEFAULT NULL,
`facebook` varchar(45) DEFAULT NULL,
`twitter` varchar(45) DEFAULT NULL,
`instagram` varchar(45) DEFAULT NULL,
`fecha_alta` date DEFAULT NULL,
`cuit` varchar(45) DEFAULT NULL,
PRIMARY KEY (`id_empresa`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `evento`
--
CREATE TABLE IF NOT EXISTS `evento` (
`id_evento` int(11) NOT NULL AUTO_INCREMENT,
`imagen1` mediumblob,
`imagen2` mediumblob,
`id_actividad` int(11) DEFAULT NULL,
`id_usuario` int(11) DEFAULT NULL,
PRIMARY KEY (`id_evento`),
KEY `id_actividad` (`id_actividad`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `fiesta`
--
CREATE TABLE IF NOT EXISTS `fiesta` (
`id_fiesta` int(11) NOT NULL AUTO_INCREMENT,
`nombre` varchar(45) DEFAULT NULL,
`calle` varchar(45) DEFAULT NULL,
`altura` int(11) DEFAULT NULL,
`telefono` varchar(11) DEFAULT NULL,
`facebook` varchar(100) DEFAULT NULL,
`twitter` varchar(100) DEFAULT NULL,
`instagram` varchar(100) DEFAULT NULL,
`pagina_web` varchar(45) DEFAULT NULL,
`datelles_adicionales` varchar(250) DEFAULT NULL,
`imagen1` mediumblob,
`imagen2` mediumblob,
`id_votacion` int(11) DEFAULT NULL,
`id_actividad` int(11) DEFAULT NULL,
`id_usuario_propuesta` int(11) DEFAULT NULL,
PRIMARY KEY (`id_fiesta`),
KEY `id_actividad` (`id_actividad`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `imagen`
--
CREATE TABLE IF NOT EXISTS `imagen` (
`id_imagen` int(11) NOT NULL AUTO_INCREMENT,
`nombre_imagen` varchar(45) DEFAULT NULL,
`tamanio` decimal(6,2) DEFAULT NULL,
`tipo` varchar(45) DEFAULT NULL,
`ancho` int(11) DEFAULT NULL,
`alto` int(11) DEFAULT NULL,
`imagen` mediumblob,
`portada` tinyint(1) DEFAULT NULL,
`id_curso` int(11) DEFAULT NULL,
`id_usuario` int(11) DEFAULT NULL,
`id_actividad` int(11) DEFAULT NULL,
PRIMARY KEY (`id_imagen`),
KEY `id_actividad` (`id_actividad`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `info_viaje`
--
CREATE TABLE IF NOT EXISTS `info_viaje` (
`id_info_viaje` int(11) NOT NULL AUTO_INCREMENT,
`nombre_lugar` varchar(45) DEFAULT NULL,
`imagen` mediumblob,
`descripcion` varchar(250) DEFAULT NULL,
`id_actividad` int(11) DEFAULT NULL,
PRIMARY KEY (`id_info_viaje`),
KEY `id_actividad` (`id_actividad`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `mensajes_privado`
--
CREATE TABLE IF NOT EXISTS `mensajes_privado` (
`id_mensaje` int(11) NOT NULL AUTO_INCREMENT,
`asunto` varchar(45) DEFAULT NULL,
`mensaje` varchar(45) DEFAULT NULL,
`fecha_hora` datetime DEFAULT NULL,
`id_emisor` int(11) DEFAULT NULL,
`id_receptor` int(11) DEFAULT NULL,
PRIMARY KEY (`id_mensaje`),
KEY `id_emisor` (`id_emisor`),
KEY `id_receptor` (`id_receptor`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `notificaciones`
--
CREATE TABLE IF NOT EXISTS `notificaciones` (
`id_notificacion` int(11) NOT NULL AUTO_INCREMENT,
`resumen` varchar(50) DEFAULT NULL,
`link` varchar(50) DEFAULT NULL,
PRIMARY KEY (`id_notificacion`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `rol`
--
CREATE TABLE IF NOT EXISTS `rol` (
`id_rol` int(11) NOT NULL DEFAULT '0',
`descripcion_rol` varchar(45) DEFAULT NULL,
PRIMARY KEY (`id_rol`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Volcado de datos para la tabla `rol`
--
/*INSERT INTO `rol` (`id_rol`, `descripcion_rol`) VALUES
(0, 'Administrador');*/
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `upd`
--
CREATE TABLE IF NOT EXISTS `upd` (
`id_upd` int(11) NOT NULL AUTO_INCREMENT,
`nombre_lugar` varchar(45) DEFAULT NULL,
`calle` varchar(45) DEFAULT NULL,
`altura` int(11) DEFAULT NULL,
`telefono` varchar(11) DEFAULT NULL,
`localidad` varchar(60) DEFAULT NULL,
`partido` varchar(60) DEFAULT NULL,
`provincia` varchar(45) DEFAULT NULL,
`pagina_web` varchar(45) DEFAULT NULL,
`facebook` varchar(100) DEFAULT NULL,
`twitter` varchar(100) DEFAULT NULL,
`instagram` varchar(100) DEFAULT NULL,
`datelles_adicionales` varchar(250) DEFAULT NULL,
`imagen1` mediumblob,
`imagen2` mediumblob,
`id_actividad` int(11) DEFAULT NULL,
`id_votacion` int(11) DEFAULT NULL,
`id_usuario_propuesta` int(11) DEFAULT NULL,
PRIMARY KEY (`id_upd`),
KEY `id_actividad` (`id_actividad`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `usuario`
--
CREATE TABLE IF NOT EXISTS `usuario` (
`id_usuario` int(11) NOT NULL AUTO_INCREMENT,
`nombre` varchar(45) DEFAULT NULL,
`apellido` varchar(45) DEFAULT NULL,
`email` varchar(45) DEFAULT NULL,
`contrasenia` varchar(256) DEFAULT NULL,
`fechaAltaUsuario` datetime NOT NULL,
`id_rol` int(11) DEFAULT NULL,
`id_curso` int(11) DEFAULT NULL,
`id_confirmacion` varchar(100) NOT NULL,
`estadoActivacion` tinyint(1) NOT NULL,
PRIMARY KEY (`id_usuario`),
UNIQUE KEY `id_usuario` (`id_usuario`),
KEY `id_curso` (`id_curso`),
KEY `id_rol` (`id_rol`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Volcado de datos para la tabla `usuario`
--
/*INSERT INTO `usuario` (`id_usuario`, `nombre`, `apellido`, `email`, `contrasenia`, `fechaAltaUsuario`, `id_rol`, `id_curso`, `id_confirmacion`, `estadoActivacion`) VALUES
(1, 'Romina', 'Giselle', 'rosse_velasco28@hotmail.com', 'rosse', '2016-07-07 00:00:00', 0, NULL, '', 1);
*/
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `usuario_has_actividad`
--
CREATE TABLE IF NOT EXISTS `usuario_has_actividad` (
`id_notificacion` int(11) NOT NULL,
`id_actividad` int(11) NOT NULL,
PRIMARY KEY (`id_notificacion`,`id_actividad`),
KEY `id_actividad` (`id_actividad`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `votacion`
--
CREATE TABLE IF NOT EXISTS `votacion` (
`id_votacion` int(11) NOT NULL AUTO_INCREMENT,
`fecha_apertura` datetime NOT NULL,
`vigente` tinyint(1) NOT NULL,
`tipo_actividad` int(11) NOT NULL,
`usuario_apertura` int(11) NOT NULL,
`curso_pertenece_votacion` int(11) NOT NULL,
`id_usuario` int(11) NOT NULL,
PRIMARY KEY (`id_votacion`),
KEY `id_usuario` (`id_usuario`),
KEY `usuario_apertura` (`usuario_apertura`),
KEY `curso_pertenece_votacion` (`curso_pertenece_votacion`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `votos`
--
CREATE TABLE IF NOT EXISTS `votos` (
`voto` int(11) NOT NULL AUTO_INCREMENT,
`id_usuario_voto` int(11) NOT NULL,
`disenio_votado` int(11) NOT NULL,
`tipo_disenio` int(11) NOT NULL,
`instancia_voto` int(11) NOT NULL,
`votacion_pertenece` int(11) NOT NULL,
PRIMARY KEY (`voto`),
KEY `id_usuario_voto` (`id_usuario_voto`),
KEY `disenio_votado` (`disenio_votado`),
KEY `tipo_disenio` (`tipo_disenio`),
KEY `votacion_pertenece` (`votacion_pertenece`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Restricciones para tablas volcadas
--
--
-- Filtros para la tabla `agenda`
--
ALTER TABLE `agenda`
ADD CONSTRAINT `agenda_ibfk_1` FOREIGN KEY (`id_usuario`) REFERENCES `usuario` (`id_usuario`),
ADD CONSTRAINT `agenda_ibfk_2` FOREIGN KEY (`id_actividad`) REFERENCES `actividad` (`id_actividad`),
ADD CONSTRAINT `agenda_ibfk_3` FOREIGN KEY (`id_usuario`) REFERENCES `usuario` (`id_usuario`),
ADD CONSTRAINT `agenda_ibfk_4` FOREIGN KEY (`id_actividad`) REFERENCES `actividad` (`id_actividad`),
ADD CONSTRAINT `agenda_ibfk_5` FOREIGN KEY (`id_usuario`) REFERENCES `usuario` (`id_usuario`),
ADD CONSTRAINT `agenda_ibfk_6` FOREIGN KEY (`id_actividad`) REFERENCES `actividad` (`id_actividad`);
--
-- Filtros para la tabla `calificacion`
--
ALTER TABLE `calificacion`
ADD CONSTRAINT `calificacion_ibfk_1` FOREIGN KEY (`id_usuario`) REFERENCES `usuario` (`id_usuario`),
ADD CONSTRAINT `calificacion_ibfk_2` FOREIGN KEY (`id_empresa`) REFERENCES `empresa` (`id_empresa`),
ADD CONSTRAINT `calificacion_ibfk_3` FOREIGN KEY (`id_usuario`) REFERENCES `usuario` (`id_usuario`),
ADD CONSTRAINT `calificacion_ibfk_4` FOREIGN KEY (`id_empresa`) REFERENCES `empresa` (`id_empresa`),
ADD CONSTRAINT `calificacion_ibfk_5` FOREIGN KEY (`id_usuario`) REFERENCES `usuario` (`id_usuario`),
ADD CONSTRAINT `calificacion_ibfk_6` FOREIGN KEY (`id_empresa`) REFERENCES `empresa` (`id_empresa`);
--
-- Filtros para la tabla `comentario`
--
ALTER TABLE `comentario`
ADD CONSTRAINT `comentario_ibfk_1` FOREIGN KEY (`id_usuario`) REFERENCES `usuario` (`id_usuario`),
ADD CONSTRAINT `comentario_ibfk_2` FOREIGN KEY (`id_actividad`) REFERENCES `actividad` (`id_actividad`),
ADD CONSTRAINT `comentario_ibfk_3` FOREIGN KEY (`id_usuario`) REFERENCES `usuario` (`id_usuario`),
ADD CONSTRAINT `comentario_ibfk_4` FOREIGN KEY (`id_actividad`) REFERENCES `actividad` (`id_actividad`),
ADD CONSTRAINT `comentario_ibfk_5` FOREIGN KEY (`id_usuario`) REFERENCES `usuario` (`id_usuario`),
ADD CONSTRAINT `comentario_ibfk_6` FOREIGN KEY (`id_actividad`) REFERENCES `actividad` (`id_actividad`);
--
-- Filtros para la tabla `disenio`
--
ALTER TABLE `disenio`
ADD CONSTRAINT `disenio_ibfk_1` FOREIGN KEY (`codigo_tipo`) REFERENCES `codigo_disenio` (`id_codigo_disenio`),
ADD CONSTRAINT `disenio_ibfk_2` FOREIGN KEY (`votacion_pertenece`) REFERENCES `votacion` (`id_votacion`),
ADD CONSTRAINT `disenio_ibfk_3` FOREIGN KEY (`id_votacion`) REFERENCES `votacion` (`id_votacion`);
--
-- Filtros para la tabla `evento`
--
ALTER TABLE `evento`
ADD CONSTRAINT `evento_ibfk_1` FOREIGN KEY (`id_actividad`) REFERENCES `actividad` (`id_actividad`),
ADD CONSTRAINT `evento_ibfk_2` FOREIGN KEY (`id_actividad`) REFERENCES `actividad` (`id_actividad`);
--
-- Filtros para la tabla `fiesta`
--
ALTER TABLE `fiesta`
ADD CONSTRAINT `fiesta_ibfk_1` FOREIGN KEY (`id_actividad`) REFERENCES `actividad` (`id_actividad`),
ADD CONSTRAINT `fiesta_ibfk_2` FOREIGN KEY (`id_actividad`) REFERENCES `actividad` (`id_actividad`);
--
-- Filtros para la tabla `imagen`
--
ALTER TABLE `imagen`
ADD CONSTRAINT `imagen_ibfk_1` FOREIGN KEY (`id_actividad`) REFERENCES `actividad` (`id_actividad`),
ADD CONSTRAINT `imagen_ibfk_2` FOREIGN KEY (`id_actividad`) REFERENCES `actividad` (`id_actividad`);
--
-- Filtros para la tabla `info_viaje`
--
ALTER TABLE `info_viaje`
ADD CONSTRAINT `info_viaje_ibfk_1` FOREIGN KEY (`id_actividad`) REFERENCES `actividad` (`id_actividad`),
ADD CONSTRAINT `info_viaje_ibfk_2` FOREIGN KEY (`id_actividad`) REFERENCES `actividad` (`id_actividad`);
--
-- Filtros para la tabla `mensajes_privado`
--
ALTER TABLE `mensajes_privado`
ADD CONSTRAINT `mensajes_privado_ibfk_1` FOREIGN KEY (`id_emisor`) REFERENCES `usuario` (`id_usuario`),
ADD CONSTRAINT `mensajes_privado_ibfk_2` FOREIGN KEY (`id_receptor`) REFERENCES `usuario` (`id_usuario`);
--
-- Filtros para la tabla `upd`
--
ALTER TABLE `upd`
ADD CONSTRAINT `upd_ibfk_1` FOREIGN KEY (`id_actividad`) REFERENCES `actividad` (`id_actividad`);
--
-- Filtros para la tabla `usuario`
--
ALTER TABLE `usuario`
ADD CONSTRAINT `usuario_ibfk_1` FOREIGN KEY (`id_curso`) REFERENCES `curso` (`id_curso`),
ADD CONSTRAINT `usuario_ibfk_2` FOREIGN KEY (`id_rol`) REFERENCES `rol` (`id_rol`);
--
-- Filtros para la tabla `usuario_has_actividad`
--
ALTER TABLE `usuario_has_actividad`
ADD CONSTRAINT `usuario_has_actividad_ibfk_1` FOREIGN KEY (`id_notificacion`) REFERENCES `notificaciones` (`id_notificacion`),
ADD CONSTRAINT `usuario_has_actividad_ibfk_2` FOREIGN KEY (`id_actividad`) REFERENCES `actividad` (`id_actividad`),
ADD CONSTRAINT `usuario_has_actividad_ibfk_3` FOREIGN KEY (`id_actividad`) REFERENCES `actividad` (`id_actividad`),
ADD CONSTRAINT `usuario_has_actividad_ibfk_4` FOREIGN KEY (`id_notificacion`) REFERENCES `notificaciones` (`id_notificacion`);
--
-- Filtros para la tabla `votacion`
--
ALTER TABLE `votacion`
ADD CONSTRAINT `votacion_ibfk_1` FOREIGN KEY (`id_usuario`) REFERENCES `usuario` (`id_usuario`),
ADD CONSTRAINT `votacion_ibfk_2` FOREIGN KEY (`usuario_apertura`) REFERENCES `usuario` (`id_usuario`),
ADD CONSTRAINT `votacion_ibfk_3` FOREIGN KEY (`curso_pertenece_votacion`) REFERENCES `curso` (`id_curso`);
--
-- Filtros para la tabla `votos`
--
ALTER TABLE `votos`
ADD CONSTRAINT `votos_ibfk_1` FOREIGN KEY (`id_usuario_voto`) REFERENCES `usuario` (`id_usuario`),
ADD CONSTRAINT `votos_ibfk_2` FOREIGN KEY (`disenio_votado`) REFERENCES `disenio` (`id_disenio`),
ADD CONSTRAINT `votos_ibfk_3` FOREIGN KEY (`tipo_disenio`) REFERENCES `disenio` (`codigo_tipo`),
ADD CONSTRAINT `votos_ibfk_4` FOREIGN KEY (`votacion_pertenece`) REFERENCES `votacion` (`id_votacion`);
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
select * from disenio;
select * from usuario;
delete from disenio where id_disenio = 11; | true |
07b8ab9dbb703c66489ddd64d39f4279c681f1a1 | SQL | Jcc20/BD | /MySQL/Procedures_Transactions/Transactions.sql | UTF-8 | 3,912 | 3.875 | 4 | [] | no_license | #Marcar um teste
DELIMITER $$
CREATE PROCEDURE marcarTeste (IN idA VARCHAR(45),IN med VARCHAR(45), IN dat DATETIME)
BEGIN
DECLARE test1 INT;
DECLARE test2 INT;
DECLARE test3 INT;
DECLARE test4 INT;
DECLARE pre DOUBLE;
DECLARE sucesso BOOL DEFAULT 0;
SET autocommit = 0;
SET pre = (SELECT RAND()*(50-10)+10);
SET test1 = (Select count(idAtleta) from Teste t where t.idAtleta= idA and t.flag='N' and t.data > now());
SET test2 = (Select count(idAtleta) from Atleta a where a.idAtleta= idA);
SET test3 = (Select count(idAtleta) from Multa m where m.idAtleta= idA and m.flag='N');
IF dat > now() then set test4 = 0;# verifica se é uma data futura
end if;
START TRANSACTION;
IF(test1=0 AND test2 = 1 AND test3=0 and test4 = 0) THEN
SET sucesso = 1;
INSERT INTO Teste
(idAtleta, medico, data, flag, preço)
VALUES (idA,med,dat,'N',pre);
END IF;
IF sucesso THEN
select('Teste marcado!')
COMMIT;
ELSE
select('Marcação inválida!')
ROLLBACK;
END IF;
END $$
set @idA = 8;
set @med = 'Dr.Marco';
set @dat = '2020-01-04';
CALL marcarTeste (@idA,@med,@dat);
Select * from teste where idATleta = 8;
DROP PROCEDURE marcarTeste;
#Marcar uma prova
DELIMITER $$
CREATE PROCEDURE adicionarProva (IN idM INT,IN idC INT,IN nomeP VARCHAR(45), IN dat DATETIME)
BEGIN
DECLARE test1 INT;
DECLARE test2 INT;
DECLARE test3 INT;
DECLARE sucesso BOOL DEFAULT 0;
SET autocommit = 0;
SET test1 = (Select count(idProva) from Prova p where p.nome= nomeP and p.data = dat and p.flag='N' and p.idModalidade = idM and p.idCategoria = idC and p.data > now());
SET test2 = (Select count(idCategoria) from Categoria c where c.idModalidade= idM and c.idCategoria = idC);
IF dat > now() then set test3 = 0;
end if;
START TRANSACTION;
IF(test1=0 AND test2 = 1 AND test3=0) THEN
SET sucesso = 1;
INSERT INTO Prova
(idModalidade, idCategoria, nome, flag, data, vencedor1, vencedor2, vencedor3)
VALUES
(idM, idC,nomeP,'N', dat, NULL, NULL, NULL);
END IF;
IF sucesso THEN
select('Prova marcado!')
COMMIT;
ELSE
select('Marcação inválida!')
ROLLBACK;
END IF;
END $$
set @idM = 1;
set @idC = 1;
set @nomeP = 'Corrida';
set @dat = '2020-01-04';
CALL adicionarProva (@idM , @idC,@nomeP,@dat);
DROP PROCEDURE adicionarProva;
#Adicionar um atleta
DELIMITER $$
CREATE PROCEDURE addAtleta (IN nomeA VARCHAR(45), IN dat DATETIME, IN gen CHAR(1),IN nac VARCHAR(45), IN mor VARCHAR(45), IN modl VARCHAR(45))
BEGIN
DECLARE test1 INT;
DECLARE test2 INT;
DECLARE test3 INT;
DECLARE mol int;
DECLARE sucesso BOOL DEFAULT 0;
SET autocommit = 0;
SET test1 = (Select count(idAtleta) from Atleta a where a.nome = nomeA and a.data_nascimento = dat);#ver se atleta existe
SET test2 = (Select count(idModalidade) from Modalidade c where c.designacao= modl and c.genero = gen);#ver se Modalidade existe
IF dat < now() then set test3 = 0;# verifica se é uma data passada
END IF;
START TRANSACTION;
IF(test1=0 AND test2 = 1 AND test3=0) THEN
SET sucesso = 1;
set mol = (select m.idModalidade from Modalidade m where m.designacao = modl and m.genero = gen);
INSERT INTO Atleta
(nome, data_nascimento, genero, nacionalidade, morada, idModalidade)
VALUES
(nomeA,dat,gen,nac,mor,mol);
END IF;
IF sucesso THEN
select('Atleta adicionado!')
COMMIT;
ELSE
select('Adição inválida!')
ROLLBACK;
END IF;
END $$
set @nomeA = 'Rui Torres';
set @dataN = '2010-06-30';
set @gen = 'M';
set @nac = 'Português';
set @loc = 'Barcelos';
set @modl = 'Velocidade';
CALL addAtleta (@nomeA,@dataN,@gen,@nac,@loc,@modl);
DROP PROCEDURE addAtleta; | true |
f098d5ade08e180ce2788f4f573abccc2f1b2013 | SQL | ganeshbabuNN/Databases | /RDMS/Oracle Database/Function_Using_IN_IS.sql | UTF-8 | 670 | 3.71875 | 4 | [] | no_license | desc employees;
select * from employees;
--getting the total salary of that deparmtent ID
create or replace function TotalDeptSalary
(varDepartmentID IN NUMBER)
return NUMBER IS
varTotalSalary NUMBER;
varBalance NUMBER;
begin
/* Defining SQL query to retrieve the current balance */
select sum(salary) into varTotalSalary from employees
where department_id=varDepartmentID
group by department_id;
/* return the balance */
return varTotalSalary;
end TotalDeptSalary;
/
---test the functions
select TotalDeptSalary(30) from dual;
--check the table
select department_id,sum(salary) from employees
where department_id=30
group by department_id;
| true |
94dfa15f211825fc1a65766b14d7c695541aa29d | SQL | mpassak/db | /ddl/01_TABLE/BM_MODALITY_CONSTRAINT.sql | UTF-8 | 875 | 2.9375 | 3 | [] | no_license | --------------------------------------------------------
-- Constraints for Table BM_MODALITY
--------------------------------------------------------
ALTER TABLE "METSM_OWNER"."BM_MODALITY" MODIFY ("DT_CREATED" NOT NULL ENABLE);
ALTER TABLE "METSM_OWNER"."BM_MODALITY" ADD CONSTRAINT "PK_BM_MODALITY" PRIMARY KEY ("ID_MODALITY")
USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
STORAGE(INITIAL 524288 NEXT 524288 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
TABLESPACE "METSM_OWNER_DATA" ENABLE;
ALTER TABLE "METSM_OWNER"."BM_MODALITY" MODIFY ("FACTOR" NOT NULL ENABLE);
ALTER TABLE "METSM_OWNER"."BM_MODALITY" MODIFY ("MODALITY_NAME" NOT NULL ENABLE);
ALTER TABLE "METSM_OWNER"."BM_MODALITY" MODIFY ("ID_MODALITY" NOT NULL ENABLE);
| true |
61da3c30dfbae361dab6a9d26004185f8ef9d547 | SQL | bellmit/iot-engine | /backup/core/scheduler/model/src/main/resources/ddl/01_edge_scheduler.sql | UTF-8 | 2,469 | 4.03125 | 4 | [] | no_license | CREATE SCHEMA IF NOT EXISTS PUBLIC;
CREATE TABLE IF NOT EXISTS JOB_ENTITY (
ID int GENERATED ALWAYS AS IDENTITY NOT NULL,
GROUP_NAME varchar(63) NOT NULL,
NAME varchar(63) NOT NULL,
JOB_TYPE varchar(15) NOT NULL,
FORWARD_IF_FAILURE boolean DEFAULT TRUE NOT NULL,
DETAIL_JSON clob(2147483647) NOT NULL,
TIME_AUDIT varchar(500) ,
SYNC_AUDIT clob(2147483647) ,
CONSTRAINT PK_JOB_ENTITY_ID PRIMARY KEY ( ID ),
CONSTRAINT IDX_UQ_JOB_ENTITY UNIQUE ( GROUP_NAME, NAME )
);
CREATE INDEX IDX_JOB_ENTITY_GROUP ON JOB_ENTITY ( GROUP_NAME );
CREATE INDEX IDX_JOB_ENTITY_TYPE ON JOB_ENTITY ( JOB_TYPE );
CREATE TABLE IF NOT EXISTS TRIGGER_ENTITY (
ID int GENERATED ALWAYS AS IDENTITY NOT NULL,
GROUP_NAME varchar(63) NOT NULL,
NAME varchar(63) NOT NULL,
TRIGGER_TYPE varchar(15) NOT NULL,
DETAIL_JSON clob(2147483647) NOT NULL,
TRIGGER_THREAD varchar(127) ,
TIME_AUDIT varchar(500) ,
SYNC_AUDIT clob(2147483647) ,
CONSTRAINT PK_TRIGGER_ENTITY_ID PRIMARY KEY ( ID ),
CONSTRAINT IDX_UQ_TRIGGER_ENTITY UNIQUE ( GROUP_NAME, NAME )
);
CREATE INDEX IDX_TRIGGER_ENTITY_GROUP ON TRIGGER_ENTITY ( GROUP_NAME );
CREATE INDEX IDX_TRIGGER_ENTITY_TYPE ON TRIGGER_ENTITY ( TRIGGER_TYPE );
CREATE INDEX IDX_TRIGGER_ENTITY_THREAD ON TRIGGER_ENTITY ( TRIGGER_THREAD );
COMMENT ON COLUMN TRIGGER_ENTITY.TRIGGER_THREAD IS 'Logical thread to group CRON trigger. It is not null if
TRIGGER_TYPE = CRON';
CREATE TABLE IF NOT EXISTS JOB_TRIGGER (
ID int GENERATED ALWAYS AS IDENTITY NOT NULL,
JOB_ID int NOT NULL,
TRIGGER_ID int NOT NULL,
ENABLED boolean DEFAULT TRUE NOT NULL,
TIME_AUDIT varchar(500) ,
SYNC_AUDIT clob(2147483647) ,
CONSTRAINT PK_JOB_TRIGGER_ID PRIMARY KEY ( ID ),
CONSTRAINT IDX_UQ_JOB_TRIGGER UNIQUE ( JOB_ID, TRIGGER_ID )
);
ALTER TABLE JOB_TRIGGER ADD CONSTRAINT FK_JOB_TRIGGER_JOB FOREIGN KEY ( JOB_ID ) REFERENCES JOB_ENTITY( ID ) ON DELETE RESTRICT ON UPDATE CASCADE;
ALTER TABLE JOB_TRIGGER ADD CONSTRAINT FK_JOB_TRIGGER_TRIGGER FOREIGN KEY ( TRIGGER_ID ) REFERENCES TRIGGER_ENTITY( ID ) ON DELETE RESTRICT ON UPDATE CASCADE;
CREATE INDEX IDX_JOB_TRIGGER_JOB ON JOB_TRIGGER ( JOB_ID );
CREATE INDEX IDX_JOB_TRIGGER_TRIGGER ON JOB_TRIGGER ( TRIGGER_ID );
| true |
80ea6ea1c6086af425441f5981856cacd412562c | SQL | weihongji/sql | /sqlserver/template/cte.sql | UTF-8 | 343 | 3.65625 | 4 | [] | no_license | WITH Sales_CTE (SalesPersonID, SalesOrderID, SalesYear)
AS (
SELECT SalesPersonID, SalesOrderID, YEAR(OrderDate) AS SalesYear
FROM Sales.SalesOrderHeader
WHERE SalesPersonID IS NOT NULL
)
SELECT SalesPersonID, COUNT(SalesOrderID) AS TotalSales, SalesYear
FROM Sales_CTE
GROUP BY SalesYear, SalesPersonID
ORDER BY SalesPersonID, SalesYear;
| true |
2a0f3f783821dcb1015752e127330dde30588c62 | SQL | ua-eas/kc-3.1.1-5.2.1-dbupgrade | /current/5.0/tables/KC_TBL_BUDGET_COLUMNS_TO_ALTER.sql | UTF-8 | 508 | 2.65625 | 3 | [] | no_license | CREATE TABLE BUDGET_COLUMNS_TO_ALTER(
LOOKUP_RETURN VARCHAR2(50),
COLUMN_NAME VARCHAR2(30),
COLUMN_LABEL VARCHAR2(30) NOT NULL,
DATA_TYPE VARCHAR2(9) NOT NULL,
DATA_LENGTH NUMBER(4,0),
HAS_LOOKUP CHAR(1) NOT NULL,
LOOKUP_ARGUMENT VARCHAR2(100),
UPDATE_TIMESTAMP DATE NOT NULL,
UPDATE_USER VARCHAR2(60) NOT NULL,
VER_NBR NUMBER(8,0) DEFAULT 1 NOT NULL,
OBJ_ID VARCHAR2(36) NOT NULL
)
/
ALTER TABLE BUDGET_COLUMNS_TO_ALTER ADD CONSTRAINT PK_BUDGET_COLUMNS_TO_ALTER
PRIMARY KEY (COLUMN_NAME)
/
| true |
c732282e95ad786fb24bbb6dd2c368db35350e2a | SQL | MrKassadin/HANA-SQL | /配方行情成本填写页面.sql | UTF-8 | 425 | 3.5 | 4 | [] | no_license | SET SCHEMA XN_FM;
SELECT "ItemCode" "Code","ItemName" "Name",IFNULL("U_ItemPrice",N'无') "Price"
FROM "OITM" T0
INNER JOIN "OITB" T1 ON T0."ItmsGrpCod"=T1."ItmsGrpCod"
LEFT JOIN "@U_ITMPRICE" T2 ON T0."ItemCode"=T2."Code"
WHERE T1."ItmsGrpNam" IN ('大宗原料','添加剂','半成品','包装物')
AND "ItemName" NOT LIKE '%WH%' AND "ItemName" NOT LIKE '%ZZ%'
AND "ItemName" LIKE '模糊搜索值'
ORDER BY T0."ItemCode";
| true |
1754a87fcd258406397c5eec0f0a61b3acd85cc9 | SQL | hpmsnell/measures | /measures/2020/mips/268/spec.cql | UTF-8 | 2,570 | 3.4375 | 3 | [] | no_license | library MIPS_268_2020 version '1'
/*
* Source: MIPS
* ID: 268
* Year: 2020
* Version: 1
* Author: Patrick Clark
*
*/
using QDM
// MIPS value sets
valueset "MIPS; MIPS 268 Encounter"
valueset "MIPS; Epilepsy"
valueset "MIPS; Performance Met: 4340F"
valueset "MIPS; Performance Not Met: 4340F-8P"
valueset "MIPS; Denominator Exclusion: M1016"
// VSAC value sets
valueset "VSAC; Absence of Cervix"
// Able value sets
valueset "Able; Post-Menopausal"
valueset "Able; Female Surgical Sterilization"
valueset "Able; Dyslexia"
valueset "Able; Genetic Neurodevelopmental Disorder"
valueset "Able; Encephalopathy"
parameter "Measurement Period" Interval<DateTime>
context Patient
define "Denominator Encounter":
["Encounter, Performed": "MIPS; MIPS 268 Encounter"] E
where E.relevantPeriod starts during "Measurement Period"
and AgeInYearsAt(start of E.relevantPeriod) >= 12
and not E.code.modifier in {'GQ','GT','95'}
and not E.placeOfService in {'02'}
and E.signingProvider.hasMeasureMembership = true
with ["Diagnosis": "MIPS; Epilepsy"] D
such that D.prevalencePeriod overlaps E.relevantPeriod
/* POPULATIONS */
define "Denominator":
"Patient Characteristic Sex" = 'Female'
and exists("Denominator Encounter")
define "Denominator Exclusion: M1016":
/*
* config_link_id: M1016
*/
exists(["Procedure, Performed": "MIPS; Denominator Exclusion: M1016"] P
where P.relevantPeriod starts during "Measurement Period")
or exists(["Diagnosis": "VSAC; Absence of Cervix"] D
where D.prevalencePeriod starts before end of "Measurement Period")
or exists(["Procedure, Performed": "VSAC; Absence of Cervix"] P
where P.relevantPeriod starts before end of "Measurement Period")
or exists(["Diagnosis": "Able; Post-Menopausal"] D
where D.prevalencePeriod starts before end of "Measurement Period")
or exists(["Procedure, Performed": "VSAC; Female Surgical Sterilization"] P
where P.relevantPeriod starts before end of "Measurement Period")
or exists(["Diagnosis": "Able; Female Surgical Sterilization"] D
where D.prevalencePeriod starts before end of "Measurement Period")
define "Numerator Performance Met: 4340F":
/*
* config_link_id: 4340F
*/
exists(["Procedure, Performed": "MIPS; Performance Met: 4340F"] P
where P.relevantPeriod starts during "Measurement Period"
and P.code.modifier = null)
define "Numerator Performance Not Met: 4340F-8P":
/*
* config_link_id: 4340F-8P
*/
not "Denominator Exclusion: M1016"
and not "Numerator Performance Met: 4340F"
| true |
520a0f5cac132f6b10195a72622b1039997148e7 | SQL | Alvearie/cql_engine | /engine/src/test/resources/org/opencds/cqf/cql/engine/execution/ElmTests/Regression/qdm/ColorectalCancerScreening-8.4.000.cql | UTF-8 | 4,118 | 2.875 | 3 | [
"Apache-2.0"
] | permissive | library ColorectalCancerScreening version '8.4.000'
using QDM version '5.4'
include Adult_Outpatient_Encounters version '1.2.000' called AdultOutpatientEncounters
include MATGlobalCommonFunctions version '4.0.000' called Global
include Hospice version '2.0.000' called Hospice
include AdvancedIllnessandFrailtyExclusionECQM version '4.0.000' called FrailtyLTI
codesystem "LOINC": 'urn:oid:2.16.840.1.113883.6.1'
valueset "Colonoscopy": 'urn:oid:2.16.840.1.113883.3.464.1003.108.12.1020'
valueset "CT Colonography": 'urn:oid:2.16.840.1.113883.3.464.1003.108.12.1038'
valueset "Ethnicity": 'urn:oid:2.16.840.1.114222.4.11.837'
valueset "Fecal Occult Blood Test (FOBT)": 'urn:oid:2.16.840.1.113883.3.464.1003.198.12.1011'
valueset "FIT DNA": 'urn:oid:2.16.840.1.113883.3.464.1003.108.12.1039'
valueset "Flexible Sigmoidoscopy": 'urn:oid:2.16.840.1.113883.3.464.1003.198.12.1010'
valueset "Malignant Neoplasm of Colon": 'urn:oid:2.16.840.1.113883.3.464.1003.108.12.1001'
valueset "ONC Administrative Sex": 'urn:oid:2.16.840.1.113762.1.4.1'
valueset "Payer": 'urn:oid:2.16.840.1.114222.4.11.3591'
valueset "Race": 'urn:oid:2.16.840.1.114222.4.11.836'
valueset "Total Colectomy": 'urn:oid:2.16.840.1.113883.3.464.1003.198.12.1019'
code "Birth date": '21112-8' from "LOINC" display 'Birth date'
parameter "Measurement Period" Interval<DateTime>
context Patient
define "SDE Ethnicity":
["Patient Characteristic Ethnicity": "Ethnicity"]
define "SDE Payer":
["Patient Characteristic Payer": "Payer"]
define "SDE Race":
["Patient Characteristic Race": "Race"]
define "SDE Sex":
["Patient Characteristic Sex": "ONC Administrative Sex"]
define "Denominator":
"Initial Population"
define "Flexible Sigmoidoscopy Performed":
["Procedure, Performed": "Flexible Sigmoidoscopy"] FlexibleSigmoidoscopy
where FlexibleSigmoidoscopy.relevantPeriod ends 5 years or less on or before
end of "Measurement Period"
define "Total Colectomy Performed":
["Procedure, Performed": "Total Colectomy"] Colectomy
where Colectomy.relevantPeriod starts on or before
end of "Measurement Period"
define "Malignant Neoplasm":
["Diagnosis": "Malignant Neoplasm of Colon"] ColorectalCancer
where ColorectalCancer.prevalencePeriod starts on or before
end of "Measurement Period"
define "Fecal Occult Blood Test Performed":
["Laboratory Test, Performed": "Fecal Occult Blood Test (FOBT)"] FecalOccultResult
where FecalOccultResult.result is not null
and FecalOccultResult.authorDatetime during "Measurement Period"
define "Colonoscopy Performed":
["Procedure, Performed": "Colonoscopy"] Colonoscopy
where Colonoscopy.relevantPeriod ends 10 years or less on or before
end of "Measurement Period"
define "Numerator":
exists "Colonoscopy Performed"
or exists "Fecal Occult Blood Test Performed"
or exists "Flexible Sigmoidoscopy Performed"
or exists "Fecal Immunochemical Test DNA Performed"
or exists "CT Colonography Performed"
define "Fecal Immunochemical Test DNA Performed":
["Laboratory Test, Performed": "FIT DNA"] FitDNA
where FitDNA.result is not null
and FitDNA.authorDatetime occurs 3 years or less on or before
end of "Measurement Period"
define "CT Colonography Performed":
["Diagnostic Study, Performed": "CT Colonography"] Colonography
where Colonography.relevantPeriod ends 5 years or less on or before
end of "Measurement Period"
define "Initial Population":
exists ["Patient Characteristic Birthdate": "Birth date"] BirthDate
where Global."CalendarAgeInYearsAt"(BirthDate.birthDatetime, start of "Measurement Period")in Interval[50, 75 )
and exists AdultOutpatientEncounters."Qualifying Encounters"
define "Denominator Exclusions":
Hospice."Has Hospice"
or exists "Malignant Neoplasm"
or exists "Total Colectomy Performed"
or FrailtyLTI."Advanced Illness and Frailty Exclusion Including Under Age 80"
or ( exists ["Patient Characteristic Birthdate": "Birth date"] BirthDate
where ( Global."CalendarAgeInYearsAt"(BirthDate.birthDatetime, start of "Measurement Period")>= 65 )
and FrailtyLTI."Has Spent More Than 90 Days in Long Term Care"
) | true |
0d6236c7fcb7e2609f9234b5734faf812fb9f02c | SQL | MaiKoDInW/Bus_RBRU | /api/busrbru.sql | UTF-8 | 3,588 | 3.078125 | 3 | [] | no_license | -- phpMyAdmin SQL Dump
-- version 5.1.1
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Sep 05, 2021 at 10:44 PM
-- Server version: 10.4.20-MariaDB
-- PHP Version: 8.0.9
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Database: `busrbru`
--
-- --------------------------------------------------------
--
-- Table structure for table `addaddress`
--
CREATE TABLE `addaddress` (
`id` int(11) NOT NULL,
`idStudent` text COLLATE utf8_unicode_ci NOT NULL,
`nameStudent` text COLLATE utf8_unicode_ci NOT NULL,
`name` text COLLATE utf8_unicode_ci NOT NULL,
`faculty` text COLLATE utf8_unicode_ci NOT NULL,
`time` text COLLATE utf8_unicode_ci NOT NULL,
`building` text COLLATE utf8_unicode_ci NOT NULL,
`images` text COLLATE utf8_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `address`
--
CREATE TABLE `address` (
`id` int(11) NOT NULL,
`idUser` text COLLATE utf8_unicode_ci NOT NULL,
`nameStudent` text COLLATE utf8_unicode_ci NOT NULL,
`name` text COLLATE utf8_unicode_ci NOT NULL,
`faculty` text COLLATE utf8_unicode_ci NOT NULL,
`time` text COLLATE utf8_unicode_ci NOT NULL,
`building` text COLLATE utf8_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `user`
--
CREATE TABLE `user` (
`id` int(11) NOT NULL,
`name` text COLLATE utf8_unicode_ci NOT NULL,
`type` text COLLATE utf8_unicode_ci NOT NULL,
`address` text COLLATE utf8_unicode_ci NOT NULL,
`phone` text COLLATE utf8_unicode_ci NOT NULL,
`user` text COLLATE utf8_unicode_ci NOT NULL,
`password` text COLLATE utf8_unicode_ci NOT NULL,
`avatar` text COLLATE utf8_unicode_ci NOT NULL,
`lat` text COLLATE utf8_unicode_ci NOT NULL,
`lng` text COLLATE utf8_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Dumping data for table `user`
--
INSERT INTO `user` (`id`, `name`, `type`, `address`, `phone`, `user`, `password`, `avatar`, `lat`, `lng`) VALUES
(1, 'User', 'Student', '123 at home', '0901314652', 'mai12', '1234', '', '12.6631167', '102.1050667'),
(2, 'drive', 'Driver', '456 at home', '123456', 'rider', '1234', '/busrbru/avatar/avatar1820.jpg', '12.6631167', '102.1050667');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `addaddress`
--
ALTER TABLE `addaddress`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `address`
--
ALTER TABLE `address`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `user`
--
ALTER TABLE `user`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `addaddress`
--
ALTER TABLE `addaddress`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `address`
--
ALTER TABLE `address`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `user`
--
ALTER TABLE `user`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
| true |
1cdc804d5a7e41e88431ce6bdf73da8bf1eec587 | SQL | ShubhamKhandelwal7/MySql | /Exercise-transaction.sql | UTF-8 | 1,409 | 4.09375 | 4 | [] | no_license |
CREATE TABLE users
(
ID INTEGER ,
Name VARCHAR(20),
Email VARCHAR(20),
Account_no INTEGER UNIQUE,
PRIMARY KEY (ID,Account_no)
);
CREATE TABLE accounts
(
ID INTEGER PRIMARY KEY,
Account_no INTEGER,
Balance INTEGER,
FOREIGN KEY (Account_no) REFERENCES users(Account_no)
);
INSERT INTO users
VALUES (1,"userA","userA@gmail.com",15001),
(2,"userB","userB@gmail.com",15002),
(3,"userC","userC@gmail.com",15003),
(4,"userD","userD@gmail.com",15004),
(5,"userE","userE@gmail.com",15005),
(6,"userF","userF@gmail.com",15006),
(7,"userG","userG@gmail.com",15007);
INSERT INTO accounts
VALUES (1,15001,2500),
(2,15002,150),
(3,15003,5000),
(4,15004,700),
(5,15005,9990),
(6,15006,100),
(7,15007,66000);
START TRANSACTION;
SET @deposit_amount=1000;
UPDATE accounts
JOIN users ON accounts.Account_no=users.Account_no
SET accounts.balance = accounts.balance+@deposit_amount
WHERE users.name='userA';
COMMIT;
START TRANSACTION;
SET @withdrawl_amount=500;
UPDATE accounts
JOIN users ON accounts.Account_no=users.Account_no
SET accounts.balance = accounts.balance-@withdrawl_amount
WHERE users.name='userA';
COMMIT;
START TRANSACTION;
SET @transfer_amount=200;
UPDATE accounts
JOIN users ON accounts.Account_no=users.Account_no
SET accounts.balance = accounts.balance-@transfer_amount
WHERE users.name='userA';
UPDATE accounts
JOIN users ON accounts.Account_no=users.Account_no
SET accounts.balance = accounts.balance+@transfer_amount
WHERE users.name='userB';
COMMIT;
| true |
bf22c77a84504c748ab653b7ed67efa1cef13b31 | SQL | witnesslq/SiChuan | /scrcu/src/main/resources/init.sql | UTF-8 | 4,981 | 3.265625 | 3 | [] | no_license | # Host: localhost (Version: 5.5.40)
# Date: 2015-09-02 10:58:18
# Generator: MySQL-Front 5.3 (Build 4.120)
/*!40101 SET NAMES utf8 */;
#
# Structure for table "custom"
#
DROP TABLE IF EXISTS `custom`;
CREATE TABLE `custom` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(255) NOT NULL DEFAULT '',
`url` varchar(255) DEFAULT NULL,
`desc` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8 COMMENT='自定义报表';
#
# Data for table "custom"
#
INSERT INTO `custom` VALUES (1,'用户分析','sss2','这个是用户新增分析的柱状图'),(3,'网站分析','网站分析','这个是页面的网站分析'),(4,'用户分析','用户分析','用户分析'),(5,'用户分析','用户分析','用户分析'),(7,'厦航自定义报表','http://10.129.34.145:8080/?proc=1&action=viewer&hback=true&db=^6cd5^^9662^^2f^^884c^^4e1a^^5f8b^^6240^^6392^^540d^.db&browserType=Chrome','测试');
#
# Structure for table "permissions"
#
DROP TABLE IF EXISTS `permissions`;
CREATE TABLE `permissions` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`parent_id` int(11) NOT NULL DEFAULT '0',
`name` varchar(45) NOT NULL DEFAULT '',
`permission` varchar(45) NOT NULL,
`description` varchar(255) DEFAULT NULL,
`create_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8;
#
# Data for table "permissions"
#
INSERT INTO `permissions` VALUES (1,5,'用户编辑','editUser',NULL,'2014-02-26 17:50:14'),(2,5,'用户展示','showUser',NULL,'2014-02-26 17:50:26'),(3,5,'添加用户','addUser',NULL,'2014-02-26 17:50:37'),(4,5,'删除用户','deleteUser',NULL,'2014-02-26 17:51:11'),(6,0,'系统管理','#this','系统管理','2015-08-05 10:48:38'),(7,6,'用户管理','users','用户管理','2015-08-05 10:49:13'),(8,6,'角色管理','role','角色管理','2015-08-05 10:49:44'),(9,6,'资源管理','permissions','资源管理','2015-08-05 10:50:09'),(10,9,'资源新增','permissions.add','资源新增','2015-08-05 10:52:36');
#
# Structure for table "roles"
#
DROP TABLE IF EXISTS `roles`;
CREATE TABLE `roles` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`role_name` varchar(45) NOT NULL,
`description` varchar(255) DEFAULT NULL,
`status` tinyint(3) NOT NULL DEFAULT '0' COMMENT '0激活 1注销',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8;
#
# Data for table "roles"
#
INSERT INTO `roles` VALUES (1,'admin','系统管理员',0),(2,'普通用户','普通用户',0),(3,'Test','test',1);
#
# Structure for table "roles_permissions"
#
DROP TABLE IF EXISTS `roles_permissions`;
CREATE TABLE `roles_permissions` (
`role_id` int(11) NOT NULL,
`permission_id` int(11) NOT NULL,
`create_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`role_id`,`permission_id`),
KEY `rolse_permissions_permissions_id_fk_idx` (`permission_id`),
CONSTRAINT `rolse_permissions_permissions_id_fk` FOREIGN KEY (`permission_id`) REFERENCES `permissions` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT `rolse_permissions_roles_id_fk` FOREIGN KEY (`role_id`) REFERENCES `roles` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
#
# Data for table "roles_permissions"
#
INSERT INTO `roles_permissions` VALUES (1,6,'2015-08-05 16:08:13'),(1,7,'2015-08-05 16:08:13'),(1,8,'2015-08-05 16:08:13'),(3,6,'2015-08-05 15:40:59'),(3,7,'2015-08-05 15:40:59'),(3,8,'2015-08-05 15:40:59'),(3,9,'2015-08-05 15:40:59');
#
# Structure for table "users"
#
DROP TABLE IF EXISTS `users`;
CREATE TABLE `users` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`username` varchar(255) NOT NULL,
`password` varchar(255) DEFAULT NULL,
`status` tinyint(3) NOT NULL DEFAULT '0' COMMENT '0激活 1注销',
`create_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`,`username`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8;
#
# Data for table "users"
#
INSERT INTO `users` VALUES (1,'xiaoming','xiaoming',1,'2014-02-26 17:44:21'),(2,'xiaoming','xiaohong',1,'2014-02-26 17:44:45'),(3,'xiaohuang','xiaohuang',1,'2014-02-26 23:31:20'),(4,'admin','admin',0,'2015-08-05 17:20:38');
#
# Structure for table "user_roles"
#
DROP TABLE IF EXISTS `user_roles`;
CREATE TABLE `user_roles` (
`user_id` int(11) NOT NULL,
`role_id` int(11) NOT NULL,
`create_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`user_id`,`role_id`),
KEY `user_roles_roles_id_fk_idx` (`role_id`),
CONSTRAINT `user_roles_roles_id_fk` FOREIGN KEY (`role_id`) REFERENCES `roles` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT `user_roles_user_id_fk` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
#
# Data for table "user_roles"
#
INSERT INTO `user_roles` VALUES (1,1,'2014-02-26 17:51:56'),(2,2,'2014-02-26 17:52:00'),(3,1,'2014-02-26 23:34:06'),(4,1,'2015-08-05 17:21:12');
| true |
793c75b63842bf5b608e53b84860aedc3b590883 | SQL | AnshGaikwad/Hyper-Secure-Vault-Backend | /vault_db.sql | UTF-8 | 1,169 | 3.84375 | 4 | [
"MIT"
] | permissive | -- Initialize the postgreSQL database template (using spring boot JDBC)
drop database vaultdb;
drop user vault;
create user vault with password 'password';
create database vaultdb with template=template0 owner=vault;
\connect vaultdb;
alter default privileges grant all on tables to vault;
alter default privileges grant all on sequences to vault;
create table users(
user_id integer primary key not null,
first_name varchar(20) not null,
last_name varchar(20) not null,
email varchar(30) not null,
password text not null
);
create table data(
data_id integer primary key not null,
user_id integer not null,
title varchar(20) not null,
message varchar(50) not null,
type varchar(20) not null
);
alter table data add constraint data_users_fk
foreign key (user_id) references users(user_id);
create sequence users_seq increment 1 start 1;
create sequence data_seq increment 1 start 1;
| true |
303973f98dd8944ab29f871e3af142f18788896b | SQL | navnathsatre/SQL | /stproc_classwork.sql | UTF-8 | 3,403 | 3.890625 | 4 | [] | no_license | CREATE DEFINER=`root`@`localhost` PROCEDURE `myproc`(aid integer)
BEGIN
if aid is null then
select "Null not allowed" as message;
elseif aid > 10 then
select "Invalid Author" as message;
else
select "Selecting author details" as message;
select authorid, name from authors where authorid = aid;
end if;
select "Outside If" as status;
END
-- LOOPS
-- a. Simple Loop
CREATE DEFINER=`root`@`localhost` PROCEDURE `proc_simpleloop`(num integer)
BEGIN
declare cnt integer default 0;
myloop:LOOP
set cnt = cnt + 1;
select concat("Hello ", cnt);
-- Termination condition
if cnt = num then
leave myloop;
end if;
END LOOP myloop;
select "Outside loop" as message;
END
--- b. Repeat Until Loop
CREATE DEFINER=`root`@`localhost` PROCEDURE `proc_repeat`(num integer)
BEGIN
declare cnt integer default 0;
myloop:REPEAT
set cnt = cnt + 1;
select concat("Hello Repeat ", cnt) as message;
-- Termination Condition
until cnt = num
END REPEAT myloop;
select "Outside loop" as message;
END
-- c. While Do Loop
CREATE DEFINER=`root`@`localhost` PROCEDURE `proc_while`(num integer)
BEGIN
declare cnt integer default 0;
-- Continuation condition
myloop:WHILE cnt < num DO
set cnt = cnt + 1;
if cnt = 3 then
iterate myloop;
end if;
select concat("Hello While ", cnt) as message;
END WHILE myloop;
select "Outside loop" as message;
END
-- Exception Handling
CREATE DEFINER=`root`@`localhost` PROCEDURE `make_payment`(cid integer, amt integer)
BEGIN
DECLARE AmountNull CONDITION FOR 1048;
declare exit handler for AmountNull
BEGIN
insert into fraud (client_id, message, tot)
values (cid, 'Fraudulent Transaction', now());
END;
insert into payments values(cid,amt);
select "Transaction Completed" as Message;
END
-- Cursor
CREATE DEFINER=`root`@`localhost` PROCEDURE `proc_cursor`()
BEGIN
declare lcl_pcode varchar(15);
declare lcl_pvendor varchar(50);
declare lcl_qty, finished integer default 0;
declare prod_cur cursor for
select pcode, pvendor, qtyinstock from products;
declare continue handler for NOT FOUND
BEGIN
set finished = 1;
END;
open prod_cur;
prodloop:LOOP
fetch prod_cur into lcl_pcode, lcl_pvendor, lcl_qty;
if finished = 1 then
leave prodloop;
end if;
if lcl_qty < 2000 then
insert into orders (product_code, vendor,status)
values(lcl_pcode, lcl_pvendor, 'Immediate');
elseif lcl_qty between 2000 and 5000 then
insert into orders (product_code, vendor,status)
values(lcl_pcode, lcl_pvendor, 'Order Soon');
end if ;
END LOOP prodloop;
close prod_cur;
select "Process Completed" as Message;
END
-- Function
CREATE DEFINER=`root`@`localhost` FUNCTION `experience`(eid integer) RETURNS int(11)
BEGIN
declare exp integer default 0;
select year(now())- year(hire_date) into exp
from myemp where emp_id = eid;
RETURN exp;
END
-- Trigger
CREATE DEFINER=`root`@`localhost` TRIGGER `bk_trg`
AFTER UPDATE ON `books`
FOR EACH ROW
BEGIN
declare qty integer default 0;
set qty = new.sales - old.sales;
insert into book_sales (bookid, title, qty_sold, tos)
values (old.bookid, old.title,qty, now());
END
| true |
88b83a2c5e36a8f9b14dcf4e519fd659a2c9e425 | SQL | roxas8210/table-api | /list.sql | UTF-8 | 1,826 | 3.046875 | 3 | [
"Apache-2.0"
] | permissive | -- phpMyAdmin SQL Dump
-- version phpStudy 2014
-- http://www.phpmyadmin.net
--
-- 主机: localhost
-- 生成日期: 2017 年 07 月 11 日 18:03
-- 服务器版本: 5.5.53
-- PHP 版本: 5.4.45
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
--
-- 数据库: `table`
--
-- --------------------------------------------------------
--
-- 表的结构 `list`
--
CREATE TABLE IF NOT EXISTS `list` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`companyName` varchar(255) DEFAULT NULL,
`lang` varchar(255) DEFAULT NULL,
`wap` tinyint(1) NOT NULL,
`designBy` varchar(255) DEFAULT NULL,
`price` int(11) NOT NULL,
`program` tinyint(1) NOT NULL,
`info` tinyint(1) NOT NULL,
`uploadtest` tinyint(1) NOT NULL,
`testaddress` varchar(255) DEFAULT NULL,
`upload` tinyint(1) NOT NULL,
`webaddress` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=5 ;
--
-- 转存表中的数据 `list`
--
INSERT INTO `list` (`id`, `companyName`, `lang`, `wap`, `designBy`, `price`, `program`, `info`, `uploadtest`, `testaddress`, `upload`, `webaddress`) VALUES
(1, ' 冈州陈', '中文、繁体', 1, ' 燃', 15800, 1, 1, 1, ' ', 0, ' '),
(2, '东阳', '中文', 1, '燃', 8000, 1, 1, 1, NULL, 1, NULL),
(3, '四眼烈', '中文', 0, '燃', 10800, 1, 1, 1, NULL, 1, NULL),
(4, '博伟', '中文', 0, '欣', 5800, 1, 1, 1, NULL, 1, NULL);
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
| true |
3531c2f9d6eb714bd3281ec9c0bf5b15cb590580 | SQL | charlverster/mock_twitter_feed | /mysql_docker/sql-scripts/CreateTable.sql | UTF-8 | 671 | 3.828125 | 4 | [
"MIT"
] | permissive | -- Create the users table
CREATE TABLE users
(
username VARCHAR(30) PRIMARY KEY
-- Use user name as primary key.
-- Assuming all user names are unique
-- Assuming names are no longer than 30 characters
);
-- Create the follows table
CREATE TABLE follows
(
username VARCHAR(30) NOT NULL REFERENCES users(username), -- User name
follows_user VARCHAR(30) NOT NULL REFERENCES users(username), -- Name of friend they follow
PRIMARY KEY (username, follows_user)
);
-- Create the posts table
CREATE TABLE posts
(
post_id INT AUTO_INCREMENT PRIMARY KEY,
username VARCHAR(30) NOT NULL REFERENCES users(username),
post VARCHAR(140)
) ; | true |
24a957d0de519297bef578237d98a00f56ff8416 | SQL | ManuelLoaizaVasquez/inf246-bases-de-datos-pucp | /problemas/string-processing-functions/PatientsWithACondition.sql | UTF-8 | 185 | 3.0625 | 3 | [] | no_license | -- https://leetcode.com/problems/patients-with-a-condition/
SELECT
*
FROM
patients
WHERE
conditions LIKE 'DIAB1%' OR conditions LIKE '% DIAB1%'
ORDER BY
1 ASC;
| true |
795e7aac3e316928205b90dbcd0e0af573496e8e | SQL | alanzhong/predictit-explorer | /src/backend/postgres/sql/update_hourly_aggregation.sql | UTF-8 | 725 | 3.4375 | 3 | [] | no_license | /**
* update hourly aggregation
*/
insert into observation_hour select
contract_id,
avg(buy_yes) as buy_yes,
avg(buy_no) as buy_no,
avg(sell_yes) as sell_yes,
avg(sell_no) as sell_no,
avg(last_close) as last_close,
avg(last_trade) as last_trade,
date_trunc('hour', date) as hour
from observation
where date >= date_trunc('hour', now() - interval '5 hours')
group by contract_id, hour
order by contract_id, hour
on conflict(contract_id, hour) do
update set
buy_yes = excluded.buy_yes,
buy_no = excluded.buy_no,
sell_yes = excluded.sell_yes,
sell_no = excluded.sell_no,
last_close = excluded.last_close,
last_trade = excluded.last_trade; | true |
c504b675f998daf7efe129f3fd96830330e117b8 | SQL | ebzeal/store-manager | /api/models/db.sql | UTF-8 | 3,762 | 3.609375 | 4 | [] | no_license | DROP TABLE IF EXISTS users, usersProfile, categories, products, sales, incidents, notifications, feedback;
CREATE TABLE IF NOT EXISTS
users(
id SERIAL PRIMARY KEY,
userName VARCHAR(128),
userEmail VARCHAR(128),
userPriviledge VARCHAR(128),
password VARCHAR(128),
dateCreated DATE NOT NULL DEFAULT CURRENT_DATE,
dateModified DATE NOT NULL DEFAULT CURRENT_DATE
);
CREATE TABLE IF NOT EXISTS
usersProfile(
id SERIAL PRIMARY KEY,
users_id INTEGER REFERENCES users(id) ON DELETE CASCADE,
userAddress VARCHAR(128),
userPhone VARCHAR(128),
dateCreated DATE NOT NULL DEFAULT CURRENT_DATE,
dateModified DATE NOT NULL DEFAULT CURRENT_DATE
);
CREATE TABLE IF NOT EXISTS
categories(
id SERIAL PRIMARY KEY,
categoryName VARCHAR(128),
categoryDetails VARCHAR(225),
timeAdded DATE NOT NULL DEFAULT CURRENT_DATE
);
CREATE TABLE IF NOT EXISTS
products(
id SERIAL PRIMARY KEY,
categories_id INTEGER REFERENCES categories(id) ON DELETE CASCADE,
productName VARCHAR(128),
productImage VARCHAR(225),
productDetails VARCHAR(128),
productSpec VARCHAR(128),
productPrice NUMERIC(10,2) DEFAULT 0,
productQuantity INTEGER,
productLimit INTEGER,
dateAdded DATE NOT NULL DEFAULT CURRENT_DATE,
dateModified DATE NOT NULL DEFAULT CURRENT_DATE
);
CREATE TABLE IF NOT EXISTS
sales(
id SERIAL PRIMARY KEY,
invoice_num INTEGER,
products_id INTEGER NOT NULL REFERENCES products(id) ON DELETE CASCADE,
users_id INTEGER NOT NULL REFERENCES users(id) ON DELETE CASCADE,
quantity INTEGER,
amount NUMERIC(10,2),
totalAmount NUMERIC(10,2),
salesTime DATE NOT NULL DEFAULT CURRENT_DATE,
salesDate DATE NOT NULL DEFAULT CURRENT_DATE
);
CREATE TABLE IF NOT EXISTS
incidents(
id SERIAL PRIMARY KEY,
users_id INTEGER NOT NULL REFERENCES users(id) ON DELETE CASCADE,
incidentTime VARCHAR(128),
incidentImage VARCHAR(128),
incidentDetails VARCHAR(328),
timeAdded DATE NOT NULL DEFAULT CURRENT_DATE
);
CREATE TABLE IF NOT EXISTS
notifications(
id SERIAL PRIMARY KEY,
notifications VARCHAR(128),
timeAdded DATE NOT NULL DEFAULT CURRENT_DATE
);
CREATE TABLE IF NOT EXISTS
feedback(
id SERIAL PRIMARY KEY,
users_id INTEGER NOT NULL REFERENCES users(id) ON DELETE CASCADE,
products_id INTEGER NOT NULL REFERENCES products(id) ON DELETE CASCADE,
title VARCHAR(128),
details VARCHAR(128),
timeAdded DATE NOT NULL DEFAULT CURRENT_DATE
);
INSERT INTO users (userName, userEmail, userPriviledge,password)VALUES('olu Sola','olu@me.com','Admin','$2a$08$HM8vn5rE0cnSGbd68Gi7BOacCvnD1tb9fcuhJdR04wrFH3ng8c6NS'),('Way Ward','way@ward.com','User','$2a$08$HM8vn5rE0cnSGbd68Gi7BOacCvnD1tb9fcuhJdR04wrFH3ng8c6NS');
INSERT INTO categories(categoryName,categoryDetails)VALUES('Food','For Eating, Obviously'),('Drinks','For Drinking'),('Toiletries','For toilets');
INSERT INTO products(categories_id,productName,productImage,productDetails,productSpec,productPrice, productQuantity, productLimit)VALUES(1,'Bath Soap','pack.jpg','For Fresh Bath','80mg per pack',300, 300, 50),(1,'Bread','bread.jpg','Wheat Flavored Bread','200g per pack',450,200,20),(2,'Vanilla Fruity','vanilla.jpg','For Parties','200g per pack',1550,150,10);
INSERT INTO incidents(users_id,incidentTime,incidentImage,incidentDetails)VALUES(2,'8am','disagreement.jpg','An angry client'),(2,'5.30pm','broken.jpg','Broken Panes');
| true |
3b40755cfce0333a0aa60bfab64bbedf788f5332 | SQL | linhtdub/magento2_data_migration | /protected/data/step3_reset.sql | UTF-8 | 10,344 | 3.71875 | 4 | [
"MIT"
] | permissive |
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for `catalog_category_entity`
-- ----------------------------
DROP TABLE IF EXISTS `catalog_category_entity`;
CREATE TABLE `catalog_category_entity` (
`entity_id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Entity ID',
`attribute_set_id` smallint(5) unsigned NOT NULL DEFAULT '0' COMMENT 'Attriute Set ID',
`parent_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT 'Parent Category ID',
`created_at` timestamp NULL DEFAULT NULL COMMENT 'Creation Time',
`updated_at` timestamp NULL DEFAULT NULL COMMENT 'Update Time',
`path` varchar(255) NOT NULL COMMENT 'Tree Path',
`position` int(11) NOT NULL COMMENT 'Position',
`level` int(11) NOT NULL DEFAULT '0' COMMENT 'Tree Level',
`children_count` int(11) NOT NULL COMMENT 'Child Count',
PRIMARY KEY (`entity_id`),
KEY `IDX_CATALOG_CATEGORY_ENTITY_LEVEL` (`level`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 COMMENT='Catalog Category Table';
-- ----------------------------
-- Records of catalog_category_entity
-- ----------------------------
INSERT INTO catalog_category_entity VALUES ('1', '0', '0', '2015-02-09 05:50:55', '2015-02-09 05:50:55', '1', '0', '0', '1');
INSERT INTO catalog_category_entity VALUES ('2', '3', '1', '2015-02-09 05:50:57', '2015-02-09 05:50:57', '1/2', '1', '1', '0');
-- ----------------------------
-- Table structure for `catalog_category_entity_datetime`
-- ----------------------------
DROP TABLE IF EXISTS `catalog_category_entity_datetime`;
CREATE TABLE `catalog_category_entity_datetime` (
`value_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Value ID',
`attribute_id` smallint(5) unsigned NOT NULL DEFAULT '0' COMMENT 'Attribute ID',
`store_id` smallint(5) unsigned NOT NULL DEFAULT '0' COMMENT 'Store ID',
`entity_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT 'Entity ID',
`value` datetime DEFAULT NULL COMMENT 'Value',
PRIMARY KEY (`value_id`),
UNIQUE KEY `UNQ_CAT_CTGR_ENTT_DTIME_ENTT_TYPE_ID_ENTT_ID_ATTR_ID_STORE_ID` (`entity_id`,`attribute_id`,`store_id`),
KEY `IDX_CATALOG_CATEGORY_ENTITY_DATETIME_ENTITY_ID` (`entity_id`),
KEY `IDX_CATALOG_CATEGORY_ENTITY_DATETIME_ATTRIBUTE_ID` (`attribute_id`),
KEY `IDX_CATALOG_CATEGORY_ENTITY_DATETIME_STORE_ID` (`store_id`),
CONSTRAINT `FK_CATALOG_CATEGORY_ENTITY_DATETIME_STORE_ID_STORE_STORE_ID` FOREIGN KEY (`store_id`) REFERENCES `store` (`store_id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `FK_CAT_CTGR_ENTT_DTIME_ATTR_ID_EAV_ATTR_ATTR_ID` FOREIGN KEY (`attribute_id`) REFERENCES `eav_attribute` (`attribute_id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `FK_CAT_CTGR_ENTT_DTIME_ENTT_ID_CAT_CTGR_ENTT_ENTT_ID` FOREIGN KEY (`entity_id`) REFERENCES `catalog_category_entity` (`entity_id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Catalog Category Datetime Attribute Backend Table';
-- ----------------------------
-- Records of catalog_category_entity_datetime
-- ----------------------------
-- ----------------------------
-- Table structure for `catalog_category_entity_decimal`
-- ----------------------------
DROP TABLE IF EXISTS `catalog_category_entity_decimal`;
CREATE TABLE `catalog_category_entity_decimal` (
`value_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Value ID',
`attribute_id` smallint(5) unsigned NOT NULL DEFAULT '0' COMMENT 'Attribute ID',
`store_id` smallint(5) unsigned NOT NULL DEFAULT '0' COMMENT 'Store ID',
`entity_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT 'Entity ID',
`value` decimal(12,4) DEFAULT NULL COMMENT 'Value',
PRIMARY KEY (`value_id`),
UNIQUE KEY `UNQ_CAT_CTGR_ENTT_DEC_ENTT_TYPE_ID_ENTT_ID_ATTR_ID_STORE_ID` (`entity_id`,`attribute_id`,`store_id`),
KEY `IDX_CATALOG_CATEGORY_ENTITY_DECIMAL_ENTITY_ID` (`entity_id`),
KEY `IDX_CATALOG_CATEGORY_ENTITY_DECIMAL_ATTRIBUTE_ID` (`attribute_id`),
KEY `IDX_CATALOG_CATEGORY_ENTITY_DECIMAL_STORE_ID` (`store_id`),
CONSTRAINT `FK_CATALOG_CATEGORY_ENTITY_DECIMAL_STORE_ID_STORE_STORE_ID` FOREIGN KEY (`store_id`) REFERENCES `store` (`store_id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `FK_CAT_CTGR_ENTT_DEC_ATTR_ID_EAV_ATTR_ATTR_ID` FOREIGN KEY (`attribute_id`) REFERENCES `eav_attribute` (`attribute_id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `FK_CAT_CTGR_ENTT_DEC_ENTT_ID_CAT_CTGR_ENTT_ENTT_ID` FOREIGN KEY (`entity_id`) REFERENCES `catalog_category_entity` (`entity_id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Catalog Category Decimal Attribute Backend Table';
-- ----------------------------
-- Records of catalog_category_entity_decimal
-- ----------------------------
-- ----------------------------
-- Table structure for `catalog_category_entity_int`
-- ----------------------------
DROP TABLE IF EXISTS `catalog_category_entity_int`;
CREATE TABLE `catalog_category_entity_int` (
`value_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Value ID',
`attribute_id` smallint(5) unsigned NOT NULL DEFAULT '0' COMMENT 'Attribute ID',
`store_id` smallint(5) unsigned NOT NULL DEFAULT '0' COMMENT 'Store ID',
`entity_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT 'Entity ID',
`value` int(11) DEFAULT NULL COMMENT 'Value',
PRIMARY KEY (`value_id`),
UNIQUE KEY `UNQ_CAT_CTGR_ENTT_INT_ENTT_TYPE_ID_ENTT_ID_ATTR_ID_STORE_ID` (`entity_id`,`attribute_id`,`store_id`),
KEY `IDX_CATALOG_CATEGORY_ENTITY_INT_ENTITY_ID` (`entity_id`),
KEY `IDX_CATALOG_CATEGORY_ENTITY_INT_ATTRIBUTE_ID` (`attribute_id`),
KEY `IDX_CATALOG_CATEGORY_ENTITY_INT_STORE_ID` (`store_id`),
CONSTRAINT `FK_CATALOG_CATEGORY_ENTITY_INT_STORE_ID_STORE_STORE_ID` FOREIGN KEY (`store_id`) REFERENCES `store` (`store_id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `FK_CAT_CTGR_ENTT_INT_ATTR_ID_EAV_ATTR_ATTR_ID` FOREIGN KEY (`attribute_id`) REFERENCES `eav_attribute` (`attribute_id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `FK_CAT_CTGR_ENTT_INT_ENTT_ID_CAT_CTGR_ENTT_ENTT_ID` FOREIGN KEY (`entity_id`) REFERENCES `catalog_category_entity` (`entity_id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 COMMENT='Catalog Category Integer Attribute Backend Table';
-- ----------------------------
-- Records of catalog_category_entity_int
-- ----------------------------
INSERT INTO catalog_category_entity_int VALUES ('1', '65', '0', '1', '1');
INSERT INTO catalog_category_entity_int VALUES ('2', '42', '0', '2', '1');
INSERT INTO catalog_category_entity_int VALUES ('3', '65', '0', '2', '1');
-- ----------------------------
-- Table structure for `catalog_category_entity_text`
-- ----------------------------
DROP TABLE IF EXISTS `catalog_category_entity_text`;
CREATE TABLE `catalog_category_entity_text` (
`value_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Value ID',
`attribute_id` smallint(5) unsigned NOT NULL DEFAULT '0' COMMENT 'Attribute ID',
`store_id` smallint(5) unsigned NOT NULL DEFAULT '0' COMMENT 'Store ID',
`entity_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT 'Entity ID',
`value` text COMMENT 'Value',
PRIMARY KEY (`value_id`),
UNIQUE KEY `UNQ_CAT_CTGR_ENTT_TEXT_ENTT_TYPE_ID_ENTT_ID_ATTR_ID_STORE_ID` (`entity_id`,`attribute_id`,`store_id`),
KEY `IDX_CATALOG_CATEGORY_ENTITY_TEXT_ENTITY_ID` (`entity_id`),
KEY `IDX_CATALOG_CATEGORY_ENTITY_TEXT_ATTRIBUTE_ID` (`attribute_id`),
KEY `IDX_CATALOG_CATEGORY_ENTITY_TEXT_STORE_ID` (`store_id`),
CONSTRAINT `FK_CATALOG_CATEGORY_ENTITY_TEXT_STORE_ID_STORE_STORE_ID` FOREIGN KEY (`store_id`) REFERENCES `store` (`store_id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `FK_CAT_CTGR_ENTT_TEXT_ATTR_ID_EAV_ATTR_ATTR_ID` FOREIGN KEY (`attribute_id`) REFERENCES `eav_attribute` (`attribute_id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `FK_CAT_CTGR_ENTT_TEXT_ENTT_ID_CAT_CTGR_ENTT_ENTT_ID` FOREIGN KEY (`entity_id`) REFERENCES `catalog_category_entity` (`entity_id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 COMMENT='Catalog Category Text Attribute Backend Table';
-- ----------------------------
-- Records of catalog_category_entity_text
-- ----------------------------
INSERT INTO catalog_category_entity_text VALUES ('1', '63', '0', '1', null);
INSERT INTO catalog_category_entity_text VALUES ('2', '63', '0', '2', null);
-- ----------------------------
-- Table structure for `catalog_category_entity_varchar`
-- ----------------------------
DROP TABLE IF EXISTS `catalog_category_entity_varchar`;
CREATE TABLE `catalog_category_entity_varchar` (
`value_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Value ID',
`attribute_id` smallint(5) unsigned NOT NULL DEFAULT '0' COMMENT 'Attribute ID',
`store_id` smallint(5) unsigned NOT NULL DEFAULT '0' COMMENT 'Store ID',
`entity_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT 'Entity ID',
`value` varchar(255) DEFAULT NULL COMMENT 'Value',
PRIMARY KEY (`value_id`),
UNIQUE KEY `UNQ_CAT_CTGR_ENTT_VCHR_ENTT_TYPE_ID_ENTT_ID_ATTR_ID_STORE_ID` (`entity_id`,`attribute_id`,`store_id`),
KEY `IDX_CATALOG_CATEGORY_ENTITY_VARCHAR_ENTITY_ID` (`entity_id`),
KEY `IDX_CATALOG_CATEGORY_ENTITY_VARCHAR_ATTRIBUTE_ID` (`attribute_id`),
KEY `IDX_CATALOG_CATEGORY_ENTITY_VARCHAR_STORE_ID` (`store_id`),
CONSTRAINT `FK_CATALOG_CATEGORY_ENTITY_VARCHAR_STORE_ID_STORE_STORE_ID` FOREIGN KEY (`store_id`) REFERENCES `store` (`store_id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `FK_CAT_CTGR_ENTT_VCHR_ATTR_ID_EAV_ATTR_ATTR_ID` FOREIGN KEY (`attribute_id`) REFERENCES `eav_attribute` (`attribute_id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `FK_CAT_CTGR_ENTT_VCHR_ENTT_ID_CAT_CTGR_ENTT_ENTT_ID` FOREIGN KEY (`entity_id`) REFERENCES `catalog_category_entity` (`entity_id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 COMMENT='Catalog Category Varchar Attribute Backend Table';
-- ----------------------------
-- Records of catalog_category_entity_varchar
-- ----------------------------
INSERT INTO catalog_category_entity_varchar VALUES ('1', '41', '0', '1', 'Root Catalog');
INSERT INTO catalog_category_entity_varchar VALUES ('2', '41', '0', '2', 'Default Category');
INSERT INTO catalog_category_entity_varchar VALUES ('3', '48', '0', '2', 'PRODUCTS');
SET FOREIGN_KEY_CHECKS=1; | true |
a4d2308442fb99d53c99e666c18fde4739976786 | SQL | psw7205/Programming-Practices | /Python/DB/sql1_1.sql | UTF-8 | 1,183 | 4.15625 | 4 | [] | no_license | -- 한줄주석
/*
여러줄
주석
*/
-- ************
-- 데이타베이스 변경하기
-- USE 데이타베이스명
USE world;
USE employees;
-- 현재 데이타베이스안의 테이블 확인하기
-- SHOW tables;
SHOW TABLES;
-- 테이블 정보 조회
SHOW TABLE STATUS;
-- 테이블 구조 확인하기
-- DESC 테이블명;
-- describe 테이블명;
DESC salaries;
-- 특정 레코드 표시
-- SELECT ... FROM 테이블명;
SELECT * FROM employees LIMIT 5;
SELECT * FROM employees;
-- 10개의 레코드만 csv 저장하기
SELECT * FROM employees LIMIT 10;
-- first_name, last_name 컬럼명으로 10개의 레코드 추출
SELECT * FROM city LIMIT 10;
/*
1) world 데이타베이스로 변경하기
2) city 테이블의 구조 확인하기.
몇개의 컬럼명으로 이루어져 있을까요?
3) city 테이블에서 10개만 레코드 출력하기
4) 3번의 테이블 목록을 city_10.csv 파일로 저장하기
5) city 테이블에서 'CountryCode' 컬럼명이 NLD인
레코드만 출력한 후 city_nld.txt 파일로 저장하기
*/
USE world;
DESC city;
SELECT * FROM city LIMIT 10;
SELECT * FROM city WHERE CountryCode = 'NLD';
| true |
05595660b309b64f6cda0d908363f27dc1faacd7 | SQL | ejoo1109/oraclesource | /다중행함수.sql | UHC | 6,759 | 4.71875 | 5 | [] | no_license | --SUM : հ
SELECT sum(sal), sum(distinct sal), sum(all sal) from emp;
--distrinct sal ߺ ϰ հ
--count : emp ̺ ˰
select count(*) from emp;
--μ ȣ 30 ϱ
select count(*) from emp where deptno=30;
SELECT count(sal), count(distinct sal), count(all sal) from emp;
--max(ִ밪), min(ּҰ)
select max(sal), min(sal) from emp;
--μȣ 20 Ի ֱ Ի ϱ
select max(hiredate) from emp where deptno=20;
-- avg : average
select avg(sal) from emp;
select avg(sal) from emp where deptno=30;
select avg(distinct sal) from emp;
--GROUP BY μ ˰ ʹٸ?
select avg(sal) from emp where deptno=30;
select avg(sal) from emp where deptno=20;
select avg(sal) from emp where deptno=10;
--GROUP BY: ϴ
SELECT DEPTNO, AVG(SAL) FROM EMP GROUP BY deptno;
--μȣ ߰ ϱ
SELECT DEPTNO, AVG(COMM) FROM EMP GROUP BY DEPTNO;
--μȣ, å ϱ
SELECT DEPTNO, JOB, AVG(SAL)
FROM EMP GROUP BY DEPTNO, JOB ORDER BY DEPTNO, JOB;
--GROUP BY ȵǴ select ϸ ȵ ex)̸
SELECT ename, deptno, avg(sal)
from emp
group by deptno;
--HAVING : GROUP BY
-- μ å ϵ 2000̻ 츸
SELECT DEPTNO,JOB, AVG(SAL)
FROM EMP
GROUP BY DEPTNO, JOB
HAVING AVG(SAL) >= 2000
ORDER BY DEPTNO, JOB;
--emp ̺ μ å 500̻
--μȣ, å, μ å
select deptno, job, avg(sal)
from emp
group by deptno, job having avg(sal) >=500;
select deptno, job, avg(sal)
from emp
where sal <=3000
group by deptno, job having avg(sal) >=2000
order by deptno;
--ǽ1)
select deptno, trunc(avg(sal))as avg_sal, max(sal) as max_sal,min(sal) as min_sal,
count(deptno) as cnt
from emp
group by deptno;
--ǽ2)
select job,count(job)
from emp
group by job having count(job) >= 3;
--ǽ3)
select TO_CHAR(hiredate,'yyyy')as hire_year, deptno,
count(TO_CHAR(hiredate,'yyyy')) as HIRE_YEAR
from emp
group by deptno,TO_CHAR(hiredate,'yyyy')
order by TO_CHAR(hiredate,'yyyy') desc;
--
-- ִ ȸ
SELECT * FROM EMP,DEPT ORDER BY EMPNO;
SELECT COUNT(*) FROM EMP, DEPT ORDER BY EMPNO;--56
SELECT * FROM DEPT; --4
SELECT * FROM EMP; --14
--1)() 2
SELECT *
FROM EMP,DEPT
WHERE EMP.DEPTNO= DEPT.DEPTNO --
ORDER BY EMPNO;
SELECT *
FROM EMP E,DEPT D --Ī
WHERE E.DEPTNO = D.DEPTNO --
ORDER BY EMPNO;
SELECT *
FROM EMP E INNER JOIN DEPT D
ON E.DEPTNO = D.DEPTNO --
ORDER BY EMPNO;
-- ̺ ̸ ʵ尡 ϴ
-- ̺ ִ ʵ带 ð Ȯ
SELECT EMPNO, ENAME, JOB,D.DEPTNO, DNAME
FROM EMP E,DEPT D
WHERE E.DEPTNO= D.DEPTNO --
ORDER BY EMPNO;
--EMP ̺ DEPT ̺ Ͽ EMPNO,ENAME,SAL,DEPTNO,
--DNAME, LOC ȸѴ., 3000 ̻
SELECT E.EMPNO,E.ENAME,E.SAL,D.DEPTNO,D.DNAME,D.LOC
FROM EMP E, DEPT D
WHERE E.DEPTNO = d.deptno AND SAL>=3000;
--EMP ̺ Ī E, DEPT̺ Ī D Ͽ
-- 2500̰, ȣ 9999
SELECT *
FROM EMP E, DEPT D
WHERE E.DEPTNO = D.DEPTNO AND SAL<=2500 AND E.EMPNO <= 9999;
--EMP ̺ Ī E, SALGRADE ̺ Ī S Ͽ
-- Ҿ
SELECT *
FROM EMP E, SALGRADE S
WHERE E.SAL BETWEEN S.LOSAL AND S.HISAL;
--2)(ü) : ̺ ڱ ڽ ̺϶
SELECT * FROM EMP;
SELECT E1.EMPNO, E1.ENAME,E1.MGR,E2.EMPNO AS MGR_EMPNO, E2.ENAME AS MGR_ENAME
FROM EMP E1,EMP E2
WHERE E1.MGR = E2.EMPNO;
--OUTER JOIN (ܺ) : ʴ
--1) LEFT OUTER JOIN
SELECT E1.EMPNO, E1.ENAME,E1.MGR,E2.EMPNO AS MGR_EMPNO, E2.ENAME AS MGR_ENAME
FROM EMP E1 LEFT OUTER JOIN EMP E2
ON E1.MGR = E2.EMPNO;
SELECT E1.EMPNO, E1.ENAME,E1.MGR,E2.EMPNO AS MGR_EMPNO, E2.ENAME AS MGR_ENAME
FROM EMP E1,EMP E2
WHERE E1.MGR = E2.EMPNO(+);
--2) RIGHT OUTER JOIN
SELECT E1.EMPNO, E1.ENAME,E1.MGR,E2.EMPNO AS MGR_EMPNO, E2.ENAME AS MGR_ENAME
FROM EMP E1 RIGHT OUTER JOIN EMP E2
ON E1.MGR = E2.EMPNO;
SELECT E1.EMPNO, E1.ENAME,E1.MGR,E2.EMPNO AS MGR_EMPNO, E2.ENAME AS MGR_ENAME
FROM EMP E1,EMP E2
WHERE E1.MGR(+) = E2.EMPNO;
--ǽ1) 2000ʰ μ , Ʒ
SELECT E.DEPTNO,D.DNAME,E.EMPNO,E.ENAME ,E.SAL
FROM EMP E,DEPT D
WHERE E.DEPTNO = D.DEPTNO AND E.SAL > 2000 ORDER BY E.DEPTNO;
SELECT E.DEPTNO,D.DNAME,E.EMPNO,E.ENAME ,E.SAL
FROM EMP E INNER JOIN DEPT D
ON E.DEPTNO = D.DEPTNO
WHERE E.SAL > 2000 ORDER BY E.DEPTNO;
--ǽ2) μ , ִ, ּұ, ϴ SQL ۼ
SELECT D.DEPTNO, D.DNAME, FLOOR(AVG(E.SAL)) AS AVG_SAL,
MAX(E.SAL) AS MAX_SAL, MIN(E.SAL)AS MIN_SAL, COUNT(D.DNAME)
FROM EMP E, DEPT D
WHERE E.DEPTNO=D.DEPTNO
GROUP BY D.DEPTNO, D.DNAME
ORDER BY D.DEPTNO;
SELECT D.DEPTNO, D.DNAME, FLOOR(AVG(E.SAL)) AS AVG_SAL,
MAX(E.SAL) AS MAX_SAL,MIN(E.SAL)AS MIN_SAL,COUNT(DNAME)
FROM EMP E INNER JOIN DEPT D ON E.DEPTNO = D.DEPTNO
GROUP BY D.DEPTNO, D.DNAME
ORDER BY D.DEPTNO;
--ǽ3) μ μȣ, ̸ Ͽ
SELECT D.DEPTNO, D.DNAME, E.EMPNO,E.ENAME,E.JOB,E.SAL
FROM EMP E RIGHT OUTER JOIN DEPT D ON E.DEPTNO = D.DEPTNO
ORDER BY D.DEPTNO, E.EMPNO;
--ǽ4) μ , , ӻ μȣ
--ȣ Ͽ
SELECT D1.DEPTNO, D1.DNAME, E1.EMPNO,E1.ENAME,E1.MGR,E1.SAL,E1.DEPTNO,
S.LOSAL,S.HISAL,S.GRADE,E2.EMPNO AS MGR_EMPNO, E2.ENAME AS MGR_ENAME
FROM EMP E1
RIGHT OUTER JOIN DEPT D1 ON E1.DEPTNO = D1.DEPTNO
LEFT OUTER JOIN SALGRADE S ON E1.SAL BETWEEN S.LOSAL AND S.HISAL
LEFT OUTER JOIN EMP E2 ON E1.MGR = E2.EMPNO
ORDER BY D1.DEPTNO, E1.EMPNO;
SELECT D1.DEPTNO, D1.DNAME, E1.EMPNO,E1.ENAME,E1.MGR,E1.SAL,E1.DEPTNO,
S.LOSAL,S.HISAL,S.GRADE,E2.EMPNO AS MGR_EMPNO, E2.ENAME AS MGR_ENAME
FROM EMP E1, DEPT D1, SALGRADE S, EMP E2
WHERE E1.DEPTNO(+)=D1.DEPTNO AND E1.SAL BETWEEN S.LOSAL(+) AND S.HISAL(+)
AND E1.MGR = E2.EMPNO(+)
ORDER BY E1.EMPNO;
| true |
1ba4274fc39cad68622b8fce1b653fb23b1b15af | SQL | AleksandrPok/TaxiService | /src/main/resources/init_db.sql | UTF-8 | 1,646 | 3.953125 | 4 | [] | no_license | CREATE SCHEMA `taxi` DEFAULT CHARACTER SET utf8 ;
CREATE TABLE `taxi`.`manufacturer` (
`id` BIGINT(11) NOT NULL AUTO_INCREMENT,
`name` VARCHAR(45) NOT NULL,
`country` VARCHAR(45) NOT NULL,
`deleted` TINYINT NOT NULL DEFAULT 0,
PRIMARY KEY (`id`)
);
CREATE TABLE `taxi`.`drivers` (
`id` BIGINT(11) NOT NULL,
`name` VARCHAR(45) NOT NULL,
`license_number` VARCHAR(45) NOT NULL,
`login` VARCHAR(45) NOT NULL,
`password` VARCHAR(45) NOT NULL,
`deleted` TINYINT NOT NULL DEFAULT 0,
PRIMARY KEY (`id`),
UNIQUE INDEX `login_UNIQUE` (`login` ASC) VISIBLE
);
CREATE TABLE `taxi`.`cars` (
`id` BIGINT(11) NOT NULL AUTO_INCREMENT,
`manufacturer_id` BIGINT(11) NOT NULL,
`model` VARCHAR(45) NOT NULL,
`deleted` TINYINT NOT NULL DEFAULT 0,
PRIMARY KEY (`id`),
INDEX `manufacturer_id_idx` (`manufacturer_id` ASC) VISIBLE,
CONSTRAINT `manufacturer_id_fk`
FOREIGN KEY (`manufacturer_id`)
REFERENCES `taxi`.`manufacturer` (`id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION
);
CREATE TABLE `taxi`.`cars_drivers` (
`car_id` BIGINT(11) NOT NULL,
`driver_id` BIGINT(11) NOT NULL,
INDEX `car_id_fk_idx` (`car_id` ASC) VISIBLE,
INDEX `driver_id_fk_idx` (`driver_id` ASC) VISIBLE,
CONSTRAINT `car_id_fk`
FOREIGN KEY (`car_id`)
REFERENCES `taxi`.`cars` (`id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `driver_id_fk`
FOREIGN KEY (`driver_id`)
REFERENCES `taxi`.`drivers` (`id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION
);
| true |
c1ec9b91e63a50d146ee951b2b4168c05e7e05d9 | SQL | twinc1e/AuctionSite | /sql/auction.sql | UTF-8 | 10,897 | 3.140625 | 3 | [] | no_license | -- phpMyAdmin SQL Dump
-- version 4.7.7
-- https://www.phpmyadmin.net/
--
-- Хост: 127.0.0.1:3306
-- Время создания: Июн 06 2019 г., 20:59
-- Версия сервера: 5.7.20
-- Версия PHP: 7.0.26
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 */;
--
-- База данных: `auction`
--
CREATE DATABASE IF NOT EXISTS `auction` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
USE `auction`;
-- --------------------------------------------------------
--
-- Структура таблицы `bidHistory`
--
DROP TABLE IF EXISTS `bidHistory`;
CREATE TABLE IF NOT EXISTS `bidHistory` (
`bidhistory_id` int(11) NOT NULL AUTO_INCREMENT,
`price` double NOT NULL,
`item_id` int(11) DEFAULT NULL,
`user_id` int(11) DEFAULT NULL,
PRIMARY KEY (`bidhistory_id`),
KEY `item_id` (`item_id`),
KEY `user_id` (`user_id`)
) ENGINE=InnoDB AUTO_INCREMENT=84 DEFAULT CHARSET=utf8;
--
-- Очистить таблицу перед добавлением данных `bidHistory`
--
TRUNCATE TABLE `bidHistory`;
--
-- Дамп данных таблицы `bidHistory`
--
INSERT IGNORE INTO `bidHistory` (`bidhistory_id`, `price`, `item_id`, `user_id`) VALUES
(38, 200, 17, 3),
(39, 201, 17, 5),
(40, 299, 17, 3),
(41, 300, 17, 1),
(42, 340, 17, 3),
(45, 111, 18, 5),
(46, 222, 18, 5),
(47, 233, 18, 3),
(48, 1111, 21, 4),
(49, 2300, 21, 1),
(50, 244, 18, 5),
(51, 3100, 23, 4),
(52, 3200, 23, 3),
(53, 3300, 23, 5),
(54, 3400, 23, 3),
(55, 3500, 23, 5),
(56, 3600, 23, 3),
(57, 501, 26, 4),
(58, 502, 26, 3),
(59, 1211, 25, 4),
(60, 185, 27, 5),
(61, 187, 27, 3),
(62, 189, 27, 5),
(63, 190, 27, 3),
(64, 191, 27, 5),
(65, 110, 20, 4),
(66, 111, 20, 3),
(67, 112, 20, 3),
(68, 352, 28, 1),
(69, 353, 28, 3),
(70, 355, 28, 5),
(71, 380, 28, 1),
(72, 390, 28, 3),
(73, 391, 28, 5),
(74, 392, 28, 3),
(75, 393, 28, 5),
(76, 394, 28, 3),
(77, 410, 28, 4),
(78, 1005, 29, 4),
(79, 2000, 29, 3),
(80, 60, 30, 4),
(81, 70, 30, 5),
(82, 70, 30, 5),
(83, 80, 30, 4);
-- --------------------------------------------------------
--
-- Структура таблицы `category`
--
DROP TABLE IF EXISTS `category`;
CREATE TABLE IF NOT EXISTS `category` (
`category_id` int(11) NOT NULL AUTO_INCREMENT,
`category_name` varchar(30) NOT NULL,
PRIMARY KEY (`category_id`)
) ENGINE=InnoDB AUTO_INCREMENT=24 DEFAULT CHARSET=utf8;
--
-- Очистить таблицу перед добавлением данных `category`
--
TRUNCATE TABLE `category`;
--
-- Дамп данных таблицы `category`
--
INSERT IGNORE INTO `category` (`category_id`, `category_name`) VALUES
(4, 'Arts, Antiques & Collectibles'),
(5, 'Baby, Kids & Mum '),
(6, 'Beauty & Personal Care'),
(7, 'Books & Comics'),
(8, 'Camera & Camcorder '),
(9, 'Cars & Transport '),
(10, 'Clothing & Accessories'),
(11, 'Computer & Software'),
(12, 'Electronics & Appliances'),
(13, 'General & Misc '),
(14, 'Handphone & Communication '),
(15, 'Health & Medical'),
(16, 'Home & Gardening '),
(17, 'House & Property '),
(18, 'Jewellery, Gemstone, Accessori'),
(19, 'Movies & Video '),
(20, 'Music & Song'),
(21, 'Office Equipment'),
(22, 'Toys & Games'),
(23, 'Watches, Pens & Clocks');
-- --------------------------------------------------------
--
-- Структура таблицы `item`
--
DROP TABLE IF EXISTS `item`;
CREATE TABLE IF NOT EXISTS `item` (
`item_id` int(11) NOT NULL AUTO_INCREMENT,
`itemname` varchar(255) NOT NULL,
`photo` text NOT NULL,
`description` text NOT NULL,
`initialprice` double NOT NULL,
`endtime` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`category_id` int(11) NOT NULL,
`user_id` int(11) NOT NULL,
`winner` int(11) DEFAULT NULL,
PRIMARY KEY (`item_id`),
KEY `category_id` (`category_id`),
KEY `user_id` (`user_id`)
) ENGINE=InnoDB AUTO_INCREMENT=32 DEFAULT CHARSET=utf8;
--
-- Очистить таблицу перед добавлением данных `item`
--
TRUNCATE TABLE `item`;
--
-- Дамп данных таблицы `item`
--
INSERT IGNORE INTO `item` (`item_id`, `itemname`, `photo`, `description`, `initialprice`, `endtime`, `category_id`, `user_id`, `winner`) VALUES
(17, 'ipad2', '../../asset/itemImg/step0-ipad-gallery-image4.png', 'this is an ipad2, top rate tablet device of 2010 and 2011, ranking 4-5(full star) across top review website. Bid now start from just RM23.33 ringit!!!', 23.33, '2019-03-22 11:00:00', 12, 2, 3),
(18, 'imac', '../../asset/itemImg/imac.jpg', 'Imac, the one stop desktop for all ppl ranging from student to pro carrer worker, bid now start from RM100', 100, '2019-03-12 14:12:00', 12, 2, 5),
(19, 'Macbook Pro', '../../asset/itemImg/macbookpro.jpg', 'Macbook Pro, ur fav laptop and top ranking laptop since appple release macbook pro.', 88.88, '2019-03-12 03:14:00', 11, 2, 0),
(20, 'HTC Desire', '../../asset/itemImg/HTC_Desire_HD.png', 'HTC lastest phone, htc desire, bid price start from RM100 only, bid now before to late', 100, '2019-03-16 05:05:00', 14, 2, 3),
(21, 'Hyundai example', '../../asset/itemImg/hundai.jpeg', 'Hyundai example, start price at RM1000, super offer, bid now and save ur money.', 1000, '2019-03-12 13:44:00', 9, 2, 1),
(22, 'Nissan Cefiro 2.5', '../../asset/itemImg/nissan.jpeg', 'Description:\r\nGreat Deal!\r\n\r\n* Genuine Dealer\r\n* High Trade In\r\n* Tip Top Condition\r\n* Well Maintained\r\n* Nice Interior\r\n* Special Promotion, \r\n* Ready Stock\r\n* Test Drive Available\r\n* Attractive Loan Package \r\n* Fast Loan, Low Interest\r\n\r\nWhat are You Waiting For? Do not Miss Out on This\r\nAmazing Offer!', 2000, '2019-03-12 15:13:00', 9, 2, 0),
(23, 'Nissan Cefiro ', '../../asset/itemImg/Nissan Cefiro 2.0 V6 Auto Excimo 2003.jpeg', 'Description:\r\nPrice : RM 49 800 \r\nMake: Nissan\r\nModel: Cefiro\r\nReg. year: 2003\r\nTransmission: Auto\r\nEngine Capacity: 2000 cc\r\nAccessories: Airbag driver, Airbag passenger, ABS\r\nBrakes, Sport rims, Alarm, Central lock\r\n', 3000, '2019-03-12 15:11:00', 9, 2, 3),
(24, 'kia forte', '../../asset/itemImg/kia forte.jpeg', 'Nice Car Good Service!! Model: Forte, Variant:1.6L DOHC CVVT EX (A), Year: 2011', 4000, '2019-03-12 15:17:00', 9, 2, 0),
(25, 'Latitude E6410 Laptop Business-Class 14.1-Inch Laptop', '../../asset/itemImg/Latitude E6410 Laptop.png', 'Designed to increase productivity while reducing total cost of ownership, the Dellâ„¢ Latitudeâ„¢ E6410 laptop features dramatic advancements in durability, security and mobile collaboration.\r\n\r\nCentrally manageable with advanced security features\r\nGlobally available compatibility with Latitude E-Family product portfolio', 1200, '2019-03-16 16:06:00', 11, 2, 4),
(26, 'iphone 4 32gb', '../../asset/itemImg/iphone.jpeg', 'FaceTime. Video calling is a reality.\r\nSee family and friends while you talk to them. No other phone makes staying in touch so much fun.\r\nLearn more about FaceTime\r\n\r\nRetina display. 960 by 640 by Wow.\r\nWith a remarkable 960-by-640 resolution in a 3.5-inch screen, text and graphics look unbelievably crisp and sharp.\r\nLearn more about the Retina display\r\n\r\nHD video recording.\r\nLife looks better in HD.\r\niPhone 4 lets you record and edit stunning HD video. So it’s the only phone — and camera — you need to carry with you.\r\nLearn more about HD video recording\r\n\r\n5-megapixel camera. Never miss a photo opportunity.\r\nTake beautiful, detailed photos using the 5-megapixel camera with built-in LED flash.', 500, '2019-03-12 17:21:00', 14, 2, 3),
(27, 'Charles-Hubert, Paris Stainless Steel Mechanical Pocket Watch', '../../asset/itemImg/51eIGLLgmWL.jpg', 'The Charles-Hubert, Paris Stainless Steel Mechanical Pocket Watch is a throwback to the era of elegant, fine-crafted pocket watches. The beautiful timepiece features a demi-hunter case made from polished stainless steel that opens with a simple push of the crown. Inside the case, the semi-exposed, skeleton dial displays the inner mechanics along with handsome, black-toned Roman numeral indexes. However, you can still tell time with the case closed--the demi-hunter case allows you to see the watch hands and there are finely-etched Roman numeral indexes on the outside of the case. The Charles-Hubert, Paris Stainless Steel Mechanical Pocket Watch comes with a matching, stainless steel curb chain and a deluxe gift box and is powered by 17-jewel mechanical movement.', 184.95, '2019-03-12 21:42:00', 23, 2, 5),
(28, 'HTC flyer', '../../asset/itemImg/htcflyer.png', 'A tablet like no other\r\nHTC Flyer is a portable 7-inch tablet with a magic pen that can do more for you than you can imagine. From creating masterpieces with a stroke of a paintbrush, to taking multimedia notes or even signing digital documents, HTC Flyer puts you in control of any situation. With streaming movies at a touch of your finger, HTC Flyer turns any moment into something special.', 350, '2019-03-21 08:10:00', 14, 2, 4),
(29, 'Bed', '../../asset/itemImg/GEn5RRBrLnw.jpg', 'Bed under floor 1meter. With ledder. Cool bed. You need to buy. Call me, I makes you happy.', 1000, '2019-03-11 00:00:00', 4, 2, 3),
(30, 'tardis', '../../asset/itemImg/00iHy.jpg', 'TARDIS. Doctor Who. Serials. Little box outside, bigger inside. Ohohoh. Fantaastiic!', 50, '2019-06-10 00:05:00', 4, 2, 0),
(31, 'Book about success', '../../asset/itemImg/book.jpg', 'Keys to Success - 50 secrets from a Business Maverick by John Timpson.', 20, '2019-06-20 08:00:00', 7, 2, 0);
-- --------------------------------------------------------
--
-- Структура таблицы `user`
--
DROP TABLE IF EXISTS `user`;
CREATE TABLE IF NOT EXISTS `user` (
`user_id` int(11) NOT NULL AUTO_INCREMENT,
`username` varchar(20) NOT NULL,
`name` varchar(30) NOT NULL,
`email` varchar(30) NOT NULL,
`password` varchar(30) NOT NULL,
`permission` int(11) DEFAULT '0',
PRIMARY KEY (`user_id`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8;
--
-- Очистить таблицу перед добавлением данных `user`
--
TRUNCATE TABLE `user`;
--
-- Дамп данных таблицы `user`
--
INSERT IGNORE INTO `user` (`user_id`, `username`, `name`, `email`, `password`, `permission`) VALUES
(1, 'dev', 'devlim', 'me@me.com', 'devdev', 3),
(2, 'devlim', 'lim', 'lim@lim.com', '1234', 2),
(3, 'don', 'donknow', 'don@don.com', 'dondon', 1),
(4, 'bito', 'bitoke', 'nadusha_28_97@mail.com', 'bit', 1),
(5, 'try', 'tryMe', 'tryme@me.com', 'try', 1);
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
| true |
4a02e15da5aec390458d369c0641f290714a5ce6 | SQL | davidheryanto/turing | /infra/docker-compose/dev/turing/db-migrations/000001_schema_creation.up.sql | UTF-8 | 3,052 | 3.875 | 4 | [
"Apache-2.0"
] | permissive | CREATE TYPE router_status as ENUM ('pending', 'failed', 'deployed', 'undeployed');
CREATE TYPE router_version_status as ENUM ('pending', 'failed', 'deployed', 'undeployed');
CREATE TABLE IF NOT EXISTS routers
(
id serial PRIMARY KEY,
project_id integer NOT NULL,
environment_name varchar(50) NOT NULL,
name varchar(50) NOT NULL,
status router_status NOT NULL default 'pending',
endpoint varchar(128),
curr_router_version_id integer,
created_at timestamp NOT NULL default current_timestamp,
updated_at timestamp NOT NULL default current_timestamp,
CONSTRAINT uc_router_project_environment_name UNIQUE (project_id, name)
);
CREATE TABLE IF NOT EXISTS enrichers
(
id serial PRIMARY KEY,
image varchar(128) NOT NULL,
resource_request jsonb NOT NULL,
endpoint varchar(128) NOT NULL,
timeout varchar(20) NOT NULL,
port integer NOT NULL,
env jsonb,
created_at timestamp NOT NULL default current_timestamp,
updated_at timestamp NOT NULL default current_timestamp
);
CREATE TABLE IF NOT EXISTS ensemblers
(
id serial PRIMARY KEY,
image varchar(128) NOT NULL,
resource_request jsonb NOT NULL,
endpoint varchar(128) NOT NULL,
timeout varchar(20) NOT NULL,
port integer NOT NULL,
env jsonb,
created_at timestamp NOT NULL default current_timestamp,
updated_at timestamp NOT NULL default current_timestamp
);
CREATE TABLE IF NOT EXISTS router_versions
(
id serial PRIMARY KEY,
router_id integer references routers (id) NOT NULL,
version integer NOT NULL,
status router_version_status NOT NULL default 'pending',
image varchar(128) NOT NULL,
routes jsonb NOT NULL,
default_route_id varchar(40) NOT NULL,
experiment_engine jsonb NOT NULL,
resource_request jsonb NOT NULL,
timeout varchar(20) NOT NULL,
log_config jsonb NOT NULL,
enricher_id integer references enrichers (id),
ensembler_id integer references ensemblers (id),
error text,
created_at timestamp NOT NULL default current_timestamp,
updated_at timestamp NOT NULL default current_timestamp
);
ALTER TABLE routers
ADD CONSTRAINT fk_curr_deployed_version FOREIGN KEY (curr_router_version_id) REFERENCES router_versions (id) ON DELETE CASCADE;
| true |
d4e97936093f1230e5e5d720db8281c258c881a0 | SQL | renz-acain/portfolio | /old-portfolio/coodle/coodle.sql | UTF-8 | 8,324 | 3.234375 | 3 | [
"MIT"
] | permissive | -- phpMyAdmin SQL Dump
-- version 3.3.9
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Nov 28, 2013 at 07:57 PM
-- Server version: 5.5.8
-- PHP Version: 5.3.5
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
--
-- Database: `coodle`
--
-- --------------------------------------------------------
--
-- Table structure for table `countries`
--
CREATE TABLE IF NOT EXISTS `countries` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(100) NOT NULL,
`dateCreated` int(11) NOT NULL,
`dateUpdated` int(11) DEFAULT NULL,
`status` int(11) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
--
-- Dumping data for table `countries`
--
-- --------------------------------------------------------
--
-- Table structure for table `families`
--
CREATE TABLE IF NOT EXISTS `families` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`familyName` varchar(100) NOT NULL,
`phone` varchar(50) DEFAULT NULL,
`primaryMember` int(11) NOT NULL,
`dateCreated` int(11) NOT NULL,
`updatedBy` int(11) DEFAULT NULL,
`dateUpdated` int(11) DEFAULT NULL,
`status` int(11) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
--
-- Dumping data for table `families`
--
-- --------------------------------------------------------
--
-- Table structure for table `familymembers`
--
CREATE TABLE IF NOT EXISTS `familymembers` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`firstName` varchar(255) NOT NULL,
`middleName` varchar(255) DEFAULT NULL,
`lastName` varchar(255) NOT NULL,
`sex` varchar(20) DEFAULT NULL,
`dobD` int(2) DEFAULT NULL,
`dobM` int(2) DEFAULT NULL,
`dobY` int(4) DEFAULT NULL,
`maritalStatus` int(11) DEFAULT NULL,
`email` varchar(50) NOT NULL,
`phone` varchar(50) DEFAULT NULL,
`address1` varchar(50) DEFAULT NULL,
`address2` varchar(50) DEFAULT NULL,
`postcode` varchar(10) DEFAULT NULL,
`stateID` int(11) DEFAULT NULL,
`countryID` int(11) DEFAULT NULL,
`dateCreated` int(11) NOT NULL,
`updatedBy` int(11) DEFAULT NULL,
`dateUpdated` int(11) DEFAULT NULL,
`status` int(11) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `email` (`email`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=4 ;
--
-- Dumping data for table `familymembers`
--
INSERT INTO `familymembers` (`id`, `firstName`, `middleName`, `lastName`, `sex`, `dobD`, `dobM`, `dobY`, `maritalStatus`, `email`, `phone`, `address1`, `address2`, `postcode`, `stateID`, `countryID`, `dateCreated`, `updatedBy`, `dateUpdated`, `status`) VALUES
(1, 'Michael', NULL, 'Fasipe', NULL, NULL, NULL, NULL, NULL, 'fasipemichael@yahoo.com', NULL, NULL, NULL, NULL, NULL, NULL, 1385659334, NULL, NULL, 2),
(2, 'Simon', NULL, 'Jolley', 'male', NULL, NULL, NULL, 1, 'simon@coodle.com', NULL, NULL, NULL, NULL, NULL, NULL, 1385663982, NULL, NULL, 2),
(3, 'Keith', NULL, 'Mayor', 'male', NULL, NULL, NULL, 2, 'keith@coodle.com', NULL, NULL, NULL, NULL, NULL, NULL, 1385664044, NULL, NULL, 2);
-- --------------------------------------------------------
--
-- Table structure for table `familymember_family`
--
CREATE TABLE IF NOT EXISTS `familymember_family` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`familyMemberID` int(11) NOT NULL,
`familyID` int(11) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
--
-- Dumping data for table `familymember_family`
--
-- --------------------------------------------------------
--
-- Table structure for table `messagelog`
--
CREATE TABLE IF NOT EXISTS `messagelog` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`messageID` int(11) NOT NULL,
`statusType` int(11) NOT NULL,
`logDate` int(11) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
--
-- Dumping data for table `messagelog`
--
-- --------------------------------------------------------
--
-- Table structure for table `messages`
--
CREATE TABLE IF NOT EXISTS `messages` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`senderID` int(11) NOT NULL,
`recepientID` int(11) NOT NULL,
`message` text NOT NULL,
`flag` int(11) NOT NULL,
`dateCreated` int(11) NOT NULL,
`dateLastUpdated` int(11) DEFAULT NULL,
`status` int(11) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
--
-- Dumping data for table `messages`
--
-- --------------------------------------------------------
--
-- Table structure for table `states`
--
CREATE TABLE IF NOT EXISTS `states` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(100) NOT NULL,
`countryID` int(11) NOT NULL,
`dateCreated` int(11) NOT NULL,
`dateUpdated` int(11) DEFAULT NULL,
`status` int(11) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
--
-- Dumping data for table `states`
--
-- --------------------------------------------------------
--
-- Table structure for table `taskcategories`
--
CREATE TABLE IF NOT EXISTS `taskcategories` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(30) NOT NULL,
`description` varchar(50) DEFAULT NULL,
`createdBy` int(11) NOT NULL,
`dateCreated` int(11) NOT NULL,
`updatedBy` int(11) DEFAULT NULL,
`dateUpdated` int(11) DEFAULT NULL,
`status` int(11) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
--
-- Dumping data for table `taskcategories`
--
-- --------------------------------------------------------
--
-- Table structure for table `taskpriorities`
--
CREATE TABLE IF NOT EXISTS `taskpriorities` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(30) NOT NULL,
`description` varchar(50) DEFAULT NULL,
`dateCreated` int(11) NOT NULL,
`createdBy` int(11) NOT NULL,
`dateUpdated` int(11) DEFAULT NULL,
`updatedBy` int(11) DEFAULT NULL,
`status` int(11) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
--
-- Dumping data for table `taskpriorities`
--
-- --------------------------------------------------------
--
-- Table structure for table `taskrepititions`
--
CREATE TABLE IF NOT EXISTS `taskrepititions` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(30) NOT NULL,
`description` varchar(50) DEFAULT NULL,
`createdBy` int(11) NOT NULL,
`dateCreated` int(11) NOT NULL,
`updatedBy` int(11) DEFAULT NULL,
`dateUpdated` int(11) DEFAULT NULL,
`status` int(11) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
--
-- Dumping data for table `taskrepititions`
--
-- --------------------------------------------------------
--
-- Table structure for table `tasks`
--
CREATE TABLE IF NOT EXISTS `tasks` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`title` varchar(100) NOT NULL,
`notes` text,
`categoryID` int(11) NOT NULL,
`dueDate` int(11) NOT NULL,
`completionDate` int(11) DEFAULT NULL,
`flag` int(2) NOT NULL,
`repeatID` int(11) NOT NULL,
`repeatFrom` int(11) DEFAULT NULL,
`dateCreated` int(11) NOT NULL,
`createdBy` int(11) NOT NULL,
`assignedTo` int(11) NOT NULL,
`dateUpdated` int(11) DEFAULT NULL,
`updatedBy` int(11) DEFAULT NULL,
`status` int(11) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
--
-- Dumping data for table `tasks`
--
-- --------------------------------------------------------
--
-- Table structure for table `users`
--
CREATE TABLE IF NOT EXISTS `users` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`familyMemberID` int(11) NOT NULL,
`password` varchar(100) NOT NULL,
`dateCreated` int(11) NOT NULL,
`dateUpdated` int(11) DEFAULT NULL,
`updatedBy` int(11) DEFAULT NULL,
`status` int(11) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `familyMemberID` (`familyMemberID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=4 ;
--
-- Dumping data for table `users`
--
INSERT INTO `users` (`id`, `familyMemberID`, `password`, `dateCreated`, `dateUpdated`, `updatedBy`, `status`) VALUES
(1, 1, '42f749ade7f9e195bf475f37a44cafcb', 1385659334, NULL, NULL, 2),
(2, 2, '42f749ade7f9e195bf475f37a44cafcb', 1385663982, NULL, NULL, 2),
(3, 3, '42f749ade7f9e195bf475f37a44cafcb', 1385664044, NULL, NULL, 2);
| true |
019108456b92ceacb07dc66a60b3fa20443496fe | SQL | aimurphyii/bs-am-books-app | /data/schema.sql | UTF-8 | 805 | 2.890625 | 3 | [
"MIT"
] | permissive | DROP TABLE IF EXISTS books;
CREATE TABLE books (
id SERIAL PRIMARY KEY,
title VARCHAR(255),
author VARCHAR(255),
isbn NUMERIC(20),
image_url VARCHAR(255),
description TEXT,
bookshelf VARCHAR(255)
);
INSERT INTO books (title, author, isbn, image_url, description, bookshelf)
VALUES('Just So Stories', 'Kipling', '39015010350141', 'http://books.google.com/books/content?id=RwBbAAAAMAAJ&printsec=frontcover&img=1&zoom=5&edge=curl&source=gbs_api', 'Twelve stories about animals and insects including How the Camel Got His Hump; How the First Letter was Written, and How the Rhinoceros Got His Skin.', 'End game');
INSERT INTO books (title, author, isbn, image_url, description, bookshelf)
VALUES('buddy','who', '4598734957','https://jfydhgfyhdthosg', 'he\''s an elf?', 'buddy the elf'); | true |
b43bbc11a2ece3615233ec8b3e2b7d58f2d257fd | SQL | slardizzone/broadwayly | /schema.sql | UTF-8 | 324 | 2.875 | 3 | [] | no_license | create table shows (
id serial primary key,
title varchar(50) not null,
year varchar(4) not null,
composer varchar(50) not null,
img_url varchar(400) not null
);
create table songs (
id serial primary key,
title varchar(50) not null,
embed_url varchar(300) not null,
show_id integer references shows(id)
);
| true |
8f134d7094cce6b662954b43d22cdca04be80a5c | SQL | Arlam/Catalog | /DB/catalog.sql | UTF-8 | 4,997 | 3.328125 | 3 | [] | no_license | SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
DROP TABLE IF EXISTS `actors`;
CREATE TABLE IF NOT EXISTS `actors` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`fullName` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
DROP TABLE IF EXISTS `directors`;
CREATE TABLE IF NOT EXISTS `directors` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`fullName` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
DROP TABLE IF EXISTS `files`;
CREATE TABLE IF NOT EXISTS `files` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`film_id` int(11) DEFAULT NULL,
`path` varchar(255) NOT NULL,
`fileSize` int(6) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `path` (`path`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=215 ;
DROP TABLE IF EXISTS `films`;
CREATE TABLE IF NOT EXISTS `films` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`description` varchar(255) DEFAULT NULL,
`existed` tinyint(1) DEFAULT NULL,
`name` varchar(255) DEFAULT NULL,
`rate` int(11) DEFAULT NULL,
`version` varchar(32) DEFAULT NULL,
`watched` tinyint(1) DEFAULT NULL,
`year` int(11) DEFAULT NULL,
`detail_id` int(11) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `detail_id` (`detail_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1997 ;
DROP TABLE IF EXISTS `films_genres`;
CREATE TABLE IF NOT EXISTS `films_genres` (
`id` int(11) NOT NULL,
`ganre_id` int(11) NOT NULL,
PRIMARY KEY (`id`,`ganre_id`),
KEY `FK53D17E207069E578` (`id`),
KEY `FK53D17E2080004883` (`ganre_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
DROP TABLE IF EXISTS `films_languages`;
CREATE TABLE IF NOT EXISTS `films_languages` (
`id` int(11) NOT NULL,
`language_id` int(11) NOT NULL,
PRIMARY KEY (`id`,`language_id`),
KEY `FK3BCB4F4B7069E578` (`id`),
KEY `FK3BCB4F4BFB92EB93` (`language_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
DROP TABLE IF EXISTS `folders`;
CREATE TABLE IF NOT EXISTS `folders` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`folder` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `folder` (`folder`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=4 ;
DROP TABLE IF EXISTS `genres`;
CREATE TABLE IF NOT EXISTS `genres` (
`ganre_id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(255) DEFAULT NULL,
PRIMARY KEY (`ganre_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
DROP TABLE IF EXISTS `imdb_details`;
CREATE TABLE IF NOT EXISTS `imdb_details` (
`detail_id` int(11) NOT NULL AUTO_INCREMENT,
`alsoKnownAs` varchar(255) DEFAULT NULL,
`filmingLocations` varchar(255) DEFAULT NULL,
`imdbId` varchar(255) DEFAULT NULL,
`imdbUrl` varchar(255) DEFAULT NULL,
`localPoster` varchar(255) DEFAULT NULL,
`plotSimple` longtext,
`poster` varchar(255) DEFAULT NULL,
`rating` varchar(8) DEFAULT NULL,
`ratingCount` int(11) DEFAULT NULL,
`releaseDate` varchar(16) DEFAULT NULL,
`runtime` varchar(50) DEFAULT NULL,
`title` varchar(255) DEFAULT NULL,
`type` varchar(255) DEFAULT NULL,
`year` int(11) DEFAULT NULL,
PRIMARY KEY (`detail_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
DROP TABLE IF EXISTS `languages`;
CREATE TABLE IF NOT EXISTS `languages` (
`language_id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(255) DEFAULT NULL,
`short_name` varchar(255) DEFAULT NULL,
PRIMARY KEY (`language_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
DROP TABLE IF EXISTS `movies_actors`;
CREATE TABLE IF NOT EXISTS `movies_actors` (
`detail_id` int(11) NOT NULL,
`id` int(11) NOT NULL,
PRIMARY KEY (`detail_id`,`id`),
KEY `FK2D20C99A72B8F03D` (`id`),
KEY `FK2D20C99AAD5024E5` (`detail_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
DROP TABLE IF EXISTS `writers`;
CREATE TABLE IF NOT EXISTS `writers` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`fullName` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
ALTER TABLE `films`
ADD CONSTRAINT `films_ibfk_1` FOREIGN KEY (`detail_id`) REFERENCES `imdb_details` (`detail_id`) ON DELETE NO ACTION ON UPDATE CASCADE;
ALTER TABLE `films_genres`
ADD CONSTRAINT `FK53D17E207069E578` FOREIGN KEY (`id`) REFERENCES `films` (`id`),
ADD CONSTRAINT `FK53D17E2080004883` FOREIGN KEY (`ganre_id`) REFERENCES `genres` (`ganre_id`);
ALTER TABLE `films_languages`
ADD CONSTRAINT `FK3BCB4F4B7069E578` FOREIGN KEY (`id`) REFERENCES `films` (`id`),
ADD CONSTRAINT `FK3BCB4F4BFB92EB93` FOREIGN KEY (`language_id`) REFERENCES `languages` (`language_id`);
ALTER TABLE `movies_actors`
ADD CONSTRAINT `FK2D20C99A72B8F03D` FOREIGN KEY (`id`) REFERENCES `actors` (`id`),
ADD CONSTRAINT `FK2D20C99AAD5024E5` FOREIGN KEY (`detail_id`) REFERENCES `imdb_details` (`detail_id`);
| true |
116f4def61ee755f3ac5a7314236662953d4c612 | SQL | NikiYu812/regional-transformation | /sql/rt_heatingexpense.sql | UTF-8 | 11,518 | 2.890625 | 3 | [] | no_license | /*
Navicat MySQL Data Transfer
Source Server : localhost_3306
Source Server Version : 50605
Source Host : localhost:3306
Source Database : regional transformation
Target Server Type : MYSQL
Target Server Version : 50605
File Encoding : 65001
Date: 2017-09-12 09:58:27
*/
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for `rt_heatingexpense`
-- ----------------------------
DROP TABLE IF EXISTS `rt_heatingexpense`;
CREATE TABLE `rt_heatingexpense` (
`ID` varchar(255) NOT NULL,
`BuildingNo` varchar(255) DEFAULT NULL,
`OriginalTenant` varchar(255) DEFAULT NULL,
`Tel` varchar(255) DEFAULT NULL,
`ConstructionArea` varchar(255) DEFAULT NULL,
`PayOrNot` varchar(255) DEFAULT NULL,
`PublicExpenseArea` varchar(255) DEFAULT NULL,
`OwnExpenseArea` varchar(255) DEFAULT NULL,
`HeatingExpense` varchar(255) DEFAULT NULL,
`PaymentDate` varchar(255) DEFAULT NULL,
`remark` varchar(255) DEFAULT NULL,
PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of rt_heatingexpense
-- ----------------------------
INSERT INTO rt_heatingexpense VALUES ('1', '165栋-3号', '陈峰', '15602472171', '50.88', '1', '0', '50.88', '1185', '2016-11-2', '');
INSERT INTO rt_heatingexpense VALUES ('10', '219栋-4号', '刘金安', '18512437655', '52.98', '0', null, null, null, '', '');
INSERT INTO rt_heatingexpense VALUES ('11', '219栋-6号', '冯书全', '15040037667(大儿子);18512461937(小儿子)', '52.33', '0', null, null, null, '', '');
INSERT INTO rt_heatingexpense VALUES ('12', '219栋-8号', '徐忠瑞', '15640194575(女儿)', '52.24', '0', null, null, null, '', '');
INSERT INTO rt_heatingexpense VALUES ('13', '219栋-9号', '冯文章', '15524457133(妻子:芦)', '51.93', '0', null, null, null, '', '');
INSERT INTO rt_heatingexpense VALUES ('14', '219栋-11号', '孙洪禄', '15524376289', '52.13', '0', null, null, null, '', '');
INSERT INTO rt_heatingexpense VALUES ('15', '219栋-12号', '冯茂臣', '13940206976', '50.92', '0', null, null, null, '', '');
INSERT INTO rt_heatingexpense VALUES ('16', '220栋-2-2号', '程立铭', '', '20.42', '1', null, null, '530', '2016-10-29', '');
INSERT INTO rt_heatingexpense VALUES ('17', '8栋-4号', '姜永海', '13897909946(儿媳:赵秀杰)', '27.33', '0', null, null, null, '', '');
INSERT INTO rt_heatingexpense VALUES ('18', '8栋-5、6号', '张佐廷', '13418864575(张英杰)', '51.56', '1', '51.56', '0', '1340', '2016-11-2', '');
INSERT INTO rt_heatingexpense VALUES ('19', '14栋-1号', '何成才', '15698842888(何霞)', '56.88', '0', null, null, null, '', '');
INSERT INTO rt_heatingexpense VALUES ('2', '144栋-14号', '宋立辉', '18940012160', '50.88', '1', null, null, '1322', '2016-10-31', '');
INSERT INTO rt_heatingexpense VALUES ('20', '14栋-2号', '孟祥斌', '13624017127(卜宝琴)', '25.01', '0', null, null, null, '', '');
INSERT INTO rt_heatingexpense VALUES ('21', '36栋-2号', '齐延忠', '', '24.35', '0', null, null, null, '', '');
INSERT INTO rt_heatingexpense VALUES ('22', '44栋-3号', '连有权', '', '41.38', '1', null, null, '1075', '2016-10-29', '');
INSERT INTO rt_heatingexpense VALUES ('23', '127栋-3、4号', '杨久然', '13940224212(孙子:杨健)', '68.63', '0', null, null, null, '', '');
INSERT INTO rt_heatingexpense VALUES ('24', '127栋-7、8号', '陈文田', '13889213172(儿子:陈宏武)', '68.51', '0', null, null, null, null, '');
INSERT INTO rt_heatingexpense VALUES ('25', '137栋-1、2号', '杨兆甲', '13898851500', '68.01', '1', '68.01', '0', '1768', '2016-11-3', '');
INSERT INTO rt_heatingexpense VALUES ('26', '137栋-3、4号', '王东升', '13940159973', '68.32', '1', null, null, '1776', '2016-10-31', '');
INSERT INTO rt_heatingexpense VALUES ('27', '137栋-5、6号', '王澜钧', '13804011679(母亲:王澜钧)', '81.61', '0', null, null, null, '', '');
INSERT INTO rt_heatingexpense VALUES ('28', '137栋-8号', '符桂琴', '24285271', '58.01', '0', null, null, null, '', '');
INSERT INTO rt_heatingexpense VALUES ('29', '148栋-1、2号', '李德仁', '13238815481(妻子:马淑义)', '70.91', '1', null, null, '1652', '2016-10-30', '');
INSERT INTO rt_heatingexpense VALUES ('3', '144栋-15号', '刘永录', '18809845292(女儿)', '50.88', '0', null, null, null, '', '');
INSERT INTO rt_heatingexpense VALUES ('30', '148栋-3、4号', '曾继彦', '13840150255(妻子:韩桂凤)', '70.76', '1', '70.76', '0', '1839', '2016-11-2', '');
INSERT INTO rt_heatingexpense VALUES ('31', '148栋-5、6号', '曾传胜', '15524338357;15802499268', '84.52', '1', '84.52', '0', '2197', '2016-11-2', '');
INSERT INTO rt_heatingexpense VALUES ('32', '148栋-7、8号', '于晓明', '13238844939', '69.94', '1', null, null, '1724', '2016-10-31', '');
INSERT INTO rt_heatingexpense VALUES ('33', '148栋-9、10号', '宋炳和', '15653539968', '71.76', '0', null, null, null, '', '');
INSERT INTO rt_heatingexpense VALUES ('34', '149栋-1、2号', '胡广兴', '14704031888(儿子:胡志斌)', '70.09', '1', null, null, '1633', '2016-10-30', '');
INSERT INTO rt_heatingexpense VALUES ('35', '149栋-9、10号', '乔玄', '', '62.52', '1', null, null, '1595', '2016-10-29', '');
INSERT INTO rt_heatingexpense VALUES ('36', '176栋-6号', '马忠权', '13940069677(妻子:田英)', '40.82', '1', '0', '40.82', '951', '2016-11-3', '');
INSERT INTO rt_heatingexpense VALUES ('37', '176栋-8号', '尹燕祥', '13252898546', '70.29', '1', null, null, '1827', '2016-10-30', '');
INSERT INTO rt_heatingexpense VALUES ('38', '174栋-1号', '杨兵', '13516005887', '54.24', '1', null, null, '1410', '2016-10-29', '');
INSERT INTO rt_heatingexpense VALUES ('39', '163栋-1、2号', '谢鸿禄', '13555713506', '89.4', '1', '85', '4.400000000000006', '2312', '2016-10-29', '');
INSERT INTO rt_heatingexpense VALUES ('4', '205栋-2号', '韩文海', '13664103169', '81.75', '0', null, null, null, '', '');
INSERT INTO rt_heatingexpense VALUES ('40', '163栋-5、6号', '尹威', '13478186858', '53.93', '1', '53.93', '0', '1402', '2016-11-1', '');
INSERT INTO rt_heatingexpense VALUES ('41', '162栋-3号', '郑晓舰', '15040218787(兄弟:郑小兵)', '83.39', '1', '83.39', '0', '2168', '2016-11-3', '');
INSERT INTO rt_heatingexpense VALUES ('42', '161栋-3号', '刘文刚', '15840352127', '43.89', '1', '43.89', '0', '1141', '2016-11-2', '');
INSERT INTO rt_heatingexpense VALUES ('43', '152栋-4号', '吴斌', '13840408262', '74.51', '0', null, null, null, '', '');
INSERT INTO rt_heatingexpense VALUES ('44', '151栋-1号', '马永河', '24282468 ;13804016518', '65.04', '1', null, null, '1691', '2016-10-31', '');
INSERT INTO rt_heatingexpense VALUES ('45', '151栋-4号', '张国芝', '13644043668', '71.49', '1', null, null, '1858', '2016-10-30', '');
INSERT INTO rt_heatingexpense VALUES ('46', '150栋-4号', '石福顺', '', '33.57', '1', null, null, '872', '2016-10-29', '');
INSERT INTO rt_heatingexpense VALUES ('47', '142栋-7号', '程树堂', '', '32.2', '0', null, null, null, '', '');
INSERT INTO rt_heatingexpense VALUES ('48', '140栋-7号', '石俊山', '13889367606', '58.06', '0', null, null, null, '', '');
INSERT INTO rt_heatingexpense VALUES ('49', '131栋-2、3号', '刘凤禄', '', '44.66', '1', null, null, '1161', '2016-10-31', '');
INSERT INTO rt_heatingexpense VALUES ('5', '205栋-5号', '杨兆华', '13674232413', '81.75', '1', '0', '81.75', '1904', '2016-11-2', '');
INSERT INTO rt_heatingexpense VALUES ('50', '131栋-7号', '刘凤禄', '13654015568', '25.85', '0', null, null, null, '', '');
INSERT INTO rt_heatingexpense VALUES ('52', '131栋-10号', '桑自铮', '13998813505', '18', '1', null, null, '468', '2016-10-30', '');
INSERT INTO rt_heatingexpense VALUES ('53', '134栋-1号', '马维列', '15640573059(妻子:周兰)', '37.1', '0', null, null, null, '', '');
INSERT INTO rt_heatingexpense VALUES ('54', '133栋-3、4号', '胡邦雷', '17071017592', '66.55', '0', null, null, null, '', '');
INSERT INTO rt_heatingexpense VALUES ('55', '123栋-2号', '程立铭', '', '43.53', '1', null, null, '1131', '2016-10-29', '');
INSERT INTO rt_heatingexpense VALUES ('56', '123栋-3号', '孙大茂', '15640317822(妻子:李);24282542', '43.69', '1', '0', '43.69', '1017', '2016-11-2', '');
INSERT INTO rt_heatingexpense VALUES ('57', '171栋-1号', '姬阔周', '24286748', '68.86', '1', null, null, '1790', '2016-10-29', '');
INSERT INTO rt_heatingexpense VALUES ('58', '156-2栋-7号', '闫玉桓', '15940205028,13066517682', '49.93', '1', null, null, '1298', '2016-10-29', '');
INSERT INTO rt_heatingexpense VALUES ('59', '178栋-1号', '张连富', '13478851715', '68.92', '1', null, null, '1791', '2016-10-30', '');
INSERT INTO rt_heatingexpense VALUES ('6', '205栋-7号', '于洪振', '13889165389', '81.75', '0', null, null, null, '', '');
INSERT INTO rt_heatingexpense VALUES ('60', '183栋-1号', '杨兆甲', '13002481277', '39.16', '1', null, null, '912', '2016-10-31', '');
INSERT INTO rt_heatingexpense VALUES ('61', '182栋-3号', '梁桂华', '', '35.2', '0', null, null, null, '', '');
INSERT INTO rt_heatingexpense VALUES ('62', '181栋-3号', '车耀庄', '13664110965', '34.73', '1', null, null, '902', '2016-10-30', '');
INSERT INTO rt_heatingexpense VALUES ('63', '169栋3、4号', '赵锦凤', '13889867045', '74.98', '1', '74.98', '0', '1949', '2016-11-2', '');
INSERT INTO rt_heatingexpense VALUES ('64', '167栋-1号', '任雨苍', '13002497888', '73.61', '0', null, null, null, '', '');
INSERT INTO rt_heatingexpense VALUES ('65', '197栋-9号', '韩玉兰', '15542240016', '35.83', '0', null, null, null, '', '');
INSERT INTO rt_heatingexpense VALUES ('66', '197栋-22号', '景冈山', '18102455003(女儿:景红)', '36.62', '0', null, null, null, '', '');
INSERT INTO rt_heatingexpense VALUES ('67', '221栋-5号', '李伟英', '13889864556(外甥女)', '30.57', '0', null, null, null, '', '');
INSERT INTO rt_heatingexpense VALUES ('68', '221栋-12号', '李明', '出国无法联系', '39.06', '0', null, null, null, '', '');
INSERT INTO rt_heatingexpense VALUES ('69', '163栋-10、11号', '潘秀荣', '', '54.25', '1', null, null, '1410', '2016-10-29', '外户');
INSERT INTO rt_heatingexpense VALUES ('7', '205栋-8号', '曲长义', '13940393591', '81.75', '0', null, null, null, '', '');
INSERT INTO rt_heatingexpense VALUES ('70', '178栋-2号', '安云平', '', '55.52', '0', null, null, null, '', '外户');
INSERT INTO rt_heatingexpense VALUES ('71', '220栋-1号', '国晓东', '', '43.3', '0', null, null, null, '', '外户');
INSERT INTO rt_heatingexpense VALUES ('72', '221栋-11号', '姜平', '', '31.5', '0', null, null, null, '', '外户');
INSERT INTO rt_heatingexpense VALUES ('73', '144栋-10号', '徐景山', '', '50.88', '1', null, null, '1322', '2016-10-31', '已签协议');
INSERT INTO rt_heatingexpense VALUES ('77', '140栋-3号', '张成广', '15040089409;24282393', '55.44', '1', '55.44', '0', '1441', '2016-11-1', '');
INSERT INTO rt_heatingexpense VALUES ('78', '165栋-6号', '于海滨', '15840524478', '50.88', '1', '0', '50.88', '1185', '2016-11-2', '协议已签');
INSERT INTO rt_heatingexpense VALUES ('8', '206栋-3号', '于永学', '13149829658;24289270', '81.75', '1', '81.75', '0', '2125', '2016-11-3', '');
INSERT INTO rt_heatingexpense VALUES ('9', '206栋-6号', '张继光', '', '81.75', '0', null, null, null, '', '');
| true |
c06770b130b49bf38b626e1f72942a478f6f959e | SQL | asongulol/Pewlett-Hackard-Analysis | /Analysis_Projects_Folder/Pewlett-Hackard-Analysis-Folder/Queries/schema.sql | UTF-8 | 8,689 | 4.5 | 4 | [] | no_license | -- Creating tables for PH-EmployeeDB
-- Syntax goes like , CREATE TABLE "name_of_the_table" (
CREATE TABLE departments (
-- column_name type of data(length of data) NOT NULL,
dept_no VARCHAR(4) NOT NULL,
dept_name VARCHAR(40) NOT NULL,
-- define what is the primary key inside parentheses
PRIMARY KEY (dept_no),
-- UNIQUE keyword eliminates all duplicate records
UNIQUE (dept_name)
-- ); signals that the statement is complete
);
-- Highlight the code you want to run otherwise Postgres will run all the code again and give you an error
CREATE TABLE employees (
emp_no INT NOT NULL,
birth_date DATE NOT NULL,
first_name VARCHAR NOT NULL,
last_name VARCHAR NOT NULL,
gender VARCHAR NOT NULL,
hire_date DATE NOT NULL,
PRIMARY KEY (emp_no)
);
-- join two fields as primary key for example (emp_no, dept_no)
CREATE TABLE dept_manager (
dept_no VARCHAR(4) NOT NULL,
emp_no INT NOT NULL,
from_date DATE NOT NULL,
to_date DATE NOT NULL,
FOREIGN KEY (emp_no) REFERENCES employees (emp_no),
FOREIGN KEY (dept_no) REFERENCES departments (dept_no),
PRIMARY KEY (emp_no, dept_no)
);
CREATE TABLE salaries (
emp_no INT NOT NULL,
salary INT NOT NULL,
from_date DATE NOT NULL,
to_date DATE NOT NULL,
FOREIGN KEY (emp_no) REFERENCES employees (emp_no),
PRIMARY KEY (emp_no)
);
CREATE TABLE titles (
emp_no INT NOT NULL,
title VARCHAR NOT NULL,
from_date DATE NOT NULL,
to_date DATE NOT NULL,
FOREIGN KEY (emp_no) REFERENCES employees (emp_no),
PRIMARY KEY (emp_no, title, from_date)
);
-- FOLLOW THE LIST OF COLUMNS AS FOUND IN THE CSV FILE TO BE IMPORTED, IT MAKES A DIFFERENCE!!!!
CREATE TABLE dept_emp (
emp_no INT NOT NULL,
dept_no VARCHAR NOT NULL,
from_date DATE NOT NULL,
to_date DATE NOT NULL,
FOREIGN KEY (emp_no) REFERENCES employees (emp_no),
FOREIGN KEY (dept_no) REFERENCES departments (dept_no),
PRIMARY KEY (emp_no, dept_no)
);
-- WHEN IMPORTING MAKE SURE TO IMPORT IN THE CORRECT ORDER TO PREVENT ERRORS WHERE A KEY DOES NOT YET EXIST
-- DROP TABLE "TABLE_NAME" CASCADE; CASCADE ALSO DELETES CONNECTIONS TO OTHER TABLES
-- Any table that does not reference a foreign key can be dropped without the CASCADE constrain
SELECT * FROM dept_emp;
-- FIND OUT RETIRABLE EMPLOYEES
SELECT first_name, last_name
FROM employees
WHERE birth_date BETWEEN '1952-01-01' AND '1955-12-31';
-- FIND OUT COUNT OF RETIRABLE EMPLOYEES
-- Number of employees retiring
SELECT COUNT(first_name)
FROM employees
WHERE (birth_date BETWEEN '1952-01-01' AND '1955-12-31')
AND (hire_date BETWEEN '1985-01-01' AND '1988-12-31');
-- USING "INTO" COMMAND TO CREATE A NEW TABLE
SELECT first_name, last_name
INTO retirement_info
FROM employees
WHERE (birth_date BETWEEN '1952-01-01' AND '1955-12-31')
AND (hire_date BETWEEN '1985-01-01' AND '1988-12-31');
-- SEE WHAT THE NEW TABLE LOOKS LIKE
SELECT * FROM retirement_info;
SELECT first_name, last_name, title
FROM employees AS e
-- RECREATE retirement_info to include emp_no column
DROP TABLE retirement_info;
SELECT emp_no, first_name, last_name
INTO retirement_info
FROM employees
WHERE (birth_date BETWEEN '1952-01-01' AND '1955-12-31')
AND (hire_date BETWEEN '1985-01-01' AND '1988-12-31');
SELECT first_name, last_name, dept_no
FROM retirement_info
LEFT JOIN dept_emp
ON retirement_info.emp_no = dept_emp.emp_no
ORDER BY dept_no;
-- CHECK retirement_info
SELECT * FROM retirement_info;
-- Joining retirement_info and dept_emp tables
SELECT retirement_info.emp_no,
retirement_info.first_name,
retirement_info.last_name,
dept_emp.to_date
FROM retirement_info
LEFT JOIN dept_emp
ON retirement_info.emp_no = dept_emp.emp_no;
-- inner join of departments and dept_manager tables
SELECT d.dept_name,
dm.emp_no,
dm.from_date,
dm.to_date
FROM departments AS d
INNER JOIN dept_manager AS dm
ON d.dept_no = dm.dept_no;
-- Left Join for retirement_info and dept_emp tables
SELECT ri.emp_no,
ri.first_name,
ri.last_name,
de.to_date
INTO current_emp
FROM retirement_info AS ri
LEFT JOIN dept_emp AS de
ON ri.emp_no = de.emp_no
WHERE de.to_date = ('9999-01-01');
-- COUNT number still employed
SELECT COUNT(first_name)
FROM current_emp;
-- CHECK ALL NAMES OF CURRENT EMPLOYEES
SELECT first_name, last_name
FROM current_emp;
-- ORGANIZING USING GROUP BY
-- Employee count by department number (group by department)
SELECT COUNT(ce.emp_no), de.dept_no
FROM current_emp as ce
LEFT JOIN dept_emp as de
ON ce.emp_no = de.emp_no
GROUP BY de.dept_no;
-- using ORDER BY to sort Employee count by department number (group by department)
SELECT COUNT(ce.emp_no), de.dept_no
INTO dept_emp_count --save into another table for export
FROM current_emp as ce
LEFT JOIN dept_emp as de
ON ce.emp_no = de.emp_no
GROUP BY de.dept_no
ORDER BY de.dept_no;
--List # 1: Employee list
-- JOIN THREE TABLES:
-- 1) employees, 2) salaries and 3) dept_emp table
-- use INNER JOIN to show strict matching between three tables
-- use WHERE to filter retirable ages and hire dates
-- use WHERE to filter currently employed
SELECT e.emp_no,
e.first_name,
e.last_name,
e.gender,
s.salary,
de.to_date
INTO emp_info
FROM employees AS e
INNER JOIN salaries AS s --each join should have a join and on statements
ON (e.emp_no = s.emp_no)
INNER JOIN dept_emp AS de
ON (e.emp_no = de.emp_no)
WHERE (e.birth_date BETWEEN '1952-01-01' AND '1955-12-31')
AND (e.hire_date BETWEEN '1985-01-01' AND '1988-12-31')
AND (de.to_date = '9999-01-01');
--List # 2: Management list
-- JOIN THREE TABLES:
-- 1) managers -> dept_no, emp_no, from_date, to_date
-- 2) departments -> dept_no, dept_name
-- 3) employees -> last_name, first_name
-- use INNER JOIN to show strict matching between three tables
-- use WHERE to filter retirable ages and hire dates
-- use WHERE to filter currently employed
-- use WHERE to filter currently manager
-- List of managers per department
SELECT dm.dept_no,
d.dept_name,
dm.emp_no,
ce.last_name,
ce.first_name,
dm.from_date,
dm.to_date
INTO manager_info
FROM dept_manager AS dm
INNER JOIN departments AS d
ON (dm.dept_no = d.dept_no)
INNER JOIN current_emp AS ce
ON (dm.emp_no = ce.emp_no);
--TABLE 3:
SELECT ce.emp_no,
ce.first_name,
ce.last_name,
d.dept_name
INTO dept_info
FROM current_emp as ce
INNER JOIN dept_emp AS de
ON (ce.emp_no = de.emp_no)
INNER JOIN departments AS d
ON (de.dept_no = d.dept_no);
--RETIREMENT INFO FOR SALES AND DEVELOPMENT TEAM ONLY
-- ADD department to retirement_info table
SELECT ri.emp_no,
ri.last_name,
ri.first_name,
de.dept_no
INTO s_and_d_retirees
FROM retirement_info AS ri
LEFT JOIN dept_emp AS de
ON (ri.emp_no = de.emp_no)
--WHERE (de.dept_no = *) OR (de.dept_no = 'd007')
ORDER BY ri.last_name;
--ADD DEPARTMENT NAMES
SELECT sd.emp_no,
sd.last_name,
sd.first_name,
d.dept_name
FROM s_and_d_retirees AS sd
INNER JOIN departments AS d
ON (sd.dept_no = d.dept_no)
WHERE sd.dept_no IN ('d007', 'd005') --USE IN OPERATOR TO CHOOSE FROM A LIST
ORDER BY sd.last_name;
--##CHALLENGE##
--Deliverable 1: Number of Retiring Employees by Title
DROP TABLE retirement_list;
SELECT e.emp_no,
e.first_name,
e.last_name,
t.title,
t.from_date AS "title_from",
s.salary
INTO retirement_list
FROM employees AS e
INNER JOIN salaries AS s
ON (e.emp_no = s.emp_no)
INNER JOIN titles as t
ON (e.emp_no = t.emp_no)
WHERE (e.birth_date BETWEEN '1952-01-01' AND '1955-12-31')
AND (t.to_date = '9999-01-01');
--USING PARTITIONING AS RECOMMENDED BY THE MODULE
-- Partition the data to show only most recent title per employee
SELECT e.emp_no,
e.first_name,
e.last_name,
t.title,
t.from_date AS "title_from",
s.salary
INTO retirement_list_2
FROM employees AS e
INNER JOIN salaries AS s
ON (e.emp_no = s.emp_no)
INNER JOIN titles as t
ON (e.emp_no = t.emp_no)
WHERE (e.birth_date BETWEEN '1952-01-01' AND '1955-12-31');
--checking for duplicate emp_no
SELECT
emp_no,
count(*)
FROM retirement_list_2
GROUP BY
emp_no
HAVING count(*) > 1; -- results show duplicates
--without the filter AND (t.to_date = '9999-01-01')!
--show the duplicate rows with the data using PARTITION
SELECT emp_no,
last_name,
first_name,
title,
title_from,
salary
INTO retirement_list_using_partition
FROM
(SELECT *, count(*)
OVER
(PARTITION BY
emp_no
) AS count
FROM retirement_list_2) tableWithCount
WHERE tableWithCount.count > 1;
--Deliverable 2: Mentorship Eligibility
SELECT e.emp_no,
e.first_name,
e.last_name,
t.title,
t.from_date,
t.to_date
INTO mentor_list
FROM employees AS e
INNER JOIN titles AS t
ON (e.emp_no = t.emp_no)
WHERE (e.birth_date BETWEEN '1965-01-01' AND '1965-12-31')
AND (t.to_date = '9999-01-01');
| true |
b38bb6dcad2730137d6f76d57be95361d26bc453 | SQL | cmmgw/Pewlett-Hackard-Analysis | /Queries/queries.sql | UTF-8 | 5,210 | 4.21875 | 4 | [] | no_license | -- Creating tables for PH-EmployeeDB
-- Departments Table
CREATE TABLE departments (
dept_no VARCHAR(4) NOT NULL,
dept_name VARCHAR(40) NOT NULL,
PRIMARY KEY (dept_no),
UNIQUE (dept_name)
);
-- Employees Table
CREATE TABLE employees (
emp_no INT NOT NULL,
birth_date DATE NOT NULL,
first_name VARCHAR NOT NULL,
last_name VARCHAR NOT NULL,
gender VARCHAR NOT NULL,
hire_date DATE NOT NULL,
PRIMARY KEY (emp_no)
);
-- Department Managers Table
CREATE TABLE dept_manager (
dept_no VARCHAR(4) NOT NULL,
emp_no INT NOT NULL,
from_date DATE NOT NULL,
to_date DATE NOT NULL,
FOREIGN KEY (emp_no) REFERENCES employees (emp_no),
FOREIGN KEY (dept_no) REFERENCES departments (dept_no),
PRIMARY KEY (emp_no, dept_no)
);
-- Salaries Table
CREATE TABLE salaries (
emp_no INT NOT NULL,
salary INT NOT NULL,
from_date DATE NOT NULL,
to_date DATE NOT NULL,
FOREIGN KEY (emp_no) REFERENCES employees (emp_no),
PRIMARY KEY (emp_no)
);
-- Titles Table
CREATE TABLE titles (
emp_no INT NOT NULL,
title VARCHAR NOT NULL,
from_date DATE NOT NULL,
to_date DATE NOT NULL,
FOREIGN KEY (emp_no) REFERENCES employees (emp_no)
);
-- Department Employees Table
CREATE TABLE dept_emp (
emp_no INT NOT NULL,
dept_no VARCHAR(4) NOT NULL,
from_date DATE NOT NULL,
to_date DATE NOT NULL,
FOREIGN KEY (emp_no) REFERENCES employees (emp_no),
FOREIGN KEY (dept_no) REFERENCES departments (dept_no)
);
-- Verify that CSV files were imported in to corresponding tables
SELECT * FROM departments;
SELECT * FROM employees;
SELECT * FROM salaries;
SELECT * FROM dept_manager;
SELECT * FROM titles;
SELECT * FROM dept_emp;
-- Search for employees who were born between 1952 - 1955
SELECT first_name, last_name
FROM employees
WHERE birth_date BETWEEN '1952-01-01' AND '1955-12-31';
-- Search for employees who were born in 1952
SELECT first_name, last_name
FROM employees
WHERE birth_date BETWEEN '1952-01-01' AND '1952-12-31';
-- Search for employees who were born in 1953
SELECT first_name, last_name
FROM employees
WHERE birth_date BETWEEN '1953-01-01' AND '1953-12-31';
-- Search for employees who were born in 1954
SELECT first_name, last_name
FROM employees
WHERE birth_date BETWEEN '1954-01-01' AND '1954-12-31';
-- Search for employees who were born in 1955
SELECT first_name, last_name
FROM employees
WHERE birth_date BETWEEN '1955-01-01' AND '1955-12-31';
-- Retirement eligibility
SELECT first_name, last_name
FROM employees
WHERE (birth_date BETWEEN '1952-01-01' AND '1955-12-31')
AND (hire_date BETWEEN '1985-01-01' AND '1988-12-31');
-- Number of employees retiring
SELECT COUNT(first_name)
FROM employees
WHERE (birth_date BETWEEN '1952-01-01' AND '1955-12-31')
AND (hire_date BETWEEN '1985-01-01' AND '1988-12-31');
-- Create new table for retiring employees born between 1952 and 1955 and who were hired between 1985 and 1988
SELECT first_name, last_name
INTO retirement_info
FROM employees
WHERE (birth_date BETWEEN '1952-01-01' AND '1955-12-31')
AND (hire_date BETWEEN '1985-01-01' AND '1988-12-31');
SELECT * FROM retirement_info;
-- Drop retirement_info table
DROP TABLE retirement_info;
-- Create new table for retiring employees
SELECT emp_no, first_name, last_name
INTO retirement_info
FROM employees
WHERE (birth_date BETWEEN '1952-01-01' AND '1955-12-31')
AND (hire_date BETWEEN '1985-01-01' AND '1988-12-31');
-- Check the table
SELECT * FROM retirement_info;
-- Inner Join: Joining departments and dept_manager tables
SELECT departments.dept_name,
dept_manager.emp_no,
dept_manager.from_date,
dept_manager.to_date
FROM departments
INNER JOIN dept_manager
ON departments.dept_no = dept_manager.dept_no;
-- Left Join: Joining retirement_info and dept_emp tables
SELECT retirement_info.emp_no,
retirement_info.first_name,
retirement_info.last_name,
dept_emp.to_date
FROM retirement_info
LEFT JOIN dept_emp
ON retirement_info.emp_no = dept_emp.emp_no;
-- Using an Alias for code readability on the retirement_info table created above
SELECT ri.emp_no,
ri.first_name,
ri.last_name,
de.to_date
FROM retirement_info as ri
LEFT JOIN dept_emp as de
ON ri.emp_no = de.emp_no;
-- Using an Alias for code readability on the departments table created above
SELECT d.dept_name,
dm.emp_no,
dm.from_date,
dm.to_date
FROM departments as d
INNER JOIN dept_manager as dm
ON d.dept_no = dm.dept_no;
-- Create new table for current employees by using left join for retirement_info and dept_emp tables
SELECT ri.emp_no,
ri.first_name,
ri.last_name,
de.to_date
INTO current_emp
FROM retirement_info as ri
LEFT JOIN dept_emp as de
ON ri.emp_no = de.emp_no
WHERE de.to_date = ('9999-01-01');
-- Employee count by department number
SELECT COUNT(ce.emp_no), de.dept_no
FROM current_emp as ce
LEFT JOIN dept_emp as de
ON ce.emp_no = de.emp_no
GROUP BY de.dept_no;
-- Employee count by department number & create 'retirement_count' table
SELECT COUNT(ce.emp_no), de.dept_no
INTO retirement_count
FROM current_emp as ce
LEFT JOIN dept_emp as de
ON ce.emp_no = de.emp_no
GROUP BY de.dept_no
ORDER BY de.dept_no;
-- Check the table
SELECT * FROM retirement_count;
| true |
c82df1062972d702990722b1bf6a8f487a577a9e | SQL | robinsonmhj/codebase15-18 | /StockReport/database.sql | UTF-8 | 502 | 2.765625 | 3 | [] | no_license | create database finance;
drop table if exists finance.company;
create table finance.company(
id bigint NOT NULL AUTO_INCREMENT
symbol varchar(5) not null,
company_name varchar(50),
address1 varchar(100),
address2 varchar(20),
county varchar(20),
phone varchar(20),
website varchar(20),
sector varchar(20),
industry varchar(20),
primary key (id)
);
LOAD DATA INFILE 'C:\work\company.sql' INTO TABLE finance.company
FIELDS TERMINATED BY '||' LINES STARTING BY '' TERMINATED BY ';' ; | true |
e093d32cc6b6aae8a85fd7c36fc27de649538daf | SQL | VijayMVC/Synergy | /User/Debbie Ann Chavez/Pull Attendance Daily Half and Full Days with Details for Ashley.sql | UTF-8 | 201 | 2.875 | 3 | [] | no_license | SELECT SIS_NUMBER, STATE_STUDENT_NUMBER, SCHOOL_CODE, CAST(ABS_DATE AS DATE) AS ABS_DATE, [Half-Day Unexcused], [Full-Day Unexcused]
FROM
[APS].[Daily]('2016-05-25')
WHERE
SIS_NUMBER = 970035916 | true |
8aaca7b049c4f0ae9608f1b48569e511dcbee26a | SQL | Los-bocachicos/EGCONAplicaciones | /api/src/db/creacion_tabla_aplicaciones.sql | UTF-8 | 605 | 2.703125 | 3 | [] | no_license | CREATE DATABASE IF NOT EXISTS `evergreen`;
USE `evergreen`;
CREATE TABLE `evergreen`.`aplicaciones` (
`id` int NOT NULL AUTO_INCREMENT,
`nombre` varchar(100) NOT NULL,
`puerto` int DEFAULT NULL,
`estado` int DEFAULT NULL,
`tipo` int DEFAULT NULL,
`imagen` varchar(200) DEFAULT NULL,
`lenguaje` varchar(200) DEFAULT NULL,
`servidor` int DEFAULT NULL,
`version` varchar(45) DEFAULT NULL,
`fecha_creacion` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`fecha_actualizacion` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
) ENGINE=InnoDB;
| true |
40538ff6a9fdeff45c0287cc698d8d609a7b07db | SQL | cjungmann/sfw_new_enroll | /setup_files/procs_2_login.sql | UTF-8 | 10,529 | 3.796875 | 4 | [] | no_license | DELIMITER $$
-- -----------------------------------------------
DROP FUNCTION IF EXISTS App_User_Password_Is_Valid $$
CREATE FUNCTION App_User_Password_Is_Valid(id_user INT UNSIGNED, password VARCHAR(30))
RETURNS BOOLEAN
BEGIN
DECLARE pcount INT UNSIGNED;
SELECT COUNT(*) INTO pcount
FROM User u
INNER JOIN Salt s ON u.id = s.id_user
WHERE u.id = id_user
AND u.pword_hash = ssys_hash_password_with_salt(password, s.salt);
RETURN pcount=1;
END $$
-- ----------------------------------------------
DROP PROCEDURE IF EXISTS App_Internal_User_Password_Set $$
CREATE PROCEDURE App_Internal_User_Password_Set(user_id INT UNSIGNED, password VARCHAR(30))
BEGIN
DECLARE new_salt CHAR(32) DEFAULT make_randstr(32);
DECLARE scount INT UNSIGNED;
DECLARE new_hash BINARY(16) DEFAULT ssys_hash_password_with_salt(password, new_salt);
SELECT COUNT(*) INTO scount
FROM Salt
WHERE id_user = user_id;
IF scount = 0 THEN
INSERT INTO Salt (id_user, salt)
VALUES(user_id, new_salt);
UPDATE User
SET pword_hash = new_hash
WHERE id = user_id;
ELSE
UPDATE User u
INNER JOIN Salt s on u.id = s.id_user
SET s.salt = new_salt,
u.pword_hash = new_hash
WHERE u.id = user_id;
END IF;
END $$
-- ---------------------------------------
DROP PROCEDURE IF EXISTS App_User_Login $$
CREATE PROCEDURE App_User_Login(email VARCHAR(128), password VARCHAR(30))
proc_block: BEGIN
DECLARE user_id INT UNSIGNED;
IF NOT (ssys_current_session_is_valid()) THEN
SELECT 1 AS error, 'The session has expired.' AS msg;
LEAVE proc_block;
END IF;
SELECT u.id INTO user_id
FROM User u
WHERE u.email = email;
IF user_id IS NULL OR NOT(App_User_Password_Is_Valid(user_id, password)) THEN
SELECT 2 AS error, 'The login email or password is invalid.' AS msg;
LEAVE proc_block;
END IF;
CALL App_Session_Initialize(user_id);
SELECT 0 AS error;
END $$
-- ------------------------------------------
DROP PROCEDURE IF EXISTS App_User_Register $$
CREATE PROCEDURE App_User_Register(email VARCHAR(128), password VARCHAR(30))
proc_block: BEGIN
DECLARE email_count INT UNSIGNED;
DECLARE user_id INT UNSIGNED;
SELECT COUNT(*) INTO email_count
FROM User u
WHERE u.email = email;
IF email_count > 0 THEN
SELECT 1 AS error, 'This email is already in use.' AS msg;
LEAVE proc_block;
END IF;
INSERT INTO User (email)
VALUES(email);
IF ROW_COUNT() > 0 THEN
SELECT LAST_INSERT_ID() INTO user_id;
CALL App_Internal_User_Password_Set(user_id, password);
CALL App_Session_Initialize(user_id);
SELECT 0 AS error;
END IF;
END $$
-- ----------------------------------------
DROP PROCEDURE IF EXISTS App_User_Logout $$
CREATE PROCEDURE App_User_Logout()
BEGIN
CALL App_Session_Abandon(@session_confirmed_id);
SELECT 2 AS jump;
END $$
-- ---------------------------------------------------------
DROP PROCEDURE IF EXISTS App_User_Password_Request_Rescue $$
CREATE PROCEDURE App_User_Password_Request_Rescue(email VARCHAR(128))
BEGIN
DECLARE new_code CHAR(6) DEFAULT make_randstr(6);
DECLARE user_id INT UNSIGNED;
DECLARE new_expires DATETIME DEFAULT ADDTIME(NOW(),'0:20:0');
DECLARE attempts_allowed INT UNSIGNED DEFAULT 8;
DECLARE rowcount INT UNSIGNED;
SELECT u.id INTO user_id
FROM User u
WHERE u.email = email;
IF user_id IS NOT NULL THEN
UPDATE Password_Reset pw
SET pw.code = new_code,
pw.expires = new_expires,
pw.attempts_left = attempts_allowed
WHERE pw.id_user = user_id;
SELECT ROW_COUNT() INTO rowcount;
IF rowcount = 0 THEN
INSERT
INTO Password_Reset (id_user, code, email, expires, attempts_left)
VALUES (user_id,
new_code,
email,
new_expires,
attempts_allowed);
SELECT ROW_COUNT() INTO rowcount;
END IF;
IF rowcount = 0 THEN
SELECT 1 AS error, 'Password rescue code failed. Try again later.' AS msg;
ELSE
-- Use error=1 because error=0 goes to Home.srm
SELECT 1 AS error, 'Password rescue code will be sent to your email.' AS msg;
END IF;
ELSE
SELECT 1 AS error, 'That email is not recognized.' AS msg;
END IF;
END $$
-- ------------------------------------------------------
DROP PROCEDURE IF EXISTS App_User_Password_Rescue $$
CREATE PROCEDURE App_User_Password_Rescue(email VARCHAR(128),
code CHAR(6),
password VARCHAR(30))
BEGIN
DECLARE user_id INT UNSIGNED;
DECLARE saved_code CHAR(6);
DECLARE expires DATETIME;
DECLARE attempts_left INT UNSIGNED;
SELECT pr.id_user, pr.code, pr.expires, pr.attempts_left
INTO user_id, saved_code, expires, attempts_left
FROM Password_Reset pr
WHERE pr.email = email;
IF user_id IS NULL THEN
SELECT 1 AS error, 'Unrecognized email.' AS msg;
ELSEIF expires < NOW() OR attempts_left < 1 THEN
SELECT 1 AS error, 'Password rescue code has expired.' AS msg;
DELETE FROM pr USING Password_Reset AS pr
WHERE pr.id_user = user_id;
ELSEIF STRCMP(saved_code, code) THEN
SET attempts_left = attempts_left - 1;
IF attempts_left = 0 THEN
SELECT 1 AS error, 'Incorrect code. That was the final allowed attempt.' AS msg;
DELETE FROM pr USING Password_Reset AS pr
WHERE pr.id_user = user_id;
ELSE
SELECT 1 AS error, CONCAT('Incorrect code. ', attempts_left, ' attempts remaining.') AS msg;
UPDATE Password_Reset pr
SET pr.attempts_left = attempts_left
WHERE pr.id_user = user_id;
END IF;
ELSE
CALL App_Internal_User_Password_Set(user_id, password);
SELECT 0 AS error, 'Password set.' AS msg;
DELETE FROM pr USING Password_Reset AS pr
WHERE pr.id_user = user_id;
END IF;
END $$
-- -------------------------------------------------
DROP PROCEDURE IF EXISTS App_User_Password_Change $$
CREATE PROCEDURE App_User_Password_Change(original VARCHAR(30),
new_password VARCHAR(30))
BEGIN
DECLARE user_id INT UNSIGNED;
SELECT u.id INTO user_id
FROM User u
INNER JOIN Salt s ON u.id = s.id_user
WHERE u.pword_hash = ssys_hash_password_with_salt(original, s.salt);
IF user_id IS NULL THEN
SELECT 1 AS error, 'Incorrect password.' AS msg;
ELSE
CALL App_Internal_User_Password_Set(user_id, new_password);
SELECT 0 AS error, 'Password changed.' AS msg;
END IF;
END $$
-- ----------------------------------------------------
DROP PROCEDURE IF EXISTS App_Password_Rescues_To_Send $$
CREATE PROCEDURE App_Password_Rescues_To_Send()
BEGIN
SELECT id_user, email, code
FROM Password_Reset
WHERE emailed IS NULL;
END $$
-- -------------------------------------------------
DROP PROCEDURE IF EXISTS App_Password_Rescues_Sent $$
CREATE PROCEDURE App_Password_Rescues_Sent(ids_sent TEXT)
BEGIN
DECLARE dnow DATETIME DEFAULT NOW();
CALL ssys_make_SFW_IntTable_from_list(ids_sent);
UPDATE Password_Reset
SET emailed = dnow
WHERE id_user IN (SELECT val FROM SFW_IntTable);
DROP TABLE SFW_IntTable;
END $$
-- --------------------------------------------------------
-- Procedures follow for application method of registration
-- --------------------------------------------------------
-- ---------------------------------------------------
-- Procedure to be used with a time-trigger.
-- ---------------------------------------------------
DROP PROCEDURE IF EXISTS App_User_Applicant_Cleanup $$
CREATE PROCEDURE App_User_Applicant_Cleanup()
BEGIN
DELETE FROM Applicant
WHERE expires > NOW();
END $$
-- ---------------------------------------------
DROP PROCEDURE IF EXISTS App_User_Application $$
CREATE PROCEDURE App_User_Application(email VARCHAR(128))
BEGIN
DECLARE ucount INT UNSIGNED;
SELECT COUNT(*) INTO ucount
FROM User u
WHERE u.email = email;
IF ucount = 0 THEN
INSERT INTO Application(email, expires, code)
VALUES(email,
ADDTIME(NOW(), '0:20:0'),
make_randstr(20));
IF ROW_COUNT() = 1 THEN
SELECT 0 AS error;
ELSE
SELECT 1 AS error, 'There was a problem adding your application.' AS msg;
END IF;
END IF;
END $$
-- -------------------------------------------------------
DROP PROCEDURE IF EXISTS App_Application_Emails_To_Send $$
CREATE PROCEDURE App_Application_Emails_To_Send()
BEGIN
DECLARE enow DATETIME DEFAULT NOW();
DELETE FROM Application
WHERE expires < enow;
SELECT id, email, code
FROM Application
WHERE emailed IS NULL;
END $$
-- ----------------------------------------------------
DROP PROCEDURE IF EXISTS App_Application_Emails_Sent $$
CREATE PROCEDURE App_Application_Emails_Sent(emails_send TEXT)
BEGIN
DECLARE dnow DATETIME DEFAULT NOW();
CALL ssys_make_SFW_IntTable_from_list(ids_sent);
UPDATE Application
SET emailed = dnow
WHERE id IN (SELECT val FROM SFW_IntTable);
DROP TABLE SFW_IntTable;
END $$
-- --------------------------------------------------
DROP PROCEDURE IF EXISTS App_User_Application_Confirm $$
CREATE PROCEDURE App_User_Application_Confirm(id INT UNSIGNED,
email VARCHAR(128),
code CHAR(20),
password VARCHAR(30))
BEGIN
DECLARE user_id INT UNSIGNED;
DECLARE acount INT UNSIGNED;
SELECT COUNT(*) INTO acount
FROM Application a
WHERE a.id = id
AND a.email = email
AND a.code = code;
IF acount = 1 THEN
INSERT INTO User(email)
SELECT a.email
FROM Application a
WHERE a.id = id;
IF ROW_COUNT() > 0 THEN
SELECT LAST_INSERT_ID() INTO user_id;
CALL App_Internal_User_Password_Set(user_id, password);
CALL App_Session_Initialize(user_id);
DELETE FROM a
USING Application AS a
WHERE a.id = id;
SELECT 0 AS error;
ELSE
SELECT 1 AS error, 'Failed to add user record.' AS msg;
END IF;
ELSE
SELECT 1 AS error, 'Unrecognized registration credentials.' AS msg;
END IF;
END $$
DELIMITER ;
| true |
4480077d5363743766674a35fb5ba7bc6997be61 | SQL | maxabelardo/comandos | /ORACLE - Scripts SQL do dia a dia/Scripts Uteis - Retorna o tamanho das tabelas da database.sql | UTF-8 | 972 | 4.34375 | 4 | [] | no_license | /*
Lista todas as tabelas e suas metricas: tamanho do dados, tamanho do index, total de linhas
*/
SELECT TB.OWNER
, TB.TABLE_NAME
, NVL(min(NUM_ROWS),0) NUM_ROWS
, ROUND(sum(TB.DATA_KB),2) DATA_KB
, ROUND(sum(IX.INDX_KB),2) INDX_KB
, ROUND(sum(IX.INDX_KB + TB.DATA_KB ),2) RESERVED_KB
FROM (SELECT T.OWNER
, T.TABLE_NAME
, t.NUM_ROWS
, S.BYTES / 1024 AS DATA_KB
FROM ALL_TABLES T
INNER JOIN DBA_SEGMENTS S ON T.TABLE_NAME = S.segment_name
WHERE T.OWNER NOT IN('SYS','SYSTEM','SYSMAN')) TB
INNER JOIN (SELECT I.OWNER
, I.INDEX_NAME
, I.TABLE_NAME
, S.BYTES / 1024 AS INDX_KB
FROM ALL_INDEXES I
INNER JOIN DBA_SEGMENTS S ON I.INDEX_NAME = S.SEGMENT_NAME
WHERE I.OWNER NOT IN('SYS','SYSTEM','SYSMAN')) IX ON IX.OWNER = TB.OWNER AND IX.TABLE_NAME = TB.TABLE_NAME
GROUP BY TB.OWNER, TB.TABLE_NAME | true |
7672d8580afe706723af4e7feca2346efc199a02 | SQL | radtek/abs3 | /sql/mmfo/bars/Data/tts/et_tm5.sql | WINDOWS-1251 | 13,952 | 2.953125 | 3 | [] | no_license | set lines 1000
set trimspool on
set serveroutput on size 1000000
prompt / TM5
prompt : TM5/ ()
declare
cnt_ number;
begin
--------------------------------
-- --
--------------------------------
begin
insert into tts(tt, name, dk, nlsm, kv, nlsk, kvk, nlss, nlsa, nlsb, mfob, flc, fli, flv, flr, s, s2, sk, proc, s3800, rang, flags, nazn)
values ('TM5', 'TM5/ ()', 1, null, null, null, 980, null, null, '#(BRANCH_USR.GET_BRANCH_PARAM2(''CASH'',0))', null, 0, 0, 1, 0, '#(BM__K)*#(BM__U)', '#(BM__K)*#(BM__R)', 61, null, '#(nbs_ob22 (''3800'',''09''))', null, '0000100001000001000000000000000000010000000000000000000000010000', ' : #(BM__N) #(BM__K) .');
exception
when dup_val_on_index then
update tts
set tt='TM5', name='TM5/ ()', dk=1, nlsm=null, kv=null, nlsk=null, kvk=980, nlss=null, nlsa=null, nlsb='#(BRANCH_USR.GET_BRANCH_PARAM2(''CASH'',0))', mfob=null, flc=0, fli=0, flv=1, flr=0, s='#(BM__K)*#(BM__U)', s2='#(BM__K)*#(BM__R)', sk=61, proc=null, s3800='#(nbs_ob22 (''3800'',''09''))', rang=null, flags='0000100001000001000000000000000000010000000000000000000000010000', nazn=' : #(BM__N) #(BM__K) .'
where tt='TM5';
end;
--------------------------------
----------- ----------
--------------------------------
delete from op_rules where tt='TM5';
begin
insert into op_rules(TAG, TT, OPT, USED4INPUT, ORD, VAL, NOMODIFY)
values ('ADRES', 'TM5', 'O', 1, 11, null, null);
exception
when dup_val_on_index then null;
when others then
if ( sqlcode = -02291 ) then
dbms_output.put_line(' (op_rules: ''ADRES'', ''TM5'', ''O'', 1, 11, null, null) - !');
else raise;
end if;
end;
begin
insert into op_rules(TAG, TT, OPT, USED4INPUT, ORD, VAL, NOMODIFY)
values ('ATRT ', 'TM5', 'O', 1, 9, null, null);
exception
when dup_val_on_index then null;
when others then
if ( sqlcode = -02291 ) then
dbms_output.put_line(' (op_rules: ''ATRT '', ''TM5'', ''O'', 1, 9, null, null) - !');
else raise;
end if;
end;
begin
insert into op_rules(TAG, TT, OPT, USED4INPUT, ORD, VAL, NOMODIFY)
values ('BM__C', 'TM5', 'M', 1, 1, null, null);
exception
when dup_val_on_index then null;
when others then
if ( sqlcode = -02291 ) then
dbms_output.put_line(' (op_rules: ''BM__C'', ''TM5'', ''M'', 1, 1, null, null) - !');
else raise;
end if;
end;
begin
insert into op_rules(TAG, TT, OPT, USED4INPUT, ORD, VAL, NOMODIFY)
values ('BM__K', 'TM5', 'M', 1, 5, null, null);
exception
when dup_val_on_index then null;
when others then
if ( sqlcode = -02291 ) then
dbms_output.put_line(' (op_rules: ''BM__K'', ''TM5'', ''M'', 1, 5, null, null) - !');
else raise;
end if;
end;
begin
insert into op_rules(TAG, TT, OPT, USED4INPUT, ORD, VAL, NOMODIFY)
values ('BM__N', 'TM5', 'M', 1, 2, null, null);
exception
when dup_val_on_index then null;
when others then
if ( sqlcode = -02291 ) then
dbms_output.put_line(' (op_rules: ''BM__N'', ''TM5'', ''M'', 1, 2, null, null) - !');
else raise;
end if;
end;
begin
insert into op_rules(TAG, TT, OPT, USED4INPUT, ORD, VAL, NOMODIFY)
values ('BM__R', 'TM5', 'M', 1, 3, null, null);
exception
when dup_val_on_index then null;
when others then
if ( sqlcode = -02291 ) then
dbms_output.put_line(' (op_rules: ''BM__R'', ''TM5'', ''M'', 1, 3, null, null) - !');
else raise;
end if;
end;
begin
insert into op_rules(TAG, TT, OPT, USED4INPUT, ORD, VAL, NOMODIFY)
values ('BM__U', 'TM5', 'M', 1, 4, null, null);
exception
when dup_val_on_index then null;
when others then
if ( sqlcode = -02291 ) then
dbms_output.put_line(' (op_rules: ''BM__U'', ''TM5'', ''M'', 1, 4, null, null) - !');
else raise;
end if;
end;
begin
insert into op_rules(TAG, TT, OPT, USED4INPUT, ORD, VAL, NOMODIFY)
values ('D#73 ', 'TM5', 'M', 0, 17, '261', null);
exception
when dup_val_on_index then null;
when others then
if ( sqlcode = -02291 ) then
dbms_output.put_line(' (op_rules: ''D#73 '', ''TM5'', ''M'', 0, 17, ''261'', null) - !');
else raise;
end if;
end;
begin
insert into op_rules(TAG, TT, OPT, USED4INPUT, ORD, VAL, NOMODIFY)
values ('DT_R ', 'TM5', 'O', 1, 10, null, null);
exception
when dup_val_on_index then null;
when others then
if ( sqlcode = -02291 ) then
dbms_output.put_line(' (op_rules: ''DT_R '', ''TM5'', ''O'', 1, 10, null, null) - !');
else raise;
end if;
end;
begin
insert into op_rules(TAG, TT, OPT, USED4INPUT, ORD, VAL, NOMODIFY)
values ('FIO ', 'TM5', 'O', 1, 6, null, null);
exception
when dup_val_on_index then null;
when others then
if ( sqlcode = -02291 ) then
dbms_output.put_line(' (op_rules: ''FIO '', ''TM5'', ''O'', 1, 6, null, null) - !');
else raise;
end if;
end;
begin
insert into op_rules(TAG, TT, OPT, USED4INPUT, ORD, VAL, NOMODIFY)
values ('KODPL', 'TM5', 'O', 1, 13, null, null);
exception
when dup_val_on_index then null;
when others then
if ( sqlcode = -02291 ) then
dbms_output.put_line(' (op_rules: ''KODPL'', ''TM5'', ''O'', 1, 13, null, null) - !');
else raise;
end if;
end;
begin
insert into op_rules(TAG, TT, OPT, USED4INPUT, ORD, VAL, NOMODIFY)
values ('KOD_B', 'TM5', 'O', 0, 14, '25', null);
exception
when dup_val_on_index then null;
when others then
if ( sqlcode = -02291 ) then
dbms_output.put_line(' (op_rules: ''KOD_B'', ''TM5'', ''O'', 0, 14, ''25'', null) - !');
else raise;
end if;
end;
begin
insert into op_rules(TAG, TT, OPT, USED4INPUT, ORD, VAL, NOMODIFY)
values ('KOD_G', 'TM5', 'O', 0, 15, '804', null);
exception
when dup_val_on_index then null;
when others then
if ( sqlcode = -02291 ) then
dbms_output.put_line(' (op_rules: ''KOD_G'', ''TM5'', ''O'', 0, 15, ''804'', null) - !');
else raise;
end if;
end;
begin
insert into op_rules(TAG, TT, OPT, USED4INPUT, ORD, VAL, NOMODIFY)
values ('KOD_N', 'TM5', 'O', 0, 16, '2343001', null);
exception
when dup_val_on_index then null;
when others then
if ( sqlcode = -02291 ) then
dbms_output.put_line(' (op_rules: ''KOD_N'', ''TM5'', ''O'', 0, 16, ''2343001'', null) - !');
else raise;
end if;
end;
begin
insert into op_rules(TAG, TT, OPT, USED4INPUT, ORD, VAL, NOMODIFY)
values ('NATIO', 'TM5', 'O', 1, 12, null, null);
exception
when dup_val_on_index then null;
when others then
if ( sqlcode = -02291 ) then
dbms_output.put_line(' (op_rules: ''NATIO'', ''TM5'', ''O'', 1, 12, null, null) - !');
else raise;
end if;
end;
begin
insert into op_rules(TAG, TT, OPT, USED4INPUT, ORD, VAL, NOMODIFY)
values ('PASP ', 'TM5', 'O', 1, 7, null, null);
exception
when dup_val_on_index then null;
when others then
if ( sqlcode = -02291 ) then
dbms_output.put_line(' (op_rules: ''PASP '', ''TM5'', ''O'', 1, 7, null, null) - !');
else raise;
end if;
end;
begin
insert into op_rules(TAG, TT, OPT, USED4INPUT, ORD, VAL, NOMODIFY)
values ('PASPN', 'TM5', 'O', 1, 8, null, null);
exception
when dup_val_on_index then null;
when others then
if ( sqlcode = -02291 ) then
dbms_output.put_line(' (op_rules: ''PASPN'', ''TM5'', ''O'', 1, 8, null, null) - !');
else raise;
end if;
end;
begin
insert into op_rules(TAG, TT, OPT, USED4INPUT, ORD, VAL, NOMODIFY)
values ('REZID', 'TM5', 'M', 0, 11, null, null);
exception
when dup_val_on_index then null;
when others then
if ( sqlcode = -02291 ) then
dbms_output.put_line(' (op_rules: ''REZID'', ''TM5'', ''M'', 0, 11, null, null) - !');
else raise;
end if;
end;
--------------------------------
------ ------
--------------------------------
delete from ttsap where tt='TM5';
--------------------------------
------- -------
--------------------------------
delete from ps_tts where tt='TM5';
begin
insert into ps_tts(nbs, tt, dk)
values ('1001', 'TM5', 1);
exception
when dup_val_on_index then null;
when others then
if ( sqlcode = -02291 ) then
dbms_output.put_line(' (ps_tts: ''1001'', ''TM5'', 1) - !');
else raise;
end if;
end;
begin
insert into ps_tts(nbs, tt, dk)
values ('1002', 'TM5', 1);
exception
when dup_val_on_index then null;
when others then
if ( sqlcode = -02291 ) then
dbms_output.put_line(' (ps_tts: ''1002'', ''TM5'', 1) - !');
else raise;
end if;
end;
begin
insert into ps_tts(nbs, tt, dk)
values ('1101', 'TM5', 0);
exception
when dup_val_on_index then null;
when others then
if ( sqlcode = -02291 ) then
dbms_output.put_line(' (ps_tts: ''1101'', ''TM5'', 0) - !');
else raise;
end if;
end;
begin
insert into ps_tts(nbs, tt, dk)
values ('1102', 'TM5', 0);
exception
when dup_val_on_index then null;
when others then
if ( sqlcode = -02291 ) then
dbms_output.put_line(' (ps_tts: ''1102'', ''TM5'', 0) - !');
else raise;
end if;
end;
--------------------------------
-------- -------
--------------------------------
delete from tts_vob where tt='TM5';
begin
insert into tts_vob(vob, tt, ord)
values (133, 'TM5', null);
exception
when dup_val_on_index then null;
when others then
if ( sqlcode = -02291 ) then
dbms_output.put_line(' (tts_vob: 133, ''TM5'', null) - !');
else raise;
end if;
end;
--------------------------------
-------- -------
--------------------------------
delete from chklist_tts where tt='TM5';
begin
insert into chklist_tts(idchk, tt, priority, f_big_amount, sqlval, f_in_charge)
values (5, 'TM5', 1, null, null, null);
exception
when dup_val_on_index then null;
when others then
if ( sqlcode = -02291 ) then
dbms_output.put_line(' (chklist_tts: 5, ''TM5'', 1, null, null, null) - !');
else raise;
end if;
end;
--------------------------------
------------- ------------
--------------------------------
delete from folders_tts where tt='TM5';
begin
insert into folders_tts(idfo, tt)
values (40, 'TM5');
exception
when dup_val_on_index then null;
when others then
if ( sqlcode = -02291 ) then
dbms_output.put_line(' (folders_tts: 40, ''TM5'') - !');
else raise;
end if;
end;
end;
/
commit;
| true |
61a63ea0065987264ed0e9fa4402c142a9902ec7 | SQL | ganeshbabuNN/Databases | /RDMS/Oracle Database/RegularExpression_REGEXP_INSTR_HoldSix+DigitsPincode.sql | UTF-8 | 841 | 3.609375 | 4 | [] | no_license | --view
drop view vlocations;
create view vlocations as
select location_id, Street_address || ','|| postal_code Address from locations;
--address holds either hold a four digits or a four +five digits pincode along with address
select location_id,Address,
regexp_INSTR (Address,'[[:digit:]]{6}(-[[:digit:]]{7})?$') pincodePosition from vlocations;
/*
[[:digit:]]- Indicates only the digits,
[[:digit:]]{6}-indicates 6 consecutive digits
[[:digit:]]{6}(-[[:digit:]]{7})?$- indicates a string that ends with 6 consecutive digits OR a string that ends with nine consecutive digits,
the sub-expression(-[[:digit:]]{7}) is repeated zero or one time, as indicated by the ? repetition operator,
this means the string may end with four digits pincode or a nine [6+7] digit pincode. this is possible as the sub-expression may or may not repeat
*/
| true |
71af017a9bb096a2466f5f358c9bddcd4dd55ee3 | SQL | diegolt8/ProyectoFinalBack | /Resource/farmacia.sql | UTF-8 | 37,227 | 2.96875 | 3 | [] | no_license | -- phpMyAdmin SQL Dump
-- version 4.9.2
-- https://www.phpmyadmin.net/
--
-- Servidor: 127.0.0.1:3306
-- Tiempo de generación: 28-05-2020 a las 02:11:26
-- Versión del servidor: 10.4.10-MariaDB
-- Versión de PHP: 7.3.12
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Base de datos: `farmacia`
--
DELIMITER $$
--
-- Procedimientos
--
DROP PROCEDURE IF EXISTS `history`$$
CREATE DEFINER=`root`@`localhost` PROCEDURE `history` (`vid` INT) BEGIN
SELECT *
FROM sale
WHERE client_id = vid;
END$$
DROP PROCEDURE IF EXISTS `listcity`$$
CREATE DEFINER=`root`@`localhost` PROCEDURE `listcity` (`vid` INT) BEGIN
SELECT id, name, description, department_id
FROM city
order by id;
END$$
DROP PROCEDURE IF EXISTS `listclient`$$
CREATE DEFINER=`root`@`localhost` PROCEDURE `listclient` (`vid` INT) BEGIN
SELECT id, name, lastname, documenttype, documentnumber, gender, age, birthdate, points, password, rol_id, city_id, admissiondate
FROM user
WHERE rol_id = 3
order by id;
END$$
DROP PROCEDURE IF EXISTS `listdepartment`$$
CREATE DEFINER=`root`@`localhost` PROCEDURE `listdepartment` (`vid` INT) BEGIN
SELECT id, name, description
FROM department
order by id;
END$$
DROP PROCEDURE IF EXISTS `listemployee`$$
CREATE DEFINER=`root`@`localhost` PROCEDURE `listemployee` (`vid` INT) BEGIN
SELECT id, name, lastname, documenttype, documentnumber, gender, age, birthdate, points, password, rol_id, city_id, admissiondate
FROM user
WHERE rol_id = 1
order by id;
END$$
DROP PROCEDURE IF EXISTS `listinventory`$$
CREATE DEFINER=`root`@`localhost` PROCEDURE `listinventory` (`vid` INT) BEGIN
SELECT id, milligrams,name,
description,
admissiondate,
expirationdate,
lotecode,
quantity,
price,
provider_id,
shelf_id,
typeproduct_id,
laboratory_id,
status_id,
imagen
FROM inventory
order by id;
END$$
DROP PROCEDURE IF EXISTS `listlaboratory`$$
CREATE DEFINER=`root`@`localhost` PROCEDURE `listlaboratory` (`vid` INT) BEGIN
SELECT id, name, description
FROM laboratory
order by id;
END$$
DROP PROCEDURE IF EXISTS `listpharmacy`$$
CREATE DEFINER=`root`@`localhost` PROCEDURE `listpharmacy` (`vid` INT) BEGIN
SELECT id, name, imagen, nit
FROM pharmacy
order by id;
END$$
DROP PROCEDURE IF EXISTS `listprovider`$$
CREATE DEFINER=`root`@`localhost` PROCEDURE `listprovider` (`vid` INT) BEGIN
SELECT id, name, nit, address, city_id
FROM provider
order by id;
END$$
DROP PROCEDURE IF EXISTS `listrol`$$
CREATE DEFINER=`root`@`localhost` PROCEDURE `listrol` (`vid` INT) BEGIN
SELECT id, name, description
FROM rol
order by id;
END$$
DROP PROCEDURE IF EXISTS `listshelf`$$
CREATE DEFINER=`root`@`localhost` PROCEDURE `listshelf` (`vid` INT) BEGIN
SELECT id, name, description
FROM shelf
order by id;
END$$
DROP PROCEDURE IF EXISTS `liststate`$$
CREATE DEFINER=`root`@`localhost` PROCEDURE `liststate` (`vid` INT) BEGIN
SELECT id, name
FROM state
order by id;
END$$
DROP PROCEDURE IF EXISTS `listtypeproduct`$$
CREATE DEFINER=`root`@`localhost` PROCEDURE `listtypeproduct` (`vid` INT) BEGIN
SELECT id, name, description
FROM typeproduct
order by id;
END$$
DROP PROCEDURE IF EXISTS `listuser`$$
CREATE DEFINER=`root`@`localhost` PROCEDURE `listuser` (`vid` INT) BEGIN
SELECT id, name, lastname, documenttype, documentnumber, gender, age, birthdate, points, password, rol_id, city_id, admissiondate
FROM user
order by id;
END$$
DROP PROCEDURE IF EXISTS `totalsale`$$
CREATE DEFINER=`root`@`localhost` PROCEDURE `totalsale` (`vid` INT, `vquantity` INT) BEGIN
SELECT price * vquantity as total
FROM inventory
where id = vid;
END$$
--
-- Funciones
--
DROP FUNCTION IF EXISTS `deletecity`$$
CREATE DEFINER=`root`@`localhost` FUNCTION `deletecity` (`vid` INT) RETURNS INT(1) READS SQL DATA
DETERMINISTIC
COMMENT 'funcion que elimina una ciudad'
BEGIN
declare res int default 0;
delete from city where id = vid;
set res = 1;
return res;
RETURN 1;
END$$
DROP FUNCTION IF EXISTS `deletedepartment`$$
CREATE DEFINER=`root`@`localhost` FUNCTION `deletedepartment` (`vid` INT) RETURNS INT(1) READS SQL DATA
DETERMINISTIC
COMMENT 'funcion que elimina una departamento'
BEGIN
declare res int default 0;
delete from department where id = vid;
set res = 1;
return res;
RETURN 1;
END$$
DROP FUNCTION IF EXISTS `deleteinventory`$$
CREATE DEFINER=`root`@`localhost` FUNCTION `deleteinventory` (`vid` INT) RETURNS INT(1) READS SQL DATA
DETERMINISTIC
COMMENT 'funcion que elimina un producto'
BEGIN
declare res int default 0;
delete from inventory where id = vid;
set res = 1;
return res;
RETURN 1;
END$$
DROP FUNCTION IF EXISTS `deletelaboratory`$$
CREATE DEFINER=`root`@`localhost` FUNCTION `deletelaboratory` (`vid` INT) RETURNS INT(1) READS SQL DATA
DETERMINISTIC
COMMENT 'funcion que elimina una ciudad'
BEGIN
declare res int default 0;
delete from laboratory where id = vid;
set res = 1;
return res;
RETURN 1;
END$$
DROP FUNCTION IF EXISTS `deletepharmacy`$$
CREATE DEFINER=`root`@`localhost` FUNCTION `deletepharmacy` (`vid` INT) RETURNS INT(1) READS SQL DATA
DETERMINISTIC
COMMENT 'funcion que elimina una farmacia'
BEGIN
declare res int default 0;
delete from pharmacy where id = vid;
set res = 1;
return res;
RETURN 1;
END$$
DROP FUNCTION IF EXISTS `deleteprovider`$$
CREATE DEFINER=`root`@`localhost` FUNCTION `deleteprovider` (`vid` INT) RETURNS INT(1) READS SQL DATA
DETERMINISTIC
COMMENT 'funcion que elimina un proveedor'
BEGIN
declare res int default 0;
delete from provider where id = vid;
set res = 1;
return res;
RETURN 1;
END$$
DROP FUNCTION IF EXISTS `deleterol`$$
CREATE DEFINER=`root`@`localhost` FUNCTION `deleterol` (`vid` INT) RETURNS INT(1) READS SQL DATA
DETERMINISTIC
COMMENT 'funcion que elimina una ciudad'
BEGIN
declare res int default 0;
delete from rol where id = vid;
set res = 1;
return res;
RETURN 1;
END$$
DROP FUNCTION IF EXISTS `deleteshelf`$$
CREATE DEFINER=`root`@`localhost` FUNCTION `deleteshelf` (`vid` INT) RETURNS INT(1) READS SQL DATA
DETERMINISTIC
COMMENT 'funcion que elimina una ciudad'
BEGIN
declare res int default 0;
delete from shelf where id = vid;
set res = 1;
return res;
RETURN 1;
END$$
DROP FUNCTION IF EXISTS `deletestate`$$
CREATE DEFINER=`root`@`localhost` FUNCTION `deletestate` (`vid` INT) RETURNS INT(1) READS SQL DATA
DETERMINISTIC
COMMENT 'funcion que elimina una ciudad'
BEGIN
declare res int default 0;
delete from state where id = vid;
set res = 1;
return res;
RETURN 1;
END$$
DROP FUNCTION IF EXISTS `deletetypeproduct`$$
CREATE DEFINER=`root`@`localhost` FUNCTION `deletetypeproduct` (`vid` INT) RETURNS INT(1) READS SQL DATA
DETERMINISTIC
COMMENT 'funcion que elimina una ciudad'
BEGIN
declare res int default 0;
delete from typeproduct where id = vid;
set res = 1;
return res;
RETURN 1;
END$$
DROP FUNCTION IF EXISTS `deleteuser`$$
CREATE DEFINER=`root`@`localhost` FUNCTION `deleteuser` (`vid` INT) RETURNS INT(1) READS SQL DATA
DETERMINISTIC
COMMENT 'funcion que elimina un usuario'
BEGIN
declare res int default 0;
delete from user where id = vid;
set res = 1;
return res;
RETURN 1;
END$$
DROP FUNCTION IF EXISTS `savecity`$$
CREATE DEFINER=`root`@`localhost` FUNCTION `savecity` (`vname` VARCHAR(50), `vdescription` VARCHAR(50), `vdepartment_id` INTEGER) RETURNS INT(1) READS SQL DATA
DETERMINISTIC
COMMENT 'Funcion que almace una ciudad'
BEGIN
declare res int default 0;
if not exists(select name from city where name=vname)
then
insert into city(name, description, department_id)
values (vname, vdescription, vdepartment_id);
set res = 1;
end if;
RETURN res;
END$$
DROP FUNCTION IF EXISTS `savedepartment`$$
CREATE DEFINER=`root`@`localhost` FUNCTION `savedepartment` (`vname` VARCHAR(50), `vdescription` VARCHAR(50)) RETURNS INT(1) READS SQL DATA
DETERMINISTIC
COMMENT 'Funcion que almace una ciudad'
BEGIN
declare res int default 0;
if not exists(select name from department where name=vname)
then
insert into department(name, description)
values (vname, vdescription);
set res = 1;
end if;
RETURN res;
END$$
DROP FUNCTION IF EXISTS `saveinventory`$$
CREATE DEFINER=`root`@`localhost` FUNCTION `saveinventory` (`vmilligrams` INT, `vname` VARCHAR(100), `vdescription` VARCHAR(5000), `vadmissiondate` DATE, `vexpirationdate` DATE, `vlotecode` VARCHAR(10), `vquantity` INT, `vprice` INT, `vprovider_id` INT, `vshelf_id` INT, `vtypeproduct_id` INT, `vlaboratory_id` INT, `vstatus_id` INT, `vimagen` VARCHAR(5000)) RETURNS INT(1) READS SQL DATA
DETERMINISTIC
COMMENT 'Funcion que guarda una medicamento'
BEGIN
declare res int default 0;
if not exists(select name from inventory where lotecode=vlotecode)
then
insert into inventory(milligrams,
name,
description,
admissiondate,
expirationdate,
lotecode,
quantity,
price,
provider_id,
shelf_id,
typeproduct_id,
laboratory_id,
status_id,
imagen)
values (vmilligrams,
vname,
vdescription,
vadmissiondate,
vexpirationdate,
vlotecode,
vquantity,
vprice,
vprovider_id,
vshelf_id,
vtypeproduct_id,
vlaboratory_id,
vstatus_id,
vimagen);
set res = 1;
end if;
RETURN 1;
END$$
DROP FUNCTION IF EXISTS `savelaboratory`$$
CREATE DEFINER=`root`@`localhost` FUNCTION `savelaboratory` (`vname` VARCHAR(50), `vdescription` VARCHAR(50)) RETURNS INT(1) READS SQL DATA
DETERMINISTIC
COMMENT 'Funcion que almace una ciudad'
BEGIN
declare res int default 0;
if not exists(select name from laboratory where name=vname)
then
insert into laboratory(name, description)
values (vname, vdescription);
set res = 1;
end if;
RETURN res;
END$$
DROP FUNCTION IF EXISTS `savepharmacy`$$
CREATE DEFINER=`root`@`localhost` FUNCTION `savepharmacy` (`vname` VARCHAR(50), `vimagen` VARCHAR(5000), `vnit` VARCHAR(200)) RETURNS INT(1) READS SQL DATA
DETERMINISTIC
COMMENT 'Funcion que almace una farmacia'
BEGIN
declare res int default 0;
if not exists(select name from pharmacy where name=vname)
then
insert into pharmacy(name, imagen, nit)
values (vname, vimagen, vnit);
set res = 1;
end if;
RETURN res;
END$$
DROP FUNCTION IF EXISTS `saveprovider`$$
CREATE DEFINER=`root`@`localhost` FUNCTION `saveprovider` (`vname` VARCHAR(50), `vnit` VARCHAR(100), `vaddress` VARCHAR(50), `vcity_id` INTEGER) RETURNS INT(1) READS SQL DATA
DETERMINISTIC
COMMENT 'Funcion que almace un proveedor'
BEGIN
declare res int default 0;
if not exists(select name from provider where name=vname)
then
insert into provider(name, nit, address, city_id)
values (vname, vnit, vaddress, vcity_id);
set res = 1;
end if;
RETURN res;
END$$
DROP FUNCTION IF EXISTS `saverol`$$
CREATE DEFINER=`root`@`localhost` FUNCTION `saverol` (`vname` VARCHAR(50), `vdescription` VARCHAR(50)) RETURNS INT(1) READS SQL DATA
DETERMINISTIC
COMMENT 'Funcion que almace una ciudad'
BEGIN
declare res int default 0;
if not exists(select name from rol where name=vname)
then
insert into rol(name, description)
values (vname, vdescription);
set res = 1;
end if;
RETURN res;
END$$
DROP FUNCTION IF EXISTS `savesale`$$
CREATE DEFINER=`root`@`localhost` FUNCTION `savesale` (`vsaledate` DATE, `vsaletotal` INT, `vclient_id` INT, `vemployee_id` INT) RETURNS INT(1) READS SQL DATA
DETERMINISTIC
COMMENT 'Funcion que guarda una venta'
BEGIN
declare res int default 0;
if not exists(select * from sale where client_id=150000)
then
insert into sale(saledate, saletotal, client_id, employee_id)
values (vsaledate, vsaletotal, vclient_id, vemployee_id);
set res = 1;
end if;
RETURN 1;
END$$
DROP FUNCTION IF EXISTS `saveshelf`$$
CREATE DEFINER=`root`@`localhost` FUNCTION `saveshelf` (`vname` VARCHAR(50), `vdescription` VARCHAR(50)) RETURNS INT(1) READS SQL DATA
DETERMINISTIC
COMMENT 'Funcion que almace una ciudad'
BEGIN
declare res int default 0;
if not exists(select name from shelf where name=vname)
then
insert into shelf(name, description)
values (vname, vdescription);
set res = 1;
end if;
RETURN res;
END$$
DROP FUNCTION IF EXISTS `savestate`$$
CREATE DEFINER=`root`@`localhost` FUNCTION `savestate` (`vname` VARCHAR(50)) RETURNS INT(1) READS SQL DATA
DETERMINISTIC
COMMENT 'Funcion que almace una ciudad'
BEGIN
declare res int default 0;
if not exists(select name from state where name=vname)
then
insert into state(name)
values (vname);
set res = 1;
end if;
RETURN res;
END$$
DROP FUNCTION IF EXISTS `savetypeproduct`$$
CREATE DEFINER=`root`@`localhost` FUNCTION `savetypeproduct` (`vname` VARCHAR(50), `vdescription` VARCHAR(50)) RETURNS INT(1) READS SQL DATA
DETERMINISTIC
COMMENT 'Funcion que almace una ciudad'
BEGIN
declare res int default 0;
if not exists(select name from typeproduct where name=vname)
then
insert into typeproduct(name, description)
values (vname, vdescription);
set res = 1;
end if;
RETURN res;
END$$
DROP FUNCTION IF EXISTS `saveuser`$$
CREATE DEFINER=`root`@`localhost` FUNCTION `saveuser` (`vname` VARCHAR(50), `vlastname` VARCHAR(50), `vdocumenttype` VARCHAR(50), `vdocumentnumber` VARCHAR(50), `vgender` VARCHAR(50), `vage` INTEGER, `vbirthdate` DATETIME, `vpoints` INTEGER, `vpassword` VARCHAR(100), `vrol_id` INTEGER, `vcity_id` INTEGER, `vadmissiondate` DATETIME) RETURNS INT(1) READS SQL DATA
DETERMINISTIC
COMMENT 'Funcion que almace una ciudad'
BEGIN
declare res int default 0;
if not exists(select name from user where documentnumber=vdocumentnumber)
then
insert into user(name,
lastname,
documenttype,
documentnumber,
gender,
age,
birthdate,
points,
password,
rol_id,
city_id,
admissiondate)
values (vname,
vlastname,
vdocumenttype,
vdocumentnumber,
vgender,
vage,
vbirthdate,
vpoints,
vpassword,
vrol_id,
vcity_id,
vadmissiondate);
set res = 1;
end if;
RETURN res;
END$$
DROP FUNCTION IF EXISTS `updatecity`$$
CREATE DEFINER=`root`@`localhost` FUNCTION `updatecity` (`vid` INT, `vname` VARCHAR(50), `vdescription` VARCHAR(50), `vdepartment_id` INT) RETURNS INT(1) READS SQL DATA
DETERMINISTIC
COMMENT 'Funcion que modifica una ciudad'
BEGIN
DECLARE res INT DEFAULT 0;
IF NOT EXISTS(select name from city where name=vname and id<>vid)
THEN
UPDATE city
SET name=vname, description=vdescription, department_id = vdepartment_id
WHERE id=vid;
set res=1;
END IF;
RETURN res;
END$$
DROP FUNCTION IF EXISTS `updatedepartment`$$
CREATE DEFINER=`root`@`localhost` FUNCTION `updatedepartment` (`vid` INT, `vname` VARCHAR(50), `vdescription` VARCHAR(50)) RETURNS INT(1) READS SQL DATA
DETERMINISTIC
COMMENT 'Funcion que modifica una ciudad'
BEGIN
DECLARE res INT DEFAULT 0;
IF NOT EXISTS(select name from department where name=vname and id<>vid)
THEN
UPDATE department
SET name=vname, description=vdescription
WHERE id=vid;
set res=1;
END IF;
RETURN res;
END$$
DROP FUNCTION IF EXISTS `updateinventory`$$
CREATE DEFINER=`root`@`localhost` FUNCTION `updateinventory` (`vid` INT, `vmiligrams` INT, `vname` VARCHAR(100), `vdescription` VARCHAR(5000), `vadmissiondate` DATE, `vexpirationdate` DATE, `vlotecode` VARCHAR(10), `vquantity` INT, `vprice` INT, `vprovider_id` INT, `vshelf_id` INT, `vtypeproduct_id` INT, `vlaboratory_id` INT, `vstatus_id` INT, `vimagen` VARCHAR(5000)) RETURNS INT(1) READS SQL DATA
DETERMINISTIC
COMMENT 'Funcion que modifica una ciudad'
BEGIN
DECLARE res INT DEFAULT 0;
IF NOT EXISTS(select name from inventory where name=vname and id<>vid)
THEN
UPDATE inventory
SET milligrams = vmiligrams,
name = vname,
description = vdescription,
admissiondate = vadmissiondate,
expirationdate = vexpirationdate,
lotecode = vlotecode,
quantity = vquantity,
price = vprice,
provider_id = vprovider_id,
shelf_id = vshelf_id,
typeproduct_id = vtypeproduct_id,
laboratory_id = vlaboratory_id,
status_id = vstatus_id,
imagen = vimagen
WHERE id=vid;
set res=1;
END IF;
RETURN res;
END$$
DROP FUNCTION IF EXISTS `updatelaboratory`$$
CREATE DEFINER=`root`@`localhost` FUNCTION `updatelaboratory` (`vid` INT, `vname` VARCHAR(50), `vdescription` VARCHAR(50)) RETURNS INT(1) READS SQL DATA
DETERMINISTIC
COMMENT 'Funcion que modifica una ciudad'
BEGIN
DECLARE res INT DEFAULT 0;
IF NOT EXISTS(select name from laboratory where name=vname and id<>vid)
THEN
UPDATE laboratory
SET name=vname, description=vdescription
WHERE id=vid;
set res=1;
END IF;
RETURN res;
END$$
DROP FUNCTION IF EXISTS `updatepharmacy`$$
CREATE DEFINER=`root`@`localhost` FUNCTION `updatepharmacy` (`vid` INT, `vname` VARCHAR(50), `vimagen` VARCHAR(5000), `vnit` VARCHAR(200)) RETURNS INT(1) READS SQL DATA
DETERMINISTIC
COMMENT 'Funcion que modifica una farmacia'
BEGIN
DECLARE res INT DEFAULT 0;
IF NOT EXISTS(select name from pharmacy where name=vname and id<>vid)
THEN
UPDATE pharmacy
SET name=vname, imagen=vimagen, nit = vnit
WHERE id=vid;
set res=1;
END IF;
RETURN res;
END$$
DROP FUNCTION IF EXISTS `updatepoint`$$
CREATE DEFINER=`root`@`localhost` FUNCTION `updatepoint` (`vid` INTEGER, `vpoints` INTEGER) RETURNS INT(1) READS SQL DATA
DETERMINISTIC
COMMENT 'Funcion que modifica un usuario'
BEGIN
DECLARE res INT DEFAULT 0;
IF NOT EXISTS(select id from user where id=vid)
THEN
UPDATE user
SET points = vpoints
WHERE id=vid;
set res=1;
END IF;
RETURN res;
END$$
DROP FUNCTION IF EXISTS `updateprovider`$$
CREATE DEFINER=`root`@`localhost` FUNCTION `updateprovider` (`vid` INT, `vname` VARCHAR(50), `vnit` VARCHAR(100), `vaddress` VARCHAR(50), `vcity_id` INT) RETURNS INT(1) READS SQL DATA
DETERMINISTIC
COMMENT 'Funcion que modifica un proveedor'
BEGIN
DECLARE res INT DEFAULT 0;
IF NOT EXISTS(select name from provider where name=vname and id<>vid)
THEN
UPDATE provider
SET name=vname, nit=vnit, address = vaddress, city_id = vcity_id
WHERE id=vid;
set res=1;
END IF;
RETURN res;
END$$
DROP FUNCTION IF EXISTS `updatequantity`$$
CREATE DEFINER=`root`@`localhost` FUNCTION `updatequantity` (`vid` INT, `vquantity` INT) RETURNS INT(1) READS SQL DATA
DETERMINISTIC
COMMENT 'Funcion que modifica la cantidad de los productos.'
BEGIN
DECLARE res INT DEFAULT 0;
IF EXISTS(select id from inventory where id=vid)
THEN
UPDATE inventory
SET id = vid,
quantity = quantity - vquantity
WHERE id=vid;
set res=1;
END IF;
RETURN res;
END$$
DROP FUNCTION IF EXISTS `updaterol`$$
CREATE DEFINER=`root`@`localhost` FUNCTION `updaterol` (`vid` INT, `vname` VARCHAR(50), `vdescription` VARCHAR(50)) RETURNS INT(1) READS SQL DATA
DETERMINISTIC
COMMENT 'Funcion que modifica una ciudad'
BEGIN
DECLARE res INT DEFAULT 0;
IF NOT EXISTS(select name from rol where name=vname and id<>vid)
THEN
UPDATE rol
SET name=vname, description=vdescription
WHERE id=vid;
set res=1;
END IF;
RETURN res;
END$$
DROP FUNCTION IF EXISTS `updateshelf`$$
CREATE DEFINER=`root`@`localhost` FUNCTION `updateshelf` (`vid` INT, `vname` VARCHAR(50), `vdescription` VARCHAR(50)) RETURNS INT(1) READS SQL DATA
DETERMINISTIC
COMMENT 'Funcion que modifica una ciudad'
BEGIN
DECLARE res INT DEFAULT 0;
IF NOT EXISTS(select name from shelf where name=vname and id<>vid)
THEN
UPDATE shelf
SET name=vname, description=vdescription
WHERE id=vid;
set res=1;
END IF;
RETURN res;
END$$
DROP FUNCTION IF EXISTS `updatestate`$$
CREATE DEFINER=`root`@`localhost` FUNCTION `updatestate` (`vid` INT, `vname` VARCHAR(50)) RETURNS INT(1) READS SQL DATA
DETERMINISTIC
COMMENT 'Funcion que modifica una ciudad'
BEGIN
DECLARE res INT DEFAULT 0;
IF NOT EXISTS(select name from state where name=vname and id<>vid)
THEN
UPDATE state
SET name=vname
WHERE id=vid;
set res=1;
END IF;
RETURN res;
END$$
DROP FUNCTION IF EXISTS `updatetypeproduct`$$
CREATE DEFINER=`root`@`localhost` FUNCTION `updatetypeproduct` (`vid` INT, `vname` VARCHAR(50), `vdescription` VARCHAR(50)) RETURNS INT(1) READS SQL DATA
DETERMINISTIC
COMMENT 'Funcion que modifica una ciudad'
BEGIN
DECLARE res INT DEFAULT 0;
IF NOT EXISTS(select name from typeproduct where name=vname and id<>vid)
THEN
UPDATE typeproduct
SET name=vname, description=vdescription
WHERE id=vid;
set res=1;
END IF;
RETURN res;
END$$
DROP FUNCTION IF EXISTS `updateuser`$$
CREATE DEFINER=`root`@`localhost` FUNCTION `updateuser` (`vid` INTEGER, `vname` VARCHAR(50), `vlastname` VARCHAR(50), `vdocumenttype` VARCHAR(50), `vdocumentnumber` VARCHAR(50), `vgender` VARCHAR(50), `vage` INTEGER, `vbirthdate` DATETIME, `vpoints` INTEGER, `vpassword` VARCHAR(100), `vrol_id` INTEGER, `vcity_id` INTEGER, `vadmissiondate` DATETIME) RETURNS INT(1) READS SQL DATA
DETERMINISTIC
COMMENT 'Funcion que modifica un usuario'
BEGIN
DECLARE res INT DEFAULT 0;
IF NOT EXISTS(select name from user where documentnumber=vdocumentnumber and id<>vid)
THEN
UPDATE user
SET name=vname, lastname=vlastname, documenttype=vdocumenttype, documentnumber = vdocumentnumber, age = vage,
gender = vgender, birthdate = vbirthdate, points = vpoints, password = vpassword,
rol_id = vrol_id, city_id = vcity_id, admissiondate = vadmissiondate
WHERE id=vid;
set res=1;
END IF;
RETURN res;
END$$
DELIMITER ;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `city`
--
DROP TABLE IF EXISTS `city`;
CREATE TABLE IF NOT EXISTS `city` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(50) CHARACTER SET latin1 DEFAULT NULL,
`description` varchar(500) CHARACTER SET latin1 DEFAULT NULL,
`department_id` int(11) NOT NULL,
PRIMARY KEY (`id`),
KEY `city_department_fk` (`department_id`)
) ENGINE=MyISAM AUTO_INCREMENT=26 DEFAULT CHARSET=utf8;
--
-- Volcado de datos para la tabla `city`
--
INSERT DELAYED INTO `city` (`id`, `name`, `description`, `department_id`) VALUES
(24, 'asd', 'asd', 68),
(23, 'salento', 'Salento', 68),
(20, 'Armenia', 'Armenia', 68),
(21, 'Calarca', 'Calarca', 68);
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `department`
--
DROP TABLE IF EXISTS `department`;
CREATE TABLE IF NOT EXISTS `department` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(50) DEFAULT NULL,
`description` varchar(500) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=69 DEFAULT CHARSET=latin1;
--
-- Volcado de datos para la tabla `department`
--
INSERT DELAYED INTO `department` (`id`, `name`, `description`) VALUES
(68, 'Quindio', 'Quindio');
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `detailsale`
--
DROP TABLE IF EXISTS `detailsale`;
CREATE TABLE IF NOT EXISTS `detailsale` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`inventory_id` int(11) NOT NULL,
`sale_id` int(11) NOT NULL,
`quantity` int(11) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `detailsale_inventory_fk` (`inventory_id`),
KEY `detailsale_sale_fk` (`sale_id`)
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=latin1;
--
-- Volcado de datos para la tabla `detailsale`
--
INSERT DELAYED INTO `detailsale` (`id`, `inventory_id`, `sale_id`, `quantity`) VALUES
(1, 47, 1, 4);
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `inventory`
--
DROP TABLE IF EXISTS `inventory`;
CREATE TABLE IF NOT EXISTS `inventory` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`milligrams` int(11) DEFAULT NULL,
`name` varchar(100) DEFAULT NULL,
`description` varchar(5000) DEFAULT NULL,
`admissiondate` date DEFAULT NULL,
`expirationdate` date DEFAULT NULL,
`lotecode` varchar(10) DEFAULT NULL,
`quantity` int(11) DEFAULT NULL,
`price` int(11) DEFAULT NULL,
`provider_id` int(11) NOT NULL,
`shelf_id` int(11) NOT NULL,
`typeproduct_id` int(11) NOT NULL,
`laboratory_id` int(11) NOT NULL,
`status_id` int(11) NOT NULL,
`imagen` varchar(5000) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `inventory_laboratory_fk` (`laboratory_id`),
KEY `inventory_provider_fk` (`provider_id`),
KEY `inventory_shelf_fk` (`shelf_id`),
KEY `inventory_status_fk` (`status_id`),
KEY `inventory_typeproduct_fk` (`typeproduct_id`)
) ENGINE=MyISAM AUTO_INCREMENT=49 DEFAULT CHARSET=latin1;
--
-- Volcado de datos para la tabla `inventory`
--
INSERT DELAYED INTO `inventory` (`id`, `milligrams`, `name`, `description`, `admissiondate`, `expirationdate`, `lotecode`, `quantity`, `price`, `provider_id`, `shelf_id`, `typeproduct_id`, `laboratory_id`, `status_id`, `imagen`) VALUES
(47, 9, 'asdasdasd', 'sdasdasd', '2020-05-22', '2020-02-01', 'asdas', 1, 1000, 12, 9, 5, 19, 3, 'Resource/Img/Inventory/2020_5_23_31100541_1301964629903999_7828916508636039120_n.jpg'),
(48, 10, 'prueba', 'asdasdasdas', '2020-05-25', '2020-01-01', 'asda', 0, 4, 12, 9, 5, 19, 3, 'Resource/Img/Inventory/2020_5_25_wallpaperflare.com_wallpaper (1).jpg');
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `invoice`
--
DROP TABLE IF EXISTS `invoice`;
CREATE TABLE IF NOT EXISTS `invoice` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`pharmacy_id` int(11) NOT NULL,
`user_id` int(11) NOT NULL,
`sale_id` int(11) NOT NULL,
PRIMARY KEY (`id`),
KEY `invoice_pharmacy_fk` (`pharmacy_id`),
KEY `invoice_sale_fk` (`sale_id`),
KEY `invoice_user_fk` (`user_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `laboratory`
--
DROP TABLE IF EXISTS `laboratory`;
CREATE TABLE IF NOT EXISTS `laboratory` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(50) DEFAULT NULL,
`description` varchar(500) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=22 DEFAULT CHARSET=latin1;
--
-- Volcado de datos para la tabla `laboratory`
--
INSERT DELAYED INTO `laboratory` (`id`, `name`, `description`) VALUES
(19, 'Bayer', 'Si es Bayer es bueno'),
(20, 'MK', 'medicamentos totalmente confiables');
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `pharmacy`
--
DROP TABLE IF EXISTS `pharmacy`;
CREATE TABLE IF NOT EXISTS `pharmacy` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(50) DEFAULT NULL,
`imagen` varchar(5000) DEFAULT NULL,
`nit` varchar(200) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=17 DEFAULT CHARSET=latin1;
--
-- Volcado de datos para la tabla `pharmacy`
--
INSERT DELAYED INTO `pharmacy` (`id`, `name`, `imagen`, `nit`) VALUES
(16, 'Farmacia', 'Resource/Img/Pharmacy/2020_5_20_31100541_1301964629903999_7828916508636039120_n.jpg', 'ads1');
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `provider`
--
DROP TABLE IF EXISTS `provider`;
CREATE TABLE IF NOT EXISTS `provider` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(50) DEFAULT NULL,
`nit` varchar(100) DEFAULT NULL,
`address` varchar(50) DEFAULT NULL,
`city_id` int(11) NOT NULL,
PRIMARY KEY (`id`),
KEY `provider_city_fk` (`city_id`)
) ENGINE=MyISAM AUTO_INCREMENT=15 DEFAULT CHARSET=latin1;
--
-- Volcado de datos para la tabla `provider`
--
INSERT DELAYED INTO `provider` (`id`, `name`, `nit`, `address`, `city_id`) VALUES
(12, 'Proveedor 1', '12345', 'Carrera tal calle tal', 20),
(13, 'proveedor2', '123456', 'carrera tal calle 2', 21);
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `rol`
--
DROP TABLE IF EXISTS `rol`;
CREATE TABLE IF NOT EXISTS `rol` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(50) DEFAULT NULL,
`description` varchar(100) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=5 DEFAULT CHARSET=latin1;
--
-- Volcado de datos para la tabla `rol`
--
INSERT DELAYED INTO `rol` (`id`, `name`, `description`) VALUES
(1, 'Empleado', 'Gestion de inventario/ventas'),
(2, 'Administrador', 'Gestiona todas la acciones en la farmacias'),
(3, 'cliente', 'usuario comun');
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `sale`
--
DROP TABLE IF EXISTS `sale`;
CREATE TABLE IF NOT EXISTS `sale` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`saledate` date DEFAULT NULL,
`saletotal` int(11) DEFAULT NULL,
`client_id` int(11) NOT NULL,
`employee_id` int(11) NOT NULL,
PRIMARY KEY (`id`),
KEY `sale_user_fk` (`client_id`),
KEY `sale_user_fkv2` (`employee_id`)
) ENGINE=MyISAM AUTO_INCREMENT=56 DEFAULT CHARSET=latin1;
--
-- Volcado de datos para la tabla `sale`
--
INSERT DELAYED INTO `sale` (`id`, `saledate`, `saletotal`, `client_id`, `employee_id`) VALUES
(8, '2020-05-27', 8012, 44, 41),
(7, '2020-05-26', 8012, 46, 43),
(6, '2020-05-26', 8012, 44, 43),
(9, '2020-05-27', 8012, 46, 41),
(10, '2020-05-27', 8012, 44, 41),
(11, '2020-05-27', 8012, 44, 41),
(12, '2020-05-27', 2012, 44, 41),
(13, '2020-05-27', 2012, 44, 43),
(14, '2020-05-27', 6008, 44, 43),
(15, '2020-05-27', 8012, 44, 41),
(16, '2020-05-27', 4004, 44, 41),
(17, '2020-05-27', 11008, 44, 41),
(18, '2020-05-27', 4004, 44, 41),
(19, '2020-05-27', 2004, 44, 41),
(20, '2020-05-27', 3000, 44, 41),
(21, '2020-05-27', 3000, 44, 41),
(22, '2020-05-27', 12, 44, 41),
(23, '2020-05-27', 3000, 44, 41),
(24, '2020-05-27', 6016, 44, 41),
(25, '2020-05-27', 8016, 44, 41),
(26, '2020-05-27', 4016, 44, 41),
(27, '2020-05-27', 10020, 44, 41),
(28, '2020-05-27', 7000, 44, 41),
(29, '2020-05-27', 32, 44, 41),
(30, '2020-05-27', 10000, 44, 41),
(31, '2020-05-27', 32, 44, 41),
(32, '2020-05-27', 3000, 44, 41),
(33, '2020-05-27', 6000, 44, 41),
(34, '2020-05-27', 7000, 44, 41),
(35, '2020-05-27', 32, 44, 41),
(36, '2020-05-27', 8000, 44, 41),
(37, '2020-05-27', 9000, 44, 41),
(38, '2020-05-27', 9000, 44, 41),
(39, '2020-05-27', 32, 44, 41),
(40, '2020-05-27', 9000, 44, 41),
(41, '2020-05-27', 32, 44, 41),
(42, '2020-05-27', 10000, 44, 41),
(43, '2020-05-27', 10000, 44, 41),
(44, '2020-05-27', 10000, 44, 41),
(45, '2020-05-27', 10000, 44, 41),
(46, '2020-05-27', 7000, 44, 43),
(47, '2020-05-27', 32, 44, 41),
(48, '2020-05-27', 7000, 44, 41),
(49, '2020-05-27', 2000, 44, 41),
(50, '2020-05-27', 1000, 44, 41),
(51, '2020-05-27', 4, 44, 41),
(52, '2020-05-27', 1000, 44, 41),
(53, '2020-05-27', 5000, 44, 41),
(54, '2020-05-27', 8036, 44, 41),
(55, '2020-05-27', 18040, 44, 41);
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `shelf`
--
DROP TABLE IF EXISTS `shelf`;
CREATE TABLE IF NOT EXISTS `shelf` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(50) DEFAULT NULL,
`description` varchar(100) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=12 DEFAULT CHARSET=latin1;
--
-- Volcado de datos para la tabla `shelf`
--
INSERT DELAYED INTO `shelf` (`id`, `name`, `description`) VALUES
(9, 'Estante 1', 'Jeringas'),
(10, 'Estante 3', 'Acetaminofenasdasd');
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `state`
--
DROP TABLE IF EXISTS `state`;
CREATE TABLE IF NOT EXISTS `state` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(50) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=5 DEFAULT CHARSET=latin1;
--
-- Volcado de datos para la tabla `state`
--
INSERT DELAYED INTO `state` (`id`, `name`) VALUES
(3, 'diegoddddd');
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `typeproduct`
--
DROP TABLE IF EXISTS `typeproduct`;
CREATE TABLE IF NOT EXISTS `typeproduct` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(50) DEFAULT NULL,
`description` varchar(100) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=7 DEFAULT CHARSET=latin1;
--
-- Volcado de datos para la tabla `typeproduct`
--
INSERT DELAYED INTO `typeproduct` (`id`, `name`, `description`) VALUES
(5, 'asdasdasdasd', 'asdasdasdad'),
(6, 'zxczx', 'czxczxc');
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `user`
--
DROP TABLE IF EXISTS `user`;
CREATE TABLE IF NOT EXISTS `user` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(50) DEFAULT NULL,
`lastname` varchar(50) DEFAULT NULL,
`documenttype` varchar(50) DEFAULT NULL,
`documentnumber` varchar(50) DEFAULT NULL,
`gender` varchar(20) DEFAULT NULL,
`age` int(11) DEFAULT NULL,
`birthdate` date DEFAULT NULL,
`points` int(11) DEFAULT NULL,
`password` varchar(100) DEFAULT NULL,
`rol_id` int(11) NOT NULL,
`city_id` int(11) NOT NULL,
`admissiondate` date DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `user_city_fk` (`city_id`),
KEY `user_rol_fk` (`rol_id`)
) ENGINE=MyISAM AUTO_INCREMENT=47 DEFAULT CHARSET=latin1;
--
-- Volcado de datos para la tabla `user`
--
INSERT DELAYED INTO `user` (`id`, `name`, `lastname`, `documenttype`, `documentnumber`, `gender`, `age`, `birthdate`, `points`, `password`, `rol_id`, `city_id`, `admissiondate`) VALUES
(44, 'Alvaro', 'Corrales', 'Cedula', '456', 'Masculino', 6, '2020-01-01', 100, '$2y$10$867gvpzqEJf7Bx/4hv1tcOwWDNNH0QGJ201hdhVw4RTu6S9L77Q4i', 3, 20, '2020-05-22'),
(45, 'asdasd', 'asdasdasd', 'Cedula', '123', 'Masculino', 3, '2020-01-01', 0, '$2y$10$mD2ycuqPH.4dZ2vM4C2t3.Q3r1itBN4R4E8Wo1CdsOO1lyjuIsati', 1, 20, '2020-05-22'),
(46, 'Diego', 'Alejandro', 'Cedula', '123789', 'Masculino', 24, '2020-01-01', 0, '$2y$10$bZQ5WpPkMR10JnDfudhDNekzV64VATFFlxBjlfD59N8Q2Jkc5Vsle', 3, 20, '2020-05-24'),
(43, 'Johan', 'Meneses', 'Cedula', '147', 'Masculino', 27, '2020-05-22', 0, '$2y$10$iKZrQcsjcReig2ODIw.Cyu/KOMX..Q9erPaqkkl7Yrx8D/OkboUTK', 1, 20, '2020-05-22'),
(42, 'Administrador', 'Admin', 'Cedula', '1094950977', 'Masculino', 24, '2020-02-01', 0, '$2y$10$WrmcO6z0WTxAQjd8XXZM.OJUMyaYcwIbvzHPnFhx.MWsKFvqP0O36', 2, 20, '2020-05-22'),
(41, 'Cristian2', 'Ospina', 'Cedula', '12345', 'Masculino', 3, '2020-01-01', 0, '$2y$10$ZHMvs3VjuwBz3CScIAeGcO7kEMdMJHzhnqgRb6Bb8RSePr1sHHMMC', 1, 20, '2020-05-22');
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
| true |
02ce86732612a5f57faced8d8ff0aef0ae3f8f51 | SQL | almogalili/maman11-sql | /maman11-questions.sql | UTF-8 | 2,908 | 4.46875 | 4 | [] | no_license |
/* 1 */
SELECT eid
FROM Employee as e
WHERE e.salary < 12000 AND
e.classification BETWEEN 1 AND 3;
/* 2 */
SELECT ename, salary
FROM Employee AS e, Onproject AS o, Project AS p
WHERE e.did = 1
AND e.eid = o.eid
AND p.pid = o.pid
AND p.pname = 'search'
/* 3 */
SELECT d.did, dname, SUM(distinct p.budget) AS totalBudget
FROM Department AS d, Project AS p
WHERE d.did = p.did
AND p.duedate > CURRENT_DATE
GROUP BY d.did
/* 4 */
SELECT d.did
from Department AS d, Budget AS b
WHERE d.did = b.did
AND 2019 - b.byear <= 5
GROUP BY d.did
HAVING SUM(b.budget) < 2500000
/* 5 */
WITH workersOnProjects(avgSalary) AS
(SELECT AVG(salary)
FROM Employee AS e, Onproject
WHERE e.eid IN
(SELECT eid
FROM Onproject)),
notWorkersOnProjects(avgSalary) AS
(SELECT AVG(salary)
FROM Employee AS e, Onproject
WHERE e.eid NOT IN
(SELECT eid
FROM Onproject) )
SELECT w.avgSalary - n.avgSalary
FROM notWorkersOnProjects AS n,
workersOnProjects AS w
/* 6 */
with projectsWithWorkersLessThanThreeClass(pid, numOfProjects) AS
(
SELECT O.pid, count(O.pid)
FROM Onproject AS O, Employee AS E
WHERE E.eid = O.eid
AND E.classification <=3
GROUP BY O.pid
)
SELECT P.budget, P.pname
FROM projectsWithWorkersLessThanThreeClass AS WL, Project AS P
WHERE WL.numOfProjects >= all(SELECT numOfProjects FROM projectsWithWorkersLessThanThreeClass)
AND WL.pid = P.pid
/* 7 */
/*
taking projects which e1.eid not working on them, and make sure that e2.eid also not working on them,
and projects which e2.eid not working on them, and make sure that e1.eid also not working on them
*/
SELECT E1.eid, E2.eid
FROM Employee AS E1, Employee AS E2
/* this condition for ensure e1.eid != e2.eid */
WHERE E1.eid < E2.eid
/* this condition return projects which e2.eid and e1.eid not working on them */
AND E1.eid not in (
SELECT eid /* This query return the projects that e2.eid not working on them*/
FROM Onproject
WHERE pid not in (
SELECT pid /* This query return e2.eid projects */
FROM Onproject
WHERE e2.eid = eid
)
)
/* this condition return projects which e2.eid and e1.eid not working on them */
AND E2.eid not in (
SELECT eid /* This query return e1.eid which not working on proejcts */
FROM Onproject
WHERE pid not in (
SELECT pid /* This query return e1.eid projects */
FROM Onproject
WHERE e1.eid = eid
)
)
| true |
47fbb357f3d7d42bd8d7af4f02784246e34b3ed6 | SQL | mikestevenson86/SQL-Repository | /Mike S Queries/Archives/00 Archive 2016/05 May 2016/HR Forced Installs.sql | UTF-8 | 693 | 3.59375 | 4 | [] | no_license | SELECT
'http://database/shorthorn/shClient.asp?clientID=' + CONVERT(varchar, cl.clientId) + '&dealId=' + CONVERT(varchar, dl.dealId) [Shorthorn Link],
cl.companyName [Company Name],
s.siteName [Site Name],
s.postcode [Site PostCode],
hr.inMakeUp [Make Up Date],
mu.[type] [Make Up Type]
FROM Shorthorn..cit_sh_dealsPEL hr
inner join Shorthorn..cit_sh_deals dl ON hr.dealID = dl.dealID
inner join Shorthorn..cit_sh_sites s ON hr.siteID = s.siteID
inner join Shorthorn..cit_sh_clients cl ON s.clientID = cl.clientID
left outer join Shorthorn..cit_sh_PELMakeUpTypes mu ON hr.makeUpType = mu.ID
WHERE
dl.renewDate > GETDATE()
and
dl.dealStatus not in (2,5,10,18)
and
hr.sysRequired = 1 | true |
6a1c797167ca7e783092fcf357bbaec1c342eb53 | SQL | ShattereDarkness/dbms-ass4 | /DBMS ass/ddl.sql | UTF-8 | 2,149 | 4.03125 | 4 | [] | no_license | drop database company_db;
create database company_db;
\c company_db
CREATE TABLE COMPANY
(
CompanyID INT,
Cname VARCHAR(10),
Primary key(CompanyID)
);
CREATE TABLE DEPARTMENT
( Dname VARCHAR(15) NOT NULL,
Mgr_ssn CHAR(9) ,
CompanyID INT,
DepartmentID Int,
PRIMARY KEY (DepartmentID, CompanyID),
-- UNIQUE (Dname),
FOREIGN KEY (CompanyID) REFERENCES COMPANY(CompanyID)
);
CREATE TABLE Employee
( Ssn CHAR(9) NOT NULL,
Name VARCHAR(50) NOT NULL ,
EmployeeID Int,
Address VARCHAR(50),
Phone_number BIGINT,
Job VARCHAR,
Salary DECIMAL(10,2),
DepartmentID INT NOT NULL,
CompanyID INT NOT NULL,
PRIMARY KEY (Ssn),
FOREIGN KEY(DepartmentID, CompanyID) REFERENCES DEPARTMENT(DepartmentID, CompanyID)
);
CREATE TABLE TECHNOLOGIES
(
TechID INT NOT NULL,
Tname VARCHAR(35) NOT NULL,
CompanyID INT NOT NULL,
DepartmentID INT NOT NULL,
FOREIGN KEY(DepartmentID, CompanyID) REFERENCES DEPARTMENT(DepartmentID, CompanyID),
PRIMARY KEY (TechID, DepartmentID, CompanyID)
);
CREATE TABLE Teaching
(
Teacher_rating INT NOT NULL,
Teacher_SSN CHAR(9) NOT NULL,
Techid INT ,
DepartmentID INT NOT NULL,
CompanyID INT NOT NULL,
PRIMARY KEY (Techid, DepartmentID, CompanyID),
FOREIGN KEY (Techid,DepartmentID, CompanyID) REFERENCES Technologies(TechID,DepartmentID,CompanyID),
FOREIGN KEY(DepartmentID, CompanyID) REFERENCES DEPARTMENT(DepartmentID, CompanyID),
FOREIGN KEY (Teacher_SSN) REFERENCES Employee(Ssn)
);
CREATE TABLE Learning
(
Student_score INT NOT NULL,
Trainee_SSN CHAR(9) NOT NULL,
Techid INT ,
DepartmentID INT NOT NULL,
CompanyID INT NOT NULL,
PRIMARY KEY (Techid, DepartmentID, CompanyID, Trainee_SSN),
constraint learning_techid_fkey
FOREIGN KEY (Techid, DepartmentID, CompanyID) REFERENCES Teaching(TechID,DepartmentID,CompanyID)
ON DELETE CASCADE,
FOREIGN KEY(DepartmentID, CompanyID) REFERENCES DEPARTMENT(DepartmentID, CompanyID),
FOREIGN KEY (Trainee_SSN) REFERENCES Employee(Ssn)
);
--Add the following constraint after the data values have been entered into the tables.
--Alter Table Department Add Constraint Fkey_mgr_ssn FOREIGN KEY (Mgr_ssn) REFERENCES EMPLOYEE(Ssn) | true |
efa94fa3e5fe732197928f38b4773729e01ac355 | SQL | cfv7/blog-app-challenge | /blog-app-challenge.sql | UTF-8 | 2,150 | 4.53125 | 5 | [] | no_license | -- users - first_name, last_name, email_address NOT NULL, screen_name NOT NULL
-- posts - author, title, content, timestamp, >=0 comments, >=0 tags
-- comments - author, posts, text
-- tags - text
-- write SQL statements to create some users, posts, and comments
--user => posts, comments
--post => comments, tags
--comments, tags => 😞
createdb dev -U blogapp
psql -U dev blogapp
CREATE TABLE users(
id serial PRIMARY KEY,
first_name text,
last_name text,
email_address text NOT NULL,
screen_name text NOT NULL
);
CREATE TABLE tags(
id serial PRIMARY KEY,
tag text
);
CREATE TABLE comments(
id serial PRIMARY KEY,
modified timestamp DEFAULT current_timestamp,
post post_id, --foreign key constraints
post_id integer REFERENCES posts,
author user_id,
user_id integer REFERENCES users,
text_field text
);
CREATE TABLE posts(
id serial PRIMARY KEY,
modified timestamp DEFAULT current_timestamp,
author user_id,
user_id integer REFERENCES users,
title text NOT NULL,
content text NOT NULL,
comment comment_id,
comment_id REFERENCES comments
);
CREATE TABLE posts_tags(
id serial PRIMARY KEY,
post_id integer REFERENCES posts,
tag_id integer REFERENCES tags
);
INSERT INTO posts_tags
(post_id, tag_id)
VALUES
(1, 1), (1, 2);
INSERT INTO users
(first_name, last_name, email_address, screen_name)
VALUES
('Ramon', 'Reyes', '123@gmail.com', 'reyesjunk'),
('Colin', 'Van Sickle', '456@gmail.com', 'colin')
RETURNING id, first_name, last_name, screen_name, email_address;
INSERT INTO tags
(tag)
VALUES
('funny'), ('sad'), ('heartwarming'), ('horrible')
RETURNING id, tag;
INSERT INTO posts
(user_id, title, content)
VALUES
( 1, 'What''s the Deal with Airline food?!', 'It''s no good!')
RETURNING user_id, title, content;
SELECT posts.id, tags.tag FROM posts
JOIN posts_tags ON posts_tags.post_id=posts.id
JOIN tags ON posts_tags.tag_id=tags.id;
-- SELECT
-- users.id as "users_id",
-- comments.id as "comment_id",
-- posts.id as "post_id"
-- FROM users
-- INNER JOIN posts
-- ON posts.post_id = posts.id
-- LIMIT 5; | true |
7c911b2857dbe3446bc140455848139ad5317d88 | SQL | uniphil/write-only.space | /src/migrations/add-author-table.sql | UTF-8 | 714 | 4.21875 | 4 | [] | no_license | CREATE TABLE author
( email citext PRIMARY KEY NOT NULL
CONSTRAINT could_be_valid_email CHECK (
length(email) <= 254
AND email like '%_@_%'
)
, timestamp timestamp NOT NULL DEFAULT now()
, username text UNIQUE
);
-- give existing authors each a row
INSERT INTO author
(email, timestamp)
SELECT
sender as email,
min(timestamp) as timestamp
FROM post
GROUP BY sender;
-- remove post's email address validation
ALTER TABLE post
DROP CONSTRAINT could_be_valid_email;
-- better name for the soon-to-be FK
ALTER TABLE post
RENAME COLUMN sender TO author;
-- make author an FK
ALTER TABLE post
ADD FOREIGN KEY(author)
REFERENCES author(email)
ON UPDATE CASCADE ON DELETE CASCADE;
| true |
65deaacff5ad334e4287f33d05634a92832b12af | SQL | dmitriynitievskiy/BSU-MMF | /2_course/Database/TaskScript.sql | UTF-8 | 2,368 | 4.0625 | 4 | [] | no_license | USE hr;
set SQL_SAFE_UPDATES = 0;
set FOREIGN_KEY_CHECKS = 0;
/* 1 */
TRUNCATE TABLE locations;
INSERT INTO locations(street_address,postal_code,city,state_province,country_id)
SELECT DISTINCT street_address,postal_code,city,state_province,country_id
FROM report
WHERE city IS NOT NULL AND country_id IS NOT NULL;
/* 2 */
TRUNCATE TABLE departments;
INSERT INTO departments(department_name)
SELECT DISTINCT department_name
FROM report
WHERE department_name IS NOT NULL;
/* 3 */
TRUNCATE TABLE employees;
INSERT INTO employees(first_name,last_name,email,phone_number,hire_date,job_id,salary,commission_pct)
SELECT DISTINCT first_name,last_name,'email',phone_number,hire_date,job_id,salary,commission_pct
FROM report;
set SQL_SAFE_UPDATES = 0;
set FOREIGN_KEY_CHECKS = 0;
/* 4 */
UPDATE employees AS e
SET e.department_id = (SELECT DISTINCT d.department_id
FROM report AS r
INNER JOIN departments AS d ON r.department_name = d.department_name
WHERE r.first_name = e.first_name AND r.last_name = e.last_name),
e.manager_id = (SELECT DISTINCT d.manager_id
FROM report AS r
INNER JOIN departments AS d ON r.department_name = d.department_name
WHERE r.first_name = e.first_name AND r.last_name = e.last_name);
/* 5 */
UPDATE departments AS d
SET manager_id = (SELECT DISTINCT e.employee_id
FROM report AS r
INNER JOIN employees AS e ON (
coalesce(r.department_manager_first_name , r.manager_first_name) = e.first_name
AND coalesce( r.department_manager_last_name, r.manager_last_name) = e.last_name )
WHERE r.department_name = d.department_name);
/* 6 */
UPDATE employees AS e
SET e.salary = (e.salary + 100)
WHERE e.employee_id NOT IN (SELECT d.manager_id
FROM departments AS d);
/* 7 */
UPDATE employees AS e
SET e.email = CONCAT(SUBSTRING(e.first_name,1,5), SUBSTRING(e.last_name,1,5));
/* 8 */
CREATE TABLE fordep(department_id INT NOT NULL PRIMARY KEY);
INSERT INTO fordep
SELECT d.department_id
FROM departments AS d
INNER JOIN employees AS e ON e.department_id = d.department_id
GROUP BY d.department_id
HAVING COUNT(e.employee_id) < 10;
UPDATE employees AS e
SET e.salary = e.salary*1.1
WHERE e.department_id IN (SELECT department_id
FROM fordep);
DROP TABLE fordep; | true |
24b513c0f03c1ee31791f5eabad37a3a05f179c3 | SQL | Minh42/42_project-piscine_PHP | /j05/ex10/ex10.sql | UTF-8 | 168 | 3.203125 | 3 | [] | no_license | SELECT titre AS 'Titre', resum as 'Resume', annee_prod
FROM film
INNER JOIN genre ON film.id_genre = genre.id_genre
WHERE genre.id_genre = 25
ORDER BY annee_prod DESC;
| true |
018f6132efcb9d03cff79d237c7ae4c0547f57cb | SQL | pstoeber/nba-stats-predictor | /Pipeline Development/multithread_testing_sql/multithread/player_misc_stats.sql | UTF-8 | 2,656 | 2.875 | 3 | [] | no_license | insert into nba_stats_backup.player_misc_stats (select `b`.`game_hash` AS `game_hash`,
`pv`.`player_id` AS `player_id`,
`misc`.`PTS_OFF_TO` AS `pts_off_to`,
`misc`.`2nd_PTS` AS `2nd_pts`,
`misc`.`FBPs` AS `fbps`,
`misc`.`PITP` AS `pitp`,
`misc`.`OppPTS_OFF_TO` AS `opppts_off_to`,
`misc`.`Opp2nd_PTS` AS `opp2nd_pts`,
`misc`.`OppFBPs` AS `oppfbps`,
`misc`.`OppPITP` AS `opppitp`,
`misc`.`BLK` AS `blk`,
`misc`.`BLKA` AS `blka`,
`misc`.`PF` AS `pf`,
`misc`.`PFD` AS `pfd`
from (((((select `box_score_map_view`.`game_hash` AS `game_hash`,
`box_score_map_view`.`home_team` AS `team`,
`box_score_map_view`.`game_date` AS `game_date`
from `nba_stats`.`box_score_map_view`
union
select `box_score_map_view`.`game_hash` AS `game_hash`,
`box_score_map_view`.`away_team` AS `team`,
`box_score_map_view`.`game_date` AS `game_date`
from `nba_stats`.`box_score_map_view`) `b` join `nba_stats`.`game_date_lookup` `lu` on ((`b`.`game_date` = `lu`.`day`))) join `nba_stats`.`player_team_map_view` `pv` on (((`lu`.`season` = `pv`.`season`) and (`b`.`team` = `pv`.`team`)))) join `nba_stats`.`player_info` `p` on ((`pv`.`player_id` = `p`.`player_id`)))
join `nba_stats`.`player_misc_stats` `misc`
on (((`b`.`team` = `misc`.`team`) and
(`p`.`NAME` = `misc`.`name`) and
(`b`.`game_date` = `misc`.`game_date`)))));
| true |
725f068e2de0aff0dd7155dfec2ee66a8bfb8ff9 | SQL | brettshollenberger/databases-course-lab-7 | /modify/bakery.sql | UTF-8 | 1,368 | 4.25 | 4 | [] | no_license | /*
For each pastry flavor which is found in more than three types of
pastries sold by the bakery, report the average price of an item of this
flavor and the total number of different pastrties of this flavor on the
menu. Sort the output in ascending order by the average price
*/
select flavor, count(id) as count, avg(price) as avg_price from goods
group by flavor
having count > 3
order by avg_price asc;
/*
Find the total amount of money the bakery earned between October
10, 2007 and October 15, 2007 (inclusive). Report just the amount.
*/
select sum(price) as earned from receipts
inner join receipt_items
on receipt_items.receipt_id=receipts.id
inner join goods
on goods.id=receipt_items.good_id
where date >= "2007-10-10"
and date <= "2007-10-15";
/*
For each purchase made by CHARLENE MESDAQ output the receipt number,
the date of purchase, the total number of items purchased and
the amount paid. Sort in descending order by the amount paid.
*/
select receipts.id, receipts.date, count(receipt_items.id) as items_purchased, sum(goods.price) as amount_paid from customers
inner join receipts
on receipts.customer_id=customers.id
inner join receipt_items
on receipt_items.receipt_id=receipts.id
inner join goods
on receipt_items.good_id=goods.id
where last_name="MESDAQ"
and first_name="CHARLENE"
group by receipts.id
order by amount_paid desc;
| true |
856ad8aa4e68d8b72f0fe0bf309867ae0d2dd22b | SQL | centripetum/server | /docs/newer/03-views.sql | UTF-8 | 9,494 | 4.4375 | 4 | [] | no_license | -- PATH RELATIONSHIP
CREATE VIEW app_private.path_relationship AS
SELECT 'Event'::text AS type,
event.id,
CASE
WHEN (event.parent IS NULL) THEN NULL::uuid
ELSE event.parent
END AS parent_id,
CASE
WHEN (event.parent IS NULL) THEN '/'::text
ELSE concat('/', event.slug)
END AS slug,
event.link_label,
event.link_description,
event.spot
FROM app_public.event
UNION
SELECT 'Venue'::text AS type,
venue.id,
venue.parent AS parent_id,
concat('/', venue.slug) AS slug,
venue.link_label,
venue.link_description,
venue.spot
FROM app_public.venue
ORDER BY 1, 4;
ALTER TABLE app_private.path_relationship OWNER TO cp_postgraphile;
COMMENT ON VIEW app_private.path_relationship IS 'Derives the parent-child edges for the event/venue (page) tree.';
-- FULL PATH
CREATE VIEW app_private.full_path AS
WITH RECURSIVE path_line AS (
SELECT '/'::text AS full_path,
path_relationship.type,
path_relationship.id,
path_relationship.parent_id,
NULL::text AS parent_path,
path_relationship.link_label,
path_relationship.link_description,
path_relationship.spot,
0 AS depth
FROM app_private.path_relationship
WHERE (path_relationship.parent_id IS NULL)
UNION ALL
SELECT
CASE
WHEN (pl.full_path = '/'::text) THEN pr.slug
ELSE concat(pl.full_path, pr.slug)
END AS full_path,
pr.type,
pr.id,
pr.parent_id,
pl.full_path AS parent_path,
pr.link_label,
pr.link_description,
pr.spot,
(pl.depth + 1)
FROM (app_private.path_relationship pr
JOIN path_line pl ON ((pr.parent_id = pl.id)))
)
SELECT path_line.type,
path_line.id,
path_line.full_path,
path_line.link_label,
path_line.link_description,
path_line.parent_path,
path_line.spot,
path_line.depth
FROM path_line
ORDER BY path_line.full_path;
ALTER TABLE app_private.full_path OWNER TO cp_postgraphile;
COMMENT ON VIEW app_private.full_path IS 'Recurses through the page tree to derive the full URL path for each event, venue, etc.';
-- FULL EVENT
CREATE VIEW app_private.full_event AS
SELECT paths.full_path,
event.id,
event.slug,
event.link_label,
event.link_description,
event.title,
event.content,
( SELECT array_agg(tag.body) AS tags
FROM ((app_public.event trk
JOIN app_public.event_tag ttag ON ((trk.id = ttag.event_id)))
JOIN app_public.tag tag ON ((ttag.tag_id = tag.id)))
WHERE (ttag.event_id = event.id)) AS tags,
image.url AS image_url,
image.alt AS image_alt,
event.spot,
event.parent,
paths.parent_path,
( SELECT array_agg(fpath.full_path) AS array_agg
FROM ( SELECT full_path.full_path,
full_path.spot,
full_path.depth
FROM app_private.full_path
ORDER BY full_path.spot) fpath
WHERE ((fpath.full_path ~~ (paths.full_path || '%'::text)) AND (fpath.depth = (paths.depth + 1)))) AS child_paths,
paths.depth
FROM ((app_private.full_path paths
JOIN app_public.event event ON ((paths.id = event.id)))
LEFT JOIN app_public.image image ON ((event.image = image.id)));
ALTER TABLE app_private.full_event OWNER TO cp_postgraphile;
COMMENT ON VIEW app_private.full_event IS 'Provides a view of each event with the full URL path and an array of associated tags.';
-- FULL VENUE
CREATE VIEW app_private.full_venue AS
SELECT paths.full_path,
venue.id,
venue.slug,
venue.link_label,
venue.link_description,
venue.title,
venue.content,
( SELECT array_agg(tag.body) AS tags
FROM ((app_public.venue trk
JOIN app_public.venue_tag ttag ON ((trk.id = ttag.venue_id)))
JOIN app_public.tag tag ON ((ttag.tag_id = tag.id)))
WHERE (ttag.venue_id = venue.id)) AS tags,
image.url AS image_url,
image.alt AS image_alt,
venue.spot,
venue.parent,
paths.parent_path,
( SELECT array_agg(fpath.full_path) AS array_agg
FROM ( SELECT full_path.full_path,
full_path.spot,
full_path.depth
FROM app_private.full_path
ORDER BY full_path.spot) fpath
WHERE ((fpath.full_path ~~ (paths.full_path || '%'::text)) AND (fpath.depth = (paths.depth + 1)))) AS child_paths,
paths.depth
FROM ((app_private.full_path paths
JOIN app_public.venue venue ON ((paths.id = venue.id)))
LEFT JOIN app_public.image image ON ((venue.image = image.id)));
ALTER TABLE app_private.full_venue OWNER TO cp_postgraphile;
COMMENT ON VIEW app_private.full_venue IS 'Provides a view of each venue with the full URL path and an array of associated tags.';
-- FULL ORGANIZATION
CREATE VIEW app_private.full_organization AS
SELECT paths.full_path,
organization.id,
organization.slug,
organization.link_label,
organization.link_description,
organization.title,
organization.content,
( SELECT array_agg(tag.body) AS tags
FROM ((app_public.organization trk
JOIN app_public.organization_tag ttag ON ((trk.id = ttag.organization_id)))
JOIN app_public.tag tag ON ((ttag.tag_id = tag.id)))
WHERE (ttag.organization_id = organization.id)) AS tags,
image.url AS image_url,
image.alt AS image_alt,
organization.spot,
organization.parent,
paths.parent_path,
( SELECT array_agg(fpath.full_path) AS array_agg
FROM ( SELECT full_path.full_path,
full_path.spot,
full_path.depth
FROM app_private.full_path
ORDER BY full_path.spot) fpath
WHERE ((fpath.full_path ~~ (paths.full_path || '%'::text)) AND (fpath.depth = (paths.depth + 1)))) AS child_paths,
paths.depth
FROM ((app_private.full_path paths
JOIN app_public.organization organization ON ((paths.id = organization.id)))
LEFT JOIN app_public.image image ON ((organization.image = image.id)));
ALTER TABLE app_private.full_organization OWNER TO cp_postgraphile;
COMMENT ON VIEW app_private.full_organization IS 'Provides a view of each organization with the full URL path and an array of associated tags.';
-- TAG USE COUNT
CREATE VIEW app_private.tag_use_count AS
SELECT tg.id,
tg.body,
tc.use_count
FROM (app_public.tag tg
LEFT JOIN ( SELECT count(t.id) AS use_count,
t.tag_id
FROM ( SELECT event_tag.event_id AS id,
event_tag.tag_id
FROM app_public.event_tag
UNION ALL
SELECT venue_tag.venue_id AS id,
venue_tag.tag_id
FROM app_public.venue_tag
UNION ALL
SELECT organization_tag.organization_id AS id,
organization_tag.tag_id
FROM app_public.organization_tag) t
GROUP BY t.tag_id) tc ON ((tg.id = tc.tag_id)))
ORDER BY tg.body;
ALTER TABLE app_private.tag_use_count OWNER TO cp_postgraphile;
COMMENT ON VIEW app_private.tag_use_count IS 'Returns a count of the total events, venues, etc. with which a tag is associated.';
-- MANAGED PAGE (MATERIALIZED)
CREATE MATERIALIZED VIEW app_public.managed_page AS
SELECT 'Event'::text AS type,
full_event.full_path,
full_event.id,
full_event.slug,
full_event.link_label,
full_event.link_description,
full_event.title,
full_event.content,
full_event.tags,
full_event.image_url,
full_event.image_alt,
full_event.spot,
full_event.parent,
full_event.parent_path,
full_event.child_paths,
NULL::text[] AS sibling_paths,
full_event.depth
FROM app_private.full_event
UNION ALL
SELECT 'Venue'::text AS type,
full_venue.full_path,
full_venue.id,
full_venue.slug,
full_venue.link_label,
full_venue.link_description,
full_venue.title,
full_venue.content,
full_venue.tags,
full_venue.image_url,
full_venue.image_alt,
full_venue.spot,
full_venue.parent,
full_venue.parent_path,
full_venue.child_paths,
NULL::text[] AS sibling_paths,
full_venue.depth
FROM app_private.full_venue
UNION ALL
SELECT 'Organization'::text AS type,
full_organization.full_path,
full_organization.id,
full_organization.slug,
full_organization.link_label,
full_organization.link_description,
full_organization.title,
full_organization.content,
full_organization.tags,
full_organization.image_url,
full_organization.image_alt,
full_organization.spot,
full_organization.parent,
full_organization.parent_path,
full_organization.child_paths,
NULL::text[] AS sibling_paths,
full_organization.depth
FROM app_private.full_organization
ORDER BY 1, 14, 12
WITH NO DATA;
ALTER MATERIALIZED VIEW app_public.managed_page OWNER TO cp_postgraphile;
CREATE UNIQUE INDEX unique_managed_page ON app_public.managed_page USING btree (full_path);
COMMENT ON MATERIALIZED VIEW app_public.managed_page IS 'Provides a view into all generated site pages (events, venues, organizations, etc.).';
| true |
206679833c556502149f95ec0f8d6206935aabe3 | SQL | djrobstep/migra | /tests/FIXTURES/rls/b.sql | UTF-8 | 367 | 2.625 | 3 | [
"Unlicense"
] | permissive | CREATE TABLE accounts (manager text, company text, contact_email text);
ALTER TABLE accounts ENABLE ROW LEVEL SECURITY;
CREATE POLICY account_managers ON accounts as restrictive TO schemainspect_test_role
USING (manager = current_user);
CREATE TABLE accounts2 (manager text, company text, contact_email text);
ALTER TABLE accounts2 ENABLE ROW LEVEL SECURITY;
| true |
b14fe956baa03f2682d5815ab7b1da05499844de | SQL | ivanandrianto/Biodict | /assets/mydb2.sql | UTF-8 | 230 | 2.625 | 3 | [] | no_license | BEGIN TRANSACTION;
CREATE TABLE `table1` (
`_id` INTEGER,
`name` TEXT,
`desc` TEXT,
PRIMARY KEY(_id)
);
CREATE TABLE "android_metadata" ("locale" TEXT DEFAULT 'en_US');
INSERT INTO `android_metadata` VALUES ('en_US');
COMMIT;
| true |
5a05f4dcad25c3810df2696cccbe38512eddfe21 | SQL | gon1958/minibso | /minibso/create/append/addcoll.sql | UTF-8 | 1,468 | 3.484375 | 3 | [] | no_license | set serveroutput on;
create or replace procedure addColl is
vParentId number;
vNRecord number;
dynStmt varchar2(2000);
type tDynStmtCur is ref cursor;
dynStmtCur tDynStmtCur;
reduAddRec redu_add%rowtype;
begin
for iterLev in (select id_obj, table_name from redu_add where lev = 0
) loop
for collect in(select a.column_name, ta.table_name
from classes c, class_tables ct, class_tab_columns a, classes ca, class_tables ta
where ct.class_id = c.id and a.class_id = c.id and ca.id = a.self_class_id and ca.target_class_id = ta.class_id
and ca.base_class_id = 'COLLECTION'
and ct.table_name like iterLev.table_name
)loop
execute immediate 'select '||collect.column_name||' from '||iterLev.table_name||' where id = '||iterLev.id_obj into vParentId;
if vParentId is null then
continue;
end if;
begin
dynStmt := 'select id, 1, '''||collect.table_name||''', ''C'' from '||collect.table_name||' where '||
'collection_id = '||vParentId||
' and (id, '''||collect.table_name||''') not in (select id_obj, table_name from redu_add)' ;
open dynStmtCur for dynStmt;
loop
fetch dynStmtCur into reduAddRec;
exit when dynStmtCur%notfound;
insertReduAdd(reduAddRec.id_obj, reduAddRec.lev, reduAddRec.key_type);
end loop;
close dynStmtCur;
end;
end loop;
end loop;
commit;
end;
/
show error
exec addColl;
/* drop procedure addColl; */
exit
| true |
07424a76adb085b49c8afd2eecc88110b2ffb052 | SQL | nss-day-cohort-13/chinook-carter-harris | /brazil_customers_invoices.sql | UTF-8 | 372 | 3.625 | 4 | [
"MIT"
] | permissive | -- Provide a query showing the Invoices of customers who are from Brazil.
-- The resultant table should show the customer's full name, Invoice ID,
-- Date of the invoice and billing country.
-- #3
select
c.FirstName,
c.LastName,
c.Country
i.InvoiceId,
i.InvoiceDate,
from
Customer c, Invoice i
where
c.CustomerId = i.CustomerId
and
c.Country = 'Brazil';
| true |
14f051b3bd3d4a10a0b5d0bab8f04ac4bd1e7aeb | SQL | diego1982chile/SIGGES | /RFCSalud Conectada Fase 3 2015.01.15/RFCSalud Conectada Fase 3 2015.01.15/2.-Trabajo/1. AT/2.ENDECA/(003)[AT.ENDECA] IA CREA 4 VISTAS ENDECA F3.sql | WINDOWS-1250 | 2,027 | 2.921875 | 3 | [] | no_license |
INSERT INTO sis.SIS_TAB_CONTROL_SCRIPT (RESPONSABLE,
NOMBRE_SCRIPT,
DESCRIPCION,
FECHA_EJECUCION,
NUMERO_OT)
VALUES ('Ivn Aguilera',
'(003)[AT.ENDECA] IA CREA 4 VISTAS ENDECA F3.sql',
'Crea vista ENDECA Fase 3',
SYSDATE,
'ENDECA FASE 3');
COMMIT;
----------------------------------------------------------------------------------
--DROP VIEW ENDECA.ENDECA_VW_CAUSALCAC;
/* Formatted on 15-01-2015 18:26:28 (QP5 v5.163.1008.3004) */
CREATE OR REPLACE FORCE VIEW ENDECA.ENDECA_VW_CAUSALCAC
(
CODIGO,
DESCRIPCION
)
AS
SELECT "TIPEVEAIS_COD_TIPEVEAIS", "TIPEVEAIS_DSC_TIPEVEAIS"
FROM SIS.SIS_TAB_TIPEVEAIS;
----------------------------------------------------------------------------------
--DROP VIEW ENDECA.ENDECA_VW_CAUSALCCEXGO;
/* Formatted on 15-01-2015 18:26:28 (QP5 v5.163.1008.3004) */
CREATE OR REPLACE FORCE VIEW ENDECA.ENDECA_VW_CAUSALCCEXGO
(
COD_CAUSAL,
DESCRIPCION,
TIPO_CAUSAL
)
AS
SELECT "TIPCIECA_COD_TIPCIECA",
"TIPCIECA_DSC_TIPCIECA",
"TIPCAUSAL_COD_TIPCAUSAL"
FROM SIS.SIS_TAB_TIPCIECA;
---------------------------------------------------------------------------------
--
DROP VIEW ENDECA.ENDECA_VW_DIAGNOSTICOPS;
/* Formatted on 15-01-2015 18:26:28 (QP5 v5.163.1008.3004) */
CREATE OR REPLACE FORCE VIEW ENDECA.ENDECA_VW_DIAGNOSTICOPS
(
COD_DIAGNOSTICO,
DESCRIPCION
)
AS
SELECT "TIPELEVA_COD_TIPELEVA", "TIPELEVA_DSC_TIPELEVA"
FROM SIS.SIS_TAB_TIPELEVA;
---------------------------------------------------------------------------------
--DROP VIEW ENDECA.ENDECA_VW_NODOHD;
/* Formatted on 15-01-2015 18:26:28 (QP5 v5.163.1008.3004) */
CREATE OR REPLACE FORCE VIEW ENDECA.ENDECA_VW_NODOHD
(
COD_NODOHD,
DESCRIPCION
)
AS
SELECT "NODOHD_COD_NODOHD", "NODOHD_DSC_NODOHD"
FROM SIS.SIS_TAB_nodoHD;
| true |
d689607557b5782d0e17de3bc7728b3b3b9fcd07 | SQL | aaric/spring-boot-2-achieve | /sparrow-db-init/src/main/resources/db/migration/V1.0_5__role.sql | UTF-8 | 556 | 3.390625 | 3 | [
"MIT"
] | permissive | CREATE TABLE IF NOT EXISTS role (
id serial PRIMARY KEY,
role_name varchar(50) NOT NULL UNIQUE,
is_del boolean NOT NULL DEFAULT FALSE,
insert_time timestamp WITH time ZONE NOT NULL DEFAULT current_timestamp
);
COMMENT ON TABLE role IS '权限信息';
COMMENT ON COLUMN role.id IS 'ID';
COMMENT ON COLUMN role.role_name IS '角色名称';
COMMENT ON COLUMN role.is_del IS '是否删除,默认false';
COMMENT ON COLUMN role.insert_time IS '入库时间';
/* 初始化系统支持的角色记录 */
INSERT INTO role VALUES (1, '超级管理员');
| true |
ac37892583aa5720a6c8ece26cfb0e230b2e6e3c | SQL | ericafenyo/wild-circus | /server/query.sql | UTF-8 | 919 | 3.53125 | 4 | [] | no_license |
CREATE DATABASE `circus`;
USE `circus`
CREATE TABLE `spectator`
(
`id` INT PRIMARY KEY AUTO_INCREMENT,
`name` VARCHAR(255) NOT NULL,
`email` VARCHAR(255) NOT NULL,
`birthDate` VARCHAR(125) NOT NULL
);
CREATE TABLE `event`
(
`id` INT PRIMARY KEY AUTO_INCREMENT,
`title` VARCHAR(255) NOT NULL,
`description` TEXT NOT NULL,
`address` VARCHAR(255) NOT NULL,
`image` TEXT NOT NULL,
`price` INT NOT NULL,
`createdAt` datetime DEFAULT NOW()
);
CREATE TABLE `booking`
(
`id` INT PRIMARY KEY AUTO_INCREMENT,
`eventId` INT NOT NULL,
`spectatorId` INT NOT NULL,
`createdAt` datetime NOT NULL,
`updatedAt` datetime NOT NULL,
`price` INT NOT NULL,
`code` VARCHAR(255) NOT NULL,
FOREIGN KEY (`eventId`) REFERENCES `event` (`id`),
FOREIGN KEY (`spectatorId`) REFERENCES `spectator` (`id`)
);
DROP TABLE IF EXISTS `booking`;
DROP TABLE IF EXISTS `event`;
DROP TABLE IF EXISTS `spectator`; | true |
0c7789fcd8a1f3b9e537d6b3524b0d2c5a1ac8ed | SQL | korezonzi/-NB_SQL | /theme-c/63.sql | UTF-8 | 188 | 2.9375 | 3 | [] | no_license | select E.イベント番号,E.イベント名称,M.クリア区分
from イベント E
join 経験イベント M
on E.イベント番号= M.イベント番号
where E.タイプ = '1'
| true |
b64fe5772c94a17c9d303a112284cb7e7ea7f24d | SQL | Irreverent-Ironwood/Reviews-API | /reviewsAPI/dbsql/schema.sql | UTF-8 | 1,686 | 3.875 | 4 | [] | no_license | DROP DATABASE IF EXISTS retaildb;
CREATE DATABASE retaildb;
USE retaildb;
CREATE TABLE product (
id INT UNSIGNED NOT NULL AUTO_INCREMENT,
product_id INT UNSIGNED NOT NULL,
PRIMARY KEY(id)
);
CREATE TABLE reviews (
id INT UNSIGNED NOT NULL AUTO_INCREMENT,
product_id INT UNSIGNED NOT NULL,
rating TINYINT NOT NULL,
review_date timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
summary VARCHAR(60),
body VARCHAR(1000),
recommend BOOLEAN NOT NULL,
reported BOOLEAN NOT NULL,
reviewer_name VARCHAR(255),
reviewer_email VARCHAR(255),
response VARCHAR(1000),
helpfulness TINYINT,
PRIMARY KEY(id),
FOREIGN KEY (product_id) REFERENCES product(id)
);
CREATE TABLE photos (
id INT NOT NULL AUTO_INCREMENT,
reviews_id INT UNSIGNED NOT NULL,
photo_url TEXT(1000),
PRIMARY KEY(id),
FOREIGN KEY (reviews_id) REFERENCES reviews(id)
);
ALTER TABLE photos ADD INDEX new_reviews_id (reviews_id);
CREATE TABLE characteristics (
id INT NOT NULL AUTO_INCREMENT,
characteristics_name VARCHAR(255),
PRIMARY KEY(id)
);
CREATE TABLE characteristics_product (
id INT NOT NULL AUTO_INCREMENT,
characteristics_id INT NOT NULL,
product_id INT UNSIGNED NOT NULL,
PRIMARY KEY(id),
FOREIGN KEY(characteristics_id) REFERENCES characteristics(id),
FOREIGN KEY(product_id) REFERENCES product(id)
);
CREATE TABLE characteristics_reviews (
id INT NOT NULL AUTO_INCREMENT,
characteristics_id INT NOT NULL,
reviews_id INT UNSIGNED NOT NULL,
characteristics_value INT NOT NULL,
PRIMARY KEY(id),
FOREIGN KEY(characteristics_id) REFERENCES characteristics(id),
FOREIGN KEY(reviews_id) REFERENCES reviews(id)
);
-- SET FOREIGN_KEY_CHECKS = 0;
| true |
9600deebe3e372c4038e882ae1482b15b1742034 | SQL | hans511002/erydb_rep | /utils/scenarios/perf/source/iteration17queries/Group5/grp5_6_test.sql | UTF-8 | 507 | 2.828125 | 3 | [] | no_license | select p_brand, sum(l_quantity) tot_qty,
avg(l_quantity) avg_qty
from lineitem, part
where l_shipdate between '1996-04-01' and '1996-04-14'
and l_partkey = p_partkey
and p_size = 5
group by p_brand
order by 1;
Select erygetstats();
Select now();
select p_brand, sum(l_quantity) tot_qty,
avg(l_quantity) avg_qty
from lineitem, part
where l_shipdate between '1996-04-01' and '1996-04-14'
and l_partkey = p_partkey
and p_size = 5
group by p_brand
order by 1;
Select erygetstats();
quit
| true |
0602ed910abc29568a1b03985675cf2a4a4b83c8 | SQL | korezonzi/-NB_SQL | /theme-b/59.sql | UTF-8 | 343 | 3.390625 | 3 | [] | no_license | SELECT A.数量合計 AS 割引による販売数,
TRUNC(A.割引料合計 / A.数量合計) AS 平均割引額
FROM (SELECT SUM(数量) AS 数量合計,
SUM(クーポン割引料) AS 割引料合計
FROM 注文
WHERE 商品コード = 'W0746'
AND クーポン割引料 IS NOT NULL) AS A
| true |
023668fb45d7538b6e445b5d18e01b19a9bb7e46 | SQL | patorma/GastosBackend | /GastosBackend/bin/main/import.sql | UTF-8 | 3,270 | 2.75 | 3 | [] | no_license | /*Registro de tipos de gastos*/
INSERT INTO tipo_gastos (nombre) VALUES ('Gastos Comunes');
INSERT INTO tipo_gastos (nombre) VALUES ('Ferreteria');
INSERT INTO tipo_gastos (nombre) VALUES ('Supermercado');
INSERT INTO tipo_gastos (nombre) VALUES ('Transporte');
INSERT INTO tipo_gastos (nombre) VALUES ('Carniceria');
INSERT INTO tipo_gastos (nombre) VALUES ('Otros');
/*Registro de ciudades*/
INSERT INTO ciudades (nombre) VALUES('Laja');
INSERT INTO ciudades (nombre) VALUES('Los Angeles');
INSERT INTO ciudades (nombre) VALUES ('Concepcion');
INSERT INTO ciudades (nombre) VALUES ('Santiago');
INSERT INTO ciudades (nombre) VALUES('Chillan');
INSERT INTO ciudades (nombre) VALUES ('Talcahuano');
INSERT INTO ciudades (nombre) VALUES('Temuco');
/*Registro de gastos*/
INSERT INTO gastos (nombre,descripcion,valor,fecha_gasto,tipo_id,local,ciudad_id) VALUES('Luz','se pago la cuenta de la luz',13100,'2019-05-06',1,'frontel',1);
INSERT INTO gastos (nombre,descripcion,valor,fecha_gasto,tipo_id,local,ciudad_id) VALUES('Agua','se pago la cuenta del agua',7900,'2019-05-06',1,'sencillito',1);
INSERT INTO gastos (nombre,descripcion,valor,fecha_gasto,tipo_id,local,ciudad_id) VALUES('Telefono','se pago la cuenta del telefono',36456,'2019-05-06',1,'sencillito del unico',1);
INSERT INTO gastos (nombre,descripcion,valor,fecha_gasto,tipo_id,local,ciudad_id) VALUES('cemento','se compro 2 bolsas de cemento en la ferreteria gran fe',25000,'2019-05-06',2,'ferreteria gran fe',1);
INSERT INTO gastos (nombre,descripcion,valor,fecha_gasto,tipo_id,local,ciudad_id) VALUES('Rueda de carretilla','se compro en los rios una rueda de la carretilla',12900,'2019-05-06',2,'ferreteria los rios',1);
INSERT INTO gastos (nombre,descripcion,valor,fecha_gasto,tipo_id,local,ciudad_id) VALUES('Viaje a los angeles','se compro dos pasajes a los angeles',2000,'2019-05-06',4,'boleteria buses laja',7);
INSERT INTO gastos (nombre,descripcion,valor,fecha_gasto,tipo_id,local,ciudad_id) VALUES('pasaje de tren','se viajo el lunes en tren a conce',6000,'2019-05-06',4,'boleteria estacion de trenes de laja',1);
INSERT INTO gastos (nombre,descripcion,valor,fecha_gasto,tipo_id,local,ciudad_id) VALUES('Viaje a Santiago','se viajo el martes en la noche a santiago y se volvio el miercoles',11100,'2019-05-06',4,'boleteria terminal rodoviario de laja',1);
INSERT INTO gastos (nombre,descripcion,valor,fecha_gasto,tipo_id,local,ciudad_id) VALUES('aletilla','se compro aletilla en el unico',6590,'2019-05-06',3,'Supermercado unico',1);
INSERT INTO gastos (nombre,descripcion,valor,fecha_gasto,tipo_id,local,ciudad_id) VALUES('Longaniza','se compro 2 tiras de longaniza en el unico',3000,'2019-05-06',3,'Supermercado unico',2);
INSERT INTO gastos (nombre,descripcion,valor,fecha_gasto,tipo_id,local,ciudad_id) VALUES('Chuleta','se compro 2 kilos de chuleta en los chavez',5000,'2019-05-06',5,'carniceria chavez',1);
INSERT INTO gastos (nombre,descripcion,valor,fecha_gasto,tipo_id,local,ciudad_id) VALUES('cazuela de vacuno','se compro un kilo de cazuela de vacuno en los chavez',2500,'2019-05-06',5,'carniceria los chavez',1);
/*Registro de notas*/
INSERT INTO notas (titulo,descripcion,fecha_creacion) VALUES('Viaje a Santiago','fui el lunes a santiago a una entrevista de trabajo','2020-02-05'); | true |
91096185d1eb911b561be8c87aca63733aef8559 | SQL | BUPT-SCS-2015-Web-Developer/borrow-site | /localhost.sql | UTF-8 | 2,041 | 3.3125 | 3 | [] | no_license | -- phpMyAdmin SQL Dump
-- version phpStudy 2014
-- http://www.phpmyadmin.net
--
-- 主机: localhost
-- 生成日期: 2017 年 03 月 26 日 15:54
-- 服务器版本: 5.5.53
-- PHP 版本: 5.4.45
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
--
-- 数据库: `borrowsite`
--
CREATE DATABASE `borrowsite` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
USE `borrowsite`;
-- --------------------------------------------------------
--
-- 表的结构 `borrow_info`
--
CREATE TABLE IF NOT EXISTS `borrow_info` (
`pk_id` int(11) NOT NULL AUTO_INCREMENT,
`site_id` int(11) NOT NULL,
`date` date NOT NULL,
`period` varchar(11) NOT NULL,
`borrow_id` varchar(11) NOT NULL,
`name` varchar(11) NOT NULL,
`contact` char(11) NOT NULL,
`reason` varchar(1024) NOT NULL,
PRIMARY KEY (`pk_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=71 ;
--
-- 转存表中的数据 `borrow_info`
--
INSERT INTO `borrow_info` (`pk_id`, `site_id`, `date`, `period`, `borrow_id`, `name`, `contact`, `reason`) VALUES
(69, 2, '2017-04-01', '1', '988793', '如太', '范文峰', '峰峰'),
(70, 1, '2017-04-03', '0', '988793', 'ewer', 'dfd', 'dsfds');
-- --------------------------------------------------------
--
-- 表的结构 `site_info`
--
CREATE TABLE IF NOT EXISTS `site_info` (
`site_id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(11) NOT NULL,
PRIMARY KEY (`site_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=6 ;
--
-- 转存表中的数据 `site_info`
--
INSERT INTO `site_info` (`site_id`, `name`) VALUES
(1, '场地1'),
(2, '场地2'),
(3, '场地3');
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
| true |
f4f822c93ef094b65d429350f9fb4e4b700295fb | SQL | RKWKomZe/RkwForm | /ext_tables.sql | UTF-8 | 1,512 | 2.828125 | 3 | [] | no_license | #
# Table structure for table 'tx_rkwform_domain_model_standardform'
#
CREATE TABLE tx_rkwform_domain_model_standardform (
uid int(11) NOT NULL auto_increment,
pid int(11) DEFAULT '0' NOT NULL,
salutation int(11) DEFAULT '0' NOT NULL,
first_name varchar(255) DEFAULT '' NOT NULL,
last_name varchar(255) DEFAULT '' NOT NULL,
company varchar(255) DEFAULT '' NOT NULL,
email varchar(255) DEFAULT '' NOT NULL,
phone varchar(255) DEFAULT '' NOT NULL,
text varchar(255) DEFAULT '' NOT NULL,
tstamp int(11) unsigned DEFAULT '0' NOT NULL,
crdate int(11) unsigned DEFAULT '0' NOT NULL,
cruser_id int(11) unsigned DEFAULT '0' NOT NULL,
deleted tinyint(4) unsigned DEFAULT '0' NOT NULL,
PRIMARY KEY (uid),
KEY parent (pid)
);
#
# extend for bst2020Form (bausachverstaendigentag.de)
#
CREATE TABLE tx_rkwform_domain_model_standardform (
bst_number1 int(11) DEFAULT '0' NOT NULL,
bst_number2 int(11) DEFAULT '0' NOT NULL,
bst_number3 int(11) DEFAULT '0' NOT NULL,
bst_agree tinyint(4) unsigned DEFAULT '0' NOT NULL,
);
#
# extend for gemCommunityForm
#
CREATE TABLE tx_rkwform_domain_model_standardform (
identifier varchar(255) DEFAULT '' NOT NULL,
title varchar(255) DEFAULT '' NOT NULL,
street varchar(255) DEFAULT '' NOT NULL,
postal varchar(5) DEFAULT '' NOT NULL,
city varchar(255) DEFAULT '' NOT NULL,
topic varchar(255) DEFAULT '' NOT NULL,
token varchar(255) DEFAULT '' NOT NULL,
valid_until int(11) unsigned DEFAULT '0' NOT NULL,
enabled tinyint(1) DEFAULT '0' NOT NULL,
);
| true |
45dc7c0112276eb400831023ea24cb09dfdb8596 | SQL | sinotopia/sinotopia-pay | /sinotopia-pay-migration/scripts/20170513153050_init_pms_role_permission_data.sql | UTF-8 | 3,070 | 2.59375 | 3 | [
"Apache-2.0"
] | permissive | --
-- Copyright 2010-2016 the original author or authors.
--
-- 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.
--
-- // init pms_role_permission data
-- Migration SQL that makes the change goes here.
-- -- 角色与用户功能点关联的初始化数据
-- admin(拥有所有的权限点)
INSERT INTO `pms_role_permission` (role_id, permission_id) SELECT
1,
id
FROM PMS_PERMISSION;
-- guest (只有所有的查看权限)
INSERT INTO `pms_role_permission` (version, status, creator, create_time, editor, edit_time, remark, role_id, permission_id)
VALUES
(0, 'ACTIVE', 'roncoo', '2016-06-03 11:07:43', 'test', '2016-06-03 11:07:43', '', 2, 1),
(0, 'ACTIVE', 'roncoo', '2016-06-03 11:07:43', 'test', '2016-06-03 11:07:43', '', 2, 11),
(0, 'ACTIVE', 'roncoo', '2016-06-03 11:07:43', 'test', '2016-06-03 11:07:43', '', 2, 21),
(0, 'ACTIVE', 'roncoo', '2016-06-03 11:07:43', 'test', '2016-06-03 11:07:43', '', 2, 31),
(0, 'ACTIVE', 'roncoo', '2016-06-03 11:07:43', 'test', '2016-06-03 11:07:43', '', 2, 41),
(0, 'ACTIVE', 'roncoo', '2016-06-03 11:07:43', 'test', '2016-06-03 11:07:43', '', 2, 51),
(0, 'ACTIVE', 'roncoo', '2016-06-03 11:07:43', 'test', '2016-06-03 11:07:43', '', 2, 61),
(0, 'ACTIVE', 'roncoo', '2016-06-03 11:07:43', 'test', '2016-06-03 11:07:43', '', 2, 71),
(0, 'ACTIVE', 'roncoo', '2016-06-03 11:07:43', 'test', '2016-06-03 11:07:43', '', 2, 81),
(0, 'ACTIVE', 'roncoo', '2016-06-03 11:07:43', 'test', '2016-06-03 11:07:43', '', 2, 85),
(0, 'ACTIVE', 'roncoo', '2016-06-03 11:07:43', 'test', '2016-06-03 11:07:43', '', 2, 91),
(0, 'ACTIVE', 'roncoo', '2016-06-03 11:07:43', 'test', '2016-06-03 11:07:43', '', 2, 101),
(0, 'ACTIVE', 'roncoo', '2016-06-03 11:07:43', 'test', '2016-06-03 11:07:43', '', 2, 111),
(0, 'ACTIVE', 'roncoo', '2016-06-03 11:07:43', 'test', '2016-06-03 11:07:43', '', 2, 121),
(0, 'ACTIVE', 'roncoo', '2016-06-03 11:07:43', 'test', '2016-06-03 11:07:43', '', 2, 131),
(0, 'ACTIVE', 'roncoo', '2016-06-03 11:07:43', 'test', '2016-06-03 11:07:43', '', 2, 141),
(0, 'ACTIVE', 'roncoo', '2016-06-03 11:07:43', 'test', '2016-06-03 11:07:43', '', 2, 151);
-- //@UNDO
-- SQL to undo the change goes here.
DELETE FROM `pms_role_permission`
WHERE role_id = 1 OR
(role_id = 2 AND permission_id IN (1, 11, 21, 31, 41, 51, 61, 71, 81, 85, 91, 101, 111, 121, 131, 141, 151));
| true |
17a6be24bd4f9af7f260c2a15e34b06cc5d6cd51 | SQL | mdaria/SQL | /sql-ex.ru/DML/Ships/8.sql | UTF-8 | 257 | 2.59375 | 3 | [] | no_license | --Задание: 8 (Serge I: 2004-09-08)
--Удалите из таблицы Ships все корабли, потопленные в сражениях.
DELETE FROM Ships
FROM Ships INNER JOIN Outcomes ON Ships.name = Outcomes.ship
WHERE result = 'sunk';
| true |
85682dbe49f7020d8259bc7a1dc1ef706b24fd38 | SQL | Darkaby/Bibliotheque-numerique | /bookstore.sql | UTF-8 | 3,165 | 3.515625 | 4 | [] | no_license |
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Base de données : `bookstore`
--
-- --------------------------------------------------------
--
-- Structure de la table `author`
--
DROP TABLE IF EXISTS `author`;
CREATE TABLE IF NOT EXISTS `author` (
`A_ID` int(11) NOT NULL,
`A_FNAME` varchar(45) COLLATE utf8_bin NOT NULL,
`A_LNAME` varchar(45) COLLATE utf8_bin NOT NULL,
PRIMARY KEY (`A_ID`),
UNIQUE KEY `A_ID` (`A_ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
-- --------------------------------------------------------
--
-- Structure de la table `books`
--
DROP TABLE IF EXISTS `books`;
CREATE TABLE IF NOT EXISTS `books` (
`B_ID` int(11) NOT NULL,
`B_TITLE` varchar(45) COLLATE utf8_bin NOT NULL,
`B_A_ID` int(11) NOT NULL,
`B_PUBLISHER` varchar(45) COLLATE utf8_bin NOT NULL,
`B_PUB_DATE` date NOT NULL,
`B_SUBJECT` varchar(45) COLLATE utf8_bin NOT NULL,
`B_UNIT_PRIZE` int(11) NOT NULL,
`B_STOCK` int(11) NOT NULL,
PRIMARY KEY (`B_ID`),
UNIQUE KEY `B_ID` (`B_ID`),
KEY `B_A_ID` (`B_A_ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
-- --------------------------------------------------------
--
-- Structure de la table `customers`
--
DROP TABLE IF EXISTS `customers`;
CREATE TABLE IF NOT EXISTS `customers` (
`C_ID` int(11) NOT NULL,
`C_NAME` varchar(45) COLLATE utf8_bin NOT NULL,
`C_ADD` varchar(45) COLLATE utf8_bin NOT NULL,
PRIMARY KEY (`C_ID`),
UNIQUE KEY `C_ID` (`C_ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
-- --------------------------------------------------------
--
-- Structure de la table `reservation`
--
DROP TABLE IF EXISTS `reservation`;
CREATE TABLE IF NOT EXISTS `reservation` (
`R_ID` int(11) NOT NULL,
`R_C_ID` int(11) NOT NULL,
`R_C_NAME` varchar(45) COLLATE utf8_bin NOT NULL,
`R_B_ID` int(11) NOT NULL,
`R_B_TITLE` varchar(45) COLLATE utf8_bin NOT NULL,
`R_B_QUANTITY` int(11) NOT NULL,
PRIMARY KEY (`R_ID`),
UNIQUE KEY `R_ID` (`R_ID`),
KEY `R_B_ID` (`R_B_ID`),
KEY `R_C_ID` (`R_C_ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
--
-- Contraintes pour les tables déchargées
--
--
-- Contraintes pour la table `books`
--
ALTER TABLE `books`
ADD CONSTRAINT `books_ibfk_1` FOREIGN KEY (`B_A_ID`) REFERENCES `author` (`A_ID`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Contraintes pour la table `reservation`
--
ALTER TABLE `reservation`
ADD CONSTRAINT `reservation_ibfk_1` FOREIGN KEY (`R_B_ID`) REFERENCES `books` (`B_ID`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `reservation_ibfk_2` FOREIGN KEY (`R_C_ID`) REFERENCES `customers` (`C_ID`) ON DELETE CASCADE ON UPDATE CASCADE;
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
| true |
8ce2ad1f11667de7edb9499e5161169e7d9ef108 | SQL | beeflawg/bamazon | /schema.sql | UTF-8 | 349 | 3.125 | 3 | [] | no_license | -- DROP DATABASE IF EXISTS bamazonDB;
CREATE DATABASE bamazonDB;
USE bamazonDB;
CREATE TABLE products(
id INTEGER(11) AUTO_INCREMENT NOT NULL,
item_id INTEGER(11) not null,
product_name VARCHAR(100) not null,
department_name VARCHAR(100) not null,
price decimal(10,4) not null,
stock_quantity integer(11) not null,
PRIMARY KEY (id)
); | true |
a95cc57157b67e66d1a067a7b9226d15eeba1dc7 | SQL | PiotrIzw/liga-szachowa | /src/sql/ElementaryDatabase.sql | UTF-8 | 1,503 | 3.984375 | 4 | [] | no_license | #Usun baze
DROP DATABASE LigaSzachowa;
#Tworzenie bazy
CREATE DATABASE LigaSzachowa;
#Uzycie bazy
USE LigaSzachowa;
#Tworzenie tabeli ListaZawodnikow
CREATE TABLE ListaZawodnikow (
PlayerID int(11) NOT NULL AUTO_INCREMENT,
FirstName varchar(255) NOT NULL,
Surname varchar(255) NOT NULL,
Country varchar(255) NOT NULL,
BYear DATE NOT NULL,
PRIMARY KEY(PlayerID)
);
#Tworzenie tabeli ListaTurniejow
CREATE TABLE ListaTurniejow (
TournamentID int(11) NOT NULL AUTO_INCREMENT,
Nazwa varchar(255) NOT NULL,
MiejsceStartu varchar(255) NOT NULL,
DataStartu DATETIME NOT NULL,
PRIMARY KEY(TournamentID)
);
#Tworzenie tabeli RozegraneMecze
CREATE TABLE RozegraneMecze (
MatchID int(11) NOT NULL AUTO_INCREMENT,
DataRozegrania DATE NOT NULL,
TurniejID int(11) NOT NULL,
Kategoria varchar(255) NOT NULL,
Gracz1 int(11) NOT NULL,
Gracz2 int(11) NOT NULL,
Wynik varchar(255),
Etap varchar(255) NOT NULL,
PRIMARY KEY(MatchID),
FOREIGN KEY (Gracz1) REFERENCES ListaZawodnikow(PlayerID),
FOREIGN KEY (Gracz2) REFERENCES ListaZawodnikow(PlayerID),
FOREIGN KEY (TurniejID) REFERENCES ListaTurniejow(TournamentID)
);
#Tworzenie tabeli Ranking
CREATE TABLE Ranking (
RankingID int(11) NOT NULL AUTO_INCREMENT,
PlayerID int(11) NOT NULL,
Rating int(11) NOT NULL,
Kategoria varchar(255) NOT NULL,
PRIMARY KEY(RankingID),
FOREIGN KEY (PlayerID) REFERENCES ListaZawodnikow(PlayerID)
);
| true |
a8b7450beebaf7337fe4f1bfbba3dc4879618e33 | SQL | sanrules/mlp | /back/src/main/resources/database/mlp.sql | UTF-8 | 1,324 | 3.828125 | 4 | [] | no_license | create table if not exists category
(
id bigint auto_increment
primary key,
description varchar(50) null
);
create table if not exists product
(
id bigint auto_increment
primary key,
name varchar(50) null,
variety varchar(50) null,
description varchar(500) null
);
create table if not exists product_category
(
idProduct bigint not null,
idCategory bigint not null,
constraint idCategory_product_category_fk
foreign key (idCategory) references category (id)
on delete cascade,
constraint idProduct_product_category_fk
foreign key (idProduct) references product (id)
on delete cascade
);
create table if not exists product_price
(
date date not null,
idProduct bigint not null,
costPrice float null,
sellPrice float null,
primary key (date, idProduct),
constraint idProduct_product_price_fk
foreign key (idProduct) references product (id)
on update set default on delete cascade
);
create table if not exists user
(
id varchar(50) not null
primary key,
name varchar(45) null,
surname varchar(45) null,
email varchar(45) null,
birth_date datetime null,
phone_number varchar(45) null
);
| true |
5e1913af83ac387c0121c0f974a230f503f16703 | SQL | taipeifx/vote_data_TW | /2004_11/new templates 11.sql | UTF-8 | 6,400 | 3.84375 | 4 | [] | no_license | use vote_data;
#elctks has 43862 obs which should be correct
#elctks20160523 has 43863 obs. why?
# ENGLISH TEMPLATES############# ONE ###############
CREATE TABLE `vote_data`.`elbase_11` (
`V1` INT(3) NULL,
`V2` INT(3) NULL,
`V3` INT(2) NULL,
`V4` INT(3) NULL,
`V5` INT(4) NULL,
`AName` CHAR(30) NULL
)
DEFAULT CHARACTER SET = utf8;
LOAD DATA INFILE 'C:/ProgramData/MySQL/MySQL Server 8.0/Uploads/11/elbase.csv' #change
INTO TABLE elbase_11 #change
FIELDS TERMINATED BY ',';
#IGNORE 1 lines;
SELECT DISTINCT * FROM elbase_11;
SELECT DISTINCT * FROM elbase_9a WHERE V5 = 0;
##check to see difference between elbase9&10.
SELECT DISTINCT * #interesting. maybe the second elections they improved the voting process and added more districts?
FROM elbase_9a
LEFT OUTER JOIN elbase_10
ON elbase_9a.V1 = elbase_10.V1 AND elbase_9a.V2 = elbase_10.V2 AND elbase_9a.V3 = elbase_10.V3 AND elbase_9a.V4 = elbase_10.V4 AND elbase_9a.V5 = elbase_10.V5
WHERE elbase_9a.V5 = 0; #-1 alishan township in 2010
SELECT * FROM prof_tks_cand_9;
CREATE TABLE `vote_data`.`elbase_11E` (
`ANameE` CHAR(30) NULL
);
LOAD DATA INFILE 'C:/ProgramData/MySQL/MySQL Server 8.0/Uploads/11/AName11E.txt' #change
INTO TABLE elbase_11E #change
FIELDS TERMINATED BY ',';
#IGNORE 1 lines;
SELECT * FROM elbase_11E;
# to add english translations of ANameE column to elbase_9
# 1. add null column to ellbase_9att which is a table of english translations
# 2. create new table with information from both _9 and _9att, using pseudo row values
# #. new table is LEFT OUTER JOINED to original table on AName = AName
ALTER TABLE elbase_11E #add a NULL column
ADD COLUMN V4 CHAR(30) AFTER ANameE; #to sort
CREATE TABLE elbase_11E2 AS #create new table from pseudo tables
SELECT T1.AName, T2.ANameE from
(select *, row_number() over (order by V5) as rn from elbase_11) T1 #pseudo value row num, V5 to match up
,
(select *, row_number() over (order by V4) as rn from elbase_11E) T2 #pseudo value row num
WHERE T1.rn = T2.rn; #row numbers = each other
SELECT * FROM elbase_11E2;
#merge above elbase_10E2 with below elbase_10
CREATE TABLE elbase_11A
SELECT DISTINCT elbase_11.V1, elbase_11.V2, elbase_11.V3, elbase_11.V4, elbase_11.V5, elbase_11.AName, elbase_11E2.ANameE
FROM elbase_11
LEFT OUTER JOIN elbase_11E2
ON elbase_11.AName = elbase_11E2.AName;
#################### TWO ###################################
CREATE TABLE `vote_data`.`elcand_11` (
`V1` INT(2) NULL,
`V2` INT(3) NULL,
`V3` INT(2) NULL,
`V4` INT(3) NULL,
`V5` INT(4) NULL,
`CanNum` INT(3) NULL,
`CanName` VARCHAR(80) NULL,
`PPN` INT(3) NULL,
`Sex` INT(1) NULL,
`Bday` INT(7) NULL,
`Age` INT(3) NULL,
`BPlace` VARCHAR(10) NULL,
`Edu` VARCHAR(10) NULL,
`CurInc` VARCHAR(1) NULL,
`Win` VARCHAR(2) NULL,
`RMate` VARCHAR(2) NULL)
DEFAULT CHARACTER SET = utf8;
LOAD DATA INFILE 'C:/ProgramData/MySQL/MySQL Server 8.0/Uploads/11/elcand.csv' #change
INTO TABLE elcand_11 #change
FIELDS TERMINATED BY ',';
#"陳水扁" "呂秀蓮" "連戰" "宋楚瑜"
##update candidate names
UPDATE elcand_11
SET CanName = '陳水扁 Chen Shui-bian'
WHERE CanName = '陳水扁';
UPDATE elcand_11
SET CanName = '呂秀蓮 Annette Lu'
WHERE CanName = '呂秀蓮';
UPDATE elcand_11
SET CanName = '連戰 Lien Chan'
WHERE CanName = '連戰';
UPDATE elcand_11
SET CanName = '宋楚瑜 James Soong'
WHERE CanName = '宋楚瑜';
SELECT * FROM elcand_11;
#################### THREE ################################### elpaty_10 is the same
#CREATE TABLE `vote_data`.`elpaty_9` (
# `PPN` INT(3) NULL,
# `PParty` VARCHAR(40) NULL)
#DEFAULT CHARACTER SET = utf8;
#LOAD DATA INFILE 'C:/ProgramData/MySQL/MySQL Server 8.0/Uploads/9/elpaty.csv' #change
#INTO TABLE elpaty_9 #change
#FIELDS TERMINATED BY ',';
### update a single row's column
UPDATE elpaty_9
SET PParty = 'Kuo.Min.Tang'
WHERE PPN = 1;
UPDATE elpaty_9
SET PParty = 'Dem.Prog.Party'
WHERE PPN = 2;
UPDATE elpaty_9
SET PParty = 'New.Party'
WHERE PPN = 3;
UPDATE elpaty_9
SET PParty = 'Independent'
WHERE PPN = 98;
UPDATE elpaty_9
SET PParty = 'Independents'
WHERE PPN = 99;
SELECT * FROM elpaty_9; #save as elpaty_10?
#################### FOUR ###################################
CREATE TABLE `vote_data`.`elprof_11` (
`V1` INT(2) NULL,
`V2` INT(3) NULL,
`V3` INT(2) NULL,
`V4` INT(3) NULL,
`V5` INT(4) NULL,
`PollN` INT(4) NULL,
`ValidBallot` INT(8) NULL,
`InvalBallot` INT(8) NULL,
`TotalVote` INT(8) NULL,
`EligVoter` INT(8) NULL,
`TotalPop` INT(8) NULL,
`CandAmount` INT(4) NULL,
`ElecAmount` INT(4) NULL,
`CandMale` INT(4) NULL,
`CandFemale` INT(4) NULL,
`ElecMale` INT(4) NULL,
`ElecFemale` INT(4) NULL,
`PerEligVoter` DECIMAL(7,2) NULL,
`PerActVote` DECIMAL(7,2) NULL,
`PerElected` DECIMAL(7,2) NULL)
DEFAULT CHARACTER SET = utf8;
LOAD DATA INFILE 'C:/ProgramData/MySQL/MySQL Server 8.0/Uploads/11/elprof.csv' #change
INTO TABLE elprof_11 #change
FIELDS TERMINATED BY ',';
SELECT * FROM elprof_11;
#################### FIVE ###################################
CREATE TABLE `vote_data`.`elctks_11` (
`V1` INT(2) NULL,
`V2` INT(3) NULL,
`V3` INT(2) NULL,
`V4` INT(3) NULL,
`V5` INT(4) NULL,
`PollN` INT(4) NULL,
`CanNum` INT(4) NULL,
`VotesGot` INT(8) NULL,
`PerVotes` DECIMAL(7,2) NULL,
`Win` VARCHAR(2) NULL);
LOAD DATA INFILE 'C:/ProgramData/MySQL/MySQL Server 8.0/Uploads/11/elctks.csv' #change
INTO TABLE elctks_11 #change
FIELDS TERMINATED BY ',';
#elctks has 43862 obs which should be correct
#elctks20160523 has 43863 obs. why? 11xx
#compare: elctks_11 with elctks_11xx
# manual search in R resulted in an extra row #15393 , V4 0178
#################### tks_cand_9us ###################################
#3 "tidyr spread() on elctks: CanNum to VotesGot (CanNum1 , 2, 3, 4 with VotesGot values"
#"tidyr spread() on elctks: CanNames + PParty to VotesGot (Candidates x 4 with VotesGot values"
#done in R, grab tks_cand_9us
CREATE TABLE `vote_data`.`tks_cand_9us` (
`V1` INT(2) NULL,
`V2` INT(3) NULL,
`V3` INT(2) NULL,
`V4` INT(3) NULL,
`V5` INT(4) NULL,
`PollN` INT(4) NULL,
`李登輝 Lee Teng-hui,連戰 Lien Chan: Kuo.Min.Tang` INT(8) NULL,
`林洋港 Lin Yang-kang,郝柏村 Hau Pei-tsun: New.Party` INT(8) NULL,
`陳履安 Chen Li-an,王清峰 Wang Ching-feng: Independent` INT(8) NULL,
`彭明敏 Peng Ming-min,謝長廷 Frank Hsieh: Dem.Prog.Party` INT(8) NULL)
DEFAULT CHARACTER SET = utf8; | true |
be0d8b2f67c087d5c08f2a58844303a6318a7daf | SQL | MonetDBSolutions/airtraffic-benchmark | /sql/q18.sql | UTF-8 | 124 | 2.5625 | 3 | [] | no_license | SET SCHEMA atraf;
SELECT "Carrier", "Year", COUNT(*)
FROM ontime
GROUP BY "Carrier", "Year"
ORDER BY "Carrier", "Year"
;
| true |
2b21c2ea3c362f77702e2893f237d9e9afc6320d | SQL | NjekeMbai/Food-Guru | /user_registration.sql | UTF-8 | 1,907 | 3.078125 | 3 | [] | no_license | -- phpMyAdmin SQL Dump
-- version 4.9.1
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Aug 02, 2020 at 03:14 AM
-- Server version: 10.4.8-MariaDB
-- PHP Version: 7.1.32
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: `user_registration`
--
-- --------------------------------------------------------
--
-- Table structure for table `user_details`
--
CREATE TABLE `user_details` (
`user_id` int(11) NOT NULL,
`Name` varchar(255) NOT NULL,
`password` varchar(255) NOT NULL,
`user_type` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `user_details`
--
INSERT INTO `user_details` (`user_id`, `Name`, `password`, `user_type`) VALUES
(5, 'Baby', 'sharkdoodoo', 'client'),
(7, 'Njeke', '4576435', 'admin'),
(15, 'Amani', 'rert4c4td', 'client'),
(18, 'Joy', 'xcfgh', 'client'),
(19, 'Chimi', 'edwefwef', 'client'),
(20, 'Silver', '354658', 'client'),
(24, 'Linda', 'linda', 'client'),
(26, 'Victor', 'victor', 'client'),
(27, 'Anne', 'anne', 'client'),
(28, 'Mbai', 'mbai', 'admin');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `user_details`
--
ALTER TABLE `user_details`
ADD PRIMARY KEY (`user_id`,`Name`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `user_details`
--
ALTER TABLE `user_details`
MODIFY `user_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=29;
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
| true |
3cb42d0af18cc1b6e0fe78e34172671592ea7635 | SQL | joonyoo/snowflake_security_analytics | /snowsql/aws/elbMonitoringIngestion.sql | UTF-8 | 2,989 | 3.40625 | 3 | [
"Apache-2.0"
] | permissive | //===========================================================
// Create elb monitoring objects
//===========================================================
// set context
USE ROLE SNOWALERT;
USE WAREHOUSE SNOWALERT;
// CREATE TABLE
CREATE TABLE IF NOT EXISTS
SNOWALERT.AWS.ELB_MONITORING_LANDING_ZONE (
RAW_DATA VARIANT,
MONITORED_TIME TIMESTAMP_TZ,
HOSTED_ZONE_NAME STRING,
HOSTED_ZONE_NAME_ID STRING,
CREATED_TIME TIMESTAMP_TZ,
DNS_NAME STRING,
LOAD_BALANCER_NAME STRING,
REGION_NAME STRING(16),
SCHEME STRING,
VPC_ID STRING,
ACCOUNT_ID STRING(12)
);
// create pipe
CREATE OR REPLACE PIPE
SNOWALERT.AWS.ELB_MONITORING_PIPE
AUTO_INGEST=TRUE
AS
COPY INTO
SNOWALERT.AWS.ELB_MONITORING_LANDING_ZONE
FROM (
SELECT
$1 AS RAW_DATA,
TO_TIMESTAMP_TZ(
REGEXP_SUBSTR(
METADATA$FILENAME, '\/([^\/]*)\.json', 1, 1, 'e'
) || 'Z'
) AS MONITORED_TIME,
$1:"CanonicalHostedZoneName" :: STRING AS HOSTED_ZONE_NAME,
$1:"CanonicalHostedZoneNameID" :: STRING AS HOSTED_ZONE_NAME_ID,
TO_TIMESTAMP_TZ($1:"CreatedTime") AS CREATED_TIME,
$1:"DNSName" :: STRING AS DNS_NAME,
$1:"LoadBalancerName" :: STRING AS LOAD_BALANCER_NAME,
$1:"Region"."RegionName" :: STRING(16) AS REGION_NAME,
$1:"Scheme" :: STRING AS SCHEME,
$1:"VPCId" :: STRING AS VPC_ID,
$1:"AccountId" :: STRING(12) AS ACCOUNT_ID
FROM
@SNOWALERT.AWS.SNOWWATCH_S3_STAGE/elb_monitoring/
);
// Copy any data that may already exist
COPY INTO
SNOWALERT.AWS.ELB_MONITORING_LANDING_ZONE
FROM (
SELECT
$1 AS RAW_DATA,
TO_TIMESTAMP_TZ(
REGEXP_SUBSTR(
METADATA$FILENAME, '\/([^\/]*)\.json', 1, 1, 'e'
) || 'Z'
) AS MONITORED_TIME,
$1:"CanonicalHostedZoneName" :: STRING AS HOSTED_ZONE_NAME,
$1:"CanonicalHostedZoneNameID" :: STRING AS HOSTED_ZONE_NAME_ID,
TO_TIMESTAMP_TZ($1:"CreatedTime") AS CREATED_TIME,
$1:"DNSName" :: STRING AS DNS_NAME,
$1:"LoadBalancerName" :: STRING AS LOAD_BALANCER_NAME,
$1:"Region"."RegionName" :: STRING(16) AS REGION_NAME,
$1:"Scheme" :: STRING AS SCHEME,
$1:"VPCId" :: STRING AS VPC_ID,
$1:"AccountId" :: STRING(12) AS ACCOUNT_ID
FROM
@SNOWALERT.AWS.SNOWWATCH_S3_STAGE/elb_monitoring/
);
// NOTE: do not forget to add the sqs arn to your s3 bucket for auto_ingest support
SELECT SYSTEM$PIPE_STATUS('SNOWALERT.AWS.ELB_MONITORING_PIPE');
//===========================================================
| true |
26e8a20b44e5b75896b6f63845347c3756b0d4ac | SQL | srsohan150626/student_management | /database/student_management.sql | UTF-8 | 23,838 | 3.390625 | 3 | [
"MIT"
] | permissive | -- phpMyAdmin SQL Dump
-- version 4.9.0.1
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Nov 19, 2019 at 05:23 AM
-- Server version: 10.3.16-MariaDB
-- PHP Version: 7.3.7
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: `student_management`
--
-- --------------------------------------------------------
--
-- Table structure for table `academics`
--
CREATE TABLE `academics` (
`academic_id` bigint(20) UNSIGNED NOT NULL,
`academic` varchar(255) 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 for table `academics`
--
INSERT INTO `academics` (`academic_id`, `academic`, `created_at`, `updated_at`) VALUES
(1, '2019-20', NULL, NULL),
(2, '2020-21', NULL, NULL);
-- --------------------------------------------------------
--
-- Table structure for table `batches`
--
CREATE TABLE `batches` (
`batch_id` bigint(20) UNSIGNED NOT NULL,
`batch` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `batches`
--
INSERT INTO `batches` (`batch_id`, `batch`) VALUES
(1, 'fall'),
(2, 'winter'),
(3, 'spring');
-- --------------------------------------------------------
--
-- Table structure for table `classes`
--
CREATE TABLE `classes` (
`class_id` bigint(20) UNSIGNED NOT NULL,
`academic_id` bigint(20) UNSIGNED NOT NULL,
`program_id` bigint(20) UNSIGNED NOT NULL,
`shift_id` bigint(20) UNSIGNED NOT NULL,
`time_id` bigint(20) UNSIGNED NOT NULL,
`group_id` bigint(20) UNSIGNED NOT NULL,
`batch_id` bigint(20) UNSIGNED NOT NULL,
`start_date` date NOT NULL,
`end_date` date NOT NULL,
`active` tinyint(1) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `classes`
--
INSERT INTO `classes` (`class_id`, `academic_id`, `program_id`, `shift_id`, `time_id`, `group_id`, `batch_id`, `start_date`, `end_date`, `active`) VALUES
(1, 1, 1, 1, 1, 1, 1, '2019-09-04', '2020-09-06', 1),
(2, 1, 3, 2, 2, 2, 3, '2019-09-20', '2019-09-10', 1),
(3, 2, 4, 1, 1, 2, 2, '2019-09-03', '2020-09-01', 1),
(4, 2, 5, 1, 1, 3, 2, '2019-09-04', '2019-09-09', 1),
(5, 2, 6, 2, 2, 2, 2, '2019-09-01', '2019-11-01', 1);
-- --------------------------------------------------------
--
-- Table structure for table `fees`
--
CREATE TABLE `fees` (
`fee_id` bigint(20) UNSIGNED NOT NULL,
`academic_id` bigint(20) UNSIGNED NOT NULL,
`program_id` bigint(20) UNSIGNED NOT NULL,
`fee_type_id` bigint(20) UNSIGNED NOT NULL,
`fee_heading` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`amount` double(8,2) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `fees`
--
INSERT INTO `fees` (`fee_id`, `academic_id`, `program_id`, `fee_type_id`, `fee_heading`, `amount`) VALUES
(1, 1, 1, 1, 'fees', 1000.00),
(2, 2, 3, 1, 'feesvue', 2000.00),
(3, 2, 4, 1, 'Fees', 1234.00),
(4, 2, 5, 1, 'Fees', 20000.00),
(5, 2, 6, 1, 'Fees', 3000.00);
-- --------------------------------------------------------
--
-- Table structure for table `feetypes`
--
CREATE TABLE `feetypes` (
`fee_type_id` bigint(20) UNSIGNED NOT NULL,
`fee_type` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `feetypes`
--
INSERT INTO `feetypes` (`fee_type_id`, `fee_type`) VALUES
(1, 'course fee');
-- --------------------------------------------------------
--
-- Table structure for table `groups`
--
CREATE TABLE `groups` (
`group_id` bigint(20) UNSIGNED NOT NULL,
`groups` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `groups`
--
INSERT INTO `groups` (`group_id`, `groups`) VALUES
(1, 'A'),
(2, 'B'),
(3, 'C');
-- --------------------------------------------------------
--
-- Table structure for table `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 for table `migrations`
--
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES
(25, '2014_10_12_000000_create_users_table', 1),
(26, '2014_10_12_100000_create_password_resets_table', 1),
(27, '2019_08_28_030016_create_roles_table', 1),
(28, '2019_08_29_061401_create_academics_table', 1),
(29, '2019_09_19_184822_create_programs_table', 1),
(30, '2019_09_22_075859_create_shifts_table', 1),
(31, '2019_09_22_082722_create_times_table', 1),
(32, '2019_09_22_163117_create_batches_table', 1),
(33, '2019_09_22_172404_create_groups_table', 1),
(34, '2019_09_23_081337_create_classes_table', 1),
(35, '2019_09_27_103827_create_students_table', 1),
(36, '2019_09_30_175222_create_statuses_table', 1),
(37, '2019_10_01_073439_create_feetypes_table', 2),
(38, '2019_10_01_092222_create_receipts_table', 2),
(39, '2019_10_01_092535_create_receipt_details_table', 2),
(40, '2019_10_01_073224_create_fees_table', 3),
(41, '2019_10_01_072537_create_studentfees_table', 4),
(42, '2019_10_01_072606_create_transactions_table', 5);
-- --------------------------------------------------------
--
-- Table structure for table `password_resets`
--
CREATE TABLE `password_resets` (
`email` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`token` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `programs`
--
CREATE TABLE `programs` (
`program_id` bigint(20) UNSIGNED NOT NULL,
`program` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`description` varchar(255) 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 for table `programs`
--
INSERT INTO `programs` (`program_id`, `program`, `description`, `created_at`, `updated_at`) VALUES
(1, 'Laravel', NULL, NULL, NULL),
(2, 'Laravel', NULL, NULL, NULL),
(3, 'VueJs', NULL, NULL, NULL),
(4, 'JS', NULL, NULL, NULL),
(5, 'Asp.net', 'C# framework', NULL, NULL),
(6, 'C Programming', 'beginner level', NULL, NULL);
-- --------------------------------------------------------
--
-- Table structure for table `receipts`
--
CREATE TABLE `receipts` (
`receipt_id` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `receipts`
--
INSERT INTO `receipts` (`receipt_id`) VALUES
(1),
(2),
(3),
(4),
(5),
(6),
(7),
(8),
(9),
(10),
(11),
(12),
(13),
(14),
(15),
(16);
-- --------------------------------------------------------
--
-- Table structure for table `receipt_details`
--
CREATE TABLE `receipt_details` (
`receipt_id` int(11) NOT NULL,
`student_id` int(11) NOT NULL,
`transact_id` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `receipt_details`
--
INSERT INTO `receipt_details` (`receipt_id`, `student_id`, `transact_id`) VALUES
(1, 1, 1),
(2, 4, 2),
(3, 4, 3),
(4, 4, 4),
(5, 4, 5),
(6, 4, 6),
(7, 4, 7),
(8, 4, 8),
(9, 5, 9),
(10, 5, 10),
(11, 2, 11),
(12, 1, 12),
(13, 6, 13),
(14, 8, 14),
(15, 10, 15),
(16, 11, 16);
-- --------------------------------------------------------
--
-- Table structure for table `roles`
--
CREATE TABLE `roles` (
`id` bigint(20) UNSIGNED NOT NULL,
`name` varchar(255) 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 for table `roles`
--
INSERT INTO `roles` (`id`, `name`, `created_at`, `updated_at`) VALUES
(1, 'Admin', NULL, NULL),
(2, 'Receiptionist', NULL, NULL),
(3, 'Manager', NULL, NULL),
(4, 'CEO', NULL, NULL);
-- --------------------------------------------------------
--
-- Table structure for table `shifts`
--
CREATE TABLE `shifts` (
`shift_id` bigint(20) UNSIGNED NOT NULL,
`shift` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `shifts`
--
INSERT INTO `shifts` (`shift_id`, `shift`) VALUES
(1, 'morning'),
(2, 'evening');
-- --------------------------------------------------------
--
-- Table structure for table `statuses`
--
CREATE TABLE `statuses` (
`status_id` bigint(20) UNSIGNED NOT NULL,
`student_id` bigint(20) UNSIGNED NOT NULL,
`class_id` bigint(20) UNSIGNED NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `statuses`
--
INSERT INTO `statuses` (`status_id`, `student_id`, `class_id`) VALUES
(1, 1, 1),
(2, 2, 2),
(3, 3, 3),
(4, 4, 3),
(5, 5, 1),
(6, 6, 4),
(7, 8, 4),
(8, 10, 3),
(9, 11, 5);
-- --------------------------------------------------------
--
-- Table structure for table `studentfees`
--
CREATE TABLE `studentfees` (
`s_fee_id` bigint(20) UNSIGNED NOT NULL,
`fee_id` bigint(20) UNSIGNED NOT NULL,
`student_id` bigint(20) UNSIGNED NOT NULL,
`program_id` bigint(20) UNSIGNED NOT NULL,
`amount` double(8,2) NOT NULL,
`discount` double(8,2) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `studentfees`
--
INSERT INTO `studentfees` (`s_fee_id`, `fee_id`, `student_id`, `program_id`, `amount`, `discount`) VALUES
(2, 1, 1, 1, 800.00, 20.00),
(3, 3, 4, 4, 1000.00, 18.00),
(4, 3, 4, 4, 800.00, 35.00),
(5, 3, 4, 4, 1234.00, 0.00),
(6, 3, 4, 4, 1234.00, 0.00),
(7, 3, 4, 4, 1234.00, 0.00),
(8, 3, 4, 4, 1000.00, 18.00),
(9, 3, 4, 4, 800.00, 35.00),
(10, 1, 5, 1, 800.00, 20.00),
(11, 1, 5, 1, 900.00, 10.00),
(12, 2, 2, 3, 1000.00, 50.00),
(13, 1, 1, 1, 800.00, 20.00),
(14, 4, 6, 5, 18000.00, 10.00),
(15, 4, 8, 5, 18000.00, 10.00),
(16, 3, 10, 4, 1234.00, 0.00),
(17, 5, 11, 6, 2500.00, 16.00);
-- --------------------------------------------------------
--
-- Table structure for table `students`
--
CREATE TABLE `students` (
`student_id` bigint(20) UNSIGNED NOT NULL,
`first_name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`last_name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`sex` tinyint(1) NOT NULL,
`dob` date NOT NULL,
`email` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`status` tinyint(1) NOT NULL,
`nationality` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`national_card` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`passport` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`phone` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`village` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`commune` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`district` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`province` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`current_address` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`dateregistered` date NOT NULL,
`user_id` int(10) UNSIGNED NOT NULL,
`photo` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `students`
--
INSERT INTO `students` (`student_id`, `first_name`, `last_name`, `sex`, `dob`, `email`, `status`, `nationality`, `national_card`, `passport`, `phone`, `village`, `commune`, `district`, `province`, `current_address`, `dateregistered`, `user_id`, `photo`) VALUES
(1, 'Sohan', 'sohan', 0, '2019-10-07', NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2019-10-01', 1, ''),
(2, 'erroer', 'sohan', 0, '2019-10-25', NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2019-10-03', 1, ''),
(3, 'Afroja', 'Akter', 1, '2019-10-11', NULL, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2019-10-03', 1, ''),
(4, 'Afroja', 'Akter', 1, '2019-10-03', NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2019-10-03', 1, ''),
(5, 'st2', 'sohan', 0, '2019-10-10', NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2019-10-04', 1, ''),
(6, 'Prity Binte', 'Mustafiz', 1, '2019-10-11', 'sohan.ice.pust@gmail.com', 1, 'bd', '24235', '43532', '01766980719', 'Bagha', 'Bagha', 'Rajshahi', 'Bagha', 'Bagha', '2019-10-05', 1, ''),
(7, 'Sohan', 'sohan', 0, '2019-10-02', NULL, 0, 'bd', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2019-10-30', 1, ''),
(8, 'Sohan', 'sohan', 0, '2019-10-02', NULL, 0, 'bd', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2019-10-30', 1, ''),
(9, 'Nuzhat', 'Choity', 1, '2019-10-08', NULL, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2019-10-31', 1, ''),
(10, 'Nuzhat', 'Choity', 1, '2019-10-08', NULL, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2019-10-31', 1, ''),
(11, 'Tahosina', 'Naznin', 1, '2009-10-01', NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2019-10-31', 1, '');
-- --------------------------------------------------------
--
-- Table structure for table `times`
--
CREATE TABLE `times` (
`time_id` bigint(20) UNSIGNED NOT NULL,
`time` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `times`
--
INSERT INTO `times` (`time_id`, `time`) VALUES
(1, '09:30am-11:30am'),
(2, '4pm-6pm');
-- --------------------------------------------------------
--
-- Table structure for table `transactions`
--
CREATE TABLE `transactions` (
`transact_id` bigint(20) UNSIGNED NOT NULL,
`transact_date` datetime NOT NULL,
`fee_id` bigint(20) UNSIGNED NOT NULL,
`student_id` bigint(20) UNSIGNED NOT NULL,
`user_id` int(10) UNSIGNED NOT NULL,
`s_fee_id` bigint(20) UNSIGNED NOT NULL,
`paid` float NOT NULL,
`remark` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`description` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `transactions`
--
INSERT INTO `transactions` (`transact_id`, `transact_date`, `fee_id`, `student_id`, `user_id`, `s_fee_id`, `paid`, `remark`, `description`) VALUES
(1, '2019-10-03 03:27:49', 1, 1, 1, 2, 800, 'USD', 'Complete'),
(2, '2019-10-03 19:06:48', 3, 4, 1, 3, 1000, 'USD', 'Complete'),
(11, '2019-10-04 16:26:00', 2, 2, 1, 12, 1000, NULL, NULL),
(13, '2019-10-05 07:29:17', 4, 6, 1, 14, 18000, 'Taka', 'Complete'),
(14, '2019-10-30 15:22:38', 4, 8, 1, 15, 18000, 'complete', 'Complete'),
(15, '2019-10-31 10:05:10', 3, 10, 1, 16, 1234, 'no discount', 'Complete'),
(16, '2019-10-31 10:34:04', 5, 11, 1, 17, 2500, 'Taka', 'Complete');
-- --------------------------------------------------------
--
-- Table structure for table `users`
--
CREATE TABLE `users` (
`id` bigint(20) UNSIGNED NOT NULL,
`role_id` int(10) UNSIGNED NOT NULL,
`name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`username` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`email` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`password` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`remember_token` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`active` tinyint(1) 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 for table `users`
--
INSERT INTO `users` (`id`, `role_id`, `name`, `username`, `email`, `password`, `remember_token`, `active`, `created_at`, `updated_at`) VALUES
(1, 1, 'Prity Binte Mustafiz', 'pritypustice07', 'jibonprity@gmail.com', '$2y$10$2XIGX.lvQJIKcd28eHvhTecuKMWC25ialePc8ZFqAo.MQNEyhgy4q', 'zEWhkvbX62', 1, '2019-10-01 11:01:50', '2019-10-01 11:01:50');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `academics`
--
ALTER TABLE `academics`
ADD PRIMARY KEY (`academic_id`);
--
-- Indexes for table `batches`
--
ALTER TABLE `batches`
ADD PRIMARY KEY (`batch_id`);
--
-- Indexes for table `classes`
--
ALTER TABLE `classes`
ADD PRIMARY KEY (`class_id`),
ADD KEY `classes_academic_id_foreign` (`academic_id`),
ADD KEY `classes_program_id_foreign` (`program_id`),
ADD KEY `classes_shift_id_foreign` (`shift_id`),
ADD KEY `classes_time_id_foreign` (`time_id`),
ADD KEY `classes_group_id_foreign` (`group_id`),
ADD KEY `classes_batch_id_foreign` (`batch_id`);
--
-- Indexes for table `fees`
--
ALTER TABLE `fees`
ADD PRIMARY KEY (`fee_id`),
ADD KEY `fees_academic_id_foreign` (`academic_id`),
ADD KEY `fees_program_id_foreign` (`program_id`),
ADD KEY `fees_fee_type_id_foreign` (`fee_type_id`);
--
-- Indexes for table `feetypes`
--
ALTER TABLE `feetypes`
ADD PRIMARY KEY (`fee_type_id`);
--
-- Indexes for table `groups`
--
ALTER TABLE `groups`
ADD PRIMARY KEY (`group_id`);
--
-- Indexes for table `migrations`
--
ALTER TABLE `migrations`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `password_resets`
--
ALTER TABLE `password_resets`
ADD KEY `password_resets_email_index` (`email`);
--
-- Indexes for table `programs`
--
ALTER TABLE `programs`
ADD PRIMARY KEY (`program_id`);
--
-- Indexes for table `roles`
--
ALTER TABLE `roles`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `shifts`
--
ALTER TABLE `shifts`
ADD PRIMARY KEY (`shift_id`);
--
-- Indexes for table `statuses`
--
ALTER TABLE `statuses`
ADD PRIMARY KEY (`status_id`),
ADD KEY `statuses_student_id_foreign` (`student_id`),
ADD KEY `statuses_class_id_foreign` (`class_id`);
--
-- Indexes for table `studentfees`
--
ALTER TABLE `studentfees`
ADD PRIMARY KEY (`s_fee_id`),
ADD KEY `studentfees_fee_id_foreign` (`fee_id`),
ADD KEY `studentfees_student_id_foreign` (`student_id`),
ADD KEY `studentfees_program_id_foreign` (`program_id`);
--
-- Indexes for table `students`
--
ALTER TABLE `students`
ADD PRIMARY KEY (`student_id`);
--
-- Indexes for table `times`
--
ALTER TABLE `times`
ADD PRIMARY KEY (`time_id`);
--
-- Indexes for table `transactions`
--
ALTER TABLE `transactions`
ADD PRIMARY KEY (`transact_id`),
ADD KEY `transactions_fee_id_foreign` (`fee_id`),
ADD KEY `transactions_student_id_foreign` (`student_id`),
ADD KEY `transactions_s_fee_id_foreign` (`s_fee_id`);
--
-- Indexes for table `users`
--
ALTER TABLE `users`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `users_email_unique` (`email`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `academics`
--
ALTER TABLE `academics`
MODIFY `academic_id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT for table `batches`
--
ALTER TABLE `batches`
MODIFY `batch_id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
--
-- AUTO_INCREMENT for table `classes`
--
ALTER TABLE `classes`
MODIFY `class_id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;
--
-- AUTO_INCREMENT for table `fees`
--
ALTER TABLE `fees`
MODIFY `fee_id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;
--
-- AUTO_INCREMENT for table `feetypes`
--
ALTER TABLE `feetypes`
MODIFY `fee_type_id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT for table `groups`
--
ALTER TABLE `groups`
MODIFY `group_id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
--
-- AUTO_INCREMENT for table `migrations`
--
ALTER TABLE `migrations`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=43;
--
-- AUTO_INCREMENT for table `programs`
--
ALTER TABLE `programs`
MODIFY `program_id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7;
--
-- AUTO_INCREMENT for table `roles`
--
ALTER TABLE `roles`
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
--
-- AUTO_INCREMENT for table `shifts`
--
ALTER TABLE `shifts`
MODIFY `shift_id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT for table `statuses`
--
ALTER TABLE `statuses`
MODIFY `status_id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=10;
--
-- AUTO_INCREMENT for table `studentfees`
--
ALTER TABLE `studentfees`
MODIFY `s_fee_id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=18;
--
-- AUTO_INCREMENT for table `students`
--
ALTER TABLE `students`
MODIFY `student_id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=12;
--
-- AUTO_INCREMENT for table `times`
--
ALTER TABLE `times`
MODIFY `time_id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT for table `transactions`
--
ALTER TABLE `transactions`
MODIFY `transact_id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=17;
--
-- AUTO_INCREMENT for table `users`
--
ALTER TABLE `users`
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- Constraints for dumped tables
--
--
-- Constraints for table `classes`
--
ALTER TABLE `classes`
ADD CONSTRAINT `classes_academic_id_foreign` FOREIGN KEY (`academic_id`) REFERENCES `academics` (`academic_id`),
ADD CONSTRAINT `classes_batch_id_foreign` FOREIGN KEY (`batch_id`) REFERENCES `batches` (`batch_id`),
ADD CONSTRAINT `classes_group_id_foreign` FOREIGN KEY (`group_id`) REFERENCES `groups` (`group_id`),
ADD CONSTRAINT `classes_program_id_foreign` FOREIGN KEY (`program_id`) REFERENCES `programs` (`program_id`),
ADD CONSTRAINT `classes_shift_id_foreign` FOREIGN KEY (`shift_id`) REFERENCES `shifts` (`shift_id`),
ADD CONSTRAINT `classes_time_id_foreign` FOREIGN KEY (`time_id`) REFERENCES `times` (`time_id`);
--
-- Constraints for table `fees`
--
ALTER TABLE `fees`
ADD CONSTRAINT `fees_academic_id_foreign` FOREIGN KEY (`academic_id`) REFERENCES `academics` (`academic_id`),
ADD CONSTRAINT `fees_fee_type_id_foreign` FOREIGN KEY (`fee_type_id`) REFERENCES `feetypes` (`fee_type_id`),
ADD CONSTRAINT `fees_program_id_foreign` FOREIGN KEY (`program_id`) REFERENCES `programs` (`program_id`);
--
-- Constraints for table `statuses`
--
ALTER TABLE `statuses`
ADD CONSTRAINT `statuses_class_id_foreign` FOREIGN KEY (`class_id`) REFERENCES `classes` (`class_id`),
ADD CONSTRAINT `statuses_student_id_foreign` FOREIGN KEY (`student_id`) REFERENCES `students` (`student_id`);
--
-- Constraints for table `studentfees`
--
ALTER TABLE `studentfees`
ADD CONSTRAINT `studentfees_fee_id_foreign` FOREIGN KEY (`fee_id`) REFERENCES `fees` (`fee_id`),
ADD CONSTRAINT `studentfees_program_id_foreign` FOREIGN KEY (`program_id`) REFERENCES `programs` (`program_id`),
ADD CONSTRAINT `studentfees_student_id_foreign` FOREIGN KEY (`student_id`) REFERENCES `students` (`student_id`);
--
-- Constraints for table `transactions`
--
ALTER TABLE `transactions`
ADD CONSTRAINT `transactions_fee_id_foreign` FOREIGN KEY (`fee_id`) REFERENCES `fees` (`fee_id`),
ADD CONSTRAINT `transactions_s_fee_id_foreign` FOREIGN KEY (`s_fee_id`) REFERENCES `studentfees` (`s_fee_id`),
ADD CONSTRAINT `transactions_student_id_foreign` FOREIGN KEY (`student_id`) REFERENCES `students` (`student_id`);
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
| true |
31499cd0626d9b228d0aff828417d6ef0911d724 | SQL | 74Labs/node-sparx-ea | /sql/diagrams/multi.sql | UTF-8 | 119 | 2.53125 | 3 | [
"MIT"
] | permissive | select
Diagram_ID as id,
Name as name
from
t_diagram
order by
Name
offset (@OFFSET) rows
fetch next (@LIMIT) rows only
| true |
2d81adc63b6108f710b7635736a96ebbbf31b560 | SQL | ogu-rep/my-sql | /tmp.sql | UTF-8 | 477 | 3.40625 | 3 | [] | no_license | drop table if exists posts;
create table posts (
id int unsigned primary key auto_increment,
title varchar(255),
created_at datetime default current_timestamp,
updated_at datetime default current_timestamp on update currentstamp,
);
insert into posts (title) values ('title1');
insert into posts (title) values ('title2');
insert into posts (title) values ('title3');
select * from posts;
update posts set title = 'update title' where id = 2;
select * from posts;
| true |
edf68a9daaebfba5963fd05acdd143330c9dc9c9 | SQL | Wyshown/projectFile | /02_项目开发目录/01_数据库开发/02_表结构变更/18-12-24-app资讯列表迭代-店铺资讯-访谈字段增加.sql | UTF-8 | 932 | 2.859375 | 3 | [] | no_license | -- 店铺资讯id
ALTER
TABLE S_ARTICLE
ADD COLUMN ARTICLE_BELONG_STORE_ID varchar(32) DEFAULT NULL COMMENT "店铺资讯所属店铺id" AFTER VIDEO_URL ;
-- 专访(访谈) 头像
ALTER
TABLE S_ARTICLE
ADD COLUMN INTERVIEWEE_PROFILE_URL varchar(255) DEFAULT NULL COMMENT "专访(访谈) 被采访者头像" AFTER ARTICLE_BELONG_STORE_ID;
-- 专访(访谈) 专访姓名
ALTER
TABLE S_ARTICLE
ADD COLUMN INTERVIEWEE_NAME varchar(50) DEFAULT NULL COMMENT "专访(访谈) 被采访者姓名" AFTER INTERVIEWEE_PROFILE_URL;
-- 专访(访谈) 公司名称
ALTER
TABLE S_ARTICLE
ADD COLUMN INTERVIEWEE_STORE_NAME varchar(50) DEFAULT NULL COMMENT "专访(访谈) 被采访者所在公司名称" AFTER INTERVIEWEE_NAME;
-- 专访(访谈) 职位
ALTER
TABLE S_ARTICLE
ADD COLUMN INTERVIEWEE_POSITION varchar(50) DEFAULT NULL COMMENT "专访(访谈) 被采访者职位" AFTER INTERVIEWEE_STORE_NAME; | true |
2ff39ef45ecea40ce94a756e23aac72f784917e9 | SQL | nnanchari/pgexercises | /Aggregation.sql | UTF-8 | 8,888 | 4.65625 | 5 | [] | no_license | -- Count the number of expensive facilities
-- Question
-- Produce a count of the number of facilities that have a cost to guests of 10 or more.
select count(*) from cd.facilities
where guestcost>=10;
-- Count the number of recommendations each member makes.
-- Question
-- Produce a count of the number of recommendations each member has made. Order by member ID.
select recommendedby,count(*) from cd.members
where recommendedby is not null
group by recommendedby
order by recommendedby
-- List the total slots booked per facility
-- Question
-- Produce a list of the total number of slots booked per facility. For now, just produce an output table consisting of facility id and slots, sorted by facility id.
select facid,sum(slots) as totalslots
from cd.bookings
group by facid
order by facid
-- List the total slots booked per facility in a given month
-- Question
-- Produce a list of the total number of slots booked per facility in the month of September 2012. Produce an output table consisting of facility id and slots, sorted by the number of slots.
select facid,sum(slots) from cd.bookings
where extract(year from starttime)='2012' and extract(month from starttime)='09'
group by facid
order by sum(slots)
-- List the total slots booked per facility per month
-- Question
-- Produce a list of the total number of slots booked per facility per month in the year of 2012. Produce an output table consisting of facility id and slots, sorted by the id and month.
select facid,extract(month from starttime),sum(slots) from cd.bookings
where extract(year from starttime)='2012'
group by facid,extract(month from starttime)
order by facid,extract(month from starttime)
-- Find the count of members who have made at least one booking
-- Question
-- Find the total number of members who have made at least one booking.
select count(*) from cd.members where memid in (select memid from cd.bookings)
-- List facilities with more than 1000 slots booked
-- Question
-- Produce a list of facilities with more than 1000 slots booked. Produce an output table consisting of facility id and hours, sorted by facility id
select facid,sum(slots) from cd.bookings
group by facid
having sum(slots) >1000
order by facid
-- Find the total revenue of each facility
-- Question
-- Produce a list of facilities along with their total revenue. The output table should consist of facility name and revenue, sorted by revenue. Remember that theres a different cost for guests and members!
select f.name, sum(case when b.memid=0 then b.slots*f.guestcost else b.slots*f.membercost end) as revenue
from cd.bookings b join cd.facilities f on b.facid=f.facid
group by f.name
order by revenue
-- Find facilities with a total revenue less than 1000
-- Question
-- Produce a list of facilities with a total revenue less than 1000. Produce an output table consisting of facility name and revenue, sorted by revenue. Remember that theres a different cost for guests and members!
select f.name,
sum(case when b.memid=0 then b.slots*f.guestcost else b.slots*f.membercost end) as revenue
from cd.bookings b join cd.facilities f on b.facid=f.facid
group by f.name
having sum(case when b.memid=0 then b.slots*f.guestcost else b.slots*f.membercost end) < 1000
order by revenue
-- Output the facility id that has the highest number of slots booked
-- Question
-- Output the facility id that has the highest number of slots booked. For bonus points, try a version without a LIMIT clause. This version will probably look messy!
select facid, sum(slots) from cd.bookings
group by facid
having sum(slots)=
(select max(s) from (select sum(slots) as s from cd.bookings group by facid) A)
with t as (select facid, sum(slots) as s from cd.bookings group by facid)
select facid,s from t where s=(select max(s) from t)
-- List the total slots booked per facility per month, part 2
-- Question
-- Produce a list of the total number of slots booked per facility per month in the year of 2012. In this version, include output rows containing totals for all months per facility, and a total for all months for all facilities. The output table should consist of facility id, month and slots, sorted by the id and month. When calculating the aggregated values for all months and all facids, return null values in the month and facid columns.
with temp as (select facid,extract(month from starttime) as m,slots
from cd.bookings
where extract(year from starttime)='2012'
)
select facid,m,sum(slots) from temp group by facid,m
union
select facid,null,sum(slots) from temp group by facid
union
select null,null,sum(slots) from temp
order by facid,m
-- List the total hours booked per named facility
-- Question
-- Produce a list of the total number of hours booked per facility, remembering that a slot lasts half an hour. The output table should consist of the facility id, name, and hours booked, sorted by facility id. Try formatting the hours to two decimal places.
select b.facid,f.name, round(sum(b.slots)/2.0,2) as totalhours
from cd.bookings b join cd.facilities f
on b.facid=f.facid
group by 1,2
order by 1
-- List each members first booking after September 1st 2012
-- Question
-- Produce a list of each member name, id, and their first booking after September 1st 2012. Order by member ID.
select m.surname,m.firstname,m.memid,min(b.starttime)
from cd.members m join cd.bookings b
on m.memid=b.memid
where b.starttime> '2012-09-01'
group by 1,2,3
order by 3
-- Produce a list of member names, with each row containing the total member count
-- Question
-- Produce a list of member names, with each row containing the total member count. Order by join date.
select count(*) over(),firstname,surname from cd.members
order by joindate
-- Produce a numbered list of members
-- Question
-- Produce a monotonically increasing numbered list of members, ordered by their date of joining. Remember that member IDs are not guaranteed to be sequential.
select row_number() over(order by joindate asc),firstname,surname
from cd.members
-- Output the facility id that has the highest number of slots booked, again
-- Question
-- Output the facility id that has the highest number of slots booked. Ensure that in the event of a tie, all tieing results get output.
with temp as (
select facid,sum(slots),dense_rank() over(order by sum(slots) desc) as dr from cd.bookings
group by facid order by sum(slots) desc)
select facid,sum from temp where dr=1
-- Rank members by (rounded) hours used
-- Question
-- Produce a list of members, along with the number of hours they have booked in facilities, rounded to the nearest ten hours. Rank them by this rounded figure, producing output of first name, surname, rounded hours, rank. Sort by rank, surname, and first name.
select m.firstname,m.surname,((sum(b.slots)+10)/20)*10, rank() over(order by ((sum(b.slots)+10)/20)*10 desc) as dr
from cd.members m join cd.bookings b on m.memid=b.memid
group by 1,2
order by dr,2,1
-- Find the top three revenue generating facilities
-- Question
-- Produce a list of the top three revenue generating facilities (including ties). Output facility name and rank, sorted by rank and facility name.
select f.name,
rank() over(order by sum(case when b.memid=0 then slots*guestcost when b.memid<>0 then
slots*membercost end) desc)
from cd.bookings b join cd.facilities f
on b.facid=f.facid
group by f.name
limit 3
with temp as (select f.name,
rank() over(order by sum(case when b.memid=0 then slots*guestcost when b.memid<>0 then
slots*membercost end) desc)
from cd.bookings b join cd.facilities f
on b.facid=f.facid
group by f.name
)
select * from temp where rank in (1,2,3)
-- Classify facilities by value
-- Question
-- Classify facilities into equally sized groups of high, average, and low based on their revenue. Order by classification and facility name.
with temp as (select f.name,
ntile(3) over(order by sum(case when b.memid=0 then slots*guestcost when b.memid<>0 then
slots*membercost end) desc) as n
from cd.bookings b join cd.facilities f
on b.facid=f.facid
group by f.name
)
select name,
case when n=1 then 'high' when n=2 then 'average' when n=3 then 'low' end as revenue
from temp
order by n,name
-- Calculate the payback time for each facility
-- Question
-- Based on the 3 complete months of data so far, calculate the amount of time each facility will take to repay its cost of ownership. Remember to take into account ongoing monthly maintenance. Output facility name and payback time in months, order by facility name. Don't worry about differences in month lengths, we're only looking for a rough value here!
select f.name,
f.initialoutlay/((sum(case when memid=0 then slots*guestcost else slots*membercost end)/3)
-f.monthlymaintenance) as m
from cd.facilities f join cd.bookings b on f.facid=b.facid
group by f.facid
order by f.name
| true |
13290f0febf5721d1f13b1da2e269ffa86f5e680 | SQL | jukarsoft/poo_152_libreria_DPO | /libreria_original.sql | UTF-8 | 1,925 | 3.046875 | 3 | [] | no_license | -- phpMyAdmin SQL Dump
-- version 4.1.12
-- http://www.phpmyadmin.net
--
-- Servidor: 127.0.0.1
-- Tiempo de generación: 20-04-2017 a las 19:06:47
-- Versión del servidor: 5.6.16
-- Versión de PHP: 5.5.11
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
--
-- Base de datos: `libreria`
--
CREATE DATABASE IF NOT EXISTS `libreria` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
USE `libreria`;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `libros`
--
DROP TABLE IF EXISTS `libros`;
CREATE TABLE IF NOT EXISTS `libros` (
`idlibros` int(11) NOT NULL AUTO_INCREMENT,
`titulo` varchar(100) NOT NULL,
`precio` decimal(6,2) NOT NULL,
PRIMARY KEY (`idlibros`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=14 ;
--
-- Volcado de datos para la tabla `libros`
--
INSERT INTO `libros` (`idlibros`, `titulo`, `precio`) VALUES
(1, 'Cómo construir un condensador de fluzo', '50.00'),
(2, '1001 utilidades de los clips', '120.00'),
(3, 'Aplicaciones prácticas de los neutrinos en la cocina', '15.00'),
(5, 'Don Pantuflo Zapatilla', '35.00'),
(6, 'Cocina creativa con escorpiones', '90.00'),
(7, '100 formas de cocinar un guisante', '78.00'),
(8, 'Zacarías Satrústegui: vida y milagros', '45.00'),
(9, 'Segismundo Picaporte', '560.00'),
(10, 'Zascandil y Zahorín: dos truhanes de postín', '76.00'),
(11, 'Testaferría avanzada', '35.00'),
(12, 'Como vivir como un Rey sin dar un palo al agua', '120.00'),
(13, 'Enciclopedia de los miriapodos', '600.00');
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
| true |
21a5a79aed6eb7cea77528c50201491fc611d6b1 | SQL | wvanheemstra/core | /apps/tests/models/tables/structures/sql/tbl_test_scenario.sql | UTF-8 | 1,153 | 3.25 | 3 | [
"MIT"
] | permissive | /*
Navicat MySQL Data Transfer
Source Server : wvanheem_core_local
Source Server Version : 50509
Source Host : 127.0.0.1
Source Database : core
Target Server Version : 50509
File Encoding : utf-8
Date: 07/05/2012 14:19:56 PM
*/
SET NAMES utf8;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for `tbl_test_scenario`
-- ----------------------------
DROP TABLE IF EXISTS `tbl_test_scenario`;
CREATE TABLE `tbl_test_scenario` (
`kf_TestID` int(11) NOT NULL DEFAULT 0,
`kf_ScenarioID` int(11) NOT NULL DEFAULT 0,
`ts_Created` datetime DEFAULT NULL,
`ts_Updated` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
FOREIGN KEY (`kf_TestID`) REFERENCES `tbl_test` (`kp_TestID`) ON DELETE CASCADE,
FOREIGN KEY (`kf_ScenarioID`) REFERENCES `tbl_scenario` (`kp_ScenarioID`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
delimiter ;;
CREATE TRIGGER `Test_Scenario.ts_Created` BEFORE INSERT ON `tbl_test_scenario` FOR EACH ROW BEGIN
SET NEW.ts_Created = CURRENT_TIMESTAMP();
END;
;;
delimiter ;
SET FOREIGN_KEY_CHECKS = 1;
| true |
99dbed49c9157cf7534918bd6e40c0597fb927dd | SQL | lsst/qserv | /src/replica/schema/migrate-9-to-10.sql | UTF-8 | 1,577 | 3.25 | 3 | [] | no_license | -- A few notes on the default values of the new columns:
--
-- 1) Values of the `create_time` and `publish_time` columns of both tables will
-- be incorrect for any catalogs and tables. Correct values should be set
-- (if that will be needed) from at the earliest `create time` and `end_time`
-- values of the database transactions or the relevant persisent data structures.
-- Note that these values are set mainly for the information and bookkeeping
-- purposes, and they won't have any affect on the functioning of
-- the Replication/Ingest system.
--
-- 2) Values of the `is_published` column added to the second table is initialized
-- based on the status of the correspomnding catalog. This may potentially affect
-- catalogs that were "unpublished" for ingesting additional tables. This scenario
-- would need to be manually evaluated to prevent these new (yet to be published tables)
-- to be marked as "published".
ALTER TABLE `config_database` ADD COLUMN `create_time` BIGINT UNSIGNED NOT NULL DEFAULT 0 AFTER `is_published` ;
ALTER TABLE `config_database` ADD COLUMN `publish_time` BIGINT UNSIGNED NOT NULL DEFAULT (UNIX_TIMESTAMP() * 1000) AFTER `create_time` ;
ALTER TABLE `config_database_table` ADD COLUMN `is_published` BOOLEAN DEFAULT TRUE AFTER `longitude_key` ;
ALTER TABLE `config_database_table` ADD COLUMN `create_time` BIGINT UNSIGNED NOT NULL DEFAULT 0 AFTER `is_published` ;
ALTER TABLE `config_database_table` ADD COLUMN `publish_time` BIGINT UNSIGNED NOT NULL DEFAULT (UNIX_TIMESTAMP() * 1000) AFTER `create_time` ;
| true |
f1e1ec88e0d6fa6ddfe963b3b1599da6e6c54a53 | SQL | justin830827/Venhicle-Mangement-System | /sql/insert.sql | UTF-8 | 78,840 | 3.015625 | 3 | [] | no_license | /* Service Center Schema: |Center_id| Center_name| Center_addr| Center_phonenum| Open_dat| Open Hour| Emp_Quan */
insert into SERVICE_CENTER values ('S0001', 'Downtown Auto Care', '437 Fayetteville St., Raleigh, NC 27601', 18008999999, 'M-F', '8AM-7PM', 7);
insert into SERVICE_CENTER values ('S0002', 'Express Auto Shop', '201 N Tryon St, Charlotte, NC 28202', 17043331555, 'M-F', '8AM-7PM', 7);
/* Distributor Schemas: |distributor_id | distributor_name|*/
insert into DISTRIBUTOR values ('D0001', 'D1');
insert into DISTRIBUTOR values ('D0002', 'D2');
/* Login Schemas: |user_id(emp_id/customer+email) | Role| Password|*/
--Emp:
insert into LOGIN values ('3169785494', 'Manager', '0000');
insert into LOGIN values ('2139882011', 'Receptionist', '0000');
insert into LOGIN values ('4133359523', 'Mechanics', '0000');
insert into LOGIN values ('5634967912', 'Mechanics', '0000');
insert into LOGIN values ('7604579846', 'Mechanics', '0000');
insert into LOGIN values ('829843373', 'Mechanics', '0000');
insert into LOGIN values ('3154851152', 'Mechanics', '0000');
insert into LOGIN values ('9017770492', 'Manager', '0000');
insert into LOGIN values ('9723533691', 'Receptionist', '0000');
insert into LOGIN values ('9564440948', 'Mechanics', '0000');
insert into LOGIN values ('6417529403', 'Mechanics', '0000');
insert into LOGIN values ('9039671809', 'Mechanics', '0000');
insert into LOGIN values ('7578866330', 'Mechanics', '0000');
insert into LOGIN values ('9315391294', 'Mechanics', '0000');
--Customer:
insert into LOGIN values ('ethanhunt@gmail.com', 'Customer', '0000');
insert into LOGIN values ('jarvis@gmail.com', 'Customer', '0000');
insert into LOGIN values ('lovestory@gmail.com', 'Customer', '0000');
insert into LOGIN values ('venus@gmail.com', 'Customer', '0000');
/* Employee Schemas: | emp_id | emp_name | emp_role | emp_addr | emp_email | emp_phone | emp_startdate | emp_wage */
/*Center 1's enp*/
insert into EMPLOYEE values (950932130, 'Larry Cohen', 'Manager', '1979 Henry Street, Raleigh, NC 27606', 'lacohen@acme.com', 3169785494, TO_DATE('08/15/2016', 'MM/DD/YYYY'), 12000, 'Monthly','S0001');
insert into EMPLOYEE values (634622236, 'Willis Martin', 'Receptionist', '465 Aviation Way, Raleigh, NC 27601', 'wimartin@acme.com', 2139882011, TO_DATE('12/04/2017', 'MM/DD/YYYY'), 8000, 'Monthly','S0001');
insert into EMPLOYEE values (557279280, 'Jacob Gloss', 'Mechanics', '2014 Leverton Cove Road, Raleigh, NC 27560', 'jagloss@acme.com', 4133359523, TO_DATE('07/29/2018', 'MM/DD/YYYY'), 30, 'Hourly','S0001');
insert into EMPLOYEE values (183683346, 'Anthony Freeman', 'Mechanics', '1188 Summit Street, Raleigh, NC 27627', 'anfreeman@acme.com', 5634967912, TO_DATE('02/09/2015', 'MM/DD/YYYY'), 40, 'Hourly','S0001');
insert into EMPLOYEE values (557279281, 'Eric Fowler', 'Mechanics', '1114 Fincham Road, Raleigh, NC 27545', 'erfowler@acme.com', 7604579846, TO_DATE('05/01/2016', 'MM/DD/YYYY'), 35, 'Hourly','S0001');
insert into EMPLOYEE values (557279282, 'Roland Richmond', 'Mechanics', '1951 Little Acres Lane, Raleigh, NC 27513', 'rorichmond@acme.com', 829843373, TO_DATE('12/28/2017', 'MM/DD/YYYY'), 30, 'Hourly','S0001');
insert into EMPLOYEE values (557279283, 'Peter Fitzpatrick', 'Mechanics','4738 Buckhannan Avenue, Raleigh, NC 27625', 'pefitzpatrick@acme.com', 3154851152, TO_DATE('04/12/2017', 'MM/DD/YYYY'), 34, 'Hourly','S0001');
/*Center 2's emp*/
insert into EMPLOYEE values (291056276, 'Roderick Phillips', 'Manager', '1133 Burton Avenue, Charlotte, NC 28201', 'rophillips@acme.com', 9017770492, TO_DATE('04/15/2017', 'MM/DD/YYYY'), 12000, 'Monthly','S0002');
insert into EMPLOYEE values (911639633, 'Dena Holmes', 'Receptionist', '1382 Whispering Pines Circle, Charlotte, NC 28205', 'deholmes@acme.com', 9723533691, TO_DATE('01/04/2010', 'MM/DD/YYYY'), 9000, 'Monthly','S0002');
insert into EMPLOYEE values (590424694, 'Dustin Esparza', 'Mechanics', '3510 Hemlock Lane, Charlotte, NC 28202', 'duesparza@acme.com', 9564440948, TO_DATE('01/26/2017', 'MM/DD/YYYY'), 35, 'Hourly','S0002');
insert into EMPLOYEE values (401671897, 'Charles Pudilo', 'Mechanics', '196 Park Boulevard, Charlotte, NC 28222', 'chpudilo@acme.com', 6417529403, TO_DATE('07/06/2016', 'MM/DD/YYYY'), 40, 'Hourly','S0002');
insert into EMPLOYEE values (310773348, 'James Rivera', 'Mechanics', '908 Alpha Avenue, Charlotte, NC 28130', 'jarivera@acme.com', 9039671809, TO_DATE('10/29/2013', 'MM/DD/YYYY'), 40, 'Hourly','S0002');
insert into EMPLOYEE values (983204784, 'Willis Morton', 'Mechanics', '404 Tenmile, Charlotte, NC 28134', 'wimorton@acme.com', 7578866330, TO_DATE('10/13/2018', 'MM/DD/YYYY'), 30, 'Hourly','S0002');
insert into EMPLOYEE values (187658163, 'Rickie Henderson', 'Mechanics', '1963 Chenoweth Drive, Charlotte, NC 28228', 'rihenderson@acme.com', 9315391294, TO_DATE('05/29/2017', 'MM/DD/YYYY'), 30, 'Hourly','S0002');
/* Payroll schems : | PAYROLL_ID | PAYCHECK_DATE | UNITS (WORKDAYS) | PAYTYPE | CUR_EARN | SOFAR_EARN | */
insert into PAYROLL values ('P0001', TO_DATE('08/1/2018', 'MM/DD/YYYY'), 23, 'Monthly', 12000, 84000,950932130);
insert into PAYROLL values ('P0002', TO_DATE('09/1/2018', 'MM/DD/YYYY'), 23, 'Monthly', 12000, 96000,950932130);
insert into PAYROLL values ('P0003', TO_DATE('10/1/2018', 'MM/DD/YYYY'), 22, 'Monthly', 12000, 108000,950932130);
insert into PAYROLL values ('P0004', TO_DATE('11/1/2018', 'MM/DD/YYYY'), 23, 'Monthly', 12000, 120000,950932130);
insert into PAYROLL values ('P0005', TO_DATE('08/1/2018', 'MM/DD/YYYY'), 23, 'Monthly', 8000, 56000,634622236);
insert into PAYROLL values ('P0006', TO_DATE('09/1/2018', 'MM/DD/YYYY'), 23, 'Monthly', 8000, 64000,634622236);
insert into PAYROLL values ('P0007', TO_DATE('10/1/2018', 'MM/DD/YYYY'), 22, 'Monthly', 8000, 72000,634622236);
insert into PAYROLL values ('P0008', TO_DATE('11/1/2018', 'MM/DD/YYYY'), 23, 'Monthly', 8000, 80000,634622236);
insert into PAYROLL values ('P0009', TO_DATE('08/1/2018', 'MM/DD/YYYY'), 184, 'Hourly', 5520, 39090,557279280);
insert into PAYROLL values ('P0010', TO_DATE('09/1/2018', 'MM/DD/YYYY'), 189, 'Hourly', 5670, 44760,557279280);
insert into PAYROLL values ('P0011', TO_DATE('10/1/2018', 'MM/DD/YYYY'), 175, 'Hourly', 5250, 50010,557279280);
insert into PAYROLL values ('P0012', TO_DATE('11/1/2018', 'MM/DD/YYYY'), 190, 'Hourly', 5700, 55710,557279280);
/* Cartype schema: | Brand | Model | YEAR | ServiceA_mile | ServiceB_mile | Service C mile */
insert into CARTYPE values ('Honda', 'Civic',null,14000, 29000, 44000);
insert into CARTYPE values ('Toyota', 'Corolla',null,5000, 25000, 45000);
insert into CARTYPE values ('Nissan', 'Altima',null,10000, 25000, 50000);
insert into CARTYPE values ('Honda', 'Accord',null,15000, 37000, 67000);
insert into CARTYPE values ('Nissan', 'Rogue',null,10000, 37000, 70000);
insert into CARTYPE values ('Toyota', 'Prius',null,10000, 28000, 58000);
/* Customer schema: | customer_id | customer_phone | customer_addr | customer_name | customer_email | */
insert into CUSTOMER values (1001, 1234567890, '203, Park St, Raleigh, NC - 27603', 'Tom Cruise', 'ethanhunt@gmail.com', 'S0001');
/* Vehicle schema: | Plate | purchased_date | mileage | made_year | last_servicetype | last_servicedate */
insert into VEHICLE values ('XYZ-5643', TO_DATE('12/24/2009', 'MM/DD/YYYY'), 90452, 2009, 'Service C', TO_DATE('09/10/2018', 'MM/DD/YYYY'), 'Honda', 'Civic', 1001);
insert into VEHICLE values ('AHS-3132', TO_DATE('01/02/2011', 'MM/DD/YYYY'), 65452, 2007, 'Repair', TO_DATE('08/06/2018', 'MM/DD/YYYY'), 'Toyota', 'Prius', 1001);
insert into CUSTOMER values (1002, 9989877791, '12-A, High St, Raleigh, NC - 27605', 'Robert Downey Jr.', 'jarvis@gmail.com', 'S0001');
insert into VEHICLE values ('IRM-1212', TO_DATE('09/07/2002', 'MM/DD/YYYY'), 210452, 2001, 'Service A', TO_DATE('02/11/2018', 'MM/DD/YYYY'), 'Nissan', 'Altima', 1002);
insert into CUSTOMER values (1003, 8179827199, '3rd Ave, Charlotte, NC - 28134', 'Taylor Swift', 'lovestory@gmail.com', 'S0002');
insert into VEHICLE values ('TSW-3462', TO_DATE('12/09/2015', 'MM/DD/YYYY'), null, 2015, null, null, 'Honda', 'Accord', 1003);
insert into VEHICLE values ('DEL-8888', TO_DATE('05/11/2016', 'MM/DD/YYYY'), 31209, 2014, 'Service A', TO_DATE('02/11/2018', 'MM/DD/YYYY'), 'Nissan', 'Rogue', 1003);
insert into CUSTOMER values (1004, 8179827199, '90, Gorman St, Charlotte, NC - 28201', 'Serena Williams', 'venus@gmail.com', 'S0002');
insert into VEHICLE values ('P11-212A', TO_DATE('04/14/2010', 'MM/DD/YYYY'), 60452, 2009, 'Service A', TO_DATE('09/01/2017', 'MM/DD/YYYY'), 'Honda', 'Accord', 1004);
insert into VEHICLE values ('WIM-BLE5', TO_DATE('03/01/2014', 'MM/DD/YYYY'), 19876, 2013, 'Service B', TO_DATE('11/11/2016', 'MM/DD/YYYY'), 'Toyota', 'Prius', 1004);
/* Inventory schema: | PART_ID | Part_Name | Cartype | Part_price | Warranty | */
insert into INVENTORY values ('PH001','Air Filter', 'Honda', 59, 'N/A', 3, 'D0002');
/* Center Has Inventory: | Part_Name | Cartype | Center_id | min_quan | min_order | current_quan | */
insert into CENTER_HAS_INVENTORY values ('PH001', 'S0001', 20, 50, 43);
insert into CENTER_HAS_INVENTORY values ('PH001', 'S0002', 35, 6, 46);
/* Inventory by distributor: | Part_name | Part_Brand | Distributor_id | Windows | */
-- insert into INVENTORY_BY_DISTRIBUTOR values ('PH001', 'D0002', '3');
insert into INVENTORY values ('PH002','Axel Rod', 'Honda', 141, '2', 5, 'D0001');
insert into CENTER_HAS_INVENTORY values ('PH002', 'S0001', 5, 7, 8);
insert into CENTER_HAS_INVENTORY values ('PH002', 'S0002', 6, 10, 7);
-- insert into INVENTORY_BY_DISTRIBUTOR values ('PH002', 'D0001', '5');
insert into INVENTORY values ('PH003','Battery', 'Honda', 79, '3', 4, 'D0001');
insert into CENTER_HAS_INVENTORY values ('PH003', 'S0001', 20, 20, 5);
insert into CENTER_HAS_INVENTORY values ('PH003', 'S0002', 52, 3, 64);
-- insert into INVENTORY_BY_DISTRIBUTOR values ('PH003', 'D0001', '4');
insert into INVENTORY values ('PH004','Brake Fluid', 'Honda', 75, 'N/A', 4, 'D0002');
insert into CENTER_HAS_INVENTORY values ('PH004', 'S0001', 4, 6, 14);
insert into CENTER_HAS_INVENTORY values ('PH004', 'S0002', 3, 3, 15);
-- insert into INVENTORY_BY_DISTRIBUTOR values ('PH004', 'D0002', '4');
insert into INVENTORY values ('PH005','Brake Shoes', 'Honda', 41, '3', 5, 'D0002');
insert into CENTER_HAS_INVENTORY values ('PH005', 'S0001', 4, 3, 8);
insert into CENTER_HAS_INVENTORY values ('PH005', 'S0002', 3, 5, 20);
-- insert into INVENTORY_BY_DISTRIBUTOR values ('PH005', 'D0002', '5');
insert into INVENTORY values ('PH006','Camshaft', 'Honda', 511, '2', 4, 'D0001');
insert into CENTER_HAS_INVENTORY values ('PH006', 'S0001', 20, 5, 22);
insert into CENTER_HAS_INVENTORY values ('PH006', 'S0002', 42, 42, 6);
-- insert into INVENTORY_BY_DISTRIBUTOR values ('PH006', 'D0001', '4');
insert into INVENTORY values ('PH007','Catalytic converter', 'Honda', 716, '2', 3, 'D0002');
insert into CENTER_HAS_INVENTORY values ('PH007', 'S0001', 10, 5, 31);
insert into CENTER_HAS_INVENTORY values ('PH007', 'S0002', 24, 5, 29);
-- insert into INVENTORY_BY_DISTRIBUTOR values ('PH007', 'D0002', '3');
insert into INVENTORY values ('PH008','Coolant', 'Honda', 10, 'N/A', 4, 'D0002');
insert into CENTER_HAS_INVENTORY values ('PH008', 'S0001', 23, 4, 23);
insert into CENTER_HAS_INVENTORY values ('PH008', 'S0002', 12, 4, 21);
-- insert into INVENTORY_BY_DISTRIBUTOR values ('PH008', 'D0002', '4');
insert into INVENTORY values ('PH009','Drive belt', 'Honda', 1443, '1', 2, 'D0002');
insert into CENTER_HAS_INVENTORY values ('PH009', 'S0001', 30, 5, 35);
insert into CENTER_HAS_INVENTORY values ('PH009', 'S0002', 23, 4, 30);
-- insert into INVENTORY_BY_DISTRIBUTOR values ('PH009', 'D0002', '2');
insert into INVENTORY values ('PH010','Engine oil', 'Honda', 27, 'N/A', 2, 'D0001');
insert into CENTER_HAS_INVENTORY values ('PH010', 'S0001', 5, 5, 15);
insert into CENTER_HAS_INVENTORY values ('PH010', 'S0002', 10, 5, 26);
-- insert into INVENTORY_BY_DISTRIBUTOR values ('PH010', 'D0001', '2');
insert into INVENTORY values ('PH011','Gears', 'Honda', 1344, '3', 5, 'D0001');
insert into CENTER_HAS_INVENTORY values ('PH011', 'S0001', 3, 5, 18);
insert into CENTER_HAS_INVENTORY values ('PH011', 'S0002', 7, 5, 70);
-- insert into INVENTORY_BY_DISTRIBUTOR values ('PH011', 'D0001', '5');
insert into INVENTORY values ('PH012','Light assembly', 'Honda', 1342, '2', 3, 'D0001');
insert into CENTER_HAS_INVENTORY values ('PH012', 'S0001', 10, 8, 12);
insert into CENTER_HAS_INVENTORY values ('PH012', 'S0002', 6, 3, 8);
-- insert into INVENTORY_BY_DISTRIBUTOR values ('PH012', 'D0001', '3');
insert into INVENTORY values ('PH013','Oil Filter', 'Honda', 42, 'N/A', 4, 'D0001');
insert into CENTER_HAS_INVENTORY values ('PH013', 'S0001', 4, 4, 11);
insert into CENTER_HAS_INVENTORY values ('PH013', 'S0002', 24, 5, 31);
-- insert into INVENTORY_BY_DISTRIBUTOR values ('PH013', 'D0001', '4');
insert into INVENTORY values ('PH014','Piston', 'Honda', 1445, '1', 2, 'D0001');
insert into CENTER_HAS_INVENTORY values ('PH014', 'S0001', 48, 2, 55);
insert into CENTER_HAS_INVENTORY values ('PH014', 'S0002', 73, 5, 81);
-- insert into INVENTORY_BY_DISTRIBUTOR values ('PH014', 'D0001', '2');
insert into INVENTORY values ('PH015','Power Steering Fluid', 'Honda', 24, 'N/A', 5, 'D0001');
insert into CENTER_HAS_INVENTORY values ('PH015', 'S0001', 7, 5, 12);
insert into CENTER_HAS_INVENTORY values ('PH015', 'S0002', 6, 4, 17);
-- insert into INVENTORY_BY_DISTRIBUTOR values ('PH015', 'D0001', '5');
insert into INVENTORY values ('PH016','Spark plug', 'Honda', 50, '2', 5, 'D0002');
insert into CENTER_HAS_INVENTORY values ('PH016', 'S0001', 42, 5, 45);
insert into CENTER_HAS_INVENTORY values ('PH016', 'S0002', 32, 4, 50);
-- insert into INVENTORY_BY_DISTRIBUTOR values ('PH016', 'D0002', '5');
insert into INVENTORY values ('PH017','Suspension fluid', 'Honda', 77, 'N/A', 3, 'D0002');
insert into CENTER_HAS_INVENTORY values ('PH017', 'S0001', 11, 5, 13);
insert into CENTER_HAS_INVENTORY values ('PH017', 'S0002', 6, 6, 15);
-- insert into INVENTORY_BY_DISTRIBUTOR values ('PH017', 'D0002', '3');
insert into INVENTORY values ('PH018','Valve', 'Honda', 1261, '2', 3, 'D0001');
insert into CENTER_HAS_INVENTORY values ('PH018', 'S0001', 7, 5, 12);
insert into CENTER_HAS_INVENTORY values ('PH018', 'S0002', 3, 6, 11);
-- insert into INVENTORY_BY_DISTRIBUTOR values ('PH018', 'D0001', '3');
insert into INVENTORY values ('PH019','Wiper Fluid', 'Honda', 56, 'N/A', 3, 'D0002');
insert into CENTER_HAS_INVENTORY values ('PH019', 'S0001', 5, 5, 12);
insert into CENTER_HAS_INVENTORY values ('PH019', 'S0002', 13, 5, 16);
-- insert into INVENTORY_BY_DISTRIBUTOR values ('PH019', 'D0002', '3');
insert into INVENTORY values ('PT001','Air Filter', 'Toyota', 11, 'N/A', 3, 'D0002');
insert into CENTER_HAS_INVENTORY values ('PT001', 'S0001', 2, 5, 13);
insert into CENTER_HAS_INVENTORY values ('PT001', 'S0002', 5, 6, 26);
-- insert into INVENTORY_BY_DISTRIBUTOR values ('PT001', 'D0002', '3');
insert into INVENTORY values ('PT002','Axel Rod', 'Toyota', 123, '2', 5, 'D0001');
insert into CENTER_HAS_INVENTORY values ('PT002', 'S0001', 5, 7, 18);
insert into CENTER_HAS_INVENTORY values ('PT002', 'S0002', 6, 10, 27);
-- insert into INVENTORY_BY_DISTRIBUTOR values ('PT002', 'D0001', '5');
insert into INVENTORY values ('PT003','Battery', 'Toyota', 63, '6', 4, 'D0001');
insert into CENTER_HAS_INVENTORY values ('PT003', 'S0001', 2, 5 ,10);
insert into CENTER_HAS_INVENTORY values ('PT003', 'S0002', 2, 3 ,24);
-- insert into INVENTORY_BY_DISTRIBUTOR values ('PT003', 'D0001', '4');
insert into INVENTORY values ('PT004','Brake Fluid', 'Toyota', 24, 'N/A', 4, 'D0002');
insert into CENTER_HAS_INVENTORY values ('PT004', 'S0001', 4, 6, 4);
insert into CENTER_HAS_INVENTORY values ('PT004', 'S0002', 3, 3 ,25);
-- insert into INVENTORY_BY_DISTRIBUTOR values ('PT004', 'D0002', '4');
insert into INVENTORY values ('PT005','Brake Shoes', 'Toyota', 62, '2', 5, 'D0002');
insert into CENTER_HAS_INVENTORY values ('PT005', 'S0001', 4, 3, 18);
insert into CENTER_HAS_INVENTORY values ('PT005', 'S0002', 3, 5 ,20);
-- insert into INVENTORY_BY_DISTRIBUTOR values ('PT005', 'D0002', '5');
insert into INVENTORY values ('PT006','Camshaft', 'Toyota', 1428, '3', 4, 'D0001');
insert into CENTER_HAS_INVENTORY values ('PT006', 'S0001', 20, 5, 22);
insert into CENTER_HAS_INVENTORY values ('PT006', 'S0002', 42, 42 ,6);
-- insert into INVENTORY_BY_DISTRIBUTOR values ('PT006', 'D0001', '4');
insert into INVENTORY values ('PT007','Catalytic converter', 'Toyota', 801, '1', 3, 'D0002');
insert into CENTER_HAS_INVENTORY values ('PT007', 'S0001', 2, 5, 12);
insert into CENTER_HAS_INVENTORY values ('PT007', 'S0002', 2, 6 ,22);
-- insert into INVENTORY_BY_DISTRIBUTOR values ('PT007', 'D0002', '3');
insert into INVENTORY values ('PT008','Coolant', 'Toyota', 63, 'N/A', 4, 'D0002');
insert into CENTER_HAS_INVENTORY values ('PT008', 'S0001', 2, 4, 13);
insert into CENTER_HAS_INVENTORY values ('PT008', 'S0002', 2, 4 ,21);
-- insert into INVENTORY_BY_DISTRIBUTOR values ('PT008', 'D0002', '4');
insert into INVENTORY values ('PT009','Drive belt', 'Toyota', 528, '1', 2, 'D0002');
insert into CENTER_HAS_INVENTORY values ('PT009', 'S0001', 3, 5, 15);
insert into CENTER_HAS_INVENTORY values ('PT009', 'S0002', 3, 5 ,20);
-- insert into INVENTORY_BY_DISTRIBUTOR values ('PT009', 'D0002', '2');
insert into INVENTORY values ('PT010','Engine oil', 'Toyota', 63, 'N/A', 2, 'D0001');
insert into CENTER_HAS_INVENTORY values ('PT010', 'S0001', 5, 5, 15);
insert into CENTER_HAS_INVENTORY values ('PT010', 'S0002', 20, 5 ,26);
-- insert into INVENTORY_BY_DISTRIBUTOR values ('PT010', 'D0001', '2');
insert into INVENTORY values ('PT011','Gears', 'Toyota', 523, '1', 5, 'D0001');
insert into CENTER_HAS_INVENTORY values ('PT011', 'S0001', 3, 5, 8);
insert into CENTER_HAS_INVENTORY values ('PT011', 'S0002', 7, 5 ,20);
-- insert into INVENTORY_BY_DISTRIBUTOR values ('PT011', 'D0001', '5');
insert into INVENTORY values ('PT012','Light assembly', 'Toyota', 617, '2', 3, 'D0001');
insert into CENTER_HAS_INVENTORY values ('PT012', 'S0001', 1, 8, 2);
insert into CENTER_HAS_INVENTORY values ('PT012', 'S0002', 6, 3 ,28);
-- insert into INVENTORY_BY_DISTRIBUTOR values ('PT012', 'D0001', '3');
insert into INVENTORY values ('PT013','Oil Filter', 'Toyota', 36, 'N/A', 4, 'D0001');
insert into CENTER_HAS_INVENTORY values ('PT013', 'S0001', 1, 4, 1);
insert into CENTER_HAS_INVENTORY values ('PT013', 'S0002', 4, 5 ,21);
-- insert into INVENTORY_BY_DISTRIBUTOR values ('PT013', 'D0001', '4');
insert into INVENTORY values ('PT014','Piston', 'Toyota', 1256, '1', 2, 'D0001');
insert into CENTER_HAS_INVENTORY values ('PT014', 'S0001', 4, 2, 15);
insert into CENTER_HAS_INVENTORY values ('PT014', 'S0002', 3, 5 ,21);
-- insert into INVENTORY_BY_DISTRIBUTOR values ('PT014', 'D0001', '2');
insert into INVENTORY values ('PT015','Power Steering Fluid', 'Toyota', 17, 'N/A', 5, 'D0001');
insert into CENTER_HAS_INVENTORY values ('PT015', 'S0001', 1, 5, 2);
insert into CENTER_HAS_INVENTORY values ('PT015', 'S0002', 6, 4 ,27);
-- insert into INVENTORY_BY_DISTRIBUTOR values ('PT015', 'D0001', '5');
insert into INVENTORY values ('PT016','Spark plug', 'Toyota', 64, '2', 5, 'D0002');
insert into CENTER_HAS_INVENTORY values ('PT016', 'S0001', 4, 5, 15);
insert into CENTER_HAS_INVENTORY values ('PT016', 'S0002', 2, 4 ,20);
-- insert into INVENTORY_BY_DISTRIBUTOR values ('PT016', 'D0002', '5');
insert into INVENTORY values ('PT017','Suspension fluid', 'Toyota', 70, 'N/A', 3, 'D0002');
insert into CENTER_HAS_INVENTORY values ('PT017', 'S0001', 1, 5, 3);
insert into CENTER_HAS_INVENTORY values ('PT017', 'S0002', 6, 6 ,25);
-- insert into INVENTORY_BY_DISTRIBUTOR values ('PT017', 'D0002', '3');
insert into INVENTORY values ('PT018','Valve', 'Toyota', 1338, '1', 3, 'D0001');
insert into CENTER_HAS_INVENTORY values ('PT018', 'S0001', 7, 5, 12);
insert into CENTER_HAS_INVENTORY values ('PT018', 'S0002', 3, 6 ,11);
-- insert into INVENTORY_BY_DISTRIBUTOR values ('PT018', 'D0001', '3');
insert into INVENTORY values ('PT019','Wiper Fluid', 'Toyota', 28, 'N/A', 3, 'D0002');
insert into CENTER_HAS_INVENTORY values ('PT019', 'S0001', 5, 5, 12);
insert into CENTER_HAS_INVENTORY values ('PT019', 'S0002', 13, 5 ,16);
-- insert into INVENTORY_BY_DISTRIBUTOR values ('PT019', 'D0002', '3');
insert into INVENTORY values ('PN001','Air Filter', 'Nissan', 61, 'N/A', 3, 'D0002');
insert into CENTER_HAS_INVENTORY values ('PN001', 'S0001', 20, 5 ,33);
insert into CENTER_HAS_INVENTORY values ('PN001', 'S0002', 5, 6 ,16);
-- insert into INVENTORY_BY_DISTRIBUTOR values ('PN001', 'D0002', '3');
insert into INVENTORY values ('PN002','Axel Rod', 'Nissan', 241, '3', 5, 'D0001');
insert into CENTER_HAS_INVENTORY values ('PN002', 'S0001', 5, 7 ,38);
insert into CENTER_HAS_INVENTORY values ('PN002', 'S0002', 6, 10 ,17);
-- insert into INVENTORY_BY_DISTRIBUTOR values ('PN002', 'D0001', '5');
insert into INVENTORY values ('PN003','Battery', 'Nissan', 14, '3', 4, 'D0001');
insert into CENTER_HAS_INVENTORY values ('PN003', 'S0001', 20, 5 ,30);
insert into CENTER_HAS_INVENTORY values ('PN003', 'S0002', 5, 3 ,14);
insert into INVENTORY values ('PN004','Brake Fluid', 'Nissan', 16, 'N/A', 4, 'D0002');
insert into CENTER_HAS_INVENTORY values ('PN004', 'S0001', 4, 6, 34);
insert into CENTER_HAS_INVENTORY values ('PN004', 'S0002', 3, 3 ,15);
insert into INVENTORY values ('PN005','Brake Shoes', 'Nissan', 47, '1', 5, 'D0002');
insert into CENTER_HAS_INVENTORY values ('PN005', 'S0001', 4, 3, 38);
insert into CENTER_HAS_INVENTORY values ('PN005', 'S0002', 3, 5 ,10);
insert into INVENTORY values ('PN006','Camshaft', 'Nissan', 1295, '2', 4, 'D0001');
insert into CENTER_HAS_INVENTORY values ('PN006', 'S0001', 20, 5, 32);
insert into CENTER_HAS_INVENTORY values ('PN006', 'S0002', 4, 6, 12);
insert into INVENTORY values ('PN007','Catalytic converter', 'Nissan', 589, '1', 3, 'D0002');
insert into CENTER_HAS_INVENTORY values ('PN007', 'S0001', 10, 5, 31);
insert into CENTER_HAS_INVENTORY values ('PN007', 'S0002', 4, 5 , 19);
insert into INVENTORY values ('PN008','Coolant', 'Nissan', 39, 'N/A', 4, 'D0002');
insert into CENTER_HAS_INVENTORY values ('PN008', 'S0001', 23, 4, 33);
insert into CENTER_HAS_INVENTORY values ('PN008', 'S0002', 2, 4 ,11);
insert into INVENTORY values ('PN009','Drive belt', 'Nissan', 1084, '3', 2, 'D0002');
insert into CENTER_HAS_INVENTORY values ('PN009', 'S0001', 30, 5, 35);
insert into CENTER_HAS_INVENTORY values ('PN009', 'S0002', 3, 4 ,10);
insert into INVENTORY values ('PN010','Engine oil', 'Nissan', 14, 'N/A', 2, 'D0001');
insert into CENTER_HAS_INVENTORY values ('PN010', 'S0001', 5, 5, 35);
insert into CENTER_HAS_INVENTORY values ('PN010', 'S0002', 10, 5 ,16);
insert into INVENTORY values ('PN011','Gears', 'Nissan', 1176, '3', 5, 'D0001');
insert into CENTER_HAS_INVENTORY values ('PN011', 'S0001', 3, 5, 38);
insert into CENTER_HAS_INVENTORY values ('PN011', 'S0002', 7, 5 ,10);
insert into INVENTORY values ('PN012','Light assembly', 'Nissan', 1367, '2', 3, 'D0001');
insert into CENTER_HAS_INVENTORY values ('PN012', 'S0001', 10, 8, 32);
insert into CENTER_HAS_INVENTORY values ('PN012', 'S0002', 6, 3 ,18);
insert into INVENTORY values ('PN013','Oil Filter', 'Nissan', 61, 'N/A', 4, 'D0001');
insert into CENTER_HAS_INVENTORY values ('PN013', 'S0001', 4, 4, 31);
insert into CENTER_HAS_INVENTORY values ('PN013', 'S0002', 4, 5 ,11);
insert into INVENTORY values ('PN014','Piston', 'Nissan', 1341, '3', 2, 'D0001');
insert into CENTER_HAS_INVENTORY values ('PN014', 'S0001', 18, 2, 35);
insert into CENTER_HAS_INVENTORY values ('PN014', 'S0002', 7, 5 ,11);
insert into INVENTORY values ('PN015','Power Steering Fluid', 'Nissan', 20, 'N/A', 5, 'D0001');
insert into CENTER_HAS_INVENTORY values ('PN015', 'S0001', 7, 5, 32);
insert into CENTER_HAS_INVENTORY values ('PN015', 'S0002', 6, 4 ,17);
insert into INVENTORY values ('PN016', 'Spark plug', 'Nissan', 11, '1', 5, 'D0002');
insert into CENTER_HAS_INVENTORY values ('PN016', 'S0001', 12, 5, 35);
insert into CENTER_HAS_INVENTORY values ('PN016', 'S0002', 2, 4 ,10);
insert into INVENTORY values ('PN017', 'Suspension fluid', 'Nissan', 32, 'N/A', 3, 'D0002');
insert into CENTER_HAS_INVENTORY values ('PN017', 'S0001', 11, 5, 33);
insert into CENTER_HAS_INVENTORY values ('PN017', 'S0002', 6, 6 ,15);
insert into INVENTORY values ('PN018', 'Valve', 'Nissan', 1013, '1', 3, 'D0001');
insert into CENTER_HAS_INVENTORY values ('PN018', 'S0001', 7, 5, 32);
insert into CENTER_HAS_INVENTORY values ('PN018', 'S0002', 3, 6 ,11);
insert into INVENTORY values ('PN019', 'Wiper Fluid', 'Nissan', 31, 'N/A', 3, 'D0002');
insert into CENTER_HAS_INVENTORY values ('PN019', 'S0001', 5, 5, 12);
insert into CENTER_HAS_INVENTORY values ('PN019', 'S0002', 13, 5 ,16);
/* Basic service schema: Basic_service_id | car_model | service_name | charge_level | charge_money | required_time (hr) | part_quan | PART_ID | */
insert into BASIC_SERVICE values ('BSTC001','Corolla','Air filter change', 'low', 50, 0.25, 1,'PT001');
insert into BASIC_SERVICE values ('BSTP001','Prius','Air filter change', 'low', 50, 0.25, 1,'PT001');
insert into BASIC_SERVICE values ('BSHC001','Civic','Air filter change', 'low', 50, 0.25, 1,'PH001');
insert into BASIC_SERVICE values ('BSHA001','Accord','Air filter change', 'low', 50, 0.25, 2,'PH001');
insert into BASIC_SERVICE values ('BSNA001','Altima','Air filter change', 'low', 50, 0.25, 1,'PN001');
insert into BASIC_SERVICE values ('BSNR001','Rogue','Air filter change', 'low', 50, 0.25, 3,'PN001');
insert into BASIC_SERVICE values ('BSTC002','Corolla','Battery replacement', 'low', 50, 0.25, 1,'PT003');
insert into BASIC_SERVICE values ('BSTP002','Prius','Battery replacement', 'low', 50, 0.25, 1,'PT003');
insert into BASIC_SERVICE values ('BSHC002','Civic','Battery replacement', 'low', 50, 0.25, 1,'PH003');
insert into BASIC_SERVICE values ('BSHA002','Accord','Battery replacement', 'low', 50, 0.25, 1,'PH003');
insert into BASIC_SERVICE values ('BSNA002','Altima','Battery replacement', 'low', 50, 0.25, 1,'PN003');
insert into BASIC_SERVICE values ('BSNR002','Rogue','Battery replacement', 'low', 50, 0.25, 2,'PN003');
insert into BASIC_SERVICE values ('BSTC003','Corolla','Brake check', 'low', 50, 0.25, 1,'PT004');
insert into BASIC_SERVICE values ('BSTP003','Prius','Brake check', 'low', 50, 0.25, 1,'PT004');
insert into BASIC_SERVICE values ('BSHC003','Civic','Brake check', 'low', 50, 0.25, 1,'PH004');
insert into BASIC_SERVICE values ('BSHA003','Accord','Brake check', 'low', 50, 0.25, 1,'PH004');
insert into BASIC_SERVICE values ('BSNA003','Altima','Brake check', 'low', 50, 0.25, 1,'PN004');
insert into BASIC_SERVICE values ('BSNR003','Rogue','Brake check', 'low', 50, 0.25, 2,'PN004');
insert into BASIC_SERVICE values ('BSTC004','Corolla','Brake repair', 'low', 50, 0.25, 4,'PT005');
insert into BASIC_SERVICE values ('BSTP004','Prius','Brake repair', 'low', 50, 0.25, 4,'PT005');
insert into BASIC_SERVICE values ('BSHC004','Civic','Brake repair', 'low', 50, 0.25, 4,'PH005');
insert into BASIC_SERVICE values ('BSHA004','Accord','Brake repair', 'low', 50, 0.25, 4,'PH005');
insert into BASIC_SERVICE values ('BSNA004','Altima','Brake repair', 'low', 50, 0.25, 4,'PN005');
insert into BASIC_SERVICE values ('BSNR004','Rogue','Brake repair', 'low', 50, 0.25, 4,'PN005');
insert into BASIC_SERVICE values ('BSTC005','Corolla','Camshaft replacement', 'high', 65, 1, 1,'PT006');
insert into BASIC_SERVICE values ('BSTP005','Prius','Camshaft replacement', 'high', 65, 1, 1,'PT006');
insert into BASIC_SERVICE values ('BSHC005','Civic','Camshaft replacement', 'high', 65, 1, 1,'PH006');
insert into BASIC_SERVICE values ('BSHA005','Accord','Camshaft replacement', 'high', 65, 1, 1,'PH006');
insert into BASIC_SERVICE values ('BSNA005','Altima','Camshaft replacement', 'high', 65, 1, 1,'PN006');
insert into BASIC_SERVICE values ('BSNR005','Rogue','Camshaft replacement', 'high', 65, 1, 2,'PN006');
insert into BASIC_SERVICE values ('BSTC006','Corolla','Catalytic convertor replacement', 'high', 65, 1, 1,'PT007');
insert into BASIC_SERVICE values ('BSTP006','Prius','Catalytic convertor replacement', 'high', 65, 1, 1,'PT007');
insert into BASIC_SERVICE values ('BSHC006','Civic','Catalytic convertor replacement', 'high', 65, 1, 1,'PH007');
insert into BASIC_SERVICE values ('BSHA006','Accord','Catalytic convertor replacement', 'high', 65, 1, 1,'PH007');
insert into BASIC_SERVICE values ('BSNA006','Altima','Catalytic convertor replacement', 'high', 65, 1, 1,'PN007');
insert into BASIC_SERVICE values ('BSNR006','Rogue','Catalytic convertor replacement', 'high', 65, 1, 1,'PN007');
insert into BASIC_SERVICE values ('BSTC007','Corolla','Coolant recycle', 'low', 50, 0.25, 1,'PT008');
insert into BASIC_SERVICE values ('BSTP007','Prius','Coolant recycle', 'low', 50, 0.25, 1,'PT008');
insert into BASIC_SERVICE values ('BSHC007','Civic','Coolant recycle', 'low', 50, 0.25, 1,'PH008');
insert into BASIC_SERVICE values ('BSHA007','Accord','Coolant recycle', 'low', 50, 0.25, 1,'PH008');
insert into BASIC_SERVICE values ('BSNA007','Altima','Coolant recycle', 'low', 50, 0.25, 2,'PN008');
insert into BASIC_SERVICE values ('BSNR007','Rogue','Coolant recycle', 'low', 50, 0.25, 2,'PN008');
insert into BASIC_SERVICE values ('BSTC008','Corolla','Drive belt replacement', 'high', 65, 1, 1,'PT009');
insert into BASIC_SERVICE values ('BSTP008','Prius','Drive belt replacement', 'high', 65, 1, 1,'PT009');
insert into BASIC_SERVICE values ('BSHC008','Civic','Drive belt replacement', 'high', 65, 1, 1,'PH009');
insert into BASIC_SERVICE values ('BSHA008','Accord','Drive belt replacement', 'high', 65, 1, 1,'PH009');
insert into BASIC_SERVICE values ('BSNA008','Altima','Drive belt replacement', 'high', 65, 1, 1,'PN009');
insert into BASIC_SERVICE values ('BSNR008','Rogue','Drive belt replacement', 'high', 65, 1, 1,'PN009');
insert into BASIC_SERVICE values ('BSTC009','Corolla','Engine oil change', 'low', 50, 0.25, 1,'PT010');
insert into BASIC_SERVICE values ('BSTP009','Prius','Engine oil change', 'low', 50, 0.25, 1,'PT010');
insert into BASIC_SERVICE values ('BSHC009','Civic','Engine oil change', 'low', 50, 0.25, 1,'PH010');
insert into BASIC_SERVICE values ('BSHA009','Accord','Engine oil change', 'low', 50, 0.25, 1,'PH010');
insert into BASIC_SERVICE values ('BSNA009','Altima','Engine oil change', 'low', 50, 0.25, 2,'PN010');
insert into BASIC_SERVICE values ('BSNR009','Rogue','Engine oil change', 'low', 50, 0.25, 3,'PN010');
insert into BASIC_SERVICE values ('BSTC010','Corolla','Gearbox repair', 'high', 65, 1, 6,'PT011');
insert into BASIC_SERVICE values ('BSTP010','Prius','Gearbox repair', 'high', 65, 1, 6,'PT011');
insert into BASIC_SERVICE values ('BSHC010','Civic','Gearbox repair', 'high', 65, 1, 12,'PH011');
insert into BASIC_SERVICE values ('BSHA010','Accord','Gearbox repair', 'high', 65, 1, 7,'PH011');
insert into BASIC_SERVICE values ('BSNA010','Altima','Gearbox repair', 'high', 65, 1, 7,'PN011');
insert into BASIC_SERVICE values ('BSNR010','Rogue','Gearbox repair', 'high', 65, 1, 9,'PN011');
insert into BASIC_SERVICE values ('BSTC011','Corolla','Headlights replacement', 'low', 50, 0.5, 2,'PT012');
insert into BASIC_SERVICE values ('BSTP011','Prius','Headlights replacement', 'low', 50, 0.5, 2,'PT012');
insert into BASIC_SERVICE values ('BSHC011','Civic','Headlights replacement', 'low', 50, 0.5, 2,'PH012');
insert into BASIC_SERVICE values ('BSHA011','Accord','Headlights replacement', 'low', 50, 0.5, 2,'PH012');
insert into BASIC_SERVICE values ('BSNA011','Altima','Headlights replacement', 'low', 50, 0.5, 2,'PN012');
insert into BASIC_SERVICE values ('BSNR011','Rogue','Headlights replacement', 'low', 50, 0.5, 2,'PN012');
insert into BASIC_SERVICE values ('BSTC012','Corolla','Oil filter change', 'low', 50, 0.25, 1,'PT013');
insert into BASIC_SERVICE values ('BSTP012','Prius','Oil filter change', 'low', 50, 0.25, 1,'PT013');
insert into BASIC_SERVICE values ('BSHC012','Civic','Oil filter change', 'low', 50, 0.25, 1,'PH013');
insert into BASIC_SERVICE values ('BSHA012','Accord','Oil filter change', 'low', 50, 0.25, 1,'PH013');
insert into BASIC_SERVICE values ('BSNA012','Altima','Oil filter change', 'low', 50, 0.25, 1,'PN013');
insert into BASIC_SERVICE values ('BSNR012','Rogue','Oil filter change', 'low', 50, 0.25, 2,'PN013');
insert into BASIC_SERVICE values ('BSTC013','Corolla','Piston replacement', 'high', 65, 1, 4,'PT014');
insert into BASIC_SERVICE values ('BSTP013','Prius','Piston replacement', 'high', 65, 1, 4,'PT014');
insert into BASIC_SERVICE values ('BSHC013','Civic','Piston replacement', 'high', 65, 1, 4,'PH014');
insert into BASIC_SERVICE values ('BSHA013','Accord','Piston replacement', 'high', 65, 1, 4,'PH014');
insert into BASIC_SERVICE values ('BSNA013','Altima','Piston replacement', 'high', 65, 1, 6,'PN014');
insert into BASIC_SERVICE values ('BSNR013','Rogue','Piston replacement', 'high', 65, 1, 8,'PN014');
insert into BASIC_SERVICE values ('BSTC014','Corolla','Power steering check', 'low', 50, 0.25, 1,'PT015');
insert into BASIC_SERVICE values ('BSTP014','Prius','Power steering check', 'low', 50, 0.25, 1,'PT015');
insert into BASIC_SERVICE values ('BSHC014','Civic','Power steering check', 'low', 50, 0.25, 1,'PH015');
insert into BASIC_SERVICE values ('BSHA014','Accord','Power steering check', 'low', 50, 0.25, 1,'PH015');
insert into BASIC_SERVICE values ('BSNA014','Altima','Power steering check', 'low', 50, 0.25, 1,'PN015');
insert into BASIC_SERVICE values ('BSNR014','Rogue','Power steering check', 'low', 50, 0.25, 1,'PN015');
insert into BASIC_SERVICE values ('BSTC015','Corolla','Spark plugs replacement', 'low', 50, 0.25, 4,'PT016');
insert into BASIC_SERVICE values ('BSTP015','Prius','Spark plugs replacement', 'low', 50, 0.25, 4,'PT016');
insert into BASIC_SERVICE values ('BSHC015','Civic','Spark plugs replacement', 'low', 50, 0.25, 4,'PH016');
insert into BASIC_SERVICE values ('BSHA015','Accord','Spark plugs replacement', 'low', 50, 0.25, 4,'PH016');
insert into BASIC_SERVICE values ('BSNA015','Altima','Spark plugs replacement', 'low', 50, 0.25, 6,'PN016');
insert into BASIC_SERVICE values ('BSNR015','Rogue','Spark plugs replacement', 'low', 50, 0.25, 8,'PN016');
insert into BASIC_SERVICE values ('BSTC016','Corolla','Suspension check', 'low', 50, 0.25, 1,'PT017');
insert into BASIC_SERVICE values ('BSTP016','Prius','Suspension check', 'low', 50, 0.25, 1,'PT017');
insert into BASIC_SERVICE values ('BSHC016','Civic','Suspension check', 'low', 50, 0.25, 1,'PH017');
insert into BASIC_SERVICE values ('BSHA016','Accord','Suspension check', 'low', 50, 0.25, 1,'PH017');
insert into BASIC_SERVICE values ('BSNA016','Altima','Suspension check', 'low', 50, 0.25, 1,'PN017');
insert into BASIC_SERVICE values ('BSNR016','Rogue','Suspension check', 'low', 50, 0.25, 1,'PN017');
insert into BASIC_SERVICE values ('BSTC017','Corolla','Tail lights replacement', 'low', 50, 0.5, 2,'PT012');
insert into BASIC_SERVICE values ('BSTP017','Prius','Tail lights replacement', 'low', 50, 0.5, 2,'PT012');
insert into BASIC_SERVICE values ('BSHC017','Civic','Tail lights replacement', 'low', 50, 0.5, 2,'PH012');
insert into BASIC_SERVICE values ('BSHA017','Accord','Tail lights replacement', 'low', 50, 0.5, 2,'PH012');
insert into BASIC_SERVICE values ('BSNA017','Altima','Tail lights replacement', 'low', 50, 0.5, 2,'PN012');
insert into BASIC_SERVICE values ('BSNR017','Rogue','Tail lights replacement', 'low', 50, 0.5, 2,'PN012');
insert into BASIC_SERVICE values ('BSTC018','Corolla','Turn lights replacement', 'low', 50, 0.5, 4,'PT012');
insert into BASIC_SERVICE values ('BSTP018','Prius','Turn lights replacement', 'low', 50, 0.5, 4,'PT012');
insert into BASIC_SERVICE values ('BSHC018','Civic','Turn lights replacement', 'low', 50, 0.5, 4,'PH012');
insert into BASIC_SERVICE values ('BSHA018','Accord','Turn lights replacement', 'low', 50, 0.5, 4,'PH012');
insert into BASIC_SERVICE values ('BSNA018','Altima','Turn lights replacement', 'low', 50, 0.5, 4,'PN012');
insert into BASIC_SERVICE values ('BSNR018','Rogue','Turn lights replacement', 'low', 50, 0.5, 4,'PN012');
insert into BASIC_SERVICE values ('BSTC019','Corolla','Valve replacement', 'high', 65, 1, 4,'PT018');
insert into BASIC_SERVICE values ('BSTP019','Prius','Valve replacement', 'high', 65, 1, 4,'PT018');
insert into BASIC_SERVICE values ('BSHC019','Civic','Valve replacement', 'high', 65, 1, 4,'PH018');
insert into BASIC_SERVICE values ('BSHA019','Accord','Valve replacement', 'high', 65, 1, 4,'PH018');
insert into BASIC_SERVICE values ('BSNA019','Altima','Valve replacement', 'high', 65, 1, 6,'PN018');
insert into BASIC_SERVICE values ('BSNR019','Rogue','Valve replacement', 'high', 65, 1, 8,'PN018');
insert into BASIC_SERVICE values ('BSTC020','Corolla','Wheel alignment', 'high', 65, 1, 2,'PT002');
insert into BASIC_SERVICE values ('BSTP020','Prius','Wheel alignment', 'high', 65, 1, 2,'PT002');
insert into BASIC_SERVICE values ('BSHC020','Civic','Wheel alignment', 'high', 65, 1, 2,'PH002');
insert into BASIC_SERVICE values ('BSHA020','Accord','Wheel alignment', 'high', 65, 1, 2,'PH002');
insert into BASIC_SERVICE values ('BSNA020','Altima','Wheel alignment', 'high', 65, 1, 2,'PN002');
insert into BASIC_SERVICE values ('BSNR020','Rogue','Wheel alignment', 'high', 65, 1, 2,'PN002');
insert into BASIC_SERVICE values ('BSTC021','Corolla','Wiper check', 'low', 50, 0.25, 1,'PT019');
insert into BASIC_SERVICE values ('BSTP021','Prius','Wiper check', 'low', 50, 0.25, 1,'PT019');
insert into BASIC_SERVICE values ('BSHC021','Civic','Wiper check', 'low', 50, 0.25, 1,'PH019');
insert into BASIC_SERVICE values ('BSHA021','Accord','Wiper check', 'low', 50, 0.25, 1,'PH019');
insert into BASIC_SERVICE values ('BSNA021','Altima','Wiper check', 'low', 50, 0.25, 1,'PN019');
insert into BASIC_SERVICE values ('BSNR021','Rogue','Wiper check', 'low', 50, 0.25, 1,'PN019');
/* CARTYPE_HAS_BASIC_SERVICE: | BRAND | MODEL | BASIC_SERVICE ID | */
/* Toyota Corlloa */
insert into CARTYPE_HAS_BASIC_SERVICE values ('Toyota', 'Corolla','Service A','BSTC009');
insert into CARTYPE_HAS_BASIC_SERVICE values ('Toyota', 'Corolla','Service A','BSTC007');
insert into CARTYPE_HAS_BASIC_SERVICE values ('Toyota', 'Prius','Service A','BSTP009');
insert into CARTYPE_HAS_BASIC_SERVICE values ('Toyota', 'Prius','Service A','BSTP012');
insert into CARTYPE_HAS_BASIC_SERVICE values ('Toyota', 'Prius','Service A','BSTP007');
insert into CARTYPE_HAS_BASIC_SERVICE values ('Honda', 'Civic','Service A','BSHC007');
insert into CARTYPE_HAS_BASIC_SERVICE values ('Honda', 'Civic','Service A','BSHC003');
insert into CARTYPE_HAS_BASIC_SERVICE values ('Honda', 'Civic','Service A','BSHC009');
insert into CARTYPE_HAS_BASIC_SERVICE values ('Honda', 'Accord','Service A','BSHA009');
insert into CARTYPE_HAS_BASIC_SERVICE values ('Honda', 'Accord','Service A','BSHA001');
insert into CARTYPE_HAS_BASIC_SERVICE values ('Honda', 'Accord','Service A','BSHA012');
insert into CARTYPE_HAS_BASIC_SERVICE values ('Honda', 'Accord','Service A','BSHA007');
insert into CARTYPE_HAS_BASIC_SERVICE values ('Nissan', 'Altima','Service A','BSNA009');
insert into CARTYPE_HAS_BASIC_SERVICE values ('Nissan', 'Altima','Service A','BSNA001');
insert into CARTYPE_HAS_BASIC_SERVICE values ('Nissan', 'Altima','Service A','BSNA012');
insert into CARTYPE_HAS_BASIC_SERVICE values ('Nissan', 'Altima','Service A','BSNA007');
insert into CARTYPE_HAS_BASIC_SERVICE values ('Nissan', 'Rogue','Service A','BSNR009');
insert into CARTYPE_HAS_BASIC_SERVICE values ('Nissan', 'Rogue','Service A','BSNR001');
insert into CARTYPE_HAS_BASIC_SERVICE values ('Nissan', 'Rogue','Service A','BSNR014');
insert into CARTYPE_HAS_BASIC_SERVICE values ('Nissan', 'Rogue','Service A','BSNR012');
insert into CARTYPE_HAS_BASIC_SERVICE values ('Nissan', 'Rogue','Service A','BSNR003');
insert into CARTYPE_HAS_BASIC_SERVICE values ('Nissan', 'Rogue','Service A','BSNR007');
insert into CARTYPE_HAS_BASIC_SERVICE values ('Toyota', 'Corolla','Service B','BSTC001');
insert into CARTYPE_HAS_BASIC_SERVICE values ('Toyota', 'Corolla','Service B','BSTC012');
insert into CARTYPE_HAS_BASIC_SERVICE values ('Toyota', 'Corolla','Service B','BSTC003');
insert into CARTYPE_HAS_BASIC_SERVICE values ('Toyota', 'Corolla','Service B','BSTC021');
insert into CARTYPE_HAS_BASIC_SERVICE values ('Toyota', 'Corolla','Service B','BSTC015');
insert into CARTYPE_HAS_BASIC_SERVICE values ('Toyota', 'Prius','Service B','BSTP001');
insert into CARTYPE_HAS_BASIC_SERVICE values ('Toyota', 'Prius','Service B','BSTP003');
insert into CARTYPE_HAS_BASIC_SERVICE values ('Toyota', 'Prius','Service B','BSTP021');
insert into CARTYPE_HAS_BASIC_SERVICE values ('Toyota', 'Prius','Service B','BSTP015');
insert into CARTYPE_HAS_BASIC_SERVICE values ('Toyota', 'Prius','Service B','BSTP002');
insert into CARTYPE_HAS_BASIC_SERVICE values ('Honda', 'Civic','Service B','BSHC001');
insert into CARTYPE_HAS_BASIC_SERVICE values ('Honda', 'Civic','Service B','BSHC012');
insert into CARTYPE_HAS_BASIC_SERVICE values ('Honda', 'Civic','Service B','BSHC004');
insert into CARTYPE_HAS_BASIC_SERVICE values ('Honda', 'Civic','Service B','BSHC021');
insert into CARTYPE_HAS_BASIC_SERVICE values ('Honda', 'Civic','Service B','BSHC015');
insert into CARTYPE_HAS_BASIC_SERVICE values ('Honda', 'Accord','Service B','BSHA003');
insert into CARTYPE_HAS_BASIC_SERVICE values ('Honda', 'Accord','Service B','BSHA021');
insert into CARTYPE_HAS_BASIC_SERVICE values ('Honda', 'Accord','Service B','BSHA015');
insert into CARTYPE_HAS_BASIC_SERVICE values ('Nissan', 'Altima','Service B','BSNA003');
insert into CARTYPE_HAS_BASIC_SERVICE values ('Nissan', 'Altima','Service B','BSNA021');
insert into CARTYPE_HAS_BASIC_SERVICE values ('Nissan', 'Rogue','Service B','BSNR016');
insert into CARTYPE_HAS_BASIC_SERVICE values ('Nissan', 'Rogue','Service B','BSNR021');
insert into CARTYPE_HAS_BASIC_SERVICE values ('Nissan', 'Rogue','Service B','BSNR015');
insert into CARTYPE_HAS_BASIC_SERVICE values ('Toyota', 'Corolla','Service C','BSTC016');
insert into CARTYPE_HAS_BASIC_SERVICE values ('Toyota', 'Corolla','Service C','BSTC004');
insert into CARTYPE_HAS_BASIC_SERVICE values ('Toyota', 'Corolla','Service C','BSTC014');
insert into CARTYPE_HAS_BASIC_SERVICE values ('Toyota', 'Prius','Service C','BSTP016');
insert into CARTYPE_HAS_BASIC_SERVICE values ('Toyota', 'Prius','Service C','BSTP004');
insert into CARTYPE_HAS_BASIC_SERVICE values ('Toyota', 'Prius','Service C','BSTP014');
insert into CARTYPE_HAS_BASIC_SERVICE values ('Honda', 'Civic','Service C','BSHC016');
insert into CARTYPE_HAS_BASIC_SERVICE values ('Honda', 'Civic','Service C','BSHC014');
insert into CARTYPE_HAS_BASIC_SERVICE values ('Honda', 'Accord','Service C','BSHA016');
insert into CARTYPE_HAS_BASIC_SERVICE values ('Honda', 'Accord','Service C','BSHA004');
insert into CARTYPE_HAS_BASIC_SERVICE values ('Honda', 'Accord','Service C','BSHA014');
insert into CARTYPE_HAS_BASIC_SERVICE values ('Nissan', 'Altima','Service C','BSNA016');
insert into CARTYPE_HAS_BASIC_SERVICE values ('Nissan', 'Altima','Service C','BSNA004');
insert into CARTYPE_HAS_BASIC_SERVICE values ('Nissan', 'Altima','Service C','BSNA014');
insert into CARTYPE_HAS_BASIC_SERVICE values ('Nissan', 'Altima','Service C','BSNA015');
insert into CARTYPE_HAS_BASIC_SERVICE values ('Nissan', 'Rogue','Service C','BSNR004');
insert into CARTYPE_HAS_BASIC_SERVICE values ('Nissan', 'Rogue','Service C','BSNR002');
/* appointment schemas: | appointment_id | service_type (M/R) | service_specify | Mechanics | Plate | */
insert into APPOINTMENT values ('SH001', 'Maintenance', 'Service C', 'Jacob Gloss', TO_DATE('09/10/2018', 'MM/DD/YYYY'),'10:00','10:30', 'XYZ-5643', 1001);
insert into APPOINTMENT values ('SH002', 'Maintenance', 'Service B', 'Eric Fowler', TO_DATE('02/25/2018', 'MM/DD/YYYY'),'09:00','10:30', 'XYZ-5643', 1001);
insert into APPOINTMENT values ('SH003', 'Maintenance', 'Service A', 'Anthony Freeman', TO_DATE('10/15/2017', 'MM/DD/YYYY'),'08:00','09:00', 'XYZ-5643', 1001);
insert into APPOINTMENT values ('SH004', 'Repair', 'Battery Does not Hold Charge', 'Roland Richmond',TO_DATE('08/06/2018', 'MM/DD/YYYY'),'08:00','08:30', 'AHS-3132', 1001);
insert into APPOINTMENT values ('SH005', 'Maintenance','Service B', 'Peter Fitzpatrick',TO_DATE('05/15/2018', 'MM/DD/YYYY'),'10:30','12:00', 'AHS-3132', 1001);
insert into APPOINTMENT values ('SH006', 'Maintenance','Service A', 'Peter Fitzpatrick',TO_DATE('01/28/2018', 'MM/DD/YYYY'),'12:00','13:00', 'AHS-3132', 1001);
insert into APPOINTMENT values ('SH007', 'Maintenance','Service A', 'Eric Fowler',TO_DATE('02/11/2018', 'MM/DD/YYYY'),'08:30','09:30', 'IRM-1212', 1002);
insert into APPOINTMENT values ('SH008', 'Maintenance','Service C', 'Eric Fowler',TO_DATE('12/10/2017', 'MM/DD/YYYY'),'09:30','10:00', 'IRM-1212', 1002);
insert into APPOINTMENT values ('SH009', 'Maintenance','Service B', 'Eric Fowler',TO_DATE('01/20/2017', 'MM/DD/YYYY'),'10:00','11:30', 'IRM-1212', 1002);
insert into APPOINTMENT values ('SH010', 'Maintenance','Service A', 'Rickie Henderson',TO_DATE('02/11/2018', 'MM/DD/YYYY'),'08:30','09:30', 'DEL-8888', 1003);
insert into APPOINTMENT values ('SH011', 'Repair', 'Headlamps/Tail lamps not working', 'Charles Pudilo',TO_DATE('11/05/2016', 'MM/DD/YYYY'),'09:00','10:30', 'DEL-8888', 1003);
insert into APPOINTMENT values ('SH012', 'Maintenance','Service B', 'Dustin Esparza',TO_DATE('09/01/2017', 'MM/DD/YYYY'),'09:00','09:30', 'P11-212A', 1004);
insert into APPOINTMENT values ('SH013', 'Maintenance','Service A', 'James Rivera',TO_DATE('06/15/2014', 'MM/DD/YYYY'),'08:30','10:00', 'P11-212A', 1004);
insert into APPOINTMENT values ('SH014', 'Maintenance','Service A', 'James Rivera',TO_DATE('11/11/2016', 'MM/DD/YYYY'),'08:30','09:30', 'WIM-BLE5', 1004);
insert into APPOINTMENT values ('SH015', 'Repair', 'A/C-Heater not working', 'Charles Pudilo',TO_DATE('01/02/2016', 'MM/DD/YYYY'),'14:00','15:30', 'WIM-BLE5', 1004);
insert into APPOINTMENT values ('SH016', 'Repair', 'Engine knock', 'Charles Pudilo',TO_DATE('09/30/2015', 'MM/DD/YYYY'),'11:00','14:30', 'WIM-BLE5', 1004);
/* DATE_STATUS: CENTER_ID | APP_DATE | MAINTENANCE_NUM*/
insert into DATE_STATUS values ('S0001',TO_DATE('11/13/2018', 'MM/DD/YYYY'),11);
insert into DATE_STATUS values ('S0001',TO_DATE('11/14/2018', 'MM/DD/YYYY'),10);
insert into DATE_STATUS values ('S0001',TO_DATE('11/15/2018', 'MM/DD/YYYY'),7);
insert into DATE_STATUS values ('S0001',TO_DATE('11/16/2018', 'MM/DD/YYYY'),0);
insert into DATE_STATUS values ('S0001',TO_DATE('11/19/2018', 'MM/DD/YYYY'),13);
insert into DATE_STATUS values ('S0001',TO_DATE('11/20/2018', 'MM/DD/YYYY'),5);
insert into DATE_STATUS values ('S0001',TO_DATE('11/21/2018', 'MM/DD/YYYY'),9);
insert into DATE_STATUS values ('S0001',TO_DATE('11/22/2018', 'MM/DD/YYYY'),12);
insert into DATE_STATUS values ('S0001',TO_DATE('11/23/2018', 'MM/DD/YYYY'),4);
insert into DATE_STATUS values ('S0001',TO_DATE('11/26/2018', 'MM/DD/YYYY'),9);
insert into DATE_STATUS values ('S0001',TO_DATE('11/27/2018', 'MM/DD/YYYY'),13);
insert into DATE_STATUS values ('S0001',TO_DATE('11/28/2018', 'MM/DD/YYYY'),2);
insert into DATE_STATUS values ('S0001',TO_DATE('11/29/2018', 'MM/DD/YYYY'),8);
insert into DATE_STATUS values ('S0001',TO_DATE('11/30/2018', 'MM/DD/YYYY'),6);
insert into DATE_STATUS values ('S0001',TO_DATE('12/03/2018', 'MM/DD/YYYY'),4);
insert into DATE_STATUS values ('S0001',TO_DATE('12/04/2018', 'MM/DD/YYYY'),1);
insert into DATE_STATUS values ('S0001',TO_DATE('12/05/2018', 'MM/DD/YYYY'),7);
insert into DATE_STATUS values ('S0001',TO_DATE('12/06/2018', 'MM/DD/YYYY'),2);
insert into DATE_STATUS values ('S0001',TO_DATE('12/07/2018', 'MM/DD/YYYY'),0);
insert into DATE_STATUS values ('S0001',TO_DATE('12/10/2018', 'MM/DD/YYYY'),0);
insert into DATE_STATUS values ('S0002',TO_DATE('11/13/2018', 'MM/DD/YYYY'),11);
insert into DATE_STATUS values ('S0002',TO_DATE('11/14/2018', 'MM/DD/YYYY'),10);
insert into DATE_STATUS values ('S0002',TO_DATE('11/15/2018', 'MM/DD/YYYY'),7);
insert into DATE_STATUS values ('S0002',TO_DATE('11/16/2018', 'MM/DD/YYYY'),0);
insert into DATE_STATUS values ('S0002',TO_DATE('11/19/2018', 'MM/DD/YYYY'),13);
insert into DATE_STATUS values ('S0002',TO_DATE('11/20/2018', 'MM/DD/YYYY'),5);
insert into DATE_STATUS values ('S0002',TO_DATE('11/21/2018', 'MM/DD/YYYY'),9);
insert into DATE_STATUS values ('S0002',TO_DATE('11/22/2018', 'MM/DD/YYYY'),12);
insert into DATE_STATUS values ('S0002',TO_DATE('11/23/2018', 'MM/DD/YYYY'),4);
insert into DATE_STATUS values ('S0002',TO_DATE('11/26/2018', 'MM/DD/YYYY'),9);
insert into DATE_STATUS values ('S0002',TO_DATE('11/27/2018', 'MM/DD/YYYY'),13);
insert into DATE_STATUS values ('S0002',TO_DATE('11/28/2018', 'MM/DD/YYYY'),2);
insert into DATE_STATUS values ('S0002',TO_DATE('11/29/2018', 'MM/DD/YYYY'),8);
insert into DATE_STATUS values ('S0002',TO_DATE('11/30/2018', 'MM/DD/YYYY'),6);
insert into DATE_STATUS values ('S0002',TO_DATE('12/03/2018', 'MM/DD/YYYY'),4);
insert into DATE_STATUS values ('S0002',TO_DATE('12/04/2018', 'MM/DD/YYYY'),1);
insert into DATE_STATUS values ('S0002',TO_DATE('12/05/2018', 'MM/DD/YYYY'),7);
insert into DATE_STATUS values ('S0002',TO_DATE('12/06/2018', 'MM/DD/YYYY'),2);
insert into DATE_STATUS values ('S0002',TO_DATE('12/07/2018', 'MM/DD/YYYY'),0);
insert into DATE_STATUS values ('S0002',TO_DATE('12/10/2018', 'MM/DD/YYYY'),0);
/* TIME_AVALIABLE: CENTER_ID | THE_DATE | BEGINSLOT | ENDSLOT | */
insert into TIME_AVALIABLE values ('S0001',TO_DATE('11/13/2018', 'MM/DD/YYYY'),1,4);
insert into TIME_AVALIABLE values ('S0001',TO_DATE('11/13/2018', 'MM/DD/YYYY'),21,22);
insert into TIME_AVALIABLE values ('S0001',TO_DATE('11/14/2018', 'MM/DD/YYYY'),9,10);
insert into TIME_AVALIABLE values ('S0001',TO_DATE('11/15/2018', 'MM/DD/YYYY'),6,12);
insert into TIME_AVALIABLE values ('S0001',TO_DATE('11/15/2018', 'MM/DD/YYYY'),13,16);
insert into TIME_AVALIABLE values ('S0001',TO_DATE('11/15/2018', 'MM/DD/YYYY'),19,20);
insert into TIME_AVALIABLE values ('S0001',TO_DATE('11/16/2018', 'MM/DD/YYYY'),7,16);
insert into TIME_AVALIABLE values ('S0001',TO_DATE('11/19/2018', 'MM/DD/YYYY'),5,9);
insert into TIME_AVALIABLE values ('S0001',TO_DATE('11/20/2018', 'MM/DD/YYYY'),3,11);
insert into TIME_AVALIABLE values ('S0001',TO_DATE('11/21/2018', 'MM/DD/YYYY'),1,3);
insert into TIME_AVALIABLE values ('S0001',TO_DATE('11/21/2018', 'MM/DD/YYYY'),5,9);
insert into TIME_AVALIABLE values ('S0001',TO_DATE('11/21/2018', 'MM/DD/YYYY'),14,16);
insert into TIME_AVALIABLE values ('S0001',TO_DATE('11/21/2018', 'MM/DD/YYYY'),19,20);
insert into TIME_AVALIABLE values ('S0001',TO_DATE('11/22/2018', 'MM/DD/YYYY'),7,10);
insert into TIME_AVALIABLE values ('S0001',TO_DATE('11/22/2018', 'MM/DD/YYYY'),13,16);
insert into TIME_AVALIABLE values ('S0001',TO_DATE('11/23/2018', 'MM/DD/YYYY'),5,13);
insert into TIME_AVALIABLE values ('S0001',TO_DATE('11/26/2018', 'MM/DD/YYYY'),9,10);
insert into TIME_AVALIABLE values ('S0001',TO_DATE('11/27/2018', 'MM/DD/YYYY'),5,9);
insert into TIME_AVALIABLE values ('S0001',TO_DATE('11/28/2018', 'MM/DD/YYYY'),1,7);
insert into TIME_AVALIABLE values ('S0001',TO_DATE('11/28/2018', 'MM/DD/YYYY'),13,18);
insert into TIME_AVALIABLE values ('S0001',TO_DATE('11/29/2018', 'MM/DD/YYYY'),4,10);
insert into TIME_AVALIABLE values ('S0001',TO_DATE('11/29/2018', 'MM/DD/YYYY'),13,15);
insert into TIME_AVALIABLE values ('S0001',TO_DATE('11/30/2018', 'MM/DD/YYYY'),2,6);
insert into TIME_AVALIABLE values ('S0001',TO_DATE('11/30/2018', 'MM/DD/YYYY'),9,10);
insert into TIME_AVALIABLE values ('S0001',TO_DATE('12/03/2018', 'MM/DD/YYYY'),1,3);
insert into TIME_AVALIABLE values ('S0001',TO_DATE('12/03/2018', 'MM/DD/YYYY'),8,12);
insert into TIME_AVALIABLE values ('S0001',TO_DATE('12/04/2018', 'MM/DD/YYYY'),9,18);
insert into TIME_AVALIABLE values ('S0001',TO_DATE('12/04/2018', 'MM/DD/YYYY'),20,21);
insert into TIME_AVALIABLE values ('S0001',TO_DATE('12/05/2018', 'MM/DD/YYYY'),7,12);
insert into TIME_AVALIABLE values ('S0001',TO_DATE('12/06/2018', 'MM/DD/YYYY'),9,14);
insert into TIME_AVALIABLE values ('S0001',TO_DATE('12/06/2018', 'MM/DD/YYYY'),16,20);
insert into TIME_AVALIABLE values ('S0001',TO_DATE('12/07/2018', 'MM/DD/YYYY'),1,23);
insert into TIME_AVALIABLE values ('S0001',TO_DATE('12/10/2018', 'MM/DD/YYYY'),1,23);
insert into TIME_AVALIABLE values ('S0002',TO_DATE('11/13/2018', 'MM/DD/YYYY'),1,4);
insert into TIME_AVALIABLE values ('S0002',TO_DATE('11/13/2018', 'MM/DD/YYYY'),21,22);
insert into TIME_AVALIABLE values ('S0002',TO_DATE('11/14/2018', 'MM/DD/YYYY'),9,10);
insert into TIME_AVALIABLE values ('S0002',TO_DATE('11/15/2018', 'MM/DD/YYYY'),6,12);
insert into TIME_AVALIABLE values ('S0002',TO_DATE('11/15/2018', 'MM/DD/YYYY'),13,16);
insert into TIME_AVALIABLE values ('S0002',TO_DATE('11/15/2018', 'MM/DD/YYYY'),19,20);
insert into TIME_AVALIABLE values ('S0002',TO_DATE('11/16/2018', 'MM/DD/YYYY'),7,16);
insert into TIME_AVALIABLE values ('S0002',TO_DATE('11/19/2018', 'MM/DD/YYYY'),5,9);
insert into TIME_AVALIABLE values ('S0002',TO_DATE('11/20/2018', 'MM/DD/YYYY'),3,11);
insert into TIME_AVALIABLE values ('S0002',TO_DATE('11/21/2018', 'MM/DD/YYYY'),1,3);
insert into TIME_AVALIABLE values ('S0002',TO_DATE('11/21/2018', 'MM/DD/YYYY'),5,9);
insert into TIME_AVALIABLE values ('S0002',TO_DATE('11/21/2018', 'MM/DD/YYYY'),14,16);
insert into TIME_AVALIABLE values ('S0002',TO_DATE('11/21/2018', 'MM/DD/YYYY'),19,20);
insert into TIME_AVALIABLE values ('S0002',TO_DATE('11/22/2018', 'MM/DD/YYYY'),7,10);
insert into TIME_AVALIABLE values ('S0002',TO_DATE('11/22/2018', 'MM/DD/YYYY'),13,16);
insert into TIME_AVALIABLE values ('S0002',TO_DATE('11/23/2018', 'MM/DD/YYYY'),5,13);
insert into TIME_AVALIABLE values ('S0002',TO_DATE('11/26/2018', 'MM/DD/YYYY'),9,10);
insert into TIME_AVALIABLE values ('S0002',TO_DATE('11/27/2018', 'MM/DD/YYYY'),5,9);
insert into TIME_AVALIABLE values ('S0002',TO_DATE('11/28/2018', 'MM/DD/YYYY'),1,7);
insert into TIME_AVALIABLE values ('S0002',TO_DATE('11/28/2018', 'MM/DD/YYYY'),13,18);
insert into TIME_AVALIABLE values ('S0002',TO_DATE('11/29/2018', 'MM/DD/YYYY'),4,10);
insert into TIME_AVALIABLE values ('S0002',TO_DATE('11/29/2018', 'MM/DD/YYYY'),13,15);
insert into TIME_AVALIABLE values ('S0002',TO_DATE('11/30/2018', 'MM/DD/YYYY'),2,6);
insert into TIME_AVALIABLE values ('S0002',TO_DATE('11/30/2018', 'MM/DD/YYYY'),9,10);
insert into TIME_AVALIABLE values ('S0002',TO_DATE('12/03/2018', 'MM/DD/YYYY'),1,3);
insert into TIME_AVALIABLE values ('S0002',TO_DATE('12/03/2018', 'MM/DD/YYYY'),8,12);
insert into TIME_AVALIABLE values ('S0002',TO_DATE('12/04/2018', 'MM/DD/YYYY'),9,18);
insert into TIME_AVALIABLE values ('S0002',TO_DATE('12/04/2018', 'MM/DD/YYYY'),20,21);
insert into TIME_AVALIABLE values ('S0002',TO_DATE('12/05/2018', 'MM/DD/YYYY'),7,12);
insert into TIME_AVALIABLE values ('S0002',TO_DATE('12/06/2018', 'MM/DD/YYYY'),9,14);
insert into TIME_AVALIABLE values ('S0002',TO_DATE('12/06/2018', 'MM/DD/YYYY'),16,20);
insert into TIME_AVALIABLE values ('S0002',TO_DATE('12/07/2018', 'MM/DD/YYYY'),1,23);
insert into TIME_AVALIABLE values ('S0002',TO_DATE('12/10/2018', 'MM/DD/YYYY'),1,23);
/* Timeslot : time_id | slot */
insert into TIMESLOT values (1,'8:00');
insert into TIMESLOT values (2,'8:30');
insert into TIMESLOT values (3,'9:00');
insert into TIMESLOT values (4,'9:30');
insert into TIMESLOT values (5,'10:00');
insert into TIMESLOT values (6,'10:30');
insert into TIMESLOT values (7,'11:00');
insert into TIMESLOT values (8,'11:30');
insert into TIMESLOT values (9,'12:00');
insert into TIMESLOT values (10,'12:30');
insert into TIMESLOT values (11,'13:00');
insert into TIMESLOT values (12,'13:30');
insert into TIMESLOT values (13,'14:00');
insert into TIMESLOT values (14,'14:30');
insert into TIMESLOT values (15,'15:00');
insert into TIMESLOT values (16,'15:30');
insert into TIMESLOT values (17,'16:00');
insert into TIMESLOT values (18,'16:30');
insert into TIMESLOT values (19,'17:00');
insert into TIMESLOT values (20,'17:30');
insert into TIMESLOT values (21,'18:00');
insert into TIMESLOT values (22,'18:30');
insert into TIMESLOT values (23,'19:00');
/* PORDER */
insert into PORDER values ('O0001', TO_DATE('06/09/2014', 'MM/DD/YYYY'), TO_DATE('06/13/2014', 'MM/DD/YYYY'), TO_DATE('06/18/2014', 'MM/DD/YYYY'), 5, 'D0001', 'S0001', 'Complete','PT003');
insert into PORDER values ('O0002', TO_DATE('09/16/2015', 'MM/DD/YYYY'), TO_DATE('09/21/2015', 'MM/DD/YYYY'), TO_DATE('09/21/2015', 'MM/DD/YYYY'), 5, 'D0002', 'S0001', 'Complete','PH019');
insert into PORDER values ('O0003', TO_DATE('02/10/2016', 'MM/DD/YYYY'), TO_DATE('02/11/2016', 'MM/DD/YYYY'), TO_DATE('02/11/2016', 'MM/DD/YYYY'), 5, 'S0001', 'S0002', 'Complete','PH011');
insert into PORDER values ('O0004', TO_DATE('08/09/2017', 'MM/DD/YYYY'), TO_DATE('08/10/2017', 'MM/DD/YYYY'), TO_DATE('08/11/2017', 'MM/DD/YYYY'), 4, 'D0002', 'S0001', 'Complete','PN008');
insert into PORDER values ('O0005', TO_DATE('10/04/2018', 'MM/DD/YYYY'), TO_DATE('10/05/2018', 'MM/DD/YYYY'), TO_DATE('10/05/2018', 'MM/DD/YYYY'), 6, 'S0001', 'S0002', 'Complete','PT001');
insert into PORDER values ('O0006', TO_DATE('10/26/2018', 'MM/DD/YYYY'), TO_DATE('11/01/2018', 'MM/DD/YYYY'), TO_DATE('11/05/2018', 'MM/DD/YYYY'), 5, 'D0001', 'S0001', 'Complete','PN006');
insert into PORDER values ('O0007', TO_DATE('11/09/2018', 'MM/DD/YYYY'), TO_DATE('11/14/2018', 'MM/DD/YYYY'), null, 7, 'D0002', 'S0002', 'Pending','PH019');
insert into PORDER values ('O0008', TO_DATE('11/07/2018', 'MM/DD/YYYY'), TO_DATE('11/14/2018', 'MM/DD/YYYY'), null, 12, 'D0001', 'S0002', 'Pending','PH002');
insert into PORDER values ('O0009', TO_DATE('11/08/2018', 'MM/DD/YYYY'), TO_DATE('11/14/2018', 'MM/DD/YYYY'), null, 6, 'D0001', 'S0002', 'Pending','PH006');
insert into PORDER values ('O0010', TO_DATE('11/08/2018', 'MM/DD/YYYY'), TO_DATE('11/14/2018', 'MM/DD/YYYY'), null, 5, 'D0001', 'S0002', 'Pending','PH013');
insert into PORDER values ('O0011', TO_DATE('11/08/2018', 'MM/DD/YYYY'), TO_DATE('11/14/2018', 'MM/DD/YYYY'), null, 5, 'D0002', 'S0002', 'Pending','PH004');
/* NOTIFICATION */
insert into NOTIF values ('N0001', TO_DATE('11/05/2018', 'MM/DD/YYYY'), 'S0001', '5 Camshaft from D0001 delayed by 2 business days','O0006');
insert into NOTIF values ('N0002', TO_DATE('08/11/2017', 'MM/DD/YYYY'), 'S0001', '4 Coolant from D0002 delayed by 1 business day','O0004');
insert into NOTIF values ('N0003', TO_DATE('06/18/2014', 'MM/DD/YYYY'), 'S0001', '5 Battery from D0001 delayed by 3 business days','O0001');
/* Car Service schemas: | service_id | start_time | end_time | status | labor fee | total_part_fee | total_service_cost | */
insert into CARSERVICE values ('CS0001', 'Complete', 'SH001');
insert into CARSERVICE values ('CS0002', 'Complete', 'SH002');
insert into CARSERVICE values ('CS0003', 'Complete', 'SH003');
insert into CARSERVICE values ('CS0004', 'Complete', 'SH004');
insert into CARSERVICE values ('CS0005', 'Complete', 'SH005');
insert into CARSERVICE values ('CS0006', 'Complete', 'SH006');
insert into CARSERVICE values ('CS0007', 'Complete', 'SH007');
insert into CARSERVICE values ('CS0008', 'Complete', 'SH008');
insert into CARSERVICE values ('CS0009', 'Complete', 'SH009');
insert into CARSERVICE values ('CS0010', 'Complete', 'SH010');
insert into CARSERVICE values ('CS0011', 'Complete', 'SH011');
insert into CARSERVICE values ('CS0012', 'Complete', 'SH012');
insert into CARSERVICE values ('CS0013', 'Complete', 'SH013');
insert into CARSERVICE values ('CS0014', 'Complete', 'SH014');
insert into CARSERVICE values ('CS0015', 'Complete', 'SH015');
insert into CARSERVICE values ('CS0016', 'Complete', 'SH016');
/* repair service schemas: | repair_id | repair_code | diagnostic | diagnostic fee | */
insert into REPAIR_SERVICE values ('R0001', 'Engine knock', 'Timing issue', 75);
insert into REPAIR_SERVICE values ('R0002', 'Car drifts in a particular direction', 'Wheel alignment issue', 50);
insert into REPAIR_SERVICE values ('R0003', 'Battery does not hold charge', 'Battery needs replacement', 25);
insert into REPAIR_SERVICE values ('R0004', 'Black/unclean exhaust', 'Bad catalytic convertor and filters', 75);
insert into REPAIR_SERVICE values ('R0005', 'A/C-Heater not working', 'Diagnostic: Drive belt damaged, coolant not enough, weak battery', 50);
insert into REPAIR_SERVICE values ('R0006', 'Headlamps/Tail lamps not working', 'Diagnostic: Light assembly damaged', 30);
insert into REPAIR_SERVICE values ('R0007', 'Check engine light', 'Gearbox and Torque convertor issue', 100);
/* repair's basic service schemas: | repair_id | car model |basic_service id | */
insert into REPAIR_HAS_BASIC_SERVICE values ('R0001', 'Corolla', 'BSTC008');
insert into REPAIR_HAS_BASIC_SERVICE values ('R0001', 'Corolla', 'BSTC015');
insert into REPAIR_HAS_BASIC_SERVICE values ('R0001', 'Corolla', 'BSTC005');
insert into REPAIR_HAS_BASIC_SERVICE values ('R0001', 'Corolla', 'BSTC019');
insert into REPAIR_HAS_BASIC_SERVICE values ('R0001', 'Prius', 'BSTP008');
insert into REPAIR_HAS_BASIC_SERVICE values ('R0001', 'Prius', 'BSTP015');
insert into REPAIR_HAS_BASIC_SERVICE values ('R0001', 'Prius', 'BSTP005');
insert into REPAIR_HAS_BASIC_SERVICE values ('R0001', 'Prius', 'BSTP019');
insert into REPAIR_HAS_BASIC_SERVICE values ('R0001', 'Civic', 'BSHC008');
insert into REPAIR_HAS_BASIC_SERVICE values ('R0001', 'Civic', 'BSHC015');
insert into REPAIR_HAS_BASIC_SERVICE values ('R0001', 'Civic', 'BSHC005');
insert into REPAIR_HAS_BASIC_SERVICE values ('R0001', 'Civic', 'BSHC019');
insert into REPAIR_HAS_BASIC_SERVICE values ('R0001', 'Accord', 'BSHA008');
insert into REPAIR_HAS_BASIC_SERVICE values ('R0001', 'Accord', 'BSHA015');
insert into REPAIR_HAS_BASIC_SERVICE values ('R0001', 'Accord', 'BSHA005');
insert into REPAIR_HAS_BASIC_SERVICE values ('R0001', 'Accord', 'BSHA019');
insert into REPAIR_HAS_BASIC_SERVICE values ('R0001', 'Altima', 'BSNA008');
insert into REPAIR_HAS_BASIC_SERVICE values ('R0001', 'Altima', 'BSNA015');
insert into REPAIR_HAS_BASIC_SERVICE values ('R0001', 'Altima', 'BSNA005');
insert into REPAIR_HAS_BASIC_SERVICE values ('R0001', 'Altima', 'BSNA019');
insert into REPAIR_HAS_BASIC_SERVICE values ('R0001', 'Rogue', 'BSNR008');
insert into REPAIR_HAS_BASIC_SERVICE values ('R0001', 'Rogue', 'BSNR015');
insert into REPAIR_HAS_BASIC_SERVICE values ('R0001', 'Rogue', 'BSNR005');
insert into REPAIR_HAS_BASIC_SERVICE values ('R0001', 'Rogue', 'BSNR019');
insert into REPAIR_HAS_BASIC_SERVICE values ('R0002', 'Corolla', 'BSTC020');
insert into REPAIR_HAS_BASIC_SERVICE values ('R0002', 'Prius', 'BSTP020');
insert into REPAIR_HAS_BASIC_SERVICE values ('R0002', 'Civic', 'BSHC020');
insert into REPAIR_HAS_BASIC_SERVICE values ('R0002', 'Accord', 'BSHA020');
insert into REPAIR_HAS_BASIC_SERVICE values ('R0002', 'Altima', 'BSNA020');
insert into REPAIR_HAS_BASIC_SERVICE values ('R0002', 'Rogue', 'BSNR020');
insert into REPAIR_HAS_BASIC_SERVICE values ('R0003', 'Corolla', 'BSTC002');
insert into REPAIR_HAS_BASIC_SERVICE values ('R0003', 'Prius', 'BSTP002');
insert into REPAIR_HAS_BASIC_SERVICE values ('R0003', 'Civic', 'BSHC002');
insert into REPAIR_HAS_BASIC_SERVICE values ('R0003', 'Accord', 'BSHA002');
insert into REPAIR_HAS_BASIC_SERVICE values ('R0003', 'Altima', 'BSNA002');
insert into REPAIR_HAS_BASIC_SERVICE values ('R0003', 'Rogue', 'BSNR002');
--
insert into REPAIR_HAS_BASIC_SERVICE values ('R0004', 'Corolla', 'BSTC001');
insert into REPAIR_HAS_BASIC_SERVICE values ('R0004', 'Corolla', 'BSTC012');
insert into REPAIR_HAS_BASIC_SERVICE values ('R0004', 'Corolla', 'BSTC006');
insert into REPAIR_HAS_BASIC_SERVICE values ('R0004', 'Prius', 'BSTP001');
insert into REPAIR_HAS_BASIC_SERVICE values ('R0004', 'Prius', 'BSTP012');
insert into REPAIR_HAS_BASIC_SERVICE values ('R0004', 'Prius', 'BSTP006');
insert into REPAIR_HAS_BASIC_SERVICE values ('R0004', 'Civic', 'BSHC001');
insert into REPAIR_HAS_BASIC_SERVICE values ('R0004', 'Civic', 'BSHC012');
insert into REPAIR_HAS_BASIC_SERVICE values ('R0004', 'Civic', 'BSHC006');
insert into REPAIR_HAS_BASIC_SERVICE values ('R0004', 'Accord', 'BSHA001');
insert into REPAIR_HAS_BASIC_SERVICE values ('R0004', 'Accord', 'BSHA012');
insert into REPAIR_HAS_BASIC_SERVICE values ('R0004', 'Accord', 'BSHA006');
insert into REPAIR_HAS_BASIC_SERVICE values ('R0004', 'Altima', 'BSNA001');
insert into REPAIR_HAS_BASIC_SERVICE values ('R0004', 'Altima', 'BSNA012');
insert into REPAIR_HAS_BASIC_SERVICE values ('R0004', 'Altima', 'BSNA006');
insert into REPAIR_HAS_BASIC_SERVICE values ('R0004', 'Rogue', 'BSNR001');
insert into REPAIR_HAS_BASIC_SERVICE values ('R0004', 'Rogue', 'BSNR012');
insert into REPAIR_HAS_BASIC_SERVICE values ('R0004', 'Rogue', 'BSNR006');
insert into REPAIR_HAS_BASIC_SERVICE values ('R0005', 'Corolla', 'BSTC008');
insert into REPAIR_HAS_BASIC_SERVICE values ('R0005', 'Corolla', 'BSTC007');
insert into REPAIR_HAS_BASIC_SERVICE values ('R0005', 'Corolla', 'BSTC002');
insert into REPAIR_HAS_BASIC_SERVICE values ('R0005', 'Prius', 'BSTP008');
insert into REPAIR_HAS_BASIC_SERVICE values ('R0005', 'Prius', 'BSTP007');
insert into REPAIR_HAS_BASIC_SERVICE values ('R0005', 'Prius', 'BSTP002');
insert into REPAIR_HAS_BASIC_SERVICE values ('R0005', 'Civic', 'BSHC008');
insert into REPAIR_HAS_BASIC_SERVICE values ('R0005', 'Civic', 'BSHC007');
insert into REPAIR_HAS_BASIC_SERVICE values ('R0005', 'Civic', 'BSHC002');
insert into REPAIR_HAS_BASIC_SERVICE values ('R0005', 'Accord', 'BSHA008');
insert into REPAIR_HAS_BASIC_SERVICE values ('R0005', 'Accord', 'BSHA007');
insert into REPAIR_HAS_BASIC_SERVICE values ('R0005', 'Accord', 'BSHA002');
insert into REPAIR_HAS_BASIC_SERVICE values ('R0005', 'Altima', 'BSNA008');
insert into REPAIR_HAS_BASIC_SERVICE values ('R0005', 'Altima', 'BSNA007');
insert into REPAIR_HAS_BASIC_SERVICE values ('R0005', 'Altima', 'BSNA002');
insert into REPAIR_HAS_BASIC_SERVICE values ('R0005', 'Rogue', 'BSNR008');
insert into REPAIR_HAS_BASIC_SERVICE values ('R0005', 'Rogue', 'BSNR007');
insert into REPAIR_HAS_BASIC_SERVICE values ('R0005', 'Rogue', 'BSNR002');
insert into REPAIR_HAS_BASIC_SERVICE values ('R0006', 'Corolla', 'BSTC011');
insert into REPAIR_HAS_BASIC_SERVICE values ('R0006', 'Corolla', 'BSTC017');
insert into REPAIR_HAS_BASIC_SERVICE values ('R0006', 'Corolla', 'BSTC018');
insert into REPAIR_HAS_BASIC_SERVICE values ('R0006', 'Prius', 'BSTP011');
insert into REPAIR_HAS_BASIC_SERVICE values ('R0006', 'Prius', 'BSTP017');
insert into REPAIR_HAS_BASIC_SERVICE values ('R0006', 'Prius', 'BSTP018');
insert into REPAIR_HAS_BASIC_SERVICE values ('R0006', 'Civic', 'BSHC011');
insert into REPAIR_HAS_BASIC_SERVICE values ('R0006', 'Civic', 'BSHC017');
insert into REPAIR_HAS_BASIC_SERVICE values ('R0006', 'Civic', 'BSHC018');
insert into REPAIR_HAS_BASIC_SERVICE values ('R0006', 'Accord', 'BSHA011');
insert into REPAIR_HAS_BASIC_SERVICE values ('R0006', 'Accord', 'BSHA017');
insert into REPAIR_HAS_BASIC_SERVICE values ('R0006', 'Accord', 'BSHA018');
insert into REPAIR_HAS_BASIC_SERVICE values ('R0006', 'Altima', 'BSNA011');
insert into REPAIR_HAS_BASIC_SERVICE values ('R0006', 'Altima', 'BSNA017');
insert into REPAIR_HAS_BASIC_SERVICE values ('R0006', 'Altima', 'BSNA018');
insert into REPAIR_HAS_BASIC_SERVICE values ('R0006', 'Rogue', 'BSNR011');
insert into REPAIR_HAS_BASIC_SERVICE values ('R0006', 'Rogue', 'BSNR017');
insert into REPAIR_HAS_BASIC_SERVICE values ('R0006', 'Rogue', 'BSNR018');
insert into REPAIR_HAS_BASIC_SERVICE values ('R0007', 'Corolla', 'BSTC013');
insert into REPAIR_HAS_BASIC_SERVICE values ('R0007', 'Corolla', 'BSTC010');
insert into REPAIR_HAS_BASIC_SERVICE values ('R0007', 'Corolla', 'BSTC005');
insert into REPAIR_HAS_BASIC_SERVICE values ('R0007', 'Corolla', 'BSTC019');
insert into REPAIR_HAS_BASIC_SERVICE values ('R0007', 'Prius', 'BSTP013');
insert into REPAIR_HAS_BASIC_SERVICE values ('R0007', 'Prius', 'BSTP010');
insert into REPAIR_HAS_BASIC_SERVICE values ('R0007', 'Prius', 'BSTP005');
insert into REPAIR_HAS_BASIC_SERVICE values ('R0007', 'Prius', 'BSTP019');
insert into REPAIR_HAS_BASIC_SERVICE values ('R0007', 'Civic', 'BSHC013');
insert into REPAIR_HAS_BASIC_SERVICE values ('R0007', 'Civic', 'BSHC010');
insert into REPAIR_HAS_BASIC_SERVICE values ('R0007', 'Civic', 'BSHC005');
insert into REPAIR_HAS_BASIC_SERVICE values ('R0007', 'Civic', 'BSHC019');
insert into REPAIR_HAS_BASIC_SERVICE values ('R0007', 'Accord', 'BSHA013');
insert into REPAIR_HAS_BASIC_SERVICE values ('R0007', 'Accord', 'BSHA010');
insert into REPAIR_HAS_BASIC_SERVICE values ('R0007', 'Accord', 'BSHA005');
insert into REPAIR_HAS_BASIC_SERVICE values ('R0007', 'Accord', 'BSHA019');
insert into REPAIR_HAS_BASIC_SERVICE values ('R0007', 'Altima', 'BSNA013');
insert into REPAIR_HAS_BASIC_SERVICE values ('R0007', 'Altima', 'BSNA010');
insert into REPAIR_HAS_BASIC_SERVICE values ('R0007', 'Altima', 'BSNA005');
insert into REPAIR_HAS_BASIC_SERVICE values ('R0007', 'Altima', 'BSNA019');
insert into REPAIR_HAS_BASIC_SERVICE values ('R0007', 'Rogue', 'BSNR013');
insert into REPAIR_HAS_BASIC_SERVICE values ('R0007', 'Rogue', 'BSNR010');
insert into REPAIR_HAS_BASIC_SERVICE values ('R0007', 'Rogue', 'BSNR005');
insert into REPAIR_HAS_BASIC_SERVICE values ('R0007', 'Rogue', 'BSNR019');
/* Maintenance's basic service schemas: | Maintenance_id | car model | SERVICE_TYPE |basic_service id | */
insert into MAINT_HAS_BASIC_SERVICE values ('M0001', 'Corolla','Service A','BSTC009');
insert into MAINT_HAS_BASIC_SERVICE values ('M0001', 'Corolla','Service A','BSTC007');
insert into MAINT_HAS_BASIC_SERVICE values ('M0004', 'Prius','Service A','BSTP009');
insert into MAINT_HAS_BASIC_SERVICE values ('M0004', 'Prius','Service A','BSTP012');
insert into MAINT_HAS_BASIC_SERVICE values ('M0004', 'Prius','Service A','BSTP007');
insert into MAINT_HAS_BASIC_SERVICE values ('M0007', 'Civic','Service A','BSHC007');
insert into MAINT_HAS_BASIC_SERVICE values ('M0007', 'Civic','Service A','BSHC003');
insert into MAINT_HAS_BASIC_SERVICE values ('M0007', 'Civic','Service A','BSHC009');
insert into MAINT_HAS_BASIC_SERVICE values ('M0010', 'Accord','Service A','BSHA009');
insert into MAINT_HAS_BASIC_SERVICE values ('M0010', 'Accord','Service A','BSHA001');
insert into MAINT_HAS_BASIC_SERVICE values ('M0010', 'Accord','Service A','BSHA012');
insert into MAINT_HAS_BASIC_SERVICE values ('M0010', 'Accord','Service A','BSHA007');
insert into MAINT_HAS_BASIC_SERVICE values ('M0013', 'Altima','Service A','BSNA009');
insert into MAINT_HAS_BASIC_SERVICE values ('M0013', 'Altima','Service A','BSNA001');
insert into MAINT_HAS_BASIC_SERVICE values ('M0013', 'Altima','Service A','BSNA012');
insert into MAINT_HAS_BASIC_SERVICE values ('M0013', 'Altima','Service A','BSNA007');
insert into MAINT_HAS_BASIC_SERVICE values ('M0016', 'Rogue','Service A','BSNR009');
insert into MAINT_HAS_BASIC_SERVICE values ('M0016', 'Rogue','Service A','BSNR001');
insert into MAINT_HAS_BASIC_SERVICE values ('M0016', 'Rogue','Service A','BSNR014');
insert into MAINT_HAS_BASIC_SERVICE values ('M0016', 'Rogue','Service A','BSNR012');
insert into MAINT_HAS_BASIC_SERVICE values ('M0016', 'Rogue','Service A','BSNR003');
insert into MAINT_HAS_BASIC_SERVICE values ('M0016', 'Rogue','Service A','BSNR007');
insert into MAINT_HAS_BASIC_SERVICE values ('M0002', 'Corolla','Service B','BSTC001');
insert into MAINT_HAS_BASIC_SERVICE values ('M0002', 'Corolla','Service B','BSTC012');
insert into MAINT_HAS_BASIC_SERVICE values ('M0002', 'Corolla','Service B','BSTC003');
insert into MAINT_HAS_BASIC_SERVICE values ('M0002', 'Corolla','Service B','BSTC021');
insert into MAINT_HAS_BASIC_SERVICE values ('M0002', 'Corolla','Service B','BSTC015');
insert into MAINT_HAS_BASIC_SERVICE values ('M0005', 'Prius','Service B','BSTP001');
insert into MAINT_HAS_BASIC_SERVICE values ('M0005', 'Prius','Service B','BSTP003');
insert into MAINT_HAS_BASIC_SERVICE values ('M0005', 'Prius','Service B','BSTP021');
insert into MAINT_HAS_BASIC_SERVICE values ('M0005', 'Prius','Service B','BSTP015');
insert into MAINT_HAS_BASIC_SERVICE values ('M0005', 'Prius','Service B','BSTP002');
insert into MAINT_HAS_BASIC_SERVICE values ('M0008', 'Civic','Service B','BSHC001');
insert into MAINT_HAS_BASIC_SERVICE values ('M0008', 'Civic','Service B','BSHC012');
insert into MAINT_HAS_BASIC_SERVICE values ('M0008', 'Civic','Service B','BSHC004');
insert into MAINT_HAS_BASIC_SERVICE values ('M0008', 'Civic','Service B','BSHC021');
insert into MAINT_HAS_BASIC_SERVICE values ('M0008', 'Civic','Service B','BSHC015');
insert into MAINT_HAS_BASIC_SERVICE values ('M0011', 'Accord','Service B','BSHA003');
insert into MAINT_HAS_BASIC_SERVICE values ('M0011', 'Accord','Service B','BSHA021');
insert into MAINT_HAS_BASIC_SERVICE values ('M0011', 'Accord','Service B','BSHA015');
insert into MAINT_HAS_BASIC_SERVICE values ('M0014', 'Altima','Service B','BSNA003');
insert into MAINT_HAS_BASIC_SERVICE values ('M0014', 'Altima','Service B','BSNA021');
insert into MAINT_HAS_BASIC_SERVICE values ('Nissan', 'Rogue','Service B','BSNR016');
insert into MAINT_HAS_BASIC_SERVICE values ('Nissan', 'Rogue','Service B','BSNR021');
insert into MAINT_HAS_BASIC_SERVICE values ('Nissan', 'Rogue','Service B','BSNR015');
insert into MAINT_HAS_BASIC_SERVICE values ('M0003', 'Corolla','Service C','BSTC016');
insert into MAINT_HAS_BASIC_SERVICE values ('M0003', 'Corolla','Service C','BSTC004');
insert into MAINT_HAS_BASIC_SERVICE values ('M0003', 'Corolla','Service C','BSTC014');
insert into MAINT_HAS_BASIC_SERVICE values ('M0006', 'Prius','Service C','BSTP016');
insert into MAINT_HAS_BASIC_SERVICE values ('M0006', 'Prius','Service C','BSTP004');
insert into MAINT_HAS_BASIC_SERVICE values ('M0006', 'Prius','Service C','BSTP014');
insert into MAINT_HAS_BASIC_SERVICE values ('M0009', 'Civic','Service C','BSHC016');
insert into MAINT_HAS_BASIC_SERVICE values ('M0009', 'Civic','Service C','BSHC014');
insert into MAINT_HAS_BASIC_SERVICE values ('M0012', 'Accord','Service C','BSHA016');
insert into MAINT_HAS_BASIC_SERVICE values ('M0012', 'Accord','Service C','BSHA004');
insert into MAINT_HAS_BASIC_SERVICE values ('M0012', 'Accord','Service C','BSHA014');
insert into MAINT_HAS_BASIC_SERVICE values ('M0015', 'Altima','Service C','BSNA016');
insert into MAINT_HAS_BASIC_SERVICE values ('M0015', 'Altima','Service C','BSNA004');
insert into MAINT_HAS_BASIC_SERVICE values ('M0015', 'Altima','Service C','BSNA014');
insert into MAINT_HAS_BASIC_SERVICE values ('M0015', 'Altima','Service C','BSNA015');
insert into MAINT_HAS_BASIC_SERVICE values ('M0018', 'Rogue','Service C','BSNR004');
insert into MAINT_HAS_BASIC_SERVICE values ('M0018', 'Rogue','Service C','BSNR002');
/* NUMERRICAL VALUES */
insert into M_VALUES values ('Corolla', 'Service A', 0.5,25,126);
insert into M_VALUES values ('Prius', 'Service A', 0.75,37.5,162);
insert into M_VALUES values ('Civic', 'Service A', 0.75,37.5,112);
insert into M_VALUES values ('Accord', 'Service A', 1,50,138);
insert into M_VALUES values ('Altima', 'Service A', 1,50,175);
insert into M_VALUES values ('Rogue', 'Service A', 1.5, 75, 211);
insert into M_VALUES values ('Corolla', 'Service B', 1.75, 87.5, 289);
insert into M_VALUES values ('Prius', 'Service B', 2, 100, 352);
insert into M_VALUES values ('Civic', 'Service B', 2.25, 112.5, 360);
insert into M_VALUES values ('Accord', 'Service B', 1.75, 87.5 ,319);
insert into M_VALUES values ('Altima', 'Service B', 1.5 ,75 ,222);
insert into M_VALUES values ('Rogue', 'Service B', 2.25, 112.5, 285);
insert into M_VALUES values ('Corolla', 'Service C', 2.75, 137.5, 220.5);
insert into M_VALUES values ('Prius', 'Service C', 3, 150, 250);
insert into M_VALUES values ('Civic', 'Service C', 2.75, 137.5, 213.5);
insert into M_VALUES values ('Accord', 'Service C', 2.75, 137.5, 229.5);
insert into M_VALUES values ('Altima', 'Service C', 2.75, 137.5, 185);
insert into M_VALUES values ('Rogue', 'Service C', 3, 150, 173.5);
insert into R_VALUES values ('Corolla', 'Engine knock', 3.25, 245, 7564,75);
insert into R_VALUES values ('Prius', 'Engine knock', 3.25, 245, 7564,75);
insert into R_VALUES values ('Civic', 'Engine knock', 3.25, 245, 727,753);
insert into R_VALUES values ('Accord', 'Engine knock', 3.25, 245, 7198,75);
insert into R_VALUES values ('Altima', 'Engine knock', 3.25, 245, 8523,75);
insert into R_VALUES values ('Rogue', 'Engine knock', 3.25, 245, 10571,75);
insert into R_VALUES values ('Corolla', 'Car drift', 1, 65, 246,50);
insert into R_VALUES values ('Prius', 'Car drift', 1, 65, 246,50);
insert into R_VALUES values ('Civic', 'Car drift', 1, 65, 282,50);
insert into R_VALUES values ('Accord', 'Car drift', 1, 65, 282,50);
insert into R_VALUES values ('Altima', 'Car drift', 1, 65, 482,50);
insert into R_VALUES values ('Rogue', 'Car drift', 1, 65, 482,50);
insert into R_VALUES values ('Corolla', 'Bettery not charge', 0.25, 12.5, 63,25);
insert into R_VALUES values ('Prius', 'Bettery not charge', 0.25, 12.5, 63,25);
insert into R_VALUES values ('Civic', 'Bettery not charge', 0.25, 12.5, 104,25);
insert into R_VALUES values ('Accord', 'Bettery not charge', 0.25, 12.5, 79,25);
insert into R_VALUES values ('Altima', 'Bettery not charge', 0.25, 12.5, 14,25);
insert into R_VALUES values ('Rogue', 'Bettery not charge', 0.25, 12.5, 28,25);
insert into R_VALUES values ('Corolla', 'Black exhaust', 1.5, 90, 848,75);
insert into R_VALUES values ('Prius', 'Black exhaust', 1.5, 90, 848,75);
insert into R_VALUES values ('Civic', 'Black exhaust', 1.5, 90, 817,75);
insert into R_VALUES values ('Accord', 'Black exhaust', 1.5 ,90, 876,75);
insert into R_VALUES values ('Altima', 'Black exhaust', 1.5, 90, 711,75);
insert into R_VALUES values ('Rogue', 'Black exhaust', 1.5, 90, 894,75);
insert into R_VALUES values ('Corolla', 'AC not working', 1.5, 90, 654,50);
insert into R_VALUES values ('Prius', 'AC not working', 1.5, 90, 654,50);
insert into R_VALUES values ('Civic', 'AC not working', 1.5, 90, 1532,50);
insert into R_VALUES values ('Accord', 'AC not working', 1.5, 90, 1532,50);
insert into R_VALUES values ('Altima', 'AC not working', 1.5, 90, 1176,50);
insert into R_VALUES values ('Rogue', 'AC not working', 1.5, 90, 1190,50);
insert into R_VALUES values ('Corolla', 'lamps not working', 1.5, 75, 1234,30);
insert into R_VALUES values ('Prius', 'lamps not working', 1.5, 75, 1234,30);
insert into R_VALUES values ('Civic', 'lamps not working', 1.5, 75, 2684,30);
insert into R_VALUES values ('Accord', 'lamps not working', 1.5, 75, 2684,30);
insert into R_VALUES values ('Altima', 'lamps not working', 1.5, 75, 2734,30);
insert into R_VALUES values ('Rogue', 'lamps not working', 1.5, 75, 2734,30);
insert into R_VALUES values ('Corolla', 'check engine', 4, 240, 14942,100);
insert into R_VALUES values ('Prius', 'check engine', 4, 240, 14942,100);
insert into R_VALUES values ('Civic', 'check engine', 4 ,240, 26263,100);
insert into R_VALUES values ('Accord', 'check engine', 4, 240, 19543,100);
insert into R_VALUES values ('Altima', 'check engine', 4, 240, 23651,100);
insert into R_VALUES values ('Rogue', 'check engine', 4, 240, 32006,100); | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.