-- phpMyAdmin SQL Dump
-- version 5.2.1
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: May 26, 2026 at 03:02 PM
-- Server version: 10.4.32-MariaDB
-- PHP Version: 8.2.12

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";


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

--
-- Database: `smartpark_db`
--

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

--
-- Table structure for table `department`
--

CREATE TABLE `department` (
  `departmentnumber` varchar(10) NOT NULL,
  `departmentname` varchar(100) NOT NULL,
  `grosssalary` decimal(10,2) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `department`
--

INSERT INTO `department` (`departmentnumber`, `departmentname`, `grosssalary`) VALUES
('CW', 'Carwash', 300000.00),
('ST', 'Stock', 200000.00);

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

--
-- Table structure for table `employee`
--

CREATE TABLE `employee` (
  `employeenumber` int(11) NOT NULL,
  `firstname` varchar(50) NOT NULL,
  `lastname` varchar(50) NOT NULL,
  `position` varchar(50) DEFAULT NULL,
  `address` varchar(255) DEFAULT NULL,
  `telephone` varchar(20) DEFAULT NULL,
  `gender` char(1) DEFAULT NULL,
  `hireddate` date DEFAULT NULL,
  `departmentnumber` varchar(10) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `employee`
--

INSERT INTO `employee` (`employeenumber`, `firstname`, `lastname`, `position`, `address`, `telephone`, `gender`, `hireddate`, `departmentnumber`) VALUES
(1, 'MUGISHA', 'Robert', 'Robert company ltd', 'Nyamagabe , Southen provence', '0799967543', 'M', '2026-05-26', 'CW'),
(2, 'KAMANA', 'kelly', 'kell cp ltd', 'Muhanga southen provence', '0788884356', 'M', '2026-05-26', 'CW'),
(3, 'KAMUGEGE', 'ANASTAZIER', 'Kamuana company ltd', 'rubavu westen provence', '07272788909', 'F', '2026-06-26', 'ST'),
(4, 'MUGISHA ', 'Odilo', 'Shimwa odilo ltd', 'Nyamagabe southen provence', '0786666666', 'M', '2026-05-26', 'ST');

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

--
-- Table structure for table `salary`
--

CREATE TABLE `salary` (
  `grosssalary` decimal(10,2) NOT NULL,
  `totaldeduction` decimal(10,2) NOT NULL,
  `netsalary` decimal(10,2) NOT NULL,
  `month` varchar(20) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `salary`
--

INSERT INTO `salary` (`grosssalary`, `totaldeduction`, `netsalary`, `month`) VALUES
(200000.00, 5000.00, 195000.00, 'june 2026'),
(300000.00, 20000.00, 280000.00, 'May 2026'),
(450000.00, 40000.00, 410000.00, 'May 2026'),
(600000.00, 70000.00, 530000.00, 'May 2026');

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

--
-- Table structure for table `user`
--

CREATE TABLE `user` (
  `userid` int(11) NOT NULL,
  `username` varchar(50) NOT NULL,
  `password_hash` varchar(255) NOT NULL,
  `last_login` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `user`
--

INSERT INTO `user` (`userid`, `username`, `password_hash`, `last_login`) VALUES
(1, 'Robert', '$2b$10$wnW.GLe78dF0Ox0X1lYBW.qZvgAxcEIg8t8jZGZpAJWiky9tDpiz6', '2026-05-26 09:11:01');

--
-- Indexes for dumped tables
--

--
-- Indexes for table `department`
--
ALTER TABLE `department`
  ADD PRIMARY KEY (`departmentnumber`),
  ADD KEY `grosssalary` (`grosssalary`);

--
-- Indexes for table `employee`
--
ALTER TABLE `employee`
  ADD PRIMARY KEY (`employeenumber`),
  ADD KEY `departmentnumber` (`departmentnumber`);

--
-- Indexes for table `salary`
--
ALTER TABLE `salary`
  ADD PRIMARY KEY (`grosssalary`);

--
-- Indexes for table `user`
--
ALTER TABLE `user`
  ADD PRIMARY KEY (`userid`),
  ADD UNIQUE KEY `username` (`username`);

--
-- AUTO_INCREMENT for dumped tables
--

--
-- AUTO_INCREMENT for table `employee`
--
ALTER TABLE `employee`
  MODIFY `employeenumber` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;

--
-- AUTO_INCREMENT for table `user`
--
ALTER TABLE `user`
  MODIFY `userid` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;

--
-- Constraints for dumped tables
--

--
-- Constraints for table `department`
--
ALTER TABLE `department`
  ADD CONSTRAINT `department_ibfk_1` FOREIGN KEY (`grosssalary`) REFERENCES `salary` (`grosssalary`) ON UPDATE CASCADE;

--
-- Constraints for table `employee`
--
ALTER TABLE `employee`
  ADD CONSTRAINT `employee_ibfk_1` FOREIGN KEY (`departmentnumber`) REFERENCES `department` (`departmentnumber`) 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 */;
