Scuba
Scuba

Reputation: 63

Database structure, user, category, answer, interval

I am designing a database that has many users. Each user is tied to many questions. Each question has one answer. Each question is tied to one category. There is also an interval table that I track the next time a user is due to be asked a particular question along with the interval that question is asked.

user table
- userid - username - password -email -created -lastlogon

question table
- questionid - question - answer

category table
- categoryid - category - questionid

interval table
- userid - questionid - interval - nextdate

Is this the correct approach/design for this data?

I was debating about combining the category and question table, would that be a good idea? Or I was thinking of making a linking table to store just the categoryid's and questionid's, but I am not so sure about that design. If I am not clear enough on, please just ask I will attempt to clarify.

Upvotes: 1

Views: 118

Answers (1)

RBarryYoung
RBarryYoung

Reputation: 56745

This is how I would probably do it:

CREATE TABLE [Users] (UserID, Username, Password, Email, Created, LastLogon)

CREATE TABLE [Questions] (QuestionID, Question, Answer, Interval, CategoryID)

CREATE TABLE [Categories] (CategoryID, Category)

CREATE TABLE [User_Intervals] (UserID, QuestionID, NextDate)

Upvotes: 1

Related Questions