Results 1 to 2 of 2

Thread: Where clause

  1. #1
    Join Date
    Mar 2009
    Location
    New Delhi - India
    Posts
    22

    Post Unanswered: Where clause

    I want to delete data from employee table.
    Say
    delete from emp
    from dept
    where emp.dno = dept.dno.

    Does the order in where clause holds any importance for query optimazation.
    Is "where emp.dno = dept.dno" better than "where dept.dno=emp.dno".
    Employee table has more no of rows.

  2. #2
    Join Date
    Jun 2010
    Posts
    51
    In most cases it doesn't matter in which order you are writing your join because sybase will automatically choose the most optimized way to execute the query (provided table statistics are up to date and query plan is up to date in case it's inside SP).

    However, If you choose to write set forceplan on..then it matters. This forces syabse to join the tables in the same order it's written.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •