In: Computer Science
Introdyction to database
Topic SQL
Q2) what is the purpose of following statements?
SELECT DISTINCT
SELECT
DESC
AND
ORDER BY
AS
Here is your answer. Please give an upvote.
SELECT DISTINCT - These keywords in the SQL statement will restrict the number of tuples from the table by selecting only the distinct rows only.
SELECT - Select statement is used to select or display the data from the tables. Users can restrict this action by applying various conditions in where clause.
DESC - Desc is used to display the data in descending order of some column from the table. For example - Displaying student information in descending order of names.
AND - And is mostly used in where clause or in having clause, where you want to filter the data records using more than 1 condition. The statement containing that where clause will be executed only if both conditions on either side of AND are true.
ORDER BY - We use order by in a select statement when we want our result to be displayed in some specific order, either ascending or descending.
AS - When we have a column with not so useful name and we might want some other name, we can use AS to give that column a temporary name also called alias name