ADVERTISEMENT
Google AdSense Slot (headerLeaderboard)
Set your Publisher ID in src/config/ads.ts to display live ads.
SQL Database Tutorial• 5 min read
SQL SELECT & SELECT DISTINCT
Extracting data and filtering duplicate records
The SELECT statement is used to select data from a database. The data returned is stored in a result table, called the result-set.
SELECT Syntax
SELECT column1, column2 FROM table_name; selects specified columns.
SELECT * FROM table_name; selects all columns.
SELECT DISTINCT column1 FROM table_name; returns only unique (distinct) values.
Selecting Unique Countries
-- Select all distinct countries from Customers table
SELECT DISTINCT Country
FROM Customers
ORDER BY Country ASC;ADVERTISEMENT
Google AdSense Slot (inContentBanner)
Set your Publisher ID in src/config/ads.ts to display live ads.
Test Yourself With Exercise
Which SQL keyword is used to return only unique, non-duplicate values in the result set?