Introduction    Describing the Life Cycle Development Phases    Defining a Database    Discussing the Theoretical, Concept...
Suggested Study Material :Oracle Database 10g SQLBy: Jason Price  › Publisher: McGraw-Hill/Osborne  › ISBN: 9780070587557 ...
DBMS is the collection of interrelated data and a set of program to access the data.DBMS allows only one person to access ...
RDBMS manages large volumes of data while supporting a large number of userssimultaneously.In a relational database,files ...
For example,data for a company’s employees is stored in a structure,with eachemployee stored only once. Data for the emplo...
Dependen                                                     t1EMPLOYEE 1                                        Dependen ...
As shown in the Figure, more dependents can be added to a single employeewithout storing the employee’s information over a...
Entity-Relationship ModelEntitiesAn entity is the person,place,thing,or abstract concept that you want to track inthe data...
Below Figure shows a data model with a few example of entities for a                   student registration system for a c...
AttributesOnce the entities have been identified and added to the data model,you candecide on the exact details for each e...
Following Figure shows the college student registration system with attributes.       STUDENT                             ...
Entities and Their RelationshipsThe relationships between entities is the focal point for the relational databasemanagemen...
CardinalityCardinality refers to the quantity of entity instances that are allowed on eitherside of the relationship and i...
Cardinality Notations  CUSTOMER                                          ORDER                  ITEMThe relationship betwe...
NormalizationThe theoretical concepts of Mathematical Set Theory and Relational Algebraallowed a database designer to orga...
Strategy                 Software development Life cycle  andAnalysis                           Design                    ...
Oracle10g offers a comprehensive high performance infrastructure needed todevelop, deploy, and manage Internet application...
Structured Query Language (SQL)The SQL in PL/SQL stands for structured query language. We use SQL to SELECT,INSERT, UPDATE...
SQL*Plus in Oracle accepts literally dozens of commands andhas even more environmental settings. Many of the commandsaccep...
Data Types                          DescriptionVARCHAR2 (SIZE)                     Variable-length character dataCHAR (Siz...
Database Objects                 DescriptionTable                            Basic Unit of Storage, Composed of Rows and C...
Types of SQL Statements and their RepresentationsSelect                            Data RetrievalInsertUpdate             ...
The Basic Command                       SELECT column_list                        FROM table_name;    Filtering the Result...
Using Arithmetic Operators with SQL Statements    Operator                          Description                   +       ...
Oracle’s comparison operators are broken down into the following groups:Simple comparison operatorsRange comparison operat...
Simple Comparison Operators                                          A=B                        A != B, A <> B, A ^= B    ...
Range Comparison Operators                                              IN                                ANY, SOME       ...
Existence Comparison OperatorsOperator                                    MeaningBETWEEN … AND ….                         ...
Similarity Comparison OperatorsOperator                       MeaningAND                            Return TRUE if both co...
Obtaining Data from Multiple table using Join           Conditions and the Filter ClauseYou can write the join condition i...
We are into training business since 10+ years and have trained     more than 1000+ candidates in the field of Database, So...
Upcoming SlideShare
Loading in …5
×

Oracle fundamentals and sql

1,251 views
1,183 views

Published on

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
1,251
On SlideShare
0
From Embeds
0
Number of Embeds
88
Actions
Shares
0
Downloads
32
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Oracle fundamentals and sql

  1. 1. Introduction Describing the Life Cycle Development Phases Defining a Database Discussing the Theoretical, Conceptual, and Physical Aspects of a Relational Database Describing How a Relational Database Management System (RDBMS) Is Used to Manage a Relational Database Describing the Oracle Implementation of Both the RDBMS and the Object Relational Database Management System (ORDBMS) Describing How SQL Is Used in the Oracle Product SetWriting a Basic SQL Statement Describing the SQL Select Capabilities Executing a Basic Select Statement with the Mandatory Clauses Differentiating Between SQL and iSQL*Plus CommandsRestricting and Sorting Data Limiting the Rows Retrieved by a Query Sorting the Rows Retrieved by a Query Database Basic & Advance Courses by Dip Mail me at dip.ray@plentynum.com 1
  2. 2. Suggested Study Material :Oracle Database 10g SQLBy: Jason Price › Publisher: McGraw-Hill/Osborne › ISBN: 9780070587557 › Edition: 1 - Pub Date: 13-APR-04 › www.tatamcgrawhill.com/html/9780070587557.html Database Basic & Advance Courses by Dip Mail me at dip.ray@plentynum.com 2
  3. 3. DBMS is the collection of interrelated data and a set of program to access the data.DBMS allows only one person to access the data at a given point time.While the DBMS fulfilled the basic requirements of storing data,they were not apractical solution to efficiently storing,manipulating,and retrieving data quickly andeasily.So based on the theory of relational data modeling by Dr. Edgar Codd publishes in theyear 1970 , In 1977 Software Development Laboratories (SDL) formed by Larry Ellison,Bob Miner, Ed Oates and Bruce Scott with $2,000 of startup cash. Larry and Bob wereworking on a CIA project code-named "Oracle."In 1978 SDL changes its name to Relational Software Inc. (RSI) with CIA as the firstcustomer.In 1982 RSI changes its name to Oracle Systems Corporation (OSC) and then simplifiesthe name to Oracle Corporation. Database Basic & Advance Courses by Dip Mail me at dip.ray@plentynum.com 3
  4. 4. RDBMS manages large volumes of data while supporting a large number of userssimultaneously.In a relational database,files do exist,but only as a medium to store data on disk.While a file processing system will only access a particular file when necessary toretrieve data,a relational database system will access all files simultaneously asone seamless system. The data that is stored in the database is completelyindependent of the files. The entire system is managed by a central database enginethat processes queries and manipulates data on demand. A single query can retrievethe data regardless of where it is stored.Instead of merely acting as a journal of transactions,a relational database preservesthe natural relationships that exist between real world entities and stores the data inthis manner. Database Basic & Advance Courses by Dip Mail me at dip.ray@plentynum.com 4
  5. 5. For example,data for a company’s employees is stored in a structure,with eachemployee stored only once. Data for the employees’ dependents may also need to bestored in another structure Each record for a dependent will contain a pointer whichreferences its related employee.Figure in the next slide shows how the relational database preserves the relationshipsthat occur naturally between employees and their dependents. Database Basic & Advance Courses by Dip Mail me at dip.ray@plentynum.com 5
  6. 6. Dependen t1EMPLOYEE 1 Dependen t2 Dependen t1 DependenEMPLOYEE 2 t2 Dependen t3EMPLOYEE 3 Database Basic & Advance Courses by Dip Mail me at dip.ray@plentynum.com 6
  7. 7. As shown in the Figure, more dependents can be added to a single employeewithout storing the employee’s information over and over again. Data can also bestored for an employee that has no dependents whatsoever. If an employeeleavesthe company,deleting the employee would also automatically delete all data forthe employee’s dependents. Since data is stored only once,if an employee movesto a new address,updating the data is only a matter of changing a single record.This configuration reduces data redundancy,which saves critical storage space,and still provides simplicity and ease in data management.An additional benefit of the RDBMS is that it is self-describing. The databasecontains not only users’ data,but also a description of its own structure, which iscommonly referred as metadata. Database Basic & Advance Courses by Dip Mail me at dip.ray@plentynum.com 7
  8. 8. Entity-Relationship ModelEntitiesAn entity is the person,place,thing,or abstract concept that you want to track inthe database. When building the data model,the first thing to do is identify allthe required entities based on the initial system requirements that weredetermined during the analysis phase. Each entity must be clearly defined toavoid ambiguity and design flaws.You should first build a simple list of the entities, and then add each one to thedata model. In the James Martin data model,entities are represented by squareswith rounded corners and are labeled with their names. Database Basic & Advance Courses by Dip Mail me at dip.ray@plentynum.com 8
  9. 9. Below Figure shows a data model with a few example of entities for a student registration system for a college.STUDENT CLASS SUBJECT INSTRUCTORSince each entity in a data model should only represent a single instance of theentity,the name of each entity should be listed in its singular form. The designshould only show how one single entity relates to another single entity.The entities can be placed anywhere in the data model and can be adjusted forclarity as more entities and relationships are added. Once the set of entitieshas been identified and added to the model,you should review the model tomake sure that the model will conform to the system requirements. Later,oncethe data model is complete,these entities will become tables that you willcreate in the database. Database Basic & Advance Courses by Dip Mail me at dip.ray@plentynum.com 9
  10. 10. AttributesOnce the entities have been identified and added to the data model,you candecide on the exact details for each entity that should be stored. At a minimum,these details should fully support the initial system requirements,but you can alsoinclude any additional details that you feel would contribute to the overall qualityof the system. Perhaps you see the opportunity to provide additional functionalitythat might prove useful later on,such as a timestamp to store the most recenttime each customer signed onto the system.First,you should build a list of attributes per entity using words that are simple,but fully explain the exact purpose of the attribute. The attributes you decide onwill become the columns of the tables. If the columns are named properly earlyin the design process,later users will not have to guess what a column is for.Once clear attribute names have been identified,some people choose to convertthese names into appropriate column names. Database Basic & Advance Courses by Dip Mail me at dip.ray@plentynum.com 10
  11. 11. Following Figure shows the college student registration system with attributes. STUDENT CLASS STUD_ID CLASS_ID L_NAME SUBJECT SEMESTER F_NAME CLASS_NAME ADDR_LINE SUBJECT_ID SUBJECT CITY SUBJECT_NAME LOCATION PIN DEGREE_PROG DURATION STATE GRADE_LEVEL PHONE_NO INSTRUCTOR INTRUC_ID L_NAME FNAME Database Basic & Advance Courses by Dip Mail me at dip.ray@plentynum.com 11
  12. 12. Entities and Their RelationshipsThe relationships between entities is the focal point for the relational databasemanagement system. Therefore,it is critical to understand how entity relationshipsare defined and how these relationships are treated to preserve data integrity.In a data model,to represent a relationship,you would simply draw a line connectingtwo entities.This indicates that in some way, shape or form, one or both entities influences theother. However,this notation is simply not enough to provide a clear picture of theimplications of the relationship. You must also include the entities’ cardinality. Database Basic & Advance Courses by Dip Mail me at dip.ray@plentynum.com 12
  13. 13. CardinalityCardinality refers to the quantity of entity instances that are allowed on eitherside of the relationship and is represented by making certain notations directly onthe relationship lines between the entities.Types of RelationshipsThere are three main types of relationships,depending on the cardinality of theentities involved. These are:• One-to-one (1:1)—Indicates that one instance of an entity must be associatedwith exactly one instance of another entity.• One-to-many (1:M)—Indicates that one instance of an entity may be associatedwith one or more instances of another entity.• Many-to-many (M:N)—Indicates that one or more instances of an entity maybe associated with one or more instances of another entity. Database Basic & Advance Courses by Dip Mail me at dip.ray@plentynum.com 13
  14. 14. Cardinality Notations CUSTOMER ORDER ITEMThe relationship between CUSTOMER and ORDER in Figure is a one-to- manyrelationship; a single customer may have one or more orders. The relationshipbetween ORDER and ITEM is a many-to-many relationship; a single order maycontain multiple items,and a single item may be found on multiple orders. One-to-one relationships are very rare, because such a relationship is simple one. If aone-to-one relationship is found in a data model, the two entities can usually becombined into a single entity without losing the meaningful value of the data. Database Basic & Advance Courses by Dip Mail me at dip.ray@plentynum.com 14
  15. 15. NormalizationThe theoretical concepts of Mathematical Set Theory and Relational Algebraallowed a database designer to organize data in a systematic fashion bysimply defining how each piece of data related to another through a processcalled data normalization.The purpose of normalization is to build a data model according to systemrequirements and to make adjustments to the model to remove as manydesign flaws as possible. The ultimate data model would providemanageability so that a single piece of data can be updated in a singlelocation,and it would clearly show the relationships without ambiguity. Alldesign flaws and anomalies would be worked out of the design to allow themost flexible database system without a single incident of redundancy. Asyou can imagine, eliminating all anomalies is somewhat of a lofty goal andis not often reached. As your data model moves closer to this goal,manydesign anomalies and data management problems disappear. Database Basic & Advance Courses by Dip Mail me at dip.ray@plentynum.com 15
  16. 16. Strategy Software development Life cycle andAnalysis Design Build and Document Transition Production Database Basic & Advance Courses by Dip Mail me at dip.ray@plentynum.com 16
  17. 17. Oracle10g offers a comprehensive high performance infrastructure needed todevelop, deploy, and manage Internet applications or e-business solutions as follows• GRID COMPUTING, AUTOMATION, SELF-MANAGEMENT• Scalability from departments to enterprise e-business sites Robust, reliable, available, secure architecture One development model, easy deployment options Leverage an organization’s current skill set throughout the Oracle platform (including SQL,PL/SQL, Java, and XML) One management interface for all applications Industry standard technologies, no proprietary lock-in Database Basic & Advance Courses by Dip Mail me at dip.ray@plentynum.com 17
  18. 18. Structured Query Language (SQL)The SQL in PL/SQL stands for structured query language. We use SQL to SELECT,INSERT, UPDATE, or DELETE data. We use it to create and maintain objects andusers, and to control access rights to our instances.SQL (pronounced as sequel or by its letter abbreviation) is the entrance, orwindow, to the database. It is a fourth-generation language (4GL) that is intendedto be easy to use and quick to learn. The basic SQL syntax is not the creation ofOracle. It actually grew out of the work done by Dr. E.F. Codd and IBM in theearly 1970s. The American National Standards Institute (ANSI) recognizes SQLand publishes standards for the language.Oracle supports ANSI-standard SQL but also adds its own twist in its SQL*Plusutility. Through SQL*Plus, Oracle supports additional commands and capabilitiesthat are not part of the standard. SQL*Plus is a utility available in multiple forms: Database Basic & Advance Courses by Dip Mail me at dip.ray@plentynum.com 18
  19. 19. SQL*Plus in Oracle accepts literally dozens of commands andhas even more environmental settings. Many of the commandsaccept arguments that control the effects of the command.Some of the more commonly used commands are listed below. CLEAR HOST COLUMN LIST CONNECT RUN DEL SAVE DESCRIBE SET DISCONNECT SHOW EDIT SHUTDOWN EXECUTE SPOOL EXIT START/STARTUP GET SHOW ALL Database Basic & Advance Courses by Dip Mail me at dip.ray@plentynum.com 19
  20. 20. Data Types DescriptionVARCHAR2 (SIZE) Variable-length character dataCHAR (Size) Fixed-length character dataNUMBER (p,s) Variable-length numeric dataDATE Date and Time ValuesLONG Variable-length character data Up to 2 gigabytesCLOB Character data up to 4 gigabytesRAW and LONG RAW Raw Binary DataBLOB Binary Data up to 4 gigabytesBFILE Binary Data stored in an external file Up to 4 gigabytesROWID A 64 base number system representing the unique address of a row in its table Database Basic & Advance Courses by Dip Mail me at dip.ray@plentynum.com 20
  21. 21. Database Objects DescriptionTable Basic Unit of Storage, Composed of Rows and ColumnsView Logically represents subset of date from one or more tablesSequence Numeric Value GeneratorIndex Improves the performance of some queriesSynonym Give alternative names of objects Database Basic & Advance Courses by Dip Mail me at dip.ray@plentynum.com 21
  22. 22. Types of SQL Statements and their RepresentationsSelect Data RetrievalInsertUpdate Data Manipulation Language (DML)DeleteMergeCreateAlterDrop Data Definition Language (DDL)RenameTruncateCommitRollback Transaction ControlSavepointGrantRevoke Data Control Language (DCL) Database Basic & Advance Courses by Dip Mail me at dip.ray@plentynum.com 22
  23. 23. The Basic Command SELECT column_list FROM table_name; Filtering the Result Set SELECT column_list FROM table_name WHERE conditions;Database Basic & Advance Courses by Dip Mail me at dip.ray@plentynum.com 23
  24. 24. Using Arithmetic Operators with SQL Statements Operator Description + Add - Subtract * Multiply / Divide Example : Select last_name, salary, salary + 300 From employees; Database Basic & Advance Courses by Dip Mail me at dip.ray@plentynum.com 24
  25. 25. Oracle’s comparison operators are broken down into the following groups:Simple comparison operatorsRange comparison operatorsExistence comparison operatorSimilarity comparison operatorNull comparison operatorRegardless of the type of comparison operator that is used, the values that arebeing compared must be of the same data type or an error will be returned. Forexample,you cannot directly compare a NUMBER datatype to a DATE datatype.Simple comparison operators test the condition of one value compared to another.The Next Slide lists the comparison operators that are supported by Oracle. Database Basic & Advance Courses by Dip Mail me at dip.ray@plentynum.com 25
  26. 26. Simple Comparison Operators A=B A != B, A <> B, A ^= B A>B A<B A >= B A <= BDatabase Basic & Advance Courses by Dip Mail me at dip.ray@plentynum.com 26
  27. 27. Range Comparison Operators IN ANY, SOME ALL BETWEEN a AND bDatabase Basic & Advance Courses by Dip Mail me at dip.ray@plentynum.com 27
  28. 28. Existence Comparison OperatorsOperator MeaningBETWEEN … AND …. Between Two Values (Inclusive)IN (SET) Match any of a list of ValuesLIKE Match a Character PatternIS NULL Is a null Value Database Basic & Advance Courses by Dip Mail me at dip.ray@plentynum.com 28
  29. 29. Similarity Comparison OperatorsOperator MeaningAND Return TRUE if both components Conditions are trueOR Return TRUE if either components Condition is trueNOT Return TRUE if the following Condition is false Database Basic & Advance Courses by Dip Mail me at dip.ray@plentynum.com 29
  30. 30. Obtaining Data from Multiple table using Join Conditions and the Filter ClauseYou can write the join condition in the where clause, by prefixingthe column name with the table name when the same columnname appears in more than one tableSyntax is :SELECT table1.column, table2.columnFrom table1, table2Where table1.column1 = table2.column2; Database Basic & Advance Courses by Dip Mail me at dip.ray@plentynum.com 30
  31. 31. We are into training business since 10+ years and have trained more than 1000+ candidates in the field of Database, Some of them have given their valued opinion which can be looked into http://www.plentynum.com/testimonials_academy.html If you like us to contact you then fill up the form at http://plentynum.com/enquiry.html In case of any clarification / requirements you can mail the undersigned or call us at +91.99713 65346 (Delhi) / +91.99032 69302 (Kolkata).Disclaimer : Oracle and other product are registered trademark of their respective owners, this slide only is for help to an individual and we are nowhereresponsible for any error/fault coming from the said materials/slides Database Basic & Advance Courses by Dip Mail me at dip.ray@plentynum.com 31

×