database-design

Enforcing Referential Integrity with Triggers Instead of Foreign Keys

I'm building a new database for a web-based application and find that I am frequently having to decide between flexibility of the model and meaningful foreign keys to enforce referential integrity. There are a couple of aspects of the design that lead me towards writing triggers to do what FKs would normally do: Parts of the model use...

Data attribute table vs many small tables

I am working for a client that currently has a DataAttributes table with columns Name, Type, Value, and ParentID. This table is used to store virtually everything such as US states, anatomical items, combo box selections, and system settings. I would seriously like to get rid of this table and break each section into its own table. Are ...

What is the best way to design this particular database/SQL issue?

Here's a tricky normalization/SQL/Database Design question that has been puzzling us. I hope I can state it correctly. You have a set of activities. They are things that need to be done -- a glorified TODO list. Any given activity can be assigned to an employee. Every activity also has an enitity for whom the activity is to be perf...

matching words in database conceptual definitions

I need to match the given words with their suitable meaning. Please help me as these words are very confusing to me.from " Unique identifier" to " Create-object operation", please find their meaning from a list given below. Problem 1 For each of the terms in the left-hand column below, select the term in the righthand column that best ...

data model, many2many with many2one relationship

Hey, I have two types of accounts (customer and provider), I chose the single-table strategy for persistence. Customer creates Orders (one2many) and provider bids on the orders in auction style (many2many relationship, because he can bid on many orders as well as other providers). My question is, is it possible to have these relationship...

Porting SQL structures to NoSQL MongoDB or CouchDB

I am trying to figure out how you design data storage in a document storage system like CouchDB or MongoDB. I don't use JOIN's anymore in my queries and just stick to searches for rows with certain indexes that meet my criterion. For example, I might look for recent comments (ORDER BY date) or all active users (WHERE status = 1). In ot...

Large scale internet application, where to start?

I'm involving in kind of work that i think knowledge about large scale application, large scale web will help me much. What do you think i should take? I mean books to read, courses to take... etc... Thanks in advance for any suggestion. PS: maybe applications i mean are not large enough :D, kind of social network for >100k users or rea...

CakePHP: Setting up relationship between two models via a third table

I have the followning tables: Users Organizations Email_Addresses Email_Address_Relations Both Users and Organizations may have email addresses, which are stored in the Email_Addresses table and related to via the Email_Address_Relations table. Structure of Email_Address_Relations id char(36) NOT NULL module varchar(64) NOT NULL DE...

How to create materialized views in SQL Server ?

I am going to design a DW and I heard about materialized views. Actually I want to create a view and it should update automatically when base tables are changed. Can anyone explain with an query example.. ...

Is it reasonable to divide data into different tables, based on a column value?

If I have a large table with a column which has a rather limited range of values (e.g. < 100), is it reasonable to divide this table into several tables with names tied to that column value? E.g. a table like with columns: table "TimeStamps": [Id] [DeviceId] [MessageCounter] [SomeData] where [DeviceId] is the "limited range" column w...

How do we optimize oracle database ?

Hello, We have a Oracle 9i Database with 7 tables each with 15+ Million records. There is no relation between the table i.e. no foreign keys. Here is an example of one of the tables CREATE TABLE GSS.SHOWPD ( INSERVID VARCHAR2(7 CHAR) NOT NULL, CAGEPOS VARCHAR2(8 CHAR) DEFAULT NULL, DETA...

draw an ER diagram that fulfills the information about the car dealer company which is described below.

This car dealer company has many branch offices. In each of these branch offices, some sales people are working whose job is selling cars to customers. You need to define your branch offices in your diagram. And also, you need to define sales people who are working in these branch offices. - This company sells cars, so you must store car...

Payroll System: Database structure for flexible storage of weekend off scheme

Objective: The Leaves Management and Payroll system requires the official weekend hodiday scheme stored in the database to be referred to while generating the monthly salary for each employee in the organisation. Generating flexible Database Schema for storing the weekend scheme is the objective. Problem: The database schema should be f...

SQL Server - Poor performance of PK delete

I have a table in SQL Server 2008 R2 consisting of about 400 rows (pretty much nothing) - it has a clustered index on the primary key (which is an identity). The table is referenced via referential integrity (no cascade delete or update) by about 13 other tables. Inserts/Updates/Gets are almost instant - we're talking a split second (a...

Are there any design patterns for bitemporal NoSQL databases?

I'm curious if anyone has implemented or even knows of any bitemporal databases built on NoSQL platforms (e.g., riak). ...

Database: Does the appendix 'HX' have significant value?

I'm working with a legacy application with surprise surprise, next to no useful documentation on naming convensions or over all data structure. There are similarly named tables in the database with one of them ending in HX. Does this hold any significance in anyones database experience? The data seems to be replicated so I would assume...

Storing boolean values: bundle or individually?

Hello, I have about 50 discrete boolean values that I need to store in the database. These are logged every few seconds so I will be storing a lot of them over time. The way this data would be used is: 1) Access a bulk of time to see flag status history 2) Find times at which flag changed status Once stored, the records will not be u...

Mysql Database design - checklist/quiz application

hello, I'm currently 'learning' codeigniter, php and mySql all at once as I try and create a "checklist" type of website, where visitors sign up, create a project and are asked a list of questions, where they must input certain fields I'm a little stuck on my mySQL DB-design... (completely stuck actually) what it comes down to is... ...

Should I add total count in a the main relational table

I'm doing something different but this is an easier to understand example. Think of the votes here. I add these votes to a separate table and log information about them like by who, when and so on. Would you also add a field to the main table that simply counts the number of votes or is this bad practice. ...

Need a feedback for matrix question table design

Hi In the survey, there is a type of question called Matrix which it's like this: | Is Friendly | Weather | Comments =========================================== Sydney | Y | 5 | 'bla' ------------------------------------------- Singapore | Y | 10 | 'test' ------------------------------------...