Database design is the process of specifying the logical and/or physical parts of a database. The goal of database design is to make a representation of some "universe of discourse" - the types of facts, business rules and other requirements that the database is intended to model.

learn more… | top users | synonyms (3)

45
votes
8answers
5k views

Is storing a delimited list in a database column really that bad?

Imagine a web form with a set of checkboxes (any or all can be selected). I chose to save them in a comma separated list of values stored in one column of the database table. Now, I know that the ...
127
votes
5answers
14k views

How do you recommend implementing tags or tagging

I've heard of a few ways to implement tagging; using a mapping table between TagID and ItemID (makes sense to me, but does it scale?), adding a fixed number of possible TagID columns to ItemID (seems ...
9
votes
3answers
2k views

Database design - articles, blog posts, photos, stories

I'm designing a database for a web site that will have at least 4 different object types represented (articles, blog posts, photos, stories), each of which have different enough data requirements to ...
11
votes
2answers
8k views

What is the purpose of system table table master..spt_values and what are the meanings of its values?

What is the purpose of system table table master..spt_values? Why was it provided and how one should use it? What are the meanings of its type, low, high values? Update: Google search gives ...
53
votes
18answers
10k views

Surrogate vs. natural/business keys

Here we go again, the old argument still arises... Would we better have a business key as a primary key, or would we rather have a surrogate id (i.e. an SQL Server identity) with a unique constraint ...
43
votes
5answers
10k views

Product table, many kinds of product, each product has many parameters

i'm have not much experience in table design. My goal is a product table(s), it must design to fix some requirement below: Support many kind of products (TV, Phone, PC, ...). Each kind of product ...
164
votes
26answers
67k views

Database, Table and Column Naming Conventions?

Whenever I design a database, I always wonder if there is a best way of naming an item in my database. Quite often I ask myself the following questions: Should table names be plural? Should column ...
49
votes
9answers
19k views

Schema for a multilanguage database

I'm developing a multilanguage software. As far as the application code goes, localizability is not an issue. We can use language specific resources and have all kinds of tools that work well with ...
97
votes
13answers
31k views

Subqueries vs joins

I refactored a slow section of an application we inherited from another company to use an inner join instead of a subquery like where id in (select id from ... ) The refactored query runs about ...
39
votes
13answers
29k views

Should each and every table have a primary key?

I'm creating a database table and I don't have a logical primary key assigned to it. So, I'm thinking about leaving it without a primary key, but I'm felling a bit guiltly about it. Should I? Should ...
19
votes
7answers
16k views

How to pivot a MySQL entity-attribute-value schema

I need to design tables which stores all the metadata of files (i.e., file name, author, title, date created), and custom metadata (which has been added to files by users, e.g. CustUseBy, CustSendBy). ...
2
votes
4answers
835 views

Interpreting ER diagram

I am learning how to interpret ER-D into SQL DDL statements, and am becoming confused with notation differences. When there is a disjointed relationship such as the following, would there be a ...
6
votes
2answers
690 views

Calculating and saving space in Postgresql

I have a table in Pg like so CREATE TABLE t ( a BIGSERIAL NOT NULL, -- 8 b b SMALLINT, -- 2 b c SMALLINT, -- 2 b d REAL, ...
3
votes
3answers
2k views

Same data from different entities in Database - Best Practice - Phone numbers example

A fairly simple question, if I had a system which dealt with Staff, Customers and Suppliers all of which had multiple possible phone numbers how would you go about storing these numbers in a nice ...
1
vote
3answers
566 views

How to create multiple one to one's

I have a database set up with many tables and it all looks good apart from one bit... Inventory Table <*-----1> Storage Table <1-----1> Van Table ^ ...

1 2 3 4 5 87
15 30 50 per page