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 8726413
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T08:14:21+00:00 2026-06-13T08:14:21+00:00

I’m pretty new at MySQL and database structure and I was wondering if anyone

  • 0

I’m pretty new at MySQL and database structure and I was wondering if anyone could help with the best way to design this database. The application is essentially an online exercise book. It will have exercises for students to complete and have the results stored in the database.

A Parent will be able to view their child’s answers, while the Teacher can view their entire class’ results.

I have 3 different types of users, Teachers, Parents and Students. each student is linked to a Parent, and each student is linked to a class. A Teacher is linked to multiple classes.

My current structure for users can be seen here;

enter image description here

Should I create a single Users table and have a UserType field? If so how do I go about linking the student to a class and parent?

  • 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-13T08:14:23+00:00Added an answer on June 13, 2026 at 8:14 am

    I have created a schema for this:-

    DROP TABLE IF EXISTS `class`;
    
    CREATE TABLE `class` (
      `class_id` int(11) NOT NULL AUTO_INCREMENT,
      `class_name` varchar(255) DEFAULT NULL,
      PRIMARY KEY (`class_id`)
    ) ENGINE=MyISAM AUTO_INCREMENT=4 DEFAULT CHARSET=latin1;
    
    /*Data for the table `class` */
    
    insert  into `class`(`class_id`,`class_name`) values (1,'A'),(2,'B'),(3,'C');
    
    /*Table structure for table `info` */
    
    DROP TABLE IF EXISTS `info`;
    
    CREATE TABLE `info` (
      `info_id` int(11) NOT NULL AUTO_INCREMENT,
      `user_id` int(11) DEFAULT NULL,
      `parent_id` int(11) DEFAULT NULL,
      `class_id` int(11) DEFAULT NULL,
      PRIMARY KEY (`info_id`)
    ) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=latin1;
    
    /*Data for the table `info` */
    
    insert  into `info`(`info_id`,`user_id`,`parent_id`,`class_id`) values (1,3,2,1);
    
    /*Table structure for table `user` */
    
    DROP TABLE IF EXISTS `user`;
    
    CREATE TABLE `user` (
      `user_id` int(11) NOT NULL AUTO_INCREMENT,
      `user_name` varchar(255) DEFAULT NULL,
      `users_types_id` int(11) DEFAULT NULL,
      `class_id` int(11) DEFAULT NULL,
      PRIMARY KEY (`user_id`)
    ) ENGINE=MyISAM AUTO_INCREMENT=6 DEFAULT CHARSET=latin1;
    
    /*Data for the table `user` */
    
    insert  into `user`(`user_id`,`user_name`,`users_types_id`,`class_id`) values (1,'TeacherA',1,1),(2,'Parent',2,0),(3,'StudentA',3,1),(4,'TeacherB',1,2),(5,'TeacherC',1,3);
    
    DROP TABLE IF EXISTS `users_types`;
    
    CREATE TABLE `users_types` (
      `users_types_id` int(11) NOT NULL AUTO_INCREMENT,
      `type` varchar(255) DEFAULT NULL,
      PRIMARY KEY (`users_types_id`)
    ) ENGINE=MyISAM AUTO_INCREMENT=4 DEFAULT CHARSET=latin1;
    
    /*Data for the table `users_types` */
    
    insert  into `users_types`(`users_types_id`,`type`) values (1,'Teacher'),(2,'Parent'),(3,'Student');
    

    sqlfiddle here

    Also before insertion check if the record exists for user and parent in info table.

    • 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’Everest What PHP function
This could be a duplicate question, but I have no idea what search terms
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
Does anyone know how can I replace this 2 symbol below from the string
Let's say I'm outputting a post title and in our database, it's Hello Y’all
That's pretty much it. I'm using Nokogiri to scrape a web page what has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
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.

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.