10 - (LectureSession11) Chapters8 SQL Mon,Feb15,2010...

Info iconThis preview shows pages 1–8. Sign up to view the full content.

View Full Document Right Arrow Icon
SQL (Lecture Session-11) Chapters 8 Mon, Feb 15, 2010 1 DLPD, BITS-Pilani.                Prepared  by Dr.R. Gururaj, Asst.Professor of CS
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Mon, Feb 15, 2010 DLPD, BITS-Pilani.                Prepared  by Dr.R. Gururaj, Asst.Professor of CS 2 •Intro to SQL •DDL Commands •DML Commands •Views in SQL Contents
Background image of page 2
Mon, Feb 15, 2010 DLPD, BITS-Pilani.                Prepared  by Dr.R. Gururaj, Asst.Professor of CS 3 Tuple Rational Calculus(TRC) is based on specifying a number of tuple variables . Each tuple variable usually ranges over a particular database relation. Variables can take values of individual tuples from the relation. A simple relational calculus query is in the form- {t | condition (t)} t – tuple variable condition (t) – is a conditional expression involving t . Result is a set of all tuples that satisfy the conditions specified in condition (t) . Ex. Find all employees whose salary is above 50,000 { t | EMP ( t ) and t . salary > 50,000} Selects all tuples from EMP such that for each tuple selected, the salary value is > 50,000. The expression EMP( t ) specifies from where the tuple t must be chosen. Hence EMP relation in this case is known as a range relation . Note: The above query retrieves all the attributes of relation EMP.
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Mon, Feb 15, 2010 DLPD, BITS-Pilani.                Prepared  by Dr.R. Gururaj, Asst.Professor of CS 4 The universal ( 2200 ), and existential ( 5 ) quantifiers can be applied to tuples. Ex.: {t.name, t age | EMP (t) and ( 5 d) (Dept (d)and d.dname = ‘Research’ and d.dno = t.dno )} To retrieve the name and age of all employees who work for ‘Research’ department. If the tuple variable t occurs with 5 or 2200 quantifiers the variable is known as bound variable and otherwise called as free variable.
Background image of page 4
Mon, Feb 15, 2010 DLPD, BITS-Pilani.                Prepared  by Dr.R. Gururaj, Asst.Professor of CS 5 Safe Relation Calculus Expression Is one that guarantees to yield a finite set of tuples as result. Ex. { t | not (EMP ( t ))} Is unsafe because it yields all tuples in the universe that are not in EMP relation, which are infinitely numerous. An expression is safe if all values in its result are from the domain of the expression. Each one of the above is in 2NF. Hence we say that the database is in 2NF
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Mon, Feb 15, 2010 DLPD, BITS-Pilani.                Prepared  by Dr.R. Gururaj, Asst.Professor of CS 6 Relational Completeness: This notion is used to compare high level query languages. Any relational query language L is considered to be relationally complete if we can express in L any query that is expressed in relational algebra (RA) or relational calculus (RC).
Background image of page 6
Mon, Feb 15, 2010 DLPD, BITS-Pilani.                Prepared  by Dr.R. Gururaj, Asst.Professor of CS 7 FNAME MINIT LNAME SSN BDATE ADDRESS SEX SALARY SUPERSSN DNO
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 8
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 03/14/2010 for the course CSE IS ZC332 taught by Professor Shailendrasshekhawat during the Summer '10 term at Birla Institute of Technology & Science.

Page1 / 25

10 - (LectureSession11) Chapters8 SQL Mon,Feb15,2010...

This preview shows document pages 1 - 8. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online