Citigroup Interview Question


Country: India




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

Yes the query executes, it evaluates to Cartesian product of the two tables.

For example if the following query is executed,
Select * from employee, department where employee. id= department. id;
- first it evaluates the Cartesian product.
- selects records of required criteria.

- navya April 06, 2014 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Yes it will.

Output:

If there are 3 rows in Employee table and 4 rows in Department then it will return total 12 rows.

Why:
Since there is no condition specified, it will return for each employee record it will join one department record.

- Srigopal Chitrapu April 06, 2014 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

yes this query will work.
beause it is cartesian product of two table employee ,department.

- Ashok kumar Bhukhar April 06, 2014 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

it will return both table data in one row.

- atul April 10, 2014 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Yes, this query will execute and return the result as (number of records in employee table * number of records in the department table) as SQL not having any condition.

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

Yes, the result will be (Employee rows x Department rows)

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

SELECT * FROM employees

- Anonymous November 09, 2020 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

SELECT * FROM Employee.
WHERE Salary > 1450.00;

- Anonymous January 25, 2021 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

SELECT*from employees, departments

- Anonymous August 06, 2021 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Select * from employee, department where employee. id= department. id;
- first it evaluates the Cartesian product.
- selects records of required criteria.

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

SELECT*from employees, departments

- Anonymous July 26, 2022 | Flag Reply
Comment hidden because of low score. Click to expand.
-1
of 1 vote

It might not execute in case there are duplicated column names. Depends on the query analyzing phase.

- napo April 08, 2014 | 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