Database schema:
CREATE TABLE Ref_Age_Categories (
  age_category_code TEXT PRIMARY KEY,
  age_category_description TEXT
);
CREATE TABLE Ref_Property_Types (
  property_type_code TEXT PRIMARY KEY,
  property_type_description TEXT
);
CREATE TABLE Ref_Room_Types (
  room_type_code TEXT PRIMARY KEY,
  room_type_description TEXT
);
CREATE TABLE Ref_User_Categories (
  user_category_code TEXT PRIMARY KEY,
  user_category_description TEXT
);
CREATE TABLE Addresses (
  address_id NUMBER PRIMARY KEY,
  line_1_number_building TEXT,
  line_2_number_street TEXT,
  line_3_area_locality TEXT,
  town_city TEXT,
  zip_postcode TEXT,
  county_state_province TEXT,
  country TEXT,
  other_address_details TEXT
);
CREATE TABLE Features (
  feature_id NUMBER PRIMARY KEY,
  feature_name TEXT,
  feature_description TEXT
);
CREATE TABLE Users (
  user_id NUMBER PRIMARY KEY,
  age_category_code TEXT,
  user_category_code TEXT,
  user_address_id NUMBER,
  is_buyer TEXT,
  is_seller TEXT,
  login_name TEXT,
  password TEXT,
  date_registered TIME,
  first_name TEXT,
  middle_name TEXT,
  last_name TEXT,
  other_user_details TEXT
);
CREATE TABLE Properties (
  property_id NUMBER PRIMARY KEY,
  property_address_id NUMBER,
  owner_user_id NUMBER,
  property_type_code TEXT,
  date_on_market TIME,
  date_off_market TIME,
  property_name TEXT,
  property_description TEXT,
  garage_yn TEXT,
  parking_lots TEXT,
  room_count TEXT,
  vendor_requested_price NUMBER,
  price_min NUMBER,
  price_max NUMBER,
  other_property_details TEXT,
  FOREIGN KEY (property_type_code) REFERENCES Ref_Property_Types(property_type_code),
  FOREIGN KEY (property_address_id) REFERENCES Addresses(address_id),
  FOREIGN KEY (owner_user_id) REFERENCES Users(user_id)
);
CREATE TABLE Property_Features (
  property_id NUMBER,
  feature_id NUMBER,
  feature_value TEXT,
  property_feature_description TEXT,
  FOREIGN KEY (property_id) REFERENCES Properties(property_id),
  FOREIGN KEY (feature_id) REFERENCES Features(feature_id)
);
CREATE TABLE Property_Photos (
  property_id NUMBER,
  photo_seq NUMBER,
  photo_title TEXT,
  photo_description TEXT,
  photo_filename TEXT,
  FOREIGN KEY (property_id) REFERENCES Properties(property_id)
);
CREATE TABLE Rooms (
  property_id NUMBER,
  room_number TEXT,
  room_type_code TEXT,
  room_size TEXT,
  other_room_details TEXT,
  FOREIGN KEY (room_type_code) REFERENCES Ref_Room_Types(room_type_code),
  FOREIGN KEY (property_id) REFERENCES Properties(property_id)
);
CREATE TABLE User_Property_History (
  user_id NUMBER,
  property_id NUMBER,
  datestamp TIME,
  FOREIGN KEY (property_id) REFERENCES Properties(property_id),
  FOREIGN KEY (user_id) REFERENCES Users(user_id)
);
CREATE TABLE User_Searches (
  user_id NUMBER,
  search_seq NUMBER,
  search_datetime TIME,
  search_string TEXT,
  FOREIGN KEY (user_id) REFERENCES Users(user_id)
);

Question: What was the time of the most recent search?
SQL: SELECT max(search_datetime) FROM User_Searches;

Question: Return the full names of users who live in properties that they own.
SQL: SELECT first_name ,  middle_name ,  last_name FROM Properties AS T1 JOIN Users AS T2 ON T1.owner_user_id  =  T2.user_id WHERE T1.property_address_id  =  T2.user_address_id;

Question: Give the feature name and description for the most common feature across all properties.
SQL: SELECT T1.feature_name ,  T1.feature_description FROM Features AS T1 JOIN Property_Features AS T2 ON T1.feature_id  =  T2.feature_id GROUP BY T1.feature_name ORDER BY count(*) DESC LIMIT 1;

Question: How many photos does each owner has of his or her properties? List user id and number of photos.
SQL: SELECT T1.owner_user_id ,  count(*) FROM Properties AS T1 JOIN Property_Photos AS T2 ON T1.property_id  =  T2.property_id GROUP BY T1.owner_user_id;

Question: Give the total max price corresponding to any properties owned by single mothers or students.
SQL: SELECT sum(T1.price_max) FROM Properties AS T1 JOIN Users AS T2 ON T1.owner_user_id  =  T2.user_id WHERE T2.user_category_code  =  'Single Mother' OR T2.user_category_code  =  'Student';

Question: What is the age range category of the user who made the first search?
SQL: SELECT T1.age_category_code FROM Users AS T1 JOIN User_Searches AS T2 ON T1.user_id  =  T2.user_id ORDER BY T2.search_datetime LIMIT 1;

Question: In which country does the user with first name Robbie live?
SQL: SELECT T1.country FROM Addresses AS T1 JOIN Users AS T2 ON T1.address_id  =  T2.user_address_id WHERE T2.first_name  =  'Robbie';

Question: Return the description of the feature 'rooftop'.
SQL: SELECT feature_description FROM Features WHERE feature_name  =  'rooftop';

Question: Return the number of different room sizes.
SQL: SELECT count(DISTINCT room_size) FROM Rooms;

Question: Find the login names of all senior citizen users ordered by their first names.
SQL: SELECT login_name FROM Users WHERE user_category_code  =  'Senior Citizen' ORDER BY first_name

Question: Count the number of property photos each property has by id.
SQL: SELECT count(*) ,  property_id FROM Property_Photos GROUP BY property_id;

Question: What is the most common property type, and what is its description.
SQL: SELECT T1.property_type_description ,  T1.property_type_code FROM Ref_Property_Types AS T1 JOIN Properties AS T2 ON T1.property_type_code  =  T2.property_type_code GROUP BY T1.property_type_code ORDER BY count(*) DESC LIMIT 1;

Question: List the last names and ids of users who have at least 2 properties and searched at most twice.
SQL: SELECT T1.last_name ,  T1.user_id FROM Users AS T1 JOIN User_Searches AS T2 ON T1.user_id  =  T2.user_id GROUP BY T1.user_id HAVING count(*)  <=  2 INTERSECT SELECT T3.last_name ,  T3.user_id FROM Users AS T3 JOIN Properties AS T4 ON T3.user_id  =  T4.owner_user_id GROUP BY T3.user_id HAVING count(*)  >=  2;

Question: Return the country in which the user with first name Robbie lives.
SQL: SELECT T1.country FROM Addresses AS T1 JOIN Users AS T2 ON T1.address_id  =  T2.user_address_id WHERE T2.first_name  =  'Robbie';

Question: How many kinds of room sizes are listed?
SQL: SELECT count(DISTINCT room_size) FROM Rooms;

Question: What are the countries and cities for each address?
SQL: SELECT country ,  town_city FROM Addresses;

Question: How many photos does each property have?
SQL: SELECT count(*) ,  property_id FROM Property_Photos GROUP BY property_id;

Question: Return the ids of users who have performed two or more searches, as well as their search sequence.
SQL: SELECT search_seq ,  user_id FROM User_Searches GROUP BY user_id HAVING count(*) >= 2;