Access Test Solutions Fall 2014 Questions 7 and 8 Karl Lieberherr.

Slides:



Advertisements
Similar presentations
Relational Algebra and SQL Exercises
Advertisements

Relational Algebra and SQL Exercises Dr. Shiyong Lu Department of Computer Science Wayne State University ©copyright 2007, all rights.
Relational Algebra and SQL Exercises
SQL and Relational Algebra Zaki Malik September 02, 2008.
M ATH IN SQL. 222 A GGREGATION O PERATORS Operators on sets of tuples. Significant extension of relational algebra. SUM ( [DISTINCT] A): the sum of all.
INTRODUCTION TO DATABASE MANAGEMENT SYSTEMS Dr. Adam Anthony Fall 2012.
 CS 405G: Introduction to Database Systems Lecture 7: Relational Algebra II Instructor: Chen Qian Spring 2014.
A U Database Review Professor J. Alberto Espinosa ITEC 334 Fall 2010 Online (Business) Application Development.
CMPT 354, Simon Fraser University, Fall 2008, Martin Ester 90 Database Systems I SQL Queries.
1 Minggu 4, Pertemuan 8 SQL: Data Manipulation (Cont.) Matakuliah: T0206-Sistem Basisdata Tahun: 2005 Versi: 1.0/0.0.
CPSC-608 Database Systems Fall 2011 Instructor: Jianer Chen Office: HRBB 315C Phone: Notes #3.
1 The Oracle Database System Querying the Data Database Course The Hebrew University of Jerusalem.
Chapter 6 SQL: Data Manipulation Cont’d. 2 ANY and ALL u ANY and ALL used with subqueries that produce single column of numbers u ALL –Condition only.
Microsoft Access 2010 Chapter 7 Using SQL.
7.1 Systems of Linear Equations: Two Equations Containing Two Variables.
Whole Numbers and Tables: Writing, Rounding, and Inequalities Section 1.1.
SQL Operations Aggregate Functions Having Clause Database Access Layer A2 Teacher Up skilling LECTURE 5.
Access Query Builder: Building Queries with the Principle of Least Information Karl Lieberherr.
Appendix A Database Design CS Database design principles  database design: the act of deciding the schema for a database  database schema: a description.
Systems of Linear Equations: Substitution and Elimination
Structured Query Language (SQL) A2 Teacher Up skilling LECTURE 2.
 Pearson Malaysia Sdn Bhd Form 4 Chapter 1: Standard Form.
Database System Concepts, 6 th Ed. ©Silberschatz, Korth and Sudarshan See for conditions on re-usewww.db-book.com Chapter 3: Introduction.
CSc-340 2b1 Introduction to SQL Chapter 3 [2 of 2] Null Values Aggregate Functions Nested Subqueries Modification of the Database.
MySQL By Scott Halvorson WDTC/DPG ATEC Forecasters Conference Boulder Colorado 25 July 2006.
IST 210: ORGANIZATION OF DATA Chapter 1. Getting Started IST210 1.
Chapter 6 SQL: Data Manipulation (Advanced Commands) Pearson Education © 2009.
Instructor: Jinze Liu Fall Basic Components (2) Relational Database Web-Interface Done before mid-term Must-Have Components (2) Security: access.
BACS 287 Structured Query Language 1. BACS 287 Visual Basic Table Access Visual Basic provides 2 mechanisms to access data in tables: – Record-at-a-time.
INTRODUCTION TO DATABASE MANAGEMENT SYSTEMS Dr. Adam Anthony Fall 2012.
Elimination Method: Solve the linear system. -8x + 3y=12 8x - 9y=12.
 CS 405G: Introduction to Database Systems Lecture 6: Relational Algebra Instructor: Chen Qian.
CS 405G: Introduction to Database Systems Instructor: Jinze Liu Fall 2009.
Assignment 1 Uploaded to course website Due next Tuesday, Sep 1, at 11:59pm.
Course title: Database-ii Chap No: 03 “Advanced SQL” Course instructor: ILTAF MEHDI.
CS 405G: Introduction to Database Systems Instructor: Jinze Liu Fall 2007.
Which list of numbers is ordered from least to greatest? 10 –3, , 1, 10, , 1, 10, 10 2, 10 – , 10 –3, 1, 10, , 10 –3,
SQL and Query Execution for Aggregation. Example Instances Reserves Sailors Boats.
Simple Queries DBS301 – Week 1. Objectives Basic SELECT statement Computed columns Aliases Concatenation operator Use of DISTINCT to eliminate duplicates.
Writing Basic SQL SELECT Statements Lecture
Chapter 1. Getting Started IST 210: Organization of Data IST2101.
1 SQL: The Query Language. 2 Example Instances R1 S1 S2 v We will use these instances of the Sailors and Reserves relations in our examples.
1 Relational Algebra & SQL Query Formulation Exercise.
SQL and Relational Algebra Edel Sherratt Nigel Hardy Horst Holstein.
Chapter 3 Introduction to SQL(2)
Database Systems SQL cont. Relational algebra
Introduction to SQL.
Chapter 3 Introduction to SQL(3)
Relational Algebra and SQL
Prime and Composite.
Database Systems Relational algebra SQL cont.
Access Patterns Karl Lieberherr 11/8/2018 Access Patterns.
CS 405G: Introduction to Database Systems
Access Final Fall 2014 Query 9
Patterns, Patterns, and more Patterns!
Announcements End of SQL today (Hopefully) Comments on midterm
Chapter Name SQL: Data Manipulation
Access Quiz.
Instructor: Mohamed Eltabakh
Writing Basic SQL SELECT Statements
Relational Algebra and SQL Exercises
3 Specifying Rows.
Chapter 6: Formal Relational Query Languages
B/C Ratio-Multiple Alts
Solve the linear system.
Finding the Least Common Denominator to Add/Subtract Fractions
Twenty Questions In the game Twenty Questions, the instructor
Shelly Cashman: Microsoft Access 2016
CSC 453 Database Systems Lecture
Group Operations Part IV.
Presentation transcript:

Access Test Solutions Fall 2014 Questions 7 and 8 Karl Lieberherr

Query 7 How many courses has each instructor taught during 2011? List LastName and number of courses. Which patterns come to mind? AggregateForOther Disambiguation

Query7a: Courses taught by Instructor in 2011

Alternative for Query7a Alternative is correct because CID has one CourseID associated with it.

Query7: Count Courses

Query 8 How many distinct courses has each instructor taught during 2011? List LastName and number of distinct courses. Differences to Query 7 highlighted in red. Patterns: same as for 7 and add: Required Elimination of Duplicates. Important: If there is a small change in the problem formulation there should be a small change in the solution.

Query8a = Query7a

Output eliminate duplicates 16 rows

Eliminate duplicates

Query8: identical to Query7, except using 8b.

Difference between Question 7 and 8 In the problem formulation, the only difference is the word distinct. If following the Principle of Least Information, the only difference in the solution is the ADDITION of an elimination of duplicates. Otherwise, the solution is identical. The solution following the Principle of Least Information is more modular.

Query 7alt: Violates Principle of Least Info.

Query 7alt: Not modular To change for Query 8, have to replace the count by a group by and add a second query to do the count. This is different from just inserting an elimination of duplicates (pure group by).