Specifies a result table. A result table is an intermediate table of values derived from columns and rows of one or more tables or views that meet conditions specified by a select expression. The tables or views that the columns and rows come from are identified in the FROM clause of the statement. The basic element of a SELECT statement is called a select expression. The Select_Expressions HELP topic describes select expressions in detail. To retrieve rows of a result table in host language programs, you must use the DECLARE CURSOR statement or a special form of SELECT statement called a singleton select. See the SELECT Singleton_ Select statement for more information about a singleton select. SQL evaluates the clauses of a SELECT statement in the following order: 1. FROM 2. WHERE 3. GROUP BY 4. HAVING 5. Select list 6. ORDER BY 7. OFFSET 8. LIMIT TO (or FETCH FIRST) 9. OPTIMIZE After each of these clauses, SQL produces an intermediate result table that is used in evaluating the next clause.
1 – Environment
You can use the general form of the SELECT statement only in interactive and dynamic SQL.
2 – Format
(B)0[m[1mselect-statement = [m [1m [m [1mselect-expr qwq>qqqqqqqqqqqqqqqqqqqqwwqqqqqqqqqqqqqqqqqqqqwq>[m [1m [m [1m mq> for-update-clause qjmq>[m [1moptimize-clause[m [1mqj[m (B)0[m[1mselect-expr = [m [1m [m [1m [m [1m [m [1mqwqwq> select-clause qqqqqqqqqqqqwqwqqqqqqk[m [1m [m [1m x tq> ( select-expr ) qqqqqqqqqqqu x [m [1mx[m [1m [m [1m [m [1m x mq> [1;4mTABLE[m[1m table-ref qqqqqqqqqqj x x [m [1m [m [1m mqqqqqq select-merge-clause <qqqqqqqj [m [1m x[m [1m lqqqqqqqqqqqqqqqqqqq <qqqqqqqqqqqqqqqqqqqj[m [1m [m [1mmqwqqqqqqqqqqqqqqqqqqqqwqqwqqqqqqqqqqqqqqqqqqwqqwqqqqqqqqqqqqqqqqqqqqwq>[m [1m [m [1m mq> order-by-clause qj[m [1mmq> offset-clause qj [m [1mmq> limit-to-clause qj[m (B)0[m[1mselect-merge-clause = [m [1m [m [1mqwq>[m [1;4mEXCEPT[m [1mqwqqqqqqqqqqqqqqwqqqwqqqqwqqqqqqqqqqqqqqqqqqqwqq>[m [1m x [m [1m mq> [1;4mDISTINCT[m[1m qqj [m [1m x[m [1m tq>[m [1;4mCORRESPONDING[m[1m qqu[m [1m tq> [1;4mINTERSECT[m[1m qwqqqqqqqqqqqqqwqu[m [1m [m [1mmq> [1;4mNATURAL[m[1m qqqqqqqqj[m [1mx[m [1mmq> [1;4mDISTINCT[m[1m qj[m [1mx[m [1mtq> [1;4mMINUS[m[1m qqqqqqqqqqqqqqqqqqqqqu[m [1mmq> [1;4mUNION[m[1m qqwqqqqqqqqqqqqqwqqqqj[m [1m tq> [1;4mALL[m[1m qqqqqqu[m [1m mq> [1;4mDISTINCT[m[1m qj[m (B)0[m[1mselect-clause = [m [1m [m [1;4mSELECT[m[1m qwqqqqqqqqqqqqqwq> select-list qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqk[m [1m tq> [1;4mALL[m[1m qqqqqqu [m [1m [m [1mx[m [1m mq> [1;4mDISTINCT[m[1m qj [m [1m [m [1mx[m [1mlqqqqqqqqqqqqqqqqqq<qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj[m [1mmq> [1;4mFROM[m[1m qwqq> table-ref qqwqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqk[m [1m mqqqqqq , <qqqqqqj [m [1m [m [1mx[m [1mlqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj[m [1mmwqqqqqqqqq>qqqqqqqqqqqqqqqqqqqqqqqwqwqqqqqqqqqqqqq>qqqqqqqqqqqqqqqqwk[m [1m m> [1;4mWHERE[m[1m predicate qqqqqqqqqqqqqqqj[m [1mm> [1;4mGROUP[m[1m [1;4mBY[m[1m qw> <column-name> qux[m [1m [m [1m t> value-expr qqqqux[m [1mmqqqqqqq[m [1m,<qqqqqqqjx[m [1mlqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq<qqqqqqqqqqqqqqqqqqqqqqqqqqqqqj[m [1mmwqqqqqqqqqq>qqqqqqqqqqwqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq>[m [1m mq> [1;4mHAVING[m[1m predicate qj [m (B)0[m[1mselect-list = [m [1m [m [1mqwqwqqqq> * qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqwqwq> [m [1m x mqwqq> value-expr qqwqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqwqwqj x [m [1m x x mq> AS <name> qwqqqqqqqqqqqqqqqqqqqqqqwj x x [m [1m x x mq> edit-using-clause qj x x [m [1m x x x x [m [1m x mwq> <table-name> qqqqqqwq> . * qqqqqqqqqqqqqqqqqqqqqqqqqqqj x [m [1m x tq> <view-name> qqqqqqqu x [m [1m x mq> <correlation-name> j x [m [1m mqqqqqqqqqqqqqqqq , <qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj [m (B)0[m[1mtable-ref = [m [1m [m [1mqqwqq> <table-name> qqwqqwqqqqqqqqqqqqqqqqqqqqqqqqqqqqqwqq> [m [1m tqq> <view-name> [m [1mqqu mq> correlation-name-clause qqu [m [1m tqq> derived-table[m [1mqj x [m [1m mqq> joined-table qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj [m [1m [m (B)0[m[1mderived-table = [m [1m [m [1mqqqq> ( qwq> select-expr qqwq> ) qqqq> [m [1m mq> joined-table qj [m [1m [m (B)0[m[1mjoined-table = [m [1m [m [1mqqwqqqqqqq> qualified-join qqqqqqwqqqq> [m [1m tqqqqqqq> cross-join qqqqqqqqqqu [m [1m mq> ( qq> joined-table qq> ) qqj [m [1m [m (B)0[m[1mqualified-join = [m [1m [m [1mqwq> table-ref qwqqqqqqqqqqqqqwqq> [1;4mJOIN[m[1m qq> table-ref qk [m [1m x m> join-type qj x [m [1m x lqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj [m [1m x mwq> [1;4mON[m[1m predicate qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqwqqqqqqqqqqqw> [m [1m x mq> [1;4mUSING[m[1m qqqq> ( qw> <column-name> wq> ) qqqqqqj x [m [1m x mqqqqqq , <qqqqqqj x [m [1m mq> table-ref q> [1;4mNATURAL[m[1m qwqqqqqqqqqqqqqwq> [1;4mJOIN[m[1m q> table-ref qj [m [1m m> join-type qj [m [1m [m (B)0[m[1mcross-join = [m [1m [m [1mqqq> table-ref qq> [1;4mCROSS[m[1m [1;4mJOIN[m[1m qq> table-ref qqq> [m [1m [m (B)0[m[1mjoin-type = [m [1m [m [1mqqwq> [1;4mINNER[m[1m qqqqqqqqqqqqqqqqqqwqq> [m [1m tq> [1;4mLEFT[m[1m qqqwqq> OUTER qqqqqj [m [1m tq> [1;4mRIGHT[m[1m qqu [m [1m mq> [1;4mFULL[m[1m qqqj [m [1m [m (B)0[m[1mcorrelation-name-clause = [m [1m [m [1mq> AS <correlation-name> wqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqwq> [m [1m mq> ( qwq> <name-of-column> qwq> ) qqj [m [1m mqqqqqqqq , <qqqqqqqqqj [m [1m [m (B)0[m[1morder-by-clause = [m [1m [m [1mqq> [1;4mORDER[m[1m [1;4mBY[m[1m qwwq> value-expr qwwqqqqqqqqqwqwqq> [m [1m xmq> <integer> qqqqjtq> [1;4mASC[m[1m qqu x [m [1m x mq> [1;4mDESC[m[1m qj x [m [1m mqqqqqqqqqqqq , <qqqqqqqqqqqqqqqj [m [1m [m (B)0[m[1moffset-clause = [m [1m [m [1mqqq> [1;4mOFFSET[m[1m skip-expression qwq> [1;4mROW[m[1m qqwqq> [m [1m mq> [1;4mROWS[m[1m qqj [m (B)0[m[1mlimit-to-clause = [m [1m [m [1mqw>[m [1;4mLIMIT[m[1m TO qwq> limit-expression qwqqqqqqqqqqqqqqqqqqqqqqqqqqqwwwqqqqqqqqqww>[m [1mx[m [1mx[m [1mtq> [1;4mOFFSET[m[1m skip-expression quxtq> [1;4mROW[m[1m qux[m [1mx[m [1mx[m [1mmq> [1;4mSKIP[m[1m skip-expression qqjxmq> [1;4mROWS[m[1m qjx[m [1mx[m [1mmq> skip-expression , limit-expression qqqqqqqqqqqj[m [1mx[m [1mx[m [1mx[m [1mm> [1;4mFETCH[m[1m qw> [1;4mFIRST[m[1m qwqqwqqqqqqqqqqqqqqqqqqqqqwqqwqqqqqqqqqqwq> [1;4mONLY[m[1m qqqqqqqqj[m [1mm> [1;4mNEXT[m[1m qqj[m [1mmq> limit-expression qj[m [1mtq> [1;4mROW[m[1m qqu[m [1mmq> [1;4mROWS[m[1m qj[m (B)0[m[1mfor-update-clause = [m [1m [m [1mqq> [1;4mFOR[m[1m [1;4mUPDATE[m[1m qwqqqqqqqqqqqqqqqqqqqqqqqqqwq> [m [1m mqwq> OF <column-name> qwqj [m [1m mqqqqqqqq , <qqqqqqqqqj [m [1m [m (B)0[m[1medit-using-clause = [m [1m [m [1mqq>[m [1;4mEDIT[m[1m [1;4mUSING[m[1m qwq> edit-string qqqwq> [m [1m [m [1m mq> <domain-name> qj [m (B)0[m[1moptimize-clause = [m [1m [m [1m [m [1m [m [1m [m [1m [m [1mqqwqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqwqqq> [m [1m mq> [1;4mOPTIMIZE[m[1m qqwqwq> [1;4mFOR[m[1m qwq> [1;4mFAST[m[1m [1;4mFIRST[m[1m qqqqqqqqwqqqqqqqqqqwqwqj [m [1m x x tq> [1;4mTOTAL[m[1m [1;4mTIME[m[1m qqqqqqqqu[m [1m [m [1mx x [m [1mx[m [1mx[m [1mmq> [1;4mSEQUENTIAL[m [1;4mACCESS[m [1mqj[m [1mx[m [1mx[m [1m x tq> [1;4mUSING[m[1m <outline-name> qqqqqqqqqqqqqqqqqqu x [m [1mx[m [1mtq> [1;4mWITH[m[1m qwq> [1;4mDEFAULT[m [1mqqwq> [1;4mSELECTIVITY[m [1mqu[m [1mx[m [1mx[m [1mx[m [1mtq>[m [1;4mSAMPLED[m [1mqqu[m [1mx[m [1mx[m [1mx[m [1mx[m [1mmq>[m [1;4mAGGRESSIVE[m[1m j[m [1mx[m [1mx[m [1m x mq> [1;4mAS[m[1m <query-name> qqqqqqqqqqqqqqqqqqqqqqqj x [m [1m mqqqqqqqqqqqqqqqq <qqqqqqqqqqqqqqqqqqqqqqqqqqqqj [m [1m [m [1m [m [1m [m
3 – Arguments
3.1 – EDIT_USING
Syntax options: EDIT USING edit-string|EDIT USING domain-name Associates an edit string with a value expression. This clause overrides any EDIT STRING defined for the columns or variables in the query. This clause is only permitted for interactive SQL.
3.2 – FOR_UPDATE_OF
Specifies the columns in a cursor that you or your program might later modify with an UPDATE statement. The column names in the FOR UPDATE clause must belong to a table or view named in the FROM clause. You do not have to specify the FOR UPDATE clause of the SELECT statement to later modify rows using the UPDATE statement: o If you do specify a FOR UPDATE clause with column names and later specify columns in the UPDATE statement that are not in the FOR UPDATE clause, SQL issues a warning message and proceeds with the update modifications. o If you do specify a FOR UPDATE clause but do not specify any column names, you can update any column using the UPDATE statement. SQL does not issue any messages. o If you do not specify a FOR UPDATE clause, you can update any column using the UPDATE statement. SQL does not issue any messages. The FOR UPDATE OF clause in a SELECT statement provides UPDATE ONLY CURSOR semantics by locking all the rows selected.
3.3 – OPTIMIZE AS query name
Assigns a name to the query. You can define the RDMS$DEBUG_FLAGS logical name or use SET FLAGS with the option 'STRATEGY' to see the access methods used to produce the results of the query. The following example shows how to use the OPTIMIZE AS clause: SQL> DELETE FROM EMPLOYEES E cont> WHERE EXISTS ( SELECT * cont> FROM SALARY_HISTORY S cont> WHERE S.EMPLOYEE_ID = E.EMPLOYEE_ID cont> AND S.SALARY_AMOUNT > 75000) cont> OPTIMIZE AS DEL_EMPLOYEE; Leaf#01 FFirst RDB$RELATIONS Card=19 . . . ~Query Name : DEL_EMPLOYEE . . . 7 rows deleted
3.4 – OPTIMIZE_FOR
Specifies the preferred optimizer strategy for statements that specify a select expression. The following options are available: o FAST FIRST A query optimized for FAST FIRST returns data to the user as quickly as possible, even at the expense of total throughput. If a query can be cancelled prematurely, you should specify FAST FIRST optimization. A good candidate for FAST FIRST optimization is an interactive application that displays groups of records to the user, where the user has the option of aborting the query after the first few screens. For example, singleton SELECT statements default to FAST FIRST optimization. If the optimization level is not explicitly set, FAST FIRST is the default. o TOTAL TIME If your application runs in batch, accesses all the records in the query, and performs updates or writes a report, you should specify TOTAL TIME optimization. Most queries benefit from TOTAL TIME optimization. The following examples illustrate the DECLARE CURSOR syntax for setting a preferred optimization mode: SQL> DECLARE TEMP1 TABLE CURSOR cont> FOR cont> SELECT * cont> FROM EMPLOYEES cont> WHERE EMPLOYEE_ID > '00400' cont> OPTIMIZE FOR FAST FIRST; SQL> -- SQL> DECLARE TEMP2 TABLE CURSOR cont> FOR cont> SELECT LAST_NAME, FIRST_NAME cont> FROM EMPLOYEES cont> ORDER BY LAST_NAME cont> OPTIMIZE FOR TOTAL TIME; o SEQUENTIAL ACCESS Forces the use of sequential access. This is particularly valuable for tables that use the strict partitioning functionality. When the storage map of a table has the attribute PARTITIONING IS NOT UPDATABLE, the mapping of data to a storage area is strictly enforced. This is known as strict partitioning. When queries on such tables use sequential access, the optimizer can eliminate partitions which do not match the WHERE restriction rather than scan every partition. The following example shows a query that deletes selected rows from a specific partition. This table also includes several indexes, which may be chosen by the optimizer. Therefore, the OPTIMIZE clause forces sequential access. SQL> delete from PARTS_LOG cont> where parts_id between 10000 and 20000 cont> and expire_date < :purge_date cont> optimize for sequential access; Note that all access performed by such queries will be sequential. Care should be taken that the I/O being used is acceptable by comparing similar queries using index access.
3.5 – OPTIMIZE USING outline name
Explicitly names the query outline to be used with the select expression even if the outline ID for the select expression and for the outline are different. The following example is the query used to create an outline named WOMENS_DEGREES: SQL> SELECT E.LAST_NAME, E.EMPLOYEE_ID, D.DEGREE, D.DEGREE_FIELD, D.YEAR_GIVEN cont> FROM EMPLOYEES E, DEGREES D WHERE E.SEX = 'F' cont> AND E.EMPLOYEE_ID = D.EMPLOYEE_ID cont> ORDER BY LAST_NAME By using the OPTIMIZE USING clause and specifying the WOMENS_ DEGREES outline, you can ensure that Oracle Rdb attempts to use the WOMENS_DEGREES outline to execute a query even if the query is slightly different as shown in the following example: SQL> SELECT E.LAST_NAME, E.EMPLOYEE_ID, D.DEGREE, D.DEGREE_FIELD, D.YEAR_GIVEN cont> FROM EMPLOYEES E, DEGREES D WHERE E.SEX = 'F' cont> AND E.EMPLOYEE_ID = D.EMPLOYEE_ID cont> ORDER BY LAST_NAME cont> LIMIT TO 10 ROWS cont> OPTIMIZE USING WOMENS_DEGREES; ~S: Outline WOMENS_DEGREES used <-- the query uses the WOMENS_DEGREES outline . . . E.LAST_NAME E.EMPLOYEE_ID D.DEGREE D.DEGREE_FIELD D.YEAR_GIVEN Boyd 00244 MA Elect. Engrg. 1982 Boyd 00244 PhD Applied Math 1979 Brown 00287 BA Arts 1982 Brown 00287 MA Applied Math 1979 Clarke 00188 BA Arts 1983 Clarke 00188 MA Applied Math 1976 Clarke 00196 BA Arts 1978 Clinton 00235 MA Applied Math 1975 Clinton 00201 BA Arts 1973 Clinton 00201 MA Applied Math 1978 10 rows selected See the CREATE OUTLINE statement for more information on creating an outline.
3.6 – OPTIMIZE_WITH
Selects one of three optimization controls: DEFAULT (as used by previous versions of Oracle Rdb), AGGRESSIVE (assumes smaller numbers of rows will be selected), and SAMPLED (which uses literals in the query to perform preliminary estimation on indices).
3.7 – select-expr
See the Select_Expressions HELP topic for a detailed description of select expressions.
4 – Examples
Example 1: Using the SELECT statement The following SELECT statement returns all rows from the EMPLOYEES table in no specific order: SQL> SELECT LAST_NAME, FIRST_NAME, MIDDLE_INITIAL FROM EMPLOYEES; LAST_NAME FIRST_NAME MIDDLE_INITIAL Toliver Alvin A Smith Terry D Dietrich Rick NULL Kilpatrick Janet NULL . . . 100 rows selected Example 2: Adding an ORDER BY clause to sort rows selected An ORDER BY clause added to the same SELECT statement causes SQL to sort the rows according to the LAST_NAME column. SQL> SELECT LAST_NAME, FIRST_NAME, MIDDLE_INITIAL FROM cont> EMPLOYEES ORDER BY LAST_NAME; LAST_NAME FIRST_NAME MIDDLE_INITIAL Ames Louie A Andriola Leslie Q Babbin Joseph Y Bartlett Dean G Bartlett Wes NULL . . . 100 rows selected Example 3: Adding a LIMIT TO clause to return a certain number of rows The same SELECT statement with both an ORDER BY clause and a LIMIT TO clause causes SQL to: 1. Sort all the rows of the EMPLOYEES table according to the LAST_NAME column 2. Return the first five rows in the ordered set SQL> SELECT LAST_NAME, FIRST_NAME, MIDDLE_INITIAL FROM cont> EMPLOYEES ORDER BY LAST_NAME LIMIT TO 5 ROWS; LAST_NAME FIRST_NAME MIDDLE_INITIAL Ames Louie A Andriola Leslie Q Babbin Joseph Y Bartlett Dean G Bartlett Wes NULL 5 rows selected Example 4: Using the optimize clause to specify an outline and a query name The following select query uses a previously defined outline called WOMENS_DEGREES and also names the query. The RDMS$DEBUG_ FLAGS logical has been set to "Ss": SQL> SELECT E.LAST_NAME, E.EMPLOYEE_ID, D.DEGREE, cont> D.DEGREE_FIELD, D.YEAR_GIVEN cont> FROM EMPLOYEES E, DEGREES D cont> WHERE E.SEX = 'F' cont> AND E.EMPLOYEE_ID = D.EMPLOYEE_ID cont> ORDER BY LAST_NAME cont> OPTIMIZE USING WOMENS_DEGREES cont> AS WOMENS_DEGREES; ~Query Name : WOMENS_DEGREES ~S: Outline WOMENS_DEGREES used Sort Cross block of 2 entries Cross block entry 1 Conjunct Get Retrieval by index of relation EMPLOYEES Index name EMP_EMPLOYEE_ID [0:0] Cross block entry 2 Leaf#01 BgrOnly DEGREES Card=165 BgrNdx1 DEG_EMP_ID [1:1] Fan=17 -- Rdb Generated Outline : 16-JUN-1994 11:01 create outline WOMENS_DEGREES id 'D3A5BC351F507FED820EB704FC3F61E8' mode 0 as ( query ( subquery ( EMPLOYEES 0 access path index EMP_EMPLOYEE_ID join by cross to DEGREES 1 access path index DEG_EMP_ID ) ) ) compliance optional ; E.LAST_NAME E.EMPLOYEE_ID D.DEGREE D.DEGREE_FIELD D.YEAR_GIVEN Boyd 00244 MA Elect. Engrg. 1982 Boyd 00244 PhD Applied Math 1979 Brown 00287 BA Arts 1982 Brown 00287 MA Applied Math 1979 Clarke 00188 BA Arts 1983 Clarke 00188 MA Applied Math 1976 Clarke 00196 BA Arts 1978 . . . 61 rows selected Example 5: Associating an Edit String with a Value Expression SQL> CREATE DOMAIN MONEY INTEGER(2) cont> EDIT STRING '$$$,$$$,$$9.99'; SQL> --Calculate the average salary for all current jobs. SQL> SELECT EMPLOYEE_ID, cont> AVG(SALARY_AMOUNT) AS AVERAGE EDIT USING MONEY, cont> MAX(SALARY_AMOUNT) AS MAXIMUM EDIT USING MONEY, cont> MAX(SALARY_START) AS START_DATE EDIT USING 'YYYBDDBMMMBWWW' cont> FROM SALARY_HISTORY cont> WHERE SALARY_END IS NULL cont> GROUP BY EMPLOYEE_ID; EMPLOYEE_ID AVERAGE MAXIMUM START_DATE 00164 $51,712.00 $51,712.00 983 14 Jan Fri 00165 $11,676.00 $11,676.00 982 1 Jul Thu 00166 $18,497.00 $18,497.00 982 7 Aug Sat 00167 $17,510.00 $17,510.00 982 21 Aug Sat . . . 00435 $84,147.00 $84,147.00 982 12 Mar Fri 00471 $52,000.00 $52,000.00 982 15 Aug Sun 100 rows selected Example 6: Using the ORDER BY Clause with a Value Expression SQL> SELECT * FROM EMPLOYEES cont> ORDER BY EXTRACT (YEAR FROM BIRTHDAY), cont> TRIM(FIRST_NAME) || TRIM(LAST_NAME); 00190 O'Sullivan Rick G. 78 Mason Rd. NULL Fremont NH 03044 M 12-Jan-1923 1 None 00231 Clairmont Rick NULL 92 Madiso7 Drive NULL Chocorua NH 03817 M 23-Dec-1924 2 None 00183 Nash Walter V. 197 Lantern Lane NULL Fremont NH 03044 M 19-Jan-1925 1 None 00177 Kinmonth Louis NULL 76 Maple St. NULL Etna NH 03750 M 7-Apr-1926 1 None 00240 Johnson Bill R. 20 South St NULL Milford NH 03055 M 13-Apr-1927 2 None . . . Example 7: Using the GROUP BY Clause with a Value Expression SQL> SELECT COUNT (*), EXTRACT (YEAR FROM BIRTHDAY) cont> FROM EMPLOYEES cont> GROUP BY EXTRACT (YEAR FROM BIRTHDAY); 1 1923 1 1924 1 1925 1 1926 4 1927 2 1928 1 1930 2 1931 . . . Example 8: Performing an Outer Join with Oracle Server Style Syntax SQL> SELECT EMPLOYEES.EMPLOYEE_ID, JOB_CODE cont> FROM EMPLOYEES, CURRENT_JOB cont> WHERE EMPLOYEES.EMPLOYEE_ID= CURRENT_JOB.EMPLOYEE_ID(+); EMPLOYEES.EMPLOYEE_ID CURRENT_JOB.JOB_CODE 00164 DMGR 00165 ASCK 00166 DMGR 00167 APGM 00168 DMGR 00169 SPGM 00170 SCTR 00171 PRGM . . .