-- phpMyAdmin SQL Dump
-- version 5.2.3
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1:3306
-- Generation Time: Mar 18, 2026 at 07:57 AM
-- Server version: 5.7.31
-- PHP Version: 8.0.30

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

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

--
-- Table structure for table `orders`
--

DROP TABLE IF EXISTS `orders`;
CREATE TABLE IF NOT EXISTS `orders` (
  `id_order` varchar(36) COLLATE utf8_unicode_ci NOT NULL,
  `id_order_ghn` varchar(20) COLLATE utf8_unicode_ci NOT NULL,
  `id_user` varchar(36) COLLATE utf8_unicode_ci DEFAULT NULL,
  `create_at` datetime DEFAULT NULL,
  `estimate_delivery` datetime DEFAULT NULL,
  `status_order` varchar(6) COLLATE utf8_unicode_ci NOT NULL DEFAULT 'wait',
  PRIMARY KEY (`id_order`),
  KEY `order_user` (`id_user`),
  KEY `order_status` (`status_order`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

--
-- Dumping data for table `orders`
--

INSERT INTO `orders` (`id_order`, `id_order_ghn`, `id_user`, `create_at`, `estimate_delivery`, `status_order`) VALUES
('b9834614-2111-11f1-941a-d481d769f217', 'LTK37W', 'f7a8fa58-a51e-4c6b-a6fd-c4539de21ba5', '2026-03-17 15:24:41', NULL, 'wait'),
('b983682e-2111-11f1-941a-d481d769f217', 'LTK37T', 'f96ca131-5470-4ce0-a757-eca9e5223321', '2026-03-16 15:24:41', NULL, 'wait');

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

--
-- Table structure for table `order_detail`
--

DROP TABLE IF EXISTS `order_detail`;
CREATE TABLE IF NOT EXISTS `order_detail` (
  `id_order` varchar(36) COLLATE utf8_unicode_ci NOT NULL,
  `id_product` varchar(10) COLLATE utf8_unicode_ci NOT NULL,
  `quantity` int(11) DEFAULT NULL,
  `total_price` double DEFAULT NULL,
  PRIMARY KEY (`id_order`,`id_product`),
  KEY `order_product` (`id_product`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

--
-- Dumping data for table `order_detail`
--

INSERT INTO `order_detail` (`id_order`, `id_product`, `quantity`, `total_price`) VALUES
('b9834614-2111-11f1-941a-d481d769f217', 'SP00000001', 3, 240),
('b983682e-2111-11f1-941a-d481d769f217', 'SP00000001', 2, 160),
('b983682e-2111-11f1-941a-d481d769f217', 'SP00000002', 1, 120);

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

--
-- Table structure for table `product`
--

DROP TABLE IF EXISTS `product`;
CREATE TABLE IF NOT EXISTS `product` (
  `id_product` varchar(10) COLLATE utf8_unicode_ci NOT NULL,
  `name` text COLLATE utf8_unicode_ci,
  `price` double DEFAULT NULL,
  `length` double DEFAULT NULL,
  `width` double DEFAULT NULL,
  `height` double DEFAULT NULL,
  `weight` int(11) DEFAULT NULL,
  `type_test` varchar(20) COLLATE utf8_unicode_ci NOT NULL,
  PRIMARY KEY (`id_product`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

--
-- Dumping data for table `product`
--

INSERT INTO `product` (`id_product`, `name`, `price`, `length`, `width`, `height`, `weight`, `type_test`) VALUES
('SP00000001', 'Áo Thun Cotton Basic', 80, 12, 12, 2, 10, 'CHOTHUHANG'),
('SP00000002', 'Quần Jean Denim Xanh', 120, 12, 12, 2, 20, 'CHOTHUHANG');

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

--
-- Table structure for table `status_order`
--

DROP TABLE IF EXISTS `status_order`;
CREATE TABLE IF NOT EXISTS `status_order` (
  `id` varchar(6) COLLATE utf8_unicode_ci NOT NULL,
  `description` text COLLATE utf8_unicode_ci,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

--
-- Dumping data for table `status_order`
--

INSERT INTO `status_order` (`id`, `description`) VALUES
('again', 'Đang vận chuyển lại'),
('cancel', 'Đơn hàng đã hủy'),
('comple', 'Đã giao thành công'),
('fail', 'Giao hàng thất bại'),
('pre', 'Đang chuẩn bị hàng'),
('return', 'Đang trả hàng '),
('ship', 'Đang vận chuyển'),
('wait', 'Chờ duyệt');

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

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

DROP TABLE IF EXISTS `users`;
CREATE TABLE IF NOT EXISTS `users` (
  `id` varchar(36) COLLATE utf8_unicode_ci NOT NULL,
  `email` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `name` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `phone` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL,
  `province_name` varchar(30) COLLATE utf8_unicode_ci NOT NULL,
  `district_name` text COLLATE utf8_unicode_ci NOT NULL,
  `ward_name` text COLLATE utf8_unicode_ci NOT NULL,
  `address` text COLLATE utf8_unicode_ci NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

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

INSERT INTO `users` (`id`, `email`, `name`, `phone`, `province_name`, `district_name`, `ward_name`, `address`) VALUES
('f7a8fa58-a51e-4c6b-a6fd-c4539de21ba5', 'dh52201400@student.stu.edu.vn', 'Nguyễn Minh Tâm', '0379272129', 'Hồ Chí Minh', 'Thành Phố Thủ Đức', 'Phường An Khánh', 'Đường abc/def'),
('f96ca131-5470-4ce0-a757-eca9e5223321', 'nminhtam425@gmail.com', 'Nguyen Kim Anh', '0379272198', 'Cần Thơ', '', '', '');

--
-- Constraints for dumped tables
--

--
-- Constraints for table `orders`
--
ALTER TABLE `orders`
  ADD CONSTRAINT `order_status` FOREIGN KEY (`status_order`) REFERENCES `status_order` (`id`),
  ADD CONSTRAINT `order_user` FOREIGN KEY (`id_user`) REFERENCES `users` (`id`);

--
-- Constraints for table `order_detail`
--
ALTER TABLE `order_detail`
  ADD CONSTRAINT `order_detail` FOREIGN KEY (`id_order`) REFERENCES `orders` (`id_order`),
  ADD CONSTRAINT `order_product` FOREIGN KEY (`id_product`) REFERENCES `product` (`id_product`);
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 */;
