General Note: Here we have pulled in the data from a sample database. You can download it from the following link and use it for practicing Click Here For Sample Database

In this tutorial, you will learn the use of DISTINCT keyword in SQLite.

A column can have n number of same values. The os_name column has many duplicate values.


Select os_name  from mobile_sales_details

os_name                 
------------------------
Android v4.4 (KitKat) OS
Android v4.4 (KitKat) OS
Android v4.4 (KitKat) OS
Android v4.3 OS         
Android v4.3 OS         
Android v4.3 OS         
Android v4.3 OS         
Android v4.2 (Jelly Bean
Android v4.2 (Jelly Bean
Android v4.2 (Jelly Bean
Android v4.2 (Jelly Bean
Android v4.1 OS         
Android v4.3 OS         
Android v4.2 (Jelly Bean
Android v4.2 (Jelly Bean
Android v4.1 OS         
Android v4.2 (Jelly Bean

If you want to display unique values, use the DISTINCT keyword. It will remove the duplicate values from the table and display only unique values. However, it will not change any internal data of table and only in display the duplicated values will be removed


Select distinct os_name from mobile_sales_details

os_name                 
------------------------
Android v4.4 (KitKat) OS
Android v4.3 OS         
Android v4.2 (Jelly Bean
Android v4.1 OS         
                        
Android v4.0 OS         
Windows Phone 8 OS      
Nokia X Software v1     
iOS 7                   
iOS 6                   
BlackBerry 10 OS        
BlackBerry 10.2.1 OS    
BlackBerry OS           
BlackBerry 7.1 OS