• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Oracle Q in Java Interview

 
prat de
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everybody,
please share your opinions/answer regarding foll. oracle q:
There are two tables, customer and order tables:
Customer
CustomerID CustomerName Phone
Order
OrderID CustomerID Orders
Query:
Select Customer.CustomerID, Order.OrderID, Order.Orders, Customer.CustomerName from Customer, Order
where CustomerID >=1000;
Which part of the query will take maximum time of execution?
- prat.
 
SJ Adnams
Ranch Hand
Posts: 925
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
looks like a cartesian join to me...
 
D. Rose
Ranch Hand
Posts: 215
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
MAximum time of the query will be spent in scanning Orders table as it will be full table scan for that table.
Changing where clause to " where customer.customerId >=1000 and order.customerId=customer.customerId" will avoid this full scan.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic