database-design

Why is using a common-lookup table to restrict the status of entity wrong?

天涯浪子 提交于 2019-12-31 08:25:29
问题 According to Five Simple Database Design Errors You Should Avoid by Anith Sen, using a common-lookup table to store the possible statuses for an entity is a common mistake. Edit + Answer: The figures in Anith's article aren't well labelled - I thought both Figure 1 and Figure 2 are examples of bad design , whereas Figure 2 is good design . Phew , got worried there for a moment. In summary: Lookup tables: good . Common-lookup tables: bad . I'll keep my question below for reference. The

How big is too big for a PostgreSQL table?

那年仲夏 提交于 2019-12-31 07:56:47
问题 I'm working on the design for a RoR project for my company, and our development team has already run into a bit of a debate about the design, specifically the database. We have a model called Message that needs to be persisted. It's a very, very small model with only three db columns other than the id, however there will likely be A LOT of these models when we go to production. We're looking at as much as 1,000,000 insertions per day. The models will only ever be searched by two foreign keys

Database Structure Advice Needed

▼魔方 西西 提交于 2019-12-31 07:54:31
问题 Im currently working on a site which will contain a products catalog. I am a little new to database design so I'm looking for advice on how best to do this. I am familiar with relational database design so I understand "many to many" or "one to many" etc (took a good db class in college). Here is an example of what an item might be categorized as: Propeller -> aircraft -> wood -> brand -> product. Instead of trying to write what I have so far, just take a quick look at this image I created

How do I not normalize continuous data (INTS, FLOATS, DATETIME, …)?

冷暖自知 提交于 2019-12-31 04:48:07
问题 According to my understanding - and correct me if I'm wrong - "Normalization" is the process of removing the redundant data from the database-desing However, when I was trying to learn about database optimizing/tuning for performance, I encountered that Mr. Rick James recommend against normalizing continuous values such as (INTS, FLOATS, DATETIME, ...) "Normalize, but don't over-normalize." In particular, do not normalize datetimes or floats or other "continuous" values. source Sure purists

How to perform edit in junction table

烂漫一生 提交于 2019-12-31 03:21:08
问题 What is the best practice to make edit in junction tables? Items{ItemId, Name, Price...} Shops{ShopId, Name, Address...} ItemsInShops{ItemId, ShopId, DeliveryDate...} Now I have 30 items in one shop. I want to edit that list and I uncheck 10 items and check 50 new items. I do this in the following way: Remove all rows from 'ItemsInShops' by 'ItemId' and add new values. I don't think that this is good solution. Is there any better way to do this kind of update? Maybe I didn't express problem

Help designing a database schema for a pizza store

懵懂的女人 提交于 2019-12-31 03:11:07
问题 Here's the script: create table Customer ( CustomerId int primary key identity(1,1), Name nvarchar(64) not null, LastName nvarchar(256) not null, Telephone nvarchar(32), MobilePhone nvarchar(32), Address nvarchar(256) ) create table Product ( ProductId int primary key identity(1,1), Name nvarchar(64), Price decimal ) create table StoreOrder ( StoreOrderId int primary key identity(1,1), Date datetime, CustomerId int foreign key references Customer(CustomerId), Total decimal ) create table

MySQL Enforce Unique constraint across a Combination of Rows

不羁的心 提交于 2019-12-31 02:55:11
问题 I am refining a Search Auto-suggestion system, and after a few iterations and Normalization, have the following set of tables: DB Fiddle : https://www.db-fiddle.com/f/b1FvGDkBMQXkREaMh3pHKi/0 Table 1: keywords - It stores a list of alphanumeric (relevant) keywords. Relevant details are: CREATE TABLE keywords ( keyword_id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, keyword VARCHAR(32) NOT NULL /* Other fields eg: ranking, weights, etc */ ) engine = innodb; | keyword_id | keyword | | ----

DB Design for Choosing One of Multiple Possible Foreign Tables

丶灬走出姿态 提交于 2019-12-31 02:34:06
问题 Say if I have two or more vastly different objects that are each represented by a table in the DB. Call these Article, Book, and so on. Now say I want to add a commentening feature to each of these objects. The comments will behave exactly the same in each object, so ideally I would like to represent them in one table. However, I don't know a good way to do this. The ways I know how to do this are: Create a comment table per object. So have Article_comments, Book_comments, and so on. Each

How to protect mysql database from anyone

狂风中的少年 提交于 2019-12-31 01:53:45
问题 I have launched my project to a hosting company. But I am worried about how to protect my mysql database from the hosting company. My question is how can I protect my database from the hosting company so they can't access my database / data. 回答1: Here's a relevant rule of IT security: "If a bad guy has unrestricted physical access to your computer, it's not your computer anymore." http://technet.microsoft.com/en-us/library/cc722487.aspx 回答2: If you don't trust your hosting company, it's time

How to store the properties of the goods in mysql? [closed]

牧云@^-^@ 提交于 2019-12-30 13:39:49
问题 Closed . This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 4 years ago . Now I'm planning the structure of the database products. There was a question of storage options / parameters of the goods. For example, if it were the size of the goods - it would be enough to create three fields to the width / height / depth, but what if dozens of parameters? It is assumed that