relational-database

How to implement a one-to-many relationship with an “Is Current” requirement

北战南征 提交于 2020-01-15 15:31:14
问题 Designing a database, there's a relationship between two tables, Job and Document . One Job can have multiple Documents , but one (and only one) of these Documents needs to be flagged as IsCurrent . This is not always the most recent Document associated with that Job . Structurally, I can see two ways of doing this. The first is to add a DocumentId column to Job , and a JobId column to Document . This will work, but creates a circular reference: when imported into Entity Framework you end up

What is 1NF truly?

…衆ロ難τιáo~ 提交于 2020-01-15 07:04:04
问题 While studying relational databases, I ran into this confusing page where the following snapshot summarizes my confusion: Why does the author say that Subject Table is in 1NF when student_id 401 and subject Math is repeated in the same way the blue depicts? This seems like a contradiction. 回答1: The key concept this page fails to mention is that the data contained in the row must not be duplicated, meaning that a single key value cannot have multiple values for a single column. The real

What is 1NF truly?

房东的猫 提交于 2020-01-15 07:03:54
问题 While studying relational databases, I ran into this confusing page where the following snapshot summarizes my confusion: Why does the author say that Subject Table is in 1NF when student_id 401 and subject Math is repeated in the same way the blue depicts? This seems like a contradiction. 回答1: The key concept this page fails to mention is that the data contained in the row must not be duplicated, meaning that a single key value cannot have multiple values for a single column. The real

How do I override the cascade delete for a relation in Grails GORM?

我怕爱的太早我们不能终老 提交于 2020-01-14 19:38:27
问题 I'm having some problems with the GORM part of Grails. I am using Grails 1.3.4, together with H2. In the database I have two tables template and report . On the GORM-level I have the two Domain classes Template and Report ; class Template { static hasMany = [reports: Report] ... } and class Report { static belongsTo = [template: Template] ... } Default behaviour seems to be that when a Template is deleted, the deletion will be cascaded so that all Report s that it has will be deleted as well.

Are there generic options for version control within a database?

故事扮演 提交于 2020-01-14 10:08:13
问题 I have a small amount of experience using SVN on my development projects, and I have just as little experience with relational databases. I know the basic concepts like tables, and SQL statements, but I'm far from being an expert. What I'd like to know is if there are any generic version control type systems like SVN, but that work with a database rather than files. I would like the same kind of features you get with SVN like the ability to create branches, create tags, and merge branches

Are there generic options for version control within a database?

穿精又带淫゛_ 提交于 2020-01-14 10:04:07
问题 I have a small amount of experience using SVN on my development projects, and I have just as little experience with relational databases. I know the basic concepts like tables, and SQL statements, but I'm far from being an expert. What I'd like to know is if there are any generic version control type systems like SVN, but that work with a database rather than files. I would like the same kind of features you get with SVN like the ability to create branches, create tags, and merge branches

Database design for an online quiz

故事扮演 提交于 2020-01-14 07:08:27
问题 I am designing an online math quiz for a college project and having some trouble with designing my database. The basic idea of the website is as follows: A teacher, once registered may log in and add questions to their account. They can choose between making the questions multiple choice OR true or false. They can also choose between making their questions public or private. (If they choose to make the questions public, other teachers may view the questions.) At any time the teacher may

Designing a database that handles inventory tracking with product variations

為{幸葍}努か 提交于 2020-01-14 06:19:06
问题 I am designing a database for a project that handles inventory management for shops. Basically, each Product can have the variations Color , and Size , and obviously, the number of products (stock) of each possible variation will vary. Example: [ { "product": "Plain T-Shirt", "color": "Red", "size": "Medium", "stock": 10, }, { "product": "Plain T-Shirt", "color": "Red", "size": "Large", "stock": 2, }, ] Here, the same product (Plain T-Shirt) has different stocks for different variations. As

How to store value objects in a relational database?

我怕爱的太早我们不能终老 提交于 2020-01-14 03:18:08
问题 I am working with a large project that has many objects that represent simple (non-related) values. Sometimes these values are a single string, sometimes they are two strings, sometimes a string and an int... Currently we have a 'values' table in our relational database that contains the columns: Id , Category , String1 , String2 ..., Int1 , Int2 ..., Double1 etc. It's convenient, but a mess. The values all have the following properties: Every object with the same Category has the same

How to store value objects in a relational database?

孤人 提交于 2020-01-14 03:17:26
问题 I am working with a large project that has many objects that represent simple (non-related) values. Sometimes these values are a single string, sometimes they are two strings, sometimes a string and an int... Currently we have a 'values' table in our relational database that contains the columns: Id , Category , String1 , String2 ..., Int1 , Int2 ..., Double1 etc. It's convenient, but a mess. The values all have the following properties: Every object with the same Category has the same