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)

1
vote
3answers
95 views

SSIS: How to check if a record DOESN'T exist in flat file but exists on the database

I am working on preparing an SSIS job where I am importing a .CVSV file to OLE DB destination (sql database). We are going to get these files on daily basis. The .CSV file contains records of doctors. ...
1
vote
1answer
80 views

What is a suitable,stable, high performing database for Large Financial Time Series Data? [closed]

I realise this question may have be answered in some form but I would like to gather the thoughts and opinions of actual users with experience in this field of Database design and development. I have ...
1
vote
0answers
56 views

Ticket booking engine

I am going to build and flight ticket booking system. My client has own planes. Under is basic concept of engine. Admin will add flights. Passengers,agents,franchises or admin will book the tickets. ...
3
votes
1answer
50 views

Schema for scarce goods

I have following objects: (Rooms) which are (available in a certain period of time [in days]). During the time of availability they can be (booked) by (users). There are basically these four tables. I ...
5
votes
3answers
210 views

MySql Invoice and Subscription Schema

I have an ecommerce db built and I'm adding subscriptions. See the simplified structure below. orders id, customer_id order_items id, order_id, product_id invoices id, order_id subscriptions id, ...
0
votes
0answers
30 views

Looking for feedback on a design for a simple task manager

I've got tired of using notepad / excel to manage my tasks at work. Since tasks may sometimes contain sensitive data, my boss will not allow us to use an online task management system, so I've decided ...
4
votes
1answer
74 views

How to model “Courses prerequisites” for a university?

I am trying to model a courses structure and dependencies of a university. For example, in the Computer Engineering department you need to do Data Structures before doing Artificial Intelligence. But ...
1
vote
1answer
50 views

DB design for employee working hours constraints [closed]

I have a simple employee schedule database (I use PostgreSQL): employees: - id - name - email shifts: - start - stop - employee_id Now there is need to apply constraint for working hours. ...
1
vote
2answers
37 views

Include logical key on each table vs. join

I'm designing a database that is used to track an inventory item through its lifecycle. I'm currently relating my tables using the previous lifecycle event's ID (for example, a shipment contains the ...
0
votes
1answer
43 views

How to get last messge between two friends in the messge table having id in descending order?

Hi friends help me to solve this problem ," display all last messages of a user from all his/her friends" My sample message table is --------------------------------------------------- | id | msg ...
2
votes
1answer
97 views

Personal finance database design

I'm making a personal finance management application in PHP and MySQL, for learning myself some more PHP and MySQL. This system is currently using 4 tables: users, this table holds all the user ...
8
votes
3answers
127 views

Why NOT partition?

When would one NOT want to partition a database? (thinking MySQL partitioning) In my case I'll be starting with a couple millions rows, it should grow from there. Primary key on a character field ...
3
votes
1answer
131 views

Storing created/retired dates for a large amount of different entities

In the db I'm working on now almost every entity has these 4 columns: CreatedDate CreatedBy RetiredDate RetiredBy Usually this is used for logging purposes, and for some of the entities the ...
0
votes
0answers
38 views

What happens to the database structure when i add a nonclustered index

Our team is working for a while now with Azure SQL. After a lot of trying , we managed to add a sync group between the main DB and the backup one. Of course, this means that for every change in the ...
0
votes
0answers
35 views

MySQL Db design: Optional data in separate table or as NULL values in original table

I am having following problem: User fills out the form, which consists of two sets of fields - header (basic information about biological observation) and detail (measurements and advanced ...
0
votes
1answer
36 views

I am designing a database for a game and the only option I can see a multiple table solution. Is there an option that I'm not seeing?

I searched but could find a similar situation, if I missed it please let me know. In this game there are approx 14,000 items which have their own table. The players will want to build multiple ...
1
vote
0answers
20 views

Reorganizing a subject area in ERwin

I have a data model in ERwin (r7) that has about 1000 tables in it. I'm right now in the process of splitting it up into various different subject areas to make it a bit more manageable. Here's the ...
1
vote
1answer
37 views

Database design for multi foreign keys

For example, I have two tables: Question(QuestionID, QuestionTitle, QuestionContent) and Answer(AnswerID, QuestionID, AnswerContent). Now, I have a Vote table that support vote for both Question and ...
2
votes
1answer
77 views

Database Design - Removing ambiguity without adding loop

I'm looking for a better approach to the problem (and my solution) described below. I've attached an image of my initial design Let's say I have a cat, and I'd like to find its owners and what vets ...
1
vote
0answers
33 views

Design optimization

I'm designing a database for a crm like software. Actually it's my first project so i'm learning on the run on this one. I have customer and employee tables. I also have a history table for tracking ...
3
votes
3answers
118 views

Redesigning a table that has a lot of columns (not always related)

I'm new to database stuff so I apologize if I say anything ridiculous.. I work for a company that runs a website for a certain industry. We're not very large at the moment but our parent company ...
0
votes
0answers
33 views

Where to put the currency field?

Abbreviated I have following tables: Companies own flats and rent them for specific periods_in_time and lastly a currencies table. The price column is sitting in the periods_in_time table. But where ...
1
vote
0answers
52 views

Get all data from two tables and group it into different category in mysql

These are my tables to build an FAQ: CREATE TABLE `tbl_section` ( `section_id` int(11) NOT NULL AUTO_INCREMENT, `section_title` varchar(100) NOT NULL, PRIMARY KEY (`section_id`), ...
0
votes
0answers
24 views

Multiple table relationship for different scenarios!

We have the following heirarchy in our platform; Package is comprised of Products, Products is comprised of Services and Services are comprised of SKUs. The relationship between them is many-to-many ...
1
vote
1answer
19 views

communication followup database design

I'm trying to decide on how to set up the tables to get this use working without over-complicating it or not collecting enough data. For the sake of an example, I've got a ticketing system with two ...
2
votes
1answer
22 views

column identifier versus separate table with related data with different purposes

Very new to database management here. I'm trying to figure out what rule of thumb I should be following when it comes to making separate tables for data rather than just labeling it as different ...
2
votes
3answers
71 views

Schema for a lease platform

I have following tables: A room I want to lease (has user.id as ForeignKey) A users table for users who can rent it An availability table for time periods the room is to use with prices for that ...
1
vote
3answers
164 views

Remove duplicate values from query result

I am using Postgres 9.3.9. I have 2 tables : f_agent : CREATE TABLE f_agent ( f_agent__id bigserial NOT NULL, f_agent__total_users integer NOT NULL, f_agent__dim_time_id integer NOT NULL, ...
2
votes
1answer
122 views

Building a restaurant database

I am designing an Italian restaurant database, but I face some problems considering the database design, which lead me to a halt. The part that I find difficult developing is the dishes table. A main ...
2
votes
1answer
39 views

How to relate a table to other two?

I'm trying to design a database that contains, among others, entities "Photo", "Venues" and "Products". Given both Venues and Products could contain a collection of photos... how could I tell whether ...
1
vote
1answer
108 views

Is it ok to create additional column for helping other column to be a PK?

Let's say a Person can have more than one nickname. He(she) must enter his(her) nicknames alongside with other details: Here is the table columns: User_Id, Nickame, Age Of course, for now there ...
1
vote
1answer
39 views

Using a GIN index on an integer array to model sets of tags

In PostgreSQL, what are the pros and cons of using a GIN index on a column of type integer[] to model sets of tags, instead of doing a relation table? I am trying to design a simple data model with a ...
6
votes
2answers
176 views

nvarchar(max) converting to varchar and table optimization

I am working with a table that has all character types set to nvarchar some of them are nvarchar(max). We are converting all these to varchar and specifying a character width based upon the actual ...
2
votes
1answer
77 views

Best practice for when the ideal number of columns is unknown

I'm currently making a MySQL database to list products for an e-commerce site. Each product will have several sizes available which will each have their own dimensions and measurements (e.g. length, ...
0
votes
1answer
49 views

How to track changes to a record that spans multipe tables

I have the challenge to design a new database using a RDBMS, Oracle, to be precise. In this database there will be one specific record/document which may span multiple tables. With as little ...
1
vote
1answer
41 views

Product attribute schema design, mixing solutions

I am working on a product database in MySQL and the products can be multiple types with different attributes. The number of attributes and there datatype vary. I read about some design patterns (post) ...
0
votes
1answer
45 views

Multiple Cascade Paths (Not really) - Sql Server

In my database I have a table with 2 columns referencing the same column in a separate table. I know this creates a race condition, but I have a check in place to make sure they don't point to the ...
2
votes
4answers
71 views

Row for each date, or 31 columns?

Currently I have a system whose front-end looks like this: The following query: SELECT `l`.*, `s`.`month`, `s`.`year` FROM `summarylines` `l` JOIN `summaries` `s` ON ...
0
votes
1answer
51 views

Usage of json to store multiple attributes

Typically we have the table designed like this UserId FirstName LastName EmailId MobileNumber Age Sex City Where UserId is going to be the primary key Is it good to have multiple columns ...
2
votes
0answers
48 views

Database Design: Include Question Answer and Comment tables into Post table

I'm designing a database. This system has question, answer and comment. Question has some type of questions. In each type, there some differences so they're have some difference fields. Answer and ...
1
vote
1answer
26 views

Index design question

This query runs for 60 seconds: SELECT mychecklis0, .... FROM dbo.MyChecklistStatus mychecklis0_ WHERE mychecklis0_.AppFormSubSectionId=@P0 AND mychecklis0_.ProfileId=@P1 There is an index created ...
0
votes
0answers
15 views

Fill the 5th table with 3 other tables data in LibreOffice

I have 5 tables primary key foreign key felh(felh_id, felh_nev) gepek(gepid, felh_id, gep_nev) lic(lic_id, lic_k, lic_l, lic_db, gep_id) pr(pr_id, pr_n, pr_vr, lic_id) haszn(haszn_id, gep_id, pr_id, ...
0
votes
2answers
74 views

Managing tables in database

I am new to web development field and particularly very poor at database management. I am developing a web application which resembles Project Management System where new companies can add their ...
1
vote
1answer
25 views

Have several rows, or one single row with a huge comma separated data?

I have many workers processes working at the same time. They grab an ID from a list called available_ids, work on that ID, and put that ID on a list, called used_ids. The list available_ids can have ...
1
vote
2answers
35 views

How to structure different types of a model in MySQL?

I am building an application where users can apply for small business loans. There are 4 types of loans (A,B,C,D). There are 10 commons questions no matter which type they choose, but then based on ...
5
votes
1answer
186 views

Efficiently storing sets of key-value pairs with wildly different keys

I inherited an application that associates many different types of activities with a site. There are roughly 100 different activity types, and each one has differing set of 3-10 fields. However, all ...
0
votes
0answers
17 views

Data Warehouse for reporting - 6 Dimension tables,or 1 table and 6 views?

Problem: I have been asked to add a Dimension table to our data warehouse and create the ETL tasks to populate it. Lets call the table "DimInternalFault". The source table for DimInternalFault is ...
0
votes
2answers
52 views

Where to place a foreign key column? [closed]

This isn't exactly related to modeling the database but rather about "standardizing" column placement. Where should I generally put my FK column? As the last column of the table? At the start just ...
1
vote
1answer
50 views

What is the best SQL Server field type to cast to when storing a UNC path stored in a sql_variant field?

What is the best choice of field type to cast to when storing a UNC path in a sql_variant in Microsoft SQL Server 2008? It appears that I could store up to 4000 characters according to Microsoft ...
2
votes
4answers
145 views

Are junction tables a good practice?

Say I have a large table that holds the user's info and another table that holds several locations. Then I use another table that holds the user_id and the location_id. In order to retrieve the data ...