How to insert data in one column in database?

Reply

Join Date: Sep 2006
Posts: 5
Reputation: anyer_ast!g is an unknown quantity at this point 
Solved Threads: 0
anyer_ast!g anyer_ast!g is offline Offline
Newbie Poster

How to insert data in one column in database?

 
0
  #1
Jan 4th, 2007
Hi 2 all experts out there....

Im begging all of you to help me in my problem... Please... please... please....

my problem goes like this:

if i have students having a grades of:

First Grading

James Tan 88

Jaime Abba 85

Grace Sasa 78

Gerald Hulife 96

Mark Reyes 85

then submit it... and retrieve for adding again the:


Second Grading

James Tan 88 78

Jaime Abba 85 90

Grace Sasa 78 85

Gerald Hul 96 85

Mark Reyes 85 90

then submit again... and retrieve for adding again the 3rd and 4th grading:



How will I insert that in one column but different fields in a database?

Like this:

tbl_studentgrade

Name 1st 2nd 3rd 4th Ave

James Tan 88 78

Jaime Abba 85 90

Grace Sasa 78 85

Gerald Hul 96 85

Mark Reyes 85 90


If anyone knows how, Please help me....

Tnx...

Reyn
"IT student doesn't work HARD but work SMART"
Reply With Quote Quick reply to this message  
Join Date: Jan 2007
Posts: 30
Reputation: Memento is an unknown quantity at this point 
Solved Threads: 0
Memento Memento is offline Offline
Light Poster

Re: How to insert data in one column in database?

 
0
  #2
Jan 14th, 2007
Hello,
If I understand you correctly, you are trying to store multiple grades in one text/varchar column.

To do this, the first grade would be put into the database using an INSERT statement with each consecutive grade getting inserted by an UPDATE statement because we are updating an existing record. Try doing something such as:

UPDATE tbl_studentgrade SET
grade = grade || ' 78'

WHERE student = 'Some Student ID'

Note that the new grade is padded with a leading space.

A more sophisticated approach might be to separate the student, grade, and assignment into separate tables.

Good luck,
Dan
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC