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


CREATE TABLE "Courses" (
	course_id INTEGER, 
	course_name VARCHAR(255), 
	course_description VARCHAR(255), 
	other_details VARCHAR(255), 
	PRIMARY KEY (course_id)
)


CREATE TABLE "Degree_Programs" (
	degree_program_id INTEGER, 
	department_id INTEGER NOT NULL, 
	degree_summary_name VARCHAR(255), 
	degree_summary_description VARCHAR(255), 
	other_details VARCHAR(255), 
	PRIMARY KEY (degree_program_id), 
	FOREIGN KEY(department_id) REFERENCES "Departments" (department_id)
)


CREATE TABLE "Departments" (
	department_id INTEGER, 
	department_name VARCHAR(255), 
	department_description VARCHAR(255), 
	other_details VARCHAR(255), 
	PRIMARY KEY (department_id)
)


CREATE TABLE "Sections" (
	section_id INTEGER, 
	course_id INTEGER NOT NULL, 
	section_name VARCHAR(255), 
	section_description VARCHAR(255), 
	other_details VARCHAR(255), 
	PRIMARY KEY (section_id), 
	FOREIGN KEY(course_id) REFERENCES "Courses" (course_id)
)


CREATE TABLE "Semesters" (
	semester_id INTEGER, 
	semester_name VARCHAR(255), 
	semester_description VARCHAR(255), 
	other_details VARCHAR(255), 
	PRIMARY KEY (semester_id)
)


CREATE TABLE "Student_Enrolment" (
	student_enrolment_id INTEGER, 
	degree_program_id INTEGER NOT NULL, 
	semester_id INTEGER NOT NULL, 
	student_id INTEGER NOT NULL, 
	other_details VARCHAR(255), 
	PRIMARY KEY (student_enrolment_id), 
	FOREIGN KEY(student_id) REFERENCES "Students" (student_id), 
	FOREIGN KEY(semester_id) REFERENCES "Semesters" (semester_id), 
	FOREIGN KEY(degree_program_id) REFERENCES "Degree_Programs" (degree_program_id)
)


CREATE TABLE "Student_Enrolment_Courses" (
	student_course_id INTEGER, 
	course_id INTEGER NOT NULL, 
	student_enrolment_id INTEGER NOT NULL, 
	PRIMARY KEY (student_course_id), 
	FOREIGN KEY(student_enrolment_id) REFERENCES "Student_Enrolment" (student_enrolment_id), 
	FOREIGN KEY(course_id) REFERENCES "Courses" (course_id)
)


CREATE TABLE "Students" (
	student_id INTEGER, 
	current_address_id INTEGER NOT NULL, 
	permanent_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), 
	ssn VARCHAR(40), 
	date_first_registered DATETIME, 
	date_left DATETIME, 
	other_student_details VARCHAR(255), 
	PRIMARY KEY (student_id), 
	FOREIGN KEY(permanent_address_id) REFERENCES "Addresses" (address_id), 
	FOREIGN KEY(current_address_id) REFERENCES "Addresses" (address_id)
)


CREATE TABLE "Transcript_Contents" (
	student_course_id INTEGER NOT NULL, 
	transcript_id INTEGER NOT NULL, 
	FOREIGN KEY(transcript_id) REFERENCES "Transcripts" (transcript_id), 
	FOREIGN KEY(student_course_id) REFERENCES "Student_Enrolment_Courses" (student_course_id)
)


CREATE TABLE "Transcripts" (
	transcript_id INTEGER, 
	transcript_date DATETIME, 
	other_details VARCHAR(255), 
	PRIMARY KEY (transcript_id)
)

CREATE TABLE "Addresses" (
	address_id INTEGER, 
	line_1 VARCHAR(255), 
	line_2 VARCHAR(255), 
	line_3 VARCHAR(255), 
	city VARCHAR(255), 
	zip_postcode VARCHAR(20), 
	state_province_county VARCHAR(255), 
	country VARCHAR(255), 
	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	2294 Grant Square Apt. 235	Apt. 370	None	Port Chelsea	148	Virginia	Iceland	None
2	3999 Aufderhar Ways Suite 593	Apt. 388	None	Lake Laishafurt	943	Kentucky	Burundi	None
*/


CREATE TABLE "Courses" (
	course_id INTEGER, 
	course_name VARCHAR(255), 
	course_description VARCHAR(255), 
	other_details VARCHAR(255), 
	PRIMARY KEY (course_id)
)

/*
2 rows from Courses table:
course_id	course_name	course_description	other_details
1	ds	p	None
2	math	q	None
*/


CREATE TABLE "Degree_Programs" (
	degree_program_id INTEGER, 
	department_id INTEGER NOT NULL, 
	degree_summary_name VARCHAR(255), 
	degree_summary_description VARCHAR(255), 
	other_details VARCHAR(255), 
	PRIMARY KEY (degree_program_id), 
	FOREIGN KEY(department_id) REFERENCES "Departments" (department_id)
)

/*
2 rows from Degree_Programs table:
degree_program_id	department_id	degree_summary_name	degree_summary_description	other_details
1	13	Master	architecto	None
2	2	Master	cumque	None
*/


CREATE TABLE "Departments" (
	department_id INTEGER, 
	department_name VARCHAR(255), 
	department_description VARCHAR(255), 
	other_details VARCHAR(255), 
	PRIMARY KEY (department_id)
)

/*
2 rows from Departments table:
department_id	department_name	department_description	other_details
1	computer science	error	None
2	history	nostrum	None
*/


CREATE TABLE "Sections" (
	section_id INTEGER, 
	course_id INTEGER NOT NULL, 
	section_name VARCHAR(255), 
	section_description VARCHAR(255), 
	other_details VARCHAR(255), 
	PRIMARY KEY (section_id), 
	FOREIGN KEY(course_id) REFERENCES "Courses" (course_id)
)

/*
2 rows from Sections table:
section_id	course_id	section_name	section_description	other_details
1	9	a	non	None
2	2	b	voluptatem	None
*/


CREATE TABLE "Semesters" (
	semester_id INTEGER, 
	semester_name VARCHAR(255), 
	semester_description VARCHAR(255), 
	other_details VARCHAR(255), 
	PRIMARY KEY (semester_id)
)

/*
2 rows from Semesters table:
semester_id	semester_name	semester_description	other_details
1	spring 2010	x	None
2	summer 2010	g	None
*/


CREATE TABLE "Student_Enrolment" (
	student_enrolment_id INTEGER, 
	degree_program_id INTEGER NOT NULL, 
	semester_id INTEGER NOT NULL, 
	student_id INTEGER NOT NULL, 
	other_details VARCHAR(255), 
	PRIMARY KEY (student_enrolment_id), 
	FOREIGN KEY(student_id) REFERENCES "Students" (student_id), 
	FOREIGN KEY(semester_id) REFERENCES "Semesters" (semester_id), 
	FOREIGN KEY(degree_program_id) REFERENCES "Degree_Programs" (degree_program_id)
)

/*
2 rows from Student_Enrolment table:
student_enrolment_id	degree_program_id	semester_id	student_id	other_details
1	12	13	14	None
2	4	2	9	None
*/


CREATE TABLE "Student_Enrolment_Courses" (
	student_course_id INTEGER, 
	course_id INTEGER NOT NULL, 
	student_enrolment_id INTEGER NOT NULL, 
	PRIMARY KEY (student_course_id), 
	FOREIGN KEY(student_enrolment_id) REFERENCES "Student_Enrolment" (student_enrolment_id), 
	FOREIGN KEY(course_id) REFERENCES "Courses" (course_id)
)

/*
2 rows from Student_Enrolment_Courses table:
student_course_id	course_id	student_enrolment_id
0	6	2
1	6	8
*/


CREATE TABLE "Students" (
	student_id INTEGER, 
	current_address_id INTEGER NOT NULL, 
	permanent_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), 
	ssn VARCHAR(40), 
	date_first_registered DATETIME, 
	date_left DATETIME, 
	other_student_details VARCHAR(255), 
	PRIMARY KEY (student_id), 
	FOREIGN KEY(permanent_address_id) REFERENCES "Addresses" (address_id), 
	FOREIGN KEY(current_address_id) REFERENCES "Addresses" (address_id)
)

/*
2 rows from Students table:
student_id	current_address_id	permanent_address_id	first_name	middle_name	last_name	cell_mobile_number	email_address	ssn	date_first_registered	date_left	other_student_details
1	10	15	Timmothy	Anna	Ward	(096)889-8954x524	erwin.zboncak@example.com	965	1971-02-05 07:28:23	1971-05-17 19:28:49	quia
2	12	5	Hobart	Lorenz	Balistreri	1-009-710-5151	swift.kolby@example.com	304246	1976-10-26 02:33:06	2013-10-05 17:41:28	autem
*/


CREATE TABLE "Transcript_Contents" (
	student_course_id INTEGER NOT NULL, 
	transcript_id INTEGER NOT NULL, 
	FOREIGN KEY(transcript_id) REFERENCES "Transcripts" (transcript_id), 
	FOREIGN KEY(student_course_id) REFERENCES "Student_Enrolment_Courses" (student_course_id)
)

/*
2 rows from Transcript_Contents table:
student_course_id	transcript_id
0	2
96	8
*/


CREATE TABLE "Transcripts" (
	transcript_id INTEGER, 
	transcript_date DATETIME, 
	other_details VARCHAR(255), 
	PRIMARY KEY (transcript_id)
)

/*
2 rows from Transcripts table:
transcript_id	transcript_date	other_details
1	1988-04-30 01:19:47	None
2	1975-10-28 15:16:51	None
*/
What are the names of all courses that have some students enrolled?
SELECT DISTINCT T1.course_name FROM Courses AS T1 JOIN Student_Enrolment_Courses AS T2 ON T1.course_id  =  T2.course_id
[{'course_name': 'la'}, {'course_name': 'pl'}, {'course_name': 'ai'}, {'course_name': 'math'}, {'course_name': 'ml'}, {'course_name': 'os'}, {'course_name': 'en'}, {'course_name': 'nlp'}, {'course_name': 'rs'}, {'course_name': 'db'}]