{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

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

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

SQL (Lecture Session-11) Chapters 8 Mon, Feb 15, 2010 1 DLPD, BITS-Pilani.                Prepared  by Dr.R. Gururaj, Asst.Professor of CS

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

View Full Document
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
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.

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

View Full Document
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.
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

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

View Full Document
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).
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 DNAME DNUMBER MGRSSN MGRSTARTDATE DNUMBER DLOCATION PNAME PNUMBER PLOCATION DNUM ESSN PNO HOURS ESSN

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}