
CREATE TABLE "Addresses" (
	address_id INTEGER, 
	line_1 VARCHAR(120), 
	line_2 VARCHAR(120), 
	line_3 VARCHAR(120), 
	city VARCHAR(80), 
	zip_postcode VARCHAR(20), 
	state_province_county VARCHAR(50), 
	country VARCHAR(50), 
	other_address_details VARCHAR(255), 
	PRIMARY KEY (address_id)
)


CREATE TABLE "Assessment_Notes" (
	notes_id INTEGER NOT NULL, 
	student_id INTEGER, 
	teacher_id INTEGER NOT NULL, 
	date_of_notes DATETIME, 
	text_of_notes VARCHAR(255), 
	other_details VARCHAR(255), 
	FOREIGN KEY(teacher_id) REFERENCES "Teachers" (teacher_id), 
	FOREIGN KEY(student_id) REFERENCES "Students" (student_id)
)


CREATE TABLE "Behavior_Incident" (
	incident_id INTEGER, 
	incident_type_code VARCHAR(10) NOT NULL, 
	student_id INTEGER NOT NULL, 
	date_incident_start DATETIME, 
	date_incident_end DATETIME, 
	incident_summary VARCHAR(255), 
	recommendations VARCHAR(255), 
	other_details VARCHAR(255), 
	PRIMARY KEY (incident_id), 
	FOREIGN KEY(student_id) REFERENCES "Students" (student_id), 
	FOREIGN KEY(incident_type_code) REFERENCES "Ref_Incident_Type" (incident_type_code)
)


CREATE TABLE "Detention" (
	detention_id INTEGER, 
	detention_type_code VARCHAR(10) NOT NULL, 
	teacher_id INTEGER, 
	datetime_detention_start DATETIME, 
	datetime_detention_end DATETIME, 
	detention_summary VARCHAR(255), 
	other_details VARCHAR(255), 
	PRIMARY KEY (detention_id), 
	FOREIGN KEY(teacher_id) REFERENCES "Teachers" (teacher_id), 
	FOREIGN KEY(detention_type_code) REFERENCES "Ref_Detention_Type" (detention_type_code)
)


CREATE TABLE "Ref_Address_Types" (
	address_type_code VARCHAR(15), 
	address_type_description VARCHAR(80), 
	PRIMARY KEY (address_type_code)
)


CREATE TABLE "Ref_Detention_Type" (
	detention_type_code VARCHAR(10), 
	detention_type_description VARCHAR(80), 
	PRIMARY KEY (detention_type_code)
)


CREATE TABLE "Ref_Incident_Type" (
	incident_type_code VARCHAR(10), 
	incident_type_description VARCHAR(80), 
	PRIMARY KEY (incident_type_code)
)


CREATE TABLE "Student_Addresses" (
	student_id INTEGER NOT NULL, 
	address_id INTEGER NOT NULL, 
	date_address_from DATETIME NOT NULL, 
	date_address_to DATETIME, 
	monthly_rental DECIMAL(19, 4), 
	other_details VARCHAR(255), 
	FOREIGN KEY(student_id) REFERENCES "Students" (student_id), 
	FOREIGN KEY(address_id) REFERENCES "Addresses" (address_id)
)


CREATE TABLE "Students" (
	student_id INTEGER, 
	address_id INTEGER NOT NULL, 
	first_name VARCHAR(80), 
	middle_name VARCHAR(40), 
	last_name VARCHAR(40), 
	cell_mobile_number VARCHAR(40), 
	email_address VARCHAR(40), 
	date_first_rental DATETIME, 
	date_left_university DATETIME, 
	other_student_details VARCHAR(255), 
	PRIMARY KEY (student_id), 
	FOREIGN KEY(address_id) REFERENCES "Addresses" (address_id)
)


CREATE TABLE "Students_in_Detention" (
	student_id INTEGER NOT NULL, 
	detention_id INTEGER NOT NULL, 
	incident_id INTEGER NOT NULL, 
	FOREIGN KEY(student_id) REFERENCES "Students" (student_id), 
	FOREIGN KEY(detention_id) REFERENCES "Detention" (detention_id), 
	FOREIGN KEY(incident_id) REFERENCES "Behavior_Incident" (incident_id)
)


CREATE TABLE "Teachers" (
	teacher_id INTEGER, 
	address_id INTEGER NOT NULL, 
	first_name VARCHAR(80), 
	middle_name VARCHAR(80), 
	last_name VARCHAR(80), 
	gender VARCHAR(1), 
	cell_mobile_number VARCHAR(40), 
	email_address VARCHAR(40), 
	other_details VARCHAR(255), 
	PRIMARY KEY (teacher_id), 
	FOREIGN KEY(address_id) REFERENCES "Addresses" (address_id)
)

CREATE TABLE "Addresses" (
	address_id INTEGER, 
	line_1 VARCHAR(120), 
	line_2 VARCHAR(120), 
	line_3 VARCHAR(120), 
	city VARCHAR(80), 
	zip_postcode VARCHAR(20), 
	state_province_county VARCHAR(50), 
	country VARCHAR(50), 
	other_address_details VARCHAR(255), 
	PRIMARY KEY (address_id)
)

/*
2 rows from Addresses table:
address_id	line_1	line_2	line_3	city	zip_postcode	state_province_county	country	other_address_details
1	020 Orie Canyon	None	None	North Loyceville	197	Hawaii	USA	None
2	1333 Boyle Lane	None	None	West Sean	937	Illinois	USA	None
*/


CREATE TABLE "Assessment_Notes" (
	notes_id INTEGER NOT NULL, 
	student_id INTEGER, 
	teacher_id INTEGER NOT NULL, 
	date_of_notes DATETIME, 
	text_of_notes VARCHAR(255), 
	other_details VARCHAR(255), 
	FOREIGN KEY(teacher_id) REFERENCES "Teachers" (teacher_id), 
	FOREIGN KEY(student_id) REFERENCES "Students" (student_id)
)

/*
2 rows from Assessment_Notes table:
notes_id	student_id	teacher_id	date_of_notes	text_of_notes	other_details
1	7	3	1978-04-15 04:49:18	None	None
2	11	10	2005-06-30 02:48:35	None	None
*/


CREATE TABLE "Behavior_Incident" (
	incident_id INTEGER, 
	incident_type_code VARCHAR(10) NOT NULL, 
	student_id INTEGER NOT NULL, 
	date_incident_start DATETIME, 
	date_incident_end DATETIME, 
	incident_summary VARCHAR(255), 
	recommendations VARCHAR(255), 
	other_details VARCHAR(255), 
	PRIMARY KEY (incident_id), 
	FOREIGN KEY(student_id) REFERENCES "Students" (student_id), 
	FOREIGN KEY(incident_type_code) REFERENCES "Ref_Incident_Type" (incident_type_code)
)

/*
2 rows from Behavior_Incident table:
incident_id	incident_type_code	student_id	date_incident_start	date_incident_end	incident_summary	recommendations	other_details
1	NOISE	6	2017-07-09 10:04:13	2018-03-08 14:08:54	None	None	None
2	DISTURB	13	2018-01-31 10:51:13	2018-03-18 18:40:05	None	None	None
*/


CREATE TABLE "Detention" (
	detention_id INTEGER, 
	detention_type_code VARCHAR(10) NOT NULL, 
	teacher_id INTEGER, 
	datetime_detention_start DATETIME, 
	datetime_detention_end DATETIME, 
	detention_summary VARCHAR(255), 
	other_details VARCHAR(255), 
	PRIMARY KEY (detention_id), 
	FOREIGN KEY(teacher_id) REFERENCES "Teachers" (teacher_id), 
	FOREIGN KEY(detention_type_code) REFERENCES "Ref_Detention_Type" (detention_type_code)
)

/*
2 rows from Detention table:
detention_id	detention_type_code	teacher_id	datetime_detention_start	datetime_detention_end	detention_summary	other_details
1	AFTER	7	2017-09-05 00:38:25	2018-03-08 02:08:32	None	None
2	AFTER	14	2018-01-10 08:09:02	2018-03-07 04:24:48	None	None
*/


CREATE TABLE "Ref_Address_Types" (
	address_type_code VARCHAR(15), 
	address_type_description VARCHAR(80), 
	PRIMARY KEY (address_type_code)
)

/*
2 rows from Ref_Address_Types table:
address_type_code	address_type_description
BILL	Billing
HOME	Home or Residence
*/


CREATE TABLE "Ref_Detention_Type" (
	detention_type_code VARCHAR(10), 
	detention_type_description VARCHAR(80), 
	PRIMARY KEY (detention_type_code)
)

/*
2 rows from Ref_Detention_Type table:
detention_type_code	detention_type_description
BREAK 	During Break time
AFTER	After School
*/


CREATE TABLE "Ref_Incident_Type" (
	incident_type_code VARCHAR(10), 
	incident_type_description VARCHAR(80), 
	PRIMARY KEY (incident_type_code)
)

/*
2 rows from Ref_Incident_Type table:
incident_type_code	incident_type_description
NOISE	Noise
VIOLENCE	Violence
*/


CREATE TABLE "Student_Addresses" (
	student_id INTEGER NOT NULL, 
	address_id INTEGER NOT NULL, 
	date_address_from DATETIME NOT NULL, 
	date_address_to DATETIME, 
	monthly_rental DECIMAL(19, 4), 
	other_details VARCHAR(255), 
	FOREIGN KEY(student_id) REFERENCES "Students" (student_id), 
	FOREIGN KEY(address_id) REFERENCES "Addresses" (address_id)
)

/*
2 rows from Student_Addresses table:
student_id	address_id	date_address_from	date_address_to	monthly_rental	other_details
6	12	2017-10-16 13:56:34	2018-03-15 10:37:19	826.4319	house
3	18	2017-06-19 12:39:39	2018-03-02 00:19:57	1113.0996	house
*/


CREATE TABLE "Students" (
	student_id INTEGER, 
	address_id INTEGER NOT NULL, 
	first_name VARCHAR(80), 
	middle_name VARCHAR(40), 
	last_name VARCHAR(40), 
	cell_mobile_number VARCHAR(40), 
	email_address VARCHAR(40), 
	date_first_rental DATETIME, 
	date_left_university DATETIME, 
	other_student_details VARCHAR(255), 
	PRIMARY KEY (student_id), 
	FOREIGN KEY(address_id) REFERENCES "Addresses" (address_id)
)

/*
2 rows from Students table:
student_id	address_id	first_name	middle_name	last_name	cell_mobile_number	email_address	date_first_rental	date_left_university	other_student_details
1	19	Emma	Frederic	Rohan	235.899.9744	derrick.jenkins@example.com	2017-12-05 15:20:04	2018-03-03 03:33:05	None
2	9	Louvenia	Fatima	Hansen	1-247-673-8446	rohan.clarabelle@example.org	2017-08-08 22:30:36	2018-02-24 11:12:11	None
*/


CREATE TABLE "Students_in_Detention" (
	student_id INTEGER NOT NULL, 
	detention_id INTEGER NOT NULL, 
	incident_id INTEGER NOT NULL, 
	FOREIGN KEY(student_id) REFERENCES "Students" (student_id), 
	FOREIGN KEY(detention_id) REFERENCES "Detention" (detention_id), 
	FOREIGN KEY(incident_id) REFERENCES "Behavior_Incident" (incident_id)
)

/*
2 rows from Students_in_Detention table:
student_id	detention_id	incident_id
3	15	1
8	13	3
*/


CREATE TABLE "Teachers" (
	teacher_id INTEGER, 
	address_id INTEGER NOT NULL, 
	first_name VARCHAR(80), 
	middle_name VARCHAR(80), 
	last_name VARCHAR(80), 
	gender VARCHAR(1), 
	cell_mobile_number VARCHAR(40), 
	email_address VARCHAR(40), 
	other_details VARCHAR(255), 
	PRIMARY KEY (teacher_id), 
	FOREIGN KEY(address_id) REFERENCES "Addresses" (address_id)
)

/*
2 rows from Teachers table:
teacher_id	address_id	first_name	middle_name	last_name	gender	cell_mobile_number	email_address	other_details
1	15	Lyla	Wilson	Medhurst	1	792.333.7714	ohammes@example.com	None
2	7	Sid	Tremayne	Brakus	1	202.626.1698x9242	deborah37@example.com	None
*/
What is the cell phone number of the student whose address has the lowest monthly rental?
SELECT T2.cell_mobile_number FROM Student_Addresses AS T1 JOIN Students AS T2 ON T1.student_id  =  T2.student_id ORDER BY T1.monthly_rental ASC LIMIT 1
[{'cell_mobile_number': '08605192839'}]