How to Select Unique Values Using SQL in Microsoft Access

Microsoft Access is one of the most popular database programs of Windows. It has made a big impact around the world and is mostly used by people at workplaces to create numerical data in a presentation format, to compare trends and forecasting. For purposes like these, the use of SQL commands has become very common in the application package. SQL, alias for Structured Query Language, is a computer language that is designed for managing data in database management systems the uses of which include data insertion, queries, deletion and updates.

There are many language elements that are sub-divided from the language. There are clauses which constitute components of queries and statements and are in some cases optional. Then there are expressions which produce either tables or scalar values and consist of rows and columns of data. There are the Queries that retrieve data based on some specific criteria, and the Statements that control transactions, connections, sessions, program flow or diagnostics.

In SQL, the most common operation is the query that is performed with the declarative SELECT statement. This statement retrieves specific data from a table. Queries thus help in obtaining a particular part of the data. The SELECT statement has optional keywords and many clauses. For example, the FROM clause indicates the table from which the data has to be obtained; the WHERE clause restricts the rows returned by the query; the ORDER BY clause is used to indicate the columns to sort the resulting data and the direction in which they need to be sorted.

Thus, the desired data can be accessed by the following command.



WHERE Price > 200.00

ORDER BY title;

Apart from the query operation, the Data Definition Language is an element of SQL that manages table and index structure, the most basic items of which are the CREATE, DROP, TRUNCATE and ALTER statements. While the CREATE statement creates an object in the database, the DROP statement deletes an object which cannot be rolled back. The TRUNCATE statement deletes all data from a table in a fast manner and ALTER modifies the structure of the data, for example, by adding an additional column to the table.

Also, when you obtain information from a database, you also need to take care of duplicate values. Using the SQL language, there’s a method to view only unique values. For this, certain instructions need to be followed.

Instructions to select Unique Values using SQL

Step 1: The SQL view window needs to be opened.

Step 2: Type SELECTDISTINCT followed by the name of the column containing the values. For instance, SELECTDISTINCT Designation. Hit Enter

Step 3: Type FROM followed by name of the table containing the column i.e. FROM AssociateTable.

Step 4: The query needs to be run.

Thus, the above instructions would make sure that it results in only distinct or unique values. Separating duplicate values if done manually would be a long process, resulting in wastage of time and resources.

Leave a Reply

Your email address will not be published. Required fields are marked *