How to add entries in a table column as the attributes for another table in MySQL? I am designing an Attendance Management System, so for the table which contains the attendance status(Present or not) of all the students for all the days and all courses, following are the details:


Date and Lecture ID are primary keys (Assuming that only one lecture of particular course per day)
Every student is represented as an attribute.


Is this a good design? 
How can I add students from the students table as attributes to the attendance table?
You should have a table something like this:

CREATE TABLE Attendance (
    class_id ... NOT NULL,
    student_id ... NOT NULL,
    date DATE NOT NULL,
    PRIMARY KEY(class_id, student_id, date)
) ENGINE=InnoDB;


The existence of a row says that a particular student was in a particular class for the particular day.

This is perhaps the cleanest way to store the data.  Remember:  A database is a repository for data, not a reflection of reports you might like to present.  Reports are derived from raw data.

Note that the table is not limited by the number of classes, students, or dates.

This, for example, reports how many students were in each class for each day:

SELECT class_id, date, COUNT(*)  FROM Attendance  GROUP BY class_id, date;


If you want to turn that into a 2D matrix, see the [pivot] tag.  (It's a bit tricky.