Docsity

Lab 4: SQL Query Practice - Web Technologies - Assignment 4 | CSCI 4410, Study notes of Computer Science

Toggle sidebar
bg1
4410/5410 Web Technologies Assignment 4, Spring 2012
Due April 13 (Friday Sunday night)
Purpose: SQL exercise
For this assignment, you will create a database called RealEstate that contains the 3 tables shown below. The
table Agencies contains data about Real Estate Agencies in Missouri. The table Agents contains data about Real
Estate Agents working for the various agencies. Finally the table Listings contains data about the various real
estate listings in the area. (I have created the Listings table and put it in a zipped file in D2L. You can use that
to save time and learn how to create a table.)
Agencies
AgencyNo
AgencyName
Street
City
State
Zip
AgencyPhone
1
Three Lakes Realtors
123 First Street
Kimberling City
MO
77889
555-666-7700
2
Camden and Camden Realtors
7878 Washington Avenue
Branson
MO
77770
555-555-8800
3
Sun and Ski Realtors
9900 West Sunset Blvd.
West Branson
MO
77990
555-999-9999
4
A1 Realtors
7744 Pokeberry Lane
Lampe
MO
77110
555-888-4444
AgentNo
AgentFirst
AgentLast
AgentPhone
AgencyNo
1
Gordon
Hughes
555-222-8877
1
2
Phil
Kirkpatrick
555-111-9900
1
3
Jessica
Polar
555-333-3344
3
4
Malika
Thompson
555-444-7788
3
5
Jane Ann
Welch
555-223-0044
2
6
Shari
Duncan
555-228-5577
2
7
Trixie
Angelina
555-220-4466
2
8
Mary
Dell
555-888-7777
1
9
Deb
Trumpet
555-333-0123
1
10
Cy
Clone
555-888-9999
4
11
Rob
Zacharias
555-888-1111
4
Listings
ListingNo
Type
Area
SqFt
LakeFt
BR
Bath
Garage
Pool
Asking
AgentNo
1
Ranch
Ozark Mountain
3400
150
4
4
2
No
90000
1
2
New
50 MM
3000
65
2
3
0
No
129000
1
3
New
73 MM
2900
180
3
2.5
2
No
135000
2
4
Cabin
Horseshoe Bend
1200
102
4
3
2
No
150000
3
5
Ranch
9 MM
2500
100
3
2.5
0
No
199000
3
7
Two Story
Ozark Mountain
3000
110
4
4
2
No
276000
4
8
Two Story
Shell City
1800
112
3
3
2
No
138000
4
9
Ranch
Horseshoe Bend
2000
120
3
3.5
0
No
105000
10
10
Ranch
80 MM
2000
80
3
3
2
No
250000
10
11
Ranch
80 MM
1215
80
3
2
0
No
85000
2
12
Ranch
Greenview
2200
200
3
3
2
No
395613
3
13
Two Story
Blue Eye
3000
100
4
3
2
No
199950
4
14
Two Story
Greenview
5500
250
4
2.5
3
Yes
194500
5
15
Two Story
Branson West
2500
100
3
2
2
No
189900
5
16
Ranch
Branson
2700
85
4
3
2
No
189900
6
pf2

Partial preview of the text

Download Lab 4: SQL Query Practice - Web Technologies - Assignment 4 | CSCI 4410 and more Study notes Computer Science in PDF only on Docsity!

4410/5410 Web Technologies Assignment 4, Spring 2012

Due April 13 (Friday  Sunday night)

Purpose : SQL exercise

For this assignment, you will create a database called RealEstate that contains the 3 tables shown below. The

table Agencies contains data about Real Estate Agencies in Missouri. The table Agents contains data about Real

Estate Agents working for the various agencies. Finally the table Listings contains data about the various real

estate listings in the area. (I have created the Listings table and put it in a zipped file in D2L. You can use that

to save time and learn how to create a table.)

Agencies AgencyNo AgencyName Street City State Zip AgencyPhone

1 Three Lakes Realtors 123 First Street Kimberling City MO 77889 555 - 666 - 7700 2 Camden and Camden Realtors 7878 Washington Avenue Branson MO 77770 555 - 555 - 8800 3 Sun and Ski Realtors 9900 West Sunset Blvd. West Branson MO 77990 555 - 999 - 9999 4 A1 Realtors 7744 Pokeberry Lane Lampe MO 77110 555 - 888 - 4444

Agents AgentNo AgentFirst AgentLast AgentPhone AgencyNo 1 Gordon Hughes 555 - 222 - 8877 1 2 Phil Kirkpatrick 555 - 111 - 9900 1 3 Jessica Polar 555 - 333 - 3344 3 4 Malika Thompson 555 - 444 - 7788 3 5 Jane Ann Welch 555 - 223 - 0044 2 6 Shari Duncan 555 - 228 - 5577 2 7 Trixie Angelina 555 - 220 - 4466 2 8 Mary Dell 555 - 888 - 7777 1 9 Deb Trumpet 555 - 333 - 0123 1 10 Cy Clone 555 - 888 - 9999 4 11 Rob Zacharias 555 - 888 - 1111 4

Listings ListingNo Type Area SqFt LakeFt BR Bath Garage Pool Asking AgentNo 1 Ranch Ozark Mountain 3400 150 4 4 2 No 90000 1 2 New 50 MM 3000 65 2 3 0 No 129000 1 3 New 73 MM 2900 180 3 2.5 2 No 135000 2 4 Cabin Horseshoe Bend 1200 102 4 3 2 No 150000 3 5 Ranch 9 MM 2500 100 3 2.5 0 No 199000 3 7 Two Story Ozark Mountain 3000 110 4 4 2 No 276000 4 8 Two Story Shell City 1800 112 3 3 2 No 138000 4 9 Ranch Horseshoe Bend 2000 120 3 3.5 0 No 105000 10 10 Ranch 80 MM 2000 80 3 3 2 No 250000 10 11 Ranch 80 MM 1215 80 3 2 0 No 85000 2 12 Ranch Greenview 2200 200 3 3 2 No 395613 3 13 Two Story Blue Eye 3000 100 4 3 2 No 199950 4 14 Two Story Greenview 5500 250 4 2.5 3 Yes 194500 5 15 Two Story Branson West 2500 100 3 2 2 No 189900 5 16 Ranch Branson 2700 85 4 3 2 No 189900 6

1. Write a SQL command to display all of the fields of the Agencies table.

2. Write a SQL command to display only the type of house, number of bedrooms, and number of baths

from the Listings table.

3. Write a SQL command to display the type of house, square footage, and asking price in ascending order

by asking price.

4. Write a SQL command to display all fields of all agents in the Agents table who work for Three Lakes

Realtors.

5. Write a SQL command to display the type of house, area, asking price where the type of house is a

ranch.

6. Write a SQL command to display the type of house and asking price for houses having more than 150

feet of lake front footage. This listing should be in descending order by lake front footage.

7. Write a SQL command to display the agents first and last name and the agencys name in which the

agent works. This should be in ascending order by agency name.

8. Write a SQL command to display all information (including realtor and agency for which the realtor

works) for all two story houses.

9. Write a SQL command to update the information for the ranch listed in Branson. The new asking price

is 170000.

10. Write a SQL command to insert a new listing into the listing table. The house is a Log Cabin in the

Branson area with 1800 square feet, no lake footage, 2 bedroom, 2 baths, no garage, no pool, with an

asking price of 190000.

11. Write a SQL command to delete Trixie Angelina from the Agents table.

For this assignment, you should create the database and test all your answers and type all the answers in a file. You should export the final database as a SQL file and turn it into D2L. To turn in this assignment, create a zipped folder that contains a text file that contains the answers to the above questions and exported SQL file.. Submit this zipped folder on D2L (elearn.mtsu.edu) in the dropbox for assignment 4.