Oracle Training Institutes in Hyderabad

31
Presented By www.kellytechno.com

description

Oracle 11g Institutes : kelly technologies is the best Oracle 11g Training Institutes in Hyderabad. Providing Oracle 11g training by real time faculty in Hyderabad.

Transcript of Oracle Training Institutes in Hyderabad

  • Presented Bywww.kellytechno.com

  • IntroductionIf you're new to SQL or just new to Oracle SQL, perhaps coming from a Microsoft SQL Server environment, it may seem like the two versions should be very similar, and they are, to a certain degree, but they are also very different in some important and basic ways. www.kellytechno.com

  • AgendaI. Quick Intro for SQL Server UsersII. Some Detail: Joins, Subqueries, DeletesIII. Certain Conceptual DifferencesIV. Powerful New FeaturesV. Summary & Referenceswww.kellytechno.com

  • Dont Use DatabasesSQL Serveruse mydatabaseOracleconnect mydatabase/mypasswordwww.kellytechno.com

  • Use Dualwww.kellytechno.com

  • Select Intowww.kellytechno.com

  • Insertswww.kellytechno.com

  • UpdatesSQL Serverupdate mytable set mycolumn=myothertable.mycolumn from mytable,myothertable where mytable.mycolumn like 'MY%' and myothertable.myothercolumn='some text';www.kellytechno.com

  • UpdatesOracleupdate mytableset mycolumn=(select a.mycolumn from myothertable a where myothertable.myothercolumn='some text';) where mytable.mycolumn like 'MY%';www.kellytechno.com

  • DeletesSQL Serverdelete mytable where mycolumn like 'some%';Oracledelete from mytable where mycolumn like 'some%';www.kellytechno.com

  • Software isql osql: for queries developed in SQL Analyzer sqlplusSQL ServerOraclewww.kellytechno.com

  • II. A Little More DetailOuter JoinSub-Queries in Place of ColumnsDeletes With a Second From Clausewww.kellytechno.com

  • Outer JoinSQL Server select d.deptname, e.ename from dept d, emp e where d.empno *= e.enum;Oracle select d.deptname,e.ename from dept d, emp e where d.empno = e.enum (+);www.kellytechno.com

  • SubQueries in Place of ColumnsSQL Serverselect distinct year,q1 = (select Amount amt FROM saleswhere Quarter=1 AND year = s.year),q2 = (SELECT Amount amt FROM saleswhere Quarter=2 AND year = s.year),q3 = (SELECT Amount amt FROM saleswhere Quarter=3 AND year = s.year),q4 = (SELECT Amount amt FROM saleswhere Quarter=4 AND year = s.year) from sales s;www.kellytechno.com

  • SubQueries in Place of ColumnsOracleSELECT year,DECODE( quarter, 1, amount, 0 ) q1,DECODE( quarter, 2, amount, 0 ) q2,DECODE( quarter, 3, amount, 0 ) q3,DECODE( quarter, 4, amount, 0 ) q4 FROM sales s;www.kellytechno.com

  • Delete with Second From ClauseSQL Serverdeletefrom productsfrom products, product_deleteswhere products.a = product_deletes.aand products.b = product_deletes.band product_deletes.c = 'd';

    www.kellytechno.com

  • Delete with Second From ClauseOracle

    deletefrom productswhere ( a, b ) in( select a, bfrom product_deleteswhere c = 'd' );

    www.kellytechno.com

  • III. More DepthThe Connect ConceptOther Conceptual DifferencesData Type DifferencesColumn AliasesSub-Querieswww.kellytechno.com

  • The Connect ConceptSQL Server Multiple databasesOracle Single Database Multiple tablespaces, schemas, userswww.kellytechno.com

  • Other Conceptual DifferencesSQL ServerDatabase owner, DBOGroup/RoleNon-unique indexT-SQL stored procedure {TriggerCompex ruleColumn identity propertyOracleSchemaRoleIndexPL/SQL procedurePL/SQL functionBEFORE triggerAfter triggerSequencewww.kellytechno.com

  • Only in OracleClustersPackagesTriggers for each rowSynonymsSnapshotswww.kellytechno.com

  • Data Type DifferencesSQL ServerOracleINTEGER NUMBER(10)SMALLINT NUMBER(6)TINYINT NUMBER(3)REALFLOATFLOATFLOATBITNUMBER(1)VARCHAR(n)VARCHAR2(n)TEXTCLOBIMAGEBLOBBINARY(n)RAW(n) or BLOB

    www.kellytechno.com

  • Data Type DifferencesSQL ServerOracleVARBINARYRAW(n) or BLOBDATETIMEDATESMALL-DATETIMEDATEMONEYNUMBER(19,4)NCHAR(n)CHAR(n*2)NVARCHAR(n)VARCHAR(n*2)SMALLMONEYNUMBER(10,4)TIMESTAMPNUMBERSYSNAME VARCHAR2(30), VARCHAR2(128)www.kellytechno.com

  • TimeSQL Server Datetime: 1/300th secondOracle Date: 1 second Timestamp: 1/100 millionth secondwww.kellytechno.com

  • Column AliasesSQL Server select a=deptid, b=deptname,c=empno from dept;Oracle select deptid a, deptname b, empno c from dept;www.kellytechno.com

  • Sub-queries, againSQL ServerSELECT ename, deptnameFROM emp, deptWHERE emp.enum = 10AND(SELECT security_codeFROM employee_securityWHERE empno = emp.enum) =(SELECT security_codeFROM security_master WHERE sec_level = dept.sec_level);www.kellytechno.com

  • Sub-queries, againOracleSELECT empname, deptnameFROM emp, deptWHERE emp.empno = 10AND EXISTS (SELECT security_codeFROM employee_security esWHERE es.empno = emp.empnoAND es.security_code =(SELECT security_codeFROM security_masterWHERE sec_level = dept.sec_level));www.kellytechno.com

  • Powerful New FeaturesRegular Expressions: Operators & FunctionsOperator: REGEXP_LIKEFunctions: REGEXP_INSTR REGEXP_SUBSTR REGEXP_REPLACEwww.kellytechno.com

  • Regular ExpressionsSelect zip from zipcode where regexp_like (zip, [^[:digit:]]);www.kellytechno.com

  • Regular ExpressionsSELECT REGEXP_INSTR('Joe Smith, 10045 Berry Lane, San Joseph, CA 91234-1234', ' [[:digit:]]{5}(-[[:digit:]]{4})?$') AS starts_at FROM dualwww.kellytechno.com