Interpreting SQL Code. SQL (The language used to query a database) S is used to specify the you want to include. F is used to specify the the selected.

Slides:



Advertisements
Similar presentations
SQL – Lesson II Grade 12.
Advertisements

Copyright © 2006 by The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill Technology Education Copyright © 2006 by The McGraw-Hill Companies,
Relational Database Systems Higher Information Systems Advanced Implementation in MySQL/PHP.
Relational Database Systems Higher Information Systems Advanced Implementation in Microsoft Access.
SQL Database for a Book Store Clinton McKay. Explanation The database contains information about the books held in stock, their authors, publishers, customers,
Sorting Rows. 2 home back first prev next last What Will I Learn? In this lesson, you will learn to: –Construct a query to sort a results set in ascending.
Database Management Systems and Enterprise Software
Relational Algebra, Join and QBE Yong Choi School of Business CSUB, Bakersfield.
Overview of basic Queries Single Item And Query Or Query.
Database Features. Lists n An Excel worksheet can be used like a table in a relational database. n In Excel, such a table is called a list. n Each row.
With Microsoft ® Access 2010© 2011 Pearson Education, Inc. Publishing as Prentice Hall1 PowerPoint Presentation to Accompany GO! with Microsoft ® Access.
Coding In SQL. Structure Query Language Common query language used in database management systems Common query language used in database management systems.
Structured Query Language Part I Chapter Three CIS 218.
1 LBSC 690: Week 9 SQL, Web Forms. 2 Discussion Points Websites that are really databases Deep vs. Surface Web.
Utility Service Database Design a database to keep track of service calls for a utility company: Customers call to report problems Call center manages.
Seminar #1 – Refreshing databases concepts and SQL CM036: Advanced Databases1 Seminar 1: Revisiting Databases and SQL Purpose To refresh basic concepts.
SQL for Data Retrieval. Running Example IST2102 Data Preparation Login to SQL server using your account Download three SQL script files from wiki page.
Organizing Data and Information for Use in Decision Making
Database Management Systems. This lesson includes the following sections  Databases and Management Systems Working with a Database Enterprise Software.
Database Queries. Queries Queries are questions used to retrieve information from a database. Contain criteria to specify the records and fields to be.
Computer Science & Engineering 2111 Lecture 11 Querying a Database 1.
Structure Query Language SQL. Database Terminology Employee ID 3 3 Last name Small First name Tony 5 5 Smith James
Using Special Operators (LIKE and IN)
Querying a Database - A question or an inquiry (dictionary.com) - WHAT ARE WE ASKING QUESTIONS ABOUT? THE DATA - BY ASKING QUESTIONS OF THE DATA WE OBTAIN?
SESSION 3.1 This section covers using the query window in design view to create a query and sorting & filtering data while in a datasheet view. Microsoft.
Visual C# 2012 How to Program © by Pearson Education, Inc. All Rights Reserved.
Part II. Query Types On the design query table pane, right click and the cascading window will appear.
Ch Determine the output displayed from procedures Lab sheet 10.4.
Computer Science & Engineering 2111 Querying a Database 1CSE 2111 Lecture- Querying a Database.
SQL for Data Retrieval. Running Example IST2102 Data Preparation Login to SQL server using your account Select your database – Your database name is.
Database Management Systems.  Database management system (DBMS)  Store large collections of data  Organize the data  Becomes a data storage system.
Microsoft Office XP Illustrated Introductory, Enhanced Tables and Queries Using.
Pasewark & Pasewark 1 Access Lesson 3 Creating Queries Microsoft Office 2007: Introductory.
1 Access Lesson 3 Creating Queries. 2 Creating a Query with the Simple Query Wizard Query-- database object that lets you ask the database about the data.
3 / 12 CHAPTER Databases MIS105 Week-10/ Lec02 Irfan Ahmed Ilyas.
MS ACCESS – FORMS AND REPORTS Naman Kohli October 31,
You can sort Access data so you can view records in the order you want to view them, and you can filter data so you only see the records you want to see.
Databases Sorting & Filtering Supplemental to Objective 5.01: Understand Database tables used in business.
DAY 16: MICROSOFT ACCESS – CHAPTER 2 Madhuri Siddula October 8, 2015.
Querying Database ISYS 363.
Microsoft Access Database Creation and Management.
© Jalal Kawash Database Queries Peeking into Computer Science.
Structured Query Language SQL Unit 4 Solving Problems with SQL.
ORDER BY clause in SELECT command: Normally, the result of the query will not be in ordered format. If we want to get the result of the query in specific.
WEEK# 12 Haifa Abulaiha November 02,
Lecture Access – Queries. What’s a Query? A question you ask a database –ie: “Who are my Stockton customers?” –ie: “How much did Bob sell on the 14th?”
Database Relationships Objective 5.01 Understand database tables used in business.
Lesson 4: Querying a Database. 2 Learning Objectives After studying this lesson, you will be able to:  Create, save, and run select queries  Set query.
7 1 Database Systems: Design, Implementation, & Management, 7 th Edition, Rob & Coronel 7.6 Advanced Select Queries SQL provides useful functions that.
Access Query Design. IT Fundamentals2 Access Query Design The Query design screen provides a mechanism for selecting specific data from datafile(s) by:
SQL: Structured Query Language It enables to create and operate on relational databases, which are sets of related information stored in tables. It is.
In-Class SQL Query Exercises For the Plumbing Supply Store Database.
Computer Science & Engineering 2111 Inner Joins and Advanced Queries 1CSE 2111 Lecture-Advanced Queries.
Concepts of Database Management, Fifth Edition Chapter 3: The Relational Model 2: SQL.
COM621: Advanced Interactive Web Development Lecture 11 MySQL – Data Manipulation Language.
DAY 20: ACCESS CHAPTERS 5, 6, 7 Larry Reaves October 28,
Relational Databases Today we will look at: Different ways of searching a database Creating queries Aggregate Queries More complex queries involving different.
SQL SQL Ayshah I. Almugahwi Maryam J. Alkhalifa
Microsoft Office Access 2010 Lab 3
Writing Basic SQL SELECT Statements
Calculated Fields Exercises Queries
GROUP BY & Subset Data Analysis
Querying Database ISYS 363.
Access: SQL Participation Project
Lecture 3 Finishing SQL
Query Functions.
Lesson 24 Managing and Reporting Database Information
List of Values and Parameter Queries
Database Management Systems and Enterprise Software
Presentation transcript:

Interpreting SQL Code

SQL (The language used to query a database) S is used to specify the you want to include. F is used to specify the the selected fields are coming from. W is used to used to narrow down the data prior to being displayed. O is used to specify how the records (in ascending or descending order), as well as the sort order. I specifies that two or more tables are and it also specifies the field that forms the between the tables.

S the following fields from the Employees table: Last Name, Title and Salary. The used to narrow down the records is where the title is “Sales Representative.” The results should be in descending order (high to low number order) based on salary. All of the fields in the query come from the Employees table.

SELECT Max(Employees.Salary) AS MaxOfSalary, Min(Employees.Salary) AS MinOfSalary, Avg(Employees.Salary) AS AvgOfSalary, StDev(Employees.Salary) AS StDevOfSalary FROM Employees; Select the Salary field from the Employees table (4 times). Find the maximum salary, the minimum salary, the average of salaries and the standard deviation of salaries.

Select the following fields from the Customers table: Company Name, City and Country. The criteria used to narrow down the records is where the country begins with U (it does not matter what comes after the U as long as the first letter of the country is a U). All of the fields in the query come from the Customers table.

All of the fields in the query come from either the Customers table or the Orders table. The Customers and Orders tables are joined together by the common field of Customer ID (Inner Join signifies this). Select the following fields from the Customers table: Customer ID and Company Name. Select the following fields from the Orders table: Order Date and Shipped Date. The criteria used to narrow down the records is that the company name should match “B’s Beverages”.

O is used to specify how the records should be sorted (in ascending or descending order), as well as the sort order. F uses the city field and the records are sorted in alphabetical order by city (order by defaults to ascending order) If there happen to be multiple entries from the same city, a (descending order by last name)