Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8495377
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T23:33:27+00:00 2026-06-10T23:33:27+00:00

I’m working on this little enrollment system and i have this problem that if

  • 0

I’m working on this little enrollment system and i have this problem that if i want to enroll the student in my system the value of year/lvl should only increase, For example Grade1 once enrolled will be grade 2 and not decrease to preparatory nor double value to grade 3. So far my data entry is flat out inserting varchars. would appreciate any help on how can i do a pattern of progression and how should my database look like. Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T23:33:28+00:00Added an answer on June 10, 2026 at 11:33 pm

    I wouldn’t suggest that you use varchars where you really mean numbers. It makes some things oh-so-much easier.

    mysql> create table studentLevels(id int(3) primary key auto_increment, name varchar(100));
    Query OK, 0 rows affected (0.02 sec)
    
    mysql> desc studentLevels;
    +-------+--------------+------+-----+---------+----------------+
    | Field | Type         | Null | Key | Default | Extra          |
    +-------+--------------+------+-----+---------+----------------+
    | id    | int(3)       | NO   | PRI | NULL    | auto_increment |
    | name  | varchar(100) | YES  |     | NULL    |                |
    +-------+--------------+------+-----+---------+----------------+
    2 rows in set (0.00 sec)
    
    mysql> create table studentEnrolled (studentID int(3),subjectID int(3), grade int(3));
    Query OK, 0 rows affected (0.00 sec)
    
    mysql> desc studentEnrolled;
    +-----------+--------+------+-----+---------+-------+
    | Field     | Type   | Null | Key | Default | Extra |
    +-----------+--------+------+-----+---------+-------+
    | studentID | int(3) | YES  |     | NULL    |       |
    | subjectID | int(3) | YES  |     | NULL    |       |
    | grade     | int(3) | YES  |     | NULL    |       |
    +-----------+--------+------+-----+---------+-------+
    3 rows in set (0.00 sec)
    
    mysql> create table subjects (id int(3), subGrade int(3));
    Query OK, 0 rows affected (0.05 sec)
    
    mysql> desc subjects;
    +----------+--------+------+-----+---------+-------+
    | Field    | Type   | Null | Key | Default | Extra |
    +----------+--------+------+-----+---------+-------+
    | id       | int(3) | YES  |     | NULL    |       |
    | subGrade | int(3) | YES  |     | NULL    |       |
    +----------+--------+------+-----+---------+-------+
    2 rows in set (0.00 sec)
    

    Now, with this structure, you have a table to identify your students nicely, you can do a lot with the primary key here as needed (link it to other tables, add functionality that you aren’t aware you want right now later – and the data is normalized). You have a neat table that defines what the student is enrolled in – linked back to the student. And lastly, you have another neat succinct table that holds subject information.

    Looking at the grade column that is used to see where a student is at, you can use one of the following:

    When a student completes a course, you can update the grade like this:

    update 
        studentEnrolled a, 
        subjects b 
    set 
        a.grade=b.subGrade 
    where 
        a.subjectID=b.id 
        and a.studentID=:ID
    

    The above will use a bound parameter from your application and the code will simply update the student grade to the subject that was just passed.

    If you want students to be able to go back and do courses that have a lower grade, but don’t want their “grade” to to drop, you can easily modify the above to be this:

    update 
        studentEnrolled a, 
        subjects b 
    set 
        a.grade=b.subGrade 
    where 
        a.subjectID=b.id 
        and a.grade<subGrade 
        and a.studentID=:ID
    

    The update will now only modify a record where the student gained a “grade”.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I'm working with an upstream system that sometimes sends me text destined for HTML/XML
this is what i have right now Drawing an RSS feed into the php,
I have this code to decode numeric html entities to the UTF8 equivalent character.
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
This could be a duplicate question, but I have no idea what search terms
I know there's a lot of other questions out there that deal with this
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.