Citigroup Interview Question for Analysts


Country: United States




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

1) Group by with having.
select name, count(*) from customer group by name having count(*) > 1;

2) Self join.
select c1.name from customer c1, customer c2 where c1.name = c2.name and c1.id > c2.id;

- m@}{ March 27, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
2
of 2 vote

select * from table_name minus select distinct * from table_name

- Sumit April 25, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

SQL- wise its correct, but minus is always a costly query; avoid using it!

- Ashish June 19, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

Use the HAVING clause from sql along with the aggregate function to find the duplicates.

- nandlogics March 26, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

select id from emp group by id having count(id) >1;

- soniakancha September 18, 2013 | Flag Reply


Add a Comment
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.

Learn More

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.

Learn More

Resume Review

Most engineers make critical mistakes on their resumes -- we can fix your resume with our custom resume review service. And, we use fellow engineers as our resume reviewers, so you can be sure that we "get" what you're saying.

Learn More

Mock Interviews

Our Mock Interviews will be conducted "in character" just like a real interview, and can focus on whatever topics you want. All our interviewers have worked for Microsoft, Google or Amazon, you know you'll get a true-to-life experience.

Learn More