-- phpMyAdmin SQL Dump
-- version 5.2.2
-- https://www.phpmyadmin.net/
--
-- Host: localhost:3306
-- Generation Time: Sep 29, 2025 at 06:53 PM
-- Server version: 10.6.23-MariaDB-cll-lve
-- PHP Version: 8.4.11

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

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

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

CREATE TABLE `questions` (
  `id` int(11) NOT NULL,
  `question_text` text NOT NULL,
  `option_a` varchar(255) NOT NULL,
  `option_b` varchar(255) NOT NULL,
  `option_c` varchar(255) NOT NULL,
  `option_d` varchar(255) NOT NULL,
  `correct_option` char(1) NOT NULL,
  `category` enum('html','css','js','php','sql') NOT NULL,
  `difficulty` int(11) DEFAULT 1,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

INSERT INTO `questions` (`id`, `question_text`, `option_a`, `option_b`, `option_c`, `option_d`, `correct_option`, `category`, `difficulty`, `created_at`) VALUES
(1, 'Which tag is used to define the main content of a webpage?', '<head>', '<body>', '<main>', '<content>', 'b', 'html', 1, '2025-09-29 16:41:04'),
(2, 'What tag is used for the largest heading?', '<h6>', '<h1>', '<header>', '<p>', 'b', 'html', 1, '2025-09-29 16:41:04'),
(3, 'Which HTML element is used to create a hyperlink?', '<a>', '<link>', '<href>', '<src>', 'a', 'html', 1, '2025-09-29 16:41:04'),
(4, 'Which CSS property changes text color?', 'font-color', 'color', 'text-color', 'foreground', 'b', 'css', 1, '2025-09-29 16:41:04'),
(5, 'How do you center text in CSS?', 'align: center;', 'text-align: center;', 'center: text;', 'font-align: center;', 'b', 'css', 1, '2025-09-29 16:41:04'),
(6, 'Which code shows a popup alert in JS?', 'msg(\"Hello\")', 'alert(\"Hello\")', 'popup(\"Hello\")', 'console(\"Hello\")', 'b', 'js', 1, '2025-09-29 16:41:04'),
(7, 'What symbol starts all PHP variables?', '%', '$', '@', '&', 'b', 'php', 1, '2025-09-29 16:41:04'),
(8, 'Which SQL command is used to retrieve data?', 'GET', 'SELECT', 'SHOW', 'FIND', 'b', 'sql', 1, '2025-09-29 16:41:04');

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

--
-- Table structure for table `scores`
--

CREATE TABLE `scores` (
  `id` int(11) NOT NULL,
  `user_id` int(11) NOT NULL,
  `score` int(11) NOT NULL,
  `level` int(11) NOT NULL,
  `date_played` date NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Indexes for dumped tables
--

--
-- Indexes for table `questions`
--
ALTER TABLE `questions`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `scores`
--
ALTER TABLE `scores`
  ADD PRIMARY KEY (`id`),
  ADD KEY `user_id` (`user_id`);

--
-- AUTO_INCREMENT for dumped tables
--

--
-- AUTO_INCREMENT for table `questions`
--
ALTER TABLE `questions`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=9;

--
-- AUTO_INCREMENT for table `scores`
--
ALTER TABLE `scores`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- Constraints for dumped tables
--

--
-- Constraints for table `scores`
--
ALTER TABLE `scores`
  ADD CONSTRAINT `scores_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;
COMMIT;

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