Module 5: Data Access. Overview Introduce database components involved in data access Introduce concepts of Transact -SQL and Procedural SQL as tools.

Slides:



Advertisements
Similar presentations
Module 13: Performance Tuning. Overview Performance tuning methodologies Instance level Database level Application level Overview of tools and techniques.
Advertisements

Basic SQL Introduction Presented by: Madhuri Bhogadi.
PL/SQL. Introduction to PL/SQL PL/SQL is the procedure extension to Oracle SQL. It is used to access an Oracle database from various environments (e.g.
Chapter 7 Managing Data Sources. ASP.NET 2.0, Third Edition2.
PL/SQL Bulk Collections in Oracle 9i and 10g Kent Crotty Burleson Consulting October 13, 2006.
ORACLE ONLINE TRAINING Contact our Support Team : SOFTNSOL India: Skype id : softnsoltrainings id:
Module 15: Monitoring. Overview Formulate requirements and identify resources to monitor in a database environment Types of monitoring that can be carried.
Module 8: Server Management. Overview Server-level and instance-level resources such as memory and processes Database-level resources such as logical.
Bordoloi and Bock CURSORS. Bordoloi and Bock CURSOR MANIPULATION To process an SQL statement, ORACLE needs to create an area of memory known as the context.
PL / SQL P rocedural L anguage / S tructured Q uery L anguage Chapter 7 in Lab Reference.
Database Design for DNN Developers Sebastian Leupold.
Overview of a Database Management System
Oracle10g Developer: PL/SQL Programming1 Objectives Manipulating data with cursors Managing errors with exception handlers Addressing exception-handling.
Module 12 Handling Errors in T-SQL Code. Module Overview Understanding T-SQL Error Handling Implementing T-SQL Error Handling Implementing Structured.
Introduction to Databases Chapter 6: Understanding the SQL Language.
Chapter Oracle Server An Oracle Server consists of an Oracle database (stored data, control and log files.) The Server will support SQL to define.
I Copyright © 2004, Oracle. All rights reserved. Introduction.
RDB/1 An introduction to RDBMS Objectives –To learn about the history and future direction of the SQL standard –To get an overall appreciation of a modern.
I Copyright © Oracle Corporation, All rights reserved. Introduction.
Store Procedures Lesson 9. Skills Matrix Stored Procedures Stored procedures in SQL Server are similar to the procedures you write in other programming.
DBSQL 14-1 Copyright © Genetic Computer School 2009 Chapter 14 Microsoft SQL Server.
Stored Procedures, Transactions, and Error-Handling
Introduction to SEQUEL. What is SEQUEL? Acronym for Structural English Query Language Acronym for Structural English Query Language Standard language.
Oracle Locking Michael Messina Principal Database Analyst Indiana University.
1 Oracle Architectural Components. 1-2 Objectives Listing the structures involved in connecting a user to an Oracle server Listing the stages in processing.
Overview · What is PL/SQL · Advantages of PL/SQL · Basic Structure of a PL/SQL Block · Procedure · Function · Anonymous Block · Types of Block · Declaring.
Quick review of SQL And conversion to Oracle SQL.
Module 8: Implementing Stored Procedures. Overview Implementing Stored Procedures Creating Parameterized Stored Procedures Working With Execution Plans.
BIS Database Systems School of Management, Business Information Systems, Assumption University A.Thanop Somprasong Chapter # 8 Advanced SQL.
Database Systems Design, Implementation, and Management Coronel | Morris 11e ©2015 Cengage Learning. All Rights Reserved. May not be scanned, copied or.
Manipulating Data in PL/SQL. 2 home back first prev next last What Will I Learn? Construct and execute PL/SQL statements that manipulate data with DML.
Chapter 15 Introduction to PL/SQL. Chapter Objectives  Explain the benefits of using PL/SQL blocks versus several SQL statements  Identify the sections.
Oracle & SQL Introduction. Database Concepts Revision DB? DBMS? DB Application? Application Programs? DBS? Examples of DBS? Examples of DBMS? 2Oracle.
SQL Fundamentals  SQL: Structured Query Language is a simple and powerful language used to create, access, and manipulate data and structure in the database.
Transactions and Locks A Quick Reference and Summary BIT 275.
Database Technology Jing Shen.
What is a Package? A package is an Oracle object, which holds other objects within it. Objects commonly held within a package are procedures, functions,
Chapter 16 Cursors and Exceptions. Chapter Objectives  Determine when an explicit cursor is required  Declare, open, and close an explicit cursor 
Dynamic SQL. 2 home back first prev next last What Will I Learn? Recall the stages through which all SQL statements pass Describe the reasons for using.
A Guide to SQL, Eighth Edition Chapter Eight SQL Functions and Procedures.
Using SQL in PL/SQL Oracle Database PL/SQL 10g Programming Chapter 4.
Professor: Dr. Shu-Ching Chen TA: Hsin-Yu Ha Views, Sequence, and Stored Procedure used in PosgreSQL.
Module 11: Managing Transactions and Locks
SQL Query Analyzer. Graphical tool that allows you to:  Create queries and other SQL scripts and execute them against SQL Server databases. (Query window)
Text TCS INTERNAL Oracle PL/SQL – Introduction. TCS INTERNAL PL SQL Introduction PLSQL means Procedural Language extension of SQL. PLSQL is a database.
DML Statements contd.. SQL Server CURSORS Cursor is used in handling results of select query for data calculations Cursors are used as buffered.
Module 14: Managing Transactions and Locks. Overview Introducing Transactions and Locks Managing Transactions Understanding SQL Server Locking Architecture.
Program with PL/SQL Lesson 3. Interacting with the Oracle Server.
Introduction to Core Database Concepts Getting started with Databases and Structure Query Language (SQL)
 CONACT UC:  Magnific training   
SQL Server Migration Hints and Tips Manual conversion required Complex triggers References to data dictionary tables (systables,…) Recent extensions.
In this session, you will learn to: Create and manage views Implement a full-text search Implement batches Objectives.
 Reviewing basic architecture concepts  Oracle 10g Architecture  Main features of 9i and 10g
1 Copyright © 2004, Oracle. All rights reserved. PL/SQL Programming Concepts: Review.
Oracle Database Architectural Components
1 Copyright © 2005, Oracle. All rights reserved. Oracle Database Administration: Overview.
Understanding Core Database Concepts Lesson 1. Objectives.
SQL Environment.
Interacting with the Oracle Server
Interacting with the Oracle Server
Introduction What is a Database?.
Database Management Systems 2
PL/SQL Scripting in Oracle:
Database systems Lecture 3 – SQL + CRUD
SQL Fundamentals in Three Hours
SQL .. An overview lecture3.
Contents Preface I Introduction Lesson Objectives I-2
Chapter 8 Advanced SQL.
Microsoft SQL Server 2014 for Oracle DBAs Module 5
Database SQL.
Presentation transcript:

Module 5: Data Access

Overview Introduce database components involved in data access Introduce concepts of Transact -SQL and Procedural SQL as tools to access and manipulate data Discuss transactional management concepts

Relational Engine SQL CLR Hosting Layer Synchronization Svcs Scheduler Lock Manager Deadlock Monitor Buffer Pool Memory Manager SQLOS SQL Manager T-SQL Execution CLR Query Execution T-SQL Compiler Algebraizer Query Optimizer Parser Expression Svcs Execution Environment METADATA Interface Storage Engine SQL Messages HTTP Messages RPC Messages Results

Demonstration 1: Evaluate an Execution Plan In this demonstration you will see how to: Provide tracing within SQL Server Review the execution plan for simple queries Compare execution plan to the trace profiler Review execution plan

Structured Query Language Oracle and SQL Server are compliant with entry-level SQL-92 Both support many of the core features of SQL-99 and SQL-2003 Categories of SQL statements Data Definition Language (DDL) Data Manipulation Language (DML) Transaction Control Statements Session Control Statements System Control Statements

Data Definition Language (DDL) Define and alter database structures Using :  CREATE, ALTER and DROP Access control:  GRANT and REVOKE  + DENY in SQL Server Identifiers limits in characters  Oracle <= 30 characters  SQL Server <= 128 Unicode characters Temporary tables <= 116 Unicode characters

Data Manipulation Language (DML) Standard Terminology with Each Other  C = INSERT  R = SELECT  U = UPDATE  D = DELETE There are Differences Though Oracle: IN lists can have up to 1000 values SQL Server: IN lists have no limited on number of values Syntax variations – Example: Oracle: SELECT Field1 || Field2 FROM Table1 SQL Server: SELECT Field3 + Field4 FROM Table2

Demonstration 2: Transact–SQL In this demonstration you will see how to: Generate a query Declare and use variables and row constructors Aggregate summary data

Control Statements Control Statements in Oracle and SQL Server Control Category OracleSQL Server Transaction ControlCOMMIT [ WORK ]COMMIT [ WORK | TRANSACTION ] Transaction ControlROLLBACKROLLBACK [ WORK | TRANSACTION ] Transaction ControlSAVEPOINTSAVE TRAN[SACTION] Transaction ControlSET TRANSACTIONSET Session ControlALTER SESSIONSET Session ControlSET ROLEsp_setapprole System ControlALTER SYSTEMsp_configure System ControlALTER DATABASEsp_dboption

Procedural and Transaction - SQL Both use “BEGIN … END” and “IF” for block and conditional structuring.  1 Statement <> BEGIN … END  > 1 Statement = BEGIN … END Oracle offers loop structures:  LOOP … END LOOP,  FOR … END LOOP,  WHILE … END LOOP SQL Server offers the loop WHILE Dynamic SQL  ORACLE - DBMS_SQL or EXECUTE IMMEDIATE  SQL Server - sp_executesql and EXEC()

Cursors Versatile navigation through data Both support Fetching and Scrolling SQL Server cursor types include: Close the Cursor Fetch the Next Row Open the Result Declare Cursor with a SELECT Define Variables FIRST NEXT PRIOR LAST ABSOLUTE RELATIVE FIRST NEXT PRIOR LAST ABSOLUTE RELATIVE FORWARD_ONLY INSENSITIVE SCROLL READ_ONLY STATIC DYNAMIC FAST_FORWARD LOCAL GLOBAL KEYSET-DRIVEN FORWARD_ONLY INSENSITIVE SCROLL READ_ONLY STATIC DYNAMIC FAST_FORWARD LOCAL GLOBAL KEYSET-DRIVEN

Integrated Full-Text Searching Storing Large Text Documents is on the rise RDBMS – Not Equiped on their own to handle this. Oracle Text SELECT * FROM MYTextDocuments WHERE CONTAINS(text, ‘Oracle’, 1) > 0 SELECT * FROM MYProductCatalog WHERE CATSEARCH(title, ‘Camera’, ‘order by price desc’) > 0 SELECT * FROM MyRules WHERE MATCHES(query_string,:doc_text) > 0 SS Full-TEXT SELECT * FROM MYTextDocuments WHERE CONTAINS(text, ‘“SQL Server”’) SELECT * FROM MYTextDocuments WHERE FREETEXT(text, ‘SQL Server’) SELECT * FROM MYTextDocuments FT_TBL INNER JOIN CONTAINSTABLE(MYTextDocuments, text, ‘SQL Server’) AS K_TBL ON FT.TBL.id = K_TBL.[KEY] ORDER BY K_TBL.RANK DESC;

Tools to Ease Development Cycles Tools for Creating Queries Command Line SQL *Plus for Oracle SQLCMD for SQL Server Graphical User Interfaces SQL *Plus for Oracle SQL Server Management Studio Beyond the Integrated Tools Visual Studio.NET ToadSoft Toad And others

Error Handling Servers always raise the errors  T-SQL dealings TRY..CATCH Oracle has predefined system exceptions NO_DATA_FOUND TOO_MANY_ROWS and so on SQL Server internal error messages Severity levels View with sys.messages Both DBs allow custom exceptions messages Severity level Description 0-9Informational messages that are not severe. DB does not raise system errors Indicate errors that can be corrected by the user Indicate software errors that cannot be corrected by the user Indicate fatal errors, which means execution ceases. Error messages are written to the error log.

Query Optimization Cost-Based Optimization Execution Plans based on : o Access methods o Statistics o Hints Plans can be viewed with: OracleExplain Plan SQL ServerExecution Plan

Transaction Management Oracle transactions end with COMMIT or ROLLBACK SQL Server is an implicit commit for each row.  Make Explicit by using:  BEGIN TRAN … COMMIT TRAN or  or  SET IMPLICIT_TRANSACTIONS ON Distributed transactions modify data in more than one database in a distributed database environment Two-phase commit provides ways to manage data consistency and data integrity in a distributed environment  Make Explicit by using:  BEGIN TRAN … COMMIT TRAN  or  SET IMPLICIT_TRANSACTIONS ON  Make Explicit by using:  BEGIN TRAN … COMMIT TRAN  or  SET IMPLICIT_TRANSACTIONS ON

Review We examined various components of the relational engine that parses, optimizes, and executes database calls and fetches data We learned about the different types of statements that constitute the Structured Query Language (SQL) We were introduced to procedural SQL offered by Oracle and SQL Server We learned that the cost-based optimizer in Oracle and SQL Server performs SQL optimization that can be superseded by hints from the user We learned about the concepts of local and distributed transactions and the two-phase commit