Relational Algebra. Query Languages Review. Operators. Select (σ), Project (π), Union ( ), Difference (-), Join: Natural (*) and Theta ( )
|
|
- Cleopatra McCormick
- 8 years ago
- Views:
Transcription
1 Query Languages Review Relational Algebra SQL Set operators Union Intersection Difference Cartesian product Relational Algebra Operators Relational operators Selection Projection Join Division Douglas S. Kerr CIS 671 Query Languages 1 CIS 671 Query Languages 2 Select (σ), Project (π), Union ( ), Difference (-), Join: Natural (*) and Theta ( ) Natural join (*) Q R 1 * (list1), (list2) R 2 list i has attributes from relation R i list 1 names go in Q Theta-join (θ-join) θ ε {, <, =, >,, } Theta (θ) join ( ) Q R 1 <join condition> R 2 where <join condition> is of the form <condition> AND <condition> AND AND <condition> where each condition is of the form A i θ B j, A i is an attribute of R 1, B j is an attribute of R 2, θ (theta) ε (<,, >,, =, ) e.g. For each employee, those making higher salary. EMP1 EMP1.SAL < EMP2.SAL EMP2 CIS 671 Query Languages 3 EMP( EMPNO, NAME, DNO, JOB, MGR, SAL, COMMISSION) DEPT( DNO, DNAME, LOC) CIS 671 Query Languages 4 Answer: D1 and D2 (exists, ) Answer: D1 and D2 π DNO ( π JOB (σ DNO = D3 (EMP)) * EMP) What about department D3? CIS 671 Query Languages 5 CIS 671 Query Languages 6 1
2 CIS 671 Query Languages 7 Divide ( ), for all ( ) EMP( EMPNO, DNO, JOB,...) D3JOBS π JOB (σ DNO = D3 (EMP)) DEPT_JOBS π DNO, JOB (EMP) GOOD_DEPTS DEPT_JOBS D3JOBS (π DNO, JOB (EMP)) (π JOB (σ DNO = D3 (EMP)) ) CIS 671 Query Languages 8 Functions and groups continued Q14. List the departments (DNO) and the average salary of each. EMP( EMPNO, DNO, SAL,...) 100 D3 66, D3 55, D3 66, D1 66, D1 55, D1 60, D2 66, D2 60, D2 66,000 DNO DNO AVG SAL D3 62,333 D1 60,333 D2 64,000 AVERAGE SAL ( EMP) CIS 671 Query Languages 9 Outer joins P(P#, PNAME, CITY) S(S#, SNAME, CITY) P1 Nut London S1 Smith London P3 Screw Rome S5 Adams Athens Q15a. For each part list all suppliers in the same city. ( P#, PNAME, S#, SNAME, CITY) P1 Nut S1 Smith London Q15b. For each part list all suppliers in the same city. For a part with no supplier in the city, list null. P P.CITY = S.CITY S natural join (inner join) ( P#, PNAME, S#, SNAME, CITY) P P.CITY = S.CITY S P1 Nut S1 Smith London P3 Screw?? Rome left outer join CIS 671 Query Languages 10 Outer joins continued P(P#, PNAME, CITY) P1 Nut London P3 Screw Rome Q15c. For each part list all suppliers in the same city. For a supplier with no part in the city, list null. ( P#, PNAME, S#, SNAME, CITY) P P.CITY = S.CITY P1 Nut S1 Smith London S?? S5 Adams Athens right outer join Q15d. For each part list all suppliers in the same city. For a part with no supplier in the city, list null. For a supplier with no part in the city, list null. S(S#, SNAME, CITY) S1 Smith London S5 Adams Athens ( P#, PNAME, S#, SNAME, CITY) P1 Nut S1 Smith London P P.CITY = S.CITY S P3 Screw?? Rome?? S5 Adams Athens outer join CIS 671 Query Languages 11 Recursive closure EMP( EMPNO, MGR,...) Q 16. List all the superiors of EMPNO Q 17. List all those supervised by EMPNO Can t express these queries? WHY? CIS 671 Query Languages 12 2
3 SEQUEL Structured English QUEry Language D. D. Chamberlin, et al., SEQUEL 2 A Unified Approach to Data Definition, Manipulation, and Control, IBM J. Res. Develop., Nov. 1976, pp SQL Structured Query Language SQL - Parts of the Language Data Definition Language (DDL) create table create index Data Manipulation Language (DML) select (retrieve) update insert delete CIS 671 Query Languages 13 CIS 671 Query Languages 14 Select - Basic Form (select from where) Cartesian product followed by select and project. select project-list from Cartesian-product-list where select-condition(s) Abstract example: Given tables R(A,B) and S(B,C) select R.A, R.B, S.C from R, S where R.A > 10 BUT - Duplicates NOT eliminated. Bag vs. Set. CIS 671 Query Languages 15 Select as a JOIN Cartesian product followed by select ( join & select conditions) and project. select project-list from Cartesian-product-list where join-condition and select-condition Abstract example: Given tables R(A,B) and S(B,C) select R.A, R.B, S.C from R, S where R.B = S.B /* join condition */ and R.A > 10 /* select condition */ CIS 671 Query Languages 16 Using EMP and DEPT From Relational Algebra to SQL EMP( EMPNO, NAME, DNO, JOB, MGR, SAL, COMMISSION) DEPT( DNO, DNAME, LOC) List the names, employee numbers, department numbers and locations for all clerks. select NAME, EMPNO, E.DNO, LOC E, DEPT D where E.DNO = D.DNO /* join condition */ and JOB = Clerk /* select condition */ Note use of alias in from clause. CIS 671 Query Languages 17 Duplicates in project - must use explicit distinct List the different department numbers in the EMP table (eliminate duplicates). select distinct DNO Specify sort order List employee number, name, and salary of employees in department 50. select EMPNO, NAME, SAL where DNO = 50 order by EMPNO CIS 671 Query Languages 18 3
4 Union List the numbers of those departments which have an employee named Smith or are located in Columbus. where ENAME = Smith union where LOC = Columbus Functions and Groups List the departments (DNO) and the average salary of each., avg(sal) E, DEPT D where E.DNO = D.DNO group by DNO Duplicates ARE eliminated by default. union all - leaves duplicates CIS 671 Query Languages 19 CIS 671 Query Languages 20 SQL is (was) NOT an Algebra List the departments (DNO, DNAME) in which the average employee salary < $25,000., DNAME E, DEPT D where E.DNO = D.DNO group by DNO, DNAME having avg(sal) < CIS 671 Query Languages 21 Nested Select: No analog in Relational Algebra List names of employees in departments 25, 47 and 53. select NAME where DNO in (25, 47, 53) List names of employees who work in departments in Ann Arbor. select NAME where DNO in ( where LOC = Ann Arbor ) CIS 671 Query Languages 22 Big Summary For all departments in Columbus with average salary > $25,000, list the department s number, name, and average salary ordered by average salary in descending order., DNAME, avg(sal), DEPT where EMP.DNO = DEPT.DNO and LOC = Columbus group by DNO, DNAME having avg(sal) > order by 3 desc CIS 671 Query Languages 23 Null Values All of the following conditions are always false. null > 25 null < 25 null = 25 null <> 25 null >= 25 null <= 25 null = null null <> null However we can use the following: select NAME where SAL < or SAL is null CIS 671 Query Languages 24 4
5 Views In SQL A named, derived table (a virtual table). Derived from base tables and/or other views. In Three-schema Architecture (pp ) External View A collection of several tables, some views, other base tables. Views: Changing Attribute Names Create a view called PROGS consisting of the EMPNO, name and salary of all programmers. Include the locations of their departments. create view PROG(EMPNO, NAME, SALARY, HOMEBASE) as select EMPNO, NAME, SAL, LOC, DEPT where EMP.DNO = DEPT.DNO and EMP.JOB = Programmer CIS 671 Query Languages 25 CIS 671 Query Languages 26 Exists ( ) and For All ( ) EMP( EMPNO, NAME, DNO, JOB, MGR, SAL, COMMISSION) DEPT( DNO, DNAME, LOC) CIS 671 Query Languages 27 Answer: D1 and D2 exists, The order of the two where exists selects does not matter. and exists EY Still gets D3. and EY.DNO = DEPT.DNO)) CIS 671 Query Languages 28 for all, However no for all exists in SQL. where for all and exists EY and EY.DNO = DEPT.DNO)) CIS 671 Query Languages 29 CIS 671 Query Languages 30 5
6 However no for all exists in SQL. where not exists Use two not exists. and not exists EY and EY.DNO = DEPT.DNO)) Eliminate where not exists and not exists EY and EY.DNO = DEPT.DNO) ) and DNO <> D3 CIS 671 Query Languages 31 CIS 671 Query Languages 32 SQL: for all ( ) using count Function First Attempt: SQL: for all ( ) using count Function Second Attempt: D where ( select count(distinct JOB) ) = ( select count(distinct JOB) EY where EY.DNO = D.DNO) D3JOBS: Jobs done DJOBS: Jobs done department D. D where ( select count(distinct JOB) ) = ( select count(distinct EY.JOB) EY, EMP ED3 where EY.DNO = D.DNO and EY.JOB = ED3.JOB and ED3.DNO = D3 ) D3JOBS: Jobs done DJOBS: Jobs done by employees in department D that are also done by employees in department D3. CIS 671 Query Languages 33 CIS 671 Query Languages 34 Why does this approach work? The where clause is applied to a specific department D. D where ( select count(distinct JOB) ) = ( select count(distinct EY.JOB) EY, EMP ED3 where EY.DNO = D.DNO and EY.JOB = ED3.JOB and ED3.DNO = D3 ) Works if DJOBS D3JOBS. Why is this a general rule? Why is the rule satisfied in this case? D3JOBS: Jobs done DJOBS: Jobs done department D that are also done by employees in CIS 671 Query Languages 35 6
Information Systems SQL. Nikolaj Popov
Information Systems SQL Nikolaj Popov Research Institute for Symbolic Computation Johannes Kepler University of Linz, Austria popov@risc.uni-linz.ac.at Outline SQL Table Creation Populating and Modifying
More informationIntroduction 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 informationChapter 8. SQL-99: SchemaDefinition, Constraints, and Queries and Views
Chapter 8 SQL-99: SchemaDefinition, Constraints, and Queries and Views Data Definition, Constraints, and Schema Changes Used to CREATE, DROP, and ALTER the descriptions of the tables (relations) of a database
More informationPart A: Data Definition Language (DDL) Schema and Catalog CREAT TABLE. Referential Triggered Actions. CSC 742 Database Management Systems
CSC 74 Database Management Systems Topic #0: SQL Part A: Data Definition Language (DDL) Spring 00 CSC 74: DBMS by Dr. Peng Ning Spring 00 CSC 74: DBMS by Dr. Peng Ning Schema and Catalog Schema A collection
More informationIntroduction 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 informationSystem R: Relational Approach to Database Management
System R: Relational Approach to Database Management M. M. ASTRAHAN, ht. W. BLASGEN, D. D. CHAMBERLIN, K. P. ESWARAN, J. N. GRAY, P. P. GRIFFITHS, W. F. KING, R. A. LORIE, P. R. A&JONES, J. W. MEHL, G.
More informationStructured 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 informationCOMP 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 informationAggregating Data Using Group Functions
Aggregating Data Using Group Functions Objectives Capter 5 After completing this lesson, you should be able to do the following: Identify the available group functions Describe the use of group functions
More informationOverview of Database Management Systems
Overview of Database Management Systems Goals: DBMS basic concepts Introduce underlying managerial issues Prepare for discussion of uses of DBMS, such as OLAP and database mining 1 Overview of Database
More informationRDBMS 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 informationDatabase Design. Marta Jakubowska-Sobczak IT/ADC based on slides prepared by Paula Figueiredo, IT/DB
Marta Jakubowska-Sobczak IT/ADC based on slides prepared by Paula Figueiredo, IT/DB Outline Database concepts Conceptual Design Logical Design Communicating with the RDBMS 2 Some concepts Database: an
More informationMini User's Guide for SQL*Plus T. J. Teorey
Mini User's Guide for SQL*Plus T. J. Teorey Table of Contents Oracle/logging-in 1 Nested subqueries 5 SQL create table/naming rules 2 Complex functions 6 Update commands 3 Save a query/perm table 6 Select
More informationCS 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 informationData Structure: Relational Model. Programming Interface: JDBC/ODBC. SQL Queries: The Basic From
Data Structure: Relational Moel Relational atabases: Schema + Data Schema (also calle scheme): collection of tables (also calle relations) each table has a set of attributes no repeating relation names,
More informationFigure 4.12.Insurancedatabase.
Exercises 43 person (driver-id, name, address) car (license, model, year) accident (report-number, date, location) owns (driver-id, license) participated (driver-id, car, report-number, damage-amount)
More information3. 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 informationChapter 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 informationPart 4: Database Language - SQL
Part 4: Database Language - SQL Junping Sun Database Systems 4-1 Database Languages and Implementation Data Model Data Model = Data Schema + Database Operations + Constraints Database Languages such as
More informationAccess Path Selection in a Relational Database Management System
Access Path Selection in a Relational Database Management System P. Griffiths Selinger M. M. Astrahan D. D. Chamberlin R. A. Lorie T. G. Price IBM Research Division, San Jose, California 95193 ABSTRACT:
More informationThe 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 informationSUBQUERIES AND VIEWS. CS121: Introduction to Relational Database Systems Fall 2015 Lecture 6
SUBQUERIES AND VIEWS CS121: Introduction to Relational Database Systems Fall 2015 Lecture 6 String Comparisons and GROUP BY 2! Last time, introduced many advanced features of SQL, including GROUP BY! Recall:
More informationSubqueries Chapter 6
Subqueries Chapter 6 Objectives After completing this lesson, you should be able to do the follovving: Describe the types of problems that subqueries can solve Define subqueries List the types of subqueries
More informationOracle/SQL Tutorial 1
Oracle/SQL Tutorial 1 Michael Gertz Database and Information Systems Group Department of Computer Science University of California, Davis gertz@cs.ucdavis.edu http://www.db.cs.ucdavis.edu This Oracle/SQL
More informationIntroduction to SQL C H A P T E R3. Exercises
C H A P T E R3 Introduction to SQL Exercises 3.1 Write the following queries in SQL, using the university schema. (We suggest you actually run these queries on a database, using the sample data that we
More informationOracle SQL. Course Summary. Duration. Objectives
Oracle SQL Course Summary Identify the major structural components of the Oracle Database 11g Create reports of aggregated data Write SELECT statements that include queries Retrieve row and column data
More informationSummary on Chapter 4 Basic SQL
Summary on Chapter 4 Basic SQL SQL Features Basic SQL DDL o Includes the CREATE statements o Has a comprehensive set of SQL data types o Can specify key, referential integrity, and other constraints Basic
More informationSQL Introduction Chapter 7, sections 1 & 4. Introduction to SQL. Introduction to SQL. Introduction to SQL
SQL Introduction Chapter 7, sections 1 & 4 Objectives To understand Oracle s SQL client interface Understand the difference between commands to the interface and SQL language. To understand the Oracle
More informationOracle 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 informationMOC 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 informationElena Baralis, Silvia Chiusano Politecnico di Torino. Pag. 1. Physical Design. Phases of database design. Physical design: Inputs.
Phases of database design Application requirements Conceptual design Database Management Systems Conceptual schema Logical design ER or UML Physical Design Relational tables Logical schema Physical design
More informationIT2305 Database Systems I (Compulsory)
Database Systems I (Compulsory) INTRODUCTION This is one of the 4 modules designed for Semester 2 of Bachelor of Information Technology Degree program. CREDITS: 04 LEARNING OUTCOMES On completion of this
More informationRelational 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- 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 informationOracle 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 informationOracle 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 informationIntroduction to tuple calculus Tore Risch 2011-02-03
Introduction to tuple calculus Tore Risch 2011-02-03 The relational data model is based on considering normalized tables as mathematical relationships. Powerful query languages can be defined over such
More informationElena Baralis, Silvia Chiusano Politecnico di Torino. Pag. 1. Query optimization. DBMS Architecture. Query optimizer. Query optimizer.
DBMS Architecture INSTRUCTION OPTIMIZER Database Management Systems MANAGEMENT OF ACCESS METHODS BUFFER MANAGER CONCURRENCY CONTROL RELIABILITY MANAGEMENT Index Files Data Files System Catalog BASE It
More informationOracle Database 11g SQL
AO3 - Version: 2 19 June 2016 Oracle Database 11g SQL Oracle Database 11g SQL AO3 - Version: 2 3 days Course Description: This course provides the essential SQL skills that allow developers to write queries
More informationUniversity of Massachusetts Amherst Department of Computer Science Prof. Yanlei Diao
University of Massachusetts Amherst Department of Computer Science Prof. Yanlei Diao CMPSCI 445 Midterm Practice Questions NAME: LOGIN: Write all of your answers directly on this paper. Be sure to clearly
More informationCh3 Active Database Systems {1{ Applications of Active Rules Internal to the database: { Integrity constraint maintenance { Support of data derivation (including data replication). Extended functionalities:
More informationChapter 1. Writing Basic. SQL Statements
Chapter 1 Writing Basic SQL Statements 1 Objectives After completing this lesson, you should be able to do the following: List the capabilities of SQL SELECT statements Execute a basic SELECT statement
More informationSQL Nested & Complex Queries. CS 377: Database Systems
SQL Nested & Complex Queries CS 377: Database Systems Recap: Basic SQL Retrieval Query A SQL query can consist of several clauses, but only SELECT and FROM are mandatory SELECT FROM
More information2874CD1EssentialSQL.qxd 6/25/01 3:06 PM Page 1 Essential SQL Copyright 2001 SYBEX, Inc., Alameda, CA www.sybex.com
Essential SQL 2 Essential SQL This bonus chapter is provided with Mastering Delphi 6. It is a basic introduction to SQL to accompany Chapter 14, Client/Server Programming. RDBMS packages are generally
More informationIT2304: Database Systems 1 (DBS 1)
: Database Systems 1 (DBS 1) (Compulsory) 1. OUTLINE OF SYLLABUS Topic Minimum number of hours Introduction to DBMS 07 Relational Data Model 03 Data manipulation using Relational Algebra 06 Data manipulation
More informationDatabase Query 1: SQL Basics
Database Query 1: SQL Basics CIS 3730 Designing and Managing Data J.G. Zheng Fall 2010 1 Overview Using Structured Query Language (SQL) to get the data you want from relational databases Learning basic
More informationChapter 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 informationObjectives of SQL. Terminology for Relational Model. Introduction to SQL
Karlstad University Department of Information Systems Adapted for a textbook by Date C. J. An Introduction to Database Systems Pearson Addison Wesley, 2004 Introduction to SQL Remigijus GUSTAS Phone: +46-54
More informationOracle Database: SQL and PL/SQL Fundamentals NEW
Oracle University Contact Us: + 38516306373 Oracle Database: SQL and PL/SQL Fundamentals NEW Duration: 5 Days What you will learn This Oracle Database: SQL and PL/SQL Fundamentals training delivers the
More informationMore on SQL. Juliana Freire. Some slides adapted from J. Ullman, L. Delcambre, R. Ramakrishnan, G. Lindstrom and Silberschatz, Korth and Sudarshan
More on SQL Some slides adapted from J. Ullman, L. Delcambre, R. Ramakrishnan, G. Lindstrom and Silberschatz, Korth and Sudarshan SELECT A1, A2,, Am FROM R1, R2,, Rn WHERE C1, C2,, Ck Interpreting a Query
More informationwww.gr8ambitionz.com
Data Base Management Systems (DBMS) Study Material (Objective Type questions with Answers) Shared by Akhil Arora Powered by www. your A to Z competitive exam guide Database Objective type questions Q.1
More informationDuration 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 informationChapter 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 informationTYPICAL QUESTIONS & ANSWERS
PART-I TYPICAL QUESTIONS & ANSWERS OBJECTIVE TYPE QUESTIONS Each question carries 2 marks. Choose the correct or best alternative in the following: Q.1 In the relational modes, cardinality is termed as:
More informationOracle Database: SQL and PL/SQL Fundamentals
Oracle University Contact Us: +966 12 739 894 Oracle Database: SQL and PL/SQL Fundamentals Duration: 5 Days What you will learn This Oracle Database: SQL and PL/SQL Fundamentals training is designed to
More informationCSC 443 Data Base Management Systems. Basic SQL
CSC 443 Data Base Management Systems Lecture 6 SQL As A Data Definition Language Basic SQL SQL language Considered one of the major reasons for the commercial success of relational databases SQL Structured
More informationDisplaying Data from Multiple Tables. Chapter 4
Displaying Data from Multiple Tables Chapter 4 1 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
More informationRelational 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 informationExamine the structure of the EMPLOYEES table: EMPLOYEE_ID NUMBER Primary Key FIRST_NAME VARCHAR2(25) LAST_NAME VARCHAR2(25)
Examine the structure of the EMPLOYEES table: EMPLOYEE_ID NUMBER Primary Key FIRST_NAME VARCHAR2(25) LAST_NAME VARCHAR2(25) Which three statements inserts a row into the table? A. INSERT INTO employees
More informationSQL (structured query language)
SQL (structured query language) A family of standards - Data definition language (DDL) - schemas - Data manipulation language (DML) - updates - Query language (Query) reads History 1974: first paper by
More informationVARRAY AND NESTED TABLE
Oracle For Beginners Page : 1 Chapter 23 VARRAY AND NESTED TABLE What is a collection? What is a VARRAY? Using VARRAY Nested Table Using DML commands with Nested Table Collection methods What is a collection?
More informationVIEWS virtual relation data duplication consistency problems
VIEWS A virtual relation that is defined from other preexisting relations Called the defining relations of the view A view supports multiple user perspectives on the database corresponding to different
More informationJoin 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 informationInstant SQL Programming
Instant SQL Programming Joe Celko Wrox Press Ltd. INSTANT Table of Contents Introduction 1 What Can SQL Do for Me? 2 Who Should Use This Book? 2 How To Use This Book 3 What You Should Know 3 Conventions
More informationDEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING DR.NAVALAR NEDUNCHEZHIAYN COLLEGE OF ENGINEERING, THOLUDUR-606303, CUDDALORE DIST.
CS2258-DATABASE MANAGEMENT SYSTEM LABORATORY LABORATORY MANUAL FOR IV SEMESTER B. E / CSE & IT (FOR PRIVATE CIRCULATION ONLY) ACADEMIC YEAR: 2013 2014 (EVEN) ANNA UNIVERSITY, CHENNAI DEPARTMENT OF COMPUTER
More informationAdvanced SQL. Lecture 3. Outline. Unions, intersections, differences Subqueries, Aggregations, NULLs Modifying databases, Indexes, Views
Advanced SQL Lecture 3 1 Outline Unions, intersections, differences Subqueries, Aggregations, NULLs Modifying databases, Indexes, Views Reading: Textbook chapters 6.2 and 6.3 from SQL for Nerds : chapter
More informationScheme G. Sample Test Paper-I
Scheme G Sample Test Paper-I Course Name : Computer Engineering Group Course Code : CO/CM/IF/CD/CW Marks : 25 Hours: 1 Hrs. Q.1 Attempt Any THREE. 09 Marks a) List any six applications of DBMS. b) Define
More informationWeek 4 & 5: SQL. SQL as a Query Language
Week 4 & 5: SQL The SQL Query Language Select Statements Joins, Aggregate and Nested Queries Insertions, Deletions and Updates Assertions, Views, Triggers and Access Control SQL 1 SQL as a Query Language
More informationRelational Algebra 2. Chapter 5.2 V3.0. Copyright @ Napier University Dr Gordon Russell
Relational Algebra 2 Chapter 5.2 V3.0 Copyright @ Napier University Dr Gordon Russell Relational Algebra - Example Consider the following SQL to find which departments have had employees on the `Further
More informationOracle 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 informationUNIT 6. Structured Query Language (SQL) Text: Chapter 5
UNIT 6 Structured Query Language (SQL) Text: Chapter 5 Learning Goals Given a database (a set of tables ) you will be able to express a query in SQL, involving set operators, subqueries and aggregations
More informationFrom Databases to Natural Language: The Unusual Direction
From Databases to Natural Language: The Unusual Direction Yannis Ioannidis Dept. of Informatics & Telecommunications, MaDgIK Lab University of Athens, Hellas (Greece) yannis@di.uoa.gr http://www.di.uoa.gr/
More informationData Models and Database Management Systems (DBMSs) Dr. Philip Cannata
Data Models and Database Management Systems (DBMSs) Dr. Philip Cannata 1 Data Models in the 1960s, 1970s, and 1980s Hierarchical Network (Graph) Relational Schema (Model) - first 1956 Vern Watts was IMS's
More informationProducing Readable Output with SQL*Plus
Producing Readable Output with SQL*Plus Chapter 8 Objectives After completing this lesson, you should be able to do the following: Produce queries that require an input variable Customize the SQL*Plus
More informationQuerying 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 information10CS54: DATABASE MANAGEMENT SYSTEM
CS54: DATABASE MANAGEMENT SYSTEM QUESTION BANK Chapter 1: Introduction to Database Systems Objective: Databases and data base system have become an essential component of everyday life in modern society.
More informationQuerying 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 informationUsing SQL in RPG Programs: An Introduction
Using SQL in RPG Programs: An Introduction OCEAN Technical Conference Catch the Wave Susan M. Gantner susan.gantner @ partner400.com www.partner400.com Your partner in AS/400 and iseries Education Copyright
More informationDisplaying Data from Multiple Tables
Displaying Data from Multiple Tables 1 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 eguality and
More informationCourse 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 informationExercises. a. Find the total number of people who owned cars that were involved in accidents
42 Chapter 4 SQL Exercises 4.1 Consider the insurance database of Figure 4.12, where the primary keys are underlined. Construct the following SQL queries for this relational database. a. Find the total
More informationCourse 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 informationQuerying 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 informationPerforming 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 informationIntroduction to SQL and SQL in R. LISA Short Courses Xinran Hu
Introduction to SQL and SQL in R LISA Short Courses Xinran Hu 1 Laboratory for Interdisciplinary Statistical Analysis LISA helps VT researchers benefit from the use of Statistics Collaboration: Visit our
More information1. INTRODUCTION TO RDBMS
Oracle For Beginners Page: 1 1. INTRODUCTION TO RDBMS What is DBMS? Data Models Relational database management system (RDBMS) Relational Algebra Structured query language (SQL) What Is DBMS? Data is one
More informationChapter 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 informationElena Baralis, Silvia Chiusano Politecnico di Torino. Pag. 1. Active database systems. Triggers. Triggers. Active database systems.
Active database systems Database Management Systems Traditional DBMS operation is passive Queries and updates are explicitly requested by users The knowledge of processes operating on data is typically
More informationAccess Path Selection in a Relational Database Management System. P. Griffiths Selinger M. M. Astrahan D. D. Chamberlin,: It. A. Lorie.
Access Path Selection in a Relational Database Management System P. Griffiths Selinger M. M. Astrahan D. D. Chamberlin,: It. A. Lorie.:' T. G. Price 4: IBM Research Division, San Jose, California 95193
More informationLecture 6. SQL, Logical DB Design
Lecture 6 SQL, Logical DB Design Relational Query Languages A major strength of the relational model: supports simple, powerful querying of data. Queries can be written intuitively, and the DBMS is responsible
More information14 Triggers / Embedded SQL
14 Triggers / Embedded SQL COMS20700 Databases Dr. Essam Ghadafi TRIGGERS A trigger is a procedure that is executed automatically whenever a specific event occurs. You can use triggers to enforce constraints
More informationSQL Server. 2012 for developers. murach's TRAINING & REFERENCE. Bryan Syverson. Mike Murach & Associates, Inc. Joel Murach
TRAINING & REFERENCE murach's SQL Server 2012 for developers Bryan Syverson Joel Murach Mike Murach & Associates, Inc. 4340 N. Knoll Ave. Fresno, CA 93722 www.murach.com murachbooks@murach.com Expanded
More information1 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 informationQuerying 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 informationSQL, PL/SQL FALL Semester 2013
SQL, PL/SQL FALL Semester 2013 Rana Umer Aziz MSc.IT (London, UK) Contact No. 0335-919 7775 enquire@oeconsultant.co.uk EDUCATION CONSULTANT Contact No. 0335-919 7775, 0321-515 3403 www.oeconsultant.co.uk
More informationUsing 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 informationOracle Database: SQL and PL/SQL Fundamentals NEW
Oracle University Contact Us: 001-855-844-3881 & 001-800-514-06-97 Oracle Database: SQL and PL/SQL Fundamentals NEW Duration: 5 Days What you will learn This Oracle Database: SQL and PL/SQL Fundamentals
More informationAppendix A Practices and Solutions
Appendix A Practices and Solutions Table of Contents Practices for Lesson I... 3 Practice I-1: Introduction... 4 Practice Solutions I-1: Introduction... 5 Practices for Lesson 1... 11 Practice 1-1: Retrieving
More informationReview of Business Information Systems Third Quarter 2013 Volume 17, Number 3
Maintaining Database Integrity Using Data Macros In Microsoft Access Ali Reza Bahreman, Oakland University, USA Mohammad Dadashzadeh, Oakland University, USA ABSTRACT The introduction of Data Macros in
More informationD B M G Data Base and Data Mining Group of Politecnico di Torino
Politecnico di Torino Database Management System Oracle Hints Data Base and Data Mining Group of Politecnico di Torino Tania Cerquitelli Computer Engineering, 2014-2015, slides by Tania Cerquitelli and
More information