Auszüge aus Oracle9i SQL Reference

Size: px
Start display at page:

Download "Auszüge aus Oracle9i SQL Reference"

Transcription

1 2 Basic Elements of Oracle SQL Pseudocolumns Pseudocolumns LEVEL For each row returned by a hierarchical query, the LEVEL pseudocolumn returns 1 for a root row, 2 for a child of a root, and so on. A root row is the highest row within an inverted tree. A child row is any nonroot row. A parent row is any row that has children. A leaf row is any row without children. Figure 2 1 shows the nodes of an inverted tree with their LEVEL values. Auszüge aus Oracle9i SQL Reference CASE Expressions 4 Expressions CASE Expressions CASE expressions let you use IF THEN ELSE logic in SQL statements without having to invoke procedures. The syntax is: case_expression::= CASE simple_case_expression searched_case_expression else_clause END Figure 2 1 Hierarchical Tree simple_case_expression::= Level 1 root/ parent expr WHEN comparison_expr THEN return_expr Level 2 parent/ child parent/ child searched_case_expression::= WHEN condition THEN return_expr Level 3 child/ leaf parent/ child child/ leaf parent/ child else_clause::= Level 4 child/ leaf child/ leaf To define a hierarchical relationship in a query, you must use the START WITH and CONNECT BY clauses. Restriction on LEVEL in WHERE Clauses In a [NOT] IN condition in a WHERE clause, if the right-hand side of the condition is a subquery, you cannot use LEVEL on the left-hand side of the condition. However, you can specify LEVEL in a subquery of the FROM clause to achieve the same result. For example, the following statement is not valid: employee_id, last_name WHERE (employee_id, LEVEL IN ( employee_id, 2 START WITH employee_id = 2 CONNECT BY PRIOR employee_id = manager_id; But the following statement is valid because it encapsulates the query containing the LEVEL information in the FROM clause: v.employee_id, v.last_name, v.lev FROM ( employee_id, last_name, LEVEL lev v START WITH employee_id = Oracle9i SQL Reference CONNECT BY PRIOR employee_id = manager_id v WHERE (v.employee_id, v.lev IN ( employee_id, 2 ; child/ leaf Pseudocolumns ELSE 4-6 Oracle9i SQL Reference else_expr In a simple CASE expression, Oracle searches for the first WHEN THEN pair for which expr is equal to comparison_expr and returns return_expr. If none of the WHEN THEN pairs meet this condition, and an ELSE clause exists, then Oracle returns else_expr. Otherwise, Oracle returns null. You cannot specify the literal NULL for all the return_exprs and the else_expr. All of the expressions (expr, comparison_expr, and return_expr must be of the same datatype, which can be CHAR, VARCHAR2, NCHAR, or NVARCHAR2. In a searched CASE expression, Oracle searches from left to right until it finds an occurrence of condition that is true, and then returns return_expr. If no condition is found to be true, and an ELSE clause exists, Oracle returns else_ expr. Otherwise, Oracle returns null. Note: The maximum number of arguments in a CASE expression is 255, and each WHEN THEN pair counts as two arguments. To avoid exceeding the limit of 128 choices, you can nest CASE expressions. That is return_expr can itself be a CASE expression. ROWID For each row in the database, the ROWID pseudocolumn returns a row s address. Oracle9i rowid values contain information necessary to locate a row: See Also: "Hierarchical Queries" on page 8-3 for information on hierarchical queries in general The data object number of the object Which data block in the datafile 1

2 See Also: COALESCE on page 6-33 and NULLIF on page for alternative forms of CASE logic Oracle9i Data Warehousing Guide for examples using various forms of the CASE expression CURSOR Expressions Simple CASE Example For each customer in the sample oe.customers table, the following statement lists the credit limit as "Low" if it equals $100, "High" if it equals $5000, and "Medium" if it equals anything else. cust_last_name, CASE credit_limit WHEN 100 THEN Low WHEN 5000 THEN High ELSE Medium END FROM customers; CUST_LAST_NAME CASECR Bogart Medium Nolte Medium Loren Medium Gueney Medium Searched CASE Example The following statement finds the average salary of the employees in the sample table oe.employees, using $2000 as the lowest salary possible: AVG(CASE WHEN e.salary > 2000 THEN e.salary ELSE 2000 END "Average Salary" from employees e; UPDATE short_orders s SET sales_rep = Unassigned ; o.item.line_item_id, o.item.quantity FROM short_orders o; Scalar Subquery Expressions Scalar Subquery Expressions A scalar subquery expression is a subquery that returns exactly one column value from one row. The value of the scalar subquery expression is the value of the select list item of the subquery. If the subquery returns 0 rows, then the value of the scalar subquery expression is NULL. If the subquery returns more than one row, then Oracle returns an error. You can use a scalar subquery expression in most syntax that calls for an expression (expr. However, scalar subqueries are not valid expressions in the following places: As default values for columns As hash expressions for clusters In the RETURNING clause of DML statements As the basis of a function-based index In CHECK constraints In WHEN conditions of CASE expressions In GROUP BY and HAVING clauses In START WITH and CONNECT BY clauses Type Constructor Expressions In statements that are unrelated to queries, such as CREATE PROFILE A type constructor expression specifies a call to a type constructor. The argument to the type constructor is any expression. Average Salary CURSOR Expressions A CURSOR expression returns a nested cursor. This form of expression is equivalent to the PL/SQL REF CURSOR and can be passed as a REF CURSOR argument to a function. Expressions 4-13 Expressions 4-7 2

3 6 Functions COALESCE COALESCE COMPOSE COMPOSE CHR (50052 USING NCHAR_CS FROM DUAL; CH -- Ä coalesce::= COALESCE ( expr COALESCE returns the first non-null expr in the expression list. At least one expr must not be the literal NULL. If all occurrences of expr evaluate to null, then the function returns null. This function is a generalization of the NVL function. You can also use COALESCE as a variety of the CASE expression. For example, COALESCE (expr1, expr2 is equivalent to: CASE WHEN expr1 IS NOT NULL THEN expr1 ELSE expr2 END Similarly, COALESCE (expr1, expr2,, exprn, for n>=3 is equivalent to:, CASE WHEN expr1 IS NOT NULL THEN expr1 ELSE COALESCE (expr2,, exprn END The following example uses the sample oe.product_information Functions table to 6-33 organize a "clearance sale" of products. It gives a 10% discount to all products with a list price. If there is no list price, then the sale price is the minimum price. If there is no minimum price, then the sale price is "5": product_id, list_price, min_price, COALESCE(0.9*list_price, min_price, 5 "Sale" FROM product_information WHERE supplier_id = ; PRODUCT_ID LIST_PRICE MIN_PRICE Sale compose::= See Also: page 4-6 COMPOSE ( string NVL on page and "CASE Expressions" on COMPOSE takes as its argument a string in any datatype, and returns a Unicode string in its fully normalized form in the same character set as the input. string can be any of the datatypes CHAR, VARCHAR2, NCHAR, NVARCHAR2, CLOB, or 3 DECODE DECODE DECODE decode::= DECODE ( expr, search, result DECODE compares expr to each search value one by one. If expr is equal to a search, then Oracle returns the corresponding result. If no match is found, then Oracle returns default. If default is omitted, then Oracle returns null. If expr and search contain character data, then Oracle compares them using nonpadded comparison semantics. expr, search, and result can be any of the datatypes CHAR, VARCHAR2, NCHAR, or NVARCHAR2. The string returned is of VARCHAR2 datatype and is in the same character set as the first result parameter. The search, result, and default values can be derived from expressions. Oracle evaluates each search value only before comparing it to expr, rather than evaluating all search values before comparing any of them with expr. Consequently, Oracle never evaluates a search if a previous search is equal to expr. Oracle automatically converts expr and each search value to the datatype of the first search value before comparing. Oracle automatically converts the return value to the same datatype as the first result. If the first result has the datatype CHAR or if the first result is null, then Oracle converts the return value to the datatype VARCHAR2. In a DECODE function, Oracle considers two nulls to be equivalent. If expr is null, then Oracle returns the result of the first search that is also null. DECOMPOSE The maximum number of components in the DECODE function, including expr, searches, results, and default, is 255. See Also: "Datatype Comparison Rules" on page 2-45 for information on comparison semantics "Data Conversion" on page 2-48 for information on datatype conversion in general "Implicit and Explicit Data Conversion" on page 2-49 for information on the drawbacks of implicit conversion 6-52 Oracle9i SQL Reference This example decodes the value warehouse_id. If warehouse_id is 1, then the function returns Southlake ; if warehouse_id is 2, then it returns San Francisco ; and so forth. If warehouse_id is not 1, 2, 3, or 4, then the function returns Non-domestic. DECOMPOSE,, default product_id, DECODE (warehouse_id, 1, Southlake, 2, San Francisco, 3, New Jersey, 4, Seattle, Non-domestic "Location of inventory" FROM inventories WHERE product_id < 1775; decompose::= CANONICAL COMPATIBILITY

4 INSTR INSTR Capitals The Soap instr::= INSTR INSTRB INSTRC INSTR2 INSTR4 ( string, substring, position, occurrence INSTR The "in string" functions search string for substring. The function returns an integer indicating the position of the character in string that is the first character of this occurrence. INSTR calculates strings using characters as defined by the input character set. INSTRB uses bytes instead of characters. INSTRC uses Unicode complete characters. INSTR2 uses UCS2 codepoints. INSTR4 uses UCS Oracle9i SQL codepoints. Reference position is an nonzero integer indicating the character of string where Oracle begins the search. If position is negative, then Oracle counts and searches backward from the end of string. occurrence is an integer indicating which occurrence of string Oracle should search for. The value of occurrence must be positive. Both string and substring can be any of the datatypes CHAR, VARCHAR2, NCHAR, NVARCHAR2, CLOB, or NCLOB. The value returned is of NUMBER datatype. The default values of both position and occurrence are 1, meaning Oracle begins searching at the first character of string for the first occurrence of substring. The return value is relative to the beginning of string, regardless of the value of position, and is expressed in characters. If the search is unsuccessful (if substring does not appear occurrence times after the position character of string, then the return value is 0. The following example searches the string "CORPORATE FLOOR", beginning with the third character, for the string "OR". It returns the position in CORPORATE FLOOR at which the second occurrence of "OR" begins: INSTR( CORPORATE FLOOR, OR, 3, 2 "Instring" FROM DUAL; Instring LAG LAG SUBSTR SUBSTR 6-80 Oracle9i SQL Reference 20 Hartstein 17-FEB Goyal 17-AUG Raphaely 07-DEC Khoo 18-MAY Tobias 24-JUL Baida 2 24-DEC This example assumes a double-byte database character set Chen 28-SEP INSTRB( CORPORATE FLOOR, OR,5,2 "Instring in bytes" 100 Sciarra 30-SEP FROM DUAL; 100 Urman 07-MAR Popp 07-DEC Instring in bytes 110 Higgens 07-JUN Gietz 07-JUN lag::= substr::= SUBSTR, offset, default LAG SUBSTRB ( value_expr, substring_length SUBSTRC query_partition_clause ( string, position OVER ( order_by_clause SUBSTR2 SUBSTR4 See Also: "Analytic Functions" on page 6-10 for information on syntax, semantics, and restrictions LAG is an analytic function. It provides access to more than one row of a table at the same time without a self join. Given a series of rows returned from a query and a Oracle9i SQL position Reference of the cursor, LAG provides access to a row at a given physical offset prior to that position. If you do not specify offset, then its default is 1. The optional default value is returned if the offset goes beyond the scope of the window. If you do not specify default, then its default value is null. You cannot use LAG or any other analytic function for value_expr. That is, you can use other built-in function expressions for value_expr, but you cannot nest analytic functions. See Also: "About SQL Expressions" on page 4-2 for information on valid forms of expr In the next example, Oracle counts backward from the last character to the third character from the end, which is the first "O" in "FLOOR". Oracle then searches backward for the second occurrence of OR, and finds that this second occurrence begins with the second character in the search string : INSTR( CORPORATE FLOOR, OR, -3, 2 "Reversed Instring" FROM DUAL; Reversed Instring Functions

5 SUBSTR SYS_CONTEXT SYS_CONNECT_BY_PATH The "substring" functions return a portion of string, beginning at character position, substring_length characters long. SUBSTR calculates lengths using characters as defined by the input character set. SUBSTRB uses bytes instead of characters. SUBSTRC uses Unicode complete characters. SUBSTR2 uses UCS2 codepoints. SUBSTR4 uses UCS4 codepoints. If position is 0, then it is treated as 1. If position is positive, then Oracle counts from the beginning of string to find the first character. If position is negative, then Oracle counts backward from the end of string. SYS_CONNECT_BY_PATH If substring_length is omitted, then Oracle returns all characters to the end of string. If substring_length is less than 1, then a null is returned. string can be any of the datatypes CHAR, VARCHAR2, NCHAR, NVARCHAR2, CLOB, manager that are equal to or less than the current salary. You can see that Raphaely or NCLOB. The return value is the same datatype as string. Floating-point and Cambrault have the same cumulative total. This is because Raphaely and numbers passed as arguments to SUBSTR are automatically converted to integers. Cambrault have the identical salaries, so Oracle adds together their salary values and applies the same cumulative total to both rows. manager_id, last_name, salary, The following example returns several specified substrings of "ABCDEFG": SUM(salary OVER (PARTITION BY manager_id ORDER BY salary RANGE SUBSTR( ABCDEFG,3,4 UNBOUNDED PRECEDING "Substring" l_csum FROM ; DUAL; Substring MANAGER_ID LAST_NAME SALARY L_CSUM CDEF 100 Mourgos 100 Vollman SUBSTR( ABCDEFG,-5,4 100 Kaufling "Substring" FROM 100 DUAL; Weiss 100 Fripp Substring 100 Zlotkey Raphaely CDEF 100 Cambrault 100 Errazuriz Assume a double-byte database character set:. SUBSTRB( ABCDEFG,5, Taylor "Substring 8600 with bytes" FROM 149 DUAL; Hutton Abel Substring 201 with Fay bytes Gietz CD King SYS_CONNECT_BY_PATH sys_connect_by_path::= SYS_CONNECT_BY_PATH ( column, char Functions SYS_CONNECT_BY_PATH is valid only in hierarchical queries. It returns the path of a column value from root to node, with column values separated by char for each row returned by CONNECT BY condition. Functions TRUNC (number SYS_CONTEXT TRUNC (number TRUNC Both column and char can be any of the datatypes CHAR, VARCHAR2, NCHAR, or NVARCHAR2. The string returned is of VARCHAR2 datatype and is in the same character set as column. The following example returns the path of employee names from employee Kochhar to all employees of Kochhar (and their employees: LPAD(, 2*level-1 SYS_CONNECT_BY_PATH(last_name, / "Path" START WITH last_name = Kochhar CONNECT BY PRIOR employee_id = manager_id; Path /Kochhar /Kochhar/Greenberg /Kochhar/Greenberg/Faviet /Kochhar/Greenberg/Chen /Kochhar/Greenberg/Sciarra /Kochhar/Greenberg/Urman /Kochhar/Greenberg/Popp /Kochhar/Whalen /Kochhar/Mavris /Kochhar/Baer /Kochhar/Higgins /Kochhar/Higgins/Gietz sys_context::= trunc_number::= See Also: "Hierarchical Queries" on page 8-3 for more information about hierarchical queries and CONNECT BY conditions, m TRUNC ( n SYS_CONTEXT ( namespace, parameter Oracle9i SQL Reference The following example truncate numbers: TRUNC (date, length The TRUNC (number function returns n truncated to m decimal places. If m is omitted, then n is truncated to 0 places. m can be negative to truncate (make zero m digits left of the decimal point. TRUNC(15.79,1 "Truncate" FROM DUAL; Truncate TRUNC(15.79,-1 "Truncate" FROM DUAL; Truncate trunc_date::= TRUNC ( date, fmt

6 USER USER USERENV Upper LARGE user::= USER If USER two returns or more the tables name have of the some session column user names (the user in common, who logged then on you with must the qualify column datatype names VARCHAR2. with names Oracle of compares tables. Otherwise, values of this fully function qualified with column blank-padded names are optional. comparison However, semantics. it is always a good idea to qualify table and column references explicitly. Oracle often does less work with fully qualified table and column names. In a distributed SQL statement, the UID and USER functions identify the user on You your can local use database. a column You alias, cannot c_alias, use these to label functions the preceding in the condition expression Functions of a in CHECK the select list constraint. so that the column is displayed with a new heading. The alias effectively renames the select list item for the duration of the query. The alias can be used in the ORDER BY clause, but not other clauses in the query. You The following can use comments example in returns a the current statement user to and pass the instructions, user s UID: or hints, to the Oracle optimizer. The optimizer uses hints to choose an execution plan for the statement. USER, UID FROM DUAL; See Also: "Hints" on page 2-91 and Oracle9i Database Performance 8USERENV SQL Queries and Subqueries Tuning Guide and Reference for more information on hints Hierarchical Queries Hierarchical Queries userenv::= If a table contains hierarchical data, then you can select rows in a hierarchical order using USERENV the hierarchical ( parameter query clause: hierarchical_query_clause::= START WITH condition CONNECT BY condition Note: USERENV is a legacy function that is retained for backward compatibility. Oracle Corporation recommends that you use the START WITH specifies the root row(s of the hierarchy. SYS_CONTEXT function with the built-in USERENV namespace for CONNECT current BY functionality. specifies the See relationship SYS_CONTEXT between on parent page rows and for more child rows of the hierarchy. information. In a hierarchical query, one expression in condition must be qualified with the PRIOR operator to refer to the parent row. For example, USERENV PRIOR returns expr information = expr about the current session. This information can be or useful for writing an application-specific audit trail table or for determining the expr = PRIOR expr language-specific characters currently used by your session. You cannot use USERENV If the CONNECT in the condition BY condition of a CHECK is constraint. compound, Table then 6 3 only describes one condition the values requires for the the parameter PRIOR operator. argument. For example: All calls CONNECT to USERENV BY last_name return VARCHAR2!= King data AND except PRIOR for employee_id calls with the = SESSIONID, manager_id ENTRYID, and COMMITSCN parameters, which return NUMBER. In addition, the CONNECT BY condition cannot contain a subquery. Hierarchical Queries 8-4 Oracle9i SQL Reference PRIOR is a unary operator and has the same precedence as the unary + and - arithmetic operators. It evaluates the immediately following expression for the parent row of the current row in a hierarchical query. PRIOR is most commonly used when comparing column values with the equality operator. (The PRIOR keyword can be on either side of the operator. PRIOR causes Oracle to use the value of the parent row in the column. Operators other than the equal sign (= are theoretically possible in CONNECT BY clauses. However, the conditions created by these other operators can result in an infinite loop through the possible combinations. In this case Oracle detects the loop at run time and returns an error. The manner in which Oracle processes a WHERE clause (if any in a hierarchical query depends on whether the WHERE clause contains a join: See Also: "" on page 8-5 If the WHERE predicate contains a join, Oracle applies the join predicates before doing the CONNECT BY processing. If the WHERE clause does not contain a join, Oracle applies all predicates other than the CONNECT BY predicates after doing the CONNECT BY processing without affecting the other rows of the hierarchy. Oracle uses the information from the hierarchical query clause to form the hierarchy using the following steps: 1. Oracle processes the WHERE clause either before or after the CONNECT BY clause depending on whether the WHERE clause contains any join predicates (as described in the preceding bullet list. 2. Oracle selects the root row(s of the hierarchy those rows that satisfy the START WITH condition. 3. Oracle selects the child rows of each root row. Each child row must satisfy the condition of the CONNECT BY condition with respect to one of the root rows. 4. Oracle selects successive generations of child rows. Oracle first selects the children of the rows returned in step 3, and then the children of those children, and so on. Oracle always selects children by evaluating the CONNECT BY condition with respect to a current parent row. 5. If the query contains a WHERE clause without a join, then Oracle eliminates all rows from the hierarchy that do not satisfy the condition of the WHERE clause. Oracle evaluates this condition for each row individually, rather than removing all the children of a row that does not satisfy the condition Oracle9i SQL Reference SQL Queries and Subqueries 8-3 6

7 Hierarchical Queries Hierarchical Queries 6. Oracle returns the rows in the order shown in Figure 8 1. In the diagram, children appear below their parents. For an explanation of hierarchical trees, see Figure 2 1, "Hierarchical Tree" on page Figure 8 1 Hierarchical Queries ROOT To find the children of a parent row, Oracle evaluates the PRIOR expression of the CONNECT BY condition for the parent row and the other expression for each row in the table. Rows for which the condition is true are the children of the parent. The CONNECT BY condition can contain other conditions to further filter the rows selected by the query. The CONNECT BY condition cannot contain a subquery. If the CONNECT BY condition results in a loop in the hierarchy, then Oracle returns an error. A loop occurs if one row is both the parent (or grandparent or direct ancestor and a child (or a grandchild or a direct descendent of another row. Note: In a hierarchical query, do not specify either ORDER BY or GROUP BY, as they will destroy the hierarchical order of the CONNECT BY results. If you want to order rows of siblings of the same parent, then use the ORDER SIBLINGS BY clause. See order_ by_clause on page The following hierarchical query uses the CONNECT BY clause to define the relationship between employees and managers: employee_id, last_name, manager_id CONNECT BY PRIOR employee_id = manager_id; EMPLOYEE_ID LAST_NAME MANAGER_ID Kochhar Greenberg Faviet Chen Sciarra Urman Popp Whalen 101. The next example is similar to the preceding example, but uses the LEVEL pseudocolumn to show parent and child rows: employee_id, last_name, manager_id, LEVEL CONNECT BY PRIOR employee_id = manager_id; EMPLOYEE_ID LAST_NAME MANAGER_ID LEVEL Kochhar Greenberg Faviet Chen Sciarra Urman Popp Finally, the next example adds a START WITH clause to specify a root row for the hierarchy, and an ORDER BY clause using the SIBLINGS keyword to preserve ordering within the hierarchy: last_name, employee_id, manager_id, LEVEL START WITH employee_id = 100 CONNECT BY PRIOR employee_id = manager_id ORDER SIBLINGS BY last_name; SQL Queries and Subqueries Oracle9i SQL Reference 7

8 The UNION [ALL], INTERSECT, MINUS Operators Joins LAST_NAME EMPLOYEE_ID MANAGER_ID LEVEL King Cambrault Sorting Query ResultsBates Bloom Fox Kumar Ozer Sorting Query Results Smith De Use Haan the ORDER BY clause to order the rows 102 selected by a 100 query. Sorting 2by position Hunold is useful in the following cases: Austin Ernst To order by a lengthy select list expression, 104 you can 103 specify its position, 4 rather Lorentz than duplicate the entire expression, in 107 the ORDER BY 103 clause. 4 Pataballa For compound queries (containing set operators UNION, INTERSECT, MINUS, or Errazuriz Ande UNION ALL, the ORDER BY clause must 166 use positions, 147 rather than explicit 3 Banda expressions. Also, the ORDER BY clause 167 can appear 147 only in the last component 3 query. The ORDER BY clause orders all rows returned by the entire compound query. See Also: The mechanism by which Oracle sorts values for the ORDER BY clause is specified either explicitly LEVEL by the on NLS_SORT page 2-86 for initialization a discussion parameter of how the or LEVEL implicitly by the NLS_ LANGUAGE initialization pseudocolumn parameter. operates You in a can hierarchical change the query sort mechanism dynamically from one linguistic sort sequence to another using the ALTER SESSION SYS_CONNECT_BY_PATH on page for information on statement. You can also specify a specific sort sequence for a single query by using retrieving the path of column values from root to node the NLSSORT function with the NLS_SORT parameter in the ORDER BY clause. order_by_clause on page for more information on the See SIBLINGS Also: Oracle9i keyword Database of ORDER Globalization BY clauses Support Guide for information on the NLS parameters The UNION [ALL], INTERSECT, MINUS Operators Joins You can combine multiple queries using the set operators UNION, UNION ALL, INTERSECT, A join is a query and that MINUS. combines All set rows operators from have two or equal more precedence. tables, views, If a or SQL statement materialized contains views. multiple Oracle performs set operators, a join then whenever Oracle multiple evaluates tables them appear from the in the left to query s right if FROM no parentheses clause. The explicitly query s select specify list another can select order. any columns from any of these tables. If any two of these tables have a column name in common, then you The must corresponding qualify all references expressions to these in the columns select lists throughout of the component the query with queries table of a names compound to avoid ambiguity. query must match in number and datatype. If component queries select character data, then the datatype of the return values are determined as follows: Join If Conditions both queries select values of datatype CHAR, then the returned values have Most datatype join queries CHAR. contain WHERE clause conditions that compare two columns, each from a different table. Such a condition is called a join condition. To execute a join, Oracle combines pairs of rows, each containing one row from each table, for which the join condition evaluates to TRUE. The columns in the join conditions need not also appear in the select list. SQL Queries and Subqueries 8-7 To execute a join of three or more tables, Oracle first joins two of the tables based on the join conditions comparing their columns and then joins the result to another table based on join conditions containing columns of the joined tables and the new table. Oracle continues this process until all tables are joined into the result. The optimizer determines the order in which Oracle joins tables based on the join conditions, indexes on the tables, and, in the case of the cost-based optimization approach, statistics for the tables. In addition to join conditions, the WHERE clause of a join query can also contain other conditions that refer to columns of only one table. These conditions can further restrict the rows returned by the join query. Note: You cannot specify LOB columns in the WHERE clause if the WHERE clause contains any joins. The use of LOBs in WHERE clauses is also subject to other restrictions. See Oracle9i Application Developer s Guide - Large Objects (LOBs for more information. Equijoins An equijoin is a join with a join condition containing an equality operator. An equijoin combines rows that have equivalent values for the specified columns. Depending on the internal algorithm the optimizer chooses to execute the join, the total size of the columns in the equijoin condition in a single table may be limited to the size of a data block minus some overhead. The size of a data block is specified by the initialization parameter DB_BLOCK_SIZE. See Also: "Using Join Queries: " on page Self Joins A self join is a join of a table to itself. This table appears twice in the FROM clause and is followed by table aliases that qualify column names in the join condition. To perform a self join, Oracle combines and returns rows of the table that satisfy the join condition. See Also: "Using Self Joins: Example" on page Cartesian Products If two tables in a join query have no join condition, then Oracle returns their Cartesian product. Oracle combines each row of one table with each row of the other. A Cartesian product always generates many rows and is rarely useful. For example, the Cartesian product of two tables, each with 100 rows, has 10,000 rows. Always include a join condition unless you specifically need a Cartesian product. If a query joins three or more tables and you do not specify a join condition for a SQL Queries and Subqueries Oracle9i SQL Reference 8

9 Joins Using Subqueries 8-12 Oracle9i SQL Reference specific pair, then the optimizer may choose a join order that avoids producing an intermediate Cartesian product. Inner Joins An inner join (sometimes called a "simple join" is a join of two or more tables that returns only those rows that satisfy the join condition. Outer Joins An outer join extends the result of a simple join. An outer join returns all rows that satisfy the join condition and also returns some or all of those rows from one table for which no rows from the other satisfy the join condition. To write a query that performs an outer join of tables A and B and returns all rows from A (a left outer join, use the LEFT [OUTER] JOIN syntax in the FROM clause, or apply the outer join operator (+ to all columns of B in the join condition in the WHERE clause. For all rows in A that have no matching rows in B, Oracle returns null for any select list expressions containing columns of B. To write a query that performs an outer join of tables A and B and returns all rows from B (a right outer join, use the RIGHT [OUTER] JOIN syntax in the FROM clause, or apply the outer join operator (+ to all columns of A in the join condition in the WHERE clause. For all rows in B that have no matching rows in A, Oracle returns null for any select list expressions containing columns of A. To write a query that performs an outer join and returns all rows from A and B, extended with nulls if they do not satisfy the join condition (a full outer join, use the FULL [OUTER] JOIN syntax in the FROM clause. Oracle Corporation recommends that you use the FROM clause OUTER JOIN syntax rather than the Oracle join operator. Outer join queries that use the Oracle join operator (+ are subject to the following rules and restrictions, which do not apply to the FROM clause join syntax: You cannot specify the (+ operator in a query block that also contains FROM clause join syntax. The (+ operator can appear only in the WHERE clause or, in the context of left-correlation (that is, when specifying the TABLE clause in the FROM clause, and can be applied only to a column of a table or view. If A and B are joined by multiple join conditions, then you must use the (+ operator in all of these conditions. If you do not, then Oracle will return only the rows resulting from a simple join, but without a warning or error to advise you that you do not have the results of an outer join. The (+ operator does not produce an outer join if you specify one table in the outer query and the other table in an inner query. You cannot use the (+ operator to outer-join a table to itself, although self joins are valid. For example, the following statement is not valid: -- The following statement is not valid: employee_id, manager_id WHERE employees.manager_id(+ = employees.employee_id; However, the following self join is valid: e1.employee_id, e1.manager_id, e2.employee_id e1, employees e2 WHERE e1.manager_id(+ = e2.employee_id; The (+ operator can be applied only to a column, not to an arbitrary expression. However, an arbitrary expression can contain one or more columns marked with the (+ operator. A condition containing the (+ operator cannot be combined with another condition using the OR logical operator. A condition cannot use the IN comparison condition to compare a column marked with the (+ operator with an expression. A condition cannot compare any column marked with the (+ operator with a subquery. If the WHERE clause contains a condition that compares a column from table B with a constant, then the (+ operator must be applied to the column so that Oracle returns the rows from table A for which it has generated nulls for this column. Otherwise Oracle will return only the results of a simple join. Selecting from the DUAL In a Table query that performs outer joins of more than two pairs of tables, a single table can be the null-generated table for only one other table. For this reason, you cannot apply the (+ operator to columns of B in the join condition for A and B and the join condition for B and C. You can unnest other subqueries by specifying the UNNEST hint in the subquery. See See Also: Also: Chapter 2, on "Basic page 18-4 Elements for the of syntax Oracle for SQL" an for outer join information on hints Using Subqueries from the DUAL Table Selecting from the DUAL Table A subquery answers multiple-part questions. For example, to determine who works DUAL is in a Taylor s table automatically department, created you can by first Oracle use along a subquery with the to determine data dictionary. the DUAL is in the schema of the user SYS, but is accessible by the name DUAL to all users. It has one column, DUMMY, defined to be VARCHAR2(1, and contains one row with a value X. Selecting from the DUAL table is useful for computing a constant expression with the statement. Because SQL Queries DUAL has and only Subqueries one row, 8-13 the constant is returned only once. Alternatively, you can select a constant, pseudocolumn, or expression from any table, but the value will be returned as many times as there are rows in the table. Distributed Queries See Also: "SQL Functions" on page 6-2 for many examples of selecting a constant value from DUAL Oracle s distributed database management system architecture lets you access data in remote databases using Oracle Net and an Oracle server. You can identify a remote table, view, or materialized view by to the end of its name. The dblink must be a complete or partial name for a database link to the database containing the remote table, view, or materialized view. 9 See Also: "Referring to Objects in Remote Databases" on page for more information on referring to database links Oracle9i Net Services Administrator s Guide for information on accessing remote databases

10 FROM ORDER table_reference SIBLINGS c_alias 18 SQL Statements: SAVEPOINT to UPDATE for_update_clause::= HAVING, condition INTERSECT MINUS ( subquery order_by_clause Subquery Factoring (subquery_factoring_clause::= Clause on page 18-5, select_list::= on schema. page 18-6, table_reference::= on tablepage 18-6, hierarchical_query_. clause::= on page 18-8, group_by_clause::= view on page 18-9, order_by_ clause::= OF on page column subquery_factoring_clause::= FOR UPDATE NOWAIT WITH WAIT query_name integer AS ( subquery Semantics where_clause hierarchical_query_clause ASC NULLS group_by_clause FIRST expr DESC NULLS LAST BY position ALL UNION, Restrictions on the FOR UPDATE Clause You cannot specify this clause with the following other constructs: the subquery_factoring_clause DISTINCT operator, CURSOR expression, set operators, group_by_clause, or aggregate functions. The subquery_factoring_clause (WITH query_name lets you assign names to subquery The tables blocks. locked You by can this then clause reference must SQL all the Statements: be subquery located on SAVEPOINT block the same multiple to database, UPDATE places and in18-5 the query on the by same specifying database the as query any LONG name. columns Oracle and optimizes sequences the query referenced by treating the the query same name statement. as either an inline view or as a temporary table. You can See specify Also: this "Using clause in the any FOR top-level UPDATE Clause: statement " and onin most types of subqueries. pagethe query name is visible to all subsequent subqueries (except the subquery that defines the query name itself and to the main query. OF column Restrictions on Subquery Factoring Use the OF column clause to lock the select rows only for a particular table or view You in a cannot join. The nest columns this clause. in the That OF is, clause you only cannot indicate specify which the subquery_ table or view rows are locked. factoring_clause The specific columns as a subquery that you within specify another are subquery_factoring_ significant. However, you must clause. specify an actual column name, not a column alias. If you omit this clause, then In Oracle a query locks with the set selected operators, rows the from set all operator the tables subquery in the cannot query. contain the subquery_factoring_clause, but the FROM subquery can contain the NOWAIT subquery_factoring_clause. WAIT The NOWAIT and WAIT clauses let you tell Oracle how to proceed if the statement See attempts Also: to lock a row that is locked by another user Oracle9i SQL Reference Oracle9i Database Concepts for information about inline views NOWAIT Specify NOWAIT to return control to you immediately if a lock exists. Oracle9i Data Warehousing Guide and Oracle9i Application WAIT Specify Developer s WAIT to Guide instruct - Fundamentals Oracle to wait for integer information seconds using for the therow to become available, subquery and factoring then return feature control to you. If you specify "Subquery neither WAIT Factoring: nor NOWAIT, Example" thenon Oracle page waits until the row is available and then returns the results of the statement. hint Specify a comment that passes instructions to the optimizer on choosing an execution plan for the statement. Subquery Factoring: Example The following statement creates the query names dept_costs See Also: and avg_cost "Hints" on for page the 2-91 initial and query Oracle9i block Database containing Performance a join, and then uses the Tuning query names Guide and in the Reference body of for the the main syntax query. and description of hints, DISTINCT WITH UNIQUE dept_costs AS ( Specify DISTINCT department_name, or UNIQUE if you SUM(salary want Oracle to dept_total return only one copy of each set of duplicate FROM rows employees selected e, (these departments two keywords d are synonymous. Duplicate rows are those WHERE with e.department_id matching values for = d.department_id each expression in the select list. Restrictions on DISTINCT and UNIQUE Queries When you specify DISTINCT or UNIQUE, the total number of bytes in all select list expressions is limited to the size SQL of a Statements: data block SAVEPOINT minus some to overhead. UPDATE This size is specified by the initialization parameter DB_BLOCK_SIZE. You cannot specify DISTINCT if the select_list contains LOB columns. ALL Specify ALL if you want Oracle to return all rows selected, including all copies of hierarchical_query_clause::= Oracle9i SQL Reference GROUP BY department_name, avg_cost AS ( SUM(dept_total/COUNT(* avg FROM dept_costs * FROM dept_costs WHERE dept_total > ( avg FROM avg_cost ORDER BY department_name; DEPARTMENT_NAME DEPT_TOTAL Sales Shipping Simple Query The following statement selects rows from the employees table with the department number of 30: Joined Table joined_table::= table_reference join_type where_clause::= 18-8 Oracle9i SQL Reference * WHERE department_id = 30; The following statement selects the name, job, salary and department number of all employees except purchase clerks from department number 30: last_name, job_id, salary, department_id ON condition JOIN WHERE table_reference NOT (job_id = PU_CLERK AND, department_id = 30; The following statement selects USING from ( subqueries column in the FROM clause and gives CROSS JOIN departments total employees and salaries as a decimal value of all the departments: a.department_id "Department", join_type table_reference a.num_emp/b.total_count "%_Employees", NATURAL JOIN a.sal_sum/b.total_sal "%_Salary" FROM ( (table_reference::= department_id, on COUNT(* page 18-6 num_emp, SUM(salary sal_sum join_type::= GROUP BY department_id a, INNER ( COUNT(* total_count, SUM(salary total_sal b; LEFT OUTER RIGHT Selecting from a Partition: Example You can select rows from a single partition of FULL a partitioned table by specifying the keyword PARTITION in the FROM clause. This WHERE condition START WITH condition CONNECT BY condition

11 Note: This alias is required if the query_table_expr_clause references any object type attributes or object type methods. Semantics Oracle9i SQL Reference joined_table Use the joined_table syntax to identify tables that are part of a join from which to select data. join_type The join_type indicates the kind of join being performed: Specify INNER to indicate explicitly that an inner join is being performed. This is the default. Specify RIGHT to indicate a right outer join. See Also: "Using Correlated Subqueries: " on page See Also: "Joins" on page 8-10 for more information on joins, "Using Join Queries: " on page 18-34, "Using Self Joins: Example" on page 18-36, and "Using Outer Joins: " on page Specify LEFT to indicate a left outer join. Specify FULL to indicate a full or two-sided outer join. In addition to the inner join, rows from both tables that have not been returned in the result of the inner join will be preserved and extended with nulls. You can specify the optional OUTER keyword following RIGHT, LEFT, or FULL to explicitly clarify that an outer join is being performed. JOIN The JOIN keyword explicitly states that a join is being performed. You can use this syntax to replace the comma-delimited table expressions used in WHERE clause joins with FROM clause join syntax. ON condition Use the ON clause to specify a join condition. Doing so lets you specify join conditions separate from any search or filter conditions in the WHERE clause. USING column When you are specifying an equijoin of columns that have the same name in both tables, the USING column clause indicates the columns to be used. You can use this clause only if the join columns in both tables have the same name. Do not qualify the column name with a table name or table alias. In an outer join with the USING clause, the query returns a single column which is a coalesce of the two matching columns in the join. The coalesce functions as follows: COALESCE (a, b = a if a NOT NULL, else b. Therefore: A left outer join returns all the common column values from the left table in the FROM clause. A right outer join returns all the common column values from the right table in the FROM clause. A full outer join returns all the common column values from both joined tables. Restriction on Columns Used in Joins You cannot specify a LOB column or a collection column in the USING column clause. To give all See employees Also: "Using in the Outer employees Joins: " table a 10% on raise page if they have changed jobs (that is, if they appear in the job_history table, issue the following statement: CROSS UPDATE JOIN employees The CROSS keyword indicates that a cross join is being performed. A cross SET join salary produces = the salary cross-product * 1.1 of two relations and is essentially the same as the comma-delimited WHERE employee_id Oracle IN notation. ( employee_id FROM job_history; NATURAL To create a JOIN second The version NATURAL of thekeyword departments indicates table that new_departments, a natural join is being with performed. only three of A the natural columns join of is based the original on all table, columns issue in the following two tables statement: that have the same CREATE name. TABLE It selects new_departments rows from the two tables that have equal values in the relevant (department_id, columns. Whendepartment_name, specifying columnslocation_id that are involved in the natural join, do not AS qualify the column department_id, name with department_name, a table name or table location_id alias. FROM departments; Using Self Note: Joins: On Example occasion, the The table following pairings query in natural uses a self or cross join joins to return may the name of be each ambiguous. employee For along example: with the name of the employee s manager. (A WHERE clause is added a NATURAL to shorten LEFT the JOIN output. b LEFT JOIN c ON b.c1 = c.c1 e1.last_name works for e2.last_name "Employees can be interpreted and Their in either Managers" of the following ways: e1, employees e2 a NATURAL LEFT JOIN (b LEFT JOIN c ON b.c1 = c.c1 WHERE e1.manager_id = e2.employee_id (a NATURAL LEFT JOIN b LEFT JOIN c ON b.c1 = c.c1 AND e1.last_name LIKE R% ; Employees To avoid and Their this ambiguity, Managers you can use parentheses to specify the pairings of joined tables. In the absence of such parentheses, Oracle Rajs works uses left for associativity, Mourgos pairing the tables from left to right. Raphaely works for King Restriction Rogers works on Natural for Kaufling Joins You cannot specify a LOB column, columns of AnyType, Russell works AnyData, for or King AnyDataSet, or a collection column as part of a natural join. The join condition for this query uses the aliases e1 and e2 for the sample table SQL Statements: SAVEPOINT to UPDATE employees: where_clause The e1.manager_id WHERE condition = e2.employee_id lets you restrict the rows selected to those that satisfy one or more conditions. For condition, specify any valid SQL condition. Using Outer Joins: The following example uses a left outer join to If return you omit the names this clause, of all departments then Oracle returns in the sample all rows schema from the hr, tables, even if views, no employees or materialized have been assigned views in to the FROM departments: clause. d.department_id, e.last_name FROM Note: departments If this clause d LEFT refers OUTER to a DATE JOIN column employees of a partitioned e table ON d.department_id or index, then Oracle = e.department_id performs partition pruning only if (1 you ORDER created BY d.department_id; the table or index partitions by fully specifying the year using the TO_DATE function with a 4-digit format mask, and (2 you specify the date in the query s where_clause using the TO_DATE function and either a 2- or 4-digit format mask Oracle9i SQL Reference See Also: Chapter 5, "Conditions" for the syntax description of condition "Selecting from a Partition: Example" on page 18-28

12 DEPARTMENT_ID LAST_NAME Whalen 20 Hartstein 20 Fay 30 Raphaely Users familiar with the traditional Oracle outer joins syntax will recognize the same query in this form: d.department_id, e.last_name FROM departments d, employees e WHERE d.department_id = e.department_id(+ ORDER BY d.department_id; Oracle Corporation strongly recommends that you use the more flexible Oracle9i FROM clause join syntax shown in the former example. The left outer join returns all departments, including those without any employees. The same statement with a right outer join returns all employees, including those not yet assigned to a department: Note: The employee Zeuss was added to the employees table for these examples, and is not part of the sample data. d.department_id, e.last_name FROM departments d RIGHT OUTER JOIN employees e ON d.department_id = e.department_id ORDER BY d.department_id; DEPARTMENT_ID LAST_NAME Higgins 110 Gietz Grant Zeuss It is not clear from this result whether employees Grant and Zeuss have department_id NULL, or whether their department_id is not in the departments table. To determine this requires a full outer join: d.department_id as d_dept_id, e.department_id as e_dept_id, e.last_name FROM departments d FULL OUTER JOIN employees e ON d.department_id = e.department_id ORDER BY d.department_id; D_DEPT_ID E_DEPT_ID LAST_NAME Gietz Higgins Zeuss Grant Because the column names in this example are the same in both tables in the join, you can also use the common column feature (the USING clause of the join syntax, which coalesces the two matching columns department_id. The output is the same as for the preceding example: department_id AS d_e_dept_id, e.last_name FROM departments d FULL OUTER JOIN employees e USING (department_id ORDER BY department_id; D_E_DEPT_ID LAST_NAME Higgins 110 Gietz Grant Zeuss Table Collections: You can perform DML operations on nested tables only if they are defined as columns of a table. Therefore, when the query_table_ expr_clause of an INSERT, DELETE, or UPDATE statement is a table_ SQL Statements: SAVEPOINT to UPDATE Oracle9i SQL Reference 12

Oracle SQL. Course Summary. Duration. Objectives

Oracle SQL. Course Summary. Duration. Objectives Oracle SQL Course Summary Identify the major structural components of the Oracle Database 11g Create reports of aggregated data Write SELECT statements that include queries Retrieve row and column data

More information

Displaying Data from Multiple Tables. Copyright 2006, Oracle. All rights reserved.

Displaying Data from Multiple Tables. Copyright 2006, Oracle. All rights reserved. Displaying Data from Multiple Tables Objectives After completing this lesson, you should be able to do the following: Write SELECT statements to access data from more than one table using equijoins and

More information

Displaying Data from Multiple Tables

Displaying Data from Multiple Tables 4 Displaying Data from Multiple Tables Copyright Oracle Corporation, 2001. All rights reserved. Schedule: Timing Topic 55 minutes Lecture 55 minutes Practice 110 minutes Total Objectives After completing

More information

Where? Originating Table Employees Departments

Where? Originating Table Employees Departments JOINS: To determine an employee s department name, you compare the value in the DEPARTMENT_ID column in the EMPLOYEES table with the DEPARTMENT_ID values in the DEPARTMENTS table. The relationship between

More information

Oracle Database: SQL and PL/SQL Fundamentals

Oracle Database: SQL and PL/SQL Fundamentals Oracle University Contact Us: 1.800.529.0165 Oracle Database: SQL and PL/SQL Fundamentals Duration: 5 Days What you will learn This course is designed to deliver the fundamentals of SQL and PL/SQL along

More information

Oracle Database: SQL and PL/SQL Fundamentals

Oracle Database: SQL and PL/SQL Fundamentals Oracle University Contact Us: +966 12 739 894 Oracle Database: SQL and PL/SQL Fundamentals Duration: 5 Days What you will learn This Oracle Database: SQL and PL/SQL Fundamentals training is designed to

More information

Oracle Database 12c: Introduction to SQL Ed 1.1

Oracle Database 12c: Introduction to SQL Ed 1.1 Oracle University Contact Us: 1.800.529.0165 Oracle Database 12c: Introduction to SQL Ed 1.1 Duration: 5 Days What you will learn This Oracle Database: Introduction to SQL training helps you write subqueries,

More information

Oracle Database: SQL and PL/SQL Fundamentals NEW

Oracle Database: SQL and PL/SQL Fundamentals NEW Oracle University Contact Us: + 38516306373 Oracle Database: SQL and PL/SQL Fundamentals NEW Duration: 5 Days What you will learn This Oracle Database: SQL and PL/SQL Fundamentals training delivers the

More information

Displaying Data from Multiple Tables. Copyright 2004, Oracle. All rights reserved.

Displaying Data from Multiple Tables. Copyright 2004, Oracle. All rights reserved. Displaying Data from Multiple Tables Copyright 2004, Oracle. All rights reserved. Objectives After completing this lesson, you should be able to do the following: Write SELECT statements to access data

More information

Duration Vendor Audience 5 Days Oracle End Users, Developers, Technical Consultants and Support Staff

Duration Vendor Audience 5 Days Oracle End Users, Developers, Technical Consultants and Support Staff D80198GC10 Oracle Database 12c SQL and Fundamentals Summary Duration Vendor Audience 5 Days Oracle End Users, Developers, Technical Consultants and Support Staff Level Professional Delivery Method Instructor-led

More information

Displaying Data from Multiple Tables. Copyright 2004, Oracle. All rights reserved.

Displaying Data from Multiple Tables. Copyright 2004, Oracle. All rights reserved. Displaying Data from Multiple Tables Objectives After completing this lesson, you should be able to do the following: Write SELECT statements to access data from more than one table using equijoins and

More information

Programming with SQL

Programming with SQL Unit 43: Programming with SQL Learning Outcomes A candidate following a programme of learning leading to this unit will be able to: Create queries to retrieve information from relational databases using

More information

MOC 20461C: Querying Microsoft SQL Server. Course Overview

MOC 20461C: Querying Microsoft SQL Server. Course Overview MOC 20461C: Querying Microsoft SQL Server Course Overview This course provides students with the knowledge and skills to query Microsoft SQL Server. Students will learn about T-SQL querying, SQL Server

More information

Oracle Database 11g SQL

Oracle Database 11g SQL AO3 - Version: 2 19 June 2016 Oracle Database 11g SQL Oracle Database 11g SQL AO3 - Version: 2 3 days Course Description: This course provides the essential SQL skills that allow developers to write queries

More information

Oracle Database 10g: Introduction to SQL

Oracle Database 10g: Introduction to SQL Oracle University Contact Us: 1.800.529.0165 Oracle Database 10g: Introduction to SQL Duration: 5 Days What you will learn This course offers students an introduction to Oracle Database 10g database technology.

More information

GET DATA FROM MULTIPLE TABLES QUESTIONS

GET DATA FROM MULTIPLE TABLES QUESTIONS GET DATA FROM MULTIPLE TABLES QUESTIONS http://www.tutorialspoint.com/sql_certificate/get_data_from_multiple_tables_questions.htm Copyright tutorialspoint.com 1.Which of the following is not related to

More information

Oracle Database: SQL and PL/SQL Fundamentals NEW

Oracle Database: SQL and PL/SQL Fundamentals NEW Oracle University Contact Us: 001-855-844-3881 & 001-800-514-06-97 Oracle Database: SQL and PL/SQL Fundamentals NEW Duration: 5 Days What you will learn This Oracle Database: SQL and PL/SQL Fundamentals

More information

3.GETTING STARTED WITH ORACLE8i

3.GETTING STARTED WITH ORACLE8i Oracle For Beginners Page : 1 3.GETTING STARTED WITH ORACLE8i Creating a table Datatypes Displaying table definition using DESCRIBE Inserting rows into a table Selecting rows from a table Editing SQL buffer

More information

Oracle Database: Introduction to SQL

Oracle Database: Introduction to SQL Oracle University Contact Us: +381 11 2016811 Oracle Database: Introduction to SQL Duration: 5 Days What you will learn Understanding the basic concepts of relational databases ensure refined code by developers.

More information

Database Programming with PL/SQL: Learning Objectives

Database Programming with PL/SQL: Learning Objectives Database Programming with PL/SQL: Learning Objectives This course covers PL/SQL, a procedural language extension to SQL. Through an innovative project-based approach, students learn procedural logic constructs

More information

Oracle Database: Introduction to SQL

Oracle Database: Introduction to SQL Oracle University Contact Us: 1.800.529.0165 Oracle Database: Introduction to SQL Duration: 5 Days What you will learn View a newer version of this course This Oracle Database: Introduction to SQL training

More information

Oracle Database: Introduction to SQL

Oracle Database: Introduction to SQL Oracle University Contact Us: 1.800.529.0165 Oracle Database: Introduction to SQL Duration: 5 Days What you will learn This Oracle Database: Introduction to SQL training teaches you how to write subqueries,

More information

CHAPTER 12. SQL Joins. Exam Objectives

CHAPTER 12. SQL Joins. Exam Objectives CHAPTER 12 SQL Joins Exam Objectives In this chapter you will learn to 051.6.1 Write SELECT Statements to Access Data from More Than One Table Using Equijoins and Nonequijoins 051.6.2 Join a Table to Itself

More information

Retrieving Data Using the SQL SELECT Statement. Copyright 2006, Oracle. All rights reserved.

Retrieving Data Using the SQL SELECT Statement. Copyright 2006, Oracle. All rights reserved. Retrieving Data Using the SQL SELECT Statement Objectives After completing this lesson, you should be able to do the following: List the capabilities of SQL SELECT statements Execute a basic SELECT statement

More information

Topics Advanced PL/SQL, Integration with PROIV SuperLayer and use within Glovia

Topics Advanced PL/SQL, Integration with PROIV SuperLayer and use within Glovia Topics Advanced PL/SQL, Integration with PROIV SuperLayer and use within Glovia 1. SQL Review Single Row Functions Character Functions Date Functions Numeric Function Conversion Functions General Functions

More information

Appendix A Practices and Solutions

Appendix A Practices and Solutions Appendix A Practices and Solutions Table of Contents Practices for Lesson I... 3 Practice I-1: Introduction... 4 Practice Solutions I-1: Introduction... 5 Practices for Lesson 1... 11 Practice 1-1: Retrieving

More information

Information and Computer Science Department ICS 324 Database Systems Lab#11 SQL-Basic Query

Information and Computer Science Department ICS 324 Database Systems Lab#11 SQL-Basic Query Information and Computer Science Department ICS 324 Database Systems Lab#11 SQL-Basic Query Objectives The objective of this lab is to learn the query language of SQL. Outcomes After completing this Lab,

More information

SECTION 3 LESSON 1. Destinations: What s in My Future?

SECTION 3 LESSON 1. Destinations: What s in My Future? SECTION 3 LESSON 1 Destinations: What s in My Future? What Will I Learn? In this lesson, you will learn to: Document a plan where training/education can be obtained to pursue career choices Formulate a

More information

Netezza SQL Class Outline

Netezza SQL Class Outline Netezza SQL Class Outline CoffingDW education has been customized for every customer for the past 20 years. Our classes can be taught either on site or remotely via the internet. Education Contact: John

More information

Instant SQL Programming

Instant SQL Programming Instant SQL Programming Joe Celko Wrox Press Ltd. INSTANT Table of Contents Introduction 1 What Can SQL Do for Me? 2 Who Should Use This Book? 2 How To Use This Book 3 What You Should Know 3 Conventions

More information

Guide to SQL Programming: SQL:1999 and Oracle Rdb V7.1

Guide to SQL Programming: SQL:1999 and Oracle Rdb V7.1 Guide to SQL Programming: SQL:1999 and Oracle Rdb V7.1 A feature of Oracle Rdb By Ian Smith Oracle Rdb Relational Technology Group Oracle Corporation 1 Oracle Rdb Journal SQL:1999 and Oracle Rdb V7.1 The

More information

RECURSIVE COMMON TABLE EXPRESSIONS DATABASE IN ORACLE. Iggy Fernandez, Database Specialists INTRODUCTION

RECURSIVE COMMON TABLE EXPRESSIONS DATABASE IN ORACLE. Iggy Fernandez, Database Specialists INTRODUCTION RECURSIVE COMMON TABLE EXPRESSIONS IN ORACLE DATABASE 11G RELEASE 2 Iggy Fernandez, Database Specialists INTRODUCTION Oracle was late to the table with recursive common table expressions which have been

More information

Oracle 10g PL/SQL Training

Oracle 10g PL/SQL Training Oracle 10g PL/SQL Training Course Number: ORCL PS01 Length: 3 Day(s) Certification Exam This course will help you prepare for the following exams: 1Z0 042 1Z0 043 Course Overview PL/SQL is Oracle's Procedural

More information

Querying Microsoft SQL Server

Querying Microsoft SQL Server Course 20461C: Querying Microsoft SQL Server Module 1: Introduction to Microsoft SQL Server 2014 This module introduces the SQL Server platform and major tools. It discusses editions, versions, tools used

More information

SQL Server. 2012 for developers. murach's TRAINING & REFERENCE. Bryan Syverson. Mike Murach & Associates, Inc. Joel Murach

SQL Server. 2012 for developers. murach's TRAINING & REFERENCE. Bryan Syverson. Mike Murach & Associates, Inc. Joel Murach TRAINING & REFERENCE murach's SQL Server 2012 for developers Bryan Syverson Joel Murach Mike Murach & Associates, Inc. 4340 N. Knoll Ave. Fresno, CA 93722 www.murach.com murachbooks@murach.com Expanded

More information

Chapter 5 More SQL: Complex Queries, Triggers, Views, and Schema Modification

Chapter 5 More SQL: Complex Queries, Triggers, Views, and Schema Modification Chapter 5 More SQL: Complex Queries, Triggers, Views, and Schema Modification Copyright 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 5 Outline More Complex SQL Retrieval Queries

More information

Course 20461C: Querying Microsoft SQL Server Duration: 35 hours

Course 20461C: Querying Microsoft SQL Server Duration: 35 hours Course 20461C: Querying Microsoft SQL Server Duration: 35 hours About this Course This course is the foundation for all SQL Server-related disciplines; namely, Database Administration, Database Development

More information

ETL TESTING TRAINING

ETL TESTING TRAINING ETL TESTING TRAINING DURATION 35hrs AVAILABLE BATCHES WEEKDAYS (6.30AM TO 7.30AM) & WEEKENDS (6.30pm TO 8pm) MODE OF TRAINING AVAILABLE ONLINE INSTRUCTOR LED CLASSROOM TRAINING (MARATHAHALLI, BANGALORE)

More information

Course ID#: 1401-801-14-W 35 Hrs. Course Content

Course ID#: 1401-801-14-W 35 Hrs. Course Content Course Content Course Description: This 5-day instructor led course provides students with the technical skills required to write basic Transact- SQL queries for Microsoft SQL Server 2014. This course

More information

DATABASE DESIGN & PROGRAMMING WITH SQL COURSE CODE: 5324

DATABASE DESIGN & PROGRAMMING WITH SQL COURSE CODE: 5324 DATABASE DESIGN & PROGRAMMING WITH SQL COURSE CODE: 5324 COURSE DESCRIPTION: This curriculum is geared to meet the learning needs of a variety of students, from those interested in gaining broad exposure

More information

Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.

Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer. Test: Final Exam Semester 1 Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer. Section 6 1. The following code does not violate any constraints and will

More information

Querying Microsoft SQL Server 20461C; 5 days

Querying Microsoft SQL Server 20461C; 5 days Lincoln Land Community College Capital City Training Center 130 West Mason Springfield, IL 62702 217-782-7436 www.llcc.edu/cctc Querying Microsoft SQL Server 20461C; 5 days Course Description This 5-day

More information

Writing Control Structures

Writing Control Structures Writing Control Structures Copyright 2006, Oracle. All rights reserved. Oracle Database 10g: PL/SQL Fundamentals 5-1 Objectives After completing this lesson, you should be able to do the following: Identify

More information

Handling Exceptions. Copyright 2006, Oracle. All rights reserved. Oracle Database 10g: PL/SQL Fundamentals 8-1

Handling Exceptions. Copyright 2006, Oracle. All rights reserved. Oracle Database 10g: PL/SQL Fundamentals 8-1 Handling Exceptions Copyright 2006, Oracle. All rights reserved. Oracle Database 10g: PL/SQL Fundamentals 8-1 Objectives After completing this lesson, you should be able to do the following: Define PL/SQL

More information

Relational Database: Additional Operations on Relations; SQL

Relational Database: Additional Operations on Relations; SQL Relational Database: Additional Operations on Relations; SQL Greg Plaxton Theory in Programming Practice, Fall 2005 Department of Computer Science University of Texas at Austin Overview The course packet

More information

Lab # 5. Retreiving Data from Multiple Tables. Eng. Alaa O Shama

Lab # 5. Retreiving Data from Multiple Tables. Eng. Alaa O Shama The Islamic University of Gaza Faculty of Engineering Department of Computer Engineering ECOM 4113: Database Lab Lab # 5 Retreiving Data from Multiple Tables Eng. Alaa O Shama November, 2015 Objectives:

More information

Guide to Performance and Tuning: Query Performance and Sampled Selectivity

Guide to Performance and Tuning: Query Performance and Sampled Selectivity Guide to Performance and Tuning: Query Performance and Sampled Selectivity A feature of Oracle Rdb By Claude Proteau Oracle Rdb Relational Technology Group Oracle Corporation 1 Oracle Rdb Journal Sampled

More information

Information Systems SQL. Nikolaj Popov

Information Systems SQL. Nikolaj Popov Information Systems SQL Nikolaj Popov Research Institute for Symbolic Computation Johannes Kepler University of Linz, Austria popov@risc.uni-linz.ac.at Outline SQL Table Creation Populating and Modifying

More information

Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.

Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer. Test: Final Exam - Database Programming with SQL Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer. Section 8 Lesson 1 1. You are creating the EMPLOYEES

More information

Porting from Oracle to PostgreSQL

Porting from Oracle to PostgreSQL by Paulo Merson February/2002 Porting from Oracle to If you are starting to use or you will migrate from Oracle database server, I hope this document helps. If you have Java applications and use JDBC,

More information

www.gr8ambitionz.com

www.gr8ambitionz.com Data Base Management Systems (DBMS) Study Material (Objective Type questions with Answers) Shared by Akhil Arora Powered by www. your A to Z competitive exam guide Database Objective type questions Q.1

More information

How To Create A Table In Sql 2.5.2.2 (Ahem)

How To Create A Table In Sql 2.5.2.2 (Ahem) Database Systems Unit 5 Database Implementation: SQL Data Definition Language Learning Goals In this unit you will learn how to transfer a logical data model into a physical database, how to extend or

More information

Oracle Database 11g SQL and PL/SQL: A Brief Primer

Oracle Database 11g SQL and PL/SQL: A Brief Primer APPENDIX Oracle Database 11g SQL and PL/SQL: A Brief Primer I m sure most of you are already familiar with SQL to some extent. However, I present in this appendix a quick introduction to Oracle Database

More information

A Comparison of Database Query Languages: SQL, SPARQL, CQL, DMX

A Comparison of Database Query Languages: SQL, SPARQL, CQL, DMX ISSN: 2393-8528 Contents lists available at www.ijicse.in International Journal of Innovative Computer Science & Engineering Volume 3 Issue 2; March-April-2016; Page No. 09-13 A Comparison of Database

More information

Introducing Microsoft SQL Server 2012 Getting Started with SQL Server Management Studio

Introducing Microsoft SQL Server 2012 Getting Started with SQL Server Management Studio Querying Microsoft SQL Server 2012 Microsoft Course 10774 This 5-day instructor led course provides students with the technical skills required to write basic Transact-SQL queries for Microsoft SQL Server

More information

Introduction to Microsoft Jet SQL

Introduction to Microsoft Jet SQL Introduction to Microsoft Jet SQL Microsoft Jet SQL is a relational database language based on the SQL 1989 standard of the American Standards Institute (ANSI). Microsoft Jet SQL contains two kinds of

More information

Handling Exceptions. Schedule: Timing Topic 45 minutes Lecture 20 minutes Practice 65 minutes Total

Handling Exceptions. Schedule: Timing Topic 45 minutes Lecture 20 minutes Practice 65 minutes Total Handling Exceptions Schedule: Timing Topic 45 minutes Lecture 20 minutes Practice 65 minutes Total Objectives After completing this lesson, you should be able to do the following: Define PL/SQL exceptions

More information

MOC 20461 QUERYING MICROSOFT SQL SERVER

MOC 20461 QUERYING MICROSOFT SQL SERVER ONE STEP AHEAD. MOC 20461 QUERYING MICROSOFT SQL SERVER Length: 5 days Level: 300 Technology: Microsoft SQL Server Delivery Method: Instructor-led (classroom) COURSE OUTLINE Module 1: Introduction to Microsoft

More information

Querying Microsoft SQL Server Course M20461 5 Day(s) 30:00 Hours

Querying Microsoft SQL Server Course M20461 5 Day(s) 30:00 Hours Área de formação Plataforma e Tecnologias de Informação Querying Microsoft SQL Introduction This 5-day instructor led course provides students with the technical skills required to write basic Transact-SQL

More information

Relational Databases

Relational Databases Relational Databases Jan Chomicki University at Buffalo Jan Chomicki () Relational databases 1 / 18 Relational data model Domain domain: predefined set of atomic values: integers, strings,... every attribute

More information

DBMS / Business Intelligence, SQL Server

DBMS / Business Intelligence, SQL Server DBMS / Business Intelligence, SQL Server Orsys, with 30 years of experience, is providing high quality, independant State of the Art seminars and hands-on courses corresponding to the needs of IT professionals.

More information

Handling Exceptions. Copyright 2008, Oracle. All rights reserved.

Handling Exceptions. Copyright 2008, Oracle. All rights reserved. Handling Exceptions Handling Exceptions What Will I Learn? In this lesson, you will learn to: Describe several advantages of including exception handling code in PL/SQL Describe the purpose of an EXCEPTION

More information

Chapter 9 Joining Data from Multiple Tables. Oracle 10g: SQL

Chapter 9 Joining Data from Multiple Tables. Oracle 10g: SQL Chapter 9 Joining Data from Multiple Tables Oracle 10g: SQL Objectives Identify a Cartesian join Create an equality join using the WHERE clause Create an equality join using the JOIN keyword Create a non-equality

More information

Structured Query Language (SQL)

Structured Query Language (SQL) Objectives of SQL Structured Query Language (SQL) o Ideally, database language should allow user to: create the database and relation structures; perform insertion, modification, deletion of data from

More information

Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.

Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer. est: Final Exam Semester 1 Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer. Section 6 1. How can you retrieve the error code and error message of any

More information

Developing SQL and PL/SQL with JDeveloper

Developing SQL and PL/SQL with JDeveloper Seite 1 von 23 Developing SQL and PL/SQL with JDeveloper Oracle JDeveloper 10g Preview Technologies used: SQL, PL/SQL An Oracle JDeveloper Tutorial September 2003 Content This tutorial walks through the

More information

Course -Oracle 10g SQL (Exam Code IZ0-047) Session number Module Topics 1 Retrieving Data Using the SQL SELECT Statement

Course -Oracle 10g SQL (Exam Code IZ0-047) Session number Module Topics 1 Retrieving Data Using the SQL SELECT Statement Course -Oracle 10g SQL (Exam Code IZ0-047) Session number Module Topics 1 Retrieving Data Using the SQL SELECT Statement List the capabilities of SQL SELECT statements Execute a basic SELECT statement

More information

MS SQL Performance (Tuning) Best Practices:

MS SQL Performance (Tuning) Best Practices: MS SQL Performance (Tuning) Best Practices: 1. Don t share the SQL server hardware with other services If other workloads are running on the same server where SQL Server is running, memory and other hardware

More information

2. Which of the following declarations is invalid? Mark for Review (1) Points

2. Which of the following declarations is invalid? Mark for Review (1) Points Mid Term Exam Semester 1 - Part 1 1. 1. Null 2. False 3. True 4. 0 Which of the above can be assigned to a Boolean variable? 2 and 3 2, 3 and 4 1, 2 and 3 (*) 1, 2, 3 and 4 2. Which of the following declarations

More information

Querying Microsoft SQL Server 2012

Querying Microsoft SQL Server 2012 Course 10774A: Querying Microsoft SQL Server 2012 Length: 5 Days Language(s): English Audience(s): IT Professionals Level: 200 Technology: Microsoft SQL Server 2012 Type: Course Delivery Method: Instructor-led

More information

Oracle Database 10g: SQL Fundamentals I

Oracle Database 10g: SQL Fundamentals I Oracle Database 10g: SQL Fundamentals I Electronic Presentation D17108GC11 Production 1.1 August 2004 D39769 Author Nancy Greenberg Technical Contributors and Reviewers Wayne Abbott Christian Bauwens Perry

More information

Data Tool Platform SQL Development Tools

Data Tool Platform SQL Development Tools Data Tool Platform SQL Development Tools ekapner Contents Setting SQL Development Preferences...5 Execution Plan View Options Preferences...5 General Preferences...5 Label Decorations Preferences...6

More information

SQL SELECT Query: Intermediate

SQL SELECT Query: Intermediate SQL SELECT Query: Intermediate IT 4153 Advanced Database J.G. Zheng Spring 2012 Overview SQL Select Expression Alias revisit Aggregate functions - complete Table join - complete Sub-query in where Limiting

More information

Course 10774A: Querying Microsoft SQL Server 2012

Course 10774A: Querying Microsoft SQL Server 2012 Course 10774A: Querying Microsoft SQL Server 2012 About this Course This 5-day instructor led course provides students with the technical skills required to write basic Transact-SQL queries for Microsoft

More information

Course 10774A: Querying Microsoft SQL Server 2012 Length: 5 Days Published: May 25, 2012 Language(s): English Audience(s): IT Professionals

Course 10774A: Querying Microsoft SQL Server 2012 Length: 5 Days Published: May 25, 2012 Language(s): English Audience(s): IT Professionals Course 10774A: Querying Microsoft SQL Server 2012 Length: 5 Days Published: May 25, 2012 Language(s): English Audience(s): IT Professionals Overview About this Course Level: 200 Technology: Microsoft SQL

More information

2. Which three statements about functions are true? (Choose three.) Mark for Review (1) Points

2. Which three statements about functions are true? (Choose three.) Mark for Review (1) Points 1. Which SQL function can be used to remove heading or trailing characters (or both) from a character string? LPAD CUT NVL2 TRIM (*) 2. Which three statements about functions are true? (Choose three.)

More information

Oracle Database 11g: SQL Tuning Workshop

Oracle Database 11g: SQL Tuning Workshop Oracle University Contact Us: + 38516306373 Oracle Database 11g: SQL Tuning Workshop Duration: 3 Days What you will learn This Oracle Database 11g: SQL Tuning Workshop Release 2 training assists database

More information

Querying Microsoft SQL Server (20461) H8N61S

Querying Microsoft SQL Server (20461) H8N61S HP Education Services course data sheet Querying Microsoft SQL Server (20461) H8N61S Course Overview In this course, you will learn the technical skills required to write basic Transact-SQL (T-SQL) queries

More information

Oracle 12c New Features For Developers

Oracle 12c New Features For Developers Oracle 12c New Features For Developers Presented by: John Jay King Download this paper from: 1 Session Objectives Learn new Oracle 12c features that are geared to developers Know how existing database

More information

Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.

Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer. Test: Final Exam - Database Programming with SQL Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer. Section 8 Lesson 1 1. Which SQL statement below will

More information

Database Query 1: SQL Basics

Database Query 1: SQL Basics Database Query 1: SQL Basics CIS 3730 Designing and Managing Data J.G. Zheng Fall 2010 1 Overview Using Structured Query Language (SQL) to get the data you want from relational databases Learning basic

More information

Oracle For Beginners Page : 1

Oracle For Beginners Page : 1 Oracle For Beginners Page : 1 Chapter 22 OBJECT TYPES Introduction to object types Creating object type and object Using object type Creating methods Accessing objects using SQL Object Type Dependencies

More information

SQL Programming. Student Workbook

SQL Programming. Student Workbook SQL Programming Student Workbook 2 SQL Programming SQL Programming Published by itcourseware, Inc., 7245 South Havana Street, Suite 100, Englewood, CO 80112 Contributing Authors: Denise Geller, Rob Roselius,

More information

D61830GC30. MySQL for Developers. Summary. Introduction. Prerequisites. At Course completion After completing this course, students will be able to:

D61830GC30. MySQL for Developers. Summary. Introduction. Prerequisites. At Course completion After completing this course, students will be able to: D61830GC30 for Developers Summary Duration Vendor Audience 5 Days Oracle Database Administrators, Developers, Web Administrators Level Technology Professional Oracle 5.6 Delivery Method Instructor-led

More information

Oracle Database 11g: SQL Tuning Workshop Release 2

Oracle Database 11g: SQL Tuning Workshop Release 2 Oracle University Contact Us: 1 800 005 453 Oracle Database 11g: SQL Tuning Workshop Release 2 Duration: 3 Days What you will learn This course assists database developers, DBAs, and SQL developers to

More information

Paper 70-27 An Introduction to SAS PROC SQL Timothy J Harrington, Venturi Partners Consulting, Waukegan, Illinois

Paper 70-27 An Introduction to SAS PROC SQL Timothy J Harrington, Venturi Partners Consulting, Waukegan, Illinois Paper 70-27 An Introduction to SAS PROC SQL Timothy J Harrington, Venturi Partners Consulting, Waukegan, Illinois Abstract This paper introduces SAS users with at least a basic understanding of SAS data

More information

5. CHANGING STRUCTURE AND DATA

5. CHANGING STRUCTURE AND DATA Oracle For Beginners Page : 1 5. CHANGING STRUCTURE AND DATA Altering the structure of a table Dropping a table Manipulating data Transaction Locking Read Consistency Summary Exercises Altering the structure

More information

SQL Server An Overview

SQL Server An Overview SQL Server An Overview SQL Server Microsoft SQL Server is designed to work effectively in a number of environments: As a two-tier or multi-tier client/server database system As a desktop database system

More information

SQL. Short introduction

SQL. Short introduction SQL Short introduction 1 Overview SQL, which stands for Structured Query Language, is used to communicate with a database. Through SQL one can create, manipulate, query and delete tables and contents.

More information

CONVERSION FUNCTIONS QUESTIONS

CONVERSION FUNCTIONS QUESTIONS CONVERSION FUNCTIONS QUESTIONS http://www.tutorialspoint.com/sql_certificate/conversion_functions_questions.htm Copyright tutorialspoint.com 1. What will be the outcome of the following query? SELECT ROUND(144.23,-1)

More information

IT2305 Database Systems I (Compulsory)

IT2305 Database Systems I (Compulsory) Database Systems I (Compulsory) INTRODUCTION This is one of the 4 modules designed for Semester 2 of Bachelor of Information Technology Degree program. CREDITS: 04 LEARNING OUTCOMES On completion of this

More information

Oracle Rdb A Comparison of SQL Dialects for Oracle and Oracle Rdb

Oracle Rdb A Comparison of SQL Dialects for Oracle and Oracle Rdb Oracle Rdb A Comparison of SQL Dialects for Oracle and Oracle Rdb Release: 1.0 Part No. A53248-01 Oracle Rdb A Comparison of SQL Dialects for Oracle and Oracle Rdb Part No. A53248-01 Release 1.0 Copyright

More information

Recognizing PL/SQL Lexical Units. Copyright 2007, Oracle. All rights reserved.

Recognizing PL/SQL Lexical Units. Copyright 2007, Oracle. All rights reserved. What Will I Learn? In this lesson, you will learn to: List and define the different types of lexical units available in PL/SQL Describe identifiers and identify valid and invalid identifiers in PL/SQL

More information

ICAB4136B Use structured query language to create database structures and manipulate data

ICAB4136B Use structured query language to create database structures and manipulate data ICAB4136B Use structured query language to create database structures and manipulate data Release: 1 ICAB4136B Use structured query language to create database structures and manipulate data Modification

More information

1Z0-117 Oracle Database 11g Release 2: SQL Tuning. Oracle

1Z0-117 Oracle Database 11g Release 2: SQL Tuning. Oracle 1Z0-117 Oracle Database 11g Release 2: SQL Tuning Oracle To purchase Full version of Practice exam click below; http://www.certshome.com/1z0-117-practice-test.html FOR Oracle 1Z0-117 Exam Candidates We

More information

Financial Data Access with SQL, Excel & VBA

Financial Data Access with SQL, Excel & VBA Computational Finance and Risk Management Financial Data Access with SQL, Excel & VBA Guy Yollin Instructor, Applied Mathematics University of Washington Guy Yollin (Copyright 2012) Data Access with SQL,

More information

Examine the structure of the EMPLOYEES table: EMPLOYEE_ID NUMBER Primary Key FIRST_NAME VARCHAR2(25) LAST_NAME VARCHAR2(25)

Examine the structure of the EMPLOYEES table: EMPLOYEE_ID NUMBER Primary Key FIRST_NAME VARCHAR2(25) LAST_NAME VARCHAR2(25) Examine the structure of the EMPLOYEES table: EMPLOYEE_ID NUMBER Primary Key FIRST_NAME VARCHAR2(25) LAST_NAME VARCHAR2(25) Which three statements inserts a row into the table? A. INSERT INTO employees

More information

PL/SQL Overview. Basic Structure and Syntax of PL/SQL

PL/SQL Overview. Basic Structure and Syntax of PL/SQL PL/SQL Overview PL/SQL is Procedural Language extension to SQL. It is loosely based on Ada (a variant of Pascal developed for the US Dept of Defense). PL/SQL was first released in ١٩٩٢ as an optional extension

More information

COMP 5138 Relational Database Management Systems. Week 5 : Basic SQL. Today s Agenda. Overview. Basic SQL Queries. Joins Queries

COMP 5138 Relational Database Management Systems. Week 5 : Basic SQL. Today s Agenda. Overview. Basic SQL Queries. Joins Queries COMP 5138 Relational Database Management Systems Week 5 : Basic COMP5138 "Relational Database Managment Systems" J. Davis 2006 5-1 Today s Agenda Overview Basic Queries Joins Queries Aggregate Functions

More information