Results 1 to 6 of 6

Thread: Output without the JOIN condition. How is it possible ?

  1. #1
    Geek_Guest
    Guest

    Output without the JOIN condition. How is it possible ?

    I have two tables. Is it required to write join condition to retrieve the data from both?

    But when I wrote a select statement like select end_date, account from detail, custom I got the output, in which end_date is from detail and account is from custom table.

    Without join condition also can we retrieve the data? I got the output without the JOIN condition. How is it possible ?

    Question asked by visitor raja


  2. #2
    Moderator
    Join Date
    Jun 2007
    Answers
    2,074

    Re: Output without the JOIN condition. How is it possible ?

    How is it possible to retrive data from more than one table with out join.

    R u using any sub -query.


  3. #3
    Expert Member
    Join Date
    Jun 2006
    Answers
    410

    Re: Output without the JOIN condition. How is it possible ?

    you have used sub-query in your select clause. It would be something like

    select d.end_date, (select c.account from custom c where c.a=d.a)
    from detail d;


  4. #4
    Expert Member
    Join Date
    Sep 2007
    Answers
    110

    Re: Output without the JOIN condition. How is it possible ?

    Yes it is possible. Suppose there are 2 tables employees and orders employees: orders: emp_id emp_name prod_id product emp_id 01 a 234 printer 01 02 b 657 table 03 03 c 865 chair 04 04 d now select the emp_name and product with out using join: select employees.emp_name, orders.product from employees,orders where employees.emp_id=orders.emp_id using join: select employees.emp_name,orders.product from employees innerjoin orders on employees.emp_id=orders.emp_id output will be same for both quiries.


  5. #5
    Expert Member
    Join Date
    Sep 2007
    Answers
    110

    Re: Output without the JOIN condition. How is it possible ?

    Yes it is possible. Suppose there are 2 tables employees and orders employees: orders: emp_id emp_name prod_id product emp_id
    01 a 234 printer 01 02 b 657 table 03 03 c 865 chair 04
    04 d now select the emp_name and product with out using join: select employees.emp_name, orders.product from employees,orders where employees.emp_id=orders.emp_id using join: select employees.emp_name,orders.product from employees innerjoin orders on employees.emp_id=orders.emp_id output will be same for both quiries.


  6. #6
    Expert Member
    Join Date
    Sep 2007
    Answers
    110

    Re: Output without the JOIN condition. How is it possible ?

    Yes It is possible.

    Suppose there are 2 tables Employees and Orders

    Employees:
    Emp_Id Emp_Name
    01 A
    02 B
    03 C
    04 D


    Orders:
    Prod_Id Product Emp_Id
    234 Printer 01
    657 Table 03
    865 Chair 04

    Now Select the Emp_Name and Product With out using Join:

    select Employees.Emp_Name, Orders.Product from Employees,Orders where Employees.Emp_Id=Orders.Emp_Id

    Using Join:

    select Employees.Emp_Name,Orders.Product from Employees innerJoin Orders ON Employees.Emp_Id=Orders.Emp_Id

    OutPut will be same for both quiries.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Applying for a job can be a stressful and frustrating experience, especially for someone who has never done it before. Considering that you are competing for the position with a at least a dozen other applicants, it is imperative that you thoroughly prepare for the job interview, in order to stand a good chance of getting hired. That's where GeekInterview can help.
Interact