SlideShare ist ein Scribd-Unternehmen logo
1 von 28
Module III: Relational Model
          Objects
Contents
Domains and Relations, Relations and
 predicates, Relational Data Integrity ; Primary
 Key, Candidate Key , Foreign Key and their
 rules;   Relational    operators,    Relational
 Algebra, Relational Calculus, SQL Language,
 Data definition, Data retrieval and update
 operations.
What are the Different types of
          Keys in RDBMS ?
•   Alternate key - An alternate key is any candidate key which is not selected to be
    the primary key


•   Candidate key - A candidate key is a field or combination of fields that can act
    as a primary key field for that table to uniquely identify each record in that table.


•    Compound key - compound key (also called a composite key or concatenated
    key) is a key that consists of 2 or more attributes.


•   Primary key - a primary key is a value that can be used to identify a unique row
    in a table. Attributes are associated with it. Examples of primary keys are Social
    Security numbers (associated to a specific person) or ISBNs (associated to a
    specific book).
•   In the relational model of data, a primary key is a candidate key chosen as the main
    method of uniquely identifying a tuple in a relation.

•    Superkey - A superkey is defined in the relational model as a set of attributes of a
    relation variable (relvar) for which it holds that in all relations assigned to that
    variable there are no two distinct tuples (rows) that have the same values for the
    attributes in this set. Equivalently a superkey can also be defined as a set of
    attributes of a relvar upon which all attributes of the relvar are functionally
    dependent.

•    Foreign key - a foreign key (FK) is a field or group of fields in a database record
    that points to a key field or group of fields forming a key of another database record
    in some (usually different) table. Usually a foreign key in one table refers to the
    primary key (PK) of another table. This way references can be made to link
    information together and it is an essential part of database normalization
Relational Algebra
• The basic set of operations for the relational model is known
  as the relational algebra. These operations enable a user to
  specify basic retrieval requests.

• The result of a retrieval is a new relation, which may have
  been formed from one or more relations. The algebra
  operations thus produce new relations, which can be further
  manipulated using operations of the same algebra.

• A sequence of relational algebra operations forms a
  relational algebra expression, whose result will also be a
  relation that represents the result of a database query (or
  retrieval request).
Unary Relational Operations
• SELECT Operation

  SELECT operation is used to select a subset of the tuples from a relation that
  satisfy a selection condition. It is a filter that keeps only those tuples that
  satisfy a qualifying condition – those satisfying the condition are selected
  while others are discarded.
  Example: To select the EMPLOYEE tuples whose department number is
  four or those whose salary is greater than $30,000 the following notation is
  used:
  σ DNO = 4 (EMPLOYEE)
               σ SALARY > 30,000 (EMPLOYEE)
  In general, the select operation is denoted by σ <selection condition>(R) where the
  symbol σ (sigma) is used to denote the select operator, and the selection
  condition is a Boolean expression specified on the attributes of relation R
Unary Relational Operations
          (cont.)
Unary Relational Operations
                  (cont.)
• PROJECT Operation
  This operation selects certain columns from the table and discards the other
  columns. The PROJECT creates a vertical partitioning – one with the needed
  columns (attributes) containing results of the operation and other containing
  the discarded Columns.
  Example: To list each employee’s first and last name and salary, the
  following is used:
                 π                     (EMPLOYEE)
                     LNAME, FNAME,SALARY


                                               π
  The general form of the project operation is <attribute list>(R) where     π
  (pi) is the symbol used to represent the project operation and <attribute list>
  is the desired list of attributes from the attributes of relation R.
  The project operation removes any duplicate tuples, so the result of the
  project operation is a set of tuples and hence a valid relation.
Unary Relational Operations (cont.)
• Rename Operation
  We may want to apply several relational algebra operations one after the other.
  Either we can write the operations as a single relational algebra expression
  by nesting the operations, or we can apply one operation at a time and create
  intermediate result relations. In the latter case, we must give names to the
  relations that hold the intermediate results.
  Example: To retrieve the first name, last name, and salary of all employees
  who work in department number 5, we must apply a select and a project
  operation. We can write a single relational algebra expression as follows:

  π   FNAME, LNAME, SALARY   (σ   DNO=5   (EMPLOYEE))
  OR We can explicitly show the sequence of operations, giving a name to each
  intermediate relation:
  DEP5_EMPS ←             σ   DNO=5   (EMPLOYEE)
  RESULT ←          π   FNAME, LNAME, SALARY   (DEP5_EMPS)
Relational Algebra Operations From
            Set Theory
• UNION Operation
  The result of this operation, denoted by R ∪ S, is a relation that includes all
  tuples that are either in R or in S or in both R and S. Duplicate tuples are
  eliminated.
  Example: To retrieve the social security numbers of all employees who either
  work in department 5 or directly supervise an employee who works in
  department 5, we can use the union operation as follows:
  DEP5_EMPS ←       σ     DNO=5   (EMPLOYEE)
  RESULT1 ←     π   SSN (DEP5_EMPS)
  RESULT2(SSN) ← π SUPERSSN(DEP5_EMPS)
  RESULT ← RESULT1 ∪ RESULT2
  The union operation produces the tuples that are in either RESULT1 or
  RESULT2 or both. The two operands must be “type compatible”.
Relational Algebra Operations From
         Set Theory (cont.)
• INTERSECTION OPERATION

 The result of this operation, denoted by R ∩ S, is a relation that includes all
 tuples that are in both R and S. The two operands must be "type compatible"

 Example: The result of the intersection operation (figure below) includes
 only those who are both students and instructors.




                          STUDENT ∩ INSTRUCTOR
Relational Algebra Operations From
        Set Theory (cont.)
• Set Difference (or MINUS) Operation
  The result of this operation, denoted by R - S, is a relation that includes all
  tuples that are in R but not in S. The two operands must be "type compatible”.

  Example: The figure shows the names of students who are not instructors,
  and the names of instructors who are not students.


                                                          STUDENT-INSTRUCTOR




                                                          INSTRUCTOR-STUDENT
Relational Algebra Operations From
         Set Theory (cont.)
• CARTESIAN (or cross product) Operation
   – This operation is used to combine tuples from two relations in a
     combinatorial fashion. In general, the result of R(A1, A2, . . ., An) x
     S(B1, B2, . . ., Bm) is a relation Q with degree n + m attributes Q(A1,
     A2, . . ., An, B1, B2, . . ., Bm), in that order. The resulting relation Q
     has one tuple for each combination of tuples—one from R and one
     from S.
   – Hence, if R has nR tuples (denoted as |R| = nR ), and S has nS
     tuples, then
      | R x S | will have nR * nS tuples.
   – The two operands do NOT have to be "type compatible”

  Example:
   FEMALE_EMPS ← σ SEX=’F’(EMPLOYEE)
   EMPNAMES ← π FNAME, LNAME, SSN (FEMALE_EMPS)
Binary Relational Operations
• JOIN Operation
  – The sequence of cartesian product followed by select is
    used quite commonly to identify and select related tuples
    from two relations, a special operation, called JOIN. It is
    denoted by a
  – This operation is very important for any relational
    database with more than a single relation, because it
    allows us to process relationships among relations.
  – The general form of a join operation on two relations
    R(A1, A2, . . ., An) and S(B1, B2, . . ., Bm) is:
     R                   S
          <join condition>

      where R and S can be any relations that result from general
 relational algebra expressions.
Binary Relational Operations
              (cont.)
Example: Suppose that we want to retrieve the name of
the manager of each department. To get the manager’s
name, we need to combine each DEPARTMENT tuple
with the EMPLOYEE tuple whose SSN value matches
the MGRSSN value in the department tuple. We do this
by using the join     operation.
DEPT_MGR ← DEPARTMENT         MGRSSN=SSN
                                           EMPLOYEE
Binary Relational Operations (cont.)
• EQUIJOIN Operation
  The most common use of join involves join conditions with equality comparisons only.
  Such a join, where the only comparison operator used is =, is called an EQUIJOIN. In
  the result of an EQUIJOIN we always have one or more pairs of attributes (whose
  names need not be identical) that have identical values in every tuple.
  The JOIN seen in the previous example was EQUIJOIN.


• NATURAL JOIN Operation
  Because one of each pair of attributes with identical values is superfluous, a new
  operation called natural join—denoted by *—was created to get rid of the second
  (superfluous) attribute in an EQUIJOIN condition.
  The standard definition of natural join requires that the two join attributes, or each pair
  of corresponding join attributes, have the same name in both relations. If this is not the
  case, a renaming operation is applied first.
Binary Relational Operations (cont.)
•   DIVISION Operation
    – The division operation is applied to two relations
      R(Z) ÷ S(X), where X subset Z. Let Y = Z - X (and
      hence Z = X ∪ Y); that is, let Y be the set of attributes
      of R that are not attributes of S.
    – The result of DIVISION is a relation T(Y) that includes
      a tuple t if tuples tR appear in R with tR [Y] = t, and with
        tR [X] = ts for every tuple ts in S.

    – For a tuple t to appear in the result T of the DIVISION,
      the values in t must appear in R in combination with
      every tuple in S.
Examples of Queries in Relational
•   Q1: Retrieve the name Algebraof all employees who
                          and address
    work for the ‘Research’ department.
    RESEARCH_DEPT ← σ DNAME=’Research’ (DEPARTMENT)
    RESEARCH_EMPS ← (RESEARCH_DEPT          DNUMBER= DNOEMPLOYEE   EMPLOYEE)
    RESULT ← π FNAME, LNAME, ADDRESS (RESEARCH_EMPS)

• Q6: Retrieve the names of employees who have no
  dependents.
    ALL_EMPS ← π SSN(EMPLOYEE)
    EMPS_WITH_DEPS(SSN) ← π ESSN(DEPENDENT)
    EMPS_WITHOUT_DEPS ← (ALL_EMPS - EMPS_WITH_DEPS)
    RESULT ← π LNAME, FNAME (EMPS_WITHOUT_DEPS * EMPLOYEE)
Relational Calculus
• A relational calculus expression creates a new relation, which is
  specified in terms of variables that range over rows of the stored
  database relations (in tuple calculus) or over columns of the
  stored relations (in domain calculus).
• In a calculus expression, there is no order of operations to
  specify how to retrieve the query result—a calculus expression
  specifies only what information the result should contain. This is
  the main distinguishing feature between relational algebra and
  relational calculus.
• Relational calculus is considered to be a nonprocedural
  language. This differs from relational algebra, where we must
  write a sequence of operations to specify a retrieval request;
  hence relational algebra can be considered as a procedural way
  of stating a query.
Tuple Relational Calculus
•   The tuple relational calculus is based on specifying a number of tuple variables. Each
    tuple variable usually ranges over a particular database relation, meaning that the
    variable may take as its value any individual tuple from that relation.
•   A simple tuple relational calculus query is of the form
    {t | COND(t)}
    where t is a tuple variable and COND (t) is a conditional expression involving t. The
    result of such a query is the set of all tuples t that satisfy COND (t).

    Example: To find the first and last names of all employees whose salary is above
    $50,000, we can write the following tuple calculus expression:

    {t.FNAME, t.LNAME | EMPLOYEE(t) AND t.SALARY>50000}
    The condition EMPLOYEE(t) specifies that the range relation of tuple variable t is
    EMPLOYEE. The first and last name (PROJECTION π FNAME, LNAME) of each
    EMPLOYEE tuple t that satisfies the condition t.SALARY>50000 (SELECTION
    σ   SALARY >50000   ) will be retrieved.
The Domain Relational Calculus
•   Another variation of relational calculus called the domain relational calculus, or
    simply, domain calculus is equivalent to tuple calculus and to relational algebra.
•   The language called QBE (Query-By-Example) that is related to domain calculus was
    developed almost concurrently to SQL at IBM Research, Yorktown Heights, New
    York. Domain calculus was thought of as a way to explain what QBE does.
•   Domain calculus differs from tuple calculus in the type of variables used in formulas:
    rather than having variables range over tuples, the variables range over single values
    from domains of attributes. To form a relation of degree n for a query result, we must
    have n of these domain variables—one for each attribute.
•    An expression of the domain calculus is of the form
    {x1, x2, . . ., xn | COND(x1, x2, . . ., xn, xn+1, xn+2, . . ., xn+m)}
    where x1, x2, . . ., xn, xn+1, xn+2, . . ., xn+m are domain variables that range over
    domains (of attributes) and COND is a condition or formula of the domain relational
    calculus.
Example Query Using Domain
•
                                 Calculus
    Retrieve the birthdate and address of the employee whose name is ‘John B.
    Smith’.

    Query :
    {uv | (∃ q) (∃ r) (∃ s) (∃ t) (∃ w) (∃ x) (∃ y) (∃ z)
    (EMPLOYEE(qrstuvwxyz) and q=’John’ and r=’B’ and s=’Smith’)}

• Ten variables for the employee relation are needed, one to range over the
  domain of each attribute in order. Of the ten variables q, r, s, . . ., z, only u and
  v are free.
• Specify the requested attributes, BDATE and ADDRESS, by the free domain
  variables u for BDATE and v for ADDRESS.
• Specify the condition for selecting a tuple following the bar ( | )—namely, that
  the sequence of values assigned to the variables qrstuvwxyz be a tuple of the
  employee relation and that the values for q (FNAME), r (MINIT), and s
  (LNAME) be ‘John’, ‘B’, and ‘Smith’, respectively.
SQL
• SQL Components (DDL, DML, DCL)
• SQL Constructs (Select…from…where…. group by….
  having…. order by…)
• Nested tables
• Views
• correlated query
• Objects in Oracle.
Clauses in SQL
•   WHERE
•   STARTING WITH
•   ORDER BY
•   GROUP BY
•   HAVING
Operators
• Operators are the elements you use
  inside an expression to articulate how
  you want specified conditions to
  retrieve data
• Operators fall into six groups:
  arithmetic, comparison, character,
  logical, set, and miscellaneous.
Functions: Molding the Data You
              Retrieve
• Functions in SQL enable you to perform
  feats such as determining the sum of a
  column or converting all the characters of
  a string to uppercase.
• Aggregate functions
• Date and time functions
• Arithmetic functions
• Character functions
• Conversion functions
• Miscellaneous functions
Manipulating Data
• The INSERT statement
• The UPDATE statement
• The DELETE statement
Views
• Views, or virtual tables, can be used to
  encapsulate complex queries. After a view
  on a set of data has been created, you
  can treat that view as another table.

Weitere ähnliche Inhalte

Was ist angesagt?

Presentation on dbms(relational calculus)
Presentation on dbms(relational calculus)Presentation on dbms(relational calculus)
Presentation on dbms(relational calculus)yourbookworldanil
 
Relational Algebra Introduction
Relational Algebra IntroductionRelational Algebra Introduction
Relational Algebra IntroductionMd. Afif Al Mamun
 
Relational Algebra-Database Systems
Relational Algebra-Database SystemsRelational Algebra-Database Systems
Relational Algebra-Database Systemsjakodongo
 
Relational Algebra
Relational AlgebraRelational Algebra
Relational Algebraguest20b0b3
 
Relational algebra in dbms
Relational algebra in dbmsRelational algebra in dbms
Relational algebra in dbmsshekhar1991
 
Dbms ii mca-ch5-ch6-relational algebra-2013
Dbms ii mca-ch5-ch6-relational algebra-2013Dbms ii mca-ch5-ch6-relational algebra-2013
Dbms ii mca-ch5-ch6-relational algebra-2013Prosanta Ghosh
 
Chapter-7 Relational Calculus
Chapter-7 Relational CalculusChapter-7 Relational Calculus
Chapter-7 Relational CalculusKunal Anand
 
Relational Algebra
Relational AlgebraRelational Algebra
Relational AlgebraAmin Omi
 
Ch6 formal relational query languages
Ch6 formal relational query languages Ch6 formal relational query languages
Ch6 formal relational query languages uoitc
 
Additional Relational Algebra Operations
Additional Relational Algebra OperationsAdditional Relational Algebra Operations
Additional Relational Algebra OperationsA. S. M. Shafi
 

Was ist angesagt? (16)

Presentation on dbms(relational calculus)
Presentation on dbms(relational calculus)Presentation on dbms(relational calculus)
Presentation on dbms(relational calculus)
 
Relational Algebra Introduction
Relational Algebra IntroductionRelational Algebra Introduction
Relational Algebra Introduction
 
Relational Algebra-Database Systems
Relational Algebra-Database SystemsRelational Algebra-Database Systems
Relational Algebra-Database Systems
 
Relational Algebra
Relational AlgebraRelational Algebra
Relational Algebra
 
Relational algebra in dbms
Relational algebra in dbmsRelational algebra in dbms
Relational algebra in dbms
 
Relational algebra in dbms
Relational algebra in dbmsRelational algebra in dbms
Relational algebra in dbms
 
Dbms ii mca-ch5-ch6-relational algebra-2013
Dbms ii mca-ch5-ch6-relational algebra-2013Dbms ii mca-ch5-ch6-relational algebra-2013
Dbms ii mca-ch5-ch6-relational algebra-2013
 
Chapter-7 Relational Calculus
Chapter-7 Relational CalculusChapter-7 Relational Calculus
Chapter-7 Relational Calculus
 
1643 y є r relational calculus-1
1643 y є r  relational calculus-11643 y є r  relational calculus-1
1643 y є r relational calculus-1
 
Relational Algebra
Relational AlgebraRelational Algebra
Relational Algebra
 
Relational+algebra (1)
Relational+algebra (1)Relational+algebra (1)
Relational+algebra (1)
 
Ch6 formal relational query languages
Ch6 formal relational query languages Ch6 formal relational query languages
Ch6 formal relational query languages
 
Ra Revision
Ra RevisionRa Revision
Ra Revision
 
Relational Algebra
Relational AlgebraRelational Algebra
Relational Algebra
 
Relational algebra
Relational algebraRelational algebra
Relational algebra
 
Additional Relational Algebra Operations
Additional Relational Algebra OperationsAdditional Relational Algebra Operations
Additional Relational Algebra Operations
 

Andere mochten auch

Andere mochten auch (8)

Files
FilesFiles
Files
 
F58fbnatural resources 2
F58fbnatural resources 2F58fbnatural resources 2
F58fbnatural resources 2
 
Ff40fnatural resources
Ff40fnatural resourcesFf40fnatural resources
Ff40fnatural resources
 
Julius caesar
Julius caesarJulius caesar
Julius caesar
 
Windows 8 tips & tricks
Windows 8 tips & tricksWindows 8 tips & tricks
Windows 8 tips & tricks
 
Database
DatabaseDatabase
Database
 
E212d9a797dbms chapter3 b.sc2 (2)
E212d9a797dbms chapter3 b.sc2 (2)E212d9a797dbms chapter3 b.sc2 (2)
E212d9a797dbms chapter3 b.sc2 (2)
 
File management
File managementFile management
File management
 

Ähnlich wie E212d9a797dbms chapter3 b.sc2 (1)

Module 2-2.ppt
Module 2-2.pptModule 2-2.ppt
Module 2-2.pptShylaja40
 
Intro to relational model
Intro to relational modelIntro to relational model
Intro to relational modelATS SBGI MIRAJ
 
3._Relational_Algebra.pptx:Basics of relation algebra
3._Relational_Algebra.pptx:Basics of relation algebra3._Relational_Algebra.pptx:Basics of relation algebra
3._Relational_Algebra.pptx:Basics of relation algebraZakriyaMalik2
 
Relational Algebra Ch6 (Navathe 4th edition)/ Ch7 (Navathe 3rd edition)
Relational Algebra Ch6 (Navathe 4th edition)/ Ch7 (Navathe 3rd edition)Relational Algebra Ch6 (Navathe 4th edition)/ Ch7 (Navathe 3rd edition)
Relational Algebra Ch6 (Navathe 4th edition)/ Ch7 (Navathe 3rd edition)Raj vardhan
 
316_16SCCCS4_2020052505222431.pptdatabasex
316_16SCCCS4_2020052505222431.pptdatabasex316_16SCCCS4_2020052505222431.pptdatabasex
316_16SCCCS4_2020052505222431.pptdatabasexabhaysonone0
 
Query Decomposition and data localization
Query Decomposition and data localization Query Decomposition and data localization
Query Decomposition and data localization Hafiz faiz
 
Relational algebr
Relational algebrRelational algebr
Relational algebrVisakh V
 
Unit-II DBMS presentation for students.pdf
Unit-II DBMS presentation for students.pdfUnit-II DBMS presentation for students.pdf
Unit-II DBMS presentation for students.pdfajajkhan16
 
5th chapter Relational algebra.pptx
5th chapter Relational algebra.pptx5th chapter Relational algebra.pptx
5th chapter Relational algebra.pptxkavitha623544
 
Relational operation final
Relational operation finalRelational operation final
Relational operation finalStudent
 
relational algebra-(basics)
 relational algebra-(basics) relational algebra-(basics)
relational algebra-(basics)Nilt1234
 
RelationalAlgebra-RelationalCalculus-SQL.pdf
RelationalAlgebra-RelationalCalculus-SQL.pdfRelationalAlgebra-RelationalCalculus-SQL.pdf
RelationalAlgebra-RelationalCalculus-SQL.pdf10GUPTASOUMYARAMPRAK
 
Relational Algebra Operations
Relational Algebra OperationsRelational Algebra Operations
Relational Algebra OperationsShefa Idrees
 
Relational algebra
Relational algebraRelational algebra
Relational algebraHuda Alameen
 
Relational Data Model Introduction
Relational Data Model IntroductionRelational Data Model Introduction
Relational Data Model IntroductionNishant Munjal
 
Chapter – 5 Relational Algebra.pdf
Chapter – 5 Relational Algebra.pdfChapter – 5 Relational Algebra.pdf
Chapter – 5 Relational Algebra.pdfTamiratDejene1
 
Relational Algebra.ppt
Relational Algebra.pptRelational Algebra.ppt
Relational Algebra.pptSreenivas R
 

Ähnlich wie E212d9a797dbms chapter3 b.sc2 (1) (20)

Module 2-2.ppt
Module 2-2.pptModule 2-2.ppt
Module 2-2.ppt
 
Intro to relational model
Intro to relational modelIntro to relational model
Intro to relational model
 
3._Relational_Algebra.pptx:Basics of relation algebra
3._Relational_Algebra.pptx:Basics of relation algebra3._Relational_Algebra.pptx:Basics of relation algebra
3._Relational_Algebra.pptx:Basics of relation algebra
 
2 r algebra
2 r algebra2 r algebra
2 r algebra
 
Relational model
Relational modelRelational model
Relational model
 
Relational Algebra Ch6 (Navathe 4th edition)/ Ch7 (Navathe 3rd edition)
Relational Algebra Ch6 (Navathe 4th edition)/ Ch7 (Navathe 3rd edition)Relational Algebra Ch6 (Navathe 4th edition)/ Ch7 (Navathe 3rd edition)
Relational Algebra Ch6 (Navathe 4th edition)/ Ch7 (Navathe 3rd edition)
 
316_16SCCCS4_2020052505222431.pptdatabasex
316_16SCCCS4_2020052505222431.pptdatabasex316_16SCCCS4_2020052505222431.pptdatabasex
316_16SCCCS4_2020052505222431.pptdatabasex
 
Query Decomposition and data localization
Query Decomposition and data localization Query Decomposition and data localization
Query Decomposition and data localization
 
Relational algebr
Relational algebrRelational algebr
Relational algebr
 
Unit-II DBMS presentation for students.pdf
Unit-II DBMS presentation for students.pdfUnit-II DBMS presentation for students.pdf
Unit-II DBMS presentation for students.pdf
 
5th chapter Relational algebra.pptx
5th chapter Relational algebra.pptx5th chapter Relational algebra.pptx
5th chapter Relational algebra.pptx
 
Relational operation final
Relational operation finalRelational operation final
Relational operation final
 
relational algebra-(basics)
 relational algebra-(basics) relational algebra-(basics)
relational algebra-(basics)
 
Chapter6
Chapter6Chapter6
Chapter6
 
RelationalAlgebra-RelationalCalculus-SQL.pdf
RelationalAlgebra-RelationalCalculus-SQL.pdfRelationalAlgebra-RelationalCalculus-SQL.pdf
RelationalAlgebra-RelationalCalculus-SQL.pdf
 
Relational Algebra Operations
Relational Algebra OperationsRelational Algebra Operations
Relational Algebra Operations
 
Relational algebra
Relational algebraRelational algebra
Relational algebra
 
Relational Data Model Introduction
Relational Data Model IntroductionRelational Data Model Introduction
Relational Data Model Introduction
 
Chapter – 5 Relational Algebra.pdf
Chapter – 5 Relational Algebra.pdfChapter – 5 Relational Algebra.pdf
Chapter – 5 Relational Algebra.pdf
 
Relational Algebra.ppt
Relational Algebra.pptRelational Algebra.ppt
Relational Algebra.ppt
 

Mehr von Mukund Trivedi (20)

System development life cycle (sdlc)
System development life cycle (sdlc)System development life cycle (sdlc)
System development life cycle (sdlc)
 
Process of design
Process of designProcess of design
Process of design
 
New file and form 2
New file and form 2New file and form 2
New file and form 2
 
File organisation
File organisationFile organisation
File organisation
 
Evaluation
EvaluationEvaluation
Evaluation
 
Case tools
Case toolsCase tools
Case tools
 
Evaluation
EvaluationEvaluation
Evaluation
 
Dfd final
Dfd finalDfd final
Dfd final
 
Sad
SadSad
Sad
 
C++ file
C++ fileC++ file
C++ file
 
Ff40fnatural resources (1)
Ff40fnatural resources (1)Ff40fnatural resources (1)
Ff40fnatural resources (1)
 
F58fbnatural resources 2 (1)
F58fbnatural resources 2 (1)F58fbnatural resources 2 (1)
F58fbnatural resources 2 (1)
 
F6dc1 session6 c++
F6dc1 session6 c++F6dc1 session6 c++
F6dc1 session6 c++
 
Ee2fbunit 7
Ee2fbunit 7Ee2fbunit 7
Ee2fbunit 7
 
E212d9a797dbms chapter3 b.sc2
E212d9a797dbms chapter3 b.sc2E212d9a797dbms chapter3 b.sc2
E212d9a797dbms chapter3 b.sc2
 
C96e1 session3 c++
C96e1 session3 c++C96e1 session3 c++
C96e1 session3 c++
 
B1ce9 assignmentbsc
B1ce9 assignmentbscB1ce9 assignmentbsc
B1ce9 assignmentbsc
 
Af7ff syllabuslablist
Af7ff syllabuslablistAf7ff syllabuslablist
Af7ff syllabuslablist
 
106da session5 c++
106da session5 c++106da session5 c++
106da session5 c++
 
098ca session7 c++
098ca session7 c++098ca session7 c++
098ca session7 c++
 

Kürzlich hochgeladen

Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersRaghuram Pandurangan
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rick Flair
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demoHarshalMandlekar2
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
What is Artificial Intelligence?????????
What is Artificial Intelligence?????????What is Artificial Intelligence?????????
What is Artificial Intelligence?????????blackmambaettijean
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESmohitsingh558521
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 

Kürzlich hochgeladen (20)

Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information Developers
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demo
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
What is Artificial Intelligence?????????
What is Artificial Intelligence?????????What is Artificial Intelligence?????????
What is Artificial Intelligence?????????
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 

E212d9a797dbms chapter3 b.sc2 (1)

  • 1. Module III: Relational Model Objects
  • 2. Contents Domains and Relations, Relations and predicates, Relational Data Integrity ; Primary Key, Candidate Key , Foreign Key and their rules; Relational operators, Relational Algebra, Relational Calculus, SQL Language, Data definition, Data retrieval and update operations.
  • 3. What are the Different types of Keys in RDBMS ? • Alternate key - An alternate key is any candidate key which is not selected to be the primary key • Candidate key - A candidate key is a field or combination of fields that can act as a primary key field for that table to uniquely identify each record in that table. • Compound key - compound key (also called a composite key or concatenated key) is a key that consists of 2 or more attributes. • Primary key - a primary key is a value that can be used to identify a unique row in a table. Attributes are associated with it. Examples of primary keys are Social Security numbers (associated to a specific person) or ISBNs (associated to a specific book).
  • 4. In the relational model of data, a primary key is a candidate key chosen as the main method of uniquely identifying a tuple in a relation. • Superkey - A superkey is defined in the relational model as a set of attributes of a relation variable (relvar) for which it holds that in all relations assigned to that variable there are no two distinct tuples (rows) that have the same values for the attributes in this set. Equivalently a superkey can also be defined as a set of attributes of a relvar upon which all attributes of the relvar are functionally dependent. • Foreign key - a foreign key (FK) is a field or group of fields in a database record that points to a key field or group of fields forming a key of another database record in some (usually different) table. Usually a foreign key in one table refers to the primary key (PK) of another table. This way references can be made to link information together and it is an essential part of database normalization
  • 5. Relational Algebra • The basic set of operations for the relational model is known as the relational algebra. These operations enable a user to specify basic retrieval requests. • The result of a retrieval is a new relation, which may have been formed from one or more relations. The algebra operations thus produce new relations, which can be further manipulated using operations of the same algebra. • A sequence of relational algebra operations forms a relational algebra expression, whose result will also be a relation that represents the result of a database query (or retrieval request).
  • 6. Unary Relational Operations • SELECT Operation SELECT operation is used to select a subset of the tuples from a relation that satisfy a selection condition. It is a filter that keeps only those tuples that satisfy a qualifying condition – those satisfying the condition are selected while others are discarded. Example: To select the EMPLOYEE tuples whose department number is four or those whose salary is greater than $30,000 the following notation is used: σ DNO = 4 (EMPLOYEE) σ SALARY > 30,000 (EMPLOYEE) In general, the select operation is denoted by σ <selection condition>(R) where the symbol σ (sigma) is used to denote the select operator, and the selection condition is a Boolean expression specified on the attributes of relation R
  • 8. Unary Relational Operations (cont.) • PROJECT Operation This operation selects certain columns from the table and discards the other columns. The PROJECT creates a vertical partitioning – one with the needed columns (attributes) containing results of the operation and other containing the discarded Columns. Example: To list each employee’s first and last name and salary, the following is used: π (EMPLOYEE) LNAME, FNAME,SALARY π The general form of the project operation is <attribute list>(R) where π (pi) is the symbol used to represent the project operation and <attribute list> is the desired list of attributes from the attributes of relation R. The project operation removes any duplicate tuples, so the result of the project operation is a set of tuples and hence a valid relation.
  • 9. Unary Relational Operations (cont.) • Rename Operation We may want to apply several relational algebra operations one after the other. Either we can write the operations as a single relational algebra expression by nesting the operations, or we can apply one operation at a time and create intermediate result relations. In the latter case, we must give names to the relations that hold the intermediate results. Example: To retrieve the first name, last name, and salary of all employees who work in department number 5, we must apply a select and a project operation. We can write a single relational algebra expression as follows: π FNAME, LNAME, SALARY (σ DNO=5 (EMPLOYEE)) OR We can explicitly show the sequence of operations, giving a name to each intermediate relation: DEP5_EMPS ← σ DNO=5 (EMPLOYEE) RESULT ← π FNAME, LNAME, SALARY (DEP5_EMPS)
  • 10. Relational Algebra Operations From Set Theory • UNION Operation The result of this operation, denoted by R ∪ S, is a relation that includes all tuples that are either in R or in S or in both R and S. Duplicate tuples are eliminated. Example: To retrieve the social security numbers of all employees who either work in department 5 or directly supervise an employee who works in department 5, we can use the union operation as follows: DEP5_EMPS ← σ DNO=5 (EMPLOYEE) RESULT1 ← π SSN (DEP5_EMPS) RESULT2(SSN) ← π SUPERSSN(DEP5_EMPS) RESULT ← RESULT1 ∪ RESULT2 The union operation produces the tuples that are in either RESULT1 or RESULT2 or both. The two operands must be “type compatible”.
  • 11. Relational Algebra Operations From Set Theory (cont.) • INTERSECTION OPERATION The result of this operation, denoted by R ∩ S, is a relation that includes all tuples that are in both R and S. The two operands must be "type compatible" Example: The result of the intersection operation (figure below) includes only those who are both students and instructors. STUDENT ∩ INSTRUCTOR
  • 12. Relational Algebra Operations From Set Theory (cont.) • Set Difference (or MINUS) Operation The result of this operation, denoted by R - S, is a relation that includes all tuples that are in R but not in S. The two operands must be "type compatible”. Example: The figure shows the names of students who are not instructors, and the names of instructors who are not students. STUDENT-INSTRUCTOR INSTRUCTOR-STUDENT
  • 13. Relational Algebra Operations From Set Theory (cont.) • CARTESIAN (or cross product) Operation – This operation is used to combine tuples from two relations in a combinatorial fashion. In general, the result of R(A1, A2, . . ., An) x S(B1, B2, . . ., Bm) is a relation Q with degree n + m attributes Q(A1, A2, . . ., An, B1, B2, . . ., Bm), in that order. The resulting relation Q has one tuple for each combination of tuples—one from R and one from S. – Hence, if R has nR tuples (denoted as |R| = nR ), and S has nS tuples, then | R x S | will have nR * nS tuples. – The two operands do NOT have to be "type compatible” Example: FEMALE_EMPS ← σ SEX=’F’(EMPLOYEE) EMPNAMES ← π FNAME, LNAME, SSN (FEMALE_EMPS)
  • 14. Binary Relational Operations • JOIN Operation – The sequence of cartesian product followed by select is used quite commonly to identify and select related tuples from two relations, a special operation, called JOIN. It is denoted by a – This operation is very important for any relational database with more than a single relation, because it allows us to process relationships among relations. – The general form of a join operation on two relations R(A1, A2, . . ., An) and S(B1, B2, . . ., Bm) is: R S <join condition> where R and S can be any relations that result from general relational algebra expressions.
  • 15. Binary Relational Operations (cont.) Example: Suppose that we want to retrieve the name of the manager of each department. To get the manager’s name, we need to combine each DEPARTMENT tuple with the EMPLOYEE tuple whose SSN value matches the MGRSSN value in the department tuple. We do this by using the join operation. DEPT_MGR ← DEPARTMENT MGRSSN=SSN EMPLOYEE
  • 16. Binary Relational Operations (cont.) • EQUIJOIN Operation The most common use of join involves join conditions with equality comparisons only. Such a join, where the only comparison operator used is =, is called an EQUIJOIN. In the result of an EQUIJOIN we always have one or more pairs of attributes (whose names need not be identical) that have identical values in every tuple. The JOIN seen in the previous example was EQUIJOIN. • NATURAL JOIN Operation Because one of each pair of attributes with identical values is superfluous, a new operation called natural join—denoted by *—was created to get rid of the second (superfluous) attribute in an EQUIJOIN condition. The standard definition of natural join requires that the two join attributes, or each pair of corresponding join attributes, have the same name in both relations. If this is not the case, a renaming operation is applied first.
  • 17. Binary Relational Operations (cont.) • DIVISION Operation – The division operation is applied to two relations R(Z) ÷ S(X), where X subset Z. Let Y = Z - X (and hence Z = X ∪ Y); that is, let Y be the set of attributes of R that are not attributes of S. – The result of DIVISION is a relation T(Y) that includes a tuple t if tuples tR appear in R with tR [Y] = t, and with tR [X] = ts for every tuple ts in S. – For a tuple t to appear in the result T of the DIVISION, the values in t must appear in R in combination with every tuple in S.
  • 18. Examples of Queries in Relational • Q1: Retrieve the name Algebraof all employees who and address work for the ‘Research’ department. RESEARCH_DEPT ← σ DNAME=’Research’ (DEPARTMENT) RESEARCH_EMPS ← (RESEARCH_DEPT DNUMBER= DNOEMPLOYEE EMPLOYEE) RESULT ← π FNAME, LNAME, ADDRESS (RESEARCH_EMPS) • Q6: Retrieve the names of employees who have no dependents. ALL_EMPS ← π SSN(EMPLOYEE) EMPS_WITH_DEPS(SSN) ← π ESSN(DEPENDENT) EMPS_WITHOUT_DEPS ← (ALL_EMPS - EMPS_WITH_DEPS) RESULT ← π LNAME, FNAME (EMPS_WITHOUT_DEPS * EMPLOYEE)
  • 19. Relational Calculus • A relational calculus expression creates a new relation, which is specified in terms of variables that range over rows of the stored database relations (in tuple calculus) or over columns of the stored relations (in domain calculus). • In a calculus expression, there is no order of operations to specify how to retrieve the query result—a calculus expression specifies only what information the result should contain. This is the main distinguishing feature between relational algebra and relational calculus. • Relational calculus is considered to be a nonprocedural language. This differs from relational algebra, where we must write a sequence of operations to specify a retrieval request; hence relational algebra can be considered as a procedural way of stating a query.
  • 20. Tuple Relational Calculus • The tuple relational calculus is based on specifying a number of tuple variables. Each tuple variable usually ranges over a particular database relation, meaning that the variable may take as its value any individual tuple from that relation. • A simple tuple relational calculus query is of the form {t | COND(t)} where t is a tuple variable and COND (t) is a conditional expression involving t. The result of such a query is the set of all tuples t that satisfy COND (t). Example: To find the first and last names of all employees whose salary is above $50,000, we can write the following tuple calculus expression: {t.FNAME, t.LNAME | EMPLOYEE(t) AND t.SALARY>50000} The condition EMPLOYEE(t) specifies that the range relation of tuple variable t is EMPLOYEE. The first and last name (PROJECTION π FNAME, LNAME) of each EMPLOYEE tuple t that satisfies the condition t.SALARY>50000 (SELECTION σ SALARY >50000 ) will be retrieved.
  • 21. The Domain Relational Calculus • Another variation of relational calculus called the domain relational calculus, or simply, domain calculus is equivalent to tuple calculus and to relational algebra. • The language called QBE (Query-By-Example) that is related to domain calculus was developed almost concurrently to SQL at IBM Research, Yorktown Heights, New York. Domain calculus was thought of as a way to explain what QBE does. • Domain calculus differs from tuple calculus in the type of variables used in formulas: rather than having variables range over tuples, the variables range over single values from domains of attributes. To form a relation of degree n for a query result, we must have n of these domain variables—one for each attribute. • An expression of the domain calculus is of the form {x1, x2, . . ., xn | COND(x1, x2, . . ., xn, xn+1, xn+2, . . ., xn+m)} where x1, x2, . . ., xn, xn+1, xn+2, . . ., xn+m are domain variables that range over domains (of attributes) and COND is a condition or formula of the domain relational calculus.
  • 22. Example Query Using Domain • Calculus Retrieve the birthdate and address of the employee whose name is ‘John B. Smith’. Query : {uv | (∃ q) (∃ r) (∃ s) (∃ t) (∃ w) (∃ x) (∃ y) (∃ z) (EMPLOYEE(qrstuvwxyz) and q=’John’ and r=’B’ and s=’Smith’)} • Ten variables for the employee relation are needed, one to range over the domain of each attribute in order. Of the ten variables q, r, s, . . ., z, only u and v are free. • Specify the requested attributes, BDATE and ADDRESS, by the free domain variables u for BDATE and v for ADDRESS. • Specify the condition for selecting a tuple following the bar ( | )—namely, that the sequence of values assigned to the variables qrstuvwxyz be a tuple of the employee relation and that the values for q (FNAME), r (MINIT), and s (LNAME) be ‘John’, ‘B’, and ‘Smith’, respectively.
  • 23. SQL • SQL Components (DDL, DML, DCL) • SQL Constructs (Select…from…where…. group by…. having…. order by…) • Nested tables • Views • correlated query • Objects in Oracle.
  • 24. Clauses in SQL • WHERE • STARTING WITH • ORDER BY • GROUP BY • HAVING
  • 25. Operators • Operators are the elements you use inside an expression to articulate how you want specified conditions to retrieve data • Operators fall into six groups: arithmetic, comparison, character, logical, set, and miscellaneous.
  • 26. Functions: Molding the Data You Retrieve • Functions in SQL enable you to perform feats such as determining the sum of a column or converting all the characters of a string to uppercase. • Aggregate functions • Date and time functions • Arithmetic functions • Character functions • Conversion functions • Miscellaneous functions
  • 27. Manipulating Data • The INSERT statement • The UPDATE statement • The DELETE statement
  • 28. Views • Views, or virtual tables, can be used to encapsulate complex queries. After a view on a set of data has been created, you can treat that view as another table.