-- phpMyAdmin SQL Dump
-- version 5.2.1
-- https://www.phpmyadmin.net/
--
-- Host: localhost:3306
-- Generation Time: Jul 03, 2024 at 08:19 AM
-- Server version: 8.0.37
-- PHP Version: 8.1.28

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: `kijani_quiz`
--

-- --------------------------------------------------------

--
-- Table structure for table `categories`
--

CREATE TABLE `categories` (
  `category_id` int NOT NULL,
  `category_name` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=	utf8mb4_general_ci;

--
-- Dumping data for table `categories`
--

INSERT INTO `categories` (`category_id`, `category_name`) VALUES
(1, 'General'),
(2, 'Parish Coordinators'),
(3, 'Branch Managers'),
(4, 'Executives'),
(5, 'Executives'),
(6, 'Executives'),
(7, 'Executives'),
(8, 'Executives'),
(9, 'Executives'),
(10, 'Executives'),
(11, 'Executives'),
(12, 'Executives'),
(13, 'Executives'),
(14, 'Executives'),
(15, 'Executives2'),
(16, 'Executives2'),
(17, 'Executives2'),
(18, 'Executives2'),
(19, 'Executives3'),
(20, 'Executives4'),
(21, 'Executives5'),
(22, 'Executives6'),
(23, 'Executives2'),
(24, 'Executives3'),
(25, 'Executives4'),
(26, 'Executives5'),
(27, 'Executives6'),
(28, 'Executives2'),
(29, 'Executives3'),
(30, 'Executives4'),
(31, ''),
(32, ''),
(33, 'Executives2'),
(34, ''),
(35, ''),
(36, ''),
(37, ''),
(38, 'Executives2'),
(39, ''),
(40, ''),
(41, ''),
(42, ''),
(43, 'Executives2'),
(44, 'Executives3'),
(45, 'Executives4'),
(46, ''),
(47, ''),
(48, 'Executives5'),
(49, 'Executives5'),
(50, 'Executives5'),
(51, 'Executives5'),
(52, 'Executives5'),
(53, 'Executives5'),
(54, 'Executives5'),
(55, 'Executives5'),
(56, 'Executives5'),
(57, 'Executives5'),
(58, 'Executives5'),
(59, 'Executives5'),
(60, 'Executives5'),
(61, 'Executives5'),
(62, 'Executives5'),
(63, 'New Team'),
(64, 'New Team'),
(65, 'New Team'),
(66, 'New Team'),
(67, 'dev'),
(68, 'it');

-- --------------------------------------------------------

--
-- Table structure for table `options`
--

CREATE TABLE `options` (
  `option_id` int NOT NULL,
  `question_id` int NOT NULL,
  `option_text` text,
  `is_correct` tinyint(1) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=	utf8mb4_general_ci;

--
-- Dumping data for table `options`
--

INSERT INTO `options` (`option_id`, `question_id`, `option_text`, `is_correct`) VALUES
(1, 1, 'Bobby', 0),
(2, 1, 'M7', 1),
(3, 1, 'Kabaka', 0),
(4, 1, 'Quinn', 0),
(5, 2, 'Value Added Tax', 1),
(6, 2, 'Value Added Taxd', 0),
(7, 2, 'DD', 0),
(8, 2, 'wwd', 0),
(9, 3, 'Green', 0),
(10, 3, 'Euro', 1),
(11, 3, 'Bobby', 0),
(12, 3, 'Kampala', 0),
(13, 4, 'United States of Africa', 0),
(14, 4, 'United States of America', 1),
(15, 4, 'Uganda Solutions of Africa', 0),
(16, 4, 'UAE', 0),
(17, 5, 'Euro', 0),
(18, 5, 'DD', 1),
(19, 5, 'at least 50', 0),
(20, 5, 'Euro33', 0),
(21, 6, 'eretwert', 0),
(22, 6, 'wertewrt', 1),
(23, 6, 'wrtwert', 0),
(24, 6, 'wetrerttrwet', 0),
(25, 7, 'safsdf', 0),
(26, 7, 'asfsdfs', 1),
(27, 7, 'avdbb', 0),
(28, 7, 'btrbrrt', 0),
(29, 8, 'asdf', 0),
(30, 8, 'j65j', 1),
(31, 8, '66', 0),
(32, 8, 'rh5', 0),
(33, 9, 'dsgfdg', 0),
(34, 9, 'sdfgfd', 1),
(35, 9, 'hdsh', 0),
(36, 9, 'jtrtjrtj', 0),
(37, 10, 'Kemi', 0),
(38, 10, 'Komu', 0),
(39, 10, 'Keino', 1),
(40, 10, 'Kem', 0),
(41, 11, 'A', 0),
(42, 11, 'B', 1),
(43, 11, 'C', 0),
(44, 11, 'D', 0),
(45, 12, '9', 0),
(46, 12, '10', 0),
(47, 12, '14', 1),
(48, 12, '8', 0);

-- --------------------------------------------------------

--
-- Table structure for table `questions`
--

CREATE TABLE `questions` (
  `question_id` int NOT NULL,
  `question_text` text,
  `topic_id` int DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=	utf8mb4_general_ci;

--
-- Dumping data for table `questions`
--

INSERT INTO `questions` (`question_id`, `question_text`, `topic_id`) VALUES
(1, 'Who is the president of Uganda', 1),
(2, 'What is VAT', 1),
(3, 'World Currency', 2),
(4, 'What does USA stand for', 3),
(5, 'what is the capital city of uganda', 1),
(6, 'Waa', 1),
(7, '222222222222224444444444444gg', 2),
(8, 'Whats your best colo', 3),
(9, 'dfgdg', 4),
(10, 'What is Josina\'s Last Name', 6),
(11, 'Who is the president of Uganda today', 7),
(12, 'latest android version', 9);

-- --------------------------------------------------------

--
-- Table structure for table `responses`
--

CREATE TABLE `responses` (
  `response_id` int NOT NULL,
  `user_id` int NOT NULL,
  `question_id` int NOT NULL,
  `option_id` int NOT NULL,
  `created_at` datetime DEFAULT CURRENT_TIMESTAMP,
  `score` int NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=	utf8mb4_general_ci;

--
-- Dumping data for table `responses`
--

INSERT INTO `responses` (`response_id`, `user_id`, `question_id`, `option_id`, `created_at`, `score`) VALUES
(1, 2, 1, 2, '2024-05-21 23:02:27', 0),
(2, 4, 1, 4, '2024-05-21 23:03:09', 0),
(3, 6, 1, 3, '2024-05-21 23:04:14', 0),
(4, 4, 1, 4, '2024-05-21 23:04:39', 0),
(5, 4, 1, 3, '2024-05-21 23:07:28', 0),
(6, 10, 1, 2, '2024-05-21 23:07:42', 0),
(7, 4, 1, 3, '2024-05-21 23:08:13', 0),
(8, 4, 1, 2, '2024-05-21 23:08:23', 0),
(9, 14, 1, 3, '2024-05-21 23:08:37', 0),
(10, 15, 1, 4, '2024-05-21 23:19:08', 0),
(11, 16, 1, 2, '2024-05-21 23:20:04', 0),
(12, 16, 1, 4, '2024-05-21 23:20:32', 0),
(13, 17, 1, 1, '2024-05-21 23:20:56', 0),
(14, 18, 1, 2, '2024-05-21 23:35:12', 0),
(15, 4, 1, 3, '2024-05-22 00:55:37', 0),
(16, 4, 2, 6, '2024-05-22 00:55:37', 0),
(17, 4, 5, 19, '2024-05-22 00:55:37', 0),
(18, 19, 9, 35, '2024-05-22 01:22:26', 0),
(19, 2, 1, 2, '2024-05-23 16:44:09', 0),
(20, 2, 2, 5, '2024-05-23 16:44:09', 0),
(21, 2, 5, 19, '2024-05-23 16:44:09', 0),
(22, 2, 6, 24, '2024-05-23 16:44:09', 0),
(23, 2, 1, 2, '2024-06-24 08:41:52', 0),
(24, 2, 2, 5, '2024-06-24 08:41:52', 0),
(25, 2, 5, 19, '2024-06-24 08:41:52', 0),
(26, 2, 6, 24, '2024-06-24 08:41:52', 0),
(27, 49, 12, 47, '2024-06-24 08:55:47', 0),
(28, 2, 1, 2, '2024-06-24 10:49:05', 0),
(29, 2, 2, 5, '2024-06-24 10:49:05', 0),
(30, 2, 5, 17, '2024-06-24 10:49:05', 0),
(31, 2, 6, 23, '2024-06-24 10:49:05', 0),
(32, 4, 1, 2, '2024-06-24 11:00:19', 0),
(33, 4, 2, 8, '2024-06-24 11:00:19', 0),
(34, 4, 5, 18, '2024-06-24 11:00:19', 0),
(35, 4, 6, 21, '2024-06-24 11:00:19', 0);

-- --------------------------------------------------------

--
-- Table structure for table `topics`
--

CREATE TABLE `topics` (
  `topic_id` int NOT NULL,
  `topic_name` varchar(255) NOT NULL,
  `category_id` int NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=	utf8mb4_general_ci;

--
-- Dumping data for table `topics`
--

INSERT INTO `topics` (`topic_id`, `topic_name`, `category_id`) VALUES
(1, 'General', 1),
(2, 'Nusery Quiz', 2),
(3, 'Computers', 3),
(4, 'fadgdg', 4),
(5, 'Rrrrrrrr', 2),
(6, 'Josina\'s Profile', 4),
(7, 'Questions Only', 63),
(8, 'Emmitt Douglas', 66),
(9, 'app dev', 67),
(10, 'survey on programming', 68);

-- --------------------------------------------------------

--
-- Table structure for table `users`
--

CREATE TABLE `users` (
  `user_id` int NOT NULL,
  `email` varchar(255) NOT NULL,
  `category_id` int NOT NULL,
  `created_at` datetime DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=	utf8mb4_general_ci;

--
-- Dumping data for table `users`
--

INSERT INTO `users` (`user_id`, `email`, `category_id`, `created_at`) VALUES
(2, 'my2allan@kijaniforestry.com', 1, '2024-05-21 23:02:27'),
(4, 'allan@kijaniforestry.com', 1, '2024-05-21 23:03:09'),
(6, 'uganda@kijaniforestry.com', 1, '2024-05-21 23:04:14'),
(10, 'wallan@kijaniforestry.com', 1, '2024-05-21 23:07:42'),
(14, 'alwewelan@kijaniforestry.com', 1, '2024-05-21 23:08:37'),
(15, 'allanbebebe@kijaniforestry.com', 1, '2024-05-21 23:19:08'),
(16, 'hello@kijaniforestry.com', 1, '2024-05-21 23:20:03'),
(17, 'hello2@kijaniforestry.com', 1, '2024-05-21 23:20:56'),
(18, 'tom@kijaniforestry.com', 1, '2024-05-21 23:35:12'),
(19, 'amayo@kijaniforestry.com', 4, '2024-05-22 01:16:08'),
(20, 'amayego@kijaniforestry.com', 15, '2024-05-22 06:00:38'),
(21, 'amssdayo@kijaniforestry.com', 19, '2024-05-22 06:00:38'),
(22, 'amawggwyo@kijaniforestry.com', 20, '2024-05-22 06:00:39'),
(23, 'am2ffayo@kijaniforestry.com', 21, '2024-05-22 06:00:39'),
(24, 'amawdwfyo@kijaniforestry.com', 22, '2024-05-22 06:00:40'),
(32, 'flow54er@kijaniforestry.com', 15, '2024-05-22 06:30:20'),
(33, 'flo44wer@kijaniforestry.com', 19, '2024-05-22 06:30:20'),
(34, 'flowe3er@kijaniforestry.com', 20, '2024-05-22 06:30:21'),
(35, '', 31, '2024-05-22 06:30:21'),
(36, 'aaafsswlow54er@kijaniforestry.com', 15, '2024-05-22 06:32:22'),
(37, 'elonian@kijaniforestry.com', 21, '2024-05-22 06:33:51'),
(38, 'elonian2@kijaniforestry.com', 21, '2024-05-22 06:36:18'),
(39, 'elonian3@kijaniforestry.com', 21, '2024-05-22 06:36:18'),
(43, 'elonieeean@kijaniforestry.com', 21, '2024-05-22 06:49:31'),
(44, 'elonidddan2@kijaniforestry.com', 21, '2024-05-22 06:49:31'),
(45, 'eloniff3fan3@kijaniforestry.com', 21, '2024-05-22 06:49:31'),
(46, 'beawu@kijaniforestry.com', 63, '2024-05-23 16:33:40'),
(47, 'besau@kijaniforestry.com', 63, '2024-05-23 16:33:40'),
(48, 'breau@kijaniforestry.com', 63, '2024-05-23 16:33:40'),
(49, 'jonathan.otiakori@kijaniforestry.com', 67, '2024-06-24 08:52:40');

--
-- Indexes for dumped tables
--

--
-- Indexes for table `categories`
--
ALTER TABLE `categories`
  ADD PRIMARY KEY (`category_id`);

--
-- Indexes for table `options`
--
ALTER TABLE `options`
  ADD PRIMARY KEY (`option_id`),
  ADD KEY `question_id` (`question_id`);

--
-- Indexes for table `questions`
--
ALTER TABLE `questions`
  ADD PRIMARY KEY (`question_id`),
  ADD KEY `topic_id` (`topic_id`);

--
-- Indexes for table `responses`
--
ALTER TABLE `responses`
  ADD PRIMARY KEY (`response_id`),
  ADD KEY `user_id` (`user_id`),
  ADD KEY `question_id` (`question_id`),
  ADD KEY `option_id` (`option_id`);

--
-- Indexes for table `topics`
--
ALTER TABLE `topics`
  ADD PRIMARY KEY (`topic_id`),
  ADD KEY `category_id` (`category_id`);

--
-- Indexes for table `users`
--
ALTER TABLE `users`
  ADD PRIMARY KEY (`user_id`),
  ADD UNIQUE KEY `email` (`email`),
  ADD KEY `category_id` (`category_id`);

--
-- AUTO_INCREMENT for dumped tables
--

--
-- AUTO_INCREMENT for table `categories`
--
ALTER TABLE `categories`
  MODIFY `category_id` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=69;

--
-- AUTO_INCREMENT for table `options`
--
ALTER TABLE `options`
  MODIFY `option_id` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=49;

--
-- AUTO_INCREMENT for table `questions`
--
ALTER TABLE `questions`
  MODIFY `question_id` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=13;

--
-- AUTO_INCREMENT for table `responses`
--
ALTER TABLE `responses`
  MODIFY `response_id` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=36;

--
-- AUTO_INCREMENT for table `topics`
--
ALTER TABLE `topics`
  MODIFY `topic_id` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=11;

--
-- AUTO_INCREMENT for table `users`
--
ALTER TABLE `users`
  MODIFY `user_id` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=50;

--
-- Constraints for dumped tables
--

--
-- Constraints for table `options`
--
ALTER TABLE `options`
  ADD CONSTRAINT `options_ibfk_1` FOREIGN KEY (`question_id`) REFERENCES `questions` (`question_id`);

--
-- Constraints for table `questions`
--
ALTER TABLE `questions`
  ADD CONSTRAINT `questions_ibfk_1` FOREIGN KEY (`topic_id`) REFERENCES `topics` (`topic_id`);

--
-- Constraints for table `responses`
--
ALTER TABLE `responses`
  ADD CONSTRAINT `responses_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`user_id`),
  ADD CONSTRAINT `responses_ibfk_2` FOREIGN KEY (`question_id`) REFERENCES `questions` (`question_id`),
  ADD CONSTRAINT `responses_ibfk_3` FOREIGN KEY (`option_id`) REFERENCES `options` (`option_id`);

--
-- Constraints for table `topics`
--
ALTER TABLE `topics`
  ADD CONSTRAINT `topics_ibfk_1` FOREIGN KEY (`category_id`) REFERENCES `categories` (`category_id`);

--
-- Constraints for table `users`
--
ALTER TABLE `users`
  ADD CONSTRAINT `users_ibfk_1` FOREIGN KEY (`category_id`) REFERENCES `categories` (`category_id`);
COMMIT;

/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
