hello
I've a denormalized table PRODUCTS with following fields:
ProductNo ,
OrderNo ,
SerialNo ,
OrderDate ,
PromiseDate ,
ManufacturerID ,
..
..
..
DistributorID ,
DealerID ,
..
..
..
ReceiptDate ,
..
..
..
I have to denormalize this table, so I created 3 tables:
Table Name : ProductOrders
Fields:
+ProducrOrderID,
ProductNo ,
OrderNo ,
SerialNo ,
OrderDate ,
PromiseDate ,
ManufacturerID ,
-------------------------------
Table Name: ProductsOrdersDetails
Fields:
+ProductsOrdersDetailsID,
ProductOrdersID,
DistributorID ,
DealerID
..
..
..
-----------------------
Table Name: ProductsOrdersReceipts
Fields:
+ProductsOrdersReceiptsID,
ProductsOrdersDetailsID,
ReceiptDate ,
..
..
..
----------------------------
DistributorID and DealerID appear in Details table because a
particular order number for a specific product number can come from
different distributor and dealer.
What I need is a query to populate these normalized tables from the
original denormalized Products table.
Can any one please help?
Thanks 1 1733
Muzamil (mu*****@hotmail.com) writes: I have to denormalize this table, so I created 3 tables:
Table Name : ProductOrders Fields: +ProducrOrderID, ProductNo , OrderNo , SerialNo , OrderDate , PromiseDate , ManufacturerID , ------------------------------- Table Name: ProductsOrdersDetails Fields:
+ProductsOrdersDetailsID, ProductOrdersID, DistributorID , DealerID . . . ----------------------- Table Name: ProductsOrdersReceipts Fields: +ProductsOrdersReceiptsID, ProductsOrdersDetailsID, ReceiptDate , . . .
I think you should find the real keys of your subtables. If I understand
your narrative correctly, the primary key for ProductOrderDetails
should be (ProductOrderID, DistributorID, DealerID). In the same vein
the key for ProductsOrdersReceipts should maybe be
(ProductOrderID, DistributorID, DealerID, ReceiptDate).
In the long run this will make the data model easier to understand,
and easier to query.
What I need is a query to populate these normalized tables from the original denormalized Products table.
Without the complete CREATE TABLE statements and sample data this
is somewhat difficult. But I would guess that for the first two
tables, you would have to use the DISTINCT keyword. But it will be
all straight-forward. At least if you follow my recommendation on the
keys.
--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se
Books Online for SQL Server SP3 at http://www.microsoft.com/sql/techinf...2000/books.asp This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: knoak |
last post by:
Hi there,
I have a table with items in it.
Table contents are: id, title, text, combination
Each product has a few other products with
which it can be combined. In the 'combination'-
field...
|
by: Ed_No_Spam_Please_Weber |
last post by:
Hello All & Thanks in advance for your help!
Background:
1) tblT_Documents is the primary parent transaction table that has 10
fields and about 250,000 rows
2) There are 9 child tables with...
|
by: Willem |
last post by:
Hi there,
I'm sort of new with doing much record manipulation with queries. Up
till now I've been programming VBA and doing record looping to get my
results. This works fine but tends to get...
|
by: E.U. |
last post by:
Hi,
I an using MS-Access in order to build a site.
I have this item that can have upto 10 pictures (might have none)
I want to design a dynamic table which has the ID of the item at the
first...
|
by: sunilkeswani |
last post by:
Hi
I am still new to access. I want to know how i can build a query which
can display results from 4 different columns/fields
Like.
Field1 Field2 Field3 Field4
1 2 1 ...
|
by: frizzle |
last post by:
Hi there,
I have a mySQL system with a news publishing part in it:
Admins can create new items with text in it, and they have an option to
create 'fulltexts', so you'd get "read more ..." on the...
|
by: PeteCresswell |
last post by:
I've got something called "Reference Rates".
The idea is that on a given day, we have various rates of return for
various entities.
e.g. Libor 3-month return, Libor 6-month return, US Treasury...
|
by: Deus402 |
last post by:
Here is my table design:
tblEmployers
EmployerID autonum (primary key)
EmployerName text
tblLocations
LocationID autonum (primary key)
EmployerID longint (foreign key)
LocationAdress text
|
by: Tess2819 |
last post by:
Hi Everyone,
This is my first topic so I hope you can help. I have searched but
can't seem to find what I am looking for, so here it is.
I want to create a query using design view in...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |