Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. Create a SQL query that shows the first_name, last_name, hire_date, and the number of days that the employee has worked from the EMPLOYEES table.

1. Create a SQL query that shows the first_name, last_name, hire_date, and the number of days that the employee has worked from the EMPLOYEES table. Note: this is the EMPLOYEES table that came with the HR Data data set. Use the concatenation operator to put the first_name and the last_name together in the same column in the result set with a space between the two names. Use date arithmetic (pg. 219) to show only employees that have worked longer than 6 years (365 * 6).

Here is a good resource on the concatenation operator:

https://www.geeksforgeeks.org/sql-concatenation-operator/

2. You have been asked to create a report showing the intra-office contact information. Create a SQL query using the EMPLOYEES table that shows the employee_id, first name, last name, email address as email@itresources.com and the last 4 digits of the phone number, usually referred to as the phone line number. Only show employees that dont have a job ID like AD_ anything.

3. Use the CONCAT() function, as opposed to the concatenation operator used above to put the email besides @itresources.com

Modify the previous SQL query and add the phone_number to your result set as we are used to seeing it: (xxx)xxx-xxx. The easiest way to do this is to use a combination of the concatenation operator || with the substr() function to get the digits from the phone_number based on their position and length. Use a column alias to show the new format phone number AS Usual phone number

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2014 Nancy France September 15 19 2014 Proceedings Part 2 Lnai 8725

Authors: Toon Calders ,Floriana Esposito ,Eyke Hullermeier ,Rosa Meo

2014th Edition

3662448505, 978-3662448502

Students also viewed these Databases questions