create database if not exists schmo_test;
use schmo_test;

source create_database.sql;

insert into hotel
       (hid, name, address, city, state, zip, phone, contact, aaarating,
        petsok, ischambermember)
values
	(1234, "Seacliff Inn", "7500 Old Dominion Ct.", "Aptos", "CA", "95003",
	"831-688-7300", "Debby", 3, 'false', 'true'),
	(5678, "Harbor Inn", "123 7th Ave.", "Santa Cruz", "CA", "95062", 
	"831-479-9467", "Juanita", 3, 'false', 'true');

select * from hotel;

insert into listing
       (lid, hid, numrooms, price, startdate, enddate, datemodified,
       isdiscounted, notes)
values
	(0000, 1234, 4, 120.50, '2007-01-15', '2007-01-20', '2007-01-01',
	'true', null),
	(0001, 1234, 8, 145.00, '2007-01-15', '2007-01-20', '2007-01-01',
	'true', null),
	(0002, 1234, 5, 130.00, '2007-12-20', '2007-12-25', '2007-10-14',
	'true', null);

select * from listing;

select * from listing where startdate > '2007-02-01';

select * from listing where price < 140.00;

select distinct hotel.name, listing.numrooms, listing.price 
       from hotel natural join listing
       where listing.startdate > '2007-01-01';

select distinct hotel.name, listing.numrooms, listing.price
       from hotel natural join listing
       where listing.price < 140.00;

select distinct hotel.name, listing.numrooms, listing.price
       from hotel natural join listing
       where listing.price < 140.00 
       	     and listing.enddate > curdate();
