
-- use DeliveryTakingSystem;

CREATE TABLE `user` (
        `id` int(11) NOT NULL AUTO_INCREMENT,
        `username` varchar(20) DEFAULT NULL,
        `password` varchar(20) DEFAULT NULL,
        `phone` varchar(20) DEFAULT NULL,
        PRIMARY KEY (`id`)
) ENGINE=InnoDB;


CREATE TABLE `order` (
         `id` int(11) NOT NULL AUTO_INCREMENT,
         `description` text,
         `when` datetime DEFAULT NULL,
         `location` text,
         `sender_id` int(11) DEFAULT NULL,
         `receiver_id` int(11) DEFAULT NULL,
         `price` int(11) DEFAULT NULL,
         `status` varchar(20) DEFAULT NULL,
         `comment` text,
         `timestamp` datetime DEFAULT NULL,
         PRIMARY KEY (`id`),
         KEY `fk_sender_id` (`sender_id`),
         CONSTRAINT `fk_sender_id` FOREIGN KEY (`sender_id`) REFERENCES `user` (`id`)
) ENGINE=InnoDB;


insert into `user` values(5,"betaberry","100299","110");

insert into `order` values(1,"订单1","2020/12/10","中北校区，河西食堂后面", 5, 1, 10, "已接单","加油！奥力给","2020/12/10 10:30:30");
insert into `order` values(2,"订单2","2020/12/11","中北校区，河西食堂后面", 5, 6, 60, "已接单","加油！奥力给","2020/12/10 10:30:30");
insert into `order` values(3,"订单3","2020/12/12","中北校区，河西食堂后面", 5, 8, 80, "已接单","加油！奥力给","2020/12/10 10:30:30");
insert into `order` values(4,"订单4","2020/12/13","中北校区，河西食堂后面", 5, null, 10, "未接单","加油！奥力给","2020/12/10 10:30:30");
insert into `order` values(5,"订单5","2020/12/14","中北校区，河西食堂后面", 5, null, 60, "未接单","加油！奥力给","2020/12/10 10:30:30");
insert into `order` values(6,"订单6","2020/12/15","中北校区，河西食堂后面", 5, null, 60, "未接单","加油！奥力给","2020/12/10 10:30:30");

