Statistical View of Data in a Clustered Bar Chart - Database
(Page 2 of 5 )
The database consists of four tables.
- Students
- Programs
- Subjects
- Marks
Each of the first three tables has a one-to-many relationship with the Marks table.

SQL statements to create these tables are as follows:
Marks Table
CREATE TABLE marks (
id int(11) NOT NULL auto_increment,
student_id int(11) DEFAULT '0' NOT NULL,
program int(11) DEFAULT '0' NOT NULL,
subject int(11) DEFAULT '0' NOT NULL,
marks int(11) DEFAULT '0' NOT NULL,
entry_date date,
PRIMARY KEY (id)
);
Programs Table
CREATE TABLE programs (
id int(11) NOT NULL auto_increment,
program varchar(255),
PRIMARY KEY (id),
UNIQUE program (program)
);
Students Table
CREATE TABLE students (
id int(11) NOT NULL auto_increment,
name varchar(100),
PRIMARY KEY (id)
);
Subjects Table
CREATE TABLE subjects (
id int(11) NOT NULL auto_increment,
subject varchar(255),
PRIMARY KEY (id),
UNIQUE subject (subject)
);
Next: Getting Down and Dirty >>
More PHP Articles
More By Muhammad Naeem