sql stringlengths 6 1.05M |
|---|
<filename>bases de datos/practicas/practica6/script.sql
select nomm, nomh from matrim WHERE nomh in (SELECT nomh from hsim) and nomm in (select nomm from msim);
select nomh, nomm from matrim where nomh in (select nomh from msim) and nomm in (select nomm from msim) and nomm in (select nomm from hsim);
Select * from (Select * from hsim where exists (Select * from msim where hsim.nomh=msim.nomh AND hsim.nomm=msim.nomm)) AS aux where exists(select * from matrim where aux.nomh=matrim.nomh AND aux.nomm=matrim.nomm);
select h.nomm, h.nomh from hsim as h join msim as m on h.nomh = m.nomh and m.nomm = h.nomm;
select h.nomm, h.nomh from hsim as h join msim as m on h.nomh = m.nomh and m.nomm = h.nomm join matrim as mt on mt.nomm = h.nomm and mt.nomh = h.nomh; |
<gh_stars>0
-- phpMyAdmin SQL Dump
-- version 4.9.1
-- https://www.phpmyadmin.net/
--
-- Servidor: 1172.16.58.3
-- Tiempo de generación: 13-01-2021 a las 19:43:19
-- Versión del servidor: 10.4.8-MariaDB
-- Versión de PHP: 7.3.10
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: `aplicacione_web`
--
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `medals`
--
CREATE TABLE `medals` (
`id` int(11) NOT NULL,
`medal` varchar(50) NOT NULL,
`name` varchar(200) NOT NULL,
`merit` varchar(200) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Volcado de datos para la tabla `medals`
--
INSERT INTO `medals` (`id`, `medal`, `name`, `merit`) VALUES
(1, 'BRONCE', 'Estudiante', 'Pregunta con 1 punto'),
(2, 'BRONCE', 'Pregunta interesante', 'Pregunta con 2 puntos'),
(3, 'PLATA', 'Buena pregunta', 'Pregunta con 4 puntos'),
(4, 'ORO', 'Excelente pregunta', 'Pregunta con 6 puntos'),
(5, 'BRONCE', 'Pregunta popular', 'Pregunta con 2 visitas'),
(6, 'PLATA', 'Pregunta destacada', 'Pregunta con 4 visitas'),
(7, 'ORO', 'Pregunta famosa', 'Pregunta con 6 visitas'),
(8, 'BRONCE', 'Respuesta interesante', 'Respuesta con 2 puntos'),
(9, 'PLATA', 'Buena respuesta', 'Respuesta con 4 puntos'),
(10, 'ORO', 'Excelente respuesta', 'Respuesta con 6 puntos');
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `question`
--
CREATE TABLE `question` (
`id` int(11) NOT NULL,
`title` varchar(200) NOT NULL,
`body` varchar(500) NOT NULL,
`counter_visit` int(11) NOT NULL DEFAULT 0,
`counter_vote` int(11) NOT NULL DEFAULT 0,
`votes` int(11) NOT NULL DEFAULT 0,
`id_user` int(11) NOT NULL,
`date` date DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Volcado de datos para la tabla `question`
--
INSERT INTO `question` (`id`, `title`, `body`, `counter_visit`, `counter_vote`, `votes`, `id_user`, `date`) VALUES
(1, '¿Cual es la diferencia entre position: relative, position: absolute y position: fixed?', 'Sé que estas propiedades de CSS sirven para posicionar un elemento dentro de la página. Sé que estas propiedades de CSS sirven para posicionar un elemento dentro de la página.', 1, 0, 0, 1, '2021-01-13'),
(2, '¿Cómo funciona exactamente nth-child?', 'No acabo de comprender muy bien que hace exactamente y qué usos prácticos puede tener.', 1, 0, 0, 2, '2021-01-13'),
(3, 'Diferencias entre == y === (comparaciones en JavaScript)', 'Siempre he visto que en JavaScript hay:\r\n\r\nasignaciones =\r\ncomparaciones == y ===\r\nCreo entender que == hace algo parecido a comparar el valor de la variable y el === también compara el tipo (como un equals de java).\r\n', 0, 0, 0, 3, '2021-01-13'),
(4, 'Problema con asincronismo en Node', 'Soy nueva en Node... Tengo una modulo que conecta a una BD de postgres por medio de pg-node. En eso no tengo problemas. Mi problema es que al llamar a ese modulo, desde otro modulo, y despues querer usar los datos que salieron de la BD me dice undefined... Estoy casi seguro que es porque la conexion a la BD devuelve una promesa, y los datos no estan disponibles al momento de usarlos.', 0, 0, 0, 4, '2021-01-13'),
(5, '¿Qué es la inyección SQL y cómo puedo evitarla?', 'He encontrado bastantes preguntas en StackOverflow sobre programas o formularios web que guardan información en una base de datos (especialmente en PHP y MySQL) y que contienen graves problemas de seguridad relacionados principalmente con la inyección SQL.\r\n\r\nNormalmente dejo un comentario y/o un enlace a una referencia externa, pero un comentario no da mucho espacio para mucho y sería positivo que hubiera una referencia interna en SOes sobre el tema así que decidí escribir esta pregunta.\r\n', 0, 0, 0, 5, '2021-01-13');
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `question_tag`
--
CREATE TABLE `question_tag` (
`id_question` int(11) NOT NULL,
`id_tag` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Volcado de datos para la tabla `question_tag`
--
INSERT INTO `question_tag` (`id_question`, `id_tag`) VALUES
(1, 2),
(1, 3),
(2, 2),
(2, 4),
(3, 5),
(4, 6),
(5, 7),
(5, 8);
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `response`
--
CREATE TABLE `response` (
`id` int(11) NOT NULL,
`message` varchar(500) NOT NULL,
`counter_vote` int(11) NOT NULL DEFAULT 0,
`votes` int(11) NOT NULL DEFAULT 0,
`id_question` int(11) NOT NULL,
`id_user` int(11) NOT NULL,
`date` date NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Volcado de datos para la tabla `response`
--
INSERT INTO `response` (`id`, `message`, `counter_vote`, `votes`, `id_question`, `id_user`, `date`) VALUES
(1, 'La propiedad position sirve para posicionar un elemento dentro de la página. Sin embargo, dependiendo de cual sea la propiedad que usemos, el elemento tomará una referencia u otra para posicionarse respecto a ella.\r\n\r\nLos posibles valores que puede adoptar la propiedad position son: static | relative | absolute | fixed | inherit | initial.\r\n', 0, 0, 1, 5, '2021-01-13'),
(2, 'La pseudoclase :nth-child() selecciona los hermanos que cumplan cierta condición definida en la fórmula an + b. a y b deben ser números enteros, n es un contador. El grupo an representa un ciclo, cada cuantos elementos se repite; b indica desde donde empezamos a contar.', 0, 0, 2, 6, '2021-01-13');
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `sessions`
--
CREATE TABLE `sessions` (
`session_id` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL,
`expires` int(11) UNSIGNED NOT NULL,
`data` mediumtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `tag`
--
CREATE TABLE `tag` (
`id` int(11) NOT NULL,
`name` varchar(50) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Volcado de datos para la tabla `tag`
--
INSERT INTO `tag` (`id`, `name`) VALUES
(2, 'css'),
(3, 'css3'),
(4, 'html'),
(5, 'JavaScript'),
(6, 'nodejs'),
(7, 'mysql'),
(8, 'sql');
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `user_medal_question`
--
CREATE TABLE `user_medal_question` (
`id_user` int(11) NOT NULL,
`id_medal` int(11) NOT NULL,
`id_question` int(11) NOT NULL,
`date` date NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `user_medal_response`
--
CREATE TABLE `user_medal_response` (
`id_user` int(11) NOT NULL,
`id_medal` int(11) NOT NULL,
`id_response` int(11) NOT NULL,
`date` date NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `usuario`
--
CREATE TABLE `usuario` (
`id` int(11) NOT NULL,
`email` varchar(200) NOT NULL,
`password` varchar(25) NOT NULL,
`name` varchar(50) NOT NULL,
`imagen` varchar(250) DEFAULT NULL,
`date` date NOT NULL,
`reputation` int(11) NOT NULL DEFAULT 1,
`publicate_questions` int(11) NOT NULL DEFAULT 0,
`publicate_response` int(11) NOT NULL DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Volcado de datos para la tabla `usuario`
--
INSERT INTO `usuario` (`id`, `email`, `password`, `name`, `imagen`, `date`, `reputation`, `publicate_questions`, `publicate_response`) VALUES
(1, '<EMAIL>', '12345678', 'Nico', '1610560579358.png', '2021-01-13', 1, 1, 0),
(2, '<EMAIL>', '12345678', 'Roberto', '1610560802828.png', '2021-01-13', 1, 1, 0),
(3, '<EMAIL>', '12345678', 'SFG', '1610561802558.png', '2021-01-13', 1, 1, 0),
(4, '<EMAIL>', '12345678', 'Marta', '1610561834591.png', '2021-01-13', 1, 1, 0),
(5, '<EMAIL>', '12345678', 'Lucas', NULL, '2021-01-13', 1, 1, 1),
(6, '<EMAIL>.es', '12345678', 'Emy', '1610561910740.png', '2021-01-13', 1, 0, 1);
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `visit_question_user`
--
CREATE TABLE `visit_question_user` (
`id_user` int(11) NOT NULL,
`id_question` int(11) NOT NULL,
`date` date NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Volcado de datos para la tabla `visit_question_user`
--
INSERT INTO `visit_question_user` (`id_user`, `id_question`, `date`) VALUES
(5, 1, '2021-01-13'),
(6, 2, '2021-01-13');
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `vote_question_user`
--
CREATE TABLE `vote_question_user` (
`id_user` int(11) NOT NULL,
`id_question` int(11) NOT NULL,
`date` date NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `vote_response_user`
--
CREATE TABLE `vote_response_user` (
`id_user` int(11) NOT NULL,
`id_response` int(11) NOT NULL,
`date` date NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Índices para tablas volcadas
--
--
-- Indices de la tabla `medals`
--
ALTER TABLE `medals`
ADD PRIMARY KEY (`id`) USING BTREE;
--
-- Indices de la tabla `question`
--
ALTER TABLE `question`
ADD PRIMARY KEY (`id`),
ADD KEY `FK_RESPONSE` (`id_user`);
--
-- Indices de la tabla `question_tag`
--
ALTER TABLE `question_tag`
ADD PRIMARY KEY (`id_question`,`id_tag`),
ADD KEY `FK_T` (`id_tag`,`id_question`) USING BTREE;
--
-- Indices de la tabla `response`
--
ALTER TABLE `response`
ADD PRIMARY KEY (`id`),
ADD KEY `FK_QUESTION` (`id_question`),
ADD KEY `FK_USER` (`id_user`);
--
-- Indices de la tabla `sessions`
--
ALTER TABLE `sessions`
ADD PRIMARY KEY (`session_id`);
--
-- Indices de la tabla `tag`
--
ALTER TABLE `tag`
ADD PRIMARY KEY (`id`);
--
-- Indices de la tabla `user_medal_question`
--
ALTER TABLE `user_medal_question`
ADD PRIMARY KEY (`id_user`,`id_medal`,`id_question`),
ADD KEY `FM_UMQ1` (`id_medal`),
ADD KEY `FM_UMQ2` (`id_question`);
--
-- Indices de la tabla `user_medal_response`
--
ALTER TABLE `user_medal_response`
ADD PRIMARY KEY (`id_user`,`id_medal`,`id_response`),
ADD KEY `FK_UMR1` (`id_medal`),
ADD KEY `FK_UMR2` (`id_response`);
--
-- Indices de la tabla `usuario`
--
ALTER TABLE `usuario`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `indice_email` (`email`);
--
-- Indices de la tabla `visit_question_user`
--
ALTER TABLE `visit_question_user`
ADD PRIMARY KEY (`id_user`,`id_question`),
ADD KEY `FK_QUESTION_U` (`id_question`);
--
-- Indices de la tabla `vote_question_user`
--
ALTER TABLE `vote_question_user`
ADD PRIMARY KEY (`id_user`,`id_question`);
--
-- Indices de la tabla `vote_response_user`
--
ALTER TABLE `vote_response_user`
ADD PRIMARY KEY (`id_user`,`id_response`),
ADD KEY `FK_RESPONSE_USER` (`id_response`);
--
-- AUTO_INCREMENT de las tablas volcadas
--
--
-- AUTO_INCREMENT de la tabla `medals`
--
ALTER TABLE `medals`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=11;
--
-- AUTO_INCREMENT de la tabla `question`
--
ALTER TABLE `question`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;
--
-- AUTO_INCREMENT de la tabla `response`
--
ALTER TABLE `response`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT de la tabla `tag`
--
ALTER TABLE `tag`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=9;
--
-- AUTO_INCREMENT de la tabla `usuario`
--
ALTER TABLE `usuario`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7;
--
-- Restricciones para tablas volcadas
--
--
-- Filtros para la tabla `question`
--
ALTER TABLE `question`
ADD CONSTRAINT `FK_RESPONSE` FOREIGN KEY (`id_user`) REFERENCES `usuario` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Filtros para la tabla `question_tag`
--
ALTER TABLE `question_tag`
ADD CONSTRAINT `FK_Q` FOREIGN KEY (`id_question`) REFERENCES `question` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `FK_T` FOREIGN KEY (`id_tag`) REFERENCES `tag` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Filtros para la tabla `response`
--
ALTER TABLE `response`
ADD CONSTRAINT `FK_QUESTION` FOREIGN KEY (`id_question`) REFERENCES `question` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `FK_USER` FOREIGN KEY (`id_user`) REFERENCES `usuario` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Filtros para la tabla `user_medal_question`
--
ALTER TABLE `user_medal_question`
ADD CONSTRAINT `FK_UMQ` FOREIGN KEY (`id_user`) REFERENCES `usuario` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `FM_UMQ1` FOREIGN KEY (`id_medal`) REFERENCES `medals` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `FM_UMQ2` FOREIGN KEY (`id_question`) REFERENCES `question` (`id`);
--
-- Filtros para la tabla `user_medal_response`
--
ALTER TABLE `user_medal_response`
ADD CONSTRAINT `FK_UMR` FOREIGN KEY (`id_user`) REFERENCES `usuario` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `FK_UMR1` FOREIGN KEY (`id_medal`) REFERENCES `medals` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `FK_UMR2` FOREIGN KEY (`id_response`) REFERENCES `response` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Filtros para la tabla `visit_question_user`
--
ALTER TABLE `visit_question_user`
ADD CONSTRAINT `FK_QUESTION_U` FOREIGN KEY (`id_question`) REFERENCES `question` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `FK_USER_Q` FOREIGN KEY (`id_user`) REFERENCES `usuario` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Filtros para la tabla `vote_response_user`
--
ALTER TABLE `vote_response_user`
ADD CONSTRAINT `FK_RESPONSE_USER` FOREIGN KEY (`id_response`) REFERENCES `response` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `FK_USER_RESPONSE` FOREIGN KEY (`id_user`) REFERENCES `usuario` (`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 */;
|
<reponame>AxelFernandez/WebHorariosLavalle<filename>myDB.sql
-- phpMyAdmin SQL Dump
-- version 4.9.5
-- https://www.phpmyadmin.net/
--
-- Servidor: localhost:3306
-- Tiempo de generación: 07-07-2020 a las 14:11:54
-- Versión del servidor: 5.7.30
-- Versión de PHP: 7.3.6
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Base de datos: `horarios_HorariosLavalle`
--
CREATE DATABASE IF NOT EXISTS `horarios_HorariosLavalle` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci;
USE `horarios_HorariosLavalle`;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `californiaidasaturday`
--
CREATE TABLE `californiaidasaturday` (
`idcaliforniaidaweek` int(11) NOT NULL,
`3portena` time DEFAULT NULL,
`central` time DEFAULT NULL,
`william` time DEFAULT NULL,
`california` time DEFAULT NULL,
`costa` time DEFAULT NULL,
`additional` text
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
--
-- Volcado de datos para la tabla `californiaidasaturday`
--
INSERT INTO `californiaidasaturday` (`idcaliforniaidaweek`, `3portena`, `central`, `william`, `california`, `costa`, `additional`) VALUES
(1, '07:00:00', '07:10:00', NULL, '07:20:00', '07:40:00', NULL),
(2, NULL, NULL, NULL, '10:10:00', '10:30:00', NULL),
(3, '16:40:00', '16:50:00', NULL, '17:00:00', '17:20:00', NULL),
(4, NULL, NULL, NULL, '18:50:00', '19:10:00', NULL);
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `californiaidasunday`
--
CREATE TABLE `californiaidasunday` (
`idcaliforniaidaweek` int(11) NOT NULL,
`3portena` time DEFAULT NULL,
`central` time DEFAULT NULL,
`california` time DEFAULT NULL,
`costa` time DEFAULT NULL,
`additional` text
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
--
-- Volcado de datos para la tabla `californiaidasunday`
--
INSERT INTO `californiaidasunday` (`idcaliforniaidaweek`, `3portena`, `central`, `california`, `costa`, `additional`) VALUES
(1, '07:00:00', '07:10:00', '07:20:00', '07:40:00', NULL),
(2, NULL, NULL, '10:10:00', '10:30:00', NULL),
(3, '16:40:00', '16:50:00', '17:00:00', '17:20:00', NULL),
(4, NULL, NULL, '18:50:00', '19:10:00', NULL);
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `californiaidaweek`
--
CREATE TABLE `californiaidaweek` (
`idcaliforniaidaweek` int(11) NOT NULL,
`3portena` time DEFAULT NULL,
`central` time DEFAULT NULL,
`william` time DEFAULT NULL,
`california` time DEFAULT NULL,
`costa` time DEFAULT NULL,
`additional` text
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
--
-- Volcado de datos para la tabla `californiaidaweek`
--
INSERT INTO `californiaidaweek` (`idcaliforniaidaweek`, `3portena`, `central`, `william`, `california`, `costa`, `additional`) VALUES
(1, '06:00:00', '06:10:00', NULL, '06:20:00', '06:40:00', NULL),
(2, NULL, NULL, NULL, '10:10:00', '10:30:00', NULL),
(3, NULL, NULL, NULL, '12:30:00', '12:50:00', NULL),
(4, NULL, NULL, NULL, '15:50:00', '16:10:00', NULL);
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `californiavueltasaturday`
--
CREATE TABLE `californiavueltasaturday` (
`idcaliforniavueltasaturday` int(11) NOT NULL,
`costa` time DEFAULT NULL,
`california` time DEFAULT NULL,
`william` time DEFAULT NULL,
`central` time DEFAULT NULL,
`3portena` time DEFAULT NULL,
`additional` text
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
--
-- Volcado de datos para la tabla `californiavueltasaturday`
--
INSERT INTO `californiavueltasaturday` (`idcaliforniavueltasaturday`, `costa`, `california`, `william`, `central`, `3portena`, `additional`) VALUES
(1, '09:20:00', '09:40:00', NULL, NULL, NULL, NULL),
(2, '10:30:00', '10:50:00', NULL, '11:00:00', '11:10:00', NULL),
(3, '18:20:00', '18:40:00', NULL, NULL, NULL, NULL),
(4, '20:00:00', '20:20:00', NULL, '20:30:00', '20:40:00', NULL);
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `californiavueltasunday`
--
CREATE TABLE `californiavueltasunday` (
`idcaliforniavueltasaturday` int(11) NOT NULL,
`costa` time DEFAULT NULL,
`california` time DEFAULT NULL,
`central` time DEFAULT NULL,
`3portena` time DEFAULT NULL,
`additional` text
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
--
-- Volcado de datos para la tabla `californiavueltasunday`
--
INSERT INTO `californiavueltasunday` (`idcaliforniavueltasaturday`, `costa`, `california`, `central`, `3portena`, `additional`) VALUES
(1, '09:20:00', '09:40:00', NULL, NULL, NULL),
(2, '10:30:00', '10:50:00', '11:00:00', '11:10:00', NULL),
(3, '18:20:00', '18:40:00', NULL, NULL, NULL),
(4, '20:00:00', '20:20:00', '20:30:00', '20:40:00', NULL);
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `californiavueltaweek`
--
CREATE TABLE `californiavueltaweek` (
`idcaliforniavueltaweek` int(11) NOT NULL,
`costa` time DEFAULT NULL,
`california` time DEFAULT NULL,
`william` time DEFAULT NULL,
`central` time DEFAULT NULL,
`3portena` time DEFAULT NULL,
`additional` text
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
--
-- Volcado de datos para la tabla `californiavueltaweek`
--
INSERT INTO `californiavueltaweek` (`idcaliforniavueltaweek`, `costa`, `california`, `william`, `central`, `3portena`, `additional`) VALUES
(1, '09:40:00', '10:00:00', NULL, NULL, NULL, NULL),
(2, '12:00:00', '12:20:00', NULL, NULL, NULL, NULL),
(3, '15:10:00', '15:30:00', NULL, NULL, NULL, NULL),
(4, '20:00:00', '20:20:00', NULL, '20:30:00', '20:40:00', NULL);
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `internocostaidasaturday`
--
CREATE TABLE `internocostaidasaturday` (
`idinternocostaidasaturday` int(11) NOT NULL,
`lapega` time DEFAULT NULL,
`lasvioletas` time DEFAULT NULL,
`elvergel` time DEFAULT NULL,
`paramillo` time DEFAULT NULL,
`lavalle` time DEFAULT NULL,
`labajada` time DEFAULT NULL,
`california` time DEFAULT NULL,
`mendoza` time DEFAULT NULL,
`costaDeAraujo` time DEFAULT NULL,
`additional` text
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
--
-- Volcado de datos para la tabla `internocostaidasaturday`
--
INSERT INTO `internocostaidasaturday` (`idinternocostaidasaturday`, `lapega`, `lasvioletas`, `elvergel`, `paramillo`, `lavalle`, `labajada`, `california`, `mendoza`, `costaDeAraujo`, `additional`) VALUES
(1, NULL, NULL, NULL, '09:00:00', '09:20:00', NULL, NULL, NULL, NULL, NULL),
(2, '09:50:00', NULL, '10:00:00', NULL, '10:10:00', NULL, NULL, NULL, NULL, NULL),
(4, NULL, NULL, NULL, NULL, '10:10:00', NULL, NULL, NULL, '10:50:00', 'Por La Palmera'),
(5, NULL, NULL, NULL, '18:00:00', '18:20:00', NULL, NULL, NULL, NULL, NULL),
(6, '18:50:00', '18:40:00', '19:00:00', NULL, '19:10:00', NULL, NULL, NULL, NULL, NULL),
(7, NULL, NULL, NULL, NULL, '19:10:00', NULL, NULL, NULL, '19:50:00', NULL);
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `internocostaidasunday`
--
CREATE TABLE `internocostaidasunday` (
`idinternocostaidasunday` int(11) NOT NULL,
`lasvioletas` time DEFAULT NULL,
`lapega` time DEFAULT NULL,
`elvergel` time DEFAULT NULL,
`paramillo` time DEFAULT NULL,
`lavalle` time DEFAULT NULL,
`costaDeAraujo` time DEFAULT NULL,
`additional` text
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
--
-- Volcado de datos para la tabla `internocostaidasunday`
--
INSERT INTO `internocostaidasunday` (`idinternocostaidasunday`, `lasvioletas`, `lapega`, `elvergel`, `paramillo`, `lavalle`, `costaDeAraujo`, `additional`) VALUES
(1, NULL, NULL, NULL, '09:00:00', '09:20:00', NULL, NULL),
(2, NULL, '09:50:00', '10:00:00', NULL, '10:10:00', NULL, NULL),
(3, NULL, NULL, NULL, NULL, '10:10:00', '10:50:00', 'Por PALMERA'),
(4, NULL, NULL, NULL, '18:00:00', '18:20:00', NULL, NULL),
(5, '18:40:00', '18:50:00', '19:00:00', NULL, '19:10:00', NULL, NULL),
(6, NULL, NULL, NULL, NULL, '19:10:00', '19:50:00', 'Por PALMERA');
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `internocostaidaweek`
--
CREATE TABLE `internocostaidaweek` (
`idinternocostaidaweek` int(11) NOT NULL,
`lapega` time DEFAULT NULL,
`lasvioletas` time DEFAULT NULL,
`elvergel` time DEFAULT NULL,
`paramillo` time DEFAULT NULL,
`california` time DEFAULT NULL,
`labajada` time DEFAULT NULL,
`mendoza` time DEFAULT NULL,
`lavalle` time DEFAULT NULL,
`costaDeAraujo` time DEFAULT NULL,
`additional` text
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
--
-- Volcado de datos para la tabla `internocostaidaweek`
--
INSERT INTO `internocostaidaweek` (`idinternocostaidaweek`, `lapega`, `lasvioletas`, `elvergel`, `paramillo`, `california`, `labajada`, `mendoza`, `lavalle`, `costaDeAraujo`, `additional`) VALUES
(6, NULL, '12:20:00', '12:30:00', NULL, NULL, NULL, NULL, '12:40:00', NULL, NULL),
(5, NULL, NULL, NULL, NULL, NULL, NULL, '10:00:00', '11:00:00', NULL, NULL),
(4, NULL, NULL, NULL, NULL, '10:10:00', NULL, NULL, NULL, '10:30:00', NULL),
(3, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '08:40:00', '09:20:00', 'Por El Carmen'),
(2, NULL, NULL, NULL, '08:10:00', NULL, NULL, NULL, '08:30:00', NULL, NULL),
(1, NULL, '07:20:00', '07:30:00', NULL, NULL, NULL, NULL, '07:40:00', NULL, NULL),
(7, NULL, NULL, NULL, '13:10:00', NULL, NULL, NULL, '13:30:00', NULL, NULL),
(8, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '13:40:00', '14:20:00', 'Por <NAME>'),
(9, '17:30:00', NULL, '17:40:00', NULL, NULL, NULL, NULL, '17:50:00', NULL, NULL),
(10, NULL, NULL, NULL, NULL, NULL, NULL, '18:00:00', '19:00:00', NULL, NULL),
(11, NULL, NULL, NULL, '18:20:00', NULL, NULL, NULL, '18:40:00', NULL, NULL),
(12, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '19:10:00', '19:30:00', NULL),
(13, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '19:20:00', '20:00:00', 'Por La Merced');
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `internocostavueltasaturday`
--
CREATE TABLE `internocostavueltasaturday` (
`idinternocostavueltasaturday` int(11) NOT NULL,
`costaDeAraujo` time DEFAULT NULL,
`mendoza` time DEFAULT NULL,
`california` time DEFAULT NULL,
`labajada` time DEFAULT NULL,
`lavalle` time DEFAULT NULL,
`paramillo` time DEFAULT NULL,
`elvergel` time DEFAULT NULL,
`lasvioletas` time DEFAULT NULL,
`lapega` time DEFAULT NULL,
`additional` text
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
--
-- Volcado de datos para la tabla `internocostavueltasaturday`
--
INSERT INTO `internocostavueltasaturday` (`idinternocostavueltasaturday`, `costaDeAraujo`, `mendoza`, `california`, `labajada`, `lavalle`, `paramillo`, `elvergel`, `lasvioletas`, `lapega`, `additional`) VALUES
(1, '08:00:00', NULL, NULL, NULL, '08:40:00', NULL, NULL, NULL, NULL, 'Por La Palmera'),
(2, NULL, NULL, NULL, NULL, '08:40:00', '09:00:00', NULL, NULL, NULL, NULL),
(4, NULL, NULL, NULL, NULL, '09:20:00', NULL, '09:30:00', '09:40:00', '09:50:00', NULL),
(5, '17:00:00', NULL, NULL, NULL, '17:40:00', NULL, NULL, NULL, NULL, 'Por La Palmera'),
(6, NULL, NULL, NULL, NULL, '17:40:00', '18:00:00', NULL, NULL, NULL, NULL),
(7, NULL, NULL, NULL, NULL, '18:20:00', NULL, '18:30:00', '18:40:00', '18:50:00', NULL),
(8, '20:30:00', NULL, NULL, '20:40:00', NULL, NULL, NULL, NULL, NULL, NULL);
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `internocostavueltasunday`
--
CREATE TABLE `internocostavueltasunday` (
`idinternocostavueltasunday` int(11) NOT NULL,
`costaDeAraujo` time DEFAULT NULL,
`labajada` time DEFAULT NULL,
`lavalle` time DEFAULT NULL,
`paramillo` time DEFAULT NULL,
`elvergel` time DEFAULT NULL,
`lasvioletas` time DEFAULT NULL,
`lapega` time DEFAULT NULL,
`additional` text
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
--
-- Volcado de datos para la tabla `internocostavueltasunday`
--
INSERT INTO `internocostavueltasunday` (`idinternocostavueltasunday`, `costaDeAraujo`, `labajada`, `lavalle`, `paramillo`, `elvergel`, `lasvioletas`, `lapega`, `additional`) VALUES
(1, '08:00:00', NULL, '08:40:00', NULL, NULL, NULL, NULL, 'Por La Palmera'),
(2, NULL, NULL, '08:40:00', '09:00:00', NULL, NULL, NULL, NULL),
(3, NULL, NULL, '09:20:00', NULL, '09:30:00', '09:40:00', '09:50:00', NULL),
(4, '17:00:00', NULL, '17:40:00', NULL, NULL, NULL, NULL, 'Por La Palmera'),
(5, NULL, NULL, '17:40:00', '18:00:00', NULL, NULL, NULL, NULL),
(6, NULL, NULL, '18:20:00', NULL, '18:30:00', '18:40:00', '18:50:00', NULL),
(7, '20:30:00', '20:40:00', NULL, NULL, NULL, NULL, NULL, NULL);
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `internocostavueltaweek`
--
CREATE TABLE `internocostavueltaweek` (
`idinternocostavueltaweek` int(11) NOT NULL,
`costaDeAraujo` time DEFAULT NULL,
`lavalle` time DEFAULT NULL,
`mendoza` time DEFAULT NULL,
`labajada` time DEFAULT NULL,
`california` time DEFAULT NULL,
`paramillo` time DEFAULT NULL,
`elvergel` time DEFAULT NULL,
`lasvioletas` time DEFAULT NULL,
`lapega` time DEFAULT NULL,
`additional` text
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
--
-- Volcado de datos para la tabla `internocostavueltaweek`
--
INSERT INTO `internocostavueltaweek` (`idinternocostavueltaweek`, `costaDeAraujo`, `lavalle`, `mendoza`, `labajada`, `california`, `paramillo`, `elvergel`, `lasvioletas`, `lapega`, `additional`) VALUES
(6, '11:00:00', '11:40:00', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'Por Arenales'),
(5, '09:40:00', NULL, NULL, NULL, '10:00:00', NULL, NULL, NULL, NULL, NULL),
(4, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(3, NULL, '07:50:00', NULL, NULL, NULL, '08:10:00', NULL, NULL, NULL, NULL),
(2, NULL, '06:50:00', NULL, NULL, NULL, NULL, '07:00:00', '07:20:00', '07:10:00', NULL),
(1, '06:00:00', '06:40:00', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'Por <NAME>'),
(7, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(8, NULL, '12:00:00', NULL, NULL, NULL, NULL, '12:10:00', '12:20:00', NULL, NULL),
(9, NULL, '12:50:00', NULL, NULL, NULL, '13:10:00', NULL, NULL, NULL, NULL),
(10, '15:00:00', '15:40:00', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'Por Arenales'),
(11, NULL, '16:00:00', '17:00:00', NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(12, '20:30:00', NULL, NULL, '20:40:00', NULL, NULL, NULL, NULL, NULL, NULL);
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `internolavalleidasaturday`
--
CREATE TABLE `internolavalleidasaturday` (
`idinternolavalleidasaturday` int(11) NOT NULL,
`paramillo` time DEFAULT NULL,
`lapega` time DEFAULT NULL,
`lasvioletas` time DEFAULT NULL,
`elvergel` time DEFAULT NULL,
`mendoza` time DEFAULT NULL,
`lavalle` time DEFAULT NULL,
`additional` text
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `internolavalleidasunday`
--
CREATE TABLE `internolavalleidasunday` (
`idinternolavalleidasunday` int(11) NOT NULL,
`paramillo` time DEFAULT NULL,
`lapega` time DEFAULT NULL,
`lasvioletas` time DEFAULT NULL,
`elvergel` time DEFAULT NULL,
`mendoza` time DEFAULT NULL,
`lavalle` time DEFAULT NULL,
`additional` text
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `internolavalleidaweek`
--
CREATE TABLE `internolavalleidaweek` (
`idinternolavalleidaweek` int(11) NOT NULL,
`paramillo` time DEFAULT NULL,
`lapega` time DEFAULT NULL,
`lasvioletas` time DEFAULT NULL,
`elvergel` time DEFAULT NULL,
`btupac` time DEFAULT NULL,
`blacolmena` time DEFAULT NULL,
`lavalle` time DEFAULT NULL,
`additional` text
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `internolavallevueltasaturday`
--
CREATE TABLE `internolavallevueltasaturday` (
`idinternolavallevueltasaturday` int(11) NOT NULL,
`lavalle` time DEFAULT NULL,
`mendoza` time DEFAULT NULL,
`elvergel` time DEFAULT NULL,
`lasvioletas` time DEFAULT NULL,
`lapega` time DEFAULT NULL,
`paramillo` time DEFAULT NULL,
`additional` text
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `internolavallevueltasunday`
--
CREATE TABLE `internolavallevueltasunday` (
`idinternolavallevueltasunday` int(11) NOT NULL,
`lavalle` time DEFAULT NULL,
`mendoza` time DEFAULT NULL,
`elvergel` time DEFAULT NULL,
`lasvioletas` time DEFAULT NULL,
`lapega` time DEFAULT NULL,
`paramillo` time DEFAULT NULL,
`additional` text
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `internolavallevueltaweek`
--
CREATE TABLE `internolavallevueltaweek` (
`idinternolavallevueltaweek` int(11) NOT NULL,
`lavalle` time DEFAULT NULL,
`blacolmena` time DEFAULT NULL,
`btupac` time DEFAULT NULL,
`elvergel` time DEFAULT NULL,
`lasvioletas` time DEFAULT NULL,
`lapega` time DEFAULT NULL,
`paramillo` time DEFAULT NULL,
`additional` text
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `ruta24idasaturday`
--
CREATE TABLE `ruta24idasaturday` (
`idruta24idasaturday` int(11) NOT NULL,
`asuncion` time DEFAULT NULL,
`el15` time DEFAULT NULL,
`gustavoAndre` time DEFAULT NULL,
`costaDeAraujo` time DEFAULT NULL,
`lavalle` time DEFAULT NULL,
`mendoza` time DEFAULT NULL,
`additional` text
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Volcado de datos para la tabla `ruta24idasaturday`
--
INSERT INTO `ruta24idasaturday` (`idruta24idasaturday`, `asuncion`, `el15`, `gustavoAndre`, `costaDeAraujo`, `lavalle`, `mendoza`, `additional`) VALUES
(1, NULL, NULL, NULL, NULL, '05:20:00', '06:20:00', NULL),
(2, NULL, NULL, '05:40:00', '06:00:00', '06:20:00', '07:20:00', NULL),
(3, '07:05:00', '07:15:00', '07:20:00', '07:40:00', '08:00:00', '09:00:00', NULL),
(4, NULL, '08:15:00', '08:20:00', '08:40:00', '09:00:00', '10:00:00', NULL),
(5, NULL, NULL, NULL, '09:40:00', '10:00:00', '11:00:00', NULL),
(6, NULL, NULL, '10:30:00', '10:50:00', '11:10:00', '12:10:00', NULL),
(7, NULL, NULL, '11:30:00', '11:50:00', '12:10:00', '13:10:00', NULL),
(8, NULL, NULL, NULL, '13:00:00', '13:20:00', '14:20:00', NULL),
(9, NULL, NULL, '13:50:00', '14:10:00', '14:30:00', '15:30:00', NULL),
(10, NULL, NULL, NULL, '15:20:00', '15:40:00', '16:40:00', NULL),
(11, NULL, NULL, '16:15:00', '16:35:00', '16:55:00', '17:55:00', NULL),
(12, '17:05:00', '17:15:00', '17:20:00', '17:40:00', '18:00:00', '19:00:00', NULL),
(13, NULL, NULL, NULL, '18:30:00', '18:50:00', '19:50:00', NULL),
(14, NULL, '19:05:00', '19:10:00', '19:30:00', '19:50:00', '20:50:00', NULL),
(15, NULL, NULL, NULL, '20:30:00', '20:50:00', '21:50:00', NULL),
(16, NULL, NULL, '21:10:00', '21:30:00', '21:50:00', '22:50:00', NULL);
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `ruta24idasunday`
--
CREATE TABLE `ruta24idasunday` (
`idruta24idasunday` int(11) NOT NULL,
`asuncion` time DEFAULT NULL,
`el15` time DEFAULT NULL,
`gustavoAndre` time DEFAULT NULL,
`costaDeAraujo` time DEFAULT NULL,
`lavalle` time DEFAULT NULL,
`mendoza` time DEFAULT NULL,
`additional` text
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Volcado de datos para la tabla `ruta24idasunday`
--
INSERT INTO `ruta24idasunday` (`idruta24idasunday`, `asuncion`, `el15`, `gustavoAndre`, `costaDeAraujo`, `lavalle`, `mendoza`, `additional`) VALUES
(1, NULL, NULL, NULL, NULL, '05:20:00', '06:20:00', NULL),
(2, NULL, NULL, '05:40:00', '06:00:00', '06:20:00', '07:20:00', NULL),
(3, '07:05:00', '07:15:00', '07:20:00', '07:40:00', '08:00:00', '09:00:00', NULL),
(4, NULL, '08:15:00', '08:20:00', '08:40:00', '09:00:00', '10:00:00', NULL),
(5, NULL, NULL, NULL, '09:40:00', '10:00:00', '11:00:00', NULL),
(6, NULL, NULL, '10:30:00', '10:50:00', '11:10:00', '12:10:00', NULL),
(7, NULL, NULL, '11:30:00', '11:50:00', '12:10:00', '13:10:00', NULL),
(8, NULL, NULL, NULL, '13:00:00', '13:20:00', '14:20:00', NULL),
(9, NULL, NULL, '13:50:00', '14:10:00', '14:30:00', '15:30:00', NULL),
(10, NULL, NULL, NULL, '15:20:00', '15:40:00', '16:40:00', NULL),
(11, NULL, NULL, '16:15:00', '16:35:00', '16:55:00', '17:55:00', NULL),
(12, '17:05:00', '17:15:00', '17:20:00', '17:40:00', '18:00:00', '19:00:00', NULL),
(13, NULL, NULL, NULL, '18:30:00', '18:50:00', '19:50:00', NULL),
(14, NULL, '19:05:00', '19:10:00', '19:30:00', '19:50:00', '20:50:00', NULL),
(15, NULL, NULL, NULL, '20:30:00', '20:50:00', '21:50:00', NULL),
(16, NULL, NULL, '21:10:00', '21:30:00', '21:50:00', '22:50:00', NULL);
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `ruta24idaweek`
--
CREATE TABLE `ruta24idaweek` (
`idruta24idaweek` int(11) NOT NULL,
`asuncion` time DEFAULT NULL,
`el15` time DEFAULT NULL,
`gustavoAndre` time DEFAULT NULL,
`costaDeAraujo` time DEFAULT NULL,
`lavalle` time DEFAULT NULL,
`mendoza` time DEFAULT NULL,
`additional` text
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Volcado de datos para la tabla `ruta24idaweek`
--
INSERT INTO `ruta24idaweek` (`idruta24idaweek`, `asuncion`, `el15`, `gustavoAndre`, `costaDeAraujo`, `lavalle`, `mendoza`, `additional`) VALUES
(1, NULL, NULL, NULL, NULL, '05:20:00', '06:20:00', NULL),
(2, NULL, NULL, '05:40:00', '06:00:00', '06:20:00', '07:20:00', NULL),
(3, NULL, NULL, '06:20:00', '06:40:00', '07:00:00', '08:00:00', NULL),
(4, '06:45:00', '06:55:00', '07:00:00', '07:20:00', '07:40:00', '08:40:00', '<NAME>'),
(5, NULL, NULL, '07:30:00', '07:50:00', '08:10:00', '09:10:00', NULL),
(6, NULL, '07:55:00', '08:00:00', '08:20:00', '08:40:00', '09:40:00', NULL),
(7, NULL, NULL, '08:40:00', '09:00:00', '09:20:00', '10:20:00', NULL),
(8, NULL, NULL, '09:30:00', '09:50:00', '10:10:00', '11:10:00', NULL),
(9, NULL, NULL, NULL, '10:40:00', '11:00:00', '12:00:00', NULL),
(10, NULL, NULL, '11:10:00', '11:30:00', '11:50:00', '12:50:00', NULL),
(11, NULL, NULL, NULL, '12:30:00', '12:50:00', '13:50:00', NULL),
(12, NULL, NULL, '13:10:00', '13:30:00', '13:50:00', '14:50:00', NULL),
(13, NULL, NULL, NULL, '14:00:00', '14:20:00', '15:20:00', NULL),
(14, NULL, NULL, '14:20:00', '14:40:00', '15:00:00', '16:00:00', NULL),
(15, NULL, NULL, NULL, '15:20:00', '15:40:00', '16:40:00', NULL),
(16, NULL, NULL, '16:00:00', '16:20:00', '16:40:00', '17:40:00', NULL),
(17, '16:55:00', '17:05:00', '17:10:00', '17:30:00', '17:50:00', '18:50:00', '<NAME> Servicio Asunción'),
(18, NULL, NULL, NULL, '18:30:00', '18:50:00', '19:50:00', NULL),
(19, NULL, NULL, '18:30:00', '18:50:00', '19:10:00', NULL, NULL),
(20, NULL, NULL, '19:50:00', '20:10:00', '20:30:00', '21:30:00', NULL),
(21, NULL, NULL, NULL, '21:30:00', '21:50:00', '22:40:00', NULL);
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `ruta24vueltasaturday`
--
CREATE TABLE `ruta24vueltasaturday` (
`idruta24vueltasaturday` int(11) NOT NULL,
`mendoza` time DEFAULT NULL,
`lavalle` time DEFAULT NULL,
`costaDeAraujo` time DEFAULT NULL,
`gustavoAndre` time DEFAULT NULL,
`el15` time DEFAULT NULL,
`asuncion` time DEFAULT NULL,
`additional` text
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Volcado de datos para la tabla `ruta24vueltasaturday`
--
INSERT INTO `ruta24vueltasaturday` (`idruta24vueltasaturday`, `mendoza`, `lavalle`, `costaDeAraujo`, `gustavoAndre`, `el15`, `asuncion`, `additional`) VALUES
(1, '06:20:00', '07:20:00', '07:40:00', '08:00:00', '08:05:00', NULL, NULL),
(2, '07:40:00', '08:40:00', '09:00:00', NULL, NULL, NULL, NULL),
(3, '08:50:00', '09:50:00', '10:10:00', '10:30:00', NULL, NULL, NULL),
(4, '09:40:00', '10:40:00', '11:00:00', '11:20:00', NULL, NULL, NULL),
(5, '10:50:00', '11:50:00', '12:10:00', NULL, NULL, NULL, NULL),
(6, '11:50:00', '12:50:00', '13:10:00', '13:30:00', NULL, NULL, NULL),
(7, '12:50:00', '13:50:00', '14:10:00', NULL, NULL, NULL, NULL),
(8, '14:00:00', '15:00:00', '15:20:00', '15:40:00', NULL, NULL, NULL),
(9, '15:10:00', '16:10:00', '16:30:00', '16:50:00', '16:55:00', '17:05:00', NULL),
(10, '16:20:00', '17:20:00', '17:40:00', NULL, NULL, NULL, NULL),
(11, '17:20:00', '18:20:00', '18:40:00', '19:00:00', '19:05:00', NULL, NULL),
(12, '18:30:00', '19:30:00', '19:50:00', NULL, NULL, NULL, NULL),
(13, '19:30:00', '20:30:00', '20:50:00', '21:10:00', NULL, NULL, NULL),
(14, '20:30:00', '21:30:00', '21:50:00', NULL, NULL, NULL, NULL),
(15, '21:30:00', '22:30:00', '22:43:00', NULL, NULL, NULL, NULL),
(16, '22:30:00', '23:30:00', '23:50:00', NULL, NULL, NULL, NULL);
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `ruta24vueltasunday`
--
CREATE TABLE `ruta24vueltasunday` (
`idruta24vueltasunday` int(11) NOT NULL,
`mendoza` time DEFAULT NULL,
`lavalle` time DEFAULT NULL,
`costaDeAraujo` time DEFAULT NULL,
`gustavoAndre` time DEFAULT NULL,
`el15` time DEFAULT NULL,
`asuncion` time DEFAULT NULL,
`additional` text
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Volcado de datos para la tabla `ruta24vueltasunday`
--
INSERT INTO `ruta24vueltasunday` (`idruta24vueltasunday`, `mendoza`, `lavalle`, `costaDeAraujo`, `gustavoAndre`, `el15`, `asuncion`, `additional`) VALUES
(1, '06:20:00', '07:20:00', '07:40:00', '08:00:00', '08:05:00', NULL, NULL),
(2, '07:40:00', '08:40:00', '09:00:00', NULL, NULL, NULL, NULL),
(3, '08:50:00', '09:50:00', '10:10:00', '10:30:00', NULL, NULL, NULL),
(4, '09:40:00', '10:40:00', '11:00:00', '11:20:00', NULL, NULL, NULL),
(5, '10:50:00', '11:50:00', '12:10:00', NULL, NULL, NULL, NULL),
(6, '11:50:00', '12:50:00', '13:10:00', '13:30:00', NULL, NULL, NULL),
(7, '12:50:00', '13:50:00', '14:10:00', NULL, NULL, NULL, NULL),
(8, '14:00:00', '15:00:00', '15:20:00', '15:40:00', NULL, NULL, NULL),
(9, '15:10:00', '16:10:00', '16:30:00', '16:50:00', '16:55:00', '17:05:00', NULL),
(10, '16:20:00', '17:20:00', '17:40:00', NULL, NULL, NULL, NULL),
(11, '17:20:00', '18:20:00', '18:40:00', '19:00:00', '19:05:00', NULL, NULL),
(12, '18:30:00', '19:30:00', '19:50:00', NULL, NULL, NULL, NULL),
(13, '19:30:00', '20:30:00', '20:50:00', '21:10:00', NULL, NULL, NULL),
(14, '20:30:00', '21:30:00', '21:50:00', NULL, NULL, NULL, NULL),
(15, '21:30:00', '22:30:00', '22:43:00', NULL, NULL, NULL, NULL),
(16, '22:30:00', '23:30:00', '23:50:00', NULL, NULL, NULL, NULL);
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `ruta24vueltaweek`
--
CREATE TABLE `ruta24vueltaweek` (
`idruta24vueltaweek` int(11) NOT NULL,
`mendoza` time DEFAULT NULL,
`lavalle` time DEFAULT NULL,
`costaDeAraujo` time DEFAULT NULL,
`gustavoAndre` time DEFAULT NULL,
`el15` time DEFAULT NULL,
`asuncion` time DEFAULT NULL,
`additional` text
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Volcado de datos para la tabla `ruta24vueltaweek`
--
INSERT INTO `ruta24vueltaweek` (`idruta24vueltaweek`, `mendoza`, `lavalle`, `costaDeAraujo`, `gustavoAndre`, `el15`, `asuncion`, `additional`) VALUES
(1, '05:50:00', '06:40:00', '07:00:00', '07:20:00', NULL, NULL, NULL),
(2, '06:50:00', '07:50:00', '08:10:00', '08:30:00', NULL, NULL, NULL),
(3, '07:50:00', '08:50:00', '09:10:00', '09:30:00', NULL, NULL, NULL),
(4, '08:50:00', '09:50:00', '10:10:00', NULL, NULL, NULL, NULL),
(5, '09:30:00', '10:40:00', '10:50:00', '11:10:00', NULL, NULL, NULL),
(6, '10:30:00', '11:30:00', '11:50:00', NULL, NULL, NULL, NULL),
(7, '11:20:00', '12:20:00', '12:40:00', '13:00:00', NULL, NULL, NULL),
(8, '12:00:00', '13:00:00', '13:20:00', NULL, NULL, NULL, NULL),
(9, '12:40:00', '13:40:00', '14:00:00', '14:20:00', NULL, NULL, NULL),
(10, '13:20:00', '14:20:00', '14:40:00', NULL, NULL, NULL, NULL),
(11, '14:10:00', '15:10:00', '15:30:00', '15:50:00', NULL, NULL, NULL),
(12, '15:00:00', '16:00:00', '16:20:00', '16:40:00', '16:45:00', '16:55:00', '<NAME>'),
(13, '15:50:00', '16:50:00', '17:10:00', NULL, NULL, NULL, NULL),
(14, '16:30:00', '17:30:00', '17:50:00', '18:10:00', NULL, NULL, NULL),
(15, '17:10:00', '18:10:00', '18:30:00', '18:50:00', NULL, NULL, NULL),
(16, '17:50:00', '18:50:00', '19:10:00', '19:30:00', NULL, NULL, NULL),
(17, '18:30:00', '19:30:00', '19:50:00', '20:10:00', '20:15:00', NULL, NULL),
(18, '19:40:00', '20:40:00', '21:00:00', NULL, NULL, NULL, NULL),
(19, '21:00:00', '21:50:00', '22:10:00', NULL, NULL, NULL, NULL),
(20, '22:30:00', '23:20:00', '23:40:00', NULL, NULL, NULL, NULL);
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `ruta40idasaturday`
--
CREATE TABLE `ruta40idasaturday` (
`idruta40idasaturday` int(11) NOT NULL,
`km56` time DEFAULT NULL,
`km47Esc` time DEFAULT NULL,
`jocoli` time DEFAULT NULL,
`oscarMendoza` time DEFAULT NULL,
`andacollo` time DEFAULT NULL,
`croco` time DEFAULT NULL,
`sguazini` time DEFAULT NULL,
`3DeMayo` time DEFAULT NULL,
`sanFrancisco` time DEFAULT NULL,
`calleItalia` time DEFAULT NULL,
`barrioLaColmena` time DEFAULT NULL,
`salvatierra` time DEFAULT NULL,
`paramillo` time DEFAULT NULL,
`lavalle` time DEFAULT NULL,
`verjel` time DEFAULT NULL,
`cruce` time DEFAULT NULL,
`pastal` time DEFAULT NULL,
`borbollon` time DEFAULT NULL,
`mendoza` time DEFAULT NULL,
`additional` text
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Volcado de datos para la tabla `ruta40idasaturday`
--
INSERT INTO `ruta40idasaturday` (`idruta40idasaturday`, `km56`, `km47Esc`, `jocoli`, `oscarMendoza`, `andacollo`, `croco`, `sguazini`, `3DeMayo`, `sanFrancisco`, `calleItalia`, `barrioLaColmena`, `salvatierra`, `paramillo`, `lavalle`, `verjel`, `cruce`, `pastal`, `borbollon`, `mendoza`, `additional`) VALUES
(1, NULL, NULL, '05:00:00', NULL, NULL, '05:10:00', '05:15:00', '05:25:00', NULL, NULL, NULL, '05:35:00', NULL, '05:45:00', NULL, '05:58:00', NULL, '06:15:00', '06:45:00', NULL),
(2, '06:40:00', '06:45:00', '06:50:00', NULL, '07:00:00', NULL, NULL, '07:10:00', NULL, NULL, NULL, '07:20:00', NULL, '07:30:00', NULL, '07:43:00', NULL, '08:00:00', '08:30:00', NULL),
(3, NULL, NULL, '08:05:00', NULL, NULL, '08:15:00', '08:20:00', '08:30:00', NULL, NULL, NULL, '08:40:00', NULL, '08:50:00', NULL, '09:03:00', NULL, '09:20:00', '09:50:00', NULL),
(4, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '08:30:00', '08:50:00', NULL, '09:00:00', NULL, '09:20:00', NULL, '09:30:00', '09:40:00', '10:00:00', '10:30:00', 'Por Pastal'),
(5, '10:10:00', '10:15:00', '10:20:00', NULL, '10:30:00', NULL, NULL, '10:40:00', NULL, NULL, NULL, '10:50:00', NULL, '11:00:00', NULL, '11:13:00', NULL, '11:30:00', '12:00:00', NULL),
(6, NULL, NULL, '11:15:00', NULL, NULL, '11:25:00', '11:30:00', '11:40:00', NULL, NULL, NULL, '11:50:00', NULL, '12:00:00', NULL, '12:10:00', '12:20:00', '12:40:00', '13:10:00', 'Por Pastal'),
(7, NULL, NULL, '12:20:00', NULL, '12:30:00', NULL, NULL, '12:40:00', NULL, NULL, NULL, '12:50:00', NULL, '13:00:00', NULL, '13:13:00', NULL, '13:30:00', '14:00:00', NULL),
(8, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '13:50:00', '14:10:00', NULL, '14:20:00', NULL, '14:30:00', NULL, '14:40:00', '14:50:00', '15:10:00', '15:40:00', 'Por Pastal'),
(9, NULL, NULL, NULL, NULL, NULL, NULL, '15:10:00', '15:20:00', NULL, NULL, NULL, '15:30:00', NULL, '15:40:00', NULL, '15:53:00', NULL, '16:10:00', '16:40:00', NULL),
(10, NULL, NULL, '16:05:00', NULL, NULL, '16:15:00', '16:20:00', '16:30:00', NULL, NULL, NULL, '16:40:00', NULL, '16:50:00', NULL, '17:00:00', '17:10:00', '17:30:00', '18:00:00', 'Por Pastal'),
(11, NULL, NULL, '17:20:00', NULL, '17:30:00', NULL, NULL, '17:40:00', NULL, NULL, NULL, '17:50:00', NULL, '18:00:00', NULL, '18:13:00', NULL, '18:30:00', '19:00:00', NULL),
(12, '18:25:00', '18:30:00', '18:35:00', NULL, NULL, '18:45:00', '18:50:00', '19:00:00', NULL, NULL, NULL, '19:10:00', NULL, '19:20:00', NULL, '19:33:00', NULL, '19:50:00', '20:20:00', NULL),
(13, NULL, NULL, '19:35:00', NULL, NULL, '19:45:00', '19:50:00', '20:00:00', NULL, NULL, NULL, '20:10:00', NULL, '20:20:00', NULL, '20:33:00', NULL, '20:50:00', '21:20:00', NULL),
(14, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '20:30:00', NULL, NULL, '20:40:00', NULL, '20:50:00', NULL, '21:00:00', '21:10:00', '21:30:00', '22:00:00', 'Por Pastal'),
(15, NULL, NULL, NULL, NULL, '00:00:00', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '22:00:00', NULL, '22:13:00', NULL, '22:30:00', '23:00:00', NULL),
(16, '21:40:00', '21:45:00', '21:50:00', NULL, NULL, '22:00:00', '22:05:00', '22:15:00', NULL, NULL, NULL, '22:25:00', NULL, '22:35:00', NULL, NULL, NULL, NULL, NULL, NULL);
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `ruta40idasunday`
--
CREATE TABLE `ruta40idasunday` (
`idruta40idasunday` int(11) NOT NULL,
`km56` time DEFAULT NULL,
`km47Esc` time DEFAULT NULL,
`jocoli` time DEFAULT NULL,
`oscarMendoza` time DEFAULT NULL,
`andacollo` time DEFAULT NULL,
`croco` time DEFAULT NULL,
`sguazini` time DEFAULT NULL,
`3DeMayo` time DEFAULT NULL,
`sanFrancisco` time DEFAULT NULL,
`calleItalia` time DEFAULT NULL,
`barrioLaColmena` time DEFAULT NULL,
`salvatierra` time DEFAULT NULL,
`paramillo` time DEFAULT NULL,
`lavalle` time DEFAULT NULL,
`verjel` time DEFAULT NULL,
`cruce` time DEFAULT NULL,
`pastal` time DEFAULT NULL,
`borbollon` time DEFAULT NULL,
`mendoza` time DEFAULT NULL,
`additional` text
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Volcado de datos para la tabla `ruta40idasunday`
--
INSERT INTO `ruta40idasunday` (`idruta40idasunday`, `km56`, `km47Esc`, `jocoli`, `oscarMendoza`, `andacollo`, `croco`, `sguazini`, `3DeMayo`, `sanFrancisco`, `calleItalia`, `barrioLaColmena`, `salvatierra`, `paramillo`, `lavalle`, `verjel`, `cruce`, `pastal`, `borbollon`, `mendoza`, `additional`) VALUES
(1, NULL, NULL, '05:00:00', NULL, NULL, '05:10:00', '05:15:00', '05:25:00', NULL, NULL, NULL, '05:35:00', NULL, '05:45:00', NULL, '05:58:00', NULL, '06:15:00', '06:45:00', NULL),
(2, '06:40:00', '06:45:00', '06:50:00', NULL, '07:00:00', NULL, NULL, '07:10:00', NULL, NULL, NULL, '07:20:00', NULL, '07:30:00', NULL, '07:43:00', NULL, '08:00:00', '08:30:00', NULL),
(3, NULL, NULL, '08:05:00', NULL, NULL, '08:15:00', '08:20:00', '08:30:00', NULL, NULL, NULL, '08:40:00', NULL, '08:50:00', NULL, '09:03:00', NULL, '09:20:00', '09:50:00', NULL),
(4, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '08:30:00', '08:50:00', NULL, '09:00:00', NULL, '09:20:00', NULL, '09:30:00', '09:40:00', '10:00:00', '10:30:00', 'Por Pastal'),
(5, '10:10:00', '10:15:00', '10:20:00', NULL, '10:30:00', NULL, NULL, '10:40:00', NULL, NULL, NULL, '10:50:00', NULL, '11:00:00', NULL, '11:13:00', NULL, '11:30:00', '12:00:00', NULL),
(6, NULL, NULL, '11:15:00', NULL, NULL, '11:25:00', '11:30:00', '11:40:00', NULL, NULL, NULL, '11:50:00', NULL, '12:00:00', NULL, '12:10:00', '12:20:00', '12:40:00', '13:10:00', 'Por Pastal'),
(7, NULL, NULL, '12:20:00', NULL, '12:30:00', NULL, NULL, '12:40:00', NULL, NULL, NULL, '12:50:00', NULL, '13:00:00', NULL, '13:13:00', NULL, '13:30:00', '14:00:00', NULL),
(8, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '13:50:00', '14:10:00', NULL, '14:20:00', NULL, '14:30:00', NULL, '14:40:00', '14:50:00', '15:10:00', '15:40:00', 'Por Pastal'),
(9, NULL, NULL, NULL, NULL, NULL, NULL, '15:10:00', '15:20:00', NULL, NULL, NULL, '15:30:00', NULL, '15:40:00', NULL, '15:53:00', NULL, '16:10:00', '16:40:00', NULL),
(10, NULL, NULL, '16:05:00', NULL, NULL, '16:15:00', '16:20:00', '16:30:00', NULL, NULL, NULL, '16:40:00', NULL, '16:50:00', NULL, '17:00:00', '17:10:00', '17:30:00', '18:00:00', 'Por Pastal'),
(11, NULL, NULL, '17:20:00', NULL, '17:30:00', NULL, NULL, '17:40:00', NULL, NULL, NULL, '17:50:00', NULL, '18:00:00', NULL, '18:13:00', NULL, '18:30:00', '19:00:00', NULL),
(12, '18:25:00', '18:30:00', '18:35:00', NULL, NULL, '18:45:00', '18:50:00', '19:00:00', NULL, NULL, NULL, '19:10:00', NULL, '19:20:00', NULL, '19:33:00', NULL, '19:50:00', '20:20:00', NULL),
(13, NULL, NULL, '19:35:00', NULL, NULL, '19:45:00', '19:50:00', '20:00:00', NULL, NULL, NULL, '20:10:00', NULL, '20:20:00', NULL, '20:33:00', NULL, '20:50:00', '21:20:00', NULL),
(14, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '20:30:00', NULL, NULL, '20:40:00', NULL, '20:50:00', NULL, '21:00:00', '21:10:00', '21:30:00', '22:00:00', 'Por Pastal'),
(15, NULL, NULL, NULL, NULL, '00:00:00', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '22:00:00', NULL, '22:13:00', NULL, '22:30:00', '23:00:00', NULL),
(16, '21:40:00', '21:45:00', '21:50:00', NULL, NULL, '22:00:00', '22:05:00', '22:15:00', NULL, NULL, NULL, '22:25:00', NULL, '22:35:00', NULL, NULL, NULL, NULL, NULL, NULL);
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `ruta40idaweek`
--
CREATE TABLE `ruta40idaweek` (
`idruta40idaweek` int(11) NOT NULL,
`km56` time DEFAULT NULL,
`km47Esc` time DEFAULT NULL,
`jocoli` time DEFAULT NULL,
`oscarMendoza` time DEFAULT NULL,
`andacollo` time DEFAULT NULL,
`croco` time DEFAULT NULL,
`sguazini` time DEFAULT NULL,
`3DeMayo` time DEFAULT NULL,
`sanFrancisco` time DEFAULT NULL,
`calleItalia` time DEFAULT NULL,
`barrioLaColmena` time DEFAULT NULL,
`salvatierra` time DEFAULT NULL,
`paramillo` time DEFAULT NULL,
`lavalle` time DEFAULT NULL,
`verjel` time DEFAULT NULL,
`cruce` time DEFAULT NULL,
`pastal` time DEFAULT NULL,
`borbollon` time DEFAULT NULL,
`mendoza` time DEFAULT NULL,
`additional` text
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Volcado de datos para la tabla `ruta40idaweek`
--
INSERT INTO `ruta40idaweek` (`idruta40idaweek`, `km56`, `km47Esc`, `jocoli`, `oscarMendoza`, `andacollo`, `croco`, `sguazini`, `3DeMayo`, `sanFrancisco`, `calleItalia`, `barrioLaColmena`, `salvatierra`, `paramillo`, `lavalle`, `verjel`, `cruce`, `pastal`, `borbollon`, `mendoza`, `additional`) VALUES
(1, NULL, NULL, '05:00:00', NULL, NULL, '05:10:00', '05:15:00', '05:25:00', NULL, NULL, NULL, '05:35:00', NULL, '05:45:00', NULL, '05:58:00', NULL, '06:15:00', '06:45:00', NULL),
(2, NULL, NULL, '05:45:00', NULL, NULL, '05:55:00', '06:00:00', '06:10:00', NULL, NULL, NULL, '06:20:00', NULL, '06:30:00', NULL, '06:43:00', NULL, '07:00:00', '07:30:00', NULL),
(3, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '06:40:00', NULL, NULL, NULL, '06:50:00', NULL, '07:00:00', NULL, '07:10:00', '07:20:00', '07:40:00', '08:10:00', 'Por Pastal'),
(4, '06:40:00', '06:45:00', '06:50:00', NULL, '07:00:00', NULL, NULL, '07:10:00', NULL, NULL, NULL, '07:20:00', NULL, '07:30:00', NULL, '07:43:00', NULL, '08:00:00', '08:30:00', NULL),
(5, NULL, NULL, '07:45:00', NULL, NULL, '07:55:00', '08:00:00', '08:10:00', NULL, NULL, NULL, '08:20:00', NULL, '08:30:00', NULL, '08:43:00', NULL, '09:00:00', '09:30:00', NULL),
(6, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '08:10:00', '08:30:00', NULL, '08:40:00', NULL, '08:50:00', NULL, '09:00:00', '09:10:00', '09:30:00', '10:00:00', 'Por Pastal'),
(7, NULL, NULL, '08:35:00', NULL, NULL, '08:45:00', '08:50:00', '09:00:00', NULL, NULL, NULL, '09:10:00', NULL, '09:20:00', NULL, '09:33:00', NULL, '09:50:00', '10:20:00', NULL),
(8, NULL, NULL, '09:25:00', NULL, NULL, '09:35:00', '09:40:00', '09:50:00', NULL, NULL, NULL, '10:00:00', NULL, '10:10:00', NULL, '10:23:00', NULL, '10:40:00', '11:10:00', NULL),
(9, '10:10:00', '10:15:00', '10:20:00', NULL, '10:30:00', NULL, NULL, '10:40:00', NULL, NULL, NULL, '10:50:00', NULL, '11:00:00', NULL, '11:10:00', '11:20:00', '11:40:00', '12:10:00', 'Por Pastal'),
(10, NULL, NULL, '11:05:00', NULL, NULL, '11:15:00', '11:20:00', '11:30:00', NULL, NULL, NULL, '11:40:00', NULL, '11:50:00', NULL, '12:03:00', NULL, '12:20:00', '12:50:00', NULL),
(11, NULL, NULL, '11:55:00', NULL, NULL, '12:05:00', '12:10:00', '12:20:00', NULL, NULL, NULL, '12:30:00', NULL, '12:40:00', NULL, '12:53:00', NULL, '13:10:00', '13:40:00', NULL),
(12, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '12:50:00', '13:10:00', NULL, '13:20:00', NULL, '13:30:00', NULL, '13:40:00', '13:50:00', '14:10:00', '14:40:00', 'Por Pastal'),
(13, NULL, NULL, '13:40:00', NULL, '13:50:00', NULL, NULL, '14:00:00', NULL, NULL, NULL, '14:10:00', NULL, '14:20:00', NULL, '14:33:00', NULL, '14:50:00', '15:20:00', NULL),
(14, NULL, NULL, '14:25:00', NULL, NULL, '14:35:00', '14:40:00', '14:50:00', NULL, NULL, NULL, NULL, NULL, '15:10:00', NULL, '15:23:00', NULL, '15:40:00', '16:10:00', NULL),
(15, NULL, NULL, '15:25:00', NULL, NULL, '15:35:00', '15:40:00', '15:50:00', NULL, NULL, NULL, '16:00:00', NULL, '16:10:00', NULL, '16:23:00', NULL, '16:40:00', '17:10:00', NULL),
(16, NULL, NULL, '16:30:00', NULL, '16:40:00', NULL, NULL, '16:50:00', NULL, NULL, NULL, '17:00:00', NULL, '17:10:00', NULL, '17:20:00', '17:30:00', '17:50:00', '18:20:00', 'Por Pastal'),
(17, NULL, NULL, '17:35:00', NULL, NULL, '17:45:00', '17:50:00', '18:00:00', NULL, NULL, NULL, '18:10:00', NULL, '18:20:00', NULL, '18:33:00', NULL, '18:50:00', '19:20:00', NULL),
(18, '18:50:00', '18:55:00', '19:00:00', NULL, '19:10:00', NULL, NULL, '19:20:00', NULL, NULL, NULL, '19:30:00', NULL, '19:40:00', NULL, '19:53:00', NULL, '20:10:00', '20:40:00', NULL),
(19, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '20:30:00', NULL, NULL, '20:40:00', NULL, '20:50:00', NULL, '21:00:00', '21:10:00', '21:30:00', '22:00:00', 'Por Pastal'),
(20, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '21:53:00', NULL, '22:10:00', '22:40:00', NULL),
(21, NULL, NULL, '21:20:00', NULL, NULL, NULL, '21:35:00', '21:45:00', NULL, NULL, NULL, '21:55:00', NULL, '22:05:00', NULL, NULL, NULL, NULL, NULL, NULL);
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `ruta40vueltasaturday`
--
CREATE TABLE `ruta40vueltasaturday` (
`idruta40vueltasaturday` int(11) NOT NULL,
`mendoza` time DEFAULT NULL,
`borbollon` time DEFAULT NULL,
`pastal` time DEFAULT NULL,
`cruce` time DEFAULT NULL,
`lavalle` time DEFAULT NULL,
`paramillo` time DEFAULT NULL,
`verjel` time DEFAULT NULL,
`salvatierra` time DEFAULT NULL,
`barrioLaColmena` time DEFAULT NULL,
`calleItalia` time DEFAULT NULL,
`sanFrancisco` time DEFAULT NULL,
`3DeMayo` time DEFAULT NULL,
`sguazini` time DEFAULT NULL,
`croco` time DEFAULT NULL,
`andacollo` time DEFAULT NULL,
`oscarMendoza` time DEFAULT NULL,
`jocoli` time DEFAULT NULL,
`km47Esc` time DEFAULT NULL,
`km56` time DEFAULT NULL,
`additional` text
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Volcado de datos para la tabla `ruta40vueltasaturday`
--
INSERT INTO `ruta40vueltasaturday` (`idruta40vueltasaturday`, `mendoza`, `borbollon`, `pastal`, `cruce`, `lavalle`, `paramillo`, `verjel`, `salvatierra`, `barrioLaColmena`, `calleItalia`, `sanFrancisco`, `3DeMayo`, `sguazini`, `croco`, `andacollo`, `oscarMendoza`, `jocoli`, `km47Esc`, `km56`, `additional`) VALUES
(1, '06:30:00', '07:00:00', NULL, '07:17:00', '07:30:00', NULL, NULL, '07:40:00', NULL, '07:50:00', '08:10:00', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(2, '08:00:00', '08:30:00', '08:50:00', '09:00:00', '09:10:00', NULL, NULL, '09:20:00', NULL, NULL, NULL, '09:30:00', '09:40:00', '09:45:00', NULL, NULL, '09:55:00', '10:00:00', '10:05:00', 'Por Pastal'),
(3, '09:30:00', '10:00:00', NULL, '10:17:00', '10:30:00', NULL, NULL, '10:40:00', NULL, NULL, NULL, '10:50:00', NULL, NULL, '11:00:00', NULL, '11:10:00', NULL, NULL, NULL),
(4, '10:40:00', '11:10:00', NULL, '11:27:00', '11:40:00', NULL, NULL, '11:50:00', NULL, NULL, NULL, '12:00:00', NULL, NULL, '12:10:00', NULL, '12:20:00', NULL, NULL, NULL),
(5, '11:50:00', '12:20:00', '12:40:00', '12:50:00', '13:00:00', NULL, NULL, '13:10:00', NULL, '13:20:00', '13:40:00', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'Por Pastal'),
(6, '13:00:00', '13:30:00', NULL, '13:47:00', '14:00:00', NULL, NULL, '14:10:00', NULL, NULL, NULL, '14:20:00', '14:30:00', NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(7, '14:10:00', '14:40:00', NULL, '14:57:00', '15:10:00', NULL, NULL, '15:20:00', NULL, NULL, NULL, '15:30:00', '15:40:00', '15:45:00', NULL, NULL, '15:55:00', NULL, NULL, NULL),
(8, '15:20:00', '15:50:00', NULL, '16:07:00', '16:20:00', NULL, NULL, '16:30:00', NULL, NULL, NULL, '16:40:00', NULL, NULL, '16:50:00', NULL, '17:00:00', NULL, NULL, NULL),
(9, '16:30:00', '17:00:00', NULL, '17:17:00', '17:30:00', NULL, NULL, '17:40:00', NULL, NULL, NULL, '17:50:00', '18:00:00', '18:05:00', NULL, NULL, '18:15:00', '18:20:00', '18:25:00', NULL),
(10, '17:40:00', '18:10:00', '18:30:00', '18:40:00', '18:50:00', NULL, NULL, '19:00:00', NULL, NULL, NULL, '19:10:00', '19:20:00', '19:25:00', NULL, NULL, '19:35:00', NULL, NULL, 'Por Pastal'),
(11, '18:50:00', '19:20:00', NULL, '19:37:00', '19:50:00', NULL, NULL, '20:00:00', NULL, '20:10:00', '20:30:00', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(12, '19:50:00', '20:20:00', NULL, '20:37:00', '20:50:00', NULL, NULL, '21:00:00', NULL, NULL, NULL, '21:10:00', NULL, NULL, '21:20:00', NULL, '21:30:00', '21:35:00', '21:40:00', NULL),
(13, '20:50:00', '21:20:00', NULL, '21:37:00', '21:50:00', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(14, '21:50:00', '22:20:00', '22:40:00', '22:50:00', '23:00:00', NULL, NULL, '23:10:00', NULL, NULL, NULL, '23:20:00', '23:30:00', '23:35:00', NULL, NULL, '23:45:00', NULL, NULL, 'Por Pastal'),
(15, '22:50:00', '23:20:00', NULL, '23:37:00', '23:50:00', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `ruta40vueltasunday`
--
CREATE TABLE `ruta40vueltasunday` (
`idruta40vueltasunday` int(11) NOT NULL,
`mendoza` time DEFAULT NULL,
`borbollon` time DEFAULT NULL,
`pastal` time DEFAULT NULL,
`cruce` time DEFAULT NULL,
`lavalle` time DEFAULT NULL,
`paramillo` time DEFAULT NULL,
`verjel` time DEFAULT NULL,
`salvatierra` time DEFAULT NULL,
`barrioLaColmena` time DEFAULT NULL,
`calleItalia` time DEFAULT NULL,
`sanFrancisco` time DEFAULT NULL,
`3DeMayo` time DEFAULT NULL,
`sguazini` time DEFAULT NULL,
`croco` time DEFAULT NULL,
`andacollo` time DEFAULT NULL,
`oscarMendoza` time DEFAULT NULL,
`jocoli` time DEFAULT NULL,
`km47Esc` time DEFAULT NULL,
`km56` time DEFAULT NULL,
`additional` text
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Volcado de datos para la tabla `ruta40vueltasunday`
--
INSERT INTO `ruta40vueltasunday` (`idruta40vueltasunday`, `mendoza`, `borbollon`, `pastal`, `cruce`, `lavalle`, `paramillo`, `verjel`, `salvatierra`, `barrioLaColmena`, `calleItalia`, `sanFrancisco`, `3DeMayo`, `sguazini`, `croco`, `andacollo`, `oscarMendoza`, `jocoli`, `km47Esc`, `km56`, `additional`) VALUES
(1, '06:30:00', '07:00:00', NULL, '07:17:00', '07:30:00', NULL, NULL, '07:40:00', NULL, '07:50:00', '08:10:00', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, ''),
(2, '08:00:00', '08:30:00', '08:50:00', '09:00:00', '09:10:00', NULL, NULL, '09:20:00', NULL, NULL, NULL, '09:30:00', '09:40:00', '09:45:00', NULL, NULL, '09:55:00', '10:00:00', '10:05:00', 'Por Pastal'),
(3, '09:30:00', '10:00:00', NULL, '10:17:00', '10:30:00', NULL, NULL, '10:40:00', NULL, NULL, NULL, '10:50:00', NULL, NULL, '11:00:00', NULL, '11:10:00', NULL, NULL, ''),
(4, '10:40:00', '11:10:00', NULL, '11:27:00', '11:40:00', NULL, NULL, '11:50:00', NULL, NULL, NULL, '12:00:00', NULL, NULL, '12:10:00', NULL, '12:20:00', NULL, NULL, ''),
(5, '11:50:00', '12:20:00', '12:40:00', '12:50:00', '13:00:00', NULL, NULL, '13:10:00', NULL, '13:20:00', '13:40:00', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'Por Pastal'),
(6, '13:00:00', '13:30:00', NULL, '13:47:00', '14:00:00', NULL, NULL, '14:10:00', NULL, NULL, NULL, '14:20:00', '14:30:00', NULL, NULL, NULL, NULL, NULL, NULL, ''),
(7, '14:10:00', '14:40:00', NULL, '14:57:00', '15:10:00', NULL, NULL, '15:20:00', NULL, NULL, NULL, '15:30:00', '15:40:00', '15:45:00', NULL, NULL, '15:55:00', NULL, NULL, ''),
(8, '15:20:00', '15:50:00', NULL, '16:07:00', '16:20:00', NULL, NULL, '16:30:00', NULL, NULL, NULL, '16:40:00', NULL, NULL, '16:50:00', NULL, '17:00:00', NULL, NULL, ''),
(9, '16:30:00', '17:00:00', NULL, '17:17:00', '17:30:00', NULL, NULL, '17:40:00', NULL, NULL, NULL, '17:50:00', '18:00:00', '18:05:00', NULL, NULL, '18:15:00', '18:20:00', '18:25:00', ''),
(10, '17:40:00', '18:10:00', '18:30:00', '18:40:00', '18:50:00', NULL, NULL, '19:00:00', NULL, NULL, NULL, '19:10:00', '19:20:00', '19:25:00', NULL, NULL, '19:35:00', NULL, NULL, 'Por Pastal'),
(11, '18:50:00', '19:20:00', NULL, '19:37:00', '19:50:00', NULL, NULL, '20:00:00', NULL, '20:10:00', '20:30:00', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, ''),
(12, '19:50:00', '20:20:00', NULL, '20:37:00', '20:50:00', NULL, NULL, '21:00:00', NULL, NULL, NULL, '21:10:00', NULL, NULL, '21:20:00', NULL, '21:30:00', '21:35:00', '21:40:00', ''),
(13, '20:50:00', '21:20:00', NULL, '21:37:00', '21:50:00', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, ''),
(14, '21:50:00', '22:20:00', '22:40:00', '22:50:00', '23:00:00', NULL, NULL, '23:10:00', NULL, NULL, NULL, '23:20:00', '23:30:00', '23:35:00', NULL, NULL, '23:45:00', NULL, NULL, 'Por Pastal'),
(15, '22:50:00', '23:20:00', NULL, '23:37:00', '23:50:00', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `ruta40vueltaweek`
--
CREATE TABLE `ruta40vueltaweek` (
`idruta40vueltaweek` int(11) NOT NULL,
`mendoza` time DEFAULT NULL,
`borbollon` time DEFAULT NULL,
`pastal` time DEFAULT NULL,
`cruce` time DEFAULT NULL,
`lavalle` time DEFAULT NULL,
`paramillo` time DEFAULT NULL,
`verjel` time DEFAULT NULL,
`salvatierra` time DEFAULT NULL,
`barrioLaColmena` time DEFAULT NULL,
`calleItalia` time DEFAULT NULL,
`sanFrancisco` time DEFAULT NULL,
`3DeMayo` time DEFAULT NULL,
`sguazini` time DEFAULT NULL,
`croco` time DEFAULT NULL,
`andacollo` time DEFAULT NULL,
`oscarMendoza` time DEFAULT NULL,
`jocoli` time DEFAULT NULL,
`km47Esc` time DEFAULT NULL,
`km56` time DEFAULT NULL,
`additional` text
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Volcado de datos para la tabla `ruta40vueltaweek`
--
INSERT INTO `ruta40vueltaweek` (`idruta40vueltaweek`, `mendoza`, `borbollon`, `pastal`, `cruce`, `lavalle`, `paramillo`, `verjel`, `salvatierra`, `barrioLaColmena`, `calleItalia`, `sanFrancisco`, `3DeMayo`, `sguazini`, `croco`, `andacollo`, `oscarMendoza`, `jocoli`, `km47Esc`, `km56`, `additional`) VALUES
(1, '06:20:00', '06:50:00', NULL, '07:07:00', '07:20:00', NULL, NULL, '07:30:00', NULL, NULL, '07:50:00', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(2, '07:10:00', '07:40:00', '08:00:00', '08:10:00', '08:20:00', NULL, NULL, '08:30:00', NULL, NULL, NULL, '08:40:00', '08:50:00', '08:55:00', NULL, NULL, '09:05:00', NULL, NULL, 'Por Pastal'),
(3, '08:10:00', '08:40:00', NULL, '08:57:00', '09:10:00', NULL, NULL, '09:20:00', NULL, NULL, NULL, '09:30:00', NULL, NULL, '09:40:00', NULL, '09:50:00', '09:55:00', '10:00:00', NULL),
(4, '09:10:00', '09:40:00', NULL, '09:57:00', '10:10:00', NULL, NULL, '10:20:00', NULL, NULL, NULL, '10:30:00', '10:40:00', '10:45:00', NULL, NULL, '10:55:00', NULL, NULL, NULL),
(5, '10:10:00', '10:40:00', NULL, '10:57:00', '11:10:00', NULL, NULL, '11:20:00', NULL, NULL, NULL, '11:30:00', NULL, NULL, '11:40:00', NULL, '11:50:00', NULL, NULL, NULL),
(6, '11:00:00', '11:30:00', '11:50:00', '12:00:00', '12:10:00', NULL, NULL, '12:20:00', NULL, '12:30:00', '12:50:00', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'Por Pastal'),
(7, '11:50:00', '12:20:00', NULL, '12:37:00', '12:50:00', NULL, NULL, '13:00:00', NULL, NULL, NULL, '13:10:00', '13:20:00', '13:25:00', NULL, NULL, '13:35:00', NULL, NULL, NULL),
(8, '12:30:00', '13:00:00', NULL, '13:17:00', '13:30:00', NULL, NULL, '13:40:00', NULL, NULL, NULL, '13:50:00', NULL, NULL, '14:00:00', NULL, '14:10:00', NULL, NULL, NULL),
(9, '13:00:00', '13:30:00', '13:50:00', '14:00:00', '14:10:00', NULL, NULL, '14:20:00', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'Por Pastal'),
(10, '13:30:00', '14:00:00', NULL, '14:17:00', '14:30:00', NULL, NULL, '14:40:00', NULL, NULL, NULL, '14:50:00', '15:00:00', '15:05:00', NULL, NULL, '15:15:00', NULL, NULL, NULL),
(11, '14:00:00', '14:30:00', NULL, '14:43:00', '15:00:00', NULL, NULL, '15:10:00', NULL, NULL, NULL, '15:20:00', NULL, NULL, '15:30:00', NULL, '15:40:00', NULL, NULL, NULL),
(12, '14:50:00', '15:20:00', '15:40:00', '15:50:00', '16:00:00', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'Por Pastal'),
(13, '15:40:00', '16:10:00', NULL, '16:27:00', '16:40:00', NULL, NULL, '16:50:00', NULL, NULL, NULL, '17:00:00', '17:10:00', '17:15:00', NULL, NULL, '17:25:00', NULL, NULL, NULL),
(14, '16:30:00', '17:00:00', NULL, '17:17:00', '17:30:00', NULL, NULL, '17:40:00', NULL, NULL, NULL, '17:50:00', NULL, NULL, '18:00:00', NULL, '18:10:00', '18:15:00', '18:20:00', NULL),
(15, '17:20:00', '17:50:00', '18:10:00', '18:20:00', '18:30:00', NULL, NULL, '18:40:00', NULL, NULL, NULL, '18:50:00', '19:00:00', '19:05:00', NULL, NULL, '19:15:00', NULL, NULL, 'Por Pastal'),
(16, '18:10:00', '18:40:00', NULL, '18:57:00', '19:10:00', NULL, NULL, '19:20:00', NULL, '19:30:00', '19:50:00', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(17, '19:00:00', '19:30:00', NULL, '19:47:00', '20:00:00', NULL, NULL, '20:10:00', NULL, NULL, NULL, '20:20:00', '20:30:00', '20:35:00', NULL, NULL, '20:45:00', NULL, NULL, NULL),
(18, '20:10:00', '20:40:00', NULL, '20:57:00', '21:10:00', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(19, '21:20:00', '21:50:00', '22:10:00', '22:20:00', '22:30:00', NULL, NULL, '22:40:00', NULL, NULL, NULL, '22:50:00', NULL, NULL, '23:00:00', NULL, '23:10:00', NULL, NULL, 'Por Pastal'),
(20, '22:30:00', '23:00:00', NULL, '23:15:00', '23:25:00', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `taxi`
--
CREATE TABLE `taxi` (
`idTaxi` int(11) NOT NULL,
`name` varchar(45) DEFAULT NULL,
`taxiNumber` varchar(45) DEFAULT NULL,
`domain` varchar(45) DEFAULT NULL,
`phone` varchar(45) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `user`
--
CREATE TABLE `user` (
`iduser` int(11) NOT NULL,
`user` varchar(45) DEFAULT NULL,
`password` varchar(45) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Volcado de datos para la tabla `user`
--
INSERT INTO `user` (`iduser`, `user`, `password`) VALUES
(4, 'admin', '<PASSWORD>');
--
-- Índices para tablas volcadas
--
--
-- Indices de la tabla `californiaidasaturday`
--
ALTER TABLE `californiaidasaturday`
ADD PRIMARY KEY (`idcaliforniaidaweek`);
--
-- Indices de la tabla `californiaidasunday`
--
ALTER TABLE `californiaidasunday`
ADD PRIMARY KEY (`idcaliforniaidaweek`);
--
-- Indices de la tabla `californiaidaweek`
--
ALTER TABLE `californiaidaweek`
ADD PRIMARY KEY (`idcaliforniaidaweek`);
--
-- Indices de la tabla `californiavueltasaturday`
--
ALTER TABLE `californiavueltasaturday`
ADD PRIMARY KEY (`idcaliforniavueltasaturday`);
--
-- Indices de la tabla `californiavueltasunday`
--
ALTER TABLE `californiavueltasunday`
ADD PRIMARY KEY (`idcaliforniavueltasaturday`);
--
-- Indices de la tabla `californiavueltaweek`
--
ALTER TABLE `californiavueltaweek`
ADD PRIMARY KEY (`idcaliforniavueltaweek`);
--
-- Indices de la tabla `internocostaidasaturday`
--
ALTER TABLE `internocostaidasaturday`
ADD PRIMARY KEY (`idinternocostaidasaturday`);
--
-- Indices de la tabla `internocostaidasunday`
--
ALTER TABLE `internocostaidasunday`
ADD PRIMARY KEY (`idinternocostaidasunday`);
--
-- Indices de la tabla `internocostaidaweek`
--
ALTER TABLE `internocostaidaweek`
ADD PRIMARY KEY (`idinternocostaidaweek`);
--
-- Indices de la tabla `internocostavueltasaturday`
--
ALTER TABLE `internocostavueltasaturday`
ADD PRIMARY KEY (`idinternocostavueltasaturday`);
--
-- Indices de la tabla `internocostavueltasunday`
--
ALTER TABLE `internocostavueltasunday`
ADD PRIMARY KEY (`idinternocostavueltasunday`);
--
-- Indices de la tabla `internocostavueltaweek`
--
ALTER TABLE `internocostavueltaweek`
ADD PRIMARY KEY (`idinternocostavueltaweek`);
--
-- Indices de la tabla `internolavalleidasaturday`
--
ALTER TABLE `internolavalleidasaturday`
ADD PRIMARY KEY (`idinternolavalleidasaturday`);
--
-- Indices de la tabla `internolavalleidasunday`
--
ALTER TABLE `internolavalleidasunday`
ADD PRIMARY KEY (`idinternolavalleidasunday`);
--
-- Indices de la tabla `internolavalleidaweek`
--
ALTER TABLE `internolavalleidaweek`
ADD PRIMARY KEY (`idinternolavalleidaweek`);
--
-- Indices de la tabla `internolavallevueltasaturday`
--
ALTER TABLE `internolavallevueltasaturday`
ADD PRIMARY KEY (`idinternolavallevueltasaturday`);
--
-- Indices de la tabla `internolavallevueltasunday`
--
ALTER TABLE `internolavallevueltasunday`
ADD PRIMARY KEY (`idinternolavallevueltasunday`);
--
-- Indices de la tabla `internolavallevueltaweek`
--
ALTER TABLE `internolavallevueltaweek`
ADD PRIMARY KEY (`idinternolavallevueltaweek`);
--
-- Indices de la tabla `ruta24idasaturday`
--
ALTER TABLE `ruta24idasaturday`
ADD PRIMARY KEY (`idruta24idasaturday`);
--
-- Indices de la tabla `ruta24idasunday`
--
ALTER TABLE `ruta24idasunday`
ADD PRIMARY KEY (`idruta24idasunday`);
--
-- Indices de la tabla `ruta24idaweek`
--
ALTER TABLE `ruta24idaweek`
ADD PRIMARY KEY (`idruta24idaweek`);
--
-- Indices de la tabla `ruta24vueltasaturday`
--
ALTER TABLE `ruta24vueltasaturday`
ADD PRIMARY KEY (`idruta24vueltasaturday`);
--
-- Indices de la tabla `ruta24vueltasunday`
--
ALTER TABLE `ruta24vueltasunday`
ADD PRIMARY KEY (`idruta24vueltasunday`);
--
-- Indices de la tabla `ruta24vueltaweek`
--
ALTER TABLE `ruta24vueltaweek`
ADD PRIMARY KEY (`idruta24vueltaweek`);
--
-- Indices de la tabla `ruta40idasaturday`
--
ALTER TABLE `ruta40idasaturday`
ADD PRIMARY KEY (`idruta40idasaturday`);
--
-- Indices de la tabla `ruta40idasunday`
--
ALTER TABLE `ruta40idasunday`
ADD PRIMARY KEY (`idruta40idasunday`);
--
-- Indices de la tabla `ruta40idaweek`
--
ALTER TABLE `ruta40idaweek`
ADD PRIMARY KEY (`idruta40idaweek`);
--
-- Indices de la tabla `ruta40vueltasaturday`
--
ALTER TABLE `ruta40vueltasaturday`
ADD PRIMARY KEY (`idruta40vueltasaturday`);
--
-- Indices de la tabla `ruta40vueltasunday`
--
ALTER TABLE `ruta40vueltasunday`
ADD PRIMARY KEY (`idruta40vueltasunday`);
--
-- Indices de la tabla `ruta40vueltaweek`
--
ALTER TABLE `ruta40vueltaweek`
ADD PRIMARY KEY (`idruta40vueltaweek`);
--
-- Indices de la tabla `taxi`
--
ALTER TABLE `taxi`
ADD PRIMARY KEY (`idTaxi`);
--
-- Indices de la tabla `user`
--
ALTER TABLE `user`
ADD PRIMARY KEY (`iduser`);
--
-- AUTO_INCREMENT de las tablas volcadas
--
--
-- AUTO_INCREMENT de la tabla `californiaidasaturday`
--
ALTER TABLE `californiaidasaturday`
MODIFY `idcaliforniaidaweek` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
--
-- AUTO_INCREMENT de la tabla `californiaidasunday`
--
ALTER TABLE `californiaidasunday`
MODIFY `idcaliforniaidaweek` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
--
-- AUTO_INCREMENT de la tabla `californiaidaweek`
--
ALTER TABLE `californiaidaweek`
MODIFY `idcaliforniaidaweek` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
--
-- AUTO_INCREMENT de la tabla `californiavueltasaturday`
--
ALTER TABLE `californiavueltasaturday`
MODIFY `idcaliforniavueltasaturday` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
--
-- AUTO_INCREMENT de la tabla `californiavueltasunday`
--
ALTER TABLE `californiavueltasunday`
MODIFY `idcaliforniavueltasaturday` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
--
-- AUTO_INCREMENT de la tabla `californiavueltaweek`
--
ALTER TABLE `californiavueltaweek`
MODIFY `idcaliforniavueltaweek` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
--
-- AUTO_INCREMENT de la tabla `internocostaidasaturday`
--
ALTER TABLE `internocostaidasaturday`
MODIFY `idinternocostaidasaturday` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8;
--
-- AUTO_INCREMENT de la tabla `internocostaidasunday`
--
ALTER TABLE `internocostaidasunday`
MODIFY `idinternocostaidasunday` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7;
--
-- AUTO_INCREMENT de la tabla `internocostaidaweek`
--
ALTER TABLE `internocostaidaweek`
MODIFY `idinternocostaidaweek` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=14;
--
-- AUTO_INCREMENT de la tabla `internocostavueltasaturday`
--
ALTER TABLE `internocostavueltasaturday`
MODIFY `idinternocostavueltasaturday` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=9;
--
-- AUTO_INCREMENT de la tabla `internocostavueltasunday`
--
ALTER TABLE `internocostavueltasunday`
MODIFY `idinternocostavueltasunday` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8;
--
-- AUTO_INCREMENT de la tabla `internocostavueltaweek`
--
ALTER TABLE `internocostavueltaweek`
MODIFY `idinternocostavueltaweek` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=13;
--
-- AUTO_INCREMENT de la tabla `internolavalleidasaturday`
--
ALTER TABLE `internolavalleidasaturday`
MODIFY `idinternolavalleidasaturday` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT de la tabla `internolavalleidasunday`
--
ALTER TABLE `internolavalleidasunday`
MODIFY `idinternolavalleidasunday` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT de la tabla `internolavalleidaweek`
--
ALTER TABLE `internolavalleidaweek`
MODIFY `idinternolavalleidaweek` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT de la tabla `internolavallevueltasaturday`
--
ALTER TABLE `internolavallevueltasaturday`
MODIFY `idinternolavallevueltasaturday` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT de la tabla `internolavallevueltasunday`
--
ALTER TABLE `internolavallevueltasunday`
MODIFY `idinternolavallevueltasunday` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT de la tabla `internolavallevueltaweek`
--
ALTER TABLE `internolavallevueltaweek`
MODIFY `idinternolavallevueltaweek` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT de la tabla `taxi`
--
ALTER TABLE `taxi`
MODIFY `idTaxi` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=9;
--
-- AUTO_INCREMENT de la tabla `user`
--
ALTER TABLE `user`
MODIFY `iduser` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
INSERT INTO EG_ROLEACTION VALUES ((select id from eg_role where name='Advertisement Tax Creator'),(select id from eg_action where name='Agency Wise DCB Report'));
INSERT INTO EG_ROLEACTION VALUES ((select id from eg_role where name='Advertisement Tax Approver'),(select id from eg_action where name='Agency Wise DCB Report'));
INSERT INTO EG_ROLEACTION VALUES ((select id from eg_role where name='Advertisement Tax Admin'),(select id from eg_action where name='Agency Wise DCB Report'));
INSERT INTO EG_ROLEACTION VALUES ((select id from eg_role where name='Collection Operator'),(select id from eg_action where name='Agency Wise DCB Report'));
update egadtax_rates_class set version=0 where version is null; |
alter table device_queue
drop column dev_addr; |
<filename>sql/00-SetupRLS.sql<gh_stars>1-10
if (user_id('MiddleTierUser') is null) begin
create user MiddleTierUser with password = '<PASSWORD>';
alter role db_owner add member MiddleTierUser;
end
go
drop security policy if exists rls.SensitiveDataPolicy;
drop function if exists rls.fn_SecurityPredicate;
drop table if exists rls.SensitiveDataPermissions;
drop table if exists dbo.EvenMoreSensitiveData;
drop table if exists dbo.SensitiveData;
drop procedure if exists web.get_sensitivedata
drop procedure if exists web.get_evenmoresensitivedata
go
drop schema if exists web;
go
create schema web;
go
drop schema if exists rls;
go
create schema rls;
go
create table dbo.SensitiveData
(
Id int not null constraint pk__SensitiveData primary key,
FirstName nvarchar(100) not null,
LastName nvarchar(100) not null,
ReallyImportantData nvarchar(max) not null check (isjson(ReallyImportantData)=1)
)
go
create table dbo.EvenMoreSensitiveData
(
Id int not null constraint pk__EvenMoreSensitiveData primary key nonclustered,
SensitiveDataId int not null foreign key references dbo.SensitiveData(Id),
SomeData1 int not null,
SomeData2 datetime2 not null,
SomeData3 nvarchar(100) not null
)
go
create clustered index ixc on dbo.EvenMoreSensitiveData (SensitiveDataId)
go
create table rls.SensitiveDataPermissions
(
UserHashId bigint not null,
SensitiveDataId int not null foreign key references dbo.SensitiveData(Id),
HasAccess bit not null default(0),
constraint pk__rls_SensitiveDataPermissions primary key nonclustered (UserHashId, SensitiveDataId)
)
go
create clustered index ixc on rls.SensitiveDataPermissions (SensitiveDataId)
go
insert into dbo.SensitiveData values
(1, 'Jane', 'Dean', '{"SuperPowers":"Fly"}'),
(2, 'John', 'Doe', '{"SuperPowers":"Laser Eyes"}')
go
insert into dbo.EvenMoreSensitiveData values
(1, 1, 10, sysdatetime(), 'Some more secret info here'),
(2, 1, 20, sysdatetime(), 'and here'),
(3, 1, 30, sysdatetime(), 'and look, even here!'),
(4, 2, 100, sysdatetime(), 'Nothing to see here'),
(5, 2, 200, sysdatetime(), 'unless you look very close!')
go
insert into rls.SensitiveDataPermissions values
(6134311589, 1, 1), -- <NAME>
(1225328053, 2, 1) -- <NAME>
go
create function rls.fn_securitypredicate(@SensitiveDataId int)
returns table
with schemabinding
as
return
select
HasAccess
from
rls.SensitiveDataPermissions
where
(database_principal_id() = database_principal_id('MiddleTierUser') or is_member('db_owner') = 1)
and
UserHashId = cast(session_context(N'user-hash-id') as bigint)
and
SensitiveDataId = @SensitiveDataId
go
create or alter procedure web.get_sensitivedata
as
select
Id,
FirstName,
LastName,
json_query(ReallyImportantData) as ReallyImportantData
from
dbo.SensitiveData
for
json path
go
create or alter procedure web.get_evenmoresensitivedata
as
select
s1.Id,
s1.FirstName,
s1.LastName,
json_query((
select
s2.Id,
s2.SomeData1,
s2.SomeData2,
s2.SomeData3
from
dbo.[EvenMoreSensitiveData] s2
where
[s2].[SensitiveDataId] = [s1].[Id]
for
json auto
)) as EvenMore
from
dbo.SensitiveData s1
for
json path
go
create security policy rls.SensitiveDataPolicy
add filter predicate rls.fn_SecurityPredicate(Id) on dbo.SensitiveData,
add filter predicate rls.fn_SecurityPredicate(SensitiveDataId) on dbo.EvenMoreSensitiveData
with (state = off);
go |
<filename>src/Database/tables/ProductTabs.sql<gh_stars>1-10
CREATE TABLE dbo.ProductTabs
(
Id INT IDENTITY(1, 1) NOT NULL CONSTRAINT PK_ProductTabs PRIMARY KEY,
ProductId INT NOT NULL CONSTRAINT FK_ProductTabs_ProductId FOREIGN KEY REFERENCES dbo.Products(Id),
Title NVARCHAR(30) NOT NULL,
Content NVARCHAR(MAX) NOT NULL,
IsEnabled BIT NOT NULL CONSTRAINT DF_ProductTabs_IsEnabled DEFAULT 0
)
|
-- file:plpgsql.sql ln:4799 expect:true
DROP TABLE multi_test
|
-- Copyright (c) 2017-2021 VMware, Inc. or its affiliates
-- SPDX-License-Identifier: Apache-2.0
-- generates alter statement to modify text datatype to tsquery datatype
SELECT $$ALTER TABLE $$ || n.nspname || '.' || c.relname || $$ ALTER COLUMN $$ || a.attname || $$ TYPE TSQUERY USING $$ || a.attname || $$::tsquery;$$
FROM pg_catalog.pg_class c,
pg_catalog.pg_namespace n,
pg_catalog.pg_attribute a
WHERE c.relkind = 'r'
AND c.oid = a.attrelid
AND NOT a.attisdropped
AND a.atttypid = 'pg_catalog.tsquery'::pg_catalog.regtype
AND c.relnamespace = n.oid
AND n.nspname NOT LIKE 'pg_temp_%'
AND n.nspname NOT LIKE 'pg_toast_temp_%'
AND n.nspname NOT IN ('pg_catalog',
'information_schema')
AND c.oid NOT IN
(SELECT DISTINCT parchildrelid
FROM pg_catalog.pg_partition_rule);
|
DROP PROCEDURE IF EXISTS insertNotification
DELIMITER $$
CREATE PROCEDURE insertNotification(
IN id INT,
IN descripcion VARCHAR(255),
IN url VARCHAR(255),
IN icon VARCHAR(255))
MODIFIES SQL DATA
BEGIN
DECLARE loopValue INT DEFAULT 0;
SET loopValue = (SELECT MIN(idUsuario) FROM usuario);
WHILE loopValue IS NOT NULL DO
IF id <> loopValue THEN
INSERT INTO notificaciones (`involvedA_idUsuario`, `involvedB_idUsuario`, `descripcion`, `url`, `icon`)
VALUES (id, loopValue, descripcion, url, icon);
END IF;
SET loopValue = (SELECT MIN(idUsuario) FROM usuario WHERE loopValue < idUsuario);
END WHILE;
END$$
DELIMITER ;
DELIMITER $$
DELIMITER $$
CREATE PROCEDURE prueba(
IN `idUsuario` INT
)
MODIFIES SQL DATA
BEGIN
DECLARE flag INT DEFAULT FALSE;
DECLARE done INT DEFAULT FALSE;
DECLARE idNotificacion INT DEFAULT 0;
DECLARE cont INT DEFAULT 0;
DECLARE resultset CURSOR FOR SELECT id FROM notificaciones WHERE involvedA_idUsuario=idUsuario AND active=1;
DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE;
/*
OPEN resultset;
SET @id = "IN('null'";
the_loop: LOOP
FETCH resultset INTO idNotificacion;
IF done THEN
LEAVE the_loop;
END IF;
SET cont = cont + 1;
SET flag = TRUE;
SET @id = CONCAT(@id," , " ,idNotificacion);
END LOOP the_loop;
SET @id = CONCAT(@id,")");
CLOSE resultset;
*/
SET @id = "IN (1)";
IF flag THEN
SET @select = CONCAT("SELECT * FROM notificaciones WHERE id ",@id);
SET @update = CONCAT("UPDATE notificaciones SET active=0 WHERE id ",@id);
PREPARE stmt FROM @update;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
PREPARE stmt FROM @select;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
END$$
DELIMITER ; |
DROP TABLE IF EXISTS FILE_INFO;
CREATE TABLE FILE_INFO (
file_id BIGINT NOT NULL PRIMARY KEY AUTO_INCREMENT,
file_name VARCHAR(128),
file_path VARCHAR(1024),
file_created BIGINT,
file_last_modified BIGINT,
file_owner VARCHAR(128),
file_size BIGINT
);
|
<filename>lab01_AmreetAulakh.sql
USE [master]
GO
if exists
(
select *
from sysdatabases
where name='aaulakh2_Lab1'
)
drop database aaulakh2_Lab1
go
CREATE DATABASE [aaulakh2_Lab1]
GO
USE [aaulakh2_Lab1]
GO
-- generating tables
CREATE TABLE [dbo].[Class]
(
[ClassID] nvarchar (50) not null,
[ClassDescription] nvarchar (50) null,
CONSTRAINT [PK_Class_ClassID] PRIMARY KEY ([ClassID])
)
GO
ALTER TABLE Class ADD CONSTRAINT CHK_CLASSDESCRIPTION_LENGTH CHECK (len([CLASSDESCRIPTION]) > 2)
GO
CREATE TABLE [dbo].[Riders]
(
[RiderID] int IDENTITY (10, 1) not null
CONSTRAINT [PK_Riders_RiderID] PRIMARY KEY,
[Name] nvarchar (50) not null
CONSTRAINT CHK_Name_Length CHECK (len([Name]) > 4),
[ClassID] nvarchar (50) null,
CONSTRAINT FK_Riders_ClassID FOREIGN KEY ([ClassID])
REFERENCES Class(ClassID) ON DELETE NO ACTION
)
GO
CREATE TABLE [dbo].[Bikes]
(
[BikeID] nvarchar (6) not null
CONSTRAINT CHK_BikeID_Format CHECK ([BikeID] like '[0][0-1][0-9][HYS]-[AP]'),
[StableDate] datetime null
CONSTRAINT Default_StableDate default getdate(),
CONSTRAINT PK_Bikes_BikedID PRIMARY KEY ([BikeID])
)
GO
CREATE TABLE [dbo].[Sessions]
(
[RiderID] int not null,
[BikeID] nvarchar (6) not null,
[SessionDate] datetime not null
CONSTRAINT CHK_SessionsDate CHECK ([SessionDate] > '1 Sep 2017'),
[Laps] int null
CONSTRAINT Default_Laps default 0,
CONSTRAINT PK_Sessions_RiderID_BikeID_SessionDate PRIMARY KEY ([RiderID], [BikeID], [SessionDate]),
CONSTRAINT FK_Session_RiderID FOREIGN KEY ([RiderID])
REFERENCES Riders(RiderID) ON DELETE NO ACTION
)
GO
CREATE NONCLUSTERED INDEX NCI_RiderID_SessionDate ON [Sessions] (RiderID, SessionDate)
GO
ALTER TABLE [Sessions] ADD CONSTRAINT FK_Sessions_BikeID FOREIGN KEY (BikeID)
REFERENCES Bikes(BikeID) ON DELETE NO ACTION
GO
-- Poopulate Class
INSERT INTO aaulakh2_Lab1.dbo.Class(ClassID, ClassDescription)
values ('moto_3', 'Default Chassis, 250cc'),
('moto_2', 'Default 600cc, Custom Chassis'),
('motogp', '1000cc Factory Spec')
GO
-- Procedures
--PopulateBikes
if exists
(
select *
from sysobjects
where name like 'PopulateBikes'
)
drop procedure PopulateBikes
GO
create procedure PopulateBikes
as
declare @FirstDigit int = 0
declare @SecondDigit int = 0
while @FirstDigit < 2
BEGIN
while @SecondDigit < 10
BEGIN
INSERT INTO aaulakh2_Lab1.dbo.Bikes(BikeID, StableDate)
values(Cast('0' as varchar(2))+Cast(@FirstDigit as varchar(1))+Cast(@SecondDigit as varchar(1))+'H-A', getdate()),
(Cast('0' as varchar(2))+Cast(@FirstDigit as varchar(1))+Cast(@SecondDigit as varchar(1))+'H-P', getdate()),
(Cast('0' as varchar(2))+Cast(@FirstDigit as varchar(1))+Cast(@SecondDigit as varchar(1))+'Y-A', getdate()),
(Cast('0' as varchar(2))+Cast(@FirstDigit as varchar(1))+Cast(@SecondDigit as varchar(1))+'Y-P', getdate()),
(Cast('0' as varchar(2))+Cast(@FirstDigit as varchar(1))+Cast(@SecondDigit as varchar(1))+'S-A', getdate()),
(Cast('0' as varchar(2))+Cast(@FirstDigit as varchar(1))+Cast(@SecondDigit as varchar(1))+'S-P', getdate())
set @SecondDigit = @SecondDigit + 1
END
set @FirstDigit = @FirstDigit + 1
set @SecondDigit = 0
END
GO
exec PopulateBikes
GO
Select *
from Bikes
GO
-- Add Rider Stored Procedure
if exists
(
select *
from sysobjects
where name like 'AddRider'
)
drop procedure AddRider
GO
create procedure AddRider
@Name as nvarchar(50),
@ClassID as nvarchar(50),
@ErrorMessage as varchar(50) output
as
if (@Name is null or @Name like '')
begin
set @ErrorMessage = 'Add Rider: Name is null or empty'
return -1
end
if not exists (select * from Class where ClassID like @ClassID)
begin
set @ErrorMessage = 'Add Rider: Class does not exist'
return -1
end
INSERT INTO aaulakh2_Lab1.dbo.Riders(Name, ClassID)
values(@Name, @ClassID)
set @ErrorMessage = 'OK'
return 0
GO
-- Remove Rider Stored Procedure
if exists
(
select *
from sysobjects
where name like 'RemoveRider'
)
drop procedure RemoveRider
GO
-- Add Rider Test End
-- Remove Rider Stored Procedure
create procedure RemoveRider
@RiderID as int,
@Force as bit = 0,
@ErrorMessage as nvarchar(max) output
as
if (@RiderID is null)
begin
set @ErrorMessage = 'Remove Rider: Rider ID is null'
return -1
end
if not exists (select * from Riders where RiderID = @RiderID)
begin
set @ErrorMessage = 'Remove Rider: ' + Cast(@RiderID as nvarchar) + ' does not exist'
end
if (@Force = 1)
begin
if exists ( select * from Sessions where RiderID = @RiderID)
begin
delete Sessions
where RiderID like
(
select RiderID
from Riders
where RiderID = @RiderID
)
end
end
if (@Force = 0)
begin
if exists ( select * from Sessions where RiderID = @RiderID)
begin
set @ErrorMessage = 'Remove Rider: Force set to false, Session Exists'
return -1
end
end
delete Riders where RiderID = @RiderID
set @ErrorMessage = 'OK'
return 0
GO
-- Add Session Stored Procedure
if exists
(
select *
from sysobjects
where name like 'AddSession'
)
drop procedure AddSession
GO
create procedure AddSession
@RiderID as int,
@BikeID as nvarchar(6),
@SessionDate as datetime,
@ErrorMessage as nvarchar(max) output
as
if @BikeID is null
begin
set @ErrorMessage = 'Add Session: BikeID is null'
return -1
end
if @RiderID is null
begin
set @ErrorMessage = 'Add Session: RiderID is null'
return -1
end
if not exists (select * from Riders where RiderID = @RiderID)
begin
set @ErrorMessage = 'Add Session: ' + cast(@RiderID as nvarchar) + ' does not exist'
return -1
end
if not exists (select * from Bikes where BikeID like @BikeID)
begin
set @ErrorMessage = 'Add Session: ' + @BikeID + ' does not exist'
return -1
end
if @SessionDate is null
begin
set @ErrorMessage = 'Add Session: SessionDate is null'
return -1
end
if ISDATE(@SessionDate) = 0 or @SessionDate < getdate()
begin
set @ErrorMessage = 'Add Session: ' + cast(@SessionDate as nvarchar) + ' is invalid'
return -1
end
if exists (select * from Sessions where BikeID like @BikeID and SessionDate = @SessionDate)
begin
set @ErrorMessage = 'Add Session: ' + @BikeID + ' is already assigned'
return -1
end
insert into Sessions(RiderID, BikeID, SessionDate, Laps)
values(@RiderID, @BikeID, @SessionDate, null)
set @ErrorMessage = 'OK'
return 0
GO
-- Update Session Stored Procedure
if exists
(
select *
from sysobjects
where name like 'UpdateSession'
)
drop procedure UpdateSession
GO
create procedure UpdateSession
@RiderID as int,
@BikeID as nvarchar(6),
@SessionDate as datetime,
@Laps as int = null,
@ErrorMessage as nvarchar(max) output
as
declare @OldLaps as int
select
@OldLaps = Laps
from Sessions
where SessionDate = @SessionDate and BikeID like @BikeID and RiderID = @RiderID
if @BikeID is null
begin
set @ErrorMessage = 'Update Session: BikeID is null'
return -1
end
if @RiderID is null
begin
set @ErrorMessage = 'Update Session: RiderID is null'
return -1
end
if not exists (select * from Sessions where RiderID = @RiderID)
begin
set @ErrorMessage = 'Update Session: ' + @RiderID + ' does not exist'
return -1
end
if not exists (select * from Sessions where BikeID like @BikeID)
begin
set @ErrorMessage = 'Update Session: ' + @BikeID + ' does not exist'
return -1
end
if @SessionDate is null
begin
set @ErrorMessage = 'Update Session: SessionDate is null'
return -1
end
if ISDATE(@SessionDate) = 0 or @SessionDate < getdate()
begin
set @ErrorMessage = 'Update Session: ' + @SessionDate + ' is invalid'
return -1
end
if not exists (select * from Sessions where SessionDate = @SessionDate)
begin
set @ErrorMessage = 'Update Session: ' + @SessionDate + ' does not exist'
return -1
end
if @Laps < @OldLaps
begin
set @ErrorMessage = 'Update Session: @Laps are less than previously held value'
return -1
end
update aaulakh2_Lab1.dbo.Sessions
set Laps = @Laps
where SessionDate = @SessionDate and BikeID like @BikeID and RiderID = @RiderID
set @ErrorMessage = 'OK'
return 0
GO
-- Remove Class Stored Procedure
if exists
(
select *
from sysobjects
where name like 'RemoveClass'
)
drop procedure RemoveClass
GO
create procedure RemoveClass
@ClassID as nvarchar(50),
@Force as bit = 0,
@ErrorMessage as nvarchar(max) output
as
if @ClassID is null or @ClassID like ''
begin
set @ErrorMessage = 'Remove Class: ClassID is null or empty'
return -1
end
if @Force = 0 and exists (select RiderID from Riders where ClassID like @ClassID)
begin
set @ErrorMessage = 'Remove Class: Rider Registered but !Force'
return -1
end
if @Force = 1 and exists (select RiderID from Riders where ClassID like @ClassID)
begin
delete Sessions
where RiderID in
(
select RiderID
from Riders
where ClassID like (select ClassID from Class where ClassID like @CLassID)
)
delete Riders
where ClassID like (select ClassID from Class where ClassID like @ClassID)
end
delete Class
where ClassID like @ClassID
set @ErrorMessage = 'OK'
return 0
GO
-- Class Info Stored Procedure
if exists
(
select *
from sysobjects
where name like 'ClassInfo'
)
drop procedure ClassInfo
GO
create procedure ClassInfo
@ClassID as nvarchar(50),
@RiderID as int = null,
@ErrorMessage as nvarchar(50) output
as
if @ClassID is null or @ClassID like ''
begin
set @ErrorMessage = 'Class Info: ClassID is null or empty'
return -1
end
if not exists (select ClassID from Class where ClassID like @ClassID)
begin
set @ErrorMessage = 'Class Info: ' + @ClassID + ' does not exist'
return -1
end
if @RiderID is null
begin
select
C.ClassDescription as 'Class Description',
R.Name
from Class as C left outer join Riders as R
on C.ClassID = R.ClassID
where R.ClassID like (select
ClassID
from Class
where ClassID like @ClassID)
set @ErrorMessage = 'Class Info: @RiderID is null'
return 0
end
if @RiderID is not null
begin
if not exists (select RiderID from Riders where ClassID like (select
ClassID
from Class
where ClassID like @ClassID))
begin
set @ErrorMessage = 'Class Info: ' + @RiderID + ' does not exist'
return -1
end
else
begin
select C.ClassDescription as 'Class Description',
R.Name
from Class as C left outer join Riders as R
on C.ClassID like R.ClassID
where
C.ClassID like @ClassID and R.RiderID = @RiderID
set @ErrorMessage = 'OK'
return 0
end
end
GO
if exists(
select *
from sysobjects
where name like 'ClassSummary'
)
drop procedure ClassSummary
go
create procedure ClassSummary
@ClassID as nvarchar(50) = null,
@RiderID as int = null,
@ErrorMessage as nvarchar(50) output
as
if @ClassID is null or @ClassID like ''
begin
set @ErrorMessage = 'Class Summary: Class ID is Null or empty'
return -1
end
if not exists(select ClassID from Class where ClassID like @ClassID)
begin
set @ErrorMessage = 'Class Summary: '+ @ClassID + 'does not exist'
return -1
end
if @RiderID is not null
begin
set @ErrorMessage = 'Class Summary: RiderID is null'
return -1
end
if not exists( select RiderID from Riders where RiderID = @RiderID)
begin
set @ErrorMessage = 'Class Summary: '+ @ClassID + 'does not exist'
return -1
end
--if not exists ( select RiderID from Riders where RiderID = @RiderID and ClassID like @RiderID)
go
-- Add Rider Test
-- null test
declare @pName as nvarchar(50)
declare @pClassID as nvarchar(50)
declare @errMsg as nvarchar(max)
declare @retVal as int = 0
set @pName = null
set @pClassID = 'moto_3'
set @errMsg = ''
exec @retVal = AddRider @Name= @pName, @ClassID = @pClassID, @ErrorMessage = @errMsg output
if @retVal >= 0 print 'Error Code Invalid'
select @errMsg as 'Add Rider Error Message', @retVal as 'Return Code'
go
-- Class Exists test
declare @pName as nvarchar(50)
declare @pClassID as nvarchar(50)
declare @errMsg as nvarchar(max)
declare @retVal as int = 0
set @pName = '<NAME>'
set @pClassID = 'moto_73'
set @errMsg = ''
exec @retVal = AddRider @Name= @pName, @ClassID = @pClassID, @ErrorMessage = @errMsg output
if @retVal >= 0 print 'Error Code Invalid'
select @errMsg as 'Add Rider Error Message', @retVal as 'Return Code'
go
-- Add Rider Sucessful Run
declare @pName as nvarchar(50)
declare @pClassID as nvarchar(50)
declare @errMsg as nvarchar(max)
declare @retVal as int = 0
set @pName = '<NAME>'
set @pClassID = 'moto_3'
set @errMsg = ''
exec @retVal = AddRider @Name= @pName, @ClassID = @pClassID, @ErrorMessage = @errMsg output
if @retVal >= 0 print 'Error Code Invalid'
select @errMsg as 'Add Rider Error Message', @retVal as 'Return Code'
select RiderID, Name from Riders where ClassID = @pClassID
GO
-- Add Session Test Code
-- RiderID Null
declare @pRiderID as int = null
declare @pBikeID as nvarchar(6) = '000H-A'
declare @pSessionDate as datetime = '2018-09-01'
declare @Error as nvarchar(max)
declare @retVal as int = 0
exec @retVal = AddSession @RiderID = @pRiderID, @BikeID = @pBikeID, @SessionDate = @pSessionDate, @ErrorMessage = @Error output
select @Error as 'Add Session Error Message', @retVal as 'Return Code'
GO
--BikeID Null
declare @pRiderID as int = 10
declare @pBikeID as nvarchar(6) = null
declare @pSessionDate as datetime = '2018-09-01'
declare @Error as nvarchar(max)
declare @retVal as int = 0
exec @retVal = AddSession @RiderID = @pRiderID, @BikeID = @pBikeID, @SessionDate = @pSessionDate, @ErrorMessage = @Error output
select @Error as 'Add Session Error Message', @retVal as 'Return Code'
GO
--RiderID !Exists
declare @pRiderID as int = 11
declare @pBikeID as nvarchar(6) = '000H-A'
declare @pSessionDate as datetime = '2018-09-01'
declare @Error as nvarchar(max)
declare @retVal as int = 0
exec @retVal = AddSession @RiderID = @pRiderID, @BikeID = @pBikeID, @SessionDate = @pSessionDate, @ErrorMessage = @Error output
select @Error as 'Add Session Error Message', @retVal as 'Return Code'
GO
--BikeID !Exists
declare @pRiderID as int = 10
declare @pBikeID as nvarchar(6) = '000H-C'
declare @pSessionDate as datetime = '2018-09-01'
declare @Error as nvarchar(max)
declare @retVal as int = 0
exec @retVal = AddSession @RiderID = @pRiderID, @BikeID = @pBikeID, @SessionDate = @pSessionDate, @ErrorMessage = @Error output
select @Error as 'Add Session Error Message', @retVal as 'Return Code'
GO
--Date Null
declare @pRiderID as int = 10
declare @pBikeID as nvarchar(6) = '000H-A'
declare @pSessionDate as datetime = null
declare @Error as nvarchar(max)
declare @retVal as int = 0
exec @retVal = AddSession @RiderID = @pRiderID, @BikeID = @pBikeID, @SessionDate = @pSessionDate, @ErrorMessage = @Error output
select @Error as 'Add Session Error Message', @retVal as 'Return Code'
GO
-- Date Invalid
declare @pRiderID as int = null
declare @pBikeID as nvarchar(6) = '000H-A'
declare @pSessionDate as datetime = '2017-09-01'
declare @Error as nvarchar(max)
declare @retVal as int = 0
exec @retVal = AddSession @RiderID = @pRiderID, @BikeID = @pBikeID, @SessionDate = @pSessionDate, @ErrorMessage = @Error output
select @Error as 'Add Session Error Message', @retVal as 'Return Code'
GO
-- Succesful Add Session Run
declare @pRiderID as int = 10
declare @pBikeID as nvarchar(6) = '000H-A'
declare @pSessionDate as datetime = '2018-09-01'
declare @Error as nvarchar(max)
declare @retVal as int = 0
exec @retVal = AddSession @RiderID = @pRiderID, @BikeID = @pBikeID, @SessionDate = @pSessionDate, @ErrorMessage = @Error output
select @Error as 'Add Session Error Message', @retVal as 'Return Code'
GO
-- BikeID already assigned
declare @pRiderID as int = 10
declare @pBikeID as nvarchar(6) = '000H-A'
declare @pSessionDate as datetime = '2018-09-01'
declare @Error as nvarchar(max)
declare @retVal as int = 0
exec @retVal = AddSession @RiderID = @pRiderID, @BikeID = @pBikeID, @SessionDate = @pSessionDate, @ErrorMessage = @Error output
select @Error as 'Add Session Error Message', @retVal as 'Return Code'
GO
-- Remove Rider Test Code
-- RiderID Null
declare @retVal as int = 0
declare @pRiderID as int = null
declare @pForce as bit = 0
declare @Error as nvarchar(max) = ''
exec @retVal = RemoveRider @RiderID = pRiderID, @Force = @pForce, @ErrorMessage = @Error output
select @Error as 'Remove Rider Error Message', @retVal as 'Return Code'
GO
----RiderID !Exist
--declare @retVal as int = 0
--declare @pRiderID as int = 11
--declare @pForce as bit = 1
--declare @Error as nvarchar(max) = ''
--exec @retVal = RemoveRider @RiderID = pRiderID, @Force = @pForce, @ErrorMessage = @Error output
--select @Error as 'Remove Rider Error Message', @retVal as 'Return Code'
--GO
---- !Force & SessionData
--declare @retVal as int = 0
--declare @pRiderID as int = 10
--declare @pForce as bit = 0
--declare @Error as nvarchar(max) = ''
--exec @retVal = RemoveRider @RiderID = pRiderID, @Force = @pForce, @ErrorMessage = @Error output
--select @Error as 'Remove Rider Error Message', @retVal as 'Return Code'
--GO
---- Force & SessionData
--declare @retVal as int = 0
--declare @pRiderID as int = 10
--declare @pForce as bit = 1
--declare @Error as nvarchar(max) = ''
--exec @retVal = RemoveRider @RiderID = pRiderID, @Force = @pForce, @ErrorMessage = @Error output
--select @Error as 'Remove Rider Error Message', @retVal as 'Return Code'
--GO
---- Remove Rider Sucessful Run
--declare @retVal as int = 0
--declare @pRiderID as int = 10
--declare @pForce as bit = 1
--declare @Error as nvarchar(max) = ''
--exec @retVal = RemoveRider @RiderID = pRiderID, @Force = @pForce, @ErrorMessage = @Error output
--select @Error as 'Remove Rider Error Message', @retVal as 'Return Code'
--GO
|
<filename>src/test/resources/jp/co/tis/gsp/tools/dba/mojo/GenerateEntity_test/view/sqlserver/ddl/40_CREATE_VIEW3.sql
CREATE VIEW VIEW3 AS
SELECT
ORDER_TEST.ORDER_ID AS OID, ORDER_TEST.CUSTOMER AS CUSTOMER_NAME
FROM ORDER_T ORDER_TEST WHERE EXISTS (SELECT * FROM ORDER_DETAIL as OD WHERE ORDER_TEST.ORDER_DETAIL_ID = OD.ORDER_DETAIL_ID) |
CREATE PROCEDURE [dbo].[dbx_codeanalysis_error_019]
AS
TRUNCATE TABLE [dbo].[dbx_table] |
<reponame>wsams/talk2me
CREATE TABLE `rooms` (
`id` INT AUTO_INCREMENT,
`name` VARCHAR(255) NOT NULL UNIQUE,
PRIMARY KEY(`id`)
);
CREATE TABLE `messages` (
`id` INT AUTO_INCREMENT,
`rooms` INT NOT NULL,
`encrypted` BIT(1) NOT NULL,
`message` TEXT NULL,
`timestamp` TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY(`id`),
CONSTRAINT `rooms_fk` FOREIGN KEY (`rooms`) REFERENCES `rooms` (`id`) ON DELETE CASCADE
);
|
<reponame>radekg/kratos
CREATE TABLE "_continuity_containers_tmp" (
"id" TEXT PRIMARY KEY,
"identity_id" char(36),
"name" TEXT NOT NULL,
"payload" TEXT,
"expires_at" DATETIME NOT NULL,
"created_at" DATETIME NOT NULL,
"updated_at" DATETIME NOT NULL,
FOREIGN KEY (identity_id) REFERENCES identities (id) ON UPDATE NO ACTION ON DELETE CASCADE
); |
grant delete, select, insert, update on SIMPLE_CONTENT_REVISION to vrtx;
grant delete, select, insert, update on REVISION_ACL_ENTRY to vrtx;
grant delete, select, insert, update on ACL_ENTRY to vrtx;
grant delete, select, insert, update on ACTION_TYPE to vrtx;
grant delete, select, insert, update on EXTRA_PROP_ENTRY to vrtx;
grant delete, select, insert, update on LOCK_TYPE to vrtx;
grant delete, select, insert, update on PARENT_CHILD to vrtx;
grant delete, select, insert, update on VORTEX_LOCK to vrtx;
grant delete, select, insert, update on VORTEX_RESOURCE to vrtx;
grant delete, select, insert, update on DELETED_RESOURCE to vrtx;
|
PRAGMA foreign_keys=OFF;
BEGIN TRANSACTION;
CREATE TABLE meta(key LONGVARCHAR NOT NULL UNIQUE PRIMARY KEY,value LONGVARCHAR);
INSERT INTO "meta" VALUES('version','40');
INSERT INTO "meta" VALUES('last_compatible_version','40');
INSERT INTO "meta" VALUES('Default Search Provider ID','2');
INSERT INTO "meta" VALUES('Default Search Provider ID Backup','2');
INSERT INTO "meta" VALUES('Default Search Provider ID Backup Signature','');
INSERT INTO "meta" VALUES('Builtin Keyword Version','33');
CREATE TABLE keywords (id INTEGER PRIMARY KEY,short_name VARCHAR NOT NULL,keyword VARCHAR NOT NULL,favicon_url VARCHAR NOT NULL,url VARCHAR NOT NULL,show_in_default_list INTEGER,safe_for_autoreplace INTEGER,originating_url VARCHAR,date_created INTEGER DEFAULT 0,usage_count INTEGER DEFAULT 0,input_encodings VARCHAR,suggest_url VARCHAR,prepopulate_id INTEGER DEFAULT 0,autogenerate_keyword INTEGER DEFAULT 0,logo_id INTEGER DEFAULT 0,created_by_policy INTEGER DEFAULT 0,instant_url VARCHAR,last_modified INTEGER DEFAULT 0, sync_guid VARCHAR);
INSERT INTO "keywords" VALUES(2,'Google','google.com','http://www.google.com/favicon.ico','{google:baseURL}search?{google:RLZ}{google:acceptedSuggestion}{google:originalQueryForSuggestion}sourceid=chrome&ie={inputEncoding}&q={searchTerms}',1,1,'',0,0,'UTF-8','{google:baseSuggestURL}search?client=chrome&hl={language}&q={searchTerms}',1,1,6262,0,'{google:baseURL}webhp?{google:RLZ}sourceid=chrome-instant&ie={inputEncoding}&ion=1{searchTerms}&nord=1',0,'{1234-5678-90AB-CDEF}');
CREATE TABLE logins (origin_url VARCHAR NOT NULL, action_url VARCHAR, username_element VARCHAR, username_value VARCHAR, password_element VARCHAR, password_value BLOB, submit_element VARCHAR, signon_realm VARCHAR NOT NULL,ssl_valid INTEGER NOT NULL,preferred INTEGER NOT NULL,date_created INTEGER NOT NULL,blacklisted_by_user INTEGER NOT NULL,scheme INTEGER NOT NULL,UNIQUE (origin_url, username_element, username_value, password_element, submit_element, signon_realm));
CREATE TABLE web_app_icons (url LONGVARCHAR,width int,height int,image BLOB, UNIQUE (url, width, height));
CREATE TABLE web_apps (url LONGVARCHAR UNIQUE,has_all_images INTEGER NOT NULL);
CREATE TABLE autofill (name VARCHAR, value VARCHAR, value_lower VARCHAR, pair_id INTEGER PRIMARY KEY, count INTEGER DEFAULT 1);
CREATE TABLE autofill_dates ( pair_id INTEGER DEFAULT 0, date_created INTEGER DEFAULT 0);
CREATE TABLE autofill_profiles ( guid VARCHAR PRIMARY KEY, company_name VARCHAR, address_line_1 VARCHAR, address_line_2 VARCHAR, city VARCHAR, state VARCHAR, zipcode VARCHAR, country VARCHAR, country_code VARCHAR, date_modified INTEGER NOT NULL DEFAULT 0);
CREATE TABLE autofill_profile_names ( guid VARCHAR, first_name VARCHAR, middle_name VARCHAR, last_name VARCHAR);
CREATE TABLE autofill_profile_emails ( guid VARCHAR, email VARCHAR);
CREATE TABLE autofill_profile_phones ( guid VARCHAR, type INTEGER DEFAULT 0, number VARCHAR);
CREATE TABLE credit_cards ( guid VARCHAR PRIMARY KEY, name_on_card VARCHAR, expiration_month INTEGER, expiration_year INTEGER, card_number_encrypted BLOB, date_modified INTEGER NOT NULL DEFAULT 0);
CREATE TABLE token_service (service VARCHAR PRIMARY KEY NOT NULL,encrypted_token BLOB);
CREATE INDEX logins_signon ON logins (signon_realm);
CREATE INDEX web_apps_url_index ON web_apps (url);
CREATE INDEX autofill_name ON autofill (name);
CREATE INDEX autofill_name_value_lower ON autofill (name, value_lower);
CREATE INDEX autofill_dates_pair_id ON autofill_dates (pair_id);
COMMIT;
|
<filename>sql/_27_banana_qa/issue_5765_timezone_support/_00_dev_cases/_01_object/_02_timestamptz/cases/1016.sql
-- create table with timestamptz data type and insert numberic data
CREATE CLASS t1(
col1 timestamptz
);
INSERT INTO t1 VALUES (1111111111);
drop t1; |
<filename>sql/_27_banana_qa/issue_5765_timezone_support/_00_dev_cases/_02_operator/_03_extract_local_tz/cases/1005.sql
-- [er]retrieve by function of extract using parameter of second that don't match on date data type
set timezone '+9:00';
create class func_05 ( a timestampltz , b date, c time );
insert into func_05 values( '00:00:01 01/01/1971', '01/01/1970', '01:02:03');
insert into func_05 values( '03:14:07 01/01/2038', '01/01/2038', '01:02:03');
insert into func_05 values( '01:02:03 am 01/01/1980', '01/01/1980', '01:02:03 am');
insert into func_05 values( '01:02:03 pm 01/01/1980', '01/01/1980', '01:02:03 pm');
insert into func_05 values( null , null, null);
select extract(second from a), extract(second from b), extract(second from c) from func_05 order by 1,2,3;
drop class func_05;
set timezone 'default';
|
<filename>Cloud-Server/PHP/database/AngelsGate.sql
-- phpMyAdmin SQL Dump
-- version 4.7.7
-- https://www.phpmyadmin.net/
--
-- Host: localhost:3306
-- Generation Time: Oct 13, 2018 at 08:42 AM
-- Server version: 10.1.35-MariaDB-cll-lve
-- PHP Version: 5.6.30
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: `AngelsGateV2`
--
-- --------------------------------------------------------
--
-- Table structure for table `AuthTable`
--
CREATE TABLE `AuthTable` (
`id` bigint(20) NOT NULL,
`session` varchar(128) DEFAULT NULL,
`handler` varchar(128) DEFAULT NULL,
`token` varchar(128) DEFAULT NULL,
`cantoken` varchar(128) DEFAULT NULL,
`timetoken` varchar(32) DEFAULT NULL,
`time` int(11) DEFAULT NULL,
`identifier` varchar(256) DEFAULT NULL,
`ivr` varchar(64) DEFAULT NULL,
`hpub` text,
`hpriv` text,
`endpoint` varchar(256) DEFAULT NULL,
`pubkey` varchar(2048) DEFAULT NULL,
`myid` varchar(64) DEFAULT NULL,
`offset` int(64) DEFAULT NULL,
`label` int(128) DEFAULT NULL,
`user` int(64) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
--
-- Table structure for table `ChainTable`
--
CREATE TABLE `ChainTable` (
`id` bigint(20) NOT NULL,
`session` varchar(128) DEFAULT NULL,
`req` varchar(256) DEFAULT NULL,
`res` varchar(256) DEFAULT NULL,
`count` int(11) DEFAULT NULL,
`time` int(11) DEFAULT NULL,
`rlimit` int(11) DEFAULT NULL,
`seq` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
--
-- Table structure for table `HashTable`
--
CREATE TABLE `HashTable` (
`id` bigint(20) NOT NULL,
`session` varchar(128) DEFAULT NULL,
`ssalt` varchar(64) DEFAULT NULL,
`time` int(11) DEFAULT NULL,
`ip` varchar(32) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
--
-- Table structure for table `IPTable`
--
CREATE TABLE `IPTable` (
`id` bigint(20) NOT NULL,
`ip` varchar(32) NOT NULL,
`count` int(11) DEFAULT NULL,
`total` bigint(20) DEFAULT NULL,
`time` int(11) DEFAULT NULL,
`block` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Indexes for dumped tables
--
--
-- Indexes for table `AuthTable`
--
ALTER TABLE `AuthTable`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `ChainTable`
--
ALTER TABLE `ChainTable`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `HashTable`
--
ALTER TABLE `HashTable`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `IPTable`
--
ALTER TABLE `IPTable`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `AuthTable`
--
ALTER TABLE `AuthTable`
MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `ChainTable`
--
ALTER TABLE `ChainTable`
MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `HashTable`
--
ALTER TABLE `HashTable`
MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `IPTable`
--
ALTER TABLE `IPTable`
MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT;
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
--
-- Create the tables needed for fsso.
--
-- Run this with the mysql command:
--
-- $ mysql -u <mysqluser> -p <dbname> < schema.sql
--
-- Or from the mysql shell:
--
-- mysql> source schema.sql
--
--
-- One entry per registered user. Additional fields may be added as needed.
--
CREATE TABLE `fsso_members` (
`id` serial,
`email` varchar(255) NOT NULL,
`fullname` varchar(50) NOT NULL,
`shortname` varchar(50) NOT NULL,
`is_active` boolean NOT NULL DEFAULT 1,
`roles` int(10) unsigned NOT NULL DEFAULT 0,
`created_at` bigint(20) NOT NULL,
`active_at` bigint(20) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- One entry per registered user who has email/password authentication enabled.
--
CREATE TABLE `fsso_auth_email` (
`member_id` bigint(20) unsigned NOT NULL PRIMARY KEY,
`email` varchar(255) NOT NULL UNIQUE,
`pwhash` varchar(64) NOT NULL,
`pwchanged_at` bigint(20) NOT NULL,
`is_primary` boolean NOT NULL DEFAULT 1,
CONSTRAINT `fsso_auth_email_ibfk_1` FOREIGN KEY (`member_id`) REFERENCES `fsso_members` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- One entry per registered user who has Google authentication enabled.
--
CREATE TABLE `fsso_auth_goog` (
`member_id` bigint(20) unsigned NOT NULL PRIMARY KEY,
`uid` varchar(32) NOT NULL UNIQUE,
`email` varchar(255) NOT NULL,
`is_primary` boolean NOT NULL DEFAULT 1,
KEY `email` (`email`),
CONSTRAINT `fsso_auth_goog_ibfk_1` FOREIGN KEY (`member_id`) REFERENCES `fsso_members` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- One entry per registered user who has Facebook authentication enabled.
--
CREATE TABLE `fsso_auth_fb` (
`member_id` bigint(20) unsigned NOT NULL PRIMARY KEY,
`uid` varchar(32) NOT NULL UNIQUE,
`email` varchar(255) NOT NULL,
`is_primary` boolean NOT NULL DEFAULT 1,
KEY `email` (`email`),
CONSTRAINT `fsso_auth_fb_ibfk_1` FOREIGN KEY (`member_id`) REFERENCES `fsso_members` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- One entry per sign-in session. One user may have more than one session active.
-- is_session is 1 for cooke-based sessions and 0 for token-based sessions.
--
CREATE TABLE `fsso_active` (
`atoken` varchar(32) NOT NULL PRIMARY KEY,
`member_id` bigint(20) unsigned NOT NULL,
`active_at` bigint(20) NOT NULL,
`useragent` varchar(50) NOT NULL,
`ip` varchar(50) NOT NULL,
`is_session` boolean NOT NULL,
`data` text NOT NULL,
KEY `member_id` (`member_id`),
CONSTRAINT `fsso_active_ibfk_1` FOREIGN KEY (`member_id`) REFERENCES `fsso_members` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- One entry per refresh token, limit one per user. Refresh tokens are only for
-- re-establishing cookie-based sessions and may only be used once.
--
CREATE TABLE `fsso_refresh` (
`rtoken` varchar(32) NOT NULL PRIMARY KEY,
`member_id` bigint(20) unsigned NOT NULL UNIQUE,
`expires_at` bigint(20) NOT NULL,
CONSTRAINT `fsso_refresh_ibfk_1` FOREIGN KEY (`member_id`) REFERENCES `fsso_members` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- One entry per email address awaiting verification.
-- Anyone in possesion of vtoken is assumed to own the email address.
--
CREATE TABLE `fsso_email_verify` (
`vtoken` varchar(32) NOT NULL PRIMARY KEY,
`email` varchar(255) NOT NULL,
`expires_at` bigint(20) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
<reponame>vicepool/guild-operators
CREATE OR REPLACE FUNCTION grest.pool_delegator_count(_pool_bech32 text)
RETURNS JSON STABLE LANGUAGE PLPGSQL AS $$
BEGIN
RETURN ( SELECT json_build_object(
'delegator_count', COUNT(*)
)
FROM public.delegation d
WHERE pool_hash_id = (SELECT id from public.pool_hash where view=_pool_bech32)
AND NOT EXISTS
(SELECT TRUE FROM public.delegation d2 WHERE d2.addr_id=d.addr_id AND d2.id > d.id)
AND NOT EXISTS
(SELECT TRUE FROM public.stake_deregistration sd WHERE sd.addr_id=d.addr_id AND sd.tx_id > d.tx_id)
);
END; $$;
COMMENT ON FUNCTION grest.pool_delegator_count IS 'Get live delegator count';
|
-- Add new configuration value for AutoNumberingResetMonth
set @query = if ((select count(*) from `tblconfiguration` where `setting` = 'AutoNumberingResetMonth') = 0, "INSERT INTO `tblconfiguration` (`setting`, `value`, `created_at`, `updated_at`) VALUES ('AutoNumberingResetMonth', CONCAT_WS('-', YEAR(CURRENT_DATE()), MONTH(CURRENT_DATE())), now(), now());",'DO 0;');
prepare statement from @query;
execute statement;
deallocate prepare statement;
-- Add new configuration value for AutoPaidNumberingResetMonth
set @query = if ((select count(*) from `tblconfiguration` where `setting` = 'AutoPaidNumberingResetMonth') = 0, "INSERT INTO `tblconfiguration` (`setting`, `value`, `created_at`, `updated_at`) VALUES ('AutoPaidNumberingResetMonth', CONCAT_WS('-', YEAR(CURRENT_DATE()), MONTH(CURRENT_DATE())), now(), now());",'DO 0;');
prepare statement from @query;
execute statement;
deallocate prepare statement;
-- Add new payment gateway product mapping table
CREATE TABLE IF NOT EXISTS `tblpaymentgateways_product_mapping` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`gateway` varchar(255) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
`account_identifier` varchar(255) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
`product_identifier` varchar(255) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
`remote_identifier` varchar(255) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
`created_at` timestamp NULL DEFAULT '0000-00-00 00:00:00',
`updated_at` timestamp NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- Add new field to tblinvoices for date_refunded
set @query = if ((select count(*) from information_schema.columns where table_schema=database() and table_name='tblinvoices' and column_name='date_refunded') = 0, 'alter table `tblinvoices` add `date_refunded` timestamp NOT NULL DEFAULT \'0000-00-00 00:00:00\' AFTER `last_capture_attempt`', 'DO 0');
prepare statement from @query;
execute statement;
deallocate prepare statement;
-- Add new field to tblinvoices for date_cancelled
set @query = if ((select count(*) from information_schema.columns where table_schema=database() and table_name='tblinvoices' and column_name='date_cancelled') = 0, 'alter table `tblinvoices` add `date_cancelled` timestamp NOT NULL DEFAULT \'0000-00-00 00:00:00\' AFTER `date_refunded`', 'DO 0');
prepare statement from @query;
execute statement;
deallocate prepare statement;
-- Add new field to tblinvoices for created_at
set @query = if ((select count(*) from information_schema.columns where table_schema=database() and table_name='tblinvoices' and column_name='created_at') = 0, 'alter table `tblinvoices` add `created_at` timestamp NOT NULL DEFAULT \'0000-00-00 00:00:00\' AFTER `notes`', 'DO 0');
prepare statement from @query;
execute statement;
deallocate prepare statement;
-- Add new field to tblinvoices for updated_at
set @query = if ((select count(*) from information_schema.columns where table_schema=database() and table_name='tblinvoices' and column_name='updated_at') = 0, 'alter table `tblinvoices` add `updated_at` timestamp NOT NULL DEFAULT \'0000-00-00 00:00:00\' AFTER `created_at`', 'DO 0');
prepare statement from @query;
execute statement;
deallocate prepare statement;
-- update type of gateways to BankAccount
UPDATE `tblpaymentgateways` SET `value` = 'Bank' WHERE `setting` = 'type' AND `gateway` IN ('authorizeecheck', 'bluepayecheck', 'directdebit');
-- Update pricing enum type to include usage billing values
set @query = if ((select count(*) from information_schema.columns where table_schema=database() and table_name='tblpricing' and column_name='type' and column_type='enum("product","addon","configoptions","domainregister","domaintransfer","domainrenew","domainaddons")') = 0, 'ALTER TABLE `tblpricing` CHANGE `type` `type` enum("product","addon","configoptions","domainregister","domaintransfer","domainrenew","domainaddons","usage") CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL','DO 0;');
prepare statement from @query;
execute statement;
deallocate prepare statement;
CREATE TABLE IF NOT EXISTS `tblpricing_bracket` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`floor` decimal(19,6) NOT NULL DEFAULT '0.000000',
`ceiling` decimal(19,6) NOT NULL DEFAULT '0.000000',
`rel_type` varchar(200) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
`rel_id` varchar(200) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
`schema_type` varchar(32) COLLATE utf8_unicode_ci NOT NULL DEFAULT 'flat',
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
`deleted_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
CREATE TABLE IF NOT EXISTS `tbltenant_stats` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`tenant_id` int(11) NOT NULL DEFAULT '0',
`metric` varchar(255) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
`type` varchar(255) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
`value` decimal(19,6) NOT NULL DEFAULT '0.000000',
`measured_at` decimal(18,6) NOT NULL DEFAULT '0.000000',
`invoice_id` int(11) DEFAULT '0',
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `tenant_id` (`tenant_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
CREATE TABLE IF NOT EXISTS `tblserver_tenants` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`server_id` int(11) NOT NULL DEFAULT '0',
`tenant` varchar(255) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `server_tenant` (`tenant`,`server_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
CREATE TABLE IF NOT EXISTS `tblusage_items` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`rel_type` varchar(200) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
`rel_id` int(11) NOT NULL DEFAULT '0',
`module_type` varchar(200) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
`module` varchar(200) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
`metric` varchar(200) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
`included` decimal(19,6) NOT NULL DEFAULT '0.000000',
`is_hidden` tinyint(4) NOT NULL DEFAULT '1',
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
`deleted_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `tblusage_items_rel_type_id` (`rel_type`,`rel_id`),
KEY `tblusage_items_module_type` (`module_type`),
KEY `tblusage_items_module` (`module`),
KEY `tblusage_items_metric` (`metric`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
|
<reponame>NimbusServices/SAEON.ObservationsDatabase
insert into SchemaColumnType
(Name, Description, UserId)
values
('Latitude','A latitude column',(Select UserID from aspnet_Users where (UserName = 'TimPN'))),
('Longitude','A longitude column',(Select UserID from aspnet_Users where (UserName = 'TimPN'))),
('Elevation','An elevation column, negative for below sea level',(Select UserID from aspnet_Users where (UserName = 'TimPN')))
Print 'Done'
|
<gh_stars>0
SELECT
id
FROM
northwind.products
ORDER BY id DESC
LIMIT 5;
|
CREATE TABLE chores (
id SERIAL PRIMARY KEY,
title text,
person text,
due_date date,
done_at timestamp
);
INSERT INTO chores (title, person, due_date) VALUES
(
'Make your bed',
'Lily',
NOW()
),
(
'Make your bed',
'Larry',
NOW()
),
(
'Feed Pippin',
'Lily',
NOW()
),
(
'Set the table',
'Larry',
NOW()
)
;
|
<gh_stars>0
DROP TABLE pCustomer CASCADE CONSTRAINTS PURGE;
DROP TABLE County CASCADE CONSTRAINTS PURGE;
DROP TABLE Courier CASCADE CONSTRAINTS PURGE;
DROP TABLE Parcel CASCADE CONSTRAINTS PURGE;
CREATE TABLE pCustomer
(
cNo NUMBER(6) NOT NULL ,
cName VARCHAR2(30) NOT NULL ,
street VARCHAR2(30) NOT NULL ,
city VARCHAR2(30) NOT NULL ,
countyID NUMBER (6) NOT NULL ,
phone VARCHAR2 (30) NOT NULL ,
email VARCHAR2(20) NOT NULL CHECK (email LIKE '%@%') ,
CONSTRAINT PCustomer_PK PRIMARY KEY (cNo)
);
CREATE TABLE County
(
countyID NUMBER(6) NOT NULL ,
countyName VARCHAR2(30) NOT NULL ,
CONSTRAINT County_PK PRIMARY KEY (countyID)
);
CREATE TABLE Courier
(
cID NUMBER(6) NOT NULL ,
fName VARCHAR2(30) NOT NULL ,
surname VARCHAR2(30)NOT NULL ,
salary NUMBER(7,2) NOT NULL ,
CONSTRAINT Courier_PK PRIMARY KEY (cID)
);
CREATE TABLE Parcel
(
pNo NUMBER(6) NOT NULL ,
courierID NUMBER(6) NOT NULL ,
custNo DATE NOT NULL ,
pdate DATE NOT NULL ,
pvalue NUMBER (7,2) NOT NULL ,
deliveryStatus VARCHAR (1) NOT NULL CHECK (deliveryStatus LIKE 'Y' OR deliveryStatus LIKE 'N') ,
CONSTRAINT Parcel_PK PRIMARY KEY (pNo)
);
INSERT INTO pCustomer VALUES (1, '<NAME>', '<NAME>', 'Dublin', 1, '(01) 819 2300', '<EMAIL>'); |
<filename>GRA.Database/dbo/Stored Procedures/app_MGMixAndMatch_Update.sql
/****** Object: StoredProcedure [dbo].[app_MGMixAndMatch_Update] Script Date: 01/05/2015 14:43:22 ******/
--Create the Update Proc
CREATE PROCEDURE [dbo].[app_MGMixAndMatch_Update] (
@MMID INT,
@MGID INT,
@CorrectRoundsToWinCount INT,
@EnableMediumDifficulty BIT,
@EnableHardDifficulty BIT,
@LastModDate DATETIME,
@LastModUser VARCHAR(50),
@AddedDate DATETIME,
@AddedUser VARCHAR(50)
)
AS
UPDATE MGMixAndMatch
SET MGID = @MGID,
CorrectRoundsToWinCount = @CorrectRoundsToWinCount,
EnableMediumDifficulty = @EnableMediumDifficulty,
EnableHardDifficulty = @EnableHardDifficulty,
LastModDate = @LastModDate,
LastModUser = @LastModUser,
AddedDate = @AddedDate,
AddedUser = @AddedUser
WHERE MMID = @MMID
|
<filename>hair_salon_test.sql
-- phpMyAdmin SQL Dump
-- version 4.6.5.1
-- https://www.phpmyadmin.net/
--
-- Host: localhost:8889
-- Generation Time: Mar 05, 2017 at 09:08 AM
-- Server version: 5.6.34
-- PHP Version: 7.1.0
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Database: `hair_salon_test`
--
CREATE DATABASE IF NOT EXISTS `hair_salon_test` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
USE `hair_salon_test`;
-- --------------------------------------------------------
--
-- Table structure for table `clients`
--
CREATE TABLE `clients` (
`name` varchar(255) DEFAULT NULL,
`stylist_id` bigint(11) DEFAULT NULL,
`id` bigint(20) UNSIGNED NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT;
-- --------------------------------------------------------
--
-- Table structure for table `stylists`
--
CREATE TABLE `stylists` (
`stylist_name` varchar(255) DEFAULT NULL,
`id` bigint(20) UNSIGNED NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT;
--
-- Indexes for dumped tables
--
--
-- Indexes for table `clients`
--
ALTER TABLE `clients`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `id` (`id`);
--
-- Indexes for table `stylists`
--
ALTER TABLE `stylists`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `id` (`id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `clients`
--
ALTER TABLE `clients`
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=300;
--
-- AUTO_INCREMENT for table `stylists`
--
ALTER TABLE `stylists`
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=444;
/*!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 */;
|
<reponame>affinitas/pg_dml_audit<gh_stars>1-10
--
-- save full tabel as json-array
-- SET search_path TO _pg_dml_audit_model;
--
CREATE OR REPLACE FUNCTION if_modified_func()
RETURNS TRIGGER AS $body$
DECLARE
audit_row _pg_dml_audit_model.events;
query_text TEXT;
all_rows JSON [] := '{}';
anyrow RECORD;
BEGIN
IF TG_WHEN <> 'AFTER' AND TG_OP != 'TRUNCATE'
THEN
RAISE EXCEPTION 'if_modified_func() may only run as an AFTER trigger';
END IF;
audit_row.nspname = TG_TABLE_SCHEMA :: TEXT;
audit_row.relname = TG_TABLE_NAME :: TEXT;
audit_row.usename = SESSION_USER :: TEXT;
audit_row.trans_ts = transaction_timestamp();
audit_row.trans_id = txid_current();
audit_row.trans_sq = 1;
audit_row.operation = TG_OP;
audit_row.rowdata = NULL;
IF (TG_OP = 'UPDATE')
THEN
audit_row.rowdata = array_to_json(ARRAY [row_to_json(OLD), row_to_json(NEW)]); -- save both rows
ELSIF (TG_OP = 'DELETE')
THEN
audit_row.rowdata = array_to_json(ARRAY [row_to_json(OLD)]); -- save old row
ELSIF (TG_OP = 'INSERT')
THEN
audit_row.rowdata = array_to_json(ARRAY [row_to_json(NEW)]); -- save new row
ELSIF (TG_OP = 'TRUNCATE')
THEN -- save all rows
query_text = 'SELECT * FROM ' || quote_ident(TG_TABLE_SCHEMA) || '.' || quote_ident(TG_TABLE_NAME);
FOR anyrow IN EXECUTE query_text LOOP
all_rows = all_rows || row_to_json(anyrow);
END LOOP;
audit_row.rowdata = array_to_json(all_rows);
ELSE
RAISE EXCEPTION '[if_modified_func] - Trigger func added as trigger for unhandled case: %, %', TG_OP, TG_LEVEL;
RETURN NULL;
END IF;
-- multiple events in the same transaction must be ordered
LOOP
BEGIN
INSERT INTO _pg_dml_audit_model.events (
nspname, relname, usename, trans_ts, trans_id, trans_sq, operation, rowdata)
VALUES (
audit_row.nspname, audit_row.relname, audit_row.usename, audit_row.trans_ts, audit_row.trans_id,
audit_row.trans_sq, audit_row.operation, audit_row.rowdata);
EXIT; -- successful insert
EXCEPTION WHEN unique_violation
THEN
-- add and loop to try the UPDATE again
audit_row.trans_sq := audit_row.trans_sq + 1;
END;
END LOOP;
RETURN NULL;
END;
$body$
LANGUAGE plpgsql
SECURITY DEFINER;
COMMENT ON FUNCTION if_modified_func() IS $body$
Track changes to a table at the row level.
Note that the user name logged is the login role for the session. The audit trigger
cannot obtain the active role because it is reset by the SECURITY DEFINER invocation
of the audit trigger itself.
$body$;
|
<filename>packages/inflection/verify/schemas/inflection/procedures/singular.sql
-- Verify schemas/inflection/procedures/singular on pg
BEGIN;
SELECT verify_function ('inflection.singular');
ROLLBACK;
|
UPDATE _database_test SET n=0;
|
/****** Object: Table [DbScriptMigration] ******/
IF OBJECT_ID (N'DbScriptMigration', N'U') IS NULL
BEGIN
CREATE TABLE [dbo].[DbScriptMigration](
[MigrationId] [uniqueidentifier] NOT NULL,
[MigrationName] [nvarchar](250) NOT NULL,
[MigrationDate] [datetime] NOT NULL,
CONSTRAINT [PK_DbScriptMigration] PRIMARY KEY CLUSTERED
(
[MigrationId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
PRINT 'Create table [DbScriptMigration]!'
END
/****** Object: Index [IX_DbScriptMigrationName] ******/
IF NOT EXISTS (SELECT * FROM sys.indexes
WHERE name='IX_DbScriptMigrationName' AND object_id = OBJECT_ID('dbo.DbScriptMigration'))
BEGIN
CREATE UNIQUE NONCLUSTERED INDEX [IX_DbScriptMigrationName] ON [dbo].[DbScriptMigration]
(
[MigrationName] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
PRINT 'Create index [IX_DbScriptMigrationName]!'
END
DECLARE @MigrationName AS VARCHAR(1000) = '000_CreateDbMigration'
IF NOT EXISTS (SELECT * FROM [dbo].[DbScriptMigration] WHERE [MigrationName]=@MigrationName )
BEGIN
INSERT INTO [DbScriptMigration]
(MigrationId, MigrationName, MigrationDate)
VALUES
(NEWID(), @MigrationName, GETDATE())
PRINT 'Insert record ''000_CreateDbMigration'' into [DbScriptMigration]!'
END |
<gh_stars>10-100
DROP TABLE IF EXISTS `church_location`;
CREATE TABLE `church_location` (
`location_id` INT NOT NULL,
`location_typeId` INT NOT NULL,
`location_name` VARCHAR(256) NOT NULL,
`location_address` VARCHAR(45) NOT NULL,
`location_city` VARCHAR(45) NOT NULL,
`location_state` VARCHAR(45) NOT NULL,
`location_zip` VARCHAR(45) NOT NULL,
`location_country` VARCHAR(45) NOT NULL,
`location_phone` VARCHAR(45) NULL,
`location_email` VARCHAR(45) NULL,
`location_timzezone` VARCHAR(45) NULL,
PRIMARY KEY (`location_id`)
) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_unicode_ci;
DROP TABLE IF EXISTS `church_location_person`;
CREATE TABLE `church_location_person` (
`location_id` INT NOT NULL,
`person_id` INT NOT NULL,
`order` INT NOT NULL,
`person_location_role_id` INT NOT NULL, #This will be referenced to user-defined roles such as clergey, pastor, member, etc for non-denominational use
PRIMARY KEY (`location_id`, `person_id`)
) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_unicode_ci;
DROP TABLE IF EXISTS `church_location_role`;
CREATE TABLE `church_location_role` (
`location_id` INT NOT NULL,
`role_id` INT NOT NULL,
`role_order` INT NOT NULL,
`role_title` INT NOT NULL, #Thi
PRIMARY KEY (`location_id`, `role_id`)
) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_unicode_ci;
|
<gh_stars>10-100
-- file:rowtypes.sql ln:74 expect:true
select (fn).first, substr((fn).last, 1, 20), length((fn).last) from people
|
<gh_stars>100-1000
CREATE TABLE list (id VARCHAR(10) NOT NULL, value VARCHAR(64) NOT NULL, PRIMARY KEY(id));
INSERT INTO "list" ("id", "value") VALUES ('AFA', 'Afegane (1927–2002)');
INSERT INTO "list" ("id", "value") VALUES ('AFN', 'Afegane afegão');
INSERT INTO "list" ("id", "value") VALUES ('MGA', 'Ariary malgaxe');
INSERT INTO "list" ("id", "value") VALUES ('ARA', 'Austral argentino');
INSERT INTO "list" ("id", "value") VALUES ('THB', 'Baht tailandês');
INSERT INTO "list" ("id", "value") VALUES ('PAB', 'Balboa panamenha');
INSERT INTO "list" ("id", "value") VALUES ('ETB', 'Birr etíope');
INSERT INTO "list" ("id", "value") VALUES ('BOB', 'Boliviano');
INSERT INTO "list" ("id", "value") VALUES ('BOL', 'Boliviano (1863–1963)');
INSERT INTO "list" ("id", "value") VALUES ('VEF', 'Bolívar venezuelano');
INSERT INTO "list" ("id", "value") VALUES ('VEB', 'Bolívar venezuelano (1871–2008)');
INSERT INTO "list" ("id", "value") VALUES ('GHC', 'Cedi de Gana (1979–2007)');
INSERT INTO "list" ("id", "value") VALUES ('GHS', 'Cedi ganês');
INSERT INTO "list" ("id", "value") VALUES ('SVC', 'Colom salvadorenho');
INSERT INTO "list" ("id", "value") VALUES ('CRC', 'Colón costarriquenho');
INSERT INTO "list" ("id", "value") VALUES ('CSK', 'Coroa Forte checoslovaca');
INSERT INTO "list" ("id", "value") VALUES ('ISJ', 'Coroa antiga islandesa');
INSERT INTO "list" ("id", "value") VALUES ('DKK', 'Coroa dinamarquesa');
INSERT INTO "list" ("id", "value") VALUES ('SKK', 'Coroa eslovaca');
INSERT INTO "list" ("id", "value") VALUES ('EEK', 'Coroa estoniana');
INSERT INTO "list" ("id", "value") VALUES ('ISK', 'Coroa islandesa');
INSERT INTO "list" ("id", "value") VALUES ('NOK', 'Coroa norueguesa');
INSERT INTO "list" ("id", "value") VALUES ('SEK', 'Coroa sueca');
INSERT INTO "list" ("id", "value") VALUES ('CZK', 'Coroa tcheca');
INSERT INTO "list" ("id", "value") VALUES ('BRC', 'Cruzado brasileiro (1986–1989)');
INSERT INTO "list" ("id", "value") VALUES ('BRN', 'Cruzado novo brasileiro (1989–1990)');
INSERT INTO "list" ("id", "value") VALUES ('BRZ', 'Cruzeiro brasileiro (1942–1967)');
INSERT INTO "list" ("id", "value") VALUES ('BRE', 'Cruzeiro brasileiro (1990–1993)');
INSERT INTO "list" ("id", "value") VALUES ('BRR', 'Cruzeiro brasileiro (1993–1994)');
INSERT INTO "list" ("id", "value") VALUES ('BRB', 'Cruzeiro novo brasileiro (1967–1986)');
INSERT INTO "list" ("id", "value") VALUES ('ZMK', 'Cuacha zambiano (1968–2012)');
INSERT INTO "list" ("id", "value") VALUES ('AOK', 'Cuanza angolano (1977–1990)');
INSERT INTO "list" ("id", "value") VALUES ('AOR', 'Cuanza angolano reajustado (1995–1999)');
INSERT INTO "list" ("id", "value") VALUES ('GEK', 'Cupom Lari georgiano');
INSERT INTO "list" ("id", "value") VALUES ('MDC', '<NAME>');
INSERT INTO "list" ("id", "value") VALUES ('NIO', 'Córdoba nicaraguense');
INSERT INTO "list" ("id", "value") VALUES ('NIC', 'Córdoba nicaraguense (1988–1991)');
INSERT INTO "list" ("id", "value") VALUES ('GMD', '<NAME>');
INSERT INTO "list" ("id", "value") VALUES ('DZD', 'Dinar argelino');
INSERT INTO "list" ("id", "value") VALUES ('BHD', '<NAME>');
INSERT INTO "list" ("id", "value") VALUES ('YUN', 'Dinar conversível iugoslavo (1990–1992)');
INSERT INTO "list" ("id", "value") VALUES ('HRD', '<NAME>');
INSERT INTO "list" ("id", "value") VALUES ('BAD', 'Dinar da Bósnia-Herzegovina (1992–1994)');
INSERT INTO "list" ("id", "value") VALUES ('YUD', 'Dinar forte iugoslavo (1966–1990)');
INSERT INTO "list" ("id", "value") VALUES ('YDD', 'Dinar iemenita');
INSERT INTO "list" ("id", "value") VALUES ('IQD', '<NAME>');
INSERT INTO "list" ("id", "value") VALUES ('JOD', '<NAME>');
INSERT INTO "list" ("id", "value") VALUES ('KWD', '<NAME>');
INSERT INTO "list" ("id", "value") VALUES ('LYD', '<NAME>');
INSERT INTO "list" ("id", "value") VALUES ('MKD', 'Dinar macedônio');
INSERT INTO "list" ("id", "value") VALUES ('MKN', 'Dinar macedônio (1992–1993)');
INSERT INTO "list" ("id", "value") VALUES ('YUM', 'Dinar noviy iugoslavo (1994–2002)');
INSERT INTO "list" ("id", "value") VALUES ('YUR', 'Dinar reformado iugoslavo (1992–1993)');
INSERT INTO "list" ("id", "value") VALUES ('SDD', 'Dinar sudanês (1992–2007)');
INSERT INTO "list" ("id", "value") VALUES ('RSD', 'Dinar sérvio');
INSERT INTO "list" ("id", "value") VALUES ('CSD', 'Dinar sérvio (2002–2006)');
INSERT INTO "list" ("id", "value") VALUES ('TND', 'Dinar tunisiano');
INSERT INTO "list" ("id", "value") VALUES ('AED', 'Dirrã dos Emirados Árabes Unidos');
INSERT INTO "list" ("id", "value") VALUES ('MAD', 'Dirrã marroquino');
INSERT INTO "list" ("id", "value") VALUES ('STD', 'Dobra de São Tomé e Príncipe');
INSERT INTO "list" ("id", "value") VALUES ('VND', 'Dong vietnamita');
INSERT INTO "list" ("id", "value") VALUES ('VNN', 'Dong vietnamita (1978–1985)');
INSERT INTO "list" ("id", "value") VALUES ('GRD', 'Dracma grego');
INSERT INTO "list" ("id", "value") VALUES ('AMD', 'Dram armênio');
INSERT INTO "list" ("id", "value") VALUES ('USD', 'Dólar americano');
INSERT INTO "list" ("id", "value") VALUES ('AUD', 'Dólar australiano');
INSERT INTO "list" ("id", "value") VALUES ('BSD', 'Dólar bahamense');
INSERT INTO "list" ("id", "value") VALUES ('BBD', 'Dólar barbadense');
INSERT INTO "list" ("id", "value") VALUES ('BZD', 'Dólar belizenho');
INSERT INTO "list" ("id", "value") VALUES ('BMD', 'Dólar bermudense');
INSERT INTO "list" ("id", "value") VALUES ('BND', 'Dólar bruneano');
INSERT INTO "list" ("id", "value") VALUES ('CAD', 'Dólar canadense');
INSERT INTO "list" ("id", "value") VALUES ('KYD', 'Dólar das Ilhas Caiman');
INSERT INTO "list" ("id", "value") VALUES ('SBD', 'Dólar das Ilhas Salomão');
INSERT INTO "list" ("id", "value") VALUES ('HKD', 'Dólar de Hong Kong');
INSERT INTO "list" ("id", "value") VALUES ('TTD', 'Dólar de Trinidad e Tobago');
INSERT INTO "list" ("id", "value") VALUES ('CNX', 'Dólar do Banco Popular da China');
INSERT INTO "list" ("id", "value") VALUES ('XCD', 'Dólar do Caribe Oriental');
INSERT INTO "list" ("id", "value") VALUES ('ZWD', 'Dólar do Zimbábue (1980–2008)');
INSERT INTO "list" ("id", "value") VALUES ('ZWR', 'Dólar do Zimbábue (2008)');
INSERT INTO "list" ("id", "value") VALUES ('ZWL', 'Dólar do Zimbábue (2009)');
INSERT INTO "list" ("id", "value") VALUES ('FJD', 'Dólar fijiano');
INSERT INTO "list" ("id", "value") VALUES ('GYD', 'Dólar guianense');
INSERT INTO "list" ("id", "value") VALUES ('JMD', 'Dólar jamaicano');
INSERT INTO "list" ("id", "value") VALUES ('LRD', 'Dólar liberiano');
INSERT INTO "list" ("id", "value") VALUES ('NAD', 'Dólar namibiano');
INSERT INTO "list" ("id", "value") VALUES ('NZD', 'Dólar neozelandês');
INSERT INTO "list" ("id", "value") VALUES ('USN', 'Dólar norte-americano (Dia seguinte)');
INSERT INTO "list" ("id", "value") VALUES ('USS', 'Dólar norte-americano (Mesmo dia)');
INSERT INTO "list" ("id", "value") VALUES ('RHD', 'Dólar rodesiano');
INSERT INTO "list" ("id", "value") VALUES ('SGD', 'Dólar singapuriano');
INSERT INTO "list" ("id", "value") VALUES ('SRD', 'Dólar surinamês');
INSERT INTO "list" ("id", "value") VALUES ('GQE', 'Ekwele da Guiné Equatorial');
INSERT INTO "list" ("id", "value") VALUES ('CVE', 'Escudo cabo-verdiano');
INSERT INTO "list" ("id", "value") VALUES ('CLE', 'Escudo chileno');
INSERT INTO "list" ("id", "value") VALUES ('GWE', 'Escudo da Guiné Portuguesa');
INSERT INTO "list" ("id", "value") VALUES ('MZE', 'Escudo de Moçambique');
INSERT INTO "list" ("id", "value") VALUES ('PTE', 'Escudo português');
INSERT INTO "list" ("id", "value") VALUES ('TPE', 'Escudo timorense');
INSERT INTO "list" ("id", "value") VALUES ('EUR', 'Euro');
INSERT INTO "list" ("id", "value") VALUES ('CHE', 'Euro WIR');
INSERT INTO "list" ("id", "value") VALUES ('AWG', 'Florim arubano');
INSERT INTO "list" ("id", "value") VALUES ('ANG', 'Florim das Antilhas Holandesas');
INSERT INTO "list" ("id", "value") VALUES ('SRG', 'Florim do Suriname');
INSERT INTO "list" ("id", "value") VALUES ('NLG', 'Florim holandês');
INSERT INTO "list" ("id", "value") VALUES ('HUF', 'Forint húngaro');
INSERT INTO "list" ("id", "value") VALUES ('XOF', 'Franco CFA de BCEAO');
INSERT INTO "list" ("id", "value") VALUES ('XAF', 'Franco CFA de BEAC');
INSERT INTO "list" ("id", "value") VALUES ('XPF', 'Franco CFP');
INSERT INTO "list" ("id", "value") VALUES ('XFU', 'Franco UIC francês');
INSERT INTO "list" ("id", "value") VALUES ('CHW', 'Franco WIR');
INSERT INTO "list" ("id", "value") VALUES ('BEF', 'Franco belga');
INSERT INTO "list" ("id", "value") VALUES ('BEC', 'Franco belga (conversível)');
INSERT INTO "list" ("id", "value") VALUES ('BEL', 'Franco belga (financeiro)');
INSERT INTO "list" ("id", "value") VALUES ('BIF', 'Franco burundiano');
INSERT INTO "list" ("id", "value") VALUES ('KMF', 'Franco comorense');
INSERT INTO "list" ("id", "value") VALUES ('CDF', 'Franco congolês');
INSERT INTO "list" ("id", "value") VALUES ('LUC', 'Franco conversível de Luxemburgo');
INSERT INTO "list" ("id", "value") VALUES ('MGF', 'Franco de Madagascar');
INSERT INTO "list" ("id", "value") VALUES ('MLF', 'Franco de Mali');
INSERT INTO "list" ("id", "value") VALUES ('DJF', 'Franco djibutiense');
INSERT INTO "list" ("id", "value") VALUES ('LUL', 'Franco financeiro de Luxemburgo');
INSERT INTO "list" ("id", "value") VALUES ('FRF', 'Franco francês');
INSERT INTO "list" ("id", "value") VALUES ('GNF', 'Franco guineano');
INSERT INTO "list" ("id", "value") VALUES ('LUF', 'Franco luxemburguês');
INSERT INTO "list" ("id", "value") VALUES ('MAF', 'Franco marroquino');
INSERT INTO "list" ("id", "value") VALUES ('MCF', 'Franco monegasco');
INSERT INTO "list" ("id", "value") VALUES ('RWF', 'Franco ruandês');
INSERT INTO "list" ("id", "value") VALUES ('CHF', 'Franco suíço');
INSERT INTO "list" ("id", "value") VALUES ('XFO', 'Franco-ouro francês');
INSERT INTO "list" ("id", "value") VALUES ('XRE', 'Fundos RINET');
INSERT INTO "list" ("id", "value") VALUES ('HTG', 'Gourde haitiano');
INSERT INTO "list" ("id", "value") VALUES ('PYG', 'Guarani paraguaio');
INSERT INTO "list" ("id", "value") VALUES ('UAH', 'Hryvnia ucraniano');
INSERT INTO "list" ("id", "value") VALUES ('KRH', 'Hwan da Coreia do Sul (1953–1962)');
INSERT INTO "list" ("id", "value") VALUES ('JPY', 'Iene japonês');
INSERT INTO "list" ("id", "value") VALUES ('PEI', 'Inti peruano');
INSERT INTO "list" ("id", "value") VALUES ('UAK', 'Karbovanetz ucraniano');
INSERT INTO "list" ("id", "value") VALUES ('PGK', 'Kina papuásia');
INSERT INTO "list" ("id", "value") VALUES ('LAK', 'Kip laosiano');
INSERT INTO "list" ("id", "value") VALUES ('HRK', 'Kuna croata');
INSERT INTO "list" ("id", "value") VALUES ('MWK', 'Kwacha malawiana');
INSERT INTO "list" ("id", "value") VALUES ('ZMW', 'Kwacha zambiano');
INSERT INTO "list" ("id", "value") VALUES ('AOA', 'Kwanza angolano');
INSERT INTO "list" ("id", "value") VALUES ('BUK', 'Kyat birmanês');
INSERT INTO "list" ("id", "value") VALUES ('MMK', 'Kyat mianmarense');
INSERT INTO "list" ("id", "value") VALUES ('GEL', 'Lari georgiano');
INSERT INTO "list" ("id", "value") VALUES ('LVL', 'Lats letão');
INSERT INTO "list" ("id", "value") VALUES ('ALK', 'Lek Albanês (1946–1965)');
INSERT INTO "list" ("id", "value") VALUES ('ALL', 'Lek albanês');
INSERT INTO "list" ("id", "value") VALUES ('HNL', 'Lempira hondurenha');
INSERT INTO "list" ("id", "value") VALUES ('SLL', 'Leone de Serra Leoa');
INSERT INTO "list" ("id", "value") VALUES ('MDL', 'Leu moldávio');
INSERT INTO "list" ("id", "value") VALUES ('RON', 'Leu romeno');
INSERT INTO "list" ("id", "value") VALUES ('ROL', 'Leu romeno (1952–2006)');
INSERT INTO "list" ("id", "value") VALUES ('BGN', 'Lev búlgaro');
INSERT INTO "list" ("id", "value") VALUES ('BGO', 'Lev búlgaro (1879–1952)');
INSERT INTO "list" ("id", "value") VALUES ('BGL', 'Lev forte búlgaro');
INSERT INTO "list" ("id", "value") VALUES ('BGM', 'Lev socialista búlgaro');
INSERT INTO "list" ("id", "value") VALUES ('GBP', 'Libra britânica');
INSERT INTO "list" ("id", "value") VALUES ('CYP', 'Libra cipriota');
INSERT INTO "list" ("id", "value") VALUES ('GIP', 'Libra de Gibraltar');
INSERT INTO "list" ("id", "value") VALUES ('SHP', 'Libra de Santa Helena');
INSERT INTO "list" ("id", "value") VALUES ('EGP', 'Libra egípcia');
INSERT INTO "list" ("id", "value") VALUES ('IEP', 'Libra irlandesa');
INSERT INTO "list" ("id", "value") VALUES ('ILP', 'Libra israelita');
INSERT INTO "list" ("id", "value") VALUES ('LBP', 'Libra libanesa');
INSERT INTO "list" ("id", "value") VALUES ('MTP', 'Libra maltesa');
INSERT INTO "list" ("id", "value") VALUES ('FKP', 'Libra malvinense');
INSERT INTO "list" ("id", "value") VALUES ('SDG', 'Libra sudanesa');
INSERT INTO "list" ("id", "value") VALUES ('SDP', 'Libra sudanesa (1957–1998)');
INSERT INTO "list" ("id", "value") VALUES ('SSP', 'Libra sul-sudanesa');
INSERT INTO "list" ("id", "value") VALUES ('SYP', 'Libra síria');
INSERT INTO "list" ("id", "value") VALUES ('SZL', 'Lilangeni suazi');
INSERT INTO "list" ("id", "value") VALUES ('ITL', 'Lira italiana');
INSERT INTO "list" ("id", "value") VALUES ('MTL', 'Lira maltesa');
INSERT INTO "list" ("id", "value") VALUES ('TRY', 'Lira turca');
INSERT INTO "list" ("id", "value") VALUES ('TRL', 'Lira turca (1922–2005)');
INSERT INTO "list" ("id", "value") VALUES ('LTL', 'Litas lituano');
INSERT INTO "list" ("id", "value") VALUES ('LSL', 'Loti do Lesoto');
INSERT INTO "list" ("id", "value") VALUES ('MVP', 'Maldivian Rupee (1947–1981)');
INSERT INTO "list" ("id", "value") VALUES ('AZM', 'Manat azerbaijano (1993–2006)');
INSERT INTO "list" ("id", "value") VALUES ('AZN', 'Manat azeri');
INSERT INTO "list" ("id", "value") VALUES ('TMM', 'Manat do Turcomenistão (1993–2009)');
INSERT INTO "list" ("id", "value") VALUES ('TMT', 'Manat turcomeno');
INSERT INTO "list" ("id", "value") VALUES ('FIM', 'Marca finlandesa');
INSERT INTO "list" ("id", "value") VALUES ('DEM', 'Marco alemão');
INSERT INTO "list" ("id", "value") VALUES ('BAM', 'Marco bósnio-herzegovino conversível');
INSERT INTO "list" ("id", "value") VALUES ('MZM', 'Metical de Moçambique (1980–2006)');
INSERT INTO "list" ("id", "value") VALUES ('MZN', 'Metical moçambicano');
INSERT INTO "list" ("id", "value") VALUES ('BOV', 'Mvdol boliviano');
INSERT INTO "list" ("id", "value") VALUES ('NGN', 'Naira nigeriana');
INSERT INTO "list" ("id", "value") VALUES ('ERN', 'Nakfa da Eritreia');
INSERT INTO "list" ("id", "value") VALUES ('BTN', 'Ngultrum butanês');
INSERT INTO "list" ("id", "value") VALUES ('AON', 'Novo cuanza angolano (1990–2000)');
INSERT INTO "list" ("id", "value") VALUES ('BAN', 'Novo dinar da Bósnia-Herzegovina (1994–1997)');
INSERT INTO "list" ("id", "value") VALUES ('TWD', 'Novo dólar taiwanês');
INSERT INTO "list" ("id", "value") VALUES ('DDM', 'Ostmark da Alemanha Oriental');
INSERT INTO "list" ("id", "value") VALUES ('MRO', 'Ouguiya mauritana');
INSERT INTO "list" ("id", "value") VALUES ('MOP', 'Pataca macaense');
INSERT INTO "list" ("id", "value") VALUES ('TOP', 'Paʻanga tonganesa');
INSERT INTO "list" ("id", "value") VALUES ('ADP', 'Peseta de Andorra');
INSERT INTO "list" ("id", "value") VALUES ('ESP', 'Peseta espanhola');
INSERT INTO "list" ("id", "value") VALUES ('ESA', 'Peseta espanhola (conta A)');
INSERT INTO "list" ("id", "value") VALUES ('ESB', 'Peseta espanhola (conta conversível)');
INSERT INTO "list" ("id", "value") VALUES ('MXP', 'Peso Prata mexicano (1861–1992)');
INSERT INTO "list" ("id", "value") VALUES ('ARS', 'Peso argentino');
INSERT INTO "list" ("id", "value") VALUES ('ARM', 'Peso argentino (1881–1970)');
INSERT INTO "list" ("id", "value") VALUES ('ARP', 'Peso argentino (1983–1985)');
INSERT INTO "list" ("id", "value") VALUES ('BOP', 'Peso boliviano');
INSERT INTO "list" ("id", "value") VALUES ('CLP', 'Peso chileno');
INSERT INTO "list" ("id", "value") VALUES ('COP', 'Peso colombiano');
INSERT INTO "list" ("id", "value") VALUES ('CUP', 'Peso cubano');
INSERT INTO "list" ("id", "value") VALUES ('CUC', 'Peso cubano conversível');
INSERT INTO "list" ("id", "value") VALUES ('GWP', 'Peso da Guiné-Bissau');
INSERT INTO "list" ("id", "value") VALUES ('DOP', 'Peso dominicano');
INSERT INTO "list" ("id", "value") VALUES ('PHP', 'Peso filipino');
INSERT INTO "list" ("id", "value") VALUES ('ARL', 'Peso lei argentino (1970–1983)');
INSERT INTO "list" ("id", "value") VALUES ('MXN', 'Peso mexicano');
INSERT INTO "list" ("id", "value") VALUES ('UYU', 'Peso uruguaio');
INSERT INTO "list" ("id", "value") VALUES ('UYP', 'Peso uruguaio (1975–1993)');
INSERT INTO "list" ("id", "value") VALUES ('UYI', 'Peso uruguaio en unidades indexadas');
INSERT INTO "list" ("id", "value") VALUES ('BWP', 'Pula botsuanesa');
INSERT INTO "list" ("id", "value") VALUES ('GTQ', 'Quetzal guatemalense');
INSERT INTO "list" ("id", "value") VALUES ('ZAR', '<NAME>');
INSERT INTO "list" ("id", "value") VALUES ('ZAL', 'Rand sul-africano (financeiro)');
INSERT INTO "list" ("id", "value") VALUES ('BRL', 'Real brasileiro');
INSERT INTO "list" ("id", "value") VALUES ('QAR', 'Rial catariano');
INSERT INTO "list" ("id", "value") VALUES ('YER', 'Rial iemenita');
INSERT INTO "list" ("id", "value") VALUES ('IRR', 'Rial iraniano');
INSERT INTO "list" ("id", "value") VALUES ('OMR', 'Rial omanense');
INSERT INTO "list" ("id", "value") VALUES ('KHR', 'Riel cambojano');
INSERT INTO "list" ("id", "value") VALUES ('MYR', 'Ringgit malaio');
INSERT INTO "list" ("id", "value") VALUES ('SAR', 'Riyal saudita');
INSERT INTO "list" ("id", "value") VALUES ('BYN', '<NAME>');
INSERT INTO "list" ("id", "value") VALUES ('BYR', '<NAME> (2000–2016)');
INSERT INTO "list" ("id", "value") VALUES ('TJR', 'Rublo do Tadjiquistão');
INSERT INTO "list" ("id", "value") VALUES ('LVR', 'Rublo letão');
INSERT INTO "list" ("id", "value") VALUES ('BYB', 'Rublo novo bielo-russo (1994–1999)');
INSERT INTO "list" ("id", "value") VALUES ('RUB', 'Rublo russo');
INSERT INTO "list" ("id", "value") VALUES ('RUR', 'Rublo russo (1991–1998)');
INSERT INTO "list" ("id", "value") VALUES ('SUR', '<NAME>');
INSERT INTO "list" ("id", "value") VALUES ('LKR', 'Rupia ceilandesa');
INSERT INTO "list" ("id", "value") VALUES ('INR', 'Rupia indiana');
INSERT INTO "list" ("id", "value") VALUES ('IDR', 'Rupia indonésia');
INSERT INTO "list" ("id", "value") VALUES ('MVR', 'Rupia maldiva');
INSERT INTO "list" ("id", "value") VALUES ('MUR', 'Rupia mauriciana');
INSERT INTO "list" ("id", "value") VALUES ('NPR', 'Rupia nepalesa');
INSERT INTO "list" ("id", "value") VALUES ('PKR', 'Rupia paquistanesa');
INSERT INTO "list" ("id", "value") VALUES ('SCR', 'Rupia seichelense');
INSERT INTO "list" ("id", "value") VALUES ('ILR', 'Sheqel antigo israelita');
INSERT INTO "list" ("id", "value") VALUES ('ILS', 'Sheqel novo israelita');
INSERT INTO "list" ("id", "value") VALUES ('PEN', 'Sol peruano');
INSERT INTO "list" ("id", "value") VALUES ('PES', 'Sol peruano (1863–1965)');
INSERT INTO "list" ("id", "value") VALUES ('KGS', 'Som quirguiz');
INSERT INTO "list" ("id", "value") VALUES ('UZS', 'Som uzbeque');
INSERT INTO "list" ("id", "value") VALUES ('TJS', 'Somoni tadjique');
INSERT INTO "list" ("id", "value") VALUES ('ECS', 'Sucre equatoriano');
INSERT INTO "list" ("id", "value") VALUES ('GNS', '<NAME>');
INSERT INTO "list" ("id", "value") VALUES ('BDT', 'Taka bengalesa');
INSERT INTO "list" ("id", "value") VALUES ('WST', 'Tala samoano');
INSERT INTO "list" ("id", "value") VALUES ('LTT', 'Talonas lituano');
INSERT INTO "list" ("id", "value") VALUES ('KZT', 'Tenge cazaque');
INSERT INTO "list" ("id", "value") VALUES ('SIT', '<NAME> esloveno');
INSERT INTO "list" ("id", "value") VALUES ('MNT', '<NAME>');
INSERT INTO "list" ("id", "value") VALUES ('MXV', 'Unidade Mexicana de Investimento (UDI)');
INSERT INTO "list" ("id", "value") VALUES ('XEU', 'Unidade de Moeda Europeia');
INSERT INTO "list" ("id", "value") VALUES ('ECV', 'Unidade de Valor Constante (UVC) do Equador');
INSERT INTO "list" ("id", "value") VALUES ('COU', 'Unidade de Valor Real');
INSERT INTO "list" ("id", "value") VALUES ('CLF', 'Unidades de Fomento chilenas');
INSERT INTO "list" ("id", "value") VALUES ('VUV', 'Vatu vanuatuense');
INSERT INTO "list" ("id", "value") VALUES ('KRO', 'Won da Coreia do Sul (1945–1953)');
INSERT INTO "list" ("id", "value") VALUES ('KPW', 'Won norte-coreano');
INSERT INTO "list" ("id", "value") VALUES ('KRW', 'Won sul-coreano');
INSERT INTO "list" ("id", "value") VALUES ('ATS', 'Xelim austríaco');
INSERT INTO "list" ("id", "value") VALUES ('KES', 'Xelim queniano');
INSERT INTO "list" ("id", "value") VALUES ('SOS', 'Xelim somaliano');
INSERT INTO "list" ("id", "value") VALUES ('TZS', 'Xelim tanzaniano');
INSERT INTO "list" ("id", "value") VALUES ('UGX', 'Xelim ugandense');
INSERT INTO "list" ("id", "value") VALUES ('UGS', 'Xelim ugandense (1966–1987)');
INSERT INTO "list" ("id", "value") VALUES ('CNY', 'Yuan chinês');
INSERT INTO "list" ("id", "value") VALUES ('ZRN', 'Zaire Novo zairense (1993–1998)');
INSERT INTO "list" ("id", "value") VALUES ('ZRZ', 'Zaire zairense (1971–1993)');
INSERT INTO "list" ("id", "value") VALUES ('PLN', 'Zloti polonês');
INSERT INTO "list" ("id", "value") VALUES ('PLZ', 'Zloti polonês (1950–1995)');
|
<reponame>NathanHowell/sqlfluff<filename>test/fixtures/parser/ansi/select_o.sql
-- Between and Not Between
-- https://github.com/sqlfluff/sqlfluff/issues/142
-- https://github.com/sqlfluff/sqlfluff/issues/478
SELECT
business_type
FROM
benchmark_summaries
WHERE
avg_click_rate NOT BETWEEN 0 and 1 + 1 + some_value
AND some_other_thing BETWEEN 0 - 1 * another_value and 1
|
<reponame>dram/metasfresh<filename>backend/de.metas.swat/de.metas.swat.base/src/main/sql/postgresql/system/48-de.metas.inoutcandidate/5563930_sys_gh7012ValidationMessagesAndNewProcess.sql
-- 2020-07-21T07:54:21.336Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Message (AD_Client_ID,AD_Message_ID,AD_Org_ID,Created,CreatedBy,EntityType,IsActive,MsgText,MsgType,Updated,UpdatedBy,Value) VALUES (0,544987,0,TO_TIMESTAMP('2020-07-21 10:54:21','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','Action not allowed. Shipment Schedule exported.','E',TO_TIMESTAMP('2020-07-21 10:54:21','YYYY-MM-DD HH24:MI:SS'),100,'webui.salesorder.shipmentschedule.exported.')
;
-- 2020-07-21T07:54:21.338Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language, t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Message t WHERE l.IsActive='Y'AND (l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N') AND t.AD_Message_ID=544987 AND NOT EXISTS (SELECT 1 FROM AD_Message_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Message_ID=t.AD_Message_ID)
;
-- 2020-07-21T07:54:49.689Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Message SET Value='salesorder.shipmentschedule.exported',Updated=TO_TIMESTAMP('2020-07-21 10:54:49','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Message_ID=544987
;
-- 2020-07-21T08:48:58.721Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Message SET EntityType='de.metas.inout',Updated=TO_TIMESTAMP('2020-07-21 11:48:58','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Message_ID=544987
;
-- 2020-07-21T08:53:06.080Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Message SET MsgText='Der Beleg kann nicht geändert werden, weil bereits Lieferdispo-Datensätze exportiert wurden.',Updated=TO_TIMESTAMP('2020-07-21 11:53:06','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Message_ID=544987
;
-- 2020-07-21T08:53:32.534Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Message_Trl SET IsTranslated='Y', MsgText='Changing the document is not allowed because shipment schedules were already exported.',Updated=TO_TIMESTAMP('2020-07-21 11:53:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Language='en_US' AND AD_Message_ID=544987
;
-- 2020-07-21T08:53:40.911Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Message_Trl SET MsgText='Der Beleg kann nicht geändert werden, weil bereits Lieferdispo-Datensätze exportiert wurden.',Updated=TO_TIMESTAMP('2020-07-21 11:53:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Language='de_CH' AND AD_Message_ID=544987
;
-- 2020-07-21T08:53:46.026Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Message_Trl SET MsgText='Der Beleg kann nicht geändert werden, weil bereits Lieferdispo-Datensätze exportiert wurden.',Updated=TO_TIMESTAMP('2020-07-21 11:53:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Language='de_DE' AND AD_Message_ID=544987
;
-- 2020-07-21T08:53:50.185Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Message_Trl SET MsgText='Changing the document is not allowed because shipment schedules were already exported.',Updated=TO_TIMESTAMP('2020-07-21 11:53:50','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Language='nl_NL' AND AD_Message_ID=544987
;
-- 2020-07-21T12:14:36.920Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Process (AccessLevel,AD_Client_ID,AD_Org_ID,AD_Process_ID,AllowProcessReRun,CopyFromProcess,Created,CreatedBy,EntityType,IsActive,IsApplySecuritySettings,IsBetaFunctionality,IsDirectPrint,IsNotifyUserAfterExecution,IsOneInstanceOnly,IsReport,IsServerProcess,IsTranslateExcelHeaders,IsUseBPartnerLanguage,LockWaitTimeout,Name,RefreshAllAfterExecution,ShowHelp,Type,Updated,UpdatedBy,Value) VALUES ('3',0,0,584729,'N','N',TO_TIMESTAMP('2020-07-21 15:14:36','YYYY-MM-DD HH24:MI:SS'),100,'U','Y','N','N','N','N','N','N','N','Y','Y',0,'Change Export Status','N','N','Java',TO_TIMESTAMP('2020-07-21 15:14:36','YYYY-MM-DD HH24:MI:SS'),100,'M_ShipmentSchedule_ChangeExportStatus')
;
-- 2020-07-21T12:14:36.925Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Process_Trl (AD_Language,AD_Process_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language, t.AD_Process_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Process t WHERE l.IsActive='Y'AND (l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N') AND t.AD_Process_ID=584729 AND NOT EXISTS (SELECT 1 FROM AD_Process_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Process_ID=t.AD_Process_ID)
;
-- 2020-07-21T12:15:21.524Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Process SET EntityType='de.metas.inoutcandidate',Updated=TO_TIMESTAMP('2020-07-21 15:15:21','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_ID=584729
;
-- 2020-07-21T12:16:37.842Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Process SET Classname='de.metas.inoutcandidate.process.M_ShipmentSchedule_ChangeExportStatus', Name=' Exportstatus Ändern',Updated=TO_TIMESTAMP('2020-07-21 15:16:37','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_ID=584729
;
-- 2020-07-21T12:16:48.097Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Process_Trl SET Name=' Exportstatus Ändern',Updated=TO_TIMESTAMP('2020-07-21 15:16:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Language='de_CH' AND AD_Process_ID=584729
;
-- 2020-07-21T12:16:50.992Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Process_Trl SET IsTranslated='Y',Updated=TO_TIMESTAMP('2020-07-21 15:16:50','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Language='en_US' AND AD_Process_ID=584729
;
-- 2020-07-21T12:18:43.693Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Process_Para (AD_Client_ID,AD_Element_ID,AD_Org_ID,AD_Process_ID,AD_Process_Para_ID,AD_Reference_ID,ColumnName,Created,CreatedBy,EntityType,FieldLength,IsActive,IsAutocomplete,IsCentrallyMaintained,IsEncrypted,IsMandatory,IsRange,Name,SeqNo,Updated,UpdatedBy) VALUES (0,577791,0,584729,541844,10,'ExportStatus',TO_TIMESTAMP('2020-07-21 15:18:43','YYYY-MM-DD HH24:MI:SS'),100,'de.metas.inoutcandidate',0,'Y','N','Y','N','Y','N','Export Status',10,TO_TIMESTAMP('2020-07-21 15:18:43','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2020-07-21T12:18:43.697Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Process_Para_Trl (AD_Language,AD_Process_Para_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language, t.AD_Process_Para_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Process_Para t WHERE l.IsActive='Y'AND (l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N') AND t.AD_Process_Para_ID=541844 AND NOT EXISTS (SELECT 1 FROM AD_Process_Para_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Process_Para_ID=t.AD_Process_Para_ID)
;
-- 2020-07-21T12:19:26.670Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Table_Process (AD_Client_ID,AD_Org_ID,AD_Process_ID,AD_Table_ID,AD_Table_Process_ID,Created,CreatedBy,EntityType,IsActive,Updated,UpdatedBy,WEBUI_DocumentAction,WEBUI_IncludedTabTopAction,WEBUI_ViewAction,WEBUI_ViewQuickAction,WEBUI_ViewQuickAction_Default) VALUES (0,0,584729,500221,540841,TO_TIMESTAMP('2020-07-21 15:19:26','YYYY-MM-DD HH24:MI:SS'),100,'de.metas.inoutcandidate','Y',TO_TIMESTAMP('2020-07-21 15:19:26','YYYY-MM-DD HH24:MI:SS'),100,'Y','Y','Y','N','N')
;
-- 2020-07-21T12:48:36.004Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Table_Process SET WEBUI_IncludedTabTopAction='N', WEBUI_ViewQuickAction='Y',Updated=TO_TIMESTAMP('2020-07-21 15:48:36','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Table_Process_ID=540841
;
-- 2020-07-21T12:49:38.584Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Process SET RefreshAllAfterExecution='Y',Updated=TO_TIMESTAMP('2020-07-21 15:49:38','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_ID=584729
;
-- 2020-07-21T12:49:50.963Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Process SET Name='Exportstatus Ändern',Updated=TO_TIMESTAMP('2020-07-21 15:49:50','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_ID=584729
;
-- 2020-07-21T12:50:16.482Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Process SET AccessLevel='7',Updated=TO_TIMESTAMP('2020-07-21 15:50:16','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_ID=584729
;
-- 2020-07-21T13:04:38.401Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Table_Process SET AD_Window_ID=540936,Updated=TO_TIMESTAMP('2020-07-21 16:04:38','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Table_Process_ID=540841
;
-- 2020-07-21T13:05:28.158Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Table_Process SET AD_Window_ID=NULL,Updated=TO_TIMESTAMP('2020-07-21 16:05:28','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Table_Process_ID=540841
;
-- 2020-07-21T13:30:04.774Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Reference (AD_Client_ID,AD_Org_ID,AD_Reference_ID,Created,CreatedBy,EntityType,IsActive,IsOrderByValue,Name,Updated,UpdatedBy,ValidationType) VALUES (0,0,541164,TO_TIMESTAMP('2020-07-21 16:30:04','YYYY-MM-DD HH24:MI:SS'),100,'de.metas.inoutcandidate','Y','N','ExportStatuses',TO_TIMESTAMP('2020-07-21 16:30:04','YYYY-MM-DD HH24:MI:SS'),100,'L')
;
-- 2020-07-21T13:30:04.778Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Reference_Trl (AD_Language,AD_Reference_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language, t.AD_Reference_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Reference t WHERE l.IsActive='Y'AND (l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N') AND t.AD_Reference_ID=541164 AND NOT EXISTS (SELECT 1 FROM AD_Reference_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Reference_ID=t.AD_Reference_ID)
;
-- 2020-07-21T13:30:43.257Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Ref_List (AD_Client_ID,AD_Org_ID,AD_Ref_List_ID,AD_Reference_ID,Created,CreatedBy,EntityType,IsActive,Name,Updated,UpdatedBy,Value,ValueName) VALUES (0,0,542167,541164,TO_TIMESTAMP('2020-07-21 16:30:43','YYYY-MM-DD HH24:MI:SS'),100,'de.metas.inoutcandidate','Y','PENDING',TO_TIMESTAMP('2020-07-21 16:30:43','YYYY-MM-DD HH24:MI:SS'),100,'P','PENDING')
;
-- 2020-07-21T13:30:43.259Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Ref_List_Trl (AD_Language,AD_Ref_List_ID, Description,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language, t.AD_Ref_List_ID, t.Description,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Ref_List t WHERE l.IsActive='Y'AND (l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N') AND t.AD_Ref_List_ID=542167 AND NOT EXISTS (SELECT 1 FROM AD_Ref_List_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Ref_List_ID=t.AD_Ref_List_ID)
;
-- 2020-07-21T13:31:09.128Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Ref_List (AD_Client_ID,AD_Org_ID,AD_Ref_List_ID,AD_Reference_ID,Created,CreatedBy,EntityType,IsActive,Name,Updated,UpdatedBy,Value,ValueName) VALUES (0,0,542168,541164,TO_TIMESTAMP('2020-07-21 16:31:08','YYYY-MM-DD HH24:MI:SS'),100,'de.metas.inoutcandidate','Y','DONT_EXPORT',TO_TIMESTAMP('2020-07-21 16:31:08','YYYY-MM-DD HH24:MI:SS'),100,'DE','DONT_EXPORT')
;
-- 2020-07-21T13:31:09.128Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Ref_List_Trl (AD_Language,AD_Ref_List_ID, Description,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language, t.AD_Ref_List_ID, t.Description,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Ref_List t WHERE l.IsActive='Y'AND (l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N') AND t.AD_Ref_List_ID=542168 AND NOT EXISTS (SELECT 1 FROM AD_Ref_List_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Ref_List_ID=t.AD_Ref_List_ID)
;
-- 2020-07-21T13:32:04.288Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Process_Para SET AD_Reference_ID=19,Updated=TO_TIMESTAMP('2020-07-21 16:32:04','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=541844
;
-- 2020-07-21T13:33:02.789Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Process_Para SET AD_Reference_ID=17, AD_Reference_Value_ID=541164,Updated=TO_TIMESTAMP('2020-07-21 16:33:02','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=541844
;
-- 2020-07-21T13:43:04.230Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Ref_List SET Name='DE', Value='DONT_EXPORT',Updated=TO_TIMESTAMP('2020-07-21 16:43:04','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Ref_List_ID=542168
;
-- 2020-07-21T13:43:14.949Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Ref_List SET Name='P', Value='PENDING',Updated=TO_TIMESTAMP('2020-07-21 16:43:14','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Ref_List_ID=542167
;
-- 2020-07-21T14:02:25.390Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Message (AD_Client_ID,AD_Message_ID,AD_Org_ID,Created,CreatedBy,EntityType,IsActive,MsgText,MsgType,Updated,UpdatedBy,Value) VALUES (0,544988,0,TO_TIMESTAMP('2020-07-21 17:02:25','YYYY-MM-DD HH24:MI:SS'),100,'de.metas.inoutcandidate','Y','Keine unverarbeiteten Zeilen ausgewählt','E',TO_TIMESTAMP('2020-07-21 17:02:25','YYYY-MM-DD HH24:MI:SS'),100,'shipmentschedule.noUnprocessedLines')
;
-- 2020-07-21T14:02:25.393Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language, t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Message t WHERE l.IsActive='Y'AND (l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N') AND t.AD_Message_ID=544988 AND NOT EXISTS (SELECT 1 FROM AD_Message_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Message_ID=t.AD_Message_ID)
;
-- 2020-07-21T14:02:50.011Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Message_Trl SET IsTranslated='Y', MsgText='No Unprocessed Lines Selected',Updated=TO_TIMESTAMP('2020-07-21 17:02:50','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Language='en_US' AND AD_Message_ID=544988
;
-- 2020-07-21T14:02:58.378Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Message_Trl SET MsgText='No unprocessed Lines Selected',Updated=TO_TIMESTAMP('2020-07-21 17:02:58','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Language='en_US' AND AD_Message_ID=544988
;
-- 2020-07-21T14:03:13.921Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Message_Trl SET MsgText='No unprocessed lines selected',Updated=TO_TIMESTAMP('2020-07-21 17:03:13','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Language='en_US' AND AD_Message_ID=544988
;
|
-- 2019-05-28T08:39:12.435
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Element (AD_Client_ID,AD_Element_ID,AD_Org_ID,Created,CreatedBy,Description,EntityType,IsActive,Name,PrintName,Updated,UpdatedBy) VALUES (0,576774,0,TO_TIMESTAMP('2019-05-28 08:39:12','YYYY-MM-DD HH24:MI:SS'),100,'Area Search','D','Y','Umkreissuche','Umkreissuche',TO_TIMESTAMP('2019-05-28 08:39:12','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2019-05-28T08:39:12.450
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, CommitWarning,Description,Help,Name,PO_Description,PO_Help,PO_Name,PO_PrintName,PrintName,WEBUI_NameBrowse,WEBUI_NameNew,WEBUI_NameNewBreadcrumb, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language, t.AD_Element_ID, t.CommitWarning,t.Description,t.Help,t.Name,t.PO_Description,t.PO_Help,t.PO_Name,t.PO_PrintName,t.PrintName,t.WEBUI_NameBrowse,t.WEBUI_NameNew,t.WEBUI_NameNewBreadcrumb, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Element t WHERE l.IsActive='Y'AND (l.IsSystemLanguage='Y' OR l.IsBaseLanguage='Y') AND t.AD_Element_ID=576774 AND NOT EXISTS (SELECT 1 FROM AD_Element_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Element_ID=t.AD_Element_ID)
;
-- 2019-05-28T08:39:20.590
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Element_Trl SET IsTranslated='Y',Updated=TO_TIMESTAMP('2019-05-28 08:39:20','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=576774 AND AD_Language='de_DE'
;
-- 2019-05-28T08:39:20.636
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
/* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(576774,'de_DE')
;
-- 2019-05-28T08:39:20.663
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
/* DDL */ select update_ad_element_on_ad_element_trl_update(576774,'de_DE')
;
-- 2019-05-28T08:39:21.175
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Element_Trl SET IsTranslated='Y',Updated=TO_TIMESTAMP('2019-05-28 08:39:21','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=576774 AND AD_Language='de_CH'
;
-- 2019-05-28T08:39:21.178
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
/* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(576774,'de_CH')
;
-- 2019-05-28T08:39:37.875
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Element_Trl SET IsTranslated='Y', Name='Area Search', PrintName='Area Search',Updated=TO_TIMESTAMP('2019-05-28 08:39:37','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=576774 AND AD_Language='en_US'
;
-- 2019-05-28T08:39:37.879
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
/* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(576774,'en_US')
;
-- 2019-05-28T08:39:46.831
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Process_Trl SET Name='Area Search',Updated=TO_TIMESTAMP('2019-05-28 08:39:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Language='en_US' AND AD_Process_ID=541139
;
-- 2019-05-28T08:40:09.967
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Process_Trl SET Description='Area Search', IsTranslated='Y',Updated=TO_TIMESTAMP('2019-05-28 08:40:09','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Language='en_US' AND AD_Process_ID=541139
;
-- 2019-05-28T08:40:15.811
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Process_Trl SET IsTranslated='Y', Name='Umkreissuche',Updated=TO_TIMESTAMP('2019-05-28 08:40:15','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Language='de_CH' AND AD_Process_ID=541139
;
-- 2019-05-28T08:41:24.539
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Process SET Description='Area Search from BPartner window action menu.', Name='Umkreissuche',Updated=TO_TIMESTAMP('2019-05-28 08:41:24','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_ID=541139
;
-- 2019-05-28T08:42:46.127
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Process SET Classname='de.metas.location.geocoding.process.C_BPartner_Window_AreaSearchProcess', Value='C_BPartner_Window_AreaSearchProcess',Updated=TO_TIMESTAMP('2019-05-28 08:42:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_ID=541139
;
|
<filename>backend/de.metas.inbound.mail/src/main/sql/postgresql/system/90-de.metas.inbound.mail/5500290_sys_gh4524_C_InboundMailConfig_EnableRemoteCacheInvalidation.sql
-- 2018-08-30T17:29:43.848
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Table SET IsEnableRemoteCacheInvalidation='Y',Updated=TO_TIMESTAMP('2018-08-30 17:29:43','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Table_ID=541013
;
|
<gh_stars>0
CREATE OR REPLACE FUNCTION utils.populatematerialhierarchytable()
RETURNS void
LANGUAGE sql
AS $function$
TRUNCATE TABLE utils.material_hierarchy;
WITH material_hierarchyquery AS (
SELECT
h.name materialcsid,
regexp_replace(cnc.refname, '^.*\)''(.*)''$', '\1') material,
rc.objectcsid broadermaterialcsid,
regexp_replace(cnc2.refname, '^.*\)''(.*)''$', '\1') broadermaterial
FROM public.concepts_common cnc
INNER JOIN misc m ON (cnc.id=m.id AND m.lifecyclestate<>'deleted')
LEFT OUTER JOIN hierarchy h ON (cnc.id = h.id AND h.primarytype='Conceptitem')
LEFT OUTER JOIN public.relations_common rc ON (h.name = rc.subjectcsid)
LEFT OUTER JOIN hierarchy h2 ON (h2.primarytype = 'Conceptitem'
AND rc.objectcsid = h2.name)
LEFT OUTER JOIN concepts_common cnc2 ON (cnc2.id = h2.id)
WHERE cnc.refname LIKE 'urn:cspace:pahma.cspace.berkeley.edu:conceptauthorities:name(material_ca)%'
)
INSERT INTO utils.material_hierarchy
SELECT DISTINCT
materialcsid,
material,
broadermaterialcsid AS parentcsid,
broadermaterialcsid AS nextcsid,
material AS material_hierarchy,
materialcsid AS csid_hierarchy
FROM material_hierarchyquery;
$function$
|
<gh_stars>0
SELECT TOP(3)emp.EmployeeID, emp.FirstName FROM Employees AS emp
FULL JOIN EmployeesProjects AS EmpProj
ON emp.EmployeeID = EmpProj.EmployeeID
WHERE EmpProj.ProjectID IS NULL
ORDER BY EmployeeID |
USE [Certificate_Administration]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- ======================================================================
-- Author: <NAME>
-- Creation date: October 22, 2021
-- Description: Creates a certificate for a SourceGroup, signs
-- all SourceGroup members, drops the certificate's
-- private key, and appends the certificate's ID
-- to the SourceGroupCertificate table before returning
-- the newly created SourceGroupCertificateID.
-- Requires: SA
-- ======================================================================
CREATE OR ALTER PROCEDURE [Permission].[CreateSourceGroupCertificate]
@SourceGroupID INT
, @SourceGroupCertificateID INT OUTPUT
, @debug BIT = 1
AS
SET XACT_ABORT, NOCOUNT ON
BEGIN TRY
BEGIN TRANSACTION
IF @debug = 1 PRINT CONCAT('-- Creating certificate for source group with ID:', @SourceGroupID)
-- Look for an existing certificate
SELECT @SourceGroupCertificateID = MIN([SourceGroupCertificateID])
FROM [Permission].[SourceGroupCertificate]
WHERE [SourceGroupID] = @SourceGroupID
-- RAISERROR if a certificate is found to already exist
IF @SourceGroupCertificateID IS NOT NULL
RAISERROR('A certificate already exists for SourceGroup with ID: "%d"', 16, 1, @SourceGroupID)
DECLARE
@db_id INT
, @object_id INT
, @cert_id INT
, @db_name SYSNAME
, @schema_name SYSNAME
, @object_name SYSNAME
, @group_name SYSNAME
, @cert_name SYSNAME
, @subject NVARCHAR(4000)
, @pwd CHAR(39)
-- Retrieve the information we need for creating the source certificate
SELECT
@db_id = MIN([sd].[database_id])
, @group_name = MIN([sg].[Name])
FROM
[Permission].[SourceGroup] AS [sg]
JOIN [Permission].[SourceDatabase] AS [sd]
ON [sg].[SourceDatabaseID] = [sd].[SourceDatabaseID]
WHERE
[sg].[SourceGroupID] = @SourceGroupID
-- Ensure the group actually exists
IF @group_name IS NULL
RAISERROR('No SourceGroup exists with ID: "%d"', 16, 1, @SourceGroupID)
-- Retrieve the database name
EXEC [Validation].[DBNameFromID]
@db_id
, @db_name OUTPUT
, 1
-- Use the group's name for the certificate's name and subject
SELECT
@cert_name = 'SIGN ' + @group_name
, @subject = CONCAT('Grants cross database permissions and roles for SourceGroup: ', @group_name, ' (ID: ', @SourceGroupID, ')')
EXEC [Definition].[CreateCertByPwd]
@db_name
, @cert_name
, @pwd OUTPUT
, @subject
, @cert_id OUTPUT
, @debug
-- Sign all grouped objects
DECLARE [object_cur] CURSOR STATIC LOCAL FOR
SELECT DISTINCT
[object_id]
FROM
[Permission].[SourceGroup] AS [sg]
JOIN [Permission].[SourceGroupObject] AS [sgo]
ON [sg].[SourceGroupID] = [sgo].[SourceGroupID]
JOIN [Permission].[SourceObject] AS [so]
ON [sgo].[SourceObjectID] = [so].SourceObjectID
OPEN [object_cur]
WHILE 1 = 1
BEGIN
FETCH NEXT FROM [object_cur] INTO @object_id
IF @@FETCH_STATUS <> 0 BREAK
EXEC [Validation].[AllNamesFromIDs]
@db_id
, @object_id
, @db_name OUTPUT
, @schema_name OUTPUT
, @object_name OUTPUT
, 1
, @debug
EXEC [Definition].[SignObjByCertWithPwd]
@db_name
, @schema_name
, @object_name
, @cert_name
, @pwd
, @debug
END
CLOSE [object_cur]
DEALLOCATE [object_cur]
-- Remove private key to prevent further signatures
EXEC [Definition].[RemoveCertPrivateKeyByName]
@db_name
, @cert_name
, @debug
-- Log the certificate
INSERT INTO [Permission].[SourceGroupCertificate] (
[SourceGroupID]
, [certificate_id]
)
VALUES (
@SourceGroupID
, @cert_id
)
-- Return the newly inserted SourceGroupCertificate's ID
SELECT @SourceGroupCertificateID = [sgc].[SourceGroupCertificateID]
FROM [Permission].[SourceGroupCertificate] AS [sgc]
WHERE [sgc].[SourceGroupID] = @SourceGroupID
COMMIT TRANSACTION
END TRY
BEGIN CATCH
IF @@TRANCOUNT > 0 ROLLBACK TRANSACTION
PRINT CONCAT('-- Error creating source group certificate for source group with ID: ', @SourceGroupID)
; THROW
END CATCH
GO
|
-- SPDX-License-Identifier: Apache-2.0
-- Licensed to the Ed-Fi Alliance under one or more agreements.
-- The Ed-Fi Alliance licenses this file to you under the Apache License, Version 2.0.
-- See the LICENSE and NOTICES files in the project root for more information.
IF OBJECT_ID('auth.StudentUSIToEducationOrganizationIdThroughEdOrgAssociation', 'V') IS NOT NULL
DROP VIEW auth.StudentUSIToEducationOrganizationIdThroughEdOrgAssociation
GO
CREATE VIEW auth.StudentUSIToEducationOrganizationIdThroughEdOrgAssociation AS
SELECT tuple.SourceEducationOrganizationId, seoa.StudentUSI
FROM edfi.StudentEducationOrganizationAssociation seoa
INNER JOIN auth.EducationOrganizationIdToEducationOrganizationId tuple
ON seoa.EducationOrganizationId = tuple.TargetEducationOrganizationId
GO
|
<filename>projects/blog1/sql/db.sql
CREATE TABLE Posts (
ID INT PRIMARY KEY auto_increment,
title VARCHAR(100),
created TIMESTAMP,
lastChanged TIMESTAMP,
content CLOB,
tags VARCHAR(255)
);
insert into posts(title, created, lastchanged, content, tags) values( 'tit2', '2015-11-16 18:49:10','2015-11-16 18:49:10', 'sdfsd', 't1 t2');
CREATE USER igor PASSWORD '<PASSWORD>';
ALTER USER igor ADMIN TRUE; |
SELECT DISTINCT CITY
FROM STATION
where not regexp_like (CITY, '^(A|E|I|O|U)')
or not regexp_like (CITY, '(a|e|i|o|u)$'); |
<gh_stars>100-1000
-- Copyright 2018 <NAME>. All rights reserved. More info at http://tanelpoder.com
-- Licensed under the Apache License, Version 2.0. See LICENSE.txt for terms & conditions.
column fvar_ksmfsnam heading SGAVARNAME for a30
column fvar_ksmfstyp heading DATATYPE for a30
column fval_ksmmval_dec heading VALUE_DEC for 999999999999990
select /*+ ORDERED USE_NL(m) NO_EXPAND */
f.addr
, f.indx
, f.ksmfsnam fvar_ksmfsnam
, f.ksmfstyp fvar_ksmfstyp
, f.ksmfsadr
, f.ksmfssiz
, m.ksmmmval
, to_number(rawtohex(m.ksmmmval), 'XXXXXXXXXXXXXXXX') fval_ksmmval_dec
/* , (select ksmmmval from x$ksmmem where addr = hextoraw(
to_char(
to_number(
rawtohex(f.ksmfsadr),
'XXXXXXXX'
) + 0,
'XXXXXXXX')
)
) ksmmmval2 */
from
x$ksmfsv f
, x$ksmmem m
where
f.ksmfsadr = m.addr
and (rawtohex(m.ksmmmval) like upper('&1'))
order by
ksmfsnam
/
|
<reponame>nenadnoveljic/tpt-oracle
-- Copyright 2018 <NAME>. All rights reserved. More info at http://tanelpoder.com
-- Licensed under the Apache License, Version 2.0. See LICENSE.txt for terms & conditions.
-- DBA_REWRITE_EQUIVALENCES
-- Name Null? Type
-- ------------------------------- -------- ----------------------------
-- OWNER NOT NULL VARCHAR2(128)
-- NAME NOT NULL VARCHAR2(128)
-- SOURCE_STMT CLOB
-- DESTINATION_STMT CLOB
-- REWRITE_MODE VARCHAR2(10)
COL equiv_owner FOR A20 WRAP
COL equiv_name FOR A30 WRAP
COL source_stmt FOR A50 WORD_WRAP
COL destination_stmt FOR A50 WORD_WRAP
SELECT
owner equiv_owner
, name equiv_name
, rewrite_mode
, source_stmt
, destination_stmt
FROM
dba_rewrite_equivalences
WHERE
UPPER(name) LIKE
upper(CASE
WHEN INSTR('&1','.') > 0 THEN
SUBSTR('&1',INSTR('&1','.')+1)
ELSE
'&1'
END
) ESCAPE '\'
AND owner LIKE
CASE WHEN INSTR('&1','.') > 0 THEN
UPPER(SUBSTR('&1',1,INSTR('&1','.')-1))
ELSE
user
END ESCAPE '\'
/
|
ALTER TABLE experiment_run ADD PRIMARY KEY (id);
ALTER TABLE experiment_config ADD PRIMARY KEY (id);
|
SELECT hostname() = hostName();
|
<filename>sql/_01_object/_03_virtual_class/_001_basic/cases/1005.sql
-- [er]create hash partition table with int field having size 4 and create view using 2nd partition
create class t1 (
col1 int not null ,
col2 int not null,
col3 int not null,
col4 integer,
col5 numeric,
col6 numeric,
col7 numeric,
col8 numeric,
col9 char(1),
col10 char(1),
col11 date,
col12 date,
col13 date,
col14 char(25),
col15 char(10),
col16 varchar(44)
)
partition by hash(col1)
partitions 4;
create view xp as select * from t1__p__p1;
insert into xp ( col1, col2, col3, col4) values(1,0,0,1);
drop class t1;
drop vclass xp;
|
CREATE OR REPLACE FUNCTION calculate_equity(action_time timestamp, content_item_id bigint) RETURNS double precision AS $$
BEGIN
RETURN SUM(calculate_equity(activity.created, action_time, activity.equity, activity.dtype))
FROM activity
WHERE (activity.contentitem_id = content_item_id) AND (activity.created <= action_time);
END;
$$ LANGUAGE plpgsql; |
<filename>common/src/main/resources/db/migration/V129__2020-07-14_modreg_recordedmodreg.sql
-- This is just for the benefit of Hibernate's stupid face
create view moduleregistration_recordedmoduleregistration as
select
mr.id as module_registration_id,
rmr.id as recorded_module_registration_id
from moduleregistration mr
join recordedmoduleregistration rmr
on mr.sprcode = rmr.spr_code and
mr.sitsmodulecode = rmr.sits_module_code and
mr.academicyear = rmr.academic_year and
mr.occurrence = rmr.occurrence;
create rule moduleregistration_recordedmoduleregistration_noinsert as
on insert to moduleregistration_recordedmoduleregistration
do instead nothing;
create rule moduleregistration_recordedmoduleregistration_noupdate as
on update to moduleregistration_recordedmoduleregistration
do instead nothing;
create rule moduleregistration_recordedmoduleregistration_nodelete as
on delete to moduleregistration_recordedmoduleregistration
do instead nothing;
|
<filename>shimbilabs.sql
-- phpMyAdmin SQL Dump
-- version 4.9.7
-- https://www.phpmyadmin.net/
--
-- Host: localhost:3306
-- Generation Time: Feb 09, 2022 at 04:13 AM
-- Server version: 5.7.36-cll-lve
-- PHP Version: 7.3.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: `shimbilabs`
--
-- --------------------------------------------------------
--
-- Table structure for table `responses`
--
CREATE TABLE `responses` (
`id` bigint(20) UNSIGNED NOT NULL,
`first_name` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
`last_name` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
`email` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`mobile` bigint(10) UNSIGNED NOT NULL,
`talk_title` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`image` 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 `responses`
--
INSERT INTO `responses` (`id`, `first_name`, `last_name`, `email`, `mobile`, `talk_title`, `image`, `created_at`, `updated_at`) VALUES
(1, 'Anand', 'Oommen', '<EMAIL>', 9544314316, 'Test Talk Title 1', '20220129120614.jpg', '2022-01-30 09:06:14', '2022-01-29 09:06:14'),
(2, 'George', 'Oommen', '<EMAIL>', 9544314316, 'Test Talk Title 2', '20220129120729.JPG', '2022-01-29 09:07:29', '2022-01-29 21:02:15');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `responses`
--
ALTER TABLE `responses`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `responses`
--
ALTER TABLE `responses`
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=10;
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
insert into [AFEDive].[LIST_ASSOCIATION] Values('574c70df-b46c-49b2-9ab8-abf4ffcba855','BPX','RP',null,0,0);
insert into [AFEDive].[LIST_ASSOCIATION] Values('bd755388-7798-4177-8868-3610253a0376','MUD Company','RP',null,0,0);
insert into [AFEDive].[LIST_ASSOCIATION] Values('fe0a2b1f-3c15-4f07-988f-36a633c444a9','Directional Company','RP',null,0,0);
insert into [AFEDive].[LIST_ASSOCIATION] Values('5b65a8aa-0cc9-4792-ac96-917376080a48','Cement Company','RP',null,0,0);
insert into [AFEDive].[LIST_ASSOCIATION] Values('bb464288-92f1-44d4-ac02-227eb464b894','Rig Contractor','RP',null,0,0);
insert into [AFEDive].[LIST_ASSOCIATION] Values('acf0fc31-cc9b-4dc9-a4c1-d4cf419e9e25','Third Party','RP',null,0,0);
insert into [AFEDive].[LIST_ASSOCIATION] Values('9b73afd5-fdc0-460f-bbfc-ed765cfda3c2','HOLE CONDITIONS/WELLBORE RELATED','Level1',null,1,0);
insert into [AFEDive].[LIST_ASSOCIATION] Values('fc60f35e-0b32-40fd-aab2-7c48748606a4','ABRAISIVE / HARD ROCK STRINGERS','Level2','9b73afd5-fdc0-460f-bbfc-ed765cfda3c2',1,0);
insert into [AFEDive].[LIST_ASSOCIATION] Values('15943108-7772-4ee7-98f9-3c0d76b6bf1f','CONDITIONING HOLE','Level2','9b73afd5-fdc0-460f-bbfc-ed765cfda3c2',1,0);
insert into [AFEDive].[LIST_ASSOCIATION] Values('b406684e-19e6-487d-a5a4-25cc13f37764','FORMAITON FLUID / GAS INFLUX','Level2','9b73afd5-fdc0-460f-bbfc-ed765cfda3c2',1,0);
insert into [AFEDive].[LIST_ASSOCIATION] Values('df35f32e-1cf0-4597-97d3-712c1e5404ce','GUMBO','Level2','9b73afd5-fdc0-460f-bbfc-ed765cfda3c2',1,0);
insert into [AFEDive].[LIST_ASSOCIATION] Values('c8db0519-befb-4e38-8173-3a040573244c','MUD LOSSES','Level2','9b73afd5-fdc0-460f-bbfc-ed765cfda3c2',1,0);
insert into [AFEDive].[LIST_ASSOCIATION] Values('385924fc-bf60-46d1-aa90-24b98df3982a','STUCK PIPE','Level2','9b73afd5-fdc0-460f-bbfc-ed765cfda3c2',1,0);
insert into [AFEDive].[LIST_ASSOCIATION] Values('99987831-d8af-4332-a5cb-2b5373633ede','TIGHT HOLE','Level2','9b73afd5-fdc0-460f-bbfc-ed765cfda3c2',1,0);
insert into [AFEDive].[LIST_ASSOCIATION] Values('1dc61cb5-ccb0-4ea5-adec-3bc65cd05481','WELLBORE BALLOONING','Level2','9b73afd5-fdc0-460f-bbfc-ed765cfda3c2',1,0);
insert into [AFEDive].[LIST_ASSOCIATION] Values('81d83c59-0e4b-4147-93da-267f46f3fdbc','WELLBORE INSTABILITY','Level2','9b73afd5-fdc0-460f-bbfc-ed765cfda3c2',1,0);
insert into [AFEDive].[LIST_ASSOCIATION] Values('9056909d-0705-490e-83e3-b8104f2d94eb','HUMAN ERROR','Level1',null,2,0);
insert into [AFEDive].[LIST_ASSOCIATION] Values('b4d12373-4f1e-4a31-b849-783cff01d565','AUTO-DRILLER SET POINTS','Level2','9056909d-0705-490e-83e3-b8104f2d94eb',2,0);
insert into [AFEDive].[LIST_ASSOCIATION] Values('05fede7c-eafa-44b1-b4a2-2c624716ee24','GALLED THREAD','Level2','9056909d-0705-490e-83e3-b8104f2d94eb',2,0);
insert into [AFEDive].[LIST_ASSOCIATION] Values('c588825f-6b34-4d95-97bc-f801a19a9607','MOTOR CONFIGURATION','Level2','9056909d-0705-490e-83e3-b8104f2d94eb',2,0);
insert into [AFEDive].[LIST_ASSOCIATION] Values('60b566f5-f8ee-4618-b58c-fc0cff63a10a','MWD CONFIGURATION','Level2','9056909d-0705-490e-83e3-b8104f2d94eb',2,0);
insert into [AFEDive].[LIST_ASSOCIATION] Values('b361a558-2213-4cdb-8daf-3fa62460f33f','PIPE TALLY','Level2','9056909d-0705-490e-83e3-b8104f2d94eb',2,0);
insert into [AFEDive].[LIST_ASSOCIATION] Values('a8a4cbe6-cf57-4ef5-94ae-4240e6bfc72f','MOC/PLAN CHANGES','Level1',null,3,0);
insert into [AFEDive].[LIST_ASSOCIATION] Values('2d212911-1e1b-4e0a-93ee-dfe23c78789d','CASING STRING PLAN','Level2','a8a4cbe6-cf57-4ef5-94ae-4240e6bfc72f',3,0);
insert into [AFEDive].[LIST_ASSOCIATION] Values('6acaa18c-b351-40f2-a56a-b8488be22de8','CEMENT STAGES','Level2','a8a4cbe6-cf57-4ef5-94ae-4240e6bfc72f',3,0);
insert into [AFEDive].[LIST_ASSOCIATION] Values('eccd86f4-41ee-4831-bffd-96d5aaa1b251','LOGGING PLAN','Level2','a8a4cbe6-cf57-4ef5-94ae-4240e6bfc72f',3,0);
insert into [AFEDive].[LIST_ASSOCIATION] Values('92a34a30-0c0d-4ac0-b1f0-803869936561','OTHER SCOPE CHANGE (DESCRIBE IN COMMENTS)','Level2','a8a4cbe6-cf57-4ef5-94ae-4240e6bfc72f',3,0);
insert into [AFEDive].[LIST_ASSOCIATION] Values('f1d43b0d-d8d3-4dc0-a84c-989634512e9a','UNPLANNED SIDETRACK','Level2','a8a4cbe6-cf57-4ef5-94ae-4240e6bfc72f',3,0);
insert into [AFEDive].[LIST_ASSOCIATION] Values('c6722bc3-cf50-41a1-aa93-e23ec1179df7','RIG PERFORMANCE','Level1',null,4,0);
insert into [AFEDive].[LIST_ASSOCIATION] Values('df787a43-c3ce-457f-be18-eded25b5b622','BOPE PRESSURE TEST TIMES','Level2','c6722bc3-cf50-41a1-aa93-e23ec1179df7',4,0);
insert into [AFEDive].[LIST_ASSOCIATION] Values('baf8e351-cc31-4597-8138-92d29fa88096','CURVE PERFORMANCE','Level2','c6722bc3-cf50-41a1-aa93-e23ec1179df7',4,0);
insert into [AFEDive].[LIST_ASSOCIATION] Values('92df4fc1-eea7-4deb-b514-f435944d3d63','DRILL PIPE CONNECTION TIMES','Level2','c6722bc3-cf50-41a1-aa93-e23ec1179df7',4,0);
insert into [AFEDive].[LIST_ASSOCIATION] Values('72b899f3-02da-48d1-a2ff-5a4d5b54eb1f','MUD PROPERTIES / PRODUCT USAGE','Level2','c6722bc3-cf50-41a1-aa93-e23ec1179df7',4,0);
insert into [AFEDive].[LIST_ASSOCIATION] Values('5d66527f-f50b-4c90-9bd4-2417d95bbea9','OVERLOADED SHAKERS','Level2','c6722bc3-cf50-41a1-aa93-e23ec1179df7',4,0);
insert into [AFEDive].[LIST_ASSOCIATION] Values('490190c7-4063-41b0-b951-6583c22b6ba9','SOLIDS CONTROL EFFICIENCY','Level2','c6722bc3-cf50-41a1-aa93-e23ec1179df7',4,0);
insert into [AFEDive].[LIST_ASSOCIATION] Values('2edceffc-37bb-4cf8-bc38-7484cd847234','TRIPPING SPEEDS','Level2','c6722bc3-cf50-41a1-aa93-e23ec1179df7',4,0);
insert into [AFEDive].[LIST_ASSOCIATION] Values('645d7804-bc80-4505-9912-42c1ca3e0baf','WAITING','Level1',null,5,0);
insert into [AFEDive].[LIST_ASSOCIATION] Values('35db656f-01f7-4202-bcdd-91846c2c5bc4','ORDERS','Level2','645d7804-bc80-4505-9912-42c1ca3e0baf',5,0);
insert into [AFEDive].[LIST_ASSOCIATION] Values('783ce955-5c8f-41e9-8bc3-1641298a9422','TRUCKING','Level2','645d7804-bc80-4505-9912-42c1ca3e0baf',5,0);
insert into [AFEDive].[LIST_ASSOCIATION] Values('539c8bde-7a42-4887-bfd2-848110f2d9f5','WEATHER','Level1',null,6,0);
insert into [AFEDive].[LIST_ASSOCIATION] Values('81f01cfd-2a91-4b15-a71d-5296df396ce1','HIGHWINDS','Level2','539c8bde-7a42-4887-bfd2-848110f2d9f5',6,0);
insert into [AFEDive].[LIST_ASSOCIATION] Values('67ae7a5d-a088-404b-8830-47610cc58e7a','LIGHTNING','Level2','539c8bde-7a42-4887-bfd2-848110f2d9f5',6,0);
insert into [AFEDive].[LIST_ASSOCIATION] Values('954e9254-8a8a-4628-95f4-82e3d4f2b604','WINTER WEATHER','Level2','539c8bde-7a42-4887-bfd2-848110f2d9f5',6,0);
insert into [AFEDive].[LIST_ASSOCIATION] Values('0adc5647-7571-45e6-9feb-c1f5afd7fb11','ACTIVE MUD SYSTEM','Level1',null,7,0);
insert into [AFEDive].[LIST_ASSOCIATION] Values('4a3cf498-d5c8-4df4-954b-e15a49c6606e','AGITATORS','Level2','0adc5647-7571-45e6-9feb-c1f5afd7fb11',7,0);
insert into [AFEDive].[LIST_ASSOCIATION] Values('0688b20c-3aed-4ce1-98e8-8dcf361560b4','COFLEX','Level2','0adc5647-7571-45e6-9feb-c1f5afd7fb11',7,0);
insert into [AFEDive].[LIST_ASSOCIATION] Values('52c47ce2-9378-4afd-ad52-0ff2225bec7f','HOPPER','Level2','0adc5647-7571-45e6-9feb-c1f5afd7fb11',7,0);
insert into [AFEDive].[LIST_ASSOCIATION] Values('e515f926-ffda-4a60-92fd-6f515bdb6727','KELLY HOSE','Level2','0adc5647-7571-45e6-9feb-c1f5afd7fb11',7,0);
insert into [AFEDive].[LIST_ASSOCIATION] Values('20d481a9-7737-49fd-a776-53a55d29e549','PIT','Level2','0adc5647-7571-45e6-9feb-c1f5afd7fb11',7,0);
insert into [AFEDive].[LIST_ASSOCIATION] Values('5a89dcf2-03f3-44b4-a562-34550b9f9787','STANDPIPE','Level2','0adc5647-7571-45e6-9feb-c1f5afd7fb11',7,0);
insert into [AFEDive].[LIST_ASSOCIATION] Values('676537bb-7df8-467c-afe5-03a221626883','VALVES','Level2','0adc5647-7571-45e6-9feb-c1f5afd7fb11',7,0);
insert into [AFEDive].[LIST_ASSOCIATION] Values('853cde52-45ad-435e-9361-154d3d007043','CASING','Level1',null,8,0);
insert into [AFEDive].[LIST_ASSOCIATION] Values('804ffdf3-0be3-4c8c-b41c-ad4afe50e071','BOWLS AND SLIPS','Level2','853cde52-45ad-435e-9361-154d3d007043',8,0);
insert into [AFEDive].[LIST_ASSOCIATION] Values('f8866979-0369-4951-8cce-d8bed8ec4791','CASING RUNNING TOOL','Level2','853cde52-45ad-435e-9361-154d3d007043',8,0);
insert into [AFEDive].[LIST_ASSOCIATION] Values('f83b2174-ae4f-437a-a284-07f7ce065596','ELEVATOR','Level2','853cde52-45ad-435e-9361-154d3d007043',8,0);
insert into [AFEDive].[LIST_ASSOCIATION] Values('2f42964b-9230-4286-846a-af2e3baeeb74','HANDLING TOOLS','Level2','853cde52-45ad-435e-9361-154d3d007043',8,0);
insert into [AFEDive].[LIST_ASSOCIATION] Values('fab8bcff-d270-475b-b3f2-90f0f244b1e0','LINER HANGER','Level2','853cde52-45ad-435e-9361-154d3d007043',8,0);
insert into [AFEDive].[LIST_ASSOCIATION] Values('8960bac9-6b7f-4377-a886-5af82297807c','SLIPS','Level2','853cde52-45ad-435e-9361-154d3d007043',8,0);
insert into [AFEDive].[LIST_ASSOCIATION] Values('761de4a3-8c34-4344-82a1-c72cc586b258','THREADS / MAKE-UP','Level2','853cde52-45ad-435e-9361-154d3d007043',8,0);
insert into [AFEDive].[LIST_ASSOCIATION] Values('ce12aec0-843d-4bad-959f-79c2e30a4947','TORQUE TURN','Level2','853cde52-45ad-435e-9361-154d3d007043',8,0);
insert into [AFEDive].[LIST_ASSOCIATION] Values('faa0f81c-6434-4f64-ba51-b035cf8cb901','CEMENT','Level1',null,9,0);
insert into [AFEDive].[LIST_ASSOCIATION] Values('40945507-2db9-4bad-9577-7131dab5cdf9','DIVERTER','Level2','faa0f81c-6434-4f64-ba51-b035cf8cb901',9,0);
insert into [AFEDive].[LIST_ASSOCIATION] Values('f68b270c-9934-4fb0-9697-9734118a27e5','FAILED LAB TEST','Level2','faa0f81c-6434-4f64-ba51-b035cf8cb901',9,0);
insert into [AFEDive].[LIST_ASSOCIATION] Values('b7325cc6-cc9f-4ade-9a21-6fa8f0c5a6b8','FAILED SHOE TEST','Level2','faa0f81c-6434-4f64-ba51-b035cf8cb901',9,0);
insert into [AFEDive].[LIST_ASSOCIATION] Values('04ae6b93-8b06-42c3-8724-f119ea8ddcfe','FLOAT VALVE','Level2','faa0f81c-6434-4f64-ba51-b035cf8cb901',9,0);
insert into [AFEDive].[LIST_ASSOCIATION] Values('ba7c0fb6-b10e-48bf-ba5e-daa3f113c09a','METERING SYSTEM','Level2','faa0f81c-6434-4f64-ba51-b035cf8cb901',9,0);
insert into [AFEDive].[LIST_ASSOCIATION] Values('7f088ed5-28f1-4fa7-b03f-d009414af8b0','MIXING TANK','Level2','faa0f81c-6434-4f64-ba51-b035cf8cb901',9,0);
insert into [AFEDive].[LIST_ASSOCIATION] Values('9ac05ec9-766f-47c7-b159-79ed408450d3','PLUG','Level2','faa0f81c-6434-4f64-ba51-b035cf8cb901',9,0);
insert into [AFEDive].[LIST_ASSOCIATION] Values('89f29dc9-26d1-4607-ac2d-7c2fb631d85b','PUMP','Level2','faa0f81c-6434-4f64-ba51-b035cf8cb901',9,0);
insert into [AFEDive].[LIST_ASSOCIATION] Values('ed7fba2b-3e47-48f2-864e-f190d1d94707','SILO','Level2','faa0f81c-6434-4f64-ba51-b035cf8cb901',9,0);
insert into [AFEDive].[LIST_ASSOCIATION] Values('e56c439b-83c0-425d-9517-93cb4b7ba720','SLURRY FLASH SET','Level2','faa0f81c-6434-4f64-ba51-b035cf8cb901',9,0);
insert into [AFEDive].[LIST_ASSOCIATION] Values('23bfa960-c2b6-417a-9991-36ab50aece42','COIL TUBING','Level1',null,10,0);
insert into [AFEDive].[LIST_ASSOCIATION] Values('40ceb0ac-1132-4389-9341-83e86746b370','COIL TUBING','Level2','23bfa960-c2b6-417a-9991-36ab50aece42',10,0);
insert into [AFEDive].[LIST_ASSOCIATION] Values('c8f5f8f5-6230-45f6-addb-5a8eb8cad738','DIRECTIONAL','Level1',null,11,0);
insert into [AFEDive].[LIST_ASSOCIATION] Values('6b63319b-7a48-485f-9f35-5c4d9143113e','LWD','Level2','c8f5f8f5-6230-45f6-addb-5a8eb8cad738',11,0);
insert into [AFEDive].[LIST_ASSOCIATION] Values('162e07cf-1de8-4745-8b95-29294d62b21d','MUD MOTOR','Level2','c8f5f8f5-6230-45f6-addb-5a8eb8cad738',11,0);
insert into [AFEDive].[LIST_ASSOCIATION] Values('9a4cbd0e-30ab-482f-bcd8-e3a313ec1f46','MWD','Level2','c8f5f8f5-6230-45f6-addb-5a8eb8cad738',11,0);
insert into [AFEDive].[LIST_ASSOCIATION] Values('ab024dff-f335-4a41-92cb-f44a47422de7','RSS','Level2','c8f5f8f5-6230-45f6-addb-5a8eb8cad738',11,0);
insert into [AFEDive].[LIST_ASSOCIATION] Values('5d863ea9-fd1b-4858-bfc8-f7bcc8b149c7','DOWN HOLE TOOL','Level1',null,12,0);
insert into [AFEDive].[LIST_ASSOCIATION] Values('a00f9c06-cf07-4a34-86b9-c248023ce571','REAMER','Level2','5d863ea9-fd1b-4858-bfc8-f7bcc8b149c7',12,0);
insert into [AFEDive].[LIST_ASSOCIATION] Values('054372fc-5b80-4651-8e12-6c577d992952','SPECIALTY TOOLS (ADD DESCRIPTION)','Level2','5d863ea9-fd1b-4858-bfc8-f7bcc8b149c7',12,0);
insert into [AFEDive].[LIST_ASSOCIATION] Values('684978a1-fbc5-46a5-9c01-33c039f6dbfe','VIBRATION TOOL / AGITATOR','Level2','5d863ea9-fd1b-4858-bfc8-f7bcc8b149c7',12,0);
insert into [AFEDive].[LIST_ASSOCIATION] Values('79a1716a-e5df-4869-bb52-bb9b10dff941','HOISTING','Level1',null,13,0);
insert into [AFEDive].[LIST_ASSOCIATION] Values('eb810789-49ad-41c5-8ee1-e6a3b6a2752f','CROWN','Level2','79a1716a-e5df-4869-bb52-bb9b10dff941',13,0);
insert into [AFEDive].[LIST_ASSOCIATION] Values('708b6539-cae4-4f41-8fa2-8bb0702fddaf','DRAWWORKS','Level2','79a1716a-e5df-4869-bb52-bb9b10dff941',13,0);
insert into [AFEDive].[LIST_ASSOCIATION] Values('1aa20ae6-da39-46fa-b60c-b341dffab86a','TOP DRIVE','Level2','79a1716a-e5df-4869-bb52-bb9b10dff941',13,0);
insert into [AFEDive].[LIST_ASSOCIATION] Values('c60689b7-d101-4e28-b8d8-c631f1104f98','TRAVELLING BLOCK','Level2','79a1716a-e5df-4869-bb52-bb9b10dff941',13,0);
insert into [AFEDive].[LIST_ASSOCIATION] Values('6521b0fe-57a0-4a56-9324-2ff527033b9f','MUD PUMPS','Level1',null,14,0);
insert into [AFEDive].[LIST_ASSOCIATION] Values('e06ae458-1384-42ea-a209-40d4a572512b','PISTON','Level2','6521b0fe-57a0-4a56-9324-2ff527033b9f',14,0);
insert into [AFEDive].[LIST_ASSOCIATION] Values('9ca129d3-8f77-4a75-831e-fcf7d67d028f','SEATS','Level2','6521b0fe-57a0-4a56-9324-2ff527033b9f',14,0);
insert into [AFEDive].[LIST_ASSOCIATION] Values('f028f401-0de6-4b8d-a821-e0679caff2fa','VALVES','Level2','6521b0fe-57a0-4a56-9324-2ff527033b9f',14,0);
insert into [AFEDive].[LIST_ASSOCIATION] Values('9043b2d0-ab34-4990-91b3-5c4a71d3acd7','PIPE HANDLING EQUIPMENT','Level1',null,15,0);
insert into [AFEDive].[LIST_ASSOCIATION] Values('42bfda4f-1e5d-4989-93d0-3506b20fb4a2','MONKEY BOARD','Level2','9043b2d0-ab34-4990-91b3-5c4a71d3acd7',15,0);
insert into [AFEDive].[LIST_ASSOCIATION] Values('f94effdf-9157-4b52-a475-01015c4b02bb','PIPE HANDLER','Level2','9043b2d0-ab34-4990-91b3-5c4a71d3acd7',15,0);
insert into [AFEDive].[LIST_ASSOCIATION] Values('96071b1e-b1a6-4105-ab40-53c7493f0de5','TONGS / IRON ROUGHNECK','Level2','9043b2d0-ab34-4990-91b3-5c4a71d3acd7',15,0);
insert into [AFEDive].[LIST_ASSOCIATION] Values('b194c793-d7de-4efe-b307-88c20ef00f18','POWER GENERATION','Level1',null,16,0);
insert into [AFEDive].[LIST_ASSOCIATION] Values('8f827f5a-0c3d-45cb-9d72-6c83b288cf27','POWER GENERATION','Level2','b194c793-d7de-4efe-b307-88c20ef00f18',16,0);
insert into [AFEDive].[LIST_ASSOCIATION] Values('3ffec520-9b9e-4b0b-ac7c-8b0c5c07a397','SOLIDS CONTROL EQUIPMENT','Level1',null,17,0);
insert into [AFEDive].[LIST_ASSOCIATION] Values('f5def626-1806-4273-abc7-0facf29bf428','DEGASSER','Level2','3ffec520-9b9e-4b0b-ac7c-8b0c5c07a397',17,0);
insert into [AFEDive].[LIST_ASSOCIATION] Values('922b6fd0-e771-4c92-99bf-60ef73eab31e','DESANDER','Level2','3ffec520-9b9e-4b0b-ac7c-8b0c5c07a397',17,0);
insert into [AFEDive].[LIST_ASSOCIATION] Values('3c862688-1c86-4f09-ad72-c77a2931cfb5','DESILTER','Level2','3ffec520-9b9e-4b0b-ac7c-8b0c5c07a397',17,0);
insert into [AFEDive].[LIST_ASSOCIATION] Values('6b9e1e90-8977-4c09-8c37-f16977641a9e','FLOW LINE','Level2','3ffec520-9b9e-4b0b-ac7c-8b0c5c07a397',17,0);
insert into [AFEDive].[LIST_ASSOCIATION] Values('7ed63b45-dfbf-46c6-85b8-54d0a6f03bb2','POSSUM BELLY','Level2','3ffec520-9b9e-4b0b-ac7c-8b0c5c07a397',17,0);
insert into [AFEDive].[LIST_ASSOCIATION] Values('7ae17665-383c-4acd-987c-5cd998fb26ee','RIG SHAKERS','Level2','3ffec520-9b9e-4b0b-ac7c-8b0c5c07a397',17,0);
insert into [AFEDive].[LIST_ASSOCIATION] Values('54833fcc-1a3d-451c-85cc-90de3025452a','SOLIDS CONTROL SHAKERS','Level2','3ffec520-9b9e-4b0b-ac7c-8b0c5c07a397',17,0);
insert into [AFEDive].[LIST_ASSOCIATION] Values('0603e1bf-eef4-4130-8ff0-b14167c78abd','SURFACE EQUIPMENT','Level1',null,18,0);
insert into [AFEDive].[LIST_ASSOCIATION] Values('26c0f7b9-2813-4200-9eb9-0d25742e131d','LIGHT PLANTS','Level2','0603e1bf-eef4-4130-8ff0-b14167c78abd',18,0);
insert into [AFEDive].[LIST_ASSOCIATION] Values('34dd46c4-0508-4730-b7e6-7e37f5993086','TABULARS','Level1',null,19,0);
insert into [AFEDive].[LIST_ASSOCIATION] Values('9acdd944-b80f-4d47-9bca-9c48df44bb53','BIT / MILL','Level2','34dd46c4-0508-4730-b7e6-7e37f5993086',19,0);
insert into [AFEDive].[LIST_ASSOCIATION] Values('82c28c90-7bc5-46c8-abaf-9696f691c75f','DRILL COLLARS','Level2','34dd46c4-0508-4730-b7e6-7e37f5993086',19,0);
insert into [AFEDive].[LIST_ASSOCIATION] Values('0887b435-076c-4729-a623-dd2b960ec78b','DRILL PIPE','Level2','34dd46c4-0508-4730-b7e6-7e37f5993086',19,0);
insert into [AFEDive].[LIST_ASSOCIATION] Values('9c504a79-a25d-4cb5-9940-f18668a905a9','HEAVY WEIGHT','Level2','34dd46c4-0508-4730-b7e6-7e37f5993086',19,0);
insert into [AFEDive].[LIST_ASSOCIATION] Values('61d3c2e7-196b-4b62-bea7-a841848243cc','INSEPCTIONS/REPAIRS','Level2','34dd46c4-0508-4730-b7e6-7e37f5993086',19,0);
insert into [AFEDive].[LIST_ASSOCIATION] Values('d3ced836-d7b7-44f5-8035-f53d8c234123','RIG SHAKERS','Level2','34dd46c4-0508-4730-b7e6-7e37f5993086',19,0);
insert into [AFEDive].[LIST_ASSOCIATION] Values('41801fea-3ff3-4ee6-943f-51359388aca4','SOLIDS CONTROL SHAKERS','Level2','34dd46c4-0508-4730-b7e6-7e37f5993086',19,0);
insert into [AFEDive].[LIST_ASSOCIATION] Values('624ba42c-c56e-4cc3-82da-c674b419854f','VDR/SCR','Level1',null,20,0);
insert into [AFEDive].[LIST_ASSOCIATION] Values('fd4944d7-a67b-4e26-b475-0f71c6a3fcef','VDR/SCR','Level2','624ba42c-c56e-4cc3-82da-c674b419854f',20,0);
insert into [AFEDive].[LIST_ASSOCIATION] Values('65a3f878-f9c0-4570-9075-7b911bf8aa38','WELL CONTROL','Level1',null,21,0);
insert into [AFEDive].[LIST_ASSOCIATION] Values('97cc87d9-3cfb-4447-af66-418ceb5ea9e6','ANNULAR','Level2','65a3f878-f9c0-4570-9075-7b911bf8aa38',21,0);
insert into [AFEDive].[LIST_ASSOCIATION] Values('71f298e4-a868-4a66-8850-ca46f5853402','CHOKE LINE','Level2','65a3f878-f9c0-4570-9075-7b911bf8aa38',21,0);
insert into [AFEDive].[LIST_ASSOCIATION] Values('294c18ee-da32-47ce-b6cb-23c6c886ff02','CHOKE MANIFOLD','Level2','65a3f878-f9c0-4570-9075-7b911bf8aa38',21,0);
insert into [AFEDive].[LIST_ASSOCIATION] Values('3ae8586d-584d-4f4b-862e-c95b8db860b3','DIVERTER','Level2','65a3f878-f9c0-4570-9075-7b911bf8aa38',21,0);
insert into [AFEDive].[LIST_ASSOCIATION] Values('0dd60a9d-7511-4dd3-9a6c-40fe3a49431a','FLARE STACK','Level2','65a3f878-f9c0-4570-9075-7b911bf8aa38',21,0);
insert into [AFEDive].[LIST_ASSOCIATION] Values('d9c4bbd7-83ec-476e-b75f-05b1a901d41f','HOSE','Level2','65a3f878-f9c0-4570-9075-7b911bf8aa38',21,0);
insert into [AFEDive].[LIST_ASSOCIATION] Values('7ffa077a-9792-4198-a48f-5fb65d5712b3','HYDRAULIC LINES','Level2','65a3f878-f9c0-4570-9075-7b911bf8aa38',21,0);
insert into [AFEDive].[LIST_ASSOCIATION] Values('a9c97119-3de9-42ff-813e-7424cdfea83a','KILL LINE','Level2','65a3f878-f9c0-4570-9075-7b911bf8aa38',21,0);
insert into [AFEDive].[LIST_ASSOCIATION] Values('a896e98b-b2db-498d-9f3f-170d1188403e','MUD GAS SEPARATOR','Level2','65a3f878-f9c0-4570-9075-7b911bf8aa38',21,0);
insert into [AFEDive].[LIST_ASSOCIATION] Values('ac6af187-2bb7-4ec1-9b5b-881b7b3ef41b','ORBIT VALVE','Level2','65a3f878-f9c0-4570-9075-7b911bf8aa38',21,0);
insert into [AFEDive].[LIST_ASSOCIATION] Values('4f825b70-d30e-47d7-92b0-bc56f8769a83','PIPE RAMS','Level2','65a3f878-f9c0-4570-9075-7b911bf8aa38',21,0);
insert into [AFEDive].[LIST_ASSOCIATION] Values('18b7939b-c0c8-4a43-b5de-dfb20a51634b','ROTATING HEAD','Level2','65a3f878-f9c0-4570-9075-7b911bf8aa38',21,0);
insert into [AFEDive].[LIST_ASSOCIATION] Values('d57a74bf-1a70-49c9-9d4e-6edc8f0f85e1','WIRELINE','Level1',null,22,0)
insert into [AFEDive].[LIST_ASSOCIATION] Values('3460a785-5462-44f8-8361-b805312e5154','WIRELINE','Level2','d57a74bf-1a70-49c9-9d4e-6edc8f0f85e1',22,0);
INSERT into [AFEDive].[LIST_ASSOCIATION] VALUES (N'7f728520-fe16-45f7-b837-0efadb584b55', N'No Action Taken', N'Close', NULL, 0,0);
INSERT into [AFEDive].[LIST_ASSOCIATION] VALUES (N'bc547644-bea6-401d-a9f6-4c91c8566408', N'Adjusted Future AFE - Outdated Costing', N'Close', NULL, 0,0);
INSERT into [AFEDive].[LIST_ASSOCIATION] VALUES (N'15900594-435d-4224-8359-d3ae8467e239', N'Training/Communication with Stakeholders', N'Close', NULL, 0,0);
INSERT into [AFEDive].[LIST_ASSOCIATION] VALUES (N'3de5355d-ffa5-4ee3-b643-dd8a2cf85bce', N'Closeout - Service Provider', N'Close', NULL, 0,0);
INSERT into [AFEDive].[LIST_ASSOCIATION] VALUES (N'd5f9a55f-8acc-4651-8e83-e8dee790723d', N'Assigned to Drilling Program', N'Close', NULL, 0,0);
SET IDENTITY_INSERT [AFEDive].[USER_PERMISSIONS] ON
GO
INSERT [AFEDive].[USER_PERMISSIONS] ([Id], [Business_Unit], [Group], [Permission], [GroupId]) VALUES (1, N'CORPORATE', N'AFEDIVE-Corporate-RO', 0, N'308bb8e1-082c-4a32-83ce-3153199b37b1')
GO
INSERT [AFEDive].[USER_PERMISSIONS] ([Id], [Business_Unit], [Group], [Permission], [GroupId]) VALUES (2, N'EAGLE FORD', N'AFEDIVE-EFDrlg-RW ', 1, N'42ceb72e-3b95-43cf-98d6-e938ddd72d17')
GO
INSERT [AFEDive].[USER_PERMISSIONS] ([Id], [Business_Unit], [Group], [Permission], [GroupId]) VALUES (3, N'EAGLE FORD', N'AFEDIVE-EFCmpl-RW', 1, N'756a2467-6bc8-4b41-b72e-feb08c1dfa3e')
GO
INSERT [AFEDive].[USER_PERMISSIONS] ([Id], [Business_Unit], [Group], [Permission], [GroupId]) VALUES (4, N'PERMIAN', N'AFEDIVE-PERDrlg-RW ', 1, N'6fe5d1a5-409f-43e7-a3e1-69ba2ce1310a')
GO
INSERT [AFEDive].[USER_PERMISSIONS] ([Id], [Business_Unit], [Group], [Permission], [GroupId]) VALUES (5, N'PERMIAN', N'AFEDIVE-PERCmpl-RW', 1, N'ac029182-7aef-4e8d-a313-d1955ca484ef')
GO
INSERT [AFEDive].[USER_PERMISSIONS] ([Id], [Business_Unit], [Group], [Permission], [GroupId]) VALUES (6, N'HAYNESVILLE', N'AFEDIVE-HAYDrlg-RW ', 1, N'de4f2a1c-3937-48f7-bd4f-1c4a406c75c7')
GO
INSERT [AFEDive].[USER_PERMISSIONS] ([Id], [Business_Unit], [Group], [Permission], [GroupId]) VALUES (7, N'HAYNESVILLE', N'AFEDIVE-HAYCmpl-RW', 1, N'b9a4ee6e-f65b-4633-ac3c-a3ce1bf8296e')
GO
INSERT [AFEDive].[USER_PERMISSIONS] ([Id], [Business_Unit], [Group], [Permission], [GroupId]) VALUES (10, N'EAST TEXAS', N'AFEDIVE-HAYCmpl-RW', 1, N'b9a4ee6e-f65b-4633-ac3c-a3ce1bf8296e')
GO
SET IDENTITY_INSERT [AFEDive].[USER_PERMISSIONS] OFF
GO
|
CREATE TABLE `employee` (
`id` int(3) NOT NULL,
`first_name` varchar(20) DEFAULT NULL,
`last_name` varchar(20) DEFAULT NULL,
PRIMARY KEY (`id`)
) ;
|
<reponame>hdelgadillo/main_micro
SELECT A.nombres, A.apellidoP,A.apellidoM,G.calificacion from Alumnos.A,Grupo.G Order By calificacion; |
<gh_stars>0
SELECT * FROM bd_inventaire.coor_temp where mac = 710 order by mac;
-- 1.-
SELECT * FROM bd_inventaire.coor_temp;
-- 2.-
select * from `bd_inventaire`.`tinvmaster` as a inner join bd_inventaire.coor_temp as b on trim(a.poste)=trim(b.mac) order by mac;
-- 3.-
update `bd_inventaire`.`tinvmaster` as a set shape = 'rect',
a.coords = (select coord from bd_inventaire.coor_temp as b where a.poste=b.mac)
where a.coords is null;
SELECT * FROM `bd_inventaire`.`tinvmaster` where poste >= 100 and poste <= 134;
SELECT * FROM `bd_inventaire`.`tinvmaster` where poste = 729;
-- 703 no existe;
-- 710 no existe;
-- 714 no existe;
-- 715 no existe;
-- 729 no existe; |
USE [AnyDatabaseName]
GO
IF OBJECT_ID('dbo.[DF_bnkCustomer_CustomerTicket]', 'D') IS NOT NULL
ALTER TABLE [dbo].[bnkCustomer] DROP CONSTRAINT [DF_bnkCustomer_CustomerTicket]
GO
/****** Object: Table [dbo].[bnkCustomer] - Script Date: 04/27/2018 22:35 ******/
IF OBJECT_ID('dbo.[bnkCustomer]', 'U') IS NOT NULL
DROP TABLE [dbo].[bnkCustomer]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[bnkCustomer](
[CustomerID] [int] IDENTITY(1,1) NOT NULL,
[CustomerTicket] [uniqueidentifier] ROWGUIDCOL NOT NULL,
[Name] [varchar] (32) NULL,
[Address] [varchar] (32) NULL,
[City] [varchar] (32) NULL,
[State] [varchar] (32) NULL,
[ZipCode] [varchar] (12) NULL,
[TIN] [varchar] (16) NULL,
primary key (CustomerID)
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
ALTER TABLE [dbo].[bnkCustomer] ADD CONSTRAINT [DF_bnkCustomer_CustomerTicket] DEFAULT (newid()) FOR [CustomerTicket]
GO
|
<reponame>udakita/toko_indonesia
-- phpMyAdmin SQL Dump
-- version 4.6.5.2
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Aug 29, 2018 at 12:53 PM
-- Server version: 10.1.21-MariaDB
-- PHP Version: 5.6.30
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Database: `db_toko`
--
-- --------------------------------------------------------
--
-- Table structure for table `barang`
--
CREATE TABLE `barang` (
`barangId` varchar(40) NOT NULL,
`barangKategori` varchar(60) DEFAULT NULL,
`barangNama` varchar(80) DEFAULT NULL,
`barangHarga` varchar(20) DEFAULT NULL,
`barangStok` varchar(20) DEFAULT NULL,
`barangSuplier` varchar(40) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `barang`
--
INSERT INTO `barang` (`barangId`, `barangKategori`, `barangNama`, `barangHarga`, `barangStok`, `barangSuplier`) VALUES
('BR1001', 'Makanan', 'Kerupuk Ikan Tengiri', '25.000', '40', 'SP01'),
('BR1002', 'Makanan', 'Keripik Singkong', '10.000', '10', 'SP01'),
('BR1003', 'Makanan', 'Keripik Singkong', '10.000', '10', 'SP01');
-- --------------------------------------------------------
--
-- Table structure for table `supllier`
--
CREATE TABLE `supllier` (
`suplierId` varchar(40) NOT NULL,
`suplierNama` varchar(120) DEFAULT NULL,
`suplierAlamat` varchar(250) DEFAULT NULL,
`suplierKota` varchar(60) DEFAULT NULL,
`suplierTelepon` varchar(40) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `supllier`
--
INSERT INTO `supllier` (`suplierId`, `suplierNama`, `suplierAlamat`, `suplierKota`, `suplierTelepon`) VALUES
('SP01', 'PD Idola Snack', 'Jl. KUD SUKA DAMAI XX', 'BEKASI', '021 333 666 098'),
('SPO2', 'Herborist', 'Jl. Daan Mogot KM 11', 'JAKARTA', '021 456 445 686');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `barang`
--
ALTER TABLE `barang`
ADD PRIMARY KEY (`barangId`),
ADD KEY `barangSuplier` (`barangSuplier`);
--
-- Indexes for table `supllier`
--
ALTER TABLE `supllier`
ADD PRIMARY KEY (`suplierId`);
--
-- Constraints for dumped tables
--
--
-- Constraints for table `barang`
--
ALTER TABLE `barang`
ADD CONSTRAINT `barang_ibfk_1` FOREIGN KEY (`barangSuplier`) REFERENCES `supllier` (`suplierId`) ON DELETE CASCADE ON UPDATE CASCADE;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
CREATE TABLE IF NOT EXISTS apps (
id varchar(255) PRIMARY KEY,
"key" varchar(255) NOT NULL,
secret varchar(255) NOT NULL,
max_connections integer NOT NULL,
enable_client_messages smallint NOT NULL,
"enabled" smallint NOT NULL,
max_backend_events_per_sec integer NOT NULL,
max_client_events_per_sec integer NOT NULL,
max_read_req_per_sec integer NOT NULL,
webhooks json,
max_presence_members_per_channel integer DEFAULT NULL,
max_presence_member_size_in_kb integer DEFAULT NULL,
max_channel_name_length integer DEFAULT NULL,
max_event_channels_at_once integer DEFAULT NULL,
max_event_name_length integer DEFAULT NULL,
max_event_payload_in_kb integer DEFAULT NULL,
max_event_batch_size integer DEFAULT NULL
);
INSERT INTO apps (
id,
"key",
secret,
max_connections,
"enabled",
enable_client_messages,
max_backend_events_per_sec,
max_client_events_per_sec,
max_read_req_per_sec,
webhooks,
max_presence_members_per_channel,
max_presence_member_size_in_kb,
max_channel_name_length,
max_event_channels_at_once,
max_event_name_length,
max_event_payload_in_kb,
max_event_batch_size
) VALUES (
'app-id',
'app-key',
'app-secret',
200,
1,
1,
-1,
-1,
-1,
'[]',
null,
null,
null,
null,
null,
null,
null
);
|
<filename>undergrad/dbscratch/learn-db/hw/hw38_09.sql
SELECT doc_id, document_title
FROM indexed_docs
WHERE document_tokens @@ to_tsquery('die & democracy')
;
|
SHOW TOPICS;
|
--------------------------------------------------------
-- DDL for Table ALL_SPCODES
--------------------------------------------------------
CREATE TABLE "GROUNDFISH"."ALL_SPCODES"
( "SOURCE" VARCHAR2(4 BYTE),
"RESEARCH" NUMBER,
"SCIENTIF" VARCHAR2(50 BYTE),
"COMMON" VARCHAR2(50 BYTE),
"TSN" NUMBER,
"NMFS" NUMBER,
"IML" NUMBER
) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
STORAGE(INITIAL 65536 NEXT 65536 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
TABLESPACE "MFD_GROUNDFISH" ;
GRANT SELECT ON "GROUNDFISH"."ALL_SPCODES" TO "RICARDD";
GRANT SELECT ON "GROUNDFISH"."ALL_SPCODES" TO "HUBLEYB";
GRANT SELECT ON "GROUNDFISH"."ALL_SPCODES" TO "GREYSONP";
|
<filename>modules/boonex/organizations/updates/13.0.0_13.0.1/install/sql/enable.sql
-- PAGES
DELETE FROM `sys_pages_blocks` WHERE `object`='bx_organizations_view_profile' AND `title` IN ('_bx_orgs_page_block_title_cover_block', '_bx_orgs_page_block_title_profile_friends_mutual');
INSERT INTO `sys_pages_blocks`(`object`, `cell_id`, `module`, `title_system`, `title`, `designbox_id`, `visible_for_levels`, `type`, `content`, `deletable`, `copyable`, `active`, `order`) VALUES
('bx_organizations_view_profile', 0, 'bx_organizations', '_bx_orgs_page_block_title_sys_cover_block', '_bx_orgs_page_block_title_cover_block', 3, 2147483647, 'service', 'a:2:{s:6:\"module\";s:16:\"bx_organizations\";s:6:\"method\";s:12:\"entity_cover\";}', 0, 0, 1, 0),
('bx_organizations_view_profile', 0, 'bx_organizations', '', '_bx_orgs_page_block_title_profile_friends_mutual', 11, 2147483647, 'service', 'a:2:{s:6:\"module\";s:16:\"bx_organizations\";s:6:\"method\";s:22:\"profile_friends_mutual\";}', 0, 0, 1, 0);
DELETE FROM `sys_pages_blocks` WHERE `object`='' AND `module`='bx_organizations' AND `title`='_bx_orgs_page_block_title_cover_block';
UPDATE `sys_pages_blocks` SET `content`='a:3:{s:6:\"module\";s:16:\"bx_organizations\";s:6:\"method\";s:22:\"browse_active_profiles\";s:6:\"params\";a:3:{s:9:\"unit_view\";s:12:\"unit_wo_info\";s:13:\"empty_message\";b:0;s:13:\"ajax_paginate\";b:0;}}' WHERE `module`='bx_organizations' AND (`title`='_bx_orgs_page_block_title_active_profiles' OR `title` LIKE '_bx_orgs_page_block_title_active_profiles_%') AND `content` LIKE '%gallery_wo_info%';
DELETE FROM `sys_pages_blocks` WHERE `object`='' AND `module`='bx_organizations' AND `title`='_bx_orgs_page_block_title_familiar_profiles';
SET @iBlockOrder = (SELECT `order` FROM `sys_pages_blocks` WHERE `object` = '' AND `cell_id` = 0 ORDER BY `order` DESC LIMIT 1);
INSERT INTO `sys_pages_blocks` (`object`, `cell_id`, `module`, `title_system`, `title`, `designbox_id`, `visible_for_levels`, `type`, `content`, `deletable`, `copyable`, `active`, `order`) VALUES
('', 0, 'bx_organizations', '_bx_orgs_page_block_title_sys_familiar_profiles', '_bx_orgs_page_block_title_familiar_profiles', 11, 2147483647, 'service', 'a:3:{s:6:\"module\";s:16:\"bx_organizations\";s:6:\"method\";s:24:\"browse_familiar_profiles\";s:6:\"params\";a:4:{s:10:\"connection\";s:20:\"sys_profiles_friends\";s:9:\"unit_view\";s:4:\"unit\";s:13:\"empty_message\";b:0;s:13:\"ajax_paginate\";b:0;}}', 0, 1, 1, IFNULL(@iBlockOrder, 0) + 1);
-- MENUS
UPDATE `sys_menu_items` SET `onclick`='bx_menu_popup(''sys_set_acl_level'', window, {id:{value:''sys_acl_set_{profile_id}'', force:true}, closeOnOuterClick: false, removeOnClose: true, displayMode: ''box'', cssClass: ''''}, {profile_id: {profile_id}});' WHERE `set_name`='bx_organizations_view_actions' AND `name`='profile-set-acl-level';
DELETE FROM `sys_menu_items` WHERE `set_name`='bx_organizations_view_actions_all' AND `name` IN ('social-sharing', 'social-sharing-facebook', 'social-sharing-twitter', 'social-sharing-pinterest');
INSERT INTO `sys_menu_items`(`set_name`, `module`, `name`, `title_system`, `title`, `link`, `onclick`, `target`, `icon`, `addon`, `submenu_object`, `submenu_popup`, `visible_for_levels`, `visibility_custom`, `active`, `copyable`, `order`) VALUES
('bx_organizations_view_actions_all', 'bx_organizations', 'social-sharing', '_sys_menu_item_title_system_social_sharing', '_sys_menu_item_title_social_sharing', 'javascript:void(0)', 'oBxDolPage.share(this, \'{url_encoded}\')', '', 'share', '', '', 0, 2147483647, '', 1, 0, 300);
DELETE FROM `sys_menu_items` WHERE `set_name`='bx_organizations_snippet_meta' AND `name`='friends-mutual';
INSERT INTO `sys_menu_items`(`set_name`, `module`, `name`, `title_system`, `title`, `link`, `onclick`, `target`, `icon`, `submenu_object`, `visible_for_levels`, `visibility_custom`, `active`, `copyable`, `editable`, `order`) VALUES
('bx_organizations_snippet_meta', 'bx_organizations', 'friends-mutual', '_sys_menu_item_title_system_sm_friends_mutual', '_sys_menu_item_title_sm_friends_mutual', '', '', '', '', '', 2147483647, '', 0, 0, 1, 0);
UPDATE `sys_menu_items` SET `collapsed`='0' WHERE `set_name`='sys_profile_followings' AND `name`='organizations';
-- METATAGS
UPDATE `sys_objects_metatags` SET `module`='bx_organizations' WHERE `object`='bx_organizations';
-- CATEGORY
UPDATE `sys_objects_category` SET `module`='bx_organizations' WHERE `object`='bx_organizations_cats';
-- CONNECTIONS
UPDATE `sys_objects_connection` SET `profile_initiator`='1', `profile_content`='1' WHERE `object`='bx_organizations_fans';
|
--
-- Name: kartoza_fba_generate_excel_all_flood_events(); Type: FUNCTION; Schema: public; Owner: -
--
DROP FUNCTION IF EXISTS public.kartoza_fba_generate_excel_all_flood_events;
CREATE FUNCTION public.kartoza_fba_generate_excel_all_flood_events() RETURNS character varying
LANGUAGE plpython3u
AS $_$
res = plpy.execute("SELECT id from hazard_event")
for flood_event in res:
plan = plpy.prepare("SELECT * from kartoza_fba_generate_excel_report_for_flood(($1))", ["integer"])
plpy.execute(plan, [flood_event['id']])
return "OK"
$_$;
|
-- --------------------------------
-- MM-Wiki 表结构
-- author: phachon
-- --------------------------------
-- 手动安装时首先需要创建数据库
-- CREATE DATABASE IF NOT EXISTS mm_wiki DEFAULT CHARSET utf8;
-- --------------------------------
-- 用户表
-- --------------------------------
DROP TABLE IF EXISTS `mw_user`;
CREATE TABLE `mw_user` (
`user_id` int(10) NOT NULL AUTO_INCREMENT COMMENT '用户 id',
`username` varchar(100) NOT NULL DEFAULT '' COMMENT '用户名',
`password` char(32) NOT NULL DEFAULT '' COMMENT '密码',
`given_name` varchar(50) NOT NULL DEFAULT '' COMMENT '姓名',
`mobile` char(13) NOT NULL DEFAULT '' COMMENT '手机号',
`phone` char(13) NOT NULL DEFAULT '' COMMENT '电话',
`email` varchar(50) NOT NULL DEFAULT '' COMMENT '邮箱',
`department` char(50) NOT NULL DEFAULT '' COMMENT '部门',
`position` char(50) NOT NULL DEFAULT '' COMMENT '职位',
`location` char(50) NOT NULL DEFAULT '' COMMENT '位置',
`im` char(50) NOT NULL DEFAULT '' COMMENT '即时聊天工具',
`last_ip` varchar(15) NOT NULL DEFAULT '' COMMENT '最后登录ip',
`last_time` int(11) NOT NULL DEFAULT '0' COMMENT '最后登录时间',
`role_id` tinyint(3) NOT NULL DEFAULT '0' COMMENT '角色 id',
`is_forbidden` tinyint(3) NOT NULL DEFAULT '0' COMMENT '是否屏蔽,0 否 1 是',
`is_delete` tinyint(3) NOT NULL DEFAULT '0' COMMENT '是否删除,0 否 1 是',
`create_time` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
`update_time` int(11) NOT NULL DEFAULT '0' COMMENT '更新时间',
PRIMARY KEY (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='用户表';
-- ---------------------------------------------------------------
-- 系统角色表
-- ---------------------------------------------------------------
DROP TABLE IF EXISTS `mw_role`;
CREATE TABLE `mw_role` (
`role_id` int(10) NOT NULL AUTO_INCREMENT COMMENT '角色 id',
`name` char(10) NOT NULL DEFAULT '' COMMENT '角色名称',
`type` tinyint(3) NOT NULL DEFAULT '0' COMMENT '角色类型 0 自定义角色,1 系统角色',
`is_delete` tinyint(3) NOT NULL DEFAULT '0' COMMENT '是否删除,0 否 1 是',
`create_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
`update_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间',
PRIMARY KEY (`role_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='系统角色表';
-- -------------------------------------------------------
-- 系统权限表
-- -------------------------------------------------------
DROP TABLE IF EXISTS `mw_privilege`;
CREATE TABLE `mw_privilege` (
`privilege_id` int(10) NOT NULL AUTO_INCREMENT COMMENT '权限id',
`name` char(30) NOT NULL DEFAULT '' COMMENT '权限名',
`parent_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '上级',
`type` enum('controller','menu') DEFAULT 'controller' COMMENT '权限类型:控制器、菜单',
`controller` char(100) NOT NULL DEFAULT '' COMMENT '控制器',
`action` char(100) NOT NULL DEFAULT '' COMMENT '动作',
`icon` char(100) NOT NULL DEFAULT '' COMMENT '图标(用于展示)',
`target` char(200) NOT NULL DEFAULT '' COMMENT '目标地址',
`is_display` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否显示:0不显示 1显示',
`sequence` int(10) NOT NULL DEFAULT '0' COMMENT '排序(越小越靠前)',
`create_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
`update_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间',
PRIMARY KEY (`privilege_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='系统权限表';
-- ------------------------------------------------------------------
-- 系统角色权限对应关系表
-- ------------------------------------------------------------------
DROP TABLE IF EXISTS `mw_role_privilege`;
CREATE TABLE `mw_role_privilege` (
`role_privilege_id` int(10) NOT NULL AUTO_INCREMENT COMMENT '角色权限关系 id',
`role_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '角色id',
`privilege_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '权限id',
`create_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
PRIMARY KEY (`role_privilege_id`),
KEY (`role_id`),
KEY (`privilege_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='系统角色权限对应关系表';
-- --------------------------------
-- 空间表
-- --------------------------------
DROP TABLE IF EXISTS `mw_space`;
CREATE TABLE `mw_space` (
`space_id` int(10) NOT NULL AUTO_INCREMENT COMMENT '空间 id',
`name` varchar(50) NOT NULL DEFAULT '' COMMENT '名称',
`description` varchar(100) NOT NULL DEFAULT '' COMMENT '描述',
`tags` varchar(255) NOT NULL DEFAULT '' COMMENT '标签',
`visit_level` enum('private','public') NOT NULL DEFAULT 'public' COMMENT '访问级别:private,public',
`is_share` tinyint(3) NOT NULL DEFAULT '1' COMMENT '文档是否允许分享 0 否 1 是',
`is_export` tinyint(3) NOT NULL DEFAULT '1' COMMENT '文档是否允许导出 0 否 1 是',
`is_delete` tinyint(3) NOT NULL DEFAULT '0' COMMENT '是否删除 0 否 1 是',
`create_time` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
`update_time` int(11) NOT NULL DEFAULT '0' COMMENT '更新时间',
PRIMARY KEY (`space_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='空间表';
-- --------------------------------
-- 空间成员表
-- --------------------------------
DROP TABLE IF EXISTS `mw_space_user`;
CREATE TABLE `mw_space_user` (
`space_user_id` int(10) NOT NULL AUTO_INCREMENT COMMENT '用户空间关系 id',
`user_id` int(10) NOT NULL DEFAULT '0' COMMENT '用户 id',
`space_id` int(10) NOT NULL DEFAULT '0' COMMENT '空间 id',
`privilege` tinyint(3) NOT NULL DEFAULT '0' COMMENT '空间成员操作权限 0 浏览者 1 编辑者 2 管理员',
`create_time` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
`update_time` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间',
PRIMARY KEY (`space_user_id`),
UNIQUE KEY (`user_id`, `space_id`),
KEY (`user_id`),
KEY (`space_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='空间成员表';
-- --------------------------------
-- 文档表
-- --------------------------------
DROP TABLE IF EXISTS `mw_document`;
CREATE TABLE `mw_document` (
`document_id` int(10) NOT NULL AUTO_INCREMENT COMMENT '文档 id',
`parent_id` int(10) NOT NULL DEFAULT '0' COMMENT '文档父 id',
`space_id` int(10) NOT NULL DEFAULT '0' COMMENT '空间id',
`name` varchar(150) NOT NULL DEFAULT '' COMMENT '文档名称',
`type` tinyint(3) NOT NULL DEFAULT '1' COMMENT '文档类型 1 page 2 dir',
`path` char(30) NOT NULL DEFAULT '0' COMMENT '存储根文档到父文档的 document_id 值, 格式 0,1,2,...',
`sequence` int(10) NOT NULL DEFAULT '0' COMMENT '排序号(越小越靠前)',
`create_user_id` int(10) NOT NULL DEFAULT '0' COMMENT '创建用户 id',
`edit_user_id` int(10) NOT NULL DEFAULT '0' COMMENT '最后修改用户 id',
`is_delete` tinyint(3) NOT NULL DEFAULT '0' COMMENT '是否删除 0 否 1 是',
`create_time` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
`update_time` int(11) NOT NULL DEFAULT '0' COMMENT '更新时间',
PRIMARY KEY (`document_id`),
KEY (`parent_id`),
KEY (`space_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='文档表';
-- --------------------------------
-- 用户收藏表
-- --------------------------------
DROP TABLE IF EXISTS `mw_collection`;
CREATE TABLE `mw_collection` (
`collection_id` int(10) NOT NULL AUTO_INCREMENT COMMENT '用户收藏关系 id',
`user_id` int(10) NOT NULL DEFAULT '0' COMMENT '用户id',
`type` tinyint(3) NOT NULL DEFAULT '1' COMMENT '收藏类型 1 文档 2 空间',
`resource_id` int(10) NOT NULL DEFAULT '0' COMMENT '收藏资源 id ',
`create_time` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
PRIMARY KEY (`collection_id`),
KEY (`user_id`),
UNIQUE key (`user_id`, `resource_id`, `type`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='用户收藏表';
-- --------------------------------
-- 用户关注表
-- --------------------------------
DROP TABLE IF EXISTS `mw_follow`;
CREATE TABLE `mw_follow` (
`follow_id` int(10) NOT NULL AUTO_INCREMENT COMMENT '关注 id',
`user_id` int(10) NOT NULL DEFAULT '0' COMMENT '用户id',
`type` tinyint(3) NOT NULL DEFAULT '1' COMMENT '关注类型 1 文档 2 用户',
`object_id` int(10) NOT NULL DEFAULT '0' COMMENT '关注对象 id',
`create_time` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
PRIMARY KEY (`follow_id`),
KEY (`user_id`),
KEY (`object_id`),
UNIQUE key (`user_id`, `object_id`, `type`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='用户关注表';
-- --------------------------------
-- 文档日志表
-- --------------------------------
DROP TABLE IF EXISTS `mw_log_document`;
CREATE TABLE `mw_log_document` (
`log_document_id` int(10) NOT NULL AUTO_INCREMENT COMMENT '文档日志 id',
`document_id` int(10) NOT NULL DEFAULT '0' COMMENT '文档id',
`user_id` int(10) NOT NULL DEFAULT '0' COMMENT '用户id',
`action` tinyint(3) NOT NULL DEFAULT '1' COMMENT '动作 1 创建 2 修改 3 删除',
`comment` varchar(255) NOT NULL DEFAULT '' COMMENT '备注信息',
`create_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
PRIMARY KEY (`log_document_id`),
KEY (`document_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='文档日志表';
-- --------------------------------
-- 系统操作日志表
-- --------------------------------
DROP TABLE IF EXISTS `mw_log`;
CREATE TABLE `mw_log` (
`log_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '系统操作日志 id',
`level` tinyint(3) NOT NULL DEFAULT '6' COMMENT '日志级别',
`path` char(100) NOT NULL DEFAULT '' COMMENT '请求路径',
`get` text NOT NULL COMMENT 'get参数',
`post` text NOT NULL COMMENT 'post参数',
`message` varchar(255) NOT NULL DEFAULT '' COMMENT '信息',
`ip` char(100) NOT NULL DEFAULT '' COMMENT 'ip地址',
`user_agent` char(200) NOT NULL DEFAULT '' COMMENT '用户代理',
`referer` char(100) NOT NULL DEFAULT '' COMMENT 'referer',
`user_id` int(10) NOT NULL DEFAULT '0' COMMENT '用户id',
`username` char(100) NOT NULL DEFAULT '' COMMENT '用户名',
`create_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
PRIMARY KEY (`log_id`),
KEY (`level`, `username`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='系统操作日志表';
-- --------------------------------
-- 邮件服务器表
-- --------------------------------
DROP TABLE IF EXISTS `mw_email`;
CREATE TABLE `mw_email` (
`email_id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '邮箱 id',
`name` varchar(100) NOT NULL DEFAULT '' COMMENT '邮箱服务器名称',
`sender_address` varchar(100) NOT NULL DEFAULT '' COMMENT '发件人邮件地址',
`sender_name` varchar(100) NOT NULL DEFAULT '' COMMENT '发件人显示名',
`sender_title_prefix` varchar(100) NOT NULL DEFAULT '' COMMENT '发送邮件标题前缀',
`host` char(100) NOT NULL DEFAULT '' COMMENT '服务器主机名',
`port` int(5) NOT NULL DEFAULT '25' COMMENT '服务器端口',
`username` varchar(50) NOT NULL DEFAULT '' COMMENT '用户名',
`password` varchar(50) NOT NULL DEFAULT '' COMMENT '密码',
`is_ssl` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否使用ssl, 0 默认不使用 1 使用',
`is_used` tinyint(3) NOT NULL DEFAULT '0' COMMENT '是否被使用, 0 默认不使用 1 使用',
`create_time` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
`update_time` int(11) NOT NULL DEFAULT '0' COMMENT '更新时间',
PRIMARY KEY (`email_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='邮件服务器表';
-- --------------------------------
-- 快捷链接表
-- --------------------------------
DROP TABLE IF EXISTS `mw_link`;
CREATE TABLE `mw_link` (
`link_id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '链接 id',
`name` varchar(50) NOT NULL DEFAULT '' COMMENT '链接名称',
`url` varchar(100) NOT NULL DEFAULT '' COMMENT '链接地址',
`sequence` int(10) NOT NULL DEFAULT '0' COMMENT '排序号(越小越靠前)',
`create_time` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
`update_time` int(11) NOT NULL DEFAULT '0' COMMENT '更新时间',
PRIMARY KEY (`link_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='快捷链接表';
-- --------------------------------
-- 统一登录认证表
-- --------------------------------
DROP TABLE IF EXISTS `mw_login_auth`;
CREATE TABLE `mw_login_auth` (
`login_auth_id` int(11) NOT NULL AUTO_INCREMENT COMMENT '认证表主键ID',
`name` varchar(30) NOT NULL COMMENT '登录认证名称',
`username_prefix` varchar(30) NOT NULL COMMENT '用户名前缀',
`url` varchar(200) NOT NULL COMMENT '认证接口 url',
`ext_data` char(100) NOT NULL DEFAULT '' COMMENT '额外数据: token=aaa&key=bbb',
`is_used` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否被使用, 0 默认不使用 1 使用',
`is_delete` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否删除 0 否 1 是',
`create_time` int(11) NOT NULL COMMENT '创建时间',
`update_time` int(11) NOT NULL COMMENT '更新时间',
PRIMARY KEY (`login_auth_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='统一登录认证表';
-- --------------------------------
-- 全局配置表
-- --------------------------------
DROP TABLE IF EXISTS `mw_config`;
CREATE TABLE `mw_config` (
`config_id` int(11) NOT NULL AUTO_INCREMENT COMMENT '配置表主键Id',
`name` varchar(100) NOT NULL DEFAULT '' COMMENT '配置名称',
`key` char(50) NOT NULL DEFAULT '' COMMENT '配置键',
`value` text NOT NULL COMMENT '配置值',
`create_time` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
`update_time` int(11) NOT NULL DEFAULT '0' COMMENT '更新时间',
PRIMARY KEY (`config_id`),
unique KEY (`key`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='全局配置表';
-- --------------------------------
-- 系统联系人表
-- --------------------------------
DROP TABLE IF EXISTS `mw_contact`;
CREATE TABLE `mw_contact` (
`contact_id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '联系人 id',
`name` varchar(50) NOT NULL DEFAULT '' COMMENT '联系人名称',
`mobile` char(13) NOT NULL DEFAULT '' COMMENT '联系电话',
`email` varchar(50) NOT NULL DEFAULT '' COMMENT '邮箱',
`position` varchar(100) NOT NULL DEFAULT '' COMMENT '联系人职位',
`create_time` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
`update_time` int(11) NOT NULL DEFAULT '0' COMMENT '更新时间',
PRIMARY KEY (`contact_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='联系人表';
-- --------------------------------
-- 附件信息表
-- --------------------------------
DROP TABLE IF EXISTS `mw_attachment`;
CREATE TABLE `mw_attachment` (
`attachment_id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '附件 id',
`user_id` int(10) NOT NULL DEFAULT '0' COMMENT '创建用户id',
`document_id` int(10) NOT NULL DEFAULT '0' COMMENT '所属文档id',
`name` varchar(50) NOT NULL DEFAULT '' COMMENT '附件名称',
`path` varchar(100) NOT NULL DEFAULT '' COMMENT '附件路径',
`source` tinyint(1) NOT NULL DEFAULT '0' COMMENT '附件来源, 0 默认是附件 1 图片',
`create_time` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
`update_time` int(11) NOT NULL DEFAULT '0' COMMENT '更新时间',
PRIMARY KEY (`attachment_id`),
KEY (`document_id`, `source`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='附件信息表'; |
-- MySQL dump 10.15 Distrib 10.0.35-MariaDB, for Linux (x86_64)
--
-- Host: localhost Database: exomevcfe
-- ------------------------------------------------------
-- Server version 10.0.35-MariaDB
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
--
-- Table structure for table `comment`
--
DROP TABLE IF EXISTS `comment`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `comment` (
`idcomment` int(10) unsigned NOT NULL AUTO_INCREMENT,
`idsnv` int(11) unsigned NOT NULL,
`idsample` int(11) unsigned NOT NULL,
`reason` varchar(45) NOT NULL,
`chrom` varchar(45) NOT NULL,
`start` int(11) NOT NULL,
`end` int(11) NOT NULL,
`refallele` varchar(255) NOT NULL,
`altallele` varchar(255) NOT NULL,
`rating` varchar(45) DEFAULT NULL,
`checked` varchar(45) DEFAULT NULL,
`confirmed` varchar(45) DEFAULT NULL,
`genotype` varchar(45) DEFAULT NULL,
`inheritance` varchar(45) DEFAULT NULL,
`confirmedcomment` varchar(255) DEFAULT NULL,
`gene` varchar(45) DEFAULT NULL,
`disease` varchar(45) DEFAULT NULL,
`diseasecomment` blob,
`user` varchar(100) NOT NULL,
`indate` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
`changedate` timestamp NULL DEFAULT NULL,
`pathocomment` varchar(255) DEFAULT NULL,
`patho` enum('unknown','pathogenic','likely pathogenic','unknown significance','likely benign','benign') NOT NULL,
`clinvardate` date NOT NULL DEFAULT '0000-00-00',
`clinvarscv` char(12) NOT NULL DEFAULT '',
`clinvarlocalkey` char(12) NOT NULL DEFAULT '',
PRIMARY KEY (`idcomment`),
UNIQUE KEY `idsample_idsnv_idx` (`idsnv`,`idsample`),
UNIQUE KEY `comment_idsample_variant` (`idsample`,`chrom`,`start`,`refallele`,`altallele`),
KEY `chromstart_idx` (`chrom`,`start`),
KEY `refallele` (`refallele`),
KEY `altallele` (`altallele`)
) ENGINE=InnoDB AUTO_INCREMENT=21377 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `conclusion`
--
DROP TABLE IF EXISTS `conclusion`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `conclusion` (
`idconclusion` int(10) unsigned NOT NULL AUTO_INCREMENT,
`idsample` int(11) unsigned NOT NULL,
`solved` int(11) NOT NULL,
`genesymbol` varchar(150) NOT NULL,
`conclusion` varchar(255) DEFAULT NULL,
`comment` varchar(255) DEFAULT NULL,
`user` varchar(100) NOT NULL,
`indate` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
`changedate` timestamp NULL DEFAULT NULL,
`omimphenotype` varchar(10) NOT NULL DEFAULT '',
`pmid` varchar(10) NOT NULL DEFAULT '',
PRIMARY KEY (`idconclusion`),
UNIQUE KEY `idsample_conclusion_idx` (`idsample`)
) ENGINE=InnoDB AUTO_INCREMENT=4864 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `hpo`
--
DROP TABLE IF EXISTS `hpo`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `hpo` (
`idsample` int(11) unsigned NOT NULL,
`samplename` varchar(45) NOT NULL,
`hpo` char(10) DEFAULT '',
`symptoms` varchar(255) DEFAULT '',
`lastuser` varchar(45) NOT NULL,
`active` tinyint(1) NOT NULL DEFAULT '1',
`dateentered` datetime DEFAULT CURRENT_TIMESTAMP,
KEY `hpoidsample` (`idsample`),
KEY `hpohpo` (`hpo`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `loginold`
--
DROP TABLE IF EXISTS `loginold`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `loginold` (
`idlogin` int(10) unsigned NOT NULL AUTO_INCREMENT,
`user` varchar(45) NOT NULL,
`succeeded_all` int(10) unsigned NOT NULL DEFAULT '0',
`failed_all` int(10) unsigned NOT NULL DEFAULT '0',
`failed_last` int(10) unsigned NOT NULL DEFAULT '0',
`lastlogin` date NOT NULL DEFAULT '0000-00-00',
PRIMARY KEY (`idlogin`),
UNIQUE KEY `idlogin_UNIQUE` (`idlogin`)
) ENGINE=InnoDB AUTO_INCREMENT=76 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `user`
--
DROP TABLE IF EXISTS `user`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `user` (
`iduser` int(10) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(45) NOT NULL DEFAULT '',
`password` varchar(100) NOT NULL DEFAULT '',
`yubikey` varchar(45) NOT NULL DEFAULT '',
`igvport` varchar(45) NOT NULL DEFAULT '',
`cooperations` varchar(255) NOT NULL DEFAULT '',
`projects` varchar(255) NOT NULL DEFAULT '',
`succeeded_all` int(10) NOT NULL DEFAULT '0',
`failed_all` int(10) NOT NULL DEFAULT '0',
`failed_last` int(10) NOT NULL DEFAULT '0',
`role` varchar(45) NOT NULL DEFAULT '',
`edit` int(1) DEFAULT '0',
`comment` varchar(255) NOT NULL DEFAULT '',
`genesearch` tinyint(4) DEFAULT '0',
`genesearchcount` int(11) DEFAULT '0',
`lastlogin` date NOT NULL DEFAULT '0000-00-00',
PRIMARY KEY (`iduser`),
UNIQUE KEY `name_UNIQUE` (`name`)
) ENGINE=MyISAM AUTO_INCREMENT=145 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2019-11-25 13:57:14
|
CREATE TABLE CUSTOMERS
(
ID VARCHAR(40) PRIMARY KEY,
NAME VARCHAR(255) NOT NULL
); |
<gh_stars>10-100
-- 节点表加入V2ray加密方式
ALTER TABLE `ss_node`
ADD COLUMN `v2_method` VARCHAR(32) NOT NULL DEFAULT 'aes-128-gcm' COMMENT 'V2ray加密方式' AFTER `v2_port`;
|
<gh_stars>10-100
CREATE TABLE `admin_location_requested` (
`id_admin_location_requested` int(11) unsigned NOT NULL AUTO_INCREMENT,
`id_admin` int(11) unsigned DEFAULT NULL,
`status` enum('permitted','denied') DEFAULT 'permitted',
`date` datetime DEFAULT NULL,
PRIMARY KEY (`id_admin_location_requested`),
KEY `id_admin` (`id_admin`),
CONSTRAINT `admin_location_requested_ibfk_1` FOREIGN KEY (`id_admin`) REFERENCES `admin` (`id_admin`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8; |
create view "postgres"._airbyte_test_normalization_namespace."simple_stream_with_n__lting_into_long_names_ab3__dbt_tmp" as (
-- SQL model to build a hash column based on the values of this record
select
md5(cast(coalesce(cast("id" as
varchar
), '') || '-' || coalesce(cast("date" as
varchar
), '') as
varchar
)) as _airbyte_simple_stre__nto_long_names_hashid,
tmp.*
from "postgres"._airbyte_test_normalization_namespace."simple_stream_with_n__lting_into_long_names_ab2" tmp
-- simple_stream_with_n__lting_into_long_names
where 1 = 1
);
|
/*
Navicat Premium Data Transfer
Source Server : L Venus - 192.168.31.102
Source Server Type : MySQL
Source Server Version : 80011
Source Host : 192.168.31.102:3306
Source Schema : album
Target Server Type : MySQL
Target Server Version : 80011
File Encoding : 65001
Date: 18/12/2018 21:49:10
*/
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for tab_qmusic_singerstat
-- ----------------------------
DROP TABLE IF EXISTS `tab_qmusic_singerstat`;
CREATE TABLE `tab_qmusic_singerstat` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'ID',
`sid` int(10) NOT NULL COMMENT '歌手ID',
`sname` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '歌手名称',
`today_persons` int(10) NOT NULL COMMENT '今日助燃人数',
`total_persons` int(10) NOT NULL COMMENT '总助燃人数',
`total_albums` int(10) NOT NULL COMMENT '总助燃次数',
`time` int(10) NOT NULL COMMENT '时间',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;
SET FOREIGN_KEY_CHECKS = 1;
|
<gh_stars>1-10
INSERT INTO "managers" ("managerId", "name", "alias") VALUES (1, '<NAME>', 'John');
INSERT INTO "managers" ("managerId", "name", "alias") VALUES (2, '<NAME>', 'Lee');
INSERT INTO "managers" ("managerId", "name", "alias") VALUES (3, '<NAME>', 'Scott');
INSERT INTO "managers" ("managerId", "name", "alias") VALUES (4, '<NAME>', 'Billy');
INSERT INTO "managers" ("managerId", "name", "alias") VALUES (5, '<NAME>', 'Tommy');
INSERT INTO "managers" ("managerId", "name", "alias") VALUES (6, '<NAME>', 'David');
INSERT INTO "managers" ("managerId", "name", "alias") VALUES (7, '<NAME>', 'Bob');
INSERT INTO "managers" ("managerId", "name", "alias") VALUES (8, '<NAME>', 'Darren');
INSERT INTO "managers" ("managerId", "name", "alias") VALUES (9, '<NAME>', 'Michael');
INSERT INTO "managers" ("managerId", "name", "alias") VALUES (10, '<NAME>', 'Rob');
INSERT INTO "managers" ("managerId", "name", "alias") VALUES (11, '<NAME>', 'Ben');
INSERT INTO "managers" ("managerId", "name", "alias") VALUES (12, '<NAME>', 'Tucker');
|
-- file:insert_conflict.sql ln:96 expect:true
insert into insertconflicttest
values (1, 'Apple'), (2, 'Orange')
on conflict (key) do update set (fruit, key) = (excluded.fruit, excluded.key)
|
<reponame>jkvetina/BUG<filename>views/nav_badges.sql
CREATE OR REPLACE FORCE VIEW nav_badges AS
SELECT
900 AS page_id,
' ' AS page_alias,
TO_CHAR(NULLIF(COUNT(*), 0)) AS badge
FROM logs l
WHERE l.created_at >= app.get_date()
AND l.created_at < app.get_date() + 1
AND l.flag = 'E'
AND auth.is_developer = 'Y'
UNION ALL
--
SELECT
950 AS page_id,
'' AS page_alias,
TO_CHAR(NULLIF(COUNT(*), 0)) AS badge
FROM user_objects o
WHERE o.status != 'VALID'
AND auth.is_developer = 'Y'
UNION ALL
--
SELECT
902 AS page_id,
'sessions' AS page_alias,
TO_CHAR(COUNT(DISTINCT s.session_id)) AS badge
FROM sessions s
WHERE s.updated_at >= app.get_date()
AND s.updated_at < app.get_date() + 1
AND auth.is_developer = 'Y'
UNION ALL
--
SELECT
901 AS page_id,
NULL AS page_alias,
TO_CHAR(COUNT(l.log_id)) AS badge
FROM logs l
WHERE l.created_at >= app.get_date()
AND l.created_at < app.get_date() + 1
AND auth.is_developer = 'Y';
--
COMMENT ON TABLE nav_badges IS 'View with current badges in top menu';
--
COMMENT ON COLUMN nav_badges.page_id IS 'Page ID with badge';
COMMENT ON COLUMN nav_badges.page_alias IS 'Page alias when page has no ID and need badge';
COMMENT ON COLUMN nav_badges.badge IS 'Badge value (string)';
|
<filename>src/spatial-1-merge-stations.sql
begin;
drop table if exists overlapping_stations;
drop table if exists station_set;
drop table if exists merged_stations;
create table overlapping_stations (
a_id integer not null,
b_id integer not null,
primary key (a_id, b_id)
);
create table station_set (
station_id integer primary key,
set_key integer not null
);
create index station_set_key on station_set (set_key);
create table merged_stations (
new_id integer primary key,
old_id integer array,
area geometry(polygon, 3857)
);
insert into overlapping_stations (a_id, b_id)
select a.station_id, b.station_id
from power_station a, power_station b
where a.station_id < b.station_id
and st_dwithin(a.area, b.area, 0);
insert into station_set (station_id, set_key)
select station_id, station_id from (
select a_id from overlapping_stations union select b_id from overlapping_stations
) f (station_id);
do $$
declare
pair overlapping_stations;
src_key integer;
dst_key integer;
begin
for pair in select * from overlapping_stations loop
src_key = set_key from station_set where station_id = pair.a_id;
dst_key = set_key from station_set where station_id = pair.b_id;
if src_key != dst_key then
update station_set set set_key = src_key where set_key = dst_key;
end if;
end loop;
end;
$$ language plpgsql;
insert into merged_stations (new_id, old_id, area)
select nextval('station_id'), old_id, area from (
select array_agg(z.station_id), st_union(s.area)
from station_set z
join power_station s on s.station_id = z.station_id
group by set_key
) f(old_id, area);
-- TODO ; somehow during the union of ares, we're getting multipolygons
insert into power_station (station_id, power_name, area)
select new_id,
(select power_name from power_station
where station_id = any(old_id)
order by st_area(area) desc limit 1),
area
from merged_stations;
insert into derived_objects (derived_id, derived_type, operation, source_id, source_type)
select new_id, 's', 'merge', old_id, 's'
from merged_stations;
delete from power_station s where station_id in (
select unnest(old_id) from merged_stations
);
commit;
|
--
-- Query demand of dockless vehicles for the next hour
--
-- Define function to represent the SageMaker model and endpoint for the prediction
-- In Athena you can access SageMaker endpoints for ML inference as external function with the keyword SAGEMAKER
-- and the name of the endpoint. THis is the definition of the inference function predict_demand() that returns
-- the predicted number of trips for the next hour based on the counts of the past four hours, the neighborhood,
-- and day of the week and hour of day. The endpoint with the pre-trained ML model was launched during installation.
-- You can find the Python code for training the ML model in the Notebook
-- “Demand Prediction for Dockless Vehicles using Amazon SageMaker and Amazon Athena”.
USING EXTERNAL FUNCTION predict_demand( location_id BIGINT, hr BIGINT , dow BIGINT,
n_pickup_1 BIGINT, n_pickup_2 BIGINT, n_pickup_3 BIGINT, n_pickup_4 BIGINT,
n_dropoff_1 BIGINT, n_dropoff_2 BIGINT, n_dropoff_3 BIGINT, n_dropoff_4 BIGINT
)
RETURNS DOUBLE SAGEMAKER '${SageMakerEndpoint}'
-- First we define two subqueries “current_ts” and “now” because this example
-- uses historic data and we have to go back in time and select a date and time.
-- I this case September 7, 2019 at 3 PM. With real-time data you can replace
-- the time-stamp “ts” with NOW() to get the current time. Athena does not
-- have support for variables in SQL statements. We use a common method to
-- achieve the same by using single-row CTEs that can be joined to subsequent
-- expressions.
WITH current_ts AS (
-- --------------------------------
-- Set the "current time" here ! --
-- --------------------------------
SELECT TIMESTAMP '2019-09-07 15:00' AS ts
-- ...if this were a live data feed we would just use the current time
-- SELECT NOW() AS ts
),
-- Define the time window of 5 hours for which we need to query data.
-- We use the epoch time (aka UNIX time) format because operations
-- on floating point number are faster than timestamps.
now AS (
SELECT ts
, to_unixtime(ts) AS t_epoch
, to_unixtime(ts - interval '5' hour) AS t_epoch_5
FROM current_ts
),
-- The next CTE “trips_raw” uses the Lambda function to pull data from the DynamoDB table. It only returns
-- records that are less than five hours older than the target time “now.ts_epoch”. We use epoch time,
-- aka. UNIX time, because DynamoDB does not support a native time-stamp format. This is faster than using
-- strings and convert them to timestamps.
trips_raw AS (
SELECT *
, from_unixtime(start_epoch) AS t_start
, from_unixtime(end_epoch) AS t_end
FROM "lambda:${AthenaDynamoDBConnectorFunction}".default."${DynamoDBTable}" dls
JOIN now ON TRUE
WHERE start_epoch BETWEEN t_epoch_5 AND t_epoch
OR end_epoch BETWEEN t_epoch_5 AND t_epoch
),
-- The next CTE “trips” prepares the selected data from “trips_raw” for aggregation over
-- time and geography by associating 1-hour bins and neighborhoods to the trip records.
-- The trip has a start time and location and end time and location. The sub-query generates
-- the respective fields “t_hour_start”, “start_nbid” and “t_hour_end”, “end_nbid”.
-- We use geospatial functions (https://docs.aws.amazon.com/athena/latest/ug/geospatial-functions-list-v2.html)
-- in Athena to map the longitude-latitude coordinates of the start and end locations to their respective
-- neighborhoods. The geospatial function ST_WITHIN(), that determines if the given points lays
-- within the boundaries of the polygon, is used to join the neighborhood table the trip data.
-- It has to be joined twice, for the start and the end location.
trips AS (
SELECT tr.*
, nb1.nh_code AS start_nbid
, nb2.nh_code AS end_nbid
, floor( ( tr.start_epoch - now.t_epoch_5 )/3600 ) AS t_hour_start
, floor( ( tr.end_epoch - now.t_epoch_5 )/3600 ) AS t_hour_end
FROM trips_raw tr
JOIN "AwsDataCatalog".default."loisville_ky_neighborhoods" nb1
ON ST_Within(ST_POINT(CAST(tr.startlongitude AS DOUBLE), CAST(tr.startlatitude AS DOUBLE)), ST_GeometryFromText(nb1.shape))
JOIN "AwsDataCatalog".default."loisville_ky_neighborhoods" nb2
ON ST_Within(ST_POINT(CAST(tr.endlongitude AS DOUBLE), CAST(tr.endlatitude AS DOUBLE)), ST_GeometryFromText(nb2.shape))
JOIN now ON TRUE
),
-- The CTEs “start_count” and “end_count” perform the aggregation over hours and neighborhoods.
-- Both sub-queries operate on the same way. Technically, we aggregate over neighborhood, “*_nbid”,
-- and hour “t_hour_*”. However, the query uses GROUP BY only on the neighborhood.
-- The construct SUM(CASE WHEN ...) is used to mimic result of a pivot table in order to get the aggregates
-- for different grouping in separate columns.
start_count AS (
SELECT start_nbid AS nbid, COUNT(start_nbid) AS n_total_start
, SUM(CASE WHEN t_hour_start=1 THEN 1 ELSE 0 END) AS n1_start
, SUM(CASE WHEN t_hour_start=2 THEN 1 ELSE 0 END) AS n2_start
, SUM(CASE WHEN t_hour_start=3 THEN 1 ELSE 0 END) AS n3_start
, SUM(CASE WHEN t_hour_start=4 THEN 1 ELSE 0 END) AS n4_start
FROM trips
WHERE start_nbid BETWEEN 1 AND 98
GROUP BY start_nbid
),
-- aggregating trips over end time and end neighborhood
end_count AS (
SELECT end_nbid AS nbid, COUNT(end_nbid) AS n_total_end
, SUM(CASE WHEN t_hour_end=1 THEN 1 ELSE 0 END) AS n1_end
, SUM(CASE WHEN t_hour_end=2 THEN 1 ELSE 0 END) AS n2_end
, SUM(CASE WHEN t_hour_end=3 THEN 1 ELSE 0 END) AS n3_end
, SUM(CASE WHEN t_hour_end=4 THEN 1 ELSE 0 END) AS n4_end
FROM trips
WHERE end_nbid BETWEEN 1 AND 98
GROUP BY end_nbid
),
-- The final CTE “predictions” uses the counts per preceding hours and neighborhoods
-- to build the feature vector for the ML model. In Athena you can access SageMaker
-- endpoints for ML inference as external function with the keyword SAGEMAKER and the
-- name of the endpoint. The top of the SQL statement shows the definition of
-- the inference function predict_demand() that returns the predicted number of trips
-- for the next hour based on the counts of the past four hours, the neighborhood,
-- and day of the week and hour of day. The endpoint with the pre-trained ML model was
-- launched during installation. You can find the Python code for training the ML model
-- in the Notebook “Demand Prediction for Dockless Vehicles using Amazon SageMaker and Amazon Athena”.
predictions AS (
SELECT sc.nbid
, predict_demand(
CAST(sc.nbid AS BIGINT),
hour(now.ts), day_of_week(now.ts),
sc.n1_start, sc.n2_start, sc.n3_start, sc.n4_start,
ec.n1_end, ec.n2_end, ec.n3_end, ec.n4_end
) AS n_demand
FROM start_count sc
JOIN end_count ec
ON sc.nbid=ec.nbid
JOIN now ON TRUE
)
-- Predicted values with the neighborhoods' meta data
SELECT nh.nh_code AS nbid, nh.nh_name AS neighborhood, nh.cog_longitude AS longitude, nh.cog_latitude AS latitude
, ST_POINT(nh.cog_longitude, nh.cog_latitude) AS geo_location
, COALESCE( round(predictions.n_demand), 0 ) AS demand
FROM "AwsDataCatalog".default."loisville_ky_neighborhoods" nh
LEFT JOIN predictions
ON nh.nh_code=predictions.nbid
|
<filename>Python/Unittest/Fixtures/create_db.sql
-- Drop table if it exists to start from scratch
DROP TABLE IF EXISTS projects;
-- Create projects table
CREATE TABLE projects (
project_id INTEGER PRIMARY KEY ASC AUTOINCREMENT,
project_name TEXT NOT NULL,
start_date TEXT NOT NULL,
end_date TEXT,
CONSTRAINT end_date_check CHECK (end_date IS NULL OR
start_date < end_date),
UNIQUE (project_name)
);
-- Drop table if it exists to start from scratch
DROP TABLE IF EXISTS researchers;
-- Create researchers table
CREATE TABLE researchers (
researcher_id INTEGER PRIMARY KEY ASC AUTOINCREMENT,
first_name TEXT NOT NULL,
last_name TEXT NOT NULL
);
-- Drop table if it exists to start from scratch
DROP TABLE IF EXISTS staff_assignments;
-- Create staff assignments table, encoding the many-to-many relation
-- between researchers and projects
CREATE TABLE staff_assignments (
project_id INTEGER NOT NULL,
researcher_id INTEGER NOT NULL,
PRIMARY KEY (project_id, researcher_id),
FOREIGN KEY (project_id) REFERENCES projects(project_id),
FOREIGN KEY (researcher_id) REFERENCES researchers(researcher_id)
);
-- Drop trigger if it exists to start from scratch
DROP TRIGGER IF EXISTS delete_researcher_assignemnt;
-- Ensure that when a researcher is deleted, all staff assignments
-- he is involved in are also deleted
CREATE TRIGGER delete_researcher_assignemnt
DELETE ON researchers
FOR EACH ROW
BEGIN
DELETE FROM staff_assignments
WHERE OLD.researcher_id = researcher_id;
END;
-- Drop trigger if it exists to start from scratch
DROP TRIGGER IF EXISTS delete_project_assignemnt;
-- Ensure that when a project is deleted, all staff assignments
-- he is involved in are also deleted
CREATE TRIGGER delete_project_assignemnt
DELETE ON projects
FOR EACH ROW
BEGIN
DELETE FROM staff_assignments
WHERE OLD.project_id = project_id;
END;
-- Drop view if it exists to start from scratch
DROP VIEW IF EXISTS project_staffing;
-- Create a view to get a more convenient overview of staff assignments
CREATE VIEW project_staffing
AS SELECT p.project_name AS 'project_name',
r.first_name AS 'first_name',
r.last_name AS 'last_name'
FROM projects AS p, researchers AS r, staff_assignments AS s
WHERE p.project_id = s.project_id AND
s.researcher_id = r.researcher_id AND
s.researcher_id = r.researcher_id;
-- Drop table if it exists to start from scratch
DROP TABLE IF EXISTS samples;
-- Create samples table
CREATE TABLE samples (
sample_id INTEGER PRIMARY KEY ASC AUTOINCREMENT,
project_id INTEGER,
organism TEXT NOT NULL,
FOREIGN KEY (project_id) REFERENCES projects(project_id)
);
-- Drop trigger if it exists to start from scratch
DROP VIEW IF EXISTS project_samples;
-- Create a view to get a more convenient overview of samples used in
-- projects
CREATE VIEW project_samples
AS SELECT p.project_name AS 'project_name',
s.organism AS 'organism'
FROM projects AS p, samples AS s
WHERE p.project_id = s.project_id;
-- Drop trigger if it exists to start from scratch
DROP TRIGGER IF EXISTS update_project_samples;
-- Ensure that when a project is deleted, all samples for that project are
-- updated to have NULL for project reference
CREATE TRIGGER update_project_samples
DELETE ON projects
FOR EACH ROW
BEGIN
UPDATE samples
SET project_id = NULL
WHERE project_id = OLD.project_id;
END;
|
<reponame>arinichevN/gwu74
CREATE TABLE "device"
(
"id" INTEGER PRIMARY KEY,
"i2c_path" TEXT NOT NULL,
"i2c_addr" INTEGER NOT NULL-- to get chip address in hex format (for Banana Pi): i2cdetect -y -a 2; convert it to decimal and put here
);
CREATE TABLE "pin"
(
"net_id" INTEGER NOT NULL,
"device_id" INTEGER NOT NULL,
"id_within_device" INTEGER NOT NULL,
"mode" TEXT NOT NULL, --in || out
"pud" TEXT NOT NULL, -- up || down || off
"pwm_resolution" INTEGER NOT NULL,--max duty cycle
"pwm_period_sec" INTEGER NOT NULL,
"pwm_period_nsec" INTEGER NOT NULL,
"pwm_duty_cycle_min_sec" INTEGER NOT NULL,
"pwm_duty_cycle_min_nsec" INTEGER NOT NULL,
"pwm_duty_cycle_max_sec" INTEGER NOT NULL,
"pwm_duty_cycle_max_nsec" INTEGER NOT NULL,
"secure_timeout_sec" INTEGER NOT NULL, -- if secure_enable, we will set this pin to PWM mode with secure_duty_cycle after we have no requests to this pin while secure_timeout_sec is running
"secure_duty_cycle" INTEGER NOT NULL, -- 0...rsl
"secure_enable" INTEGER NOT NULL
);
|
-- phpMyAdmin SQL Dump
-- version 5.0.2
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1:3306
-- Generation Time: Mar 31, 2021 at 01:28 AM
-- Server version: 5.7.31
-- PHP Version: 7.3.21
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Database: `london_referees_group`
--
-- --------------------------------------------------------
--
-- Table structure for table `tbl_events`
--
DROP TABLE IF EXISTS `tbl_events`;
CREATE TABLE IF NOT EXISTS `tbl_events` (
`events_id` mediumint(8) NOT NULL AUTO_INCREMENT,
`events_name` varchar(200) NOT NULL,
`events_subject` text NOT NULL,
`events_creator` varchar(250) NOT NULL,
`last_executed` timestamp NOT NULL,
`events_file` varchar(300) NOT NULL,
PRIMARY KEY (`events_id`)
) ENGINE=MyISAM AUTO_INCREMENT=17 DEFAULT CHARSET=utf8;
--
-- Dumping data for table `tbl_events`
--
INSERT INTO `tbl_events` (`events_id`, `events_name`, `events_subject`, `events_creator`, `last_executed`, `events_file`) VALUES
(1, 'Criminal Declaration', 'This is Criminal Declaration Form for all members', 'admin', '2021-03-25 15:37:06', 'OHF_Criminal_Declaration_Form.pdf'),
(2, 'LRG Bylaws', 'LRG Bylaws', 'admin', '2021-03-27 02:38:09', 'LRG_Bylaws_March_21__2017.pdf');
-- --------------------------------------------------------
--
-- Table structure for table `tbl_users`
--
DROP TABLE IF EXISTS `tbl_users`;
CREATE TABLE IF NOT EXISTS `tbl_users` (
`user_id` mediumint(8) NOT NULL AUTO_INCREMENT,
`user_level` varchar(2) NOT NULL DEFAULT '0',
`user_name` varchar(250) NOT NULL,
`user_fname` varchar(250) NOT NULL,
`user_lname` varchar(250) NOT NULL,
`user_password` varchar(250) NOT NULL,
`user_email` varchar(250) NOT NULL,
`user_ip` varchar(50) DEFAULT NULL,
`user_date` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
`last_login` timestamp NULL DEFAULT NULL,
`login_times` int(11) DEFAULT '0',
`user_status` varchar(20) NOT NULL DEFAULT 'unlocked',
PRIMARY KEY (`user_id`)
) ENGINE=MyISAM AUTO_INCREMENT=73 DEFAULT CHARSET=utf8;
--
-- Dumping data for table `tbl_users`
--
INSERT INTO `tbl_users` (`user_id`, `user_level`, `user_name`, `user_fname`, `user_lname`, `user_password`, `user_email`, `user_ip`, `user_date`, `last_login`, `login_times`, `user_status`) VALUES
(1, '2', 'Meng', 'Zhu', 'Meng', '112233', '<EMAIL>', '127.0.0.1', '2021-02-12 19:57:36', '2021-03-31 01:20:16', 143, 'unlocked'),
(5, '0', 'Oka', 'Ryoko', 'Oka', 'oka123', '<EMAIL>', '127.0.0.1', '2021-03-31 00:10:46', '2021-03-31 00:11:25', 1, 'unlocked'),
(2, '1', 'Evan', 'Evan', 'Chan', '112233', '<EMAIL>', NULL, '2021-03-24 21:22:39', NULL, 0, 'locked'),
(3, '0', 'Jihee', 'Jihee', 'Yu', 'yu123', '<EMAIL>', '127.0.0.1', '2021-03-24 23:40:37', '2021-03-30 18:55:15', 10, 'unlocked'),
(4, '0', 'Petrova', 'Elina', 'Petrova', '19KWMUyz', '<EMAIL>', NULL, '2021-03-31 00:21:29', NULL, 0, 'unlocked');
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
CREATE TYPE accessibility_request_status AS ENUM ('OPEN', 'IN_REMEDIATION', 'CLOSED');
CREATE TABLE accessibility_request_status_records (
id uuid PRIMARY KEY not null,
request_id uuid REFERENCES accessibility_requests(id) NOT NULL,
status accessibility_request_status NOT NULL DEFAULT 'OPEN',
created_at timestamp with time zone DEFAULT now() NOT NULL
);
|
<reponame>tharangar/k8s-webserver
-- POCOR-2780
--
INSERT INTO `db_patches` (issue, created) VALUES ('POCOR-2780', NOW());
INSERT INTO `import_mapping` (`id`, `model`, `column_name`, `description`, `order`, `foreign_key`, `lookup_plugin`, `lookup_model`, `lookup_column`) VALUES
(81, 'Institution.Staff', 'institution_position_id', 'Code', 1, 2, 'Institution', 'InstitutionPositions', 'position_no'),
(82, 'Institution.Staff', 'start_date', '( DD/MM/YYYY )', 2, 0, NULL, NULL, NULL),
(83, 'Institution.Staff', 'position_type', 'Code', 3, 3, NULL, 'PositionTypes', 'id'),
(84, 'Institution.Staff', 'FTE', '(Not Required if Position Type is Full Time)', 4, 3, NULL, 'FTE', 'value'),
(85, 'Institution.Staff', 'staff_type_id', 'Code', 5, 1, 'FieldOption', 'StaffTypes', 'code'),
(86, 'Institution.Staff', 'staff_id', 'OpenEMIS ID', 6, 2, 'Staff', 'Staff', 'openemis_no')
;
DELETE FROM `security_functions` WHERE `id` = 7047;
INSERT INTO `security_functions` (`id`, `name`, `controller`, `module`, `category`, `parent_id`, `_view`, `_edit`, `_add`, `_delete`, `_execute`, `order`, `visible`, `modified_user_id`, `modified`, `created_user_id`, `created`) VALUES
(1042, 'Import Staff', 'Institutions', 'Institutions', 'Staff', 1016, NULL, NULL, NULL, NULL, 'ImportStaff.add|ImportStaff.template|ImportStaff.results|ImportStaff.downloadFailed|ImportStaff.downloadPassed', 1042, 1, NULL, NULL, 1, NOW());
-- POCOR-3037
-- db_patches
INSERT INTO `db_patches` (issue, created) VALUES ('POCOR-3037', NOW());
-- code here
INSERT INTO `security_functions` (`id`, `name`, `controller`, `module`, `category`, `parent_id`, `_view`, `_edit`, `_add`, `_delete`, `_execute`, `order`, `visible`, `modified_user_id`, `modified`, `created_user_id`, `created`) VALUES ('7047', 'New Guardian Profile', 'Directories', 'Directory', 'Students - Guardians', '7000', NULL, NULL, 'StudentGuardianUser.add', NULL, NULL, '7047', '1', NULL, NULL, '1', NOW());
-- POCOR-2416
-- db_patches
INSERT INTO db_patches (`issue`, `created`) VALUES ('POCOR-2416', NOW());
CREATE TABLE IF NOT EXISTS `deleted_records` (
`id` int(11) NOT NULL,
`reference_table` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
`reference_key` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
`data` mediumtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
`created_user_id` int(11) NOT NULL,
`created` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Indexes for dumped tables
--
--
-- Indexes for table `deleted_records`
--
ALTER TABLE `deleted_records`
ADD PRIMARY KEY (`id`),
ADD KEY `reference_key` (`reference_key`),
ADD KEY `created_user_id` (`created_user_id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `deleted_records`
--
ALTER TABLE `deleted_records`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
-- 3.5.8
UPDATE config_items SET value = '3.5.8' WHERE code = 'db_version';
UPDATE db_patches SET version = (SELECT value FROM config_items WHERE code = 'db_version') WHERE version IS NULL;
|
<reponame>serkef/covid_bot
CREATE TABLE IF NOT EXISTS raw_daily_data (
id SERIAL,
ts TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP,
rec_dt DATE NOT NULL,
rec_territory TEXT NOT NULL,
rec_value NUMERIC,
CONSTRAINT unique_entry UNIQUE(rec_dt, rec_territory, rec_value)
)
|
<gh_stars>1000+
select fun from {{ ref('model_one') }}
|
<reponame>ghJo-Gaia3D/mago3d
-- 데이터 그룹 (알파돔, 시립대)
INSERT INTO data_group(data_group_id, data_group_key, data_group_name, data_group_path, data_group_target, sharing, user_id, ancestor, parent, depth,
view_order, children, basic, available, tiling, data_count, location, altitude, metainfo)
VALUES
(50000, 'alphadom', 'alphadom', 'infra/data/alphadom/', 'admin', 'common', 'admin', 50000, 0, 1, 2, 0, false, true, false, 1, ST_GeomFromText('POINT(127.11209614609372 37.394169200581445)', 4326), 10.45, TO_JSON('{"isPhysical": false}'::json)),
(50001, 'uos21c', 'uos21c', 'infra/data/uos21c/', 'admin', 'common', 'admin', 50001, 0, 1, 2, 0, false, true, false, 1, ST_GeomFromText('POINT (127.05851812380287 37.58321465738111)', 4326), 10.45, TO_JSON('{"isPhysical": false}'::json));
-- 데이터 (알파돔, 시립대)
INSERT INTO data_info(data_id, data_group_id, converter_job_id, data_key, data_name, data_type, sharing, user_id, mapping_type, location, altitude, heading,
pitch, roll, metainfo, status, attribute_exist, object_attribute_exist)
VALUES
(5000000, 50000, NULL, 'admin_20210723181116_201832785427500', '알파돔', 'indoorgml', 'common', 'admin', 'origin', ST_GeomFromText('POINT(127.11209614609372 37.394169200581445)', 4326), 10.45, 0, 0, 0, '{"isPhysical": true, "heightReference": "clampToGround", "floors" : [7,8,9,10,11,12,13,14,15,16,17,18,19,20,21]}', 'use', false, false),
(5000001, 50001, NULL, 'admin_20210723160338_194175424390000', '시립대', 'indoorgml', 'common', 'admin', 'origin', ST_GeomFromText('POINT (127.05851812380287 37.58321465738111)', 4326), 0, 0, 0, 0, '{"isPhysical": true, "heightReference": "clampToGround", "floors" : [1]}', 'use', false, false);
-- MICRO SERVICE 등록
INSERT INTO micro_service (micro_service_id, micro_service_key, micro_service_name, micro_service_type, server_ip, url_scheme, url_host, url_port, url_path,
status, available, description)
VALUES
(NEXTVAL('micro_service_seq'), 'SENSOR_THINGS', 'SensorThingsAPI', 'sensor-things', 'iot.openindoormap.io', 'http', 'iot.openindoormap.io', 80, 'v1.0/', 'up', true, 'SensorThingsAPI 서비스'); |
DROP DATABASE IF EXISTS `cfboom_test`;
CREATE DATABASE `cfboom_test` /*!40100 DEFAULT CHARACTER SET utf8mb4 */;
USE `cfboom_test`;
--
-- Table structure for table `All_Types`
--
DROP TABLE IF EXISTS `All_Types`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `All_Types` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`blob` blob,
`binary` binary(3) DEFAULT NULL,
`longblob` longblob,
`mediumblob` mediumblob,
`tinyblob` tinyblob,
`varbinary` varbinary(3) DEFAULT NULL,
`date` date DEFAULT NULL,
`datetime` datetime DEFAULT NULL,
`time` time DEFAULT NULL,
`timestamp` timestamp NULL DEFAULT NULL,
`year` year(4) DEFAULT NULL,
`bigint` bigint(20) DEFAULT NULL,
`decimal` decimal(5,2) DEFAULT NULL,
`double` double DEFAULT NULL,
`float` float DEFAULT NULL,
`int` int(11) DEFAULT NULL,
`mediumint` mediumint(9) DEFAULT NULL,
`real` double DEFAULT NULL,
`smallint` smallint(6) DEFAULT NULL,
`tinyint` tinyint(4) DEFAULT NULL,
`char` char(1) DEFAULT NULL,
`nvarchar` varchar(3) CHARACTER SET utf8 DEFAULT NULL,
`varchar` varchar(45) DEFAULT NULL,
`longtext` longtext,
`mediumtext` mediumtext,
`text` text,
`tinytext` tinytext,
`bit` bit(1) DEFAULT NULL,
`enum` enum('A','B') DEFAULT NULL,
`set` set('A','B') DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `All_Types`
--
LOCK TABLES `All_Types` WRITE;
/*!40000 ALTER TABLE `All_Types` DISABLE KEYS */;
INSERT INTO `All_Types` VALUES (1,'lkjsfodijfs','uud','oiwueroi','uybbvyrbv','plokmjn','okq','2016-09-17','2016-09-18 05:02:31','22:56:10','2016-09-18 05:02:31',2016,8746373827474374,23.47,192.338,3.22228,1277383,238732,2327.28394832,1232,127,'a','def','d',' This has leading and trailing spaces ','asdflkj','asdflkj','asdflkj',b'0','A','B'),(2,'oiwueroi','8y5','mnxvmnb','ygcuvsdjhsjhds','qaxscdwd','0c3','2016-09-18','2016-09-18 05:04:20','21:33:10','2016-09-18 05:04:20',2016,874677327474374,62.53,98.1255,4.27874,8798762,12345,234.1837463,7927,12,'f','jir','d','lkjasd','asdflkj','asdflkj','asdflkj',b'1','A','B'),(3,NULL,NULL,NULL,NULL,NULL,NULL,'2016-09-20',NULL,NULL,NULL,2016,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'b',NULL,NULL,NULL,NULL,NULL,NULL,b'0','B','A');
/*!40000 ALTER TABLE `All_Types` ENABLE KEYS */;
UNLOCK TABLES;
|
-- SPDX-License-Identifier: Apache-2.0
-- Licensed to the Ed-Fi Alliance under one or more agreements.
-- The Ed-Fi Alliance licenses this file to you under the Apache License, Version 2.0.
-- See the LICENSE and NOTICES files in the project root for more information.
ALTER TABLE [edfi].[AbsenceEventCategoryDescriptor] WITH CHECK ADD CONSTRAINT [FK_AbsenceEventCategoryDescriptor_Descriptor] FOREIGN KEY ([AbsenceEventCategoryDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[AcademicHonorCategoryDescriptor] WITH CHECK ADD CONSTRAINT [FK_AcademicHonorCategoryDescriptor_Descriptor] FOREIGN KEY ([AcademicHonorCategoryDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[AcademicSubjectDescriptor] WITH CHECK ADD CONSTRAINT [FK_AcademicSubjectDescriptor_Descriptor] FOREIGN KEY ([AcademicSubjectDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[AcademicWeek] WITH CHECK ADD CONSTRAINT [FK_AcademicWeek_School] FOREIGN KEY ([SchoolId])
REFERENCES [edfi].[School] ([SchoolId])
GO
CREATE NONCLUSTERED INDEX [FK_AcademicWeek_School]
ON [edfi].[AcademicWeek] ([SchoolId] ASC)
GO
ALTER TABLE [edfi].[AccommodationDescriptor] WITH CHECK ADD CONSTRAINT [FK_AccommodationDescriptor_Descriptor] FOREIGN KEY ([AccommodationDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[Account] WITH CHECK ADD CONSTRAINT [FK_Account_EducationOrganization] FOREIGN KEY ([EducationOrganizationId])
REFERENCES [edfi].[EducationOrganization] ([EducationOrganizationId])
GO
CREATE NONCLUSTERED INDEX [FK_Account_EducationOrganization]
ON [edfi].[Account] ([EducationOrganizationId] ASC)
GO
ALTER TABLE [edfi].[AccountabilityRating] WITH CHECK ADD CONSTRAINT [FK_AccountabilityRating_EducationOrganization] FOREIGN KEY ([EducationOrganizationId])
REFERENCES [edfi].[EducationOrganization] ([EducationOrganizationId])
GO
CREATE NONCLUSTERED INDEX [FK_AccountabilityRating_EducationOrganization]
ON [edfi].[AccountabilityRating] ([EducationOrganizationId] ASC)
GO
ALTER TABLE [edfi].[AccountabilityRating] WITH CHECK ADD CONSTRAINT [FK_AccountabilityRating_SchoolYearType] FOREIGN KEY ([SchoolYear])
REFERENCES [edfi].[SchoolYearType] ([SchoolYear])
GO
CREATE NONCLUSTERED INDEX [FK_AccountabilityRating_SchoolYearType]
ON [edfi].[AccountabilityRating] ([SchoolYear] ASC)
GO
ALTER TABLE [edfi].[AccountAccountCode] WITH CHECK ADD CONSTRAINT [FK_AccountAccountCode_Account] FOREIGN KEY ([AccountIdentifier], [EducationOrganizationId], [FiscalYear])
REFERENCES [edfi].[Account] ([AccountIdentifier], [EducationOrganizationId], [FiscalYear])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_AccountAccountCode_Account]
ON [edfi].[AccountAccountCode] ([AccountIdentifier] ASC, [EducationOrganizationId] ASC, [FiscalYear] ASC)
GO
ALTER TABLE [edfi].[AccountAccountCode] WITH CHECK ADD CONSTRAINT [FK_AccountAccountCode_AccountCode] FOREIGN KEY ([AccountClassificationDescriptorId], [AccountCodeNumber], [EducationOrganizationId], [FiscalYear])
REFERENCES [edfi].[AccountCode] ([AccountClassificationDescriptorId], [AccountCodeNumber], [EducationOrganizationId], [FiscalYear])
GO
CREATE NONCLUSTERED INDEX [FK_AccountAccountCode_AccountCode]
ON [edfi].[AccountAccountCode] ([AccountClassificationDescriptorId] ASC, [AccountCodeNumber] ASC, [EducationOrganizationId] ASC, [FiscalYear] ASC)
GO
ALTER TABLE [edfi].[AccountClassificationDescriptor] WITH CHECK ADD CONSTRAINT [FK_AccountClassificationDescriptor_Descriptor] FOREIGN KEY ([AccountClassificationDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[AccountCode] WITH CHECK ADD CONSTRAINT [FK_AccountCode_AccountClassificationDescriptor] FOREIGN KEY ([AccountClassificationDescriptorId])
REFERENCES [edfi].[AccountClassificationDescriptor] ([AccountClassificationDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_AccountCode_AccountClassificationDescriptor]
ON [edfi].[AccountCode] ([AccountClassificationDescriptorId] ASC)
GO
ALTER TABLE [edfi].[AccountCode] WITH CHECK ADD CONSTRAINT [FK_AccountCode_EducationOrganization] FOREIGN KEY ([EducationOrganizationId])
REFERENCES [edfi].[EducationOrganization] ([EducationOrganizationId])
GO
CREATE NONCLUSTERED INDEX [FK_AccountCode_EducationOrganization]
ON [edfi].[AccountCode] ([EducationOrganizationId] ASC)
GO
ALTER TABLE [edfi].[AchievementCategoryDescriptor] WITH CHECK ADD CONSTRAINT [FK_AchievementCategoryDescriptor_Descriptor] FOREIGN KEY ([AchievementCategoryDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[Actual] WITH CHECK ADD CONSTRAINT [FK_Actual_Account] FOREIGN KEY ([AccountIdentifier], [EducationOrganizationId], [FiscalYear])
REFERENCES [edfi].[Account] ([AccountIdentifier], [EducationOrganizationId], [FiscalYear])
GO
CREATE NONCLUSTERED INDEX [FK_Actual_Account]
ON [edfi].[Actual] ([AccountIdentifier] ASC, [EducationOrganizationId] ASC, [FiscalYear] ASC)
GO
ALTER TABLE [edfi].[AdditionalCreditTypeDescriptor] WITH CHECK ADD CONSTRAINT [FK_AdditionalCreditTypeDescriptor_Descriptor] FOREIGN KEY ([AdditionalCreditTypeDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[AddressTypeDescriptor] WITH CHECK ADD CONSTRAINT [FK_AddressTypeDescriptor_Descriptor] FOREIGN KEY ([AddressTypeDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[AdministrationEnvironmentDescriptor] WITH CHECK ADD CONSTRAINT [FK_AdministrationEnvironmentDescriptor_Descriptor] FOREIGN KEY ([AdministrationEnvironmentDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[AdministrativeFundingControlDescriptor] WITH CHECK ADD CONSTRAINT [FK_AdministrativeFundingControlDescriptor_Descriptor] FOREIGN KEY ([AdministrativeFundingControlDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[AncestryEthnicOriginDescriptor] WITH CHECK ADD CONSTRAINT [FK_AncestryEthnicOriginDescriptor_Descriptor] FOREIGN KEY ([AncestryEthnicOriginDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[Assessment] WITH CHECK ADD CONSTRAINT [FK_Assessment_AssessmentCategoryDescriptor] FOREIGN KEY ([AssessmentCategoryDescriptorId])
REFERENCES [edfi].[AssessmentCategoryDescriptor] ([AssessmentCategoryDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_Assessment_AssessmentCategoryDescriptor]
ON [edfi].[Assessment] ([AssessmentCategoryDescriptorId] ASC)
GO
ALTER TABLE [edfi].[Assessment] WITH CHECK ADD CONSTRAINT [FK_Assessment_EducationOrganization] FOREIGN KEY ([EducationOrganizationId])
REFERENCES [edfi].[EducationOrganization] ([EducationOrganizationId])
GO
CREATE NONCLUSTERED INDEX [FK_Assessment_EducationOrganization]
ON [edfi].[Assessment] ([EducationOrganizationId] ASC)
GO
ALTER TABLE [edfi].[AssessmentAcademicSubject] WITH CHECK ADD CONSTRAINT [FK_AssessmentAcademicSubject_AcademicSubjectDescriptor] FOREIGN KEY ([AcademicSubjectDescriptorId])
REFERENCES [edfi].[AcademicSubjectDescriptor] ([AcademicSubjectDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_AssessmentAcademicSubject_AcademicSubjectDescriptor]
ON [edfi].[AssessmentAcademicSubject] ([AcademicSubjectDescriptorId] ASC)
GO
ALTER TABLE [edfi].[AssessmentAcademicSubject] WITH CHECK ADD CONSTRAINT [FK_AssessmentAcademicSubject_Assessment] FOREIGN KEY ([AssessmentIdentifier], [Namespace])
REFERENCES [edfi].[Assessment] ([AssessmentIdentifier], [Namespace])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_AssessmentAcademicSubject_Assessment]
ON [edfi].[AssessmentAcademicSubject] ([AssessmentIdentifier] ASC, [Namespace] ASC)
GO
ALTER TABLE [edfi].[AssessmentAssessedGradeLevel] WITH CHECK ADD CONSTRAINT [FK_AssessmentAssessedGradeLevel_Assessment] FOREIGN KEY ([AssessmentIdentifier], [Namespace])
REFERENCES [edfi].[Assessment] ([AssessmentIdentifier], [Namespace])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_AssessmentAssessedGradeLevel_Assessment]
ON [edfi].[AssessmentAssessedGradeLevel] ([AssessmentIdentifier] ASC, [Namespace] ASC)
GO
ALTER TABLE [edfi].[AssessmentAssessedGradeLevel] WITH CHECK ADD CONSTRAINT [FK_AssessmentAssessedGradeLevel_GradeLevelDescriptor] FOREIGN KEY ([GradeLevelDescriptorId])
REFERENCES [edfi].[GradeLevelDescriptor] ([GradeLevelDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_AssessmentAssessedGradeLevel_GradeLevelDescriptor]
ON [edfi].[AssessmentAssessedGradeLevel] ([GradeLevelDescriptorId] ASC)
GO
ALTER TABLE [edfi].[AssessmentCategoryDescriptor] WITH CHECK ADD CONSTRAINT [FK_AssessmentCategoryDescriptor_Descriptor] FOREIGN KEY ([AssessmentCategoryDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[AssessmentContentStandard] WITH CHECK ADD CONSTRAINT [FK_AssessmentContentStandard_Assessment] FOREIGN KEY ([AssessmentIdentifier], [Namespace])
REFERENCES [edfi].[Assessment] ([AssessmentIdentifier], [Namespace])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[AssessmentContentStandard] WITH CHECK ADD CONSTRAINT [FK_AssessmentContentStandard_EducationOrganization] FOREIGN KEY ([MandatingEducationOrganizationId])
REFERENCES [edfi].[EducationOrganization] ([EducationOrganizationId])
GO
CREATE NONCLUSTERED INDEX [FK_AssessmentContentStandard_EducationOrganization]
ON [edfi].[AssessmentContentStandard] ([MandatingEducationOrganizationId] ASC)
GO
ALTER TABLE [edfi].[AssessmentContentStandard] WITH CHECK ADD CONSTRAINT [FK_AssessmentContentStandard_PublicationStatusDescriptor] FOREIGN KEY ([PublicationStatusDescriptorId])
REFERENCES [edfi].[PublicationStatusDescriptor] ([PublicationStatusDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_AssessmentContentStandard_PublicationStatusDescriptor]
ON [edfi].[AssessmentContentStandard] ([PublicationStatusDescriptorId] ASC)
GO
ALTER TABLE [edfi].[AssessmentContentStandardAuthor] WITH CHECK ADD CONSTRAINT [FK_AssessmentContentStandardAuthor_AssessmentContentStandard] FOREIGN KEY ([AssessmentIdentifier], [Namespace])
REFERENCES [edfi].[AssessmentContentStandard] ([AssessmentIdentifier], [Namespace])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_AssessmentContentStandardAuthor_AssessmentContentStandard]
ON [edfi].[AssessmentContentStandardAuthor] ([AssessmentIdentifier] ASC, [Namespace] ASC)
GO
ALTER TABLE [edfi].[AssessmentIdentificationCode] WITH CHECK ADD CONSTRAINT [FK_AssessmentIdentificationCode_Assessment] FOREIGN KEY ([AssessmentIdentifier], [Namespace])
REFERENCES [edfi].[Assessment] ([AssessmentIdentifier], [Namespace])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_AssessmentIdentificationCode_Assessment]
ON [edfi].[AssessmentIdentificationCode] ([AssessmentIdentifier] ASC, [Namespace] ASC)
GO
ALTER TABLE [edfi].[AssessmentIdentificationCode] WITH CHECK ADD CONSTRAINT [FK_AssessmentIdentificationCode_AssessmentIdentificationSystemDescriptor] FOREIGN KEY ([AssessmentIdentificationSystemDescriptorId])
REFERENCES [edfi].[AssessmentIdentificationSystemDescriptor] ([AssessmentIdentificationSystemDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_AssessmentIdentificationCode_AssessmentIdentificationSystemDescriptor]
ON [edfi].[AssessmentIdentificationCode] ([AssessmentIdentificationSystemDescriptorId] ASC)
GO
ALTER TABLE [edfi].[AssessmentIdentificationSystemDescriptor] WITH CHECK ADD CONSTRAINT [FK_AssessmentIdentificationSystemDescriptor_Descriptor] FOREIGN KEY ([AssessmentIdentificationSystemDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[AssessmentItem] WITH CHECK ADD CONSTRAINT [FK_AssessmentItem_Assessment] FOREIGN KEY ([AssessmentIdentifier], [Namespace])
REFERENCES [edfi].[Assessment] ([AssessmentIdentifier], [Namespace])
GO
CREATE NONCLUSTERED INDEX [FK_AssessmentItem_Assessment]
ON [edfi].[AssessmentItem] ([AssessmentIdentifier] ASC, [Namespace] ASC)
GO
ALTER TABLE [edfi].[AssessmentItem] WITH CHECK ADD CONSTRAINT [FK_AssessmentItem_AssessmentItemCategoryDescriptor] FOREIGN KEY ([AssessmentItemCategoryDescriptorId])
REFERENCES [edfi].[AssessmentItemCategoryDescriptor] ([AssessmentItemCategoryDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_AssessmentItem_AssessmentItemCategoryDescriptor]
ON [edfi].[AssessmentItem] ([AssessmentItemCategoryDescriptorId] ASC)
GO
ALTER TABLE [edfi].[AssessmentItemCategoryDescriptor] WITH CHECK ADD CONSTRAINT [FK_AssessmentItemCategoryDescriptor_Descriptor] FOREIGN KEY ([AssessmentItemCategoryDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[AssessmentItemLearningStandard] WITH CHECK ADD CONSTRAINT [FK_AssessmentItemLearningStandard_AssessmentItem] FOREIGN KEY ([AssessmentIdentifier], [IdentificationCode], [Namespace])
REFERENCES [edfi].[AssessmentItem] ([AssessmentIdentifier], [IdentificationCode], [Namespace])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_AssessmentItemLearningStandard_AssessmentItem]
ON [edfi].[AssessmentItemLearningStandard] ([AssessmentIdentifier] ASC, [IdentificationCode] ASC, [Namespace] ASC)
GO
ALTER TABLE [edfi].[AssessmentItemLearningStandard] WITH CHECK ADD CONSTRAINT [FK_AssessmentItemLearningStandard_LearningStandard] FOREIGN KEY ([LearningStandardId])
REFERENCES [edfi].[LearningStandard] ([LearningStandardId])
GO
CREATE NONCLUSTERED INDEX [FK_AssessmentItemLearningStandard_LearningStandard]
ON [edfi].[AssessmentItemLearningStandard] ([LearningStandardId] ASC)
GO
ALTER TABLE [edfi].[AssessmentItemPossibleResponse] WITH CHECK ADD CONSTRAINT [FK_AssessmentItemPossibleResponse_AssessmentItem] FOREIGN KEY ([AssessmentIdentifier], [IdentificationCode], [Namespace])
REFERENCES [edfi].[AssessmentItem] ([AssessmentIdentifier], [IdentificationCode], [Namespace])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_AssessmentItemPossibleResponse_AssessmentItem]
ON [edfi].[AssessmentItemPossibleResponse] ([AssessmentIdentifier] ASC, [IdentificationCode] ASC, [Namespace] ASC)
GO
ALTER TABLE [edfi].[AssessmentItemResultDescriptor] WITH CHECK ADD CONSTRAINT [FK_AssessmentItemResultDescriptor_Descriptor] FOREIGN KEY ([AssessmentItemResultDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[AssessmentLanguage] WITH CHECK ADD CONSTRAINT [FK_AssessmentLanguage_Assessment] FOREIGN KEY ([AssessmentIdentifier], [Namespace])
REFERENCES [edfi].[Assessment] ([AssessmentIdentifier], [Namespace])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_AssessmentLanguage_Assessment]
ON [edfi].[AssessmentLanguage] ([AssessmentIdentifier] ASC, [Namespace] ASC)
GO
ALTER TABLE [edfi].[AssessmentLanguage] WITH CHECK ADD CONSTRAINT [FK_AssessmentLanguage_LanguageDescriptor] FOREIGN KEY ([LanguageDescriptorId])
REFERENCES [edfi].[LanguageDescriptor] ([LanguageDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_AssessmentLanguage_LanguageDescriptor]
ON [edfi].[AssessmentLanguage] ([LanguageDescriptorId] ASC)
GO
ALTER TABLE [edfi].[AssessmentPerformanceLevel] WITH CHECK ADD CONSTRAINT [FK_AssessmentPerformanceLevel_Assessment] FOREIGN KEY ([AssessmentIdentifier], [Namespace])
REFERENCES [edfi].[Assessment] ([AssessmentIdentifier], [Namespace])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_AssessmentPerformanceLevel_Assessment]
ON [edfi].[AssessmentPerformanceLevel] ([AssessmentIdentifier] ASC, [Namespace] ASC)
GO
ALTER TABLE [edfi].[AssessmentPerformanceLevel] WITH CHECK ADD CONSTRAINT [FK_AssessmentPerformanceLevel_AssessmentReportingMethodDescriptor] FOREIGN KEY ([AssessmentReportingMethodDescriptorId])
REFERENCES [edfi].[AssessmentReportingMethodDescriptor] ([AssessmentReportingMethodDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_AssessmentPerformanceLevel_AssessmentReportingMethodDescriptor]
ON [edfi].[AssessmentPerformanceLevel] ([AssessmentReportingMethodDescriptorId] ASC)
GO
ALTER TABLE [edfi].[AssessmentPerformanceLevel] WITH CHECK ADD CONSTRAINT [FK_AssessmentPerformanceLevel_PerformanceLevelDescriptor] FOREIGN KEY ([PerformanceLevelDescriptorId])
REFERENCES [edfi].[PerformanceLevelDescriptor] ([PerformanceLevelDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_AssessmentPerformanceLevel_PerformanceLevelDescriptor]
ON [edfi].[AssessmentPerformanceLevel] ([PerformanceLevelDescriptorId] ASC)
GO
ALTER TABLE [edfi].[AssessmentPerformanceLevel] WITH CHECK ADD CONSTRAINT [FK_AssessmentPerformanceLevel_ResultDatatypeTypeDescriptor] FOREIGN KEY ([ResultDatatypeTypeDescriptorId])
REFERENCES [edfi].[ResultDatatypeTypeDescriptor] ([ResultDatatypeTypeDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_AssessmentPerformanceLevel_ResultDatatypeTypeDescriptor]
ON [edfi].[AssessmentPerformanceLevel] ([ResultDatatypeTypeDescriptorId] ASC)
GO
ALTER TABLE [edfi].[AssessmentPeriod] WITH CHECK ADD CONSTRAINT [FK_AssessmentPeriod_Assessment] FOREIGN KEY ([AssessmentIdentifier], [Namespace])
REFERENCES [edfi].[Assessment] ([AssessmentIdentifier], [Namespace])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[AssessmentPeriod] WITH CHECK ADD CONSTRAINT [FK_AssessmentPeriod_AssessmentPeriodDescriptor] FOREIGN KEY ([AssessmentPeriodDescriptorId])
REFERENCES [edfi].[AssessmentPeriodDescriptor] ([AssessmentPeriodDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_AssessmentPeriod_AssessmentPeriodDescriptor]
ON [edfi].[AssessmentPeriod] ([AssessmentPeriodDescriptorId] ASC)
GO
ALTER TABLE [edfi].[AssessmentPeriodDescriptor] WITH CHECK ADD CONSTRAINT [FK_AssessmentPeriodDescriptor_Descriptor] FOREIGN KEY ([AssessmentPeriodDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[AssessmentPlatformType] WITH CHECK ADD CONSTRAINT [FK_AssessmentPlatformType_Assessment] FOREIGN KEY ([AssessmentIdentifier], [Namespace])
REFERENCES [edfi].[Assessment] ([AssessmentIdentifier], [Namespace])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_AssessmentPlatformType_Assessment]
ON [edfi].[AssessmentPlatformType] ([AssessmentIdentifier] ASC, [Namespace] ASC)
GO
ALTER TABLE [edfi].[AssessmentPlatformType] WITH CHECK ADD CONSTRAINT [FK_AssessmentPlatformType_PlatformTypeDescriptor] FOREIGN KEY ([PlatformTypeDescriptorId])
REFERENCES [edfi].[PlatformTypeDescriptor] ([PlatformTypeDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_AssessmentPlatformType_PlatformTypeDescriptor]
ON [edfi].[AssessmentPlatformType] ([PlatformTypeDescriptorId] ASC)
GO
ALTER TABLE [edfi].[AssessmentProgram] WITH CHECK ADD CONSTRAINT [FK_AssessmentProgram_Assessment] FOREIGN KEY ([AssessmentIdentifier], [Namespace])
REFERENCES [edfi].[Assessment] ([AssessmentIdentifier], [Namespace])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_AssessmentProgram_Assessment]
ON [edfi].[AssessmentProgram] ([AssessmentIdentifier] ASC, [Namespace] ASC)
GO
ALTER TABLE [edfi].[AssessmentProgram] WITH CHECK ADD CONSTRAINT [FK_AssessmentProgram_Program] FOREIGN KEY ([EducationOrganizationId], [ProgramName], [ProgramTypeDescriptorId])
REFERENCES [edfi].[Program] ([EducationOrganizationId], [ProgramName], [ProgramTypeDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_AssessmentProgram_Program]
ON [edfi].[AssessmentProgram] ([EducationOrganizationId] ASC, [ProgramName] ASC, [ProgramTypeDescriptorId] ASC)
GO
ALTER TABLE [edfi].[AssessmentReportingMethodDescriptor] WITH CHECK ADD CONSTRAINT [FK_AssessmentReportingMethodDescriptor_Descriptor] FOREIGN KEY ([AssessmentReportingMethodDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[AssessmentScore] WITH CHECK ADD CONSTRAINT [FK_AssessmentScore_Assessment] FOREIGN KEY ([AssessmentIdentifier], [Namespace])
REFERENCES [edfi].[Assessment] ([AssessmentIdentifier], [Namespace])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_AssessmentScore_Assessment]
ON [edfi].[AssessmentScore] ([AssessmentIdentifier] ASC, [Namespace] ASC)
GO
ALTER TABLE [edfi].[AssessmentScore] WITH CHECK ADD CONSTRAINT [FK_AssessmentScore_AssessmentReportingMethodDescriptor] FOREIGN KEY ([AssessmentReportingMethodDescriptorId])
REFERENCES [edfi].[AssessmentReportingMethodDescriptor] ([AssessmentReportingMethodDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_AssessmentScore_AssessmentReportingMethodDescriptor]
ON [edfi].[AssessmentScore] ([AssessmentReportingMethodDescriptorId] ASC)
GO
ALTER TABLE [edfi].[AssessmentScore] WITH CHECK ADD CONSTRAINT [FK_AssessmentScore_ResultDatatypeTypeDescriptor] FOREIGN KEY ([ResultDatatypeTypeDescriptorId])
REFERENCES [edfi].[ResultDatatypeTypeDescriptor] ([ResultDatatypeTypeDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_AssessmentScore_ResultDatatypeTypeDescriptor]
ON [edfi].[AssessmentScore] ([ResultDatatypeTypeDescriptorId] ASC)
GO
ALTER TABLE [edfi].[AssessmentScoreRangeLearningStandard] WITH CHECK ADD CONSTRAINT [FK_AssessmentScoreRangeLearningStandard_Assessment] FOREIGN KEY ([AssessmentIdentifier], [Namespace])
REFERENCES [edfi].[Assessment] ([AssessmentIdentifier], [Namespace])
GO
CREATE NONCLUSTERED INDEX [FK_AssessmentScoreRangeLearningStandard_Assessment]
ON [edfi].[AssessmentScoreRangeLearningStandard] ([AssessmentIdentifier] ASC, [Namespace] ASC)
GO
ALTER TABLE [edfi].[AssessmentScoreRangeLearningStandard] WITH CHECK ADD CONSTRAINT [FK_AssessmentScoreRangeLearningStandard_AssessmentReportingMethodDescriptor] FOREIGN KEY ([AssessmentReportingMethodDescriptorId])
REFERENCES [edfi].[AssessmentReportingMethodDescriptor] ([AssessmentReportingMethodDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_AssessmentScoreRangeLearningStandard_AssessmentReportingMethodDescriptor]
ON [edfi].[AssessmentScoreRangeLearningStandard] ([AssessmentReportingMethodDescriptorId] ASC)
GO
ALTER TABLE [edfi].[AssessmentScoreRangeLearningStandard] WITH CHECK ADD CONSTRAINT [FK_AssessmentScoreRangeLearningStandard_ObjectiveAssessment] FOREIGN KEY ([AssessmentIdentifier], [IdentificationCode], [Namespace])
REFERENCES [edfi].[ObjectiveAssessment] ([AssessmentIdentifier], [IdentificationCode], [Namespace])
GO
CREATE NONCLUSTERED INDEX [FK_AssessmentScoreRangeLearningStandard_ObjectiveAssessment]
ON [edfi].[AssessmentScoreRangeLearningStandard] ([AssessmentIdentifier] ASC, [IdentificationCode] ASC, [Namespace] ASC)
GO
ALTER TABLE [edfi].[AssessmentScoreRangeLearningStandardLearningStandard] WITH CHECK ADD CONSTRAINT [FK_AssessmentScoreRangeLearningStandardLearningStandard_AssessmentScoreRangeLearningStandard] FOREIGN KEY ([AssessmentIdentifier], [Namespace], [ScoreRangeId])
REFERENCES [edfi].[AssessmentScoreRangeLearningStandard] ([AssessmentIdentifier], [Namespace], [ScoreRangeId])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_AssessmentScoreRangeLearningStandardLearningStandard_AssessmentScoreRangeLearningStandard]
ON [edfi].[AssessmentScoreRangeLearningStandardLearningStandard] ([AssessmentIdentifier] ASC, [Namespace] ASC, [ScoreRangeId] ASC)
GO
ALTER TABLE [edfi].[AssessmentScoreRangeLearningStandardLearningStandard] WITH CHECK ADD CONSTRAINT [FK_AssessmentScoreRangeLearningStandardLearningStandard_LearningStandard] FOREIGN KEY ([LearningStandardId])
REFERENCES [edfi].[LearningStandard] ([LearningStandardId])
GO
CREATE NONCLUSTERED INDEX [FK_AssessmentScoreRangeLearningStandardLearningStandard_LearningStandard]
ON [edfi].[AssessmentScoreRangeLearningStandardLearningStandard] ([LearningStandardId] ASC)
GO
ALTER TABLE [edfi].[AssessmentSection] WITH CHECK ADD CONSTRAINT [FK_AssessmentSection_Assessment] FOREIGN KEY ([AssessmentIdentifier], [Namespace])
REFERENCES [edfi].[Assessment] ([AssessmentIdentifier], [Namespace])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_AssessmentSection_Assessment]
ON [edfi].[AssessmentSection] ([AssessmentIdentifier] ASC, [Namespace] ASC)
GO
ALTER TABLE [edfi].[AssessmentSection] WITH CHECK ADD CONSTRAINT [FK_AssessmentSection_Section] FOREIGN KEY ([LocalCourseCode], [SchoolId], [SchoolYear], [SectionIdentifier], [SessionName])
REFERENCES [edfi].[Section] ([LocalCourseCode], [SchoolId], [SchoolYear], [SectionIdentifier], [SessionName])
ON UPDATE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_AssessmentSection_Section]
ON [edfi].[AssessmentSection] ([LocalCourseCode] ASC, [SchoolId] ASC, [SchoolYear] ASC, [SectionIdentifier] ASC, [SessionName] ASC)
GO
ALTER TABLE [edfi].[AttemptStatusDescriptor] WITH CHECK ADD CONSTRAINT [FK_AttemptStatusDescriptor_Descriptor] FOREIGN KEY ([AttemptStatusDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[AttendanceEventCategoryDescriptor] WITH CHECK ADD CONSTRAINT [FK_AttendanceEventCategoryDescriptor_Descriptor] FOREIGN KEY ([AttendanceEventCategoryDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[BarrierToInternetAccessInResidenceDescriptor] WITH CHECK ADD CONSTRAINT [FK_BarrierToInternetAccessInResidenceDescriptor_Descriptor] FOREIGN KEY ([BarrierToInternetAccessInResidenceDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[BehaviorDescriptor] WITH CHECK ADD CONSTRAINT [FK_BehaviorDescriptor_Descriptor] FOREIGN KEY ([BehaviorDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[BellSchedule] WITH CHECK ADD CONSTRAINT [FK_BellSchedule_School] FOREIGN KEY ([SchoolId])
REFERENCES [edfi].[School] ([SchoolId])
GO
CREATE NONCLUSTERED INDEX [FK_BellSchedule_School]
ON [edfi].[BellSchedule] ([SchoolId] ASC)
GO
ALTER TABLE [edfi].[BellScheduleClassPeriod] WITH CHECK ADD CONSTRAINT [FK_BellScheduleClassPeriod_BellSchedule] FOREIGN KEY ([BellScheduleName], [SchoolId])
REFERENCES [edfi].[BellSchedule] ([BellScheduleName], [SchoolId])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_BellScheduleClassPeriod_BellSchedule]
ON [edfi].[BellScheduleClassPeriod] ([BellScheduleName] ASC, [SchoolId] ASC)
GO
ALTER TABLE [edfi].[BellScheduleClassPeriod] WITH CHECK ADD CONSTRAINT [FK_BellScheduleClassPeriod_ClassPeriod] FOREIGN KEY ([ClassPeriodName], [SchoolId])
REFERENCES [edfi].[ClassPeriod] ([ClassPeriodName], [SchoolId])
ON UPDATE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_BellScheduleClassPeriod_ClassPeriod]
ON [edfi].[BellScheduleClassPeriod] ([ClassPeriodName] ASC, [SchoolId] ASC)
GO
ALTER TABLE [edfi].[BellScheduleDate] WITH CHECK ADD CONSTRAINT [FK_BellScheduleDate_BellSchedule] FOREIGN KEY ([BellScheduleName], [SchoolId])
REFERENCES [edfi].[BellSchedule] ([BellScheduleName], [SchoolId])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_BellScheduleDate_BellSchedule]
ON [edfi].[BellScheduleDate] ([BellScheduleName] ASC, [SchoolId] ASC)
GO
ALTER TABLE [edfi].[BellScheduleGradeLevel] WITH CHECK ADD CONSTRAINT [FK_BellScheduleGradeLevel_BellSchedule] FOREIGN KEY ([BellScheduleName], [SchoolId])
REFERENCES [edfi].[BellSchedule] ([BellScheduleName], [SchoolId])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_BellScheduleGradeLevel_BellSchedule]
ON [edfi].[BellScheduleGradeLevel] ([BellScheduleName] ASC, [SchoolId] ASC)
GO
ALTER TABLE [edfi].[BellScheduleGradeLevel] WITH CHECK ADD CONSTRAINT [FK_BellScheduleGradeLevel_GradeLevelDescriptor] FOREIGN KEY ([GradeLevelDescriptorId])
REFERENCES [edfi].[GradeLevelDescriptor] ([GradeLevelDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_BellScheduleGradeLevel_GradeLevelDescriptor]
ON [edfi].[BellScheduleGradeLevel] ([GradeLevelDescriptorId] ASC)
GO
ALTER TABLE [edfi].[Budget] WITH CHECK ADD CONSTRAINT [FK_Budget_Account] FOREIGN KEY ([AccountIdentifier], [EducationOrganizationId], [FiscalYear])
REFERENCES [edfi].[Account] ([AccountIdentifier], [EducationOrganizationId], [FiscalYear])
GO
CREATE NONCLUSTERED INDEX [FK_Budget_Account]
ON [edfi].[Budget] ([AccountIdentifier] ASC, [EducationOrganizationId] ASC, [FiscalYear] ASC)
GO
ALTER TABLE [edfi].[Calendar] WITH CHECK ADD CONSTRAINT [FK_Calendar_CalendarTypeDescriptor] FOREIGN KEY ([CalendarTypeDescriptorId])
REFERENCES [edfi].[CalendarTypeDescriptor] ([CalendarTypeDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_Calendar_CalendarTypeDescriptor]
ON [edfi].[Calendar] ([CalendarTypeDescriptorId] ASC)
GO
ALTER TABLE [edfi].[Calendar] WITH CHECK ADD CONSTRAINT [FK_Calendar_School] FOREIGN KEY ([SchoolId])
REFERENCES [edfi].[School] ([SchoolId])
GO
CREATE NONCLUSTERED INDEX [FK_Calendar_School]
ON [edfi].[Calendar] ([SchoolId] ASC)
GO
ALTER TABLE [edfi].[Calendar] WITH CHECK ADD CONSTRAINT [FK_Calendar_SchoolYearType] FOREIGN KEY ([SchoolYear])
REFERENCES [edfi].[SchoolYearType] ([SchoolYear])
GO
CREATE NONCLUSTERED INDEX [FK_Calendar_SchoolYearType]
ON [edfi].[Calendar] ([SchoolYear] ASC)
GO
ALTER TABLE [edfi].[CalendarDate] WITH CHECK ADD CONSTRAINT [FK_CalendarDate_Calendar] FOREIGN KEY ([CalendarCode], [SchoolId], [SchoolYear])
REFERENCES [edfi].[Calendar] ([CalendarCode], [SchoolId], [SchoolYear])
GO
CREATE NONCLUSTERED INDEX [FK_CalendarDate_Calendar]
ON [edfi].[CalendarDate] ([CalendarCode] ASC, [SchoolId] ASC, [SchoolYear] ASC)
GO
ALTER TABLE [edfi].[CalendarDateCalendarEvent] WITH CHECK ADD CONSTRAINT [FK_CalendarDateCalendarEvent_CalendarDate] FOREIGN KEY ([CalendarCode], [Date], [SchoolId], [SchoolYear])
REFERENCES [edfi].[CalendarDate] ([CalendarCode], [Date], [SchoolId], [SchoolYear])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_CalendarDateCalendarEvent_CalendarDate]
ON [edfi].[CalendarDateCalendarEvent] ([CalendarCode] ASC, [Date] ASC, [SchoolId] ASC, [SchoolYear] ASC)
GO
ALTER TABLE [edfi].[CalendarDateCalendarEvent] WITH CHECK ADD CONSTRAINT [FK_CalendarDateCalendarEvent_CalendarEventDescriptor] FOREIGN KEY ([CalendarEventDescriptorId])
REFERENCES [edfi].[CalendarEventDescriptor] ([CalendarEventDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_CalendarDateCalendarEvent_CalendarEventDescriptor]
ON [edfi].[CalendarDateCalendarEvent] ([CalendarEventDescriptorId] ASC)
GO
ALTER TABLE [edfi].[CalendarEventDescriptor] WITH CHECK ADD CONSTRAINT [FK_CalendarEventDescriptor_Descriptor] FOREIGN KEY ([CalendarEventDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[CalendarGradeLevel] WITH CHECK ADD CONSTRAINT [FK_CalendarGradeLevel_Calendar] FOREIGN KEY ([CalendarCode], [SchoolId], [SchoolYear])
REFERENCES [edfi].[Calendar] ([CalendarCode], [SchoolId], [SchoolYear])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_CalendarGradeLevel_Calendar]
ON [edfi].[CalendarGradeLevel] ([CalendarCode] ASC, [SchoolId] ASC, [SchoolYear] ASC)
GO
ALTER TABLE [edfi].[CalendarGradeLevel] WITH CHECK ADD CONSTRAINT [FK_CalendarGradeLevel_GradeLevelDescriptor] FOREIGN KEY ([GradeLevelDescriptorId])
REFERENCES [edfi].[GradeLevelDescriptor] ([GradeLevelDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_CalendarGradeLevel_GradeLevelDescriptor]
ON [edfi].[CalendarGradeLevel] ([GradeLevelDescriptorId] ASC)
GO
ALTER TABLE [edfi].[CalendarTypeDescriptor] WITH CHECK ADD CONSTRAINT [FK_CalendarTypeDescriptor_Descriptor] FOREIGN KEY ([CalendarTypeDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[CareerPathwayDescriptor] WITH CHECK ADD CONSTRAINT [FK_CareerPathwayDescriptor_Descriptor] FOREIGN KEY ([CareerPathwayDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[CharterApprovalAgencyTypeDescriptor] WITH CHECK ADD CONSTRAINT [FK_CharterApprovalAgencyTypeDescriptor_Descriptor] FOREIGN KEY ([CharterApprovalAgencyTypeDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[CharterStatusDescriptor] WITH CHECK ADD CONSTRAINT [FK_CharterStatusDescriptor_Descriptor] FOREIGN KEY ([CharterStatusDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[CitizenshipStatusDescriptor] WITH CHECK ADD CONSTRAINT [FK_CitizenshipStatusDescriptor_Descriptor] FOREIGN KEY ([CitizenshipStatusDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[ClassPeriod] WITH CHECK ADD CONSTRAINT [FK_ClassPeriod_School] FOREIGN KEY ([SchoolId])
REFERENCES [edfi].[School] ([SchoolId])
GO
CREATE NONCLUSTERED INDEX [FK_ClassPeriod_School]
ON [edfi].[ClassPeriod] ([SchoolId] ASC)
GO
ALTER TABLE [edfi].[ClassPeriodMeetingTime] WITH CHECK ADD CONSTRAINT [FK_ClassPeriodMeetingTime_ClassPeriod] FOREIGN KEY ([ClassPeriodName], [SchoolId])
REFERENCES [edfi].[ClassPeriod] ([ClassPeriodName], [SchoolId])
ON DELETE CASCADE
ON UPDATE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_ClassPeriodMeetingTime_ClassPeriod]
ON [edfi].[ClassPeriodMeetingTime] ([ClassPeriodName] ASC, [SchoolId] ASC)
GO
ALTER TABLE [edfi].[ClassroomPositionDescriptor] WITH CHECK ADD CONSTRAINT [FK_ClassroomPositionDescriptor_Descriptor] FOREIGN KEY ([ClassroomPositionDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[Cohort] WITH CHECK ADD CONSTRAINT [FK_Cohort_AcademicSubjectDescriptor] FOREIGN KEY ([AcademicSubjectDescriptorId])
REFERENCES [edfi].[AcademicSubjectDescriptor] ([AcademicSubjectDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_Cohort_AcademicSubjectDescriptor]
ON [edfi].[Cohort] ([AcademicSubjectDescriptorId] ASC)
GO
ALTER TABLE [edfi].[Cohort] WITH CHECK ADD CONSTRAINT [FK_Cohort_CohortScopeDescriptor] FOREIGN KEY ([CohortScopeDescriptorId])
REFERENCES [edfi].[CohortScopeDescriptor] ([CohortScopeDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_Cohort_CohortScopeDescriptor]
ON [edfi].[Cohort] ([CohortScopeDescriptorId] ASC)
GO
ALTER TABLE [edfi].[Cohort] WITH CHECK ADD CONSTRAINT [FK_Cohort_CohortTypeDescriptor] FOREIGN KEY ([CohortTypeDescriptorId])
REFERENCES [edfi].[CohortTypeDescriptor] ([CohortTypeDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_Cohort_CohortTypeDescriptor]
ON [edfi].[Cohort] ([CohortTypeDescriptorId] ASC)
GO
ALTER TABLE [edfi].[Cohort] WITH CHECK ADD CONSTRAINT [FK_Cohort_EducationOrganization] FOREIGN KEY ([EducationOrganizationId])
REFERENCES [edfi].[EducationOrganization] ([EducationOrganizationId])
GO
CREATE NONCLUSTERED INDEX [FK_Cohort_EducationOrganization]
ON [edfi].[Cohort] ([EducationOrganizationId] ASC)
GO
ALTER TABLE [edfi].[CohortProgram] WITH CHECK ADD CONSTRAINT [FK_CohortProgram_Cohort] FOREIGN KEY ([CohortIdentifier], [EducationOrganizationId])
REFERENCES [edfi].[Cohort] ([CohortIdentifier], [EducationOrganizationId])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_CohortProgram_Cohort]
ON [edfi].[CohortProgram] ([CohortIdentifier] ASC, [EducationOrganizationId] ASC)
GO
ALTER TABLE [edfi].[CohortProgram] WITH CHECK ADD CONSTRAINT [FK_CohortProgram_Program] FOREIGN KEY ([ProgramEducationOrganizationId], [ProgramName], [ProgramTypeDescriptorId])
REFERENCES [edfi].[Program] ([EducationOrganizationId], [ProgramName], [ProgramTypeDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_CohortProgram_Program]
ON [edfi].[CohortProgram] ([ProgramEducationOrganizationId] ASC, [ProgramName] ASC, [ProgramTypeDescriptorId] ASC)
GO
ALTER TABLE [edfi].[CohortScopeDescriptor] WITH CHECK ADD CONSTRAINT [FK_CohortScopeDescriptor_Descriptor] FOREIGN KEY ([CohortScopeDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[CohortTypeDescriptor] WITH CHECK ADD CONSTRAINT [FK_CohortTypeDescriptor_Descriptor] FOREIGN KEY ([CohortTypeDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[CohortYearTypeDescriptor] WITH CHECK ADD CONSTRAINT [FK_CohortYearTypeDescriptor_Descriptor] FOREIGN KEY ([CohortYearTypeDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[CommunityOrganization] WITH CHECK ADD CONSTRAINT [FK_CommunityOrganization_EducationOrganization] FOREIGN KEY ([CommunityOrganizationId])
REFERENCES [edfi].[EducationOrganization] ([EducationOrganizationId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[CommunityProvider] WITH CHECK ADD CONSTRAINT [FK_CommunityProvider_CommunityOrganization] FOREIGN KEY ([CommunityOrganizationId])
REFERENCES [edfi].[CommunityOrganization] ([CommunityOrganizationId])
GO
CREATE NONCLUSTERED INDEX [FK_CommunityProvider_CommunityOrganization]
ON [edfi].[CommunityProvider] ([CommunityOrganizationId] ASC)
GO
ALTER TABLE [edfi].[CommunityProvider] WITH CHECK ADD CONSTRAINT [FK_CommunityProvider_EducationOrganization] FOREIGN KEY ([CommunityProviderId])
REFERENCES [edfi].[EducationOrganization] ([EducationOrganizationId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[CommunityProvider] WITH CHECK ADD CONSTRAINT [FK_CommunityProvider_ProviderCategoryDescriptor] FOREIGN KEY ([ProviderCategoryDescriptorId])
REFERENCES [edfi].[ProviderCategoryDescriptor] ([ProviderCategoryDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_CommunityProvider_ProviderCategoryDescriptor]
ON [edfi].[CommunityProvider] ([ProviderCategoryDescriptorId] ASC)
GO
ALTER TABLE [edfi].[CommunityProvider] WITH CHECK ADD CONSTRAINT [FK_CommunityProvider_ProviderProfitabilityDescriptor] FOREIGN KEY ([ProviderProfitabilityDescriptorId])
REFERENCES [edfi].[ProviderProfitabilityDescriptor] ([ProviderProfitabilityDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_CommunityProvider_ProviderProfitabilityDescriptor]
ON [edfi].[CommunityProvider] ([ProviderProfitabilityDescriptorId] ASC)
GO
ALTER TABLE [edfi].[CommunityProvider] WITH CHECK ADD CONSTRAINT [FK_CommunityProvider_ProviderStatusDescriptor] FOREIGN KEY ([ProviderStatusDescriptorId])
REFERENCES [edfi].[ProviderStatusDescriptor] ([ProviderStatusDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_CommunityProvider_ProviderStatusDescriptor]
ON [edfi].[CommunityProvider] ([ProviderStatusDescriptorId] ASC)
GO
ALTER TABLE [edfi].[CommunityProviderLicense] WITH CHECK ADD CONSTRAINT [FK_CommunityProviderLicense_CommunityProvider] FOREIGN KEY ([CommunityProviderId])
REFERENCES [edfi].[CommunityProvider] ([CommunityProviderId])
GO
CREATE NONCLUSTERED INDEX [FK_CommunityProviderLicense_CommunityProvider]
ON [edfi].[CommunityProviderLicense] ([CommunityProviderId] ASC)
GO
ALTER TABLE [edfi].[CommunityProviderLicense] WITH CHECK ADD CONSTRAINT [FK_CommunityProviderLicense_LicenseStatusDescriptor] FOREIGN KEY ([LicenseStatusDescriptorId])
REFERENCES [edfi].[LicenseStatusDescriptor] ([LicenseStatusDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_CommunityProviderLicense_LicenseStatusDescriptor]
ON [edfi].[CommunityProviderLicense] ([LicenseStatusDescriptorId] ASC)
GO
ALTER TABLE [edfi].[CommunityProviderLicense] WITH CHECK ADD CONSTRAINT [FK_CommunityProviderLicense_LicenseTypeDescriptor] FOREIGN KEY ([LicenseTypeDescriptorId])
REFERENCES [edfi].[LicenseTypeDescriptor] ([LicenseTypeDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_CommunityProviderLicense_LicenseTypeDescriptor]
ON [edfi].[CommunityProviderLicense] ([LicenseTypeDescriptorId] ASC)
GO
ALTER TABLE [edfi].[CompetencyLevelDescriptor] WITH CHECK ADD CONSTRAINT [FK_CompetencyLevelDescriptor_Descriptor] FOREIGN KEY ([CompetencyLevelDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[CompetencyObjective] WITH CHECK ADD CONSTRAINT [FK_CompetencyObjective_EducationOrganization] FOREIGN KEY ([EducationOrganizationId])
REFERENCES [edfi].[EducationOrganization] ([EducationOrganizationId])
GO
CREATE NONCLUSTERED INDEX [FK_CompetencyObjective_EducationOrganization]
ON [edfi].[CompetencyObjective] ([EducationOrganizationId] ASC)
GO
ALTER TABLE [edfi].[CompetencyObjective] WITH CHECK ADD CONSTRAINT [FK_CompetencyObjective_GradeLevelDescriptor] FOREIGN KEY ([ObjectiveGradeLevelDescriptorId])
REFERENCES [edfi].[GradeLevelDescriptor] ([GradeLevelDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_CompetencyObjective_GradeLevelDescriptor]
ON [edfi].[CompetencyObjective] ([ObjectiveGradeLevelDescriptorId] ASC)
GO
ALTER TABLE [edfi].[ContactTypeDescriptor] WITH CHECK ADD CONSTRAINT [FK_ContactTypeDescriptor_Descriptor] FOREIGN KEY ([ContactTypeDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[ContentClassDescriptor] WITH CHECK ADD CONSTRAINT [FK_ContentClassDescriptor_Descriptor] FOREIGN KEY ([ContentClassDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[ContinuationOfServicesReasonDescriptor] WITH CHECK ADD CONSTRAINT [FK_ContinuationOfServicesReasonDescriptor_Descriptor] FOREIGN KEY ([ContinuationOfServicesReasonDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[ContractedStaff] WITH CHECK ADD CONSTRAINT [FK_ContractedStaff_Account] FOREIGN KEY ([AccountIdentifier], [EducationOrganizationId], [FiscalYear])
REFERENCES [edfi].[Account] ([AccountIdentifier], [EducationOrganizationId], [FiscalYear])
GO
CREATE NONCLUSTERED INDEX [FK_ContractedStaff_Account]
ON [edfi].[ContractedStaff] ([AccountIdentifier] ASC, [EducationOrganizationId] ASC, [FiscalYear] ASC)
GO
ALTER TABLE [edfi].[ContractedStaff] WITH CHECK ADD CONSTRAINT [FK_ContractedStaff_Staff] FOREIGN KEY ([StaffUSI])
REFERENCES [edfi].[Staff] ([StaffUSI])
GO
CREATE NONCLUSTERED INDEX [FK_ContractedStaff_Staff]
ON [edfi].[ContractedStaff] ([StaffUSI] ASC)
GO
ALTER TABLE [edfi].[CostRateDescriptor] WITH CHECK ADD CONSTRAINT [FK_CostRateDescriptor_Descriptor] FOREIGN KEY ([CostRateDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[CountryDescriptor] WITH CHECK ADD CONSTRAINT [FK_CountryDescriptor_Descriptor] FOREIGN KEY ([CountryDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[Course] WITH CHECK ADD CONSTRAINT [FK_Course_AcademicSubjectDescriptor] FOREIGN KEY ([AcademicSubjectDescriptorId])
REFERENCES [edfi].[AcademicSubjectDescriptor] ([AcademicSubjectDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_Course_AcademicSubjectDescriptor]
ON [edfi].[Course] ([AcademicSubjectDescriptorId] ASC)
GO
ALTER TABLE [edfi].[Course] WITH CHECK ADD CONSTRAINT [FK_Course_CareerPathwayDescriptor] FOREIGN KEY ([CareerPathwayDescriptorId])
REFERENCES [edfi].[CareerPathwayDescriptor] ([CareerPathwayDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_Course_CareerPathwayDescriptor]
ON [edfi].[Course] ([CareerPathwayDescriptorId] ASC)
GO
ALTER TABLE [edfi].[Course] WITH CHECK ADD CONSTRAINT [FK_Course_CourseDefinedByDescriptor] FOREIGN KEY ([CourseDefinedByDescriptorId])
REFERENCES [edfi].[CourseDefinedByDescriptor] ([CourseDefinedByDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_Course_CourseDefinedByDescriptor]
ON [edfi].[Course] ([CourseDefinedByDescriptorId] ASC)
GO
ALTER TABLE [edfi].[Course] WITH CHECK ADD CONSTRAINT [FK_Course_CourseGPAApplicabilityDescriptor] FOREIGN KEY ([CourseGPAApplicabilityDescriptorId])
REFERENCES [edfi].[CourseGPAApplicabilityDescriptor] ([CourseGPAApplicabilityDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_Course_CourseGPAApplicabilityDescriptor]
ON [edfi].[Course] ([CourseGPAApplicabilityDescriptorId] ASC)
GO
ALTER TABLE [edfi].[Course] WITH CHECK ADD CONSTRAINT [FK_Course_CreditTypeDescriptor] FOREIGN KEY ([MinimumAvailableCreditTypeDescriptorId])
REFERENCES [edfi].[CreditTypeDescriptor] ([CreditTypeDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_Course_CreditTypeDescriptor]
ON [edfi].[Course] ([MinimumAvailableCreditTypeDescriptorId] ASC)
GO
ALTER TABLE [edfi].[Course] WITH CHECK ADD CONSTRAINT [FK_Course_CreditTypeDescriptor1] FOREIGN KEY ([MaximumAvailableCreditTypeDescriptorId])
REFERENCES [edfi].[CreditTypeDescriptor] ([CreditTypeDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_Course_CreditTypeDescriptor1]
ON [edfi].[Course] ([MaximumAvailableCreditTypeDescriptorId] ASC)
GO
ALTER TABLE [edfi].[Course] WITH CHECK ADD CONSTRAINT [FK_Course_EducationOrganization] FOREIGN KEY ([EducationOrganizationId])
REFERENCES [edfi].[EducationOrganization] ([EducationOrganizationId])
GO
CREATE NONCLUSTERED INDEX [FK_Course_EducationOrganization]
ON [edfi].[Course] ([EducationOrganizationId] ASC)
GO
ALTER TABLE [edfi].[CourseAttemptResultDescriptor] WITH CHECK ADD CONSTRAINT [FK_CourseAttemptResultDescriptor_Descriptor] FOREIGN KEY ([CourseAttemptResultDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[CourseCompetencyLevel] WITH CHECK ADD CONSTRAINT [FK_CourseCompetencyLevel_CompetencyLevelDescriptor] FOREIGN KEY ([CompetencyLevelDescriptorId])
REFERENCES [edfi].[CompetencyLevelDescriptor] ([CompetencyLevelDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_CourseCompetencyLevel_CompetencyLevelDescriptor]
ON [edfi].[CourseCompetencyLevel] ([CompetencyLevelDescriptorId] ASC)
GO
ALTER TABLE [edfi].[CourseCompetencyLevel] WITH CHECK ADD CONSTRAINT [FK_CourseCompetencyLevel_Course] FOREIGN KEY ([CourseCode], [EducationOrganizationId])
REFERENCES [edfi].[Course] ([CourseCode], [EducationOrganizationId])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_CourseCompetencyLevel_Course]
ON [edfi].[CourseCompetencyLevel] ([CourseCode] ASC, [EducationOrganizationId] ASC)
GO
ALTER TABLE [edfi].[CourseDefinedByDescriptor] WITH CHECK ADD CONSTRAINT [FK_CourseDefinedByDescriptor_Descriptor] FOREIGN KEY ([CourseDefinedByDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[CourseGPAApplicabilityDescriptor] WITH CHECK ADD CONSTRAINT [FK_CourseGPAApplicabilityDescriptor_Descriptor] FOREIGN KEY ([CourseGPAApplicabilityDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[CourseIdentificationCode] WITH CHECK ADD CONSTRAINT [FK_CourseIdentificationCode_Course] FOREIGN KEY ([CourseCode], [EducationOrganizationId])
REFERENCES [edfi].[Course] ([CourseCode], [EducationOrganizationId])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_CourseIdentificationCode_Course]
ON [edfi].[CourseIdentificationCode] ([CourseCode] ASC, [EducationOrganizationId] ASC)
GO
ALTER TABLE [edfi].[CourseIdentificationCode] WITH CHECK ADD CONSTRAINT [FK_CourseIdentificationCode_CourseIdentificationSystemDescriptor] FOREIGN KEY ([CourseIdentificationSystemDescriptorId])
REFERENCES [edfi].[CourseIdentificationSystemDescriptor] ([CourseIdentificationSystemDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_CourseIdentificationCode_CourseIdentificationSystemDescriptor]
ON [edfi].[CourseIdentificationCode] ([CourseIdentificationSystemDescriptorId] ASC)
GO
ALTER TABLE [edfi].[CourseIdentificationSystemDescriptor] WITH CHECK ADD CONSTRAINT [FK_CourseIdentificationSystemDescriptor_Descriptor] FOREIGN KEY ([CourseIdentificationSystemDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[CourseLearningObjective] WITH CHECK ADD CONSTRAINT [FK_CourseLearningObjective_Course] FOREIGN KEY ([CourseCode], [EducationOrganizationId])
REFERENCES [edfi].[Course] ([CourseCode], [EducationOrganizationId])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_CourseLearningObjective_Course]
ON [edfi].[CourseLearningObjective] ([CourseCode] ASC, [EducationOrganizationId] ASC)
GO
ALTER TABLE [edfi].[CourseLearningObjective] WITH CHECK ADD CONSTRAINT [FK_CourseLearningObjective_LearningObjective] FOREIGN KEY ([LearningObjectiveId], [Namespace])
REFERENCES [edfi].[LearningObjective] ([LearningObjectiveId], [Namespace])
GO
CREATE NONCLUSTERED INDEX [FK_CourseLearningObjective_LearningObjective]
ON [edfi].[CourseLearningObjective] ([LearningObjectiveId] ASC, [Namespace] ASC)
GO
ALTER TABLE [edfi].[CourseLearningStandard] WITH CHECK ADD CONSTRAINT [FK_CourseLearningStandard_Course] FOREIGN KEY ([CourseCode], [EducationOrganizationId])
REFERENCES [edfi].[Course] ([CourseCode], [EducationOrganizationId])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_CourseLearningStandard_Course]
ON [edfi].[CourseLearningStandard] ([CourseCode] ASC, [EducationOrganizationId] ASC)
GO
ALTER TABLE [edfi].[CourseLearningStandard] WITH CHECK ADD CONSTRAINT [FK_CourseLearningStandard_LearningStandard] FOREIGN KEY ([LearningStandardId])
REFERENCES [edfi].[LearningStandard] ([LearningStandardId])
GO
CREATE NONCLUSTERED INDEX [FK_CourseLearningStandard_LearningStandard]
ON [edfi].[CourseLearningStandard] ([LearningStandardId] ASC)
GO
ALTER TABLE [edfi].[CourseLevelCharacteristic] WITH CHECK ADD CONSTRAINT [FK_CourseLevelCharacteristic_Course] FOREIGN KEY ([CourseCode], [EducationOrganizationId])
REFERENCES [edfi].[Course] ([CourseCode], [EducationOrganizationId])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_CourseLevelCharacteristic_Course]
ON [edfi].[CourseLevelCharacteristic] ([CourseCode] ASC, [EducationOrganizationId] ASC)
GO
ALTER TABLE [edfi].[CourseLevelCharacteristic] WITH CHECK ADD CONSTRAINT [FK_CourseLevelCharacteristic_CourseLevelCharacteristicDescriptor] FOREIGN KEY ([CourseLevelCharacteristicDescriptorId])
REFERENCES [edfi].[CourseLevelCharacteristicDescriptor] ([CourseLevelCharacteristicDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_CourseLevelCharacteristic_CourseLevelCharacteristicDescriptor]
ON [edfi].[CourseLevelCharacteristic] ([CourseLevelCharacteristicDescriptorId] ASC)
GO
ALTER TABLE [edfi].[CourseLevelCharacteristicDescriptor] WITH CHECK ADD CONSTRAINT [FK_CourseLevelCharacteristicDescriptor_Descriptor] FOREIGN KEY ([CourseLevelCharacteristicDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[CourseOfferedGradeLevel] WITH CHECK ADD CONSTRAINT [FK_CourseOfferedGradeLevel_Course] FOREIGN KEY ([CourseCode], [EducationOrganizationId])
REFERENCES [edfi].[Course] ([CourseCode], [EducationOrganizationId])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_CourseOfferedGradeLevel_Course]
ON [edfi].[CourseOfferedGradeLevel] ([CourseCode] ASC, [EducationOrganizationId] ASC)
GO
ALTER TABLE [edfi].[CourseOfferedGradeLevel] WITH CHECK ADD CONSTRAINT [FK_CourseOfferedGradeLevel_GradeLevelDescriptor] FOREIGN KEY ([GradeLevelDescriptorId])
REFERENCES [edfi].[GradeLevelDescriptor] ([GradeLevelDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_CourseOfferedGradeLevel_GradeLevelDescriptor]
ON [edfi].[CourseOfferedGradeLevel] ([GradeLevelDescriptorId] ASC)
GO
ALTER TABLE [edfi].[CourseOffering] WITH CHECK ADD CONSTRAINT [FK_CourseOffering_Course] FOREIGN KEY ([CourseCode], [EducationOrganizationId])
REFERENCES [edfi].[Course] ([CourseCode], [EducationOrganizationId])
GO
CREATE NONCLUSTERED INDEX [FK_CourseOffering_Course]
ON [edfi].[CourseOffering] ([CourseCode] ASC, [EducationOrganizationId] ASC)
GO
ALTER TABLE [edfi].[CourseOffering] WITH CHECK ADD CONSTRAINT [FK_CourseOffering_School] FOREIGN KEY ([SchoolId])
REFERENCES [edfi].[School] ([SchoolId])
GO
CREATE NONCLUSTERED INDEX [FK_CourseOffering_School]
ON [edfi].[CourseOffering] ([SchoolId] ASC)
GO
ALTER TABLE [edfi].[CourseOffering] WITH CHECK ADD CONSTRAINT [FK_CourseOffering_Session] FOREIGN KEY ([SchoolId], [SchoolYear], [SessionName])
REFERENCES [edfi].[Session] ([SchoolId], [SchoolYear], [SessionName])
ON UPDATE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_CourseOffering_Session]
ON [edfi].[CourseOffering] ([SchoolId] ASC, [SchoolYear] ASC, [SessionName] ASC)
GO
ALTER TABLE [edfi].[CourseOfferingCourseLevelCharacteristic] WITH CHECK ADD CONSTRAINT [FK_CourseOfferingCourseLevelCharacteristic_CourseLevelCharacteristicDescriptor] FOREIGN KEY ([CourseLevelCharacteristicDescriptorId])
REFERENCES [edfi].[CourseLevelCharacteristicDescriptor] ([CourseLevelCharacteristicDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_CourseOfferingCourseLevelCharacteristic_CourseLevelCharacteristicDescriptor]
ON [edfi].[CourseOfferingCourseLevelCharacteristic] ([CourseLevelCharacteristicDescriptorId] ASC)
GO
ALTER TABLE [edfi].[CourseOfferingCourseLevelCharacteristic] WITH CHECK ADD CONSTRAINT [FK_CourseOfferingCourseLevelCharacteristic_CourseOffering] FOREIGN KEY ([LocalCourseCode], [SchoolId], [SchoolYear], [SessionName])
REFERENCES [edfi].[CourseOffering] ([LocalCourseCode], [SchoolId], [SchoolYear], [SessionName])
ON DELETE CASCADE
ON UPDATE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_CourseOfferingCourseLevelCharacteristic_CourseOffering]
ON [edfi].[CourseOfferingCourseLevelCharacteristic] ([LocalCourseCode] ASC, [SchoolId] ASC, [SchoolYear] ASC, [SessionName] ASC)
GO
ALTER TABLE [edfi].[CourseOfferingCurriculumUsed] WITH CHECK ADD CONSTRAINT [FK_CourseOfferingCurriculumUsed_CourseOffering] FOREIGN KEY ([LocalCourseCode], [SchoolId], [SchoolYear], [SessionName])
REFERENCES [edfi].[CourseOffering] ([LocalCourseCode], [SchoolId], [SchoolYear], [SessionName])
ON DELETE CASCADE
ON UPDATE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_CourseOfferingCurriculumUsed_CourseOffering]
ON [edfi].[CourseOfferingCurriculumUsed] ([LocalCourseCode] ASC, [SchoolId] ASC, [SchoolYear] ASC, [SessionName] ASC)
GO
ALTER TABLE [edfi].[CourseOfferingCurriculumUsed] WITH CHECK ADD CONSTRAINT [FK_CourseOfferingCurriculumUsed_CurriculumUsedDescriptor] FOREIGN KEY ([CurriculumUsedDescriptorId])
REFERENCES [edfi].[CurriculumUsedDescriptor] ([CurriculumUsedDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_CourseOfferingCurriculumUsed_CurriculumUsedDescriptor]
ON [edfi].[CourseOfferingCurriculumUsed] ([CurriculumUsedDescriptorId] ASC)
GO
ALTER TABLE [edfi].[CourseOfferingOfferedGradeLevel] WITH CHECK ADD CONSTRAINT [FK_CourseOfferingOfferedGradeLevel_CourseOffering] FOREIGN KEY ([LocalCourseCode], [SchoolId], [SchoolYear], [SessionName])
REFERENCES [edfi].[CourseOffering] ([LocalCourseCode], [SchoolId], [SchoolYear], [SessionName])
ON DELETE CASCADE
ON UPDATE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_CourseOfferingOfferedGradeLevel_CourseOffering]
ON [edfi].[CourseOfferingOfferedGradeLevel] ([LocalCourseCode] ASC, [SchoolId] ASC, [SchoolYear] ASC, [SessionName] ASC)
GO
ALTER TABLE [edfi].[CourseOfferingOfferedGradeLevel] WITH CHECK ADD CONSTRAINT [FK_CourseOfferingOfferedGradeLevel_GradeLevelDescriptor] FOREIGN KEY ([GradeLevelDescriptorId])
REFERENCES [edfi].[GradeLevelDescriptor] ([GradeLevelDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_CourseOfferingOfferedGradeLevel_GradeLevelDescriptor]
ON [edfi].[CourseOfferingOfferedGradeLevel] ([GradeLevelDescriptorId] ASC)
GO
ALTER TABLE [edfi].[CourseRepeatCodeDescriptor] WITH CHECK ADD CONSTRAINT [FK_CourseRepeatCodeDescriptor_Descriptor] FOREIGN KEY ([CourseRepeatCodeDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[CourseTranscript] WITH CHECK ADD CONSTRAINT [FK_CourseTranscript_Course] FOREIGN KEY ([CourseCode], [CourseEducationOrganizationId])
REFERENCES [edfi].[Course] ([CourseCode], [EducationOrganizationId])
GO
CREATE NONCLUSTERED INDEX [FK_CourseTranscript_Course]
ON [edfi].[CourseTranscript] ([CourseCode] ASC, [CourseEducationOrganizationId] ASC)
GO
ALTER TABLE [edfi].[CourseTranscript] WITH CHECK ADD CONSTRAINT [FK_CourseTranscript_CourseAttemptResultDescriptor] FOREIGN KEY ([CourseAttemptResultDescriptorId])
REFERENCES [edfi].[CourseAttemptResultDescriptor] ([CourseAttemptResultDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_CourseTranscript_CourseAttemptResultDescriptor]
ON [edfi].[CourseTranscript] ([CourseAttemptResultDescriptorId] ASC)
GO
ALTER TABLE [edfi].[CourseTranscript] WITH CHECK ADD CONSTRAINT [FK_CourseTranscript_CourseRepeatCodeDescriptor] FOREIGN KEY ([CourseRepeatCodeDescriptorId])
REFERENCES [edfi].[CourseRepeatCodeDescriptor] ([CourseRepeatCodeDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_CourseTranscript_CourseRepeatCodeDescriptor]
ON [edfi].[CourseTranscript] ([CourseRepeatCodeDescriptorId] ASC)
GO
ALTER TABLE [edfi].[CourseTranscript] WITH CHECK ADD CONSTRAINT [FK_CourseTranscript_CreditTypeDescriptor] FOREIGN KEY ([AttemptedCreditTypeDescriptorId])
REFERENCES [edfi].[CreditTypeDescriptor] ([CreditTypeDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_CourseTranscript_CreditTypeDescriptor]
ON [edfi].[CourseTranscript] ([AttemptedCreditTypeDescriptorId] ASC)
GO
ALTER TABLE [edfi].[CourseTranscript] WITH CHECK ADD CONSTRAINT [FK_CourseTranscript_CreditTypeDescriptor1] FOREIGN KEY ([EarnedCreditTypeDescriptorId])
REFERENCES [edfi].[CreditTypeDescriptor] ([CreditTypeDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_CourseTranscript_CreditTypeDescriptor1]
ON [edfi].[CourseTranscript] ([EarnedCreditTypeDescriptorId] ASC)
GO
ALTER TABLE [edfi].[CourseTranscript] WITH CHECK ADD CONSTRAINT [FK_CourseTranscript_EducationOrganization] FOREIGN KEY ([ExternalEducationOrganizationId])
REFERENCES [edfi].[EducationOrganization] ([EducationOrganizationId])
GO
CREATE NONCLUSTERED INDEX [FK_CourseTranscript_EducationOrganization]
ON [edfi].[CourseTranscript] ([ExternalEducationOrganizationId] ASC)
GO
ALTER TABLE [edfi].[CourseTranscript] WITH CHECK ADD CONSTRAINT [FK_CourseTranscript_GradeLevelDescriptor] FOREIGN KEY ([WhenTakenGradeLevelDescriptorId])
REFERENCES [edfi].[GradeLevelDescriptor] ([GradeLevelDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_CourseTranscript_GradeLevelDescriptor]
ON [edfi].[CourseTranscript] ([WhenTakenGradeLevelDescriptorId] ASC)
GO
ALTER TABLE [edfi].[CourseTranscript] WITH CHECK ADD CONSTRAINT [FK_CourseTranscript_MethodCreditEarnedDescriptor] FOREIGN KEY ([MethodCreditEarnedDescriptorId])
REFERENCES [edfi].[MethodCreditEarnedDescriptor] ([MethodCreditEarnedDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_CourseTranscript_MethodCreditEarnedDescriptor]
ON [edfi].[CourseTranscript] ([MethodCreditEarnedDescriptorId] ASC)
GO
ALTER TABLE [edfi].[CourseTranscript] WITH CHECK ADD CONSTRAINT [FK_CourseTranscript_StudentAcademicRecord] FOREIGN KEY ([EducationOrganizationId], [SchoolYear], [StudentUSI], [TermDescriptorId])
REFERENCES [edfi].[StudentAcademicRecord] ([EducationOrganizationId], [SchoolYear], [StudentUSI], [TermDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_CourseTranscript_StudentAcademicRecord]
ON [edfi].[CourseTranscript] ([EducationOrganizationId] ASC, [SchoolYear] ASC, [StudentUSI] ASC, [TermDescriptorId] ASC)
GO
ALTER TABLE [edfi].[CourseTranscriptAcademicSubject] WITH CHECK ADD CONSTRAINT [FK_CourseTranscriptAcademicSubject_AcademicSubjectDescriptor] FOREIGN KEY ([AcademicSubjectDescriptorId])
REFERENCES [edfi].[AcademicSubjectDescriptor] ([AcademicSubjectDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_CourseTranscriptAcademicSubject_AcademicSubjectDescriptor]
ON [edfi].[CourseTranscriptAcademicSubject] ([AcademicSubjectDescriptorId] ASC)
GO
ALTER TABLE [edfi].[CourseTranscriptAcademicSubject] WITH CHECK ADD CONSTRAINT [FK_CourseTranscriptAcademicSubject_CourseTranscript] FOREIGN KEY ([CourseAttemptResultDescriptorId], [CourseCode], [CourseEducationOrganizationId], [EducationOrganizationId], [SchoolYear], [StudentUSI], [TermDescriptorId])
REFERENCES [edfi].[CourseTranscript] ([CourseAttemptResultDescriptorId], [CourseCode], [CourseEducationOrganizationId], [EducationOrganizationId], [SchoolYear], [StudentUSI], [TermDescriptorId])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_CourseTranscriptAcademicSubject_CourseTranscript]
ON [edfi].[CourseTranscriptAcademicSubject] ([CourseAttemptResultDescriptorId] ASC, [CourseCode] ASC, [CourseEducationOrganizationId] ASC, [EducationOrganizationId] ASC, [SchoolYear] ASC, [StudentUSI] ASC, [TermDescriptorId] ASC)
GO
ALTER TABLE [edfi].[CourseTranscriptAlternativeCourseIdentificationCode] WITH CHECK ADD CONSTRAINT [FK_CourseTranscriptAlternativeCourseIdentificationCode_CourseIdentificationSystemDescriptor] FOREIGN KEY ([CourseIdentificationSystemDescriptorId])
REFERENCES [edfi].[CourseIdentificationSystemDescriptor] ([CourseIdentificationSystemDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_CourseTranscriptAlternativeCourseIdentificationCode_CourseIdentificationSystemDescriptor]
ON [edfi].[CourseTranscriptAlternativeCourseIdentificationCode] ([CourseIdentificationSystemDescriptorId] ASC)
GO
ALTER TABLE [edfi].[CourseTranscriptAlternativeCourseIdentificationCode] WITH CHECK ADD CONSTRAINT [FK_CourseTranscriptAlternativeCourseIdentificationCode_CourseTranscript] FOREIGN KEY ([CourseAttemptResultDescriptorId], [CourseCode], [CourseEducationOrganizationId], [EducationOrganizationId], [SchoolYear], [StudentUSI], [TermDescriptorId])
REFERENCES [edfi].[CourseTranscript] ([CourseAttemptResultDescriptorId], [CourseCode], [CourseEducationOrganizationId], [EducationOrganizationId], [SchoolYear], [StudentUSI], [TermDescriptorId])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_CourseTranscriptAlternativeCourseIdentificationCode_CourseTranscript]
ON [edfi].[CourseTranscriptAlternativeCourseIdentificationCode] ([CourseAttemptResultDescriptorId] ASC, [CourseCode] ASC, [CourseEducationOrganizationId] ASC, [EducationOrganizationId] ASC, [SchoolYear] ASC, [StudentUSI] ASC, [TermDescriptorId] ASC)
GO
ALTER TABLE [edfi].[CourseTranscriptCreditCategory] WITH CHECK ADD CONSTRAINT [FK_CourseTranscriptCreditCategory_CourseTranscript] FOREIGN KEY ([CourseAttemptResultDescriptorId], [CourseCode], [CourseEducationOrganizationId], [EducationOrganizationId], [SchoolYear], [StudentUSI], [TermDescriptorId])
REFERENCES [edfi].[CourseTranscript] ([CourseAttemptResultDescriptorId], [CourseCode], [CourseEducationOrganizationId], [EducationOrganizationId], [SchoolYear], [StudentUSI], [TermDescriptorId])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_CourseTranscriptCreditCategory_CourseTranscript]
ON [edfi].[CourseTranscriptCreditCategory] ([CourseAttemptResultDescriptorId] ASC, [CourseCode] ASC, [CourseEducationOrganizationId] ASC, [EducationOrganizationId] ASC, [SchoolYear] ASC, [StudentUSI] ASC, [TermDescriptorId] ASC)
GO
ALTER TABLE [edfi].[CourseTranscriptCreditCategory] WITH CHECK ADD CONSTRAINT [FK_CourseTranscriptCreditCategory_CreditCategoryDescriptor] FOREIGN KEY ([CreditCategoryDescriptorId])
REFERENCES [edfi].[CreditCategoryDescriptor] ([CreditCategoryDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_CourseTranscriptCreditCategory_CreditCategoryDescriptor]
ON [edfi].[CourseTranscriptCreditCategory] ([CreditCategoryDescriptorId] ASC)
GO
ALTER TABLE [edfi].[CourseTranscriptEarnedAdditionalCredits] WITH CHECK ADD CONSTRAINT [FK_CourseTranscriptEarnedAdditionalCredits_AdditionalCreditTypeDescriptor] FOREIGN KEY ([AdditionalCreditTypeDescriptorId])
REFERENCES [edfi].[AdditionalCreditTypeDescriptor] ([AdditionalCreditTypeDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_CourseTranscriptEarnedAdditionalCredits_AdditionalCreditTypeDescriptor]
ON [edfi].[CourseTranscriptEarnedAdditionalCredits] ([AdditionalCreditTypeDescriptorId] ASC)
GO
ALTER TABLE [edfi].[CourseTranscriptEarnedAdditionalCredits] WITH CHECK ADD CONSTRAINT [FK_CourseTranscriptEarnedAdditionalCredits_CourseTranscript] FOREIGN KEY ([CourseAttemptResultDescriptorId], [CourseCode], [CourseEducationOrganizationId], [EducationOrganizationId], [SchoolYear], [StudentUSI], [TermDescriptorId])
REFERENCES [edfi].[CourseTranscript] ([CourseAttemptResultDescriptorId], [CourseCode], [CourseEducationOrganizationId], [EducationOrganizationId], [SchoolYear], [StudentUSI], [TermDescriptorId])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_CourseTranscriptEarnedAdditionalCredits_CourseTranscript]
ON [edfi].[CourseTranscriptEarnedAdditionalCredits] ([CourseAttemptResultDescriptorId] ASC, [CourseCode] ASC, [CourseEducationOrganizationId] ASC, [EducationOrganizationId] ASC, [SchoolYear] ASC, [StudentUSI] ASC, [TermDescriptorId] ASC)
GO
ALTER TABLE [edfi].[CourseTranscriptPartialCourseTranscriptAwards] WITH CHECK ADD CONSTRAINT [FK_CourseTranscriptPartialCourseTranscriptAwards_CourseTranscript] FOREIGN KEY ([CourseAttemptResultDescriptorId], [CourseCode], [CourseEducationOrganizationId], [EducationOrganizationId], [SchoolYear], [StudentUSI], [TermDescriptorId])
REFERENCES [edfi].[CourseTranscript] ([CourseAttemptResultDescriptorId], [CourseCode], [CourseEducationOrganizationId], [EducationOrganizationId], [SchoolYear], [StudentUSI], [TermDescriptorId])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_CourseTranscriptPartialCourseTranscriptAwards_CourseTranscript]
ON [edfi].[CourseTranscriptPartialCourseTranscriptAwards] ([CourseAttemptResultDescriptorId] ASC, [CourseCode] ASC, [CourseEducationOrganizationId] ASC, [EducationOrganizationId] ASC, [SchoolYear] ASC, [StudentUSI] ASC, [TermDescriptorId] ASC)
GO
ALTER TABLE [edfi].[CourseTranscriptPartialCourseTranscriptAwards] WITH CHECK ADD CONSTRAINT [FK_CourseTranscriptPartialCourseTranscriptAwards_MethodCreditEarnedDescriptor] FOREIGN KEY ([MethodCreditEarnedDescriptorId])
REFERENCES [edfi].[MethodCreditEarnedDescriptor] ([MethodCreditEarnedDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_CourseTranscriptPartialCourseTranscriptAwards_MethodCreditEarnedDescriptor]
ON [edfi].[CourseTranscriptPartialCourseTranscriptAwards] ([MethodCreditEarnedDescriptorId] ASC)
GO
ALTER TABLE [edfi].[Credential] WITH CHECK ADD CONSTRAINT [FK_Credential_CredentialFieldDescriptor] FOREIGN KEY ([CredentialFieldDescriptorId])
REFERENCES [edfi].[CredentialFieldDescriptor] ([CredentialFieldDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_Credential_CredentialFieldDescriptor]
ON [edfi].[Credential] ([CredentialFieldDescriptorId] ASC)
GO
ALTER TABLE [edfi].[Credential] WITH CHECK ADD CONSTRAINT [FK_Credential_CredentialTypeDescriptor] FOREIGN KEY ([CredentialTypeDescriptorId])
REFERENCES [edfi].[CredentialTypeDescriptor] ([CredentialTypeDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_Credential_CredentialTypeDescriptor]
ON [edfi].[Credential] ([CredentialTypeDescriptorId] ASC)
GO
ALTER TABLE [edfi].[Credential] WITH CHECK ADD CONSTRAINT [FK_Credential_StateAbbreviationDescriptor] FOREIGN KEY ([StateOfIssueStateAbbreviationDescriptorId])
REFERENCES [edfi].[StateAbbreviationDescriptor] ([StateAbbreviationDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_Credential_StateAbbreviationDescriptor]
ON [edfi].[Credential] ([StateOfIssueStateAbbreviationDescriptorId] ASC)
GO
ALTER TABLE [edfi].[Credential] WITH CHECK ADD CONSTRAINT [FK_Credential_TeachingCredentialBasisDescriptor] FOREIGN KEY ([TeachingCredentialBasisDescriptorId])
REFERENCES [edfi].[TeachingCredentialBasisDescriptor] ([TeachingCredentialBasisDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_Credential_TeachingCredentialBasisDescriptor]
ON [edfi].[Credential] ([TeachingCredentialBasisDescriptorId] ASC)
GO
ALTER TABLE [edfi].[Credential] WITH CHECK ADD CONSTRAINT [FK_Credential_TeachingCredentialDescriptor] FOREIGN KEY ([TeachingCredentialDescriptorId])
REFERENCES [edfi].[TeachingCredentialDescriptor] ([TeachingCredentialDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_Credential_TeachingCredentialDescriptor]
ON [edfi].[Credential] ([TeachingCredentialDescriptorId] ASC)
GO
ALTER TABLE [edfi].[CredentialAcademicSubject] WITH CHECK ADD CONSTRAINT [FK_CredentialAcademicSubject_AcademicSubjectDescriptor] FOREIGN KEY ([AcademicSubjectDescriptorId])
REFERENCES [edfi].[AcademicSubjectDescriptor] ([AcademicSubjectDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_CredentialAcademicSubject_AcademicSubjectDescriptor]
ON [edfi].[CredentialAcademicSubject] ([AcademicSubjectDescriptorId] ASC)
GO
ALTER TABLE [edfi].[CredentialAcademicSubject] WITH CHECK ADD CONSTRAINT [FK_CredentialAcademicSubject_Credential] FOREIGN KEY ([CredentialIdentifier], [StateOfIssueStateAbbreviationDescriptorId])
REFERENCES [edfi].[Credential] ([CredentialIdentifier], [StateOfIssueStateAbbreviationDescriptorId])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_CredentialAcademicSubject_Credential]
ON [edfi].[CredentialAcademicSubject] ([CredentialIdentifier] ASC, [StateOfIssueStateAbbreviationDescriptorId] ASC)
GO
ALTER TABLE [edfi].[CredentialEndorsement] WITH CHECK ADD CONSTRAINT [FK_CredentialEndorsement_Credential] FOREIGN KEY ([CredentialIdentifier], [StateOfIssueStateAbbreviationDescriptorId])
REFERENCES [edfi].[Credential] ([CredentialIdentifier], [StateOfIssueStateAbbreviationDescriptorId])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_CredentialEndorsement_Credential]
ON [edfi].[CredentialEndorsement] ([CredentialIdentifier] ASC, [StateOfIssueStateAbbreviationDescriptorId] ASC)
GO
ALTER TABLE [edfi].[CredentialFieldDescriptor] WITH CHECK ADD CONSTRAINT [FK_CredentialFieldDescriptor_Descriptor] FOREIGN KEY ([CredentialFieldDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[CredentialGradeLevel] WITH CHECK ADD CONSTRAINT [FK_CredentialGradeLevel_Credential] FOREIGN KEY ([CredentialIdentifier], [StateOfIssueStateAbbreviationDescriptorId])
REFERENCES [edfi].[Credential] ([CredentialIdentifier], [StateOfIssueStateAbbreviationDescriptorId])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_CredentialGradeLevel_Credential]
ON [edfi].[CredentialGradeLevel] ([CredentialIdentifier] ASC, [StateOfIssueStateAbbreviationDescriptorId] ASC)
GO
ALTER TABLE [edfi].[CredentialGradeLevel] WITH CHECK ADD CONSTRAINT [FK_CredentialGradeLevel_GradeLevelDescriptor] FOREIGN KEY ([GradeLevelDescriptorId])
REFERENCES [edfi].[GradeLevelDescriptor] ([GradeLevelDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_CredentialGradeLevel_GradeLevelDescriptor]
ON [edfi].[CredentialGradeLevel] ([GradeLevelDescriptorId] ASC)
GO
ALTER TABLE [edfi].[CredentialTypeDescriptor] WITH CHECK ADD CONSTRAINT [FK_CredentialTypeDescriptor_Descriptor] FOREIGN KEY ([CredentialTypeDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[CreditCategoryDescriptor] WITH CHECK ADD CONSTRAINT [FK_CreditCategoryDescriptor_Descriptor] FOREIGN KEY ([CreditCategoryDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[CreditTypeDescriptor] WITH CHECK ADD CONSTRAINT [FK_CreditTypeDescriptor_Descriptor] FOREIGN KEY ([CreditTypeDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[CTEProgramServiceDescriptor] WITH CHECK ADD CONSTRAINT [FK_CTEProgramServiceDescriptor_Descriptor] FOREIGN KEY ([CTEProgramServiceDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[CurriculumUsedDescriptor] WITH CHECK ADD CONSTRAINT [FK_CurriculumUsedDescriptor_Descriptor] FOREIGN KEY ([CurriculumUsedDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[DeliveryMethodDescriptor] WITH CHECK ADD CONSTRAINT [FK_DeliveryMethodDescriptor_Descriptor] FOREIGN KEY ([DeliveryMethodDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[DiagnosisDescriptor] WITH CHECK ADD CONSTRAINT [FK_DiagnosisDescriptor_Descriptor] FOREIGN KEY ([DiagnosisDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[DiplomaLevelDescriptor] WITH CHECK ADD CONSTRAINT [FK_DiplomaLevelDescriptor_Descriptor] FOREIGN KEY ([DiplomaLevelDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[DiplomaTypeDescriptor] WITH CHECK ADD CONSTRAINT [FK_DiplomaTypeDescriptor_Descriptor] FOREIGN KEY ([DiplomaTypeDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[DisabilityDescriptor] WITH CHECK ADD CONSTRAINT [FK_DisabilityDescriptor_Descriptor] FOREIGN KEY ([DisabilityDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[DisabilityDesignationDescriptor] WITH CHECK ADD CONSTRAINT [FK_DisabilityDesignationDescriptor_Descriptor] FOREIGN KEY ([DisabilityDesignationDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[DisabilityDeterminationSourceTypeDescriptor] WITH CHECK ADD CONSTRAINT [FK_DisabilityDeterminationSourceTypeDescriptor_Descriptor] FOREIGN KEY ([DisabilityDeterminationSourceTypeDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[DisciplineAction] WITH CHECK ADD CONSTRAINT [FK_DisciplineAction_DisciplineActionLengthDifferenceReasonDescriptor] FOREIGN KEY ([DisciplineActionLengthDifferenceReasonDescriptorId])
REFERENCES [edfi].[DisciplineActionLengthDifferenceReasonDescriptor] ([DisciplineActionLengthDifferenceReasonDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_DisciplineAction_DisciplineActionLengthDifferenceReasonDescriptor]
ON [edfi].[DisciplineAction] ([DisciplineActionLengthDifferenceReasonDescriptorId] ASC)
GO
ALTER TABLE [edfi].[DisciplineAction] WITH CHECK ADD CONSTRAINT [FK_DisciplineAction_School] FOREIGN KEY ([ResponsibilitySchoolId])
REFERENCES [edfi].[School] ([SchoolId])
GO
CREATE NONCLUSTERED INDEX [FK_DisciplineAction_School]
ON [edfi].[DisciplineAction] ([ResponsibilitySchoolId] ASC)
GO
ALTER TABLE [edfi].[DisciplineAction] WITH CHECK ADD CONSTRAINT [FK_DisciplineAction_School1] FOREIGN KEY ([AssignmentSchoolId])
REFERENCES [edfi].[School] ([SchoolId])
GO
CREATE NONCLUSTERED INDEX [FK_DisciplineAction_School1]
ON [edfi].[DisciplineAction] ([AssignmentSchoolId] ASC)
GO
ALTER TABLE [edfi].[DisciplineAction] WITH CHECK ADD CONSTRAINT [FK_DisciplineAction_Student] FOREIGN KEY ([StudentUSI])
REFERENCES [edfi].[Student] ([StudentUSI])
GO
CREATE NONCLUSTERED INDEX [FK_DisciplineAction_Student]
ON [edfi].[DisciplineAction] ([StudentUSI] ASC)
GO
ALTER TABLE [edfi].[DisciplineActionDiscipline] WITH CHECK ADD CONSTRAINT [FK_DisciplineActionDiscipline_DisciplineAction] FOREIGN KEY ([DisciplineActionIdentifier], [DisciplineDate], [StudentUSI])
REFERENCES [edfi].[DisciplineAction] ([DisciplineActionIdentifier], [DisciplineDate], [StudentUSI])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_DisciplineActionDiscipline_DisciplineAction]
ON [edfi].[DisciplineActionDiscipline] ([DisciplineActionIdentifier] ASC, [DisciplineDate] ASC, [StudentUSI] ASC)
GO
ALTER TABLE [edfi].[DisciplineActionDiscipline] WITH CHECK ADD CONSTRAINT [FK_DisciplineActionDiscipline_DisciplineDescriptor] FOREIGN KEY ([DisciplineDescriptorId])
REFERENCES [edfi].[DisciplineDescriptor] ([DisciplineDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_DisciplineActionDiscipline_DisciplineDescriptor]
ON [edfi].[DisciplineActionDiscipline] ([DisciplineDescriptorId] ASC)
GO
ALTER TABLE [edfi].[DisciplineActionLengthDifferenceReasonDescriptor] WITH CHECK ADD CONSTRAINT [FK_DisciplineActionLengthDifferenceReasonDescriptor_Descriptor] FOREIGN KEY ([DisciplineActionLengthDifferenceReasonDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[DisciplineActionStaff] WITH CHECK ADD CONSTRAINT [FK_DisciplineActionStaff_DisciplineAction] FOREIGN KEY ([DisciplineActionIdentifier], [DisciplineDate], [StudentUSI])
REFERENCES [edfi].[DisciplineAction] ([DisciplineActionIdentifier], [DisciplineDate], [StudentUSI])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_DisciplineActionStaff_DisciplineAction]
ON [edfi].[DisciplineActionStaff] ([DisciplineActionIdentifier] ASC, [DisciplineDate] ASC, [StudentUSI] ASC)
GO
ALTER TABLE [edfi].[DisciplineActionStaff] WITH CHECK ADD CONSTRAINT [FK_DisciplineActionStaff_Staff] FOREIGN KEY ([StaffUSI])
REFERENCES [edfi].[Staff] ([StaffUSI])
GO
CREATE NONCLUSTERED INDEX [FK_DisciplineActionStaff_Staff]
ON [edfi].[DisciplineActionStaff] ([StaffUSI] ASC)
GO
ALTER TABLE [edfi].[DisciplineActionStudentDisciplineIncidentAssociation] WITH CHECK ADD CONSTRAINT [FK_DisciplineActionStudentDisciplineIncidentAssociation_DisciplineAction] FOREIGN KEY ([DisciplineActionIdentifier], [DisciplineDate], [StudentUSI])
REFERENCES [edfi].[DisciplineAction] ([DisciplineActionIdentifier], [DisciplineDate], [StudentUSI])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_DisciplineActionStudentDisciplineIncidentAssociation_DisciplineAction]
ON [edfi].[DisciplineActionStudentDisciplineIncidentAssociation] ([DisciplineActionIdentifier] ASC, [DisciplineDate] ASC, [StudentUSI] ASC)
GO
ALTER TABLE [edfi].[DisciplineActionStudentDisciplineIncidentAssociation] WITH CHECK ADD CONSTRAINT [FK_DisciplineActionStudentDisciplineIncidentAssociation_StudentDisciplineIncidentAssociation] FOREIGN KEY ([IncidentIdentifier], [SchoolId], [StudentUSI])
REFERENCES [edfi].[StudentDisciplineIncidentAssociation] ([IncidentIdentifier], [SchoolId], [StudentUSI])
GO
CREATE NONCLUSTERED INDEX [FK_DisciplineActionStudentDisciplineIncidentAssociation_StudentDisciplineIncidentAssociation]
ON [edfi].[DisciplineActionStudentDisciplineIncidentAssociation] ([IncidentIdentifier] ASC, [SchoolId] ASC, [StudentUSI] ASC)
GO
ALTER TABLE [edfi].[DisciplineActionStudentDisciplineIncidentBehaviorAssociation] WITH CHECK ADD CONSTRAINT [FK_DisciplineActionStudentDisciplineIncidentBehaviorAssociation_DisciplineAction] FOREIGN KEY ([DisciplineActionIdentifier], [DisciplineDate], [StudentUSI])
REFERENCES [edfi].[DisciplineAction] ([DisciplineActionIdentifier], [DisciplineDate], [StudentUSI])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_DisciplineActionStudentDisciplineIncidentBehaviorAssociation_DisciplineAction]
ON [edfi].[DisciplineActionStudentDisciplineIncidentBehaviorAssociation] ([DisciplineActionIdentifier] ASC, [DisciplineDate] ASC, [StudentUSI] ASC)
GO
ALTER TABLE [edfi].[DisciplineActionStudentDisciplineIncidentBehaviorAssociation] WITH CHECK ADD CONSTRAINT [FK_DisciplineActionStudentDisciplineIncidentBehaviorAssociation_StudentDisciplineIncidentBehaviorAssociation] FOREIGN KEY ([BehaviorDescriptorId], [IncidentIdentifier], [SchoolId], [StudentUSI])
REFERENCES [edfi].[StudentDisciplineIncidentBehaviorAssociation] ([BehaviorDescriptorId], [IncidentIdentifier], [SchoolId], [StudentUSI])
GO
CREATE NONCLUSTERED INDEX [FK_DisciplineActionStudentDisciplineIncidentBehaviorAssociation_StudentDisciplineIncidentBehaviorAssociation]
ON [edfi].[DisciplineActionStudentDisciplineIncidentBehaviorAssociation] ([BehaviorDescriptorId] ASC, [IncidentIdentifier] ASC, [SchoolId] ASC, [StudentUSI] ASC)
GO
ALTER TABLE [edfi].[DisciplineDescriptor] WITH CHECK ADD CONSTRAINT [FK_DisciplineDescriptor_Descriptor] FOREIGN KEY ([DisciplineDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[DisciplineIncident] WITH CHECK ADD CONSTRAINT [FK_DisciplineIncident_IncidentLocationDescriptor] FOREIGN KEY ([IncidentLocationDescriptorId])
REFERENCES [edfi].[IncidentLocationDescriptor] ([IncidentLocationDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_DisciplineIncident_IncidentLocationDescriptor]
ON [edfi].[DisciplineIncident] ([IncidentLocationDescriptorId] ASC)
GO
ALTER TABLE [edfi].[DisciplineIncident] WITH CHECK ADD CONSTRAINT [FK_DisciplineIncident_ReporterDescriptionDescriptor] FOREIGN KEY ([ReporterDescriptionDescriptorId])
REFERENCES [edfi].[ReporterDescriptionDescriptor] ([ReporterDescriptionDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_DisciplineIncident_ReporterDescriptionDescriptor]
ON [edfi].[DisciplineIncident] ([ReporterDescriptionDescriptorId] ASC)
GO
ALTER TABLE [edfi].[DisciplineIncident] WITH CHECK ADD CONSTRAINT [FK_DisciplineIncident_School] FOREIGN KEY ([SchoolId])
REFERENCES [edfi].[School] ([SchoolId])
GO
CREATE NONCLUSTERED INDEX [FK_DisciplineIncident_School]
ON [edfi].[DisciplineIncident] ([SchoolId] ASC)
GO
ALTER TABLE [edfi].[DisciplineIncident] WITH CHECK ADD CONSTRAINT [FK_DisciplineIncident_Staff] FOREIGN KEY ([StaffUSI])
REFERENCES [edfi].[Staff] ([StaffUSI])
GO
CREATE NONCLUSTERED INDEX [FK_DisciplineIncident_Staff]
ON [edfi].[DisciplineIncident] ([StaffUSI] ASC)
GO
ALTER TABLE [edfi].[DisciplineIncidentBehavior] WITH CHECK ADD CONSTRAINT [FK_DisciplineIncidentBehavior_BehaviorDescriptor] FOREIGN KEY ([BehaviorDescriptorId])
REFERENCES [edfi].[BehaviorDescriptor] ([BehaviorDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_DisciplineIncidentBehavior_BehaviorDescriptor]
ON [edfi].[DisciplineIncidentBehavior] ([BehaviorDescriptorId] ASC)
GO
ALTER TABLE [edfi].[DisciplineIncidentBehavior] WITH CHECK ADD CONSTRAINT [FK_DisciplineIncidentBehavior_DisciplineIncident] FOREIGN KEY ([IncidentIdentifier], [SchoolId])
REFERENCES [edfi].[DisciplineIncident] ([IncidentIdentifier], [SchoolId])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_DisciplineIncidentBehavior_DisciplineIncident]
ON [edfi].[DisciplineIncidentBehavior] ([IncidentIdentifier] ASC, [SchoolId] ASC)
GO
ALTER TABLE [edfi].[DisciplineIncidentExternalParticipant] WITH CHECK ADD CONSTRAINT [FK_DisciplineIncidentExternalParticipant_DisciplineIncident] FOREIGN KEY ([IncidentIdentifier], [SchoolId])
REFERENCES [edfi].[DisciplineIncident] ([IncidentIdentifier], [SchoolId])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_DisciplineIncidentExternalParticipant_DisciplineIncident]
ON [edfi].[DisciplineIncidentExternalParticipant] ([IncidentIdentifier] ASC, [SchoolId] ASC)
GO
ALTER TABLE [edfi].[DisciplineIncidentExternalParticipant] WITH CHECK ADD CONSTRAINT [FK_DisciplineIncidentExternalParticipant_DisciplineIncidentParticipationCodeDescriptor] FOREIGN KEY ([DisciplineIncidentParticipationCodeDescriptorId])
REFERENCES [edfi].[DisciplineIncidentParticipationCodeDescriptor] ([DisciplineIncidentParticipationCodeDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_DisciplineIncidentExternalParticipant_DisciplineIncidentParticipationCodeDescriptor]
ON [edfi].[DisciplineIncidentExternalParticipant] ([DisciplineIncidentParticipationCodeDescriptorId] ASC)
GO
ALTER TABLE [edfi].[DisciplineIncidentParticipationCodeDescriptor] WITH CHECK ADD CONSTRAINT [FK_DisciplineIncidentParticipationCodeDescriptor_Descriptor] FOREIGN KEY ([DisciplineIncidentParticipationCodeDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[DisciplineIncidentWeapon] WITH CHECK ADD CONSTRAINT [FK_DisciplineIncidentWeapon_DisciplineIncident] FOREIGN KEY ([IncidentIdentifier], [SchoolId])
REFERENCES [edfi].[DisciplineIncident] ([IncidentIdentifier], [SchoolId])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_DisciplineIncidentWeapon_DisciplineIncident]
ON [edfi].[DisciplineIncidentWeapon] ([IncidentIdentifier] ASC, [SchoolId] ASC)
GO
ALTER TABLE [edfi].[DisciplineIncidentWeapon] WITH CHECK ADD CONSTRAINT [FK_DisciplineIncidentWeapon_WeaponDescriptor] FOREIGN KEY ([WeaponDescriptorId])
REFERENCES [edfi].[WeaponDescriptor] ([WeaponDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_DisciplineIncidentWeapon_WeaponDescriptor]
ON [edfi].[DisciplineIncidentWeapon] ([WeaponDescriptorId] ASC)
GO
ALTER TABLE [edfi].[EducationalEnvironmentDescriptor] WITH CHECK ADD CONSTRAINT [FK_EducationalEnvironmentDescriptor_Descriptor] FOREIGN KEY ([EducationalEnvironmentDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[EducationContent] WITH CHECK ADD CONSTRAINT [FK_EducationContent_ContentClassDescriptor] FOREIGN KEY ([ContentClassDescriptorId])
REFERENCES [edfi].[ContentClassDescriptor] ([ContentClassDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_EducationContent_ContentClassDescriptor]
ON [edfi].[EducationContent] ([ContentClassDescriptorId] ASC)
GO
ALTER TABLE [edfi].[EducationContent] WITH CHECK ADD CONSTRAINT [FK_EducationContent_CostRateDescriptor] FOREIGN KEY ([CostRateDescriptorId])
REFERENCES [edfi].[CostRateDescriptor] ([CostRateDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_EducationContent_CostRateDescriptor]
ON [edfi].[EducationContent] ([CostRateDescriptorId] ASC)
GO
ALTER TABLE [edfi].[EducationContent] WITH CHECK ADD CONSTRAINT [FK_EducationContent_InteractivityStyleDescriptor] FOREIGN KEY ([InteractivityStyleDescriptorId])
REFERENCES [edfi].[InteractivityStyleDescriptor] ([InteractivityStyleDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_EducationContent_InteractivityStyleDescriptor]
ON [edfi].[EducationContent] ([InteractivityStyleDescriptorId] ASC)
GO
ALTER TABLE [edfi].[EducationContent] WITH CHECK ADD CONSTRAINT [FK_EducationContent_LearningStandard] FOREIGN KEY ([LearningStandardId])
REFERENCES [edfi].[LearningStandard] ([LearningStandardId])
GO
CREATE NONCLUSTERED INDEX [FK_EducationContent_LearningStandard]
ON [edfi].[EducationContent] ([LearningStandardId] ASC)
GO
ALTER TABLE [edfi].[EducationContentAppropriateGradeLevel] WITH CHECK ADD CONSTRAINT [FK_EducationContentAppropriateGradeLevel_EducationContent] FOREIGN KEY ([ContentIdentifier])
REFERENCES [edfi].[EducationContent] ([ContentIdentifier])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_EducationContentAppropriateGradeLevel_EducationContent]
ON [edfi].[EducationContentAppropriateGradeLevel] ([ContentIdentifier] ASC)
GO
ALTER TABLE [edfi].[EducationContentAppropriateGradeLevel] WITH CHECK ADD CONSTRAINT [FK_EducationContentAppropriateGradeLevel_GradeLevelDescriptor] FOREIGN KEY ([GradeLevelDescriptorId])
REFERENCES [edfi].[GradeLevelDescriptor] ([GradeLevelDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_EducationContentAppropriateGradeLevel_GradeLevelDescriptor]
ON [edfi].[EducationContentAppropriateGradeLevel] ([GradeLevelDescriptorId] ASC)
GO
ALTER TABLE [edfi].[EducationContentAppropriateSex] WITH CHECK ADD CONSTRAINT [FK_EducationContentAppropriateSex_EducationContent] FOREIGN KEY ([ContentIdentifier])
REFERENCES [edfi].[EducationContent] ([ContentIdentifier])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_EducationContentAppropriateSex_EducationContent]
ON [edfi].[EducationContentAppropriateSex] ([ContentIdentifier] ASC)
GO
ALTER TABLE [edfi].[EducationContentAppropriateSex] WITH CHECK ADD CONSTRAINT [FK_EducationContentAppropriateSex_SexDescriptor] FOREIGN KEY ([SexDescriptorId])
REFERENCES [edfi].[SexDescriptor] ([SexDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_EducationContentAppropriateSex_SexDescriptor]
ON [edfi].[EducationContentAppropriateSex] ([SexDescriptorId] ASC)
GO
ALTER TABLE [edfi].[EducationContentAuthor] WITH CHECK ADD CONSTRAINT [FK_EducationContentAuthor_EducationContent] FOREIGN KEY ([ContentIdentifier])
REFERENCES [edfi].[EducationContent] ([ContentIdentifier])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_EducationContentAuthor_EducationContent]
ON [edfi].[EducationContentAuthor] ([ContentIdentifier] ASC)
GO
ALTER TABLE [edfi].[EducationContentDerivativeSourceEducationContent] WITH CHECK ADD CONSTRAINT [FK_EducationContentDerivativeSourceEducationContent_EducationContent] FOREIGN KEY ([ContentIdentifier])
REFERENCES [edfi].[EducationContent] ([ContentIdentifier])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_EducationContentDerivativeSourceEducationContent_EducationContent]
ON [edfi].[EducationContentDerivativeSourceEducationContent] ([ContentIdentifier] ASC)
GO
ALTER TABLE [edfi].[EducationContentDerivativeSourceEducationContent] WITH CHECK ADD CONSTRAINT [FK_EducationContentDerivativeSourceEducationContent_EducationContent1] FOREIGN KEY ([DerivativeSourceContentIdentifier])
REFERENCES [edfi].[EducationContent] ([ContentIdentifier])
GO
CREATE NONCLUSTERED INDEX [FK_EducationContentDerivativeSourceEducationContent_EducationContent1]
ON [edfi].[EducationContentDerivativeSourceEducationContent] ([DerivativeSourceContentIdentifier] ASC)
GO
ALTER TABLE [edfi].[EducationContentDerivativeSourceLearningResourceMetadataURI] WITH CHECK ADD CONSTRAINT [FK_EducationContentDerivativeSourceLearningResourceMetadataURI_EducationContent] FOREIGN KEY ([ContentIdentifier])
REFERENCES [edfi].[EducationContent] ([ContentIdentifier])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_EducationContentDerivativeSourceLearningResourceMetadataURI_EducationContent]
ON [edfi].[EducationContentDerivativeSourceLearningResourceMetadataURI] ([ContentIdentifier] ASC)
GO
ALTER TABLE [edfi].[EducationContentDerivativeSourceURI] WITH CHECK ADD CONSTRAINT [FK_EducationContentDerivativeSourceURI_EducationContent] FOREIGN KEY ([ContentIdentifier])
REFERENCES [edfi].[EducationContent] ([ContentIdentifier])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_EducationContentDerivativeSourceURI_EducationContent]
ON [edfi].[EducationContentDerivativeSourceURI] ([ContentIdentifier] ASC)
GO
ALTER TABLE [edfi].[EducationContentLanguage] WITH CHECK ADD CONSTRAINT [FK_EducationContentLanguage_EducationContent] FOREIGN KEY ([ContentIdentifier])
REFERENCES [edfi].[EducationContent] ([ContentIdentifier])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_EducationContentLanguage_EducationContent]
ON [edfi].[EducationContentLanguage] ([ContentIdentifier] ASC)
GO
ALTER TABLE [edfi].[EducationContentLanguage] WITH CHECK ADD CONSTRAINT [FK_EducationContentLanguage_LanguageDescriptor] FOREIGN KEY ([LanguageDescriptorId])
REFERENCES [edfi].[LanguageDescriptor] ([LanguageDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_EducationContentLanguage_LanguageDescriptor]
ON [edfi].[EducationContentLanguage] ([LanguageDescriptorId] ASC)
GO
ALTER TABLE [edfi].[EducationOrganization] WITH CHECK ADD CONSTRAINT [FK_EducationOrganization_OperationalStatusDescriptor] FOREIGN KEY ([OperationalStatusDescriptorId])
REFERENCES [edfi].[OperationalStatusDescriptor] ([OperationalStatusDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_EducationOrganization_OperationalStatusDescriptor]
ON [edfi].[EducationOrganization] ([OperationalStatusDescriptorId] ASC)
GO
ALTER TABLE [edfi].[EducationOrganizationAddress] WITH CHECK ADD CONSTRAINT [FK_EducationOrganizationAddress_AddressTypeDescriptor] FOREIGN KEY ([AddressTypeDescriptorId])
REFERENCES [edfi].[AddressTypeDescriptor] ([AddressTypeDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_EducationOrganizationAddress_AddressTypeDescriptor]
ON [edfi].[EducationOrganizationAddress] ([AddressTypeDescriptorId] ASC)
GO
ALTER TABLE [edfi].[EducationOrganizationAddress] WITH CHECK ADD CONSTRAINT [FK_EducationOrganizationAddress_EducationOrganization] FOREIGN KEY ([EducationOrganizationId])
REFERENCES [edfi].[EducationOrganization] ([EducationOrganizationId])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_EducationOrganizationAddress_EducationOrganization]
ON [edfi].[EducationOrganizationAddress] ([EducationOrganizationId] ASC)
GO
ALTER TABLE [edfi].[EducationOrganizationAddress] WITH CHECK ADD CONSTRAINT [FK_EducationOrganizationAddress_LocaleDescriptor] FOREIGN KEY ([LocaleDescriptorId])
REFERENCES [edfi].[LocaleDescriptor] ([LocaleDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_EducationOrganizationAddress_LocaleDescriptor]
ON [edfi].[EducationOrganizationAddress] ([LocaleDescriptorId] ASC)
GO
ALTER TABLE [edfi].[EducationOrganizationAddress] WITH CHECK ADD CONSTRAINT [FK_EducationOrganizationAddress_StateAbbreviationDescriptor] FOREIGN KEY ([StateAbbreviationDescriptorId])
REFERENCES [edfi].[StateAbbreviationDescriptor] ([StateAbbreviationDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_EducationOrganizationAddress_StateAbbreviationDescriptor]
ON [edfi].[EducationOrganizationAddress] ([StateAbbreviationDescriptorId] ASC)
GO
ALTER TABLE [edfi].[EducationOrganizationAddressPeriod] WITH CHECK ADD CONSTRAINT [FK_EducationOrganizationAddressPeriod_EducationOrganizationAddress] FOREIGN KEY ([AddressTypeDescriptorId], [City], [EducationOrganizationId], [PostalCode], [StateAbbreviationDescriptorId], [StreetNumberName])
REFERENCES [edfi].[EducationOrganizationAddress] ([AddressTypeDescriptorId], [City], [EducationOrganizationId], [PostalCode], [StateAbbreviationDescriptorId], [StreetNumberName])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_EducationOrganizationAddressPeriod_EducationOrganizationAddress]
ON [edfi].[EducationOrganizationAddressPeriod] ([AddressTypeDescriptorId] ASC, [City] ASC, [EducationOrganizationId] ASC, [PostalCode] ASC, [StateAbbreviationDescriptorId] ASC, [StreetNumberName] ASC)
GO
ALTER TABLE [edfi].[EducationOrganizationCategory] WITH CHECK ADD CONSTRAINT [FK_EducationOrganizationCategory_EducationOrganization] FOREIGN KEY ([EducationOrganizationId])
REFERENCES [edfi].[EducationOrganization] ([EducationOrganizationId])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_EducationOrganizationCategory_EducationOrganization]
ON [edfi].[EducationOrganizationCategory] ([EducationOrganizationId] ASC)
GO
ALTER TABLE [edfi].[EducationOrganizationCategory] WITH CHECK ADD CONSTRAINT [FK_EducationOrganizationCategory_EducationOrganizationCategoryDescriptor] FOREIGN KEY ([EducationOrganizationCategoryDescriptorId])
REFERENCES [edfi].[EducationOrganizationCategoryDescriptor] ([EducationOrganizationCategoryDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_EducationOrganizationCategory_EducationOrganizationCategoryDescriptor]
ON [edfi].[EducationOrganizationCategory] ([EducationOrganizationCategoryDescriptorId] ASC)
GO
ALTER TABLE [edfi].[EducationOrganizationCategoryDescriptor] WITH CHECK ADD CONSTRAINT [FK_EducationOrganizationCategoryDescriptor_Descriptor] FOREIGN KEY ([EducationOrganizationCategoryDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[EducationOrganizationIdentificationCode] WITH CHECK ADD CONSTRAINT [FK_EducationOrganizationIdentificationCode_EducationOrganization] FOREIGN KEY ([EducationOrganizationId])
REFERENCES [edfi].[EducationOrganization] ([EducationOrganizationId])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_EducationOrganizationIdentificationCode_EducationOrganization]
ON [edfi].[EducationOrganizationIdentificationCode] ([EducationOrganizationId] ASC)
GO
ALTER TABLE [edfi].[EducationOrganizationIdentificationCode] WITH CHECK ADD CONSTRAINT [FK_EducationOrganizationIdentificationCode_EducationOrganizationIdentificationSystemDescriptor] FOREIGN KEY ([EducationOrganizationIdentificationSystemDescriptorId])
REFERENCES [edfi].[EducationOrganizationIdentificationSystemDescriptor] ([EducationOrganizationIdentificationSystemDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_EducationOrganizationIdentificationCode_EducationOrganizationIdentificationSystemDescriptor]
ON [edfi].[EducationOrganizationIdentificationCode] ([EducationOrganizationIdentificationSystemDescriptorId] ASC)
GO
ALTER TABLE [edfi].[EducationOrganizationIdentificationSystemDescriptor] WITH CHECK ADD CONSTRAINT [FK_EducationOrganizationIdentificationSystemDescriptor_Descriptor] FOREIGN KEY ([EducationOrganizationIdentificationSystemDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[EducationOrganizationIndicator] WITH CHECK ADD CONSTRAINT [FK_EducationOrganizationIndicator_EducationOrganization] FOREIGN KEY ([EducationOrganizationId])
REFERENCES [edfi].[EducationOrganization] ([EducationOrganizationId])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_EducationOrganizationIndicator_EducationOrganization]
ON [edfi].[EducationOrganizationIndicator] ([EducationOrganizationId] ASC)
GO
ALTER TABLE [edfi].[EducationOrganizationIndicator] WITH CHECK ADD CONSTRAINT [FK_EducationOrganizationIndicator_IndicatorDescriptor] FOREIGN KEY ([IndicatorDescriptorId])
REFERENCES [edfi].[IndicatorDescriptor] ([IndicatorDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_EducationOrganizationIndicator_IndicatorDescriptor]
ON [edfi].[EducationOrganizationIndicator] ([IndicatorDescriptorId] ASC)
GO
ALTER TABLE [edfi].[EducationOrganizationIndicator] WITH CHECK ADD CONSTRAINT [FK_EducationOrganizationIndicator_IndicatorGroupDescriptor] FOREIGN KEY ([IndicatorGroupDescriptorId])
REFERENCES [edfi].[IndicatorGroupDescriptor] ([IndicatorGroupDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_EducationOrganizationIndicator_IndicatorGroupDescriptor]
ON [edfi].[EducationOrganizationIndicator] ([IndicatorGroupDescriptorId] ASC)
GO
ALTER TABLE [edfi].[EducationOrganizationIndicator] WITH CHECK ADD CONSTRAINT [FK_EducationOrganizationIndicator_IndicatorLevelDescriptor] FOREIGN KEY ([IndicatorLevelDescriptorId])
REFERENCES [edfi].[IndicatorLevelDescriptor] ([IndicatorLevelDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_EducationOrganizationIndicator_IndicatorLevelDescriptor]
ON [edfi].[EducationOrganizationIndicator] ([IndicatorLevelDescriptorId] ASC)
GO
ALTER TABLE [edfi].[EducationOrganizationIndicatorPeriod] WITH CHECK ADD CONSTRAINT [FK_EducationOrganizationIndicatorPeriod_EducationOrganizationIndicator] FOREIGN KEY ([EducationOrganizationId], [IndicatorDescriptorId])
REFERENCES [edfi].[EducationOrganizationIndicator] ([EducationOrganizationId], [IndicatorDescriptorId])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_EducationOrganizationIndicatorPeriod_EducationOrganizationIndicator]
ON [edfi].[EducationOrganizationIndicatorPeriod] ([EducationOrganizationId] ASC, [IndicatorDescriptorId] ASC)
GO
ALTER TABLE [edfi].[EducationOrganizationInstitutionTelephone] WITH CHECK ADD CONSTRAINT [FK_EducationOrganizationInstitutionTelephone_EducationOrganization] FOREIGN KEY ([EducationOrganizationId])
REFERENCES [edfi].[EducationOrganization] ([EducationOrganizationId])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_EducationOrganizationInstitutionTelephone_EducationOrganization]
ON [edfi].[EducationOrganizationInstitutionTelephone] ([EducationOrganizationId] ASC)
GO
ALTER TABLE [edfi].[EducationOrganizationInstitutionTelephone] WITH CHECK ADD CONSTRAINT [FK_EducationOrganizationInstitutionTelephone_InstitutionTelephoneNumberTypeDescriptor] FOREIGN KEY ([InstitutionTelephoneNumberTypeDescriptorId])
REFERENCES [edfi].[InstitutionTelephoneNumberTypeDescriptor] ([InstitutionTelephoneNumberTypeDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_EducationOrganizationInstitutionTelephone_InstitutionTelephoneNumberTypeDescriptor]
ON [edfi].[EducationOrganizationInstitutionTelephone] ([InstitutionTelephoneNumberTypeDescriptorId] ASC)
GO
ALTER TABLE [edfi].[EducationOrganizationInternationalAddress] WITH CHECK ADD CONSTRAINT [FK_EducationOrganizationInternationalAddress_AddressTypeDescriptor] FOREIGN KEY ([AddressTypeDescriptorId])
REFERENCES [edfi].[AddressTypeDescriptor] ([AddressTypeDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_EducationOrganizationInternationalAddress_AddressTypeDescriptor]
ON [edfi].[EducationOrganizationInternationalAddress] ([AddressTypeDescriptorId] ASC)
GO
ALTER TABLE [edfi].[EducationOrganizationInternationalAddress] WITH CHECK ADD CONSTRAINT [FK_EducationOrganizationInternationalAddress_CountryDescriptor] FOREIGN KEY ([CountryDescriptorId])
REFERENCES [edfi].[CountryDescriptor] ([CountryDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_EducationOrganizationInternationalAddress_CountryDescriptor]
ON [edfi].[EducationOrganizationInternationalAddress] ([CountryDescriptorId] ASC)
GO
ALTER TABLE [edfi].[EducationOrganizationInternationalAddress] WITH CHECK ADD CONSTRAINT [FK_EducationOrganizationInternationalAddress_EducationOrganization] FOREIGN KEY ([EducationOrganizationId])
REFERENCES [edfi].[EducationOrganization] ([EducationOrganizationId])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_EducationOrganizationInternationalAddress_EducationOrganization]
ON [edfi].[EducationOrganizationInternationalAddress] ([EducationOrganizationId] ASC)
GO
ALTER TABLE [edfi].[EducationOrganizationInterventionPrescriptionAssociation] WITH CHECK ADD CONSTRAINT [FK_EducationOrganizationInterventionPrescriptionAssociation_EducationOrganization] FOREIGN KEY ([EducationOrganizationId])
REFERENCES [edfi].[EducationOrganization] ([EducationOrganizationId])
GO
CREATE NONCLUSTERED INDEX [FK_EducationOrganizationInterventionPrescriptionAssociation_EducationOrganization]
ON [edfi].[EducationOrganizationInterventionPrescriptionAssociation] ([EducationOrganizationId] ASC)
GO
ALTER TABLE [edfi].[EducationOrganizationInterventionPrescriptionAssociation] WITH CHECK ADD CONSTRAINT [FK_EducationOrganizationInterventionPrescriptionAssociation_InterventionPrescription] FOREIGN KEY ([InterventionPrescriptionEducationOrganizationId], [InterventionPrescriptionIdentificationCode])
REFERENCES [edfi].[InterventionPrescription] ([EducationOrganizationId], [InterventionPrescriptionIdentificationCode])
GO
CREATE NONCLUSTERED INDEX [FK_EducationOrganizationInterventionPrescriptionAssociation_InterventionPrescription]
ON [edfi].[EducationOrganizationInterventionPrescriptionAssociation] ([InterventionPrescriptionEducationOrganizationId] ASC, [InterventionPrescriptionIdentificationCode] ASC)
GO
ALTER TABLE [edfi].[EducationOrganizationNetwork] WITH CHECK ADD CONSTRAINT [FK_EducationOrganizationNetwork_EducationOrganization] FOREIGN KEY ([EducationOrganizationNetworkId])
REFERENCES [edfi].[EducationOrganization] ([EducationOrganizationId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[EducationOrganizationNetwork] WITH CHECK ADD CONSTRAINT [FK_EducationOrganizationNetwork_NetworkPurposeDescriptor] FOREIGN KEY ([NetworkPurposeDescriptorId])
REFERENCES [edfi].[NetworkPurposeDescriptor] ([NetworkPurposeDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_EducationOrganizationNetwork_NetworkPurposeDescriptor]
ON [edfi].[EducationOrganizationNetwork] ([NetworkPurposeDescriptorId] ASC)
GO
ALTER TABLE [edfi].[EducationOrganizationNetworkAssociation] WITH CHECK ADD CONSTRAINT [FK_EducationOrganizationNetworkAssociation_EducationOrganization] FOREIGN KEY ([MemberEducationOrganizationId])
REFERENCES [edfi].[EducationOrganization] ([EducationOrganizationId])
GO
CREATE NONCLUSTERED INDEX [FK_EducationOrganizationNetworkAssociation_EducationOrganization]
ON [edfi].[EducationOrganizationNetworkAssociation] ([MemberEducationOrganizationId] ASC)
GO
ALTER TABLE [edfi].[EducationOrganizationNetworkAssociation] WITH CHECK ADD CONSTRAINT [FK_EducationOrganizationNetworkAssociation_EducationOrganizationNetwork] FOREIGN KEY ([EducationOrganizationNetworkId])
REFERENCES [edfi].[EducationOrganizationNetwork] ([EducationOrganizationNetworkId])
GO
CREATE NONCLUSTERED INDEX [FK_EducationOrganizationNetworkAssociation_EducationOrganizationNetwork]
ON [edfi].[EducationOrganizationNetworkAssociation] ([EducationOrganizationNetworkId] ASC)
GO
ALTER TABLE [edfi].[EducationOrganizationPeerAssociation] WITH CHECK ADD CONSTRAINT [FK_EducationOrganizationPeerAssociation_EducationOrganization] FOREIGN KEY ([EducationOrganizationId])
REFERENCES [edfi].[EducationOrganization] ([EducationOrganizationId])
GO
CREATE NONCLUSTERED INDEX [FK_EducationOrganizationPeerAssociation_EducationOrganization]
ON [edfi].[EducationOrganizationPeerAssociation] ([EducationOrganizationId] ASC)
GO
ALTER TABLE [edfi].[EducationOrganizationPeerAssociation] WITH CHECK ADD CONSTRAINT [FK_EducationOrganizationPeerAssociation_EducationOrganization1] FOREIGN KEY ([PeerEducationOrganizationId])
REFERENCES [edfi].[EducationOrganization] ([EducationOrganizationId])
GO
CREATE NONCLUSTERED INDEX [FK_EducationOrganizationPeerAssociation_EducationOrganization1]
ON [edfi].[EducationOrganizationPeerAssociation] ([PeerEducationOrganizationId] ASC)
GO
ALTER TABLE [edfi].[EducationPlanDescriptor] WITH CHECK ADD CONSTRAINT [FK_EducationPlanDescriptor_Descriptor] FOREIGN KEY ([EducationPlanDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[EducationServiceCenter] WITH CHECK ADD CONSTRAINT [FK_EducationServiceCenter_EducationOrganization] FOREIGN KEY ([EducationServiceCenterId])
REFERENCES [edfi].[EducationOrganization] ([EducationOrganizationId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[EducationServiceCenter] WITH CHECK ADD CONSTRAINT [FK_EducationServiceCenter_StateEducationAgency] FOREIGN KEY ([StateEducationAgencyId])
REFERENCES [edfi].[StateEducationAgency] ([StateEducationAgencyId])
GO
CREATE NONCLUSTERED INDEX [FK_EducationServiceCenter_StateEducationAgency]
ON [edfi].[EducationServiceCenter] ([StateEducationAgencyId] ASC)
GO
ALTER TABLE [edfi].[ElectronicMailTypeDescriptor] WITH CHECK ADD CONSTRAINT [FK_ElectronicMailTypeDescriptor_Descriptor] FOREIGN KEY ([ElectronicMailTypeDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[EmploymentStatusDescriptor] WITH CHECK ADD CONSTRAINT [FK_EmploymentStatusDescriptor_Descriptor] FOREIGN KEY ([EmploymentStatusDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[EntryGradeLevelReasonDescriptor] WITH CHECK ADD CONSTRAINT [FK_EntryGradeLevelReasonDescriptor_Descriptor] FOREIGN KEY ([EntryGradeLevelReasonDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[EntryTypeDescriptor] WITH CHECK ADD CONSTRAINT [FK_EntryTypeDescriptor_Descriptor] FOREIGN KEY ([EntryTypeDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[EventCircumstanceDescriptor] WITH CHECK ADD CONSTRAINT [FK_EventCircumstanceDescriptor_Descriptor] FOREIGN KEY ([EventCircumstanceDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[ExitWithdrawTypeDescriptor] WITH CHECK ADD CONSTRAINT [FK_ExitWithdrawTypeDescriptor_Descriptor] FOREIGN KEY ([ExitWithdrawTypeDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[FeederSchoolAssociation] WITH CHECK ADD CONSTRAINT [FK_FeederSchoolAssociation_School] FOREIGN KEY ([FeederSchoolId])
REFERENCES [edfi].[School] ([SchoolId])
GO
CREATE NONCLUSTERED INDEX [FK_FeederSchoolAssociation_School]
ON [edfi].[FeederSchoolAssociation] ([FeederSchoolId] ASC)
GO
ALTER TABLE [edfi].[FeederSchoolAssociation] WITH CHECK ADD CONSTRAINT [FK_FeederSchoolAssociation_School1] FOREIGN KEY ([SchoolId])
REFERENCES [edfi].[School] ([SchoolId])
GO
CREATE NONCLUSTERED INDEX [FK_FeederSchoolAssociation_School1]
ON [edfi].[FeederSchoolAssociation] ([SchoolId] ASC)
GO
ALTER TABLE [edfi].[GeneralStudentProgramAssociation] WITH CHECK ADD CONSTRAINT [FK_GeneralStudentProgramAssociation_EducationOrganization] FOREIGN KEY ([EducationOrganizationId])
REFERENCES [edfi].[EducationOrganization] ([EducationOrganizationId])
GO
CREATE NONCLUSTERED INDEX [FK_GeneralStudentProgramAssociation_EducationOrganization]
ON [edfi].[GeneralStudentProgramAssociation] ([EducationOrganizationId] ASC)
GO
ALTER TABLE [edfi].[GeneralStudentProgramAssociation] WITH CHECK ADD CONSTRAINT [FK_GeneralStudentProgramAssociation_Program] FOREIGN KEY ([ProgramEducationOrganizationId], [ProgramName], [ProgramTypeDescriptorId])
REFERENCES [edfi].[Program] ([EducationOrganizationId], [ProgramName], [ProgramTypeDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_GeneralStudentProgramAssociation_Program]
ON [edfi].[GeneralStudentProgramAssociation] ([ProgramEducationOrganizationId] ASC, [ProgramName] ASC, [ProgramTypeDescriptorId] ASC)
GO
ALTER TABLE [edfi].[GeneralStudentProgramAssociation] WITH CHECK ADD CONSTRAINT [FK_GeneralStudentProgramAssociation_ReasonExitedDescriptor] FOREIGN KEY ([ReasonExitedDescriptorId])
REFERENCES [edfi].[ReasonExitedDescriptor] ([ReasonExitedDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_GeneralStudentProgramAssociation_ReasonExitedDescriptor]
ON [edfi].[GeneralStudentProgramAssociation] ([ReasonExitedDescriptorId] ASC)
GO
ALTER TABLE [edfi].[GeneralStudentProgramAssociation] WITH CHECK ADD CONSTRAINT [FK_GeneralStudentProgramAssociation_Student] FOREIGN KEY ([StudentUSI])
REFERENCES [edfi].[Student] ([StudentUSI])
GO
CREATE NONCLUSTERED INDEX [FK_GeneralStudentProgramAssociation_Student]
ON [edfi].[GeneralStudentProgramAssociation] ([StudentUSI] ASC)
GO
ALTER TABLE [edfi].[GeneralStudentProgramAssociationParticipationStatus] WITH CHECK ADD CONSTRAINT [FK_GeneralStudentProgramAssociationParticipationStatus_GeneralStudentProgramAssociation] FOREIGN KEY ([BeginDate], [EducationOrganizationId], [ProgramEducationOrganizationId], [ProgramName], [ProgramTypeDescriptorId], [StudentUSI])
REFERENCES [edfi].[GeneralStudentProgramAssociation] ([BeginDate], [EducationOrganizationId], [ProgramEducationOrganizationId], [ProgramName], [ProgramTypeDescriptorId], [StudentUSI])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[GeneralStudentProgramAssociationParticipationStatus] WITH CHECK ADD CONSTRAINT [FK_GeneralStudentProgramAssociationParticipationStatus_ParticipationStatusDescriptor] FOREIGN KEY ([ParticipationStatusDescriptorId])
REFERENCES [edfi].[ParticipationStatusDescriptor] ([ParticipationStatusDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_GeneralStudentProgramAssociationParticipationStatus_ParticipationStatusDescriptor]
ON [edfi].[GeneralStudentProgramAssociationParticipationStatus] ([ParticipationStatusDescriptorId] ASC)
GO
ALTER TABLE [edfi].[GeneralStudentProgramAssociationProgramParticipationStatus] WITH CHECK ADD CONSTRAINT [FK_GeneralStudentProgramAssociationProgramParticipationStatus_GeneralStudentProgramAssociation] FOREIGN KEY ([BeginDate], [EducationOrganizationId], [ProgramEducationOrganizationId], [ProgramName], [ProgramTypeDescriptorId], [StudentUSI])
REFERENCES [edfi].[GeneralStudentProgramAssociation] ([BeginDate], [EducationOrganizationId], [ProgramEducationOrganizationId], [ProgramName], [ProgramTypeDescriptorId], [StudentUSI])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_GeneralStudentProgramAssociationProgramParticipationStatus_GeneralStudentProgramAssociation]
ON [edfi].[GeneralStudentProgramAssociationProgramParticipationStatus] ([BeginDate] ASC, [EducationOrganizationId] ASC, [ProgramEducationOrganizationId] ASC, [ProgramName] ASC, [ProgramTypeDescriptorId] ASC, [StudentUSI] ASC)
GO
ALTER TABLE [edfi].[GeneralStudentProgramAssociationProgramParticipationStatus] WITH CHECK ADD CONSTRAINT [FK_GeneralStudentProgramAssociationProgramParticipationStatus_ParticipationStatusDescriptor] FOREIGN KEY ([ParticipationStatusDescriptorId])
REFERENCES [edfi].[ParticipationStatusDescriptor] ([ParticipationStatusDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_GeneralStudentProgramAssociationProgramParticipationStatus_ParticipationStatusDescriptor]
ON [edfi].[GeneralStudentProgramAssociationProgramParticipationStatus] ([ParticipationStatusDescriptorId] ASC)
GO
ALTER TABLE [edfi].[Grade] WITH CHECK ADD CONSTRAINT [FK_Grade_GradeTypeDescriptor] FOREIGN KEY ([GradeTypeDescriptorId])
REFERENCES [edfi].[GradeTypeDescriptor] ([GradeTypeDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_Grade_GradeTypeDescriptor]
ON [edfi].[Grade] ([GradeTypeDescriptorId] ASC)
GO
ALTER TABLE [edfi].[Grade] WITH CHECK ADD CONSTRAINT [FK_Grade_GradingPeriod] FOREIGN KEY ([GradingPeriodDescriptorId], [GradingPeriodSequence], [SchoolId], [GradingPeriodSchoolYear])
REFERENCES [edfi].[GradingPeriod] ([GradingPeriodDescriptorId], [PeriodSequence], [SchoolId], [SchoolYear])
GO
CREATE NONCLUSTERED INDEX [FK_Grade_GradingPeriod]
ON [edfi].[Grade] ([GradingPeriodDescriptorId] ASC, [GradingPeriodSequence] ASC, [SchoolId] ASC, [GradingPeriodSchoolYear] ASC)
GO
ALTER TABLE [edfi].[Grade] WITH CHECK ADD CONSTRAINT [FK_Grade_PerformanceBaseConversionDescriptor] FOREIGN KEY ([PerformanceBaseConversionDescriptorId])
REFERENCES [edfi].[PerformanceBaseConversionDescriptor] ([PerformanceBaseConversionDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_Grade_PerformanceBaseConversionDescriptor]
ON [edfi].[Grade] ([PerformanceBaseConversionDescriptorId] ASC)
GO
ALTER TABLE [edfi].[Grade] WITH CHECK ADD CONSTRAINT [FK_Grade_StudentSectionAssociation] FOREIGN KEY ([BeginDate], [LocalCourseCode], [SchoolId], [SchoolYear], [SectionIdentifier], [SessionName], [StudentUSI])
REFERENCES [edfi].[StudentSectionAssociation] ([BeginDate], [LocalCourseCode], [SchoolId], [SchoolYear], [SectionIdentifier], [SessionName], [StudentUSI])
ON UPDATE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_Grade_StudentSectionAssociation]
ON [edfi].[Grade] ([BeginDate] ASC, [LocalCourseCode] ASC, [SchoolId] ASC, [SchoolYear] ASC, [SectionIdentifier] ASC, [SessionName] ASC, [StudentUSI] ASC)
GO
ALTER TABLE [edfi].[GradebookEntry] WITH CHECK ADD CONSTRAINT [FK_GradebookEntry_GradebookEntryTypeDescriptor] FOREIGN KEY ([GradebookEntryTypeDescriptorId])
REFERENCES [edfi].[GradebookEntryTypeDescriptor] ([GradebookEntryTypeDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_GradebookEntry_GradebookEntryTypeDescriptor]
ON [edfi].[GradebookEntry] ([GradebookEntryTypeDescriptorId] ASC)
GO
ALTER TABLE [edfi].[GradebookEntry] WITH CHECK ADD CONSTRAINT [FK_GradebookEntry_GradingPeriod] FOREIGN KEY ([GradingPeriodDescriptorId], [PeriodSequence], [SchoolId], [SchoolYear])
REFERENCES [edfi].[GradingPeriod] ([GradingPeriodDescriptorId], [PeriodSequence], [SchoolId], [SchoolYear])
GO
CREATE NONCLUSTERED INDEX [FK_GradebookEntry_GradingPeriod]
ON [edfi].[GradebookEntry] ([GradingPeriodDescriptorId] ASC, [PeriodSequence] ASC, [SchoolId] ASC, [SchoolYear] ASC)
GO
ALTER TABLE [edfi].[GradebookEntry] WITH CHECK ADD CONSTRAINT [FK_GradebookEntry_Section] FOREIGN KEY ([LocalCourseCode], [SchoolId], [SchoolYear], [SectionIdentifier], [SessionName])
REFERENCES [edfi].[Section] ([LocalCourseCode], [SchoolId], [SchoolYear], [SectionIdentifier], [SessionName])
ON UPDATE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_GradebookEntry_Section]
ON [edfi].[GradebookEntry] ([LocalCourseCode] ASC, [SchoolId] ASC, [SchoolYear] ASC, [SectionIdentifier] ASC, [SessionName] ASC)
GO
ALTER TABLE [edfi].[GradebookEntryLearningObjective] WITH CHECK ADD CONSTRAINT [FK_GradebookEntryLearningObjective_GradebookEntry] FOREIGN KEY ([DateAssigned], [GradebookEntryTitle], [LocalCourseCode], [SchoolId], [SchoolYear], [SectionIdentifier], [SessionName])
REFERENCES [edfi].[GradebookEntry] ([DateAssigned], [GradebookEntryTitle], [LocalCourseCode], [SchoolId], [SchoolYear], [SectionIdentifier], [SessionName])
ON DELETE CASCADE
ON UPDATE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_GradebookEntryLearningObjective_GradebookEntry]
ON [edfi].[GradebookEntryLearningObjective] ([DateAssigned] ASC, [GradebookEntryTitle] ASC, [LocalCourseCode] ASC, [SchoolId] ASC, [SchoolYear] ASC, [SectionIdentifier] ASC, [SessionName] ASC)
GO
ALTER TABLE [edfi].[GradebookEntryLearningObjective] WITH CHECK ADD CONSTRAINT [FK_GradebookEntryLearningObjective_LearningObjective] FOREIGN KEY ([LearningObjectiveId], [Namespace])
REFERENCES [edfi].[LearningObjective] ([LearningObjectiveId], [Namespace])
GO
CREATE NONCLUSTERED INDEX [FK_GradebookEntryLearningObjective_LearningObjective]
ON [edfi].[GradebookEntryLearningObjective] ([LearningObjectiveId] ASC, [Namespace] ASC)
GO
ALTER TABLE [edfi].[GradebookEntryLearningStandard] WITH CHECK ADD CONSTRAINT [FK_GradebookEntryLearningStandard_GradebookEntry] FOREIGN KEY ([DateAssigned], [GradebookEntryTitle], [LocalCourseCode], [SchoolId], [SchoolYear], [SectionIdentifier], [SessionName])
REFERENCES [edfi].[GradebookEntry] ([DateAssigned], [GradebookEntryTitle], [LocalCourseCode], [SchoolId], [SchoolYear], [SectionIdentifier], [SessionName])
ON DELETE CASCADE
ON UPDATE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_GradebookEntryLearningStandard_GradebookEntry]
ON [edfi].[GradebookEntryLearningStandard] ([DateAssigned] ASC, [GradebookEntryTitle] ASC, [LocalCourseCode] ASC, [SchoolId] ASC, [SchoolYear] ASC, [SectionIdentifier] ASC, [SessionName] ASC)
GO
ALTER TABLE [edfi].[GradebookEntryLearningStandard] WITH CHECK ADD CONSTRAINT [FK_GradebookEntryLearningStandard_LearningStandard] FOREIGN KEY ([LearningStandardId])
REFERENCES [edfi].[LearningStandard] ([LearningStandardId])
GO
CREATE NONCLUSTERED INDEX [FK_GradebookEntryLearningStandard_LearningStandard]
ON [edfi].[GradebookEntryLearningStandard] ([LearningStandardId] ASC)
GO
ALTER TABLE [edfi].[GradebookEntryTypeDescriptor] WITH CHECK ADD CONSTRAINT [FK_GradebookEntryTypeDescriptor_Descriptor] FOREIGN KEY ([GradebookEntryTypeDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[GradeLearningStandardGrade] WITH CHECK ADD CONSTRAINT [FK_GradeLearningStandardGrade_Grade] FOREIGN KEY ([BeginDate], [GradeTypeDescriptorId], [GradingPeriodDescriptorId], [GradingPeriodSchoolYear], [GradingPeriodSequence], [LocalCourseCode], [SchoolId], [SchoolYear], [SectionIdentifier], [SessionName], [StudentUSI])
REFERENCES [edfi].[Grade] ([BeginDate], [GradeTypeDescriptorId], [GradingPeriodDescriptorId], [GradingPeriodSchoolYear], [GradingPeriodSequence], [LocalCourseCode], [SchoolId], [SchoolYear], [SectionIdentifier], [SessionName], [StudentUSI])
ON DELETE CASCADE
ON UPDATE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_GradeLearningStandardGrade_Grade]
ON [edfi].[GradeLearningStandardGrade] ([BeginDate] ASC, [GradeTypeDescriptorId] ASC, [GradingPeriodDescriptorId] ASC, [GradingPeriodSchoolYear] ASC, [GradingPeriodSequence] ASC, [LocalCourseCode] ASC, [SchoolId] ASC, [SchoolYear] ASC, [SectionIdentifier] ASC, [SessionName] ASC, [StudentUSI] ASC)
GO
ALTER TABLE [edfi].[GradeLearningStandardGrade] WITH CHECK ADD CONSTRAINT [FK_GradeLearningStandardGrade_LearningStandard] FOREIGN KEY ([LearningStandardId])
REFERENCES [edfi].[LearningStandard] ([LearningStandardId])
GO
CREATE NONCLUSTERED INDEX [FK_GradeLearningStandardGrade_LearningStandard]
ON [edfi].[GradeLearningStandardGrade] ([LearningStandardId] ASC)
GO
ALTER TABLE [edfi].[GradeLearningStandardGrade] WITH CHECK ADD CONSTRAINT [FK_GradeLearningStandardGrade_PerformanceBaseConversionDescriptor] FOREIGN KEY ([PerformanceBaseConversionDescriptorId])
REFERENCES [edfi].[PerformanceBaseConversionDescriptor] ([PerformanceBaseConversionDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_GradeLearningStandardGrade_PerformanceBaseConversionDescriptor]
ON [edfi].[GradeLearningStandardGrade] ([PerformanceBaseConversionDescriptorId] ASC)
GO
ALTER TABLE [edfi].[GradeLevelDescriptor] WITH CHECK ADD CONSTRAINT [FK_GradeLevelDescriptor_Descriptor] FOREIGN KEY ([GradeLevelDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[GradePointAverageTypeDescriptor] WITH CHECK ADD CONSTRAINT [FK_GradePointAverageTypeDescriptor_Descriptor] FOREIGN KEY ([GradePointAverageTypeDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[GradeTypeDescriptor] WITH CHECK ADD CONSTRAINT [FK_GradeTypeDescriptor_Descriptor] FOREIGN KEY ([GradeTypeDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[GradingPeriod] WITH CHECK ADD CONSTRAINT [FK_GradingPeriod_GradingPeriodDescriptor] FOREIGN KEY ([GradingPeriodDescriptorId])
REFERENCES [edfi].[GradingPeriodDescriptor] ([GradingPeriodDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_GradingPeriod_GradingPeriodDescriptor]
ON [edfi].[GradingPeriod] ([GradingPeriodDescriptorId] ASC)
GO
ALTER TABLE [edfi].[GradingPeriod] WITH CHECK ADD CONSTRAINT [FK_GradingPeriod_School] FOREIGN KEY ([SchoolId])
REFERENCES [edfi].[School] ([SchoolId])
GO
CREATE NONCLUSTERED INDEX [FK_GradingPeriod_School]
ON [edfi].[GradingPeriod] ([SchoolId] ASC)
GO
ALTER TABLE [edfi].[GradingPeriod] WITH CHECK ADD CONSTRAINT [FK_GradingPeriod_SchoolYearType] FOREIGN KEY ([SchoolYear])
REFERENCES [edfi].[SchoolYearType] ([SchoolYear])
GO
CREATE NONCLUSTERED INDEX [FK_GradingPeriod_SchoolYearType]
ON [edfi].[GradingPeriod] ([SchoolYear] ASC)
GO
ALTER TABLE [edfi].[GradingPeriodDescriptor] WITH CHECK ADD CONSTRAINT [FK_GradingPeriodDescriptor_Descriptor] FOREIGN KEY ([GradingPeriodDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[GraduationPlan] WITH CHECK ADD CONSTRAINT [FK_GraduationPlan_CreditTypeDescriptor] FOREIGN KEY ([TotalRequiredCreditTypeDescriptorId])
REFERENCES [edfi].[CreditTypeDescriptor] ([CreditTypeDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_GraduationPlan_CreditTypeDescriptor]
ON [edfi].[GraduationPlan] ([TotalRequiredCreditTypeDescriptorId] ASC)
GO
ALTER TABLE [edfi].[GraduationPlan] WITH CHECK ADD CONSTRAINT [FK_GraduationPlan_EducationOrganization] FOREIGN KEY ([EducationOrganizationId])
REFERENCES [edfi].[EducationOrganization] ([EducationOrganizationId])
GO
CREATE NONCLUSTERED INDEX [FK_GraduationPlan_EducationOrganization]
ON [edfi].[GraduationPlan] ([EducationOrganizationId] ASC)
GO
ALTER TABLE [edfi].[GraduationPlan] WITH CHECK ADD CONSTRAINT [FK_GraduationPlan_GraduationPlanTypeDescriptor] FOREIGN KEY ([GraduationPlanTypeDescriptorId])
REFERENCES [edfi].[GraduationPlanTypeDescriptor] ([GraduationPlanTypeDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_GraduationPlan_GraduationPlanTypeDescriptor]
ON [edfi].[GraduationPlan] ([GraduationPlanTypeDescriptorId] ASC)
GO
ALTER TABLE [edfi].[GraduationPlan] WITH CHECK ADD CONSTRAINT [FK_GraduationPlan_SchoolYearType] FOREIGN KEY ([GraduationSchoolYear])
REFERENCES [edfi].[SchoolYearType] ([SchoolYear])
GO
CREATE NONCLUSTERED INDEX [FK_GraduationPlan_SchoolYearType]
ON [edfi].[GraduationPlan] ([GraduationSchoolYear] ASC)
GO
ALTER TABLE [edfi].[GraduationPlanCreditsByCourse] WITH CHECK ADD CONSTRAINT [FK_GraduationPlanCreditsByCourse_CreditTypeDescriptor] FOREIGN KEY ([CreditTypeDescriptorId])
REFERENCES [edfi].[CreditTypeDescriptor] ([CreditTypeDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_GraduationPlanCreditsByCourse_CreditTypeDescriptor]
ON [edfi].[GraduationPlanCreditsByCourse] ([CreditTypeDescriptorId] ASC)
GO
ALTER TABLE [edfi].[GraduationPlanCreditsByCourse] WITH CHECK ADD CONSTRAINT [FK_GraduationPlanCreditsByCourse_GradeLevelDescriptor] FOREIGN KEY ([WhenTakenGradeLevelDescriptorId])
REFERENCES [edfi].[GradeLevelDescriptor] ([GradeLevelDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_GraduationPlanCreditsByCourse_GradeLevelDescriptor]
ON [edfi].[GraduationPlanCreditsByCourse] ([WhenTakenGradeLevelDescriptorId] ASC)
GO
ALTER TABLE [edfi].[GraduationPlanCreditsByCourse] WITH CHECK ADD CONSTRAINT [FK_GraduationPlanCreditsByCourse_GraduationPlan] FOREIGN KEY ([EducationOrganizationId], [GraduationPlanTypeDescriptorId], [GraduationSchoolYear])
REFERENCES [edfi].[GraduationPlan] ([EducationOrganizationId], [GraduationPlanTypeDescriptorId], [GraduationSchoolYear])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_GraduationPlanCreditsByCourse_GraduationPlan]
ON [edfi].[GraduationPlanCreditsByCourse] ([EducationOrganizationId] ASC, [GraduationPlanTypeDescriptorId] ASC, [GraduationSchoolYear] ASC)
GO
ALTER TABLE [edfi].[GraduationPlanCreditsByCourseCourse] WITH CHECK ADD CONSTRAINT [FK_GraduationPlanCreditsByCourseCourse_Course] FOREIGN KEY ([CourseCode], [CourseEducationOrganizationId])
REFERENCES [edfi].[Course] ([CourseCode], [EducationOrganizationId])
GO
CREATE NONCLUSTERED INDEX [FK_GraduationPlanCreditsByCourseCourse_Course]
ON [edfi].[GraduationPlanCreditsByCourseCourse] ([CourseCode] ASC, [CourseEducationOrganizationId] ASC)
GO
ALTER TABLE [edfi].[GraduationPlanCreditsByCourseCourse] WITH CHECK ADD CONSTRAINT [FK_GraduationPlanCreditsByCourseCourse_GraduationPlanCreditsByCourse] FOREIGN KEY ([CourseSetName], [EducationOrganizationId], [GraduationPlanTypeDescriptorId], [GraduationSchoolYear])
REFERENCES [edfi].[GraduationPlanCreditsByCourse] ([CourseSetName], [EducationOrganizationId], [GraduationPlanTypeDescriptorId], [GraduationSchoolYear])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_GraduationPlanCreditsByCourseCourse_GraduationPlanCreditsByCourse]
ON [edfi].[GraduationPlanCreditsByCourseCourse] ([CourseSetName] ASC, [EducationOrganizationId] ASC, [GraduationPlanTypeDescriptorId] ASC, [GraduationSchoolYear] ASC)
GO
ALTER TABLE [edfi].[GraduationPlanCreditsByCreditCategory] WITH CHECK ADD CONSTRAINT [FK_GraduationPlanCreditsByCreditCategory_CreditCategoryDescriptor] FOREIGN KEY ([CreditCategoryDescriptorId])
REFERENCES [edfi].[CreditCategoryDescriptor] ([CreditCategoryDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_GraduationPlanCreditsByCreditCategory_CreditCategoryDescriptor]
ON [edfi].[GraduationPlanCreditsByCreditCategory] ([CreditCategoryDescriptorId] ASC)
GO
ALTER TABLE [edfi].[GraduationPlanCreditsByCreditCategory] WITH CHECK ADD CONSTRAINT [FK_GraduationPlanCreditsByCreditCategory_CreditTypeDescriptor] FOREIGN KEY ([CreditTypeDescriptorId])
REFERENCES [edfi].[CreditTypeDescriptor] ([CreditTypeDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_GraduationPlanCreditsByCreditCategory_CreditTypeDescriptor]
ON [edfi].[GraduationPlanCreditsByCreditCategory] ([CreditTypeDescriptorId] ASC)
GO
ALTER TABLE [edfi].[GraduationPlanCreditsByCreditCategory] WITH CHECK ADD CONSTRAINT [FK_GraduationPlanCreditsByCreditCategory_GraduationPlan] FOREIGN KEY ([EducationOrganizationId], [GraduationPlanTypeDescriptorId], [GraduationSchoolYear])
REFERENCES [edfi].[GraduationPlan] ([EducationOrganizationId], [GraduationPlanTypeDescriptorId], [GraduationSchoolYear])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_GraduationPlanCreditsByCreditCategory_GraduationPlan]
ON [edfi].[GraduationPlanCreditsByCreditCategory] ([EducationOrganizationId] ASC, [GraduationPlanTypeDescriptorId] ASC, [GraduationSchoolYear] ASC)
GO
ALTER TABLE [edfi].[GraduationPlanCreditsBySubject] WITH CHECK ADD CONSTRAINT [FK_GraduationPlanCreditsBySubject_AcademicSubjectDescriptor] FOREIGN KEY ([AcademicSubjectDescriptorId])
REFERENCES [edfi].[AcademicSubjectDescriptor] ([AcademicSubjectDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_GraduationPlanCreditsBySubject_AcademicSubjectDescriptor]
ON [edfi].[GraduationPlanCreditsBySubject] ([AcademicSubjectDescriptorId] ASC)
GO
ALTER TABLE [edfi].[GraduationPlanCreditsBySubject] WITH CHECK ADD CONSTRAINT [FK_GraduationPlanCreditsBySubject_CreditTypeDescriptor] FOREIGN KEY ([CreditTypeDescriptorId])
REFERENCES [edfi].[CreditTypeDescriptor] ([CreditTypeDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_GraduationPlanCreditsBySubject_CreditTypeDescriptor]
ON [edfi].[GraduationPlanCreditsBySubject] ([CreditTypeDescriptorId] ASC)
GO
ALTER TABLE [edfi].[GraduationPlanCreditsBySubject] WITH CHECK ADD CONSTRAINT [FK_GraduationPlanCreditsBySubject_GraduationPlan] FOREIGN KEY ([EducationOrganizationId], [GraduationPlanTypeDescriptorId], [GraduationSchoolYear])
REFERENCES [edfi].[GraduationPlan] ([EducationOrganizationId], [GraduationPlanTypeDescriptorId], [GraduationSchoolYear])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_GraduationPlanCreditsBySubject_GraduationPlan]
ON [edfi].[GraduationPlanCreditsBySubject] ([EducationOrganizationId] ASC, [GraduationPlanTypeDescriptorId] ASC, [GraduationSchoolYear] ASC)
GO
ALTER TABLE [edfi].[GraduationPlanRequiredAssessment] WITH CHECK ADD CONSTRAINT [FK_GraduationPlanRequiredAssessment_Assessment] FOREIGN KEY ([AssessmentIdentifier], [Namespace])
REFERENCES [edfi].[Assessment] ([AssessmentIdentifier], [Namespace])
GO
CREATE NONCLUSTERED INDEX [FK_GraduationPlanRequiredAssessment_Assessment]
ON [edfi].[GraduationPlanRequiredAssessment] ([AssessmentIdentifier] ASC, [Namespace] ASC)
GO
ALTER TABLE [edfi].[GraduationPlanRequiredAssessment] WITH CHECK ADD CONSTRAINT [FK_GraduationPlanRequiredAssessment_GraduationPlan] FOREIGN KEY ([EducationOrganizationId], [GraduationPlanTypeDescriptorId], [GraduationSchoolYear])
REFERENCES [edfi].[GraduationPlan] ([EducationOrganizationId], [GraduationPlanTypeDescriptorId], [GraduationSchoolYear])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_GraduationPlanRequiredAssessment_GraduationPlan]
ON [edfi].[GraduationPlanRequiredAssessment] ([EducationOrganizationId] ASC, [GraduationPlanTypeDescriptorId] ASC, [GraduationSchoolYear] ASC)
GO
ALTER TABLE [edfi].[GraduationPlanRequiredAssessmentPerformanceLevel] WITH CHECK ADD CONSTRAINT [FK_GraduationPlanRequiredAssessmentPerformanceLevel_AssessmentReportingMethodDescriptor] FOREIGN KEY ([AssessmentReportingMethodDescriptorId])
REFERENCES [edfi].[AssessmentReportingMethodDescriptor] ([AssessmentReportingMethodDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_GraduationPlanRequiredAssessmentPerformanceLevel_AssessmentReportingMethodDescriptor]
ON [edfi].[GraduationPlanRequiredAssessmentPerformanceLevel] ([AssessmentReportingMethodDescriptorId] ASC)
GO
ALTER TABLE [edfi].[GraduationPlanRequiredAssessmentPerformanceLevel] WITH CHECK ADD CONSTRAINT [FK_GraduationPlanRequiredAssessmentPerformanceLevel_GraduationPlanRequiredAssessment] FOREIGN KEY ([AssessmentIdentifier], [EducationOrganizationId], [GraduationPlanTypeDescriptorId], [GraduationSchoolYear], [Namespace])
REFERENCES [edfi].[GraduationPlanRequiredAssessment] ([AssessmentIdentifier], [EducationOrganizationId], [GraduationPlanTypeDescriptorId], [GraduationSchoolYear], [Namespace])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[GraduationPlanRequiredAssessmentPerformanceLevel] WITH CHECK ADD CONSTRAINT [FK_GraduationPlanRequiredAssessmentPerformanceLevel_PerformanceLevelDescriptor] FOREIGN KEY ([PerformanceLevelDescriptorId])
REFERENCES [edfi].[PerformanceLevelDescriptor] ([PerformanceLevelDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_GraduationPlanRequiredAssessmentPerformanceLevel_PerformanceLevelDescriptor]
ON [edfi].[GraduationPlanRequiredAssessmentPerformanceLevel] ([PerformanceLevelDescriptorId] ASC)
GO
ALTER TABLE [edfi].[GraduationPlanRequiredAssessmentPerformanceLevel] WITH CHECK ADD CONSTRAINT [FK_GraduationPlanRequiredAssessmentPerformanceLevel_ResultDatatypeTypeDescriptor] FOREIGN KEY ([ResultDatatypeTypeDescriptorId])
REFERENCES [edfi].[ResultDatatypeTypeDescriptor] ([ResultDatatypeTypeDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_GraduationPlanRequiredAssessmentPerformanceLevel_ResultDatatypeTypeDescriptor]
ON [edfi].[GraduationPlanRequiredAssessmentPerformanceLevel] ([ResultDatatypeTypeDescriptorId] ASC)
GO
ALTER TABLE [edfi].[GraduationPlanRequiredAssessmentScore] WITH CHECK ADD CONSTRAINT [FK_GraduationPlanRequiredAssessmentScore_AssessmentReportingMethodDescriptor] FOREIGN KEY ([AssessmentReportingMethodDescriptorId])
REFERENCES [edfi].[AssessmentReportingMethodDescriptor] ([AssessmentReportingMethodDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_GraduationPlanRequiredAssessmentScore_AssessmentReportingMethodDescriptor]
ON [edfi].[GraduationPlanRequiredAssessmentScore] ([AssessmentReportingMethodDescriptorId] ASC)
GO
ALTER TABLE [edfi].[GraduationPlanRequiredAssessmentScore] WITH CHECK ADD CONSTRAINT [FK_GraduationPlanRequiredAssessmentScore_GraduationPlanRequiredAssessment] FOREIGN KEY ([AssessmentIdentifier], [EducationOrganizationId], [GraduationPlanTypeDescriptorId], [GraduationSchoolYear], [Namespace])
REFERENCES [edfi].[GraduationPlanRequiredAssessment] ([AssessmentIdentifier], [EducationOrganizationId], [GraduationPlanTypeDescriptorId], [GraduationSchoolYear], [Namespace])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_GraduationPlanRequiredAssessmentScore_GraduationPlanRequiredAssessment]
ON [edfi].[GraduationPlanRequiredAssessmentScore] ([AssessmentIdentifier] ASC, [EducationOrganizationId] ASC, [GraduationPlanTypeDescriptorId] ASC, [GraduationSchoolYear] ASC, [Namespace] ASC)
GO
ALTER TABLE [edfi].[GraduationPlanRequiredAssessmentScore] WITH CHECK ADD CONSTRAINT [FK_GraduationPlanRequiredAssessmentScore_ResultDatatypeTypeDescriptor] FOREIGN KEY ([ResultDatatypeTypeDescriptorId])
REFERENCES [edfi].[ResultDatatypeTypeDescriptor] ([ResultDatatypeTypeDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_GraduationPlanRequiredAssessmentScore_ResultDatatypeTypeDescriptor]
ON [edfi].[GraduationPlanRequiredAssessmentScore] ([ResultDatatypeTypeDescriptorId] ASC)
GO
ALTER TABLE [edfi].[GraduationPlanTypeDescriptor] WITH CHECK ADD CONSTRAINT [FK_GraduationPlanTypeDescriptor_Descriptor] FOREIGN KEY ([GraduationPlanTypeDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[GunFreeSchoolsActReportingStatusDescriptor] WITH CHECK ADD CONSTRAINT [FK_GunFreeSchoolsActReportingStatusDescriptor_Descriptor] FOREIGN KEY ([GunFreeSchoolsActReportingStatusDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[HomelessPrimaryNighttimeResidenceDescriptor] WITH CHECK ADD CONSTRAINT [FK_HomelessPrimaryNighttimeResidenceDescriptor_Descriptor] FOREIGN KEY ([HomelessPrimaryNighttimeResidenceDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[HomelessProgramServiceDescriptor] WITH CHECK ADD CONSTRAINT [FK_HomelessProgramServiceDescriptor_Descriptor] FOREIGN KEY ([HomelessProgramServiceDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[IdentificationDocumentUseDescriptor] WITH CHECK ADD CONSTRAINT [FK_IdentificationDocumentUseDescriptor_Descriptor] FOREIGN KEY ([IdentificationDocumentUseDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[IncidentLocationDescriptor] WITH CHECK ADD CONSTRAINT [FK_IncidentLocationDescriptor_Descriptor] FOREIGN KEY ([IncidentLocationDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[IndicatorDescriptor] WITH CHECK ADD CONSTRAINT [FK_IndicatorDescriptor_Descriptor] FOREIGN KEY ([IndicatorDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[IndicatorGroupDescriptor] WITH CHECK ADD CONSTRAINT [FK_IndicatorGroupDescriptor_Descriptor] FOREIGN KEY ([IndicatorGroupDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[IndicatorLevelDescriptor] WITH CHECK ADD CONSTRAINT [FK_IndicatorLevelDescriptor_Descriptor] FOREIGN KEY ([IndicatorLevelDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[InstitutionTelephoneNumberTypeDescriptor] WITH CHECK ADD CONSTRAINT [FK_InstitutionTelephoneNumberTypeDescriptor_Descriptor] FOREIGN KEY ([InstitutionTelephoneNumberTypeDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[InteractivityStyleDescriptor] WITH CHECK ADD CONSTRAINT [FK_InteractivityStyleDescriptor_Descriptor] FOREIGN KEY ([InteractivityStyleDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[InternetAccessDescriptor] WITH CHECK ADD CONSTRAINT [FK_InternetAccessDescriptor_Descriptor] FOREIGN KEY ([InternetAccessDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[InternetAccessTypeInResidenceDescriptor] WITH CHECK ADD CONSTRAINT [FK_InternetAccessTypeInResidenceDescriptor_Descriptor] FOREIGN KEY ([InternetAccessTypeInResidenceDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[InternetPerformanceInResidenceDescriptor] WITH CHECK ADD CONSTRAINT [FK_InternetPerformanceInResidenceDescriptor_Descriptor] FOREIGN KEY ([InternetPerformanceInResidenceDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[Intervention] WITH CHECK ADD CONSTRAINT [FK_Intervention_DeliveryMethodDescriptor] FOREIGN KEY ([DeliveryMethodDescriptorId])
REFERENCES [edfi].[DeliveryMethodDescriptor] ([DeliveryMethodDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_Intervention_DeliveryMethodDescriptor]
ON [edfi].[Intervention] ([DeliveryMethodDescriptorId] ASC)
GO
ALTER TABLE [edfi].[Intervention] WITH CHECK ADD CONSTRAINT [FK_Intervention_EducationOrganization] FOREIGN KEY ([EducationOrganizationId])
REFERENCES [edfi].[EducationOrganization] ([EducationOrganizationId])
GO
CREATE NONCLUSTERED INDEX [FK_Intervention_EducationOrganization]
ON [edfi].[Intervention] ([EducationOrganizationId] ASC)
GO
ALTER TABLE [edfi].[Intervention] WITH CHECK ADD CONSTRAINT [FK_Intervention_InterventionClassDescriptor] FOREIGN KEY ([InterventionClassDescriptorId])
REFERENCES [edfi].[InterventionClassDescriptor] ([InterventionClassDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_Intervention_InterventionClassDescriptor]
ON [edfi].[Intervention] ([InterventionClassDescriptorId] ASC)
GO
ALTER TABLE [edfi].[InterventionAppropriateGradeLevel] WITH CHECK ADD CONSTRAINT [FK_InterventionAppropriateGradeLevel_GradeLevelDescriptor] FOREIGN KEY ([GradeLevelDescriptorId])
REFERENCES [edfi].[GradeLevelDescriptor] ([GradeLevelDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_InterventionAppropriateGradeLevel_GradeLevelDescriptor]
ON [edfi].[InterventionAppropriateGradeLevel] ([GradeLevelDescriptorId] ASC)
GO
ALTER TABLE [edfi].[InterventionAppropriateGradeLevel] WITH CHECK ADD CONSTRAINT [FK_InterventionAppropriateGradeLevel_Intervention] FOREIGN KEY ([EducationOrganizationId], [InterventionIdentificationCode])
REFERENCES [edfi].[Intervention] ([EducationOrganizationId], [InterventionIdentificationCode])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_InterventionAppropriateGradeLevel_Intervention]
ON [edfi].[InterventionAppropriateGradeLevel] ([EducationOrganizationId] ASC, [InterventionIdentificationCode] ASC)
GO
ALTER TABLE [edfi].[InterventionAppropriateSex] WITH CHECK ADD CONSTRAINT [FK_InterventionAppropriateSex_Intervention] FOREIGN KEY ([EducationOrganizationId], [InterventionIdentificationCode])
REFERENCES [edfi].[Intervention] ([EducationOrganizationId], [InterventionIdentificationCode])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_InterventionAppropriateSex_Intervention]
ON [edfi].[InterventionAppropriateSex] ([EducationOrganizationId] ASC, [InterventionIdentificationCode] ASC)
GO
ALTER TABLE [edfi].[InterventionAppropriateSex] WITH CHECK ADD CONSTRAINT [FK_InterventionAppropriateSex_SexDescriptor] FOREIGN KEY ([SexDescriptorId])
REFERENCES [edfi].[SexDescriptor] ([SexDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_InterventionAppropriateSex_SexDescriptor]
ON [edfi].[InterventionAppropriateSex] ([SexDescriptorId] ASC)
GO
ALTER TABLE [edfi].[InterventionClassDescriptor] WITH CHECK ADD CONSTRAINT [FK_InterventionClassDescriptor_Descriptor] FOREIGN KEY ([InterventionClassDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[InterventionDiagnosis] WITH CHECK ADD CONSTRAINT [FK_InterventionDiagnosis_DiagnosisDescriptor] FOREIGN KEY ([DiagnosisDescriptorId])
REFERENCES [edfi].[DiagnosisDescriptor] ([DiagnosisDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_InterventionDiagnosis_DiagnosisDescriptor]
ON [edfi].[InterventionDiagnosis] ([DiagnosisDescriptorId] ASC)
GO
ALTER TABLE [edfi].[InterventionDiagnosis] WITH CHECK ADD CONSTRAINT [FK_InterventionDiagnosis_Intervention] FOREIGN KEY ([EducationOrganizationId], [InterventionIdentificationCode])
REFERENCES [edfi].[Intervention] ([EducationOrganizationId], [InterventionIdentificationCode])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_InterventionDiagnosis_Intervention]
ON [edfi].[InterventionDiagnosis] ([EducationOrganizationId] ASC, [InterventionIdentificationCode] ASC)
GO
ALTER TABLE [edfi].[InterventionEducationContent] WITH CHECK ADD CONSTRAINT [FK_InterventionEducationContent_EducationContent] FOREIGN KEY ([ContentIdentifier])
REFERENCES [edfi].[EducationContent] ([ContentIdentifier])
GO
CREATE NONCLUSTERED INDEX [FK_InterventionEducationContent_EducationContent]
ON [edfi].[InterventionEducationContent] ([ContentIdentifier] ASC)
GO
ALTER TABLE [edfi].[InterventionEducationContent] WITH CHECK ADD CONSTRAINT [FK_InterventionEducationContent_Intervention] FOREIGN KEY ([EducationOrganizationId], [InterventionIdentificationCode])
REFERENCES [edfi].[Intervention] ([EducationOrganizationId], [InterventionIdentificationCode])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_InterventionEducationContent_Intervention]
ON [edfi].[InterventionEducationContent] ([EducationOrganizationId] ASC, [InterventionIdentificationCode] ASC)
GO
ALTER TABLE [edfi].[InterventionEffectivenessRatingDescriptor] WITH CHECK ADD CONSTRAINT [FK_InterventionEffectivenessRatingDescriptor_Descriptor] FOREIGN KEY ([InterventionEffectivenessRatingDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[InterventionInterventionPrescription] WITH CHECK ADD CONSTRAINT [FK_InterventionInterventionPrescription_Intervention] FOREIGN KEY ([EducationOrganizationId], [InterventionIdentificationCode])
REFERENCES [edfi].[Intervention] ([EducationOrganizationId], [InterventionIdentificationCode])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_InterventionInterventionPrescription_Intervention]
ON [edfi].[InterventionInterventionPrescription] ([EducationOrganizationId] ASC, [InterventionIdentificationCode] ASC)
GO
ALTER TABLE [edfi].[InterventionInterventionPrescription] WITH CHECK ADD CONSTRAINT [FK_InterventionInterventionPrescription_InterventionPrescription] FOREIGN KEY ([InterventionPrescriptionEducationOrganizationId], [InterventionPrescriptionIdentificationCode])
REFERENCES [edfi].[InterventionPrescription] ([EducationOrganizationId], [InterventionPrescriptionIdentificationCode])
GO
CREATE NONCLUSTERED INDEX [FK_InterventionInterventionPrescription_InterventionPrescription]
ON [edfi].[InterventionInterventionPrescription] ([InterventionPrescriptionEducationOrganizationId] ASC, [InterventionPrescriptionIdentificationCode] ASC)
GO
ALTER TABLE [edfi].[InterventionLearningResourceMetadataURI] WITH CHECK ADD CONSTRAINT [FK_InterventionLearningResourceMetadataURI_Intervention] FOREIGN KEY ([EducationOrganizationId], [InterventionIdentificationCode])
REFERENCES [edfi].[Intervention] ([EducationOrganizationId], [InterventionIdentificationCode])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_InterventionLearningResourceMetadataURI_Intervention]
ON [edfi].[InterventionLearningResourceMetadataURI] ([EducationOrganizationId] ASC, [InterventionIdentificationCode] ASC)
GO
ALTER TABLE [edfi].[InterventionMeetingTime] WITH CHECK ADD CONSTRAINT [FK_InterventionMeetingTime_Intervention] FOREIGN KEY ([EducationOrganizationId], [InterventionIdentificationCode])
REFERENCES [edfi].[Intervention] ([EducationOrganizationId], [InterventionIdentificationCode])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_InterventionMeetingTime_Intervention]
ON [edfi].[InterventionMeetingTime] ([EducationOrganizationId] ASC, [InterventionIdentificationCode] ASC)
GO
ALTER TABLE [edfi].[InterventionPopulationServed] WITH CHECK ADD CONSTRAINT [FK_InterventionPopulationServed_Intervention] FOREIGN KEY ([EducationOrganizationId], [InterventionIdentificationCode])
REFERENCES [edfi].[Intervention] ([EducationOrganizationId], [InterventionIdentificationCode])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_InterventionPopulationServed_Intervention]
ON [edfi].[InterventionPopulationServed] ([EducationOrganizationId] ASC, [InterventionIdentificationCode] ASC)
GO
ALTER TABLE [edfi].[InterventionPopulationServed] WITH CHECK ADD CONSTRAINT [FK_InterventionPopulationServed_PopulationServedDescriptor] FOREIGN KEY ([PopulationServedDescriptorId])
REFERENCES [edfi].[PopulationServedDescriptor] ([PopulationServedDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_InterventionPopulationServed_PopulationServedDescriptor]
ON [edfi].[InterventionPopulationServed] ([PopulationServedDescriptorId] ASC)
GO
ALTER TABLE [edfi].[InterventionPrescription] WITH CHECK ADD CONSTRAINT [FK_InterventionPrescription_DeliveryMethodDescriptor] FOREIGN KEY ([DeliveryMethodDescriptorId])
REFERENCES [edfi].[DeliveryMethodDescriptor] ([DeliveryMethodDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_InterventionPrescription_DeliveryMethodDescriptor]
ON [edfi].[InterventionPrescription] ([DeliveryMethodDescriptorId] ASC)
GO
ALTER TABLE [edfi].[InterventionPrescription] WITH CHECK ADD CONSTRAINT [FK_InterventionPrescription_EducationOrganization] FOREIGN KEY ([EducationOrganizationId])
REFERENCES [edfi].[EducationOrganization] ([EducationOrganizationId])
GO
CREATE NONCLUSTERED INDEX [FK_InterventionPrescription_EducationOrganization]
ON [edfi].[InterventionPrescription] ([EducationOrganizationId] ASC)
GO
ALTER TABLE [edfi].[InterventionPrescription] WITH CHECK ADD CONSTRAINT [FK_InterventionPrescription_InterventionClassDescriptor] FOREIGN KEY ([InterventionClassDescriptorId])
REFERENCES [edfi].[InterventionClassDescriptor] ([InterventionClassDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_InterventionPrescription_InterventionClassDescriptor]
ON [edfi].[InterventionPrescription] ([InterventionClassDescriptorId] ASC)
GO
ALTER TABLE [edfi].[InterventionPrescriptionAppropriateGradeLevel] WITH CHECK ADD CONSTRAINT [FK_InterventionPrescriptionAppropriateGradeLevel_GradeLevelDescriptor] FOREIGN KEY ([GradeLevelDescriptorId])
REFERENCES [edfi].[GradeLevelDescriptor] ([GradeLevelDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_InterventionPrescriptionAppropriateGradeLevel_GradeLevelDescriptor]
ON [edfi].[InterventionPrescriptionAppropriateGradeLevel] ([GradeLevelDescriptorId] ASC)
GO
ALTER TABLE [edfi].[InterventionPrescriptionAppropriateGradeLevel] WITH CHECK ADD CONSTRAINT [FK_InterventionPrescriptionAppropriateGradeLevel_InterventionPrescription] FOREIGN KEY ([EducationOrganizationId], [InterventionPrescriptionIdentificationCode])
REFERENCES [edfi].[InterventionPrescription] ([EducationOrganizationId], [InterventionPrescriptionIdentificationCode])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_InterventionPrescriptionAppropriateGradeLevel_InterventionPrescription]
ON [edfi].[InterventionPrescriptionAppropriateGradeLevel] ([EducationOrganizationId] ASC, [InterventionPrescriptionIdentificationCode] ASC)
GO
ALTER TABLE [edfi].[InterventionPrescriptionAppropriateSex] WITH CHECK ADD CONSTRAINT [FK_InterventionPrescriptionAppropriateSex_InterventionPrescription] FOREIGN KEY ([EducationOrganizationId], [InterventionPrescriptionIdentificationCode])
REFERENCES [edfi].[InterventionPrescription] ([EducationOrganizationId], [InterventionPrescriptionIdentificationCode])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_InterventionPrescriptionAppropriateSex_InterventionPrescription]
ON [edfi].[InterventionPrescriptionAppropriateSex] ([EducationOrganizationId] ASC, [InterventionPrescriptionIdentificationCode] ASC)
GO
ALTER TABLE [edfi].[InterventionPrescriptionAppropriateSex] WITH CHECK ADD CONSTRAINT [FK_InterventionPrescriptionAppropriateSex_SexDescriptor] FOREIGN KEY ([SexDescriptorId])
REFERENCES [edfi].[SexDescriptor] ([SexDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_InterventionPrescriptionAppropriateSex_SexDescriptor]
ON [edfi].[InterventionPrescriptionAppropriateSex] ([SexDescriptorId] ASC)
GO
ALTER TABLE [edfi].[InterventionPrescriptionDiagnosis] WITH CHECK ADD CONSTRAINT [FK_InterventionPrescriptionDiagnosis_DiagnosisDescriptor] FOREIGN KEY ([DiagnosisDescriptorId])
REFERENCES [edfi].[DiagnosisDescriptor] ([DiagnosisDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_InterventionPrescriptionDiagnosis_DiagnosisDescriptor]
ON [edfi].[InterventionPrescriptionDiagnosis] ([DiagnosisDescriptorId] ASC)
GO
ALTER TABLE [edfi].[InterventionPrescriptionDiagnosis] WITH CHECK ADD CONSTRAINT [FK_InterventionPrescriptionDiagnosis_InterventionPrescription] FOREIGN KEY ([EducationOrganizationId], [InterventionPrescriptionIdentificationCode])
REFERENCES [edfi].[InterventionPrescription] ([EducationOrganizationId], [InterventionPrescriptionIdentificationCode])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_InterventionPrescriptionDiagnosis_InterventionPrescription]
ON [edfi].[InterventionPrescriptionDiagnosis] ([EducationOrganizationId] ASC, [InterventionPrescriptionIdentificationCode] ASC)
GO
ALTER TABLE [edfi].[InterventionPrescriptionEducationContent] WITH CHECK ADD CONSTRAINT [FK_InterventionPrescriptionEducationContent_EducationContent] FOREIGN KEY ([ContentIdentifier])
REFERENCES [edfi].[EducationContent] ([ContentIdentifier])
GO
CREATE NONCLUSTERED INDEX [FK_InterventionPrescriptionEducationContent_EducationContent]
ON [edfi].[InterventionPrescriptionEducationContent] ([ContentIdentifier] ASC)
GO
ALTER TABLE [edfi].[InterventionPrescriptionEducationContent] WITH CHECK ADD CONSTRAINT [FK_InterventionPrescriptionEducationContent_InterventionPrescription] FOREIGN KEY ([EducationOrganizationId], [InterventionPrescriptionIdentificationCode])
REFERENCES [edfi].[InterventionPrescription] ([EducationOrganizationId], [InterventionPrescriptionIdentificationCode])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_InterventionPrescriptionEducationContent_InterventionPrescription]
ON [edfi].[InterventionPrescriptionEducationContent] ([EducationOrganizationId] ASC, [InterventionPrescriptionIdentificationCode] ASC)
GO
ALTER TABLE [edfi].[InterventionPrescriptionLearningResourceMetadataURI] WITH CHECK ADD CONSTRAINT [FK_InterventionPrescriptionLearningResourceMetadataURI_InterventionPrescription] FOREIGN KEY ([EducationOrganizationId], [InterventionPrescriptionIdentificationCode])
REFERENCES [edfi].[InterventionPrescription] ([EducationOrganizationId], [InterventionPrescriptionIdentificationCode])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_InterventionPrescriptionLearningResourceMetadataURI_InterventionPrescription]
ON [edfi].[InterventionPrescriptionLearningResourceMetadataURI] ([EducationOrganizationId] ASC, [InterventionPrescriptionIdentificationCode] ASC)
GO
ALTER TABLE [edfi].[InterventionPrescriptionPopulationServed] WITH CHECK ADD CONSTRAINT [FK_InterventionPrescriptionPopulationServed_InterventionPrescription] FOREIGN KEY ([EducationOrganizationId], [InterventionPrescriptionIdentificationCode])
REFERENCES [edfi].[InterventionPrescription] ([EducationOrganizationId], [InterventionPrescriptionIdentificationCode])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_InterventionPrescriptionPopulationServed_InterventionPrescription]
ON [edfi].[InterventionPrescriptionPopulationServed] ([EducationOrganizationId] ASC, [InterventionPrescriptionIdentificationCode] ASC)
GO
ALTER TABLE [edfi].[InterventionPrescriptionPopulationServed] WITH CHECK ADD CONSTRAINT [FK_InterventionPrescriptionPopulationServed_PopulationServedDescriptor] FOREIGN KEY ([PopulationServedDescriptorId])
REFERENCES [edfi].[PopulationServedDescriptor] ([PopulationServedDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_InterventionPrescriptionPopulationServed_PopulationServedDescriptor]
ON [edfi].[InterventionPrescriptionPopulationServed] ([PopulationServedDescriptorId] ASC)
GO
ALTER TABLE [edfi].[InterventionPrescriptionURI] WITH CHECK ADD CONSTRAINT [FK_InterventionPrescriptionURI_InterventionPrescription] FOREIGN KEY ([EducationOrganizationId], [InterventionPrescriptionIdentificationCode])
REFERENCES [edfi].[InterventionPrescription] ([EducationOrganizationId], [InterventionPrescriptionIdentificationCode])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_InterventionPrescriptionURI_InterventionPrescription]
ON [edfi].[InterventionPrescriptionURI] ([EducationOrganizationId] ASC, [InterventionPrescriptionIdentificationCode] ASC)
GO
ALTER TABLE [edfi].[InterventionStaff] WITH CHECK ADD CONSTRAINT [FK_InterventionStaff_Intervention] FOREIGN KEY ([EducationOrganizationId], [InterventionIdentificationCode])
REFERENCES [edfi].[Intervention] ([EducationOrganizationId], [InterventionIdentificationCode])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_InterventionStaff_Intervention]
ON [edfi].[InterventionStaff] ([EducationOrganizationId] ASC, [InterventionIdentificationCode] ASC)
GO
ALTER TABLE [edfi].[InterventionStaff] WITH CHECK ADD CONSTRAINT [FK_InterventionStaff_Staff] FOREIGN KEY ([StaffUSI])
REFERENCES [edfi].[Staff] ([StaffUSI])
GO
CREATE NONCLUSTERED INDEX [FK_InterventionStaff_Staff]
ON [edfi].[InterventionStaff] ([StaffUSI] ASC)
GO
ALTER TABLE [edfi].[InterventionStudy] WITH CHECK ADD CONSTRAINT [FK_InterventionStudy_DeliveryMethodDescriptor] FOREIGN KEY ([DeliveryMethodDescriptorId])
REFERENCES [edfi].[DeliveryMethodDescriptor] ([DeliveryMethodDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_InterventionStudy_DeliveryMethodDescriptor]
ON [edfi].[InterventionStudy] ([DeliveryMethodDescriptorId] ASC)
GO
ALTER TABLE [edfi].[InterventionStudy] WITH CHECK ADD CONSTRAINT [FK_InterventionStudy_EducationOrganization] FOREIGN KEY ([EducationOrganizationId])
REFERENCES [edfi].[EducationOrganization] ([EducationOrganizationId])
GO
CREATE NONCLUSTERED INDEX [FK_InterventionStudy_EducationOrganization]
ON [edfi].[InterventionStudy] ([EducationOrganizationId] ASC)
GO
ALTER TABLE [edfi].[InterventionStudy] WITH CHECK ADD CONSTRAINT [FK_InterventionStudy_InterventionClassDescriptor] FOREIGN KEY ([InterventionClassDescriptorId])
REFERENCES [edfi].[InterventionClassDescriptor] ([InterventionClassDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_InterventionStudy_InterventionClassDescriptor]
ON [edfi].[InterventionStudy] ([InterventionClassDescriptorId] ASC)
GO
ALTER TABLE [edfi].[InterventionStudy] WITH CHECK ADD CONSTRAINT [FK_InterventionStudy_InterventionPrescription] FOREIGN KEY ([InterventionPrescriptionEducationOrganizationId], [InterventionPrescriptionIdentificationCode])
REFERENCES [edfi].[InterventionPrescription] ([EducationOrganizationId], [InterventionPrescriptionIdentificationCode])
GO
CREATE NONCLUSTERED INDEX [FK_InterventionStudy_InterventionPrescription]
ON [edfi].[InterventionStudy] ([InterventionPrescriptionEducationOrganizationId] ASC, [InterventionPrescriptionIdentificationCode] ASC)
GO
ALTER TABLE [edfi].[InterventionStudyAppropriateGradeLevel] WITH CHECK ADD CONSTRAINT [FK_InterventionStudyAppropriateGradeLevel_GradeLevelDescriptor] FOREIGN KEY ([GradeLevelDescriptorId])
REFERENCES [edfi].[GradeLevelDescriptor] ([GradeLevelDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_InterventionStudyAppropriateGradeLevel_GradeLevelDescriptor]
ON [edfi].[InterventionStudyAppropriateGradeLevel] ([GradeLevelDescriptorId] ASC)
GO
ALTER TABLE [edfi].[InterventionStudyAppropriateGradeLevel] WITH CHECK ADD CONSTRAINT [FK_InterventionStudyAppropriateGradeLevel_InterventionStudy] FOREIGN KEY ([EducationOrganizationId], [InterventionStudyIdentificationCode])
REFERENCES [edfi].[InterventionStudy] ([EducationOrganizationId], [InterventionStudyIdentificationCode])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_InterventionStudyAppropriateGradeLevel_InterventionStudy]
ON [edfi].[InterventionStudyAppropriateGradeLevel] ([EducationOrganizationId] ASC, [InterventionStudyIdentificationCode] ASC)
GO
ALTER TABLE [edfi].[InterventionStudyAppropriateSex] WITH CHECK ADD CONSTRAINT [FK_InterventionStudyAppropriateSex_InterventionStudy] FOREIGN KEY ([EducationOrganizationId], [InterventionStudyIdentificationCode])
REFERENCES [edfi].[InterventionStudy] ([EducationOrganizationId], [InterventionStudyIdentificationCode])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_InterventionStudyAppropriateSex_InterventionStudy]
ON [edfi].[InterventionStudyAppropriateSex] ([EducationOrganizationId] ASC, [InterventionStudyIdentificationCode] ASC)
GO
ALTER TABLE [edfi].[InterventionStudyAppropriateSex] WITH CHECK ADD CONSTRAINT [FK_InterventionStudyAppropriateSex_SexDescriptor] FOREIGN KEY ([SexDescriptorId])
REFERENCES [edfi].[SexDescriptor] ([SexDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_InterventionStudyAppropriateSex_SexDescriptor]
ON [edfi].[InterventionStudyAppropriateSex] ([SexDescriptorId] ASC)
GO
ALTER TABLE [edfi].[InterventionStudyEducationContent] WITH CHECK ADD CONSTRAINT [FK_InterventionStudyEducationContent_EducationContent] FOREIGN KEY ([ContentIdentifier])
REFERENCES [edfi].[EducationContent] ([ContentIdentifier])
GO
CREATE NONCLUSTERED INDEX [FK_InterventionStudyEducationContent_EducationContent]
ON [edfi].[InterventionStudyEducationContent] ([ContentIdentifier] ASC)
GO
ALTER TABLE [edfi].[InterventionStudyEducationContent] WITH CHECK ADD CONSTRAINT [FK_InterventionStudyEducationContent_InterventionStudy] FOREIGN KEY ([EducationOrganizationId], [InterventionStudyIdentificationCode])
REFERENCES [edfi].[InterventionStudy] ([EducationOrganizationId], [InterventionStudyIdentificationCode])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_InterventionStudyEducationContent_InterventionStudy]
ON [edfi].[InterventionStudyEducationContent] ([EducationOrganizationId] ASC, [InterventionStudyIdentificationCode] ASC)
GO
ALTER TABLE [edfi].[InterventionStudyInterventionEffectiveness] WITH CHECK ADD CONSTRAINT [FK_InterventionStudyInterventionEffectiveness_DiagnosisDescriptor] FOREIGN KEY ([DiagnosisDescriptorId])
REFERENCES [edfi].[DiagnosisDescriptor] ([DiagnosisDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_InterventionStudyInterventionEffectiveness_DiagnosisDescriptor]
ON [edfi].[InterventionStudyInterventionEffectiveness] ([DiagnosisDescriptorId] ASC)
GO
ALTER TABLE [edfi].[InterventionStudyInterventionEffectiveness] WITH CHECK ADD CONSTRAINT [FK_InterventionStudyInterventionEffectiveness_GradeLevelDescriptor] FOREIGN KEY ([GradeLevelDescriptorId])
REFERENCES [edfi].[GradeLevelDescriptor] ([GradeLevelDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_InterventionStudyInterventionEffectiveness_GradeLevelDescriptor]
ON [edfi].[InterventionStudyInterventionEffectiveness] ([GradeLevelDescriptorId] ASC)
GO
ALTER TABLE [edfi].[InterventionStudyInterventionEffectiveness] WITH CHECK ADD CONSTRAINT [FK_InterventionStudyInterventionEffectiveness_InterventionEffectivenessRatingDescriptor] FOREIGN KEY ([InterventionEffectivenessRatingDescriptorId])
REFERENCES [edfi].[InterventionEffectivenessRatingDescriptor] ([InterventionEffectivenessRatingDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_InterventionStudyInterventionEffectiveness_InterventionEffectivenessRatingDescriptor]
ON [edfi].[InterventionStudyInterventionEffectiveness] ([InterventionEffectivenessRatingDescriptorId] ASC)
GO
ALTER TABLE [edfi].[InterventionStudyInterventionEffectiveness] WITH CHECK ADD CONSTRAINT [FK_InterventionStudyInterventionEffectiveness_InterventionStudy] FOREIGN KEY ([EducationOrganizationId], [InterventionStudyIdentificationCode])
REFERENCES [edfi].[InterventionStudy] ([EducationOrganizationId], [InterventionStudyIdentificationCode])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_InterventionStudyInterventionEffectiveness_InterventionStudy]
ON [edfi].[InterventionStudyInterventionEffectiveness] ([EducationOrganizationId] ASC, [InterventionStudyIdentificationCode] ASC)
GO
ALTER TABLE [edfi].[InterventionStudyInterventionEffectiveness] WITH CHECK ADD CONSTRAINT [FK_InterventionStudyInterventionEffectiveness_PopulationServedDescriptor] FOREIGN KEY ([PopulationServedDescriptorId])
REFERENCES [edfi].[PopulationServedDescriptor] ([PopulationServedDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_InterventionStudyInterventionEffectiveness_PopulationServedDescriptor]
ON [edfi].[InterventionStudyInterventionEffectiveness] ([PopulationServedDescriptorId] ASC)
GO
ALTER TABLE [edfi].[InterventionStudyLearningResourceMetadataURI] WITH CHECK ADD CONSTRAINT [FK_InterventionStudyLearningResourceMetadataURI_InterventionStudy] FOREIGN KEY ([EducationOrganizationId], [InterventionStudyIdentificationCode])
REFERENCES [edfi].[InterventionStudy] ([EducationOrganizationId], [InterventionStudyIdentificationCode])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_InterventionStudyLearningResourceMetadataURI_InterventionStudy]
ON [edfi].[InterventionStudyLearningResourceMetadataURI] ([EducationOrganizationId] ASC, [InterventionStudyIdentificationCode] ASC)
GO
ALTER TABLE [edfi].[InterventionStudyPopulationServed] WITH CHECK ADD CONSTRAINT [FK_InterventionStudyPopulationServed_InterventionStudy] FOREIGN KEY ([EducationOrganizationId], [InterventionStudyIdentificationCode])
REFERENCES [edfi].[InterventionStudy] ([EducationOrganizationId], [InterventionStudyIdentificationCode])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_InterventionStudyPopulationServed_InterventionStudy]
ON [edfi].[InterventionStudyPopulationServed] ([EducationOrganizationId] ASC, [InterventionStudyIdentificationCode] ASC)
GO
ALTER TABLE [edfi].[InterventionStudyPopulationServed] WITH CHECK ADD CONSTRAINT [FK_InterventionStudyPopulationServed_PopulationServedDescriptor] FOREIGN KEY ([PopulationServedDescriptorId])
REFERENCES [edfi].[PopulationServedDescriptor] ([PopulationServedDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_InterventionStudyPopulationServed_PopulationServedDescriptor]
ON [edfi].[InterventionStudyPopulationServed] ([PopulationServedDescriptorId] ASC)
GO
ALTER TABLE [edfi].[InterventionStudyStateAbbreviation] WITH CHECK ADD CONSTRAINT [FK_InterventionStudyStateAbbreviation_InterventionStudy] FOREIGN KEY ([EducationOrganizationId], [InterventionStudyIdentificationCode])
REFERENCES [edfi].[InterventionStudy] ([EducationOrganizationId], [InterventionStudyIdentificationCode])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_InterventionStudyStateAbbreviation_InterventionStudy]
ON [edfi].[InterventionStudyStateAbbreviation] ([EducationOrganizationId] ASC, [InterventionStudyIdentificationCode] ASC)
GO
ALTER TABLE [edfi].[InterventionStudyStateAbbreviation] WITH CHECK ADD CONSTRAINT [FK_InterventionStudyStateAbbreviation_StateAbbreviationDescriptor] FOREIGN KEY ([StateAbbreviationDescriptorId])
REFERENCES [edfi].[StateAbbreviationDescriptor] ([StateAbbreviationDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_InterventionStudyStateAbbreviation_StateAbbreviationDescriptor]
ON [edfi].[InterventionStudyStateAbbreviation] ([StateAbbreviationDescriptorId] ASC)
GO
ALTER TABLE [edfi].[InterventionStudyURI] WITH CHECK ADD CONSTRAINT [FK_InterventionStudyURI_InterventionStudy] FOREIGN KEY ([EducationOrganizationId], [InterventionStudyIdentificationCode])
REFERENCES [edfi].[InterventionStudy] ([EducationOrganizationId], [InterventionStudyIdentificationCode])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_InterventionStudyURI_InterventionStudy]
ON [edfi].[InterventionStudyURI] ([EducationOrganizationId] ASC, [InterventionStudyIdentificationCode] ASC)
GO
ALTER TABLE [edfi].[InterventionURI] WITH CHECK ADD CONSTRAINT [FK_InterventionURI_Intervention] FOREIGN KEY ([EducationOrganizationId], [InterventionIdentificationCode])
REFERENCES [edfi].[Intervention] ([EducationOrganizationId], [InterventionIdentificationCode])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_InterventionURI_Intervention]
ON [edfi].[InterventionURI] ([EducationOrganizationId] ASC, [InterventionIdentificationCode] ASC)
GO
ALTER TABLE [edfi].[LanguageDescriptor] WITH CHECK ADD CONSTRAINT [FK_LanguageDescriptor_Descriptor] FOREIGN KEY ([LanguageDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[LanguageInstructionProgramServiceDescriptor] WITH CHECK ADD CONSTRAINT [FK_LanguageInstructionProgramServiceDescriptor_Descriptor] FOREIGN KEY ([LanguageInstructionProgramServiceDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[LanguageUseDescriptor] WITH CHECK ADD CONSTRAINT [FK_LanguageUseDescriptor_Descriptor] FOREIGN KEY ([LanguageUseDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[LearningObjective] WITH CHECK ADD CONSTRAINT [FK_LearningObjective_LearningObjective] FOREIGN KEY ([ParentLearningObjectiveId], [ParentNamespace])
REFERENCES [edfi].[LearningObjective] ([LearningObjectiveId], [Namespace])
GO
CREATE NONCLUSTERED INDEX [FK_LearningObjective_LearningObjective]
ON [edfi].[LearningObjective] ([ParentLearningObjectiveId] ASC, [ParentNamespace] ASC)
GO
ALTER TABLE [edfi].[LearningObjectiveAcademicSubject] WITH CHECK ADD CONSTRAINT [FK_LearningObjectiveAcademicSubject_AcademicSubjectDescriptor] FOREIGN KEY ([AcademicSubjectDescriptorId])
REFERENCES [edfi].[AcademicSubjectDescriptor] ([AcademicSubjectDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_LearningObjectiveAcademicSubject_AcademicSubjectDescriptor]
ON [edfi].[LearningObjectiveAcademicSubject] ([AcademicSubjectDescriptorId] ASC)
GO
ALTER TABLE [edfi].[LearningObjectiveAcademicSubject] WITH CHECK ADD CONSTRAINT [FK_LearningObjectiveAcademicSubject_LearningObjective] FOREIGN KEY ([LearningObjectiveId], [Namespace])
REFERENCES [edfi].[LearningObjective] ([LearningObjectiveId], [Namespace])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_LearningObjectiveAcademicSubject_LearningObjective]
ON [edfi].[LearningObjectiveAcademicSubject] ([LearningObjectiveId] ASC, [Namespace] ASC)
GO
ALTER TABLE [edfi].[LearningObjectiveContentStandard] WITH CHECK ADD CONSTRAINT [FK_LearningObjectiveContentStandard_EducationOrganization] FOREIGN KEY ([MandatingEducationOrganizationId])
REFERENCES [edfi].[EducationOrganization] ([EducationOrganizationId])
GO
CREATE NONCLUSTERED INDEX [FK_LearningObjectiveContentStandard_EducationOrganization]
ON [edfi].[LearningObjectiveContentStandard] ([MandatingEducationOrganizationId] ASC)
GO
ALTER TABLE [edfi].[LearningObjectiveContentStandard] WITH CHECK ADD CONSTRAINT [FK_LearningObjectiveContentStandard_LearningObjective] FOREIGN KEY ([LearningObjectiveId], [Namespace])
REFERENCES [edfi].[LearningObjective] ([LearningObjectiveId], [Namespace])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[LearningObjectiveContentStandard] WITH CHECK ADD CONSTRAINT [FK_LearningObjectiveContentStandard_PublicationStatusDescriptor] FOREIGN KEY ([PublicationStatusDescriptorId])
REFERENCES [edfi].[PublicationStatusDescriptor] ([PublicationStatusDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_LearningObjectiveContentStandard_PublicationStatusDescriptor]
ON [edfi].[LearningObjectiveContentStandard] ([PublicationStatusDescriptorId] ASC)
GO
ALTER TABLE [edfi].[LearningObjectiveContentStandardAuthor] WITH CHECK ADD CONSTRAINT [FK_LearningObjectiveContentStandardAuthor_LearningObjectiveContentStandard] FOREIGN KEY ([LearningObjectiveId], [Namespace])
REFERENCES [edfi].[LearningObjectiveContentStandard] ([LearningObjectiveId], [Namespace])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_LearningObjectiveContentStandardAuthor_LearningObjectiveContentStandard]
ON [edfi].[LearningObjectiveContentStandardAuthor] ([LearningObjectiveId] ASC, [Namespace] ASC)
GO
ALTER TABLE [edfi].[LearningObjectiveGradeLevel] WITH CHECK ADD CONSTRAINT [FK_LearningObjectiveGradeLevel_GradeLevelDescriptor] FOREIGN KEY ([GradeLevelDescriptorId])
REFERENCES [edfi].[GradeLevelDescriptor] ([GradeLevelDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_LearningObjectiveGradeLevel_GradeLevelDescriptor]
ON [edfi].[LearningObjectiveGradeLevel] ([GradeLevelDescriptorId] ASC)
GO
ALTER TABLE [edfi].[LearningObjectiveGradeLevel] WITH CHECK ADD CONSTRAINT [FK_LearningObjectiveGradeLevel_LearningObjective] FOREIGN KEY ([LearningObjectiveId], [Namespace])
REFERENCES [edfi].[LearningObjective] ([LearningObjectiveId], [Namespace])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_LearningObjectiveGradeLevel_LearningObjective]
ON [edfi].[LearningObjectiveGradeLevel] ([LearningObjectiveId] ASC, [Namespace] ASC)
GO
ALTER TABLE [edfi].[LearningObjectiveLearningStandard] WITH CHECK ADD CONSTRAINT [FK_LearningObjectiveLearningStandard_LearningObjective] FOREIGN KEY ([LearningObjectiveId], [Namespace])
REFERENCES [edfi].[LearningObjective] ([LearningObjectiveId], [Namespace])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_LearningObjectiveLearningStandard_LearningObjective]
ON [edfi].[LearningObjectiveLearningStandard] ([LearningObjectiveId] ASC, [Namespace] ASC)
GO
ALTER TABLE [edfi].[LearningObjectiveLearningStandard] WITH CHECK ADD CONSTRAINT [FK_LearningObjectiveLearningStandard_LearningStandard] FOREIGN KEY ([LearningStandardId])
REFERENCES [edfi].[LearningStandard] ([LearningStandardId])
GO
CREATE NONCLUSTERED INDEX [FK_LearningObjectiveLearningStandard_LearningStandard]
ON [edfi].[LearningObjectiveLearningStandard] ([LearningStandardId] ASC)
GO
ALTER TABLE [edfi].[LearningStandard] WITH CHECK ADD CONSTRAINT [FK_LearningStandard_LearningStandard] FOREIGN KEY ([ParentLearningStandardId])
REFERENCES [edfi].[LearningStandard] ([LearningStandardId])
GO
CREATE NONCLUSTERED INDEX [FK_LearningStandard_LearningStandard]
ON [edfi].[LearningStandard] ([ParentLearningStandardId] ASC)
GO
ALTER TABLE [edfi].[LearningStandard] WITH CHECK ADD CONSTRAINT [FK_LearningStandard_LearningStandardCategoryDescriptor] FOREIGN KEY ([LearningStandardCategoryDescriptorId])
REFERENCES [edfi].[LearningStandardCategoryDescriptor] ([LearningStandardCategoryDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_LearningStandard_LearningStandardCategoryDescriptor]
ON [edfi].[LearningStandard] ([LearningStandardCategoryDescriptorId] ASC)
GO
ALTER TABLE [edfi].[LearningStandard] WITH CHECK ADD CONSTRAINT [FK_LearningStandard_LearningStandardScopeDescriptor] FOREIGN KEY ([LearningStandardScopeDescriptorId])
REFERENCES [edfi].[LearningStandardScopeDescriptor] ([LearningStandardScopeDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_LearningStandard_LearningStandardScopeDescriptor]
ON [edfi].[LearningStandard] ([LearningStandardScopeDescriptorId] ASC)
GO
ALTER TABLE [edfi].[LearningStandardAcademicSubject] WITH CHECK ADD CONSTRAINT [FK_LearningStandardAcademicSubject_AcademicSubjectDescriptor] FOREIGN KEY ([AcademicSubjectDescriptorId])
REFERENCES [edfi].[AcademicSubjectDescriptor] ([AcademicSubjectDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_LearningStandardAcademicSubject_AcademicSubjectDescriptor]
ON [edfi].[LearningStandardAcademicSubject] ([AcademicSubjectDescriptorId] ASC)
GO
ALTER TABLE [edfi].[LearningStandardAcademicSubject] WITH CHECK ADD CONSTRAINT [FK_LearningStandardAcademicSubject_LearningStandard] FOREIGN KEY ([LearningStandardId])
REFERENCES [edfi].[LearningStandard] ([LearningStandardId])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_LearningStandardAcademicSubject_LearningStandard]
ON [edfi].[LearningStandardAcademicSubject] ([LearningStandardId] ASC)
GO
ALTER TABLE [edfi].[LearningStandardCategoryDescriptor] WITH CHECK ADD CONSTRAINT [FK_LearningStandardCategoryDescriptor_Descriptor] FOREIGN KEY ([LearningStandardCategoryDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[LearningStandardContentStandard] WITH CHECK ADD CONSTRAINT [FK_LearningStandardContentStandard_EducationOrganization] FOREIGN KEY ([MandatingEducationOrganizationId])
REFERENCES [edfi].[EducationOrganization] ([EducationOrganizationId])
GO
CREATE NONCLUSTERED INDEX [FK_LearningStandardContentStandard_EducationOrganization]
ON [edfi].[LearningStandardContentStandard] ([MandatingEducationOrganizationId] ASC)
GO
ALTER TABLE [edfi].[LearningStandardContentStandard] WITH CHECK ADD CONSTRAINT [FK_LearningStandardContentStandard_LearningStandard] FOREIGN KEY ([LearningStandardId])
REFERENCES [edfi].[LearningStandard] ([LearningStandardId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[LearningStandardContentStandard] WITH CHECK ADD CONSTRAINT [FK_LearningStandardContentStandard_PublicationStatusDescriptor] FOREIGN KEY ([PublicationStatusDescriptorId])
REFERENCES [edfi].[PublicationStatusDescriptor] ([PublicationStatusDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_LearningStandardContentStandard_PublicationStatusDescriptor]
ON [edfi].[LearningStandardContentStandard] ([PublicationStatusDescriptorId] ASC)
GO
ALTER TABLE [edfi].[LearningStandardContentStandardAuthor] WITH CHECK ADD CONSTRAINT [FK_LearningStandardContentStandardAuthor_LearningStandardContentStandard] FOREIGN KEY ([LearningStandardId])
REFERENCES [edfi].[LearningStandardContentStandard] ([LearningStandardId])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_LearningStandardContentStandardAuthor_LearningStandardContentStandard]
ON [edfi].[LearningStandardContentStandardAuthor] ([LearningStandardId] ASC)
GO
ALTER TABLE [edfi].[LearningStandardEquivalenceAssociation] WITH CHECK ADD CONSTRAINT [FK_LearningStandardEquivalenceAssociation_LearningStandard] FOREIGN KEY ([SourceLearningStandardId])
REFERENCES [edfi].[LearningStandard] ([LearningStandardId])
GO
CREATE NONCLUSTERED INDEX [FK_LearningStandardEquivalenceAssociation_LearningStandard]
ON [edfi].[LearningStandardEquivalenceAssociation] ([SourceLearningStandardId] ASC)
GO
ALTER TABLE [edfi].[LearningStandardEquivalenceAssociation] WITH CHECK ADD CONSTRAINT [FK_LearningStandardEquivalenceAssociation_LearningStandard1] FOREIGN KEY ([TargetLearningStandardId])
REFERENCES [edfi].[LearningStandard] ([LearningStandardId])
GO
CREATE NONCLUSTERED INDEX [FK_LearningStandardEquivalenceAssociation_LearningStandard1]
ON [edfi].[LearningStandardEquivalenceAssociation] ([TargetLearningStandardId] ASC)
GO
ALTER TABLE [edfi].[LearningStandardEquivalenceAssociation] WITH CHECK ADD CONSTRAINT [FK_LearningStandardEquivalenceAssociation_LearningStandardEquivalenceStrengthDescriptor] FOREIGN KEY ([LearningStandardEquivalenceStrengthDescriptorId])
REFERENCES [edfi].[LearningStandardEquivalenceStrengthDescriptor] ([LearningStandardEquivalenceStrengthDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_LearningStandardEquivalenceAssociation_LearningStandardEquivalenceStrengthDescriptor]
ON [edfi].[LearningStandardEquivalenceAssociation] ([LearningStandardEquivalenceStrengthDescriptorId] ASC)
GO
ALTER TABLE [edfi].[LearningStandardEquivalenceStrengthDescriptor] WITH CHECK ADD CONSTRAINT [FK_LearningStandardEquivalenceStrengthDescriptor_Descriptor] FOREIGN KEY ([LearningStandardEquivalenceStrengthDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[LearningStandardGradeLevel] WITH CHECK ADD CONSTRAINT [FK_LearningStandardGradeLevel_GradeLevelDescriptor] FOREIGN KEY ([GradeLevelDescriptorId])
REFERENCES [edfi].[GradeLevelDescriptor] ([GradeLevelDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_LearningStandardGradeLevel_GradeLevelDescriptor]
ON [edfi].[LearningStandardGradeLevel] ([GradeLevelDescriptorId] ASC)
GO
ALTER TABLE [edfi].[LearningStandardGradeLevel] WITH CHECK ADD CONSTRAINT [FK_LearningStandardGradeLevel_LearningStandard] FOREIGN KEY ([LearningStandardId])
REFERENCES [edfi].[LearningStandard] ([LearningStandardId])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_LearningStandardGradeLevel_LearningStandard]
ON [edfi].[LearningStandardGradeLevel] ([LearningStandardId] ASC)
GO
ALTER TABLE [edfi].[LearningStandardIdentificationCode] WITH CHECK ADD CONSTRAINT [FK_LearningStandardIdentificationCode_LearningStandard] FOREIGN KEY ([LearningStandardId])
REFERENCES [edfi].[LearningStandard] ([LearningStandardId])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_LearningStandardIdentificationCode_LearningStandard]
ON [edfi].[LearningStandardIdentificationCode] ([LearningStandardId] ASC)
GO
ALTER TABLE [edfi].[LearningStandardPrerequisiteLearningStandard] WITH CHECK ADD CONSTRAINT [FK_LearningStandardPrerequisiteLearningStandard_LearningStandard] FOREIGN KEY ([LearningStandardId])
REFERENCES [edfi].[LearningStandard] ([LearningStandardId])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_LearningStandardPrerequisiteLearningStandard_LearningStandard]
ON [edfi].[LearningStandardPrerequisiteLearningStandard] ([LearningStandardId] ASC)
GO
ALTER TABLE [edfi].[LearningStandardPrerequisiteLearningStandard] WITH CHECK ADD CONSTRAINT [FK_LearningStandardPrerequisiteLearningStandard_LearningStandard1] FOREIGN KEY ([PrerequisiteLearningStandardId])
REFERENCES [edfi].[LearningStandard] ([LearningStandardId])
GO
CREATE NONCLUSTERED INDEX [FK_LearningStandardPrerequisiteLearningStandard_LearningStandard1]
ON [edfi].[LearningStandardPrerequisiteLearningStandard] ([PrerequisiteLearningStandardId] ASC)
GO
ALTER TABLE [edfi].[LearningStandardScopeDescriptor] WITH CHECK ADD CONSTRAINT [FK_LearningStandardScopeDescriptor_Descriptor] FOREIGN KEY ([LearningStandardScopeDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[LevelOfEducationDescriptor] WITH CHECK ADD CONSTRAINT [FK_LevelOfEducationDescriptor_Descriptor] FOREIGN KEY ([LevelOfEducationDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[LicenseStatusDescriptor] WITH CHECK ADD CONSTRAINT [FK_LicenseStatusDescriptor_Descriptor] FOREIGN KEY ([LicenseStatusDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[LicenseTypeDescriptor] WITH CHECK ADD CONSTRAINT [FK_LicenseTypeDescriptor_Descriptor] FOREIGN KEY ([LicenseTypeDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[LimitedEnglishProficiencyDescriptor] WITH CHECK ADD CONSTRAINT [FK_LimitedEnglishProficiencyDescriptor_Descriptor] FOREIGN KEY ([LimitedEnglishProficiencyDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[LocaleDescriptor] WITH CHECK ADD CONSTRAINT [FK_LocaleDescriptor_Descriptor] FOREIGN KEY ([LocaleDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[LocalEducationAgency] WITH CHECK ADD CONSTRAINT [FK_LocalEducationAgency_CharterStatusDescriptor] FOREIGN KEY ([CharterStatusDescriptorId])
REFERENCES [edfi].[CharterStatusDescriptor] ([CharterStatusDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_LocalEducationAgency_CharterStatusDescriptor]
ON [edfi].[LocalEducationAgency] ([CharterStatusDescriptorId] ASC)
GO
ALTER TABLE [edfi].[LocalEducationAgency] WITH CHECK ADD CONSTRAINT [FK_LocalEducationAgency_EducationOrganization] FOREIGN KEY ([LocalEducationAgencyId])
REFERENCES [edfi].[EducationOrganization] ([EducationOrganizationId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[LocalEducationAgency] WITH CHECK ADD CONSTRAINT [FK_LocalEducationAgency_EducationServiceCenter] FOREIGN KEY ([EducationServiceCenterId])
REFERENCES [edfi].[EducationServiceCenter] ([EducationServiceCenterId])
GO
CREATE NONCLUSTERED INDEX [FK_LocalEducationAgency_EducationServiceCenter]
ON [edfi].[LocalEducationAgency] ([EducationServiceCenterId] ASC)
GO
ALTER TABLE [edfi].[LocalEducationAgency] WITH CHECK ADD CONSTRAINT [FK_LocalEducationAgency_LocalEducationAgency] FOREIGN KEY ([ParentLocalEducationAgencyId])
REFERENCES [edfi].[LocalEducationAgency] ([LocalEducationAgencyId])
GO
CREATE NONCLUSTERED INDEX [FK_LocalEducationAgency_LocalEducationAgency]
ON [edfi].[LocalEducationAgency] ([ParentLocalEducationAgencyId] ASC)
GO
ALTER TABLE [edfi].[LocalEducationAgency] WITH CHECK ADD CONSTRAINT [FK_LocalEducationAgency_LocalEducationAgencyCategoryDescriptor] FOREIGN KEY ([LocalEducationAgencyCategoryDescriptorId])
REFERENCES [edfi].[LocalEducationAgencyCategoryDescriptor] ([LocalEducationAgencyCategoryDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_LocalEducationAgency_LocalEducationAgencyCategoryDescriptor]
ON [edfi].[LocalEducationAgency] ([LocalEducationAgencyCategoryDescriptorId] ASC)
GO
ALTER TABLE [edfi].[LocalEducationAgency] WITH CHECK ADD CONSTRAINT [FK_LocalEducationAgency_StateEducationAgency] FOREIGN KEY ([StateEducationAgencyId])
REFERENCES [edfi].[StateEducationAgency] ([StateEducationAgencyId])
GO
CREATE NONCLUSTERED INDEX [FK_LocalEducationAgency_StateEducationAgency]
ON [edfi].[LocalEducationAgency] ([StateEducationAgencyId] ASC)
GO
ALTER TABLE [edfi].[LocalEducationAgencyAccountability] WITH CHECK ADD CONSTRAINT [FK_LocalEducationAgencyAccountability_GunFreeSchoolsActReportingStatusDescriptor] FOREIGN KEY ([GunFreeSchoolsActReportingStatusDescriptorId])
REFERENCES [edfi].[GunFreeSchoolsActReportingStatusDescriptor] ([GunFreeSchoolsActReportingStatusDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_LocalEducationAgencyAccountability_GunFreeSchoolsActReportingStatusDescriptor]
ON [edfi].[LocalEducationAgencyAccountability] ([GunFreeSchoolsActReportingStatusDescriptorId] ASC)
GO
ALTER TABLE [edfi].[LocalEducationAgencyAccountability] WITH CHECK ADD CONSTRAINT [FK_LocalEducationAgencyAccountability_LocalEducationAgency] FOREIGN KEY ([LocalEducationAgencyId])
REFERENCES [edfi].[LocalEducationAgency] ([LocalEducationAgencyId])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_LocalEducationAgencyAccountability_LocalEducationAgency]
ON [edfi].[LocalEducationAgencyAccountability] ([LocalEducationAgencyId] ASC)
GO
ALTER TABLE [edfi].[LocalEducationAgencyAccountability] WITH CHECK ADD CONSTRAINT [FK_LocalEducationAgencyAccountability_SchoolChoiceImplementStatusDescriptor] FOREIGN KEY ([SchoolChoiceImplementStatusDescriptorId])
REFERENCES [edfi].[SchoolChoiceImplementStatusDescriptor] ([SchoolChoiceImplementStatusDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_LocalEducationAgencyAccountability_SchoolChoiceImplementStatusDescriptor]
ON [edfi].[LocalEducationAgencyAccountability] ([SchoolChoiceImplementStatusDescriptorId] ASC)
GO
ALTER TABLE [edfi].[LocalEducationAgencyAccountability] WITH CHECK ADD CONSTRAINT [FK_LocalEducationAgencyAccountability_SchoolYearType] FOREIGN KEY ([SchoolYear])
REFERENCES [edfi].[SchoolYearType] ([SchoolYear])
GO
CREATE NONCLUSTERED INDEX [FK_LocalEducationAgencyAccountability_SchoolYearType]
ON [edfi].[LocalEducationAgencyAccountability] ([SchoolYear] ASC)
GO
ALTER TABLE [edfi].[LocalEducationAgencyCategoryDescriptor] WITH CHECK ADD CONSTRAINT [FK_LocalEducationAgencyCategoryDescriptor_Descriptor] FOREIGN KEY ([LocalEducationAgencyCategoryDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[LocalEducationAgencyFederalFunds] WITH CHECK ADD CONSTRAINT [FK_LocalEducationAgencyFederalFunds_LocalEducationAgency] FOREIGN KEY ([LocalEducationAgencyId])
REFERENCES [edfi].[LocalEducationAgency] ([LocalEducationAgencyId])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_LocalEducationAgencyFederalFunds_LocalEducationAgency]
ON [edfi].[LocalEducationAgencyFederalFunds] ([LocalEducationAgencyId] ASC)
GO
ALTER TABLE [edfi].[Location] WITH CHECK ADD CONSTRAINT [FK_Location_School] FOREIGN KEY ([SchoolId])
REFERENCES [edfi].[School] ([SchoolId])
GO
CREATE NONCLUSTERED INDEX [FK_Location_School]
ON [edfi].[Location] ([SchoolId] ASC)
GO
ALTER TABLE [edfi].[MagnetSpecialProgramEmphasisSchoolDescriptor] WITH CHECK ADD CONSTRAINT [FK_MagnetSpecialProgramEmphasisSchoolDescriptor_Descriptor] FOREIGN KEY ([MagnetSpecialProgramEmphasisSchoolDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[MediumOfInstructionDescriptor] WITH CHECK ADD CONSTRAINT [FK_MediumOfInstructionDescriptor_Descriptor] FOREIGN KEY ([MediumOfInstructionDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[MethodCreditEarnedDescriptor] WITH CHECK ADD CONSTRAINT [FK_MethodCreditEarnedDescriptor_Descriptor] FOREIGN KEY ([MethodCreditEarnedDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[MigrantEducationProgramServiceDescriptor] WITH CHECK ADD CONSTRAINT [FK_MigrantEducationProgramServiceDescriptor_Descriptor] FOREIGN KEY ([MigrantEducationProgramServiceDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[MonitoredDescriptor] WITH CHECK ADD CONSTRAINT [FK_MonitoredDescriptor_Descriptor] FOREIGN KEY ([MonitoredDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[NeglectedOrDelinquentProgramDescriptor] WITH CHECK ADD CONSTRAINT [FK_NeglectedOrDelinquentProgramDescriptor_Descriptor] FOREIGN KEY ([NeglectedOrDelinquentProgramDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[NeglectedOrDelinquentProgramServiceDescriptor] WITH CHECK ADD CONSTRAINT [FK_NeglectedOrDelinquentProgramServiceDescriptor_Descriptor] FOREIGN KEY ([NeglectedOrDelinquentProgramServiceDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[NetworkPurposeDescriptor] WITH CHECK ADD CONSTRAINT [FK_NetworkPurposeDescriptor_Descriptor] FOREIGN KEY ([NetworkPurposeDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[ObjectiveAssessment] WITH CHECK ADD CONSTRAINT [FK_ObjectiveAssessment_AcademicSubjectDescriptor] FOREIGN KEY ([AcademicSubjectDescriptorId])
REFERENCES [edfi].[AcademicSubjectDescriptor] ([AcademicSubjectDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_ObjectiveAssessment_AcademicSubjectDescriptor]
ON [edfi].[ObjectiveAssessment] ([AcademicSubjectDescriptorId] ASC)
GO
ALTER TABLE [edfi].[ObjectiveAssessment] WITH CHECK ADD CONSTRAINT [FK_ObjectiveAssessment_Assessment] FOREIGN KEY ([AssessmentIdentifier], [Namespace])
REFERENCES [edfi].[Assessment] ([AssessmentIdentifier], [Namespace])
GO
CREATE NONCLUSTERED INDEX [FK_ObjectiveAssessment_Assessment]
ON [edfi].[ObjectiveAssessment] ([AssessmentIdentifier] ASC, [Namespace] ASC)
GO
ALTER TABLE [edfi].[ObjectiveAssessment] WITH CHECK ADD CONSTRAINT [FK_ObjectiveAssessment_ObjectiveAssessment] FOREIGN KEY ([AssessmentIdentifier], [ParentIdentificationCode], [Namespace])
REFERENCES [edfi].[ObjectiveAssessment] ([AssessmentIdentifier], [IdentificationCode], [Namespace])
GO
CREATE NONCLUSTERED INDEX [FK_ObjectiveAssessment_ObjectiveAssessment]
ON [edfi].[ObjectiveAssessment] ([AssessmentIdentifier] ASC, [ParentIdentificationCode] ASC, [Namespace] ASC)
GO
ALTER TABLE [edfi].[ObjectiveAssessmentAssessmentItem] WITH CHECK ADD CONSTRAINT [FK_ObjectiveAssessmentAssessmentItem_AssessmentItem] FOREIGN KEY ([AssessmentIdentifier], [AssessmentItemIdentificationCode], [Namespace])
REFERENCES [edfi].[AssessmentItem] ([AssessmentIdentifier], [IdentificationCode], [Namespace])
GO
CREATE NONCLUSTERED INDEX [FK_ObjectiveAssessmentAssessmentItem_AssessmentItem]
ON [edfi].[ObjectiveAssessmentAssessmentItem] ([AssessmentIdentifier] ASC, [AssessmentItemIdentificationCode] ASC, [Namespace] ASC)
GO
ALTER TABLE [edfi].[ObjectiveAssessmentAssessmentItem] WITH CHECK ADD CONSTRAINT [FK_ObjectiveAssessmentAssessmentItem_ObjectiveAssessment] FOREIGN KEY ([AssessmentIdentifier], [IdentificationCode], [Namespace])
REFERENCES [edfi].[ObjectiveAssessment] ([AssessmentIdentifier], [IdentificationCode], [Namespace])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_ObjectiveAssessmentAssessmentItem_ObjectiveAssessment]
ON [edfi].[ObjectiveAssessmentAssessmentItem] ([AssessmentIdentifier] ASC, [IdentificationCode] ASC, [Namespace] ASC)
GO
ALTER TABLE [edfi].[ObjectiveAssessmentLearningObjective] WITH CHECK ADD CONSTRAINT [FK_ObjectiveAssessmentLearningObjective_LearningObjective] FOREIGN KEY ([LearningObjectiveId], [LearningObjectiveNamespace])
REFERENCES [edfi].[LearningObjective] ([LearningObjectiveId], [Namespace])
GO
CREATE NONCLUSTERED INDEX [FK_ObjectiveAssessmentLearningObjective_LearningObjective]
ON [edfi].[ObjectiveAssessmentLearningObjective] ([LearningObjectiveId] ASC, [LearningObjectiveNamespace] ASC)
GO
ALTER TABLE [edfi].[ObjectiveAssessmentLearningObjective] WITH CHECK ADD CONSTRAINT [FK_ObjectiveAssessmentLearningObjective_ObjectiveAssessment] FOREIGN KEY ([AssessmentIdentifier], [IdentificationCode], [Namespace])
REFERENCES [edfi].[ObjectiveAssessment] ([AssessmentIdentifier], [IdentificationCode], [Namespace])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_ObjectiveAssessmentLearningObjective_ObjectiveAssessment]
ON [edfi].[ObjectiveAssessmentLearningObjective] ([AssessmentIdentifier] ASC, [IdentificationCode] ASC, [Namespace] ASC)
GO
ALTER TABLE [edfi].[ObjectiveAssessmentLearningStandard] WITH CHECK ADD CONSTRAINT [FK_ObjectiveAssessmentLearningStandard_LearningStandard] FOREIGN KEY ([LearningStandardId])
REFERENCES [edfi].[LearningStandard] ([LearningStandardId])
GO
CREATE NONCLUSTERED INDEX [FK_ObjectiveAssessmentLearningStandard_LearningStandard]
ON [edfi].[ObjectiveAssessmentLearningStandard] ([LearningStandardId] ASC)
GO
ALTER TABLE [edfi].[ObjectiveAssessmentLearningStandard] WITH CHECK ADD CONSTRAINT [FK_ObjectiveAssessmentLearningStandard_ObjectiveAssessment] FOREIGN KEY ([AssessmentIdentifier], [IdentificationCode], [Namespace])
REFERENCES [edfi].[ObjectiveAssessment] ([AssessmentIdentifier], [IdentificationCode], [Namespace])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_ObjectiveAssessmentLearningStandard_ObjectiveAssessment]
ON [edfi].[ObjectiveAssessmentLearningStandard] ([AssessmentIdentifier] ASC, [IdentificationCode] ASC, [Namespace] ASC)
GO
ALTER TABLE [edfi].[ObjectiveAssessmentPerformanceLevel] WITH CHECK ADD CONSTRAINT [FK_ObjectiveAssessmentPerformanceLevel_AssessmentReportingMethodDescriptor] FOREIGN KEY ([AssessmentReportingMethodDescriptorId])
REFERENCES [edfi].[AssessmentReportingMethodDescriptor] ([AssessmentReportingMethodDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_ObjectiveAssessmentPerformanceLevel_AssessmentReportingMethodDescriptor]
ON [edfi].[ObjectiveAssessmentPerformanceLevel] ([AssessmentReportingMethodDescriptorId] ASC)
GO
ALTER TABLE [edfi].[ObjectiveAssessmentPerformanceLevel] WITH CHECK ADD CONSTRAINT [FK_ObjectiveAssessmentPerformanceLevel_ObjectiveAssessment] FOREIGN KEY ([AssessmentIdentifier], [IdentificationCode], [Namespace])
REFERENCES [edfi].[ObjectiveAssessment] ([AssessmentIdentifier], [IdentificationCode], [Namespace])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_ObjectiveAssessmentPerformanceLevel_ObjectiveAssessment]
ON [edfi].[ObjectiveAssessmentPerformanceLevel] ([AssessmentIdentifier] ASC, [IdentificationCode] ASC, [Namespace] ASC)
GO
ALTER TABLE [edfi].[ObjectiveAssessmentPerformanceLevel] WITH CHECK ADD CONSTRAINT [FK_ObjectiveAssessmentPerformanceLevel_PerformanceLevelDescriptor] FOREIGN KEY ([PerformanceLevelDescriptorId])
REFERENCES [edfi].[PerformanceLevelDescriptor] ([PerformanceLevelDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_ObjectiveAssessmentPerformanceLevel_PerformanceLevelDescriptor]
ON [edfi].[ObjectiveAssessmentPerformanceLevel] ([PerformanceLevelDescriptorId] ASC)
GO
ALTER TABLE [edfi].[ObjectiveAssessmentPerformanceLevel] WITH CHECK ADD CONSTRAINT [FK_ObjectiveAssessmentPerformanceLevel_ResultDatatypeTypeDescriptor] FOREIGN KEY ([ResultDatatypeTypeDescriptorId])
REFERENCES [edfi].[ResultDatatypeTypeDescriptor] ([ResultDatatypeTypeDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_ObjectiveAssessmentPerformanceLevel_ResultDatatypeTypeDescriptor]
ON [edfi].[ObjectiveAssessmentPerformanceLevel] ([ResultDatatypeTypeDescriptorId] ASC)
GO
ALTER TABLE [edfi].[ObjectiveAssessmentScore] WITH CHECK ADD CONSTRAINT [FK_ObjectiveAssessmentScore_AssessmentReportingMethodDescriptor] FOREIGN KEY ([AssessmentReportingMethodDescriptorId])
REFERENCES [edfi].[AssessmentReportingMethodDescriptor] ([AssessmentReportingMethodDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_ObjectiveAssessmentScore_AssessmentReportingMethodDescriptor]
ON [edfi].[ObjectiveAssessmentScore] ([AssessmentReportingMethodDescriptorId] ASC)
GO
ALTER TABLE [edfi].[ObjectiveAssessmentScore] WITH CHECK ADD CONSTRAINT [FK_ObjectiveAssessmentScore_ObjectiveAssessment] FOREIGN KEY ([AssessmentIdentifier], [IdentificationCode], [Namespace])
REFERENCES [edfi].[ObjectiveAssessment] ([AssessmentIdentifier], [IdentificationCode], [Namespace])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_ObjectiveAssessmentScore_ObjectiveAssessment]
ON [edfi].[ObjectiveAssessmentScore] ([AssessmentIdentifier] ASC, [IdentificationCode] ASC, [Namespace] ASC)
GO
ALTER TABLE [edfi].[ObjectiveAssessmentScore] WITH CHECK ADD CONSTRAINT [FK_ObjectiveAssessmentScore_ResultDatatypeTypeDescriptor] FOREIGN KEY ([ResultDatatypeTypeDescriptorId])
REFERENCES [edfi].[ResultDatatypeTypeDescriptor] ([ResultDatatypeTypeDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_ObjectiveAssessmentScore_ResultDatatypeTypeDescriptor]
ON [edfi].[ObjectiveAssessmentScore] ([ResultDatatypeTypeDescriptorId] ASC)
GO
ALTER TABLE [edfi].[OldEthnicityDescriptor] WITH CHECK ADD CONSTRAINT [FK_OldEthnicityDescriptor_Descriptor] FOREIGN KEY ([OldEthnicityDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[OpenStaffPosition] WITH CHECK ADD CONSTRAINT [FK_OpenStaffPosition_EducationOrganization] FOREIGN KEY ([EducationOrganizationId])
REFERENCES [edfi].[EducationOrganization] ([EducationOrganizationId])
GO
CREATE NONCLUSTERED INDEX [FK_OpenStaffPosition_EducationOrganization]
ON [edfi].[OpenStaffPosition] ([EducationOrganizationId] ASC)
GO
ALTER TABLE [edfi].[OpenStaffPosition] WITH CHECK ADD CONSTRAINT [FK_OpenStaffPosition_EmploymentStatusDescriptor] FOREIGN KEY ([EmploymentStatusDescriptorId])
REFERENCES [edfi].[EmploymentStatusDescriptor] ([EmploymentStatusDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_OpenStaffPosition_EmploymentStatusDescriptor]
ON [edfi].[OpenStaffPosition] ([EmploymentStatusDescriptorId] ASC)
GO
ALTER TABLE [edfi].[OpenStaffPosition] WITH CHECK ADD CONSTRAINT [FK_OpenStaffPosition_PostingResultDescriptor] FOREIGN KEY ([PostingResultDescriptorId])
REFERENCES [edfi].[PostingResultDescriptor] ([PostingResultDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_OpenStaffPosition_PostingResultDescriptor]
ON [edfi].[OpenStaffPosition] ([PostingResultDescriptorId] ASC)
GO
ALTER TABLE [edfi].[OpenStaffPosition] WITH CHECK ADD CONSTRAINT [FK_OpenStaffPosition_ProgramAssignmentDescriptor] FOREIGN KEY ([ProgramAssignmentDescriptorId])
REFERENCES [edfi].[ProgramAssignmentDescriptor] ([ProgramAssignmentDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_OpenStaffPosition_ProgramAssignmentDescriptor]
ON [edfi].[OpenStaffPosition] ([ProgramAssignmentDescriptorId] ASC)
GO
ALTER TABLE [edfi].[OpenStaffPosition] WITH CHECK ADD CONSTRAINT [FK_OpenStaffPosition_StaffClassificationDescriptor] FOREIGN KEY ([StaffClassificationDescriptorId])
REFERENCES [edfi].[StaffClassificationDescriptor] ([StaffClassificationDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_OpenStaffPosition_StaffClassificationDescriptor]
ON [edfi].[OpenStaffPosition] ([StaffClassificationDescriptorId] ASC)
GO
ALTER TABLE [edfi].[OpenStaffPositionAcademicSubject] WITH CHECK ADD CONSTRAINT [FK_OpenStaffPositionAcademicSubject_AcademicSubjectDescriptor] FOREIGN KEY ([AcademicSubjectDescriptorId])
REFERENCES [edfi].[AcademicSubjectDescriptor] ([AcademicSubjectDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_OpenStaffPositionAcademicSubject_AcademicSubjectDescriptor]
ON [edfi].[OpenStaffPositionAcademicSubject] ([AcademicSubjectDescriptorId] ASC)
GO
ALTER TABLE [edfi].[OpenStaffPositionAcademicSubject] WITH CHECK ADD CONSTRAINT [FK_OpenStaffPositionAcademicSubject_OpenStaffPosition] FOREIGN KEY ([EducationOrganizationId], [RequisitionNumber])
REFERENCES [edfi].[OpenStaffPosition] ([EducationOrganizationId], [RequisitionNumber])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_OpenStaffPositionAcademicSubject_OpenStaffPosition]
ON [edfi].[OpenStaffPositionAcademicSubject] ([EducationOrganizationId] ASC, [RequisitionNumber] ASC)
GO
ALTER TABLE [edfi].[OpenStaffPositionInstructionalGradeLevel] WITH CHECK ADD CONSTRAINT [FK_OpenStaffPositionInstructionalGradeLevel_GradeLevelDescriptor] FOREIGN KEY ([GradeLevelDescriptorId])
REFERENCES [edfi].[GradeLevelDescriptor] ([GradeLevelDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_OpenStaffPositionInstructionalGradeLevel_GradeLevelDescriptor]
ON [edfi].[OpenStaffPositionInstructionalGradeLevel] ([GradeLevelDescriptorId] ASC)
GO
ALTER TABLE [edfi].[OpenStaffPositionInstructionalGradeLevel] WITH CHECK ADD CONSTRAINT [FK_OpenStaffPositionInstructionalGradeLevel_OpenStaffPosition] FOREIGN KEY ([EducationOrganizationId], [RequisitionNumber])
REFERENCES [edfi].[OpenStaffPosition] ([EducationOrganizationId], [RequisitionNumber])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_OpenStaffPositionInstructionalGradeLevel_OpenStaffPosition]
ON [edfi].[OpenStaffPositionInstructionalGradeLevel] ([EducationOrganizationId] ASC, [RequisitionNumber] ASC)
GO
ALTER TABLE [edfi].[OperationalStatusDescriptor] WITH CHECK ADD CONSTRAINT [FK_OperationalStatusDescriptor_Descriptor] FOREIGN KEY ([OperationalStatusDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[OrganizationDepartment] WITH CHECK ADD CONSTRAINT [FK_OrganizationDepartment_AcademicSubjectDescriptor] FOREIGN KEY ([AcademicSubjectDescriptorId])
REFERENCES [edfi].[AcademicSubjectDescriptor] ([AcademicSubjectDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_OrganizationDepartment_AcademicSubjectDescriptor]
ON [edfi].[OrganizationDepartment] ([AcademicSubjectDescriptorId] ASC)
GO
ALTER TABLE [edfi].[OrganizationDepartment] WITH CHECK ADD CONSTRAINT [FK_OrganizationDepartment_EducationOrganization] FOREIGN KEY ([OrganizationDepartmentId])
REFERENCES [edfi].[EducationOrganization] ([EducationOrganizationId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[OrganizationDepartment] WITH CHECK ADD CONSTRAINT [FK_OrganizationDepartment_EducationOrganization1] FOREIGN KEY ([ParentEducationOrganizationId])
REFERENCES [edfi].[EducationOrganization] ([EducationOrganizationId])
GO
CREATE NONCLUSTERED INDEX [FK_OrganizationDepartment_EducationOrganization1]
ON [edfi].[OrganizationDepartment] ([ParentEducationOrganizationId] ASC)
GO
ALTER TABLE [edfi].[OtherNameTypeDescriptor] WITH CHECK ADD CONSTRAINT [FK_OtherNameTypeDescriptor_Descriptor] FOREIGN KEY ([OtherNameTypeDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[Parent] WITH CHECK ADD CONSTRAINT [FK_Parent_LevelOfEducationDescriptor] FOREIGN KEY ([HighestCompletedLevelOfEducationDescriptorId])
REFERENCES [edfi].[LevelOfEducationDescriptor] ([LevelOfEducationDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_Parent_LevelOfEducationDescriptor]
ON [edfi].[Parent] ([HighestCompletedLevelOfEducationDescriptorId] ASC)
GO
ALTER TABLE [edfi].[Parent] WITH CHECK ADD CONSTRAINT [FK_Parent_Person] FOREIGN KEY ([PersonId], [SourceSystemDescriptorId])
REFERENCES [edfi].[Person] ([PersonId], [SourceSystemDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_Parent_Person]
ON [edfi].[Parent] ([PersonId] ASC, [SourceSystemDescriptorId] ASC)
GO
ALTER TABLE [edfi].[Parent] WITH CHECK ADD CONSTRAINT [FK_Parent_SexDescriptor] FOREIGN KEY ([SexDescriptorId])
REFERENCES [edfi].[SexDescriptor] ([SexDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_Parent_SexDescriptor]
ON [edfi].[Parent] ([SexDescriptorId] ASC)
GO
ALTER TABLE [edfi].[ParentAddress] WITH CHECK ADD CONSTRAINT [FK_ParentAddress_AddressTypeDescriptor] FOREIGN KEY ([AddressTypeDescriptorId])
REFERENCES [edfi].[AddressTypeDescriptor] ([AddressTypeDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_ParentAddress_AddressTypeDescriptor]
ON [edfi].[ParentAddress] ([AddressTypeDescriptorId] ASC)
GO
ALTER TABLE [edfi].[ParentAddress] WITH CHECK ADD CONSTRAINT [FK_ParentAddress_LocaleDescriptor] FOREIGN KEY ([LocaleDescriptorId])
REFERENCES [edfi].[LocaleDescriptor] ([LocaleDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_ParentAddress_LocaleDescriptor]
ON [edfi].[ParentAddress] ([LocaleDescriptorId] ASC)
GO
ALTER TABLE [edfi].[ParentAddress] WITH CHECK ADD CONSTRAINT [FK_ParentAddress_Parent] FOREIGN KEY ([ParentUSI])
REFERENCES [edfi].[Parent] ([ParentUSI])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_ParentAddress_Parent]
ON [edfi].[ParentAddress] ([ParentUSI] ASC)
GO
ALTER TABLE [edfi].[ParentAddress] WITH CHECK ADD CONSTRAINT [FK_ParentAddress_StateAbbreviationDescriptor] FOREIGN KEY ([StateAbbreviationDescriptorId])
REFERENCES [edfi].[StateAbbreviationDescriptor] ([StateAbbreviationDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_ParentAddress_StateAbbreviationDescriptor]
ON [edfi].[ParentAddress] ([StateAbbreviationDescriptorId] ASC)
GO
ALTER TABLE [edfi].[ParentAddressPeriod] WITH CHECK ADD CONSTRAINT [FK_ParentAddressPeriod_ParentAddress] FOREIGN KEY ([AddressTypeDescriptorId], [City], [ParentUSI], [PostalCode], [StateAbbreviationDescriptorId], [StreetNumberName])
REFERENCES [edfi].[ParentAddress] ([AddressTypeDescriptorId], [City], [ParentUSI], [PostalCode], [StateAbbreviationDescriptorId], [StreetNumberName])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_ParentAddressPeriod_ParentAddress]
ON [edfi].[ParentAddressPeriod] ([AddressTypeDescriptorId] ASC, [City] ASC, [ParentUSI] ASC, [PostalCode] ASC, [StateAbbreviationDescriptorId] ASC, [StreetNumberName] ASC)
GO
ALTER TABLE [edfi].[ParentElectronicMail] WITH CHECK ADD CONSTRAINT [FK_ParentElectronicMail_ElectronicMailTypeDescriptor] FOREIGN KEY ([ElectronicMailTypeDescriptorId])
REFERENCES [edfi].[ElectronicMailTypeDescriptor] ([ElectronicMailTypeDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_ParentElectronicMail_ElectronicMailTypeDescriptor]
ON [edfi].[ParentElectronicMail] ([ElectronicMailTypeDescriptorId] ASC)
GO
ALTER TABLE [edfi].[ParentElectronicMail] WITH CHECK ADD CONSTRAINT [FK_ParentElectronicMail_Parent] FOREIGN KEY ([ParentUSI])
REFERENCES [edfi].[Parent] ([ParentUSI])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_ParentElectronicMail_Parent]
ON [edfi].[ParentElectronicMail] ([ParentUSI] ASC)
GO
ALTER TABLE [edfi].[ParentInternationalAddress] WITH CHECK ADD CONSTRAINT [FK_ParentInternationalAddress_AddressTypeDescriptor] FOREIGN KEY ([AddressTypeDescriptorId])
REFERENCES [edfi].[AddressTypeDescriptor] ([AddressTypeDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_ParentInternationalAddress_AddressTypeDescriptor]
ON [edfi].[ParentInternationalAddress] ([AddressTypeDescriptorId] ASC)
GO
ALTER TABLE [edfi].[ParentInternationalAddress] WITH CHECK ADD CONSTRAINT [FK_ParentInternationalAddress_CountryDescriptor] FOREIGN KEY ([CountryDescriptorId])
REFERENCES [edfi].[CountryDescriptor] ([CountryDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_ParentInternationalAddress_CountryDescriptor]
ON [edfi].[ParentInternationalAddress] ([CountryDescriptorId] ASC)
GO
ALTER TABLE [edfi].[ParentInternationalAddress] WITH CHECK ADD CONSTRAINT [FK_ParentInternationalAddress_Parent] FOREIGN KEY ([ParentUSI])
REFERENCES [edfi].[Parent] ([ParentUSI])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_ParentInternationalAddress_Parent]
ON [edfi].[ParentInternationalAddress] ([ParentUSI] ASC)
GO
ALTER TABLE [edfi].[ParentLanguage] WITH CHECK ADD CONSTRAINT [FK_ParentLanguage_LanguageDescriptor] FOREIGN KEY ([LanguageDescriptorId])
REFERENCES [edfi].[LanguageDescriptor] ([LanguageDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_ParentLanguage_LanguageDescriptor]
ON [edfi].[ParentLanguage] ([LanguageDescriptorId] ASC)
GO
ALTER TABLE [edfi].[ParentLanguage] WITH CHECK ADD CONSTRAINT [FK_ParentLanguage_Parent] FOREIGN KEY ([ParentUSI])
REFERENCES [edfi].[Parent] ([ParentUSI])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_ParentLanguage_Parent]
ON [edfi].[ParentLanguage] ([ParentUSI] ASC)
GO
ALTER TABLE [edfi].[ParentLanguageUse] WITH CHECK ADD CONSTRAINT [FK_ParentLanguageUse_LanguageUseDescriptor] FOREIGN KEY ([LanguageUseDescriptorId])
REFERENCES [edfi].[LanguageUseDescriptor] ([LanguageUseDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_ParentLanguageUse_LanguageUseDescriptor]
ON [edfi].[ParentLanguageUse] ([LanguageUseDescriptorId] ASC)
GO
ALTER TABLE [edfi].[ParentLanguageUse] WITH CHECK ADD CONSTRAINT [FK_ParentLanguageUse_ParentLanguage] FOREIGN KEY ([LanguageDescriptorId], [ParentUSI])
REFERENCES [edfi].[ParentLanguage] ([LanguageDescriptorId], [ParentUSI])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_ParentLanguageUse_ParentLanguage]
ON [edfi].[ParentLanguageUse] ([LanguageDescriptorId] ASC, [ParentUSI] ASC)
GO
ALTER TABLE [edfi].[ParentOtherName] WITH CHECK ADD CONSTRAINT [FK_ParentOtherName_OtherNameTypeDescriptor] FOREIGN KEY ([OtherNameTypeDescriptorId])
REFERENCES [edfi].[OtherNameTypeDescriptor] ([OtherNameTypeDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_ParentOtherName_OtherNameTypeDescriptor]
ON [edfi].[ParentOtherName] ([OtherNameTypeDescriptorId] ASC)
GO
ALTER TABLE [edfi].[ParentOtherName] WITH CHECK ADD CONSTRAINT [FK_ParentOtherName_Parent] FOREIGN KEY ([ParentUSI])
REFERENCES [edfi].[Parent] ([ParentUSI])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_ParentOtherName_Parent]
ON [edfi].[ParentOtherName] ([ParentUSI] ASC)
GO
ALTER TABLE [edfi].[ParentPersonalIdentificationDocument] WITH CHECK ADD CONSTRAINT [FK_ParentPersonalIdentificationDocument_CountryDescriptor] FOREIGN KEY ([IssuerCountryDescriptorId])
REFERENCES [edfi].[CountryDescriptor] ([CountryDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_ParentPersonalIdentificationDocument_CountryDescriptor]
ON [edfi].[ParentPersonalIdentificationDocument] ([IssuerCountryDescriptorId] ASC)
GO
ALTER TABLE [edfi].[ParentPersonalIdentificationDocument] WITH CHECK ADD CONSTRAINT [FK_ParentPersonalIdentificationDocument_IdentificationDocumentUseDescriptor] FOREIGN KEY ([IdentificationDocumentUseDescriptorId])
REFERENCES [edfi].[IdentificationDocumentUseDescriptor] ([IdentificationDocumentUseDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_ParentPersonalIdentificationDocument_IdentificationDocumentUseDescriptor]
ON [edfi].[ParentPersonalIdentificationDocument] ([IdentificationDocumentUseDescriptorId] ASC)
GO
ALTER TABLE [edfi].[ParentPersonalIdentificationDocument] WITH CHECK ADD CONSTRAINT [FK_ParentPersonalIdentificationDocument_Parent] FOREIGN KEY ([ParentUSI])
REFERENCES [edfi].[Parent] ([ParentUSI])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_ParentPersonalIdentificationDocument_Parent]
ON [edfi].[ParentPersonalIdentificationDocument] ([ParentUSI] ASC)
GO
ALTER TABLE [edfi].[ParentPersonalIdentificationDocument] WITH CHECK ADD CONSTRAINT [FK_ParentPersonalIdentificationDocument_PersonalInformationVerificationDescriptor] FOREIGN KEY ([PersonalInformationVerificationDescriptorId])
REFERENCES [edfi].[PersonalInformationVerificationDescriptor] ([PersonalInformationVerificationDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_ParentPersonalIdentificationDocument_PersonalInformationVerificationDescriptor]
ON [edfi].[ParentPersonalIdentificationDocument] ([PersonalInformationVerificationDescriptorId] ASC)
GO
ALTER TABLE [edfi].[ParentTelephone] WITH CHECK ADD CONSTRAINT [FK_ParentTelephone_Parent] FOREIGN KEY ([ParentUSI])
REFERENCES [edfi].[Parent] ([ParentUSI])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_ParentTelephone_Parent]
ON [edfi].[ParentTelephone] ([ParentUSI] ASC)
GO
ALTER TABLE [edfi].[ParentTelephone] WITH CHECK ADD CONSTRAINT [FK_ParentTelephone_TelephoneNumberTypeDescriptor] FOREIGN KEY ([TelephoneNumberTypeDescriptorId])
REFERENCES [edfi].[TelephoneNumberTypeDescriptor] ([TelephoneNumberTypeDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_ParentTelephone_TelephoneNumberTypeDescriptor]
ON [edfi].[ParentTelephone] ([TelephoneNumberTypeDescriptorId] ASC)
GO
ALTER TABLE [edfi].[ParticipationDescriptor] WITH CHECK ADD CONSTRAINT [FK_ParticipationDescriptor_Descriptor] FOREIGN KEY ([ParticipationDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[ParticipationStatusDescriptor] WITH CHECK ADD CONSTRAINT [FK_ParticipationStatusDescriptor_Descriptor] FOREIGN KEY ([ParticipationStatusDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[Payroll] WITH CHECK ADD CONSTRAINT [FK_Payroll_Account] FOREIGN KEY ([AccountIdentifier], [EducationOrganizationId], [FiscalYear])
REFERENCES [edfi].[Account] ([AccountIdentifier], [EducationOrganizationId], [FiscalYear])
GO
CREATE NONCLUSTERED INDEX [FK_Payroll_Account]
ON [edfi].[Payroll] ([AccountIdentifier] ASC, [EducationOrganizationId] ASC, [FiscalYear] ASC)
GO
ALTER TABLE [edfi].[Payroll] WITH CHECK ADD CONSTRAINT [FK_Payroll_Staff] FOREIGN KEY ([StaffUSI])
REFERENCES [edfi].[Staff] ([StaffUSI])
GO
CREATE NONCLUSTERED INDEX [FK_Payroll_Staff]
ON [edfi].[Payroll] ([StaffUSI] ASC)
GO
ALTER TABLE [edfi].[PerformanceBaseConversionDescriptor] WITH CHECK ADD CONSTRAINT [FK_PerformanceBaseConversionDescriptor_Descriptor] FOREIGN KEY ([PerformanceBaseConversionDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[PerformanceLevelDescriptor] WITH CHECK ADD CONSTRAINT [FK_PerformanceLevelDescriptor_Descriptor] FOREIGN KEY ([PerformanceLevelDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[Person] WITH CHECK ADD CONSTRAINT [FK_Person_SourceSystemDescriptor] FOREIGN KEY ([SourceSystemDescriptorId])
REFERENCES [edfi].[SourceSystemDescriptor] ([SourceSystemDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_Person_SourceSystemDescriptor]
ON [edfi].[Person] ([SourceSystemDescriptorId] ASC)
GO
ALTER TABLE [edfi].[PersonalInformationVerificationDescriptor] WITH CHECK ADD CONSTRAINT [FK_PersonalInformationVerificationDescriptor_Descriptor] FOREIGN KEY ([PersonalInformationVerificationDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[PlatformTypeDescriptor] WITH CHECK ADD CONSTRAINT [FK_PlatformTypeDescriptor_Descriptor] FOREIGN KEY ([PlatformTypeDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[PopulationServedDescriptor] WITH CHECK ADD CONSTRAINT [FK_PopulationServedDescriptor_Descriptor] FOREIGN KEY ([PopulationServedDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[PostingResultDescriptor] WITH CHECK ADD CONSTRAINT [FK_PostingResultDescriptor_Descriptor] FOREIGN KEY ([PostingResultDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[PostSecondaryEvent] WITH CHECK ADD CONSTRAINT [FK_PostSecondaryEvent_PostSecondaryEventCategoryDescriptor] FOREIGN KEY ([PostSecondaryEventCategoryDescriptorId])
REFERENCES [edfi].[PostSecondaryEventCategoryDescriptor] ([PostSecondaryEventCategoryDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_PostSecondaryEvent_PostSecondaryEventCategoryDescriptor]
ON [edfi].[PostSecondaryEvent] ([PostSecondaryEventCategoryDescriptorId] ASC)
GO
ALTER TABLE [edfi].[PostSecondaryEvent] WITH CHECK ADD CONSTRAINT [FK_PostSecondaryEvent_PostSecondaryInstitution] FOREIGN KEY ([PostSecondaryInstitutionId])
REFERENCES [edfi].[PostSecondaryInstitution] ([PostSecondaryInstitutionId])
GO
CREATE NONCLUSTERED INDEX [FK_PostSecondaryEvent_PostSecondaryInstitution]
ON [edfi].[PostSecondaryEvent] ([PostSecondaryInstitutionId] ASC)
GO
ALTER TABLE [edfi].[PostSecondaryEvent] WITH CHECK ADD CONSTRAINT [FK_PostSecondaryEvent_Student] FOREIGN KEY ([StudentUSI])
REFERENCES [edfi].[Student] ([StudentUSI])
GO
CREATE NONCLUSTERED INDEX [FK_PostSecondaryEvent_Student]
ON [edfi].[PostSecondaryEvent] ([StudentUSI] ASC)
GO
ALTER TABLE [edfi].[PostSecondaryEventCategoryDescriptor] WITH CHECK ADD CONSTRAINT [FK_PostSecondaryEventCategoryDescriptor_Descriptor] FOREIGN KEY ([PostSecondaryEventCategoryDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[PostSecondaryInstitution] WITH CHECK ADD CONSTRAINT [FK_PostSecondaryInstitution_AdministrativeFundingControlDescriptor] FOREIGN KEY ([AdministrativeFundingControlDescriptorId])
REFERENCES [edfi].[AdministrativeFundingControlDescriptor] ([AdministrativeFundingControlDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_PostSecondaryInstitution_AdministrativeFundingControlDescriptor]
ON [edfi].[PostSecondaryInstitution] ([AdministrativeFundingControlDescriptorId] ASC)
GO
ALTER TABLE [edfi].[PostSecondaryInstitution] WITH CHECK ADD CONSTRAINT [FK_PostSecondaryInstitution_EducationOrganization] FOREIGN KEY ([PostSecondaryInstitutionId])
REFERENCES [edfi].[EducationOrganization] ([EducationOrganizationId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[PostSecondaryInstitution] WITH CHECK ADD CONSTRAINT [FK_PostSecondaryInstitution_PostSecondaryInstitutionLevelDescriptor] FOREIGN KEY ([PostSecondaryInstitutionLevelDescriptorId])
REFERENCES [edfi].[PostSecondaryInstitutionLevelDescriptor] ([PostSecondaryInstitutionLevelDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_PostSecondaryInstitution_PostSecondaryInstitutionLevelDescriptor]
ON [edfi].[PostSecondaryInstitution] ([PostSecondaryInstitutionLevelDescriptorId] ASC)
GO
ALTER TABLE [edfi].[PostSecondaryInstitutionLevelDescriptor] WITH CHECK ADD CONSTRAINT [FK_PostSecondaryInstitutionLevelDescriptor_Descriptor] FOREIGN KEY ([PostSecondaryInstitutionLevelDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[PostSecondaryInstitutionMediumOfInstruction] WITH CHECK ADD CONSTRAINT [FK_PostSecondaryInstitutionMediumOfInstruction_MediumOfInstructionDescriptor] FOREIGN KEY ([MediumOfInstructionDescriptorId])
REFERENCES [edfi].[MediumOfInstructionDescriptor] ([MediumOfInstructionDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_PostSecondaryInstitutionMediumOfInstruction_MediumOfInstructionDescriptor]
ON [edfi].[PostSecondaryInstitutionMediumOfInstruction] ([MediumOfInstructionDescriptorId] ASC)
GO
ALTER TABLE [edfi].[PostSecondaryInstitutionMediumOfInstruction] WITH CHECK ADD CONSTRAINT [FK_PostSecondaryInstitutionMediumOfInstruction_PostSecondaryInstitution] FOREIGN KEY ([PostSecondaryInstitutionId])
REFERENCES [edfi].[PostSecondaryInstitution] ([PostSecondaryInstitutionId])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_PostSecondaryInstitutionMediumOfInstruction_PostSecondaryInstitution]
ON [edfi].[PostSecondaryInstitutionMediumOfInstruction] ([PostSecondaryInstitutionId] ASC)
GO
ALTER TABLE [edfi].[PrimaryLearningDeviceAccessDescriptor] WITH CHECK ADD CONSTRAINT [FK_PrimaryLearningDeviceAccessDescriptor_Descriptor] FOREIGN KEY ([PrimaryLearningDeviceAccessDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[PrimaryLearningDeviceAwayFromSchoolDescriptor] WITH CHECK ADD CONSTRAINT [FK_PrimaryLearningDeviceAwayFromSchoolDescriptor_Descriptor] FOREIGN KEY ([PrimaryLearningDeviceAwayFromSchoolDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[PrimaryLearningDeviceProviderDescriptor] WITH CHECK ADD CONSTRAINT [FK_PrimaryLearningDeviceProviderDescriptor_Descriptor] FOREIGN KEY ([PrimaryLearningDeviceProviderDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[ProficiencyDescriptor] WITH CHECK ADD CONSTRAINT [FK_ProficiencyDescriptor_Descriptor] FOREIGN KEY ([ProficiencyDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[Program] WITH CHECK ADD CONSTRAINT [FK_Program_EducationOrganization] FOREIGN KEY ([EducationOrganizationId])
REFERENCES [edfi].[EducationOrganization] ([EducationOrganizationId])
GO
CREATE NONCLUSTERED INDEX [FK_Program_EducationOrganization]
ON [edfi].[Program] ([EducationOrganizationId] ASC)
GO
ALTER TABLE [edfi].[Program] WITH CHECK ADD CONSTRAINT [FK_Program_ProgramTypeDescriptor] FOREIGN KEY ([ProgramTypeDescriptorId])
REFERENCES [edfi].[ProgramTypeDescriptor] ([ProgramTypeDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_Program_ProgramTypeDescriptor]
ON [edfi].[Program] ([ProgramTypeDescriptorId] ASC)
GO
ALTER TABLE [edfi].[ProgramAssignmentDescriptor] WITH CHECK ADD CONSTRAINT [FK_ProgramAssignmentDescriptor_Descriptor] FOREIGN KEY ([ProgramAssignmentDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[ProgramCharacteristic] WITH CHECK ADD CONSTRAINT [FK_ProgramCharacteristic_Program] FOREIGN KEY ([EducationOrganizationId], [ProgramName], [ProgramTypeDescriptorId])
REFERENCES [edfi].[Program] ([EducationOrganizationId], [ProgramName], [ProgramTypeDescriptorId])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_ProgramCharacteristic_Program]
ON [edfi].[ProgramCharacteristic] ([EducationOrganizationId] ASC, [ProgramName] ASC, [ProgramTypeDescriptorId] ASC)
GO
ALTER TABLE [edfi].[ProgramCharacteristic] WITH CHECK ADD CONSTRAINT [FK_ProgramCharacteristic_ProgramCharacteristicDescriptor] FOREIGN KEY ([ProgramCharacteristicDescriptorId])
REFERENCES [edfi].[ProgramCharacteristicDescriptor] ([ProgramCharacteristicDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_ProgramCharacteristic_ProgramCharacteristicDescriptor]
ON [edfi].[ProgramCharacteristic] ([ProgramCharacteristicDescriptorId] ASC)
GO
ALTER TABLE [edfi].[ProgramCharacteristicDescriptor] WITH CHECK ADD CONSTRAINT [FK_ProgramCharacteristicDescriptor_Descriptor] FOREIGN KEY ([ProgramCharacteristicDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[ProgramLearningObjective] WITH CHECK ADD CONSTRAINT [FK_ProgramLearningObjective_LearningObjective] FOREIGN KEY ([LearningObjectiveId], [Namespace])
REFERENCES [edfi].[LearningObjective] ([LearningObjectiveId], [Namespace])
GO
CREATE NONCLUSTERED INDEX [FK_ProgramLearningObjective_LearningObjective]
ON [edfi].[ProgramLearningObjective] ([LearningObjectiveId] ASC, [Namespace] ASC)
GO
ALTER TABLE [edfi].[ProgramLearningObjective] WITH CHECK ADD CONSTRAINT [FK_ProgramLearningObjective_Program] FOREIGN KEY ([EducationOrganizationId], [ProgramName], [ProgramTypeDescriptorId])
REFERENCES [edfi].[Program] ([EducationOrganizationId], [ProgramName], [ProgramTypeDescriptorId])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_ProgramLearningObjective_Program]
ON [edfi].[ProgramLearningObjective] ([EducationOrganizationId] ASC, [ProgramName] ASC, [ProgramTypeDescriptorId] ASC)
GO
ALTER TABLE [edfi].[ProgramLearningStandard] WITH CHECK ADD CONSTRAINT [FK_ProgramLearningStandard_LearningStandard] FOREIGN KEY ([LearningStandardId])
REFERENCES [edfi].[LearningStandard] ([LearningStandardId])
GO
CREATE NONCLUSTERED INDEX [FK_ProgramLearningStandard_LearningStandard]
ON [edfi].[ProgramLearningStandard] ([LearningStandardId] ASC)
GO
ALTER TABLE [edfi].[ProgramLearningStandard] WITH CHECK ADD CONSTRAINT [FK_ProgramLearningStandard_Program] FOREIGN KEY ([EducationOrganizationId], [ProgramName], [ProgramTypeDescriptorId])
REFERENCES [edfi].[Program] ([EducationOrganizationId], [ProgramName], [ProgramTypeDescriptorId])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_ProgramLearningStandard_Program]
ON [edfi].[ProgramLearningStandard] ([EducationOrganizationId] ASC, [ProgramName] ASC, [ProgramTypeDescriptorId] ASC)
GO
ALTER TABLE [edfi].[ProgramService] WITH CHECK ADD CONSTRAINT [FK_ProgramService_Program] FOREIGN KEY ([EducationOrganizationId], [ProgramName], [ProgramTypeDescriptorId])
REFERENCES [edfi].[Program] ([EducationOrganizationId], [ProgramName], [ProgramTypeDescriptorId])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_ProgramService_Program]
ON [edfi].[ProgramService] ([EducationOrganizationId] ASC, [ProgramName] ASC, [ProgramTypeDescriptorId] ASC)
GO
ALTER TABLE [edfi].[ProgramService] WITH CHECK ADD CONSTRAINT [FK_ProgramService_ServiceDescriptor] FOREIGN KEY ([ServiceDescriptorId])
REFERENCES [edfi].[ServiceDescriptor] ([ServiceDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_ProgramService_ServiceDescriptor]
ON [edfi].[ProgramService] ([ServiceDescriptorId] ASC)
GO
ALTER TABLE [edfi].[ProgramSponsor] WITH CHECK ADD CONSTRAINT [FK_ProgramSponsor_Program] FOREIGN KEY ([EducationOrganizationId], [ProgramName], [ProgramTypeDescriptorId])
REFERENCES [edfi].[Program] ([EducationOrganizationId], [ProgramName], [ProgramTypeDescriptorId])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_ProgramSponsor_Program]
ON [edfi].[ProgramSponsor] ([EducationOrganizationId] ASC, [ProgramName] ASC, [ProgramTypeDescriptorId] ASC)
GO
ALTER TABLE [edfi].[ProgramSponsor] WITH CHECK ADD CONSTRAINT [FK_ProgramSponsor_ProgramSponsorDescriptor] FOREIGN KEY ([ProgramSponsorDescriptorId])
REFERENCES [edfi].[ProgramSponsorDescriptor] ([ProgramSponsorDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_ProgramSponsor_ProgramSponsorDescriptor]
ON [edfi].[ProgramSponsor] ([ProgramSponsorDescriptorId] ASC)
GO
ALTER TABLE [edfi].[ProgramSponsorDescriptor] WITH CHECK ADD CONSTRAINT [FK_ProgramSponsorDescriptor_Descriptor] FOREIGN KEY ([ProgramSponsorDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[ProgramTypeDescriptor] WITH CHECK ADD CONSTRAINT [FK_ProgramTypeDescriptor_Descriptor] FOREIGN KEY ([ProgramTypeDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[ProgressDescriptor] WITH CHECK ADD CONSTRAINT [FK_ProgressDescriptor_Descriptor] FOREIGN KEY ([ProgressDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[ProgressLevelDescriptor] WITH CHECK ADD CONSTRAINT [FK_ProgressLevelDescriptor_Descriptor] FOREIGN KEY ([ProgressLevelDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[ProviderCategoryDescriptor] WITH CHECK ADD CONSTRAINT [FK_ProviderCategoryDescriptor_Descriptor] FOREIGN KEY ([ProviderCategoryDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[ProviderProfitabilityDescriptor] WITH CHECK ADD CONSTRAINT [FK_ProviderProfitabilityDescriptor_Descriptor] FOREIGN KEY ([ProviderProfitabilityDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[ProviderStatusDescriptor] WITH CHECK ADD CONSTRAINT [FK_ProviderStatusDescriptor_Descriptor] FOREIGN KEY ([ProviderStatusDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[PublicationStatusDescriptor] WITH CHECK ADD CONSTRAINT [FK_PublicationStatusDescriptor_Descriptor] FOREIGN KEY ([PublicationStatusDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[QuestionFormDescriptor] WITH CHECK ADD CONSTRAINT [FK_QuestionFormDescriptor_Descriptor] FOREIGN KEY ([QuestionFormDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[RaceDescriptor] WITH CHECK ADD CONSTRAINT [FK_RaceDescriptor_Descriptor] FOREIGN KEY ([RaceDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[ReasonExitedDescriptor] WITH CHECK ADD CONSTRAINT [FK_ReasonExitedDescriptor_Descriptor] FOREIGN KEY ([ReasonExitedDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[ReasonNotTestedDescriptor] WITH CHECK ADD CONSTRAINT [FK_ReasonNotTestedDescriptor_Descriptor] FOREIGN KEY ([ReasonNotTestedDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[RecognitionTypeDescriptor] WITH CHECK ADD CONSTRAINT [FK_RecognitionTypeDescriptor_Descriptor] FOREIGN KEY ([RecognitionTypeDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[RelationDescriptor] WITH CHECK ADD CONSTRAINT [FK_RelationDescriptor_Descriptor] FOREIGN KEY ([RelationDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[RepeatIdentifierDescriptor] WITH CHECK ADD CONSTRAINT [FK_RepeatIdentifierDescriptor_Descriptor] FOREIGN KEY ([RepeatIdentifierDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[ReportCard] WITH CHECK ADD CONSTRAINT [FK_ReportCard_EducationOrganization] FOREIGN KEY ([EducationOrganizationId])
REFERENCES [edfi].[EducationOrganization] ([EducationOrganizationId])
GO
CREATE NONCLUSTERED INDEX [FK_ReportCard_EducationOrganization]
ON [edfi].[ReportCard] ([EducationOrganizationId] ASC)
GO
ALTER TABLE [edfi].[ReportCard] WITH CHECK ADD CONSTRAINT [FK_ReportCard_GradingPeriod] FOREIGN KEY ([GradingPeriodDescriptorId], [GradingPeriodSequence], [GradingPeriodSchoolId], [GradingPeriodSchoolYear])
REFERENCES [edfi].[GradingPeriod] ([GradingPeriodDescriptorId], [PeriodSequence], [SchoolId], [SchoolYear])
GO
CREATE NONCLUSTERED INDEX [FK_ReportCard_GradingPeriod]
ON [edfi].[ReportCard] ([GradingPeriodDescriptorId] ASC, [GradingPeriodSequence] ASC, [GradingPeriodSchoolId] ASC, [GradingPeriodSchoolYear] ASC)
GO
ALTER TABLE [edfi].[ReportCard] WITH CHECK ADD CONSTRAINT [FK_ReportCard_Student] FOREIGN KEY ([StudentUSI])
REFERENCES [edfi].[Student] ([StudentUSI])
GO
CREATE NONCLUSTERED INDEX [FK_ReportCard_Student]
ON [edfi].[ReportCard] ([StudentUSI] ASC)
GO
ALTER TABLE [edfi].[ReportCardGrade] WITH CHECK ADD CONSTRAINT [FK_ReportCardGrade_Grade] FOREIGN KEY ([BeginDate], [GradeTypeDescriptorId], [GradingPeriodDescriptorId], [GradingPeriodSchoolYear], [GradingPeriodSequence], [LocalCourseCode], [SchoolId], [SchoolYear], [SectionIdentifier], [SessionName], [StudentUSI])
REFERENCES [edfi].[Grade] ([BeginDate], [GradeTypeDescriptorId], [GradingPeriodDescriptorId], [GradingPeriodSchoolYear], [GradingPeriodSequence], [LocalCourseCode], [SchoolId], [SchoolYear], [SectionIdentifier], [SessionName], [StudentUSI])
ON UPDATE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_ReportCardGrade_Grade]
ON [edfi].[ReportCardGrade] ([BeginDate] ASC, [GradeTypeDescriptorId] ASC, [GradingPeriodDescriptorId] ASC, [GradingPeriodSchoolYear] ASC, [GradingPeriodSequence] ASC, [LocalCourseCode] ASC, [SchoolId] ASC, [SchoolYear] ASC, [SectionIdentifier] ASC, [SessionName] ASC, [StudentUSI] ASC)
GO
ALTER TABLE [edfi].[ReportCardGrade] WITH CHECK ADD CONSTRAINT [FK_ReportCardGrade_ReportCard] FOREIGN KEY ([EducationOrganizationId], [GradingPeriodDescriptorId], [GradingPeriodSchoolId], [GradingPeriodSchoolYear], [GradingPeriodSequence], [StudentUSI])
REFERENCES [edfi].[ReportCard] ([EducationOrganizationId], [GradingPeriodDescriptorId], [GradingPeriodSchoolId], [GradingPeriodSchoolYear], [GradingPeriodSequence], [StudentUSI])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_ReportCardGrade_ReportCard]
ON [edfi].[ReportCardGrade] ([EducationOrganizationId] ASC, [GradingPeriodDescriptorId] ASC, [GradingPeriodSchoolId] ASC, [GradingPeriodSchoolYear] ASC, [GradingPeriodSequence] ASC, [StudentUSI] ASC)
GO
ALTER TABLE [edfi].[ReportCardGradePointAverage] WITH CHECK ADD CONSTRAINT [FK_ReportCardGradePointAverage_GradePointAverageTypeDescriptor] FOREIGN KEY ([GradePointAverageTypeDescriptorId])
REFERENCES [edfi].[GradePointAverageTypeDescriptor] ([GradePointAverageTypeDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_ReportCardGradePointAverage_GradePointAverageTypeDescriptor]
ON [edfi].[ReportCardGradePointAverage] ([GradePointAverageTypeDescriptorId] ASC)
GO
ALTER TABLE [edfi].[ReportCardGradePointAverage] WITH CHECK ADD CONSTRAINT [FK_ReportCardGradePointAverage_ReportCard] FOREIGN KEY ([EducationOrganizationId], [GradingPeriodDescriptorId], [GradingPeriodSchoolId], [GradingPeriodSchoolYear], [GradingPeriodSequence], [StudentUSI])
REFERENCES [edfi].[ReportCard] ([EducationOrganizationId], [GradingPeriodDescriptorId], [GradingPeriodSchoolId], [GradingPeriodSchoolYear], [GradingPeriodSequence], [StudentUSI])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_ReportCardGradePointAverage_ReportCard]
ON [edfi].[ReportCardGradePointAverage] ([EducationOrganizationId] ASC, [GradingPeriodDescriptorId] ASC, [GradingPeriodSchoolId] ASC, [GradingPeriodSchoolYear] ASC, [GradingPeriodSequence] ASC, [StudentUSI] ASC)
GO
ALTER TABLE [edfi].[ReportCardStudentCompetencyObjective] WITH CHECK ADD CONSTRAINT [FK_ReportCardStudentCompetencyObjective_ReportCard] FOREIGN KEY ([EducationOrganizationId], [GradingPeriodDescriptorId], [GradingPeriodSchoolId], [GradingPeriodSchoolYear], [GradingPeriodSequence], [StudentUSI])
REFERENCES [edfi].[ReportCard] ([EducationOrganizationId], [GradingPeriodDescriptorId], [GradingPeriodSchoolId], [GradingPeriodSchoolYear], [GradingPeriodSequence], [StudentUSI])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_ReportCardStudentCompetencyObjective_ReportCard]
ON [edfi].[ReportCardStudentCompetencyObjective] ([EducationOrganizationId] ASC, [GradingPeriodDescriptorId] ASC, [GradingPeriodSchoolId] ASC, [GradingPeriodSchoolYear] ASC, [GradingPeriodSequence] ASC, [StudentUSI] ASC)
GO
ALTER TABLE [edfi].[ReportCardStudentCompetencyObjective] WITH CHECK ADD CONSTRAINT [FK_ReportCardStudentCompetencyObjective_StudentCompetencyObjective] FOREIGN KEY ([GradingPeriodDescriptorId], [GradingPeriodSchoolId], [GradingPeriodSchoolYear], [GradingPeriodSequence], [Objective], [ObjectiveEducationOrganizationId], [ObjectiveGradeLevelDescriptorId], [StudentUSI])
REFERENCES [edfi].[StudentCompetencyObjective] ([GradingPeriodDescriptorId], [GradingPeriodSchoolId], [GradingPeriodSchoolYear], [GradingPeriodSequence], [Objective], [ObjectiveEducationOrganizationId], [ObjectiveGradeLevelDescriptorId], [StudentUSI])
GO
CREATE NONCLUSTERED INDEX [FK_ReportCardStudentCompetencyObjective_StudentCompetencyObjective]
ON [edfi].[ReportCardStudentCompetencyObjective] ([GradingPeriodDescriptorId] ASC, [GradingPeriodSchoolId] ASC, [GradingPeriodSchoolYear] ASC, [GradingPeriodSequence] ASC, [Objective] ASC, [ObjectiveEducationOrganizationId] ASC, [ObjectiveGradeLevelDescriptorId] ASC, [StudentUSI] ASC)
GO
ALTER TABLE [edfi].[ReportCardStudentLearningObjective] WITH CHECK ADD CONSTRAINT [FK_ReportCardStudentLearningObjective_ReportCard] FOREIGN KEY ([EducationOrganizationId], [GradingPeriodDescriptorId], [GradingPeriodSchoolId], [GradingPeriodSchoolYear], [GradingPeriodSequence], [StudentUSI])
REFERENCES [edfi].[ReportCard] ([EducationOrganizationId], [GradingPeriodDescriptorId], [GradingPeriodSchoolId], [GradingPeriodSchoolYear], [GradingPeriodSequence], [StudentUSI])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_ReportCardStudentLearningObjective_ReportCard]
ON [edfi].[ReportCardStudentLearningObjective] ([EducationOrganizationId] ASC, [GradingPeriodDescriptorId] ASC, [GradingPeriodSchoolId] ASC, [GradingPeriodSchoolYear] ASC, [GradingPeriodSequence] ASC, [StudentUSI] ASC)
GO
ALTER TABLE [edfi].[ReportCardStudentLearningObjective] WITH CHECK ADD CONSTRAINT [FK_ReportCardStudentLearningObjective_StudentLearningObjective] FOREIGN KEY ([GradingPeriodDescriptorId], [GradingPeriodSchoolId], [GradingPeriodSchoolYear], [GradingPeriodSequence], [LearningObjectiveId], [Namespace], [StudentUSI])
REFERENCES [edfi].[StudentLearningObjective] ([GradingPeriodDescriptorId], [GradingPeriodSchoolId], [GradingPeriodSchoolYear], [GradingPeriodSequence], [LearningObjectiveId], [Namespace], [StudentUSI])
GO
CREATE NONCLUSTERED INDEX [FK_ReportCardStudentLearningObjective_StudentLearningObjective]
ON [edfi].[ReportCardStudentLearningObjective] ([GradingPeriodDescriptorId] ASC, [GradingPeriodSchoolId] ASC, [GradingPeriodSchoolYear] ASC, [GradingPeriodSequence] ASC, [LearningObjectiveId] ASC, [Namespace] ASC, [StudentUSI] ASC)
GO
ALTER TABLE [edfi].[ReporterDescriptionDescriptor] WITH CHECK ADD CONSTRAINT [FK_ReporterDescriptionDescriptor_Descriptor] FOREIGN KEY ([ReporterDescriptionDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[ResidencyStatusDescriptor] WITH CHECK ADD CONSTRAINT [FK_ResidencyStatusDescriptor_Descriptor] FOREIGN KEY ([ResidencyStatusDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[ResponseIndicatorDescriptor] WITH CHECK ADD CONSTRAINT [FK_ResponseIndicatorDescriptor_Descriptor] FOREIGN KEY ([ResponseIndicatorDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[ResponsibilityDescriptor] WITH CHECK ADD CONSTRAINT [FK_ResponsibilityDescriptor_Descriptor] FOREIGN KEY ([ResponsibilityDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[RestraintEvent] WITH CHECK ADD CONSTRAINT [FK_RestraintEvent_EducationalEnvironmentDescriptor] FOREIGN KEY ([EducationalEnvironmentDescriptorId])
REFERENCES [edfi].[EducationalEnvironmentDescriptor] ([EducationalEnvironmentDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_RestraintEvent_EducationalEnvironmentDescriptor]
ON [edfi].[RestraintEvent] ([EducationalEnvironmentDescriptorId] ASC)
GO
ALTER TABLE [edfi].[RestraintEvent] WITH CHECK ADD CONSTRAINT [FK_RestraintEvent_School] FOREIGN KEY ([SchoolId])
REFERENCES [edfi].[School] ([SchoolId])
GO
CREATE NONCLUSTERED INDEX [FK_RestraintEvent_School]
ON [edfi].[RestraintEvent] ([SchoolId] ASC)
GO
ALTER TABLE [edfi].[RestraintEvent] WITH CHECK ADD CONSTRAINT [FK_RestraintEvent_Student] FOREIGN KEY ([StudentUSI])
REFERENCES [edfi].[Student] ([StudentUSI])
GO
CREATE NONCLUSTERED INDEX [FK_RestraintEvent_Student]
ON [edfi].[RestraintEvent] ([StudentUSI] ASC)
GO
ALTER TABLE [edfi].[RestraintEventProgram] WITH CHECK ADD CONSTRAINT [FK_RestraintEventProgram_Program] FOREIGN KEY ([EducationOrganizationId], [ProgramName], [ProgramTypeDescriptorId])
REFERENCES [edfi].[Program] ([EducationOrganizationId], [ProgramName], [ProgramTypeDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_RestraintEventProgram_Program]
ON [edfi].[RestraintEventProgram] ([EducationOrganizationId] ASC, [ProgramName] ASC, [ProgramTypeDescriptorId] ASC)
GO
ALTER TABLE [edfi].[RestraintEventProgram] WITH CHECK ADD CONSTRAINT [FK_RestraintEventProgram_RestraintEvent] FOREIGN KEY ([RestraintEventIdentifier], [SchoolId], [StudentUSI])
REFERENCES [edfi].[RestraintEvent] ([RestraintEventIdentifier], [SchoolId], [StudentUSI])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_RestraintEventProgram_RestraintEvent]
ON [edfi].[RestraintEventProgram] ([RestraintEventIdentifier] ASC, [SchoolId] ASC, [StudentUSI] ASC)
GO
ALTER TABLE [edfi].[RestraintEventReason] WITH CHECK ADD CONSTRAINT [FK_RestraintEventReason_RestraintEvent] FOREIGN KEY ([RestraintEventIdentifier], [SchoolId], [StudentUSI])
REFERENCES [edfi].[RestraintEvent] ([RestraintEventIdentifier], [SchoolId], [StudentUSI])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_RestraintEventReason_RestraintEvent]
ON [edfi].[RestraintEventReason] ([RestraintEventIdentifier] ASC, [SchoolId] ASC, [StudentUSI] ASC)
GO
ALTER TABLE [edfi].[RestraintEventReason] WITH CHECK ADD CONSTRAINT [FK_RestraintEventReason_RestraintEventReasonDescriptor] FOREIGN KEY ([RestraintEventReasonDescriptorId])
REFERENCES [edfi].[RestraintEventReasonDescriptor] ([RestraintEventReasonDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_RestraintEventReason_RestraintEventReasonDescriptor]
ON [edfi].[RestraintEventReason] ([RestraintEventReasonDescriptorId] ASC)
GO
ALTER TABLE [edfi].[RestraintEventReasonDescriptor] WITH CHECK ADD CONSTRAINT [FK_RestraintEventReasonDescriptor_Descriptor] FOREIGN KEY ([RestraintEventReasonDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[ResultDatatypeTypeDescriptor] WITH CHECK ADD CONSTRAINT [FK_ResultDatatypeTypeDescriptor_Descriptor] FOREIGN KEY ([ResultDatatypeTypeDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[RetestIndicatorDescriptor] WITH CHECK ADD CONSTRAINT [FK_RetestIndicatorDescriptor_Descriptor] FOREIGN KEY ([RetestIndicatorDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[School] WITH CHECK ADD CONSTRAINT [FK_School_AdministrativeFundingControlDescriptor] FOREIGN KEY ([AdministrativeFundingControlDescriptorId])
REFERENCES [edfi].[AdministrativeFundingControlDescriptor] ([AdministrativeFundingControlDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_School_AdministrativeFundingControlDescriptor]
ON [edfi].[School] ([AdministrativeFundingControlDescriptorId] ASC)
GO
ALTER TABLE [edfi].[School] WITH CHECK ADD CONSTRAINT [FK_School_CharterApprovalAgencyTypeDescriptor] FOREIGN KEY ([CharterApprovalAgencyTypeDescriptorId])
REFERENCES [edfi].[CharterApprovalAgencyTypeDescriptor] ([CharterApprovalAgencyTypeDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_School_CharterApprovalAgencyTypeDescriptor]
ON [edfi].[School] ([CharterApprovalAgencyTypeDescriptorId] ASC)
GO
ALTER TABLE [edfi].[School] WITH CHECK ADD CONSTRAINT [FK_School_CharterStatusDescriptor] FOREIGN KEY ([CharterStatusDescriptorId])
REFERENCES [edfi].[CharterStatusDescriptor] ([CharterStatusDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_School_CharterStatusDescriptor]
ON [edfi].[School] ([CharterStatusDescriptorId] ASC)
GO
ALTER TABLE [edfi].[School] WITH CHECK ADD CONSTRAINT [FK_School_EducationOrganization] FOREIGN KEY ([SchoolId])
REFERENCES [edfi].[EducationOrganization] ([EducationOrganizationId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[School] WITH CHECK ADD CONSTRAINT [FK_School_InternetAccessDescriptor] FOREIGN KEY ([InternetAccessDescriptorId])
REFERENCES [edfi].[InternetAccessDescriptor] ([InternetAccessDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_School_InternetAccessDescriptor]
ON [edfi].[School] ([InternetAccessDescriptorId] ASC)
GO
ALTER TABLE [edfi].[School] WITH CHECK ADD CONSTRAINT [FK_School_LocalEducationAgency] FOREIGN KEY ([LocalEducationAgencyId])
REFERENCES [edfi].[LocalEducationAgency] ([LocalEducationAgencyId])
GO
CREATE NONCLUSTERED INDEX [FK_School_LocalEducationAgency]
ON [edfi].[School] ([LocalEducationAgencyId] ASC)
GO
ALTER TABLE [edfi].[School] WITH CHECK ADD CONSTRAINT [FK_School_MagnetSpecialProgramEmphasisSchoolDescriptor] FOREIGN KEY ([MagnetSpecialProgramEmphasisSchoolDescriptorId])
REFERENCES [edfi].[MagnetSpecialProgramEmphasisSchoolDescriptor] ([MagnetSpecialProgramEmphasisSchoolDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_School_MagnetSpecialProgramEmphasisSchoolDescriptor]
ON [edfi].[School] ([MagnetSpecialProgramEmphasisSchoolDescriptorId] ASC)
GO
ALTER TABLE [edfi].[School] WITH CHECK ADD CONSTRAINT [FK_School_SchoolTypeDescriptor] FOREIGN KEY ([SchoolTypeDescriptorId])
REFERENCES [edfi].[SchoolTypeDescriptor] ([SchoolTypeDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_School_SchoolTypeDescriptor]
ON [edfi].[School] ([SchoolTypeDescriptorId] ASC)
GO
ALTER TABLE [edfi].[School] WITH CHECK ADD CONSTRAINT [FK_School_SchoolYearType] FOREIGN KEY ([CharterApprovalSchoolYear])
REFERENCES [edfi].[SchoolYearType] ([SchoolYear])
GO
CREATE NONCLUSTERED INDEX [FK_School_SchoolYearType]
ON [edfi].[School] ([CharterApprovalSchoolYear] ASC)
GO
ALTER TABLE [edfi].[School] WITH CHECK ADD CONSTRAINT [FK_School_TitleIPartASchoolDesignationDescriptor] FOREIGN KEY ([TitleIPartASchoolDesignationDescriptorId])
REFERENCES [edfi].[TitleIPartASchoolDesignationDescriptor] ([TitleIPartASchoolDesignationDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_School_TitleIPartASchoolDesignationDescriptor]
ON [edfi].[School] ([TitleIPartASchoolDesignationDescriptorId] ASC)
GO
ALTER TABLE [edfi].[SchoolCategory] WITH CHECK ADD CONSTRAINT [FK_SchoolCategory_School] FOREIGN KEY ([SchoolId])
REFERENCES [edfi].[School] ([SchoolId])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_SchoolCategory_School]
ON [edfi].[SchoolCategory] ([SchoolId] ASC)
GO
ALTER TABLE [edfi].[SchoolCategory] WITH CHECK ADD CONSTRAINT [FK_SchoolCategory_SchoolCategoryDescriptor] FOREIGN KEY ([SchoolCategoryDescriptorId])
REFERENCES [edfi].[SchoolCategoryDescriptor] ([SchoolCategoryDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_SchoolCategory_SchoolCategoryDescriptor]
ON [edfi].[SchoolCategory] ([SchoolCategoryDescriptorId] ASC)
GO
ALTER TABLE [edfi].[SchoolCategoryDescriptor] WITH CHECK ADD CONSTRAINT [FK_SchoolCategoryDescriptor_Descriptor] FOREIGN KEY ([SchoolCategoryDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[SchoolChoiceImplementStatusDescriptor] WITH CHECK ADD CONSTRAINT [FK_SchoolChoiceImplementStatusDescriptor_Descriptor] FOREIGN KEY ([SchoolChoiceImplementStatusDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[SchoolFoodServiceProgramServiceDescriptor] WITH CHECK ADD CONSTRAINT [FK_SchoolFoodServiceProgramServiceDescriptor_Descriptor] FOREIGN KEY ([SchoolFoodServiceProgramServiceDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[SchoolGradeLevel] WITH CHECK ADD CONSTRAINT [FK_SchoolGradeLevel_GradeLevelDescriptor] FOREIGN KEY ([GradeLevelDescriptorId])
REFERENCES [edfi].[GradeLevelDescriptor] ([GradeLevelDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_SchoolGradeLevel_GradeLevelDescriptor]
ON [edfi].[SchoolGradeLevel] ([GradeLevelDescriptorId] ASC)
GO
ALTER TABLE [edfi].[SchoolGradeLevel] WITH CHECK ADD CONSTRAINT [FK_SchoolGradeLevel_School] FOREIGN KEY ([SchoolId])
REFERENCES [edfi].[School] ([SchoolId])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_SchoolGradeLevel_School]
ON [edfi].[SchoolGradeLevel] ([SchoolId] ASC)
GO
ALTER TABLE [edfi].[SchoolTypeDescriptor] WITH CHECK ADD CONSTRAINT [FK_SchoolTypeDescriptor_Descriptor] FOREIGN KEY ([SchoolTypeDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[Section] WITH CHECK ADD CONSTRAINT [FK_Section_CourseOffering] FOREIGN KEY ([LocalCourseCode], [SchoolId], [SchoolYear], [SessionName])
REFERENCES [edfi].[CourseOffering] ([LocalCourseCode], [SchoolId], [SchoolYear], [SessionName])
ON UPDATE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_Section_CourseOffering]
ON [edfi].[Section] ([LocalCourseCode] ASC, [SchoolId] ASC, [SchoolYear] ASC, [SessionName] ASC)
GO
ALTER TABLE [edfi].[Section] WITH CHECK ADD CONSTRAINT [FK_Section_CreditTypeDescriptor] FOREIGN KEY ([AvailableCreditTypeDescriptorId])
REFERENCES [edfi].[CreditTypeDescriptor] ([CreditTypeDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_Section_CreditTypeDescriptor]
ON [edfi].[Section] ([AvailableCreditTypeDescriptorId] ASC)
GO
ALTER TABLE [edfi].[Section] WITH CHECK ADD CONSTRAINT [FK_Section_EducationalEnvironmentDescriptor] FOREIGN KEY ([EducationalEnvironmentDescriptorId])
REFERENCES [edfi].[EducationalEnvironmentDescriptor] ([EducationalEnvironmentDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_Section_EducationalEnvironmentDescriptor]
ON [edfi].[Section] ([EducationalEnvironmentDescriptorId] ASC)
GO
ALTER TABLE [edfi].[Section] WITH CHECK ADD CONSTRAINT [FK_Section_LanguageDescriptor] FOREIGN KEY ([InstructionLanguageDescriptorId])
REFERENCES [edfi].[LanguageDescriptor] ([LanguageDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_Section_LanguageDescriptor]
ON [edfi].[Section] ([InstructionLanguageDescriptorId] ASC)
GO
ALTER TABLE [edfi].[Section] WITH CHECK ADD CONSTRAINT [FK_Section_Location] FOREIGN KEY ([LocationClassroomIdentificationCode], [LocationSchoolId])
REFERENCES [edfi].[Location] ([ClassroomIdentificationCode], [SchoolId])
ON UPDATE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_Section_Location]
ON [edfi].[Section] ([LocationClassroomIdentificationCode] ASC, [LocationSchoolId] ASC)
GO
ALTER TABLE [edfi].[Section] WITH CHECK ADD CONSTRAINT [FK_Section_MediumOfInstructionDescriptor] FOREIGN KEY ([MediumOfInstructionDescriptorId])
REFERENCES [edfi].[MediumOfInstructionDescriptor] ([MediumOfInstructionDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_Section_MediumOfInstructionDescriptor]
ON [edfi].[Section] ([MediumOfInstructionDescriptorId] ASC)
GO
ALTER TABLE [edfi].[Section] WITH CHECK ADD CONSTRAINT [FK_Section_PopulationServedDescriptor] FOREIGN KEY ([PopulationServedDescriptorId])
REFERENCES [edfi].[PopulationServedDescriptor] ([PopulationServedDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_Section_PopulationServedDescriptor]
ON [edfi].[Section] ([PopulationServedDescriptorId] ASC)
GO
ALTER TABLE [edfi].[Section] WITH CHECK ADD CONSTRAINT [FK_Section_School] FOREIGN KEY ([LocationSchoolId])
REFERENCES [edfi].[School] ([SchoolId])
GO
CREATE NONCLUSTERED INDEX [FK_Section_School]
ON [edfi].[Section] ([LocationSchoolId] ASC)
GO
ALTER TABLE [edfi].[SectionAttendanceTakenEvent] WITH CHECK ADD CONSTRAINT [FK_SectionAttendanceTakenEvent_CalendarDate] FOREIGN KEY ([CalendarCode], [Date], [SchoolId], [SchoolYear])
REFERENCES [edfi].[CalendarDate] ([CalendarCode], [Date], [SchoolId], [SchoolYear])
GO
CREATE NONCLUSTERED INDEX [FK_SectionAttendanceTakenEvent_CalendarDate]
ON [edfi].[SectionAttendanceTakenEvent] ([CalendarCode] ASC, [Date] ASC, [SchoolId] ASC, [SchoolYear] ASC)
GO
ALTER TABLE [edfi].[SectionAttendanceTakenEvent] WITH CHECK ADD CONSTRAINT [FK_SectionAttendanceTakenEvent_Section] FOREIGN KEY ([LocalCourseCode], [SchoolId], [SchoolYear], [SectionIdentifier], [SessionName])
REFERENCES [edfi].[Section] ([LocalCourseCode], [SchoolId], [SchoolYear], [SectionIdentifier], [SessionName])
ON UPDATE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_SectionAttendanceTakenEvent_Section]
ON [edfi].[SectionAttendanceTakenEvent] ([LocalCourseCode] ASC, [SchoolId] ASC, [SchoolYear] ASC, [SectionIdentifier] ASC, [SessionName] ASC)
GO
ALTER TABLE [edfi].[SectionAttendanceTakenEvent] WITH CHECK ADD CONSTRAINT [FK_SectionAttendanceTakenEvent_Staff] FOREIGN KEY ([StaffUSI])
REFERENCES [edfi].[Staff] ([StaffUSI])
GO
CREATE NONCLUSTERED INDEX [FK_SectionAttendanceTakenEvent_Staff]
ON [edfi].[SectionAttendanceTakenEvent] ([StaffUSI] ASC)
GO
ALTER TABLE [edfi].[SectionCharacteristic] WITH CHECK ADD CONSTRAINT [FK_SectionCharacteristic_Section] FOREIGN KEY ([LocalCourseCode], [SchoolId], [SchoolYear], [SectionIdentifier], [SessionName])
REFERENCES [edfi].[Section] ([LocalCourseCode], [SchoolId], [SchoolYear], [SectionIdentifier], [SessionName])
ON DELETE CASCADE
ON UPDATE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_SectionCharacteristic_Section]
ON [edfi].[SectionCharacteristic] ([LocalCourseCode] ASC, [SchoolId] ASC, [SchoolYear] ASC, [SectionIdentifier] ASC, [SessionName] ASC)
GO
ALTER TABLE [edfi].[SectionCharacteristic] WITH CHECK ADD CONSTRAINT [FK_SectionCharacteristic_SectionCharacteristicDescriptor] FOREIGN KEY ([SectionCharacteristicDescriptorId])
REFERENCES [edfi].[SectionCharacteristicDescriptor] ([SectionCharacteristicDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_SectionCharacteristic_SectionCharacteristicDescriptor]
ON [edfi].[SectionCharacteristic] ([SectionCharacteristicDescriptorId] ASC)
GO
ALTER TABLE [edfi].[SectionCharacteristicDescriptor] WITH CHECK ADD CONSTRAINT [FK_SectionCharacteristicDescriptor_Descriptor] FOREIGN KEY ([SectionCharacteristicDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[SectionClassPeriod] WITH CHECK ADD CONSTRAINT [FK_SectionClassPeriod_ClassPeriod] FOREIGN KEY ([ClassPeriodName], [SchoolId])
REFERENCES [edfi].[ClassPeriod] ([ClassPeriodName], [SchoolId])
ON UPDATE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_SectionClassPeriod_ClassPeriod]
ON [edfi].[SectionClassPeriod] ([ClassPeriodName] ASC, [SchoolId] ASC)
GO
ALTER TABLE [edfi].[SectionClassPeriod] WITH CHECK ADD CONSTRAINT [FK_SectionClassPeriod_Section] FOREIGN KEY ([LocalCourseCode], [SchoolId], [SchoolYear], [SectionIdentifier], [SessionName])
REFERENCES [edfi].[Section] ([LocalCourseCode], [SchoolId], [SchoolYear], [SectionIdentifier], [SessionName])
ON DELETE CASCADE
ON UPDATE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_SectionClassPeriod_Section]
ON [edfi].[SectionClassPeriod] ([LocalCourseCode] ASC, [SchoolId] ASC, [SchoolYear] ASC, [SectionIdentifier] ASC, [SessionName] ASC)
GO
ALTER TABLE [edfi].[SectionCourseLevelCharacteristic] WITH CHECK ADD CONSTRAINT [FK_SectionCourseLevelCharacteristic_CourseLevelCharacteristicDescriptor] FOREIGN KEY ([CourseLevelCharacteristicDescriptorId])
REFERENCES [edfi].[CourseLevelCharacteristicDescriptor] ([CourseLevelCharacteristicDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_SectionCourseLevelCharacteristic_CourseLevelCharacteristicDescriptor]
ON [edfi].[SectionCourseLevelCharacteristic] ([CourseLevelCharacteristicDescriptorId] ASC)
GO
ALTER TABLE [edfi].[SectionCourseLevelCharacteristic] WITH CHECK ADD CONSTRAINT [FK_SectionCourseLevelCharacteristic_Section] FOREIGN KEY ([LocalCourseCode], [SchoolId], [SchoolYear], [SectionIdentifier], [SessionName])
REFERENCES [edfi].[Section] ([LocalCourseCode], [SchoolId], [SchoolYear], [SectionIdentifier], [SessionName])
ON DELETE CASCADE
ON UPDATE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_SectionCourseLevelCharacteristic_Section]
ON [edfi].[SectionCourseLevelCharacteristic] ([LocalCourseCode] ASC, [SchoolId] ASC, [SchoolYear] ASC, [SectionIdentifier] ASC, [SessionName] ASC)
GO
ALTER TABLE [edfi].[SectionOfferedGradeLevel] WITH CHECK ADD CONSTRAINT [FK_SectionOfferedGradeLevel_GradeLevelDescriptor] FOREIGN KEY ([GradeLevelDescriptorId])
REFERENCES [edfi].[GradeLevelDescriptor] ([GradeLevelDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_SectionOfferedGradeLevel_GradeLevelDescriptor]
ON [edfi].[SectionOfferedGradeLevel] ([GradeLevelDescriptorId] ASC)
GO
ALTER TABLE [edfi].[SectionOfferedGradeLevel] WITH CHECK ADD CONSTRAINT [FK_SectionOfferedGradeLevel_Section] FOREIGN KEY ([LocalCourseCode], [SchoolId], [SchoolYear], [SectionIdentifier], [SessionName])
REFERENCES [edfi].[Section] ([LocalCourseCode], [SchoolId], [SchoolYear], [SectionIdentifier], [SessionName])
ON DELETE CASCADE
ON UPDATE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_SectionOfferedGradeLevel_Section]
ON [edfi].[SectionOfferedGradeLevel] ([LocalCourseCode] ASC, [SchoolId] ASC, [SchoolYear] ASC, [SectionIdentifier] ASC, [SessionName] ASC)
GO
ALTER TABLE [edfi].[SectionProgram] WITH CHECK ADD CONSTRAINT [FK_SectionProgram_Program] FOREIGN KEY ([EducationOrganizationId], [ProgramName], [ProgramTypeDescriptorId])
REFERENCES [edfi].[Program] ([EducationOrganizationId], [ProgramName], [ProgramTypeDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_SectionProgram_Program]
ON [edfi].[SectionProgram] ([EducationOrganizationId] ASC, [ProgramName] ASC, [ProgramTypeDescriptorId] ASC)
GO
ALTER TABLE [edfi].[SectionProgram] WITH CHECK ADD CONSTRAINT [FK_SectionProgram_Section] FOREIGN KEY ([LocalCourseCode], [SchoolId], [SchoolYear], [SectionIdentifier], [SessionName])
REFERENCES [edfi].[Section] ([LocalCourseCode], [SchoolId], [SchoolYear], [SectionIdentifier], [SessionName])
ON DELETE CASCADE
ON UPDATE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_SectionProgram_Section]
ON [edfi].[SectionProgram] ([LocalCourseCode] ASC, [SchoolId] ASC, [SchoolYear] ASC, [SectionIdentifier] ASC, [SessionName] ASC)
GO
ALTER TABLE [edfi].[SeparationDescriptor] WITH CHECK ADD CONSTRAINT [FK_SeparationDescriptor_Descriptor] FOREIGN KEY ([SeparationDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[SeparationReasonDescriptor] WITH CHECK ADD CONSTRAINT [FK_SeparationReasonDescriptor_Descriptor] FOREIGN KEY ([SeparationReasonDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[ServiceDescriptor] WITH CHECK ADD CONSTRAINT [FK_ServiceDescriptor_Descriptor] FOREIGN KEY ([ServiceDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[Session] WITH CHECK ADD CONSTRAINT [FK_Session_School] FOREIGN KEY ([SchoolId])
REFERENCES [edfi].[School] ([SchoolId])
GO
CREATE NONCLUSTERED INDEX [FK_Session_School]
ON [edfi].[Session] ([SchoolId] ASC)
GO
ALTER TABLE [edfi].[Session] WITH CHECK ADD CONSTRAINT [FK_Session_SchoolYearType] FOREIGN KEY ([SchoolYear])
REFERENCES [edfi].[SchoolYearType] ([SchoolYear])
GO
CREATE NONCLUSTERED INDEX [FK_Session_SchoolYearType]
ON [edfi].[Session] ([SchoolYear] ASC)
GO
ALTER TABLE [edfi].[Session] WITH CHECK ADD CONSTRAINT [FK_Session_TermDescriptor] FOREIGN KEY ([TermDescriptorId])
REFERENCES [edfi].[TermDescriptor] ([TermDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_Session_TermDescriptor]
ON [edfi].[Session] ([TermDescriptorId] ASC)
GO
ALTER TABLE [edfi].[SessionAcademicWeek] WITH CHECK ADD CONSTRAINT [FK_SessionAcademicWeek_AcademicWeek] FOREIGN KEY ([SchoolId], [WeekIdentifier])
REFERENCES [edfi].[AcademicWeek] ([SchoolId], [WeekIdentifier])
GO
CREATE NONCLUSTERED INDEX [FK_SessionAcademicWeek_AcademicWeek]
ON [edfi].[SessionAcademicWeek] ([SchoolId] ASC, [WeekIdentifier] ASC)
GO
ALTER TABLE [edfi].[SessionAcademicWeek] WITH CHECK ADD CONSTRAINT [FK_SessionAcademicWeek_Session] FOREIGN KEY ([SchoolId], [SchoolYear], [SessionName])
REFERENCES [edfi].[Session] ([SchoolId], [SchoolYear], [SessionName])
ON DELETE CASCADE
ON UPDATE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_SessionAcademicWeek_Session]
ON [edfi].[SessionAcademicWeek] ([SchoolId] ASC, [SchoolYear] ASC, [SessionName] ASC)
GO
ALTER TABLE [edfi].[SessionGradingPeriod] WITH CHECK ADD CONSTRAINT [FK_SessionGradingPeriod_GradingPeriod] FOREIGN KEY ([GradingPeriodDescriptorId], [PeriodSequence], [SchoolId], [SchoolYear])
REFERENCES [edfi].[GradingPeriod] ([GradingPeriodDescriptorId], [PeriodSequence], [SchoolId], [SchoolYear])
GO
CREATE NONCLUSTERED INDEX [FK_SessionGradingPeriod_GradingPeriod]
ON [edfi].[SessionGradingPeriod] ([GradingPeriodDescriptorId] ASC, [PeriodSequence] ASC, [SchoolId] ASC, [SchoolYear] ASC)
GO
ALTER TABLE [edfi].[SessionGradingPeriod] WITH CHECK ADD CONSTRAINT [FK_SessionGradingPeriod_Session] FOREIGN KEY ([SchoolId], [SchoolYear], [SessionName])
REFERENCES [edfi].[Session] ([SchoolId], [SchoolYear], [SessionName])
ON DELETE CASCADE
ON UPDATE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_SessionGradingPeriod_Session]
ON [edfi].[SessionGradingPeriod] ([SchoolId] ASC, [SchoolYear] ASC, [SessionName] ASC)
GO
ALTER TABLE [edfi].[SexDescriptor] WITH CHECK ADD CONSTRAINT [FK_SexDescriptor_Descriptor] FOREIGN KEY ([SexDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[SourceSystemDescriptor] WITH CHECK ADD CONSTRAINT [FK_SourceSystemDescriptor_Descriptor] FOREIGN KEY ([SourceSystemDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[SpecialEducationProgramServiceDescriptor] WITH CHECK ADD CONSTRAINT [FK_SpecialEducationProgramServiceDescriptor_Descriptor] FOREIGN KEY ([SpecialEducationProgramServiceDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[SpecialEducationSettingDescriptor] WITH CHECK ADD CONSTRAINT [FK_SpecialEducationSettingDescriptor_Descriptor] FOREIGN KEY ([SpecialEducationSettingDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[Staff] WITH CHECK ADD CONSTRAINT [FK_Staff_CitizenshipStatusDescriptor] FOREIGN KEY ([CitizenshipStatusDescriptorId])
REFERENCES [edfi].[CitizenshipStatusDescriptor] ([CitizenshipStatusDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_Staff_CitizenshipStatusDescriptor]
ON [edfi].[Staff] ([CitizenshipStatusDescriptorId] ASC)
GO
ALTER TABLE [edfi].[Staff] WITH CHECK ADD CONSTRAINT [FK_Staff_LevelOfEducationDescriptor] FOREIGN KEY ([HighestCompletedLevelOfEducationDescriptorId])
REFERENCES [edfi].[LevelOfEducationDescriptor] ([LevelOfEducationDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_Staff_LevelOfEducationDescriptor]
ON [edfi].[Staff] ([HighestCompletedLevelOfEducationDescriptorId] ASC)
GO
ALTER TABLE [edfi].[Staff] WITH CHECK ADD CONSTRAINT [FK_Staff_OldEthnicityDescriptor] FOREIGN KEY ([OldEthnicityDescriptorId])
REFERENCES [edfi].[OldEthnicityDescriptor] ([OldEthnicityDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_Staff_OldEthnicityDescriptor]
ON [edfi].[Staff] ([OldEthnicityDescriptorId] ASC)
GO
ALTER TABLE [edfi].[Staff] WITH CHECK ADD CONSTRAINT [FK_Staff_Person] FOREIGN KEY ([PersonId], [SourceSystemDescriptorId])
REFERENCES [edfi].[Person] ([PersonId], [SourceSystemDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_Staff_Person]
ON [edfi].[Staff] ([PersonId] ASC, [SourceSystemDescriptorId] ASC)
GO
ALTER TABLE [edfi].[Staff] WITH CHECK ADD CONSTRAINT [FK_Staff_SexDescriptor] FOREIGN KEY ([SexDescriptorId])
REFERENCES [edfi].[SexDescriptor] ([SexDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_Staff_SexDescriptor]
ON [edfi].[Staff] ([SexDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StaffAbsenceEvent] WITH CHECK ADD CONSTRAINT [FK_StaffAbsenceEvent_AbsenceEventCategoryDescriptor] FOREIGN KEY ([AbsenceEventCategoryDescriptorId])
REFERENCES [edfi].[AbsenceEventCategoryDescriptor] ([AbsenceEventCategoryDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StaffAbsenceEvent_AbsenceEventCategoryDescriptor]
ON [edfi].[StaffAbsenceEvent] ([AbsenceEventCategoryDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StaffAbsenceEvent] WITH CHECK ADD CONSTRAINT [FK_StaffAbsenceEvent_Staff] FOREIGN KEY ([StaffUSI])
REFERENCES [edfi].[Staff] ([StaffUSI])
GO
CREATE NONCLUSTERED INDEX [FK_StaffAbsenceEvent_Staff]
ON [edfi].[StaffAbsenceEvent] ([StaffUSI] ASC)
GO
ALTER TABLE [edfi].[StaffAddress] WITH CHECK ADD CONSTRAINT [FK_StaffAddress_AddressTypeDescriptor] FOREIGN KEY ([AddressTypeDescriptorId])
REFERENCES [edfi].[AddressTypeDescriptor] ([AddressTypeDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StaffAddress_AddressTypeDescriptor]
ON [edfi].[StaffAddress] ([AddressTypeDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StaffAddress] WITH CHECK ADD CONSTRAINT [FK_StaffAddress_LocaleDescriptor] FOREIGN KEY ([LocaleDescriptorId])
REFERENCES [edfi].[LocaleDescriptor] ([LocaleDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StaffAddress_LocaleDescriptor]
ON [edfi].[StaffAddress] ([LocaleDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StaffAddress] WITH CHECK ADD CONSTRAINT [FK_StaffAddress_Staff] FOREIGN KEY ([StaffUSI])
REFERENCES [edfi].[Staff] ([StaffUSI])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_StaffAddress_Staff]
ON [edfi].[StaffAddress] ([StaffUSI] ASC)
GO
ALTER TABLE [edfi].[StaffAddress] WITH CHECK ADD CONSTRAINT [FK_StaffAddress_StateAbbreviationDescriptor] FOREIGN KEY ([StateAbbreviationDescriptorId])
REFERENCES [edfi].[StateAbbreviationDescriptor] ([StateAbbreviationDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StaffAddress_StateAbbreviationDescriptor]
ON [edfi].[StaffAddress] ([StateAbbreviationDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StaffAddressPeriod] WITH CHECK ADD CONSTRAINT [FK_StaffAddressPeriod_StaffAddress] FOREIGN KEY ([AddressTypeDescriptorId], [City], [PostalCode], [StaffUSI], [StateAbbreviationDescriptorId], [StreetNumberName])
REFERENCES [edfi].[StaffAddress] ([AddressTypeDescriptorId], [City], [PostalCode], [StaffUSI], [StateAbbreviationDescriptorId], [StreetNumberName])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_StaffAddressPeriod_StaffAddress]
ON [edfi].[StaffAddressPeriod] ([AddressTypeDescriptorId] ASC, [City] ASC, [PostalCode] ASC, [StaffUSI] ASC, [StateAbbreviationDescriptorId] ASC, [StreetNumberName] ASC)
GO
ALTER TABLE [edfi].[StaffAncestryEthnicOrigin] WITH CHECK ADD CONSTRAINT [FK_StaffAncestryEthnicOrigin_AncestryEthnicOriginDescriptor] FOREIGN KEY ([AncestryEthnicOriginDescriptorId])
REFERENCES [edfi].[AncestryEthnicOriginDescriptor] ([AncestryEthnicOriginDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StaffAncestryEthnicOrigin_AncestryEthnicOriginDescriptor]
ON [edfi].[StaffAncestryEthnicOrigin] ([AncestryEthnicOriginDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StaffAncestryEthnicOrigin] WITH CHECK ADD CONSTRAINT [FK_StaffAncestryEthnicOrigin_Staff] FOREIGN KEY ([StaffUSI])
REFERENCES [edfi].[Staff] ([StaffUSI])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_StaffAncestryEthnicOrigin_Staff]
ON [edfi].[StaffAncestryEthnicOrigin] ([StaffUSI] ASC)
GO
ALTER TABLE [edfi].[StaffClassificationDescriptor] WITH CHECK ADD CONSTRAINT [FK_StaffClassificationDescriptor_Descriptor] FOREIGN KEY ([StaffClassificationDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[StaffCohortAssociation] WITH CHECK ADD CONSTRAINT [FK_StaffCohortAssociation_Cohort] FOREIGN KEY ([CohortIdentifier], [EducationOrganizationId])
REFERENCES [edfi].[Cohort] ([CohortIdentifier], [EducationOrganizationId])
GO
CREATE NONCLUSTERED INDEX [FK_StaffCohortAssociation_Cohort]
ON [edfi].[StaffCohortAssociation] ([CohortIdentifier] ASC, [EducationOrganizationId] ASC)
GO
ALTER TABLE [edfi].[StaffCohortAssociation] WITH CHECK ADD CONSTRAINT [FK_StaffCohortAssociation_Staff] FOREIGN KEY ([StaffUSI])
REFERENCES [edfi].[Staff] ([StaffUSI])
GO
CREATE NONCLUSTERED INDEX [FK_StaffCohortAssociation_Staff]
ON [edfi].[StaffCohortAssociation] ([StaffUSI] ASC)
GO
ALTER TABLE [edfi].[StaffCredential] WITH CHECK ADD CONSTRAINT [FK_StaffCredential_Credential] FOREIGN KEY ([CredentialIdentifier], [StateOfIssueStateAbbreviationDescriptorId])
REFERENCES [edfi].[Credential] ([CredentialIdentifier], [StateOfIssueStateAbbreviationDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StaffCredential_Credential]
ON [edfi].[StaffCredential] ([CredentialIdentifier] ASC, [StateOfIssueStateAbbreviationDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StaffCredential] WITH CHECK ADD CONSTRAINT [FK_StaffCredential_Staff] FOREIGN KEY ([StaffUSI])
REFERENCES [edfi].[Staff] ([StaffUSI])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_StaffCredential_Staff]
ON [edfi].[StaffCredential] ([StaffUSI] ASC)
GO
ALTER TABLE [edfi].[StaffDisciplineIncidentAssociation] WITH CHECK ADD CONSTRAINT [FK_StaffDisciplineIncidentAssociation_DisciplineIncident] FOREIGN KEY ([IncidentIdentifier], [SchoolId])
REFERENCES [edfi].[DisciplineIncident] ([IncidentIdentifier], [SchoolId])
GO
CREATE NONCLUSTERED INDEX [FK_StaffDisciplineIncidentAssociation_DisciplineIncident]
ON [edfi].[StaffDisciplineIncidentAssociation] ([IncidentIdentifier] ASC, [SchoolId] ASC)
GO
ALTER TABLE [edfi].[StaffDisciplineIncidentAssociation] WITH CHECK ADD CONSTRAINT [FK_StaffDisciplineIncidentAssociation_Staff] FOREIGN KEY ([StaffUSI])
REFERENCES [edfi].[Staff] ([StaffUSI])
GO
CREATE NONCLUSTERED INDEX [FK_StaffDisciplineIncidentAssociation_Staff]
ON [edfi].[StaffDisciplineIncidentAssociation] ([StaffUSI] ASC)
GO
ALTER TABLE [edfi].[StaffDisciplineIncidentAssociationDisciplineIncidentParticipationCode] WITH CHECK ADD CONSTRAINT [FK_StaffDisciplineIncidentAssociationDisciplineIncidentParticipationCode_DisciplineIncidentParticipationCodeDescriptor] FOREIGN KEY ([DisciplineIncidentParticipationCodeDescriptorId])
REFERENCES [edfi].[DisciplineIncidentParticipationCodeDescriptor] ([DisciplineIncidentParticipationCodeDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StaffDisciplineIncidentAssociationDisciplineIncidentParticipationCode_DisciplineIncidentParticipationCodeDescriptor]
ON [edfi].[StaffDisciplineIncidentAssociationDisciplineIncidentParticipationCode] ([DisciplineIncidentParticipationCodeDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StaffDisciplineIncidentAssociationDisciplineIncidentParticipationCode] WITH CHECK ADD CONSTRAINT [FK_StaffDisciplineIncidentAssociationDisciplineIncidentParticipationCode_StaffDisciplineIncidentAssociation] FOREIGN KEY ([IncidentIdentifier], [SchoolId], [StaffUSI])
REFERENCES [edfi].[StaffDisciplineIncidentAssociation] ([IncidentIdentifier], [SchoolId], [StaffUSI])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_StaffDisciplineIncidentAssociationDisciplineIncidentParticipationCode_StaffDisciplineIncidentAssociation]
ON [edfi].[StaffDisciplineIncidentAssociationDisciplineIncidentParticipationCode] ([IncidentIdentifier] ASC, [SchoolId] ASC, [StaffUSI] ASC)
GO
ALTER TABLE [edfi].[StaffEducationOrganizationAssignmentAssociation] WITH CHECK ADD CONSTRAINT [FK_StaffEducationOrganizationAssignmentAssociation_Credential] FOREIGN KEY ([CredentialIdentifier], [StateOfIssueStateAbbreviationDescriptorId])
REFERENCES [edfi].[Credential] ([CredentialIdentifier], [StateOfIssueStateAbbreviationDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StaffEducationOrganizationAssignmentAssociation_Credential]
ON [edfi].[StaffEducationOrganizationAssignmentAssociation] ([CredentialIdentifier] ASC, [StateOfIssueStateAbbreviationDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StaffEducationOrganizationAssignmentAssociation] WITH CHECK ADD CONSTRAINT [FK_StaffEducationOrganizationAssignmentAssociation_EducationOrganization] FOREIGN KEY ([EducationOrganizationId])
REFERENCES [edfi].[EducationOrganization] ([EducationOrganizationId])
GO
CREATE NONCLUSTERED INDEX [FK_StaffEducationOrganizationAssignmentAssociation_EducationOrganization]
ON [edfi].[StaffEducationOrganizationAssignmentAssociation] ([EducationOrganizationId] ASC)
GO
ALTER TABLE [edfi].[StaffEducationOrganizationAssignmentAssociation] WITH CHECK ADD CONSTRAINT [FK_StaffEducationOrganizationAssignmentAssociation_Staff] FOREIGN KEY ([StaffUSI])
REFERENCES [edfi].[Staff] ([StaffUSI])
GO
CREATE NONCLUSTERED INDEX [FK_StaffEducationOrganizationAssignmentAssociation_Staff]
ON [edfi].[StaffEducationOrganizationAssignmentAssociation] ([StaffUSI] ASC)
GO
ALTER TABLE [edfi].[StaffEducationOrganizationAssignmentAssociation] WITH CHECK ADD CONSTRAINT [FK_StaffEducationOrganizationAssignmentAssociation_StaffClassificationDescriptor] FOREIGN KEY ([StaffClassificationDescriptorId])
REFERENCES [edfi].[StaffClassificationDescriptor] ([StaffClassificationDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StaffEducationOrganizationAssignmentAssociation_StaffClassificationDescriptor]
ON [edfi].[StaffEducationOrganizationAssignmentAssociation] ([StaffClassificationDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StaffEducationOrganizationAssignmentAssociation] WITH CHECK ADD CONSTRAINT [FK_StaffEducationOrganizationAssignmentAssociation_StaffEducationOrganizationEmploymentAssociation] FOREIGN KEY ([EmploymentEducationOrganizationId], [EmploymentStatusDescriptorId], [EmploymentHireDate], [StaffUSI])
REFERENCES [edfi].[StaffEducationOrganizationEmploymentAssociation] ([EducationOrganizationId], [EmploymentStatusDescriptorId], [HireDate], [StaffUSI])
GO
CREATE NONCLUSTERED INDEX [FK_StaffEducationOrganizationAssignmentAssociation_StaffEducationOrganizationEmploymentAssociation]
ON [edfi].[StaffEducationOrganizationAssignmentAssociation] ([EmploymentEducationOrganizationId] ASC, [EmploymentStatusDescriptorId] ASC, [EmploymentHireDate] ASC, [StaffUSI] ASC)
GO
ALTER TABLE [edfi].[StaffEducationOrganizationContactAssociation] WITH CHECK ADD CONSTRAINT [FK_StaffEducationOrganizationContactAssociation_ContactTypeDescriptor] FOREIGN KEY ([ContactTypeDescriptorId])
REFERENCES [edfi].[ContactTypeDescriptor] ([ContactTypeDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StaffEducationOrganizationContactAssociation_ContactTypeDescriptor]
ON [edfi].[StaffEducationOrganizationContactAssociation] ([ContactTypeDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StaffEducationOrganizationContactAssociation] WITH CHECK ADD CONSTRAINT [FK_StaffEducationOrganizationContactAssociation_EducationOrganization] FOREIGN KEY ([EducationOrganizationId])
REFERENCES [edfi].[EducationOrganization] ([EducationOrganizationId])
GO
CREATE NONCLUSTERED INDEX [FK_StaffEducationOrganizationContactAssociation_EducationOrganization]
ON [edfi].[StaffEducationOrganizationContactAssociation] ([EducationOrganizationId] ASC)
GO
ALTER TABLE [edfi].[StaffEducationOrganizationContactAssociation] WITH CHECK ADD CONSTRAINT [FK_StaffEducationOrganizationContactAssociation_Staff] FOREIGN KEY ([StaffUSI])
REFERENCES [edfi].[Staff] ([StaffUSI])
GO
CREATE NONCLUSTERED INDEX [FK_StaffEducationOrganizationContactAssociation_Staff]
ON [edfi].[StaffEducationOrganizationContactAssociation] ([StaffUSI] ASC)
GO
ALTER TABLE [edfi].[StaffEducationOrganizationContactAssociationAddress] WITH CHECK ADD CONSTRAINT [FK_StaffEducationOrganizationContactAssociationAddress_AddressTypeDescriptor] FOREIGN KEY ([AddressTypeDescriptorId])
REFERENCES [edfi].[AddressTypeDescriptor] ([AddressTypeDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StaffEducationOrganizationContactAssociationAddress_AddressTypeDescriptor]
ON [edfi].[StaffEducationOrganizationContactAssociationAddress] ([AddressTypeDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StaffEducationOrganizationContactAssociationAddress] WITH CHECK ADD CONSTRAINT [FK_StaffEducationOrganizationContactAssociationAddress_LocaleDescriptor] FOREIGN KEY ([LocaleDescriptorId])
REFERENCES [edfi].[LocaleDescriptor] ([LocaleDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StaffEducationOrganizationContactAssociationAddress_LocaleDescriptor]
ON [edfi].[StaffEducationOrganizationContactAssociationAddress] ([LocaleDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StaffEducationOrganizationContactAssociationAddress] WITH CHECK ADD CONSTRAINT [FK_StaffEducationOrganizationContactAssociationAddress_StaffEducationOrganizationContactAssociation] FOREIGN KEY ([ContactTitle], [EducationOrganizationId], [StaffUSI])
REFERENCES [edfi].[StaffEducationOrganizationContactAssociation] ([ContactTitle], [EducationOrganizationId], [StaffUSI])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[StaffEducationOrganizationContactAssociationAddress] WITH CHECK ADD CONSTRAINT [FK_StaffEducationOrganizationContactAssociationAddress_StateAbbreviationDescriptor] FOREIGN KEY ([StateAbbreviationDescriptorId])
REFERENCES [edfi].[StateAbbreviationDescriptor] ([StateAbbreviationDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StaffEducationOrganizationContactAssociationAddress_StateAbbreviationDescriptor]
ON [edfi].[StaffEducationOrganizationContactAssociationAddress] ([StateAbbreviationDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StaffEducationOrganizationContactAssociationAddressPeriod] WITH CHECK ADD CONSTRAINT [FK_StaffEducationOrganizationContactAssociationAddressPeriod_StaffEducationOrganizationContactAssociationAddress] FOREIGN KEY ([ContactTitle], [EducationOrganizationId], [StaffUSI])
REFERENCES [edfi].[StaffEducationOrganizationContactAssociationAddress] ([ContactTitle], [EducationOrganizationId], [StaffUSI])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_StaffEducationOrganizationContactAssociationAddressPeriod_StaffEducationOrganizationContactAssociationAddress]
ON [edfi].[StaffEducationOrganizationContactAssociationAddressPeriod] ([ContactTitle] ASC, [EducationOrganizationId] ASC, [StaffUSI] ASC)
GO
ALTER TABLE [edfi].[StaffEducationOrganizationContactAssociationTelephone] WITH CHECK ADD CONSTRAINT [FK_StaffEducationOrganizationContactAssociationTelephone_StaffEducationOrganizationContactAssociation] FOREIGN KEY ([ContactTitle], [EducationOrganizationId], [StaffUSI])
REFERENCES [edfi].[StaffEducationOrganizationContactAssociation] ([ContactTitle], [EducationOrganizationId], [StaffUSI])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_StaffEducationOrganizationContactAssociationTelephone_StaffEducationOrganizationContactAssociation]
ON [edfi].[StaffEducationOrganizationContactAssociationTelephone] ([ContactTitle] ASC, [EducationOrganizationId] ASC, [StaffUSI] ASC)
GO
ALTER TABLE [edfi].[StaffEducationOrganizationContactAssociationTelephone] WITH CHECK ADD CONSTRAINT [FK_StaffEducationOrganizationContactAssociationTelephone_TelephoneNumberTypeDescriptor] FOREIGN KEY ([TelephoneNumberTypeDescriptorId])
REFERENCES [edfi].[TelephoneNumberTypeDescriptor] ([TelephoneNumberTypeDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StaffEducationOrganizationContactAssociationTelephone_TelephoneNumberTypeDescriptor]
ON [edfi].[StaffEducationOrganizationContactAssociationTelephone] ([TelephoneNumberTypeDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StaffEducationOrganizationEmploymentAssociation] WITH CHECK ADD CONSTRAINT [FK_StaffEducationOrganizationEmploymentAssociation_Credential] FOREIGN KEY ([CredentialIdentifier], [StateOfIssueStateAbbreviationDescriptorId])
REFERENCES [edfi].[Credential] ([CredentialIdentifier], [StateOfIssueStateAbbreviationDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StaffEducationOrganizationEmploymentAssociation_Credential]
ON [edfi].[StaffEducationOrganizationEmploymentAssociation] ([CredentialIdentifier] ASC, [StateOfIssueStateAbbreviationDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StaffEducationOrganizationEmploymentAssociation] WITH CHECK ADD CONSTRAINT [FK_StaffEducationOrganizationEmploymentAssociation_EducationOrganization] FOREIGN KEY ([EducationOrganizationId])
REFERENCES [edfi].[EducationOrganization] ([EducationOrganizationId])
GO
CREATE NONCLUSTERED INDEX [FK_StaffEducationOrganizationEmploymentAssociation_EducationOrganization]
ON [edfi].[StaffEducationOrganizationEmploymentAssociation] ([EducationOrganizationId] ASC)
GO
ALTER TABLE [edfi].[StaffEducationOrganizationEmploymentAssociation] WITH CHECK ADD CONSTRAINT [FK_StaffEducationOrganizationEmploymentAssociation_EmploymentStatusDescriptor] FOREIGN KEY ([EmploymentStatusDescriptorId])
REFERENCES [edfi].[EmploymentStatusDescriptor] ([EmploymentStatusDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StaffEducationOrganizationEmploymentAssociation_EmploymentStatusDescriptor]
ON [edfi].[StaffEducationOrganizationEmploymentAssociation] ([EmploymentStatusDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StaffEducationOrganizationEmploymentAssociation] WITH CHECK ADD CONSTRAINT [FK_StaffEducationOrganizationEmploymentAssociation_SeparationDescriptor] FOREIGN KEY ([SeparationDescriptorId])
REFERENCES [edfi].[SeparationDescriptor] ([SeparationDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StaffEducationOrganizationEmploymentAssociation_SeparationDescriptor]
ON [edfi].[StaffEducationOrganizationEmploymentAssociation] ([SeparationDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StaffEducationOrganizationEmploymentAssociation] WITH CHECK ADD CONSTRAINT [FK_StaffEducationOrganizationEmploymentAssociation_SeparationReasonDescriptor] FOREIGN KEY ([SeparationReasonDescriptorId])
REFERENCES [edfi].[SeparationReasonDescriptor] ([SeparationReasonDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StaffEducationOrganizationEmploymentAssociation_SeparationReasonDescriptor]
ON [edfi].[StaffEducationOrganizationEmploymentAssociation] ([SeparationReasonDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StaffEducationOrganizationEmploymentAssociation] WITH CHECK ADD CONSTRAINT [FK_StaffEducationOrganizationEmploymentAssociation_Staff] FOREIGN KEY ([StaffUSI])
REFERENCES [edfi].[Staff] ([StaffUSI])
GO
CREATE NONCLUSTERED INDEX [FK_StaffEducationOrganizationEmploymentAssociation_Staff]
ON [edfi].[StaffEducationOrganizationEmploymentAssociation] ([StaffUSI] ASC)
GO
ALTER TABLE [edfi].[StaffElectronicMail] WITH CHECK ADD CONSTRAINT [FK_StaffElectronicMail_ElectronicMailTypeDescriptor] FOREIGN KEY ([ElectronicMailTypeDescriptorId])
REFERENCES [edfi].[ElectronicMailTypeDescriptor] ([ElectronicMailTypeDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StaffElectronicMail_ElectronicMailTypeDescriptor]
ON [edfi].[StaffElectronicMail] ([ElectronicMailTypeDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StaffElectronicMail] WITH CHECK ADD CONSTRAINT [FK_StaffElectronicMail_Staff] FOREIGN KEY ([StaffUSI])
REFERENCES [edfi].[Staff] ([StaffUSI])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_StaffElectronicMail_Staff]
ON [edfi].[StaffElectronicMail] ([StaffUSI] ASC)
GO
ALTER TABLE [edfi].[StaffIdentificationCode] WITH CHECK ADD CONSTRAINT [FK_StaffIdentificationCode_Staff] FOREIGN KEY ([StaffUSI])
REFERENCES [edfi].[Staff] ([StaffUSI])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_StaffIdentificationCode_Staff]
ON [edfi].[StaffIdentificationCode] ([StaffUSI] ASC)
GO
ALTER TABLE [edfi].[StaffIdentificationCode] WITH CHECK ADD CONSTRAINT [FK_StaffIdentificationCode_StaffIdentificationSystemDescriptor] FOREIGN KEY ([StaffIdentificationSystemDescriptorId])
REFERENCES [edfi].[StaffIdentificationSystemDescriptor] ([StaffIdentificationSystemDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StaffIdentificationCode_StaffIdentificationSystemDescriptor]
ON [edfi].[StaffIdentificationCode] ([StaffIdentificationSystemDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StaffIdentificationDocument] WITH CHECK ADD CONSTRAINT [FK_StaffIdentificationDocument_CountryDescriptor] FOREIGN KEY ([IssuerCountryDescriptorId])
REFERENCES [edfi].[CountryDescriptor] ([CountryDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StaffIdentificationDocument_CountryDescriptor]
ON [edfi].[StaffIdentificationDocument] ([IssuerCountryDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StaffIdentificationDocument] WITH CHECK ADD CONSTRAINT [FK_StaffIdentificationDocument_IdentificationDocumentUseDescriptor] FOREIGN KEY ([IdentificationDocumentUseDescriptorId])
REFERENCES [edfi].[IdentificationDocumentUseDescriptor] ([IdentificationDocumentUseDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StaffIdentificationDocument_IdentificationDocumentUseDescriptor]
ON [edfi].[StaffIdentificationDocument] ([IdentificationDocumentUseDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StaffIdentificationDocument] WITH CHECK ADD CONSTRAINT [FK_StaffIdentificationDocument_PersonalInformationVerificationDescriptor] FOREIGN KEY ([PersonalInformationVerificationDescriptorId])
REFERENCES [edfi].[PersonalInformationVerificationDescriptor] ([PersonalInformationVerificationDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StaffIdentificationDocument_PersonalInformationVerificationDescriptor]
ON [edfi].[StaffIdentificationDocument] ([PersonalInformationVerificationDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StaffIdentificationDocument] WITH CHECK ADD CONSTRAINT [FK_StaffIdentificationDocument_Staff] FOREIGN KEY ([StaffUSI])
REFERENCES [edfi].[Staff] ([StaffUSI])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_StaffIdentificationDocument_Staff]
ON [edfi].[StaffIdentificationDocument] ([StaffUSI] ASC)
GO
ALTER TABLE [edfi].[StaffIdentificationSystemDescriptor] WITH CHECK ADD CONSTRAINT [FK_StaffIdentificationSystemDescriptor_Descriptor] FOREIGN KEY ([StaffIdentificationSystemDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[StaffInternationalAddress] WITH CHECK ADD CONSTRAINT [FK_StaffInternationalAddress_AddressTypeDescriptor] FOREIGN KEY ([AddressTypeDescriptorId])
REFERENCES [edfi].[AddressTypeDescriptor] ([AddressTypeDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StaffInternationalAddress_AddressTypeDescriptor]
ON [edfi].[StaffInternationalAddress] ([AddressTypeDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StaffInternationalAddress] WITH CHECK ADD CONSTRAINT [FK_StaffInternationalAddress_CountryDescriptor] FOREIGN KEY ([CountryDescriptorId])
REFERENCES [edfi].[CountryDescriptor] ([CountryDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StaffInternationalAddress_CountryDescriptor]
ON [edfi].[StaffInternationalAddress] ([CountryDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StaffInternationalAddress] WITH CHECK ADD CONSTRAINT [FK_StaffInternationalAddress_Staff] FOREIGN KEY ([StaffUSI])
REFERENCES [edfi].[Staff] ([StaffUSI])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_StaffInternationalAddress_Staff]
ON [edfi].[StaffInternationalAddress] ([StaffUSI] ASC)
GO
ALTER TABLE [edfi].[StaffLanguage] WITH CHECK ADD CONSTRAINT [FK_StaffLanguage_LanguageDescriptor] FOREIGN KEY ([LanguageDescriptorId])
REFERENCES [edfi].[LanguageDescriptor] ([LanguageDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StaffLanguage_LanguageDescriptor]
ON [edfi].[StaffLanguage] ([LanguageDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StaffLanguage] WITH CHECK ADD CONSTRAINT [FK_StaffLanguage_Staff] FOREIGN KEY ([StaffUSI])
REFERENCES [edfi].[Staff] ([StaffUSI])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_StaffLanguage_Staff]
ON [edfi].[StaffLanguage] ([StaffUSI] ASC)
GO
ALTER TABLE [edfi].[StaffLanguageUse] WITH CHECK ADD CONSTRAINT [FK_StaffLanguageUse_LanguageUseDescriptor] FOREIGN KEY ([LanguageUseDescriptorId])
REFERENCES [edfi].[LanguageUseDescriptor] ([LanguageUseDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StaffLanguageUse_LanguageUseDescriptor]
ON [edfi].[StaffLanguageUse] ([LanguageUseDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StaffLanguageUse] WITH CHECK ADD CONSTRAINT [FK_StaffLanguageUse_StaffLanguage] FOREIGN KEY ([LanguageDescriptorId], [StaffUSI])
REFERENCES [edfi].[StaffLanguage] ([LanguageDescriptorId], [StaffUSI])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_StaffLanguageUse_StaffLanguage]
ON [edfi].[StaffLanguageUse] ([LanguageDescriptorId] ASC, [StaffUSI] ASC)
GO
ALTER TABLE [edfi].[StaffLeave] WITH CHECK ADD CONSTRAINT [FK_StaffLeave_Staff] FOREIGN KEY ([StaffUSI])
REFERENCES [edfi].[Staff] ([StaffUSI])
GO
CREATE NONCLUSTERED INDEX [FK_StaffLeave_Staff]
ON [edfi].[StaffLeave] ([StaffUSI] ASC)
GO
ALTER TABLE [edfi].[StaffLeave] WITH CHECK ADD CONSTRAINT [FK_StaffLeave_StaffLeaveEventCategoryDescriptor] FOREIGN KEY ([StaffLeaveEventCategoryDescriptorId])
REFERENCES [edfi].[StaffLeaveEventCategoryDescriptor] ([StaffLeaveEventCategoryDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StaffLeave_StaffLeaveEventCategoryDescriptor]
ON [edfi].[StaffLeave] ([StaffLeaveEventCategoryDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StaffLeaveEventCategoryDescriptor] WITH CHECK ADD CONSTRAINT [FK_StaffLeaveEventCategoryDescriptor_Descriptor] FOREIGN KEY ([StaffLeaveEventCategoryDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[StaffOtherName] WITH CHECK ADD CONSTRAINT [FK_StaffOtherName_OtherNameTypeDescriptor] FOREIGN KEY ([OtherNameTypeDescriptorId])
REFERENCES [edfi].[OtherNameTypeDescriptor] ([OtherNameTypeDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StaffOtherName_OtherNameTypeDescriptor]
ON [edfi].[StaffOtherName] ([OtherNameTypeDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StaffOtherName] WITH CHECK ADD CONSTRAINT [FK_StaffOtherName_Staff] FOREIGN KEY ([StaffUSI])
REFERENCES [edfi].[Staff] ([StaffUSI])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_StaffOtherName_Staff]
ON [edfi].[StaffOtherName] ([StaffUSI] ASC)
GO
ALTER TABLE [edfi].[StaffPersonalIdentificationDocument] WITH CHECK ADD CONSTRAINT [FK_StaffPersonalIdentificationDocument_CountryDescriptor] FOREIGN KEY ([IssuerCountryDescriptorId])
REFERENCES [edfi].[CountryDescriptor] ([CountryDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StaffPersonalIdentificationDocument_CountryDescriptor]
ON [edfi].[StaffPersonalIdentificationDocument] ([IssuerCountryDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StaffPersonalIdentificationDocument] WITH CHECK ADD CONSTRAINT [FK_StaffPersonalIdentificationDocument_IdentificationDocumentUseDescriptor] FOREIGN KEY ([IdentificationDocumentUseDescriptorId])
REFERENCES [edfi].[IdentificationDocumentUseDescriptor] ([IdentificationDocumentUseDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StaffPersonalIdentificationDocument_IdentificationDocumentUseDescriptor]
ON [edfi].[StaffPersonalIdentificationDocument] ([IdentificationDocumentUseDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StaffPersonalIdentificationDocument] WITH CHECK ADD CONSTRAINT [FK_StaffPersonalIdentificationDocument_PersonalInformationVerificationDescriptor] FOREIGN KEY ([PersonalInformationVerificationDescriptorId])
REFERENCES [edfi].[PersonalInformationVerificationDescriptor] ([PersonalInformationVerificationDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StaffPersonalIdentificationDocument_PersonalInformationVerificationDescriptor]
ON [edfi].[StaffPersonalIdentificationDocument] ([PersonalInformationVerificationDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StaffPersonalIdentificationDocument] WITH CHECK ADD CONSTRAINT [FK_StaffPersonalIdentificationDocument_Staff] FOREIGN KEY ([StaffUSI])
REFERENCES [edfi].[Staff] ([StaffUSI])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_StaffPersonalIdentificationDocument_Staff]
ON [edfi].[StaffPersonalIdentificationDocument] ([StaffUSI] ASC)
GO
ALTER TABLE [edfi].[StaffProgramAssociation] WITH CHECK ADD CONSTRAINT [FK_StaffProgramAssociation_Program] FOREIGN KEY ([ProgramEducationOrganizationId], [ProgramName], [ProgramTypeDescriptorId])
REFERENCES [edfi].[Program] ([EducationOrganizationId], [ProgramName], [ProgramTypeDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StaffProgramAssociation_Program]
ON [edfi].[StaffProgramAssociation] ([ProgramEducationOrganizationId] ASC, [ProgramName] ASC, [ProgramTypeDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StaffProgramAssociation] WITH CHECK ADD CONSTRAINT [FK_StaffProgramAssociation_Staff] FOREIGN KEY ([StaffUSI])
REFERENCES [edfi].[Staff] ([StaffUSI])
GO
CREATE NONCLUSTERED INDEX [FK_StaffProgramAssociation_Staff]
ON [edfi].[StaffProgramAssociation] ([StaffUSI] ASC)
GO
ALTER TABLE [edfi].[StaffRace] WITH CHECK ADD CONSTRAINT [FK_StaffRace_RaceDescriptor] FOREIGN KEY ([RaceDescriptorId])
REFERENCES [edfi].[RaceDescriptor] ([RaceDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StaffRace_RaceDescriptor]
ON [edfi].[StaffRace] ([RaceDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StaffRace] WITH CHECK ADD CONSTRAINT [FK_StaffRace_Staff] FOREIGN KEY ([StaffUSI])
REFERENCES [edfi].[Staff] ([StaffUSI])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_StaffRace_Staff]
ON [edfi].[StaffRace] ([StaffUSI] ASC)
GO
ALTER TABLE [edfi].[StaffRecognition] WITH CHECK ADD CONSTRAINT [FK_StaffRecognition_AchievementCategoryDescriptor] FOREIGN KEY ([AchievementCategoryDescriptorId])
REFERENCES [edfi].[AchievementCategoryDescriptor] ([AchievementCategoryDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StaffRecognition_AchievementCategoryDescriptor]
ON [edfi].[StaffRecognition] ([AchievementCategoryDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StaffRecognition] WITH CHECK ADD CONSTRAINT [FK_StaffRecognition_RecognitionTypeDescriptor] FOREIGN KEY ([RecognitionTypeDescriptorId])
REFERENCES [edfi].[RecognitionTypeDescriptor] ([RecognitionTypeDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StaffRecognition_RecognitionTypeDescriptor]
ON [edfi].[StaffRecognition] ([RecognitionTypeDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StaffRecognition] WITH CHECK ADD CONSTRAINT [FK_StaffRecognition_Staff] FOREIGN KEY ([StaffUSI])
REFERENCES [edfi].[Staff] ([StaffUSI])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_StaffRecognition_Staff]
ON [edfi].[StaffRecognition] ([StaffUSI] ASC)
GO
ALTER TABLE [edfi].[StaffSchoolAssociation] WITH CHECK ADD CONSTRAINT [FK_StaffSchoolAssociation_Calendar] FOREIGN KEY ([CalendarCode], [SchoolId], [SchoolYear])
REFERENCES [edfi].[Calendar] ([CalendarCode], [SchoolId], [SchoolYear])
GO
CREATE NONCLUSTERED INDEX [FK_StaffSchoolAssociation_Calendar]
ON [edfi].[StaffSchoolAssociation] ([CalendarCode] ASC, [SchoolId] ASC, [SchoolYear] ASC)
GO
ALTER TABLE [edfi].[StaffSchoolAssociation] WITH CHECK ADD CONSTRAINT [FK_StaffSchoolAssociation_ProgramAssignmentDescriptor] FOREIGN KEY ([ProgramAssignmentDescriptorId])
REFERENCES [edfi].[ProgramAssignmentDescriptor] ([ProgramAssignmentDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StaffSchoolAssociation_ProgramAssignmentDescriptor]
ON [edfi].[StaffSchoolAssociation] ([ProgramAssignmentDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StaffSchoolAssociation] WITH CHECK ADD CONSTRAINT [FK_StaffSchoolAssociation_School] FOREIGN KEY ([SchoolId])
REFERENCES [edfi].[School] ([SchoolId])
GO
CREATE NONCLUSTERED INDEX [FK_StaffSchoolAssociation_School]
ON [edfi].[StaffSchoolAssociation] ([SchoolId] ASC)
GO
ALTER TABLE [edfi].[StaffSchoolAssociation] WITH CHECK ADD CONSTRAINT [FK_StaffSchoolAssociation_SchoolYearType] FOREIGN KEY ([SchoolYear])
REFERENCES [edfi].[SchoolYearType] ([SchoolYear])
GO
CREATE NONCLUSTERED INDEX [FK_StaffSchoolAssociation_SchoolYearType]
ON [edfi].[StaffSchoolAssociation] ([SchoolYear] ASC)
GO
ALTER TABLE [edfi].[StaffSchoolAssociation] WITH CHECK ADD CONSTRAINT [FK_StaffSchoolAssociation_Staff] FOREIGN KEY ([StaffUSI])
REFERENCES [edfi].[Staff] ([StaffUSI])
GO
CREATE NONCLUSTERED INDEX [FK_StaffSchoolAssociation_Staff]
ON [edfi].[StaffSchoolAssociation] ([StaffUSI] ASC)
GO
ALTER TABLE [edfi].[StaffSchoolAssociationAcademicSubject] WITH CHECK ADD CONSTRAINT [FK_StaffSchoolAssociationAcademicSubject_AcademicSubjectDescriptor] FOREIGN KEY ([AcademicSubjectDescriptorId])
REFERENCES [edfi].[AcademicSubjectDescriptor] ([AcademicSubjectDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StaffSchoolAssociationAcademicSubject_AcademicSubjectDescriptor]
ON [edfi].[StaffSchoolAssociationAcademicSubject] ([AcademicSubjectDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StaffSchoolAssociationAcademicSubject] WITH CHECK ADD CONSTRAINT [FK_StaffSchoolAssociationAcademicSubject_StaffSchoolAssociation] FOREIGN KEY ([ProgramAssignmentDescriptorId], [SchoolId], [StaffUSI])
REFERENCES [edfi].[StaffSchoolAssociation] ([ProgramAssignmentDescriptorId], [SchoolId], [StaffUSI])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_StaffSchoolAssociationAcademicSubject_StaffSchoolAssociation]
ON [edfi].[StaffSchoolAssociationAcademicSubject] ([ProgramAssignmentDescriptorId] ASC, [SchoolId] ASC, [StaffUSI] ASC)
GO
ALTER TABLE [edfi].[StaffSchoolAssociationGradeLevel] WITH CHECK ADD CONSTRAINT [FK_StaffSchoolAssociationGradeLevel_GradeLevelDescriptor] FOREIGN KEY ([GradeLevelDescriptorId])
REFERENCES [edfi].[GradeLevelDescriptor] ([GradeLevelDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StaffSchoolAssociationGradeLevel_GradeLevelDescriptor]
ON [edfi].[StaffSchoolAssociationGradeLevel] ([GradeLevelDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StaffSchoolAssociationGradeLevel] WITH CHECK ADD CONSTRAINT [FK_StaffSchoolAssociationGradeLevel_StaffSchoolAssociation] FOREIGN KEY ([ProgramAssignmentDescriptorId], [SchoolId], [StaffUSI])
REFERENCES [edfi].[StaffSchoolAssociation] ([ProgramAssignmentDescriptorId], [SchoolId], [StaffUSI])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_StaffSchoolAssociationGradeLevel_StaffSchoolAssociation]
ON [edfi].[StaffSchoolAssociationGradeLevel] ([ProgramAssignmentDescriptorId] ASC, [SchoolId] ASC, [StaffUSI] ASC)
GO
ALTER TABLE [edfi].[StaffSectionAssociation] WITH CHECK ADD CONSTRAINT [FK_StaffSectionAssociation_ClassroomPositionDescriptor] FOREIGN KEY ([ClassroomPositionDescriptorId])
REFERENCES [edfi].[ClassroomPositionDescriptor] ([ClassroomPositionDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StaffSectionAssociation_ClassroomPositionDescriptor]
ON [edfi].[StaffSectionAssociation] ([ClassroomPositionDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StaffSectionAssociation] WITH CHECK ADD CONSTRAINT [FK_StaffSectionAssociation_Section] FOREIGN KEY ([LocalCourseCode], [SchoolId], [SchoolYear], [SectionIdentifier], [SessionName])
REFERENCES [edfi].[Section] ([LocalCourseCode], [SchoolId], [SchoolYear], [SectionIdentifier], [SessionName])
ON UPDATE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_StaffSectionAssociation_Section]
ON [edfi].[StaffSectionAssociation] ([LocalCourseCode] ASC, [SchoolId] ASC, [SchoolYear] ASC, [SectionIdentifier] ASC, [SessionName] ASC)
GO
ALTER TABLE [edfi].[StaffSectionAssociation] WITH CHECK ADD CONSTRAINT [FK_StaffSectionAssociation_Staff] FOREIGN KEY ([StaffUSI])
REFERENCES [edfi].[Staff] ([StaffUSI])
GO
CREATE NONCLUSTERED INDEX [FK_StaffSectionAssociation_Staff]
ON [edfi].[StaffSectionAssociation] ([StaffUSI] ASC)
GO
ALTER TABLE [edfi].[StaffTelephone] WITH CHECK ADD CONSTRAINT [FK_StaffTelephone_Staff] FOREIGN KEY ([StaffUSI])
REFERENCES [edfi].[Staff] ([StaffUSI])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_StaffTelephone_Staff]
ON [edfi].[StaffTelephone] ([StaffUSI] ASC)
GO
ALTER TABLE [edfi].[StaffTelephone] WITH CHECK ADD CONSTRAINT [FK_StaffTelephone_TelephoneNumberTypeDescriptor] FOREIGN KEY ([TelephoneNumberTypeDescriptorId])
REFERENCES [edfi].[TelephoneNumberTypeDescriptor] ([TelephoneNumberTypeDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StaffTelephone_TelephoneNumberTypeDescriptor]
ON [edfi].[StaffTelephone] ([TelephoneNumberTypeDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StaffTribalAffiliation] WITH CHECK ADD CONSTRAINT [FK_StaffTribalAffiliation_Staff] FOREIGN KEY ([StaffUSI])
REFERENCES [edfi].[Staff] ([StaffUSI])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_StaffTribalAffiliation_Staff]
ON [edfi].[StaffTribalAffiliation] ([StaffUSI] ASC)
GO
ALTER TABLE [edfi].[StaffTribalAffiliation] WITH CHECK ADD CONSTRAINT [FK_StaffTribalAffiliation_TribalAffiliationDescriptor] FOREIGN KEY ([TribalAffiliationDescriptorId])
REFERENCES [edfi].[TribalAffiliationDescriptor] ([TribalAffiliationDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StaffTribalAffiliation_TribalAffiliationDescriptor]
ON [edfi].[StaffTribalAffiliation] ([TribalAffiliationDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StaffVisa] WITH CHECK ADD CONSTRAINT [FK_StaffVisa_Staff] FOREIGN KEY ([StaffUSI])
REFERENCES [edfi].[Staff] ([StaffUSI])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_StaffVisa_Staff]
ON [edfi].[StaffVisa] ([StaffUSI] ASC)
GO
ALTER TABLE [edfi].[StaffVisa] WITH CHECK ADD CONSTRAINT [FK_StaffVisa_VisaDescriptor] FOREIGN KEY ([VisaDescriptorId])
REFERENCES [edfi].[VisaDescriptor] ([VisaDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StaffVisa_VisaDescriptor]
ON [edfi].[StaffVisa] ([VisaDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StateAbbreviationDescriptor] WITH CHECK ADD CONSTRAINT [FK_StateAbbreviationDescriptor_Descriptor] FOREIGN KEY ([StateAbbreviationDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[StateEducationAgency] WITH CHECK ADD CONSTRAINT [FK_StateEducationAgency_EducationOrganization] FOREIGN KEY ([StateEducationAgencyId])
REFERENCES [edfi].[EducationOrganization] ([EducationOrganizationId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[StateEducationAgencyAccountability] WITH CHECK ADD CONSTRAINT [FK_StateEducationAgencyAccountability_SchoolYearType] FOREIGN KEY ([SchoolYear])
REFERENCES [edfi].[SchoolYearType] ([SchoolYear])
GO
CREATE NONCLUSTERED INDEX [FK_StateEducationAgencyAccountability_SchoolYearType]
ON [edfi].[StateEducationAgencyAccountability] ([SchoolYear] ASC)
GO
ALTER TABLE [edfi].[StateEducationAgencyAccountability] WITH CHECK ADD CONSTRAINT [FK_StateEducationAgencyAccountability_StateEducationAgency] FOREIGN KEY ([StateEducationAgencyId])
REFERENCES [edfi].[StateEducationAgency] ([StateEducationAgencyId])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_StateEducationAgencyAccountability_StateEducationAgency]
ON [edfi].[StateEducationAgencyAccountability] ([StateEducationAgencyId] ASC)
GO
ALTER TABLE [edfi].[StateEducationAgencyFederalFunds] WITH CHECK ADD CONSTRAINT [FK_StateEducationAgencyFederalFunds_StateEducationAgency] FOREIGN KEY ([StateEducationAgencyId])
REFERENCES [edfi].[StateEducationAgency] ([StateEducationAgencyId])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_StateEducationAgencyFederalFunds_StateEducationAgency]
ON [edfi].[StateEducationAgencyFederalFunds] ([StateEducationAgencyId] ASC)
GO
ALTER TABLE [edfi].[Student] WITH CHECK ADD CONSTRAINT [FK_Student_CitizenshipStatusDescriptor] FOREIGN KEY ([CitizenshipStatusDescriptorId])
REFERENCES [edfi].[CitizenshipStatusDescriptor] ([CitizenshipStatusDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_Student_CitizenshipStatusDescriptor]
ON [edfi].[Student] ([CitizenshipStatusDescriptorId] ASC)
GO
ALTER TABLE [edfi].[Student] WITH CHECK ADD CONSTRAINT [FK_Student_CountryDescriptor] FOREIGN KEY ([BirthCountryDescriptorId])
REFERENCES [edfi].[CountryDescriptor] ([CountryDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_Student_CountryDescriptor]
ON [edfi].[Student] ([BirthCountryDescriptorId] ASC)
GO
ALTER TABLE [edfi].[Student] WITH CHECK ADD CONSTRAINT [FK_Student_Person] FOREIGN KEY ([PersonId], [SourceSystemDescriptorId])
REFERENCES [edfi].[Person] ([PersonId], [SourceSystemDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_Student_Person]
ON [edfi].[Student] ([PersonId] ASC, [SourceSystemDescriptorId] ASC)
GO
ALTER TABLE [edfi].[Student] WITH CHECK ADD CONSTRAINT [FK_Student_SexDescriptor] FOREIGN KEY ([BirthSexDescriptorId])
REFERENCES [edfi].[SexDescriptor] ([SexDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_Student_SexDescriptor]
ON [edfi].[Student] ([BirthSexDescriptorId] ASC)
GO
ALTER TABLE [edfi].[Student] WITH CHECK ADD CONSTRAINT [FK_Student_StateAbbreviationDescriptor] FOREIGN KEY ([BirthStateAbbreviationDescriptorId])
REFERENCES [edfi].[StateAbbreviationDescriptor] ([StateAbbreviationDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_Student_StateAbbreviationDescriptor]
ON [edfi].[Student] ([BirthStateAbbreviationDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StudentAcademicRecord] WITH CHECK ADD CONSTRAINT [FK_StudentAcademicRecord_CreditTypeDescriptor] FOREIGN KEY ([CumulativeEarnedCreditTypeDescriptorId])
REFERENCES [edfi].[CreditTypeDescriptor] ([CreditTypeDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StudentAcademicRecord_CreditTypeDescriptor]
ON [edfi].[StudentAcademicRecord] ([CumulativeEarnedCreditTypeDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StudentAcademicRecord] WITH CHECK ADD CONSTRAINT [FK_StudentAcademicRecord_CreditTypeDescriptor1] FOREIGN KEY ([CumulativeAttemptedCreditTypeDescriptorId])
REFERENCES [edfi].[CreditTypeDescriptor] ([CreditTypeDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StudentAcademicRecord_CreditTypeDescriptor1]
ON [edfi].[StudentAcademicRecord] ([CumulativeAttemptedCreditTypeDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StudentAcademicRecord] WITH CHECK ADD CONSTRAINT [FK_StudentAcademicRecord_CreditTypeDescriptor2] FOREIGN KEY ([SessionEarnedCreditTypeDescriptorId])
REFERENCES [edfi].[CreditTypeDescriptor] ([CreditTypeDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StudentAcademicRecord_CreditTypeDescriptor2]
ON [edfi].[StudentAcademicRecord] ([SessionEarnedCreditTypeDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StudentAcademicRecord] WITH CHECK ADD CONSTRAINT [FK_StudentAcademicRecord_CreditTypeDescriptor3] FOREIGN KEY ([SessionAttemptedCreditTypeDescriptorId])
REFERENCES [edfi].[CreditTypeDescriptor] ([CreditTypeDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StudentAcademicRecord_CreditTypeDescriptor3]
ON [edfi].[StudentAcademicRecord] ([SessionAttemptedCreditTypeDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StudentAcademicRecord] WITH CHECK ADD CONSTRAINT [FK_StudentAcademicRecord_EducationOrganization] FOREIGN KEY ([EducationOrganizationId])
REFERENCES [edfi].[EducationOrganization] ([EducationOrganizationId])
GO
CREATE NONCLUSTERED INDEX [FK_StudentAcademicRecord_EducationOrganization]
ON [edfi].[StudentAcademicRecord] ([EducationOrganizationId] ASC)
GO
ALTER TABLE [edfi].[StudentAcademicRecord] WITH CHECK ADD CONSTRAINT [FK_StudentAcademicRecord_SchoolYearType] FOREIGN KEY ([SchoolYear])
REFERENCES [edfi].[SchoolYearType] ([SchoolYear])
GO
CREATE NONCLUSTERED INDEX [FK_StudentAcademicRecord_SchoolYearType]
ON [edfi].[StudentAcademicRecord] ([SchoolYear] ASC)
GO
ALTER TABLE [edfi].[StudentAcademicRecord] WITH CHECK ADD CONSTRAINT [FK_StudentAcademicRecord_Student] FOREIGN KEY ([StudentUSI])
REFERENCES [edfi].[Student] ([StudentUSI])
GO
CREATE NONCLUSTERED INDEX [FK_StudentAcademicRecord_Student]
ON [edfi].[StudentAcademicRecord] ([StudentUSI] ASC)
GO
ALTER TABLE [edfi].[StudentAcademicRecord] WITH CHECK ADD CONSTRAINT [FK_StudentAcademicRecord_TermDescriptor] FOREIGN KEY ([TermDescriptorId])
REFERENCES [edfi].[TermDescriptor] ([TermDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StudentAcademicRecord_TermDescriptor]
ON [edfi].[StudentAcademicRecord] ([TermDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StudentAcademicRecordAcademicHonor] WITH CHECK ADD CONSTRAINT [FK_StudentAcademicRecordAcademicHonor_AcademicHonorCategoryDescriptor] FOREIGN KEY ([AcademicHonorCategoryDescriptorId])
REFERENCES [edfi].[AcademicHonorCategoryDescriptor] ([AcademicHonorCategoryDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StudentAcademicRecordAcademicHonor_AcademicHonorCategoryDescriptor]
ON [edfi].[StudentAcademicRecordAcademicHonor] ([AcademicHonorCategoryDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StudentAcademicRecordAcademicHonor] WITH CHECK ADD CONSTRAINT [FK_StudentAcademicRecordAcademicHonor_AchievementCategoryDescriptor] FOREIGN KEY ([AchievementCategoryDescriptorId])
REFERENCES [edfi].[AchievementCategoryDescriptor] ([AchievementCategoryDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StudentAcademicRecordAcademicHonor_AchievementCategoryDescriptor]
ON [edfi].[StudentAcademicRecordAcademicHonor] ([AchievementCategoryDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StudentAcademicRecordAcademicHonor] WITH CHECK ADD CONSTRAINT [FK_StudentAcademicRecordAcademicHonor_StudentAcademicRecord] FOREIGN KEY ([EducationOrganizationId], [SchoolYear], [StudentUSI], [TermDescriptorId])
REFERENCES [edfi].[StudentAcademicRecord] ([EducationOrganizationId], [SchoolYear], [StudentUSI], [TermDescriptorId])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_StudentAcademicRecordAcademicHonor_StudentAcademicRecord]
ON [edfi].[StudentAcademicRecordAcademicHonor] ([EducationOrganizationId] ASC, [SchoolYear] ASC, [StudentUSI] ASC, [TermDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StudentAcademicRecordClassRanking] WITH CHECK ADD CONSTRAINT [FK_StudentAcademicRecordClassRanking_StudentAcademicRecord] FOREIGN KEY ([EducationOrganizationId], [SchoolYear], [StudentUSI], [TermDescriptorId])
REFERENCES [edfi].[StudentAcademicRecord] ([EducationOrganizationId], [SchoolYear], [StudentUSI], [TermDescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[StudentAcademicRecordDiploma] WITH CHECK ADD CONSTRAINT [FK_StudentAcademicRecordDiploma_AchievementCategoryDescriptor] FOREIGN KEY ([AchievementCategoryDescriptorId])
REFERENCES [edfi].[AchievementCategoryDescriptor] ([AchievementCategoryDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StudentAcademicRecordDiploma_AchievementCategoryDescriptor]
ON [edfi].[StudentAcademicRecordDiploma] ([AchievementCategoryDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StudentAcademicRecordDiploma] WITH CHECK ADD CONSTRAINT [FK_StudentAcademicRecordDiploma_DiplomaLevelDescriptor] FOREIGN KEY ([DiplomaLevelDescriptorId])
REFERENCES [edfi].[DiplomaLevelDescriptor] ([DiplomaLevelDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StudentAcademicRecordDiploma_DiplomaLevelDescriptor]
ON [edfi].[StudentAcademicRecordDiploma] ([DiplomaLevelDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StudentAcademicRecordDiploma] WITH CHECK ADD CONSTRAINT [FK_StudentAcademicRecordDiploma_DiplomaTypeDescriptor] FOREIGN KEY ([DiplomaTypeDescriptorId])
REFERENCES [edfi].[DiplomaTypeDescriptor] ([DiplomaTypeDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StudentAcademicRecordDiploma_DiplomaTypeDescriptor]
ON [edfi].[StudentAcademicRecordDiploma] ([DiplomaTypeDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StudentAcademicRecordDiploma] WITH CHECK ADD CONSTRAINT [FK_StudentAcademicRecordDiploma_StudentAcademicRecord] FOREIGN KEY ([EducationOrganizationId], [SchoolYear], [StudentUSI], [TermDescriptorId])
REFERENCES [edfi].[StudentAcademicRecord] ([EducationOrganizationId], [SchoolYear], [StudentUSI], [TermDescriptorId])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_StudentAcademicRecordDiploma_StudentAcademicRecord]
ON [edfi].[StudentAcademicRecordDiploma] ([EducationOrganizationId] ASC, [SchoolYear] ASC, [StudentUSI] ASC, [TermDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StudentAcademicRecordGradePointAverage] WITH CHECK ADD CONSTRAINT [FK_StudentAcademicRecordGradePointAverage_GradePointAverageTypeDescriptor] FOREIGN KEY ([GradePointAverageTypeDescriptorId])
REFERENCES [edfi].[GradePointAverageTypeDescriptor] ([GradePointAverageTypeDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StudentAcademicRecordGradePointAverage_GradePointAverageTypeDescriptor]
ON [edfi].[StudentAcademicRecordGradePointAverage] ([GradePointAverageTypeDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StudentAcademicRecordGradePointAverage] WITH CHECK ADD CONSTRAINT [FK_StudentAcademicRecordGradePointAverage_StudentAcademicRecord] FOREIGN KEY ([EducationOrganizationId], [SchoolYear], [StudentUSI], [TermDescriptorId])
REFERENCES [edfi].[StudentAcademicRecord] ([EducationOrganizationId], [SchoolYear], [StudentUSI], [TermDescriptorId])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_StudentAcademicRecordGradePointAverage_StudentAcademicRecord]
ON [edfi].[StudentAcademicRecordGradePointAverage] ([EducationOrganizationId] ASC, [SchoolYear] ASC, [StudentUSI] ASC, [TermDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StudentAcademicRecordRecognition] WITH CHECK ADD CONSTRAINT [FK_StudentAcademicRecordRecognition_AchievementCategoryDescriptor] FOREIGN KEY ([AchievementCategoryDescriptorId])
REFERENCES [edfi].[AchievementCategoryDescriptor] ([AchievementCategoryDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StudentAcademicRecordRecognition_AchievementCategoryDescriptor]
ON [edfi].[StudentAcademicRecordRecognition] ([AchievementCategoryDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StudentAcademicRecordRecognition] WITH CHECK ADD CONSTRAINT [FK_StudentAcademicRecordRecognition_RecognitionTypeDescriptor] FOREIGN KEY ([RecognitionTypeDescriptorId])
REFERENCES [edfi].[RecognitionTypeDescriptor] ([RecognitionTypeDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StudentAcademicRecordRecognition_RecognitionTypeDescriptor]
ON [edfi].[StudentAcademicRecordRecognition] ([RecognitionTypeDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StudentAcademicRecordRecognition] WITH CHECK ADD CONSTRAINT [FK_StudentAcademicRecordRecognition_StudentAcademicRecord] FOREIGN KEY ([EducationOrganizationId], [SchoolYear], [StudentUSI], [TermDescriptorId])
REFERENCES [edfi].[StudentAcademicRecord] ([EducationOrganizationId], [SchoolYear], [StudentUSI], [TermDescriptorId])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_StudentAcademicRecordRecognition_StudentAcademicRecord]
ON [edfi].[StudentAcademicRecordRecognition] ([EducationOrganizationId] ASC, [SchoolYear] ASC, [StudentUSI] ASC, [TermDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StudentAcademicRecordReportCard] WITH CHECK ADD CONSTRAINT [FK_StudentAcademicRecordReportCard_ReportCard] FOREIGN KEY ([EducationOrganizationId], [GradingPeriodDescriptorId], [GradingPeriodSchoolId], [GradingPeriodSchoolYear], [GradingPeriodSequence], [StudentUSI])
REFERENCES [edfi].[ReportCard] ([EducationOrganizationId], [GradingPeriodDescriptorId], [GradingPeriodSchoolId], [GradingPeriodSchoolYear], [GradingPeriodSequence], [StudentUSI])
GO
CREATE NONCLUSTERED INDEX [FK_StudentAcademicRecordReportCard_ReportCard]
ON [edfi].[StudentAcademicRecordReportCard] ([EducationOrganizationId] ASC, [GradingPeriodDescriptorId] ASC, [GradingPeriodSchoolId] ASC, [GradingPeriodSchoolYear] ASC, [GradingPeriodSequence] ASC, [StudentUSI] ASC)
GO
ALTER TABLE [edfi].[StudentAcademicRecordReportCard] WITH CHECK ADD CONSTRAINT [FK_StudentAcademicRecordReportCard_StudentAcademicRecord] FOREIGN KEY ([EducationOrganizationId], [SchoolYear], [StudentUSI], [TermDescriptorId])
REFERENCES [edfi].[StudentAcademicRecord] ([EducationOrganizationId], [SchoolYear], [StudentUSI], [TermDescriptorId])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_StudentAcademicRecordReportCard_StudentAcademicRecord]
ON [edfi].[StudentAcademicRecordReportCard] ([EducationOrganizationId] ASC, [SchoolYear] ASC, [StudentUSI] ASC, [TermDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StudentAssessment] WITH CHECK ADD CONSTRAINT [FK_StudentAssessment_AdministrationEnvironmentDescriptor] FOREIGN KEY ([AdministrationEnvironmentDescriptorId])
REFERENCES [edfi].[AdministrationEnvironmentDescriptor] ([AdministrationEnvironmentDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StudentAssessment_AdministrationEnvironmentDescriptor]
ON [edfi].[StudentAssessment] ([AdministrationEnvironmentDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StudentAssessment] WITH CHECK ADD CONSTRAINT [FK_StudentAssessment_Assessment] FOREIGN KEY ([AssessmentIdentifier], [Namespace])
REFERENCES [edfi].[Assessment] ([AssessmentIdentifier], [Namespace])
GO
CREATE NONCLUSTERED INDEX [FK_StudentAssessment_Assessment]
ON [edfi].[StudentAssessment] ([AssessmentIdentifier] ASC, [Namespace] ASC)
GO
ALTER TABLE [edfi].[StudentAssessment] WITH CHECK ADD CONSTRAINT [FK_StudentAssessment_EventCircumstanceDescriptor] FOREIGN KEY ([EventCircumstanceDescriptorId])
REFERENCES [edfi].[EventCircumstanceDescriptor] ([EventCircumstanceDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StudentAssessment_EventCircumstanceDescriptor]
ON [edfi].[StudentAssessment] ([EventCircumstanceDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StudentAssessment] WITH CHECK ADD CONSTRAINT [FK_StudentAssessment_GradeLevelDescriptor] FOREIGN KEY ([WhenAssessedGradeLevelDescriptorId])
REFERENCES [edfi].[GradeLevelDescriptor] ([GradeLevelDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StudentAssessment_GradeLevelDescriptor]
ON [edfi].[StudentAssessment] ([WhenAssessedGradeLevelDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StudentAssessment] WITH CHECK ADD CONSTRAINT [FK_StudentAssessment_LanguageDescriptor] FOREIGN KEY ([AdministrationLanguageDescriptorId])
REFERENCES [edfi].[LanguageDescriptor] ([LanguageDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StudentAssessment_LanguageDescriptor]
ON [edfi].[StudentAssessment] ([AdministrationLanguageDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StudentAssessment] WITH CHECK ADD CONSTRAINT [FK_StudentAssessment_PlatformTypeDescriptor] FOREIGN KEY ([PlatformTypeDescriptorId])
REFERENCES [edfi].[PlatformTypeDescriptor] ([PlatformTypeDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StudentAssessment_PlatformTypeDescriptor]
ON [edfi].[StudentAssessment] ([PlatformTypeDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StudentAssessment] WITH CHECK ADD CONSTRAINT [FK_StudentAssessment_ReasonNotTestedDescriptor] FOREIGN KEY ([ReasonNotTestedDescriptorId])
REFERENCES [edfi].[ReasonNotTestedDescriptor] ([ReasonNotTestedDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StudentAssessment_ReasonNotTestedDescriptor]
ON [edfi].[StudentAssessment] ([ReasonNotTestedDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StudentAssessment] WITH CHECK ADD CONSTRAINT [FK_StudentAssessment_RetestIndicatorDescriptor] FOREIGN KEY ([RetestIndicatorDescriptorId])
REFERENCES [edfi].[RetestIndicatorDescriptor] ([RetestIndicatorDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StudentAssessment_RetestIndicatorDescriptor]
ON [edfi].[StudentAssessment] ([RetestIndicatorDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StudentAssessment] WITH CHECK ADD CONSTRAINT [FK_StudentAssessment_SchoolYearType] FOREIGN KEY ([SchoolYear])
REFERENCES [edfi].[SchoolYearType] ([SchoolYear])
GO
CREATE NONCLUSTERED INDEX [FK_StudentAssessment_SchoolYearType]
ON [edfi].[StudentAssessment] ([SchoolYear] ASC)
GO
ALTER TABLE [edfi].[StudentAssessment] WITH CHECK ADD CONSTRAINT [FK_StudentAssessment_Student] FOREIGN KEY ([StudentUSI])
REFERENCES [edfi].[Student] ([StudentUSI])
GO
CREATE NONCLUSTERED INDEX [FK_StudentAssessment_Student]
ON [edfi].[StudentAssessment] ([StudentUSI] ASC)
GO
ALTER TABLE [edfi].[StudentAssessmentAccommodation] WITH CHECK ADD CONSTRAINT [FK_StudentAssessmentAccommodation_AccommodationDescriptor] FOREIGN KEY ([AccommodationDescriptorId])
REFERENCES [edfi].[AccommodationDescriptor] ([AccommodationDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StudentAssessmentAccommodation_AccommodationDescriptor]
ON [edfi].[StudentAssessmentAccommodation] ([AccommodationDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StudentAssessmentAccommodation] WITH CHECK ADD CONSTRAINT [FK_StudentAssessmentAccommodation_StudentAssessment] FOREIGN KEY ([AssessmentIdentifier], [Namespace], [StudentAssessmentIdentifier], [StudentUSI])
REFERENCES [edfi].[StudentAssessment] ([AssessmentIdentifier], [Namespace], [StudentAssessmentIdentifier], [StudentUSI])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_StudentAssessmentAccommodation_StudentAssessment]
ON [edfi].[StudentAssessmentAccommodation] ([AssessmentIdentifier] ASC, [Namespace] ASC, [StudentAssessmentIdentifier] ASC, [StudentUSI] ASC)
GO
ALTER TABLE [edfi].[StudentAssessmentItem] WITH CHECK ADD CONSTRAINT [FK_StudentAssessmentItem_AssessmentItem] FOREIGN KEY ([AssessmentIdentifier], [IdentificationCode], [Namespace])
REFERENCES [edfi].[AssessmentItem] ([AssessmentIdentifier], [IdentificationCode], [Namespace])
GO
CREATE NONCLUSTERED INDEX [FK_StudentAssessmentItem_AssessmentItem]
ON [edfi].[StudentAssessmentItem] ([AssessmentIdentifier] ASC, [IdentificationCode] ASC, [Namespace] ASC)
GO
ALTER TABLE [edfi].[StudentAssessmentItem] WITH CHECK ADD CONSTRAINT [FK_StudentAssessmentItem_AssessmentItemResultDescriptor] FOREIGN KEY ([AssessmentItemResultDescriptorId])
REFERENCES [edfi].[AssessmentItemResultDescriptor] ([AssessmentItemResultDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StudentAssessmentItem_AssessmentItemResultDescriptor]
ON [edfi].[StudentAssessmentItem] ([AssessmentItemResultDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StudentAssessmentItem] WITH CHECK ADD CONSTRAINT [FK_StudentAssessmentItem_ResponseIndicatorDescriptor] FOREIGN KEY ([ResponseIndicatorDescriptorId])
REFERENCES [edfi].[ResponseIndicatorDescriptor] ([ResponseIndicatorDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StudentAssessmentItem_ResponseIndicatorDescriptor]
ON [edfi].[StudentAssessmentItem] ([ResponseIndicatorDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StudentAssessmentItem] WITH CHECK ADD CONSTRAINT [FK_StudentAssessmentItem_StudentAssessment] FOREIGN KEY ([AssessmentIdentifier], [Namespace], [StudentAssessmentIdentifier], [StudentUSI])
REFERENCES [edfi].[StudentAssessment] ([AssessmentIdentifier], [Namespace], [StudentAssessmentIdentifier], [StudentUSI])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_StudentAssessmentItem_StudentAssessment]
ON [edfi].[StudentAssessmentItem] ([AssessmentIdentifier] ASC, [Namespace] ASC, [StudentAssessmentIdentifier] ASC, [StudentUSI] ASC)
GO
ALTER TABLE [edfi].[StudentAssessmentPerformanceLevel] WITH CHECK ADD CONSTRAINT [FK_StudentAssessmentPerformanceLevel_AssessmentReportingMethodDescriptor] FOREIGN KEY ([AssessmentReportingMethodDescriptorId])
REFERENCES [edfi].[AssessmentReportingMethodDescriptor] ([AssessmentReportingMethodDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StudentAssessmentPerformanceLevel_AssessmentReportingMethodDescriptor]
ON [edfi].[StudentAssessmentPerformanceLevel] ([AssessmentReportingMethodDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StudentAssessmentPerformanceLevel] WITH CHECK ADD CONSTRAINT [FK_StudentAssessmentPerformanceLevel_PerformanceLevelDescriptor] FOREIGN KEY ([PerformanceLevelDescriptorId])
REFERENCES [edfi].[PerformanceLevelDescriptor] ([PerformanceLevelDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StudentAssessmentPerformanceLevel_PerformanceLevelDescriptor]
ON [edfi].[StudentAssessmentPerformanceLevel] ([PerformanceLevelDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StudentAssessmentPerformanceLevel] WITH CHECK ADD CONSTRAINT [FK_StudentAssessmentPerformanceLevel_StudentAssessment] FOREIGN KEY ([AssessmentIdentifier], [Namespace], [StudentAssessmentIdentifier], [StudentUSI])
REFERENCES [edfi].[StudentAssessment] ([AssessmentIdentifier], [Namespace], [StudentAssessmentIdentifier], [StudentUSI])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_StudentAssessmentPerformanceLevel_StudentAssessment]
ON [edfi].[StudentAssessmentPerformanceLevel] ([AssessmentIdentifier] ASC, [Namespace] ASC, [StudentAssessmentIdentifier] ASC, [StudentUSI] ASC)
GO
ALTER TABLE [edfi].[StudentAssessmentScoreResult] WITH CHECK ADD CONSTRAINT [FK_StudentAssessmentScoreResult_AssessmentReportingMethodDescriptor] FOREIGN KEY ([AssessmentReportingMethodDescriptorId])
REFERENCES [edfi].[AssessmentReportingMethodDescriptor] ([AssessmentReportingMethodDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StudentAssessmentScoreResult_AssessmentReportingMethodDescriptor]
ON [edfi].[StudentAssessmentScoreResult] ([AssessmentReportingMethodDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StudentAssessmentScoreResult] WITH CHECK ADD CONSTRAINT [FK_StudentAssessmentScoreResult_ResultDatatypeTypeDescriptor] FOREIGN KEY ([ResultDatatypeTypeDescriptorId])
REFERENCES [edfi].[ResultDatatypeTypeDescriptor] ([ResultDatatypeTypeDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StudentAssessmentScoreResult_ResultDatatypeTypeDescriptor]
ON [edfi].[StudentAssessmentScoreResult] ([ResultDatatypeTypeDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StudentAssessmentScoreResult] WITH CHECK ADD CONSTRAINT [FK_StudentAssessmentScoreResult_StudentAssessment] FOREIGN KEY ([AssessmentIdentifier], [Namespace], [StudentAssessmentIdentifier], [StudentUSI])
REFERENCES [edfi].[StudentAssessment] ([AssessmentIdentifier], [Namespace], [StudentAssessmentIdentifier], [StudentUSI])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_StudentAssessmentScoreResult_StudentAssessment]
ON [edfi].[StudentAssessmentScoreResult] ([AssessmentIdentifier] ASC, [Namespace] ASC, [StudentAssessmentIdentifier] ASC, [StudentUSI] ASC)
GO
ALTER TABLE [edfi].[StudentAssessmentStudentObjectiveAssessment] WITH CHECK ADD CONSTRAINT [FK_StudentAssessmentStudentObjectiveAssessment_ObjectiveAssessment] FOREIGN KEY ([AssessmentIdentifier], [IdentificationCode], [Namespace])
REFERENCES [edfi].[ObjectiveAssessment] ([AssessmentIdentifier], [IdentificationCode], [Namespace])
GO
CREATE NONCLUSTERED INDEX [FK_StudentAssessmentStudentObjectiveAssessment_ObjectiveAssessment]
ON [edfi].[StudentAssessmentStudentObjectiveAssessment] ([AssessmentIdentifier] ASC, [IdentificationCode] ASC, [Namespace] ASC)
GO
ALTER TABLE [edfi].[StudentAssessmentStudentObjectiveAssessment] WITH CHECK ADD CONSTRAINT [FK_StudentAssessmentStudentObjectiveAssessment_StudentAssessment] FOREIGN KEY ([AssessmentIdentifier], [Namespace], [StudentAssessmentIdentifier], [StudentUSI])
REFERENCES [edfi].[StudentAssessment] ([AssessmentIdentifier], [Namespace], [StudentAssessmentIdentifier], [StudentUSI])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_StudentAssessmentStudentObjectiveAssessment_StudentAssessment]
ON [edfi].[StudentAssessmentStudentObjectiveAssessment] ([AssessmentIdentifier] ASC, [Namespace] ASC, [StudentAssessmentIdentifier] ASC, [StudentUSI] ASC)
GO
ALTER TABLE [edfi].[StudentAssessmentStudentObjectiveAssessmentPerformanceLevel] WITH CHECK ADD CONSTRAINT [FK_StudentAssessmentStudentObjectiveAssessmentPerformanceLevel_AssessmentReportingMethodDescriptor] FOREIGN KEY ([AssessmentReportingMethodDescriptorId])
REFERENCES [edfi].[AssessmentReportingMethodDescriptor] ([AssessmentReportingMethodDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StudentAssessmentStudentObjectiveAssessmentPerformanceLevel_AssessmentReportingMethodDescriptor]
ON [edfi].[StudentAssessmentStudentObjectiveAssessmentPerformanceLevel] ([AssessmentReportingMethodDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StudentAssessmentStudentObjectiveAssessmentPerformanceLevel] WITH CHECK ADD CONSTRAINT [FK_StudentAssessmentStudentObjectiveAssessmentPerformanceLevel_PerformanceLevelDescriptor] FOREIGN KEY ([PerformanceLevelDescriptorId])
REFERENCES [edfi].[PerformanceLevelDescriptor] ([PerformanceLevelDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StudentAssessmentStudentObjectiveAssessmentPerformanceLevel_PerformanceLevelDescriptor]
ON [edfi].[StudentAssessmentStudentObjectiveAssessmentPerformanceLevel] ([PerformanceLevelDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StudentAssessmentStudentObjectiveAssessmentPerformanceLevel] WITH CHECK ADD CONSTRAINT [FK_StudentAssessmentStudentObjectiveAssessmentPerformanceLevel_StudentAssessmentStudentObjectiveAssessment] FOREIGN KEY ([AssessmentIdentifier], [IdentificationCode], [Namespace], [StudentAssessmentIdentifier], [StudentUSI])
REFERENCES [edfi].[StudentAssessmentStudentObjectiveAssessment] ([AssessmentIdentifier], [IdentificationCode], [Namespace], [StudentAssessmentIdentifier], [StudentUSI])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_StudentAssessmentStudentObjectiveAssessmentPerformanceLevel_StudentAssessmentStudentObjectiveAssessment]
ON [edfi].[StudentAssessmentStudentObjectiveAssessmentPerformanceLevel] ([AssessmentIdentifier] ASC, [IdentificationCode] ASC, [Namespace] ASC, [StudentAssessmentIdentifier] ASC, [StudentUSI] ASC)
GO
ALTER TABLE [edfi].[StudentAssessmentStudentObjectiveAssessmentScoreResult] WITH CHECK ADD CONSTRAINT [FK_StudentAssessmentStudentObjectiveAssessmentScoreResult_AssessmentReportingMethodDescriptor] FOREIGN KEY ([AssessmentReportingMethodDescriptorId])
REFERENCES [edfi].[AssessmentReportingMethodDescriptor] ([AssessmentReportingMethodDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StudentAssessmentStudentObjectiveAssessmentScoreResult_AssessmentReportingMethodDescriptor]
ON [edfi].[StudentAssessmentStudentObjectiveAssessmentScoreResult] ([AssessmentReportingMethodDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StudentAssessmentStudentObjectiveAssessmentScoreResult] WITH CHECK ADD CONSTRAINT [FK_StudentAssessmentStudentObjectiveAssessmentScoreResult_ResultDatatypeTypeDescriptor] FOREIGN KEY ([ResultDatatypeTypeDescriptorId])
REFERENCES [edfi].[ResultDatatypeTypeDescriptor] ([ResultDatatypeTypeDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StudentAssessmentStudentObjectiveAssessmentScoreResult_ResultDatatypeTypeDescriptor]
ON [edfi].[StudentAssessmentStudentObjectiveAssessmentScoreResult] ([ResultDatatypeTypeDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StudentAssessmentStudentObjectiveAssessmentScoreResult] WITH CHECK ADD CONSTRAINT [FK_StudentAssessmentStudentObjectiveAssessmentScoreResult_StudentAssessmentStudentObjectiveAssessment] FOREIGN KEY ([AssessmentIdentifier], [IdentificationCode], [Namespace], [StudentAssessmentIdentifier], [StudentUSI])
REFERENCES [edfi].[StudentAssessmentStudentObjectiveAssessment] ([AssessmentIdentifier], [IdentificationCode], [Namespace], [StudentAssessmentIdentifier], [StudentUSI])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_StudentAssessmentStudentObjectiveAssessmentScoreResult_StudentAssessmentStudentObjectiveAssessment]
ON [edfi].[StudentAssessmentStudentObjectiveAssessmentScoreResult] ([AssessmentIdentifier] ASC, [IdentificationCode] ASC, [Namespace] ASC, [StudentAssessmentIdentifier] ASC, [StudentUSI] ASC)
GO
ALTER TABLE [edfi].[StudentCharacteristicDescriptor] WITH CHECK ADD CONSTRAINT [FK_StudentCharacteristicDescriptor_Descriptor] FOREIGN KEY ([StudentCharacteristicDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[StudentCohortAssociation] WITH CHECK ADD CONSTRAINT [FK_StudentCohortAssociation_Cohort] FOREIGN KEY ([CohortIdentifier], [EducationOrganizationId])
REFERENCES [edfi].[Cohort] ([CohortIdentifier], [EducationOrganizationId])
GO
CREATE NONCLUSTERED INDEX [FK_StudentCohortAssociation_Cohort]
ON [edfi].[StudentCohortAssociation] ([CohortIdentifier] ASC, [EducationOrganizationId] ASC)
GO
ALTER TABLE [edfi].[StudentCohortAssociation] WITH CHECK ADD CONSTRAINT [FK_StudentCohortAssociation_Student] FOREIGN KEY ([StudentUSI])
REFERENCES [edfi].[Student] ([StudentUSI])
GO
CREATE NONCLUSTERED INDEX [FK_StudentCohortAssociation_Student]
ON [edfi].[StudentCohortAssociation] ([StudentUSI] ASC)
GO
ALTER TABLE [edfi].[StudentCohortAssociationSection] WITH CHECK ADD CONSTRAINT [FK_StudentCohortAssociationSection_Section] FOREIGN KEY ([LocalCourseCode], [SchoolId], [SchoolYear], [SectionIdentifier], [SessionName])
REFERENCES [edfi].[Section] ([LocalCourseCode], [SchoolId], [SchoolYear], [SectionIdentifier], [SessionName])
ON UPDATE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_StudentCohortAssociationSection_Section]
ON [edfi].[StudentCohortAssociationSection] ([LocalCourseCode] ASC, [SchoolId] ASC, [SchoolYear] ASC, [SectionIdentifier] ASC, [SessionName] ASC)
GO
ALTER TABLE [edfi].[StudentCohortAssociationSection] WITH CHECK ADD CONSTRAINT [FK_StudentCohortAssociationSection_StudentCohortAssociation] FOREIGN KEY ([BeginDate], [CohortIdentifier], [EducationOrganizationId], [StudentUSI])
REFERENCES [edfi].[StudentCohortAssociation] ([BeginDate], [CohortIdentifier], [EducationOrganizationId], [StudentUSI])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_StudentCohortAssociationSection_StudentCohortAssociation]
ON [edfi].[StudentCohortAssociationSection] ([BeginDate] ASC, [CohortIdentifier] ASC, [EducationOrganizationId] ASC, [StudentUSI] ASC)
GO
ALTER TABLE [edfi].[StudentCompetencyObjective] WITH CHECK ADD CONSTRAINT [FK_StudentCompetencyObjective_CompetencyLevelDescriptor] FOREIGN KEY ([CompetencyLevelDescriptorId])
REFERENCES [edfi].[CompetencyLevelDescriptor] ([CompetencyLevelDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StudentCompetencyObjective_CompetencyLevelDescriptor]
ON [edfi].[StudentCompetencyObjective] ([CompetencyLevelDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StudentCompetencyObjective] WITH CHECK ADD CONSTRAINT [FK_StudentCompetencyObjective_CompetencyObjective] FOREIGN KEY ([ObjectiveEducationOrganizationId], [Objective], [ObjectiveGradeLevelDescriptorId])
REFERENCES [edfi].[CompetencyObjective] ([EducationOrganizationId], [Objective], [ObjectiveGradeLevelDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StudentCompetencyObjective_CompetencyObjective]
ON [edfi].[StudentCompetencyObjective] ([ObjectiveEducationOrganizationId] ASC, [Objective] ASC, [ObjectiveGradeLevelDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StudentCompetencyObjective] WITH CHECK ADD CONSTRAINT [FK_StudentCompetencyObjective_GradingPeriod] FOREIGN KEY ([GradingPeriodDescriptorId], [GradingPeriodSequence], [GradingPeriodSchoolId], [GradingPeriodSchoolYear])
REFERENCES [edfi].[GradingPeriod] ([GradingPeriodDescriptorId], [PeriodSequence], [SchoolId], [SchoolYear])
GO
CREATE NONCLUSTERED INDEX [FK_StudentCompetencyObjective_GradingPeriod]
ON [edfi].[StudentCompetencyObjective] ([GradingPeriodDescriptorId] ASC, [GradingPeriodSequence] ASC, [GradingPeriodSchoolId] ASC, [GradingPeriodSchoolYear] ASC)
GO
ALTER TABLE [edfi].[StudentCompetencyObjective] WITH CHECK ADD CONSTRAINT [FK_StudentCompetencyObjective_Student] FOREIGN KEY ([StudentUSI])
REFERENCES [edfi].[Student] ([StudentUSI])
GO
CREATE NONCLUSTERED INDEX [FK_StudentCompetencyObjective_Student]
ON [edfi].[StudentCompetencyObjective] ([StudentUSI] ASC)
GO
ALTER TABLE [edfi].[StudentCompetencyObjectiveGeneralStudentProgramAssociation] WITH CHECK ADD CONSTRAINT [FK_StudentCompetencyObjectiveGeneralStudentProgramAssociation_GeneralStudentProgramAssociation] FOREIGN KEY ([BeginDate], [EducationOrganizationId], [ProgramEducationOrganizationId], [ProgramName], [ProgramTypeDescriptorId], [StudentUSI])
REFERENCES [edfi].[GeneralStudentProgramAssociation] ([BeginDate], [EducationOrganizationId], [ProgramEducationOrganizationId], [ProgramName], [ProgramTypeDescriptorId], [StudentUSI])
GO
CREATE NONCLUSTERED INDEX [FK_StudentCompetencyObjectiveGeneralStudentProgramAssociation_GeneralStudentProgramAssociation]
ON [edfi].[StudentCompetencyObjectiveGeneralStudentProgramAssociation] ([BeginDate] ASC, [EducationOrganizationId] ASC, [ProgramEducationOrganizationId] ASC, [ProgramName] ASC, [ProgramTypeDescriptorId] ASC, [StudentUSI] ASC)
GO
ALTER TABLE [edfi].[StudentCompetencyObjectiveGeneralStudentProgramAssociation] WITH CHECK ADD CONSTRAINT [FK_StudentCompetencyObjectiveGeneralStudentProgramAssociation_StudentCompetencyObjective] FOREIGN KEY ([GradingPeriodDescriptorId], [GradingPeriodSchoolId], [GradingPeriodSchoolYear], [GradingPeriodSequence], [Objective], [ObjectiveEducationOrganizationId], [ObjectiveGradeLevelDescriptorId], [StudentUSI])
REFERENCES [edfi].[StudentCompetencyObjective] ([GradingPeriodDescriptorId], [GradingPeriodSchoolId], [GradingPeriodSchoolYear], [GradingPeriodSequence], [Objective], [ObjectiveEducationOrganizationId], [ObjectiveGradeLevelDescriptorId], [StudentUSI])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_StudentCompetencyObjectiveGeneralStudentProgramAssociation_StudentCompetencyObjective]
ON [edfi].[StudentCompetencyObjectiveGeneralStudentProgramAssociation] ([GradingPeriodDescriptorId] ASC, [GradingPeriodSchoolId] ASC, [GradingPeriodSchoolYear] ASC, [GradingPeriodSequence] ASC, [Objective] ASC, [ObjectiveEducationOrganizationId] ASC, [ObjectiveGradeLevelDescriptorId] ASC, [StudentUSI] ASC)
GO
ALTER TABLE [edfi].[StudentCompetencyObjectiveStudentSectionAssociation] WITH CHECK ADD CONSTRAINT [FK_StudentCompetencyObjectiveStudentSectionAssociation_StudentCompetencyObjective] FOREIGN KEY ([GradingPeriodDescriptorId], [GradingPeriodSchoolId], [GradingPeriodSchoolYear], [GradingPeriodSequence], [Objective], [ObjectiveEducationOrganizationId], [ObjectiveGradeLevelDescriptorId], [StudentUSI])
REFERENCES [edfi].[StudentCompetencyObjective] ([GradingPeriodDescriptorId], [GradingPeriodSchoolId], [GradingPeriodSchoolYear], [GradingPeriodSequence], [Objective], [ObjectiveEducationOrganizationId], [ObjectiveGradeLevelDescriptorId], [StudentUSI])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_StudentCompetencyObjectiveStudentSectionAssociation_StudentCompetencyObjective]
ON [edfi].[StudentCompetencyObjectiveStudentSectionAssociation] ([GradingPeriodDescriptorId] ASC, [GradingPeriodSchoolId] ASC, [GradingPeriodSchoolYear] ASC, [GradingPeriodSequence] ASC, [Objective] ASC, [ObjectiveEducationOrganizationId] ASC, [ObjectiveGradeLevelDescriptorId] ASC, [StudentUSI] ASC)
GO
ALTER TABLE [edfi].[StudentCompetencyObjectiveStudentSectionAssociation] WITH CHECK ADD CONSTRAINT [FK_StudentCompetencyObjectiveStudentSectionAssociation_StudentSectionAssociation] FOREIGN KEY ([BeginDate], [LocalCourseCode], [SchoolId], [SchoolYear], [SectionIdentifier], [SessionName], [StudentUSI])
REFERENCES [edfi].[StudentSectionAssociation] ([BeginDate], [LocalCourseCode], [SchoolId], [SchoolYear], [SectionIdentifier], [SessionName], [StudentUSI])
ON UPDATE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_StudentCompetencyObjectiveStudentSectionAssociation_StudentSectionAssociation]
ON [edfi].[StudentCompetencyObjectiveStudentSectionAssociation] ([BeginDate] ASC, [LocalCourseCode] ASC, [SchoolId] ASC, [SchoolYear] ASC, [SectionIdentifier] ASC, [SessionName] ASC, [StudentUSI] ASC)
GO
ALTER TABLE [edfi].[StudentCTEProgramAssociation] WITH CHECK ADD CONSTRAINT [FK_StudentCTEProgramAssociation_GeneralStudentProgramAssociation] FOREIGN KEY ([BeginDate], [EducationOrganizationId], [ProgramEducationOrganizationId], [ProgramName], [ProgramTypeDescriptorId], [StudentUSI])
REFERENCES [edfi].[GeneralStudentProgramAssociation] ([BeginDate], [EducationOrganizationId], [ProgramEducationOrganizationId], [ProgramName], [ProgramTypeDescriptorId], [StudentUSI])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[StudentCTEProgramAssociation] WITH CHECK ADD CONSTRAINT [FK_StudentCTEProgramAssociation_TechnicalSkillsAssessmentDescriptor] FOREIGN KEY ([TechnicalSkillsAssessmentDescriptorId])
REFERENCES [edfi].[TechnicalSkillsAssessmentDescriptor] ([TechnicalSkillsAssessmentDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StudentCTEProgramAssociation_TechnicalSkillsAssessmentDescriptor]
ON [edfi].[StudentCTEProgramAssociation] ([TechnicalSkillsAssessmentDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StudentCTEProgramAssociationCTEProgram] WITH CHECK ADD CONSTRAINT [FK_StudentCTEProgramAssociationCTEProgram_CareerPathwayDescriptor] FOREIGN KEY ([CareerPathwayDescriptorId])
REFERENCES [edfi].[CareerPathwayDescriptor] ([CareerPathwayDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StudentCTEProgramAssociationCTEProgram_CareerPathwayDescriptor]
ON [edfi].[StudentCTEProgramAssociationCTEProgram] ([CareerPathwayDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StudentCTEProgramAssociationCTEProgram] WITH CHECK ADD CONSTRAINT [FK_StudentCTEProgramAssociationCTEProgram_StudentCTEProgramAssociation] FOREIGN KEY ([BeginDate], [EducationOrganizationId], [ProgramEducationOrganizationId], [ProgramName], [ProgramTypeDescriptorId], [StudentUSI])
REFERENCES [edfi].[StudentCTEProgramAssociation] ([BeginDate], [EducationOrganizationId], [ProgramEducationOrganizationId], [ProgramName], [ProgramTypeDescriptorId], [StudentUSI])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_StudentCTEProgramAssociationCTEProgram_StudentCTEProgramAssociation]
ON [edfi].[StudentCTEProgramAssociationCTEProgram] ([BeginDate] ASC, [EducationOrganizationId] ASC, [ProgramEducationOrganizationId] ASC, [ProgramName] ASC, [ProgramTypeDescriptorId] ASC, [StudentUSI] ASC)
GO
ALTER TABLE [edfi].[StudentCTEProgramAssociationCTEProgramService] WITH CHECK ADD CONSTRAINT [FK_StudentCTEProgramAssociationCTEProgramService_CTEProgramServiceDescriptor] FOREIGN KEY ([CTEProgramServiceDescriptorId])
REFERENCES [edfi].[CTEProgramServiceDescriptor] ([CTEProgramServiceDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StudentCTEProgramAssociationCTEProgramService_CTEProgramServiceDescriptor]
ON [edfi].[StudentCTEProgramAssociationCTEProgramService] ([CTEProgramServiceDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StudentCTEProgramAssociationCTEProgramService] WITH CHECK ADD CONSTRAINT [FK_StudentCTEProgramAssociationCTEProgramService_StudentCTEProgramAssociation] FOREIGN KEY ([BeginDate], [EducationOrganizationId], [ProgramEducationOrganizationId], [ProgramName], [ProgramTypeDescriptorId], [StudentUSI])
REFERENCES [edfi].[StudentCTEProgramAssociation] ([BeginDate], [EducationOrganizationId], [ProgramEducationOrganizationId], [ProgramName], [ProgramTypeDescriptorId], [StudentUSI])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_StudentCTEProgramAssociationCTEProgramService_StudentCTEProgramAssociation]
ON [edfi].[StudentCTEProgramAssociationCTEProgramService] ([BeginDate] ASC, [EducationOrganizationId] ASC, [ProgramEducationOrganizationId] ASC, [ProgramName] ASC, [ProgramTypeDescriptorId] ASC, [StudentUSI] ASC)
GO
ALTER TABLE [edfi].[StudentCTEProgramAssociationService] WITH CHECK ADD CONSTRAINT [FK_StudentCTEProgramAssociationService_ServiceDescriptor] FOREIGN KEY ([ServiceDescriptorId])
REFERENCES [edfi].[ServiceDescriptor] ([ServiceDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StudentCTEProgramAssociationService_ServiceDescriptor]
ON [edfi].[StudentCTEProgramAssociationService] ([ServiceDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StudentCTEProgramAssociationService] WITH CHECK ADD CONSTRAINT [FK_StudentCTEProgramAssociationService_StudentCTEProgramAssociation] FOREIGN KEY ([BeginDate], [EducationOrganizationId], [ProgramEducationOrganizationId], [ProgramName], [ProgramTypeDescriptorId], [StudentUSI])
REFERENCES [edfi].[StudentCTEProgramAssociation] ([BeginDate], [EducationOrganizationId], [ProgramEducationOrganizationId], [ProgramName], [ProgramTypeDescriptorId], [StudentUSI])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_StudentCTEProgramAssociationService_StudentCTEProgramAssociation]
ON [edfi].[StudentCTEProgramAssociationService] ([BeginDate] ASC, [EducationOrganizationId] ASC, [ProgramEducationOrganizationId] ASC, [ProgramName] ASC, [ProgramTypeDescriptorId] ASC, [StudentUSI] ASC)
GO
ALTER TABLE [edfi].[StudentDisciplineIncidentAssociation] WITH CHECK ADD CONSTRAINT [FK_StudentDisciplineIncidentAssociation_DisciplineIncident] FOREIGN KEY ([IncidentIdentifier], [SchoolId])
REFERENCES [edfi].[DisciplineIncident] ([IncidentIdentifier], [SchoolId])
GO
CREATE NONCLUSTERED INDEX [FK_StudentDisciplineIncidentAssociation_DisciplineIncident]
ON [edfi].[StudentDisciplineIncidentAssociation] ([IncidentIdentifier] ASC, [SchoolId] ASC)
GO
ALTER TABLE [edfi].[StudentDisciplineIncidentAssociation] WITH CHECK ADD CONSTRAINT [FK_StudentDisciplineIncidentAssociation_Student] FOREIGN KEY ([StudentUSI])
REFERENCES [edfi].[Student] ([StudentUSI])
GO
CREATE NONCLUSTERED INDEX [FK_StudentDisciplineIncidentAssociation_Student]
ON [edfi].[StudentDisciplineIncidentAssociation] ([StudentUSI] ASC)
GO
ALTER TABLE [edfi].[StudentDisciplineIncidentAssociation] WITH CHECK ADD CONSTRAINT [FK_StudentDisciplineIncidentAssociation_StudentParticipationCodeDescriptor] FOREIGN KEY ([StudentParticipationCodeDescriptorId])
REFERENCES [edfi].[StudentParticipationCodeDescriptor] ([StudentParticipationCodeDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StudentDisciplineIncidentAssociation_StudentParticipationCodeDescriptor]
ON [edfi].[StudentDisciplineIncidentAssociation] ([StudentParticipationCodeDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StudentDisciplineIncidentAssociationBehavior] WITH CHECK ADD CONSTRAINT [FK_StudentDisciplineIncidentAssociationBehavior_BehaviorDescriptor] FOREIGN KEY ([BehaviorDescriptorId])
REFERENCES [edfi].[BehaviorDescriptor] ([BehaviorDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StudentDisciplineIncidentAssociationBehavior_BehaviorDescriptor]
ON [edfi].[StudentDisciplineIncidentAssociationBehavior] ([BehaviorDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StudentDisciplineIncidentAssociationBehavior] WITH CHECK ADD CONSTRAINT [FK_StudentDisciplineIncidentAssociationBehavior_StudentDisciplineIncidentAssociation] FOREIGN KEY ([IncidentIdentifier], [SchoolId], [StudentUSI])
REFERENCES [edfi].[StudentDisciplineIncidentAssociation] ([IncidentIdentifier], [SchoolId], [StudentUSI])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_StudentDisciplineIncidentAssociationBehavior_StudentDisciplineIncidentAssociation]
ON [edfi].[StudentDisciplineIncidentAssociationBehavior] ([IncidentIdentifier] ASC, [SchoolId] ASC, [StudentUSI] ASC)
GO
ALTER TABLE [edfi].[StudentDisciplineIncidentBehaviorAssociation] WITH CHECK ADD CONSTRAINT [FK_StudentDisciplineIncidentBehaviorAssociation_BehaviorDescriptor] FOREIGN KEY ([BehaviorDescriptorId])
REFERENCES [edfi].[BehaviorDescriptor] ([BehaviorDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StudentDisciplineIncidentBehaviorAssociation_BehaviorDescriptor]
ON [edfi].[StudentDisciplineIncidentBehaviorAssociation] ([BehaviorDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StudentDisciplineIncidentBehaviorAssociation] WITH CHECK ADD CONSTRAINT [FK_StudentDisciplineIncidentBehaviorAssociation_DisciplineIncident] FOREIGN KEY ([IncidentIdentifier], [SchoolId])
REFERENCES [edfi].[DisciplineIncident] ([IncidentIdentifier], [SchoolId])
GO
CREATE NONCLUSTERED INDEX [FK_StudentDisciplineIncidentBehaviorAssociation_DisciplineIncident]
ON [edfi].[StudentDisciplineIncidentBehaviorAssociation] ([IncidentIdentifier] ASC, [SchoolId] ASC)
GO
ALTER TABLE [edfi].[StudentDisciplineIncidentBehaviorAssociation] WITH CHECK ADD CONSTRAINT [FK_StudentDisciplineIncidentBehaviorAssociation_Student] FOREIGN KEY ([StudentUSI])
REFERENCES [edfi].[Student] ([StudentUSI])
GO
CREATE NONCLUSTERED INDEX [FK_StudentDisciplineIncidentBehaviorAssociation_Student]
ON [edfi].[StudentDisciplineIncidentBehaviorAssociation] ([StudentUSI] ASC)
GO
ALTER TABLE [edfi].[StudentDisciplineIncidentBehaviorAssociationDisciplineIncidentParticipationCode] WITH CHECK ADD CONSTRAINT [FK_StudentDisciplineIncidentBehaviorAssociationDisciplineIncidentParticipationCode_DisciplineIncidentParticipationCodeDescriptor] FOREIGN KEY ([DisciplineIncidentParticipationCodeDescriptorId])
REFERENCES [edfi].[DisciplineIncidentParticipationCodeDescriptor] ([DisciplineIncidentParticipationCodeDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StudentDisciplineIncidentBehaviorAssociationDisciplineIncidentParticipationCode_DisciplineIncidentParticipationCodeDescriptor]
ON [edfi].[StudentDisciplineIncidentBehaviorAssociationDisciplineIncidentParticipationCode] ([DisciplineIncidentParticipationCodeDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StudentDisciplineIncidentBehaviorAssociationDisciplineIncidentParticipationCode] WITH CHECK ADD CONSTRAINT [FK_StudentDisciplineIncidentBehaviorAssociationDisciplineIncidentParticipationCode_StudentDisciplineIncidentBehaviorAssociation] FOREIGN KEY ([BehaviorDescriptorId], [IncidentIdentifier], [SchoolId], [StudentUSI])
REFERENCES [edfi].[StudentDisciplineIncidentBehaviorAssociation] ([BehaviorDescriptorId], [IncidentIdentifier], [SchoolId], [StudentUSI])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_StudentDisciplineIncidentBehaviorAssociationDisciplineIncidentParticipationCode_StudentDisciplineIncidentBehaviorAssociation]
ON [edfi].[StudentDisciplineIncidentBehaviorAssociationDisciplineIncidentParticipationCode] ([BehaviorDescriptorId] ASC, [IncidentIdentifier] ASC, [SchoolId] ASC, [StudentUSI] ASC)
GO
ALTER TABLE [edfi].[StudentDisciplineIncidentNonOffenderAssociation] WITH CHECK ADD CONSTRAINT [FK_StudentDisciplineIncidentNonOffenderAssociation_DisciplineIncident] FOREIGN KEY ([IncidentIdentifier], [SchoolId])
REFERENCES [edfi].[DisciplineIncident] ([IncidentIdentifier], [SchoolId])
GO
CREATE NONCLUSTERED INDEX [FK_StudentDisciplineIncidentNonOffenderAssociation_DisciplineIncident]
ON [edfi].[StudentDisciplineIncidentNonOffenderAssociation] ([IncidentIdentifier] ASC, [SchoolId] ASC)
GO
ALTER TABLE [edfi].[StudentDisciplineIncidentNonOffenderAssociation] WITH CHECK ADD CONSTRAINT [FK_StudentDisciplineIncidentNonOffenderAssociation_Student] FOREIGN KEY ([StudentUSI])
REFERENCES [edfi].[Student] ([StudentUSI])
GO
CREATE NONCLUSTERED INDEX [FK_StudentDisciplineIncidentNonOffenderAssociation_Student]
ON [edfi].[StudentDisciplineIncidentNonOffenderAssociation] ([StudentUSI] ASC)
GO
ALTER TABLE [edfi].[StudentDisciplineIncidentNonOffenderAssociationDisciplineIncidentParticipationCode] WITH CHECK ADD CONSTRAINT [FK_StudentDisciplineIncidentNonOffenderAssociationDisciplineIncidentParticipationCode_DisciplineIncidentParticipationCodeDescrip] FOREIGN KEY ([DisciplineIncidentParticipationCodeDescriptorId])
REFERENCES [edfi].[DisciplineIncidentParticipationCodeDescriptor] ([DisciplineIncidentParticipationCodeDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StudentDisciplineIncidentNonOffenderAssociationDisciplineIncidentParticipationCode_DisciplineIncidentParticipationCodeDescrip]
ON [edfi].[StudentDisciplineIncidentNonOffenderAssociationDisciplineIncidentParticipationCode] ([DisciplineIncidentParticipationCodeDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StudentDisciplineIncidentNonOffenderAssociationDisciplineIncidentParticipationCode] WITH CHECK ADD CONSTRAINT [FK_StudentDisciplineIncidentNonOffenderAssociationDisciplineIncidentParticipationCode_StudentDisciplineIncidentNonOffenderAssoci] FOREIGN KEY ([IncidentIdentifier], [SchoolId], [StudentUSI])
REFERENCES [edfi].[StudentDisciplineIncidentNonOffenderAssociation] ([IncidentIdentifier], [SchoolId], [StudentUSI])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_StudentDisciplineIncidentNonOffenderAssociationDisciplineIncidentParticipationCode_StudentDisciplineIncidentNonOffenderAssoci]
ON [edfi].[StudentDisciplineIncidentNonOffenderAssociationDisciplineIncidentParticipationCode] ([IncidentIdentifier] ASC, [SchoolId] ASC, [StudentUSI] ASC)
GO
ALTER TABLE [edfi].[StudentEducationOrganizationAssociation] WITH CHECK ADD CONSTRAINT [FK_StudentEducationOrganizationAssociation_BarrierToInternetAccessInResidenceDescriptor] FOREIGN KEY ([BarrierToInternetAccessInResidenceDescriptorId])
REFERENCES [edfi].[BarrierToInternetAccessInResidenceDescriptor] ([BarrierToInternetAccessInResidenceDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StudentEducationOrganizationAssociation_BarrierToInternetAccessInResidenceDescriptor]
ON [edfi].[StudentEducationOrganizationAssociation] ([BarrierToInternetAccessInResidenceDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StudentEducationOrganizationAssociation] WITH CHECK ADD CONSTRAINT [FK_StudentEducationOrganizationAssociation_EducationOrganization] FOREIGN KEY ([EducationOrganizationId])
REFERENCES [edfi].[EducationOrganization] ([EducationOrganizationId])
GO
CREATE NONCLUSTERED INDEX [FK_StudentEducationOrganizationAssociation_EducationOrganization]
ON [edfi].[StudentEducationOrganizationAssociation] ([EducationOrganizationId] ASC)
GO
ALTER TABLE [edfi].[StudentEducationOrganizationAssociation] WITH CHECK ADD CONSTRAINT [FK_StudentEducationOrganizationAssociation_InternetAccessTypeInResidenceDescriptor] FOREIGN KEY ([InternetAccessTypeInResidenceDescriptorId])
REFERENCES [edfi].[InternetAccessTypeInResidenceDescriptor] ([InternetAccessTypeInResidenceDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StudentEducationOrganizationAssociation_InternetAccessTypeInResidenceDescriptor]
ON [edfi].[StudentEducationOrganizationAssociation] ([InternetAccessTypeInResidenceDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StudentEducationOrganizationAssociation] WITH CHECK ADD CONSTRAINT [FK_StudentEducationOrganizationAssociation_InternetPerformanceInResidenceDescriptor] FOREIGN KEY ([InternetPerformanceInResidenceDescriptorId])
REFERENCES [edfi].[InternetPerformanceInResidenceDescriptor] ([InternetPerformanceInResidenceDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StudentEducationOrganizationAssociation_InternetPerformanceInResidenceDescriptor]
ON [edfi].[StudentEducationOrganizationAssociation] ([InternetPerformanceInResidenceDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StudentEducationOrganizationAssociation] WITH CHECK ADD CONSTRAINT [FK_StudentEducationOrganizationAssociation_LimitedEnglishProficiencyDescriptor] FOREIGN KEY ([LimitedEnglishProficiencyDescriptorId])
REFERENCES [edfi].[LimitedEnglishProficiencyDescriptor] ([LimitedEnglishProficiencyDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StudentEducationOrganizationAssociation_LimitedEnglishProficiencyDescriptor]
ON [edfi].[StudentEducationOrganizationAssociation] ([LimitedEnglishProficiencyDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StudentEducationOrganizationAssociation] WITH CHECK ADD CONSTRAINT [FK_StudentEducationOrganizationAssociation_OldEthnicityDescriptor] FOREIGN KEY ([OldEthnicityDescriptorId])
REFERENCES [edfi].[OldEthnicityDescriptor] ([OldEthnicityDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StudentEducationOrganizationAssociation_OldEthnicityDescriptor]
ON [edfi].[StudentEducationOrganizationAssociation] ([OldEthnicityDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StudentEducationOrganizationAssociation] WITH CHECK ADD CONSTRAINT [FK_StudentEducationOrganizationAssociation_PrimaryLearningDeviceAccessDescriptor] FOREIGN KEY ([PrimaryLearningDeviceAccessDescriptorId])
REFERENCES [edfi].[PrimaryLearningDeviceAccessDescriptor] ([PrimaryLearningDeviceAccessDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StudentEducationOrganizationAssociation_PrimaryLearningDeviceAccessDescriptor]
ON [edfi].[StudentEducationOrganizationAssociation] ([PrimaryLearningDeviceAccessDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StudentEducationOrganizationAssociation] WITH CHECK ADD CONSTRAINT [FK_StudentEducationOrganizationAssociation_PrimaryLearningDeviceAwayFromSchoolDescriptor] FOREIGN KEY ([PrimaryLearningDeviceAwayFromSchoolDescriptorId])
REFERENCES [edfi].[PrimaryLearningDeviceAwayFromSchoolDescriptor] ([PrimaryLearningDeviceAwayFromSchoolDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StudentEducationOrganizationAssociation_PrimaryLearningDeviceAwayFromSchoolDescriptor]
ON [edfi].[StudentEducationOrganizationAssociation] ([PrimaryLearningDeviceAwayFromSchoolDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StudentEducationOrganizationAssociation] WITH CHECK ADD CONSTRAINT [FK_StudentEducationOrganizationAssociation_PrimaryLearningDeviceProviderDescriptor] FOREIGN KEY ([PrimaryLearningDeviceProviderDescriptorId])
REFERENCES [edfi].[PrimaryLearningDeviceProviderDescriptor] ([PrimaryLearningDeviceProviderDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StudentEducationOrganizationAssociation_PrimaryLearningDeviceProviderDescriptor]
ON [edfi].[StudentEducationOrganizationAssociation] ([PrimaryLearningDeviceProviderDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StudentEducationOrganizationAssociation] WITH CHECK ADD CONSTRAINT [FK_StudentEducationOrganizationAssociation_SexDescriptor] FOREIGN KEY ([SexDescriptorId])
REFERENCES [edfi].[SexDescriptor] ([SexDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StudentEducationOrganizationAssociation_SexDescriptor]
ON [edfi].[StudentEducationOrganizationAssociation] ([SexDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StudentEducationOrganizationAssociation] WITH CHECK ADD CONSTRAINT [FK_StudentEducationOrganizationAssociation_Student] FOREIGN KEY ([StudentUSI])
REFERENCES [edfi].[Student] ([StudentUSI])
GO
CREATE NONCLUSTERED INDEX [FK_StudentEducationOrganizationAssociation_Student]
ON [edfi].[StudentEducationOrganizationAssociation] ([StudentUSI] ASC)
GO
ALTER TABLE [edfi].[StudentEducationOrganizationAssociationAddress] WITH CHECK ADD CONSTRAINT [FK_StudentEducationOrganizationAssociationAddress_AddressTypeDescriptor] FOREIGN KEY ([AddressTypeDescriptorId])
REFERENCES [edfi].[AddressTypeDescriptor] ([AddressTypeDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StudentEducationOrganizationAssociationAddress_AddressTypeDescriptor]
ON [edfi].[StudentEducationOrganizationAssociationAddress] ([AddressTypeDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StudentEducationOrganizationAssociationAddress] WITH CHECK ADD CONSTRAINT [FK_StudentEducationOrganizationAssociationAddress_LocaleDescriptor] FOREIGN KEY ([LocaleDescriptorId])
REFERENCES [edfi].[LocaleDescriptor] ([LocaleDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StudentEducationOrganizationAssociationAddress_LocaleDescriptor]
ON [edfi].[StudentEducationOrganizationAssociationAddress] ([LocaleDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StudentEducationOrganizationAssociationAddress] WITH CHECK ADD CONSTRAINT [FK_StudentEducationOrganizationAssociationAddress_StateAbbreviationDescriptor] FOREIGN KEY ([StateAbbreviationDescriptorId])
REFERENCES [edfi].[StateAbbreviationDescriptor] ([StateAbbreviationDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StudentEducationOrganizationAssociationAddress_StateAbbreviationDescriptor]
ON [edfi].[StudentEducationOrganizationAssociationAddress] ([StateAbbreviationDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StudentEducationOrganizationAssociationAddress] WITH CHECK ADD CONSTRAINT [FK_StudentEducationOrganizationAssociationAddress_StudentEducationOrganizationAssociation] FOREIGN KEY ([EducationOrganizationId], [StudentUSI])
REFERENCES [edfi].[StudentEducationOrganizationAssociation] ([EducationOrganizationId], [StudentUSI])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_StudentEducationOrganizationAssociationAddress_StudentEducationOrganizationAssociation]
ON [edfi].[StudentEducationOrganizationAssociationAddress] ([EducationOrganizationId] ASC, [StudentUSI] ASC)
GO
ALTER TABLE [edfi].[StudentEducationOrganizationAssociationAddressPeriod] WITH CHECK ADD CONSTRAINT [FK_StudentEducationOrganizationAssociationAddressPeriod_StudentEducationOrganizationAssociationAddress] FOREIGN KEY ([AddressTypeDescriptorId], [City], [EducationOrganizationId], [PostalCode], [StateAbbreviationDescriptorId], [StreetNumberName], [StudentUSI])
REFERENCES [edfi].[StudentEducationOrganizationAssociationAddress] ([AddressTypeDescriptorId], [City], [EducationOrganizationId], [PostalCode], [StateAbbreviationDescriptorId], [StreetNumberName], [StudentUSI])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_StudentEducationOrganizationAssociationAddressPeriod_StudentEducationOrganizationAssociationAddress]
ON [edfi].[StudentEducationOrganizationAssociationAddressPeriod] ([AddressTypeDescriptorId] ASC, [City] ASC, [EducationOrganizationId] ASC, [PostalCode] ASC, [StateAbbreviationDescriptorId] ASC, [StreetNumberName] ASC, [StudentUSI] ASC)
GO
ALTER TABLE [edfi].[StudentEducationOrganizationAssociationAncestryEthnicOrigin] WITH CHECK ADD CONSTRAINT [FK_StudentEducationOrganizationAssociationAncestryEthnicOrigin_AncestryEthnicOriginDescriptor] FOREIGN KEY ([AncestryEthnicOriginDescriptorId])
REFERENCES [edfi].[AncestryEthnicOriginDescriptor] ([AncestryEthnicOriginDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StudentEducationOrganizationAssociationAncestryEthnicOrigin_AncestryEthnicOriginDescriptor]
ON [edfi].[StudentEducationOrganizationAssociationAncestryEthnicOrigin] ([AncestryEthnicOriginDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StudentEducationOrganizationAssociationAncestryEthnicOrigin] WITH CHECK ADD CONSTRAINT [FK_StudentEducationOrganizationAssociationAncestryEthnicOrigin_StudentEducationOrganizationAssociation] FOREIGN KEY ([EducationOrganizationId], [StudentUSI])
REFERENCES [edfi].[StudentEducationOrganizationAssociation] ([EducationOrganizationId], [StudentUSI])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_StudentEducationOrganizationAssociationAncestryEthnicOrigin_StudentEducationOrganizationAssociation]
ON [edfi].[StudentEducationOrganizationAssociationAncestryEthnicOrigin] ([EducationOrganizationId] ASC, [StudentUSI] ASC)
GO
ALTER TABLE [edfi].[StudentEducationOrganizationAssociationCohortYear] WITH CHECK ADD CONSTRAINT [FK_StudentEducationOrganizationAssociationCohortYear_CohortYearTypeDescriptor] FOREIGN KEY ([CohortYearTypeDescriptorId])
REFERENCES [edfi].[CohortYearTypeDescriptor] ([CohortYearTypeDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StudentEducationOrganizationAssociationCohortYear_CohortYearTypeDescriptor]
ON [edfi].[StudentEducationOrganizationAssociationCohortYear] ([CohortYearTypeDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StudentEducationOrganizationAssociationCohortYear] WITH CHECK ADD CONSTRAINT [FK_StudentEducationOrganizationAssociationCohortYear_SchoolYearType] FOREIGN KEY ([SchoolYear])
REFERENCES [edfi].[SchoolYearType] ([SchoolYear])
GO
CREATE NONCLUSTERED INDEX [FK_StudentEducationOrganizationAssociationCohortYear_SchoolYearType]
ON [edfi].[StudentEducationOrganizationAssociationCohortYear] ([SchoolYear] ASC)
GO
ALTER TABLE [edfi].[StudentEducationOrganizationAssociationCohortYear] WITH CHECK ADD CONSTRAINT [FK_StudentEducationOrganizationAssociationCohortYear_StudentEducationOrganizationAssociation] FOREIGN KEY ([EducationOrganizationId], [StudentUSI])
REFERENCES [edfi].[StudentEducationOrganizationAssociation] ([EducationOrganizationId], [StudentUSI])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_StudentEducationOrganizationAssociationCohortYear_StudentEducationOrganizationAssociation]
ON [edfi].[StudentEducationOrganizationAssociationCohortYear] ([EducationOrganizationId] ASC, [StudentUSI] ASC)
GO
ALTER TABLE [edfi].[StudentEducationOrganizationAssociationCohortYear] WITH CHECK ADD CONSTRAINT [FK_StudentEducationOrganizationAssociationCohortYear_TermDescriptor] FOREIGN KEY ([TermDescriptorId])
REFERENCES [edfi].[TermDescriptor] ([TermDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StudentEducationOrganizationAssociationCohortYear_TermDescriptor]
ON [edfi].[StudentEducationOrganizationAssociationCohortYear] ([TermDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StudentEducationOrganizationAssociationDisability] WITH CHECK ADD CONSTRAINT [FK_StudentEducationOrganizationAssociationDisability_DisabilityDescriptor] FOREIGN KEY ([DisabilityDescriptorId])
REFERENCES [edfi].[DisabilityDescriptor] ([DisabilityDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StudentEducationOrganizationAssociationDisability_DisabilityDescriptor]
ON [edfi].[StudentEducationOrganizationAssociationDisability] ([DisabilityDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StudentEducationOrganizationAssociationDisability] WITH CHECK ADD CONSTRAINT [FK_StudentEducationOrganizationAssociationDisability_DisabilityDeterminationSourceTypeDescriptor] FOREIGN KEY ([DisabilityDeterminationSourceTypeDescriptorId])
REFERENCES [edfi].[DisabilityDeterminationSourceTypeDescriptor] ([DisabilityDeterminationSourceTypeDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StudentEducationOrganizationAssociationDisability_DisabilityDeterminationSourceTypeDescriptor]
ON [edfi].[StudentEducationOrganizationAssociationDisability] ([DisabilityDeterminationSourceTypeDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StudentEducationOrganizationAssociationDisability] WITH CHECK ADD CONSTRAINT [FK_StudentEducationOrganizationAssociationDisability_StudentEducationOrganizationAssociation] FOREIGN KEY ([EducationOrganizationId], [StudentUSI])
REFERENCES [edfi].[StudentEducationOrganizationAssociation] ([EducationOrganizationId], [StudentUSI])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_StudentEducationOrganizationAssociationDisability_StudentEducationOrganizationAssociation]
ON [edfi].[StudentEducationOrganizationAssociationDisability] ([EducationOrganizationId] ASC, [StudentUSI] ASC)
GO
ALTER TABLE [edfi].[StudentEducationOrganizationAssociationDisabilityDesignation] WITH CHECK ADD CONSTRAINT [FK_StudentEducationOrganizationAssociationDisabilityDesignation_DisabilityDesignationDescriptor] FOREIGN KEY ([DisabilityDesignationDescriptorId])
REFERENCES [edfi].[DisabilityDesignationDescriptor] ([DisabilityDesignationDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StudentEducationOrganizationAssociationDisabilityDesignation_DisabilityDesignationDescriptor]
ON [edfi].[StudentEducationOrganizationAssociationDisabilityDesignation] ([DisabilityDesignationDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StudentEducationOrganizationAssociationDisabilityDesignation] WITH CHECK ADD CONSTRAINT [FK_StudentEducationOrganizationAssociationDisabilityDesignation_StudentEducationOrganizationAssociationDisability] FOREIGN KEY ([DisabilityDescriptorId], [EducationOrganizationId], [StudentUSI])
REFERENCES [edfi].[StudentEducationOrganizationAssociationDisability] ([DisabilityDescriptorId], [EducationOrganizationId], [StudentUSI])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_StudentEducationOrganizationAssociationDisabilityDesignation_StudentEducationOrganizationAssociationDisability]
ON [edfi].[StudentEducationOrganizationAssociationDisabilityDesignation] ([DisabilityDescriptorId] ASC, [EducationOrganizationId] ASC, [StudentUSI] ASC)
GO
ALTER TABLE [edfi].[StudentEducationOrganizationAssociationElectronicMail] WITH CHECK ADD CONSTRAINT [FK_StudentEducationOrganizationAssociationElectronicMail_ElectronicMailTypeDescriptor] FOREIGN KEY ([ElectronicMailTypeDescriptorId])
REFERENCES [edfi].[ElectronicMailTypeDescriptor] ([ElectronicMailTypeDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StudentEducationOrganizationAssociationElectronicMail_ElectronicMailTypeDescriptor]
ON [edfi].[StudentEducationOrganizationAssociationElectronicMail] ([ElectronicMailTypeDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StudentEducationOrganizationAssociationElectronicMail] WITH CHECK ADD CONSTRAINT [FK_StudentEducationOrganizationAssociationElectronicMail_StudentEducationOrganizationAssociation] FOREIGN KEY ([EducationOrganizationId], [StudentUSI])
REFERENCES [edfi].[StudentEducationOrganizationAssociation] ([EducationOrganizationId], [StudentUSI])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_StudentEducationOrganizationAssociationElectronicMail_StudentEducationOrganizationAssociation]
ON [edfi].[StudentEducationOrganizationAssociationElectronicMail] ([EducationOrganizationId] ASC, [StudentUSI] ASC)
GO
ALTER TABLE [edfi].[StudentEducationOrganizationAssociationInternationalAddress] WITH CHECK ADD CONSTRAINT [FK_StudentEducationOrganizationAssociationInternationalAddress_AddressTypeDescriptor] FOREIGN KEY ([AddressTypeDescriptorId])
REFERENCES [edfi].[AddressTypeDescriptor] ([AddressTypeDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StudentEducationOrganizationAssociationInternationalAddress_AddressTypeDescriptor]
ON [edfi].[StudentEducationOrganizationAssociationInternationalAddress] ([AddressTypeDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StudentEducationOrganizationAssociationInternationalAddress] WITH CHECK ADD CONSTRAINT [FK_StudentEducationOrganizationAssociationInternationalAddress_CountryDescriptor] FOREIGN KEY ([CountryDescriptorId])
REFERENCES [edfi].[CountryDescriptor] ([CountryDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StudentEducationOrganizationAssociationInternationalAddress_CountryDescriptor]
ON [edfi].[StudentEducationOrganizationAssociationInternationalAddress] ([CountryDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StudentEducationOrganizationAssociationInternationalAddress] WITH CHECK ADD CONSTRAINT [FK_StudentEducationOrganizationAssociationInternationalAddress_StudentEducationOrganizationAssociation] FOREIGN KEY ([EducationOrganizationId], [StudentUSI])
REFERENCES [edfi].[StudentEducationOrganizationAssociation] ([EducationOrganizationId], [StudentUSI])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_StudentEducationOrganizationAssociationInternationalAddress_StudentEducationOrganizationAssociation]
ON [edfi].[StudentEducationOrganizationAssociationInternationalAddress] ([EducationOrganizationId] ASC, [StudentUSI] ASC)
GO
ALTER TABLE [edfi].[StudentEducationOrganizationAssociationLanguage] WITH CHECK ADD CONSTRAINT [FK_StudentEducationOrganizationAssociationLanguage_LanguageDescriptor] FOREIGN KEY ([LanguageDescriptorId])
REFERENCES [edfi].[LanguageDescriptor] ([LanguageDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StudentEducationOrganizationAssociationLanguage_LanguageDescriptor]
ON [edfi].[StudentEducationOrganizationAssociationLanguage] ([LanguageDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StudentEducationOrganizationAssociationLanguage] WITH CHECK ADD CONSTRAINT [FK_StudentEducationOrganizationAssociationLanguage_StudentEducationOrganizationAssociation] FOREIGN KEY ([EducationOrganizationId], [StudentUSI])
REFERENCES [edfi].[StudentEducationOrganizationAssociation] ([EducationOrganizationId], [StudentUSI])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_StudentEducationOrganizationAssociationLanguage_StudentEducationOrganizationAssociation]
ON [edfi].[StudentEducationOrganizationAssociationLanguage] ([EducationOrganizationId] ASC, [StudentUSI] ASC)
GO
ALTER TABLE [edfi].[StudentEducationOrganizationAssociationLanguageUse] WITH CHECK ADD CONSTRAINT [FK_StudentEducationOrganizationAssociationLanguageUse_LanguageUseDescriptor] FOREIGN KEY ([LanguageUseDescriptorId])
REFERENCES [edfi].[LanguageUseDescriptor] ([LanguageUseDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StudentEducationOrganizationAssociationLanguageUse_LanguageUseDescriptor]
ON [edfi].[StudentEducationOrganizationAssociationLanguageUse] ([LanguageUseDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StudentEducationOrganizationAssociationLanguageUse] WITH CHECK ADD CONSTRAINT [FK_StudentEducationOrganizationAssociationLanguageUse_StudentEducationOrganizationAssociationLanguage] FOREIGN KEY ([EducationOrganizationId], [LanguageDescriptorId], [StudentUSI])
REFERENCES [edfi].[StudentEducationOrganizationAssociationLanguage] ([EducationOrganizationId], [LanguageDescriptorId], [StudentUSI])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_StudentEducationOrganizationAssociationLanguageUse_StudentEducationOrganizationAssociationLanguage]
ON [edfi].[StudentEducationOrganizationAssociationLanguageUse] ([EducationOrganizationId] ASC, [LanguageDescriptorId] ASC, [StudentUSI] ASC)
GO
ALTER TABLE [edfi].[StudentEducationOrganizationAssociationProgramParticipation] WITH CHECK ADD CONSTRAINT [FK_StudentEducationOrganizationAssociationProgramParticipation_ProgramTypeDescriptor] FOREIGN KEY ([ProgramTypeDescriptorId])
REFERENCES [edfi].[ProgramTypeDescriptor] ([ProgramTypeDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StudentEducationOrganizationAssociationProgramParticipation_ProgramTypeDescriptor]
ON [edfi].[StudentEducationOrganizationAssociationProgramParticipation] ([ProgramTypeDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StudentEducationOrganizationAssociationProgramParticipation] WITH CHECK ADD CONSTRAINT [FK_StudentEducationOrganizationAssociationProgramParticipation_StudentEducationOrganizationAssociation] FOREIGN KEY ([EducationOrganizationId], [StudentUSI])
REFERENCES [edfi].[StudentEducationOrganizationAssociation] ([EducationOrganizationId], [StudentUSI])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_StudentEducationOrganizationAssociationProgramParticipation_StudentEducationOrganizationAssociation]
ON [edfi].[StudentEducationOrganizationAssociationProgramParticipation] ([EducationOrganizationId] ASC, [StudentUSI] ASC)
GO
ALTER TABLE [edfi].[StudentEducationOrganizationAssociationProgramParticipationProgramCharacteristic] WITH CHECK ADD CONSTRAINT [FK_StudentEducationOrganizationAssociationProgramParticipationProgramCharacteristic_ProgramCharacteristicDescriptor] FOREIGN KEY ([ProgramCharacteristicDescriptorId])
REFERENCES [edfi].[ProgramCharacteristicDescriptor] ([ProgramCharacteristicDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StudentEducationOrganizationAssociationProgramParticipationProgramCharacteristic_ProgramCharacteristicDescriptor]
ON [edfi].[StudentEducationOrganizationAssociationProgramParticipationProgramCharacteristic] ([ProgramCharacteristicDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StudentEducationOrganizationAssociationProgramParticipationProgramCharacteristic] WITH CHECK ADD CONSTRAINT [FK_StudentEducationOrganizationAssociationProgramParticipationProgramCharacteristic_StudentEducationOrganizationAssociationProgr] FOREIGN KEY ([EducationOrganizationId], [ProgramTypeDescriptorId], [StudentUSI])
REFERENCES [edfi].[StudentEducationOrganizationAssociationProgramParticipation] ([EducationOrganizationId], [ProgramTypeDescriptorId], [StudentUSI])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_StudentEducationOrganizationAssociationProgramParticipationProgramCharacteristic_StudentEducationOrganizationAssociationProgr]
ON [edfi].[StudentEducationOrganizationAssociationProgramParticipationProgramCharacteristic] ([EducationOrganizationId] ASC, [ProgramTypeDescriptorId] ASC, [StudentUSI] ASC)
GO
ALTER TABLE [edfi].[StudentEducationOrganizationAssociationRace] WITH CHECK ADD CONSTRAINT [FK_StudentEducationOrganizationAssociationRace_RaceDescriptor] FOREIGN KEY ([RaceDescriptorId])
REFERENCES [edfi].[RaceDescriptor] ([RaceDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StudentEducationOrganizationAssociationRace_RaceDescriptor]
ON [edfi].[StudentEducationOrganizationAssociationRace] ([RaceDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StudentEducationOrganizationAssociationRace] WITH CHECK ADD CONSTRAINT [FK_StudentEducationOrganizationAssociationRace_StudentEducationOrganizationAssociation] FOREIGN KEY ([EducationOrganizationId], [StudentUSI])
REFERENCES [edfi].[StudentEducationOrganizationAssociation] ([EducationOrganizationId], [StudentUSI])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_StudentEducationOrganizationAssociationRace_StudentEducationOrganizationAssociation]
ON [edfi].[StudentEducationOrganizationAssociationRace] ([EducationOrganizationId] ASC, [StudentUSI] ASC)
GO
ALTER TABLE [edfi].[StudentEducationOrganizationAssociationStudentCharacteristic] WITH CHECK ADD CONSTRAINT [FK_StudentEducationOrganizationAssociationStudentCharacteristic_StudentCharacteristicDescriptor] FOREIGN KEY ([StudentCharacteristicDescriptorId])
REFERENCES [edfi].[StudentCharacteristicDescriptor] ([StudentCharacteristicDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StudentEducationOrganizationAssociationStudentCharacteristic_StudentCharacteristicDescriptor]
ON [edfi].[StudentEducationOrganizationAssociationStudentCharacteristic] ([StudentCharacteristicDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StudentEducationOrganizationAssociationStudentCharacteristic] WITH CHECK ADD CONSTRAINT [FK_StudentEducationOrganizationAssociationStudentCharacteristic_StudentEducationOrganizationAssociation] FOREIGN KEY ([EducationOrganizationId], [StudentUSI])
REFERENCES [edfi].[StudentEducationOrganizationAssociation] ([EducationOrganizationId], [StudentUSI])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_StudentEducationOrganizationAssociationStudentCharacteristic_StudentEducationOrganizationAssociation]
ON [edfi].[StudentEducationOrganizationAssociationStudentCharacteristic] ([EducationOrganizationId] ASC, [StudentUSI] ASC)
GO
ALTER TABLE [edfi].[StudentEducationOrganizationAssociationStudentCharacteristicPeriod] WITH CHECK ADD CONSTRAINT [FK_StudentEducationOrganizationAssociationStudentCharacteristicPeriod_StudentEducationOrganizationAssociationStudentCharacterist] FOREIGN KEY ([EducationOrganizationId], [StudentCharacteristicDescriptorId], [StudentUSI])
REFERENCES [edfi].[StudentEducationOrganizationAssociationStudentCharacteristic] ([EducationOrganizationId], [StudentCharacteristicDescriptorId], [StudentUSI])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_StudentEducationOrganizationAssociationStudentCharacteristicPeriod_StudentEducationOrganizationAssociationStudentCharacterist]
ON [edfi].[StudentEducationOrganizationAssociationStudentCharacteristicPeriod] ([EducationOrganizationId] ASC, [StudentCharacteristicDescriptorId] ASC, [StudentUSI] ASC)
GO
ALTER TABLE [edfi].[StudentEducationOrganizationAssociationStudentIdentificationCode] WITH CHECK ADD CONSTRAINT [FK_StudentEducationOrganizationAssociationStudentIdentificationCode_StudentEducationOrganizationAssociation] FOREIGN KEY ([EducationOrganizationId], [StudentUSI])
REFERENCES [edfi].[StudentEducationOrganizationAssociation] ([EducationOrganizationId], [StudentUSI])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_StudentEducationOrganizationAssociationStudentIdentificationCode_StudentEducationOrganizationAssociation]
ON [edfi].[StudentEducationOrganizationAssociationStudentIdentificationCode] ([EducationOrganizationId] ASC, [StudentUSI] ASC)
GO
ALTER TABLE [edfi].[StudentEducationOrganizationAssociationStudentIdentificationCode] WITH CHECK ADD CONSTRAINT [FK_StudentEducationOrganizationAssociationStudentIdentificationCode_StudentIdentificationSystemDescriptor] FOREIGN KEY ([StudentIdentificationSystemDescriptorId])
REFERENCES [edfi].[StudentIdentificationSystemDescriptor] ([StudentIdentificationSystemDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StudentEducationOrganizationAssociationStudentIdentificationCode_StudentIdentificationSystemDescriptor]
ON [edfi].[StudentEducationOrganizationAssociationStudentIdentificationCode] ([StudentIdentificationSystemDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StudentEducationOrganizationAssociationStudentIndicator] WITH CHECK ADD CONSTRAINT [FK_StudentEducationOrganizationAssociationStudentIndicator_StudentEducationOrganizationAssociation] FOREIGN KEY ([EducationOrganizationId], [StudentUSI])
REFERENCES [edfi].[StudentEducationOrganizationAssociation] ([EducationOrganizationId], [StudentUSI])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_StudentEducationOrganizationAssociationStudentIndicator_StudentEducationOrganizationAssociation]
ON [edfi].[StudentEducationOrganizationAssociationStudentIndicator] ([EducationOrganizationId] ASC, [StudentUSI] ASC)
GO
ALTER TABLE [edfi].[StudentEducationOrganizationAssociationStudentIndicatorPeriod] WITH CHECK ADD CONSTRAINT [FK_StudentEducationOrganizationAssociationStudentIndicatorPeriod_StudentEducationOrganizationAssociationStudentIndicator] FOREIGN KEY ([EducationOrganizationId], [IndicatorName], [StudentUSI])
REFERENCES [edfi].[StudentEducationOrganizationAssociationStudentIndicator] ([EducationOrganizationId], [IndicatorName], [StudentUSI])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_StudentEducationOrganizationAssociationStudentIndicatorPeriod_StudentEducationOrganizationAssociationStudentIndicator]
ON [edfi].[StudentEducationOrganizationAssociationStudentIndicatorPeriod] ([EducationOrganizationId] ASC, [IndicatorName] ASC, [StudentUSI] ASC)
GO
ALTER TABLE [edfi].[StudentEducationOrganizationAssociationTelephone] WITH CHECK ADD CONSTRAINT [FK_StudentEducationOrganizationAssociationTelephone_StudentEducationOrganizationAssociation] FOREIGN KEY ([EducationOrganizationId], [StudentUSI])
REFERENCES [edfi].[StudentEducationOrganizationAssociation] ([EducationOrganizationId], [StudentUSI])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_StudentEducationOrganizationAssociationTelephone_StudentEducationOrganizationAssociation]
ON [edfi].[StudentEducationOrganizationAssociationTelephone] ([EducationOrganizationId] ASC, [StudentUSI] ASC)
GO
ALTER TABLE [edfi].[StudentEducationOrganizationAssociationTelephone] WITH CHECK ADD CONSTRAINT [FK_StudentEducationOrganizationAssociationTelephone_TelephoneNumberTypeDescriptor] FOREIGN KEY ([TelephoneNumberTypeDescriptorId])
REFERENCES [edfi].[TelephoneNumberTypeDescriptor] ([TelephoneNumberTypeDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StudentEducationOrganizationAssociationTelephone_TelephoneNumberTypeDescriptor]
ON [edfi].[StudentEducationOrganizationAssociationTelephone] ([TelephoneNumberTypeDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StudentEducationOrganizationAssociationTribalAffiliation] WITH CHECK ADD CONSTRAINT [FK_StudentEducationOrganizationAssociationTribalAffiliation_StudentEducationOrganizationAssociation] FOREIGN KEY ([EducationOrganizationId], [StudentUSI])
REFERENCES [edfi].[StudentEducationOrganizationAssociation] ([EducationOrganizationId], [StudentUSI])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_StudentEducationOrganizationAssociationTribalAffiliation_StudentEducationOrganizationAssociation]
ON [edfi].[StudentEducationOrganizationAssociationTribalAffiliation] ([EducationOrganizationId] ASC, [StudentUSI] ASC)
GO
ALTER TABLE [edfi].[StudentEducationOrganizationAssociationTribalAffiliation] WITH CHECK ADD CONSTRAINT [FK_StudentEducationOrganizationAssociationTribalAffiliation_TribalAffiliationDescriptor] FOREIGN KEY ([TribalAffiliationDescriptorId])
REFERENCES [edfi].[TribalAffiliationDescriptor] ([TribalAffiliationDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StudentEducationOrganizationAssociationTribalAffiliation_TribalAffiliationDescriptor]
ON [edfi].[StudentEducationOrganizationAssociationTribalAffiliation] ([TribalAffiliationDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StudentEducationOrganizationResponsibilityAssociation] WITH CHECK ADD CONSTRAINT [FK_StudentEducationOrganizationResponsibilityAssociation_EducationOrganization] FOREIGN KEY ([EducationOrganizationId])
REFERENCES [edfi].[EducationOrganization] ([EducationOrganizationId])
GO
CREATE NONCLUSTERED INDEX [FK_StudentEducationOrganizationResponsibilityAssociation_EducationOrganization]
ON [edfi].[StudentEducationOrganizationResponsibilityAssociation] ([EducationOrganizationId] ASC)
GO
ALTER TABLE [edfi].[StudentEducationOrganizationResponsibilityAssociation] WITH CHECK ADD CONSTRAINT [FK_StudentEducationOrganizationResponsibilityAssociation_ResponsibilityDescriptor] FOREIGN KEY ([ResponsibilityDescriptorId])
REFERENCES [edfi].[ResponsibilityDescriptor] ([ResponsibilityDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StudentEducationOrganizationResponsibilityAssociation_ResponsibilityDescriptor]
ON [edfi].[StudentEducationOrganizationResponsibilityAssociation] ([ResponsibilityDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StudentEducationOrganizationResponsibilityAssociation] WITH CHECK ADD CONSTRAINT [FK_StudentEducationOrganizationResponsibilityAssociation_Student] FOREIGN KEY ([StudentUSI])
REFERENCES [edfi].[Student] ([StudentUSI])
GO
CREATE NONCLUSTERED INDEX [FK_StudentEducationOrganizationResponsibilityAssociation_Student]
ON [edfi].[StudentEducationOrganizationResponsibilityAssociation] ([StudentUSI] ASC)
GO
ALTER TABLE [edfi].[StudentGradebookEntry] WITH CHECK ADD CONSTRAINT [FK_StudentGradebookEntry_CompetencyLevelDescriptor] FOREIGN KEY ([CompetencyLevelDescriptorId])
REFERENCES [edfi].[CompetencyLevelDescriptor] ([CompetencyLevelDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StudentGradebookEntry_CompetencyLevelDescriptor]
ON [edfi].[StudentGradebookEntry] ([CompetencyLevelDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StudentGradebookEntry] WITH CHECK ADD CONSTRAINT [FK_StudentGradebookEntry_GradebookEntry] FOREIGN KEY ([DateAssigned], [GradebookEntryTitle], [LocalCourseCode], [SchoolId], [SchoolYear], [SectionIdentifier], [SessionName])
REFERENCES [edfi].[GradebookEntry] ([DateAssigned], [GradebookEntryTitle], [LocalCourseCode], [SchoolId], [SchoolYear], [SectionIdentifier], [SessionName])
ON UPDATE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_StudentGradebookEntry_GradebookEntry]
ON [edfi].[StudentGradebookEntry] ([DateAssigned] ASC, [GradebookEntryTitle] ASC, [LocalCourseCode] ASC, [SchoolId] ASC, [SchoolYear] ASC, [SectionIdentifier] ASC, [SessionName] ASC)
GO
ALTER TABLE [edfi].[StudentGradebookEntry] WITH CHECK ADD CONSTRAINT [FK_StudentGradebookEntry_StudentSectionAssociation] FOREIGN KEY ([BeginDate], [LocalCourseCode], [SchoolId], [SchoolYear], [SectionIdentifier], [SessionName], [StudentUSI])
REFERENCES [edfi].[StudentSectionAssociation] ([BeginDate], [LocalCourseCode], [SchoolId], [SchoolYear], [SectionIdentifier], [SessionName], [StudentUSI])
GO
CREATE NONCLUSTERED INDEX [FK_StudentGradebookEntry_StudentSectionAssociation]
ON [edfi].[StudentGradebookEntry] ([BeginDate] ASC, [LocalCourseCode] ASC, [SchoolId] ASC, [SchoolYear] ASC, [SectionIdentifier] ASC, [SessionName] ASC, [StudentUSI] ASC)
GO
ALTER TABLE [edfi].[StudentHomelessProgramAssociation] WITH CHECK ADD CONSTRAINT [FK_StudentHomelessProgramAssociation_GeneralStudentProgramAssociation] FOREIGN KEY ([BeginDate], [EducationOrganizationId], [ProgramEducationOrganizationId], [ProgramName], [ProgramTypeDescriptorId], [StudentUSI])
REFERENCES [edfi].[GeneralStudentProgramAssociation] ([BeginDate], [EducationOrganizationId], [ProgramEducationOrganizationId], [ProgramName], [ProgramTypeDescriptorId], [StudentUSI])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[StudentHomelessProgramAssociation] WITH CHECK ADD CONSTRAINT [FK_StudentHomelessProgramAssociation_HomelessPrimaryNighttimeResidenceDescriptor] FOREIGN KEY ([HomelessPrimaryNighttimeResidenceDescriptorId])
REFERENCES [edfi].[HomelessPrimaryNighttimeResidenceDescriptor] ([HomelessPrimaryNighttimeResidenceDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StudentHomelessProgramAssociation_HomelessPrimaryNighttimeResidenceDescriptor]
ON [edfi].[StudentHomelessProgramAssociation] ([HomelessPrimaryNighttimeResidenceDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StudentHomelessProgramAssociationHomelessProgramService] WITH CHECK ADD CONSTRAINT [FK_StudentHomelessProgramAssociationHomelessProgramService_HomelessProgramServiceDescriptor] FOREIGN KEY ([HomelessProgramServiceDescriptorId])
REFERENCES [edfi].[HomelessProgramServiceDescriptor] ([HomelessProgramServiceDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StudentHomelessProgramAssociationHomelessProgramService_HomelessProgramServiceDescriptor]
ON [edfi].[StudentHomelessProgramAssociationHomelessProgramService] ([HomelessProgramServiceDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StudentHomelessProgramAssociationHomelessProgramService] WITH CHECK ADD CONSTRAINT [FK_StudentHomelessProgramAssociationHomelessProgramService_StudentHomelessProgramAssociation] FOREIGN KEY ([BeginDate], [EducationOrganizationId], [ProgramEducationOrganizationId], [ProgramName], [ProgramTypeDescriptorId], [StudentUSI])
REFERENCES [edfi].[StudentHomelessProgramAssociation] ([BeginDate], [EducationOrganizationId], [ProgramEducationOrganizationId], [ProgramName], [ProgramTypeDescriptorId], [StudentUSI])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_StudentHomelessProgramAssociationHomelessProgramService_StudentHomelessProgramAssociation]
ON [edfi].[StudentHomelessProgramAssociationHomelessProgramService] ([BeginDate] ASC, [EducationOrganizationId] ASC, [ProgramEducationOrganizationId] ASC, [ProgramName] ASC, [ProgramTypeDescriptorId] ASC, [StudentUSI] ASC)
GO
ALTER TABLE [edfi].[StudentIdentificationDocument] WITH CHECK ADD CONSTRAINT [FK_StudentIdentificationDocument_CountryDescriptor] FOREIGN KEY ([IssuerCountryDescriptorId])
REFERENCES [edfi].[CountryDescriptor] ([CountryDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StudentIdentificationDocument_CountryDescriptor]
ON [edfi].[StudentIdentificationDocument] ([IssuerCountryDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StudentIdentificationDocument] WITH CHECK ADD CONSTRAINT [FK_StudentIdentificationDocument_IdentificationDocumentUseDescriptor] FOREIGN KEY ([IdentificationDocumentUseDescriptorId])
REFERENCES [edfi].[IdentificationDocumentUseDescriptor] ([IdentificationDocumentUseDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StudentIdentificationDocument_IdentificationDocumentUseDescriptor]
ON [edfi].[StudentIdentificationDocument] ([IdentificationDocumentUseDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StudentIdentificationDocument] WITH CHECK ADD CONSTRAINT [FK_StudentIdentificationDocument_PersonalInformationVerificationDescriptor] FOREIGN KEY ([PersonalInformationVerificationDescriptorId])
REFERENCES [edfi].[PersonalInformationVerificationDescriptor] ([PersonalInformationVerificationDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StudentIdentificationDocument_PersonalInformationVerificationDescriptor]
ON [edfi].[StudentIdentificationDocument] ([PersonalInformationVerificationDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StudentIdentificationDocument] WITH CHECK ADD CONSTRAINT [FK_StudentIdentificationDocument_Student] FOREIGN KEY ([StudentUSI])
REFERENCES [edfi].[Student] ([StudentUSI])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_StudentIdentificationDocument_Student]
ON [edfi].[StudentIdentificationDocument] ([StudentUSI] ASC)
GO
ALTER TABLE [edfi].[StudentIdentificationSystemDescriptor] WITH CHECK ADD CONSTRAINT [FK_StudentIdentificationSystemDescriptor_Descriptor] FOREIGN KEY ([StudentIdentificationSystemDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[StudentInterventionAssociation] WITH CHECK ADD CONSTRAINT [FK_StudentInterventionAssociation_Cohort] FOREIGN KEY ([CohortIdentifier], [CohortEducationOrganizationId])
REFERENCES [edfi].[Cohort] ([CohortIdentifier], [EducationOrganizationId])
GO
CREATE NONCLUSTERED INDEX [FK_StudentInterventionAssociation_Cohort]
ON [edfi].[StudentInterventionAssociation] ([CohortIdentifier] ASC, [CohortEducationOrganizationId] ASC)
GO
ALTER TABLE [edfi].[StudentInterventionAssociation] WITH CHECK ADD CONSTRAINT [FK_StudentInterventionAssociation_Intervention] FOREIGN KEY ([EducationOrganizationId], [InterventionIdentificationCode])
REFERENCES [edfi].[Intervention] ([EducationOrganizationId], [InterventionIdentificationCode])
GO
CREATE NONCLUSTERED INDEX [FK_StudentInterventionAssociation_Intervention]
ON [edfi].[StudentInterventionAssociation] ([EducationOrganizationId] ASC, [InterventionIdentificationCode] ASC)
GO
ALTER TABLE [edfi].[StudentInterventionAssociation] WITH CHECK ADD CONSTRAINT [FK_StudentInterventionAssociation_Student] FOREIGN KEY ([StudentUSI])
REFERENCES [edfi].[Student] ([StudentUSI])
GO
CREATE NONCLUSTERED INDEX [FK_StudentInterventionAssociation_Student]
ON [edfi].[StudentInterventionAssociation] ([StudentUSI] ASC)
GO
ALTER TABLE [edfi].[StudentInterventionAssociationInterventionEffectiveness] WITH CHECK ADD CONSTRAINT [FK_StudentInterventionAssociationInterventionEffectiveness_DiagnosisDescriptor] FOREIGN KEY ([DiagnosisDescriptorId])
REFERENCES [edfi].[DiagnosisDescriptor] ([DiagnosisDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StudentInterventionAssociationInterventionEffectiveness_DiagnosisDescriptor]
ON [edfi].[StudentInterventionAssociationInterventionEffectiveness] ([DiagnosisDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StudentInterventionAssociationInterventionEffectiveness] WITH CHECK ADD CONSTRAINT [FK_StudentInterventionAssociationInterventionEffectiveness_GradeLevelDescriptor] FOREIGN KEY ([GradeLevelDescriptorId])
REFERENCES [edfi].[GradeLevelDescriptor] ([GradeLevelDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StudentInterventionAssociationInterventionEffectiveness_GradeLevelDescriptor]
ON [edfi].[StudentInterventionAssociationInterventionEffectiveness] ([GradeLevelDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StudentInterventionAssociationInterventionEffectiveness] WITH CHECK ADD CONSTRAINT [FK_StudentInterventionAssociationInterventionEffectiveness_InterventionEffectivenessRatingDescriptor] FOREIGN KEY ([InterventionEffectivenessRatingDescriptorId])
REFERENCES [edfi].[InterventionEffectivenessRatingDescriptor] ([InterventionEffectivenessRatingDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StudentInterventionAssociationInterventionEffectiveness_InterventionEffectivenessRatingDescriptor]
ON [edfi].[StudentInterventionAssociationInterventionEffectiveness] ([InterventionEffectivenessRatingDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StudentInterventionAssociationInterventionEffectiveness] WITH CHECK ADD CONSTRAINT [FK_StudentInterventionAssociationInterventionEffectiveness_PopulationServedDescriptor] FOREIGN KEY ([PopulationServedDescriptorId])
REFERENCES [edfi].[PopulationServedDescriptor] ([PopulationServedDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StudentInterventionAssociationInterventionEffectiveness_PopulationServedDescriptor]
ON [edfi].[StudentInterventionAssociationInterventionEffectiveness] ([PopulationServedDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StudentInterventionAssociationInterventionEffectiveness] WITH CHECK ADD CONSTRAINT [FK_StudentInterventionAssociationInterventionEffectiveness_StudentInterventionAssociation] FOREIGN KEY ([EducationOrganizationId], [InterventionIdentificationCode], [StudentUSI])
REFERENCES [edfi].[StudentInterventionAssociation] ([EducationOrganizationId], [InterventionIdentificationCode], [StudentUSI])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_StudentInterventionAssociationInterventionEffectiveness_StudentInterventionAssociation]
ON [edfi].[StudentInterventionAssociationInterventionEffectiveness] ([EducationOrganizationId] ASC, [InterventionIdentificationCode] ASC, [StudentUSI] ASC)
GO
ALTER TABLE [edfi].[StudentInterventionAttendanceEvent] WITH CHECK ADD CONSTRAINT [FK_StudentInterventionAttendanceEvent_AttendanceEventCategoryDescriptor] FOREIGN KEY ([AttendanceEventCategoryDescriptorId])
REFERENCES [edfi].[AttendanceEventCategoryDescriptor] ([AttendanceEventCategoryDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StudentInterventionAttendanceEvent_AttendanceEventCategoryDescriptor]
ON [edfi].[StudentInterventionAttendanceEvent] ([AttendanceEventCategoryDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StudentInterventionAttendanceEvent] WITH CHECK ADD CONSTRAINT [FK_StudentInterventionAttendanceEvent_EducationalEnvironmentDescriptor] FOREIGN KEY ([EducationalEnvironmentDescriptorId])
REFERENCES [edfi].[EducationalEnvironmentDescriptor] ([EducationalEnvironmentDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StudentInterventionAttendanceEvent_EducationalEnvironmentDescriptor]
ON [edfi].[StudentInterventionAttendanceEvent] ([EducationalEnvironmentDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StudentInterventionAttendanceEvent] WITH CHECK ADD CONSTRAINT [FK_StudentInterventionAttendanceEvent_Intervention] FOREIGN KEY ([EducationOrganizationId], [InterventionIdentificationCode])
REFERENCES [edfi].[Intervention] ([EducationOrganizationId], [InterventionIdentificationCode])
GO
CREATE NONCLUSTERED INDEX [FK_StudentInterventionAttendanceEvent_Intervention]
ON [edfi].[StudentInterventionAttendanceEvent] ([EducationOrganizationId] ASC, [InterventionIdentificationCode] ASC)
GO
ALTER TABLE [edfi].[StudentInterventionAttendanceEvent] WITH CHECK ADD CONSTRAINT [FK_StudentInterventionAttendanceEvent_Student] FOREIGN KEY ([StudentUSI])
REFERENCES [edfi].[Student] ([StudentUSI])
GO
CREATE NONCLUSTERED INDEX [FK_StudentInterventionAttendanceEvent_Student]
ON [edfi].[StudentInterventionAttendanceEvent] ([StudentUSI] ASC)
GO
ALTER TABLE [edfi].[StudentLanguageInstructionProgramAssociation] WITH CHECK ADD CONSTRAINT [FK_StudentLanguageInstructionProgramAssociation_GeneralStudentProgramAssociation] FOREIGN KEY ([BeginDate], [EducationOrganizationId], [ProgramEducationOrganizationId], [ProgramName], [ProgramTypeDescriptorId], [StudentUSI])
REFERENCES [edfi].[GeneralStudentProgramAssociation] ([BeginDate], [EducationOrganizationId], [ProgramEducationOrganizationId], [ProgramName], [ProgramTypeDescriptorId], [StudentUSI])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[StudentLanguageInstructionProgramAssociationEnglishLanguageProficiencyAssessment] WITH CHECK ADD CONSTRAINT [FK_StudentLanguageInstructionProgramAssociationEnglishLanguageProficiencyAssessment_MonitoredDescriptor] FOREIGN KEY ([MonitoredDescriptorId])
REFERENCES [edfi].[MonitoredDescriptor] ([MonitoredDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StudentLanguageInstructionProgramAssociationEnglishLanguageProficiencyAssessment_MonitoredDescriptor]
ON [edfi].[StudentLanguageInstructionProgramAssociationEnglishLanguageProficiencyAssessment] ([MonitoredDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StudentLanguageInstructionProgramAssociationEnglishLanguageProficiencyAssessment] WITH CHECK ADD CONSTRAINT [FK_StudentLanguageInstructionProgramAssociationEnglishLanguageProficiencyAssessment_ParticipationDescriptor] FOREIGN KEY ([ParticipationDescriptorId])
REFERENCES [edfi].[ParticipationDescriptor] ([ParticipationDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StudentLanguageInstructionProgramAssociationEnglishLanguageProficiencyAssessment_ParticipationDescriptor]
ON [edfi].[StudentLanguageInstructionProgramAssociationEnglishLanguageProficiencyAssessment] ([ParticipationDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StudentLanguageInstructionProgramAssociationEnglishLanguageProficiencyAssessment] WITH CHECK ADD CONSTRAINT [FK_StudentLanguageInstructionProgramAssociationEnglishLanguageProficiencyAssessment_ProficiencyDescriptor] FOREIGN KEY ([ProficiencyDescriptorId])
REFERENCES [edfi].[ProficiencyDescriptor] ([ProficiencyDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StudentLanguageInstructionProgramAssociationEnglishLanguageProficiencyAssessment_ProficiencyDescriptor]
ON [edfi].[StudentLanguageInstructionProgramAssociationEnglishLanguageProficiencyAssessment] ([ProficiencyDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StudentLanguageInstructionProgramAssociationEnglishLanguageProficiencyAssessment] WITH CHECK ADD CONSTRAINT [FK_StudentLanguageInstructionProgramAssociationEnglishLanguageProficiencyAssessment_ProgressDescriptor] FOREIGN KEY ([ProgressDescriptorId])
REFERENCES [edfi].[ProgressDescriptor] ([ProgressDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StudentLanguageInstructionProgramAssociationEnglishLanguageProficiencyAssessment_ProgressDescriptor]
ON [edfi].[StudentLanguageInstructionProgramAssociationEnglishLanguageProficiencyAssessment] ([ProgressDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StudentLanguageInstructionProgramAssociationEnglishLanguageProficiencyAssessment] WITH CHECK ADD CONSTRAINT [FK_StudentLanguageInstructionProgramAssociationEnglishLanguageProficiencyAssessment_SchoolYearType] FOREIGN KEY ([SchoolYear])
REFERENCES [edfi].[SchoolYearType] ([SchoolYear])
GO
CREATE NONCLUSTERED INDEX [FK_StudentLanguageInstructionProgramAssociationEnglishLanguageProficiencyAssessment_SchoolYearType]
ON [edfi].[StudentLanguageInstructionProgramAssociationEnglishLanguageProficiencyAssessment] ([SchoolYear] ASC)
GO
ALTER TABLE [edfi].[StudentLanguageInstructionProgramAssociationEnglishLanguageProficiencyAssessment] WITH CHECK ADD CONSTRAINT [FK_StudentLanguageInstructionProgramAssociationEnglishLanguageProficiencyAssessment_StudentLanguageInstructionProgramAssociation] FOREIGN KEY ([BeginDate], [EducationOrganizationId], [ProgramEducationOrganizationId], [ProgramName], [ProgramTypeDescriptorId], [StudentUSI])
REFERENCES [edfi].[StudentLanguageInstructionProgramAssociation] ([BeginDate], [EducationOrganizationId], [ProgramEducationOrganizationId], [ProgramName], [ProgramTypeDescriptorId], [StudentUSI])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_StudentLanguageInstructionProgramAssociationEnglishLanguageProficiencyAssessment_StudentLanguageInstructionProgramAssociation]
ON [edfi].[StudentLanguageInstructionProgramAssociationEnglishLanguageProficiencyAssessment] ([BeginDate] ASC, [EducationOrganizationId] ASC, [ProgramEducationOrganizationId] ASC, [ProgramName] ASC, [ProgramTypeDescriptorId] ASC, [StudentUSI] ASC)
GO
ALTER TABLE [edfi].[StudentLanguageInstructionProgramAssociationLanguageInstructionProgramService] WITH CHECK ADD CONSTRAINT [FK_StudentLanguageInstructionProgramAssociationLanguageInstructionProgramService_LanguageInstructionProgramServiceDescriptor] FOREIGN KEY ([LanguageInstructionProgramServiceDescriptorId])
REFERENCES [edfi].[LanguageInstructionProgramServiceDescriptor] ([LanguageInstructionProgramServiceDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StudentLanguageInstructionProgramAssociationLanguageInstructionProgramService_LanguageInstructionProgramServiceDescriptor]
ON [edfi].[StudentLanguageInstructionProgramAssociationLanguageInstructionProgramService] ([LanguageInstructionProgramServiceDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StudentLanguageInstructionProgramAssociationLanguageInstructionProgramService] WITH CHECK ADD CONSTRAINT [FK_StudentLanguageInstructionProgramAssociationLanguageInstructionProgramService_StudentLanguageInstructionProgramAssociation] FOREIGN KEY ([BeginDate], [EducationOrganizationId], [ProgramEducationOrganizationId], [ProgramName], [ProgramTypeDescriptorId], [StudentUSI])
REFERENCES [edfi].[StudentLanguageInstructionProgramAssociation] ([BeginDate], [EducationOrganizationId], [ProgramEducationOrganizationId], [ProgramName], [ProgramTypeDescriptorId], [StudentUSI])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_StudentLanguageInstructionProgramAssociationLanguageInstructionProgramService_StudentLanguageInstructionProgramAssociation]
ON [edfi].[StudentLanguageInstructionProgramAssociationLanguageInstructionProgramService] ([BeginDate] ASC, [EducationOrganizationId] ASC, [ProgramEducationOrganizationId] ASC, [ProgramName] ASC, [ProgramTypeDescriptorId] ASC, [StudentUSI] ASC)
GO
ALTER TABLE [edfi].[StudentLearningObjective] WITH CHECK ADD CONSTRAINT [FK_StudentLearningObjective_CompetencyLevelDescriptor] FOREIGN KEY ([CompetencyLevelDescriptorId])
REFERENCES [edfi].[CompetencyLevelDescriptor] ([CompetencyLevelDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StudentLearningObjective_CompetencyLevelDescriptor]
ON [edfi].[StudentLearningObjective] ([CompetencyLevelDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StudentLearningObjective] WITH CHECK ADD CONSTRAINT [FK_StudentLearningObjective_GradingPeriod] FOREIGN KEY ([GradingPeriodDescriptorId], [GradingPeriodSequence], [GradingPeriodSchoolId], [GradingPeriodSchoolYear])
REFERENCES [edfi].[GradingPeriod] ([GradingPeriodDescriptorId], [PeriodSequence], [SchoolId], [SchoolYear])
GO
CREATE NONCLUSTERED INDEX [FK_StudentLearningObjective_GradingPeriod]
ON [edfi].[StudentLearningObjective] ([GradingPeriodDescriptorId] ASC, [GradingPeriodSequence] ASC, [GradingPeriodSchoolId] ASC, [GradingPeriodSchoolYear] ASC)
GO
ALTER TABLE [edfi].[StudentLearningObjective] WITH CHECK ADD CONSTRAINT [FK_StudentLearningObjective_LearningObjective] FOREIGN KEY ([LearningObjectiveId], [Namespace])
REFERENCES [edfi].[LearningObjective] ([LearningObjectiveId], [Namespace])
GO
CREATE NONCLUSTERED INDEX [FK_StudentLearningObjective_LearningObjective]
ON [edfi].[StudentLearningObjective] ([LearningObjectiveId] ASC, [Namespace] ASC)
GO
ALTER TABLE [edfi].[StudentLearningObjective] WITH CHECK ADD CONSTRAINT [FK_StudentLearningObjective_Student] FOREIGN KEY ([StudentUSI])
REFERENCES [edfi].[Student] ([StudentUSI])
GO
CREATE NONCLUSTERED INDEX [FK_StudentLearningObjective_Student]
ON [edfi].[StudentLearningObjective] ([StudentUSI] ASC)
GO
ALTER TABLE [edfi].[StudentLearningObjectiveGeneralStudentProgramAssociation] WITH CHECK ADD CONSTRAINT [FK_StudentLearningObjectiveGeneralStudentProgramAssociation_GeneralStudentProgramAssociation] FOREIGN KEY ([BeginDate], [EducationOrganizationId], [ProgramEducationOrganizationId], [ProgramName], [ProgramTypeDescriptorId], [StudentUSI])
REFERENCES [edfi].[GeneralStudentProgramAssociation] ([BeginDate], [EducationOrganizationId], [ProgramEducationOrganizationId], [ProgramName], [ProgramTypeDescriptorId], [StudentUSI])
GO
CREATE NONCLUSTERED INDEX [FK_StudentLearningObjectiveGeneralStudentProgramAssociation_GeneralStudentProgramAssociation]
ON [edfi].[StudentLearningObjectiveGeneralStudentProgramAssociation] ([BeginDate] ASC, [EducationOrganizationId] ASC, [ProgramEducationOrganizationId] ASC, [ProgramName] ASC, [ProgramTypeDescriptorId] ASC, [StudentUSI] ASC)
GO
ALTER TABLE [edfi].[StudentLearningObjectiveGeneralStudentProgramAssociation] WITH CHECK ADD CONSTRAINT [FK_StudentLearningObjectiveGeneralStudentProgramAssociation_StudentLearningObjective] FOREIGN KEY ([GradingPeriodDescriptorId], [GradingPeriodSchoolId], [GradingPeriodSchoolYear], [GradingPeriodSequence], [LearningObjectiveId], [Namespace], [StudentUSI])
REFERENCES [edfi].[StudentLearningObjective] ([GradingPeriodDescriptorId], [GradingPeriodSchoolId], [GradingPeriodSchoolYear], [GradingPeriodSequence], [LearningObjectiveId], [Namespace], [StudentUSI])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_StudentLearningObjectiveGeneralStudentProgramAssociation_StudentLearningObjective]
ON [edfi].[StudentLearningObjectiveGeneralStudentProgramAssociation] ([GradingPeriodDescriptorId] ASC, [GradingPeriodSchoolId] ASC, [GradingPeriodSchoolYear] ASC, [GradingPeriodSequence] ASC, [LearningObjectiveId] ASC, [Namespace] ASC, [StudentUSI] ASC)
GO
ALTER TABLE [edfi].[StudentLearningObjectiveStudentSectionAssociation] WITH CHECK ADD CONSTRAINT [FK_StudentLearningObjectiveStudentSectionAssociation_StudentLearningObjective] FOREIGN KEY ([GradingPeriodDescriptorId], [GradingPeriodSchoolId], [GradingPeriodSchoolYear], [GradingPeriodSequence], [LearningObjectiveId], [Namespace], [StudentUSI])
REFERENCES [edfi].[StudentLearningObjective] ([GradingPeriodDescriptorId], [GradingPeriodSchoolId], [GradingPeriodSchoolYear], [GradingPeriodSequence], [LearningObjectiveId], [Namespace], [StudentUSI])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_StudentLearningObjectiveStudentSectionAssociation_StudentLearningObjective]
ON [edfi].[StudentLearningObjectiveStudentSectionAssociation] ([GradingPeriodDescriptorId] ASC, [GradingPeriodSchoolId] ASC, [GradingPeriodSchoolYear] ASC, [GradingPeriodSequence] ASC, [LearningObjectiveId] ASC, [Namespace] ASC, [StudentUSI] ASC)
GO
ALTER TABLE [edfi].[StudentLearningObjectiveStudentSectionAssociation] WITH CHECK ADD CONSTRAINT [FK_StudentLearningObjectiveStudentSectionAssociation_StudentSectionAssociation] FOREIGN KEY ([BeginDate], [LocalCourseCode], [SchoolId], [SchoolYear], [SectionIdentifier], [SessionName], [StudentUSI])
REFERENCES [edfi].[StudentSectionAssociation] ([BeginDate], [LocalCourseCode], [SchoolId], [SchoolYear], [SectionIdentifier], [SessionName], [StudentUSI])
ON UPDATE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_StudentLearningObjectiveStudentSectionAssociation_StudentSectionAssociation]
ON [edfi].[StudentLearningObjectiveStudentSectionAssociation] ([BeginDate] ASC, [LocalCourseCode] ASC, [SchoolId] ASC, [SchoolYear] ASC, [SectionIdentifier] ASC, [SessionName] ASC, [StudentUSI] ASC)
GO
ALTER TABLE [edfi].[StudentMigrantEducationProgramAssociation] WITH CHECK ADD CONSTRAINT [FK_StudentMigrantEducationProgramAssociation_ContinuationOfServicesReasonDescriptor] FOREIGN KEY ([ContinuationOfServicesReasonDescriptorId])
REFERENCES [edfi].[ContinuationOfServicesReasonDescriptor] ([ContinuationOfServicesReasonDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StudentMigrantEducationProgramAssociation_ContinuationOfServicesReasonDescriptor]
ON [edfi].[StudentMigrantEducationProgramAssociation] ([ContinuationOfServicesReasonDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StudentMigrantEducationProgramAssociation] WITH CHECK ADD CONSTRAINT [FK_StudentMigrantEducationProgramAssociation_GeneralStudentProgramAssociation] FOREIGN KEY ([BeginDate], [EducationOrganizationId], [ProgramEducationOrganizationId], [ProgramName], [ProgramTypeDescriptorId], [StudentUSI])
REFERENCES [edfi].[GeneralStudentProgramAssociation] ([BeginDate], [EducationOrganizationId], [ProgramEducationOrganizationId], [ProgramName], [ProgramTypeDescriptorId], [StudentUSI])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[StudentMigrantEducationProgramAssociationMigrantEducationProgramService] WITH CHECK ADD CONSTRAINT [FK_StudentMigrantEducationProgramAssociationMigrantEducationProgramService_MigrantEducationProgramServiceDescriptor] FOREIGN KEY ([MigrantEducationProgramServiceDescriptorId])
REFERENCES [edfi].[MigrantEducationProgramServiceDescriptor] ([MigrantEducationProgramServiceDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StudentMigrantEducationProgramAssociationMigrantEducationProgramService_MigrantEducationProgramServiceDescriptor]
ON [edfi].[StudentMigrantEducationProgramAssociationMigrantEducationProgramService] ([MigrantEducationProgramServiceDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StudentMigrantEducationProgramAssociationMigrantEducationProgramService] WITH CHECK ADD CONSTRAINT [FK_StudentMigrantEducationProgramAssociationMigrantEducationProgramService_StudentMigrantEducationProgramAssociation] FOREIGN KEY ([BeginDate], [EducationOrganizationId], [ProgramEducationOrganizationId], [ProgramName], [ProgramTypeDescriptorId], [StudentUSI])
REFERENCES [edfi].[StudentMigrantEducationProgramAssociation] ([BeginDate], [EducationOrganizationId], [ProgramEducationOrganizationId], [ProgramName], [ProgramTypeDescriptorId], [StudentUSI])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_StudentMigrantEducationProgramAssociationMigrantEducationProgramService_StudentMigrantEducationProgramAssociation]
ON [edfi].[StudentMigrantEducationProgramAssociationMigrantEducationProgramService] ([BeginDate] ASC, [EducationOrganizationId] ASC, [ProgramEducationOrganizationId] ASC, [ProgramName] ASC, [ProgramTypeDescriptorId] ASC, [StudentUSI] ASC)
GO
ALTER TABLE [edfi].[StudentNeglectedOrDelinquentProgramAssociation] WITH CHECK ADD CONSTRAINT [FK_StudentNeglectedOrDelinquentProgramAssociation_GeneralStudentProgramAssociation] FOREIGN KEY ([BeginDate], [EducationOrganizationId], [ProgramEducationOrganizationId], [ProgramName], [ProgramTypeDescriptorId], [StudentUSI])
REFERENCES [edfi].[GeneralStudentProgramAssociation] ([BeginDate], [EducationOrganizationId], [ProgramEducationOrganizationId], [ProgramName], [ProgramTypeDescriptorId], [StudentUSI])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[StudentNeglectedOrDelinquentProgramAssociation] WITH CHECK ADD CONSTRAINT [FK_StudentNeglectedOrDelinquentProgramAssociation_NeglectedOrDelinquentProgramDescriptor] FOREIGN KEY ([NeglectedOrDelinquentProgramDescriptorId])
REFERENCES [edfi].[NeglectedOrDelinquentProgramDescriptor] ([NeglectedOrDelinquentProgramDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StudentNeglectedOrDelinquentProgramAssociation_NeglectedOrDelinquentProgramDescriptor]
ON [edfi].[StudentNeglectedOrDelinquentProgramAssociation] ([NeglectedOrDelinquentProgramDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StudentNeglectedOrDelinquentProgramAssociation] WITH CHECK ADD CONSTRAINT [FK_StudentNeglectedOrDelinquentProgramAssociation_ProgressLevelDescriptor] FOREIGN KEY ([ELAProgressLevelDescriptorId])
REFERENCES [edfi].[ProgressLevelDescriptor] ([ProgressLevelDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StudentNeglectedOrDelinquentProgramAssociation_ProgressLevelDescriptor]
ON [edfi].[StudentNeglectedOrDelinquentProgramAssociation] ([ELAProgressLevelDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StudentNeglectedOrDelinquentProgramAssociation] WITH CHECK ADD CONSTRAINT [FK_StudentNeglectedOrDelinquentProgramAssociation_ProgressLevelDescriptor1] FOREIGN KEY ([MathematicsProgressLevelDescriptorId])
REFERENCES [edfi].[ProgressLevelDescriptor] ([ProgressLevelDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StudentNeglectedOrDelinquentProgramAssociation_ProgressLevelDescriptor1]
ON [edfi].[StudentNeglectedOrDelinquentProgramAssociation] ([MathematicsProgressLevelDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StudentNeglectedOrDelinquentProgramAssociationNeglectedOrDelinquentProgramService] WITH CHECK ADD CONSTRAINT [FK_StudentNeglectedOrDelinquentProgramAssociationNeglectedOrDelinquentProgramService_NeglectedOrDelinquentProgramServiceDescript] FOREIGN KEY ([NeglectedOrDelinquentProgramServiceDescriptorId])
REFERENCES [edfi].[NeglectedOrDelinquentProgramServiceDescriptor] ([NeglectedOrDelinquentProgramServiceDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StudentNeglectedOrDelinquentProgramAssociationNeglectedOrDelinquentProgramService_NeglectedOrDelinquentProgramServiceDescript]
ON [edfi].[StudentNeglectedOrDelinquentProgramAssociationNeglectedOrDelinquentProgramService] ([NeglectedOrDelinquentProgramServiceDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StudentNeglectedOrDelinquentProgramAssociationNeglectedOrDelinquentProgramService] WITH CHECK ADD CONSTRAINT [FK_StudentNeglectedOrDelinquentProgramAssociationNeglectedOrDelinquentProgramService_StudentNeglectedOrDelinquentProgramAssociat] FOREIGN KEY ([BeginDate], [EducationOrganizationId], [ProgramEducationOrganizationId], [ProgramName], [ProgramTypeDescriptorId], [StudentUSI])
REFERENCES [edfi].[StudentNeglectedOrDelinquentProgramAssociation] ([BeginDate], [EducationOrganizationId], [ProgramEducationOrganizationId], [ProgramName], [ProgramTypeDescriptorId], [StudentUSI])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_StudentNeglectedOrDelinquentProgramAssociationNeglectedOrDelinquentProgramService_StudentNeglectedOrDelinquentProgramAssociat]
ON [edfi].[StudentNeglectedOrDelinquentProgramAssociationNeglectedOrDelinquentProgramService] ([BeginDate] ASC, [EducationOrganizationId] ASC, [ProgramEducationOrganizationId] ASC, [ProgramName] ASC, [ProgramTypeDescriptorId] ASC, [StudentUSI] ASC)
GO
ALTER TABLE [edfi].[StudentOtherName] WITH CHECK ADD CONSTRAINT [FK_StudentOtherName_OtherNameTypeDescriptor] FOREIGN KEY ([OtherNameTypeDescriptorId])
REFERENCES [edfi].[OtherNameTypeDescriptor] ([OtherNameTypeDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StudentOtherName_OtherNameTypeDescriptor]
ON [edfi].[StudentOtherName] ([OtherNameTypeDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StudentOtherName] WITH CHECK ADD CONSTRAINT [FK_StudentOtherName_Student] FOREIGN KEY ([StudentUSI])
REFERENCES [edfi].[Student] ([StudentUSI])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_StudentOtherName_Student]
ON [edfi].[StudentOtherName] ([StudentUSI] ASC)
GO
ALTER TABLE [edfi].[StudentParentAssociation] WITH CHECK ADD CONSTRAINT [FK_StudentParentAssociation_Parent] FOREIGN KEY ([ParentUSI])
REFERENCES [edfi].[Parent] ([ParentUSI])
GO
CREATE NONCLUSTERED INDEX [FK_StudentParentAssociation_Parent]
ON [edfi].[StudentParentAssociation] ([ParentUSI] ASC)
GO
ALTER TABLE [edfi].[StudentParentAssociation] WITH CHECK ADD CONSTRAINT [FK_StudentParentAssociation_RelationDescriptor] FOREIGN KEY ([RelationDescriptorId])
REFERENCES [edfi].[RelationDescriptor] ([RelationDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StudentParentAssociation_RelationDescriptor]
ON [edfi].[StudentParentAssociation] ([RelationDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StudentParentAssociation] WITH CHECK ADD CONSTRAINT [FK_StudentParentAssociation_Student] FOREIGN KEY ([StudentUSI])
REFERENCES [edfi].[Student] ([StudentUSI])
GO
CREATE NONCLUSTERED INDEX [FK_StudentParentAssociation_Student]
ON [edfi].[StudentParentAssociation] ([StudentUSI] ASC)
GO
ALTER TABLE [edfi].[StudentParticipationCodeDescriptor] WITH CHECK ADD CONSTRAINT [FK_StudentParticipationCodeDescriptor_Descriptor] FOREIGN KEY ([StudentParticipationCodeDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[StudentPersonalIdentificationDocument] WITH CHECK ADD CONSTRAINT [FK_StudentPersonalIdentificationDocument_CountryDescriptor] FOREIGN KEY ([IssuerCountryDescriptorId])
REFERENCES [edfi].[CountryDescriptor] ([CountryDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StudentPersonalIdentificationDocument_CountryDescriptor]
ON [edfi].[StudentPersonalIdentificationDocument] ([IssuerCountryDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StudentPersonalIdentificationDocument] WITH CHECK ADD CONSTRAINT [FK_StudentPersonalIdentificationDocument_IdentificationDocumentUseDescriptor] FOREIGN KEY ([IdentificationDocumentUseDescriptorId])
REFERENCES [edfi].[IdentificationDocumentUseDescriptor] ([IdentificationDocumentUseDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StudentPersonalIdentificationDocument_IdentificationDocumentUseDescriptor]
ON [edfi].[StudentPersonalIdentificationDocument] ([IdentificationDocumentUseDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StudentPersonalIdentificationDocument] WITH CHECK ADD CONSTRAINT [FK_StudentPersonalIdentificationDocument_PersonalInformationVerificationDescriptor] FOREIGN KEY ([PersonalInformationVerificationDescriptorId])
REFERENCES [edfi].[PersonalInformationVerificationDescriptor] ([PersonalInformationVerificationDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StudentPersonalIdentificationDocument_PersonalInformationVerificationDescriptor]
ON [edfi].[StudentPersonalIdentificationDocument] ([PersonalInformationVerificationDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StudentPersonalIdentificationDocument] WITH CHECK ADD CONSTRAINT [FK_StudentPersonalIdentificationDocument_Student] FOREIGN KEY ([StudentUSI])
REFERENCES [edfi].[Student] ([StudentUSI])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_StudentPersonalIdentificationDocument_Student]
ON [edfi].[StudentPersonalIdentificationDocument] ([StudentUSI] ASC)
GO
ALTER TABLE [edfi].[StudentProgramAssociation] WITH CHECK ADD CONSTRAINT [FK_StudentProgramAssociation_GeneralStudentProgramAssociation] FOREIGN KEY ([BeginDate], [EducationOrganizationId], [ProgramEducationOrganizationId], [ProgramName], [ProgramTypeDescriptorId], [StudentUSI])
REFERENCES [edfi].[GeneralStudentProgramAssociation] ([BeginDate], [EducationOrganizationId], [ProgramEducationOrganizationId], [ProgramName], [ProgramTypeDescriptorId], [StudentUSI])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[StudentProgramAssociationService] WITH CHECK ADD CONSTRAINT [FK_StudentProgramAssociationService_ServiceDescriptor] FOREIGN KEY ([ServiceDescriptorId])
REFERENCES [edfi].[ServiceDescriptor] ([ServiceDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StudentProgramAssociationService_ServiceDescriptor]
ON [edfi].[StudentProgramAssociationService] ([ServiceDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StudentProgramAssociationService] WITH CHECK ADD CONSTRAINT [FK_StudentProgramAssociationService_StudentProgramAssociation] FOREIGN KEY ([BeginDate], [EducationOrganizationId], [ProgramEducationOrganizationId], [ProgramName], [ProgramTypeDescriptorId], [StudentUSI])
REFERENCES [edfi].[StudentProgramAssociation] ([BeginDate], [EducationOrganizationId], [ProgramEducationOrganizationId], [ProgramName], [ProgramTypeDescriptorId], [StudentUSI])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_StudentProgramAssociationService_StudentProgramAssociation]
ON [edfi].[StudentProgramAssociationService] ([BeginDate] ASC, [EducationOrganizationId] ASC, [ProgramEducationOrganizationId] ASC, [ProgramName] ASC, [ProgramTypeDescriptorId] ASC, [StudentUSI] ASC)
GO
ALTER TABLE [edfi].[StudentProgramAttendanceEvent] WITH CHECK ADD CONSTRAINT [FK_StudentProgramAttendanceEvent_AttendanceEventCategoryDescriptor] FOREIGN KEY ([AttendanceEventCategoryDescriptorId])
REFERENCES [edfi].[AttendanceEventCategoryDescriptor] ([AttendanceEventCategoryDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StudentProgramAttendanceEvent_AttendanceEventCategoryDescriptor]
ON [edfi].[StudentProgramAttendanceEvent] ([AttendanceEventCategoryDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StudentProgramAttendanceEvent] WITH CHECK ADD CONSTRAINT [FK_StudentProgramAttendanceEvent_EducationalEnvironmentDescriptor] FOREIGN KEY ([EducationalEnvironmentDescriptorId])
REFERENCES [edfi].[EducationalEnvironmentDescriptor] ([EducationalEnvironmentDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StudentProgramAttendanceEvent_EducationalEnvironmentDescriptor]
ON [edfi].[StudentProgramAttendanceEvent] ([EducationalEnvironmentDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StudentProgramAttendanceEvent] WITH CHECK ADD CONSTRAINT [FK_StudentProgramAttendanceEvent_EducationOrganization] FOREIGN KEY ([EducationOrganizationId])
REFERENCES [edfi].[EducationOrganization] ([EducationOrganizationId])
GO
CREATE NONCLUSTERED INDEX [FK_StudentProgramAttendanceEvent_EducationOrganization]
ON [edfi].[StudentProgramAttendanceEvent] ([EducationOrganizationId] ASC)
GO
ALTER TABLE [edfi].[StudentProgramAttendanceEvent] WITH CHECK ADD CONSTRAINT [FK_StudentProgramAttendanceEvent_Program] FOREIGN KEY ([ProgramEducationOrganizationId], [ProgramName], [ProgramTypeDescriptorId])
REFERENCES [edfi].[Program] ([EducationOrganizationId], [ProgramName], [ProgramTypeDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StudentProgramAttendanceEvent_Program]
ON [edfi].[StudentProgramAttendanceEvent] ([ProgramEducationOrganizationId] ASC, [ProgramName] ASC, [ProgramTypeDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StudentProgramAttendanceEvent] WITH CHECK ADD CONSTRAINT [FK_StudentProgramAttendanceEvent_Student] FOREIGN KEY ([StudentUSI])
REFERENCES [edfi].[Student] ([StudentUSI])
GO
CREATE NONCLUSTERED INDEX [FK_StudentProgramAttendanceEvent_Student]
ON [edfi].[StudentProgramAttendanceEvent] ([StudentUSI] ASC)
GO
ALTER TABLE [edfi].[StudentSchoolAssociation] WITH CHECK ADD CONSTRAINT [FK_StudentSchoolAssociation_Calendar] FOREIGN KEY ([CalendarCode], [SchoolId], [SchoolYear])
REFERENCES [edfi].[Calendar] ([CalendarCode], [SchoolId], [SchoolYear])
GO
CREATE NONCLUSTERED INDEX [FK_StudentSchoolAssociation_Calendar]
ON [edfi].[StudentSchoolAssociation] ([CalendarCode] ASC, [SchoolId] ASC, [SchoolYear] ASC)
GO
ALTER TABLE [edfi].[StudentSchoolAssociation] WITH CHECK ADD CONSTRAINT [FK_StudentSchoolAssociation_EntryGradeLevelReasonDescriptor] FOREIGN KEY ([EntryGradeLevelReasonDescriptorId])
REFERENCES [edfi].[EntryGradeLevelReasonDescriptor] ([EntryGradeLevelReasonDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StudentSchoolAssociation_EntryGradeLevelReasonDescriptor]
ON [edfi].[StudentSchoolAssociation] ([EntryGradeLevelReasonDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StudentSchoolAssociation] WITH CHECK ADD CONSTRAINT [FK_StudentSchoolAssociation_EntryTypeDescriptor] FOREIGN KEY ([EntryTypeDescriptorId])
REFERENCES [edfi].[EntryTypeDescriptor] ([EntryTypeDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StudentSchoolAssociation_EntryTypeDescriptor]
ON [edfi].[StudentSchoolAssociation] ([EntryTypeDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StudentSchoolAssociation] WITH CHECK ADD CONSTRAINT [FK_StudentSchoolAssociation_ExitWithdrawTypeDescriptor] FOREIGN KEY ([ExitWithdrawTypeDescriptorId])
REFERENCES [edfi].[ExitWithdrawTypeDescriptor] ([ExitWithdrawTypeDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StudentSchoolAssociation_ExitWithdrawTypeDescriptor]
ON [edfi].[StudentSchoolAssociation] ([ExitWithdrawTypeDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StudentSchoolAssociation] WITH CHECK ADD CONSTRAINT [FK_StudentSchoolAssociation_GradeLevelDescriptor] FOREIGN KEY ([EntryGradeLevelDescriptorId])
REFERENCES [edfi].[GradeLevelDescriptor] ([GradeLevelDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StudentSchoolAssociation_GradeLevelDescriptor]
ON [edfi].[StudentSchoolAssociation] ([EntryGradeLevelDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StudentSchoolAssociation] WITH CHECK ADD CONSTRAINT [FK_StudentSchoolAssociation_GraduationPlan] FOREIGN KEY ([EducationOrganizationId], [GraduationPlanTypeDescriptorId], [GraduationSchoolYear])
REFERENCES [edfi].[GraduationPlan] ([EducationOrganizationId], [GraduationPlanTypeDescriptorId], [GraduationSchoolYear])
GO
CREATE NONCLUSTERED INDEX [FK_StudentSchoolAssociation_GraduationPlan]
ON [edfi].[StudentSchoolAssociation] ([EducationOrganizationId] ASC, [GraduationPlanTypeDescriptorId] ASC, [GraduationSchoolYear] ASC)
GO
ALTER TABLE [edfi].[StudentSchoolAssociation] WITH CHECK ADD CONSTRAINT [FK_StudentSchoolAssociation_ResidencyStatusDescriptor] FOREIGN KEY ([ResidencyStatusDescriptorId])
REFERENCES [edfi].[ResidencyStatusDescriptor] ([ResidencyStatusDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StudentSchoolAssociation_ResidencyStatusDescriptor]
ON [edfi].[StudentSchoolAssociation] ([ResidencyStatusDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StudentSchoolAssociation] WITH CHECK ADD CONSTRAINT [FK_StudentSchoolAssociation_School] FOREIGN KEY ([SchoolId])
REFERENCES [edfi].[School] ([SchoolId])
GO
CREATE NONCLUSTERED INDEX [FK_StudentSchoolAssociation_School]
ON [edfi].[StudentSchoolAssociation] ([SchoolId] ASC)
GO
ALTER TABLE [edfi].[StudentSchoolAssociation] WITH CHECK ADD CONSTRAINT [FK_StudentSchoolAssociation_SchoolYearType] FOREIGN KEY ([SchoolYear])
REFERENCES [edfi].[SchoolYearType] ([SchoolYear])
GO
CREATE NONCLUSTERED INDEX [FK_StudentSchoolAssociation_SchoolYearType]
ON [edfi].[StudentSchoolAssociation] ([SchoolYear] ASC)
GO
ALTER TABLE [edfi].[StudentSchoolAssociation] WITH CHECK ADD CONSTRAINT [FK_StudentSchoolAssociation_SchoolYearType1] FOREIGN KEY ([ClassOfSchoolYear])
REFERENCES [edfi].[SchoolYearType] ([SchoolYear])
GO
CREATE NONCLUSTERED INDEX [FK_StudentSchoolAssociation_SchoolYearType1]
ON [edfi].[StudentSchoolAssociation] ([ClassOfSchoolYear] ASC)
GO
ALTER TABLE [edfi].[StudentSchoolAssociation] WITH CHECK ADD CONSTRAINT [FK_StudentSchoolAssociation_Student] FOREIGN KEY ([StudentUSI])
REFERENCES [edfi].[Student] ([StudentUSI])
GO
CREATE NONCLUSTERED INDEX [FK_StudentSchoolAssociation_Student]
ON [edfi].[StudentSchoolAssociation] ([StudentUSI] ASC)
GO
ALTER TABLE [edfi].[StudentSchoolAssociationAlternativeGraduationPlan] WITH CHECK ADD CONSTRAINT [FK_StudentSchoolAssociationAlternativeGraduationPlan_GraduationPlan] FOREIGN KEY ([AlternativeEducationOrganizationId], [AlternativeGraduationPlanTypeDescriptorId], [AlternativeGraduationSchoolYear])
REFERENCES [edfi].[GraduationPlan] ([EducationOrganizationId], [GraduationPlanTypeDescriptorId], [GraduationSchoolYear])
GO
CREATE NONCLUSTERED INDEX [FK_StudentSchoolAssociationAlternativeGraduationPlan_GraduationPlan]
ON [edfi].[StudentSchoolAssociationAlternativeGraduationPlan] ([AlternativeEducationOrganizationId] ASC, [AlternativeGraduationPlanTypeDescriptorId] ASC, [AlternativeGraduationSchoolYear] ASC)
GO
ALTER TABLE [edfi].[StudentSchoolAssociationAlternativeGraduationPlan] WITH CHECK ADD CONSTRAINT [FK_StudentSchoolAssociationAlternativeGraduationPlan_StudentSchoolAssociation] FOREIGN KEY ([EntryDate], [SchoolId], [StudentUSI])
REFERENCES [edfi].[StudentSchoolAssociation] ([EntryDate], [SchoolId], [StudentUSI])
ON DELETE CASCADE
ON UPDATE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_StudentSchoolAssociationAlternativeGraduationPlan_StudentSchoolAssociation]
ON [edfi].[StudentSchoolAssociationAlternativeGraduationPlan] ([EntryDate] ASC, [SchoolId] ASC, [StudentUSI] ASC)
GO
ALTER TABLE [edfi].[StudentSchoolAssociationEducationPlan] WITH CHECK ADD CONSTRAINT [FK_StudentSchoolAssociationEducationPlan_EducationPlanDescriptor] FOREIGN KEY ([EducationPlanDescriptorId])
REFERENCES [edfi].[EducationPlanDescriptor] ([EducationPlanDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StudentSchoolAssociationEducationPlan_EducationPlanDescriptor]
ON [edfi].[StudentSchoolAssociationEducationPlan] ([EducationPlanDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StudentSchoolAssociationEducationPlan] WITH CHECK ADD CONSTRAINT [FK_StudentSchoolAssociationEducationPlan_StudentSchoolAssociation] FOREIGN KEY ([EntryDate], [SchoolId], [StudentUSI])
REFERENCES [edfi].[StudentSchoolAssociation] ([EntryDate], [SchoolId], [StudentUSI])
ON DELETE CASCADE
ON UPDATE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_StudentSchoolAssociationEducationPlan_StudentSchoolAssociation]
ON [edfi].[StudentSchoolAssociationEducationPlan] ([EntryDate] ASC, [SchoolId] ASC, [StudentUSI] ASC)
GO
ALTER TABLE [edfi].[StudentSchoolAttendanceEvent] WITH CHECK ADD CONSTRAINT [FK_StudentSchoolAttendanceEvent_AttendanceEventCategoryDescriptor] FOREIGN KEY ([AttendanceEventCategoryDescriptorId])
REFERENCES [edfi].[AttendanceEventCategoryDescriptor] ([AttendanceEventCategoryDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StudentSchoolAttendanceEvent_AttendanceEventCategoryDescriptor]
ON [edfi].[StudentSchoolAttendanceEvent] ([AttendanceEventCategoryDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StudentSchoolAttendanceEvent] WITH CHECK ADD CONSTRAINT [FK_StudentSchoolAttendanceEvent_EducationalEnvironmentDescriptor] FOREIGN KEY ([EducationalEnvironmentDescriptorId])
REFERENCES [edfi].[EducationalEnvironmentDescriptor] ([EducationalEnvironmentDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StudentSchoolAttendanceEvent_EducationalEnvironmentDescriptor]
ON [edfi].[StudentSchoolAttendanceEvent] ([EducationalEnvironmentDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StudentSchoolAttendanceEvent] WITH CHECK ADD CONSTRAINT [FK_StudentSchoolAttendanceEvent_School] FOREIGN KEY ([SchoolId])
REFERENCES [edfi].[School] ([SchoolId])
GO
CREATE NONCLUSTERED INDEX [FK_StudentSchoolAttendanceEvent_School]
ON [edfi].[StudentSchoolAttendanceEvent] ([SchoolId] ASC)
GO
ALTER TABLE [edfi].[StudentSchoolAttendanceEvent] WITH CHECK ADD CONSTRAINT [FK_StudentSchoolAttendanceEvent_Session] FOREIGN KEY ([SchoolId], [SchoolYear], [SessionName])
REFERENCES [edfi].[Session] ([SchoolId], [SchoolYear], [SessionName])
ON UPDATE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_StudentSchoolAttendanceEvent_Session]
ON [edfi].[StudentSchoolAttendanceEvent] ([SchoolId] ASC, [SchoolYear] ASC, [SessionName] ASC)
GO
ALTER TABLE [edfi].[StudentSchoolAttendanceEvent] WITH CHECK ADD CONSTRAINT [FK_StudentSchoolAttendanceEvent_Student] FOREIGN KEY ([StudentUSI])
REFERENCES [edfi].[Student] ([StudentUSI])
GO
CREATE NONCLUSTERED INDEX [FK_StudentSchoolAttendanceEvent_Student]
ON [edfi].[StudentSchoolAttendanceEvent] ([StudentUSI] ASC)
GO
ALTER TABLE [edfi].[StudentSchoolFoodServiceProgramAssociation] WITH CHECK ADD CONSTRAINT [FK_StudentSchoolFoodServiceProgramAssociation_GeneralStudentProgramAssociation] FOREIGN KEY ([BeginDate], [EducationOrganizationId], [ProgramEducationOrganizationId], [ProgramName], [ProgramTypeDescriptorId], [StudentUSI])
REFERENCES [edfi].[GeneralStudentProgramAssociation] ([BeginDate], [EducationOrganizationId], [ProgramEducationOrganizationId], [ProgramName], [ProgramTypeDescriptorId], [StudentUSI])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[StudentSchoolFoodServiceProgramAssociationSchoolFoodServiceProgramService] WITH CHECK ADD CONSTRAINT [FK_StudentSchoolFoodServiceProgramAssociationSchoolFoodServiceProgramService_SchoolFoodServiceProgramServiceDescriptor] FOREIGN KEY ([SchoolFoodServiceProgramServiceDescriptorId])
REFERENCES [edfi].[SchoolFoodServiceProgramServiceDescriptor] ([SchoolFoodServiceProgramServiceDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StudentSchoolFoodServiceProgramAssociationSchoolFoodServiceProgramService_SchoolFoodServiceProgramServiceDescriptor]
ON [edfi].[StudentSchoolFoodServiceProgramAssociationSchoolFoodServiceProgramService] ([SchoolFoodServiceProgramServiceDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StudentSchoolFoodServiceProgramAssociationSchoolFoodServiceProgramService] WITH CHECK ADD CONSTRAINT [FK_StudentSchoolFoodServiceProgramAssociationSchoolFoodServiceProgramService_StudentSchoolFoodServiceProgramAssociation] FOREIGN KEY ([BeginDate], [EducationOrganizationId], [ProgramEducationOrganizationId], [ProgramName], [ProgramTypeDescriptorId], [StudentUSI])
REFERENCES [edfi].[StudentSchoolFoodServiceProgramAssociation] ([BeginDate], [EducationOrganizationId], [ProgramEducationOrganizationId], [ProgramName], [ProgramTypeDescriptorId], [StudentUSI])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_StudentSchoolFoodServiceProgramAssociationSchoolFoodServiceProgramService_StudentSchoolFoodServiceProgramAssociation]
ON [edfi].[StudentSchoolFoodServiceProgramAssociationSchoolFoodServiceProgramService] ([BeginDate] ASC, [EducationOrganizationId] ASC, [ProgramEducationOrganizationId] ASC, [ProgramName] ASC, [ProgramTypeDescriptorId] ASC, [StudentUSI] ASC)
GO
ALTER TABLE [edfi].[StudentSectionAssociation] WITH CHECK ADD CONSTRAINT [FK_StudentSectionAssociation_AttemptStatusDescriptor] FOREIGN KEY ([AttemptStatusDescriptorId])
REFERENCES [edfi].[AttemptStatusDescriptor] ([AttemptStatusDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StudentSectionAssociation_AttemptStatusDescriptor]
ON [edfi].[StudentSectionAssociation] ([AttemptStatusDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StudentSectionAssociation] WITH CHECK ADD CONSTRAINT [FK_StudentSectionAssociation_RepeatIdentifierDescriptor] FOREIGN KEY ([RepeatIdentifierDescriptorId])
REFERENCES [edfi].[RepeatIdentifierDescriptor] ([RepeatIdentifierDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StudentSectionAssociation_RepeatIdentifierDescriptor]
ON [edfi].[StudentSectionAssociation] ([RepeatIdentifierDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StudentSectionAssociation] WITH CHECK ADD CONSTRAINT [FK_StudentSectionAssociation_Section] FOREIGN KEY ([LocalCourseCode], [SchoolId], [SchoolYear], [SectionIdentifier], [SessionName])
REFERENCES [edfi].[Section] ([LocalCourseCode], [SchoolId], [SchoolYear], [SectionIdentifier], [SessionName])
ON UPDATE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_StudentSectionAssociation_Section]
ON [edfi].[StudentSectionAssociation] ([LocalCourseCode] ASC, [SchoolId] ASC, [SchoolYear] ASC, [SectionIdentifier] ASC, [SessionName] ASC)
GO
ALTER TABLE [edfi].[StudentSectionAssociation] WITH CHECK ADD CONSTRAINT [FK_StudentSectionAssociation_Student] FOREIGN KEY ([StudentUSI])
REFERENCES [edfi].[Student] ([StudentUSI])
GO
CREATE NONCLUSTERED INDEX [FK_StudentSectionAssociation_Student]
ON [edfi].[StudentSectionAssociation] ([StudentUSI] ASC)
GO
ALTER TABLE [edfi].[StudentSectionAttendanceEvent] WITH CHECK ADD CONSTRAINT [FK_StudentSectionAttendanceEvent_AttendanceEventCategoryDescriptor] FOREIGN KEY ([AttendanceEventCategoryDescriptorId])
REFERENCES [edfi].[AttendanceEventCategoryDescriptor] ([AttendanceEventCategoryDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StudentSectionAttendanceEvent_AttendanceEventCategoryDescriptor]
ON [edfi].[StudentSectionAttendanceEvent] ([AttendanceEventCategoryDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StudentSectionAttendanceEvent] WITH CHECK ADD CONSTRAINT [FK_StudentSectionAttendanceEvent_EducationalEnvironmentDescriptor] FOREIGN KEY ([EducationalEnvironmentDescriptorId])
REFERENCES [edfi].[EducationalEnvironmentDescriptor] ([EducationalEnvironmentDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StudentSectionAttendanceEvent_EducationalEnvironmentDescriptor]
ON [edfi].[StudentSectionAttendanceEvent] ([EducationalEnvironmentDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StudentSectionAttendanceEvent] WITH CHECK ADD CONSTRAINT [FK_StudentSectionAttendanceEvent_Section] FOREIGN KEY ([LocalCourseCode], [SchoolId], [SchoolYear], [SectionIdentifier], [SessionName])
REFERENCES [edfi].[Section] ([LocalCourseCode], [SchoolId], [SchoolYear], [SectionIdentifier], [SessionName])
ON UPDATE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_StudentSectionAttendanceEvent_Section]
ON [edfi].[StudentSectionAttendanceEvent] ([LocalCourseCode] ASC, [SchoolId] ASC, [SchoolYear] ASC, [SectionIdentifier] ASC, [SessionName] ASC)
GO
ALTER TABLE [edfi].[StudentSectionAttendanceEvent] WITH CHECK ADD CONSTRAINT [FK_StudentSectionAttendanceEvent_Student] FOREIGN KEY ([StudentUSI])
REFERENCES [edfi].[Student] ([StudentUSI])
GO
CREATE NONCLUSTERED INDEX [FK_StudentSectionAttendanceEvent_Student]
ON [edfi].[StudentSectionAttendanceEvent] ([StudentUSI] ASC)
GO
ALTER TABLE [edfi].[StudentSectionAttendanceEventClassPeriod] WITH CHECK ADD CONSTRAINT [FK_StudentSectionAttendanceEventClassPeriod_ClassPeriod] FOREIGN KEY ([ClassPeriodName], [SchoolId])
REFERENCES [edfi].[ClassPeriod] ([ClassPeriodName], [SchoolId])
ON UPDATE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_StudentSectionAttendanceEventClassPeriod_ClassPeriod]
ON [edfi].[StudentSectionAttendanceEventClassPeriod] ([ClassPeriodName] ASC, [SchoolId] ASC)
GO
ALTER TABLE [edfi].[StudentSectionAttendanceEventClassPeriod] WITH CHECK ADD CONSTRAINT [FK_StudentSectionAttendanceEventClassPeriod_StudentSectionAttendanceEvent] FOREIGN KEY ([AttendanceEventCategoryDescriptorId], [EventDate], [LocalCourseCode], [SchoolId], [SchoolYear], [SectionIdentifier], [SessionName], [StudentUSI])
REFERENCES [edfi].[StudentSectionAttendanceEvent] ([AttendanceEventCategoryDescriptorId], [EventDate], [LocalCourseCode], [SchoolId], [SchoolYear], [SectionIdentifier], [SessionName], [StudentUSI])
ON DELETE CASCADE
ON UPDATE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_StudentSectionAttendanceEventClassPeriod_StudentSectionAttendanceEvent]
ON [edfi].[StudentSectionAttendanceEventClassPeriod] ([AttendanceEventCategoryDescriptorId] ASC, [EventDate] ASC, [LocalCourseCode] ASC, [SchoolId] ASC, [SchoolYear] ASC, [SectionIdentifier] ASC, [SessionName] ASC, [StudentUSI] ASC)
GO
ALTER TABLE [edfi].[StudentSpecialEducationProgramAssociation] WITH CHECK ADD CONSTRAINT [FK_StudentSpecialEducationProgramAssociation_GeneralStudentProgramAssociation] FOREIGN KEY ([BeginDate], [EducationOrganizationId], [ProgramEducationOrganizationId], [ProgramName], [ProgramTypeDescriptorId], [StudentUSI])
REFERENCES [edfi].[GeneralStudentProgramAssociation] ([BeginDate], [EducationOrganizationId], [ProgramEducationOrganizationId], [ProgramName], [ProgramTypeDescriptorId], [StudentUSI])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[StudentSpecialEducationProgramAssociation] WITH CHECK ADD CONSTRAINT [FK_StudentSpecialEducationProgramAssociation_SpecialEducationSettingDescriptor] FOREIGN KEY ([SpecialEducationSettingDescriptorId])
REFERENCES [edfi].[SpecialEducationSettingDescriptor] ([SpecialEducationSettingDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StudentSpecialEducationProgramAssociation_SpecialEducationSettingDescriptor]
ON [edfi].[StudentSpecialEducationProgramAssociation] ([SpecialEducationSettingDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StudentSpecialEducationProgramAssociationDisability] WITH CHECK ADD CONSTRAINT [FK_StudentSpecialEducationProgramAssociationDisability_DisabilityDescriptor] FOREIGN KEY ([DisabilityDescriptorId])
REFERENCES [edfi].[DisabilityDescriptor] ([DisabilityDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StudentSpecialEducationProgramAssociationDisability_DisabilityDescriptor]
ON [edfi].[StudentSpecialEducationProgramAssociationDisability] ([DisabilityDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StudentSpecialEducationProgramAssociationDisability] WITH CHECK ADD CONSTRAINT [FK_StudentSpecialEducationProgramAssociationDisability_DisabilityDeterminationSourceTypeDescriptor] FOREIGN KEY ([DisabilityDeterminationSourceTypeDescriptorId])
REFERENCES [edfi].[DisabilityDeterminationSourceTypeDescriptor] ([DisabilityDeterminationSourceTypeDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StudentSpecialEducationProgramAssociationDisability_DisabilityDeterminationSourceTypeDescriptor]
ON [edfi].[StudentSpecialEducationProgramAssociationDisability] ([DisabilityDeterminationSourceTypeDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StudentSpecialEducationProgramAssociationDisability] WITH CHECK ADD CONSTRAINT [FK_StudentSpecialEducationProgramAssociationDisability_StudentSpecialEducationProgramAssociation] FOREIGN KEY ([BeginDate], [EducationOrganizationId], [ProgramEducationOrganizationId], [ProgramName], [ProgramTypeDescriptorId], [StudentUSI])
REFERENCES [edfi].[StudentSpecialEducationProgramAssociation] ([BeginDate], [EducationOrganizationId], [ProgramEducationOrganizationId], [ProgramName], [ProgramTypeDescriptorId], [StudentUSI])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_StudentSpecialEducationProgramAssociationDisability_StudentSpecialEducationProgramAssociation]
ON [edfi].[StudentSpecialEducationProgramAssociationDisability] ([BeginDate] ASC, [EducationOrganizationId] ASC, [ProgramEducationOrganizationId] ASC, [ProgramName] ASC, [ProgramTypeDescriptorId] ASC, [StudentUSI] ASC)
GO
ALTER TABLE [edfi].[StudentSpecialEducationProgramAssociationDisabilityDesignation] WITH CHECK ADD CONSTRAINT [FK_StudentSpecialEducationProgramAssociationDisabilityDesignation_DisabilityDesignationDescriptor] FOREIGN KEY ([DisabilityDesignationDescriptorId])
REFERENCES [edfi].[DisabilityDesignationDescriptor] ([DisabilityDesignationDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StudentSpecialEducationProgramAssociationDisabilityDesignation_DisabilityDesignationDescriptor]
ON [edfi].[StudentSpecialEducationProgramAssociationDisabilityDesignation] ([DisabilityDesignationDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StudentSpecialEducationProgramAssociationDisabilityDesignation] WITH CHECK ADD CONSTRAINT [FK_StudentSpecialEducationProgramAssociationDisabilityDesignation_StudentSpecialEducationProgramAssociationDisability] FOREIGN KEY ([BeginDate], [DisabilityDescriptorId], [EducationOrganizationId], [ProgramEducationOrganizationId], [ProgramName], [ProgramTypeDescriptorId], [StudentUSI])
REFERENCES [edfi].[StudentSpecialEducationProgramAssociationDisability] ([BeginDate], [DisabilityDescriptorId], [EducationOrganizationId], [ProgramEducationOrganizationId], [ProgramName], [ProgramTypeDescriptorId], [StudentUSI])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_StudentSpecialEducationProgramAssociationDisabilityDesignation_StudentSpecialEducationProgramAssociationDisability]
ON [edfi].[StudentSpecialEducationProgramAssociationDisabilityDesignation] ([BeginDate] ASC, [DisabilityDescriptorId] ASC, [EducationOrganizationId] ASC, [ProgramEducationOrganizationId] ASC, [ProgramName] ASC, [ProgramTypeDescriptorId] ASC, [StudentUSI] ASC)
GO
ALTER TABLE [edfi].[StudentSpecialEducationProgramAssociationServiceProvider] WITH CHECK ADD CONSTRAINT [FK_StudentSpecialEducationProgramAssociationServiceProvider_Staff] FOREIGN KEY ([StaffUSI])
REFERENCES [edfi].[Staff] ([StaffUSI])
GO
CREATE NONCLUSTERED INDEX [FK_StudentSpecialEducationProgramAssociationServiceProvider_Staff]
ON [edfi].[StudentSpecialEducationProgramAssociationServiceProvider] ([StaffUSI] ASC)
GO
ALTER TABLE [edfi].[StudentSpecialEducationProgramAssociationServiceProvider] WITH CHECK ADD CONSTRAINT [FK_StudentSpecialEducationProgramAssociationServiceProvider_StudentSpecialEducationProgramAssociation] FOREIGN KEY ([BeginDate], [EducationOrganizationId], [ProgramEducationOrganizationId], [ProgramName], [ProgramTypeDescriptorId], [StudentUSI])
REFERENCES [edfi].[StudentSpecialEducationProgramAssociation] ([BeginDate], [EducationOrganizationId], [ProgramEducationOrganizationId], [ProgramName], [ProgramTypeDescriptorId], [StudentUSI])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_StudentSpecialEducationProgramAssociationServiceProvider_StudentSpecialEducationProgramAssociation]
ON [edfi].[StudentSpecialEducationProgramAssociationServiceProvider] ([BeginDate] ASC, [EducationOrganizationId] ASC, [ProgramEducationOrganizationId] ASC, [ProgramName] ASC, [ProgramTypeDescriptorId] ASC, [StudentUSI] ASC)
GO
ALTER TABLE [edfi].[StudentSpecialEducationProgramAssociationSpecialEducationProgramService] WITH CHECK ADD CONSTRAINT [FK_StudentSpecialEducationProgramAssociationSpecialEducationProgramService_SpecialEducationProgramServiceDescriptor] FOREIGN KEY ([SpecialEducationProgramServiceDescriptorId])
REFERENCES [edfi].[SpecialEducationProgramServiceDescriptor] ([SpecialEducationProgramServiceDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StudentSpecialEducationProgramAssociationSpecialEducationProgramService_SpecialEducationProgramServiceDescriptor]
ON [edfi].[StudentSpecialEducationProgramAssociationSpecialEducationProgramService] ([SpecialEducationProgramServiceDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StudentSpecialEducationProgramAssociationSpecialEducationProgramService] WITH CHECK ADD CONSTRAINT [FK_StudentSpecialEducationProgramAssociationSpecialEducationProgramService_StudentSpecialEducationProgramAssociation] FOREIGN KEY ([BeginDate], [EducationOrganizationId], [ProgramEducationOrganizationId], [ProgramName], [ProgramTypeDescriptorId], [StudentUSI])
REFERENCES [edfi].[StudentSpecialEducationProgramAssociation] ([BeginDate], [EducationOrganizationId], [ProgramEducationOrganizationId], [ProgramName], [ProgramTypeDescriptorId], [StudentUSI])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_StudentSpecialEducationProgramAssociationSpecialEducationProgramService_StudentSpecialEducationProgramAssociation]
ON [edfi].[StudentSpecialEducationProgramAssociationSpecialEducationProgramService] ([BeginDate] ASC, [EducationOrganizationId] ASC, [ProgramEducationOrganizationId] ASC, [ProgramName] ASC, [ProgramTypeDescriptorId] ASC, [StudentUSI] ASC)
GO
ALTER TABLE [edfi].[StudentSpecialEducationProgramAssociationSpecialEducationProgramServiceProvider] WITH CHECK ADD CONSTRAINT [FK_StudentSpecialEducationProgramAssociationSpecialEducationProgramServiceProvider_Staff] FOREIGN KEY ([StaffUSI])
REFERENCES [edfi].[Staff] ([StaffUSI])
GO
CREATE NONCLUSTERED INDEX [FK_StudentSpecialEducationProgramAssociationSpecialEducationProgramServiceProvider_Staff]
ON [edfi].[StudentSpecialEducationProgramAssociationSpecialEducationProgramServiceProvider] ([StaffUSI] ASC)
GO
ALTER TABLE [edfi].[StudentSpecialEducationProgramAssociationSpecialEducationProgramServiceProvider] WITH CHECK ADD CONSTRAINT [FK_StudentSpecialEducationProgramAssociationSpecialEducationProgramServiceProvider_StudentSpecialEducationProgramAssociationSpec] FOREIGN KEY ([BeginDate], [EducationOrganizationId], [ProgramEducationOrganizationId], [ProgramName], [ProgramTypeDescriptorId], [SpecialEducationProgramServiceDescriptorId], [StudentUSI])
REFERENCES [edfi].[StudentSpecialEducationProgramAssociationSpecialEducationProgramService] ([BeginDate], [EducationOrganizationId], [ProgramEducationOrganizationId], [ProgramName], [ProgramTypeDescriptorId], [SpecialEducationProgramServiceDescriptorId], [StudentUSI])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_StudentSpecialEducationProgramAssociationSpecialEducationProgramServiceProvider_StudentSpecialEducationProgramAssociationSpec]
ON [edfi].[StudentSpecialEducationProgramAssociationSpecialEducationProgramServiceProvider] ([BeginDate] ASC, [EducationOrganizationId] ASC, [ProgramEducationOrganizationId] ASC, [ProgramName] ASC, [ProgramTypeDescriptorId] ASC, [SpecialEducationProgramServiceDescriptorId] ASC, [StudentUSI] ASC)
GO
ALTER TABLE [edfi].[StudentTitleIPartAProgramAssociation] WITH CHECK ADD CONSTRAINT [FK_StudentTitleIPartAProgramAssociation_GeneralStudentProgramAssociation] FOREIGN KEY ([BeginDate], [EducationOrganizationId], [ProgramEducationOrganizationId], [ProgramName], [ProgramTypeDescriptorId], [StudentUSI])
REFERENCES [edfi].[GeneralStudentProgramAssociation] ([BeginDate], [EducationOrganizationId], [ProgramEducationOrganizationId], [ProgramName], [ProgramTypeDescriptorId], [StudentUSI])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[StudentTitleIPartAProgramAssociation] WITH CHECK ADD CONSTRAINT [FK_StudentTitleIPartAProgramAssociation_TitleIPartAParticipantDescriptor] FOREIGN KEY ([TitleIPartAParticipantDescriptorId])
REFERENCES [edfi].[TitleIPartAParticipantDescriptor] ([TitleIPartAParticipantDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StudentTitleIPartAProgramAssociation_TitleIPartAParticipantDescriptor]
ON [edfi].[StudentTitleIPartAProgramAssociation] ([TitleIPartAParticipantDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StudentTitleIPartAProgramAssociationService] WITH CHECK ADD CONSTRAINT [FK_StudentTitleIPartAProgramAssociationService_ServiceDescriptor] FOREIGN KEY ([ServiceDescriptorId])
REFERENCES [edfi].[ServiceDescriptor] ([ServiceDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StudentTitleIPartAProgramAssociationService_ServiceDescriptor]
ON [edfi].[StudentTitleIPartAProgramAssociationService] ([ServiceDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StudentTitleIPartAProgramAssociationService] WITH CHECK ADD CONSTRAINT [FK_StudentTitleIPartAProgramAssociationService_StudentTitleIPartAProgramAssociation] FOREIGN KEY ([BeginDate], [EducationOrganizationId], [ProgramEducationOrganizationId], [ProgramName], [ProgramTypeDescriptorId], [StudentUSI])
REFERENCES [edfi].[StudentTitleIPartAProgramAssociation] ([BeginDate], [EducationOrganizationId], [ProgramEducationOrganizationId], [ProgramName], [ProgramTypeDescriptorId], [StudentUSI])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_StudentTitleIPartAProgramAssociationService_StudentTitleIPartAProgramAssociation]
ON [edfi].[StudentTitleIPartAProgramAssociationService] ([BeginDate] ASC, [EducationOrganizationId] ASC, [ProgramEducationOrganizationId] ASC, [ProgramName] ASC, [ProgramTypeDescriptorId] ASC, [StudentUSI] ASC)
GO
ALTER TABLE [edfi].[StudentTitleIPartAProgramAssociationTitleIPartAProgramService] WITH CHECK ADD CONSTRAINT [FK_StudentTitleIPartAProgramAssociationTitleIPartAProgramService_StudentTitleIPartAProgramAssociation] FOREIGN KEY ([BeginDate], [EducationOrganizationId], [ProgramEducationOrganizationId], [ProgramName], [ProgramTypeDescriptorId], [StudentUSI])
REFERENCES [edfi].[StudentTitleIPartAProgramAssociation] ([BeginDate], [EducationOrganizationId], [ProgramEducationOrganizationId], [ProgramName], [ProgramTypeDescriptorId], [StudentUSI])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_StudentTitleIPartAProgramAssociationTitleIPartAProgramService_StudentTitleIPartAProgramAssociation]
ON [edfi].[StudentTitleIPartAProgramAssociationTitleIPartAProgramService] ([BeginDate] ASC, [EducationOrganizationId] ASC, [ProgramEducationOrganizationId] ASC, [ProgramName] ASC, [ProgramTypeDescriptorId] ASC, [StudentUSI] ASC)
GO
ALTER TABLE [edfi].[StudentTitleIPartAProgramAssociationTitleIPartAProgramService] WITH CHECK ADD CONSTRAINT [FK_StudentTitleIPartAProgramAssociationTitleIPartAProgramService_TitleIPartAProgramServiceDescriptor] FOREIGN KEY ([TitleIPartAProgramServiceDescriptorId])
REFERENCES [edfi].[TitleIPartAProgramServiceDescriptor] ([TitleIPartAProgramServiceDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StudentTitleIPartAProgramAssociationTitleIPartAProgramService_TitleIPartAProgramServiceDescriptor]
ON [edfi].[StudentTitleIPartAProgramAssociationTitleIPartAProgramService] ([TitleIPartAProgramServiceDescriptorId] ASC)
GO
ALTER TABLE [edfi].[StudentVisa] WITH CHECK ADD CONSTRAINT [FK_StudentVisa_Student] FOREIGN KEY ([StudentUSI])
REFERENCES [edfi].[Student] ([StudentUSI])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_StudentVisa_Student]
ON [edfi].[StudentVisa] ([StudentUSI] ASC)
GO
ALTER TABLE [edfi].[StudentVisa] WITH CHECK ADD CONSTRAINT [FK_StudentVisa_VisaDescriptor] FOREIGN KEY ([VisaDescriptorId])
REFERENCES [edfi].[VisaDescriptor] ([VisaDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_StudentVisa_VisaDescriptor]
ON [edfi].[StudentVisa] ([VisaDescriptorId] ASC)
GO
ALTER TABLE [edfi].[Survey] WITH CHECK ADD CONSTRAINT [FK_Survey_EducationOrganization] FOREIGN KEY ([EducationOrganizationId])
REFERENCES [edfi].[EducationOrganization] ([EducationOrganizationId])
GO
CREATE NONCLUSTERED INDEX [FK_Survey_EducationOrganization]
ON [edfi].[Survey] ([EducationOrganizationId] ASC)
GO
ALTER TABLE [edfi].[Survey] WITH CHECK ADD CONSTRAINT [FK_Survey_SchoolYearType] FOREIGN KEY ([SchoolYear])
REFERENCES [edfi].[SchoolYearType] ([SchoolYear])
GO
CREATE NONCLUSTERED INDEX [FK_Survey_SchoolYearType]
ON [edfi].[Survey] ([SchoolYear] ASC)
GO
ALTER TABLE [edfi].[Survey] WITH CHECK ADD CONSTRAINT [FK_Survey_Session] FOREIGN KEY ([SchoolId], [SchoolYear], [SessionName])
REFERENCES [edfi].[Session] ([SchoolId], [SchoolYear], [SessionName])
ON UPDATE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_Survey_Session]
ON [edfi].[Survey] ([SchoolId] ASC, [SchoolYear] ASC, [SessionName] ASC)
GO
ALTER TABLE [edfi].[Survey] WITH CHECK ADD CONSTRAINT [FK_Survey_SurveyCategoryDescriptor] FOREIGN KEY ([SurveyCategoryDescriptorId])
REFERENCES [edfi].[SurveyCategoryDescriptor] ([SurveyCategoryDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_Survey_SurveyCategoryDescriptor]
ON [edfi].[Survey] ([SurveyCategoryDescriptorId] ASC)
GO
ALTER TABLE [edfi].[SurveyCategoryDescriptor] WITH CHECK ADD CONSTRAINT [FK_SurveyCategoryDescriptor_Descriptor] FOREIGN KEY ([SurveyCategoryDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[SurveyCourseAssociation] WITH CHECK ADD CONSTRAINT [FK_SurveyCourseAssociation_Course] FOREIGN KEY ([CourseCode], [EducationOrganizationId])
REFERENCES [edfi].[Course] ([CourseCode], [EducationOrganizationId])
GO
CREATE NONCLUSTERED INDEX [FK_SurveyCourseAssociation_Course]
ON [edfi].[SurveyCourseAssociation] ([CourseCode] ASC, [EducationOrganizationId] ASC)
GO
ALTER TABLE [edfi].[SurveyCourseAssociation] WITH CHECK ADD CONSTRAINT [FK_SurveyCourseAssociation_Survey] FOREIGN KEY ([Namespace], [SurveyIdentifier])
REFERENCES [edfi].[Survey] ([Namespace], [SurveyIdentifier])
GO
CREATE NONCLUSTERED INDEX [FK_SurveyCourseAssociation_Survey]
ON [edfi].[SurveyCourseAssociation] ([Namespace] ASC, [SurveyIdentifier] ASC)
GO
ALTER TABLE [edfi].[SurveyLevelDescriptor] WITH CHECK ADD CONSTRAINT [FK_SurveyLevelDescriptor_Descriptor] FOREIGN KEY ([SurveyLevelDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[SurveyProgramAssociation] WITH CHECK ADD CONSTRAINT [FK_SurveyProgramAssociation_Program] FOREIGN KEY ([EducationOrganizationId], [ProgramName], [ProgramTypeDescriptorId])
REFERENCES [edfi].[Program] ([EducationOrganizationId], [ProgramName], [ProgramTypeDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_SurveyProgramAssociation_Program]
ON [edfi].[SurveyProgramAssociation] ([EducationOrganizationId] ASC, [ProgramName] ASC, [ProgramTypeDescriptorId] ASC)
GO
ALTER TABLE [edfi].[SurveyProgramAssociation] WITH CHECK ADD CONSTRAINT [FK_SurveyProgramAssociation_Survey] FOREIGN KEY ([Namespace], [SurveyIdentifier])
REFERENCES [edfi].[Survey] ([Namespace], [SurveyIdentifier])
GO
CREATE NONCLUSTERED INDEX [FK_SurveyProgramAssociation_Survey]
ON [edfi].[SurveyProgramAssociation] ([Namespace] ASC, [SurveyIdentifier] ASC)
GO
ALTER TABLE [edfi].[SurveyQuestion] WITH CHECK ADD CONSTRAINT [FK_SurveyQuestion_QuestionFormDescriptor] FOREIGN KEY ([QuestionFormDescriptorId])
REFERENCES [edfi].[QuestionFormDescriptor] ([QuestionFormDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_SurveyQuestion_QuestionFormDescriptor]
ON [edfi].[SurveyQuestion] ([QuestionFormDescriptorId] ASC)
GO
ALTER TABLE [edfi].[SurveyQuestion] WITH CHECK ADD CONSTRAINT [FK_SurveyQuestion_Survey] FOREIGN KEY ([Namespace], [SurveyIdentifier])
REFERENCES [edfi].[Survey] ([Namespace], [SurveyIdentifier])
GO
CREATE NONCLUSTERED INDEX [FK_SurveyQuestion_Survey]
ON [edfi].[SurveyQuestion] ([Namespace] ASC, [SurveyIdentifier] ASC)
GO
ALTER TABLE [edfi].[SurveyQuestion] WITH CHECK ADD CONSTRAINT [FK_SurveyQuestion_SurveySection] FOREIGN KEY ([Namespace], [SurveyIdentifier], [SurveySectionTitle])
REFERENCES [edfi].[SurveySection] ([Namespace], [SurveyIdentifier], [SurveySectionTitle])
GO
CREATE NONCLUSTERED INDEX [FK_SurveyQuestion_SurveySection]
ON [edfi].[SurveyQuestion] ([Namespace] ASC, [SurveyIdentifier] ASC, [SurveySectionTitle] ASC)
GO
ALTER TABLE [edfi].[SurveyQuestionMatrix] WITH CHECK ADD CONSTRAINT [FK_SurveyQuestionMatrix_SurveyQuestion] FOREIGN KEY ([Namespace], [QuestionCode], [SurveyIdentifier])
REFERENCES [edfi].[SurveyQuestion] ([Namespace], [QuestionCode], [SurveyIdentifier])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_SurveyQuestionMatrix_SurveyQuestion]
ON [edfi].[SurveyQuestionMatrix] ([Namespace] ASC, [QuestionCode] ASC, [SurveyIdentifier] ASC)
GO
ALTER TABLE [edfi].[SurveyQuestionResponse] WITH CHECK ADD CONSTRAINT [FK_SurveyQuestionResponse_SurveyQuestion] FOREIGN KEY ([Namespace], [QuestionCode], [SurveyIdentifier])
REFERENCES [edfi].[SurveyQuestion] ([Namespace], [QuestionCode], [SurveyIdentifier])
GO
CREATE NONCLUSTERED INDEX [FK_SurveyQuestionResponse_SurveyQuestion]
ON [edfi].[SurveyQuestionResponse] ([Namespace] ASC, [QuestionCode] ASC, [SurveyIdentifier] ASC)
GO
ALTER TABLE [edfi].[SurveyQuestionResponse] WITH CHECK ADD CONSTRAINT [FK_SurveyQuestionResponse_SurveyResponse] FOREIGN KEY ([Namespace], [SurveyIdentifier], [SurveyResponseIdentifier])
REFERENCES [edfi].[SurveyResponse] ([Namespace], [SurveyIdentifier], [SurveyResponseIdentifier])
GO
CREATE NONCLUSTERED INDEX [FK_SurveyQuestionResponse_SurveyResponse]
ON [edfi].[SurveyQuestionResponse] ([Namespace] ASC, [SurveyIdentifier] ASC, [SurveyResponseIdentifier] ASC)
GO
ALTER TABLE [edfi].[SurveyQuestionResponseChoice] WITH CHECK ADD CONSTRAINT [FK_SurveyQuestionResponseChoice_SurveyQuestion] FOREIGN KEY ([Namespace], [QuestionCode], [SurveyIdentifier])
REFERENCES [edfi].[SurveyQuestion] ([Namespace], [QuestionCode], [SurveyIdentifier])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_SurveyQuestionResponseChoice_SurveyQuestion]
ON [edfi].[SurveyQuestionResponseChoice] ([Namespace] ASC, [QuestionCode] ASC, [SurveyIdentifier] ASC)
GO
ALTER TABLE [edfi].[SurveyQuestionResponseSurveyQuestionMatrixElementResponse] WITH CHECK ADD CONSTRAINT [FK_SurveyQuestionResponseSurveyQuestionMatrixElementResponse_SurveyQuestionResponse] FOREIGN KEY ([Namespace], [QuestionCode], [SurveyIdentifier], [SurveyResponseIdentifier])
REFERENCES [edfi].[SurveyQuestionResponse] ([Namespace], [QuestionCode], [SurveyIdentifier], [SurveyResponseIdentifier])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_SurveyQuestionResponseSurveyQuestionMatrixElementResponse_SurveyQuestionResponse]
ON [edfi].[SurveyQuestionResponseSurveyQuestionMatrixElementResponse] ([Namespace] ASC, [QuestionCode] ASC, [SurveyIdentifier] ASC, [SurveyResponseIdentifier] ASC)
GO
ALTER TABLE [edfi].[SurveyQuestionResponseValue] WITH CHECK ADD CONSTRAINT [FK_SurveyQuestionResponseValue_SurveyQuestionResponse] FOREIGN KEY ([Namespace], [QuestionCode], [SurveyIdentifier], [SurveyResponseIdentifier])
REFERENCES [edfi].[SurveyQuestionResponse] ([Namespace], [QuestionCode], [SurveyIdentifier], [SurveyResponseIdentifier])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_SurveyQuestionResponseValue_SurveyQuestionResponse]
ON [edfi].[SurveyQuestionResponseValue] ([Namespace] ASC, [QuestionCode] ASC, [SurveyIdentifier] ASC, [SurveyResponseIdentifier] ASC)
GO
ALTER TABLE [edfi].[SurveyResponse] WITH CHECK ADD CONSTRAINT [FK_SurveyResponse_Parent] FOREIGN KEY ([ParentUSI])
REFERENCES [edfi].[Parent] ([ParentUSI])
GO
CREATE NONCLUSTERED INDEX [FK_SurveyResponse_Parent]
ON [edfi].[SurveyResponse] ([ParentUSI] ASC)
GO
ALTER TABLE [edfi].[SurveyResponse] WITH CHECK ADD CONSTRAINT [FK_SurveyResponse_Staff] FOREIGN KEY ([StaffUSI])
REFERENCES [edfi].[Staff] ([StaffUSI])
GO
CREATE NONCLUSTERED INDEX [FK_SurveyResponse_Staff]
ON [edfi].[SurveyResponse] ([StaffUSI] ASC)
GO
ALTER TABLE [edfi].[SurveyResponse] WITH CHECK ADD CONSTRAINT [FK_SurveyResponse_Student] FOREIGN KEY ([StudentUSI])
REFERENCES [edfi].[Student] ([StudentUSI])
GO
CREATE NONCLUSTERED INDEX [FK_SurveyResponse_Student]
ON [edfi].[SurveyResponse] ([StudentUSI] ASC)
GO
ALTER TABLE [edfi].[SurveyResponse] WITH CHECK ADD CONSTRAINT [FK_SurveyResponse_Survey] FOREIGN KEY ([Namespace], [SurveyIdentifier])
REFERENCES [edfi].[Survey] ([Namespace], [SurveyIdentifier])
GO
CREATE NONCLUSTERED INDEX [FK_SurveyResponse_Survey]
ON [edfi].[SurveyResponse] ([Namespace] ASC, [SurveyIdentifier] ASC)
GO
ALTER TABLE [edfi].[SurveyResponseEducationOrganizationTargetAssociation] WITH CHECK ADD CONSTRAINT [FK_SurveyResponseEducationOrganizationTargetAssociation_EducationOrganization] FOREIGN KEY ([EducationOrganizationId])
REFERENCES [edfi].[EducationOrganization] ([EducationOrganizationId])
GO
CREATE NONCLUSTERED INDEX [FK_SurveyResponseEducationOrganizationTargetAssociation_EducationOrganization]
ON [edfi].[SurveyResponseEducationOrganizationTargetAssociation] ([EducationOrganizationId] ASC)
GO
ALTER TABLE [edfi].[SurveyResponseEducationOrganizationTargetAssociation] WITH CHECK ADD CONSTRAINT [FK_SurveyResponseEducationOrganizationTargetAssociation_SurveyResponse] FOREIGN KEY ([Namespace], [SurveyIdentifier], [SurveyResponseIdentifier])
REFERENCES [edfi].[SurveyResponse] ([Namespace], [SurveyIdentifier], [SurveyResponseIdentifier])
GO
CREATE NONCLUSTERED INDEX [FK_SurveyResponseEducationOrganizationTargetAssociation_SurveyResponse]
ON [edfi].[SurveyResponseEducationOrganizationTargetAssociation] ([Namespace] ASC, [SurveyIdentifier] ASC, [SurveyResponseIdentifier] ASC)
GO
ALTER TABLE [edfi].[SurveyResponseStaffTargetAssociation] WITH CHECK ADD CONSTRAINT [FK_SurveyResponseStaffTargetAssociation_Staff] FOREIGN KEY ([StaffUSI])
REFERENCES [edfi].[Staff] ([StaffUSI])
GO
CREATE NONCLUSTERED INDEX [FK_SurveyResponseStaffTargetAssociation_Staff]
ON [edfi].[SurveyResponseStaffTargetAssociation] ([StaffUSI] ASC)
GO
ALTER TABLE [edfi].[SurveyResponseStaffTargetAssociation] WITH CHECK ADD CONSTRAINT [FK_SurveyResponseStaffTargetAssociation_SurveyResponse] FOREIGN KEY ([Namespace], [SurveyIdentifier], [SurveyResponseIdentifier])
REFERENCES [edfi].[SurveyResponse] ([Namespace], [SurveyIdentifier], [SurveyResponseIdentifier])
GO
CREATE NONCLUSTERED INDEX [FK_SurveyResponseStaffTargetAssociation_SurveyResponse]
ON [edfi].[SurveyResponseStaffTargetAssociation] ([Namespace] ASC, [SurveyIdentifier] ASC, [SurveyResponseIdentifier] ASC)
GO
ALTER TABLE [edfi].[SurveyResponseSurveyLevel] WITH CHECK ADD CONSTRAINT [FK_SurveyResponseSurveyLevel_SurveyLevelDescriptor] FOREIGN KEY ([SurveyLevelDescriptorId])
REFERENCES [edfi].[SurveyLevelDescriptor] ([SurveyLevelDescriptorId])
GO
CREATE NONCLUSTERED INDEX [FK_SurveyResponseSurveyLevel_SurveyLevelDescriptor]
ON [edfi].[SurveyResponseSurveyLevel] ([SurveyLevelDescriptorId] ASC)
GO
ALTER TABLE [edfi].[SurveyResponseSurveyLevel] WITH CHECK ADD CONSTRAINT [FK_SurveyResponseSurveyLevel_SurveyResponse] FOREIGN KEY ([Namespace], [SurveyIdentifier], [SurveyResponseIdentifier])
REFERENCES [edfi].[SurveyResponse] ([Namespace], [SurveyIdentifier], [SurveyResponseIdentifier])
ON DELETE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_SurveyResponseSurveyLevel_SurveyResponse]
ON [edfi].[SurveyResponseSurveyLevel] ([Namespace] ASC, [SurveyIdentifier] ASC, [SurveyResponseIdentifier] ASC)
GO
ALTER TABLE [edfi].[SurveySection] WITH CHECK ADD CONSTRAINT [FK_SurveySection_Survey] FOREIGN KEY ([Namespace], [SurveyIdentifier])
REFERENCES [edfi].[Survey] ([Namespace], [SurveyIdentifier])
GO
CREATE NONCLUSTERED INDEX [FK_SurveySection_Survey]
ON [edfi].[SurveySection] ([Namespace] ASC, [SurveyIdentifier] ASC)
GO
ALTER TABLE [edfi].[SurveySectionAssociation] WITH CHECK ADD CONSTRAINT [FK_SurveySectionAssociation_Section] FOREIGN KEY ([LocalCourseCode], [SchoolId], [SchoolYear], [SectionIdentifier], [SessionName])
REFERENCES [edfi].[Section] ([LocalCourseCode], [SchoolId], [SchoolYear], [SectionIdentifier], [SessionName])
ON UPDATE CASCADE
GO
CREATE NONCLUSTERED INDEX [FK_SurveySectionAssociation_Section]
ON [edfi].[SurveySectionAssociation] ([LocalCourseCode] ASC, [SchoolId] ASC, [SchoolYear] ASC, [SectionIdentifier] ASC, [SessionName] ASC)
GO
ALTER TABLE [edfi].[SurveySectionAssociation] WITH CHECK ADD CONSTRAINT [FK_SurveySectionAssociation_Survey] FOREIGN KEY ([Namespace], [SurveyIdentifier])
REFERENCES [edfi].[Survey] ([Namespace], [SurveyIdentifier])
GO
CREATE NONCLUSTERED INDEX [FK_SurveySectionAssociation_Survey]
ON [edfi].[SurveySectionAssociation] ([Namespace] ASC, [SurveyIdentifier] ASC)
GO
ALTER TABLE [edfi].[SurveySectionResponse] WITH CHECK ADD CONSTRAINT [FK_SurveySectionResponse_SurveyResponse] FOREIGN KEY ([Namespace], [SurveyIdentifier], [SurveyResponseIdentifier])
REFERENCES [edfi].[SurveyResponse] ([Namespace], [SurveyIdentifier], [SurveyResponseIdentifier])
GO
CREATE NONCLUSTERED INDEX [FK_SurveySectionResponse_SurveyResponse]
ON [edfi].[SurveySectionResponse] ([Namespace] ASC, [SurveyIdentifier] ASC, [SurveyResponseIdentifier] ASC)
GO
ALTER TABLE [edfi].[SurveySectionResponse] WITH CHECK ADD CONSTRAINT [FK_SurveySectionResponse_SurveySection] FOREIGN KEY ([Namespace], [SurveyIdentifier], [SurveySectionTitle])
REFERENCES [edfi].[SurveySection] ([Namespace], [SurveyIdentifier], [SurveySectionTitle])
GO
CREATE NONCLUSTERED INDEX [FK_SurveySectionResponse_SurveySection]
ON [edfi].[SurveySectionResponse] ([Namespace] ASC, [SurveyIdentifier] ASC, [SurveySectionTitle] ASC)
GO
ALTER TABLE [edfi].[SurveySectionResponseEducationOrganizationTargetAssociation] WITH CHECK ADD CONSTRAINT [FK_SurveySectionResponseEducationOrganizationTargetAssociation_EducationOrganization] FOREIGN KEY ([EducationOrganizationId])
REFERENCES [edfi].[EducationOrganization] ([EducationOrganizationId])
GO
CREATE NONCLUSTERED INDEX [FK_SurveySectionResponseEducationOrganizationTargetAssociation_EducationOrganization]
ON [edfi].[SurveySectionResponseEducationOrganizationTargetAssociation] ([EducationOrganizationId] ASC)
GO
ALTER TABLE [edfi].[SurveySectionResponseEducationOrganizationTargetAssociation] WITH CHECK ADD CONSTRAINT [FK_SurveySectionResponseEducationOrganizationTargetAssociation_SurveySectionResponse] FOREIGN KEY ([Namespace], [SurveyIdentifier], [SurveyResponseIdentifier], [SurveySectionTitle])
REFERENCES [edfi].[SurveySectionResponse] ([Namespace], [SurveyIdentifier], [SurveyResponseIdentifier], [SurveySectionTitle])
GO
CREATE NONCLUSTERED INDEX [FK_SurveySectionResponseEducationOrganizationTargetAssociation_SurveySectionResponse]
ON [edfi].[SurveySectionResponseEducationOrganizationTargetAssociation] ([Namespace] ASC, [SurveyIdentifier] ASC, [SurveyResponseIdentifier] ASC, [SurveySectionTitle] ASC)
GO
ALTER TABLE [edfi].[SurveySectionResponseStaffTargetAssociation] WITH CHECK ADD CONSTRAINT [FK_SurveySectionResponseStaffTargetAssociation_Staff] FOREIGN KEY ([StaffUSI])
REFERENCES [edfi].[Staff] ([StaffUSI])
GO
CREATE NONCLUSTERED INDEX [FK_SurveySectionResponseStaffTargetAssociation_Staff]
ON [edfi].[SurveySectionResponseStaffTargetAssociation] ([StaffUSI] ASC)
GO
ALTER TABLE [edfi].[SurveySectionResponseStaffTargetAssociation] WITH CHECK ADD CONSTRAINT [FK_SurveySectionResponseStaffTargetAssociation_SurveySectionResponse] FOREIGN KEY ([Namespace], [SurveyIdentifier], [SurveyResponseIdentifier], [SurveySectionTitle])
REFERENCES [edfi].[SurveySectionResponse] ([Namespace], [SurveyIdentifier], [SurveyResponseIdentifier], [SurveySectionTitle])
GO
CREATE NONCLUSTERED INDEX [FK_SurveySectionResponseStaffTargetAssociation_SurveySectionResponse]
ON [edfi].[SurveySectionResponseStaffTargetAssociation] ([Namespace] ASC, [SurveyIdentifier] ASC, [SurveyResponseIdentifier] ASC, [SurveySectionTitle] ASC)
GO
ALTER TABLE [edfi].[TeachingCredentialBasisDescriptor] WITH CHECK ADD CONSTRAINT [FK_TeachingCredentialBasisDescriptor_Descriptor] FOREIGN KEY ([TeachingCredentialBasisDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[TeachingCredentialDescriptor] WITH CHECK ADD CONSTRAINT [FK_TeachingCredentialDescriptor_Descriptor] FOREIGN KEY ([TeachingCredentialDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[TechnicalSkillsAssessmentDescriptor] WITH CHECK ADD CONSTRAINT [FK_TechnicalSkillsAssessmentDescriptor_Descriptor] FOREIGN KEY ([TechnicalSkillsAssessmentDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[TelephoneNumberTypeDescriptor] WITH CHECK ADD CONSTRAINT [FK_TelephoneNumberTypeDescriptor_Descriptor] FOREIGN KEY ([TelephoneNumberTypeDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[TermDescriptor] WITH CHECK ADD CONSTRAINT [FK_TermDescriptor_Descriptor] FOREIGN KEY ([TermDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[TitleIPartAParticipantDescriptor] WITH CHECK ADD CONSTRAINT [FK_TitleIPartAParticipantDescriptor_Descriptor] FOREIGN KEY ([TitleIPartAParticipantDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[TitleIPartAProgramServiceDescriptor] WITH CHECK ADD CONSTRAINT [FK_TitleIPartAProgramServiceDescriptor_Descriptor] FOREIGN KEY ([TitleIPartAProgramServiceDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[TitleIPartASchoolDesignationDescriptor] WITH CHECK ADD CONSTRAINT [FK_TitleIPartASchoolDesignationDescriptor_Descriptor] FOREIGN KEY ([TitleIPartASchoolDesignationDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[TribalAffiliationDescriptor] WITH CHECK ADD CONSTRAINT [FK_TribalAffiliationDescriptor_Descriptor] FOREIGN KEY ([TribalAffiliationDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[VisaDescriptor] WITH CHECK ADD CONSTRAINT [FK_VisaDescriptor_Descriptor] FOREIGN KEY ([VisaDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
ALTER TABLE [edfi].[WeaponDescriptor] WITH CHECK ADD CONSTRAINT [FK_WeaponDescriptor_Descriptor] FOREIGN KEY ([WeaponDescriptorId])
REFERENCES [edfi].[Descriptor] ([DescriptorId])
ON DELETE CASCADE
GO
|
<gh_stars>1-10
/*--
EXEC tSQLt.DropClass [dbo_CalculateDiscountTests];
GO
--*/
CREATE SCHEMA [dbo_CalculateDiscountTests] AUTHORIZATION [tSQLt.TestClass];
GO
CREATE PROCEDURE dbo_CalculateDiscountTests.[test returns no discount for order value 49.00]
AS
BEGIN
--Assemble
--Act
DECLARE @Actual NUMERIC(13,2) = (SELECT discount FROM dbo.CalculateDiscount(49.00) AS CD);
--Assert
EXEC tSQLt.AssertEquals @Expected = 0, @Actual = @Actual;
END;
GO
CREATE PROCEDURE dbo_CalculateDiscountTests.[test returns 10% discount for order value 51.00]
AS
BEGIN
--Assemble
--Act
DECLARE @Actual NUMERIC(13,2) = (SELECT discount FROM dbo.CalculateDiscount(51.00) AS CD);
--Assert
EXEC tSQLt.AssertEquals @Expected = 5.10, @Actual = @Actual;
END;
GO
CREATE PROCEDURE dbo_CalculateDiscountTests.[test returns 10% discount for order value 50.00]
AS
BEGIN
--Assemble
--Act
DECLARE @Actual NUMERIC(13,2) = (SELECT discount FROM dbo.CalculateDiscount(50.00) AS CD);
--Assert
EXEC tSQLt.AssertEquals @Expected = 5.00, @Actual = @Actual;
END;
GO
|
CREATE FUNCTION [dal].[ft_Time1__Center_Agent_Resource_Balance] (
@AccountTypeConcept NVARCHAR (255),
@AgentDefinitionCode NVARCHAR(255),
@ResourceDefinitionCode NVARCHAR(255),
@AsOfDate DATE,
@ParentCenterId INT
)
RETURNS @returntable TABLE
(
[CenterId] INT,
[AgentId] INT,
[ResourceId] INT,
[AsOf] DATE,
[Till] DATE,
[Duration] DECIMAL (19, 4),
[Quantity] DECIMAL (19, 4),
[MonetaryValue] DECIMAL (19, 4),
[Value] DECIMAL (19, 4)
)
AS
BEGIN
DECLARE @ParentCenterNode HIERARCHYID = (
SELECT [Node] FROM dbo.Centers WHERE [Id] = @ParentCenterId
);
DECLARE @AgentDefinitionId INT = (
SELECT [Id] FROM dbo.AgentDefinitions WHERE [Code] = @AgentDefinitionCode
);
DECLARE @ResourceDefinitionId INT = (
SELECT [Id] FROM dbo.ResourceDefinitions WHERE [Code] = @ResourceDefinitionCode
);
INSERT @returntable
SELECT E.[CenterId], E.[AgentId], E.[ResourceId], MAX(E.[Time1]) AS AsOf,
DATEADD(DAY, SUM(E.[Direction] * E.[Duration])-1, MAX(E.[Time1])) AS Till,
SUM(E.[Direction] * E.[Duration]) AS [Duration],
SUM(E.[Direction] * E.[BaseQuantity]) AS [Quantity],
SUM(E.[Direction] * E.[MonetaryValue]) AS [MonetaryValue],
SUM(E.[Direction] * E.[Value]) AS [Value]
FROM map.DetailsEntries() E
JOIN dbo.Centers C ON C.[Id] = E.[CenterId]
JOIN dbo.Agents AG ON AG.[Id] = E.[AgentId]
JOIN dbo.Resources R ON R.[Id] = E.[ResourceId]
JOIN dbo.Lines L ON E.[LineId] = L.[Id]
JOIN dbo.Accounts A ON E.[AccountId] = A.[Id]
JOIN dbo.AccountTypes AC ON A.[AccountTypeId] = AC.[Id]
WHERE AC.[Concept] = @AccountTypeConcept
AND (@AsOfDate IS NULL OR E.[Time1] <= @AsOfDate)
AND (@ParentCenterId IS NULL OR C.[Node].IsDescendantOf(@ParentCenterNode) = 1)
AND (@AgentDefinitionCode IS NULL OR AG.[DefinitionId] = @AgentDefinitionId)
AND (@ResourceDefinitionCode IS NULL OR R.[DefinitionId] = @ResourceDefinitionId)
AND L.[State] = 2 -- or 4?
GROUP BY E.[CenterId], E.[AgentId], E.[ResourceId]
HAVING (SUM(E.[Direction] * E.[BaseQuantity]) <> 0 OR SUM(E.[Direction] * E.[MonetaryValue]) <> 0);
RETURN
END; |
<reponame>isuruuy429/product-ei<filename>integration/dataservice-hosting-tests/tests-integration/tests/src/test/resources/artifacts/DSS/sql/h2/CreateTablesAccount.sql<gh_stars>100-1000
CREATE TABLE IF NOT EXISTS Accounts(
accountId INTEGER NOT NULL AUTO_INCREMENT,
balance DOUBLE,
PRIMARY KEY (accountId)
)
|
--
-- BOX
--
--
-- box logic
-- o
-- 3 o--|X
-- | o|
-- 2 +-+-+ |
-- | | | |
-- 1 | o-+-o
-- | |
-- 0 +---+
--
-- 0 1 2 3
--
-- boxes are specified by two points, given by four floats x1,y1,x2,y2
CREATE TABLE BOX_TBL (f1 box);
INSERT INTO BOX_TBL (f1) VALUES ('(2.0,2.0,0.0,0.0)');
INSERT INTO BOX_TBL (f1) VALUES ('(1.0,1.0,3.0,3.0)');
INSERT INTO BOX_TBL (f1) VALUES ('((-8, 2), (-2, -10))');
-- degenerate cases where the box is a line or a point
-- note that lines and points boxes all have zero area
INSERT INTO BOX_TBL (f1) VALUES ('(2.5, 2.5, 2.5,3.5)');
INSERT INTO BOX_TBL (f1) VALUES ('(3.0, 3.0,3.0,3.0)');
-- badly formatted box inputs
INSERT INTO BOX_TBL (f1) VALUES ('(2.3, 4.5)');
INSERT INTO BOX_TBL (f1) VALUES ('[1, 2, 3, 4)');
INSERT INTO BOX_TBL (f1) VALUES ('(1, 2, 3, 4]');
INSERT INTO BOX_TBL (f1) VALUES ('(1, 2, 3, 4) x');
INSERT INTO BOX_TBL (f1) VALUES ('asdfasdf(ad');
SELECT '' AS four, * FROM BOX_TBL;
SELECT '' AS four, b.*, area(b.f1) as barea
FROM BOX_TBL b;
-- overlap
SELECT '' AS three, b.f1
FROM BOX_TBL b
WHERE b.f1 && box '(2.5,2.5,1.0,1.0)';
-- left-or-overlap (x only)
SELECT '' AS two, b1.*
FROM BOX_TBL b1
WHERE b1.f1 &< box '(2.0,2.0,2.5,2.5)';
-- right-or-overlap (x only)
SELECT '' AS two, b1.*
FROM BOX_TBL b1
WHERE b1.f1 &> box '(2.0,2.0,2.5,2.5)';
-- left of
SELECT '' AS two, b.f1
FROM BOX_TBL b
WHERE b.f1 << box '(3.0,3.0,5.0,5.0)';
-- area <=
SELECT '' AS four, b.f1
FROM BOX_TBL b
WHERE b.f1 <= box '(3.0,3.0,5.0,5.0)';
-- area <
SELECT '' AS two, b.f1
FROM BOX_TBL b
WHERE b.f1 < box '(3.0,3.0,5.0,5.0)';
-- area =
SELECT '' AS two, b.f1
FROM BOX_TBL b
WHERE b.f1 = box '(3.0,3.0,5.0,5.0)';
-- area >
SELECT '' AS two, b.f1
FROM BOX_TBL b -- zero area
WHERE b.f1 > box '(3.5,3.0,4.5,3.0)';
-- area >=
SELECT '' AS four, b.f1
FROM BOX_TBL b -- zero area
WHERE b.f1 >= box '(3.5,3.0,4.5,3.0)';
-- right of
SELECT '' AS two, b.f1
FROM BOX_TBL b
WHERE box '(3.0,3.0,5.0,5.0)' >> b.f1;
-- contained in
SELECT '' AS three, b.f1
FROM BOX_TBL b
WHERE b.f1 <@ box '(0,0,3,3)';
-- contains
SELECT '' AS three, b.f1
FROM BOX_TBL b
WHERE box '(0,0,3,3)' @> b.f1;
-- box equality
SELECT '' AS one, b.f1
FROM BOX_TBL b
WHERE box '(1,1,3,3)' ~= b.f1;
-- center of box, left unary operator
SELECT '' AS four, @@(b1.f1) AS p
FROM BOX_TBL b1;
-- wholly-contained
SELECT '' AS one, b1.*, b2.*
FROM BOX_TBL b1, BOX_TBL b2
WHERE b1.f1 @> b2.f1 and not b1.f1 ~= b2.f1;
SELECT '' AS four, height(f1), width(f1) FROM BOX_TBL;
--
-- Test the SP-GiST index
--
CREATE TEMPORARY TABLE box_temp (f1 box);
INSERT INTO box_temp
SELECT box(point(i, i), point(i * 2, i * 2))
FROM generate_series(1, 50) AS i;
CREATE INDEX box_spgist ON box_temp USING spgist (f1);
INSERT INTO box_temp
VALUES (NULL),
('(0,0)(0,100)'),
('(-3,4.3333333333)(40,1)'),
('(0,100)(0,infinity)'),
('(-infinity,0)(0,infinity)'),
('(-infinity,-infinity)(infinity,infinity)');
SET enable_seqscan = false;
SELECT * FROM box_temp WHERE f1 << '(10,20),(30,40)';
EXPLAIN (COSTS OFF) SELECT * FROM box_temp WHERE f1 << '(10,20),(30,40)';
SELECT * FROM box_temp WHERE f1 &< '(10,4.333334),(5,100)';
EXPLAIN (COSTS OFF) SELECT * FROM box_temp WHERE f1 &< '(10,4.333334),(5,100)';
SELECT * FROM box_temp WHERE f1 && '(15,20),(25,30)';
EXPLAIN (COSTS OFF) SELECT * FROM box_temp WHERE f1 && '(15,20),(25,30)';
SELECT * FROM box_temp WHERE f1 &> '(40,30),(45,50)';
EXPLAIN (COSTS OFF) SELECT * FROM box_temp WHERE f1 &> '(40,30),(45,50)';
SELECT * FROM box_temp WHERE f1 >> '(30,40),(40,30)';
EXPLAIN (COSTS OFF) SELECT * FROM box_temp WHERE f1 >> '(30,40),(40,30)';
SELECT * FROM box_temp WHERE f1 <<| '(10,4.33334),(5,100)';
EXPLAIN (COSTS OFF) SELECT * FROM box_temp WHERE f1 <<| '(10,4.33334),(5,100)';
SELECT * FROM box_temp WHERE f1 &<| '(10,4.3333334),(5,1)';
EXPLAIN (COSTS OFF) SELECT * FROM box_temp WHERE f1 &<| '(10,4.3333334),(5,1)';
SELECT * FROM box_temp WHERE f1 |&> '(49.99,49.99),(49.99,49.99)';
EXPLAIN (COSTS OFF) SELECT * FROM box_temp WHERE f1 |&> '(49.99,49.99),(49.99,49.99)';
SELECT * FROM box_temp WHERE f1 |>> '(37,38),(39,40)';
EXPLAIN (COSTS OFF) SELECT * FROM box_temp WHERE f1 |>> '(37,38),(39,40)';
SELECT * FROM box_temp WHERE f1 @> '(10,11),(15,16)';
EXPLAIN (COSTS OFF) SELECT * FROM box_temp WHERE f1 @> '(10,11),(15,15)';
SELECT * FROM box_temp WHERE f1 <@ '(10,15),(30,35)';
EXPLAIN (COSTS OFF) SELECT * FROM box_temp WHERE f1 <@ '(10,15),(30,35)';
SELECT * FROM box_temp WHERE f1 ~= '(20,20),(40,40)';
EXPLAIN (COSTS OFF) SELECT * FROM box_temp WHERE f1 ~= '(20,20),(40,40)';
RESET enable_seqscan;
DROP INDEX box_spgist;
--
-- Test the SP-GiST index on the larger volume of data
--
CREATE TABLE quad_box_tbl (id int, b box);
INSERT INTO quad_box_tbl
SELECT (x - 1) * 100 + y, box(point(x * 10, y * 10), point(x * 10 + 5, y * 10 + 5))
FROM generate_series(1, 100) x,
generate_series(1, 100) y;
-- insert repeating data to test allTheSame
INSERT INTO quad_box_tbl
SELECT i, '((200, 300),(210, 310))'
FROM generate_series(10001, 11000) AS i;
INSERT INTO quad_box_tbl
VALUES
(11001, NULL),
(11002, NULL),
(11003, '((-infinity,-infinity),(infinity,infinity))'),
(11004, '((-infinity,100),(-infinity,500))'),
(11005, '((-infinity,-infinity),(700,infinity))');
CREATE INDEX quad_box_tbl_idx ON quad_box_tbl USING spgist(b);
-- get reference results for ORDER BY distance from seq scan
SET enable_seqscan = ON;
SET enable_indexscan = OFF;
SET enable_bitmapscan = OFF;
CREATE TABLE quad_box_tbl_ord_seq1 AS
SELECT rank() OVER (ORDER BY b <-> point '123,456') n, b <-> point '123,456' dist, id
FROM quad_box_tbl;
CREATE TABLE quad_box_tbl_ord_seq2 AS
SELECT rank() OVER (ORDER BY b <-> point '123,456') n, b <-> point '123,456' dist, id
FROM quad_box_tbl WHERE b <@ box '((200,300),(500,600))';
SET enable_seqscan = OFF;
SET enable_indexscan = ON;
SET enable_bitmapscan = ON;
SELECT count(*) FROM quad_box_tbl WHERE b << box '((100,200),(300,500))';
SELECT count(*) FROM quad_box_tbl WHERE b &< box '((100,200),(300,500))';
SELECT count(*) FROM quad_box_tbl WHERE b && box '((100,200),(300,500))';
SELECT count(*) FROM quad_box_tbl WHERE b &> box '((100,200),(300,500))';
SELECT count(*) FROM quad_box_tbl WHERE b >> box '((100,200),(300,500))';
SELECT count(*) FROM quad_box_tbl WHERE b >> box '((100,200),(300,500))';
SELECT count(*) FROM quad_box_tbl WHERE b <<| box '((100,200),(300,500))';
SELECT count(*) FROM quad_box_tbl WHERE b &<| box '((100,200),(300,500))';
SELECT count(*) FROM quad_box_tbl WHERE b |&> box '((100,200),(300,500))';
SELECT count(*) FROM quad_box_tbl WHERE b |>> box '((100,200),(300,500))';
SELECT count(*) FROM quad_box_tbl WHERE b @> box '((201,301),(202,303))';
SELECT count(*) FROM quad_box_tbl WHERE b <@ box '((100,200),(300,500))';
SELECT count(*) FROM quad_box_tbl WHERE b ~= box '((200,300),(205,305))';
-- test ORDER BY distance
SET enable_indexscan = ON;
SET enable_bitmapscan = OFF;
EXPLAIN (COSTS OFF)
SELECT rank() OVER (ORDER BY b <-> point '123,456') n, b <-> point '123,456' dist, id
FROM quad_box_tbl;
CREATE TEMP TABLE quad_box_tbl_ord_idx1 AS
SELECT rank() OVER (ORDER BY b <-> point '123,456') n, b <-> point '123,456' dist, id
FROM quad_box_tbl;
SELECT *
FROM quad_box_tbl_ord_seq1 seq FULL JOIN quad_box_tbl_ord_idx1 idx
ON seq.n = idx.n AND seq.id = idx.id AND
(seq.dist = idx.dist OR seq.dist IS NULL AND idx.dist IS NULL)
WHERE seq.id IS NULL OR idx.id IS NULL;
EXPLAIN (COSTS OFF)
SELECT rank() OVER (ORDER BY b <-> point '123,456') n, b <-> point '123,456' dist, id
FROM quad_box_tbl WHERE b <@ box '((200,300),(500,600))';
CREATE TEMP TABLE quad_box_tbl_ord_idx2 AS
SELECT rank() OVER (ORDER BY b <-> point '123,456') n, b <-> point '123,456' dist, id
FROM quad_box_tbl WHERE b <@ box '((200,300),(500,600))';
SELECT *
FROM quad_box_tbl_ord_seq2 seq FULL JOIN quad_box_tbl_ord_idx2 idx
ON seq.n = idx.n AND seq.id = idx.id AND
(seq.dist = idx.dist OR seq.dist IS NULL AND idx.dist IS NULL)
WHERE seq.id IS NULL OR idx.id IS NULL;
RESET enable_seqscan;
RESET enable_indexscan;
RESET enable_bitmapscan;
|
--
-- SELECT_INTO
--
SELECT *
INTO TABLE sitmp1
FROM onek
WHERE onek.unique1 < 2;
DROP TABLE sitmp1;
SELECT *
INTO TABLE sitmp1
FROM onek2
WHERE onek2.unique1 < 2;
DROP TABLE sitmp1;
--
-- SELECT INTO and INSERT permission, if owner is not allowed to insert.
--
CREATE SCHEMA selinto_schema;
CREATE USER regress_selinto_user;
ALTER DEFAULT PRIVILEGES FOR ROLE regress_selinto_user
REVOKE INSERT ON TABLES FROM regress_selinto_user;
GRANT ALL ON SCHEMA selinto_schema TO public;
SET SESSION AUTHORIZATION regress_selinto_user;
-- WITH DATA, passes.
CREATE TABLE selinto_schema.tbl_withdata1 (a)
AS SELECT generate_series(1,3) WITH DATA;
INSERT INTO selinto_schema.tbl_withdata1 VALUES (4);
EXPLAIN (ANALYZE, COSTS OFF, SUMMARY OFF, TIMING OFF)
CREATE TABLE selinto_schema.tbl_withdata2 (a) AS
SELECT generate_series(1,3) WITH DATA;
-- WITH NO DATA, passes.
CREATE TABLE selinto_schema.tbl_nodata1 (a) AS
SELECT generate_series(1,3) WITH NO DATA;
EXPLAIN (ANALYZE, COSTS OFF, SUMMARY OFF, TIMING OFF)
CREATE TABLE selinto_schema.tbl_nodata2 (a) AS
SELECT generate_series(1,3) WITH NO DATA;
-- EXECUTE and WITH DATA, passes.
PREPARE data_sel AS SELECT generate_series(1,3);
CREATE TABLE selinto_schema.tbl_withdata3 (a) AS
EXECUTE data_sel WITH DATA;
EXPLAIN (ANALYZE, COSTS OFF, SUMMARY OFF, TIMING OFF)
CREATE TABLE selinto_schema.tbl_withdata4 (a) AS
EXECUTE data_sel WITH DATA;
-- EXECUTE and WITH NO DATA, passes.
CREATE TABLE selinto_schema.tbl_nodata3 (a) AS
EXECUTE data_sel WITH NO DATA;
EXPLAIN (ANALYZE, COSTS OFF, SUMMARY OFF, TIMING OFF)
CREATE TABLE selinto_schema.tbl_nodata4 (a) AS
EXECUTE data_sel WITH NO DATA;
RESET SESSION AUTHORIZATION;
ALTER DEFAULT PRIVILEGES FOR ROLE regress_selinto_user
GRANT INSERT ON TABLES TO regress_selinto_user;
SET SESSION AUTHORIZATION regress_selinto_user;
RESET SESSION AUTHORIZATION;
DEALLOCATE data_sel;
DROP SCHEMA selinto_schema CASCADE;
DROP USER regress_selinto_user;
-- Tests for WITH NO DATA and column name consistency
CREATE TABLE ctas_base (i int, j int);
INSERT INTO ctas_base VALUES (1, 2);
CREATE TABLE ctas_nodata (ii, jj, kk) AS SELECT i, j FROM ctas_base; -- Error
CREATE TABLE ctas_nodata (ii, jj, kk) AS SELECT i, j FROM ctas_base WITH NO DATA; -- Error
CREATE TABLE ctas_nodata (ii, jj) AS SELECT i, j FROM ctas_base; -- OK
CREATE TABLE ctas_nodata_2 (ii, jj) AS SELECT i, j FROM ctas_base WITH NO DATA; -- OK
CREATE TABLE ctas_nodata_3 (ii) AS SELECT i, j FROM ctas_base; -- OK
CREATE TABLE ctas_nodata_4 (ii) AS SELECT i, j FROM ctas_base WITH NO DATA; -- OK
SELECT * FROM ctas_nodata;
SELECT * FROM ctas_nodata_2;
SELECT * FROM ctas_nodata_3;
SELECT * FROM ctas_nodata_4;
DROP TABLE ctas_base;
DROP TABLE ctas_nodata;
DROP TABLE ctas_nodata_2;
DROP TABLE ctas_nodata_3;
DROP TABLE ctas_nodata_4;
--
-- CREATE TABLE AS/SELECT INTO as last command in a SQL function
-- have been known to cause problems
--
CREATE FUNCTION make_table() RETURNS VOID
AS $$
CREATE TABLE created_table AS SELECT * FROM int8_tbl;
$$ LANGUAGE SQL;
SELECT make_table();
SELECT * FROM created_table;
-- Try EXPLAIN ANALYZE SELECT INTO and EXPLAIN ANALYZE CREATE TABLE AS
-- WITH NO DATA, but hide the outputs since they won't be stable.
DO $$
BEGIN
EXECUTE 'EXPLAIN ANALYZE SELECT * INTO TABLE easi FROM int8_tbl';
EXECUTE 'EXPLAIN ANALYZE CREATE TABLE easi2 AS SELECT * FROM int8_tbl WITH NO DATA';
END$$;
DROP TABLE created_table;
DROP TABLE easi, easi2;
--
-- Disallowed uses of SELECT ... INTO. All should fail
--
DECLARE foo CURSOR FOR SELECT 1 INTO int4_tbl;
COPY (SELECT 1 INTO frak UNION SELECT 2) TO 'blob';
SELECT * FROM (SELECT 1 INTO f) bar;
CREATE VIEW foo AS SELECT 1 INTO int4_tbl;
INSERT INTO int4_tbl SELECT 1 INTO f;
-- Test CREATE TABLE AS ... IF NOT EXISTS
CREATE TABLE ctas_ine_tbl AS SELECT 1;
CREATE TABLE ctas_ine_tbl AS SELECT 1 / 0; -- error
CREATE TABLE IF NOT EXISTS ctas_ine_tbl AS SELECT 1 / 0; -- ok
CREATE TABLE ctas_ine_tbl AS SELECT 1 / 0 WITH NO DATA; -- error
CREATE TABLE IF NOT EXISTS ctas_ine_tbl AS SELECT 1 / 0 WITH NO DATA; -- ok
EXPLAIN (ANALYZE, COSTS OFF, SUMMARY OFF, TIMING OFF)
CREATE TABLE ctas_ine_tbl AS SELECT 1 / 0; -- error
EXPLAIN (ANALYZE, COSTS OFF, SUMMARY OFF, TIMING OFF)
CREATE TABLE IF NOT EXISTS ctas_ine_tbl AS SELECT 1 / 0; -- ok
EXPLAIN (ANALYZE, COSTS OFF, SUMMARY OFF, TIMING OFF)
CREATE TABLE ctas_ine_tbl AS SELECT 1 / 0 WITH NO DATA; -- error
EXPLAIN (ANALYZE, COSTS OFF, SUMMARY OFF, TIMING OFF)
CREATE TABLE IF NOT EXISTS ctas_ine_tbl AS SELECT 1 / 0 WITH NO DATA; -- ok
PREPARE ctas_ine_query AS SELECT 1 / 0;
EXPLAIN (ANALYZE, COSTS OFF, SUMMARY OFF, TIMING OFF)
CREATE TABLE ctas_ine_tbl AS EXECUTE ctas_ine_query; -- error
EXPLAIN (ANALYZE, COSTS OFF, SUMMARY OFF, TIMING OFF)
CREATE TABLE IF NOT EXISTS ctas_ine_tbl AS EXECUTE ctas_ine_query; -- ok
DROP TABLE ctas_ine_tbl;
|
<filename>modules/comments/queries/schemas/bayesion.sql
CREATE TABLE IF NOT EXISTS `b8_words` (
`id` bigint unsigned NOT NULL auto_increment,
`word` varchar(30) NOT NULL,
`ham` bigint unsigned NULL,
`spam` bigint unsigned NULL,
PRIMARY KEY (`id`),
INDEX (`word`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `b8_categories` (
`id` bigint unsigned NOT NULL auto_increment,
`category` varchar(4) NULL,
`total` bigint unsigned NULL,
PRIMARY KEY (`id`),
UNIQUE INDEX (`category`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
INSERT INTO b8_categories (id, category, total) VALUES (1, 'ham', 0);
INSERT INTO b8_categories (id, category, total) VALUES (2, 'spam', 0);
|
ALTER TABLE country ADD max_lat REAL NULL;
ALTER TABLE country ADD max_lng REAL NULL;
ALTER TABLE country ADD min_lat REAL NULL;
ALTER TABLE country ADD min_lng REAL NULL;
|
set names utf8;
SELECT '韩国', JSON_ARRAY('中国', '韩国') AS json_data;
SELECT '首尔', JSON_OBJECT('city','首尔') as json_data; |
<gh_stars>0
-- MySQL dump 10.13 Distrib 8.0.21, for Linux (x86_64)
--
-- Host: 192.168.8.2 Database: jay2
-- ------------------------------------------------------
-- Server version 5.5.44-0ubuntu0.14.04.1
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!50503 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
--
-- Table structure for table `atmcenter`
--
DROP TABLE IF EXISTS `atmcenter`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `atmcenter` (
`num` int(6) NOT NULL AUTO_INCREMENT,
`project` varchar(24) DEFAULT NULL,
`cabang` varchar(4) DEFAULT NULL,
`nomesin` varchar(25) DEFAULT NULL,
`namacabang` varchar(128) DEFAULT NULL,
`kota` varchar(50) DEFAULT NULL,
`alamat` varchar(255) DEFAULT NULL,
`weekend_siang` varchar(50) DEFAULT NULL,
`shp_weekend_siang` varchar(50) DEFAULT NULL,
`tgl_weekend_siang` date DEFAULT NULL,
`nomesin_weekend_siang` varchar(255) DEFAULT NULL,
`status_weekend_siang` tinyint(1) DEFAULT NULL,
`noform_weekend_siang` varchar(25) DEFAULT NULL,
`weekend_malam` varchar(50) DEFAULT NULL,
`shp_weekend_malam` varchar(50) DEFAULT NULL,
`tgl_weekend_malam` date DEFAULT NULL,
`nomesin_weekend_malam` varchar(50) DEFAULT NULL,
`status_weekend_malam` tinyint(1) DEFAULT NULL,
`noform_weekend_malam` varchar(25) DEFAULT NULL,
`weekday_siang` varchar(50) DEFAULT NULL,
`shp_weekday_siang` varchar(50) DEFAULT NULL,
`tgl_weekday_siang` date DEFAULT NULL,
`nomesin_weekday_siang` varchar(255) DEFAULT NULL,
`status_weekday_siang` tinyint(1) DEFAULT NULL,
`noform_weekday_siang` varchar(25) DEFAULT NULL,
`weekday_malam` varchar(50) DEFAULT NULL,
`shp_weekday_malam` varchar(50) DEFAULT NULL,
`tgl_weekday_malam` date DEFAULT NULL,
`nomesin_weekday_malam` varchar(255) DEFAULT NULL,
`status_weekday_malam` tinyint(1) DEFAULT NULL,
`noform_weekday_malam` varchar(25) DEFAULT NULL,
`kodebank` varchar(5) DEFAULT NULL,
PRIMARY KEY (`num`)
) ENGINE=MyISAM AUTO_INCREMENT=29520 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `att_field_matrix`
--
DROP TABLE IF EXISTS `att_field_matrix`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `att_field_matrix` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`nama` varchar(100) DEFAULT NULL,
`field_matrix` varchar(50) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=61 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `attribute`
--
DROP TABLE IF EXISTS `attribute`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `attribute` (
`kode` char(3) NOT NULL,
`nama` varchar(64) DEFAULT NULL,
`kategori` varchar(24) DEFAULT NULL,
`flag` enum('0','1') NOT NULL,
`transport` enum('y','n') NOT NULL DEFAULT 'n',
`matrix` varchar(50) DEFAULT NULL,
`kunjungan_q` int(1) DEFAULT NULL,
`timedelivery` varchar(24) DEFAULT NULL,
PRIMARY KEY (`kode`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `attribute_ebanking`
--
DROP TABLE IF EXISTS `attribute_ebanking`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `attribute_ebanking` (
`kode` int(11) NOT NULL AUTO_INCREMENT,
`nama` varchar(255) DEFAULT NULL,
`sumber` int(11) DEFAULT NULL,
`kategori` varchar(20) DEFAULT NULL,
PRIMARY KEY (`kode`)
) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `bank`
--
DROP TABLE IF EXISTS `bank`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `bank` (
`kode` char(3) NOT NULL,
`nama` varchar(64) DEFAULT NULL,
`swift_code` varchar(10) DEFAULT NULL,
PRIMARY KEY (`kode`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `cabang`
--
DROP TABLE IF EXISTS `cabang`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `cabang` (
`num` int(8) NOT NULL AUTO_INCREMENT,
`project` char(4) NOT NULL,
`kode` char(4) NOT NULL,
`nama` varchar(64) DEFAULT NULL,
`alamat` varchar(254) DEFAULT NULL,
`kota` varchar(64) DEFAULT NULL,
`provinsi` varchar(64) NOT NULL,
`kanwil` varchar(64) DEFAULT NULL,
`kodepos` varchar(5) DEFAULT NULL,
`notelpon` varchar(64) DEFAULT NULL,
`fax` varchar(64) DEFAULT NULL,
`timestamp` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
`kd_kota` varchar(10) DEFAULT NULL,
`spvdua` varchar(255) DEFAULT NULL,
`kareg` varchar(100) DEFAULT NULL,
`picperkota` varchar(100) DEFAULT NULL,
`nostkb` varchar(255) DEFAULT NULL,
`honor` varchar(255) DEFAULT NULL,
`plantugasstart` date DEFAULT NULL,
`plantugasend` date DEFAULT NULL,
`kodebank` varchar(5) DEFAULT NULL,
PRIMARY KEY (`num`,`project`,`kode`),
KEY `ix_project` (`project`),
KEY `ix_cabang` (`kode`)
) ENGINE=MyISAM AUTO_INCREMENT=58016 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `cabang_sulit`
--
DROP TABLE IF EXISTS `cabang_sulit`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `cabang_sulit` (
`sulit_id` int(11) NOT NULL AUTO_INCREMENT,
`sulit_projek` varchar(4) DEFAULT NULL,
`sulit_kode` char(3) DEFAULT NULL,
`sulit_nama` varchar(255) DEFAULT NULL,
PRIMARY KEY (`sulit_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Temporary view structure for view `cek_jml_cabang`
--
DROP TABLE IF EXISTS `cek_jml_cabang`;
/*!50001 DROP VIEW IF EXISTS `cek_jml_cabang`*/;
SET @saved_cs_client = @@character_set_client;
/*!50503 SET character_set_client = utf8mb4 */;
/*!50001 CREATE VIEW `cek_jml_cabang` AS SELECT
1 AS `num`,
1 AS `jml`,
1 AS `project`,
1 AS `kode`*/;
SET character_set_client = @saved_cs_client;
--
-- Table structure for table `code_list`
--
DROP TABLE IF EXISTS `code_list`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `code_list` (
`id_var` int(11) NOT NULL AUTO_INCREMENT,
`project` varchar(5) DEFAULT NULL,
`nm_var` varchar(20) DEFAULT NULL,
PRIMARY KEY (`id_var`)
) ENGINE=InnoDB AUTO_INCREMENT=355 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `code_list_tambahan`
--
DROP TABLE IF EXISTS `code_list_tambahan`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `code_list_tambahan` (
`num` int(11) NOT NULL AUTO_INCREMENT,
`kuesioner` varchar(5) DEFAULT NULL,
`variable` varchar(20) DEFAULT NULL,
`kode` int(11) DEFAULT NULL,
`skor` int(11) DEFAULT NULL,
`label_variabel` text,
`label_kode` text,
`tanggal` date DEFAULT NULL,
`nama` varchar(50) DEFAULT NULL,
`timestamp` datetime DEFAULT NULL,
`noid` char(8) DEFAULT NULL,
`ipaddress` varchar(24) DEFAULT NULL,
PRIMARY KEY (`num`)
) ENGINE=InnoDB AUTO_INCREMENT=7017 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `contact`
--
DROP TABLE IF EXISTS `contact`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `contact` (
`num` int(6) NOT NULL AUTO_INCREMENT,
`nama` varchar(128) DEFAULT NULL,
`notelpon` varchar(255) DEFAULT NULL,
`kota` varchar(55) DEFAULT NULL,
`aktual` varchar(8) DEFAULT NULL,
PRIMARY KEY (`num`)
) ENGINE=MyISAM AUTO_INCREMENT=566 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `daemons`
--
DROP TABLE IF EXISTS `daemons`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `daemons` (
`Start` text NOT NULL,
`Info` text NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `data_divisi`
--
DROP TABLE IF EXISTS `data_divisi`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `data_divisi` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`keterangan_divisi` varchar(255) NOT NULL,
`created_at` datetime NOT NULL,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=100 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `data_foto_temuan`
--
DROP TABLE IF EXISTS `data_foto_temuan`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `data_foto_temuan` (
`num` int(10) NOT NULL AUTO_INCREMENT,
`shp` char(20) DEFAULT NULL,
`project` char(20) DEFAULT NULL,
`cabang` char(20) DEFAULT NULL,
`kunjungan` char(20) DEFAULT NULL,
`skenario` char(20) DEFAULT NULL,
`ket_temuan` varchar(255) DEFAULT NULL,
`foto_temuan` varchar(255) DEFAULT NULL,
PRIMARY KEY (`num`)
) ENGINE=InnoDB AUTO_INCREMENT=14 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `data_jawaban_equest`
--
DROP TABLE IF EXISTS `data_jawaban_equest`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `data_jawaban_equest` (
`id_jawaban` int(11) NOT NULL AUTO_INCREMENT,
`id_project` varchar(11) NOT NULL,
`id_skenario` varchar(11) DEFAULT NULL,
`id_pembuat_equest` int(11) DEFAULT NULL,
`id_kunjungan` varchar(5) NOT NULL,
`kode_cabang` int(11) NOT NULL,
`id_user` int(11) NOT NULL,
`jawaban_equest` text NOT NULL,
`sts` int(11) NOT NULL,
`var_equest` text NOT NULL,
`var_equest2` text NOT NULL,
`var_equest3` text NOT NULL,
`var_equest4` text NOT NULL,
`var_equest5` text NOT NULL,
`ket_cek` text NOT NULL,
`ket_jawab` text NOT NULL,
PRIMARY KEY (`id_jawaban`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `data_kuis`
--
DROP TABLE IF EXISTS `data_kuis`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `data_kuis` (
`id_kuis` int(11) NOT NULL AUTO_INCREMENT,
`soal_kuis` text NOT NULL,
`benar_kuis` text NOT NULL,
`salah1_kuis` text NOT NULL,
`salah2_kuis` text NOT NULL,
`salah3_kuis` text NOT NULL,
`id_skenario` int(11) NOT NULL,
`kode_project` char(255) DEFAULT NULL,
`kunjungan` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id_kuis`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `data_nilai`
--
DROP TABLE IF EXISTS `data_nilai`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `data_nilai` (
`id_nilai` int(11) NOT NULL AUTO_INCREMENT,
`kode_project` varchar(5) DEFAULT NULL,
`kunjungan` varchar(5) DEFAULT NULL,
`id_user` varchar(250) NOT NULL,
`id_skenario` int(11) DEFAULT NULL,
`total_nilai` int(11) NOT NULL,
`benar_nilai` int(11) NOT NULL,
`salah_nilai` int(11) NOT NULL,
`tanggal_nilai` date NOT NULL,
PRIMARY KEY (`id_nilai`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `data_pengajuan_sdm`
--
DROP TABLE IF EXISTS `data_pengajuan_sdm`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `data_pengajuan_sdm` (
`id` int(255) NOT NULL AUTO_INCREMENT,
`project` varchar(50) DEFAULT NULL,
`kareg` varchar(15) DEFAULT NULL,
`pic` varchar(15) DEFAULT NULL,
`kota_dinas` varchar(50) DEFAULT NULL,
`keterangan` text,
`status` int(1) DEFAULT '0',
`tanggal` datetime DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=34 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `data_rekaman`
--
DROP TABLE IF EXISTS `data_rekaman`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `data_rekaman` (
`id_rekaman` int(11) NOT NULL AUTO_INCREMENT,
`validator_id` varchar(20) DEFAULT NULL,
`id_project` varchar(11) NOT NULL,
`id_skenario` varchar(11) DEFAULT NULL,
`id_user` int(11) NOT NULL,
`kode_cabang` varchar(11) NOT NULL,
`kunjungan` varchar(5) DEFAULT NULL,
`file_rekaman` varchar(250) NOT NULL,
`tanggal_input` date NOT NULL,
`sts_rekaman` int(11) NOT NULL,
`sts_valid` int(11) NOT NULL,
PRIMARY KEY (`id_rekaman`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=4812 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `data_skenario`
--
DROP TABLE IF EXISTS `data_skenario`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `data_skenario` (
`id_skenario` int(11) NOT NULL AUTO_INCREMENT,
`kode_project` varchar(255) NOT NULL,
`nama_skenario` varchar(255) NOT NULL,
`file_skenario` text NOT NULL,
`file_kuis` text NOT NULL,
`id_user` varchar(255) NOT NULL,
PRIMARY KEY (`id_skenario`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `data_td`
--
DROP TABLE IF EXISTS `data_td`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `data_td` (
`id_td` int(11) NOT NULL AUTO_INCREMENT,
`id_project` char(255) NOT NULL,
`id_skenario` char(11) NOT NULL,
`id_pembuat` char(11) NOT NULL,
`pilihan_td` text NOT NULL,
PRIMARY KEY (`id_td`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=2509 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `data_waktu_td`
--
DROP TABLE IF EXISTS `data_waktu_td`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `data_waktu_td` (
`id_waktu` int(11) NOT NULL AUTO_INCREMENT,
`user_entry` char(11) NOT NULL,
`id_project` varchar(11) NOT NULL,
`kode_cabang` char(11) NOT NULL,
`id_skenario` char(11) NOT NULL,
`kapan_isi_form` varchar(255) NOT NULL,
`jenis_form` varchar(255) NOT NULL,
`kondisi_pengisian` varchar(255) NOT NULL,
`proses` text NOT NULL,
`timestamp` time DEFAULT NULL,
`waktu` time NOT NULL,
`akhir_td` time DEFAULT NULL,
`full` time NOT NULL,
`part_1` time DEFAULT NULL,
`part_2` time DEFAULT NULL,
`ket_interupsi` text,
`temuan` text NOT NULL,
`status_td` int(1) DEFAULT NULL,
`revisi_ra` time DEFAULT NULL,
`alasan_revisi` text,
`user_revisi` char(11) DEFAULT NULL,
`tanggal_revisi` date DEFAULT NULL,
PRIMARY KEY (`id_waktu`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=37882 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `data_waktu_td_bak`
--
DROP TABLE IF EXISTS `data_waktu_td_bak`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `data_waktu_td_bak` (
`id_waktu` int(11) NOT NULL AUTO_INCREMENT,
`user_entry` char(11) NOT NULL,
`id_project` varchar(11) NOT NULL,
`kode_cabang` char(11) NOT NULL,
`id_skenario` char(11) NOT NULL,
`kapan_isi_form` varchar(255) NOT NULL,
`jenis_form` varchar(255) NOT NULL,
`kondisi_pengisian` varchar(255) NOT NULL,
`proses` text NOT NULL,
`timestamp` time DEFAULT NULL,
`waktu` time NOT NULL,
`akhir_td` time DEFAULT NULL,
`full` time NOT NULL,
`part_1` time DEFAULT NULL,
`part_2` time DEFAULT NULL,
`ket_interupsi` text,
`temuan` text NOT NULL,
`status_td` int(1) DEFAULT NULL,
PRIMARY KEY (`id_waktu`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `data_waktu_td_gd`
--
DROP TABLE IF EXISTS `data_waktu_td_gd`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `data_waktu_td_gd` (
`id_waktu` int(11) NOT NULL AUTO_INCREMENT,
`user_entry` varchar(24) NOT NULL,
`id_project` varchar(11) NOT NULL,
`kode_cabang` char(11) NOT NULL,
`id_skenario` char(11) NOT NULL,
`proses` text NOT NULL,
`sub_proses` text,
`td` text,
`penyebab_lama` text,
`temuan` text,
`kasir_penaksir` int(1) DEFAULT NULL,
PRIMARY KEY (`id_waktu`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `data_waktu_timestamp`
--
DROP TABLE IF EXISTS `data_waktu_timestamp`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `data_waktu_timestamp` (
`id_waktu` int(11) NOT NULL AUTO_INCREMENT,
`user_entry` char(11) NOT NULL,
`id_project` varchar(11) NOT NULL,
`kode_cabang` char(11) NOT NULL,
`id_skenario` char(11) NOT NULL,
`kapan_isi_form` varchar(255) NOT NULL,
`jenis_form` varchar(255) NOT NULL,
`kondisi_pengisian` varchar(255) NOT NULL,
`proses` text NOT NULL,
`waktu` time NOT NULL,
`akhir_td` time NOT NULL,
`full` time NOT NULL,
`part_1` time DEFAULT NULL,
`part_2` time DEFAULT NULL,
`ket_interupsi` text,
`temuan` text NOT NULL,
`status_td` int(1) DEFAULT NULL,
PRIMARY KEY (`id_waktu`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `datahost`
--
DROP TABLE IF EXISTS `datahost`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `datahost` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`hostname` varchar(50) DEFAULT NULL,
`nama` varchar(100) DEFAULT NULL,
`username` varchar(50) DEFAULT NULL,
`password` varchar(50) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `datarekening`
--
DROP TABLE IF EXISTS `datarekening`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `datarekening` (
`num` int(9) NOT NULL AUTO_INCREMENT,
`Id` varchar(16) NOT NULL,
`CodeBank` varchar(16) DEFAULT NULL,
`NoRek` varchar(64) DEFAULT NULL,
`JenRek` varchar(64) DEFAULT NULL,
`Saldo` varchar(24) DEFAULT NULL,
`TglSaldo` date DEFAULT NULL,
`Cabang` varchar(128) DEFAULT NULL,
`AlmtBank` varchar(255) DEFAULT NULL,
`Kota` varchar(64) DEFAULT NULL,
`KodePos` varchar(8) DEFAULT NULL,
`TglBuka` date DEFAULT NULL,
`TglTutup` date DEFAULT NULL,
`StaRek` varchar(255) DEFAULT NULL,
`FotoBuTab` varchar(255) DEFAULT NULL,
`KepemilikanRek` varchar(255) DEFAULT NULL,
PRIMARY KEY (`num`)
) ENGINE=MyISAM AUTO_INCREMENT=7250 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `datarekening_backup`
--
DROP TABLE IF EXISTS `datarekening_backup`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `datarekening_backup` (
`num` int(9) NOT NULL AUTO_INCREMENT,
`Id` varchar(16) NOT NULL,
`CodeBank` varchar(16) DEFAULT NULL,
`NoRek` varchar(64) DEFAULT NULL,
`JenRek` varchar(64) DEFAULT NULL,
`Saldo` varchar(24) DEFAULT NULL,
`TglSaldo` date DEFAULT NULL,
`Cabang` varchar(128) DEFAULT NULL,
`AlmtBank` varchar(255) DEFAULT NULL,
`Kota` varchar(64) DEFAULT NULL,
`KodePos` varchar(8) DEFAULT NULL,
`TglBuka` date DEFAULT NULL,
`TglTutup` date DEFAULT NULL,
`StaRek` varchar(255) DEFAULT NULL,
PRIMARY KEY (`num`)
) ENGINE=MyISAM AUTO_INCREMENT=9072 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `datarekening_baru`
--
DROP TABLE IF EXISTS `datarekening_baru`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `datarekening_baru` (
`num` int(9) NOT NULL AUTO_INCREMENT,
`Id` varchar(16) NOT NULL,
`CodeBank` varchar(16) DEFAULT NULL,
`NoRek` varchar(64) DEFAULT NULL,
`JenRek` varchar(64) DEFAULT NULL,
`Saldo` varchar(24) DEFAULT NULL,
`TglSaldo` date DEFAULT NULL,
`Cabang` varchar(128) DEFAULT NULL,
`AlmtBank` varchar(255) DEFAULT NULL,
`Kota` varchar(64) DEFAULT NULL,
`KodePos` varchar(8) DEFAULT NULL,
`TglBuka` date DEFAULT NULL,
`TglTutup` date DEFAULT NULL,
`StaRek` varchar(255) DEFAULT NULL,
PRIMARY KEY (`num`)
) ENGINE=MyISAM AUTO_INCREMENT=9087 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `datarekening_trash`
--
DROP TABLE IF EXISTS `datarekening_trash`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `datarekening_trash` (
`num` int(9) NOT NULL AUTO_INCREMENT,
`Id` varchar(16) NOT NULL,
`CodeBank` varchar(16) DEFAULT NULL,
`NoRek` varchar(64) DEFAULT NULL,
`JenRek` varchar(64) DEFAULT NULL,
`Saldo` varchar(24) DEFAULT NULL,
`TglSaldo` date DEFAULT NULL,
`Cabang` varchar(128) DEFAULT NULL,
`AlmtBank` varchar(255) DEFAULT NULL,
`Kota` varchar(64) DEFAULT NULL,
`KodePos` varchar(8) DEFAULT NULL,
`TglBuka` date DEFAULT NULL,
`TglTutup` date DEFAULT NULL,
`StaRek` varchar(255) DEFAULT NULL,
PRIMARY KEY (`num`)
) ENGINE=MyISAM AUTO_INCREMENT=9174 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `datatraining`
--
DROP TABLE IF EXISTS `datatraining`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `datatraining` (
`Id` varchar(16) NOT NULL,
`KodeTrain` varchar(64) DEFAULT NULL,
`TglTrain` date DEFAULT NULL,
`StaTrain` varchar(64) DEFAULT NULL,
`StatFinal` varchar(24) DEFAULT NULL,
`KeteranganTrain` varchar(255) DEFAULT NULL,
PRIMARY KEY (`Id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `dp`
--
DROP TABLE IF EXISTS `dp`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `dp` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`project` varchar(4) DEFAULT NULL,
`cabang` varchar(4) DEFAULT NULL,
`kunjungan` varchar(4) DEFAULT NULL,
`tanggal` datetime DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=343 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `dum_cab`
--
DROP TABLE IF EXISTS `dum_cab`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `dum_cab` (
`kode` varchar(255) DEFAULT NULL,
`kota` varchar(255) DEFAULT NULL,
`alamat` varchar(255) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `ebanking`
--
DROP TABLE IF EXISTS `ebanking`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `ebanking` (
`num` int(11) NOT NULL AUTO_INCREMENT,
`project` varchar(11) DEFAULT NULL,
`bank` char(3) DEFAULT NULL,
`channel` varchar(50) DEFAULT NULL,
`transaksi` int(11) DEFAULT NULL,
`os` varchar(50) DEFAULT NULL,
`provider` varchar(50) DEFAULT NULL,
`hari` varchar(11) DEFAULT NULL,
`waktu` varchar(11) DEFAULT NULL,
`trx_ke` int(11) DEFAULT NULL,
`nama_shopper` varchar(255) DEFAULT NULL,
`norek` varchar(255) DEFAULT NULL,
`tujuan` varchar(255) DEFAULT NULL,
`user_input` char(50) DEFAULT NULL,
`tanggal_evaluasi` date DEFAULT NULL,
`jam_mulai` time DEFAULT NULL,
`jam_selesai` time DEFAULT NULL,
`jenis` varchar(255) DEFAULT NULL,
`percobaan` char(50) DEFAULT NULL,
`penyebab` text,
`total_td` decimal(8,2) DEFAULT NULL,
`tgl_aktual` date DEFAULT NULL,
`upload_bukti` varchar(255) DEFAULT NULL,
`status` int(11) NOT NULL DEFAULT '0',
`r_temuan` varchar(255) DEFAULT NULL,
`validator_id` char(50) DEFAULT NULL,
`tgl_validasi` date DEFAULT NULL,
`versi_label` int(11) DEFAULT NULL,
`updatetd_id` char(20) DEFAULT NULL,
`last_update` timestamp NULL DEFAULT NULL,
`download_total` timestamp NULL DEFAULT NULL,
`download_label` timestamp NULL DEFAULT NULL,
`ket_reset` text,
PRIMARY KEY (`num`)
) ENGINE=InnoDB AUTO_INCREMENT=4070 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `ebanking_aplikasi`
--
DROP TABLE IF EXISTS `ebanking_aplikasi`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `ebanking_aplikasi` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`nama` varchar(50) DEFAULT NULL,
`bank` char(3) DEFAULT NULL,
`channel` varchar(50) DEFAULT NULL,
`os` varchar(20) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=23 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `ebanking_cekfield`
--
DROP TABLE IF EXISTS `ebanking_cekfield`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `ebanking_cekfield` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`project` varchar(4) DEFAULT NULL,
`tanggal` date DEFAULT NULL,
`jam` time DEFAULT NULL,
`hari` varchar(15) DEFAULT NULL,
`waktu` varchar(15) DEFAULT NULL,
`provider` varchar(30) DEFAULT NULL,
`download` decimal(8,2) DEFAULT NULL,
`upload` decimal(8,2) DEFAULT NULL,
`bukti` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=28 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `ebanking_data_td`
--
DROP TABLE IF EXISTS `ebanking_data_td`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `ebanking_data_td` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`bank` char(11) DEFAULT NULL,
`channel` varchar(50) DEFAULT NULL,
`os` varchar(50) DEFAULT NULL,
`jenis` varchar(50) DEFAULT NULL,
`transaksi` int(11) DEFAULT NULL,
`versi` int(11) DEFAULT NULL,
`step` int(11) DEFAULT NULL,
`label` varchar(255) DEFAULT NULL,
`pembuat` char(50) DEFAULT NULL,
`last_update` date DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=633 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `ebanking_peralatan`
--
DROP TABLE IF EXISTS `ebanking_peralatan`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `ebanking_peralatan` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`project` varchar(4) DEFAULT NULL,
`nama` varchar(100) DEFAULT NULL,
`jenis` varchar(25) DEFAULT NULL,
`terpakai` varchar(100) DEFAULT NULL,
`kosong` varchar(100) DEFAULT NULL,
`bukti` varchar(255) DEFAULT NULL,
`tanggal` date DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `ebanking_provider`
--
DROP TABLE IF EXISTS `ebanking_provider`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `ebanking_provider` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`nama` varchar(100) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `ebanking_rekening`
--
DROP TABLE IF EXISTS `ebanking_rekening`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `ebanking_rekening` (
`id` int(15) NOT NULL AUTO_INCREMENT,
`nama` varchar(100) DEFAULT NULL,
`bank` varchar(20) DEFAULT NULL,
`norek` varchar(70) DEFAULT NULL,
`kategori` varchar(20) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=28 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `ebanking_shopper`
--
DROP TABLE IF EXISTS `ebanking_shopper`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `ebanking_shopper` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`nama` varchar(100) DEFAULT NULL,
`jk` varchar(30) DEFAULT NULL,
`no_hp` varchar(20) DEFAULT NULL,
`email` varchar(100) DEFAULT NULL,
`tanggal_mulai` date DEFAULT NULL,
`tanggal_selesai` date DEFAULT NULL,
`user_id` varchar(100) DEFAULT NULL,
`password` varchar(100) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `ebanking_td`
--
DROP TABLE IF EXISTS `ebanking_td`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `ebanking_td` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`num_eb` int(11) DEFAULT NULL,
`project` char(5) DEFAULT NULL,
`bank` char(11) DEFAULT NULL,
`channel` varchar(50) DEFAULT NULL,
`transaksi` int(11) DEFAULT NULL,
`versi_label` int(11) DEFAULT NULL,
`step1` decimal(8,2) DEFAULT NULL,
`step2` decimal(8,2) DEFAULT NULL,
`step3` decimal(8,2) DEFAULT NULL,
`step4` decimal(8,2) DEFAULT NULL,
`step5` decimal(8,2) DEFAULT NULL,
`step6` decimal(8,2) DEFAULT NULL,
`step7` decimal(8,2) DEFAULT NULL,
`step8` decimal(8,2) DEFAULT NULL,
`step9` decimal(8,2) DEFAULT NULL,
`step10` decimal(8,2) DEFAULT NULL,
`step11` decimal(8,2) DEFAULT NULL,
`step12` decimal(8,2) DEFAULT NULL,
`step13` decimal(8,2) DEFAULT NULL,
`step14` decimal(8,2) DEFAULT NULL,
`step15` decimal(8,2) DEFAULT NULL,
`step16` decimal(8,2) DEFAULT NULL,
`step17` decimal(8,2) DEFAULT NULL,
`step18` decimal(8,2) DEFAULT NULL,
`step19` decimal(8,2) DEFAULT NULL,
`step20` decimal(8,2) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=92 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `field_kotakab`
--
DROP TABLE IF EXISTS `field_kotakab`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `field_kotakab` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`kota_id` int(11) NOT NULL,
`jeniskota` varchar(50) NOT NULL,
`ump_bulanan` int(11) DEFAULT NULL,
`ump_harian` int(11) DEFAULT NULL,
`tahun` int(11) DEFAULT NULL,
`user_update` int(11) DEFAULT NULL,
`created_at` date NOT NULL,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `field_pembayaran`
--
DROP TABLE IF EXISTS `field_pembayaran`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `field_pembayaran` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`nomorstkb` int(11) DEFAULT NULL,
`term` int(11) NOT NULL,
`tanggalbuat` date NOT NULL,
`kodeproject` varchar(10) NOT NULL,
`id_data_id` int(11) NOT NULL,
`total` int(11) NOT NULL,
`total_aktual` int(11) DEFAULT NULL,
`status_pembayaran` int(11) NOT NULL,
`noid_bpu` int(11) DEFAULT NULL,
`metode_pembayaran` varchar(10) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=43 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `field_sdm`
--
DROP TABLE IF EXISTS `field_sdm`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `field_sdm` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`id_data_id` varchar(20) NOT NULL,
`kota_id` int(11) NOT NULL,
`posisi` varchar(30) NOT NULL,
`status` varchar(30) DEFAULT NULL,
`tanggal_mulai` date DEFAULT NULL,
`tanggal_selesai` date DEFAULT NULL,
`tanggal_kaderisasi` date DEFAULT NULL,
`kader_id` int(11) DEFAULT NULL,
`kepala_id` int(11) DEFAULT NULL,
`jumlah_kaderisasi` int(11) DEFAULT NULL,
`mulai_kaderisasi` date DEFAULT NULL,
`selesai_kaderisasi` date DEFAULT NULL,
`penanggung_jawab_kaderisasi` int(11) DEFAULT NULL,
`memo` varchar(255) DEFAULT NULL,
`user_update` int(11) DEFAULT NULL,
`created_at` datetime NOT NULL,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `Unique ID SDM` (`id_data_id`)
) ENGINE=InnoDB AUTO_INCREMENT=57 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `form_keterlambatan`
--
DROP TABLE IF EXISTS `form_keterlambatan`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `form_keterlambatan` (
`id` int(20) NOT NULL AUTO_INCREMENT,
`num_quest` int(50) DEFAULT NULL,
`project` char(4) DEFAULT NULL,
`cabang` char(11) DEFAULT NULL,
`kunjungan` char(11) DEFAULT NULL,
`r_kategori` char(11) DEFAULT NULL,
`tgl_kunjungan` date DEFAULT NULL,
`pwt` char(20) DEFAULT NULL,
`ra_project` char(20) DEFAULT NULL,
`alasan` text,
`tgl_dibuat` timestamp NULL DEFAULT NULL,
`pemohon` char(20) DEFAULT NULL,
`pj_field` char(20) DEFAULT NULL,
`mengetahui` char(20) DEFAULT NULL,
`tgl_mengetahui` timestamp NULL DEFAULT NULL,
`approval` varchar(20) DEFAULT NULL,
`tgl_approve` timestamp NULL DEFAULT NULL,
`evidence` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=18 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `form_validasi`
--
DROP TABLE IF EXISTS `form_validasi`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `form_validasi` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`num_eb` int(11) DEFAULT NULL,
`bank` varchar(50) DEFAULT NULL,
`tujuan` int(11) DEFAULT NULL,
`tanggal` varchar(50) DEFAULT NULL,
`hari` varchar(50) DEFAULT NULL,
`transaksi` varchar(50) DEFAULT NULL,
`jam` varchar(50) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=48 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `format_file`
--
DROP TABLE IF EXISTS `format_file`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `format_file` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`jenis` varchar(255) DEFAULT NULL,
`nama_file` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=18 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `gammu`
--
DROP TABLE IF EXISTS `gammu`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `gammu` (
`Version` int(11) NOT NULL DEFAULT '0'
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `hari_libur`
--
DROP TABLE IF EXISTS `hari_libur`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `hari_libur` (
`id` int(12) NOT NULL AUTO_INCREMENT COMMENT 'ID Hari Libur',
`tanggal` date NOT NULL COMMENT 'Tanggal Libur',
`hari` varchar(10) NOT NULL COMMENT 'Hari Libur',
`keterangan` varchar(100) NOT NULL COMMENT 'Keterangan Libur',
`tipe` enum('libur_nasional','cuti_bersama') DEFAULT NULL COMMENT 'Keterangan Tipe Libur',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=32 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `history_ulang`
--
DROP TABLE IF EXISTS `history_ulang`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `history_ulang` (
`id` int(8) NOT NULL AUTO_INCREMENT,
`project` varchar(8) NOT NULL,
`cabang` varchar(8) NOT NULL,
`kunjungan` varchar(8) NOT NULL,
`tgl_temuan` datetime NOT NULL COMMENT 'Tanggal Temuan Masalah',
`id_user` varchar(10) NOT NULL COMMENT 'ID Shopper / Pewitness yang melakukan kesalahan',
`potongan` int(8) NOT NULL COMMENT 'Jumlah Pemotongan Honor',
`keterangan` text NOT NULL COMMENT 'Detail Alasan Pengulangan',
`status` enum('yes','no') NOT NULL COMMENT 'Status honor user sudah dipotong atau belum.',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=195 DEFAULT CHARSET=latin1 COMMENT='Table untuk menampung data pemotongan honor karena kesalahan kunjungan';
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `honor`
--
DROP TABLE IF EXISTS `honor`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `honor` (
`num` int(9) NOT NULL AUTO_INCREMENT,
`project` char(4) DEFAULT NULL,
`cabang` char(4) DEFAULT NULL,
`kunjungan` char(3) DEFAULT NULL,
`shporpwt` char(8) DEFAULT NULL,
`user` varchar(24) DEFAULT NULL,
`transport` varchar(9) DEFAULT NULL,
`transport_jauh` varchar(9) DEFAULT NULL,
`honor` varchar(9) DEFAULT NULL,
`pemotongan` varchar(500) DEFAULT NULL,
`totalpemotongan` varchar(4) DEFAULT NULL,
`total` varchar(9) DEFAULT NULL,
`paid` varchar(4) DEFAULT NULL,
`paidby` varchar(24) DEFAULT NULL,
`datepaid` datetime DEFAULT NULL,
`noform` varchar(28) DEFAULT NULL,
PRIMARY KEY (`num`),
FULLTEXT KEY `IXUser` (`user`)
) ENGINE=MyISAM AUTO_INCREMENT=51050 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Temporary view structure for view `honor_atm_center`
--
DROP TABLE IF EXISTS `honor_atm_center`;
/*!50001 DROP VIEW IF EXISTS `honor_atm_center`*/;
SET @saved_cs_client = @@character_set_client;
/*!50503 SET character_set_client = utf8mb4 */;
/*!50001 CREATE VIEW `honor_atm_center` AS SELECT
1 AS `project`,
1 AS `cabang`,
1 AS `kunjungan`,
1 AS `tanggal`,
1 AS `shp_atm`,
1 AS `kota`*/;
SET character_set_client = @saved_cs_client;
--
-- Table structure for table `honor_basic_hadir`
--
DROP TABLE IF EXISTS `honor_basic_hadir`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `honor_basic_hadir` (
`id` int(12) NOT NULL AUTO_INCREMENT COMMENT 'ID Honor Basic dan Kehadiran',
`tgl_proses` datetime NOT NULL COMMENT 'Tanggal Proses End Of Month',
`user_id` char(3) NOT NULL COMMENT 'ID User',
`group_id` varchar(2) NOT NULL,
`prorate` enum('yes','no') NOT NULL DEFAULT 'no' COMMENT 'Detail apakah periode itu adalah prorate atau bukan',
`jumlah_hari` int(2) NOT NULL COMMENT 'Jumlah Hari Kerja',
`honor_basic_harian` int(12) NOT NULL COMMENT 'honor_basic / 22 hari (variasi)',
`honor_basic` int(12) NOT NULL COMMENT 'Honor Basic dari table honor_basic_hadir_mx. Jika prorate maka (honor_basic_harian * hari kerja)',
`honor_basic_potongan` int(12) NOT NULL COMMENT '(Jumlah tidak masuk * honor_basic_harian)',
`total_honor_basic` int(12) NOT NULL COMMENT '(honor_basic - honor_basic_potongan)',
`honor_hadir_harian` int(12) NOT NULL COMMENT 'honor_hadir / 22 hari (25000)',
`honor_hadir` int(12) NOT NULL COMMENT 'Honor Hadir dari table honor_basic_hadir_mx. Jika prorate maka (honor_basic_harian * hari kerja)',
`honor_hadir_potongan` int(12) NOT NULL COMMENT '(Jumlah tidak masuk * honor_hadir_harian)',
`honor_hadir_potongan_terlambat` int(12) NOT NULL COMMENT '(Jumlah terlambat * potongan terlambat) (15000 - jan 15)',
`total_honor_hadir` int(12) NOT NULL COMMENT '(honor_hadir - (honor_hadir_potongan + honor_hadir_potongan_terlambat))',
`honor_tunjangan_harian` int(12) NOT NULL COMMENT 'honor_tunjangan / 22 hari (30700)',
`honor_tunjangan` int(12) NOT NULL COMMENT 'Honor Tunjangan dari table honor_basic_hadir_mx. Pengganti Produktifitas jika hanya PKWT (bukan HL)',
`honor_tunjangan_potongan` int(12) NOT NULL COMMENT '(Jumlah tidak masuk * honor_tunjangan_harian)',
`total_honor_tunjangan` int(12) NOT NULL COMMENT '(honor_tunjangan - honor_tunjangan_potongan)',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=240 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `honor_basic_hadir_mx`
--
DROP TABLE IF EXISTS `honor_basic_hadir_mx`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `honor_basic_hadir_mx` (
`id` int(8) NOT NULL AUTO_INCREMENT COMMENT 'ID Honor Basic dan Honor Kehadiran',
`user_id` char(3) NOT NULL COMMENT 'ID User (Karyawan)',
`group_id` varchar(2) NOT NULL COMMENT 'Grade User',
`honor_basic` int(12) NOT NULL COMMENT 'Jumlah Honor Basic',
`honor_hadir` int(12) NOT NULL COMMENT 'Jumlah Honor Kehadiran',
`honor_tunjangan` int(12) NOT NULL COMMENT 'Jumlah Honor Tunjangan (Pengganti Produktifitas)',
`aktif` enum('y','n') NOT NULL DEFAULT 'y' COMMENT 'Status Honor Basic dan Hadir',
`created_by` char(3) NOT NULL,
`created_date` datetime NOT NULL,
`updated_by` char(3) NOT NULL,
`updated_date` datetime NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=26 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `honor_basic_hadir_mx_copy1`
--
DROP TABLE IF EXISTS `honor_basic_hadir_mx_copy1`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `honor_basic_hadir_mx_copy1` (
`id` int(8) NOT NULL AUTO_INCREMENT COMMENT 'ID Honor Basic dan Honor Kehadiran',
`user_id` char(3) NOT NULL COMMENT 'ID User (Karyawan)',
`group_id` varchar(2) NOT NULL COMMENT 'Grade User',
`honor_basic` int(12) NOT NULL COMMENT 'Jumlah Honor Basic',
`honor_hadir` int(12) NOT NULL COMMENT 'Jumlah Honor Kehadiran',
`honor_tunjangan` int(12) NOT NULL COMMENT 'Jumlah Honor Tunjangan (Pengganti Produktifitas)',
`aktif` enum('y','n') NOT NULL DEFAULT 'y' COMMENT 'Status Honor Basic dan Hadir',
`created_by` char(3) NOT NULL,
`created_date` datetime NOT NULL,
`updated_by` char(3) NOT NULL,
`updated_date` datetime NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `honor_batch`
--
DROP TABLE IF EXISTS `honor_batch`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `honor_batch` (
`batch_id` int(11) NOT NULL AUTO_INCREMENT,
`batch_projek` char(4) DEFAULT NULL,
`batch_cabang` char(4) DEFAULT NULL,
`batch_kunjungan` char(3) DEFAULT NULL,
`batch_shporpwt` char(3) DEFAULT NULL,
`batch_user` varchar(16) DEFAULT NULL,
`batch_transport` varchar(9) DEFAULT NULL,
`batch_transport_j` varchar(9) DEFAULT NULL,
`batch_transport_k` varchar(9) DEFAULT NULL,
`batch_honor` varchar(9) DEFAULT NULL,
`batch_potongan_kode` varchar(8) DEFAULT NULL,
`batch_potongan_nominal` varchar(9) DEFAULT NULL,
`batch_potongan_keterangan` varchar(255) DEFAULT NULL,
`batch_total` varchar(9) DEFAULT NULL,
`batch_potongan2` varchar(255) DEFAULT NULL,
`batch_ipck` varchar(255) DEFAULT NULL,
`batch_nohp` varchar(65) DEFAULT NULL,
`batch_norek` varchar(64) DEFAULT NULL,
`batch_status` char(1) DEFAULT NULL,
`batch_rekaman` enum('true','false') DEFAULT 'false',
`batch_rekaman_tgl` date DEFAULT NULL,
`batch_quest_tgl` date DEFAULT NULL,
`batch_projek_nama` varchar(64) DEFAULT NULL,
`batch_cabang_nama` varchar(64) DEFAULT NULL,
`batch_kunjungan_nama` varchar(64) DEFAULT NULL,
`batch_user_nama` varchar(100) DEFAULT NULL,
PRIMARY KEY (`batch_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `honor_do`
--
DROP TABLE IF EXISTS `honor_do`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `honor_do` (
`num` int(9) NOT NULL AUTO_INCREMENT,
`project` char(4) DEFAULT NULL,
`cabang` char(4) DEFAULT NULL,
`kunjungan` char(3) DEFAULT NULL,
`shporpwt` char(8) DEFAULT NULL,
`user` varchar(24) DEFAULT NULL,
`transport` varchar(9) DEFAULT NULL,
`transport_jauh` varchar(9) DEFAULT NULL,
`honor` varchar(9) DEFAULT NULL,
`pemotongan` varchar(500) DEFAULT NULL,
`totalpemotongan` varchar(4) DEFAULT NULL,
`total` varchar(9) DEFAULT NULL,
`paid` varchar(4) DEFAULT NULL,
`paidby` varchar(24) DEFAULT NULL,
`datepaid` datetime DEFAULT NULL,
`noform` varchar(28) DEFAULT NULL,
PRIMARY KEY (`num`),
FULLTEXT KEY `IXUser` (`user`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `honor_edit_aktual`
--
DROP TABLE IF EXISTS `honor_edit_aktual`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `honor_edit_aktual` (
`num` int(9) DEFAULT NULL,
`project` char(4) DEFAULT NULL,
`cabang` char(4) DEFAULT NULL,
`kunjungan` char(3) DEFAULT NULL,
`shporpwt` char(8) DEFAULT NULL,
`user` varchar(24) DEFAULT NULL,
`transport` varchar(9) DEFAULT NULL,
`transport_jauh` varchar(9) DEFAULT NULL,
`honor` varchar(9) DEFAULT NULL,
`pemotongan` varchar(500) DEFAULT NULL,
`totalpemotongan` varchar(4) DEFAULT NULL,
`total` varchar(9) DEFAULT NULL,
`paid` varchar(4) DEFAULT NULL,
`paidby` varchar(24) DEFAULT NULL,
`datepaid` datetime DEFAULT NULL,
`noform` varchar(28) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `honor_hadir_detail`
--
DROP TABLE IF EXISTS `honor_hadir_detail`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `honor_hadir_detail` (
`id` int(12) NOT NULL AUTO_INCREMENT COMMENT 'ID Detail Kehadiran',
`user_id` char(3) NOT NULL COMMENT 'ID User (Karyawan)',
`group_id` varchar(2) NOT NULL COMMENT 'ID Grup (Karyawan)',
`tgl_proses` datetime NOT NULL COMMENT 'Tanggal Proses (Kosong ketika input, update ketika proses end of month)',
`jml_absen` int(2) NOT NULL DEFAULT '0' COMMENT 'Total Jumlah Tidak Masuk',
`jml_terlambat` int(2) NOT NULL DEFAULT '0' COMMENT 'Total Jumlah Datang Terlambat',
`created_by` char(3) NOT NULL,
`created_date` datetime NOT NULL,
`updated_by` char(3) NOT NULL,
`updated_date` datetime NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=73 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `honor_prod`
--
DROP TABLE IF EXISTS `honor_prod`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `honor_prod` (
`id_honor_prod` int(8) NOT NULL AUTO_INCREMENT,
`tgl_proses` datetime NOT NULL,
`id_user` char(4) NOT NULL,
`bagian` char(20) NOT NULL,
`grade` char(20) NOT NULL,
`project` char(4) NOT NULL,
`jumlah_q_besar` int(4) NOT NULL COMMENT 'Jumlah Q Besar yang ditangani',
`honor_q_besar` int(8) NOT NULL COMMENT 'Honor Q Besar',
`total_q_besar` int(12) NOT NULL COMMENT 'Jumlah Q Besar * Honor Q Besar',
`jumlah_q_kecil` int(4) NOT NULL COMMENT 'Jumlah Q Kecil yang ditangani',
`honor_q_kecil` int(8) NOT NULL COMMENT 'Honor Q Kecil',
`total_q_kecil` int(12) NOT NULL COMMENT 'Jumlah Q Kecil * Honor Q Kecil',
PRIMARY KEY (`id_honor_prod`)
) ENGINE=InnoDB AUTO_INCREMENT=4504 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `honor_prod_anomali`
--
DROP TABLE IF EXISTS `honor_prod_anomali`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `honor_prod_anomali` (
`anomali_id` int(11) NOT NULL AUTO_INCREMENT,
`anomali_att` char(3) DEFAULT NULL,
`anomali_input_ip` varchar(15) DEFAULT NULL,
`anomali_input_date` datetime DEFAULT NULL,
`anomali_input_id` char(4) DEFAULT NULL,
`anomali_efektif` date DEFAULT NULL,
`anomali_nonaktif` date DEFAULT NULL,
`anomali_aktif` tinyint(1) DEFAULT '1',
PRIMARY KEY (`anomali_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `honor_prod_last_process`
--
DROP TABLE IF EXISTS `honor_prod_last_process`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `honor_prod_last_process` (
`tanggal_proses_akhir` datetime NOT NULL COMMENT 'Tanggal Proses',
`tanggal_awal_periode` datetime NOT NULL COMMENT 'Awal Periode',
`tanggal_akhir_periode` datetime DEFAULT NULL COMMENT 'Akhir Periode',
PRIMARY KEY (`tanggal_proses_akhir`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `honor_prod_mx`
--
DROP TABLE IF EXISTS `honor_prod_mx`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `honor_prod_mx` (
`id` int(8) NOT NULL AUTO_INCREMENT COMMENT 'ID Matrix',
`project` char(5) DEFAULT NULL COMMENT 'Nama Project',
`group_id` int(11) NOT NULL COMMENT 'ID User_Group',
`honor_q_besar` int(8) NOT NULL COMMENT 'Honor Q Besar',
`honor_q_kecil` int(8) NOT NULL COMMENT 'Honor Q Kecil',
`aktif` enum('y','n') NOT NULL DEFAULT 'y' COMMENT 'Status Aktif',
`created_by` char(3) NOT NULL,
`created_date` datetime NOT NULL,
`updated_by` char(3) NOT NULL,
`updated_date` datetime DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=19 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `honor_tambahan`
--
DROP TABLE IF EXISTS `honor_tambahan`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `honor_tambahan` (
`num` int(11) NOT NULL AUTO_INCREMENT,
`nama` varchar(225) DEFAULT NULL,
`npwp` varchar(100) DEFAULT NULL,
`jenkel` enum('L','P') DEFAULT NULL,
`nominal` int(11) DEFAULT NULL,
`tanggal` date DEFAULT NULL,
`ket` varchar(225) DEFAULT NULL,
`timestamp` datetime DEFAULT NULL,
`user_create` char(8) DEFAULT NULL,
PRIMARY KEY (`num`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `honor_training`
--
DROP TABLE IF EXISTS `honor_training`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `honor_training` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`training_id` int(11) NOT NULL,
`nama_honor` varchar(50) NOT NULL,
`nominal_honor` int(11) NOT NULL,
`created_at` datetime NOT NULL,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=16 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `honor_ulang`
--
DROP TABLE IF EXISTS `honor_ulang`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `honor_ulang` (
`num` int(9) NOT NULL AUTO_INCREMENT,
`project` char(4) DEFAULT NULL,
`cabang` char(4) DEFAULT NULL,
`kunjungan` char(3) DEFAULT NULL,
`shporpwt` char(8) DEFAULT NULL,
`user` varchar(24) DEFAULT NULL,
`transport` varchar(9) DEFAULT NULL,
`transport_jauh` varchar(9) DEFAULT NULL,
`honor` varchar(9) DEFAULT NULL,
`pemotongan` varchar(128) DEFAULT NULL,
`totalpemotongan` varchar(4) DEFAULT NULL,
`total` varchar(9) DEFAULT NULL,
`paid` varchar(4) DEFAULT NULL,
`paidby` varchar(24) DEFAULT NULL,
`datepaid` datetime DEFAULT NULL,
`noform` varchar(28) DEFAULT NULL,
PRIMARY KEY (`num`)
) ENGINE=MyISAM AUTO_INCREMENT=49993 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `honorlk`
--
DROP TABLE IF EXISTS `honorlk`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `honorlk` (
`num` int(9) NOT NULL AUTO_INCREMENT,
`project` char(4) DEFAULT NULL,
`cabang` char(4) DEFAULT NULL,
`kunjungan` char(3) DEFAULT NULL,
`shporpwt` char(8) DEFAULT NULL,
`user` varchar(24) DEFAULT NULL,
`kota` varchar(128) DEFAULT NULL,
`transport` varchar(9) DEFAULT NULL,
`transport_jauh` varchar(9) DEFAULT NULL,
`honor` varchar(9) DEFAULT NULL,
`pemotongan` varchar(256) DEFAULT NULL,
`totalpemotongan` varchar(8) DEFAULT NULL,
`total` varchar(9) DEFAULT NULL,
`paid` varchar(4) DEFAULT NULL,
`paidby` varchar(24) DEFAULT NULL,
`datepaid` datetime DEFAULT NULL,
`noform` varchar(28) DEFAULT NULL,
`kd_kota` varchar(10) DEFAULT NULL,
PRIMARY KEY (`num`)
) ENGINE=MyISAM AUTO_INCREMENT=45399 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `honorlk_do`
--
DROP TABLE IF EXISTS `honorlk_do`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `honorlk_do` (
`num` int(9) NOT NULL AUTO_INCREMENT,
`project` char(4) DEFAULT NULL,
`cabang` char(4) DEFAULT NULL,
`kunjungan` char(3) DEFAULT NULL,
`shporpwt` char(8) DEFAULT NULL,
`user` varchar(24) DEFAULT NULL,
`kota` varchar(128) DEFAULT NULL,
`transport` varchar(9) DEFAULT NULL,
`transport_jauh` varchar(9) DEFAULT NULL,
`honor` varchar(9) DEFAULT NULL,
`pemotongan` varchar(256) DEFAULT NULL,
`totalpemotongan` varchar(8) DEFAULT NULL,
`total` varchar(9) DEFAULT NULL,
`paid` varchar(4) DEFAULT NULL,
`paidby` varchar(24) DEFAULT NULL,
`datepaid` datetime DEFAULT NULL,
`noform` varchar(28) DEFAULT NULL,
`kd_kota` varchar(10) DEFAULT NULL,
PRIMARY KEY (`num`)
) ENGINE=MyISAM AUTO_INCREMENT=85519 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `honorlk_edit_aktual`
--
DROP TABLE IF EXISTS `honorlk_edit_aktual`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `honorlk_edit_aktual` (
`num` int(9) DEFAULT NULL,
`project` char(4) DEFAULT NULL,
`cabang` char(4) DEFAULT NULL,
`kunjungan` char(3) DEFAULT NULL,
`shporpwt` char(8) DEFAULT NULL,
`user` varchar(24) DEFAULT NULL,
`kota` varchar(128) DEFAULT NULL,
`transport` varchar(9) DEFAULT NULL,
`transport_jauh` varchar(9) DEFAULT NULL,
`honor` varchar(9) DEFAULT NULL,
`pemotongan` varchar(256) DEFAULT NULL,
`totalpemotongan` varchar(8) DEFAULT NULL,
`total` varchar(9) DEFAULT NULL,
`paid` varchar(4) DEFAULT NULL,
`paidby` varchar(24) DEFAULT NULL,
`datepaid` datetime DEFAULT NULL,
`noform` varchar(28) DEFAULT NULL,
`kd_kota` varchar(10) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `honorlk_ulang`
--
DROP TABLE IF EXISTS `honorlk_ulang`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `honorlk_ulang` (
`num` int(9) NOT NULL AUTO_INCREMENT,
`project` char(4) DEFAULT NULL,
`cabang` char(4) DEFAULT NULL,
`kunjungan` char(3) DEFAULT NULL,
`shporpwt` char(8) DEFAULT NULL,
`user` varchar(24) DEFAULT NULL,
`kota` varchar(128) DEFAULT NULL,
`transport` varchar(9) DEFAULT NULL,
`transport_jauh` varchar(9) DEFAULT NULL,
`honor` varchar(9) DEFAULT NULL,
`pemotongan` varchar(256) DEFAULT NULL,
`totalpemotongan` varchar(8) DEFAULT NULL,
`total` varchar(9) DEFAULT NULL,
`paid` varchar(4) DEFAULT NULL,
`paidby` varchar(24) DEFAULT NULL,
`datepaid` datetime DEFAULT NULL,
`noform` varchar(28) DEFAULT NULL,
`kd_kota` varchar(10) DEFAULT NULL,
PRIMARY KEY (`num`)
) ENGINE=MyISAM AUTO_INCREMENT=44782 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `honortl`
--
DROP TABLE IF EXISTS `honortl`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `honortl` (
`num` int(6) NOT NULL AUTO_INCREMENT,
`project` varchar(4) DEFAULT NULL,
`cabang` varchar(3) DEFAULT NULL,
`kunjungan` varchar(3) DEFAULT NULL,
`tl` varchar(8) DEFAULT NULL,
`noform` varchar(128) DEFAULT NULL,
`honor` int(9) DEFAULT NULL,
`etc` varchar(128) DEFAULT '',
PRIMARY KEY (`num`)
) ENGINE=InnoDB AUTO_INCREMENT=10888 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `id_data`
--
DROP TABLE IF EXISTS `id_data`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `id_data` (
`num` int(8) NOT NULL AUTO_INCREMENT,
`Id` varchar(16) NOT NULL,
`Nama` varchar(100) DEFAULT NULL,
`AlmntTgl` varchar(128) DEFAULT NULL,
`KecTgl` varchar(128) DEFAULT NULL,
`KotaTgl` varchar(128) DEFAULT NULL,
`KdPosTgl` varchar(8) DEFAULT NULL,
`PropTgl` varchar(65) DEFAULT NULL,
`Telpon` varchar(65) DEFAULT NULL,
`HP` varchar(65) DEFAULT NULL,
`Email` varchar(65) DEFAULT NULL,
`Foto` varchar(128) DEFAULT NULL,
`JenKel` varchar(24) DEFAULT NULL,
`TptLahir` varchar(65) DEFAULT NULL,
`TglLahir` date DEFAULT NULL,
`Pekerjaan` varchar(128) DEFAULT NULL,
`NmPerusahaan` varchar(128) DEFAULT NULL,
`AlmtPerusahaan` varchar(254) DEFAULT NULL,
`NoTelpPerusahaan` varchar(128) DEFAULT NULL,
`IDNo` varchar(65) DEFAULT NULL,
`IdJen` varchar(18) DEFAULT NULL,
`AlmtID` varchar(128) DEFAULT NULL,
`KotaID` varchar(65) DEFAULT NULL,
`KdPosID` varchar(8) DEFAULT NULL,
`PropID` varchar(65) DEFAULT NULL,
`PicCard` varchar(255) DEFAULT NULL,
`MasaBerlakuID` date DEFAULT NULL,
`TglLamar` date DEFAULT NULL,
`TglRekrut` timestamp NULL DEFAULT NULL,
`Posisi` varchar(128) DEFAULT NULL,
`Referensi` varchar(128) DEFAULT NULL,
`Pendidikan` varchar(64) DEFAULT NULL,
`CodeCV` varchar(128) DEFAULT NULL,
`StaRekrut` varchar(12) DEFAULT NULL,
`status` varchar(6) DEFAULT NULL,
`TglInput` date DEFAULT NULL,
`typeuser` varchar(8) DEFAULT NULL,
`NmIbu` varchar(54) DEFAULT NULL,
`OrgDekat` varchar(54) DEFAULT NULL,
`HubunganOrgDekat` varchar(54) DEFAULT NULL,
`NoTelpOrgDekat` varchar(54) DEFAULT NULL,
`user_create` varchar(20) DEFAULT NULL,
`tanggal` datetime DEFAULT NULL,
`npwp` varchar(50) DEFAULT NULL,
`PicNpwp` varchar(255) DEFAULT NULL,
`staff` tinyint(1) DEFAULT '0',
`password` varchar(255) DEFAULT '<PASSWORD>',
`level` varchar(255) DEFAULT NULL,
`aktif` varchar(10) DEFAULT NULL,
`keterangan_restore` text,
`id_divisi` int(1) DEFAULT NULL,
`id_akses` int(1) DEFAULT NULL,
`link` varchar(255) DEFAULT NULL,
`JenisHP` varchar(50) DEFAULT NULL,
`ProviderHP` varchar(255) DEFAULT NULL,
`rekrut` varchar(255) DEFAULT NULL,
PRIMARY KEY (`num`,`Id`),
KEY `ix_posisi` (`Posisi`) USING BTREE,
KEY `ix_iddt_1` (`Id`,`KecTgl`,`KotaTgl`,`PropID`) USING BTREE
) ENGINE=MyISAM AUTO_INCREMENT=104290 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `id_data_ba`
--
DROP TABLE IF EXISTS `id_data_ba`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `id_data_ba` (
`num` int(11) NOT NULL AUTO_INCREMENT,
`id` varchar(16) NOT NULL,
`nama` varchar(100) DEFAULT NULL,
`kota` varchar(128) DEFAULT NULL,
`posisi` varchar(20) DEFAULT NULL,
`keterangan` text,
`id_pengaju` varchar(255) DEFAULT NULL,
`nama_pengaju` varchar(128) DEFAULT NULL,
`jabatan_pengaju` varchar(128) DEFAULT NULL,
`tgl_pengaju` varchar(128) DEFAULT NULL,
`id_approve` varchar(16) DEFAULT NULL,
`approve` int(1) DEFAULT '0',
`tgl_approve` date DEFAULT NULL,
PRIMARY KEY (`num`,`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `id_data_backup`
--
DROP TABLE IF EXISTS `id_data_backup`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `id_data_backup` (
`num` int(8) NOT NULL AUTO_INCREMENT,
`Id` varchar(16) NOT NULL,
`Nama` varchar(100) DEFAULT NULL,
`AlmntTgl` varchar(128) DEFAULT NULL,
`KecTgl` varchar(128) DEFAULT NULL,
`KotaTgl` varchar(128) DEFAULT NULL,
`KdPosTgl` varchar(8) DEFAULT NULL,
`PropTgl` varchar(65) DEFAULT NULL,
`Telpon` varchar(65) DEFAULT NULL,
`HP` varchar(65) DEFAULT NULL,
`Email` varchar(65) DEFAULT NULL,
`Foto` varchar(128) DEFAULT NULL,
`JenKel` varchar(24) DEFAULT NULL,
`TptLahir` varchar(65) DEFAULT NULL,
`TglLahir` date DEFAULT NULL,
`Pekerjaan` varchar(128) DEFAULT NULL,
`NmPerusahaan` varchar(128) DEFAULT NULL,
`AlmtPerusahaan` varchar(254) DEFAULT NULL,
`NoTelpPerusahaan` varchar(128) DEFAULT NULL,
`IDNo` varchar(65) DEFAULT NULL,
`IdJen` varchar(18) DEFAULT NULL,
`AlmtID` varchar(128) DEFAULT NULL,
`KotaID` varchar(65) DEFAULT NULL,
`KdPosID` varchar(8) DEFAULT NULL,
`PropID` varchar(65) DEFAULT NULL,
`PicCard` varchar(255) DEFAULT NULL,
`MasaBerlakuID` date DEFAULT NULL,
`TglLamar` date DEFAULT NULL,
`TglRekrut` date DEFAULT NULL,
`Posisi` varchar(128) DEFAULT NULL,
`Referensi` varchar(128) DEFAULT NULL,
`Pendidikan` varchar(64) DEFAULT NULL,
`CodeCV` varchar(128) DEFAULT NULL,
`StaRekrut` varchar(12) DEFAULT NULL,
`status` varchar(6) DEFAULT NULL,
`TglInput` date DEFAULT NULL,
`typeuser` varchar(8) DEFAULT NULL,
`NmIbu` varchar(54) DEFAULT NULL,
`OrgDekat` varchar(54) DEFAULT NULL,
`HubunganOrgDekat` varchar(54) DEFAULT NULL,
`NoTelpOrgDekat` varchar(54) DEFAULT NULL,
`user_create` varchar(20) DEFAULT NULL,
`tanggal` datetime DEFAULT NULL,
`npwp` varchar(50) DEFAULT NULL,
`staff` tinyint(1) DEFAULT '0',
`password` varchar(255) DEFAULT '<PASSWORD>',
`level` varchar(255) DEFAULT NULL,
PRIMARY KEY (`num`,`Id`),
KEY `ix_posisi` (`Posisi`) USING BTREE,
KEY `ix_iddt_1` (`Id`,`KecTgl`,`KotaTgl`,`PropID`) USING BTREE
) ENGINE=MyISAM AUTO_INCREMENT=103184 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `id_data_baru`
--
DROP TABLE IF EXISTS `id_data_baru`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `id_data_baru` (
`num` int(8) NOT NULL AUTO_INCREMENT,
`Id` varchar(16) NOT NULL,
`Nama` varchar(100) DEFAULT NULL,
`AlmntTgl` varchar(128) DEFAULT NULL,
`KecTgl` varchar(128) DEFAULT NULL,
`KotaTgl` varchar(128) DEFAULT NULL,
`KdPosTgl` varchar(8) DEFAULT NULL,
`PropTgl` varchar(65) DEFAULT NULL,
`Telpon` varchar(65) DEFAULT NULL,
`HP` varchar(65) DEFAULT NULL,
`Email` varchar(65) DEFAULT NULL,
`Foto` varchar(128) DEFAULT NULL,
`JenKel` varchar(24) DEFAULT NULL,
`TptLahir` varchar(65) DEFAULT NULL,
`TglLahir` date DEFAULT NULL,
`Pekerjaan` varchar(128) DEFAULT NULL,
`NmPerusahaan` varchar(128) DEFAULT NULL,
`AlmtPerusahaan` varchar(254) DEFAULT NULL,
`NoTelpPerusahaan` varchar(128) DEFAULT NULL,
`IDNo` varchar(65) DEFAULT NULL,
`IdJen` varchar(18) DEFAULT NULL,
`AlmtID` varchar(128) DEFAULT NULL,
`KotaID` varchar(65) DEFAULT NULL,
`KdPosID` varchar(8) DEFAULT NULL,
`PropID` varchar(65) DEFAULT NULL,
`PicCard` varchar(255) DEFAULT NULL,
`MasaBerlakuID` date DEFAULT NULL,
`TglLamar` date DEFAULT NULL,
`TglRekrut` date DEFAULT NULL,
`Posisi` varchar(128) DEFAULT NULL,
`Referensi` varchar(128) DEFAULT NULL,
`Pendidikan` varchar(64) DEFAULT NULL,
`CodeCV` varchar(128) DEFAULT NULL,
`StaRekrut` varchar(12) DEFAULT NULL,
`status` varchar(6) DEFAULT NULL,
`TglInput` date DEFAULT NULL,
`typeuser` varchar(8) DEFAULT NULL,
`NmIbu` varchar(54) DEFAULT NULL,
`OrgDekat` varchar(54) DEFAULT NULL,
`HubunganOrgDekat` varchar(54) DEFAULT NULL,
`NoTelpOrgDekat` varchar(54) DEFAULT NULL,
`user_create` varchar(20) DEFAULT NULL,
`tanggal` datetime DEFAULT NULL,
`npwp` varchar(50) DEFAULT NULL,
`staff` tinyint(1) DEFAULT '0',
`password` varchar(255) DEFAULT '<PASSWORD>',
`level` varchar(255) DEFAULT NULL,
PRIMARY KEY (`num`,`Id`),
KEY `ix_posisi` (`Posisi`) USING BTREE,
KEY `ix_iddt_1` (`Id`,`KecTgl`,`KotaTgl`,`PropID`) USING BTREE
) ENGINE=MyISAM AUTO_INCREMENT=103217 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `id_data_trash`
--
DROP TABLE IF EXISTS `id_data_trash`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `id_data_trash` (
`num` int(8) NOT NULL AUTO_INCREMENT,
`Id` varchar(16) NOT NULL,
`Nama` varchar(100) DEFAULT NULL,
`AlmntTgl` varchar(128) DEFAULT NULL,
`KecTgl` varchar(128) DEFAULT NULL,
`KotaTgl` varchar(128) DEFAULT NULL,
`KdPosTgl` varchar(8) DEFAULT NULL,
`PropTgl` varchar(65) DEFAULT NULL,
`Telpon` varchar(65) DEFAULT NULL,
`HP` varchar(65) DEFAULT NULL,
`Email` varchar(65) DEFAULT NULL,
`Foto` varchar(128) DEFAULT NULL,
`JenKel` varchar(24) DEFAULT NULL,
`TptLahir` varchar(65) DEFAULT NULL,
`TglLahir` date DEFAULT NULL,
`Pekerjaan` varchar(128) DEFAULT NULL,
`NmPerusahaan` varchar(128) DEFAULT NULL,
`AlmtPerusahaan` varchar(254) DEFAULT NULL,
`NoTelpPerusahaan` varchar(128) DEFAULT NULL,
`IDNo` varchar(65) DEFAULT NULL,
`IdJen` varchar(18) DEFAULT NULL,
`AlmtID` varchar(128) DEFAULT NULL,
`KotaID` varchar(65) DEFAULT NULL,
`KdPosID` varchar(8) DEFAULT NULL,
`PropID` varchar(65) DEFAULT NULL,
`PicCard` varchar(255) DEFAULT NULL,
`MasaBerlakuID` date DEFAULT NULL,
`TglLamar` date DEFAULT NULL,
`TglRekrut` date DEFAULT NULL,
`Posisi` varchar(128) DEFAULT NULL,
`Referensi` varchar(128) DEFAULT NULL,
`Pendidikan` varchar(64) DEFAULT NULL,
`CodeCV` varchar(128) DEFAULT NULL,
`StaRekrut` varchar(12) DEFAULT NULL,
`status` varchar(6) DEFAULT NULL,
`TglInput` date DEFAULT NULL,
`typeuser` varchar(8) DEFAULT NULL,
`NmIbu` varchar(54) DEFAULT NULL,
`OrgDekat` varchar(54) DEFAULT NULL,
`HubunganOrgDekat` varchar(54) DEFAULT NULL,
`NoTelpOrgDekat` varchar(54) DEFAULT NULL,
`user_create` varchar(20) DEFAULT NULL,
`tanggal` datetime DEFAULT NULL,
`keterangan_blacklist` text,
`tgl_blacklist` date DEFAULT NULL,
PRIMARY KEY (`num`,`Id`),
KEY `ix_posisi` (`Posisi`),
KEY `ix_iddt_1` (`Id`,`KecTgl`,`KotaTgl`,`PropID`)
) ENGINE=MyISAM AUTO_INCREMENT=100546 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `inbox`
--
DROP TABLE IF EXISTS `inbox`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `inbox` (
`UpdatedInDB` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`ReceivingDateTime` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
`Text` text NOT NULL,
`SenderNumber` varchar(20) NOT NULL DEFAULT '',
`Coding` enum('Default_No_Compression','Unicode_No_Compression','8bit','Default_Compression','Unicode_Compression') NOT NULL DEFAULT 'Default_No_Compression',
`UDH` text NOT NULL,
`SMSCNumber` varchar(20) NOT NULL DEFAULT '',
`Class` int(11) NOT NULL DEFAULT '-1',
`TextDecoded` varchar(160) NOT NULL DEFAULT '',
`ID` int(10) unsigned NOT NULL AUTO_INCREMENT,
`RecipientID` text NOT NULL,
`Processed` enum('false','true') NOT NULL DEFAULT 'false',
`deleted` varchar(1) DEFAULT '',
`Readed` enum('true','false') DEFAULT 'false',
PRIMARY KEY (`ID`)
) ENGINE=MyISAM AUTO_INCREMENT=40880 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `inbox_modif`
--
DROP TABLE IF EXISTS `inbox_modif`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `inbox_modif` (
`UpdatedInDB` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`ReceivingDateTime` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
`Text` text NOT NULL,
`SenderNumber` varchar(20) NOT NULL,
`Coding` enum('Default_No_Compression','Unicode_No_Compression','8bit','Default_Compression','Unicode_Compression') NOT NULL DEFAULT 'Default_No_Compression',
`UDH` text NOT NULL,
`SMSCNumber` varchar(20) NOT NULL DEFAULT '',
`Class` int(11) NOT NULL DEFAULT '-1',
`TextDecoded` varchar(160) NOT NULL DEFAULT '',
`ID` int(10) unsigned NOT NULL,
`RecipientID` text NOT NULL,
`Processed` enum('false','true') NOT NULL DEFAULT 'false',
`deleted` varchar(1) DEFAULT '',
`Readed` enum('true','false') DEFAULT 'false',
PRIMARY KEY (`ID`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `jakarta_kota_list`
--
DROP TABLE IF EXISTS `jakarta_kota_list`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `jakarta_kota_list` (
`id` int(12) NOT NULL AUTO_INCREMENT,
`kota` varchar(50) NOT NULL,
`aktif` enum('yes','no') NOT NULL DEFAULT 'yes',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=40 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `jenis_training`
--
DROP TABLE IF EXISTS `jenis_training`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `jenis_training` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`keterangan` varchar(100) NOT NULL,
`created_at` datetime DEFAULT NULL,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `kanwil`
--
DROP TABLE IF EXISTS `kanwil`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `kanwil` (
`num` int(4) NOT NULL AUTO_INCREMENT,
`projek` varchar(4) NOT NULL DEFAULT '',
`kode` varchar(3) DEFAULT NULL,
`kodekanwil` varchar(3) DEFAULT NULL,
PRIMARY KEY (`num`,`projek`)
) ENGINE=InnoDB AUTO_INCREMENT=321 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `kelompok_menu`
--
DROP TABLE IF EXISTS `kelompok_menu`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `kelompok_menu` (
`id_menu` int(11) NOT NULL AUTO_INCREMENT,
`id_divisi` int(11) DEFAULT NULL,
`urut` int(11) DEFAULT NULL,
`nama_menu` varchar(50) DEFAULT NULL,
`control_menu` varchar(100) DEFAULT NULL,
`sub` int(11) DEFAULT NULL,
`icon` varchar(50) DEFAULT NULL,
`status` varchar(20) DEFAULT NULL,
PRIMARY KEY (`id_menu`)
) ENGINE=InnoDB AUTO_INCREMENT=59 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `kelompok_submenu`
--
DROP TABLE IF EXISTS `kelompok_submenu`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `kelompok_submenu` (
`id_submenu` int(11) NOT NULL AUTO_INCREMENT,
`id_menu` int(11) DEFAULT NULL,
`urut` int(11) DEFAULT NULL,
`nama_submenu` varchar(100) DEFAULT NULL,
`control_submenu` varchar(100) DEFAULT NULL,
PRIMARY KEY (`id_submenu`)
) ENGINE=InnoDB AUTO_INCREMENT=102 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `konsistensi`
--
DROP TABLE IF EXISTS `konsistensi`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `konsistensi` (
`id` int(20) NOT NULL AUTO_INCREMENT,
`project` char(4) DEFAULT NULL,
`project_name` varchar(100) DEFAULT NULL,
`unique` varchar(255) DEFAULT NULL,
`serial` varchar(100) DEFAULT NULL,
`code` varchar(11) DEFAULT NULL,
`cabang` varchar(15) DEFAULT NULL,
`z3` text,
`variable` varchar(15) DEFAULT NULL,
`kode` char(11) DEFAULT NULL,
`check` text,
`verifikasi` varchar(100) DEFAULT NULL,
`final_code` varchar(50) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=140 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `konsistensi_query`
--
DROP TABLE IF EXISTS `konsistensi_query`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `konsistensi_query` (
`num` int(11) NOT NULL AUTO_INCREMENT,
`query` text,
PRIMARY KEY (`num`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `kota`
--
DROP TABLE IF EXISTS `kota`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `kota` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`kode` varchar(10) DEFAULT NULL,
`nm_kelurahan` varchar(255) DEFAULT NULL,
`nm_kecamatan` varchar(255) DEFAULT NULL,
`nm_kota` varchar(50) DEFAULT NULL,
`nm_provinsi` varchar(50) DEFAULT NULL,
`kode_pos` varchar(255) DEFAULT NULL,
`nm_pulau` varchar(50) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=76 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `last_sinkron`
--
DROP TABLE IF EXISTS `last_sinkron`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `last_sinkron` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`time` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `log`
--
DROP TABLE IF EXISTS `log`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `log` (
`num` int(11) NOT NULL AUTO_INCREMENT,
`noid` varchar(10) DEFAULT NULL,
`tanggal` datetime DEFAULT NULL,
`activity` text,
PRIMARY KEY (`num`)
) ENGINE=InnoDB AUTO_INCREMENT=227182 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `logpoin`
--
DROP TABLE IF EXISTS `logpoin`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `logpoin` (
`num` int(6) NOT NULL AUTO_INCREMENT,
`id` varchar(16) DEFAULT NULL,
`tanggal` date DEFAULT NULL,
`namabarang` varchar(255) DEFAULT NULL,
`poin` int(4) DEFAULT NULL,
PRIMARY KEY (`num`)
) ENGINE=InnoDB AUTO_INCREMENT=14 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `materi_training`
--
DROP TABLE IF EXISTS `materi_training`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `materi_training` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`training_id` int(11) NOT NULL,
`user_noid` int(11) NOT NULL,
`materi` varchar(100) NOT NULL,
`tanggal_mulai` date NOT NULL,
`tanggal_selesai` date NOT NULL,
`jam_mulai` time NOT NULL,
`jam_selesai` time NOT NULL,
`created_at` datetime DEFAULT NULL,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=12 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `matrix_cut_off`
--
DROP TABLE IF EXISTS `matrix_cut_off`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `matrix_cut_off` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`tgl_berlaku` date NOT NULL,
`rule` tinyint(1) NOT NULL DEFAULT '2',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `matrix_honor_sdm_field`
--
DROP TABLE IF EXISTS `matrix_honor_sdm_field`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `matrix_honor_sdm_field` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`jeniskota` varchar(10) NOT NULL,
`posisi` varchar(50) NOT NULL,
`status` varchar(50) NOT NULL,
`produktivitas` int(11) NOT NULL,
`produktivitas_lk` int(11) DEFAULT NULL,
`supervisi_mitra` int(11) NOT NULL DEFAULT '0',
`supervisi_kontrak` int(11) NOT NULL DEFAULT '0',
`training` int(11) NOT NULL,
`insentif_timeline` int(11) NOT NULL,
`insentif_kaderisasi` int(11) NOT NULL,
`insentif_upload` int(11) NOT NULL,
`penalti_pengulangan` int(11) NOT NULL,
`penalti_keterlambatan_upload` int(11) NOT NULL,
`penalti_keterlambatan_timeline` int(11) NOT NULL,
`penalti_kaderisasi` int(11) NOT NULL,
`user_update` int(11) NOT NULL,
`created_at` date NOT NULL,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `matrix_perdin`
--
DROP TABLE IF EXISTS `matrix_perdin`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `matrix_perdin` (
`num` int(11) NOT NULL AUTO_INCREMENT,
`kota_asal` varchar(100) NOT NULL,
`kota_tujuan` varchar(100) NOT NULL,
`perdin` int(11) DEFAULT NULL,
PRIMARY KEY (`num`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `matrixhonor`
--
DROP TABLE IF EXISTS `matrixhonor`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `matrixhonor` (
`num` int(9) NOT NULL AUTO_INCREMENT,
`project` varchar(24) DEFAULT NULL,
`typehonor` varchar(24) DEFAULT NULL,
`burek` varchar(24) DEFAULT NULL,
`turek` varchar(24) DEFAULT NULL,
`komplain` varchar(24) DEFAULT NULL,
`tanyainfo` varchar(24) DEFAULT NULL,
`cs` varchar(24) DEFAULT NULL,
`teller` varchar(24) DEFAULT NULL,
`cabterpencil` varchar(24) DEFAULT NULL,
`retur` varchar(24) DEFAULT NULL,
`atmnoninstant` varchar(24) DEFAULT NULL,
`atmmalam` varchar(24) DEFAULT NULL,
`atmmalamcabterpencil` varchar(24) DEFAULT NULL,
`telponburek` varchar(24) DEFAULT NULL,
`telponbiasa` varchar(24) DEFAULT NULL,
`etc1` varchar(24) DEFAULT NULL,
`etc2` varchar(24) DEFAULT NULL,
`setorburek` varchar(24) DEFAULT NULL,
`tarik` varchar(24) DEFAULT NULL,
`tukar` varchar(24) DEFAULT NULL,
`tellerterpisah` varchar(24) DEFAULT NULL,
`ktlterbilang` varchar(24) DEFAULT NULL,
`satpam` varchar(24) DEFAULT NULL,
`transferdebet` varchar(24) DEFAULT NULL,
`ktljumlah` varchar(24) DEFAULT NULL,
`atmcenterweekday` varchar(24) DEFAULT NULL,
`atmcenterweekend` varchar(24) DEFAULT NULL,
`prasyarat` varchar(24) DEFAULT NULL,
`atmcabangemoney` varchar(24) DEFAULT NULL,
`ontime` varchar(24) DEFAULT NULL,
`ontime2` varchar(24) DEFAULT NULL,
`emoney` varchar(24) DEFAULT NULL,
`nasabah` varchar(24) DEFAULT NULL,
`nonnasabah` varchar(24) DEFAULT NULL,
`wdq5` varchar(24) DEFAULT NULL,
`weq5` varchar(24) DEFAULT NULL,
`wdq6` varchar(24) DEFAULT NULL,
`weq6` varchar(24) DEFAULT NULL,
`prakuq2` varchar(24) DEFAULT NULL,
`prakuq3` varchar(24) DEFAULT NULL,
`atmcenter_wds` varchar(24) DEFAULT NULL,
`merchant_wd` varchar(24) DEFAULT NULL,
`merchant_we` varchar(24) DEFAULT NULL,
`atmarea_wd` varchar(24) DEFAULT NULL,
`atmarea_we` varchar(24) DEFAULT NULL,
`carrefour_wd` varchar(24) DEFAULT NULL,
`carrefour_we` varchar(24) DEFAULT NULL,
`parkir_wd` varchar(24) DEFAULT NULL,
`parkir_we` varchar(24) DEFAULT NULL,
`minimarket_wd` varchar(24) DEFAULT NULL,
`minimarket_we` varchar(24) DEFAULT NULL,
`tol_wd` varchar(24) DEFAULT NULL,
`krl_busway_wd` varchar(24) DEFAULT NULL,
`tol_we` varchar(24) DEFAULT NULL,
`krl_busway_we` varchar(24) DEFAULT NULL,
`bayarkk_wd` varchar(24) DEFAULT NULL,
`bayarkk_we` varchar(24) DEFAULT NULL,
`cut_off_id` int(11) DEFAULT NULL,
PRIMARY KEY (`num`)
) ENGINE=MyISAM AUTO_INCREMENT=790 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `matrixhonorlk`
--
DROP TABLE IF EXISTS `matrixhonorlk`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `matrixhonorlk` (
`num` int(9) NOT NULL AUTO_INCREMENT,
`project` varchar(24) DEFAULT NULL,
`model` varchar(54) DEFAULT NULL,
`typehonor` varchar(24) DEFAULT NULL,
`burek` varchar(24) DEFAULT NULL,
`turek` varchar(24) DEFAULT NULL,
`komplain` varchar(24) DEFAULT NULL,
`tanyainfo` varchar(24) DEFAULT NULL,
`cs` varchar(24) DEFAULT NULL,
`teller` varchar(24) DEFAULT NULL,
`cabterpencil` varchar(24) DEFAULT NULL,
`retur` varchar(24) DEFAULT NULL,
`atmnoninstant` varchar(24) DEFAULT NULL,
`atmmalam` varchar(24) DEFAULT NULL,
`atmmalamcabterpencil` varchar(24) DEFAULT NULL,
`telponburek` varchar(24) DEFAULT NULL,
`telponbiasa` varchar(24) DEFAULT NULL,
`etc1` varchar(24) DEFAULT '',
`etc2` varchar(24) DEFAULT NULL,
`trfphoneplus` varchar(24) DEFAULT NULL,
`setorburek` varchar(24) DEFAULT NULL,
`tarik` varchar(24) DEFAULT NULL,
`tukar` varchar(24) DEFAULT NULL,
`tellerterpisah` varchar(24) DEFAULT NULL,
`ktlterbilang` varchar(24) DEFAULT NULL,
`satpam` varchar(24) DEFAULT NULL,
`transferdebet` varchar(24) DEFAULT NULL,
`ktljumlah` varchar(24) DEFAULT NULL,
`prasyarat` varchar(24) DEFAULT NULL,
`atmcabangemoney` varchar(24) DEFAULT NULL,
`ontime` varchar(24) DEFAULT NULL,
`ontime2` varchar(24) DEFAULT NULL,
`emoney` varchar(24) DEFAULT NULL,
`nasabah` varchar(24) DEFAULT NULL,
`nonnasabah` varchar(24) DEFAULT NULL,
`wdq5` varchar(24) DEFAULT NULL,
`weq5` varchar(24) DEFAULT NULL,
`wdq6` varchar(24) DEFAULT NULL,
`weq6` varchar(24) DEFAULT NULL,
`wd1q7` varchar(24) DEFAULT NULL,
`wd2q7` varchar(24) DEFAULT NULL,
`weq7` varchar(24) DEFAULT NULL,
`wdq8` varchar(24) DEFAULT NULL,
`weq8` varchar(24) DEFAULT NULL,
`prakuq2` varchar(24) DEFAULT NULL,
`prakuq3` varchar(24) DEFAULT NULL,
`atmcenterweekday` varchar(24) DEFAULT NULL,
`atmcenterweekend` varchar(24) DEFAULT NULL,
`atmcenter_wds` varchar(24) DEFAULT NULL,
PRIMARY KEY (`num`)
) ENGINE=MyISAM AUTO_INCREMENT=872 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `matrixpotongan`
--
DROP TABLE IF EXISTS `matrixpotongan`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `matrixpotongan` (
`id_matrix` int(8) NOT NULL AUTO_INCREMENT,
`project` varchar(8) NOT NULL,
`kode_att` varchar(8) NOT NULL COMMENT 'Kode Attribute yang diulang',
`pemotongan_honor` varchar(24) NOT NULL COMMENT 'Jumlah Pemotongan Honor',
`posisi` enum('shp','pwt','shi') DEFAULT 'shp' COMMENT 'Posisi User',
`persen` enum('no','yes') NOT NULL,
PRIMARY KEY (`id_matrix`)
) ENGINE=InnoDB AUTO_INCREMENT=973 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `matrixprobing`
--
DROP TABLE IF EXISTS `matrixprobing`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `matrixprobing` (
`id` int(8) NOT NULL AUTO_INCREMENT COMMENT 'ID Honor Probing',
`project` char(4) NOT NULL COMMENT 'Kode Project || ALL jika masih bersifat global',
`regional` enum('kota1','kota2','kota3','kota4','jakarta') NOT NULL COMMENT 'Regional Sesuai Kota',
`tipe_honor` enum('shp','pwt','shi') NOT NULL COMMENT 'Honor untuk SHP / PWT / SHI',
`honor_probing` int(6) NOT NULL COMMENT 'Angka honor probing',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `matrixtl`
--
DROP TABLE IF EXISTS `matrixtl`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `matrixtl` (
`num` int(8) NOT NULL AUTO_INCREMENT,
`project` varchar(4) DEFAULT NULL,
`attribut` varchar(3) DEFAULT NULL,
`honor` int(9) DEFAULT NULL,
PRIMARY KEY (`num`)
) ENGINE=InnoDB AUTO_INCREMENT=496 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `menu`
--
DROP TABLE IF EXISTS `menu`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `menu` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`label` varchar(50) NOT NULL DEFAULT '',
`link` varchar(100) NOT NULL DEFAULT '#',
`parent` int(11) NOT NULL DEFAULT '0',
`sort` int(11) DEFAULT NULL,
`pid` varchar(5) DEFAULT NULL,
`permission` text,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=92 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `mprovinsi`
--
DROP TABLE IF EXISTS `mprovinsi`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `mprovinsi` (
`num` int(3) NOT NULL AUTO_INCREMENT,
`nmprovinsi` varchar(60) DEFAULT NULL,
`kode` varchar(3) DEFAULT NULL,
PRIMARY KEY (`num`)
) ENGINE=InnoDB AUTO_INCREMENT=34 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `mx_honor_prod`
--
DROP TABLE IF EXISTS `mx_honor_prod`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `mx_honor_prod` (
`id` int(4) NOT NULL AUTO_INCREMENT,
`project` char(4) NOT NULL,
`user_id` int(4) NOT NULL,
`bagian` char(20) NOT NULL,
`grade` char(20) DEFAULT NULL,
`honor_q_besar` int(8) NOT NULL COMMENT 'Jumlah Honor Quest Besar',
`honor_q_kecil` int(8) NOT NULL COMMENT 'Jumlah Honor Quest Kecil',
`aktif` enum('y','n') NOT NULL DEFAULT 'y',
`created_by` char(4) DEFAULT NULL,
`created_date` datetime DEFAULT NULL,
`updated_by` char(4) DEFAULT NULL,
`updated_date` datetime DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `noformlk`
--
DROP TABLE IF EXISTS `noformlk`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `noformlk` (
`num` int(8) NOT NULL AUTO_INCREMENT,
`noform` varchar(24) NOT NULL,
`periode` varchar(128) DEFAULT NULL,
`t |
<filename>estoque_mercearia_banco_teste.sql<gh_stars>0
-- phpMyAdmin SQL Dump
-- version 4.1.14
-- http://www.phpmyadmin.net
--
-- Host: 127.0.0.1
-- Generation Time: 30-Mar-2017 às 07:21
-- Versão do servidor: 5.6.17
-- PHP Version: 5.5.12
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
--
-- Database: `estoque_mercearia`
--
-- --------------------------------------------------------
--
-- Estrutura da tabela `categorias`
--
CREATE TABLE IF NOT EXISTS `categorias` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`nome` varchar(255) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `nome` (`nome`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=39 ;
--
-- Extraindo dados da tabela `categorias`
--
INSERT INTO `categorias` (`id`, `nome`) VALUES
(38, 'Automotivo'),
(36, 'Carnes'),
(24, 'Cereais');
-- --------------------------------------------------------
--
-- Estrutura da tabela `distribuidor`
--
CREATE TABLE IF NOT EXISTS `distribuidor` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`nome` varchar(255) NOT NULL,
`cnpj` varchar(18) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `cnpj` (`cnpj`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=11 ;
--
-- Extraindo dados da tabela `distribuidor`
--
INSERT INTO `distribuidor` (`id`, `nome`, `cnpj`) VALUES
(4, 'Clorox', '34.666.075/0001-28'),
(9, '<NAME>', '30.123.237/0001-20');
-- --------------------------------------------------------
--
-- Estrutura da tabela `lotes`
--
CREATE TABLE IF NOT EXISTS `lotes` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`distribuidor` int(8) NOT NULL,
PRIMARY KEY (`id`),
KEY `Lotes_fk0` (`distribuidor`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Estrutura da tabela `podutoslotes`
--
CREATE TABLE IF NOT EXISTS `podutoslotes` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`produto_id` int(11) NOT NULL,
`lote_id` int(11) NOT NULL,
PRIMARY KEY (`id`),
KEY `PodutosLotes_fk0` (`produto_id`),
KEY `PodutosLotes_fk1` (`lote_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Estrutura da tabela `produtos`
--
CREATE TABLE IF NOT EXISTS `produtos` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`descricao` varchar(255) NOT NULL,
`categoria_id` int(255) NOT NULL,
`codBarras` varchar(15) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `descricao` (`descricao`),
UNIQUE KEY `descricao_2` (`descricao`),
UNIQUE KEY `descricao_3` (`descricao`),
KEY `Produtos_fk0` (`categoria_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=10 ;
--
-- Extraindo dados da tabela `produtos`
--
INSERT INTO `produtos` (`id`, `descricao`, `categoria_id`, `codBarras`) VALUES
(8, '<NAME>', 24, '545445445545458'),
(9, '<NAME>', 24, '54544544554533');
--
-- Constraints for dumped tables
--
--
-- Limitadores para a tabela `lotes`
--
ALTER TABLE `lotes`
ADD CONSTRAINT `Lotes_fk0` FOREIGN KEY (`distribuidor`) REFERENCES `distribuidor` (`id`);
--
-- Limitadores para a tabela `podutoslotes`
--
ALTER TABLE `podutoslotes`
ADD CONSTRAINT `PodutosLotes_fk1` FOREIGN KEY (`lote_id`) REFERENCES `lotes` (`id`),
ADD CONSTRAINT `PodutosLotes_fk0` FOREIGN KEY (`produto_id`) REFERENCES `produtos` (`id`);
--
-- Limitadores para a tabela `produtos`
--
ALTER TABLE `produtos`
ADD CONSTRAINT `Produtos_fk0` FOREIGN KEY (`categoria_id`) REFERENCES `categorias` (`id`);
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
<reponame>cscl-git/digit-bpa<filename>egov/egov-edcr/src/main/resources/db/migration/main/V20180514182044__edcr_application_add_columns.sql<gh_stars>0
Alter TABLE edcr_application ADD COLUMN occupancy CHARACTER VARYING (256);
Alter TABLE edcr_application ADD COLUMN applicantname CHARACTER VARYING (256);
Alter TABLE edcr_application ADD COLUMN architectInformation CHARACTER VARYING (256);
alter table edcr_application ADD COLUMN serviceType character varying(50);
alter table edcr_application ADD COLUMN amenities character varying(200); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.