Order by clause in SQL, Oder By Clause in SQL Example
- The ORDER BY keyword is used to sort the column value in ascending or descending order.
- The ORDER BY keyword sorts the records in ascending order by default. To sort the records in descending order, use the disc or descending keyword.
SYNTAX:
SELECT column1, column2, ...
FROM Table_Name
ORDER BY column ASC;
SELECT column1, column2, ...
FROM Table_Name
ORDER BY column DESC;
EXAMPLE:
SELECT * FROM Student
ORDER BY Student_Name ASC;
Note: Here Record will show alphabetically order because We have applied Order by Asc. on Student Name.
The SQL SELECT DISTINCT Statement
TUTORIAL IN HINDI:
The SELECT DISTINCT statement is used to return only distinct (different) values.
Inside a table, a column often contains many duplicate values; and sometimes you only want to list the different (distinct) values.
Example:
SELECT DISTINCT Student_City From STUDENT;
--------------------------------------------------------------------------------------------
SQL:
- The Structured Query Language (SQL) is the language of databases.
- All modern relational databases, including Access, FileMaker Pro, Microsoft SQL Server and Oracle use SQL as their basic building block.
- In fact, it’s often the only way that you can truly interact with the database itself.
- All of the fancy graphical user interfaces that provide data entry and manipulation functionality are nothing more than SQL translators.
- They take the actions you perform graphically and convert them to SQL commands understood by the database.
- SQL is Similar to English
- Fortunately, at its core, SQL is a simple language.
- It has a limited number of commands and those commands are very readable and are almost structured like English sentences.
SQL Commands:
SQL commands are instructions. It is used to communicate with the database. It is also used to perform specific tasks, functions, and queries of data.
0 Comments