employer cover photo
employer logo
employer logo

NextGen Healthcare

Is this your company?

NextGen Healthcare Interview Question

Question related Department to employees ( SQL table design) and queries. Employee Table Columns are id , name , mgr_id ( name is firstname space lastName) Department table looks like name ,head ( where head is mgr_id ) Questions are 1) Write an SQL query to list the full name of every employee, alphabetized by first name. 2)Write an SQL query to list the full name of every employee, alphabetized by last name. 3)Write an SQL query to list the full name of every employee along with the full name of his/her manager. 4)Write an SQL query to list the full name of every employee in the Sales department. 5)Write an SQL query to list the full name of every employee along with name of his/her department. 6)Is there a better design for a database that supports the queries described in questions above? If so, describe it. If not, why not?

Interview Answers

Anonymous

May 8, 2015

In MySQL, SELECT name FROM employee ORDER BY SUBSTRING_INDEX(name, " ", 1);

1

Anonymous

Jan 27, 2012

Trick one is question 2 answer look like this ( SQL Server) SELECT employee.name FROM employee order by SUBSTRING(Name, CHARINDEX(' ', Name) + 1, LEN(Name))