对以下内容的查询是什么?

时间:2013-08-01 03:11:05

标签: php mysql database

这是三个表的SQL

CREATE TABLE `reservation` (
  `cust_id` int(50) NOT NULL,
  `reservation_id` int(25) NOT NULL,
  `car_id` int(50) NOT NULL,
  `total` varchar(50) NOT NULL,
  `pulocation` varchar(50) NOT NULL,
  `dolocation` varchar(50) NOT NULL,
  `pudate` varchar(50) NOT NULL,
  `dodate` varchar(50) NOT NULL,
  `putime` varchar(25) NOT NULL,
  `dotime` varchar(25) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;


CREATE TABLE `car` (
  `car_id` int(25) NOT NULL auto_increment,
  `car_name` varchar(50) NOT NULL,
  `rental` varchar(50) NOT NULL,
  `category` varchar(50) NOT NULL,
  `category_id` varchar(10) NOT NULL,
  `details` text NOT NULL,
  `date_added` date NOT NULL,
  `Status` varchar(50) NOT NULL,
  PRIMARY KEY  (`car_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=34 ;



CREATE TABLE `customer` (
  `cust_id` int(11) NOT NULL auto_increment,
  `fname` varchar(50) NOT NULL,
  `lname` varchar(50) NOT NULL,
  `address` varchar(100) NOT NULL,
  `city` varchar(50) NOT NULL,
  `country` varchar(50) NOT NULL,
  `zip` varchar(50) NOT NULL,
  `DOB` varchar(50) NOT NULL,
  `email` varchar(50) NOT NULL,
  `username` varchar(50) NOT NULL,
  `password` varchar(50) NOT NULL,
  PRIMARY KEY  (`cust_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=7 ;

cust_id和car_id是来自汽车和客户表的外键。所以我必须写一个查询来检查汽车是否在预订表中的pudate和dodate之间可用。任何帮助将不胜感激

0 个答案:

没有答案