Amazon Interview Question for Software Developers


Country: United States




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

Create another table Table2 with same structure as Table1. Then copy distinct rows from Table 1 into Table 2 -
INSERT INTO Table2 SELECT DISTINCT * FROM Table1;

- Lily-S July 18, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
2
of 2 vote

SELECT SUM(LEN(STRING)-LEN(REPLACE(STRING,'A',''))) FROM TABLE

- Kapil Gurjar October 10, 2016 | Flag Reply
Comment hidden because of low score. Click to expand.
1
of 1 vote

With Dele as
(
select
Row_Number() over (Partition by FirstName, LastName, Occupation, Age, ZipCode order by id) as RN,
*
From [a].[Person])

Delete from Dele
where RN>1

- tdk June 20, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

DELETE FROM table_name A WHERE ROWID > (
  SELECT min(rowid) FROM table_name B
      WHERE A.key_values = B.key_values);

- santosh June 12, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

Your solution would be OK if there is a rowId column but what if there were no id column(s). Then there needs to be some kind of LIMIT magic to get the same result, I think..

- 1uttMentek June 16, 2015 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

select distinct <columnname> from tablename;

- Anonymous June 15, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

DELETE
FROM EMPLOYEE
WHERE ROWID NOT IN
(SELECT MAX(ROWID) FROM EMPLOYEE GROUP BY EMP_ID
);

- Abhinaw July 05, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

select sum(regexp_count(first_name,'i')) 
from
(
select first_name,count(1) from emp
group by first_name 
having count(1) =1
);

- Alok December 07, 2017 | 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