Recordset for Reporting the Standings
Total Page:16
File Type:pdf, Size:1020Kb
Structure of Sailors.mdb Introduction and Objective Sailors. mdb supports a hypothetical web site for competitive sailors. The web site includes pages to notify sailors of upcoming regattas, changes in rules, reports on past regattas, and personalized pages based on each sailor's interests. Additional features allow the posting and statistical analysis of regatta results and the ranking of sailors. Vocabulary and Business Rules Sailors, in this database are people who race sailboats. These people have the normal personal information such as names and nationalities, as well as an assigned professional class, which reflects their commitment and accomplishment in the sport of yachting. The most skilled sailors, those of Olympic caliber, are rated Professional Class 1 while those who compete at an amateur level are class 3. Boats are owned by Sailors. A boat has a name and an identifying sail number. Every boat is of a boat class. A Boat Class is a group of boats of the same shape, sail area and hull size, thus ensuring an even competition among the sailors. Sailors generally race in one class only and thus are not interested in information for boats of other classes. Sailors race under the aegis of yacht clubs, the organizations which typically sponsor regattas. Yacht clubs have an identifying flag called a club burgee, may have a web site, and each year a yacht club has a meeting at which time information for the season is disseminated. Larger boats are limited to sailing from clubs with a crane to hoist the boat from its trailer to the water. Competitions generally consist of a series of races (typically 3 to 10), which together constitute a regatta. Based on the results of regattas, sailors are ranked each month from first (most skilled) to 20th (least skilled). Appendix A Where to Download This database, in Access format, is available from the Wrox site. The procedures to create the queries for Microsoft SQL Server are also available from the same site in the file Sailors. sql. The end of this appendix lists the information to create the structure of the database by hand. Structure and Relationships of Tables The Sailors database contains five tables. There are no relationships permanently created, they are created in queries as needed. People Table Sailors are listed in the People table; each person is a record. The People table can be related to the Clubs table and to the boats table, since each sailor is a member of a club and most sailors own boats. In addition, the People table can be related to the Rank table. As in all tables of this database there is an ID field with a data type of autonumber. To keep the database small for the download, there are only twenty sailors. Boats Within the Boat table each record is a boat. The boats can be related to the People table by the PeopleiD as well as the Boat Class table. BoatCiass This table has only a few records, each representing a class of boats. It can only be directly related to the Boats table. Since all the boats of a given class have the same length, weight and sail area, this information is kept only in the Boat Class table. In our simple example there are just three classes. Rank Each record in the Rank table represents one sailor in one month of one year. Fields hold the sailor's ID as well as the rank number. This database covers the four months from December 1999 to March 2000. Clubs Each yacht club holds a record in this table. In addition to contact information, this table holds data for the URL of the club's home page. An image of the club burgee (flag) is held in two places, a file on the server and in a BLOB field in this table. Overview of Queries One group of queries, those beginning with qAll, merely list the records of the table. An exception is the qAllRankings query, which joins the People, Clubs and Rank tables to create a useful recordset for reporting the standings. A second group of queries begins with qparm. These are for demonstrating the use of passing parameters through the ADO command object. This group includes the qparminsert queries, which are called to append records to tables. 742 Structure of Sailors.mdb Structure of Tables Table Field Name Field Type Field Size Notes Boat Class ClassiD AutoNumber 4 Attributes: Fixed Size, Auto- Number (Long) Increment ClassName Text 50 ClassLength Number (Long) 4 ClassWeight Number (Long) 4 ClassEntered Date/Time 8 Format: Long Date Boats BoatsiD AutoNumber 4 attributes: Fixed Size Number (Long) Auto-Increment BoatName Text 50 Boatel ass Text 50 BoatLaunched Date/Time 8 BoatCertified Yes/No 1 BoatNote Memo Boat Photo OLE Object BoatValue Currency 8 Decimal Places: Auto Format: $#,##0.00;($#,##0. 00) 743 Appendix A Table Field Name Field Type Field Size Notes Clubs ClubiD AutoN umber 4 Attributes: Fixed Size Number (Long) Auto-Increment ClubCode Text so ClubName Text so ClubAnnualMeeting Date/Time 8 ClubDues Currency 8 Decimal Places: Auto Format: $#,##0.00;($#,##0. 00) ClubWWWSite Hyperlink ClubBurgeeFile Text 50 ClubBurgee OLE Object ClubHasCranes Yes/No 1 ClubMembership Number (Long) 4 ClubNote Memo People PeopleiD AutoN umber 4 Number (Long) PeopleNameLast Text 50 PeopleNameFirst Text 50 PeopleDOB Date/Time 8 Format: Short Date PeopleProfessionalClass Number (Long) 4 PeopleClubCode Text 50 PeopleReferee Yes/No 1 PeopleState Text so PeopleView Text 50 744 Structure of Sailors.mdb Table Field Name Field Type Field Size Notes Rank ID AutoN umber 4 Attributes: Fixed Size Number (Long) Auto-Increment SailoriD Number (Long) 4 Year Number (Long) 4 Month Number (Long) 4 Rank Number (Long) 4 Structure of Queries Query Name Query Details qAllBoatClasses SELECT BoatClass.ClassName FROM BoatClass ORDER BY BoatClass.ClassName; qAllBoatNames SELECT Boats.BoatName FROM Boats; qAllBoats SELECT Boats.BoatClass, Boats.BoatName FROM Boats ORDER BY Boats.BoatClass, Boats.BoatName; qAllClubs SELECT Clubs.ClubName, Clubs.ClubCode FROM Clubs ORDER BY Clubs.ClubName; qAllRankings SELECT People.PeopleiD, People.PeopleNameLast, People.PeopleNameFirst, Clubs.ClubName, Rank.Year, Rank.Month, Rank. Rank FROM (Rank INNER JOIN People ON Rank.SailoriD = People.PeopleiD) INNER JOIN Clubs ON People.PeopleClubCode = Clubs.ClubCode ORDER BY Clubs.ClubName, Rank.Year, Rank.Month, Rank.Rank; 745 Appendix A Query Name Query Details qDemoQueryGrid SELECT People.PeopleNameLast, People.PeopleNameFirst, People.PeopleProfessionalClass FROM People WHERE (((People.PeopleProfessionalClass)=2)) ORDER BY People.PeopleNameLast; qparmBoats PARAMETERS Class Text; SELECT Boats.BoatsiD, Boats.BoatName FROM Boats WHERE (((Boats. BoatClass )=[Class])); qparminsertBoat PARAMETERS Name Text, Class Text, Launched DateTime, Certified Bit, Notes LongText, [Value] Currency; INSERT INTO Boats ( BoatName, BoatClass, BoatLaunched, BoatCertified, BoatNote, BoatValue) SELECT [Name] AS Exprl, [Class] AS Expr2, [Launched] AS Expr3, [Certified] AS Expr4, [Notes] AS ExprS, [Value] AS Expr6; qparminsertBoatClass INSERT INTO BoatClass ( ClassName, ClassBoatLength, ClassBoatWeight, ClassSailAreaMainJib, ClassSailAreaSpinnaker, ClassAuthority ) SELECT [Name] AS Exprl, [Length] AS Expr2, [Weight] AS Expr3, [MainJib] AS Expr4, [Spinnaker] AS ExprS, [Authority] AS Expr6; qparminsertPerson PARAMETERS FirstName Text, LastName Text, DOB DateTime, ProfessionalClass Long, ClubCode Text, Referee Bit, State Text; INSERT INTO People ( PeopleNameFirst, PeopleNameLast, PeopleDOB, PeopleProfessionalClass, PeopleClubCode, PeopleReferee, PeopleState ) SELECT [FirstName] AS Exprl, [LastName] AS Expr2, [DOB] AS Expr3, [ProfessionalClass] AS Expr4, [ClubCode] AS ExprS, [Referee] AS Expr6, [State] AS Expr7; qParmSailorRanking PARAMETERS ClubCode Text, Ranking Long; SELECT People.PeopleiD, People.PeopleNameLast, People.PeopleNameFirst, People.PeopleProfessionalClass, People.PeopleClubCode, Rank.Year, Rank.Month, Rank.Rank FROM People INNER JOIN Rank ON People.PeopleiD = Rank.SailoriD WHERE (((People.PeopleClubCode)=[ClubCode]) AND ((Rank.Rank)<=[Ranking])) ORDER BY Rank.Year, Rank.Month, Rank.Rank; 746 Structure of Sailors.mdb Query Name Query Details qparmVerifyLogin PARAMETERS FirstName Text, LastName Text, ClubCode Text; SELECT People.PeopleNameFirst, People.PeopleNameLast, People.PeopleClubCode FROM People WHERE (((People.PeopleNameFirst)=[FirstName]) AND ((People.PeopleNameLast)=[LastName]) AND ((People.PeopleClubCode)=[ClubCode])); qranktest SELECT Rank.Rank, Rank. Year, Rank.Month, Rank.SailoriD FROM Rank ORDER BY Rank.Rank, Rank. Year, Rank.Month, Rank.SailoriD DESC; qTestWherein SELECT People.PeopleNameLast, People.PeopleNameFirst, People.PeopleClubCode FROM People WHERE (((People.PeopleClubCode) In ('scow','dsyc'))); 747 - Structure of Clothier.mdb Introduction and Objective The Clothier database supports an Internet site to manage new items in the inventory of a clothing wholesaler. As the wholesaler contracts to buy clothing from manufacturers, the buyers post the items on the web site so they can be ordered by individual stores. Vocabulary and Business Rules An item refers to a given model (design) of clothing. An item is not one piece of clothing, but rather one offering by the wholesaler such as the "Mountain Walker" hiking trousers. Every item belongs to a department, such as Women's Sportswear or Men's Formalwear. In addition, each item has a type such as trousers, shirts, or hats. Items have a release date and since the wholesaler wants to show clothes as early as possible, they are frequently posted to the site prior to release. A quantity per box helps the sales staff