Академический Документы
Профессиональный Документы
Культура Документы
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
Using :
CREATE, ALTER and DROP Access control: GRANT and REVOKE + DENY in SQL Server
D = DELETE
Demonstration: TransactSQL
Demonstration:
TransactSQL Queries
Control Statements
Control Statements in Oracle and SQL Server
Control Category Oracle SQL Server
COMMIT [ WORK | TRANSACTION ] ROLLBACK [ WORK | TRANSACTION ]
SAVE TRAN[SACTION]
Transaction Control SET TRANSACTION SET Session Control ALTER SESSION SET
Session Control
System Control System Control
SET ROLE
ALTER SYSTEM ALTER DATABASE
sp_setapprole
sp_configure sp_dboption
Cursors
Versatile navigation through data Both support Fetching and Scrolling
FIRST NEXT PRIOR LAST ABSOLUTE RELATIVE
Define Variables Declare Cursor with a SELECT Open the Result Fetch the Next Row Close the Cursor
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
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;
Command Line
SQL *Plus for Oracle SQLCMD for SQL Server
Error Handling
Servers always raise the errors T-SQL dealings @@Error TRY..CATCH Oracle has predefined system exceptions
NO_DATA_FOUND TOO_MANY_ROWS and so on
Severity level 0-9 Description Informational messages that are not severe. DB does not raise system errors.
11-16
17-19
SQL Server internal error messages Severity levels View with sys.messages Both DBs allow custom exceptions messages
20-25
Query Optimization
Cost-Based Optimization Plans can be viewed with:
Oracle Explain Plan SQL Server Execution Plan
Demonstration:
Transaction Management
Oracle transactions end with COMMIT or ROLLBACK
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