Hot answers tagged

5

A is not good a table for the keywords ID PK Keyword then have a join table jobID PK FK keywordID PK FK with FK to the two tables


5

Easy on the bigint and nvarchar(MAX) Table Student: ID int (primary key, identity) Name nvarchar(800) Table Question: ID smallint (primary key, identity) TextOfTheQuestion nvarchar(800) CorrectAns tinyint FK (to AnswerNum.Num) tested and can make a composite FK to Answer QuestionID, AnsNum I was not sure could do this but it would mean you have ...


4

I think you've pretty much nailed it on your initial schema. However, since we're dealing with an MCQ scenario, you don't require an "Answers" table - the answer can be included in the question (along with the two incorrect answers - see below). This will greatly simplify matters. Another smaller change that I would recommend is having a Question_ID field ...


1

If you migrate from RDBMS to NoSQL then you will also have problems. They are not interchangeable for all types of usage. When you start a project then just before you start the creation of your data objects you must choose the one that suits best to your needs. Changing later will nearly always cause problems as soon as you use more then the 'standard' ...


1

For databases of a significant size, the normalised logical design is typically created first. Following this, sample queries are run and the database is then denormalised for performance if need be (the physical design). If the gains are minimal, you may elect to stick with the logical design for the simple reason that it is easier to understand and is more ...


1

It sounds like you're talking about a self-referential relationship, especially with the inclusion of "manager" titles. This is a common pattern, especially with employee tables. While they may implement it differently the main RDBMS vendors typically offer recursive capabilities. This means that with a special syntax you can easily query this kind of a ...


1

This is a too broad of a question sadly as each DB Engine might do it differently. To put it very simply most of them work by making a copy of the data you want sorted in a different way. This way when you look for a range of data it's already sorted so the DB Engine can very quickly find what you want without scanning everything. Imagine if you had ...


1

"Designing database" exam task solution most probably should show how a student can express domain business rules by means of DB data integrity tools (PK,FK). Your solution covers most of them. Missing rules are: (1) Only one Answer is solution to a Question. Bit flag doesn't help without triggers or extra app code. (2) A Student can choose only one Answer ...


1

As I review the structure you have now I would change the identity columns from BigInt to Int. I suggest you review how many Students, Questions, Answers and Choices you expect and select data types with appropriate sized ranges. I would also replace nvarchar(max) with a more reasonable sized field. As there are limitations with functions on nvarchar(max). ...


1

aha! I've recently been reading "SQL Antipatterns: Avoiding the Pitfalls of Database Programming" by Bill Karwin. He talks about this specific antipattern in chapter 8. Trying to create X number of columns in the table is the incorrect solution. The solution is to create a dependent table. You create a column in this table for the multivalued attribute. ...



Only top voted, non community-wiki answers of a minimum length are eligible