Quality Testing

Quality is delighting customers

How can we retrieving data from multiple tables without using SELECT in mysql?


How can we retrieve data from 2 tables without using Joins in mysql?


Views: 3952

Reply to This

Replies to This Discussion

create dept table(deptno,dname,loc)
create emptable(eno,ename,job,sal,deptno) using primary,refernce key

select empno,ename,job,sal,deptno from emp where
deptno in (select deptno from dept
where loc = 'CHICAGO');

data retrive from two tables with out using joins

In this query we can say that we are using two different tables to retrieve the data; but we are retrieving the data (empno, ename,job,sal,deptno) only from one table viz emp and not from dept. Let me know your thoughts.



Arvi, QTPhelp.com

you can try something like this though...


Select emp.ename, dept.dname from emp, dept where emp.eno in (Select eno from emp)


ahh.. I guess this is the answer to the original question. I tried and it works.


nice explain. Between join, sub query & nested query, who will give fast result?



Thanks all of you.



I have one more question, We can retrieve data from 2 tables using alias/nested queries & Joins.

Both are retrieving same data then what is the difference between alias/nested queries & Joins?


gud questions plz arvi i need answer of this question too


Nested : Nested query is using the results of a subquery in the main query (A Query inside a query)


Joins : http://www.w3schools.com/sql/sql_join.asp




Check out how to Connect to database using QTP


With Alias - we can alias a name to a column or table and retrieve the data from 2 tables.

Joins- We can retrieve data from more than 2 tables.


With Alias also we can retrieve the data then why we use Joins? pls.. explain clearly. Bcoz this question is asked in one interview.

Using Alias - Implicit joins

Using Joins - Explicit joins

Both are joins only, but different join notions. The only way to retrieve from 2 tables is using sub queries. I have specified  the query above.

mysql> SELECT * FROM officeTable WHERE Empid in(SELECT Empid FROM  employee); is this what you are looking for?


TTWT Magazine





© 2022   Created by Quality Testing.   Powered by

Badges  |  Report an Issue  |  Terms of Service