relational-database

Are There Bidirectional Relational Databases?

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-30 16:18:02
问题 I'd like to create a clothing database, where items from tables such as 'tops' or 'bottoms' (pants, skirts) can be matched with each other and with items in other tables such as hats or shoes. I want to be able to relate all tables to each other in both directions (each skirt goes with many tops, and each top goes with many pants, etc) and I want each table to be related to each other. E.g, I want to query 'what items look good with these pants' and see a list of shirts, shoes, etc. Using a

Advice on design relations between tables

大憨熊 提交于 2019-12-30 12:54:09
问题 I have information about music albums that I want to organise in RDBMS tables with relations between them. I have the following info for each album: artist, album name, year, label, genre, style, rating. So far I think to make 4 tables - artists, albums (name, year, label, rating), genre1 and genre2 (each genre with its styles). On the diagram it looks as follows: But don't know yet how can I establish a connection between albums and the other three tables? I.e., when I will run a query

When should a social security number be used as a database primary key?

只愿长相守 提交于 2019-12-30 11:38:20
问题 Our DBA says that because the social security number (SSN) is unique, that we should use it as the primary key in a table. While I do not agree with the DBA (and have already mentioned some of the good parts found in this answer), are there any situations where he could possibly be correct? 回答1: SSN is not a unique identifier for people. Whether it should be the PK in some table depends on what the rows in the table mean. (See also sqlvogel's answer.) 6.1 percent of Americans have at least

Complex IF statement with 3 tables

馋奶兔 提交于 2019-12-30 11:09:14
问题 This is a continuation of this question from yesterday. Here are my three tables: Fighters Table fighter_id | name ----------------------- 1 | John 2 | Steve 3 | Bill 4 | Bobby Events Table event_id | event_name | event_date ------------------------------------------- 1 | MMA | 01/01/2010 2 | Cool | 02/20/2010 3 | Yeaa! | 04/15/2010 Fights Table fight_id | fighter_a | fighter_b | winner | method | event ----------------------------------------------------------------------- 1 | 1 | 2 | 1 |

Storing inherited objects in a database

拈花ヽ惹草 提交于 2019-12-30 07:01:06
问题 I'm trying to figure out the best way to map inheritance relationships in an object model into a relational database. For example consider the following class structure. public Class Item { public String Name{get; set;} public int Size {get; set} } public Class Widget:Item { public String Color{get; set;} } public Class Doohicky:Item { public String Smell{get; set;} } Here's are a few options I'm considering for how to save this structure to a database. Options 1: Single Table for all item

Relational Data Model for Double-Entry Accounting

北慕城南 提交于 2019-12-30 05:31:28
问题 The bounty expires in 5 hours . Answers to this question are eligible for a +50 reputation bounty. Alex wants to draw more attention to this question. Assume there is a bank, a large shop, etc, that wants the accounting to be done correctly, for both internal accounts, and keeping track of customer accounts. Rather than implementing that which satisfies the current simple and narrow requirement, which would a 'home brew': those turn out to be a temporary crutch for the current simple

When to use a key-value data store vs. a more traditional relational DB?

旧街凉风 提交于 2019-12-29 18:44:08
问题 When would one choose a key-value data store over a relational DB? What considerations go into deciding one or the other? When is mix of both the best route? Please provide examples if you can. 回答1: In my experience, if you're even asking the question whether to use traditional vs esoteric practices, then go traditional. While esoteric practices are sexy, challenging, and fun, 99.999% of applications call for a traditional approach. With regards to relational vs KV, the question you should be

Data Modeling: Logical Modeling Exercise

我只是一个虾纸丫 提交于 2019-12-29 11:41:28
问题 In trying to learn the art of data storage I have been trying to take in as much solid information as possible. PerformanceDBA posted some really helpful tutorials/examples in the following posts among others: is my data normalized? and Relational table naming convention. I already asked a subset question of this model here. So to make sure I understood the concepts he presented and I have seen elsewhere I wanted to take things a step or two further and see if I am grasping the concepts.

How to apply complex constraints to a database table in MySQL?

前提是你 提交于 2019-12-29 09:25:28
问题 As I am in the final stages of setting up a database for one of my projects, I have thought of an additional constraint that would need to be added to the Task table (see image below), but I am not sure how this can be implemented in MySQL. Original Database Schema (without markups): Click here. Database Schema with Markups: For each job ( job ), a WBS Code List ( wbscodelist ) is assigned. Each of these lists contain a number of WBS Codes ( wbscodeitem ) that apply to that job. An example

Look-up vs relationship Microsoft Access

风格不统一 提交于 2019-12-29 05:32:06
问题 I'm developing a Microsoft Access 2013 based information system. One of the client's demands was to simplify the data entry process by using combo box with available values. For example, instead of entering agentID the client asked to let the user choose agent name from the combo box, the same logic with other similar fields. In brief: I need to avoid as much as possible the need to enter the values ID and let to user choose them from the combo box. Microsoft Access has a built-in lookup