Access/SQL Server Eliminate Duplicates with SELECT DISTINCT

Slides:



Advertisements
Similar presentations
Chapter 4 Joining Multiple Tables
Advertisements

Virtual training week 4 structured query language (SQL)
CSEN 5314 Quiz What type of join is needed when you wish to include rows that do not have matching values? A. Equi-joinB. Natural join C. Outer.
Introduction to Oracle9i: SQL1 Basic SQL SELECT Statements.
WRITING BASIC SQL SELECT STATEMENTS Lecture 7 1. Outlines  SQL SELECT statement  Capabilities of SELECT statements  Basic SELECT statement  Selecting.
Ceng 356-Lab1. Objectives After completing this lesson, you should be able to do the following: Get Familiar with the development environment List the.
Rationale Aspiring Database Developers should be able to efficiently query and maintain databases. This module will help students learn the Structured.
Chapter 2 Basic SQL SELECT Statements
CPS120: Introduction to Computer Science Information Systems: Database Management Nell Dale John Lewis.
 SQL stands for Structured Query Language.  SQL lets you access and manipulate databases.  SQL is an ANSI (American National Standards Institute) standard.
SQL/lesson 2/Slide 1 of 45 Retrieving Result Sets Objectives In this lesson, you will learn to: * Use wildcards * Use the IS NULL and IS NOT NULL keywords.
CPS120: Introduction to Computer Science Lecture 19 Introduction to SQL.
Structure Query Language SQL. Database Terminology Employee ID 3 3 Last name Small First name Tony 5 5 Smith James
CS1100: Microsoft Access Managing Data in Relational Databases Created By Martin Schedlbauer CS11001Microsoft Access - Introduction.
Chapter 4Introduction to Oracle9i: SQL1 Chapter 4 Joining Multiple Tables.
Topic 1: Introduction to SQL. SQL stands for Structured Query Language. SQL is a standard computer language for accessing and manipulating databases SQL.
4a. Structured Query Language - SELECT Statement Lingma Acheson Department of Computer and Information Science IUPUI CSCI N207 Data Analysis with Spreadsheets.
Database Fundamental & Design by A.Surasit Samaisut Copyrights : All Rights Reserved.
DATA RETRIEVAL WITH SQL Goal: To issue a database query using the SELECT command.
1 DBS201: More on SQL Lecture 3. 2 Agenda How to use SQL to update table definitions How to update data in a table How to join tables together.
1 Copyright © Oracle Corporation, All rights reserved. Writing Basic SQL SELECT Statements.
INFANL01-3 ANALYSE 3 WEEK 3 March 2015 Institute voor Communication, Media en Informatietechnology.
Selecting Rows from Tables Now that we know how to specify columns, how do we specify rows in a SELECT statement?
1 SQL Chapter 9 – 8 th edition With help from Chapter 2 – 10 th edition.
Writing Basic SQL SELECT Statements Lecture
 CONACT UC:  Magnific training   
Slide 1 of 32ASH-Training Querying and Managing Data Using SQL Server 2014 By: Segla In this session, you will learn to: Query data by using joins Query.
1 Copyright © 2007, Oracle. All rights reserved. Retrieving Data Using the SQL SELECT Statement.
Select Complex Queries Database Management Fundamentals LESSON 3.1b.
Lec-7. The IN Operator The IN operator allows you to specify multiple values in a WHERE clause. SQL IN Syntax SELECT column_name(s) FROM table_name WHERE.
1 Copyright © 2009, Oracle. All rights reserved. Retrieving Data Using the SQL SELECT Statement.
IFS180 Intro. to Data Management Chapter 10 - Unions.
 MySQL is a database system used on the web  MySQL is a database system that runs on a server  MySQL is ideal for both small and large applications.
Chapter 12 Introducing Databases. Objectives What a database is and which databases are typically used with ASP.NET pages What SQL is, how it looks, and.
Web Systems & Technologies
CHAPTER 7 DATABASE ACCESS THROUGH WEB
Connect to SQL Server and run select statements
Writing Basic SQL SELECT Statements
Using the Set Operators
MS Access Database Connection
Writing Basic SQL SELECT Statements
Using the Set Operators
ISC440: Web Programming 2 Server-side Scripting PHP 3
Writing SELECT Queries
Access: SQL Participation Project
HAVING,INDEX,COMMIT & ROLLBACK
Writing Basic SQL SELECT Statements
Writing Basic SQL SELECT Statements
3 Specifying Rows.
Excel – VBA TypeMismatch (Error 13) on OpenRecordset Method Call
EXCEL Creating An Array In VBA
Source: Link Posted By: HeelpBook Permalink: Link
SQL Server How to find duplicate values with T-SQL
Excel Import data from Access to Excel (ADO) using VBA
How To - Use a Monitor as a Secondary Display for your Laptop
EXCEL How to Hide Columns Using VBA
Topic 12 Lesson 2 – Retrieving Data with Queries
SQL Server SELECT * and Adding Column Issue in View
Excel – VBA – How to use Non-Contiguous range of cells
SQL Server Sp_refreshview for all views in a Database
Using the Set Operators
SQL Server Avoid using SELECT * in a View
PERL How to Use the Array Push() Function
Objectives In this lesson, you will learn to:
កម្មវិធីបង្រៀន SQL Programming ជាភាសាខ្មែរ Online SQL Training Course
កម្មវិធីបង្រៀន SQL Programming ជាភាសាខ្មែរ Online SQL Training Course
Source: Link Posted By: HeelpBook Permalink: Link
Concept of grouping SELECT statement have:
SQL Tutorial Basic SQL Commands
Presentation transcript:

Access/SQL Server Eliminate Duplicates with SELECT DISTINCT HeelpBook © - 2011 18/02/2019 Access/SQL Server Eliminate Duplicates with SELECT DISTINCT Source: Link Posted By: HeelpBook Permalink: Link 18/02/2019 How-Tos <<

HeelpBook © - 2011 18/02/2019 When you are working with the SQL SELECT statement, you will more than likely come across duplicate rows when viewing your query results. This should cause no real problems, and by using the SQL DISTINCT keyword in your SELECT statement you will be able to remove all duplicate rows from your query results. 18/02/2019 >> Eliminate Duplicates with SELECT DISTINCT How-Tos <<

HeelpBook © - 2011 18/02/2019 The syntax for the SELECT Statement including the DISTINCT keyword would be:   SELECT DISTINCT "column_name" FROM "table_name"   DISTINCT is an optional keyword (see the full list of reserved keywords in Microsoft Access) that needs to precede the columns that are specified in the SELECT clause. 18/02/2019 >> Eliminate Duplicates with SELECT DISTINCT How-Tos <<

HeelpBook © - 2011 18/02/2019 Using DISTINCT, the system will evaluate that data contained in all of the columns as a single unit, on a row per row basis, and will eliminate any duplicates that it finds. It will then return the results of the UNIQUE ROWS that remain. 18/02/2019 >> Eliminate Duplicates with SELECT DISTINCT How-Tos <<

HeelpBook © - 2011 18/02/2019   If we take a look at the following example, we will see the difference between running a query for a standard SELECT statement, and then running the same statement including the DISTINCT keyword.   18/02/2019 >> Eliminate Duplicates with SELECT DISTINCT How-Tos <<

Our initial database table contains the following Customer data: HeelpBook © - 2011 18/02/2019 Our initial database table contains the following Customer data:   18/02/2019 >> Eliminate Duplicates with SELECT DISTINCT How-Tos <<

HeelpBook © - 2011 18/02/2019 Our database table, containing Customer data. If we decide to query our data to find out the Towns that our Customers represent we can run the following SQL SELECT statement:   SELECT CustomerTown FROM tblCustomers; 18/02/2019 >> Eliminate Duplicates with SELECT DISTINCT How-Tos <<

>> Eliminate Duplicates with SELECT DISTINCT How-Tos << HeelpBook © - 2011 18/02/2019 18/02/2019 >> Eliminate Duplicates with SELECT DISTINCT How-Tos <<

>> Eliminate Duplicates with SELECT DISTINCT How-Tos << HeelpBook © - 2011 18/02/2019 The results of running the SQL SELECT statement As you will see from the resulting data above, the SELECT statement returns every occurrence of a Town name included in the Customers table. We don't really need to see every occurrence of the Town, so this information is duplicated and unnecessary. If we now run the SQL SELECT statement again, however this time we include the optional DISTINCT clause, we can eliminate the duplicate information from the resultant data. 18/02/2019 >> Eliminate Duplicates with SELECT DISTINCT How-Tos <<

>> Eliminate Duplicates with SELECT DISTINCT How-Tos << HeelpBook © - 2011 18/02/2019 The SQL for this looks like the following: SELECT DISTINCT CustomerTown FROM tblCustomers;   The resultant data will now display only a single occurrence of each distinct Town found in the Customers table: The results of running the SQL SELECT DISTINCT statement  Here you see only unique (distinct) values contained in the Town column of the Customer table. 18/02/2019 >> Eliminate Duplicates with SELECT DISTINCT How-Tos <<

HeelpBook © - 2011 18/02/2019 That’s all Folks Come visit us on www.heelpbook.net to find and read more documents and guides… AND / OR Subscribe to our feed RSS: Link Or see&read us on FeedBurner: Link { 18/02/2019 >> Eliminate Duplicates with SELECT DISTINCT How-Tos <<