database-design

Database modeling, stock and product variant

孤街醉人 提交于 2019-12-25 09:37:06
问题 These are requirements. Multiple sellers are selling product variants. Multiple sellers can sell single product variant at the same time. (This requirement can be relaxed if it makes db modeling much simpler.) The following modeling satisfies the above two requirements. ProductVariant * id Stock * id * product_variant * seller * quantity * prices There's another requirement Multiple variants might need to share quantity among them. For instance, a teacher(seller) list his/her product as the

How to design this RDBMS schema?

痞子三分冷 提交于 2019-12-25 09:28:48
问题 So we have foods, which are usually of one single unit and recipes, which consist of varying amount of different foods. We want to track a few basic things like the price and the nutrition info. How would we design RDBMS schema for this? So, here is the probably most obvious solution: [Foods] : ID, Name, Carbs, Protein, Fat, Price [RecipeIngredients] : ID, FoodID, RecipeID, AmountOfFood [Recipes] : ID, Name However, since recipe has almost all the same actions as foods, I need to create a lot

What should i store as UserName from DotNetOpenAuth

帅比萌擦擦* 提交于 2019-12-25 08:59:54
问题 Im using DotNetOpenAuth to integrate Google,Yahoo,Twitter and Facebook Logins into my application. Now everything works as expected. Twitter returns -> User-name and Claim-identifier(Just Id) Google returns -> Email-Address, First and last Name and ID(URL+ID) Yahoo returns -> Email-Address, Alias and ID (Url + ID) Also im also allowing my users to register internally so my database User table is like this: ID,UserName,Name,OpenID,LoginType,DisplayName im wondering what i should be storing as

Generalizing work orders

自闭症网瘾萝莉.ら 提交于 2019-12-25 08:42:46
问题 Hello stackoverflowians, I am working on designing tables for work orders. The problem: There is different work order models (from now on called WOM ) The WOMs share some attributes (Num, Date, Description, ... etc) The WOMs have details such as: Sectors on wich the work is done. Some WOMs use storage tank instead of sectors (products are prepared in storage tanks). Products and their quantities (plus or no some info on product) applied to wich sector. Human ressources wich worked on the WO.

Which approach to store static data is better?

感情迁移 提交于 2019-12-25 07:47:29
问题 I am developing a web application about books. We all knows that books have different category. So, this category is basic on a sequence of number, for example, 200 = computer related, 800 = history. Each book is beyond to one category only. Here is the question. I have a category list, it may expand in the future. For example, new technology is appear, and new category will be created. So, what should I store this category? In a database? or a simple XML file? Because it is not alter all the

Clarification on splitting an Access Database

雨燕双飞 提交于 2019-12-25 07:36:04
问题 I've read multiple articles and watched videos but this is a big change to the structure so I want to confirm the idea that I have. Splitting will separate the tables and forms/queries into separate files. I get that much. But two questions. 1) Should I backup my database beforehand? 2) Can I edit the forms in design/layout view while they're being used by, say, a data entry team? The issue I'm running into now is that I created a simplistic front end for another team to use but I now need to

Converting to Third Normal Form

橙三吉。 提交于 2019-12-25 07:27:05
问题 How would you convert this table into Third Normal Form (and what are the resulting tables): 回答1: Here are the tables: Film (filmNo, fTitle, dirNo) Director(dirNo, dirName) FilmActor(filmNo, actNo, role, timeOnScreen) Actor(actNo, actName) 来源: https://stackoverflow.com/questions/37346125/converting-to-third-normal-form

Is it possible to name SQL result columns from rows in another table? (Postgres)

纵饮孤独 提交于 2019-12-25 07:01:47
问题 Basically I have users with a dynamic attributes table. Simplified: SELECT * FROM users; id | email -----+------------------------------------------ 1 | example@example.com SELECT * FROM user_attributes; id | name ----+---------------- 1 | Salutation 2 | Given Name 3 | Surname 4 | Alias 5 | Address 6 | Address 2 7 | Address 3 8 | City 9 | Region .... SELECT * FROM user_attribute_values; client_id | attribute_id | value -----------+--------------+------- What I'm looking to do is a SELECT that

Tables versioning (historical tables) and Order tables relationship

╄→гoц情女王★ 提交于 2019-12-25 06:50:02
问题 If I add a new product in the products table or change the data - it will automatically add into products_history . This is done by trigger. When customer placed the order, there is no need to duplicate the name of product in the order_products table. To get the pruduct name and price from the order_products table - you will query from the products_history table not the products table Note: I am showing simple tables for demonstration. See the following tables and the result: mysql> select *

Convoluted comparisons and exclusions inside a single MySQL table

☆樱花仙子☆ 提交于 2019-12-25 06:49:26
问题 MySQLfiddle here: http://sqlfiddle.com/#!2/6094e8/6 The fiddle contains the data that goes along with my examples below. I have a single table I am trying to work with: Table 1: user_answers table (stores users answers and their acceptable asnwers to various questions) The notable values that are stored are: users id (column uid ) question id for the question they are answering (column quid ) answer to the question (column answer ) acceptable answer storage #1 stores other acceptable answers