2 min read

Select With Different Keywords

Select is used to query the database and retrieve selected data that follow the conditions we want. In other words, we can say that the select statement used to query or retrieve data from a table in the database.
Select With Different Keywords

SELECT UNIQUE

UNIQUE statement is used to retrieve a unique or distinct element from the table.

Let's see the syntax of select unique statement.

SELECT UNIQUE column_name FROM table_name

SQL SELECT DISTINCT statement can also be used for the same cause.

SELECT DISTINCT

The SQL DISTINCT command is used with SELECT keyword to retrieve only distinct or unique data.

SQL SELECT UNIQUE and SQL SELECT DISTINCT statements are same.

SELECT DISTINCT column_name ,column_name FROM table_name;

Let's try to understand it by the table given below:

Student_NameGenderMobile_NumberHOME_TOWN
Rahul OjhaMale7503896532Lucknow
Disha RaiFemale9270568893Varanasi
Sonoo JaiswalMale9990449935Lucknow

Here is a table of students from where we want to retrieve distinct information For example: distinct home-town.

SELECT DISTINCT home_town FROM students

Now, it will return two rows.

HOME_TOWN
Lucknow
Varanasi

SELECT COUNT

The SQL COUNT() function is used to return the number of rows in a query.

The COUNT() function is used with SQL SELECT statement and it is very useful to count the number of rows in a table having enormous data.

SELECT COUNT(name) FROM employee_table;

SELECT COUNT(DISTINCT name) FROM employee_table;

SELECT TOP

The SQL SELECT TOP Statement is used to select top data from a table. The top clause specifies that how many rows are returned.

SELECT TOP 2 * FROM employee

It will return top records from the table.

SELECT FIRST

The SQL first() function is used to return the first value of the selected column.

SELECT FIRST(column_name) FROM table_name;

SELECT LAST

The SQL first() function is used to return the last value of the selected column.

SELECT LAST(column_name) FROM table_name;
SQL SELECT - javatpoint
SQL select query or statement with sql, tutorial, examples, insert, update, delete, select, join, database, table, join
https://www.javatpoint.com/sql-select

#SQL #Select #Keywords #Probyto #ProbytoAI

Subscribe and follow us for latest news in Data Science, Machine learning, technology and stay updated!

Facebook: https://facebook.com/probyto
Twitter: https://twitter.com/probyto
LinkedIn: https://linkedin.com/company/probyto
Instagram: https://instagram.com/probyto