unisys OS 2200 Relational Data Management System (RDMS 2200) and IPF SQL Interface End Use Guide imagine it. done. ClearPath OS

Save this PDF as:
 WORD  PNG  TXT  JPG

Size: px
Start display at page:

Download "unisys OS 2200 Relational Data Management System (RDMS 2200) and IPF SQL Interface End Use Guide imagine it. done. ClearPath OS 2200 12."

Transcription

1 unisys imagine it. done. OS 2200 Relational Data Management System (RDMS 2200) and IPF SQL Interface End Use Guide ClearPath OS Release June

2 NO WARRANTIES OF ANY NATURE ARE EXTENDED BY THIS DOCUMENT. Any product or related information described herein is only furnished pursuant and subject to the terms and conditions of a duly executed agreement to purchase or lease equipment or to license software. The only warranties made by Unisys, if any, with respect to the products described in this document are set forth in such agreement. Unisys cannot accept any financial or other responsibility that may be the result of your use of the information in this document or software material, including direct, special, or consequential damages. You should be very careful to ensure that the use of this information and/or software material complies with the laws, rules, and regulations of the jurisdictions with respect to which it is used. The information contained herein is subject to change without notice. Revisions may be issued to advise of such changes and/or additions. Notice to U.S. Government End Users: This is commercial computer software or hardware documentation developed at private expense. Use, reproduction, or disclosure by the Government is subject to the terms of Unisys standard commercial license for the products, and where applicable, the restricted/limited rights provisions of the contract data rights clauses. Unisys and ClearPath are registered trademarks of Unisys Corporation in the United States and other countries. All other brands and products referenced in this document are acknowledged to be the trademarks or registered trademarks of their respective holders.

3 Contents Section 1. About This Guide 1.1. Documentation Updates Prerequisites Section 2. Introduction 2.1. Database Management in the OS 2200 Environment Basic End-User Tasks Structured Query Language (SQL) Section 3. Relational Concepts 3.1. Relational Data Model Characteristics of Relational Tables Tables and Views Section 4. Threads 4.1. Managing Threads, Steps, and Recovery Starting a Session Committing Changes Canceling Changes Ending a Session Section 5. Querying the Database 5.1. Query Specifications Specifying Columns: Select List Specifying Tables: FROM Clause Selecting Rows: WHERE Clause Retrieving Information on Groups of Rows: GROUP BY Clause Restricting Groups: HAVING Clause Joining Tables Using Cursors Declaring a Cursor (DECLARE CURSOR) Opening a Cursor (OPEN) Closing a Cursor (CLOSE) iii

4 Contents Section 6. Changing Data 6.1. Deleting Rows from a Table (DELETE) Inserting Data in a Table (INSERT) Changing Values in a Table (UPDATE) Section 7. Views 7.1. Creating a View (CREATE VIEW) Qualifier Name and View Name Column Names View Query Specification Updating Views View WITH CHECK OPTION Clause Dropping a View (DROP VIEW) Section 8. Restricting Access to Data 8.1. Using Locks Locking Tables (LOCK) Removing Locks (UNLOCK) Section 9. RDMS Interfaces Section 10. IPF SQL Interface Using SQL Statements with IPF IPF SQL Interface Sessions Calling the IPF Processor Specifying a Data Manager Specifying an IPF Escape Character Opening an RDMS Database (BEGIN THREAD) Selecting Recovery Options Getting Help with SQL Statements Automatically Committing Changes to the Database Saving Changes to a Database (COMMIT) Discarding Changes to a Database (ROLLBACK) Closing a Database (END THREAD) Exiting IPF (LOGOFF) Saving SQL Statements in a File Query Result Output Saving Query Results in a File Using SQL Full-Screen Mode Section 11. SQL Operations and Variables Cursor Operations Declaring a Cursor (SQL DECLARE CURSOR) iv

5 Contents Dropping a Cursor (SQL DROP CURSOR) Closing a Cursor (SQL CLOSE) Retrieving a Row from a Cursor (SQL FETCH) IPF Variables Status Variables Indicator Variables IPF Procedures and Variables Appendix A. Qualifier and Version Names A.1. Purpose and Use... A 1 A.2. Using Qualifiers... A 2 A.3. Using Versions... A 2 A.4. Default Qualifier and Version Names... A 2 A.5. Establishing a New Default Qualifier (USE DEFAULT QUALIFIER)... A 3 A.6. Establishing a Default Version (USE DEFAULT VERSION)... A 3 Glossary... 1 Index v

6 Contents vi

7 Tables 3 1. Table CUSTOMERS Table HOUSES GROUP BY Result Table CUSTOMERS/HOUSES Cross-Product Table CUSTOMERS/HOUSES Cross-Product Table with WHERE Clause CUSTOMERS/HOUSES Cross-Product Table with Query Specification Error Codes and Auxiliary Status Information vii

8 Tables viii

9 Section 1 About This Guide Purpose RDMS is one of the Universal Data System (UDS) suite of software products. UDS products work together to manage and control the flow of data on a system. RDMS is a part of the standard product (the UDS kernel). RDMS is based on the relational data model. The relational data model provides an uncomplicated view of data to all users by representing data in two-dimensional tables of rows and columns. These tables are called relational tables. A relational database is a collection of relational tables. RDMS is the data manager for relational databases. RDMS users use Structured Query Language (SQL), the industry-standard relational database management language, and some RDMS extensions to SQL to interact with RDMS databases. Interactive Processing Facility (IPF) users can use the IPF SQL Interface to manage RDMS databases using SQL. This guide serves two purposes. First, it is a procedural guide to common RDMS end-user tasks performed in SQL. These tasks include retrieving, updating, inserting, and deleting rows from RDMS tables; thread control; and concurrency control. This guide is not intended as a text for learning SQL. It is meant to serve the occasional user as well as the SQL user unfamiliar with RDMS. The guide s second purpose is to document the IPF SQL Interface. The IPF SQL Interface enables IPF users to use RDMS databases. Scope The end-user tasks covered in this guide include managing threads; querying and updating tables; and using views, variables, and locks. The IPF SQL Interface sections of this guide cover Logging on to and off from the IPF SQL Interface Specifying a data manager Beginning and ending threads Getting online help Saving SQL statements and IPF commands in a file for later execution

10 About This Guide Using variables with the IPF SQL Interface Using the IPF SQL Interface as an application prototype and development platform This guide explains the necessary concepts and terminology for each task. It also provides examples of how to perform each task. Audience The primary audience for this guide is all RDMS end users, which includes Any RDMS end user who needs assistance with SQL or other end-user tasks IPF SQL Interface users Programmers developing or maintaining applications written in third-generation programming languages such as UCS COBOL, UCS FORTRAN, UCS C, UCS Pascal, ASCII COBOL or ASCII FORTRAN 1.1. Documentation Updates This document contains all the information that was available at the time of publication. Changes identified after release of this document are included in problem list entry (PLE) To obtain a copy of the PLE, contact your Unisys service representative or access the current PLE from the Unisys Product Support Web site: Note: If you are not logged into the Product Support site, you will be asked to do so Prerequisites This guide assumes that users have a working knowledge of the Exec. It also assumes that users can work effectively with the interface of their choice. This means, for example, that they know how to write programs in the third-generation programming language they are using, or, if they are IPF SQL Interface users, that they know how to use IPF. As for relational database competence, this guide assumes that most users have had some training and have at least a basic understanding of relational concepts and terminology. However, the guide contains a brief refresher of elementary concepts for the benefit of new, out-of-practice, or infrequent users

11 Section 2 Introduction 2.1. Database Management in the OS 2200 Environment Unisys supports database management systems for OS 2200 systems through the Universal Data System (UDS). UDS supports network databases through Data Management System (DMS), flat file databases through Shared File System (SFS), and relational databases through RDMS. UDS has two components that support all databases, regardless of type: UDS Control UDS Control handles all actual input/output operations on the database. It also provides recovery and locking services for you. Unisys Repository Manager (UREP) UREP handles repository tasks, such as storing table and view definitions. UDS Control and UREP work together in many ways to support database activities. RDMS is a relational database manager based on SQL that provides relational database users with many services: Parsing SQL or other relational data management instructions from users Issuing diagnostic messages to users when it finds errors in their instructions $ Creating instruction packets from user instructions and executing them Providing data type conversion services Passing diagnostic and other messages back to users Providing interfaces for programming languages, application generators, interactive tools, report generators, and other relational tools developed by Unisys and other vendors

12 Introduction 2.2. Basic End-User Tasks The basic tasks end users perform in working with a relational database include Retrieving data You use retrieval statements to specify which rows and columns you want to retrieve for examination or further processing. In a real estate database application for example, you might want to see a list of all the customers who said the maximum price they would pay for a home was $100,000 or more. Updating data You use update statements to change the values in one or more columns of one or more rows. For example, a family could change their minds and decide they prefer to buy in New London instead of Woodbury. You must then update the preferred location column for their row to indicate their correct preference. Inserting data As you attract more customers and list more houses, you need to add rows to those tables to keep them current. Deleting data As customers buy houses, you need to delete the customers and the purchased houses from tables. These are the main tasks users perform regularly. Other tasks, like creating and dropping tables, controlling access to tables, and managing recovery, are the responsibility of the database administrator. For more information on these and other administrative tasks, see the RDMS Administration Guide

13 Introduction 2.3. Structured Query Language (SQL) RDMS users use SQL statements to create and access RDMS databases. SQL, an acronym that stands for Structured Query Language, is a relational data management language. The American National Standards Institute uses SQL as the official standard for relational database languages. SQL is pronounced ess-cue-ell or sequel. SQL divorces the application program or end user from the physical and location attributes of the data. Data manipulation commands are expressed in logical terms. A SQL query declares an action to be applied to the data of interest. It makes no difference where the data is located or how it is arranged. The data of interest is identified only in logical terms, which includes Identifying the table or tables involved in the action (retrieval or update). Optionally, the names of the tables can be qualified by a schema name. A query can involve one or more tables, and the tables specified generally can involve multiple schemas. Identifying the rows to be selected from the tables. Rows are selected through specifications that identify the rows of interest. The specifications include column names whose associated value in the row can be compared or included in an expression that is compared to other like expressions. These statements of truth or falseness identify whether or not the row is to be included as the set of interest. Optionally, columns can be qualified by a table and schema. Identifying the columns on which the action (retrieval or update) is specified. The specifications include column names whose associated value is to be presented or included in an expression of a column or columns for presentation from the rows in the tables selected. For update actions, column names are associated with corresponding values for assignment to the columns of the selected row set. In all cases, the column names can be qualified by a table and schema name. You use SQL to control a database and its data. SQL statements enable you to perform all the basic tasks and most of the administrative tasks required for working with relational databases. RDMS supports entry-level SQL 92 and several extension to it. Some of these extensions take advantage of the unique capabilities of RDMS, the Integrated Recovery Utility (IRU), or the Exec. The thread control operations are examples of this kind of extension to the standard. Refer to Section 4, Threads, for more information. Some extensions of this kind are presented in this guide. RDMS also extends the capability of some standard SQL statements and supports embedded SQL (ESQL), a method by which you can incorporate SQL statement into third-generation programming languages. For details on RDMS extensions to standard SQL and more information about ESQL, see the RDMS SQL Programming Reference Manual

14 Introduction

15 Section 3 Relational Concepts 3.1. Relational Data Model The relational data model represents information, or data, in an organized way: as a table or a group of tables. A table (also called a relation) is a collection of rows, each containing values for a fixed number of columns. (Rows are also called tuples, and columns are also called attributes.) Relational tables are just like the tables you see every day in reports or timetables. Each row in the table contains information about one item. Each column in a row reveals something about the item the row describes. Each column has a set of permissible values called its domain. Tables look like and are similar to conventional sequential files. Like a file, each table has a name. The rows in a table are like the records in a file and are, in fact, sometimes referred to as records. The columns in a row are like the data fields in a record. Like data fields, columns have names and data types associated with them. RDMS stores the structural definition of each table in the repository. From the table definition, RDMS can determine how many columns a given table has, the names of the columns, and the data types. Table 3-1 and Table 3-2 are examples of relational tables a real estate company might use. These tables and their data are used in examples throughout this guide

16 Relational Concepts Table CUSTOMERS contains a customer identifier (CNO), the customer s name (CNAME), the maximum price the customer can pay for a house (MAXPRICE), and the location desired by each customer (DESIREDLOC). Table 3 1. Table CUSTOMERS CNO CNAME MAXPRICE DESIREDLOC C101 Thompson Woodbury C102 Owen New London C103 Johnson Woodbury C104 Jones Greenville C105 Smith Westchester Table HOUSES contains a house identifier (HNO), the location of the house (LOCATION), the asking price (PRICE), and a brief description of each house on the market (DESCRIPTION). Table 3 2. Table HOUSES HNO LOCATION PRICE DESCRIPTION H101 Woodbury bedroom condominium H102 Woodbury Handyman s special H103 Westchester Duplex H104 Parkway Heights bedroom town house H105 Turtle Creek bedroom house

17 Relational Concepts 3.2. Characteristics of Relational Tables Relational tables have the following characteristics: Each table has a specific number of columns. You specify how many columns the table is to have when you create it using the CREATE TABLE statement. You can change the number of columns later by using the ALTER TABLE statement. Each relational table contains just one type of row (that is, each row has the same format). This means that every row in a given table has the same +columns in the same order. The intersection of a column and a row is called a data item. An example of a data item in the HOUSES table is the intersection of the column Price with the row describing house number H102. The specific value of a given data item is called a data value. For example the data value of Price for house H102 is Each row in a table contains information about one item. For example, each row in the HOUSES table contains information about one particular house. If a primary key is defined, part of each row must be unique. This means that for each row, the value of one column (or a group of columns considered together) must be unique. This column or set of columns that have a unique value for every row is called the primary key. The group of columns that have a unique value when considered together can include all columns in the table. No more than one row can have a given primary key value. Each column in a table has a distinct name. Rows do not have names Tables and Views A base table has physical data associated with it in permanent files that reside on a computer system s mass storage. You can work directly on tables by using SQL statements to retrieve, change, add, or delete rows from tables in the database. A view, also called a virtual table, is another way to look at the data that is physically stored in tables in the database. A view has no physical data associated with it; instead, a view is a filter through which you view the data in one or more tables. The definition of a view is stored in the repository, just like the definition of a table. But the computer mass storage system that holds the data for a view contains no permanent files. Views and tables are so similar in most ways that you can use the terms table and view interchangeably in this guide unless otherwise noted

18 Relational Concepts

19 Section 4 Threads 4.1. Managing Threads, Steps, and Recovery A thread is a work session with the databases in a particular application group. (An application group is a collection of files and programs that make up a working environment. A host computer system can have up to nine application groups.) A thread is composed of steps. Steps are portions of the work session that begin and end with thread control operations. You can use the following thread control operations: BEGIN THREAD COMMIT ROLLBACK END THREAD Any changes you make to the database are not made permanent until you execute a COMMIT or END THREAD statement. Until that time, UDS Control keeps both the updated and original copies of the data. If an error or system stop occurs before the end of the step, UDS Control rolls backs the database to the state that existed at the start of the step. This operation is called recovery. Recovery assures you of a consistent database. UDS Control and RDMS also lock updated data until the end of the step to prevent other users from accessing uncommitted data

20 Threads 4.2. Starting a Session To establish communication with RDMS and to specify which database application group you want to open, use the BEGIN THREAD statement. You must specify the BEGIN THREAD statement before any other SQL statement. While a thread is open, you can display the information in the database and make changes to it. A thread remains open until you enter an END THREAD statement or log off the system. Only one application group can be open at a time. The application group that is currently open must therefore be closed with the END THREAD statement before a new database can be opened. The BEGIN THREAD statement registers a thread with UDS and sets up the thread working storage and environment. To use the BEGIN THREAD statement, you specify The name of the thread This is optional. If you omit the thread name, RDMS uses the program run-id. The application group name Application group names are twelve or fewer alphanumeric characters (letters, numbers, and underscores only), begin with a letter, and do not end with an underscore. The default application group name is UDSSRC. Whether or not you plan to update the database If you specify READ or RETRIEVE on the FOR clause of the BEGIN THREAD statement, you can retrieve data from the tables on which you have retrieval privileges, but you cannot add, delete, or update rows, nor can you create, drop, or modify tables. Attempts to do other than data retrieval result in an error. If you specify UPDATE in the FOR clause of the BEGIN THREAD statement, you can retrieve, add, delete, and update data in tables for which you have the corresponding privileges. You can also create, modify, or drop tables. If you do not specify whether or not you plan to update the database, RDMS uses UPDATE(DEFERRED). This means that you can update the database and that you are using the DEFERRED recovery option

21 Threads If you do plan to update the database, specify the type of recovery you want. Put the recovery option in parentheses immediately following the UPDATE keyword. You or the database administrator should choose one of these recovery options: DEFERRED Use DEFERRED if you plan to make few updates (fewer than the MAX-AOR-LIMIT configuration parameter, which is 10 by default) between thread control operations, or if you plan to roll back changes. If you specify UPDATE but you do not specify a recovery option, RDMS uses DEFERRED. QUICKLOOKS Use QUICKLOOKS if you plan to make many changes to the database between thread control operations (more than about 100). If you plan to make between 10 and 100 updates per step, it does not make much difference whether you choose DEFERRED or QUICKLOOKS. COMMANDLOOKS Use COMMANDLOOKS, the most expensive type of recovery, to provide recovery to the beginning of a statement if the statement encounters errors. It is recommended for the IPF SQL Interface and other interactive sessions. (Interactive users are more likely to use erroneous statements than debugged programs.) How RDMS should handle error messages The UDSMESSAGE option instructs RDMS to print error messages immediately instead of waiting for you to retrieve them. IPF SQL Interface users cannot use this option because the IPF SQL Interface already has a mechanism for retrieving error messages. Examples The following example registers thread T1 with RDMS in application group UDSSRC. This thread cannot update the database. BEGIN THREAD t1 FOR udssrc READ The next example registers thread PUBS in application group UDSSRC. This thread can update the database; any updates use the DEFERRED recovery option. BEGIN THREAD pubs FOR udsscr UPDATE(DEFERRED)

22 Threads 4.3. Committing Changes Use the COMMIT statement to preserve any changes you make to the database.the system takes the changes you made since the most recent COMMIT or BEGIN THREAD statement and applies them to the database, making them permanent. Until you commit the changes, the system has only changed a working copy of the database. Use the COMMIT statement only if a thread is open. When you close a database with the END THREAD statement, the system automatically commits the changes for you. Committing a thread releases all locks except those set by LOCK statements. Example The following example writes all updates for the current step (since the last thread control operation) to the database: COMMIT 4.4. Canceling Changes The ROLLBACK statement discards any updates made to the working copy of the database since the last BEGIN THREAD, ROLLBACK, or COMMIT statement; thus, the changes do not become permanent. This statement is useful if you make a mistake and do not want to manually undo the changes. The ROLLBACK statement may apply to application programs using relational statements in two circumstances: You are making several updates to the database, get an unexpected error, and want to commit the changes only if you can apply them all. If any one of the updates is unsuccessful, you can use the ROLLBACK statement to discard all updates made by the step. You are making temporary updates to generate a what if report. In this case, you can discard all changes to the database with a ROLLBACK statement when you have all the information you need. Rolling back a thread releases all locks except those set by LOCK statements. Example The following example ends the current recovery step and discards any updates to the database made since the last thread control operation: ROLLBACK

23 Threads 4.5. Ending a Session When you finish working with a database, end the session using the END THREAD statement. This statement closes the thread that is currently open and ends communication with RDMS. It also writes any updates made to the database during the last step. Since only one application group can be accessed by a thread, you do not need to specify which thread or application group to close. Example The following example ends the current thread: END THREAD

24 Threads

25 Section 5 Querying the Database 5.1. Query Specifications SQL makes it easy for you to query a database to get answers to business questions. The basic format for query specifications is SELECT... FROM... WHERE (although other clauses can be added). A query specification can be used alone or as a clause in some other SQL statements. Used alone, it is the SELECT statement. Other SQL statements that use query specifications as clauses include DECLARE CURSOR In SQL, you can describe the conditions for a group of rows you want to retrieve and process one at a time. This description is called a cursor. CREATE VIEW Refer to Section 7, Threads. UNLOAD The UNLOAD statement is not covered in this guide. For information on the UNLOAD statement, see the RDMS SQL Programming Reference Manual. The query specification allows you to retrieve information from a database. You can retrieve zero or more rows from a table. Only those rows with data values that satisfy the selection criteria you specify are retrieved. Use several clauses with the query specification to specify this criteria: Which columns you want to see This can be a list of column names or an asterisk ( *) if you want to see all the columns in the table. This part of the query specification is called the select list. Which table or tables are those columns in (FROM clause) This is a list of table names. You must name every table from which you are retrieving columns

26 Querying the Database You can also use these optional clauses to further refine a query: WHERE clause The WHERE clause lets you specify conditions for the rows you want to see. If a row meets the condition, the columns you specified are retrieved. Otherwise, the row is not retrieved. GROUP BY clause The GROUP BY clause lets you obtain summarized information. For example, you can summarize a sales report and use the GROUP BY clause to find the total month s sales for each salesperson. HAVING clause The HAVING clause lets you specify conditions each group specified in the GROUP BY clause must meet. For example, you can use the HAVING clause to eliminate all salespersons who have not met their bonus quotas for a sales contest Specifying Columns: Select List To select all of the columns from the table specified in the FROM clause, use an asterisk ( *) after the keyword SELECT. Examples The following example selects all columns from table CUSTOMERS: SELECT * FROM customers You can also select all columns from two or more tables as in the following query specification, which specifies all columns from tables CUSTOMERS and HOUSES: SELECT * FROM customers, houses To select all columns from one particular table when the FROM clause specifies several tables, place the table name followed by a period in front of the asterisk. The following example illustrates how to select all columns from table CUSTOMERS but only column HNO from table HOUSES when joining the two tables: SELECT customers.*, houses.hno FROM customers, houses

27 Querying the Database If you do not want all the columns from a table, you can specify the desired columns with a list of column names. You do not have to specify the table containing the column name in a select list. RDMS matches the column with one of the table names specified in the FROM clause. It scans the list of tables in the FROM clause (from left to right) until it matches a column with the table that contains that column. RDMS then qualifies the column name implicitly with the matching table name. Assume, for example, that you have the following tables: Table R1 (with columns A, B, and C) Table R2 (with columns B, D, E, and F) The results of the following two query specifications are the same: SELECT A, D, B, C FROM r1, r2 WHERE B = r2.b SELECT r1.a, r2.d, r1.b, r1.c FROM r1, r2 WHERE r1.b = r2.b An entry in the select list can also be an arithmetic expression. For example, if you do not want to retrieve the price of a house, but want to know the agent s 6 percent commission, enter SELECT hno, price *.06 FROM houses You get house numbers and sales commissions; you do not get the price of houses. You can also include numeric constants or string literals in the select list: SELECT 'THE HOUSE NUMBER IS', hno FROM houses In this case, each row retrieved has two data values: one character string with the value THE HOUSE NUMBER IS and a second character string that contains a house identification number. You can also use the DISTINCT keyword to specify no duplicate rows. DISTINCT requires RDMS to sort and compare rows to eliminate duplicates, except in special cases such as the projection of all columns in a primary key or unique index. This means that selecting data with DISTINCT takes longer than selecting data without it

28 Querying the Database If you use the GROUP BY clause, all column names used in the SELECT list must also be in the GROUP BY column specification list. You cannot include both column names and functions (AVG, COUNT, MAX, MIN, and SUM) in the select list unless a GROUP BY clause exists. In that case, you can mix columns in the GROUP BY column specification list with functions that affect columns not included in the column specification list Specifying Tables: FROM Clause In the FROM clause, provide the names of the tables and views from which you want to select data. Use commas to separate table specifications in the list. The table list can include views, but a view containing DISTINCT, GROUP BY, or built-in functions cannot be joined to any other table or view. If you list such a view in the FROM clause, the FROM clause can contain no other tables or views. If you have more than one table name in the FROM clause, RDMS performs a join of the tables. If you join tables and one of the tables is empty, nothing is selected (see 5.2). You might want to use the same table more than once in a query specification. You can do this with a correlation name. A correlation name is an alias for a table. If you use a table or view specification followed by a correlation name, any column name referenced in the select list can be qualified with that correlation name. This means that column names qualified in this manner are assumed to be in the table associated with the correlation name. Examples To list identically priced pairs of houses, you can specify X and Y as variable names for the rows in the single table HOUSES, as in the following example: SELECT x.hno, y.hno FROM houses x,houses y WHERE x.price = y.price AND NOT (x.hno = y.hno) The WHERE clause in this example uses a Boolean expression. The second part of the Boolean expression, namely NOT (X.HNO = Y.HNO), ensures that no house is paired with itself. (Boolean expressions decide true or false kinds of conditions. For example, the expression A = B is either true or false. A complete discussion of how RDMS uses Boolean expressions is beyond the scope of this guide. See the RDMS SQL Programming Reference Manual.)

29 Querying the Database Any table identified in a FROM clause is subject to a scoping rule that governs the range within the overall query in which the table s columns can be referenced. The scope of a table includes the query specification whose FROM clause identifies the table as well as all subqueries nested within the query specification, no matter how deep. The reference to column C2 of table T1 in the following example is legal since it falls within the scope of T1, which consists of the entire query: SELECT * FROM t1 WHERE t1.c1 < (SELECT min(t2.d1) FROM t2 WHERE t1.c2 = t2.d2) The reference to column D3 of table T2 in the next example is not legal, however, because it is referenced outside the scope of T2, which consists solely of the subquery: SELECT * FROM t1 WHERE t1.c1 < (SELECT min(t2.d1) FROM t2 WHERE t1.c2 = t2.d2) AND t2.d3 IS NOT NULL

30 Querying the Database Selecting Rows: WHERE Clause The WHERE clause restricts which rows are selected. It first combines rows from all tables specified in the FROM clause and then determines if each of these rows satisfies the conditions in a Boolean expression. The WHERE clause selects data from only those rows that meet the specified conditions. (Rows for which the Boolean expression is not TRUE are not selected.) Examples Since CNO is the primary key of table CUSTOMERS and each row in a table has a unique primary key, the following example selects no more than one row of the table: WHERE customers.cno = 'C101' To continue, you may want to select all houses with an asking price of over $100,000. The WHERE clause that restricts the houses to this price range is WHERE houses.price > You can further restrict the selected rows by using an AND operand in a Boolean expression. For example, you can select only the houses that cost over $100,000 and are located in Woodbury: WHERE houses.price > AND houses.location = 'Woodbury' You can also restrict the selected rows by using nested SELECT statements or subqueries. You can use the following WHERE clause, for example, to select all houses that every customer can afford: WHERE houses.price <= (SELECT min(customers.maxprice) FROM customers) If you leave out the WHERE clause in a query specification, RDMS selects all rows from the specified table or tables

31 Querying the Database Retrieving Information on Groups of Rows: GROUP BY Clause You use the GROUP BY clause to direct RDMS how to divide rows into separate groups. All rows in which the set of columns in the column specification list have the same set of values form one group. Any row containing a null value in any grouping column (those in the column specification list) is considered a distinct group. The GROUP BY clause contains the instructions to RDMS to construct a conceptual table (called a grouped table ), which contains one row for each group. Each row in the grouped table contains summary information about one group. This information may be the sum of values of a column in that group or the largest value in a column in that group. Example To get a list of towns (locations) where houses are listed and the average price of houses in each location, you can use the following query specification: SELECT location, AVG(Price) FROM houses GROUP BY location Table 5-1 illustrates the data selected from table HOUSES. Table 5 1. GROUP BY Result Table LOCATION AVG(PRICE) Woodbury Westchester Parkway Heights Turtle Creek

32 Querying the Database Restricting Groups: HAVING Clause Just as the WHERE clause imposes search conditions on the table formed by the FROM clause, the HAVING clause imposes search conditions on groups formed by the GROUP BY clause. RDMS forms the groups first and then applies the HAVING clause. One grouped table row is formed for each group that satisfies the HAVING clause. The Boolean-expression in the HAVING clause can refer to any column in the GROUP BY column specification list. You can use any column not in that list as a parameter to a built-in function only. If you have a HAVING clause but no GROUP BY clause, all rows in the FROM and WHERE clauses comprise a single group, and the resulting grouped table consists of zero or one row. Example To find the locations where the average price of a house exceeds $100,000, use the following query specification: SELECT location, AVG(price) FROM houses GROUP BY location HAVING AVG(price) > If this example is applied to table HOUSES, one row is selected: Turtle Creek

33 Querying the Database 5.2. Joining Tables When RDMS joins tables, it first determines the cross product of the tables listed in the FROM clause. Suppose the FROM clause lists these tables: Table T1 with columns A, B, C Table T2 with columns D, E, F, G Table T3 with columns H, I, J The cross-product table is a conceptual table (that is, it does not physically exist in the database). This table contains all the columns from all three tables: A, B, C, D, E, F, G, H, I, and J. The number of rows in the cross-product table is the product of the number of rows in Tables T1, T2, and T3. For example, if T1 contains 10 rows, T2 contains 5 rows, and T3 contains 20 rows, the cross-product table contains 10X5X20 = 1000 rows. Therefore, if you include an empty table (that is, with no rows in it), the resulting cross-product table is also empty. Second, RDMS applies the conditions in the WHERE clause to every row in the cross-product table. If a row satisfies the conditions in the WHERE clause, it goes into a reduced cross-product table. This table contains the same number of columns as the original cross-product table. That is, if the Boolean expression is true for a given row, that row goes into the reduced cross-product table. The number of rows in the reduced product table is probably reduced as a result of conditions in the WHERE clause. Third, RDMS now applies the query specification clause to the reduced cross-product table. The only columns selected for the SELECT clause are those that meet any conditions in the SELECT clause. Example The following example illustrates a query specification clause to join tables CUSTOMERS and HOUSES. SELECT cno, cname, maxprice, hno, location, price FROM customers, houses WHERE houses.price <= customers.maxprice In three steps, RDMS performs the following steps: 1. RDMS determines the cross-product table. 2. RDMS determines the reduced cross-product table by applying the WHERE clause. 3. RDMS determines the final result by applying the SELECT clause

34 Querying the Database Table 5-2 illustrates the joined tables CUSTOMERS and HOUSES in a cross-product table. Table 5 2. CUSTOMERS/HOUSES Cross-Product Table CNO CNAME MAXPRICE DESIREDLOC HNO LOCATION PRICE DESCRIP C101 Thompson Woodbury H101 Woodbury bedroom C101 Thompson Woodbury H102 Woodbury Handyman C101 Thompson Woodbury H103 Westchester Duplex C101 Thompson Woodbury H104 Parkway Hts bedroom C101 Thompson Woodbury H105 Turtle Creek bedroom C102 Owen New London H101 Woodbury bedroom C102 Owen New London H102 Woodbury Handyman C102 Owen New London H103 Westchester Duplex C102 Owen New London H104 Parkway Hts bedroom C102 Owen New London H105 Turtle Creek bedroom C103 Johnson Woodbury H101 Woodbury bedroom C103 Johnson Woodbury H102 Woodbury Handyman C103 Johnson Woodbury H103 Westchester Duplex C103 Johnson Woodbury H104 Parkway Hts bedroom C103 Johnson Woodbury H105 Turtle Creek bedroom C104 Jones Greenville H101 Woodbury bedroom C104 Jones Greenville H102 Woodbury Handyman C104 Jones Greenville H103 Westchester Duplex C104 Jones Greenville H104 Parkway Hts bedroom C104 Jones Greenville H105 Turtle Creek bedroom C105 Smith Westchester H101 Woodbury bedroom C105 Smith Westchester H102 Woodbury Handyman C105 Smith Westchester H103 Westchester Duplex C105 Smith Westchester H104 Parkway Hts bedroom C105 Smith Westchester H105 Turtle Creek bedroom

35 Querying the Database Table 5-3 illustrates the reduced cross-product table after the WHERE clause has been applied. Table 5 3. CUSTOMERS/HOUSES Cross-Product Table with WHERE Clause CNO CNAME MAXPRICE DESIREDLOC HNO LOCATION PRICE DESCRIP C101 Thompson Woodbury H101 Woodbury bedroom C101 Thompson Woodbury H102 Woodbury Handyman C101 Thompson Woodbury H103 Westchester Duplex C101 Thompson Woodbury H104 Parkway Hts bedroom C101 Thompson Woodbury H105 Turtle Creek bedroom C102 Owen New London H102 Woodbury Handyman C103 Johnson Woodbury H102 Woodbury Handyman C103 Johnson Woodbury H103 Westchester Duplex C103 Johnson Woodbury H104 Parkway Hts bedroom C104 Jones Greenville H102 Woodbury Handyman C104 Jones Greenville H103 Westchester Duplex C104 Jones Greenville H104 Parkway Hts bedroom C105 Smith Westchester H102 Woodbury Handyman C105 Smith Westchester H103 Westchester Duplex C105 Smith Westchester H104 Parkway Hts bedroom C105 Smith Westchester H105 Turtle Creek bedroom

36 Querying the Database Table 5-4 illustrates the final cross-product table after the SELECT clause has been applied. Table 5 4. CUSTOMERS/HOUSES Cross-Product Table with Query Specification CNO CNAME MAXPRICE HNO LOCATION PRICE C101 Thompson H101 Woodbury C101 Thompson H101 Woodbury C101 Thompson H102 Woodbury C101 Thompson H103 Westchester C101 Thompson H104 Parkway Heights C101 Thompson H105 Turtle Creek C102 Owen H102 Woodbury C102 Owen H103 Westchester C102 Owen H104 Parkway Heights C103 Johnson H102 Woodbury C104 Jones H102 Woodbury C104 Jones H103 Westchester C104 Jones H104 Parkway Heights C105 Smith H102 Woodbury C105 Smith H103 Westchester C105 Smith H104 Parkway Heights C105 Smith H105 Turtle Creek In some cases when you do not select a column or columns from each table in the FROM clause, RDMS is able to optimize retrieval by not returning all duplicate rows

37 Querying the Database 5.3. Using Cursors You can use three SQL statements to declare cursors and make them available or unavailable: DECLARE CURSOR Use the DECLARE CURSOR statement to define the rows you want to retrieve. OPEN Use the OPEN statement to instruct RDMS to prepare the rows you defined in the DECLARE CURSOR statement. CLOSE Use the CLOSE statement to instruct RDMS to release the rows it retrieved when it opened the cursor. You can also use a DROP CURSOR statement with RDMS, but it is not part of standard SQL. Working with cursors often involves the use of variables to pass values from an application to RDMS and back. Variable usage depends on the interface used. For more information about variables, see the documentation for the interface you are using. See the RDMS SQL Programming Reference Manual also Declaring a Cursor (DECLARE CURSOR) The DECLARE CURSOR statement is intended for application programs that need to specify many rows and retrieve them one at a time for processing. To use the DECLARE CURSOR statement, specify a name for the cursor and follow it with a query specification. (Remember, a query specification is a SELECT statement used as a clause in another statement.) Examples The following example defines a set of rows by joining selected columns from tables CUSTOMERS and HOUSES. It restricts the cursor to rows where the asking price of the house does not exceed the maximum price the customer is willing to pay. DECLARE matchprice CURSOR FOR SELECT cno, maxprice, hno, price FROM customers, houses WHERE houses.price <= customers.maxprice

38 Querying the Database The next example illustrates how to use an arithmetic expression with a column to give you a calculated result instead of just the data in the table. It returns the sales agent s commission (6%) instead of the house price. It also sorts the retrieved rows by the amount of the commission and the location of the house. (Since the commission is not an actual column value but an expression, you use an unsigned integer to designate its position in the list of items selected.) DECLARE mycut CURSOR FOR SELECT hno, price * 0.06, location FROM houses ORDER BY 2, location The more work you give a cursor to do, the longer it takes to do it. Since the cursor MYCUT has to perform both arithmetic calculations and sort the retrieved rows, it takes longer to execute than an unsorted retrieval without calculations. The next example illustrates how to use the UNION set operator with columns in two tables. It returns all cities in ascending order that have either a customer or a house. The UNION operator requires two query specifications. DECLARE cities CURSOR FOR SELECT desiredloc FROM customers UNION SELECT location FROM houses ORDER BY Opening a Cursor (OPEN) You use the OPEN statement to make a cursor available for use after you have declared it. If you are working through an application program, you also use the OPEN statement to associate new values with the cursor declaration. Example The following example opens the cursor MATCHPRICE that was declared in the example in 4.3.1: OPEN matchprice

39 Querying the Database Closing a Cursor (CLOSE) When you open a cursor, RDMS does preparatory work to be able to efficiently retrieve rows on subsequent statements. RDMS also maintains internal tables to keep track of the cursor. These tables and retrieved data occupy main and mass storage space; depending on the amount of data retrieved, considerable system resources may be dedicated to a cursor. When you close a cursor, you release most of the system resources used by the cursor. It is a good idea to close cursors you no longer need. Since opening cursors can require considerable processing time, however, do not close cursors prematurely. To close a cursor, use the CLOSE statement with the cursor name. Example The following example closes cursor MATCHPRICE, which was opened in the example in 4.3.2: CLOSE matchprice

40 Querying the Database

41 Section 6 Changing Data 6.1. Deleting Rows from a Table (DELETE) The DELETE statement deletes zero or more rows from a table in the database. To use the DELETE statement, specify the name of the table and add a WHERE clause (unless you want to delete every row in the table.) Note: If you do not use the WHERE clause, RDMS deletes every row from the table. Use a WHERE clause if you do not want to delete all the rows. Examples The following example deletes all rows from table HOUSES: DELETE houses The next example deletes all rows from table CUSTOMERS: DELETE customers You can also delete rows that meet certain conditions. In the next two examples, you are eliminating from the database all customers who are unable to spend more than $40,000 for a house: DELETE customers WHERE maxprice <= DELETE customers WHERE maxprice <= 0 The next example deletes only those rows where the value of the PRICE column is greater than $100,000: DELETE houses WHERE price > The last example removes a specific row from a table: DELETE houses WHERE hno = 'H102'

42 Changing Data 6.2. Inserting Data in a Table (INSERT) You use the INSERT statement to add a row to an existing table. The table may or may not already contain rows of data. It must, however, already be created with the CREATE TABLE statement. If you want to create a table, see the database administrator. For a description of the process, see the RDMS Administration Guide. To use the INSERT statement, you name the table into which you want to insert a row. You must also specify the values you are inserting in the new row (the VALUES clause). If you do not place the values into the columns in the same order as the columns were defined, you must list the column names in front of the VALUES clause. Instead of specifying a VALUES clause, you can use a query specification to select values from other tables to form rows to be inserted. Use commas to separate the data items in the values list. The order of the data items must match the order of the columns. All columns must have a data item, and each data item must be compatible with the column data type. Examples Here are some examples of INSERT statements: INSERT INTO houses VALUES ('H106', 'Anoka', 95000, 'Duplex') INSERT INTO houses (hno, price, location, description) VALUES ('H106', 95000, 'Anoka', 'Duplex') To insert a row with null values, use the keyword NULL: INSERT INTO houses (hno, price, location, description) VALUES('H107', NULL, 'Hibbing', NULL) The next two examples assume another table, HOUSES2, exists with three columns defined as HNUM, LOC, and PRICE. An insertion from table HOUSES2 into table HOUSES results in default values for DESCRIPTION: INSERT INTO houses SELECT * FROM houses2 The last example inserts default values for PRICE and DESCRIPTION: INSERT INTO houses (hno, location) SELECT hnum, loc FROM houses

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

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 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

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

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

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

SQL Development Using Oracle

SQL Development Using Oracle SQL Development Using Oracle 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

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

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

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 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

UNISYS. Business Information Server. MRI Administration and User s Guide. Printed in USA May 2004 7846 0391 013

UNISYS. Business Information Server. MRI Administration and User s Guide. Printed in USA May 2004 7846 0391 013 Business Information Server MRI Administration and User s Guide UNISYS 2004 Unisys Corporation. All rights reserved. Printed in USA May 2004 7846 0391 013 NO WARRANTIES OF ANY NATURE ARE EXTENDED BY THIS

More information

Chapter 4: SQL. Basic Structure

Chapter 4: SQL. Basic Structure Chapter 4: SQL Basic Structure Set Operations Aggregate Functions Null Values Nested Subqueries Derived Relations Views Modification of the Database Joined Relations Data Definition Language Embedded SQL

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

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

Distributed Data Processing (DDP-PPC) TCP/IP Interface COBOL

Distributed Data Processing (DDP-PPC) TCP/IP Interface COBOL !()+ OS 2200 Distributed Data Processing (DDP-PPC) TCP/IP Interface COBOL Programming Guide Copyright ( 1997 Unisys Corporation. All rights reserved. Unisys is a registered trademark of Unisys Corporation.

More information

KB_SQL SQL Reference Guide Version 4

KB_SQL SQL Reference Guide Version 4 KB_SQL SQL Reference Guide Version 4 1995, 1999 by KB Systems, Inc. All rights reserved. KB Systems, Inc., Herndon, Virginia, USA. Printed in the United States of America. No part of this manual may be

More information

unisys OS 2200 Shared File System (SFS 2200) Administration and Support Reference Manual imagine it. done. Release Level 4R1 June 2010 7831 0786 003

unisys OS 2200 Shared File System (SFS 2200) Administration and Support Reference Manual imagine it. done. Release Level 4R1 June 2010 7831 0786 003 unisys imagine it. done. OS 2200 Shared File System (SFS 2200) Administration and Support Reference Manual Release Level 4R1 June 2010 7831 0786 003 NO WARRANTIES OF ANY NATURE ARE EXTENDED BY THIS DOCUMENT.

More information

Server Sentinel Monitored Server

Server Sentinel Monitored Server Server Sentinel Monitored Server Installation and Reinstallation Guide for Systems Monitoring Third-Party Products Server Sentinel 4.4.3 and Higher April 2007 . unisys imagine it. done. Server Sentinel

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

SQL Query & Modification

SQL Query & Modification CS145 Lecture Notes #7 SQL Query & Modification Introduction SQL Structured Query Language Pronounced S-Q-L or sequel The query language of every commercial RDBMS Evolution of SQL standard: SQL89 SQL92

More information

CHAPTER 2 DATABASE MANAGEMENT SYSTEM AND SECURITY

CHAPTER 2 DATABASE MANAGEMENT SYSTEM AND SECURITY CHAPTER 2 DATABASE MANAGEMENT SYSTEM AND SECURITY 2.1 Introduction In this chapter, I am going to introduce Database Management Systems (DBMS) and the Structured Query Language (SQL), its syntax and usage.

More information

System Monitoring and Diagnostics Guide for Siebel Business Applications. Version 7.8 April 2005

System Monitoring and Diagnostics Guide for Siebel Business Applications. Version 7.8 April 2005 System Monitoring and Diagnostics Guide for Siebel Business Applications April 2005 Siebel Systems, Inc., 2207 Bridgepointe Parkway, San Mateo, CA 94404 Copyright 2005 Siebel Systems, Inc. All rights reserved.

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

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 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

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

DATABASE DESIGN AND IMPLEMENTATION II SAULT COLLEGE OF APPLIED ARTS AND TECHNOLOGY SAULT STE. MARIE, ONTARIO. Sault College

DATABASE DESIGN AND IMPLEMENTATION II SAULT COLLEGE OF APPLIED ARTS AND TECHNOLOGY SAULT STE. MARIE, ONTARIO. Sault College -1- SAULT COLLEGE OF APPLIED ARTS AND TECHNOLOGY SAULT STE. MARIE, ONTARIO Sault College COURSE OUTLINE COURSE TITLE: CODE NO. : SEMESTER: 4 PROGRAM: PROGRAMMER (2090)/PROGRAMMER ANALYST (2091) AUTHOR:

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

ORACLE USER PRODUCTIVITY KIT USAGE TRACKING ADMINISTRATION & REPORTING RELEASE 3.6 PART NO. E17087-01

ORACLE USER PRODUCTIVITY KIT USAGE TRACKING ADMINISTRATION & REPORTING RELEASE 3.6 PART NO. E17087-01 ORACLE USER PRODUCTIVITY KIT USAGE TRACKING ADMINISTRATION & REPORTING RELEASE 3.6 PART NO. E17087-01 FEBRUARY 2010 COPYRIGHT Copyright 1998, 2009, Oracle and/or its affiliates. All rights reserved. Part

More information

Microsoft Access 3: Understanding and Creating Queries

Microsoft Access 3: Understanding and Creating Queries Microsoft Access 3: Understanding and Creating Queries In Access Level 2, we learned how to perform basic data retrievals by using Search & Replace functions and Sort & Filter functions. For more complex

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

UNISYS. Server Management 2.0. Software Release Announcement. imagine it. done. Server Management 2.0 and Higher. May 2008 8216 3445 000

UNISYS. Server Management 2.0. Software Release Announcement. imagine it. done. Server Management 2.0 and Higher. May 2008 8216 3445 000 UNISYS imagine it. done. Server Management 2.0 Software Release Announcement Server Management 2.0 and Higher May 2008 8216 3445 000 NO WARRANTIES OF ANY NATURE ARE EXTENDED BY THIS DOCUMENT. Any product

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 It's important for developers to understand the

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

DBMS LAB MANUAL PREPARED BY JAGRUTI SAVE

DBMS LAB MANUAL PREPARED BY JAGRUTI SAVE DBMS LAB MANUAL PREPARED BY JAGRUTI SAVE 1 EXPERIMENT NO: 1 AIM: Preparing an ER diagram for given database and Conversion from ER diagram to tables THEORY: Database : A Database is a collection of interrelated

More information

Server Sentinel Client Workstation

Server Sentinel Client Workstation Server Sentinel Client Workstation Installation and Reinstallation Guide Server Sentinel 4.4.3 and Higher April 2008 . unisys imagine it. done. Server Sentinel Client Workstation Installation and Reinstallation

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

Micro Focus Database Connectors

Micro Focus Database Connectors data sheet Database Connectors Executive Overview Database Connectors are designed to bridge the worlds of COBOL and Structured Query Language (SQL). There are three Database Connector interfaces: Database

More information

2 SQL in iseries Navigator

2 SQL in iseries Navigator 2 SQL in iseries Navigator In V4R4, IBM added an SQL scripting tool to the standard features included within iseries Navigator and has continued enhancing it in subsequent releases. Because standard features

More information

Using Temporary Tables to Improve Performance for SQL Data Services

Using Temporary Tables to Improve Performance for SQL Data Services Using Temporary Tables to Improve Performance for SQL Data Services 2014- Informatica Corporation. No part of this document may be reproduced or transmitted in any form, by any means (electronic, photocopying,

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

NETWORK PRINT MONITOR User Guide

NETWORK PRINT MONITOR User Guide NETWORK PRINT MONITOR User Guide Legal Notes Unauthorized reproduction of all or part of this guide is prohibited. The information in this guide is subject to change without notice. We cannot be held liable

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

A Brief Introduction to MySQL

A Brief Introduction to MySQL A Brief Introduction to MySQL by Derek Schuurman Introduction to Databases A database is a structured collection of logically related data. One common type of database is the relational database, a term

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

Standard Query Language. SQL: Data Manipulation Transparencies

Standard Query Language. SQL: Data Manipulation Transparencies Standard Query Language SQL: Data Manipulation Transparencies Objectives Purpose and importance of SQL. How to retrieve data from database using SELECT and: Use compound WHERE conditions. Sort query results

More information

HP Quality Center. Upgrade Preparation Guide

HP Quality Center. Upgrade Preparation Guide HP Quality Center Upgrade Preparation Guide Document Release Date: November 2008 Software Release Date: November 2008 Legal Notices Warranty The only warranties for HP products and services are set forth

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

DBMS Questions. 3.) For which two constraints are indexes created when the constraint is added?

DBMS Questions. 3.) For which two constraints are indexes created when the constraint is added? DBMS Questions 1.) Which type of file is part of the Oracle database? A.) B.) C.) D.) Control file Password file Parameter files Archived log files 2.) Which statements are use to UNLOCK the user? A.)

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

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

ICE for Eclipse. Release 9.0.1

ICE for Eclipse. Release 9.0.1 ICE for Eclipse Release 9.0.1 Disclaimer This document is for informational purposes only and is subject to change without notice. This document and its contents, including the viewpoints, dates and functional

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

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

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

Database Administration with MySQL

Database Administration with MySQL Database Administration with MySQL Suitable For: Database administrators and system administrators who need to manage MySQL based services. Prerequisites: Practical knowledge of SQL Some knowledge of relational

More information

unisys ClearPath Enterprise Servers Universal Data System Administration and Support Reference Manual Level 18R1 February 2013 7831 0737 021

unisys ClearPath Enterprise Servers Universal Data System Administration and Support Reference Manual Level 18R1 February 2013 7831 0737 021 unisys ClearPath Enterprise Servers Universal Data System Administration and Support Reference Manual Level 18R1 February 2013 7831 0737 021 NO WARRANTIES OF ANY NATURE ARE EXTENDED BY THIS DOCUMENT. Any

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

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

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

Turning ClearPath MCP Data into Information with Business Information Server. White Paper

Turning ClearPath MCP Data into Information with Business Information Server. White Paper Turning ClearPath MCP Data into Information with Business Information Server White Paper 1 Many Unisys ClearPath MCP Series customers have Enterprise Database Server (DMSII) databases to support a variety

More information

Enterprise Server. Application Sentinel for SQL Server Installation and Configuration Guide. Application Sentinel 2.0 and Higher

Enterprise Server. Application Sentinel for SQL Server Installation and Configuration Guide. Application Sentinel 2.0 and Higher Enterprise Server Application Sentinel for SQL Server Installation and Configuration Guide Application Sentinel 2.0 and Higher August 2004 Printed in USA 3832 1097 000 . Enterprise Server Application Sentinel

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

unisys ClearPath Servers Hadoop Distributed File System(HDFS) Data Transfer Guide Firmware 2.0 and Higher December 2014 8230 6952-000

unisys ClearPath Servers Hadoop Distributed File System(HDFS) Data Transfer Guide Firmware 2.0 and Higher December 2014 8230 6952-000 unisys ClearPath Servers Hadoop Distributed File System(HDFS) Data Transfer Guide Firmware 2.0 and Higher December 2014 8230 6952-000 NO WARRANTIES OF ANY NATURE ARE EXTENDED BY THIS DOCUMENT. Any product

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

2874CD1EssentialSQL.qxd 6/25/01 3:06 PM Page 1 Essential SQL Copyright 2001 SYBEX, Inc., Alameda, CA www.sybex.com

2874CD1EssentialSQL.qxd 6/25/01 3:06 PM Page 1 Essential SQL Copyright 2001 SYBEX, Inc., Alameda, CA www.sybex.com Essential SQL 2 Essential SQL This bonus chapter is provided with Mastering Delphi 6. It is a basic introduction to SQL to accompany Chapter 14, Client/Server Programming. RDBMS packages are generally

More information

Working with the Geodatabase Using SQL

Working with the Geodatabase Using SQL An ESRI Technical Paper February 2004 This technical paper is aimed primarily at GIS managers and data administrators who are responsible for the installation, design, and day-to-day management of a geodatabase.

More information

MySQL for Beginners Ed 3

MySQL for Beginners Ed 3 Oracle University Contact Us: 1.800.529.0165 MySQL for Beginners Ed 3 Duration: 4 Days What you will learn The MySQL for Beginners course helps you learn about the world's most popular open source database.

More information

Advance DBMS. Structured Query Language (SQL)

Advance DBMS. Structured Query Language (SQL) Structured Query Language (SQL) Introduction Commercial database systems use more user friendly language to specify the queries. SQL is the most influential commercially marketed product language. Other

More information

VMware vcenter Discovered Machines Import Tool User's Guide Version 5.3.0.25 for vcenter Configuration Manager 5.3

VMware vcenter Discovered Machines Import Tool User's Guide Version 5.3.0.25 for vcenter Configuration Manager 5.3 VMware vcenter Discovered Machines Import Tool User's Guide Version 5.3.0.25 for vcenter Configuration Manager 5.3 This document supports the version of each product listed and supports all subsequent

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

Firebird. Embedded SQL Guide for RM/Cobol

Firebird. Embedded SQL Guide for RM/Cobol Firebird Embedded SQL Guide for RM/Cobol Embedded SQL Guide for RM/Cobol 3 Table of Contents 1. Program Structure...6 1.1. General...6 1.2. Reading this Guide...6 1.3. Definition of Terms...6 1.4. Declaring

More information

Chapter 5. SQL: Queries, Constraints, Triggers

Chapter 5. SQL: Queries, Constraints, Triggers Chapter 5 SQL: Queries, Constraints, Triggers 1 Overview: aspects of SQL DML: Data Management Language. Pose queries (Ch. 5) and insert, delete, modify rows (Ch. 3) DDL: Data Definition Language. Creation,

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

Q4. What are data model? Explain the different data model with examples. Q8. Differentiate physical and logical data independence data models.

Q4. What are data model? Explain the different data model with examples. Q8. Differentiate physical and logical data independence data models. FAQs Introduction to Database Systems and Design Module 1: Introduction Data, Database, DBMS, DBA Q2. What is a catalogue? Explain the use of it in DBMS. Q3. Differentiate File System approach and Database

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

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

Documentum Content Distribution Services TM Administration Guide

Documentum Content Distribution Services TM Administration Guide Documentum Content Distribution Services TM Administration Guide Version 5.3 SP5 August 2007 Copyright 1994-2007 EMC Corporation. All rights reserved. Table of Contents Preface... 7 Chapter 1 Introducing

More information

2. Basic Relational Data Model

2. Basic Relational Data Model 2. Basic Relational Data Model 2.1 Introduction Basic concepts of information models, their realisation in databases comprising data objects and object relationships, and their management by DBMS s that

More information

CS143: Query and Update in SQL

CS143: Query and Update in SQL CS143: Query and Update in SQL Book Chapters (4th) Chapter 4.1-6, 4.8-10, 3.3.4 (5th) Chapter 3.1-8, 3.10-11 (6th) Chapter 3.1-9, 4.1, 4.3 Things to Learn SQL DML for SQL Structured Query Language The

More information

More SQL: Complex Queries. This chapter describes more advanced features of the SQL language standard for relational databases.

More SQL: Complex Queries. This chapter describes more advanced features of the SQL language standard for relational databases. More SQL: Complex Queries This chapter describes more advanced features of the SQL language standard for relational databases. 5.1 More Complex SQL Retrieval Queries Because of the generality and expressive

More information

INTRO TO RDBMS-OODBMS-ORDBMS. Seema Sirpal Delhi University Computer Centre

INTRO TO RDBMS-OODBMS-ORDBMS. Seema Sirpal Delhi University Computer Centre INTRO TO RDBMS-OODBMS-ORDBMS Seema Sirpal Delhi University Computer Centre Databases Data - raw facts/details DATABASE- A shared collection of logically related data (and a description of this data), designed

More information

JD Edwards EnterpriseOne Tools

JD Edwards EnterpriseOne Tools JD Edwards EnterpriseOne Tools Table Conversion Guide Release 9.1 E24236-01 December 2011 JD Edwards EnterpriseOne Tools Table Conversion Guide, Release 9.1 E24236-01 Copyright 2011, Oracle and/or its

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

Business Intelligence Tutorial: Introduction to the Data Warehouse Center

Business Intelligence Tutorial: Introduction to the Data Warehouse Center IBM DB2 Universal Database Business Intelligence Tutorial: Introduction to the Data Warehouse Center Version 8 IBM DB2 Universal Database Business Intelligence Tutorial: Introduction to the Data Warehouse

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

FileMaker 11. ODBC and JDBC Guide

FileMaker 11. ODBC and JDBC Guide FileMaker 11 ODBC and JDBC Guide 2004 2010 FileMaker, Inc. All Rights Reserved. FileMaker, Inc. 5201 Patrick Henry Drive Santa Clara, California 95054 FileMaker is a trademark of FileMaker, Inc. registered

More information

Oracle. Brief Course Content This course can be done in modular form as per the detail below. ORA-1 Oracle Database 10g: SQL 4 Weeks 4000/-

Oracle. Brief Course Content This course can be done in modular form as per the detail below. ORA-1 Oracle Database 10g: SQL 4 Weeks 4000/- Oracle Objective: Oracle has many advantages and features that makes it popular and thereby makes it as the world's largest enterprise software company. Oracle is used for almost all large application

More information

Chapter 6 The database Language SQL as a tutorial

Chapter 6 The database Language SQL as a tutorial Chapter 6 The database Language SQL as a tutorial About SQL SQL is a standard database language, adopted by many commercial systems. ANSI SQL, SQL-92 or SQL2, SQL99 or SQL3 extends SQL2 with objectrelational

More information

Query and Export Guide

Query and Export Guide Query and Export Guide 011712 2012 Blackbaud, Inc. This publication, or any part thereof, may not be reproduced or transmitted in any form or by any means, electronic, or mechanical, including photocopying,

More information

IT2304: Database Systems 1 (DBS 1)

IT2304: Database Systems 1 (DBS 1) : Database Systems 1 (DBS 1) (Compulsory) 1. OUTLINE OF SYLLABUS Topic Minimum number of hours Introduction to DBMS 07 Relational Data Model 03 Data manipulation using Relational Algebra 06 Data manipulation

More information

IBM Security QRadar Vulnerability Manager Version 7.2.1. User Guide

IBM Security QRadar Vulnerability Manager Version 7.2.1. User Guide IBM Security QRadar Vulnerability Manager Version 7.2.1 User Guide Note Before using this information and the product that it supports, read the information in Notices on page 61. Copyright IBM Corporation

More information

Oracle Database Concepts

Oracle Database Concepts Oracle Database Concepts Database Structure The database has logical structures and physical structures. Because the physical and logical structures are separate, the physical storage of data can be managed

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

AV-005: Administering and Implementing a Data Warehouse with SQL Server 2014

AV-005: Administering and Implementing a Data Warehouse with SQL Server 2014 AV-005: Administering and Implementing a Data Warehouse with SQL Server 2014 Career Details Duration 105 hours Prerequisites This career requires that you meet the following prerequisites: Working knowledge

More information

Handling Missing Values in the SQL Procedure

Handling Missing Values in the SQL Procedure Handling Missing Values in the SQL Procedure Danbo Yi, Abt Associates Inc., Cambridge, MA Lei Zhang, Domain Solutions Corp., Cambridge, MA ABSTRACT PROC SQL as a powerful database management tool provides

More information

UNISYS. ClearPath Enterprise Servers. Authentication Sentinel for OS 2200 User Guide. ClearPath OS 2200 Release 8.2

UNISYS. ClearPath Enterprise Servers. Authentication Sentinel for OS 2200 User Guide. ClearPath OS 2200 Release 8.2 ClearPath Enterprise Servers Authentication Sentinel for OS 2200 User Guide UNISYS 2004 Unisys Corporation. All rights reserved. ClearPath OS 2200 Release 8.2 Printed in USA September 2004 4729 2016 000

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

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