Amazon Interview Question for Software Engineers


Country: United States
Interview Type: Written Test




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

create table cgpa (name varchar(30), gpa smallint(3));
Insert some values
mysql> select * from cgpa;
+------+------+
| name | gpa  |
+------+------+
| A    |    3 |
| B    |    3 |
| C    |    3 |
| D    |    3 |
| E    |    4 |
| F    |    4 |
| G    |    4 |
| H    |    4 |
| I    |    2 |
| J    |    2 |
| K    |    2 |
| l    |    2 |
| M    |    3 |
| N    |    3 |
+------+------+
mysql> select gpa, count(*) from cgpa where gpa = 3 or gpa = 4 group by gpa;
+------+----------+
| gpa  | count(*) |
+------+----------+
|    3 |        6 |
|    4 |        4 |
+------+----------+

- utk4rsh October 20, 2016 | Flag Reply
Comment hidden because of low score. Click to expand.
1
of 1 vote

SELECT gpa, count(gpa)
FROM student
WHERE gpa = 3 OR gpa = 4
GROUP BY gpa

- libertythecoder November 03, 2016 | Flag Reply
Comment hidden because of low score. Click to expand.
1
of 1 vote

Select Grade,
       Count(0)
  From (Select Student_ID,
               Sum(Grade)/Count(0) Grade
          From Student         a,
               Student_Classes b
         Where b.Student_ID = a.Student_ID
         Group By b.Student_ID)
 Where Grade In (3,4)
 Group By Grade

- edanir December 08, 2016 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

select gpa , count(gpa) over (partition by gpa order by gpa)
from student
where gpa = 3 or gpa = 4

- namrataghadi November 02, 2016 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

SELECT gpa, count(1)
FROM student
WHERE gpa in (3, 4)
GROUP BY gpa;

- Ranjha November 15, 2016 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

select sum( case when grade =3 then 1 else 0 end) as gpa3,
sum(case when grade =4 then 1 else 0 end) as gpa4
from student

- Anonymous February 28, 2018 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

SELECT roll_number, mobile_number FROM students WHERE cgpa BETWEEN 7 AND 9 AND year = 'Ill' or year = 'IV'

- Anonymous July 02, 2020 | 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