Question

SQL query: Write an SQL query that will output the last name, employee id, hire date and department from the employee table. Pick only those employees whose department ID is specified in the employee...

SQL query: Write an SQL query that will output the last name, employee id, hire date and department from the employee table. Pick only those employees whose department ID is specified in the employee table. If the employee id is 777, name is ABC and hire date is 01-JAN-2016, the output should look as follows - 'Stephen (Employee ID - 777) was hired on the 1st of January, 2016 – Department: 90'. Note - The date should not have preceding zeros

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

Select last_name+' (Employee ID - '+' '+employeeid+' was hired on the '+CAST(DAY(hire_date) AS VARCHAR(2)) + ' ' + DATENAME(MM, hire_date) + ' ' + CAST(YEAR(hire_date) AS VARCHAR(4))+' – Department: '+Department_Id from employees where department_id is not null;

Requirement is purely based on concatenating. Please change column names if applicable. Please comment if any error

Add a comment
Know the answer?
Add Answer to:
SQL query: Write an SQL query that will output the last name, employee id, hire date and department from the employee table. Pick only those employees whose department ID is specified in the employee...
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
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