OPTION
Example
Section titled “Example”SELECT ProductID, NameFROM Production.ProductORDER BY ListPrice DESCOPTION (MAXDOP 1);Output
Section titled “Output”ProductID | Name--------- | -------------748 | Road-150 Red, 62749 | Road-150 Red, 44750 | Road-150 Red, 48751 | Road-150 Red, 52752 | Road-150 Red, 56753 | Road-150 Red, 60Explanation
Section titled “Explanation”The OPTION clause is used to optimize the performance of your SQL Server query. In this example, the MAXDOP 1 option ensures that the query uses only one processor for its execution, potentially improving performance for a system with multiple processors. The query selects ProductID and Name from the Production.Product table, ordered by ListPrice in descending order.
Example
Section titled “Example”SELECT * FROM employeesWHERE department_id = 10OPTION (FULL JOIN)Output
Section titled “Output”EMPLOYEE_ID FIRST_NAME LAST_NAME DEPARTMENT_ID------------------------------------------------110 John Doe 10111 Jane Smith 10Explanation
Section titled “Explanation”The OPTION(FULL JOIN) hint is Oracle’s mechanism for influencing the execution plan of a statement. In the above example, the Oracle SQL engine will perform a FULL JOIN on the tables mentioned in the query. The output shows all employees who are in department 10.