CREATE TABLE Addresses (
    address_id NUMBER PRIMARY KEY,
    line_1 TEXT,
    line_2 TEXT,
    line_3 TEXT,
    city TEXT,
    zip_postcode TEXT,
    state_province_county TEXT,
    country TEXT,
    other_address_details TEXT
);
CREATE TABLE Courses (
    course_id NUMBER PRIMARY KEY,
    course_name TEXT,
    course_description TEXT,
    other_details TEXT
);
CREATE TABLE Departments (
    department_id NUMBER PRIMARY KEY,
    department_name TEXT,
    department_description TEXT,
    other_details TEXT
);
CREATE TABLE Degree_Programs (
    degree_program_id NUMBER PRIMARY KEY,
    department_id NUMBER,
    degree_summary_name TEXT,
    degree_summary_description TEXT,
    other_details TEXT,
    FOREIGN KEY ("department_id") REFERENCES Departments("department_id")
);
CREATE TABLE Sections (
    section_id NUMBER PRIMARY KEY,
    course_id NUMBER,
    section_name TEXT,
    section_description TEXT,
    other_details TEXT,
    FOREIGN KEY ("course_id") REFERENCES Courses("course_id")
);
CREATE TABLE Semesters (
    semester_id NUMBER PRIMARY KEY,
    semester_name TEXT,
    semester_description TEXT,
    other_details TEXT
);
CREATE TABLE Students (
    student_id NUMBER PRIMARY KEY,
    current_address_id NUMBER,
    permanent_address_id NUMBER,
    first_name TEXT,
    middle_name TEXT,
    last_name TEXT,
    cell_mobile_number TEXT,
    email_address TEXT,
    ssn TEXT,
    date_first_registered TIME,
    date_left TIME,
    other_student_details TEXT,
    FOREIGN KEY ("permanent_address_id") REFERENCES Addresses("address_id"),
    FOREIGN KEY ("current_address_id") REFERENCES Addresses("address_id")
);
CREATE TABLE Student_Enrolment (
    student_enrolment_id NUMBER PRIMARY KEY,
    degree_program_id NUMBER,
    semester_id NUMBER,
    student_id NUMBER,
    other_details TEXT,
    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 NUMBER PRIMARY KEY,
    course_id NUMBER,
    student_enrolment_id NUMBER,
    FOREIGN KEY ("student_enrolment_id") REFERENCES Student_Enrolment("student_enrolment_id"),
    FOREIGN KEY ("course_id") REFERENCES Courses("course_id")
);
CREATE TABLE Transcripts (
    transcript_id NUMBER PRIMARY KEY,
    transcript_date TIME,
    other_details TEXT
);
CREATE TABLE Transcript_Contents (
    student_course_id NUMBER,
    transcript_id NUMBER,
    FOREIGN KEY ("transcript_id") REFERENCES Transcripts("transcript_id"),
    FOREIGN KEY ("student_course_id") REFERENCES Student_Enrolment_Courses("student_course_id")
);

Question: What is the date and id of the transcript with at least 2 courses listed?
SQL: SELECT T2.transcript_date ,  T1.transcript_id FROM Transcript_Contents AS T1 JOIN Transcripts AS T2 ON T1.transcript_id  =  T2.transcript_id GROUP BY T1.transcript_id HAVING count(*)  >=  2

Question: What is the phone number of the man with the first name Timmothy and the last name Ward?
SQL: SELECT cell_mobile_number FROM Students WHERE first_name  =  'Timmothy' AND last_name  =  'Ward'

Question: What is the mobile phone number of the student named Timmothy Ward ?
SQL: select cell_mobile_number from students where first_name  =  'timmothy' and last_name  =  'ward'

Question: Who is the first student to register? List the first name, middle name and last name.
SQL: SELECT first_name ,  middle_name ,  last_name FROM Students ORDER BY date_first_registered ASC LIMIT 1

Question: What is the first, middle, and last name of the first student to register?
SQL: SELECT first_name ,  middle_name ,  last_name FROM Students ORDER BY date_first_registered ASC LIMIT 1

Question: Who is the earliest graduate of the school? List the first name, middle name and last name.
SQL: SELECT first_name ,  middle_name ,  last_name FROM Students ORDER BY date_left ASC LIMIT 1

Question: What is the first, middle, and last name of the earliest school graduate?
SQL: SELECT first_name ,  middle_name ,  last_name FROM Students ORDER BY date_left ASC LIMIT 1

Question: Whose permanent address is different from his or her current address? List his or her first name.
SQL: SELECT first_name FROM Students WHERE current_address_id != permanent_address_id

Question: What is the first name of the student whose permanent address is different from his or her current one?
SQL: SELECT first_name FROM Students WHERE current_address_id != permanent_address_id

Question: Which address holds the most number of students currently? List the address id and all lines.
SQL: SELECT T1.address_id ,  T1.line_1 ,  T1.line_2 FROM Addresses AS T1 JOIN Students AS T2 ON T1.address_id  =  T2.current_address_id GROUP BY T1.address_id ORDER BY count(*) DESC LIMIT 1

Question: What is the id, line 1, and line 2 of the address with the most students?
SQL: SELECT T1.address_id ,  T1.line_1 ,  T1.line_2 FROM Addresses AS T1 JOIN Students AS T2 ON T1.address_id  =  T2.current_address_id GROUP BY T1.address_id ORDER BY count(*) DESC LIMIT 1

Question: On average, when were the transcripts printed?
SQL: SELECT avg(transcript_date) FROM Transcripts

Question: What is the average transcript date?
SQL: SELECT avg(transcript_date) FROM Transcripts

Question: When is the first transcript released? List the date and details.
SQL: SELECT transcript_date ,  other_details FROM Transcripts ORDER BY transcript_date ASC LIMIT 1

Question: What is the earliest date of a transcript release, and what details can you tell me?
SQL: SELECT transcript_date ,  other_details FROM Transcripts ORDER BY transcript_date ASC LIMIT 1

Question: How many transcripts are released?
SQL: SELECT count(*) FROM Transcripts

Question: How many transcripts are listed?
SQL: SELECT count(*) FROM Transcripts

Question: What is the last transcript release date?
SQL: SELECT transcript_date FROM Transcripts ORDER BY transcript_date DESC LIMIT 1

Question: When was the last transcript released?
SQL: SELECT transcript_date FROM Transcripts ORDER BY transcript_date DESC LIMIT 1

Question: How many times at most can a course enrollment result show in different transcripts? Also show the course enrollment id.
SQL: SELECT count(*) ,  student_course_id FROM Transcript_Contents GROUP BY student_course_id ORDER BY count(*) DESC LIMIT 1

Question: What is the maximum number of times that a course shows up in different transcripts and what is that course's enrollment id?
SQL: SELECT count(*) ,  student_course_id FROM Transcript_Contents GROUP BY student_course_id ORDER BY count(*) DESC LIMIT 1

Question: Show the date of the transcript which shows the least number of results, also list the id.
SQL: SELECT T2.transcript_date ,  T1.transcript_id FROM Transcript_Contents AS T1 JOIN Transcripts AS T2 ON T1.transcript_id  =  T2.transcript_id GROUP BY T1.transcript_id ORDER BY count(*) ASC LIMIT 1

Question: What is the date and id of the transcript with the least number of results?
SQL: SELECT T2.transcript_date ,  T1.transcript_id FROM Transcript_Contents AS T1 JOIN Transcripts AS T2 ON T1.transcript_id  =  T2.transcript_id GROUP BY T1.transcript_id ORDER BY count(*) ASC LIMIT 1

Question: Find the semester when both Master students and Bachelor students got enrolled in.
SQL: SELECT DISTINCT T2.semester_id FROM Degree_Programs AS T1 JOIN Student_Enrolment AS T2 ON T1.degree_program_id  =  T2.degree_program_id WHERE degree_summary_name  =  'Master' INTERSECT SELECT DISTINCT T2.semester_id FROM Degree_Programs AS T1 JOIN Student_Enrolment AS T2 ON T1.degree_program_id  =  T2.degree_program_id WHERE degree_summary_name  =  'Bachelor'