Question: Write SQL code. List information about vendors in the Vendor table. The vendors are located in either California or Nevada. Concatenate the Address1, City, and
Write SQL code. List information about vendors in the Vendor table. The vendors are located in either California or Nevada. Concatenate the Address1, City, and State columns into a single column and call it VendorAddress. Format the phone number using standard U.S. formatting. Format the FirstBuyDate as shown in the result table. Sort the result table by FirstBuyDate. Someone answered and give The following Code but does not work. The result table will have 5 Rows; VendorID, VendorName, Vendor Address, Vendor phone, and FirstBuyDateFormat
SELECT VendorID, VendorName, CONCAT(Address1, ', ', City, ', ', State) AS VendorAddress, FORMAT(PhoneNumber, '(###) ###-####') AS FormattedPhoneNumber, DATE_FORMAT(FirstBuyDate, '%b %d, %Y') AS FormattedFirstBuyDate FROM Vendor WHERE State IN ('CA', 'NV') ORDER BY FirstBuyDate;
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
