F
Frank
I'm a newbie to databases. After reading Allen Browne's site I realized my
experience with Excel was not serving me well with MS Access (2000), so I
set out to normalize my db. Prior to doing this I was able to easily
create a query in Access and then paste the SQL into Dreamweaver. The
resulting recordset worked fine with my web app.
I can now appreciate the advantages of normalization but cannot reproduce
the same recordset for my web app.
Please have a look at the below link, it's a screenshot of the
relationships before normalization along with the recordset it generated in
Access. At the very bottom is a screenshot of the relationships after
normalization.
http://shycatwebs.com/PUB/BeforeAfter.gif
Here's the SQL....
SELECT Lodging.globalLoc, Lodging.regional, Lodging.location,
Lodging.LodgingName, Lodging.photo, Lodging.LodgingDescription,
IconAssignments.Icon1, IconAssignments.Code1, IconAssignments.Icon2,
IconAssignments.Code2, IconAssignments.Icon3, IconAssignments.Code3,
IconAssignments.Icon4, IconAssignments.Code4
FROM Lodging INNER JOIN IconAssignments ON Lodging.LodgingID =
IconAssignments.LodgingID;
The recordset is a listing of all 91 lodgings from the Lodging table and
the associated records from the IconAssignments table. As you can see,
some lodgings have no Icon Assignments while others can have up to 4.
After normalizing, all my attempts at creating queries failed. The best
resulted in Lodging records being duplicated for each assigned policy icon,
and records that had no assigned icons didn't appear at all. For example,
the above link shows the 1st record (Algonquin) has no assigned icons,
while the 4th record (Phantom Ranch) has two. What I got were 2 Phantom
Ranch records with each showing just 1 of the assigned icons (instead of 1
record with 2 icons), and no record for Algonquin. I could get lodging
records with no policy icons to appear if I entered a blank record in the
PolicyIcons table, and then in the IconAssignments table created a dummy
record that matched the LodgingID with the blank PolicyIconID. But I'm
still left with the duplicate record problem, and using dummy records in
this manner doesn't seem like the right thing to do just because I'm unable
to produce a working query.
What is the SQL needed to get the same recordset I had before normalization
but using the normalized db?
Reproducing the recordset appeals best to me because it means no rework in
existing Dreamweaver pages. However, I suspect another query would be more
appropriate if I didn't have code in existing web pages to consider. Would
you agree? And if so, how would such a query handle the (dupe & dummy)
problems I've encountered?
Regards,
Frank
experience with Excel was not serving me well with MS Access (2000), so I
set out to normalize my db. Prior to doing this I was able to easily
create a query in Access and then paste the SQL into Dreamweaver. The
resulting recordset worked fine with my web app.
I can now appreciate the advantages of normalization but cannot reproduce
the same recordset for my web app.
Please have a look at the below link, it's a screenshot of the
relationships before normalization along with the recordset it generated in
Access. At the very bottom is a screenshot of the relationships after
normalization.
http://shycatwebs.com/PUB/BeforeAfter.gif
Here's the SQL....
SELECT Lodging.globalLoc, Lodging.regional, Lodging.location,
Lodging.LodgingName, Lodging.photo, Lodging.LodgingDescription,
IconAssignments.Icon1, IconAssignments.Code1, IconAssignments.Icon2,
IconAssignments.Code2, IconAssignments.Icon3, IconAssignments.Code3,
IconAssignments.Icon4, IconAssignments.Code4
FROM Lodging INNER JOIN IconAssignments ON Lodging.LodgingID =
IconAssignments.LodgingID;
The recordset is a listing of all 91 lodgings from the Lodging table and
the associated records from the IconAssignments table. As you can see,
some lodgings have no Icon Assignments while others can have up to 4.
After normalizing, all my attempts at creating queries failed. The best
resulted in Lodging records being duplicated for each assigned policy icon,
and records that had no assigned icons didn't appear at all. For example,
the above link shows the 1st record (Algonquin) has no assigned icons,
while the 4th record (Phantom Ranch) has two. What I got were 2 Phantom
Ranch records with each showing just 1 of the assigned icons (instead of 1
record with 2 icons), and no record for Algonquin. I could get lodging
records with no policy icons to appear if I entered a blank record in the
PolicyIcons table, and then in the IconAssignments table created a dummy
record that matched the LodgingID with the blank PolicyIconID. But I'm
still left with the duplicate record problem, and using dummy records in
this manner doesn't seem like the right thing to do just because I'm unable
to produce a working query.
What is the SQL needed to get the same recordset I had before normalization
but using the normalized db?
Reproducing the recordset appeals best to me because it means no rework in
existing Dreamweaver pages. However, I suspect another query would be more
appropriate if I didn't have code in existing web pages to consider. Would
you agree? And if so, how would such a query handle the (dupe & dummy)
problems I've encountered?
Regards,
Frank