QUERY ON STRUCTURED QUERY LANGUAGE

Asked By 0 points N/A Posted on -
qa-featured

How to select distinct files from database using SQL statement?

SHARE
Best Answer by Wilma Galvan
Best Answer
Best Answer
Answered By 0 points N/A #84021

QUERY ON STRUCTURED QUERY LANGUAGE

qa-featured

Here’s an example of how to select files from the database using SQL statement: Study the syntax below:


SELECT [DISTINCT] column_name|*|expression AS column_alias FROM [table_or_view_name] SQL

Select statement permits you to choose values in the columns, literals, expressions, you may also choose single or multiple columns. Below is an example:


SELECT name FROM employees

When selecting these columns, make a list like column names or using the syntax below:


SELECT id, name, salary FROM employees
SELECT * FROM employees

With the keyword DISTINCT, SQL statement removes any duplicate values in the final result set. Below is an example of selecting distinct:


SELECT DISTINCT salary FROM employees

This will display values from the employee table so that you will know their salary levels. Max and min function can also be used to identity salary range.


SELECT MAX(salary) AS max_salary, MIN(salary) AS min_salary FROM employees

Answered By 0 points N/A #84022

QUERY ON STRUCTURED QUERY LANGUAGE

qa-featured

Hay Yugeshreddy,

Well I would love to answer this question as being oracle certified professional(OCP) and working on different structured query language for last 10 years. It is also known as SQL which on different databases almost the syntax is 90% same.

If you want to retrieve data from a table in a way that even having multiple occurrences, only one time the data appeared. The key word mostly used to retrieve such type of data is “DISTINCT”, or in SQL*Plus you use the key word as synonym “DIST”.

Given you an example you have a table with a field colors having multiple colors of some product you want to query to see which color products are available in the stock then you write query i. e.

SQL> SELECT DISTINCT(COLOR) FROM TABLE_XYZ.

Hope you understand and it will help you out to solve your problem. 

Regards

Peter

Login/Register to Answer

Related Questions