Part V. Working with Information Systems. Marc H. Scholl (DBIS, Uni KN) Information Management Winter 2007/08 1

Size: px
Start display at page:

Download "Part V. Working with Information Systems. Marc H. Scholl (DBIS, Uni KN) Information Management Winter 2007/08 1"

Transcription

1 Part V Working with Information Systems Marc H. Scholl (DBIS, Uni KN) Information Management Winter 2007/08 1

2 Outline of this part 1 Introduction to Database Languages Declarative Languages Option 1: Graphical User-Interface (GUI) Option 2: Mathematically Oriented Formalism Option 3: User-Friendly Interface (UFI) 2 Relational Algebra Five Essential Operators More Operators Relational Algebra for Query Optimization 3 Relational Calculus 4 SQL: The Relational Standard Query Functionality Updates Data Definition and Schema Changes 5 Datalog: Logic as a Query Language 6 Beyond Relational Databases Marc H. Scholl (DBIS, Uni KN) Information Management Winter 2007/08 2

3 1. Introduction to Database Languages 5.1 Introduction to Database Languages This section s goal: After completing this chapter, you should be able to explain the basic ideas of (relational) database languages: declarative vs. navigational access, different language styles (algebra, calculus, SQL, logic, graphical), formulate simple queries in different RDBMS languages, explain the use cases for the different language styles. Marc H. Scholl (DBIS, Uni KN) Information Management Winter 2007/08 3

4 Declarative Languages Recall from the introductory chapter: we re interested in high-level, declarative database query languages, such as SQL, that allow the specification of our information needs, not in (procedural, navigational) programming languages that allow us to code algorithms that retrieve the necessary data! Example (What s the salary of employee Jones?) Given a relational representation of Employee information in a table EMP EMPNO ENAME SAL SMITH ALLEN WARD JONES MARTIN Marc H. Scholl (DBIS, Uni KN) Information Management Winter 2007/08 4

5 Navigational vs. declarative access Example (Cont d: navigation)... you can certainly come up with the following lookup algorithm: result ; open file(emp); while EOF(EMP) do e get next record(emp ); if e.ename = Jones then result result e; fi od return(result); Example (Cont d: specification)... but it is certainly much easier to formulate a SQL query: SELECT SAL FROM EMP WHERE ENAME = "Jones" And the best thing is: it is very likely to be not only much more convenient to express, but also much more efficient to execute! even better yet: the more complex the query, the bigger the savings! Marc H. Scholl (DBIS, Uni KN) Information Management Winter 2007/08 5

6 Declarative language characteristics A declarative language specifies, in a high-level formalism, what you want to do, (rather than program, in a low-level language, the algorithm how the job gets done) leaves a lot of freedom to the system, to generate an efficient execution plan puts a big burden on the system, to be able to actually find an efficient execution plan is a necessary precondition for data independence of application programs to really work (see Intro). Marc H. Scholl (DBIS, Uni KN) Information Management Winter 2007/08 6

7 Different styles of declarative languages A high-level language that allows for an abstract specification of an information need rather than for programming of a data access algorithm? 1 A graphical user-interface (GUI)? 2 A high-level, abstract mathematically oriented formalism? 3 A user-friendly interface (UFI)? 4 What else? Marc H. Scholl (DBIS, Uni KN) Information Management Winter 2007/08 7

8 Option 1: GUI In fact, long before the term GUI was coined, database research has investigated and developed graphically oriented query languages for RDBMSs. QbE ( Query by example ) is the grandfather of such interactive interfaces. developed in the early 1970s at IBM Yorktown Heights under M. Zloof available today in IBM s DB2 product Inspired a lot of similar, forms-based interactive DB-interfaces. Marc H. Scholl (DBIS, Uni KN) Information Management Winter 2007/08 8

9 Example query using QbE Example (Step 1: system presents empty table template)... user fills in table name EMP... Example (Step 2: system prompts with table schema)... user enters selection criterion and marks attributes to be printed EMP EMPNO ENAME SAL... Jones P. Example (Step 3: system interprets and executes query, presents result) EMP SAL 7839 Marc H. Scholl (DBIS, Uni KN) Information Management Winter 2007/08 9

10 QbE: How it works Entering values means: look for exactly this value in column/row. Entering P. means: print this attribute value. To print all attribute values, place the P. in ront of the line. More general predicates: user can enter comparison operators, e.g., > 2000, several values in different attributes: logical and, adding more lines: logical or, even more complex: open condition box to specify predicate in text form. Condition box refers to attribute values via example values (think of a variable), e.g., Jones. Those example values are where the name QbE comes from. They can be used in other places as well, e.g., for the formulation of a join. Marc H. Scholl (DBIS, Uni KN) Information Management Winter 2007/08 10

11 QbE: Final example Example (Get EMP names & salaries, with their DEPT names, if employee makes between 3k and 5k.) EMP EMPNO ENAME SAL DEPTNO Jones DEPT DEPTNO DNAME Sales CONDITIONS 4444 > 3000 AND 4444 < 5000 P. Jones Sales Marc H. Scholl (DBIS, Uni KN) Information Management Winter 2007/08 11

12 Option 2: High-level mathematical formalism... what mathematical notions are appropriate? When introducing the relational data model, we noticed the similarity to mathematical set theory, mathematical relations, and first order predicate logic. 1 Set operators look like a natural choice: Given two sets, A and B, we are used to compute their union, difference, intersection and Cartesian product, writing A B A B A B A B. All of these work for relations (sets of tuples) as well! 2 Predicate logic is another best friend: We re used to define sets via predicates, 19 e.g., E = {n N n mod 2 = 0} or O = {n N m N : n = 2m + 1}. Again, this should be useful with relations! 19 in Computer Science, such set definitions are called set comprehensions Marc H. Scholl (DBIS, Uni KN) Information Management Winter 2007/08 12

13 Option 2a: Operator-based languages Relational Algebra is such an operator-based language. Each operator takes one or two relations as input arguments, and delivers a relation as output result. As an immediate consequence, compound expressions may be formed by nesting: apply another operator to the result of a previous operator, as in A (B C). Relational algebra comes with two new operators for the selection of tuples that qualify w.r.t. a given search condition and for the projection of tuples onto a subset of attributes: π A, B, C (R) retains only the A, B, and C attributes of relation R. σ P (R) returns the subset of R-tuples that match predicate P. Marc H. Scholl (DBIS, Uni KN) Information Management Winter 2007/08 13

14 Example using Relational Algebra Example (Get salary of employee Jones.) π SAL ( σename = Jones (EMP) ) Example (Employee names & salaries with dept. names, for those making between 3k and 5k.) (See the complex QbE query above.) π ENAME,DNAME,SAL ( σ3000 < SAL < 5000 (EMP) DEPT ). The operator denotes the natural join. Marc H. Scholl (DBIS, Uni KN) Information Management Winter 2007/08 14

15 Natural Join in Relational Algebra In RA, the join is a derived operator, it can be defined using the other algebra operators: Definition (Natural Join) Let the schema of R be sch(r) = {A 1,..., A n, B 1,..., B m } and sch(s) = {B 1,..., B m, C 1,..., C k }, i.e., the attributes B i are common to both relations, e.g., as a key foreign key pair. The natural join of R and S, R S, can be defined as R S π RS ( σf (R S) ) with F = (R.B 1 = S.B 1 R.B m = S.B m ) and RS = {A 1,..., A n, B 1,..., B m, C 1,..., C k }. N.B. We have seen these two ways of formulating a join in the introductory SQL examples already! Marc H. Scholl (DBIS, Uni KN) Information Management Winter 2007/08 15

16 Option 2b: Predicate logic as a query language Relational Calculus is a query language that defines sets, namely, query results, via predicates. Example (Simple queries in Relational Calculus) 1 All employees named Jones: Q1 = 2 The salaries of Jones: Q2 = 3 Employee names & salaries, with department names, for those making between 3k and 5k: Q3 = N.B. We re using a little notational freedom here, textbook Relational Calculus looks somewhat more involved. Marc H. Scholl (DBIS, Uni KN) Information Management Winter 2007/08 16

17 Relational Calculus: How it works Notice the use of variables for tuples (e, d in the examples), hence the name Tuple Relational Calculus (TRC). 20 Notation: e EMP introduces a (bound) variable, e, that ranges over all tuples in the given relation, EMP; e.sal (dot notation) is used to access attribute values of tuples; a wide variety of notations can be found for attribute access, e.g., also e(sal), e[sal], SAL(e),... Quantifiers e EMP and e EMP are allowed in the predicates; the typical textbook would not use bounded quantifiers, though. Instead of e EMP :... one would use e : EMP(e)... Result tuples are constructed component-wise. In the classical textbook TRC, instead of {(e.ename, d.dname)... } you would have to use an additional variable, t, and write {t t.ename = e.ename t.dname = d.dname}. 20 there is also a Domain RC variant, where variables denote attribute values Marc H. Scholl (DBIS, Uni KN) Information Management Winter 2007/08 17

18 Predicate logic as a query language Take 2 There is an alternative style of logic-based query languages. Here we also use predicates, but not to define relations via set comprehensions as in Q = {t P (t)}, rather, relations themselves are considered as (stored extensions of) predicates. Example (Relations as stored extensions of predicates) A relation/table, such as EMP EMPNO ENAME SAL JONES MARTIN records the fact that predicate EMP holds for certain parameter values: EMP(7566,JONES,7839,... ) true EMP(7654,MARTIN,7698,... ) true and so on. Marc H. Scholl (DBIS, Uni KN) Information Management Winter 2007/08 18

19 Rule-based querying We can now query a relational database by defining new (result) relations via derivation (or inference) rules using the stored relations as input. 21 Example (Get all employees named Jones) Q1(enum, ename, sal,... ) = EMP(enum, ename, sal,... ). Example (Get Jones salaries) Q2(sal) = EMP(enum, ename, sal,... ) ename = Jones, or even Q2 (sal) = EMP(enum, Jones, sal,... ). Example (Employee names & salaries, with department names, for those making between 3k and 5k:) Q3(en, dn, s) = EMP(eno, en, sal, dno,... ) DEPT(dno, dn,... ) 3000 < sal < Notice the use of variables for parameter/attribute values. Marc H. Scholl (DBIS, Uni KN) Information Management Winter 2007/08 19

20 DATALOG: Rule-based database languages A family of rule-based database languages under the name DATALOG have been defined. Their concrete syntax again deviates a little from our examples, but the general form is the same: derived predicates can be defined by implication rules, these are typically written with the consequence on the left (also called head of the rule), the premise on the right (also called body ), i.e., the implication pointing to the left ( ) variables for predicate parameters (attribute values) can be used use of the same variable name indicates an equality restriction the form of body is typically restricted to a conjunction disjunctions can be expressed by multiple rules with the same head negation (logical not ) poses a problem with the formal semantics and is often excluded quantifiers are not (explicitly) allowed (variables are implicitly quantified) Marc H. Scholl (DBIS, Uni KN) Information Management Winter 2007/08 20

21 DATALOG can express recursion The standard example query for rule-based languages is ancestors : Example (Given a table of parent-child-tuples, derive an ancestor-table) Let P ar(p, C) be a binary, stored relation, whose tuples p, c indicate that person p is a parent of child c. Task: formulate a database query that computes a relation Anc(A, C), where tuple a, c means: person a is an (arbitrary generation) ancestor of child c. Solution: recursively define the derived predicate Anc Anc(a, c) =. (1) Anc(a, c) =. (2) (1) This rule defines the baseline case : parents are ancestors. (2) This handles the recursion: parents of ancestors are also ancestors. Variable p in this rule is existentially quantified, implicitly ( p :... ). Marc H. Scholl (DBIS, Uni KN) Information Management Winter 2007/08 21

22 Remarks on recursion Recursive queries cannot be expressed using any of the other languages we have seen so far. 22 The need for recursive queries is actually less academic than it may seem from the canonical ancestors example. Recursive queries are a challenge not only for query formulation, but also for (efficient) query processing. Different kinds of recursive queries can be distinguished, with different language requirements and different execution complexity. 22 Appropriate extensions, e.g., of relational algebra, not withstanding. Marc H. Scholl (DBIS, Uni KN) Information Management Winter 2007/08 22

23 Option 3: User-Friendly Interface (UFI) Problems of the options considered so far: GUIs are not usable from within application programs, as an API (application programming interface). Neither are mathematical formalisms, since they freighten users off. Solution: Design a (textual) language that is easy to use, both as a stand-alone interface to the RDBMS ( adhoc query interface ) and as an API, embedded from within a wide variety of programming language(s) The syntax should be human readable and it should be independent of the usage mode (stand-alone vs. API) Marc H. Scholl (DBIS, Uni KN) Information Management Winter 2007/08 23

24 SQL A recap & comparison We have already seen basic functionality of SQL in a previous chapter. Let us compare SQL with (some of) the other languages sketched above. The design of SQL has in fact been influenced, at least, by RA and TRC. We will compare basic queries in those three languges, using simple examples. A detailed discussion is deferred until after the presentation of all these languages. The five basic operators of relational algebra, namely union, difference, product, selection, and projection will be our guideline, and, of course, we will also look at the ubiquitous join. Marc H. Scholl (DBIS, Uni KN) Information Management Winter 2007/08 24

25 Selection: Predicate-oriented search Example (1. Selection: Picking some tuples based on a search predicate) Let P be some predicate that can be eavluated on a sinlge tuple r R of a relation R 23 (i.e., it references attributes, uses constants and comparison operators, combines parts with logical and, or, not operators). The subset of R satisfying P can be retrieved, by in RA: σ P (R) in TRC: {r R P (r)} in SQL SELECT DISTINCT * FROM R WHERE P N.B. As we will see later, there are some subtle differences as to what kind of predicates are permitted, but apart from that, the differences are of a lexical nature. 23 Relation R here and in the sequel might as well be the result of some subexpression! Marc H. Scholl (DBIS, Uni KN) Information Management Winter 2007/08 25

26 Projection: Hiding unnecessary details Example (2. Projection: Keep only a specified set of attributes) Let L sch(r) be a subset of relation R s attributes. If we re not interested in the values of other attributes, we can restrict tuples to the components in L: in RA: π L (R) in TRC: {r(l) r R} in SQL SELECT DISTINCT L FROM R N.B. Duplicate removal in SQL is essential here, at least if no candidate key of R is preserved in the projection! Marc H. Scholl (DBIS, Uni KN) Information Management Winter 2007/08 26

27 Relational product: Combining data of different relations Example (3. Product: Generate all combinations of R- and S-tuples) Let R and S be relations without common attributes: 24 R = sch(r), S = sch(s), R S =. Taking the product of R and S generates a relation RS with the attributes R S. Each tuple of R is combined with each tuple of S: in RA: R S in TRC: {rs r R : s S : rs(r) = r rs(s) = s} in SQL SELECT DISTINCT * FROM R, S N.B. In SQL, an equivalent, more explicit formulation could be SELECT DISTINCT R.*, S.* FROM R, S. 24 If R and S share common attributes, we will have to rename one copy of each shared attribute, such that the resulting schema has unique names (see later). Marc H. Scholl (DBIS, Uni KN) Information Management Winter 2007/08 27

28 Union, Difference: Easy & obvious relations are sets Example (4./5. Union & Difference: The usual set operations) Let R and S be two relations over the same schema (i.e., they have all attributes in common). Union collects all tuples in R, S, or R and S. Differences retains those tuples from the first argument that are not in the second argument relation: in RA: R S or R S in TRC: {t t R t S} or {r R r / S} in SQL SELECT DISTINCT * FROM R UNION or EXCEPT SELECT DISTINCT * FROM S N.B. DISTINCT could be omitted here, since duplicate elimination is automatically performed before set operations in SQL. Marc H. Scholl (DBIS, Uni KN) Information Management Winter 2007/08 28

29 Natural Join: Following key-to-foreign key relationships We have already seen that Natural Join is not a basic (algebra) operator, since it can be defined using other operators. In fact, the five algebra operators seen above are sufficient to define all the others. Nontheless, we have a look at how Joins are expressed in the three languages here: Example (Join: Combine data that belongs together) Let R and S be relations with attributes sch(r) = R X, sch(s) = S X, i.e., R and S share the attributes X. Often, X will be key in one and foreign key in the other relation, but not necessarily so. The Natural Join brings together matching R and S tuples, i.e., those with same X -values: in RA: R S in TRC: {rs r R : s S : rs(r X ) = r rs(s X ) = s} in SQL SELECT DISTINCT * FROM R NATURAL JOIN S Marc H. Scholl (DBIS, Uni KN) Information Management Winter 2007/08 29

30 Final remark on SQL vs. RA and TRC From this initial comparison, it may look as if SQL mainly drew from Relational Algebra. This is not the case! Just to give one example: SQL allows for so-called Alias names, to be introduced in the FROM clause. They can be used as abbreviations from relation names and/or to disambiguate queries that reference the same relation more than once: SELECT DISTINCT r.*, s.* FROM LongRelationName1 AS r, AnotherVeryLongRelationName AS s WHERE r.attr1 = s.attr2... These alias names cold also be called tuple variables : a concept that is clearly absent from (any) algebra, but exactly the same as in TRC. Marc H. Scholl (DBIS, Uni KN) Information Management Winter 2007/08 30

31 SQL as a UFI 1. Introduction to Database Languages Declarative Languages The term UFI for User-Friendly Interface has been coined in the course of the SQL/DS development within IBM. 25 Back in those days, it was completely uncommon to have an interactive DBMS interface, where you could simply type in queries in some human-readible form and get the answers displayed. Rather, DBMSs had only programming interfaces (APIs), so that you had to write (e.g., COBOL) programs for each database query. UFI was the initial name of the interactive database query interface, where you typed SQL statements, that were executed immediately. Actually, the identical syntax for API- and interactive use of SQL was (one) key to its success. The UFI idea carries much further, since you can do almost everything, not just querying, interactively in SQL (see later). 25 SQL/DS was IBM s first RDBMS product that originated from the System/R research prototype. Marc H. Scholl (DBIS, Uni KN) Information Management Winter 2007/08 31

Part III. Data Modelling. Marc H. Scholl (DBIS, Uni KN) Information Management Winter 2007/08 1

Part III. Data Modelling. Marc H. Scholl (DBIS, Uni KN) Information Management Winter 2007/08 1 Part III Data Modelling Marc H. Scholl (DBIS, Uni KN) Information Management Winter 2007/08 1 Outline of this part (I) 1 Introduction to the Relational Model and SQL Relational Tables Simple Constraints

More information

Relational Databases

Relational Databases Relational Databases Jan Chomicki University at Buffalo Jan Chomicki () Relational databases 1 / 49 Plan of the course 1 Relational databases 2 Relational database design 3 Conceptual database design 4

More information

Databases - 4. Other relational operations and DDL. How to write RA expressions for dummies

Databases - 4. Other relational operations and DDL. How to write RA expressions for dummies Databases - 4 Other relational operations and DDL How to write RA expressions for dummies Step 1: Identify the relations required and CP them together Step 2: Add required selections to make the CP Step

More information

Ian Kenny. November 28, 2017

Ian Kenny. November 28, 2017 Ian Kenny November 28, 2017 Introductory Databases Relational Algebra Introduction In this lecture we will cover Relational Algebra. Relational Algebra is the foundation upon which SQL is built and is

More information

Databases. Relational Model, Algebra and operations. How do we model and manipulate complex data structures inside a computer system? Until

Databases. Relational Model, Algebra and operations. How do we model and manipulate complex data structures inside a computer system? Until Databases Relational Model, Algebra and operations How do we model and manipulate complex data structures inside a computer system? Until 1970.. Many different views or ways of doing this Could use tree

More information

Copyright 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley. Chapter 6 Outline. Unary Relational Operations: SELECT and

Copyright 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley. Chapter 6 Outline. Unary Relational Operations: SELECT and Chapter 6 The Relational Algebra and Relational Calculus Copyright 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 6 Outline Unary Relational Operations: SELECT and PROJECT Relational

More information

Chapter 6 5/2/2008. Chapter Outline. Database State for COMPANY. The Relational Algebra and Calculus

Chapter 6 5/2/2008. Chapter Outline. Database State for COMPANY. The Relational Algebra and Calculus Chapter 6 The Relational Algebra and Calculus Chapter Outline Example Database Application (COMPANY) Relational Algebra Unary Relational Operations Relational Algebra Operations From Set Theory Binary

More information

Copyright 2016 Ramez Elmasri and Shamkant B. Navathe

Copyright 2016 Ramez Elmasri and Shamkant B. Navathe CHAPTER 19 Query Optimization Introduction Query optimization Conducted by a query optimizer in a DBMS Goal: select best available strategy for executing query Based on information available Most RDBMSs

More information

SQL STRUCTURED QUERY LANGUAGE

SQL STRUCTURED QUERY LANGUAGE STRUCTURED QUERY LANGUAGE SQL Structured Query Language 4.1 Introduction Originally, SQL was called SEQUEL (for Structured English QUery Language) and implemented at IBM Research as the interface for an

More information

Basant Group of Institution

Basant Group of Institution Basant Group of Institution Visual Basic 6.0 Objective Question Q.1 In the relational modes, cardinality is termed as: (A) Number of tuples. (B) Number of attributes. (C) Number of tables. (D) Number of

More information

Mahathma Gandhi University

Mahathma Gandhi University Mahathma Gandhi University BSc Computer science III Semester BCS 303 OBJECTIVE TYPE QUESTIONS Choose the correct or best alternative in the following: Q.1 In the relational modes, cardinality is termed

More information

DATABASE DESIGN II - 1DL400

DATABASE DESIGN II - 1DL400 DATABASE DESIGN II - 1DL400 Fall 2016 A second course in database systems http://www.it.uu.se/research/group/udbl/kurser/dbii_ht16 Kjell Orsborn Uppsala Database Laboratory Department of Information Technology,

More information

Query Processing SL03

Query Processing SL03 Distributed Database Systems Fall 2016 Query Processing Overview Query Processing SL03 Distributed Query Processing Steps Query Decomposition Data Localization Query Processing Overview/1 Query processing:

More information

Relational Model: History

Relational Model: History Relational Model: History Objectives of Relational Model: 1. Promote high degree of data independence 2. Eliminate redundancy, consistency, etc. problems 3. Enable proliferation of non-procedural DML s

More information

2.2.2.Relational Database concept

2.2.2.Relational Database concept Foreign key:- is a field (or collection of fields) in one table that uniquely identifies a row of another table. In simpler words, the foreign key is defined in a second table, but it refers to the primary

More information

Relational Query Languages: Relational Algebra. Juliana Freire

Relational Query Languages: Relational Algebra. Juliana Freire Relational Query Languages: Relational Algebra Relational Query Languages Query languages: Allow manipulation and retrieval of data from a database. Relational model supports simple, powerful QLs: Simple

More information

CS 377 Database Systems

CS 377 Database Systems CS 377 Database Systems Relational Algebra and Calculus Li Xiong Department of Mathematics and Computer Science Emory University 1 ER Diagram of Company Database 2 3 4 5 Relational Algebra and Relational

More information

Chapter 5 Relational Algebra. Nguyen Thi Ai Thao

Chapter 5 Relational Algebra. Nguyen Thi Ai Thao Chapter 5 Nguyen Thi Ai Thao thaonguyen@cse.hcmut.edu.vn Spring- 2016 Contents 1 Unary Relational Operations 2 Operations from Set Theory 3 Binary Relational Operations 4 Additional Relational Operations

More information

Detecting Logical Errors in SQL Queries

Detecting Logical Errors in SQL Queries Detecting Logical Errors in SQL Queries Stefan Brass Christian Goldberg Martin-Luther-Universität Halle-Wittenberg, Institut für Informatik, Von-Seckendorff-Platz 1, D-06099 Halle (Saale), Germany (brass

More information

Database Technology Introduction. Heiko Paulheim

Database Technology Introduction. Heiko Paulheim Database Technology Introduction Outline The Need for Databases Data Models Relational Databases Database Design Storage Manager Query Processing Transaction Manager Introduction to the Relational Model

More information

Chapter 6 The Relational Algebra and Calculus

Chapter 6 The Relational Algebra and Calculus Chapter 6 The Relational Algebra and Calculus 1 Chapter Outline Example Database Application (COMPANY) Relational Algebra Unary Relational Operations Relational Algebra Operations From Set Theory Binary

More information

Relational Model History. COSC 304 Introduction to Database Systems. Relational Model and Algebra. Relational Model Definitions.

Relational Model History. COSC 304 Introduction to Database Systems. Relational Model and Algebra. Relational Model Definitions. COSC 304 Introduction to Database Systems Relational Model and Algebra Dr. Ramon Lawrence University of British Columbia Okanagan ramon.lawrence@ubc.ca Relational Model History The relational model was

More information

Relational Algebra Part I. CS 377: Database Systems

Relational Algebra Part I. CS 377: Database Systems Relational Algebra Part I CS 377: Database Systems Recap of Last Week ER Model: Design good conceptual models to store information Relational Model: Table representation with structures and constraints

More information

RELATIONAL DATA MODEL: Relational Algebra

RELATIONAL DATA MODEL: Relational Algebra RELATIONAL DATA MODEL: Relational Algebra Outline 1. Relational Algebra 2. Relational Algebra Example Queries 1. Relational Algebra A basic set of relational model operations constitute the relational

More information

Copyright 2016 Ramez Elmasri and Shamkant B. Navathe

Copyright 2016 Ramez Elmasri and Shamkant B. Navathe CHAPTER 6 Basic SQL Slide 6-2 Chapter 6 Outline SQL Data Definition and Data Types Specifying Constraints in SQL Basic Retrieval Queries in SQL INSERT, DELETE, and UPDATE Statements in SQL Additional Features

More information

1. Introduction; Selection, Projection. 2. Cartesian Product, Join. 5. Formal Definitions, A Bit of Theory

1. Introduction; Selection, Projection. 2. Cartesian Product, Join. 5. Formal Definitions, A Bit of Theory Relational Algebra 169 After completing this chapter, you should be able to enumerate and explain the operations of relational algebra (there is a core of 5 relational algebra operators), write relational

More information

CS2 Current Technologies Note 1 CS2Bh

CS2 Current Technologies Note 1 CS2Bh CS2 Current Technologies Note 1 Relational Database Systems Introduction When we wish to extract information from a database, we communicate with the Database Management System (DBMS) using a query language

More information

Chapter 2: Intro to Relational Model

Chapter 2: Intro to Relational Model Non è possibile visualizzare l'immagine. Chapter 2: Intro to Relational Model Database System Concepts, 6 th Ed. See www.db-book.com for conditions on re-use Example of a Relation attributes (or columns)

More information

Programming Languages Third Edition

Programming Languages Third Edition Programming Languages Third Edition Chapter 12 Formal Semantics Objectives Become familiar with a sample small language for the purpose of semantic specification Understand operational semantics Understand

More information

Chapter 8: The Relational Algebra and The Relational Calculus

Chapter 8: The Relational Algebra and The Relational Calculus Ramez Elmasri, Shamkant B. Navathe(2017) Fundamentals of Database Systems (7th Edition),pearson, isbn 10: 0-13-397077-9;isbn-13:978-0-13-397077-7. Chapter 8: The Relational Algebra and The Relational Calculus

More information

QUERY PROCESSING & OPTIMIZATION CHAPTER 19 (6/E) CHAPTER 15 (5/E)

QUERY PROCESSING & OPTIMIZATION CHAPTER 19 (6/E) CHAPTER 15 (5/E) QUERY PROCESSING & OPTIMIZATION CHAPTER 19 (6/E) CHAPTER 15 (5/E) 2 LECTURE OUTLINE Query Processing Methodology Basic Operations and Their Costs Generation of Execution Plans 3 QUERY PROCESSING IN A DDBMS

More information

Relational Algebra 1

Relational Algebra 1 Relational Algebra 1 Motivation The relational data model provides a means of defining the database structure and constraints NAME SALARY ADDRESS DEPT Smith 50k St. Lucia Printing Dilbert 40k Taringa Printing

More information

پوهنتون کابل پوهنځی كمپيوترساینس

پوهنتون کابل پوهنځی كمپيوترساینس پوهنتون کابل پوهنځی كمپيوترساینس دیپارتمنت سیستم های معلوماتی : : تهیه کننده سال پوهنیار محمد شعیب "زرین خیل" 389 By: M Shuaib Zarinkhail 00 Each column has a unique name which shows one attribute of an

More information

Unit 4 Relational Algebra (Using SQL DML Syntax): Data Manipulation Language For Relations Zvi M. Kedem 1

Unit 4 Relational Algebra (Using SQL DML Syntax): Data Manipulation Language For Relations Zvi M. Kedem 1 Unit 4 Relational Algebra (Using SQL DML Syntax): Data Manipulation Language For Relations 2014 Zvi M. Kedem 1 Relational Algebra And SQL SQL is based on relational algebra with many extensions Some necessary

More information

Unit 4 Relational Algebra (Using SQL DML Syntax): Data Manipulation Language For Relations Zvi M. Kedem 1

Unit 4 Relational Algebra (Using SQL DML Syntax): Data Manipulation Language For Relations Zvi M. Kedem 1 Unit 4 Relational Algebra (Using SQL DML Syntax): Data Manipulation Language For Relations 2016 Zvi M. Kedem 1 Relational Algebra in Context User Level (View Level) Community Level (Base Level) Physical

More information

Databases - 3. Null, Cartesian Product and Join. Null Null is a value that we use when. Something will never have a value

Databases - 3. Null, Cartesian Product and Join. Null Null is a value that we use when. Something will never have a value Databases - 3 Null, Cartesian Product and Join Null Null is a value that we use when Something will never have a value Something will have a value in the future Something had a value but doesn t at the

More information

Introduction to Query Processing and Query Optimization Techniques. Copyright 2011 Ramez Elmasri and Shamkant Navathe

Introduction to Query Processing and Query Optimization Techniques. Copyright 2011 Ramez Elmasri and Shamkant Navathe Introduction to Query Processing and Query Optimization Techniques Outline Translating SQL Queries into Relational Algebra Algorithms for External Sorting Algorithms for SELECT and JOIN Operations Algorithms

More information

COSC 304 Introduction to Database Systems SQL. Dr. Ramon Lawrence University of British Columbia Okanagan

COSC 304 Introduction to Database Systems SQL. Dr. Ramon Lawrence University of British Columbia Okanagan COSC 304 Introduction to Database Systems SQL Dr. Ramon Lawrence University of British Columbia Okanagan ramon.lawrence@ubc.ca SQL Queries Querying with SQL is performed using a SELECT statement. The general

More information

Database Management System Dr. S. Srinath Department of Computer Science & Engineering Indian Institute of Technology, Madras Lecture No.

Database Management System Dr. S. Srinath Department of Computer Science & Engineering Indian Institute of Technology, Madras Lecture No. Database Management System Dr. S. Srinath Department of Computer Science & Engineering Indian Institute of Technology, Madras Lecture No. # 5 Structured Query Language Hello and greetings. In the ongoing

More information

Databases - 3. Null, Cartesian Product and Join. Null Null is a value that we use when. Something will never have a value

Databases - 3. Null, Cartesian Product and Join. Null Null is a value that we use when. Something will never have a value Databases - 3, Cartesian Product and Join is a value that we use when Something will never have a value Something will have a value in the future Something had a value but doesn t at the moment is a reserved

More information

Relational Database: The Relational Data Model; Operations on Database Relations

Relational Database: The Relational Data Model; Operations on Database Relations Relational Database: The Relational Data Model; Operations on Database Relations Greg Plaxton Theory in Programming Practice, Spring 2005 Department of Computer Science University of Texas at Austin Overview

More information

CMP-3440 Database Systems

CMP-3440 Database Systems CMP-3440 Database Systems Relational DB Languages Relational Algebra, Calculus, SQL Lecture 05 zain 1 Introduction Relational algebra & relational calculus are formal languages associated with the relational

More information

Relational Model, Relational Algebra, and SQL

Relational Model, Relational Algebra, and SQL Relational Model, Relational Algebra, and SQL August 29, 2007 1 Relational Model Data model. constraints. Set of conceptual tools for describing of data, data semantics, data relationships, and data integrity

More information

Databases 1. Daniel POP

Databases 1. Daniel POP Databases 1 Daniel POP Week 4 Agenda The Relational Model 1. Origins and history 2. Key concepts 3. Relational integrity 4. Relational algebra 5. 12+1 Codd rules for a relational DBMSes 7. SQL implementation

More information

Query Decomposition and Data Localization

Query Decomposition and Data Localization Query Decomposition and Data Localization Query Decomposition and Data Localization Query decomposition and data localization consists of two steps: Mapping of calculus query (SQL) to algebra operations

More information

UNIT 2 RELATIONAL MODEL

UNIT 2 RELATIONAL MODEL UNIT 2 RELATIONAL MODEL RELATIONAL MODEL CONCEPTS The relational Model of Data is based on the concept of a Relation. A Relation is a mathematical concept based on the ideas of sets. The strength of the

More information

Chapter 3: Relational Model

Chapter 3: Relational Model Chapter 3: Relational Model Structure of Relational Databases Relational Algebra Tuple Relational Calculus Domain Relational Calculus Extended Relational-Algebra-Operations Modification of the Database

More information

Chapter 5: Other Relational Languages

Chapter 5: Other Relational Languages Chapter 5: Other Relational Languages Database System Concepts, 5th Ed. See www.db-book.com for conditions on re-use Chapter 5: Other Relational Languages Tuple Relational Calculus Domain Relational Calculus

More information

Introduction Relational Algebra Operations

Introduction Relational Algebra Operations CMPT 354 Introduction Relational Algebra Operations Projection and Selection Set Operations Joins Division Tuple Relational Calculus John Edgar 2 Query languages allow the manipulation and retrieval of

More information

The Relational Algebra and Calculus. Copyright 2013 Ramez Elmasri and Shamkant B. Navathe

The Relational Algebra and Calculus. Copyright 2013 Ramez Elmasri and Shamkant B. Navathe The Relational Algebra and Calculus Copyright 2013 Ramez Elmasri and Shamkant B. Navathe Chapter Outline Relational Algebra Unary Relational Operations Relational Algebra Operations From Set Theory Binary

More information

Chapter 6 Part I The Relational Algebra and Calculus

Chapter 6 Part I The Relational Algebra and Calculus Chapter 6 Part I The Relational Algebra and Calculus Copyright 2004 Ramez Elmasri and Shamkant Navathe Database State for COMPANY All examples discussed below refer to the COMPANY database shown here.

More information

SQL Queries. COSC 304 Introduction to Database Systems SQL. Example Relations. SQL and Relational Algebra. Example Relation Instances

SQL Queries. COSC 304 Introduction to Database Systems SQL. Example Relations. SQL and Relational Algebra. Example Relation Instances COSC 304 Introduction to Database Systems SQL Dr. Ramon Lawrence University of British Columbia Okanagan ramon.lawrence@ubc.ca SQL Queries Querying with SQL is performed using a SELECT statement. The general

More information

Relational Algebra. Relational Algebra. 7/4/2017 Md. Golam Moazzam, Dept. of CSE, JU

Relational Algebra. Relational Algebra. 7/4/2017 Md. Golam Moazzam, Dept. of CSE, JU Relational Algebra 1 Structure of Relational Databases A relational database consists of a collection of tables, each of which is assigned a unique name. A row in a table represents a relationship among

More information

King Fahd University of Petroleum and Minerals

King Fahd University of Petroleum and Minerals 1 King Fahd University of Petroleum and Minerals Information and Computer Science Department ICS 334: Database Systems Semester 041 Major Exam 1 18% ID: Name: Section: Grades Section Max Scored A 5 B 25

More information

Lecture Query evaluation. Combining operators. Logical query optimization. By Marina Barsky Winter 2016, University of Toronto

Lecture Query evaluation. Combining operators. Logical query optimization. By Marina Barsky Winter 2016, University of Toronto Lecture 02.03. Query evaluation Combining operators. Logical query optimization By Marina Barsky Winter 2016, University of Toronto Quick recap: Relational Algebra Operators Core operators: Selection σ

More information

Chapter 2: Intro to Relational Model

Chapter 2: Intro to Relational Model Chapter 2: Intro to Relational Model Database System Concepts, 6 th Ed. See www.db-book.com for conditions on re-use Example of a Relation attributes (or columns) tuples (or rows) 2.2 Attribute Types The

More information

Z Notation. June 21, 2018

Z Notation. June 21, 2018 Z Notation June 21, 2018 1 Definitions There are many different ways to introduce an object in a Z specification: declarations, abbreviations, axiomatic definitions, and free types. Keep in mind that the

More information

QUERY OPTIMIZATION [CH 15]

QUERY OPTIMIZATION [CH 15] Spring 2017 QUERY OPTIMIZATION [CH 15] 4/12/17 CS 564: Database Management Systems; (c) Jignesh M. Patel, 2013 1 Example SELECT distinct ename FROM Emp E, Dept D WHERE E.did = D.did and D.dname = Toy EMP

More information

The XQuery Data Model

The XQuery Data Model The XQuery Data Model 9. XQuery Data Model XQuery Type System Like for any other database query language, before we talk about the operators of the language, we have to specify exactly what it is that

More information

Chapter 6 The Relational Algebra and Relational Calculus

Chapter 6 The Relational Algebra and Relational Calculus Chapter 6 The Relational Algebra and Relational Calculus Fundamentals of Database Systems, 6/e The Relational Algebra and Relational Calculus Dr. Salha M. Alzahrani 1 Fundamentals of Databases Topics so

More information

6.001 Notes: Section 8.1

6.001 Notes: Section 8.1 6.001 Notes: Section 8.1 Slide 8.1.1 In this lecture we are going to introduce a new data type, specifically to deal with symbols. This may sound a bit odd, but if you step back, you may realize that everything

More information

Objectives. After completing this lesson, you should be able to do the following:

Objectives. After completing this lesson, you should be able to do the following: Objectives After completing this lesson, you should be able to do the following: Write SELECT statements to access data from more than one table using equality and nonequality joins View data that generally

More information

Agenda. Database Systems. Session 5 Main Theme. Relational Algebra, Relational Calculus, and SQL. Dr. Jean-Claude Franchitti

Agenda. Database Systems. Session 5 Main Theme. Relational Algebra, Relational Calculus, and SQL. Dr. Jean-Claude Franchitti Database Systems Session 5 Main Theme Relational Algebra, Relational Calculus, and SQL Dr. Jean-Claude Franchitti New York University Computer Science Department Courant Institute of Mathematical Sciences

More information

Part VII. Querying XML The XQuery Data Model. Marc H. Scholl (DBIS, Uni KN) XML and Databases Winter 2005/06 153

Part VII. Querying XML The XQuery Data Model. Marc H. Scholl (DBIS, Uni KN) XML and Databases Winter 2005/06 153 Part VII Querying XML The XQuery Data Model Marc H. Scholl (DBIS, Uni KN) XML and Databases Winter 2005/06 153 Outline of this part 1 Querying XML Documents Overview 2 The XQuery Data Model The XQuery

More information

SOFTWARE ENGINEERING DESIGN I

SOFTWARE ENGINEERING DESIGN I 2 SOFTWARE ENGINEERING DESIGN I 3. Schemas and Theories The aim of this course is to learn how to write formal specifications of computer systems, using classical logic. The key descriptional technique

More information

Informationslogistik Unit 4: The Relational Algebra

Informationslogistik Unit 4: The Relational Algebra Informationslogistik Unit 4: The Relational Algebra 26. III. 2012 Outline 1 SQL 2 Summary What happened so far? 3 The Relational Algebra Summary 4 The Relational Calculus Outline 1 SQL 2 Summary What happened

More information

Lecture 1: Conjunctive Queries

Lecture 1: Conjunctive Queries CS 784: Foundations of Data Management Spring 2017 Instructor: Paris Koutris Lecture 1: Conjunctive Queries A database schema R is a set of relations: we will typically use the symbols R, S, T,... to denote

More information

Relational Model History. COSC 416 NoSQL Databases. Relational Model (Review) Relation Example. Relational Model Definitions. Relational Integrity

Relational Model History. COSC 416 NoSQL Databases. Relational Model (Review) Relation Example. Relational Model Definitions. Relational Integrity COSC 416 NoSQL Databases Relational Model (Review) Dr. Ramon Lawrence University of British Columbia Okanagan ramon.lawrence@ubc.ca Relational Model History The relational model was proposed by E. F. Codd

More information

Chapter 1: Introduction

Chapter 1: Introduction Chapter 1: Introduction Chapter 2: Intro. To the Relational Model Database System Concepts, 6 th Ed. See www.db-book.com for conditions on re-use Database Management System (DBMS) DBMS is Collection of

More information

CSCC43H: Introduction to Databases. Lecture 3

CSCC43H: Introduction to Databases. Lecture 3 CSCC43H: Introduction to Databases Lecture 3 Wael Aboulsaadat Acknowledgment: these slides are partially based on Prof. Garcia-Molina & Prof. Ullman slides accompanying the course s textbook. CSCC43: Introduction

More information

ECE 650 Systems Programming & Engineering. Spring 2018

ECE 650 Systems Programming & Engineering. Spring 2018 ECE 650 Systems Programming & Engineering Spring 2018 Relational Databases: Tuples, Tables, Schemas, Relational Algebra Tyler Bletsch Duke University Slides are adapted from Brian Rogers (Duke) Overview

More information

Real-World Performance Training SQL Introduction

Real-World Performance Training SQL Introduction Real-World Performance Training SQL Introduction Real-World Performance Team Basics SQL Structured Query Language Declarative You express what you want to do, not how to do it Despite the name, provides

More information

Announcements. Relational Model & Algebra. Example. Relational data model. Example. Schema versus instance. Lecture notes

Announcements. Relational Model & Algebra. Example. Relational data model. Example. Schema versus instance. Lecture notes Announcements Relational Model & Algebra CPS 216 Advanced Database Systems Lecture notes Notes version (incomplete) available in the morning on the day of lecture Slides version (complete) available after

More information

Relational Query Languages. Relational Algebra. Preliminaries. Formal Relational Query Languages. Relational Algebra: 5 Basic Operations

Relational Query Languages. Relational Algebra. Preliminaries. Formal Relational Query Languages. Relational Algebra: 5 Basic Operations Relational Algebra R & G, Chapter 4 By relieving the brain of all unnecessary work, a good notation sets it free to concentrate on more advanced problems, and, in effect, increases the mental power of

More information

CS2 Current Technologies Lecture 3: SQL - Joins and Subqueries

CS2 Current Technologies Lecture 3: SQL - Joins and Subqueries T E H U N I V E R S I T Y O H F R G E D I N B U CS2 Current Technologies Lecture 3: SQL - Joins and Subqueries Chris Walton (cdw@dcs.ed.ac.uk) 11 February 2002 Multiple Tables 1 Redundancy requires excess

More information

Semantic Errors in Database Queries

Semantic Errors in Database Queries Semantic Errors in Database Queries 1 Semantic Errors in Database Queries Stefan Brass TU Clausthal, Germany From April: University of Halle, Germany Semantic Errors in Database Queries 2 Classification

More information

Relational Algebra Homework 0 Due Tonight, 5pm! R & G, Chapter 4 Room Swap for Tuesday Discussion Section Homework 1 will be posted Tomorrow

Relational Algebra Homework 0 Due Tonight, 5pm! R & G, Chapter 4 Room Swap for Tuesday Discussion Section Homework 1 will be posted Tomorrow Relational Algebra R & G, Chapter 4 By relieving the brain of all unnecessary work, a good notation sets it free to concentrate on more advanced problems, and, in effect, increases the mental power of

More information

DATABASE SYSTEMS. Database Systems 1 L. Libkin

DATABASE SYSTEMS. Database Systems 1 L. Libkin DATABASE SYSTEMS Copyright c 2009 by Leonid Libkin These slides are free to download for students and instructors. If you use them for teaching a course, you can only distribute them to students free of

More information

Relational model continued. Understanding how to use the relational model. Summary of board example: with Copies as weak entity

Relational model continued. Understanding how to use the relational model. Summary of board example: with Copies as weak entity COS 597A: Principles of Database and Information Systems Relational model continued Understanding how to use the relational model 1 with as weak entity folded into folded into branches: (br_, librarian,

More information

System R and the Relational Model

System R and the Relational Model IC-65 Advances in Database Management Systems Roadmap System R and the Relational Model Intro Codd s paper System R - design Anastasia Ailamaki www.cs.cmu.edu/~natassa 2 The Roots The Roots Codd (CACM

More information

CS121 MIDTERM REVIEW. CS121: Relational Databases Fall 2017 Lecture 13

CS121 MIDTERM REVIEW. CS121: Relational Databases Fall 2017 Lecture 13 CS121 MIDTERM REVIEW CS121: Relational Databases Fall 2017 Lecture 13 2 Before We Start Midterm Overview 3 6 hours, multiple sittings Open book, open notes, open lecture slides No collaboration Possible

More information

CSC 261/461 Database Systems Lecture 13. Fall 2017

CSC 261/461 Database Systems Lecture 13. Fall 2017 CSC 261/461 Database Systems Lecture 13 Fall 2017 Announcement Start learning HTML, CSS, JavaScript, PHP + SQL We will cover the basics next week https://www.w3schools.com/php/php_mysql_intro.asp Project

More information

The Relational Algebra

The Relational Algebra The Relational Algebra Relational Algebra Relational algebra is the basic set of operations for the relational model These operations enable a user to specify basic retrieval requests (or queries) 27-Jan-14

More information

Relational Algebra and SQL

Relational Algebra and SQL Relational Algebra and SQL Relational Algebra. This algebra is an important form of query language for the relational model. The operators of the relational algebra: divided into the following classes:

More information

Query formalisms for relational model relational calculus

Query formalisms for relational model relational calculus lecture 7: Query formalisms for relational model relational calculus course: Database Systems (NDBI025) doc. RNDr. Tomáš Skopal, Ph.D. SS2011/12 Department of Software Engineering, Faculty of Mathematics

More information

LOGIC AND DISCRETE MATHEMATICS

LOGIC AND DISCRETE MATHEMATICS LOGIC AND DISCRETE MATHEMATICS A Computer Science Perspective WINFRIED KARL GRASSMANN Department of Computer Science University of Saskatchewan JEAN-PAUL TREMBLAY Department of Computer Science University

More information

Query Processing with Indexes. Announcements (February 24) Review. CPS 216 Advanced Database Systems

Query Processing with Indexes. Announcements (February 24) Review. CPS 216 Advanced Database Systems Query Processing with Indexes CPS 216 Advanced Database Systems Announcements (February 24) 2 More reading assignment for next week Buffer management (due next Wednesday) Homework #2 due next Thursday

More information

CSE 544: Principles of Database Systems

CSE 544: Principles of Database Systems CSE 544: Principles of Database Systems Semijoin Reductions Theory Wrap-up CSE544 - Spring, 2012 1 Announcements Makeup lectures: Friday, May 18, 10:30-11:50, CSE 405 Friday, May 25, 10:30-11:50, CSE 405

More information

DATABASE SYSTEMS. Database Systems 1 L. Libkin

DATABASE SYSTEMS. Database Systems 1 L. Libkin DATABASE SYSTEMS Copyright c 2014 by Leonid Libkin These slides are free to download for students and instructors. If you use them for teaching a course, you can only distribute them to students free of

More information

CMPS 277 Principles of Database Systems. https://courses.soe.ucsc.edu/courses/cmps277/fall11/01. Lecture #3

CMPS 277 Principles of Database Systems. https://courses.soe.ucsc.edu/courses/cmps277/fall11/01. Lecture #3 CMPS 277 Principles of Database Systems https://courses.soe.ucsc.edu/courses/cmps277/fall11/01 Lecture #3 1 Summary of Lectures #1 and #2 Codd s Relational Model based on the concept of a relation (table)

More information

Information Systems (Informationssysteme)

Information Systems (Informationssysteme) Information Systems (Informationssysteme) Jens Teubner, TU Dortmund jens.teubner@cs.tu-dortmund.de Summer 2016 c Jens Teubner Information Systems Summer 2016 1 Part V The Relational Data Model c Jens Teubner

More information

Set theory is a branch of mathematics that studies sets. Sets are a collection of objects.

Set theory is a branch of mathematics that studies sets. Sets are a collection of objects. Set Theory Set theory is a branch of mathematics that studies sets. Sets are a collection of objects. Often, all members of a set have similar properties, such as odd numbers less than 10 or students in

More information

Copyright 2016 Ramez Elmasri and Shamkant B. Navathe

Copyright 2016 Ramez Elmasri and Shamkant B. Navathe CHAPTER 7 More SQL: Complex Queries, Triggers, Views, and Schema Modification Slide 7-2 Chapter 7 Outline More Complex SQL Retrieval Queries Specifying Semantic Constraints as Assertions and Actions as

More information

The SQL data-definition language (DDL) allows defining :

The SQL data-definition language (DDL) allows defining : Introduction to SQL Introduction to SQL Overview of the SQL Query Language Data Definition Basic Query Structure Additional Basic Operations Set Operations Null Values Aggregate Functions Nested Subqueries

More information

Further GroupBy & Extend Operations

Further GroupBy & Extend Operations Slide 1 Further GroupBy & Extend Operations Objectives of the Lecture : To consider whole relation Grouping; To consider the SQL Grouping option Having; To consider the Extend operator & its implementation

More information

Relational Algebra and Relational Calculus. Pearson Education Limited 1995,

Relational Algebra and Relational Calculus. Pearson Education Limited 1995, Relational Algebra and Relational Calculus 1 Objectives Meaning of the term relational completeness. How to form queries in relational algebra. How to form queries in tuple relational calculus. How to

More information

Introductory SQL SQL Joins: Viewing Relationships Pg 1

Introductory SQL SQL Joins: Viewing Relationships Pg 1 Introductory SQL SQL Joins: Viewing Relationships Pg 1 SQL Joins: Viewing Relationships Ray Lockwood Points: The relational model uses foreign keys to establish relationships between tables. SQL uses Joins

More information

Outline. Textbook Chapter 6. Note 1. CSIE30600/CSIEB0290 Database Systems Basic SQL 2

Outline. Textbook Chapter 6. Note 1. CSIE30600/CSIEB0290 Database Systems Basic SQL 2 Outline SQL Data Definition and Data Types Specifying Constraints in SQL Basic Retrieval Queries in SQL INSERT, DELETE, and UPDATE Statements in SQL Additional Features of SQL Textbook Chapter 6 CSIE30600/CSIEB0290

More information

CS Bootcamp Boolean Logic Autumn 2015 A B A B T T T T F F F T F F F F T T T T F T F T T F F F

CS Bootcamp Boolean Logic Autumn 2015 A B A B T T T T F F F T F F F F T T T T F T F T T F F F 1 Logical Operations 1.1 And The and operator is a binary operator, denoted as, &,, or sometimes by just concatenating symbols, is true only if both parameters are true. A B A B F T F F F F The expression

More information

6.001 Notes: Section 6.1

6.001 Notes: Section 6.1 6.001 Notes: Section 6.1 Slide 6.1.1 When we first starting talking about Scheme expressions, you may recall we said that (almost) every Scheme expression had three components, a syntax (legal ways of

More information