Good db table design: One table mixing different entities or separate table for each entity



What is better database design?


Having one big table that could contain different "types" of records eg: employees, cars, cell-phones, and in order to identify each type of record, we have a column called type.


So the table would have columns that look like


id | type | name

1 | car | Ford


2 | car | Toyota


3 | phone | motorola


4 | employee | Jack


5 | employee | Aneesh


6 | phone | Nokia


7 | phone | Motorola


or have different tables for each type


eg:



Related to : Good db table design: One table mixing different entities or separate table for each entity
Is it a good practice to maintain the data in a separate table from the task table?
Programming Languages

In my application there is a module which displays info by reading from a table. This info can be edited. Once edited there is a series of actions needs to be performed. So i am maintaining a task table which will create task for each edit made. In order to execute the task, i need the data modified by the user along with the user id. My task table structure will be like this:


TaskId
TaskType
CreatedOn
State
CompletedOn

I am planning to have TaskType attribute based on which it will read the data from the source data table on which info is stored. Now my question is, i also need to maintain the userid to know f

Entity Framework 4 - Code First not storing inherited table separate from base table
Programming Languages

With EF Code First CTP 4 I've created a simple project. This project consists of 2 classes, one inherited from other.


I wish to store the data in separate tables, but the default of EF 4 is to map/store these two entities in the same table.


With .ToTable(), I can change this behavior, but with this I have a side effect: when I persist a Inherited object, EF doesn't persist the common values (ex. Id) on the base class.


I'm sure I'm leaving to set some information in the mapping but do not know which.


static void Main(string[] args)
{
Database.SetInitializer<ZooContext>(new
Best Practice - Mixing Table-Entities with View-Entities in EntityFramework?
Programming Languages

I have a legacy database that I'd like to interact with Entity Framework.


The database is highly normalised for storing information about flights. In order to make it easier to work with some of the data, a number of SQL Views have been written to flatten data and to pivot certain multi-table joins into more logical information.


After quickly looking over this I see two problems with using Views in EF.


The Views contains lots and lots of Keys. Some quick googling seems to indicate I will need to manually edit the EDMX file to remove this info.


The Views don't have any relationships to the other table entities

DB design : members table separate or all in one table?
Programming Languages

I want to create a table of friends with personal information and log on details.


What better to separate the members table to 2 tables ,
one contain minimal details ,
second with Other details.


or remain in one table ?


i have a lot of tables that contain the foreign key of the member.


Good db table design: One table mixing different entities or separate table for each entity
Programming Languages

What is better database design?


Having one big table that could contain different "types" of records eg: employees, cars, cell-phones, and in order to identify each type of record, we have a column called type.


So the table would have columns that look like


id | type | name

1 | car | Ford


2 | car | Toyota


3 | phone | motorola


4 | employee | Jack


5 | employee | Aneesh


6 | phone | Nokia


7 | phone | Motorola


or have different tables for each type


eg:



Table design with joining tables or separate ID in main table
Programming Languages

I'm designing a database that has a couple of tables; FAQ's, Bulletins, and Attachments. Bulletins and FAQ's could have an attachment associated with them, so my initial thought was to create a joining table with the two primary keys as a composite key:


Bulletin
--------
BulletinID
Subject
Description
Notes
Attachment
-----------
AttachmentID
FileName
FilePath
etc.

Joining table:


BulletinAttachments
-------------------
BulletinID
AttachmentID

As I design this, I also thought, what if other enti


Privacy Policy - Copyrights Notice - Feedback - Report Violation - RSS 2017 © bighow.org All Rights Reserved .