2. Projection, selection and join operations. Witold Rekuć Data Processing Technology 29

Size: px
Start display at page:

Download "2. Projection, selection and join operations. Witold Rekuć Data Processing Technology 29"

Transcription

1 . Projection, selection and join operations Witold Rekuć Data Processing Technology 9

2 Operations on tables Relational operations Set theoretic operations Projection Union Selection Intersection Join Difference Division Complement Rename Witold Rekuć Data Processing Technology 0

3 Projection Projection results in a table that has a header restricted to the given set of column names r(r) - table r of a header R that is a projection argument X a header of a new table a set of column names (X R) q(x) = π X ( r (R) ) = { t[x] : t r } where t[x] denotes a row obtained by a restriction of the row t to values of X R X Witold Rekuć Data Processing Technology

4 Example r({a,b,c,d}) A B C D a5 b c d a6 b4 c5 d a6 b4 c d a6 b4 c d a b c d π {C,D} ( r ({A,B,C,D}) ) = q({c,d}) C c c5 c c c D d d d d d π {A,B} ( r ({A,B,C,D}) ) = q({a,b}) A a5 a6 a B b b4 b Witold Rekuć Data Processing Technology

5 Example Give names and telephone numbers of all companies q({name, Telephone}) = π {Name, Telephone} (Companies ({Id, Name, Street, City Id, Telephone})) q Companies Name Telephone Id Name Street City Id Telephone Our Company Abeja Audi Pafawag Iase Dolmed π {Name, Telephone} Our Company Abeja Audi Pafawag Iase Dolmed Our Street Abejow Street Audi Blvd. Wagon Place Energetic Lane Medical Street rows restricted to X={Name, Telephone} Witold Rekuć Data Processing Technology

6 Witold Rekuć Data Processing Technology 4

7 Example: Give city ids of the companies q({cityid}) = π {City Id} (Company ({Id,Name,Street,City Id,Telephone})) Witold Rekuć Data Processing Technology 5

8 q City Id π {City Id} Companies Id Name 0 Our Company Abeja Audi Pafawag Street Our Street Abejow Street Audi Blvd. Wagon Place City Id Telephone Iase Energetic Lane 56 5 Dolmed Medical Street Why there are duplictes of rows in the table q? Witold Rekuć Data Processing Technology 6

9 Witold Rekuć Data Processing Technology 7

10 Example: Give unique list of city ids of the companies q({cityid}) = π {City Id} (Company ({Id,Name,Street,City Id,Telephone})) Witold Rekuć Data Processing Technology 8

11 Companies q Id 0 Name Our Company Street Our Street City Id Telephone 4 City Id Abeja Abejow Street 4 55 Pafawag Wagon Place π {KodMjc} Audi Audi Blvd. 4 Iase Energetic Lane 56 5 Dolmed Medical Street Witold Rekuć Data Processing Technology 9

12 Example Having a table MonthTurnover we would like to calculate an average value of the month turnover. q({turnover}) = π {Obrót} ( MonthTurnover ({Month,Turnover}) ) q MonthTurnover Turnover Month Turnover π {Turnover} January February March April Mai June Leave duplicates in the result table Avg = ( )/6 = 66,67 Avg = ( )/ = 00 Witold Rekuć Data Processing Technology 40

13 Expressing projection by means of SQL select Name, Telephone from Companies; select distinct Name, Telephone from Companies; select * from Companies; Witold Rekuć Data Processing Technology 4

14 Selection Selection results in a table that has a header equal to the header of the argument table but with rows restricted to those satisfying a given condition r(r) F table r of a header R that is a selection argument selection condition (logical expression) q(r) = σ F ( r (R) ) = { t : t r i F(t) = true } rows satisfying the selection condition Witold Rekuć Data Processing Technology 4

15 Przykład r({a,b,c,d}) A B C D a5 a a6 4 a5 a6 4 a a6 4 a a a σ σ B=4 B=4 and D< ( r ({A,B,C,D}) ) = q ({A,B,C,D}) A B C D a6 4 a5 a6 4 a a6 4 a ( r ({A,B,C,D}) ) = q ({A,B,C,D}) A B C D a6 4 a σ B=4 or D< ( r ({A,B,C,D}) ) = q ({A,B,C,D}) A B C D a5 a a6 4 a5 a6 4 a a6 4 a a a Witold Rekuć Data Processing Technology 4

16 Example Give the list of cities from the province DL q({id,name,prov Id}) = σ Prov Id = DL ( Cities ({Id,Name,Prov Id}) ) Cities q Id Name Wrocław Prov Id DL Wrocław DL σ Prov Id = DL Wałbrzych DL Id Name Prov Id Opole OP Wałbrzych DL 4 Warszawa MZ 5 6 Katowice Kraków SL MP Witold Rekuć Data Processing Technology 44

17 Witold Rekuć Data Processing Technology 45

18 q({... })=σ (City Id=) and (Companies({Id,Name,Street,City Id,Telephone})) (Telephone is NULL) Witold Rekuć Data Processing Technology 46

19 q({... })=σ (City Id=) or (Companies({Id,Name,Street,City Id,Telephone})) (Telephone is NULL) Witold Rekuć Data Processing Technology 47

20 Expressing selection by means of the SQL select * from Cities where [Prov Id] = DL ; select * from Companies where ([City Id] = ) and (Telephone IS NULL); select * from Companies where ([City Id] = ) or (Telephone IS NULL); Witold Rekuć Data Processing Technology 48

21 Composition of projection and selection operations q(x) = π X (σ F ( r (R) ) Example Give names of companies from Opole, which telephone number is unknown. q({name})=π {Name} (σ (City id=) and (Companies({Id,Name,Street,City id,telephone}))) (Telephone is NULL) q Companie sid Name 0 Our Company Street Our Street City Id Telephone 4 Name Abeja Abejow Street 4 55 Audi Pafawag π {Name} ( σ (City Id=) and (Telephone is NULL) Audi Pafawag Audi Blvd. Wagon Place 4 Iase Energetic Lane 56 5 Dolmed Medical Street Witold Rekuć Data Processing Technology 49

22 q({name})=π {Name} (σ (City Id=) and (Companies({Id,Name,Stret,City Id,Telephone}))) (Telephone is NULL) Witold Rekuć Data Processing Technology 50

23 Expressing projection and selection by means of the SQL select Name from Companies where [City Id] = and Telephone IS NULL; Witold Rekuć Data Processing Technology 5

24 Join operation The problem: we would like to get the list of companies and city names Companies Id Name Street 0 Our Our Street Company Abeja Abejow Street Audi Audi Blvd. Pafawag Wagon Place City Id Telephone Cities Id Name Wrocław Opole Wałbrzych Prov Id DL OP DL Comp007.accdb Province Id Name DL Dolnośląskie OP Opolskie 4 Iase Energetic Lane 56 5 Dolmed Invoices Id SellerId Medical Street BuyerId Date Invoice items DocI BuyerId d /0 0 ItemN o ProdId 00 NetPrice,00 Quantity 0 / / ,50 00 / / ,00 50 / /0 00,00 00 / /0 00,00 0 / / ,50 0 4/ /0 0 00,00 45 Products /0 / ,50 7, id 00 Name Pâté Unit kg VatRate 7% /0 / ,0, Sausage Mortadela Crisps Coffee Jakobs kg packet 400g packet 00g 7% 7% 7% /0 4/ ,60, Mackerel can 50g 7% Witold Rekuć Data Processing Technology 5

25 Companies Id 0 Name Our Company Street Our Street City Id Telephone 4 Cities Abeja Abejow Street 4 55 Id Name Prov Id Audi Audi Blvd. Wrocław DL 4 Pafawag Iase Wagon Place Energetic Lane 56 Opole Wałbrzych OP DL 5 Dolmed Medical Street Witold Rekuć Data Processing Technology 5

26 Equijoin (equi-join) operation r(r) table r having header R, attribute A R s(s) table s having header S, attribute B S R i S are disjoint, don't have common names (R S = Ø) q(r S) = r [ A=B ] s = { t : t[r] r, t[s] s i t[a] = t[b] } r R A s S B v v t v v Witold Rekuć Data Processing Technology 54

27 Companies Id Name Street 0 Our Our Street Company Abeja Abejow Street Audi Audi Blvd. Pafawag Wagon Place 4 Iase Energetic Lane City Id Telephone Cities Id Name Wrocław Opole Wałbrzych Prov Id DL OP DL 5 Dolmed Medical Street Companies [ City Id = Id ] Cities List of compnies Id Name Street City Id Telephone Cities.Id Cities.Name Prov Id 0 Our Company Our Comapny 4 Wrocław DL Abeja Abejow Street 4 55 Wałbrzych DL Audi Audi Bvld. Opole OP Pafawag Wagon Lane Opole OP 4 Iase Energetic Lane 56 Wałbrzych DL 5 Dolmed Medcal Street Wrocław DL Witold Rekuć Data Processing Technology 55

28 Companies [ City Id = Id ] Cities Witold Rekuć Data Processing Technology 56

29 Companies [ ] Cities = Companies Cities Witold Rekuć Data Processing Technology 57

30 Composition of projection, selection and equi-join operations q(x) = π X (σ F ( r [A=B] s ) Example π {Invoices.Date} (σ Cities.Name= Wałbrzych ( Invoices [Buyer Id=Id] Companies [City Id=Id ] Cities )) Witold Rekuć Data Processing Technology 58

31 Composition of projection, selection and equi-join operations Witold Rekuć Data Processing Technology 59

32 Cartesian product Witold Rekuć Data Processing Technology 60

33 Equi-join of many tables Witold Rekuć Data Processing Technology 6

34 Expressing projection, selection and equi-join by means of SQL select Companies.Name, Cities.Name from Companies inner join Cities on Companies.[City Id]=Cities.Id; select Companies.Name, Cities.Name from Companies inner join Cities on Companies.[City Id]=Cities.Id where Companies.Telephone is Null; select Invoices.Id, Companies.Name, Invoices.Date from ( [Invoice Items] inner join Invoices on ([Invoice Items].[Seller Id] = Invoices.[Seller Id]) and ([Invoice Items].Id = Invoices.Id) ) inner join Companies on Invoices.[Seller Id] = Companies.Id; Witold Rekuć Data Processing Technology 6

35 Examples C( Id, Name ) P ( Id, Name ) n a na n b nb n c nc 4 n4 In (Id, SiD, BiD,Date) InI ( InvId, SiD, Id, PiD Pr Qua) d a 0 d b 5 d a 0 4 d a d b 7 c 4 5 a 5 c b 4 4 c 0 5 Witold Rekuć Data Processing Technology 6

36 Compute: ) π{date}(in) ) σsid= and BiD=(In), σsid= or BiD=(In) ) π{nrd,nrs}(σsmb=a(ini)) 4) In [SiD=Id] C, In [BiD=Id] C, In [Id=InvId, SiD=SiD] InI Write expressions for the following queries given in the natural language: ) Give names of the companies, which bought something on 'd'. ) Give names of the products bought by the company of the name 'n'. ) Give dates at which product of the name 'na' was bought. 4) Give the names of products that was bought at price >. Witold Rekuć Data Processing Technology 64

Chapter 9 Joining Data from Multiple Tables. Oracle 10g: SQL

Chapter 9 Joining Data from Multiple Tables. Oracle 10g: SQL Chapter 9 Joining Data from Multiple Tables Oracle 10g: SQL Objectives Identify a Cartesian join Create an equality join using the WHERE clause Create an equality join using the JOIN keyword Create a non-equality

More information

3. Relational Model and Relational Algebra

3. Relational Model and Relational Algebra ECS-165A WQ 11 36 3. Relational Model and Relational Algebra Contents Fundamental Concepts of the Relational Model Integrity Constraints Translation ER schema Relational Database Schema Relational Algebra

More information

Relational Database: Additional Operations on Relations; SQL

Relational Database: Additional Operations on Relations; SQL Relational Database: Additional Operations on Relations; SQL Greg Plaxton Theory in Programming Practice, Fall 2005 Department of Computer Science University of Texas at Austin Overview The course packet

More information

Relational Algebra. Module 3, Lecture 1. Database Management Systems, R. Ramakrishnan 1

Relational Algebra. Module 3, Lecture 1. Database Management Systems, R. Ramakrishnan 1 Relational Algebra Module 3, Lecture 1 Database Management Systems, R. Ramakrishnan 1 Relational Query Languages Query languages: Allow manipulation and retrieval of data from a database. Relational model

More information

Relational Databases

Relational Databases Relational Databases Jan Chomicki University at Buffalo Jan Chomicki () Relational databases 1 / 18 Relational data model Domain domain: predefined set of atomic values: integers, strings,... every attribute

More information

Chapter 5 More SQL: Complex Queries, Triggers, Views, and Schema Modification

Chapter 5 More SQL: Complex Queries, Triggers, Views, and Schema Modification Chapter 5 More SQL: Complex Queries, Triggers, Views, and Schema Modification Copyright 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 5 Outline More Complex SQL Retrieval Queries

More information

Using SQL Queries to Insert, Update, Delete, and View Data: Joining Multiple Tables. Lesson C Objectives. Joining Multiple Tables

Using SQL Queries to Insert, Update, Delete, and View Data: Joining Multiple Tables. Lesson C Objectives. Joining Multiple Tables Using SQL Queries to Insert, Update, Delete, and View Data: Joining Multiple Tables Wednesay 9/24/2014 Abdou Illia MIS 4200 - Fall 2014 Lesson C Objectives After completing this lesson, you should be able

More information

Join Example. Join Example Cart Prod. www.comp-soln.com 2006 Comprehensive Consulting Solutions, Inc.All rights reserved.

Join Example. Join Example Cart Prod. www.comp-soln.com 2006 Comprehensive Consulting Solutions, Inc.All rights reserved. Join Example S04.5 Join Example Cart Prod S04.6 Previous joins are equijoins (=) Other operators can be used e.g. List all my employees older than their manager SELECT emp.name FROM employee emp, manager

More information

Define terms Write single and multiple table SQL queries Write noncorrelated and correlated subqueries Define and use three types of joins

Define terms Write single and multiple table SQL queries Write noncorrelated and correlated subqueries Define and use three types of joins Chapter 7 Advanced SQL 1 Define terms Objectives Write single and multiple table SQL queries Write noncorrelated and correlated subqueries Define and use three types of joins 2 Nested Queries (Subqueries)

More information

Boats bid bname color 101 Interlake blue 102 Interlake red 103 Clipper green 104 Marine red. Figure 1: Instances of Sailors, Boats and Reserves

Boats bid bname color 101 Interlake blue 102 Interlake red 103 Clipper green 104 Marine red. Figure 1: Instances of Sailors, Boats and Reserves Tutorial 5: SQL By Chaofa Gao Tables used in this note: Sailors(sid: integer, sname: string, rating: integer, age: real); Boats(bid: integer, bname: string, color: string); Reserves(sid: integer, bid:

More information

Introduction to database design

Introduction to database design Introduction to database design KBL chapter 5 (pages 127-187) Rasmus Pagh Some figures are borrowed from the ppt slides from the book used in the course, Database systems by Kiefer, Bernstein, Lewis Copyright

More information

COMP 5138 Relational Database Management Systems. Week 5 : Basic SQL. Today s Agenda. Overview. Basic SQL Queries. Joins Queries

COMP 5138 Relational Database Management Systems. Week 5 : Basic SQL. Today s Agenda. Overview. Basic SQL Queries. Joins Queries COMP 5138 Relational Database Management Systems Week 5 : Basic COMP5138 "Relational Database Managment Systems" J. Davis 2006 5-1 Today s Agenda Overview Basic Queries Joins Queries Aggregate Functions

More information

RDBMS Using Oracle. Lecture Week 7 Introduction to Oracle 9i SQL Last Lecture. kamran.munir@gmail.com. Joining Tables

RDBMS Using Oracle. Lecture Week 7 Introduction to Oracle 9i SQL Last Lecture. kamran.munir@gmail.com. Joining Tables RDBMS Using Oracle Lecture Week 7 Introduction to Oracle 9i SQL Last Lecture Joining Tables Multiple Table Queries Simple Joins Complex Joins Cartesian Joins Outer Joins Multi table Joins Other Multiple

More information

Relational Algebra and SQL

Relational Algebra and SQL Relational Algebra and SQL Johannes Gehrke johannes@cs.cornell.edu http://www.cs.cornell.edu/johannes Slides from Database Management Systems, 3 rd Edition, Ramakrishnan and Gehrke. Database Management

More information

Duration Vendor Audience 5 Days Oracle End Users, Developers, Technical Consultants and Support Staff

Duration Vendor Audience 5 Days Oracle End Users, Developers, Technical Consultants and Support Staff D80198GC10 Oracle Database 12c SQL and Fundamentals Summary Duration Vendor Audience 5 Days Oracle End Users, Developers, Technical Consultants and Support Staff Level Professional Delivery Method Instructor-led

More information

Oracle Database 11g: SQL Tuning Workshop Release 2

Oracle Database 11g: SQL Tuning Workshop Release 2 Oracle University Contact Us: 1 800 005 453 Oracle Database 11g: SQL Tuning Workshop Release 2 Duration: 3 Days What you will learn This course assists database developers, DBAs, and SQL developers to

More information

Oracle Database 10g: Introduction to SQL

Oracle Database 10g: Introduction to SQL Oracle University Contact Us: 1.800.529.0165 Oracle Database 10g: Introduction to SQL Duration: 5 Days What you will learn This course offers students an introduction to Oracle Database 10g database technology.

More information

Lecture Slides 4. SQL Summary. presented by Timothy Heron. Indexes. Creating an index. Mathematical functions, for single values and groups of values.

Lecture Slides 4. SQL Summary. presented by Timothy Heron. Indexes. Creating an index. Mathematical functions, for single values and groups of values. CS252: Fundamentals of Relational Databases 1 CS252: Fundamentals of Relational Databases Lecture Slides 4 presented by Timothy Heron SQL Summary Mathematical functions, for single values and groups of

More information

MOC 20461C: Querying Microsoft SQL Server. Course Overview

MOC 20461C: Querying Microsoft SQL Server. Course Overview MOC 20461C: Querying Microsoft SQL Server Course Overview This course provides students with the knowledge and skills to query Microsoft SQL Server. Students will learn about T-SQL querying, SQL Server

More information

SQL: Queries, Programming, Triggers

SQL: Queries, Programming, Triggers SQL: Queries, Programming, Triggers Chapter 5 Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke 1 R1 Example Instances We will use these instances of the Sailors and Reserves relations in

More information

Example Instances. SQL: Queries, Programming, Triggers. Conceptual Evaluation Strategy. Basic SQL Query. A Note on Range Variables

Example Instances. SQL: Queries, Programming, Triggers. Conceptual Evaluation Strategy. Basic SQL Query. A Note on Range Variables SQL: Queries, Programming, Triggers Chapter 5 Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke 1 Example Instances We will use these instances of the Sailors and Reserves relations in our

More information

1 Structured Query Language: Again. 2 Joining Tables

1 Structured Query Language: Again. 2 Joining Tables 1 Structured Query Language: Again So far we ve only seen the basic features of SQL. More often than not, you can get away with just using the basic SELECT, INSERT, UPDATE, or DELETE statements. Sometimes

More information

- Eliminating redundant data - Ensuring data dependencies makes sense. ie:- data is stored logically

- Eliminating redundant data - Ensuring data dependencies makes sense. ie:- data is stored logically Normalization of databases Database normalization is a technique of organizing the data in the database. Normalization is a systematic approach of decomposing tables to eliminate data redundancy and undesirable

More information

Electronic Purchase Order System

Electronic Purchase Order System Electronic Purchase Order System IT Services Enter the Electronic Purchase Order system by clicking on Admin and then Procurement. Finding an Approved Supplier to Order from You must place your order from

More information

Programming with SQL

Programming with SQL Unit 43: Programming with SQL Learning Outcomes A candidate following a programme of learning leading to this unit will be able to: Create queries to retrieve information from relational databases using

More information

Introduction to Microsoft Jet SQL

Introduction to Microsoft Jet SQL Introduction to Microsoft Jet SQL Microsoft Jet SQL is a relational database language based on the SQL 1989 standard of the American Standards Institute (ANSI). Microsoft Jet SQL contains two kinds of

More information

Advance DBMS. Structured Query Language (SQL)

Advance DBMS. Structured Query Language (SQL) Structured Query Language (SQL) Introduction Commercial database systems use more user friendly language to specify the queries. SQL is the most influential commercially marketed product language. Other

More information

Using Multiple Operations. Implementing Table Operations Using Structured Query Language (SQL)

Using Multiple Operations. Implementing Table Operations Using Structured Query Language (SQL) Copyright 2000-2001, University of Washington Using Multiple Operations Implementing Table Operations Using Structured Query Language (SQL) The implementation of table operations in relational database

More information

Lab # 5. Retreiving Data from Multiple Tables. Eng. Alaa O Shama

Lab # 5. Retreiving Data from Multiple Tables. Eng. Alaa O Shama The Islamic University of Gaza Faculty of Engineering Department of Computer Engineering ECOM 4113: Database Lab Lab # 5 Retreiving Data from Multiple Tables Eng. Alaa O Shama November, 2015 Objectives:

More information

Introduction to Structured Query Language

Introduction to Structured Query Language Introduction to Structured Query Language This page is a introductory tutorial of the Structured Query Language (also known as SQL) and is a pioneering effort on the World Wide Web, as this is the first

More information

Introduction to Querying & Reporting with SQL Server

Introduction to Querying & Reporting with SQL Server 1800 ULEARN (853 276) www.ddls.com.au Introduction to Querying & Reporting with SQL Server Length 5 days Price $4169.00 (inc GST) Overview This five-day instructor led course provides students with the

More information

Querying Microsoft SQL Server 2012. Querying Microsoft SQL Server 2014 20461D. Course 10774A: Course Det ails. Co urse Outline

Querying Microsoft SQL Server 2012. Querying Microsoft SQL Server 2014 20461D. Course 10774A: Course Det ails. Co urse Outline Course 10774A: Querying Microsoft SQL Server 2012 20461D Querying Microsoft SQL Server 2014 Course Det ails Co urse Outline M o d ule 1: Intr o d uctio n to M icro so ft SQL Ser ver 2012 This module introduces

More information

Lecture 4: More SQL and Relational Algebra

Lecture 4: More SQL and Relational Algebra CPSC 421 Database Management Systems Lecture 4: More SQL and Relational Algebra * Some material adapted from R. Ramakrishnan, L. Delcambre, and B. Ludaescher Today s Agenda Go over last week s quiz New

More information

SQL Boot Camp. End To End SQL Query Writing, Database Design & Development Training. SQL Boot Camp Training.

SQL Boot Camp. End To End SQL Query Writing, Database Design & Development Training. SQL Boot Camp Training. Page 1 of 7 SQL Boot Camp www.sqlbootcamp.com End To End SQL Query Writing, Database Design & Development Training Database Design Query Optimization SQL Boot Camp Training Database Development SQL Query

More information

Querying Microsoft SQL Server 2012

Querying Microsoft SQL Server 2012 Querying Microsoft SQL Server 2012 MOC 10774 About this Course This 5-day instructor led course provides students with the technical skills required to write basic Transact-SQL queries for Microsoft SQL

More information

Relational Database Systems 1

Relational Database Systems 1 Relational Database Systems 1 Wolf-Tilo Balke Philipp Wille Simon Barthel Institut für Informationssysteme Technische Universität Braunschweig www.ifis.cs.tu-bs.de 7.0 Summary of Last Week Basic relational

More information

Advanced Query for Query Developers

Advanced Query for Query Developers for Developers This is a training guide to step you through the advanced functions of in NUFinancials. is an ad-hoc reporting tool that allows you to retrieve data that is stored in the NUFinancials application.

More information

Oracle Database 11g: SQL Tuning Workshop

Oracle Database 11g: SQL Tuning Workshop Oracle University Contact Us: + 38516306373 Oracle Database 11g: SQL Tuning Workshop Duration: 3 Days What you will learn This Oracle Database 11g: SQL Tuning Workshop Release 2 training assists database

More information

SQL: Queries, Programming, Triggers

SQL: Queries, Programming, Triggers SQL: Queries, Programming, Triggers CSC343 Introduction to Databases - A. Vaisman 1 R1 Example Instances We will use these instances of the Sailors and Reserves relations in our examples. If the key for

More information

Where? Originating Table Employees Departments

Where? Originating Table Employees Departments JOINS: To determine an employee s department name, you compare the value in the DEPARTMENT_ID column in the EMPLOYEES table with the DEPARTMENT_ID values in the DEPARTMENTS table. The relationship between

More information

Displaying Data from Multiple Tables

Displaying Data from Multiple Tables 4 Displaying Data from Multiple Tables Copyright Oracle Corporation, 2001. All rights reserved. Schedule: Timing Topic 55 minutes Lecture 55 minutes Practice 110 minutes Total Objectives After completing

More information

The process of database development. Logical model: relational DBMS. Relation

The process of database development. Logical model: relational DBMS. Relation The process of database development Reality (Universe of Discourse) Relational Databases and SQL Basic Concepts The 3rd normal form Structured Query Language (SQL) Conceptual model (e.g. Entity-Relationship

More information

Applications of Methods of Proof

Applications of Methods of Proof CHAPTER 4 Applications of Methods of Proof 1. Set Operations 1.1. Set Operations. The set-theoretic operations, intersection, union, and complementation, defined in Chapter 1.1 Introduction to Sets are

More information

Chapter 5. SQL: Queries, Constraints, Triggers

Chapter 5. SQL: Queries, Constraints, Triggers Chapter 5 SQL: Queries, Constraints, Triggers 1 Overview: aspects of SQL DML: Data Management Language. Pose queries (Ch. 5) and insert, delete, modify rows (Ch. 3) DDL: Data Definition Language. Creation,

More information

Introduction to Structured Query Language

Introduction to Structured Query Language Introduction to Structured Query Language Version 4.66 Copyright 1996-2001, James Hoffman jhoffman@one.net Introduction to Structured Query Language Version 4.66 This page is a introductory tutorial of

More information

Chapter 1 Overview of the SQL Procedure

Chapter 1 Overview of the SQL Procedure Chapter 1 Overview of the SQL Procedure 1.1 Features of PROC SQL...1-3 1.2 Selecting Columns and Rows...1-6 1.3 Presenting and Summarizing Data...1-17 1.4 Joining Tables...1-27 1-2 Chapter 1 Overview of

More information

7. Business views (2/3h)

7. Business views (2/3h) 7. Business views (2/3h) Topics 7.1. Business views as business architecture 7.2. Business vision view 7.3. Business process view 7.4. Business structure view 7.5. Business behavior view Dr. Witold Rekuć

More information

WRITING EFFICIENT SQL. By Selene Bainum

WRITING EFFICIENT SQL. By Selene Bainum WRITING EFFICIENT SQL By Selene Bainum About Me Extensive SQL & database development since 1995 ColdFusion Developer since 1996 Author & Speaker Co-Founder RiteTech LLC IT & Web Company in Washington,

More information

Outline. SAS-seminar Proc SQL, the pass-through facility. What is SQL? What is a database? What is Proc SQL? What is SQL and what is a database

Outline. SAS-seminar Proc SQL, the pass-through facility. What is SQL? What is a database? What is Proc SQL? What is SQL and what is a database Outline SAS-seminar Proc SQL, the pass-through facility How to make your data processing someone else s problem What is SQL and what is a database Quick introduction to Proc SQL The pass-through facility

More information

In this Lecture SQL SELECT. Example Tables. SQL SELECT Overview. WHERE Clauses. DISTINCT and ALL SQL SELECT. For more information

In this Lecture SQL SELECT. Example Tables. SQL SELECT Overview. WHERE Clauses. DISTINCT and ALL SQL SELECT. For more information In this Lecture SQL SELECT Database Systems Lecture 7 Natasha Alechina SQL SELECT WHERE clauses SELECT from multiple tables JOINs For more information Connolly and Begg Chapter 5 Ullman and Widom Chapter

More information

Performing Queries Using PROC SQL (1)

Performing Queries Using PROC SQL (1) SAS SQL Contents Performing queries using PROC SQL Performing advanced queries using PROC SQL Combining tables horizontally using PROC SQL Combining tables vertically using PROC SQL 2 Performing Queries

More information

Course 20461C: Querying Microsoft SQL Server Duration: 35 hours

Course 20461C: Querying Microsoft SQL Server Duration: 35 hours Course 20461C: Querying Microsoft SQL Server Duration: 35 hours About this Course This course is the foundation for all SQL Server-related disciplines; namely, Database Administration, Database Development

More information

Paper 109-25 Merges and Joins Timothy J Harrington, Trilogy Consulting Corporation

Paper 109-25 Merges and Joins Timothy J Harrington, Trilogy Consulting Corporation Paper 109-25 Merges and Joins Timothy J Harrington, Trilogy Consulting Corporation Abstract This paper discusses methods of joining SAS data sets. The different methods and the reasons for choosing a particular

More information

CS143: Query and Update in SQL

CS143: Query and Update in SQL CS143: Query and Update in SQL Book Chapters (4th) Chapter 4.1-6, 4.8-10, 3.3.4 (5th) Chapter 3.1-8, 3.10-11 (6th) Chapter 3.1-9, 4.1, 4.3 Things to Learn SQL DML for SQL Structured Query Language The

More information

The SQL Query Language. Creating Relations in SQL. Referential Integrity in SQL. Basic SQL Query. Primary and Candidate Keys in SQL

The SQL Query Language. Creating Relations in SQL. Referential Integrity in SQL. Basic SQL Query. Primary and Candidate Keys in SQL COS 597A: Principles of Database and Information Systems SQL: Overview and highlights The SQL Query Language Structured Query Language Developed by IBM (system R) in the 1970s Need for a standard since

More information

A vector is a directed line segment used to represent a vector quantity.

A vector is a directed line segment used to represent a vector quantity. Chapters and 6 Introduction to Vectors A vector quantity has direction and magnitude. There are many examples of vector quantities in the natural world, such as force, velocity, and acceleration. A vector

More information

Introducing Microsoft SQL Server 2012 Getting Started with SQL Server Management Studio

Introducing Microsoft SQL Server 2012 Getting Started with SQL Server Management Studio Querying Microsoft SQL Server 2012 Microsoft Course 10774 This 5-day instructor led course provides students with the technical skills required to write basic Transact-SQL queries for Microsoft SQL Server

More information

Table 1. Demog. id education B002 5 b003 8 b005 5 b007 9 b008 7 b009 8 b010 8

Table 1. Demog. id education B002 5 b003 8 b005 5 b007 9 b008 7 b009 8 b010 8 Adding PROC SQL to your SAS toolbox for merging multiple tables without common variable names Susan Wancewicz, Moores Cancer Center, UCSD, La Jolla, CA ABSTRACT The SQL procedure offers an efficient method

More information

Querying Microsoft SQL Server

Querying Microsoft SQL Server Course 20461C: Querying Microsoft SQL Server Module 1: Introduction to Microsoft SQL Server 2014 This module introduces the SQL Server platform and major tools. It discusses editions, versions, tools used

More information

Relational Algebra. Basic Operations Algebra of Bags

Relational Algebra. Basic Operations Algebra of Bags Relational Algebra Basic Operations Algebra of Bags 1 What is an Algebra Mathematical system consisting of: Operands --- variables or values from which new values can be constructed. Operators --- symbols

More information

INTRODUCTION TO MICROSOFT ACCESS MINIMAL MANUAL

INTRODUCTION TO MICROSOFT ACCESS MINIMAL MANUAL University of Glasgow Department of Computing Science INTRODUCTION TO MICROSOFT ACCESS MINIMAL MANUAL 1 Databases in Access...2 2 The Database Window...2 3 Help...2 4 Saving...3 5 Wizards...3 6 Tables...3

More information

The Relational Data Model and Relational Database Constraints

The Relational Data Model and Relational Database Constraints The Relational Data Model and Relational Database Constraints Chapter Outline Relational Model Concepts Relational Model Constraints and Relational Database Schemas Update Operations and Dealing with Constraint

More information

TEN GOOD REASONS TO LEARN SAS SOFTWARE S SQL PROCEDURE SIGURD W. HERMANSEN, WESTAT,ROCKVILLE,MD

TEN GOOD REASONS TO LEARN SAS SOFTWARE S SQL PROCEDURE SIGURD W. HERMANSEN, WESTAT,ROCKVILLE,MD TEN GOOD REASONS TO LEARN SAS SOFTWARE S SQL PROCEDURE SIGURD W. HERMANSEN, WESTAT,ROCKVILLE,MD ABSTRACT SAS PROC SQL works interchangeably with and complements data step programs and other procedures,

More information

Oracle 10g PL/SQL Training

Oracle 10g PL/SQL Training Oracle 10g PL/SQL Training Course Number: ORCL PS01 Length: 3 Day(s) Certification Exam This course will help you prepare for the following exams: 1Z0 042 1Z0 043 Course Overview PL/SQL is Oracle's Procedural

More information

8. Query Processing. Query Processing & Optimization

8. Query Processing. Query Processing & Optimization ECS-165A WQ 11 136 8. Query Processing Goals: Understand the basic concepts underlying the steps in query processing and optimization and estimating query processing cost; apply query optimization techniques;

More information

Below is a table called raw_search_log containing details of search queries. user_id INTEGER ID of the user that made the search.

Below is a table called raw_search_log containing details of search queries. user_id INTEGER ID of the user that made the search. %load_ext sql %sql sqlite:///olap.db OLAP and Cubes Activity 1 Data and Motivation You're given a bunch of data on search queries by users. (We can pretend that these users are Google search users and

More information

Useful Business Analytics SQL operators and more Ajaykumar Gupte IBM

Useful Business Analytics SQL operators and more Ajaykumar Gupte IBM Useful Business Analytics SQL operators and more Ajaykumar Gupte IBM 1 Acknowledgements and Disclaimers Availability. References in this presentation to IBM products, programs, or services do not imply

More information

Databases 2011 The Relational Model and SQL

Databases 2011 The Relational Model and SQL Databases 2011 Christian S. Jensen Computer Science, Aarhus University What is a Database? Main Entry: da ta base Pronunciation: \ˈdā-tə-ˌbās, ˈda- also ˈdä-\ Function: noun Date: circa 1962 : a usually

More information

Querying Microsoft SQL Server (20461) H8N61S

Querying Microsoft SQL Server (20461) H8N61S HP Education Services course data sheet Querying Microsoft SQL Server (20461) H8N61S Course Overview In this course, you will learn the technical skills required to write basic Transact-SQL (T-SQL) queries

More information

CHAPTER 2. Set, Whole Numbers, and Numeration

CHAPTER 2. Set, Whole Numbers, and Numeration CHAPTER 2 Set, Whole Numbers, and Numeration 2.1. Sets as a Basis for Whole Numbers A set is a collection of objects, called the elements or members of the set. Three common ways to define sets: (1) A

More information

Handling Missing Values in the SQL Procedure

Handling Missing Values in the SQL Procedure Handling Missing Values in the SQL Procedure Danbo Yi, Abt Associates Inc., Cambridge, MA Lei Zhang, Domain Solutions Corp., Cambridge, MA ABSTRACT PROC SQL as a powerful database management tool provides

More information

DIPLOMA IN WEBDEVELOPMENT

DIPLOMA IN WEBDEVELOPMENT DIPLOMA IN WEBDEVELOPMENT Prerequisite skills Basic programming knowledge on C Language or Core Java is must. # Module 1 Basics and introduction to HTML Basic HTML training. Different HTML elements, tags

More information

Discrete Mathematics

Discrete Mathematics Discrete Mathematics Chih-Wei Yi Dept. of Computer Science National Chiao Tung University March 16, 2009 2.1 Sets 2.1 Sets 2.1 Sets Basic Notations for Sets For sets, we ll use variables S, T, U,. We can

More information

Effective Use of SQL in SAS Programming

Effective Use of SQL in SAS Programming INTRODUCTION Effective Use of SQL in SAS Programming Yi Zhao Merck & Co. Inc., Upper Gwynedd, Pennsylvania Structured Query Language (SQL) is a data manipulation tool of which many SAS programmers are

More information

Comp 5311 Database Management Systems. 3. Structured Query Language 1

Comp 5311 Database Management Systems. 3. Structured Query Language 1 Comp 5311 Database Management Systems 3. Structured Query Language 1 1 Aspects of SQL Most common Query Language used in all commercial systems Discussion is based on the SQL92 Standard. Commercial products

More information

ICAB4136B Use structured query language to create database structures and manipulate data

ICAB4136B Use structured query language to create database structures and manipulate data ICAB4136B Use structured query language to create database structures and manipulate data Release: 1 ICAB4136B Use structured query language to create database structures and manipulate data Modification

More information

Querying Microsoft SQL Server 2012

Querying Microsoft SQL Server 2012 Course 10774A: Querying Microsoft SQL Server 2012 Length: 5 Days Language(s): English Audience(s): IT Professionals Level: 200 Technology: Microsoft SQL Server 2012 Type: Course Delivery Method: Instructor-led

More information

Structured Query Language (SQL)

Structured Query Language (SQL) Objectives of SQL Structured Query Language (SQL) o Ideally, database language should allow user to: create the database and relation structures; perform insertion, modification, deletion of data from

More information

Course 10774A: Querying Microsoft SQL Server 2012

Course 10774A: Querying Microsoft SQL Server 2012 Course 10774A: Querying Microsoft SQL Server 2012 About this Course This 5-day instructor led course provides students with the technical skills required to write basic Transact-SQL queries for Microsoft

More information

Course ID#: 1401-801-14-W 35 Hrs. Course Content

Course ID#: 1401-801-14-W 35 Hrs. Course Content Course Content Course Description: This 5-day instructor led course provides students with the technical skills required to write basic Transact- SQL queries for Microsoft SQL Server 2014. This course

More information

Course 10774A: Querying Microsoft SQL Server 2012 Length: 5 Days Published: May 25, 2012 Language(s): English Audience(s): IT Professionals

Course 10774A: Querying Microsoft SQL Server 2012 Length: 5 Days Published: May 25, 2012 Language(s): English Audience(s): IT Professionals Course 10774A: Querying Microsoft SQL Server 2012 Length: 5 Days Published: May 25, 2012 Language(s): English Audience(s): IT Professionals Overview About this Course Level: 200 Technology: Microsoft SQL

More information

Triggers & Packages. {INSERT [OR] UPDATE [OR] DELETE}: This specifies the DML operation.

Triggers & Packages. {INSERT [OR] UPDATE [OR] DELETE}: This specifies the DML operation. Triggers & Packages An SQL trigger is a mechanism that automatically executes a specified PL/SQL block (referred to as the triggered action) when a triggering event occurs on the table. The triggering

More information

Querying Microsoft SQL Server 20461C; 5 days

Querying Microsoft SQL Server 20461C; 5 days Lincoln Land Community College Capital City Training Center 130 West Mason Springfield, IL 62702 217-782-7436 www.llcc.edu/cctc Querying Microsoft SQL Server 20461C; 5 days Course Description This 5-day

More information

Oracle Database 12c: Introduction to SQL Ed 1.1

Oracle Database 12c: Introduction to SQL Ed 1.1 Oracle University Contact Us: 1.800.529.0165 Oracle Database 12c: Introduction to SQL Ed 1.1 Duration: 5 Days What you will learn This Oracle Database: Introduction to SQL training helps you write subqueries,

More information

Introduction to SQL: Data Retrieving

Introduction to SQL: Data Retrieving Introduction to SQL: Data Retrieving Ruslan Fomkin Databasdesign för Ingenjörer 1056F Structured Query Language (SQL) History: SEQUEL (Structured English QUery Language), earlier 70 s, IBM Research SQL

More information

Co-ordinate Geometry THE EQUATION OF STRAIGHT LINES

Co-ordinate Geometry THE EQUATION OF STRAIGHT LINES Co-ordinate Geometry THE EQUATION OF STRAIGHT LINES This section refers to the properties of straight lines and curves using rules found by the use of cartesian co-ordinates. The Gradient of a Line. As

More information

What is a set? Sets. Specifying a Set. Notes. The Universal Set. Specifying a Set 10/29/13

What is a set? Sets. Specifying a Set. Notes. The Universal Set. Specifying a Set 10/29/13 What is a set? Sets CS 231 Dianna Xu set is a group of objects People: {lice, ob, Clara} Colors of a rainbow: {red, orange, yellow, green, blue, purple} States in the S: {labama, laska, Virginia, } ll

More information

Designing Databases. Introduction

Designing Databases. Introduction Designing Databases C Introduction Businesses rely on databases for accurate, up-to-date information. Without access to mission critical data, most businesses are unable to perform their normal daily functions,

More information

Results CRM 2012 User Manual

Results CRM 2012 User Manual Results CRM 2012 User Manual A Guide to Using Results CRM Standard, Results CRM Plus, & Results CRM Business Suite Table of Contents Installation Instructions... 1 Single User & Evaluation Installation

More information

Information and Computer Science Department ICS 324 Database Systems Lab#11 SQL-Basic Query

Information and Computer Science Department ICS 324 Database Systems Lab#11 SQL-Basic Query Information and Computer Science Department ICS 324 Database Systems Lab#11 SQL-Basic Query Objectives The objective of this lab is to learn the query language of SQL. Outcomes After completing this Lab,

More information

Unique column combinations

Unique column combinations Unique column combinations Arvid Heise Guest lecture in Data Profiling and Data Cleansing Prof. Dr. Felix Naumann Agenda 2 Introduction and problem statement Unique column combinations Exponential search

More information

Automata Theory. Şubat 2006 Tuğrul Yılmaz Ankara Üniversitesi

Automata Theory. Şubat 2006 Tuğrul Yılmaz Ankara Üniversitesi Automata Theory Automata theory is the study of abstract computing devices. A. M. Turing studied an abstract machine that had all the capabilities of today s computers. Turing s goal was to describe the

More information

The Relational Algebra

The Relational Algebra The Relational Algebra Relational set operators: The data in relational tables are of limited value unless the data can be manipulated to generate useful information. Relational Algebra defines the theoretical

More information

Big Data Hive! 2013-2014 Laurent d Orazio

Big Data Hive! 2013-2014 Laurent d Orazio Big Data Hive! 2013-2014 Laurent d Orazio Introduction! Context Parallel computation on large data sets on commodity hardware Hadoop [hadoop] Definition Open source implementation of MapReduce [DG08] Objective

More information

Querying Microsoft SQL Server Course M20461 5 Day(s) 30:00 Hours

Querying Microsoft SQL Server Course M20461 5 Day(s) 30:00 Hours Área de formação Plataforma e Tecnologias de Informação Querying Microsoft SQL Introduction This 5-day instructor led course provides students with the technical skills required to write basic Transact-SQL

More information

Oracle Database: SQL and PL/SQL Fundamentals

Oracle Database: SQL and PL/SQL Fundamentals Oracle University Contact Us: 1.800.529.0165 Oracle Database: SQL and PL/SQL Fundamentals Duration: 5 Days What you will learn This course is designed to deliver the fundamentals of SQL and PL/SQL along

More information

Ad Hoc Advanced Table of Contents

Ad Hoc Advanced Table of Contents Ad Hoc Advanced Table of Contents Functions... 1 Adding a Function to the Adhoc Query:... 1 Constant... 2 Coalesce... 4 Concatenate... 6 Add/Subtract... 7 Logical Expressions... 8 Creating a Logical Expression:...

More information

CS 338 Join, Aggregate and Group SQL Queries

CS 338 Join, Aggregate and Group SQL Queries CS 338 Join, Aggregate and Group SQL Queries Bojana Bislimovska Winter 2016 Outline SQL joins Aggregate functions in SQL Grouping in SQL HAVING clause SQL Joins Specifies a table resulting from a join

More information