I am building a web app for a school and I need to arrange the topics into sections.
I have a course model and I want to arrange the course content into sections, e.g.
COURSE TITLE - LEARNING PHP
- Getting Started with PHP
- What is php
- writing your first php syntax
- PHP and MYSQL
- making a connection to db
- listening for response
this is what I came up with
CREATE TABLE courses (
course_id INT NOT NULL,
title VARCHAR(50) NOT NULL,
PRIMARY KEY(course_id)
);
CREATE TABLE sections (
section_id INT NOT NULL,
title VARCHAR(50) NOT NULL,
course_id INT NOT NULL,
PRIMARY KEY(section_id),
FOREIGN KEY (course_id) REFERENCES COURSES(course_id)
);
CREATE TABLE topics (
topic_id INT NOT NULL,
section_id INT NOT NULL,
title VARCHAR(50) NOT NULL,
video_url varchar(255),
PRIMARY KEY(section_id),
FOREIGN KEY (section_id) REFERENCES SECTIONS(section_id)
);
but my problem here is when i collect all sections related to a course, it is sorts the sections according to timestamp and I cant sort by title either because 1 can be zzzz and section 2 aaa.
please how do I go about this. if my schema is not appropriate, please guide me thanks