data-modeling

Handling data content security

So let's say that in your application you have to handle data content security, in such a way that application defines several "Entities" that have to be secured so that user cannot view, edit etc. certain code ranges. Let's say we have secured entities such as Location, Department, Division, ProductLine etc. and each user gets associat...

SQL Database Structure for Custom Categories

I am creating an online blog website and for each blog post, I'd like to have the user be able to create/edit/delete their own category so that they may categorize their post. What is generally considered a good database design for user generated categories? This is my proposed table design. (Is there a name for this type of db?) USE...

Surrogate key as a foreign key over composite keys

I realise there might be similar questions but I couldn't find one that was close enough for guidance. Given this spec, Site --------------------------- SiteID int identity Name varchar(50) Series --------------------- SiteID int SeriesCode varchar(6) ... --SeriesCode will be unique for every unique SiteID Episod...

Two tables or one table ?

Hi, a quick question in regards to table design.. Let's say I am designing a loan application database. As it is right now, I will have 2 tables.. Applicant (ApplicantID, FirstName , LastName, SSN, Email... ) and Co-Applicant(CoApplicantID, FirstName, LastName , SSN, Email.., ApplicantID) Should I consider having just one table beca...

Is it a good idea to use rowguid as unique key in database design?

Hi there, SQL Server provides the type [rowguid]. I like to use this as unique primary key, to identify a row for update. The benefit shows up if you dump the table and reload it, no mess with SerialNo (identity) columns. In the special case of distributed databases like offline copies on notebooks or something like that, nothing else ...

Survey Data Model

I'm developing a simple survey module for an ASP application I'm working on and I'd like to get some suggestions on the data model. Questions can be one of three types - multiple choice, multiple answer; multiple choice, single answer, and free response. I'm thinking of the following tables: Question - with a question type discrimi...

DB design to use sub-type or not?

The database I'm designing has 3 major tables: BOOKS, ARTICLES, NOTES. Each book or article can have multiple notes, my original design was just like that, which means both notes on books and notes on articles go the 'notes' table. Here are the columns for the NOTES table: note_id note_type note_type_id note_content NOTE_TYPE can be ...

mysql - keyword search table - a good idea?

Is it a good idea to have a 'search table'? for example a search that can search 'users', 'groups' and 'pages' (facebook style) would have fields like keywords, userid, groupid, pageid that way the system can do a LIKE query on the keywords from one table. or would it be better like keyword1, keyword2, keyword3, keyword4, keyword5, u...

Should I make specification table referenceable?

Since I know there are lots of expert database core designers here, I decided to ask this question on stackoverflow. I'm developing a website whose main concern is to index every product that is available in the real world, like digital cameras, printers, refrigerators, and so on. As we know, each product has its own specifications. For...

Design of Databases for storing the details of the recurrent occurrence of an event

I need to implement a feature similar to the one provided by Microsoft Outlook to make your meeting appointment recurrent. I am trying to figure out the optimized Database design that I will be requiring for implementing this feature. The requirement is something like that each run or task entered by the user will also be applicable fo...

R: ARIMA, ARMA and AICs?

data <-c(88, 84, 85, 85, 84, 85, 83, 85, 88, 89, 91, 99, 104, 112, 126, 138, 146,151, 150, 148, 147, 149, 143, 132, 131, 139, 147, 150, 148, 145, 140, 134, 131, 131, 129, 126, 126, 132, 137, 140, 142, 150, 159, 167, 170, 171, 172, 172, 174, 175, 172, 172, 174, 174, 169, 165, 156, 142, 131, 121, 112, 104, 102, 99, 99, 95, 88, 84, 84, 87...

SQL Server Database Design Problem/Challenge

I have a database that has node & nodetype tables. Nodes table NodeID ParentNodeID NodeTypeID NodeName ... NodeType Table NodeTypeID ParentNodeTypeID NodeTypeName ..... Both tables have a relationship to itself. There are different types of node i.e Node Site Building Office These are hierarchical, so information (attributes) th...

ER Diagram (Drawing)

For a relational database that represents the current term enrollment at a large university, what is the ER diagram for a schema that takes into account all the assertions given: • 100 instructors, 200 courses, and 800 students. • An instructor may teach one or more courses in a given term (average is 2.0 courses). • An instructor mus...

Creating database tables with "either or" type fields.

I have a database that tracks players through their attempts at a game. To accomplish this, I keep a table of users and store the attempts in a separate table. The schema for these tables is: CREATE TABLE users ( id BIGINT PRIMARY KEY, -- the local unique ID for this user name TEXT UNIQUE, -- a self-chosen username for the user ...

Many to many relationship

I have a customers and managers, two tables independently. My customer table have nearly hundred million records whereas manager table have 100 records. Now i am in position to map the customers to manager. Rules are as follows One manager can have multiple customers. One customer may mapped with multiple managers. What is the best D...

Database design for write-heavy web application

A lot of the LOB applications we provide to our customers are of a marketing / promotional nature (sweepstakes, event registration, etc...). Most of the applications, while very simple, are very demanding on the database. Imagine a "registration" type site as the backing for a commercial that airs during the superbowl, for example (yes, ...

Should i have a primary ID? i am indexing another field.

Using sqlite i need a table to hold a blob to store a md5 hash and a 4byte int. I plan to index the int but this value will not be unique. Do i need a primary key for this table? and is there an issue with indexing a non unique value? (I assume there is not issue or reason for any). ...

Is this a good data model to implement strongly-typed roles?

Yes, this has been asked before here and here. I'm curious as to whether the approach I'm considering is architecturally sound. Let me start off by trying to describe what I'd like to be able to do with my object model: class Person { ISet<Roles> Roles { get; set; } } class RoleDefinition { string Name { get; set; } } class RoleA...

Rails modeling: converting HABTM to has_many :through

I'm doing maintenance work on an existing Rails site and am having some problems stemming from many-to-many associations. It looks like the site was initially built using has_and_belongs_to_many for a few relationships that have since gotten more complicated in the business logic, so I need to use has_many :through instead to support ad...

Adding an ad to a mysql database; Point me in the right direction please...

Currently, I have an 'add your ad here' page, with a form. Now, the user must select what category he will want to post an ad into... So I have a table for each category in mysql. Now my question, how would I make each ad unique, with an ID nr? If I have several tables, the 'auto increment' might turn out to be the same in some ads, a...