Note that there are some explanatory texts on larger screens.

plurals
  1. POMySQL Tables for School Website
    primarykey
    data
    text
    <p>Right now I have 40+ tables for my website and I don't think I'm using MySQL to it's full power quite right. I am making a website similar to Moodle. It basically just holds tests for students grouped by courses.</p> <p><strong>Origonal Tables</strong>:</p> <pre class="lang-none prettyprint-override"><code>courses - Lists all courses (ID, Name) c_$id - Lists all the Tests (ID, Name, etc) for course number $id a_$id - Lists all questions for the test number $id (Question, A, B, C, D) g_$id - Lists all grades for the course with course number $id. c_a - Lists course ID and assignment ID pairs ex: (1,2) (1,3) (2,2) (2,3) </code></pre> <p><strong>Tables Revision 1:</strong> </p> <pre><code>courses - Lists all courses (ID, Name, etc) tests - Lists all tests (ID, Name, etc) questions - Lists all questions from all tests (ID, Ques, Ans) grades* - Lists all grades (studentID, courseID, testID, grade) students* - Lists all students and their courses (StudentID, courseID) </code></pre> <p>The grades* table, it's basically 3 primary keys and a value. Something seems odd about it. Is there a better way? Same goes for the students table. Both are basically connections of the other tables. Primary key for fast searching is not possible?</p> <p><strong>Origonal Post:</strong></p> <p>What is the most efficient way to recreate this to utilize the power of MySQL?</p> <p>As of right now when a new course is made it creates a new table for that course (<code>c_$id</code>), then a table for each assignment and a list of grades for that course <code>g_$id</code>. Then when creating an assignment it creates a new <code>a_$id</code> table,adding that course and assignment pair to <code>c_a</code>.</p> <p>I have removed the "<code>*</code>" from most of my select statements and added "<code>LIMIT 1</code>" to any that are selecting a primary key, next is solving this OOP issue.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload