Management of Information Infor mation Systems and Technology Technology MGT 186 Relational Database System using MS Access
This exercise exercise is for you to practice using MS Access in the lab, and to provide you with help as to how to work with access. In many regards, it is similar to your for! grade" pro#ect. The goal withthis pro#ect is to learn how to create and use an MS Access database, not to rush through the exercise. $A%T I & T'( )I*( ST%+T+%(S -ur -ur data atabase ase shal shalll be to kee eep p trac rack of sale salesp sper erso sons ns in a comp ompany any. The The SA*(S$(%S- table shall be made up of the following /elds0
There should be a table of customers who are ustomers of the salespersons, the +ST-M(% table. It should be made up of the following /elds0
$A%T II & ST($ 12 ST($, %(ATI3 T'( SA*(S$(%S- TA1*( 4. )irst open up MS Access. lick in the reate a ew 5atabase" box6s use a 1lank 5atabase". Then click -7. 8. 2ou6ll be asked to save the new database. 5own below, click in the )ile name" box, and call this (mployee.mdb". %emember & this database will have two tables . lick reate. 9. The blank database will be presented. The Tables" Tables" tab will already be selected for you. ote that you can’t select anything but ew" on the right. lick on it. :. A new dialog box is opened. lick on Design View, and then -7. 2ou will do this for both tables. ;. ow you6ll start setting up your table. In the )ield ame column, give the /eld its identifying name. 2ou may use the suggested /eld names above. Then use the Tab key to tab over to the 5ata Type. sign in )ormat for the Ofce and State /elds, which makes them uppercase, u ppercase, and you create the ?alidation %ule and ?alidation Text, as described in the previous class session. @. 3o ahead and complete all the /elds.
4. (xit your table after you6ve entered all the data. 8. lick on the Tools drop!down menu from the menu bar. lick on the %elationships command. 9. The Show Table dialog box is displayed0 lick on each table and then click on Add lick on the common /eld in the Salesperson table, table, and drag it to the same common /eld in the Customer table.
(xperiment by changing your Luery, and running it each time, in the following ways0 ! lic lick k on the the Sor Sortt row row in a colu column mn oth other er tha than n the the Salesperson ID and select Ascending. %un the Luery and view the results. ow change back to 5esign ?iew and select 5escending for the same /eld and run it. ?iew the results. Try this with several /elds. ! lic lick k on the Show Show butto utton n in in 5esi 5esig gn ?iew iewB for for a /eld eld sho shoul uld d be checked ! so HuncheckH itB and run the Luery. That /eld should not be present. heck the /eld back again. ! If yo you hav havenNt nNt cho chos sen th the State /eld to be in your Luery, click on the next empty /eldNs drop!down arrow and choose it. ow youNre going to select, select, or /lter out, records. records. lick in the riteria riteria row for the State /eld and key in O3A. obviously, you will have to have some employees in 3A, and you should have some in other states tooB Tab out of the /eld. ow run the Luery. ! Try the the sam same e sel select ection ion with with Se! being M and then ). 2ou should have some records of each sex so that this /lter works, displaying only the male records and then, the female recordsB ! 2ou can can do the the same same thing thing with with the ompa ompany ny ar 2es P o /eld, using it to /lter only those Salespersons who drive a company car. car.
Don’t Don’t forget to Turn Turn in your lab activity to our Google Classroom Classroom to avoid submission. Activity No. 2 Overview This another lab activity will introduce you to database concepts using Microsoft Access. Run MS Access •
Under Start -- Progras! choose MS Access.
"reate a U#$%&RS$T' (atabase •
"hoose )"reate a new database using *lan+ Access database) - clic+ O,
•
Save it on the des+top with the nae )U#$%&RS$T'.db)
"reate (&PARTMT table •
(ouble-clic+ on )"reate table in (esign view)
•
ill in the following fields and types to create the table $&/( #AM& (&PT $(
(ATA T'P& T&0T
late
(&PT #AM& *U$/($#1 P2O#& •
T&0T T&0T T&0T
"hoose the (&PT $( as priary +ey right clic+ on the row and choose )Priary +ey)
o
•
Save the table 3clic+ on the save icon4
•
nae it )(&PARTMT)
&nter data into (&PARTMT table •
ro the 5indow enu! choose )University(atabase) to view choices
•
(ouble-clic+ on )(&PARTMT)
•
ill in the following data! using tab to ove fro one cell to the ne6t
(&PT $(
(&PT #AM&
*U$/($#1
P2O#&
"S"
"OMPUT&R S"$"&
T'/&R
789-:8;<
MT2
MAT2
T'/&R
789-:7;=
P2'
P2'S$"S
PASTOR&
789-::>:
/$S2
$#(&P("&
789->:;:
*$O
*$O/O1'
*$O/O1$"A/ S"$"&
789-9>>;
•
Save the table by clic+ing on the save icon
"reate aculty table •
1o bac+ to University (atabase window
•
"hoose )"reate table in (esign view)
•
"reate table with the following fields
$&/( #AM& A" $( /AST #AM& $RST #AM& (&PT *(AT& RA#, 2$R& (AT&
(ATA T'P& T&0T 3PR$MAR' ,&'4 T&0T T&0T T&0T (AT& T&0T (AT&
•
Save the table as )A"U/T')
"reate aculty-(epartent relationship •
On the Tools enu! choose Relationships...
•
2ighlight dept and clic+ )Add)
•
2ighlight faculty and clic+ )Add)
•
$cons for each table appear on the screen
•
"lic+ and drag fro )(&PT $() in dept table to )(&PT) in faculty table.
•
$n the dialog bo6! clic+ on "reate
•
Save the relationship by clic+ing on the save icon
Add data data to faculty faculty table •
$nsert the following data into the faculty table -- notice that each faculty entry has a dept that corresponds to an e6isting dept entry
A" $(
/AST #AM&
$RST #AM&
(&PT
*(AT&
RA#,
2$R& (AT&
;;>;>
SM$T2
?O&
"S"
;=@:>@<=B
ASST
;<@:>@<==7
;;>::
?O#&S
A/$"&
MT2
;>@<<@<=8:
ASST
<:@:>@:;;<
;;::>
R$(A'
?#$&R
<:@<:@<=8;
ASSO"
;7@;:@<==9
;;>>:
/A#&
/A#"&
"S"
;@;:@<=B=
U//
;<@;<@<==B
;;9>>
?U#$P&R
/U"'
MT2
;>@:<@<=B
ASSO"
;>@;>@<==7
As+ soe Cuestions Cuestions 3Cueries4 •
On the University(atabase window! clic+ on the Dueries option 3left side colun4
•
(ouble-clic+ on )"reate Cuery in (esign view) <. Show all all depart departent ents s in descen descending ding order order by by nae
clic+ on the first ield bo6 and choose dept.nae
clic+ on the first Sort bo6 and choose Ascending
clic+ on the second ield bo6 and choose dept id
On the Duery enu! choose Run
:. Show the the naes naes and ran+s ran+s of all faculty faculty ebers ebers in the "S" "S" departen departentt
"reate a Cuery in (esign view as above Add both both A"U/T A"U/T' ' and and (&PT to the Cuery Cuery by double-clic+ing double-clic+ing on the naes $cons for both tables will appear in the top part of the Cuery $n the first three ield bo6es! choose A"U/T'./AST #AM&! A"U/T'.$RST #AM&! and A"U/T'.RA#,. *e sure to chec+ the )Show) bo6 to indicate that you want these fields to show in the result. $n the fourth ield bo6! choose (&PT.(&PT $(. $n the "riteria bo6! type E )"S"). This will only choose those rows where the (&PT $( E )"S"). #ote that the two tables are autoatically lin+ed by (&PT $( because of the relationship that was set up above. (ouble-clic+ on the lin+ between the tables to see the properties of the ?oin. 'ou will see that the default is to )Only include rows where the Foined fields fro both tables are eCual). This eans that the Cuery will only show results where the (&PT $( is the sae in both tables.
Use the steps above to create a new table for students •
2ere is the structure of the student table $&/( #AM& /AST #AM& $RST #AM& STU( $( MA?OR *$RT2 (AT& 1RA( (AT& A(%$SOR
(ATA T'P& T&0T T&0T T&0T T&0T (AT& (AT& T&0T
•
*e sure to create a priary +ey
•
"reate a relationship fro the studentGs departent 3MA?OR4 to the departent table
•
"reate a relationship fro the studentGs advisor 3A" $(4 to the faculty table
•
$nsert data representing at least <; students
"reate the following Cueries
•
/ist all students! sorted by graduation date.
•
/ist all students advised by (r. Sith.
•
or every student in the "S" aFor! list his@her advisor.
"hallenge Proble •
Add another another table representing representing classes. classes. The fields fields should should include at least the the class code! the nae of the class! the nuber of students ta+ing the class! the seester the class is offered! the departent offering the class and the faculty teaching the class.
•
/in+ the classes to departent 3providing the class4 and faculty 3teaching the class4.
•
ill in interesting data 3at least <; classes4.
•
"reate the following Cueries <. /ist the naes of all classes classes offered offered by the "oputer Science departent. departent. :. /ist the faculty ebers teaching classes with ore ore than than B; students. students. >. /ist the class class with with the the ost ost stud students ents.. 9. /ist the the depart departent ents s teaching teaching classes classes in all all :;;B. :;;B.
Don’t Don’t forget to Turn Turn in your lab activity to our Google Classroom Classroom to avoid submission.
late