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 (4)

2
votes
0answers
31 views

Design Question - Stock and OnSale Table

Background : I'm designing a solution for a repair toy association. Since they have office - I'll use Access. Plot : Stock will store items - I choose this primary key (Item_Id,Record_date) ...
0
votes
1answer
55 views

TOTAL column or VIEW that computes?

I've got a couple of tables to track volunteer workers at our non-profit. One stores Volunteers and tracks information about a volunteer such as the person's name, a contact number, primary location ...
4
votes
1answer
59 views

Managing and speeding up queries on PostgreSQL table with over 3 trillion rows

I have time series data which spans over 10 years and has over 3 trillion rows and 10 columns. At the moment I use a PCIe SSD with 128GB of RAM and I am finding that querying takes a significant ...
1
vote
1answer
46 views

Database design for 2 1-to-many?

It's the first time here so I don't know if it's the right place to ask.. I'm not good in database design, just learning, so I'd like some advice if possible. The case: I'm building a really small ...
0
votes
2answers
18 views

MySQL - replicate some tables between transaction and report database

I have two different database (on two different hosts). One database is transactional and another database is reporting. Let us say, it stores information about departments and their employees. ...
1
vote
1answer
28 views

SQL 2012 insert data into a table from another table and custom columns

I'm trying to insert data from one table into another table and I also have 4 columns that are not in the source table but need to be populated in the target table. Here is the Insert statement SET ...
3
votes
1answer
116 views

Supertypes and subtypes

I am trying to design a database that has supertype/subtypes. I have the following users: - basic user - business user - administrator (super user). All three users share a common table (users) ...
2
votes
0answers
39 views

Better performance to have nullable columns or an extra table? [duplicate]

There are many ways to get rid of nulls in tables, and I have heard of various reasons to get rid of them, but can anyone show me some real numbers as to how your database might perform differently ...
1
vote
2answers
174 views

Avoid foreign keys on an 800-GB database?

This question is for the experienced developers out there. My friend recently told me that his employer has a legacy code base whose MySQL database has now grown to around 800 GB in size. What's ...
1
vote
3answers
69 views

How to prevent redundant data that is hard to detect, e.g. John Smith

I have a database table to store technicians (employees) which is structured like this: | firstName | lastName | phone | alternatePhone | email | canadaTravel | canDrive | notes | In this table, ...
3
votes
2answers
42 views

Bitemporal Table with changing schema

I have to design a database covering business assumptions using MS SQL-Server 2008 R2. The current data of the tables will be exported to text files and used as input for a certain application. I ...
3
votes
3answers
110 views

Proper way to store a value that could be multiple different types

I have an Answers table and a Questions table. The Answers table has a value, but depending on the question, this value could be a bit, nvarchar, or number (so far.) The Question has a notion of what ...
1
vote
1answer
27 views

Update a unique column with an unknown number of values

I have a table with three columns, ID, a foreign key field and a text field (unique). The user should be able to update all text fields where the FK has a certain value. The problem is that the user ...
1
vote
0answers
18 views

Database sharding, denormalization and synchronization

In sharding, it is advisable to follow a share nothing, shard everything approach. Essentially, this translates to: data that are to be used together are to be stored together (i.e. in a single ...
0
votes
0answers
8 views

Where to put a 0..1 fk column when already having 0..n fk’s on one side and 0..1 on the other

I have a transaction table that represents user’s credit transactions and two tables containing different entities, but both interacting with the transaction table. Say, payment_with_state and ...
2
votes
1answer
118 views

Foreign Key Constraint over two tables

I am trying to put the following entity-model into practice: We have a list of Payments, each Payment belongs to a certain store and is of a certain payment type (e.g. 10€ maintenance cost in ...
0
votes
2answers
105 views

What is the best way to find out the sum of a field from a table?

I am making a accounting software. I have a table debit_credit that contains double entry accounting data.Table is: debit_credit_id | tran_id | ledger_head_id | debit | credit | dr_cr | commission | ...
1
vote
1answer
46 views

Count childs of parent with sql or save in column?

In postgres I have a threaded setup where parent id has many childs and childs can have childs. What is the most efficient way to get the count with a sql statement similar to this: WITH RECURSIVE ...
1
vote
1answer
31 views

Real-world scenarios for table with DENY SELECT and GRANT [INSERT/UPDATE/DELETE] [closed]

What is real-world scenarios for this type of permissions? May be it is generally not valid, and made by mistake? Should this kind of permissions be avoided (or prohibited)?
2
votes
0answers
39 views

How To Manage Random Data Without Repitition?

We have a database design problem of a Learning System. Please can somebody help us ? These are the requirements : A person can register for a module which has "n" number of questions. The person ...
2
votes
0answers
56 views

How to store data where various subcategories have specific columns?

I'm new to database designing. I'll use MySQL and PHP. I'm designing a database in which I have a lot of categories and subcategories like given below: Product Table p_id p_title category_id ...
2
votes
1answer
54 views

Migrate existing SQL Server database file to smaller files

I have a database that is about 1TB in size. It's currently on a 2TB hard drive and I would like to replace it with a few 512GB SSD. I need to split the existing database file (.mdf) into multiple ...
3
votes
0answers
32 views

View of structurally same tables [closed]

Let's say I have two schemas (HR and Finance for example), in each schema I have a table with information about document types this department works with. Tables have the same structure: HR.doc_type ...
2
votes
2answers
56 views

Three-sided many-to-many relationship design

I have 3 entity that have a relation to each other. My entities are: OPTION PLAN PRICE Relationships: PLAN and OPTION have a many-to-many relationship Map of PLAN and OPTION has a many-to-many ...
1
vote
0answers
23 views

How do you output field changes in mysql the most efficiently?

I have a rather large employee feed coming in and each employee has about 50 fields. I take the employee data and add on a bunch of other stuff and this gets outputted to one of our vendors. Most ...
1
vote
1answer
57 views

Is my shopping list database schema good enough?

I'm wondering if my schema is correct? It's intended to hold shopping list items for each user, a user belongs to a household. Items will be added to the household. The stocklist will to hold the ...
1
vote
1answer
35 views

Database design - need someone to guide me

Im probably doing this wrong, but here it goes. Im trying to build something like very basic CRM. I know there are plenty of them, but I want something to learn actually. Requirements: Some ...
4
votes
2answers
49 views

Best db setup to accomplish yes/no list of clients for daily calls

I will preface this by saying I am a relative novice to Access but I have managed to develop some basic databases. I have some working knowledge of expressions and macros but VBA is still a bit of a ...
3
votes
1answer
66 views

Can jsonb do fast search by *value* or even a partial value? Other types?

I have a person table where arbitrary data must be inserted. Since I'm using Postgres 9.4, jsonb appears to be the right choice. Example data: id: 1, name: "Joe Doe", preferences: { color: "red" , ...
5
votes
3answers
161 views

Why would I need a third table in a one-to-many relationship?

Good day, Our db professor at the univeristy always said that one-to-many relationships with (0, M) in one side MUST have a third table to relate them. I did not ask him back then and now I cannot, ...
0
votes
2answers
34 views

Multiple types of parts with multiple types of information (unspecified amount) [duplicate]

I'm having trouble designing a database for a project I was working on recently. It's to do with a garage management system. So I've realised I need to store multiple types of parts (Tyres, engines, ...
2
votes
4answers
153 views

Finding all date ranges that overlap a target date range

Say I wish to store when staff are on holiday (FromDate, ToDate) and then I wish to find all staff that are on holiday between two given dates (QFromDate, QToDate). Now assume that I have many such ...
8
votes
3answers
188 views

Is it reasonable to mark all columns but one as primary key?

I have a table representing movies. The fields are: id (PK), title, genre, runtime, released_in, tags, origin, downloads. My database cannot be polluted by duplicated rows, so I want to enforce ...
0
votes
0answers
25 views

database polymorphic associations: design for foreign key point to itself

I have a database design that used to solve polymorphic assocations problem. Here is my schema: Post(PostID, PostType) Question(QuestionID, QuestionTitle, QuestionContent) // QuestionID references ...
6
votes
1answer
53 views

PostgreSQL and table inheritance

I'm not sure if this is the right place for this, so please feel free to tell me if it is off-topic or there is a better place to post. I am working on a fantasy sports based project, and the number ...
0
votes
1answer
29 views

Should we store sum of values in a column, or store in memory database

I have a bunch of questions and answers and total votes of those questions and answers. My requirement that I always show how many votes for a question or a answer (and user doesn't often click to who ...
1
vote
1answer
21 views

Tables design for conversation

I want to create simple conversation module on my site. So I need a list of users who had conversation with current user. I need to show amount of new messages in each conversation. I think about next ...
2
votes
2answers
49 views

Database design appoach confirmation

I am working for a mortgage company in migrating a legacy application to new application for managing claims, means lender fore close a loan and request for a claim to get its funds from government or ...
0
votes
1answer
48 views

Using Year Ranges vs Row for Each Year

I'm working on a database in SQL Server for a project. My background is in data analysis and although I'm familiar with database design I don't have a lot of experience. The project revolves around ...
0
votes
0answers
27 views

Help for design DB, avoiding circular relationships

Help for design DB, I have user, order, scratch_card and transaction tables. When user place an order, one record will add to order and another one to transaction as withdraw and when user recharge ...
0
votes
1answer
23 views

SELinux is preventing pg_ctl from read access on the file postgresql.conf

I am trying to setup a master-slave PostgreSQL 9.4 database on Fedora 22, with the slave database's PGDATA being different from the default /var/lib/pgsql/data/ directory. I wrote this to ...
2
votes
1answer
30 views

Distinguishing Records with Related Fields

I'm a newer user (obviously) and would greatly appreciate question writing suggestions as well as answer suggestions: I have a lot of interrelated tables which largely depend on my Products table, ...
1
vote
0answers
13 views

Automatically set table name prefix according to other field in PowerDesigner

I'm working with PowerDesigner 16.5 and I have a PDM generated out of its corresponding LDM. The table names are inherited from the LDM and I'm fine with them, but I would like to generate the DDL ...
1
vote
1answer
51 views

Sharding VS Replication

To improve query response will it be better to shard the data or replicate existing shards for faster response. In case of sharding the data might be nicely distributed and hence the queries. In ...
1
vote
0answers
34 views

Design of user database and basic authentication process [closed]

I want to know if somebody can give me very briefly information describing the design of a user database and the basic authentication process please? Thank you
1
vote
1answer
91 views

Database schema for entities with two possible owner/parent types?

I'm using PostgreSQL with Sequelize as my ORM. I have one type, User. The second type is Group, which can have any number of users associated with it through a GroupMemberships table. Users can also ...
0
votes
0answers
20 views

SSAS bridge table with Slowly changing dimensions

I am designing a datamart using the basic principles of Kimball for use in SSAS. I have a many many to many attribute relationships (multi-valued dimension objects), however I have a few questions: ...
1
vote
1answer
26 views

Category entity relationship / subtype relationships design

I am looking to implement a generic comment and file attachment facility within a web application which would be used across various parts and allow users to provide comments and add attachments to ...
0
votes
0answers
42 views

Versioning database tables

I need to store all the changes made for almost every table in a meta-data database. I am thinking about storing every previous version in a JSON array or XML in the table. Like: CREATE TABLE ...
3
votes
1answer
26 views

Stored procedure deployment - push or pull into database? [closed]

Using stored procedures as part of an ETL process to populate tables in another database, which method would be considered a best practice (if any) in terms of deployment, maintenance, visibility and ...