FIT 100 More Microsoft Access and Relational Databases Creating Views with SQL

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

FIT 100 More Microsoft Access and Relational Databases Creating Forms for Data Entry

FIT 100 Lab 16: More Microsoft Access and Relational Databases Creating Forms for Data Entry

Querying Data with Transact SQL

Querying Data with Transact-SQL

Querying Data with Transact SQL Microsoft Official Curriculum (MOC 20761)

Databases II: Microsoft Access

Microsoft Office Access Learn how to use the Query window in Design view. Tutorial 3b Querying a Database

Student Records. SLCM_AD_310 Practice Guide

Access Intermediate

Oracle Database 10g: Introduction to SQL

Access Intermediate

STIDistrict Query (Basic)

Relational Databases

Follow these steps to get started: o Launch MS Access from your start menu. The MS Access startup panel is displayed:

Microsoft Querying Microsoft SQL Server 2014

Oracle Database 11g: SQL and PL/SQL Fundamentals

Querying Data with Transact-SQL

Querying Data with Transact-SQL (20761)

COURSE OUTLINE MOC 20461: QUERYING MICROSOFT SQL SERVER 2014

QMF: Query Management Facility

Querying Microsoft SQL Server 2014

INFO 1103 Homework Project 2

Course 20461C: Querying Microsoft SQL Server

20461: Querying Microsoft SQL Server 2014 Databases

Relational Database Management Systems for Epidemiologists: SQL Part II

Microsoft Access Illustrated. Unit B: Building and Using Queries

Querying Microsoft SQL Server (MOC 20461C)

Microsoft Access Description

"Charting the Course to Your Success!" MOC D Querying Microsoft SQL Server Course Summary

Querying Microsoft SQL Server

The following instructions cover how to edit an existing report in IBM Cognos Analytics.

20761B: QUERYING DATA WITH TRANSACT-SQL

T-SQL Training: T-SQL for SQL Server for Developers

Querying Microsoft SQL Server

Querying Microsoft SQL Server 2008/2012

More on MS Access queries

Introduction to MS Access queries

Using Microsoft Access

3344 Database Lab. 1. Overview. 2. Lab Requirements. In this lab, you will:

Querying Data with Transact-SQL

Querying Microsoft SQL Server

Querying Microsoft SQL Server 2014

3/3/2008. Announcements. A Table with a View (continued) Fields (Attributes) and Primary Keys. Video. Keys Primary & Foreign Primary/Foreign Key

Ian Kenny. November 28, 2017

QUERYING MICROSOFT SQL SERVER COURSE OUTLINE. Course: 20461C; Duration: 5 Days; Instructor-led

Querying Microsoft SQL Server 2012/2014

Lab 19: Excel Formatting, Using Conditional Formatting and Sorting Records

Writing Reports with Report Designer and SSRS 2014 Level 1

20761 Querying Data with Transact SQL

Chapter 7 Equijoins. Review. Why do we store data for articles and writers in two separate tables? How can we link an article to its writer?

20461D: Querying Microsoft SQL Server

EE221 Databases Practicals Manual

Table of Contents. PDF created with FinePrint pdffactory Pro trial version

Hash table example. B+ Tree Index by Example Recall binary trees from CSE 143! Clustered vs Unclustered. Example

Microsoft Windows XP. Operating System. Starting Windows XP. You might be asked to enter your username and password

CSCI 1100L: Topics in Computing Lab Lab 07: Microsoft Access (Databases) Part I: Movie review database.

CSC Web Programming. Introduction to SQL

AVANTUS TRAINING PTE LTD

Microsoft Office Access 2007: Intermediate Course 01 Relational Databases

Writing Queries Using Microsoft SQL Server 2008 Transact- SQL

Unit Assessment Guide

Chapter 4: SQL Basics

Introduction to Database Systems CSE 414. Lecture 26: More Indexes and Operator Costs

1.8 Database and data Data Definition Language (DDL) and Data Manipulation Language (DML)

CS 200. Lecture 09 FileMaker vs SQL & Reports. FileMaker vs SQL + Reports. CS 200 Spring 2018

Course Outline. Querying Data with Transact-SQL Course 20761B: 5 days Instructor Led

Querying Microsoft SQL Server

Chapter 8 Relational Tables in Microsoft Access

[AVNICF-MCSASQL2012]: NICF - Microsoft Certified Solutions Associate (MCSA): SQL Server 2012

Querying Data with Transact-SQL

20461: Querying Microsoft SQL Server

QUERY USER MANUAL Chapter 7

COURSE OUTLINE: Querying Microsoft SQL Server

Writing Queries Using Microsoft SQL Server 2008 Transact-SQL. Overview

Oracle Database: Introduction to SQL Ed 2

MTA Database Administrator Fundamentals Course

TECHNOLOGY COMPETENCY ASSESSMENT MODULE Microsoft Access

Introduction to Database Systems CSE 344

COP 1170 Introduction to Computer Programming using Visual Basic

Course 20461C: Querying Microsoft SQL Server

After completing this course, participants will be able to:

Database Lab Lab 6 DML part 3

Microsoft Access 2013/2016 Course Outlines (version differences will be noted in the outline).

GIFT Department of Computing Science Data Selection and Filtering using the SELECT Statement

Querying Data with Transact-SQL

Workbooks (File) and Worksheet Handling

Navigate to Cognos Cognos Analytics supports all browsers with the exception of Microsoft Edge.

Introduction to Database Systems CSE 344

Querying Microsoft SQL Server

COP 1220 Introduction to Programming in C++ Course Justification

Reading: Managing Files in Windows XP

Learning Alliance Corporation, Inc. For more info: go to

INTRODUCTION TO PROC SQL JEFF SIMPSON SYSTEMS ENGINEER

Microsoft Office Illustrated Introductory, Building and Using Queries

Test Bank Database Processing Fundamentals Designand Implementation 14th Edition Kroenke

CMPT 354: Database System I. Lecture 3. SQL Basics

"Charting the Course... MOC C: Querying Data with Transact-SQL. Course Summary

Using Relational Databases for Digital Research

Introduction to Access 97/2000

Transcription:

FIT 100 More Microsoft Access and Relational Databases Creating Views with SQL Creating Views with SQL... 1 1. Query Construction in SQL View:... 2 2. Use the QBE:... 5 3. Practice (use the QBE):... 6 Introduction: Today s lab looks at an additional component of the Data Services layer: formulating queries that select, project and join up data from different tables. Access uses a GUI called the Query-By-Example so users can build queries visually. In the background, Access translates the visually represented query into SQL (Structured Query Language), the standardized language used to communicate with a database. This SQL View can also be used to build queries using straight SQL syntax. Data Services The main unit of data services (data storage) is a Table. Data storage allows for persistent data (the data stays even when the power goes off). A table is a collection of data about a specific topic. Tables organize that data in columns (called attributes) and rows (called records). One of the attributes (columns) of the table is almost always a number data type that is used as a key. A key is used to uniquely identify the data in a particular row. Key values must be unique and not null. A primary key is just the attribute(s) that have been designated as the main key for the table. Data Services also includes the storage engine and the query engine which deal with the saving, accessing and manipulation of the data. A Query is used to access and manipulate the data. Queries are also called views because they are a user s view of the data in the database. Objectives: 1. To become familiar with graphical query method of QBE (Query-By- Example) that is used in Access. 2. To create queries that view and/or manipulate data from one or more tables. 1

The important points to remember when creating a query are: Always include any tables that hold the data you want to see Always include any tables that are in the path to the data you want to see. When using a join operation, always indicate where the tables are related: Match the keys. When generating a query on more than one table, always use table name qualifiers to distinctly identify the correct table Example: tbladvisor.lname and tblstudent.lname refer to 2 distinct attributes. If you simply use LName in a query on those 2 tables, Access will not know which attribute you are referring to. Download your database A. Download your lab database to the desktop and open it. B. Add 2 additional records to each table using the forms your produced last lab. C. Now that we have some seed data in our database, we can request the display of data from different tables. 1. Query Construction in SQL View: A. To get to the SQL View, go to the Queries window and double click on the Create query in Design View option. B. When the Show Table window comes up, close it without adding any of the tables you have created. C. From the top menu, go to View>SQL View or click on the SQL icon on the tool bar. SQL View: 2

D. Enter the SQL statement needed for query A from Assignment 4 into the window. Example: SELECT * FROM tbladvisor; E. When the SQL Clauses are in place, click on the Datasheet view icon in the upper left hand or go to View>DataSheet View to display your query results For the first view, the number of rows displayed should be the same number as the records in your student table since you asked for all students. F. Save the query for review later. Repeat the process for B and C in Assignment 4. 3

Now let s take a look at creating a query using a GUI instead of just typing in commands. What goes where in the QBE: QBE, or Query By Example, is a graphical query language. This tool allows a user to follow a "drag and drop" method of constructing a query against a data store. You can consider the QBE as a translation tool that takes user input in graphical locations and generates SQL. By breaking down the interface, a user can see how this tool is able to construct SQL with the input provided. 4

2. Use the QBE: A. Go to the Queries window and double click on the Create Query in Design View option. B. Construct the queries from Assignment 4 using the QBE. Add the table needed for the first view from the Show Table window and then close it. C. Drag all the fields you wish to see displayed down into the Select columns, or choose them from the Field combo box. D. View the results in Form View E. Go back to the Design View of the query. Can you figure out how to sort the records and display them alphabetically by last name? You shouldn t have to double check to see if the query is correct, but if you aren t sure of the join, look in your tables to see what information you should get. 5

3. Practice (use the QBE): Determine what information is necessary to show or what has been requested. Not all attributes used in a query need to be shown to the user. Show me all students (just their first and last names) and the name of their Major. Show all students (first name and last name), their major and their advisor. Sort by major. Show all students with an ART major OR a CSE Major. (Use two Majors you actually entered if you don t have ART or CSE) Show who advises student number 4 (StudentID). Show all Students who have an Advisor from the certain department AND have a particular Major. Only show the student names. 6