Click here to Skip to main content
15,895,774 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
i want a guideline or a structure , can anyone just explain me how my database should look like if a teacher etc wants to save paper in database

What I have tried:

all i did is added questions and retrieve like in a simple way bu idk how my sql database structure should look like
i have Questionid, question,option1,2,3,4 and answer and subjectname what should i add more r what?
Posted
Updated 3-Jun-17 22:00pm
v2

1 solution

You want to have several tables:
Teachers:
ID              IDENTITY or GUID
Name            NVARCHAR()
Subjects:
ID              IDENTITY or GUID
Name            NVARCHAR()

Papers:
ID              IDENTITY or GUID
Name            NVARCHAR()
SubmitDate      DATE or DATETIME
TeacherID       INT or GUID, Foreign key to Teachers.ID
SubjectID         INT or GUID, Foreign key to Subjects.ID
Questions:
ID              IDENTITY or GUID
PaperID         INT or GUID, Foreign key to Papers.ID
...
You then access them using SQL JOIN statements:
SQL
SELECT q.* FROM Questions q
JOIN Papers p ON q.PaperID = p.ID
WHERE p.Name LIKE '%Transdimensional Physics%'
 
Share this answer
 
Comments
OriginalGriff 30-May-17 13:55pm    
Via the ID and foreign key values: look at the JOIN and see what it does.
stella bloom 31-May-17 6:21am    
thnx

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900