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)

-2
votes
1answer
222 views

How to represent it with UNIQUE indexes and foreign keys?

"Group" is a group of pupils. "Topic" is a topic of lessons. To every group corresponds exactly one topic. (So there may be multiple groups per topic.) To a pupil corresponds multiple groups, but ...
3
votes
1answer
384 views

Splitting a table based on enum value

I am re-designing our company database, and am wondering whether or not to split this table up into two (or even three) different tables based on the type field. Prospects can become clients, and in ...
2
votes
1answer
221 views

MySQL Performance Gains By Splitting Tables?

I am designing a database schema to be used with MySQL. The database needs to keep track of a users basket items and purchased items. I've thought about two ways I could do this but not sure which ...
5
votes
2answers
391 views

How to design index for faster deletes

I want to speed up following piece of code delete from ssn_sdo where (art_id=@art_id and skl_id=@skl_id and @level=0 ) or (art_id=@art_id and skl_id=@skl_id and @level=1 and ...
1
vote
1answer
505 views

UNF to 3NF is this relation workable?

I've inherited a flat table of data consisting of around 2 million records. Looking at the data its already in 1NF, i'd like to get this into 3NF. The data is Australian so suburb can't determine ...
0
votes
2answers
3k views

How can I better optimize my tables and a LEFT JOIN query to find items that don't yet exist in the right table?

I have two tables that represent a list of urls and their related word indexes. Here are the table definitions for reference. desc urllist; ...
1
vote
2answers
1k views

boolean purpose column char(0) or tinyint(1)

For Boolean purpose column which one is better: nullable char(0) or tinyint(1). I know bool is an alias for tinyint(1) , but in "High Performance MySQL" book that published by O'reilly said: "If ...
2
votes
1answer
544 views

Multiple Database Design or NOT?

I have a database design issue, one that has rattled my brain. What is the project? I am designing a platform where different people register a group, each group is allowed to register their own ...
1
vote
0answers
49 views

Where should a default setting field be?

I am creating a database to track occurrences of incidents on buses based on an existing system. Currently the drivers can set a default bus number, which is used to pre-populate the bus number on the ...
2
votes
0answers
891 views

which role-permission database design?

I want to manage roles and permissions. Most of designs on web look like this tables: Users Roles UserRoles Permissions RolePermissions Here, what is permissions? I am thinking for such a design ...
1
vote
0answers
391 views

Data modelling: RBAC for small enterprise software

I'm building the core tables for a small, cloud-based enterprise app. Is this data model suitable for a role based authentication system (flat hierarchy of permissions) that allows users to work for ...
1
vote
1answer
334 views

Implementing a Record Keeper/Rollback System for a MySQL Database

What's the best way to create a record keeping table for all actions in my database? I have a number of tables inside one database and I want to create another that records all movements in every ...
4
votes
2answers
212 views

Terminology for table types

I am currently unsure of the correct terminology for types of tables that exist, or indeed whether there is a term for the examples I have. I have included my current understanding of the types that ...
7
votes
2answers
1k views

How to find parent rows that have indentical sets of child rows?

Suppose I have structure like this: Recipes Table: RecipeID Name Description RecipeIngredients Table: RecipeID IngredientID Quantity UOM What are some good ways for ...
1
vote
2answers
64 views

Can a database detect that data is out of sequence if each datapoint has a sequential ID

Can a database detect that data is out of sequence if each datapoint has a sequential ID? E.G A trading DB server receives trade ID 9, and next receives trade ID 11. In this case, I would like the DB ...
4
votes
2answers
6k views

Create table group sub-folders in Management Studio

When I was exploring the master database in SSMS I noticed that under the Tables folder there is another folder called Systems Tables that houses a bunch of tables. Is it possible for us to create a ...
1
vote
1answer
795 views

Count number of common column names among all tables in a database

Is there any way to compare every table with each other in a database, listing the number of common columns between each tables? I prefer using join over subquery and information_schema.columns over ...
1
vote
1answer
45 views

query to get list of tables that has same columns from information_schema.columns?

idea is to list all the tables that has redundant columns across database using information_schema.columns! let's say table1 = dbo.ABC columns = id, name, department, designation table2= dbo.DEF ...
2
votes
1answer
143 views

Is it ok to let users add new columns and tables to your database?

I'm basically making a database of databases. An administrative User can go in and hit "Create Database" (which is basically a table) and set up the column types and how many columns. Other users can ...
0
votes
1answer
135 views

Create primary keys based upon higher-level entity in access?

Is it possible to have access create primary keys for items by appending a string to the primary key one level above it? I am trying to create an inventory management database for my company's server ...
2
votes
3answers
343 views

Database design for conditional detail table

I have an expense management system for monthly expenses. Expenses are of two types: one-time monthly expenses, and daily expenses for each day of month. I have created the following tables: ...
3
votes
2answers
94 views

Which design to choose in this case?

I am designing a database for a video game. I have some data structures like {x, y, z, dimension} used across multiple tables. For instance : Table player_death id: int player_id: int death_x: int ...
1
vote
1answer
387 views

Column of generic/variable type?

In SQL, I would like to create a table which can contain generic data types. This types can change from every row. The solution I could come up to is: CREATE TABLE TagValue ( tag VARCHAR(64), ...
0
votes
1answer
197 views

how I can create check sum to validate no changes at int string pairs on table

Business case is. 1)Users print document on paper 2)users carry printed paper to Boss, Boss sing on paper 3)after that users going to administrator to digitally sign that paper. My task is to help ...
0
votes
1answer
442 views

Contact system database design

I'm designing a database for contacts and I'm looking for some feedback on the current design. What i want: A contact can be a person or an organization. A contact can have many groups. A contact ...
4
votes
2answers
3k views

Auto-increment key and Foreign Key as composite for relational database

I do not have any experience in databases other than what I have from just playing with workbench and trying to understand how I need to setup this database for a project. I have been searching the ...
6
votes
1answer
1k views

Best practice for storing record metadata

What is the best practice for storing metadata of individual records in a database? I need to store common meta data such as creation time and time of last update for many tables in my database. I ...
0
votes
1answer
815 views

Which is the redundant relationship in this ER Diagram and why?

Which is the redundant relationship in this ER Diagram and why? A few of my friends and I have been trying to figure it out but keep going in circles. where the attributes of each entity are as ...
0
votes
2answers
64 views

This certain MySQL database organisation

Hypothetically, let's say that I have three tables: - Products (id, product_name, added_timestamp) - Individuals (id, name, last_name) - Companies (id, company_name, company_number, company_address) ...
0
votes
2answers
233 views

Mirrored tables on PostgreSQL

I have some values under "account" and I need to have the same values under "invoice", so, I'm trying to find a way to symlink my tables, so every time one gets updated, the another have the new value ...
0
votes
0answers
80 views

How can I model this problem in a graph database?

I have a project that I'm working on where I extract data from PDFs and map/visualize the relationships between the extracted pieces. Here's an example of my problem: file: 11425646.pdf author: ...
0
votes
1answer
261 views

What's the practice to generate long user id like those on Facebook?

Now I am about to launch a site and I have trouble coming up with a way to create long user id(e.g. 4000002). Do I set id to auto-increment(Starts at 0) and then add something(e.g. 4000000) to this ...
0
votes
1answer
233 views

Implementing something similar to “pointer arrays” with MySQL

While building a site I came across the following issue: I want to be able to have multiple containers and within each container have ids pointing to multiple items that lie on another table. Scheme: ...
0
votes
1answer
1k views

User roles and permissions

Look at the attached graphic. I'm trying to keep this as simple as possible. Basically I want to have multiple admins(or superusers) who own regular users who own sites. Admins can give regular ...
0
votes
1answer
178 views

Relational database primary key requirements

I am trying to put together an ER Diagram to design a fairly simple asset tag tracking/inventory management system for our servers/switches/UPS/etc. The top-level entity corresponds to the business ...
2
votes
3answers
1k views

Is it worth to separate columns into multiple tables for one-to-one relational table

I need to make a decision for database structure on whether to separate one-to-one relational columns into multiple tables and link with one relationship id or just add all columns into one table. ...
9
votes
4answers
11k views

Can I add a unique constraint that ignores existing violations?

I have a table which currently has duplicate values in a column. I cannot remove these erroneous duplicates but I would like to prevent additional non-unique values from being added. Can I create a ...
2
votes
2answers
162 views

Design consideration regarding state handling: how to store multiple, variable states for one entity [closed]

First I have to admit that I'm not a database professional neither are my colleagues. For a new project my colleagues and me came to a design question we couldn't really solve easily. And all the ...
0
votes
2answers
894 views

Storing dynamic data in NoSQL

I have scenario where I need to store unstructured data but the rest of my data is structured and relational. An example of the type of unstructured data is as explained below: User Type 1: How do ...
2
votes
1answer
2k views

How to optimize multiple self-JOINs?

I'm looking for advice on either optimizing multiple self-joins, or a better table/DB design. One of the tables looks as follows (relevant cols only): CREATE TABLE IF NOT EXISTS CountryData ( ...
0
votes
1answer
121 views

Am I wrong in table design or wrong in selected index when made the table?

I've build web application as a tool to eliminate unnecessary data in peoples table, this application mainly to filter all data of peoples who valid to get an election rights. At first, it wasn't a ...
0
votes
2answers
299 views

Should numeric identifiers like serial numbers be stored as integers?

Many of our databases store numeric tracking codes (like serial numbers) as integers. There is little chance of these codes every getting alphabetic characters, but it still seems like an incorrect ...
5
votes
1answer
669 views

financial transactions with and without commissions

I'm building a gambling website. All financial transactions from and to external sources (credit cards, money transfer systems) are subject to commission. Amount of the commission depends on the ...
0
votes
1answer
340 views

Database with insert data every 2 minutes

I have a site to develop into PHP and mysql where I take, with a cron, every two minutes 10 xml from a server parse each and insert data into my database. Well this data are simple string (maximum 10) ...
0
votes
2answers
1k views

Use timestamp(or datetime) as part of primary key (or part of clustered index)

I use following query frequently: SELECT * FROM table WHERE Timestamp > [SomeTime] AND Timestamp < [SomeOtherTime] and publish = 1 and type = 2 order by Timestamp I would like to optimize ...
6
votes
3answers
1k views

PK as ROWGUIDCOL or use a separate rowguid column?

There's a long-winded debate going on here so I'd like to hear other opinions. I have many tables with uniqueidentifier clustered PK. Whether this is a good idea is out of scope here (and it's not ...
4
votes
2answers
318 views

What is Transaction Path Analysis?

I came across the term Transaction Path Analysis which I am not familiar with. A Google search resulted in only a few results, most of which seem to assume everyone knows what it means. From these my ...
0
votes
0answers
171 views

How implement MySQL unique index with two foreign key that one can be null?

I would know if can be declared in MySQl to create an index constraints in a table with two foreign key that one can be null. For example cannot be repeated a null foreign key with the other foreign ...
1
vote
2answers
149 views

What is proper database design for a drupal table with an order field?

I am adding a custom widget to an instance of Drupal 6.x & MySQL 5.5 and came across a problem with updating rows. I have a table of recipe ingredients where multiple ingredients are tied to a ...
-1
votes
2answers
174 views

what is the best way to update 2 tables via data entry form in access 2007 database? [closed]

I have a database with more than 500.000 records, I am using Table_a to Accessing the files by the ID number,Name, Date, Address, Tel, ..... And then I used Table_b to archive files and locate the ...