Rob Gleasure robgleasure.com

Slides:



Advertisements
Similar presentations
Query Methods (SQL). What is SQL A programming language for databases. SQL (structured Query Language) It allows you add, edit, delete and run queries.
Advertisements

Middle on the Normal distribution. Z = =.1003 What is going on here? It is just an exercise in using.
Lectures in Macroeconomics- Charles W. Upton Equilibrium in Two Markets Basics 2.
Exercise Exercise3.1 8 Exercise3.1 9 Exercise
Exercise Exercise Exercise Exercise
Northwind Sample database (also supplied with MS Access)
Exercise Exercise Exercise Exercise
Exercise Exercise6.1 7 Exercise6.1 8 Exercise6.1 9.
Coordinate geometry © Christine Crisp.
Slide 1 Chapter 2 Introduction to Structured Query Language (SQL) ‏
INTRODUCTION TO DECIMALS.
HPC 1.4 Notes Learning Targets: - Solve equations using your calculator -Solve linear equations -Solve quadratic equations - Solve radical equations -
8 1 Chapter 8 Advanced SQL Database Systems: Design, Implementation, and Management, Seventh Edition, Rob and Coronel.
Straight Lines and Gradients Objectives: To find linear equations from minimum information. To use linear equations in any form to find the gradient and.
 z – Score  Percentiles  Quartiles  A standardized value  A number of standard deviations a given value, x, is above or below the mean  z = (score.
Lab 4: Displaying Data from Multiple Tables CISB224 02A, 02B Semester I, 2009/2010 College of Information Technology, Universiti Tenaga Nasional 1.
PRE-ALGEBRA. Lesson 6-5 Warm-Up PRE-ALGEBRA How do you find the percent of a number using a proportion?? You can use a proportion to solve any percent.
Programming in R SQL in R. Running SQL in R In this session I will show you how to: Run basic SQL commands within R.
Views, Algebra Temporary Tables. Definition of a view A view is a virtual table which does not physically hold data but instead acts like a window into.
Week 3 Lab1 Review on Database Dina A. Said
Rounding (Decimal Places) Round each number to the given number of decimal places.
Lesson one 1) Counting numbers : Fifth Primary The Numbers Any numbers you can use for counting things: 1, 2, 3, 4, 5, ……………….. It is usually represented.
Lesson 15: Compound Inequalities Objectives: Describe the solution set of two inequalities joined by either “and” or “or” and graph the solution set on.
IS6146 Databases for Management Information Systems Lecture 4: SQL IV – SQL Functions and Procedures Rob Gleasure robgleasure.com.
Chapter 8 Systems of Linear Equations in Two Variables Section 8.3.
In-Class SQL Query Exercises For the Plumbing Supply Store Database.
SQL Application University of Central Florida Summer 2002 EEL4781 Prof. Zalewski By Karl-H Pierre-Louis Hector Navarro.
IFS180 Intro. to Data Management Chapter 10 - Unions.
Writing Simple Queries in Access
Order Database – ER Diagram
Rob Gleasure robgleasure.com
Rob Gleasure robgleasure.com
Rob Gleasure robgleasure.com
Database Management Systems II
Rob Gleasure robgleasure.com
Rob Gleasure robgleasure.com
Order Database – ER Diagram
Lab 13 Databases and SQL.
Querying in Access Objectives: Learn how to use the Access Query Design Tool manipulate data in Access: Sorting data Aggregating Data Performing Calculations.
5.6 – Solving Equations with Decimals
Rob Gleasure IS3320 Developing and Using Management Information Systems Lecture 9: Use Cases and Scenarios 2: The.
Logs – Solve USING EXPONENTIATION
Order Database – ER Diagram
MENAMPILKAN DATA DARI SATU TABEL (Chap 2)
Web Services שפת SQL כתבה: זהבה יעקובסון ליווי מקצועי : ארז קלר
Chapter 8 Advanced SQL Database Systems: Design, Implementation, and Management, Seventh Edition, Rob and Coronel.
IS6125 Database Analysis and Design Lecture 6: Fine-Granular Design-Specific ER Modelling Rob Gleasure
Rob Gleasure robgleasure.com
Rob Gleasure robgleasure.com
Aggregations Various Aggregation Functions GROUP BY HAVING.
Rob Gleasure robgleasure.com
Rob Gleasure robgleasure.com
Bringing up SQL plus at BCC.
Rob Gleasure robgleasure.com
Order Database – ER Diagram
1..
Query Functions.
ER Diagram Master How to use this template
Lab 4: Displaying Data from Multiple Tables
Views Views CREATE VIEW AS Uses for Views.
Rob Gleasure robgleasure.com
Rob Gleasure robgleasure.com
BUS2206 Access Lab Queries Second Term,
Joins and other advanced Queries
Exercise Write 100 as a standard numeral. 1.
Decimals LI: To identify the information that a decimal number shows and to be able to round a decimal. LI: To be able to round to the nearest 100, 10.
Database SQL.
Database Management System
Trigonometric Equations
One-step addition & subtraction equations: fractions & decimals
Presentation transcript:

Rob Gleasure R.Gleasure@ucc.ie robgleasure.com IS6126 Databases for Management Information Systems Lecture 4: SQL IV – Solution Rob Gleasure R.Gleasure@ucc.ie robgleasure.com

Exercise Consider the following problems, what queries best solve them? We want to select the average Quantity for each ProductID in the OrderDetails table? SELECT OrderDetails.ProductID,AVG(OrderDetails.Quantity) AS AverageQuantity FROM OrderDetails GROUP BY OrderDetails.ProductID; We want to create the same result but with the ProductName from the Products table instead of the ProductID (Hint – use LEFT JOIN)? SELECT Products.ProductName,AVG(OrderDetails.Quantity) AS AverageQuantity FROM OrderDetails LEFT JOIN Products ON Products.ProductID=OrderDetails.ProductID GROUP BY Products.ProductName;

Exercise We want to create the same result but with the AverageQuantity rounded to two decimal places? SELECT Products.ProductName,ROUND(AVG(OrderDetails.Quantity),2) AS AverageQuantity FROM OrderDetails LEFT JOIN Products ON Products.ProductID=OrderDetails.ProductID GROUP BY Products.ProductName; We want the same result but displayed according to the first three letters of the ProductName in upper case, e.g. SELECT UCASE(MID(Products.ProductName,1,3)) AS CompanyAbbrev, ROUND(AVG(OrderDetails.Quantity),2) AS AverageQuantity FROM OrderDetails CompanyAbbrev AverageQuantity ALI  30.09  ANI  40