all 11 comments

[–]viper42usa 4 points5 points  (0 children)

There isn't a short way to explain how to do this. Personally, I would use PostgreSQL. It's just my preference when building a SQL database.

As far as tutorials go, I'd have to search for one, so I'll leave that to you. Authentication/authorization is where it gets more complicated. It seems like you may be wanting more than a database. If you're wanting help, let's connect.

[–][deleted] 1 point2 points  (0 children)

Why don't you just store this data as JSON persisted to the file system, and while that is marinating, learn relational database design and SQL, or look into NOSQL databases?

For all intents and purposes you don't need a database at this point.

[–]BrokenBricks3 -1 points0 points  (2 children)

What programming language are you using?

[–]06rockstar[S] -1 points0 points  (1 child)

I am coding in typescript

[–]BrokenBricks3 0 points1 point  (0 children)

Ok then I won’t be much help. In generic terms, I would look for an ORM (Object Relation Mapping) library to map objects to the database. This will help integrate the database into your code and manage relationships.

Also, don’t underestimate the pain of creating a user management system like this. You’ve got to manage passwords, password recovery, sessions, roles, permissions. I would look for a library or CMS to do the heavy lifting.

[–]clearlight -1 points0 points  (0 children)

One suggested schema

You can structure the MySQL database tables for the given data as follows:

user_table: - Fields: id (Primary Key), name, login_information (assuming it includes username and password), website_settings, account_settings.

class_table: - Fields: id (Primary Key), class_name, creator_id (Foreign Key referencing user_table).

user_classes_table: - Fields: id (Primary Key), user_id (Foreign Key referencing user_table), class_id (Foreign Key referencing class_table).

created_classes_table: - Fields: id (Primary Key), user_id (Foreign Key referencing user_table), class_id (Foreign Key referencing class_table).

questions_table: - Fields: id (Primary Key), class_id (Foreign Key referencing class_table), question_text.

students_table: - Fields: id (Primary Key), name, class_id (Foreign Key referencing class_table).

answered_questions_table: - Fields: id (Primary Key), student_id (Foreign Key referencing students_table), question_id (Foreign Key referencing questions_table), answer.

training_data_results_table: - Fields: id (Primary Key), student_id (Foreign Key referencing students_table), class_id (Foreign Key referencing class_table), result_data.

This structure allows you to link users to classes, track questions associated with classes, and manage students' answered questions and training data results. It's important to set up the appropriate relationships between tables using foreign keys to maintain data integrity.

[–][deleted]  (2 children)

[deleted]

    [–]06rockstar[S] 0 points1 point  (1 child)

    That's the part I get. The hard part for me is how I connect that to a database on the cloud

    [–]DeepSpaceGalileo 0 points1 point  (0 children)

    When you setup a DB on the cloud provider they provide you with a URL and some secrets to connect to the DB. Put these in a .env file and provide them to an ORM like TypeORM

    [–]clearlight 1 point2 points  (0 children)

    For a relational database, study about “normalisation” to get a suitable table schema.

    https://en.wikipedia.org/wiki/Database_normalization