well you have to do it on your own.
its actually easy
|||Joey, I've done it for years and am comfortable with it. I was just wondering if such a tool existed.|||I guess no such tool exist as of now.
maybe we should invent one
well you have to do it on your own.
its actually easy
|||Joey, I've done it for years and am comfortable with it. I was just wondering if such a tool existed.|||I guess no such tool exist as of now.
maybe we should invent one
Hai everybody recently i came across this article and i have tried to answer all the follwoing questions. But i am not sure its correct or not..so you peoples can comment on the follwoing questions.
2)
Employee (ssn, Name, Salary, Address, ListOfSkills)
Yes,
No.Ans: No. as list of skills would be repeated.
3)
Department (Did, Dname, ssn)
Yes,
No.Ans: No. ssn and did should be moved to a seperate table.
4)
Vehicle (LicensePlate,Brand,
Model, PurchasePrice, Year, OwnerSSN, OwnerName
Yes,
NoAns: No.
5)
Employee (ssn, Name, Salary, did) (obs.:
employee can only belong to one department)
Yes,
No.Ans: Yes.
6)
Customer (Cust_Id, Name, Salesperson, Region) where Salesperson
determines Region.
Yes,
No.Ans: No.Salesperson and region should be moved to a seperate table.
7)
Component (ItemNo, ComponentNo, ItemName, Quantity) where ItemNo
->ItemName
Yes,
No.Ans: No.As itemname is a subset of itemno and not a subset of both itemno and componentno.
Not homework, right? :)
Hai everybody recently i came across this article and i have tried to answer all the follwoing questions. But i am not sure its correct or not..so you peoples can comment on the follwoing questions.
2) Employee (ssn, Name, Salary, Address, ListOfSkills)
Yes, No. Ans: No. as list of skills would be repeated.
louis: exactly. Any column that is plural likely represents multiple things...
3) Department (Did, Dname, ssn)
Yes, No. Ans: No. ssn and did should be moved to a seperate table.
Louis: Well, Did is fine, but I would expect that ssn violates fourth normal form. If the SSN represents something where there is only one of them (like the manager,) then this is fine. If it represents a member of a department, then you definitely have problems because the department name and members of the department relate differently to the Did key of the Department table.
4) Vehicle (LicensePlate, Brand, Model, PurchasePrice, Year, OwnerSSN, OwnerName
Yes, No Ans: No.
Louis: if you are only allowing a single owner of the vehicle AND you only track the most recent purchase information, then yes. Else no. You always need to consider cardinality between attribute and key.
5) Employee (ssn, Name, Salary, did) (obs.: employee can only belong to one department)
Yes, No. Ans: Yes.
Louis: agree. One employee, one name, one salary, one department, all data corresponds to the employee. That is fine.
6) Customer (Cust_Id, Name, Salesperson, Region) where Salesperson determines Region.
Yes, No. Ans: No.Salesperson and region should be moved to a seperate table.
Louis: Good question. Was this the salesperson of the customer, and the Region of the customer? Or is this the region that the salesperson works, regardless of the location of the customer? That makes a big different.
7) Component (ItemNo, ComponentNo, ItemName, Quantity) where ItemNo -> ItemName
Yes, No. Ans: No.As itemname is a subset of itemno and not a subset of both itemno and componentno.
Louis. No, like you said, this violates second normal form
|||Thanks louis, definetly its not homework. I am very much interested in design, that's why i posted.sqlI have few doubts whether the following DB structure is good or rubbish.
Suppose you are an organization has many cinemas,Theatres,Venues etc:
Cinemas
Theatres
Venues
etc
and you want to store-retrieve about each one of this item
would you normalize like this
Organization Table
==================
orgID PK
OrgName
CinemaInOrganization
==================
OrgID PK
CinID PK
TheatreInOrganization
==================
OrgID PK
CinID PK
VenueInOrganization
====================
OrgID PK
VenID PK
Do you envisage any problem with querying tables with this structure?
Thanks a lot in advance
Not really, it largely depends on how your systems handle the Theatres, Cinemas and Venues.
Personally they are all types of venues, what commonality of data and function is shared across them all?
|||
Thanks a lot for your quick reply.
That was just a fictious example that strongly reflect a scenario I have to implement.
The commonality among them is that all these Items (Venues,Theatres etc) they all belong to an Organization.
What I wanted to establish is that if you have the following Tables:
Venue VeniD -VenName etc
Theatre ThID -THName etc
Cinema CinID -CinName
and then this organization has a one to many toabove tables should you create Link table for each one of them as I mentioned in the original post?
Thanks again
My confusion.
I would only create link tables where you can have many to many relationships. It really complicates the issue to have those intermediate tables when you don't need them (in my view)
Victoria store:
TorrensUnit
TorrensVolume
TorrensFolio
Queensland store:
TorrensCounty
TorrensLot
TorrensPlan
TorrensParish
TorrensUnit
TorrensVolume
TorrensTitleRef
There are 11 different columns and they are used in 8 different
combinations depending on the state.
Since we need to store information about land in different states I see
two possible solutions:
1. A sparse table containing the 11 columns with a CHECK constraint to
enforce the valid combinations.
2. A table for each state containing only the columns relevant to the
state with a foreign key relationship to the table containing the
common columns.
I'm not sure if the data type and length is consistent between states
yet (waiting to find this out) but assuming that it is which of these
approaches is going to be the most rigorous? I'm leaning towards (2)
but I don't like the feel of a table per state.>From a design standpoint I try to stay away from your first choice if
possible, seems like it'd be difficult to maintain. I like your second
point, but if there is a common set of data that is shared, then
"normalize" that information.
CREATE TABLE Store(
StoreID int IDENTITY(1,1) NOT NULL,
TorrensUnit varchar(50) NOT NULL,
TorrensVolume varchar(50) NOT NULL
)
CREATE TABLE StoreVictoria(
StoreVictoriaID int IDENTITY(1,1) NOT NULL,
StoreID INT NOT NULL, -- FK
--Specific columns
)
CREATE TABLE StoreQueensLand
(
StoreQueensLandID int IDENTITY(1,1) NOT NULL,
StoreID INT NOT NULL, -- FK
TorrensParish varchar(50),
TorrensTitleRef varchar(50)
--Specific columns
)|||On one hand, property does not move from state to state so one table
per state would work and make sense.
But do you ever view the set of all parcels of land in the country as
your unit of work? I woudl go with one table per state and VIEW that
has the global summary information.|||90% of the time we will be dealing with individual properties, there
will be time where we need to show a list of properties that are in
different states so a VIEW would make sense here. Thanks Celko, when's
your SQL Coding Standards book coming out? Looking forward to it.|||>> Thanks Celko, when's your SQL Coding Standards book coming out? Looking forward to it. <<
It has been out for a several weeks now.
http://www.amazon.com/exec/obidos/t...=glance&s=bookssql
Hello,
I'm building an OLTP employee roster application, and I have the data model normalized, but I'm finding it challenging to update the data in all of the underlying tables via a web form and stored procedures. I'm getting the direction to keep things normalized, but I'm struggling with table updates.
Is it sound OLTP database practice to write records to a "roster_data" table that is a foreign key repository for all of the underlying tables (almost like a view without the update restrictions)? It would be much easier to manage this table of foreign keys (fact table) instead of writing several stored procedures to keep all of the related tables (dimensions) updated. (almost like a star schema in OLAP)
I know I'm being vague, but I would like to bounce off some OLTP experts.
Thanks,
Jim
What type of data is being changed?
Is it key data?
Would CASCADE UPDATE work?
More information, table DDL, etc., would be useful.
|||Not that you are a beginner in normalization topic, but the following links should get you the idea in thsi regard:
http://www.informit.com/articles/article.asp?p=27785&rl=1 & http://www.sqlmag.com/Articles/Index.cfm?ArticleID=4887
|||Everyone,
My basic issue was keeping my underlying normalized data model updated via one VIEW, and I was running into the "can't updated more than one base table issue." After some research, I found the INSTEAD OF triggers -- this functionality will enable me to update all of my underyling tables using one VIEW.
Thanks everyone and have a great holiday!
Jim