Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Create user-defined functions that replicate the following: 1. CONCAT(HotelHNumber,' ' , HotelStreet,' ' , HotelCity,' ' , HotelState, ' ' , HotelZip) 2. CONCAT(CustomerHNumber,' '
Create user-defined functions that replicate the following:
1. CONCAT(HotelHNumber,' ' , HotelStreet,' ' , HotelCity,' ' , HotelState, ' ' , HotelZip)
2. CONCAT(CustomerHNumber,' ' , CustomerStreet,' ' , CustomerCity,' ' , CustomerState, ' ' , CustomerZip)
The goal is to make a function that automatically takes those inputs and turns them into a full address.
Two tables for reference:
CREATE TABLE Customer ( CustomerID INT FirstName VARCHAR(30) LastName VARCHAR(30) CustomerPhone VARCHAR(12) Customer Email VARCHAR (35) CustomerHNumber INT CustomerStreet VARCHAR (30) CustomerCity VARCHAR (30) CustomerState CHAR(2) CustomerZip INT ); NOT NULL NOT NULL, NOT NULL, NOT NULL NOT NULL, NOT NULL, NOT NULL, NOT NULL, NOT NULL, NOT NULL IDENTITY PRIMARY KEY, UNIQUE CHECK (CustomerPhone LIKE '[0-9][0-9][0-9]-[0-9][0-9][0-9]-[0-9][0-9][0-9][0-9]'), --phone number format CHECK (CustomerState LIKE '[A-Z][A-Z]'), --only allows state abbreviation CHECK (CustomerZip LIKE '[0-9][0-9][0-9][0-9][0-9]') --zip code is always 5 digits
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