Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

What is the main difference between the IN and EXISTS clause in sub queries??

0
Posted

What is the main difference between the IN and EXISTS clause in sub queries??

0

The main difference between the IN and EXISTS predicate in sub query is the way in which the query gets executed. IN — The inner query is executed first and the list of values obtained as its result is used by the outer query. The inner query is executed for only once. EXISTS — The first row from the outer query is selected, then the inner query is executed and, the outer query output uses this result for checking. This process of inner query execution repeats as many no .of times as there are outer query rows. That is, if there are ten rows that can result from outer query, the inner query is executed that many no. of times. Question: TRUNCATE TABLE EMP; DELETE FROM EMP; Will the outputs of the above two commands differ Answer: The difference is that the TRUNCATE call cannot be rolled back and all memory space for that table is released back to the server. TRUNCATE is much faster than DELETE and in both cases only the table data is removed, not the table structure.

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123