FactSet Research Systems, Inc Interview Question for Software Engineer / Developers

• 0

Country: United States

Comment hidden because of low score. Click to expand.
0
of 0 vote

I can only come up with a solution in PL/SQL to do it. Were you able to do it in SQL?

Comment hidden because of low score. Click to expand.
0
of 0 vote

Run the query, and do the computations on the results you get.

Comment hidden because of low score. Click to expand.
0

How do you do the computations without using sql aggregate function and only using sql queries?

Comment hidden because of low score. Click to expand.
0

Huh?

If you want to find the average salary of employees under a specific manager, get the list of salaries (using the simple sql query), and find the average yourself by going through the returned results and computing the average yourself.

Might not be efficient, but that is what we get for putting idiotic constraints.

Comment hidden because of low score. Click to expand.
0
of 0 vote

There is a way to do this with only basic SQL queries.

In fact, I believe that's how these aggregate functions are implemented behind the scenes. But I can't recall how. Some Googling will turn up an answer I'm sure.

Comment hidden because of low score. Click to expand.
0
of 0 vote

use cursor to get the sum and avg
use row_number cooperating with count to find the median

Comment hidden because of low score. Click to expand.
0
of 0 vote

``````I have implemented the sum function using recursive with clause in Oracle SQL, similarly it can be modified for average (sum/count)

WITH s (iteration, num_sum)
AS (SELECT row_id iteration, xn.num
FROM (    SELECT NUM,
ROW_NUMBER () OVER (ORDER BY num) row_id
FROM xxtest_num) xn
WHERE xn.row_id = 1 -- first row in the table
UNION ALL
SELECT s1.iteration + 1, s1.num_sum + xn1.num
FROM s s1,
(     SELECT NUM,
ROW_NUMBER () OVER (ORDER BY num) row_id
FROM xxtest_num) xn1
WHERE s1.iteration <= 10 -- stopping condition count of rows
AND s1.iteration + 1 = xn1.row_id)
SELECT num_sum
FROM (  SELECT *
FROM s s1
ORDER BY num_sum DESC)
WHERE ROWNUM = 1;``````

Name:

Writing Code? Surround your code with {{{ and }}} to preserve whitespace.

Books

is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.

Videos

CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.