Question

SQL From employees table, display the first_name, last_name, phone_number and Phone number Type. ...

SQL

From employees table, display the first_name, last_name, phone_number and Phone number Type. Phone number type should be "USA Phone Number" (Length=12) or "International Phone Number" (Length=18) or "Unknown" based on the length of the phone number. Sort the display in desc order of phone number type

Use Either CASE or DECODE.

Output Column Heading: First Name, Last Name, Phone Number, Phone Number Type

0 0
Add a comment Improve this question Transcribed image text
Answer #1

NOTE: BELOW QUERIES ARE IN MS SQL SERVER

If "phone_number" column in SQL is a TEXT column then consider below query:

select first name as [First Name], last name as [Last Name], phone_number as [Phone Number], case when LEN (phone number) = 1

If "phone_number" column in SQL is a NUMERIC column then consider below query:

select first name as [First Name] , last_name as [Last Name], phone_number as [Phone Numberl, case when LEN (CONVERT (varcharOUTPUT

E ResultsMessages First Name ast Name Phone Number 1 Franklin Jones Phone Number Type USA Phone Number USA Phone Number Unkno

Add a comment
Know the answer?
Add Answer to:
SQL From employees table, display the first_name, last_name, phone_number and Phone number Type. ...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • SQL From employees table, display the first_name, last_name, phone_number and Phone number Type. Phone number type...

    SQL From employees table, display the first_name, last_name, phone_number and Phone number Type. Phone number type should be "USA Phone Number" (Length=12) or "International Phone Number" (Length=18) or "Unknown" based on the length of the phone number. Sort the display in desc order of phone number type Use Either CASE or DECODE. Output Column Heading: First Name, Last Name, Phone Number, Phone Number Type

  • ​​​​​​​ SQL Display the employee names in this format: Lastname(in upper case)<comma>First_name(in initcaps) from employees using...

    ​​​​​​​ SQL Display the employee names in this format: Lastname(in upper case)<comma>First_name(in initcaps) from employees using NESTED FUNCTIONSName the column as ‘Formatted Name’                         Eg: STEVEN,Fox

  • Use the HR database for all the questions in this lab. For each item in this lab, paste the SQL y...

    Use the HR database for all the questions in this lab. For each item in this lab, paste the SQL you used to complete the task and the number of rows retrieved. Ensure you follow the coding standards listed in the ETSU SQL standards guide found on D2L. Save this document as a PDF and name it your_name_lab7.pdf Display the employees’ first name, last name and phone number of employees with salaries greater than 10,000 dollars. SELECT first_name, last_name, phone_number,...

  • rider_student Column Data Type Description student_id integer the primary key first_name varchar(25) student first name last_name...

    rider_student Column Data Type Description student_id integer the primary key first_name varchar(25) student first name last_name varchar(25) student last name major_id integer the ID of the student's major; a foreign key for the major_id in the rider_major table rider_major Column Data Type Description major_id integer the primary key major_name varchar(50) student first name major_description varchar(100) student last name Use the Tables above to answer the questions. Questions: 1. Write a SQL statement to add a student record to the rider_student...

  • Write a query in SQL to list the following information of the artists in movie industry....

    Write a query in SQL to list the following information of the artists in movie industry. Limit this information to only 5 artists. Sort the information by age descending order.          Full name : first name and last name separated by space          Age: Current age          Address: State that he resides          Contact number: Phone number This is from an artist table, where first_name, last_name, contact_no, address, birth_date are the fields in the table. Birth date in the table...

  • SQL query: Write a SQL statement using the employees table and retrieve employees whose monthly salary...

    SQL query: Write a SQL statement using the employees table and retrieve employees whose monthly salary (including their commission) is greater or equal to 5,000 but less than or equal to 17,000 (we are assuming the salary on the table is monthly). In other words, if their monthly salary was 1000 and their commission was .2, their total monthly salary would be 1200 and given the criteria above this instance would not be selected. Please display the full name of...

  • Hi this is for SQL Use the AP database Vendor name from the vendor table Vendor...

    Hi this is for SQL Use the AP database Vendor name from the vendor table Vendor Contact First Name and Vendor Contact Last Name from the vendor table but I need them concatenated together with a space between the names Invoice Date from the invoice table Only the day of from the Invoice Date Invoice Number from the invoice table The third and fourth characters from the Invoice Number Line Item Amount from the invoice line items table Calculate the...

  • pls help me with these SQL questions Here are tables TEAM table Task 10 (4 marks)...

    pls help me with these SQL questions Here are tables TEAM table Task 10 (4 marks) Write an SQL statement to display fan categories, the number of tickets in each category the fan bought (change the alias to "NUMBER OF TICKETS PURCHASED") along with the sum of prices (change the alias to TOTAL PRICES') in each category the fans paid. Sort the result by total price in an ascending order. Task 11 (5 marks) Write an SQL statement to display...

  • Using VIEW functions to CREAT VIEW reservation_id last_name first_name room_number check_in_date check_out_date 6 Gamgee Sam 102...

    Using VIEW functions to CREAT VIEW reservation_id last_name first_name room_number check_in_date check_out_date 6 Gamgee Sam 102 2018-04-06 2018-04-08 7 Katniss Everdeen 201 2018-04-10 2018-04-12 3 Granger Hermoine 201 2018-05-01 2018-05-08 4 Weasley Ron 201 2018-05-01 2018-05-08 1 Potter Harry 301 2018-05-01 2018-05-08 2 Potter Harry 201 2018-09-10 2018-09-13 1. Create a view that lists the guests who have reservations that begin on a Monday, Tuesday, Wednesday, or Thursday. Include the following columns: • a concatenated version of the guest’s name...

  • Problem 33, chapter 7 from Database Systems 13th edition by Coronel Write a query to display...

    Problem 33, chapter 7 from Database Systems 13th edition by Coronel Write a query to display the employee number, last name, email address, title, and department name of each employee whose job title ends in the word “ASSOCIATE.” Sort the output by department name and employee title Problem 36, chapter 7 from Database Systems 13th edition by Coronel Write a query to display the number of products within each base and type combination, sorted by base and then by type...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT