Share your knowledge at the LQ Wiki.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 03-16-2008, 11:24 PM   #1
Registered: Jun 2006
Distribution: Kubuntu Hardy
Posts: 94

Rep: Reputation: 15
SQL noob question: can SQL effectively handle a 2D matrix?

I'm an SQL noob, but I'm a decent C/C++ programmer. I have an idea for a large scale gradebook system, and I'm wondering if SQL has what I need to efficiently implement the following structure:

Student: {ID, Name, etc}
Assignment: {ID, Description, Points possible, etc}
Grade: {value:int}

Student students[student_count]
Assignment assignments[assignment_count]
Grade grades[student_count /*rows*/ ][assignment_count /*columns*/ ]

This structure could be pictured by having the students listed on the left axis, and the assignments listed on the top axis, and all the grades as entries on a spreadsheet in the body. The interesting part is that the grades are a 2D matrix. Students and/or assignments will need to be able to be dynamically inserted and deleted (imagine editing a spreadsheet).

The other interesting part is that the system will need to be usable on a large scale (imagine, instead of a class of 20 with 15 assignments, a community college with 55 campuses across the nation, 100 courses offered per campus, and 20-1000 students per class). It should be possible to add an assignment to a course that is fragmented into different classes with the same assignments.

As well, it should be possible to access the gradebook with multiple frontends (e.g. one in Qt, one in GTK, one in terminal, etc) if these are written, and it would be nice if the system could support a simple mode in which the grades are simply written to a file (ideal for a typical high school teacher in a school without a Linux server).

My question is: would MySQL be ideal for this sort of setup, or would another SQL system or another database setup be better?
Old 03-17-2008, 01:04 AM   #2
LQ Guru
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.9, Centos 7.3
Posts: 17,406

Rep: Reputation: 2396Reputation: 2396Reputation: 2396Reputation: 2396Reputation: 2396Reputation: 2396Reputation: 2396Reputation: 2396Reputation: 2396Reputation: 2396Reputation: 2396
This sort of app should be fine for any decent SQL system, inc MySQL, but use the InnoDB engine and SQL txns to ensure data integrity.
Looks like you could use a Courses table as well.

I also recommend the following my.conf setting:
Old 03-17-2008, 01:10 AM   #3
LQ Newbie
Registered: Jun 2006
Location: Bangalore, India
Distribution: Fedora Core 5
Posts: 11

Rep: Reputation: 0
One of the ways you can achieve this would be, create a grades table where you will have student id, assignment id(as foreign keys) and the grade. Now you can search the grades table by student id, assignment is or both.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Sql - stored procedures, views, and dynamic sql generation LXer Syndicated Linux News 0 08-17-2006 06:33 AM
SQL: old sql dump not loading into new db BrianK Linux - Software 1 07-25-2006 11:55 PM
Migrating from MS-SQL server to My-SQL emailssent Linux - Networking 2 02-07-2005 02:20 PM
Which SQL is suitable for EMbedded SQL on C? hk_michael Programming 4 01-10-2005 05:07 PM
Multiple values with SQL (Noob stuff) Travis86 Programming 6 09-03-2003 08:38 PM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:38 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration