SELECT count(*) FROM Properties WHERE parking_lots  =  1 OR garage_yn  =  1;
How many properties have 1 parking lot or 1 garage?
CREATE TABLE `Ref_Age_Categories` (
`age_category_code` VARCHAR(15) PRIMARY KEY,
`age_category_description` VARCHAR(80)
);
CREATE TABLE `Ref_Property_Types` (
`property_type_code` VARCHAR(15) PRIMARY KEY,
`property_type_description` VARCHAR(80)
);
CREATE TABLE `Ref_Room_Types` (
`room_type_code` VARCHAR(15) PRIMARY KEY,
`room_type_description` VARCHAR(80)
);
CREATE TABLE `Ref_User_Categories` (
`user_category_code` VARCHAR(15) PRIMARY KEY,
`user_category_description` VARCHAR(80)
);
CREATE TABLE `Addresses` (
`address_id` INTEGER PRIMARY KEY,
`line_1_number_building` VARCHAR(80),
`line_2_number_street` VARCHAR(80),
`line_3_area_locality` VARCHAR(80),
`town_city` VARCHAR(80),
`zip_postcode` VARCHAR(20),
`county_state_province` VARCHAR(80),
`country` VARCHAR(50),
`other_address_details` VARCHAR(255)
);
CREATE TABLE `Features` (
`feature_id` INTEGER PRIMARY KEY,
`feature_name` VARCHAR(80),
`feature_description` VARCHAR(80)
);
CREATE TABLE `Users` (
`user_id` INTEGER PRIMARY KEY,
`age_category_code` VARCHAR(15),
`user_category_code` VARCHAR(15),
`user_address_id` INTEGER NOT NULL,
`is_buyer` VARCHAR(1),
`is_seller` VARCHAR(1),
`login_name` VARCHAR(25),
`password` VARCHAR(8),
`date_registered` DATETIME,
`first_name` VARCHAR(80),
`middle_name` VARCHAR(80),
`last_name` VARCHAR(80),
`other_user_details` VARCHAR(255)
);
CREATE TABLE `Properties` (
`property_id` INTEGER PRIMARY KEY,
`property_address_id` INTEGER NOT NULL,
`owner_user_id` INTEGER NOT NULL,
`property_type_code` VARCHAR(15) NOT NULL,
`date_on_market` DATETIME,
`date_off_market` DATETIME,
`property_name` VARCHAR(80),
`property_description` VARCHAR(255),
`garage_yn` VARCHAR(1),
`parking_lots` VARCHAR(1),
`room_count` VARCHAR(10),
`vendor_requested_price` DOUBLE NULL,
`price_min` DOUBLE NULL,
`price_max` DOUBLE NULL,
`other_property_details` VARCHAR(255),
FOREIGN KEY (`owner_user_id` ) REFERENCES `Users`(`user_id` ),
FOREIGN KEY (`property_address_id` ) REFERENCES `Addresses`(`address_id` ),
FOREIGN KEY (`property_type_code` ) REFERENCES `Ref_Property_Types`(`property_type_code` )
);
CREATE TABLE `Property_Features` (
`property_id` INTEGER NOT NULL,
`feature_id` INTEGER NOT NULL,
`feature_value` VARCHAR(80),
`property_feature_description` VARCHAR(80),
FOREIGN KEY (`feature_id` ) REFERENCES `Features`(`feature_id` ),
FOREIGN KEY (`property_id` ) REFERENCES `Properties`(`property_id` )
);
CREATE TABLE `Property_Photos` (
`property_id` INTEGER NOT NULL,
`photo_seq` INTEGER NOT NULL,
`photo_title` VARCHAR(30),
`photo_description` VARCHAR(255),
`photo_filename` VARCHAR(255),
FOREIGN KEY (`property_id` ) REFERENCES `Properties`(`property_id` )
);
CREATE TABLE `Rooms` (
`property_id` INTEGER NOT NULL,
`room_number` VARCHAR(10) NOT NULL,
`room_type_code` VARCHAR(15) NOT NULL,
`room_size` VARCHAR(20),
`other_room_details` VARCHAR(255),
FOREIGN KEY (`property_id` ) REFERENCES `Properties`(`property_id` ),
FOREIGN KEY (`room_type_code` ) REFERENCES `Ref_Room_Types`(`room_type_code` )
);
CREATE TABLE `User_Property_History` (
`user_id` INTEGER NOT NULL,
`property_id` INTEGER NOT NULL,
`datestamp` DATETIME NOT NULL,
FOREIGN KEY (`user_id` ) REFERENCES `Users`(`user_id` ),
FOREIGN KEY (`property_id` ) REFERENCES `Properties`(`property_id` )
);
CREATE TABLE `User_Searches` (
`user_id` INTEGER NOT NULL,
`search_seq` INTEGER NOT NULL,
`search_datetime` DATETIME,
`search_string` VARCHAR(80),
FOREIGN KEY (`user_id` ) REFERENCES `Users`(`user_id` )
);
INSERT INTO Ref_Age_Categories (`age_category_code`, `age_category_description`) VALUES ('18-25', '18 - 25 years old.')
INSERT INTO Ref_Property_Types (`property_type_code`, `property_type_description`) VALUES ('7', 'flat')
INSERT INTO Ref_Room_Types (`room_type_code`, `room_type_description`) VALUES ('2', 'living')
INSERT INTO Ref_User_Categories (`user_category_code`, `user_category_description`) VALUES ('Student', 'Student')
INSERT INTO Addresses (`address_id`, `line_1_number_building`, `line_2_number_street`, `line_3_area_locality`, `town_city`, `zip_postcode`, `county_state_province`, `country`, `other_address_details`) VALUES (1, '6207 Marks Trafficway', 'Apt. 516', NULL, 'Port Miafurt', '349', 'Utah', 'United States Minor Outlying Islands', NULL)
INSERT INTO Features (`feature_id`, `feature_name`, `feature_description`) VALUES (1, 'kichen', 'ea')
INSERT INTO Users (`user_id`, `age_category_code`, `user_category_code`, `user_address_id`, `is_buyer`, `is_seller`, `login_name`, `password`, `date_registered`, `first_name`, `middle_name`, `last_name`, `other_user_details`) VALUES (1, '18-25', 'Senior Citizen', 5, '1', '', 'dolor', 'a9dc84fe', '1980-12-28 20:26:12', 'Madonna', 'Kristoffer', 'Jaskolski', NULL)
INSERT INTO Properties (`property_id`, `property_address_id`, `owner_user_id`, `property_type_code`, `date_on_market`, `date_off_market`, `property_name`, `property_description`, `garage_yn`, `parking_lots`, `room_count`, `vendor_requested_price`, `price_min`, `price_max`, `other_property_details`) VALUES (1, 9, 13, '7', '2015-06-16 01:43:42', '1978-11-17 22:49:30', 'garden', 'dolores', '1', '', '7', '2454.682', '20835877.439261', '352563032.06431', NULL)
INSERT INTO Property_Features (`property_id`, `feature_id`, `feature_value`, `property_feature_description`) VALUES (14, 3, 'temporibus', 'est')
INSERT INTO Property_Photos (`property_id`, `photo_seq`, `photo_title`, `photo_description`, `photo_filename`) VALUES (5, 0, 'front', 'reiciendis', 'repellat')
INSERT INTO Rooms (`property_id`, `room_number`, `room_type_code`, `room_size`, `other_room_details`) VALUES (14, '2', '8', 's', 'praesentium')
INSERT INTO User_Property_History (`user_id`, `property_id`, `datestamp`) VALUES (11, 2, '2014-07-18 19:21:51')
INSERT INTO User_Searches (`user_id`, `search_seq`, `search_datetime`, `search_string`) VALUES (13, 50636, '2014-04-28 20:21:54', 'optio')