Answered step by step
Verified Expert Solution
Question
1 Approved Answer
StayWell focuses on finding and managing accommodation for owners of student accommodation in the Seattle area. Currently, it operates in two main areas of the
StayWell focuses on finding and managing accommodation for owners of student accommodation in the Seattle area. Currently, it operates in two main areas of the city with separate administrative offices: Colombia City and Georgetown. StayWell rents out to bedroom properties to students on behalf of property owner You are assigned, as the database administrator, to collect and manage transactional data of the StayWell operations. You will begin by creating the database and tables for StayWell and will transfer the collected data. Then, you will need to execute further database operations as StayWells operations expand.
The OFFICE table contains information about the two StayWell office locations, including the office number, office name, and address.
OFFICE table
OFFICE table
The SERVICECATEGORY table contains information regarding the different service categories, such as their numerical designation and description.
SERVICECATEGORY table
SERVICECATEGORY table
The SERVICEREQUEST table contains information on service requests for each property. The SERVICEREQUEST table stores the service ID property ID service category number, the managing office ID request description, the request's status, estimated hours, hours spent, and the service date.
SERVICEREQUEST
SERVICEREQUEST table
The RESIDENTS table contains the information on each resident, such as their resident ID first name, surname last name and property ID
RESIDENTS table
RESIDENTS table
The OWNER table contains information on each property owner, such as their owner number ID last name, first name, and address.
OWNER table
OWNER table
The PROPERTY table contains information on each property, including the property ID managing office number, address, square feet, bedrooms, floors, monthly rent, and the owner.
PROPERTY table
PROPERTY table
Project Objectives
Create, use, and drop views
Update the data over views instead of tables
Create and test constraints such as foreign keys
Use mathematical functions over numerical data
Calculate dates with SQL functions
Create triggers before inserting data into tables
Best practices to follow:
Write detailed comments for SQL statements.
Organize and structure SQL statements for readability.
Your tasks are as follows:
Task : The property management team of StayWell is considering separating the database operations of its Colombia City and Georgetown offices. Therefore, you need to create a COLOMBIACITYPROPERTY VIEW to filter the properties where OFFICENUM equals to Be sure to show all the PROPERTY table information on each property except for the managing office number OFFICENUM
Task : Colombia office employees started using COLOMBIACITYPROPERTY and they want to update the MONTHLYRENT to for properities where their PROPERTYID equals to You need to update the rent information over the VIEW.
Task : The property management team wants to continue property database operations by using the common PROPERTY table. Therefore, they no longer require the COLOMBIACITYPROPERTY VIEW, and they want you to remove it from the database.
Task : The property management team wants to ensure that the property and owner information always correspond. In other words, they do not want any property in the database where the OWNERNUM information does not match with anyone in the OWNER table. You need to alter the PROPERTY table by changing the OWNERNUM field to refer to the OWNER table.
Task : The marketing team wants to print out branded name tags for the properties with the StayWell logo and resident names. They require the first and last names of the residents combined and converted to uppercase for printing. You need to send them a singlecolumn table with the column name of LABEL.
Task : The property management team wants to learn and track the average size of the properties in StayWell. You need to return the average square feet of each property, calculated and rounded to an integer value, displayed as AVGSQUAREFEET.
Task : The maintenance team wants to send SMS reminders in relation to upcoming service operations. Therefore, they request the SERVICEID day prior to the planned service dates of the service requests as the REMINDER column. However, they only require this information for those service requests where the NEXTSERVICEDATE is set.
Task : The development team of StayWell wants to ensure that all the STATE fields of the owners are uppercase in the database. Create the stateinsert trigger prior to incorporation in the OWNER table to ensure that this requirement is satisfied. From the textbook, A Guide to SQL th edition
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started