text: -- phpMyAdmin SQL Dump
  -- version 5.0.4
  -- https://www.phpmyadmin.net/
  --
  -- Host: localhost
  -- Generation Time: Apr 19, 2021 at 06:52 AM
  -- Server version: 10.4.17-MariaDB
  -- PHP Version: 8.0.0
  
  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: `project_pkk`
  --
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `admin`
  --
  
  CREATE TABLE `admin` (
    `id` int(255) NOT NULL,
    `email` varchar(255) NOT NULL,
    `password` varchar(255) NOT NULL,
    `nama` varchar(255) NOT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
  
  --
  -- Dumping data for table `admin`
  --
  
  INSERT INTO `admin` (`id`, `email`, `password`, `nama`) VALUES
  (1, 'arya@gmail.com', '4026', 'Muhammad Arya Dyas');
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `laptops`
  --
  
  CREATE TABLE `laptops` (
    `id` int(11) NOT NULL,
    `nama_laptop` varchar(255) NOT NULL,
    `price` varchar(255) NOT NULL,
    `status` enum('Ready','Pending','On Process','Finished','Hold') NOT NULL,
    `note` varchar(255) NOT NULL,
    `id_operator` int(255) DEFAULT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
  
  --
  -- Dumping data for table `laptops`
  --
  
  INSERT INTO `laptops` (`id`, `nama_laptop`, `price`, `status`, `note`, `id_operator`) VALUES
  (5, 'Macbook Pro', '500000', 'Pending', '', NULL),
  (6, 'Microsoft Surface', '250000', 'Ready', '', NULL),
  (7, 'Thinkpad X1', '450000', 'Ready', '', NULL),
  (8, 'Asus Zenbook', '600000', 'Ready', '', NULL);
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `operators`
  --
  
  CREATE TABLE `operators` (
    `id` int(11) NOT NULL,
    `email` varchar(255) NOT NULL,
    `password` varchar(255) NOT NULL,
    `nama` varchar(255) NOT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
  
  --
  -- Dumping data for table `operators`
  --
  
  INSERT INTO `operators` (`id`, `email`, `password`, `nama`) VALUES
  (1, 'operator@gmail.com', '4026', 'Operator 1');
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `orders`
  --
  
  CREATE TABLE `orders` (
    `id` int(255) NOT NULL,
    `id_user` int(255) NOT NULL,
    `city` varchar(255) NOT NULL,
    `zip` varchar(255) NOT NULL,
    `address` varchar(255) NOT NULL,
    `id_laptop` int(255) NOT NULL,
    `duration` varchar(255) NOT NULL,
    `totprice` varchar(255) NOT NULL,
    `pickupdate` varchar(255) NOT NULL,
    `status` varchar(255) NOT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
  
  --
  -- Dumping data for table `orders`
  --
  
  INSERT INTO `orders` (`id`, `id_user`, `city`, `zip`, `address`, `id_laptop`, `duration`, `totprice`, `pickupdate`, `status`) VALUES
  (52, 16, 'Central Jakarta', '97021', '2966 Sycamore Road', 6, '2', '500000', '2021-04-14', 'Finished');
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `questions`
  --
  
  CREATE TABLE `questions` (
    `id` int(11) NOT NULL,
    `name` varchar(255) NOT NULL,
    `email` varchar(255) NOT NULL,
    `phone` varchar(255) NOT NULL,
    `subject` varchar(255) NOT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `users`
  --
  
  CREATE TABLE `users` (
    `id` int(11) NOT NULL,
    `email` varchar(255) NOT NULL,
    `phone` varchar(255) NOT NULL,
    `nama_user` varchar(255) NOT NULL,
    `password` varchar(255) NOT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
  
  --
  -- Dumping data for table `users`
  --
  
  INSERT INTO `users` (`id`, `email`, `phone`, `nama_user`, `password`) VALUES
  (16, 'aryadotid21@gmail.com', '+62895613367705', 'Arya Dyas', '40264026');
  
  -- --------------------------------------------------------
  
  --
  -- Stand-in structure for view `vorders`
  -- (See below for the actual view)
  --
  CREATE TABLE `vorders` (
  `id` int(255)
  ,`nama_user` varchar(255)
  ,`email` varchar(255)
  ,`phone` varchar(255)
  ,`city` varchar(255)
  ,`zip` varchar(255)
  ,`address` varchar(255)
  ,`nama_laptop` varchar(255)
  ,`price` varchar(255)
  ,`duration` varchar(255)
  ,`totprice` varchar(255)
  ,`pickupdate` varchar(255)
  ,`status` varchar(255)
  );
  
  -- --------------------------------------------------------
  
  --
  -- Structure for view `vorders`
  --
  DROP TABLE IF EXISTS `vorders`;
  
  CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `vorders`  AS SELECT `orders`.`id` AS `id`, `users`.`nama_user` AS `nama_user`, `users`.`email` AS `email`, `users`.`phone` AS `phone`, `orders`.`city` AS `city`, `orders`.`zip` AS `zip`, `orders`.`address` AS `address`, `laptops`.`nama_laptop` AS `nama_laptop`, `laptops`.`price` AS `price`, `orders`.`duration` AS `duration`, `orders`.`totprice` AS `totprice`, `orders`.`pickupdate` AS `pickupdate`, `orders`.`status` AS `status` FROM ((`orders` join `users` on(`orders`.`id_user` = `users`.`id`)) join `laptops` on(`orders`.`id_laptop` = `laptops`.`id`)) ;
  
  --
  -- Indexes for dumped tables
  --
  
  --
  -- Indexes for table `admin`
  --
  ALTER TABLE `admin`
    ADD PRIMARY KEY (`id`),
    ADD UNIQUE KEY `username` (`email`);
  
  --
  -- Indexes for table `laptops`
  --
  ALTER TABLE `laptops`
    ADD PRIMARY KEY (`id`),
    ADD KEY `id_operator` (`id_operator`);
  
  --
  -- Indexes for table `operators`
  --
  ALTER TABLE `operators`
    ADD PRIMARY KEY (`id`);
  
  --
  -- Indexes for table `orders`
  --
  ALTER TABLE `orders`
    ADD PRIMARY KEY (`id`),
    ADD KEY `id_user` (`id_user`),
    ADD KEY `id_laptop` (`id_laptop`);
  
  --
  -- Indexes for table `questions`
  --
  ALTER TABLE `questions`
    ADD PRIMARY KEY (`id`);
  
  --
  -- Indexes for table `users`
  --
  ALTER TABLE `users`
    ADD PRIMARY KEY (`id`),
    ADD UNIQUE KEY `email` (`email`),
    ADD UNIQUE KEY `phone` (`phone`);
  
  --
  -- AUTO_INCREMENT for dumped tables
  --
  
  --
  -- AUTO_INCREMENT for table `admin`
  --
  ALTER TABLE `admin`
    MODIFY `id` int(255) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
  
  --
  -- AUTO_INCREMENT for table `laptops`
  --
  ALTER TABLE `laptops`
    MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=11;
  
  --
  -- AUTO_INCREMENT for table `operators`
  --
  ALTER TABLE `operators`
    MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
  
  --
  -- AUTO_INCREMENT for table `orders`
  --
  ALTER TABLE `orders`
    MODIFY `id` int(255) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=53;
  
  --
  -- AUTO_INCREMENT for table `questions`
  --
  ALTER TABLE `questions`
    MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
  
  --
  -- AUTO_INCREMENT for table `users`
  --
  ALTER TABLE `users`
    MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=17;
  
  --
  -- Constraints for dumped tables
  --
  
  --
  -- Constraints for table `laptops`
  --
  ALTER TABLE `laptops`
    ADD CONSTRAINT `laptops_ibfk_1` FOREIGN KEY (`id_operator`) REFERENCES `operators` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
  
  --
  -- Constraints for table `orders`
  --
  ALTER TABLE `orders`
    ADD CONSTRAINT `orders_ibfk_1` FOREIGN KEY (`id_user`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
    ADD CONSTRAINT `orders_ibfk_2` FOREIGN KEY (`id_laptop`) REFERENCES `laptops` (`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 */;
  