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


surfsatwerk
HOME ยป 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:



Related to : Good db table design: One table mixing different entities or separate table for each entity
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:



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

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



HD Wallpapers
3D
3D Abstract
City
Celebrities
Indian Celebrities
Cars
Travel
Girls
Animals Birds
Movies
Sports
Black White
Nature
Planes
Anime
Food Drink
Dreamy Fantasy
Architecture
Games
Space
Holidays
Flowers
Love
Artistic
Baby
Beach
Bikes Motorcycles
Macro
Computers
Vector
Funny
Army
Textures
Brands
Misc
Music
Other
Privacy Policy - Copyrights Notice - Feedback - Report Violation - RSS 2017 © bighow.org All Rights Reserved .