Interview Question


Country: United States




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

SELECT
Team1.TEAM_NAME AS Team1,
Team2.TEAM_NAME AS Team2
FROM TEAM Team1
INNER JOIN TEAM Team2 ON Team1.TEAM_ID > Team2.TEAM_ID

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

correct answer !

- siva.sai.2020 April 19, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

I already tried the query, the result is
Germany France
Spain France
Spain Germany
that do not make sense, any suggestion?

- J.T. May 21, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

SELECT Team_1.Team AS C1,
Team.Team AS C2
FROM Team INNER JOIN
Team AS Team_1 ON Team.Team > Team_1.Team

- Satwant Singh July 12, 2013 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

This comment has been deleted.

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

why you are used "SELECT Top 3", why top3 ?

- siva.sai.2020 April 19, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

SELECT
Team1.TEAM_NAME AS Team1,
Team2.TEAM_NAME AS Team2
FROM TEAM Team1, TEAM Team2
WHERE Team1.TEAM_ID > Team2.TEAM_ID

- Shiva Kumar May 16, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

The query
SELECT
Team1.TEAM_NAME AS Team1,
Team2.TEAM_NAME AS Team2
FROM TEAM Team1, TEAM Team2
WHERE Team1.TEAM_ID > Team2.TEAM_ID
is absolutely correct, the reverse condition (Team1.TEAM_ID < Team2.TEAM_ID) would also result in the right permutation & combination

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

--Create Teams Table
CREATE table teams
(
id int,
name varchar(20)
)

insert into teams
(
id,
name
)
VALUES
(
1, -- id - int
'France' -- name - varchar
)

-- Insert sample data

insert into teams
(
id,
name
)
VALUES
(
2, -- id - int
'Germany' -- name - varchar
)

insert into teams
(
id,
name
)
VALUES
(
3, -- id - int
'Spain' -- name - varchar
)

--Generate fixtures between team

SELECT * from teams t CROSS join teams t2
WHERE t.id > t2.id

SELECT * from teams t CROSS join teams t2
WHERE t.id > t2.id

- Vishwanath Dalvi March 27, 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