SELECT

SELECT

Welcome to our Knowledge Base

Documentation | Blog | Demos | Support

< All Topics
Print

SELECT

Lists selected data from the database.

Syntax

SELECT [ALL] [DISTINCT] values FROM SQLsetspec [-> setname]

Parameters

ALLAn optional keyword indicating that all records of the specified type are to be listed. But, even if ALL is omitted, all records are processed by default.
DISTINCTSpecifies that only the records that contain unique values in the fields being displayed are to be listed.
valuesCan be:
*
An asterisk indicates that all fields in the listed records are to be displayed.
«expr »
One or more expressions whose values are to be displayed for each listed record. Each expression must be separated from the next by a comma.
SQLsetspecAn SQL set specification.

Comments

The SELECT command is the SQL equivalent of the LIST command.

You can include sub-queries using the SELECT command in SQLsetspec.

Example

select LastName,FirstName from Employees,Departments
where Employees.DNo = Departments.DNo

list Employees WorkIn Departments format LastName FirstName

The preceding two commands produce equivalent results.

select $max(Salary) from Employees group by DNo
having $average(Salary) > 30000

In the preceding command, the keywords GROUP BY and HAVING produce a list of the highest-salaried employees within each department number where the average salary is greater than $30,000.

select * from Emps order by LastName

The preceding command lists all the fields in each employee record. The records are listed in alphabetical order by last name.

select distinct LastName,FirstName from Emps

The preceding command lists the first and last names of all employees, eliminating duplicates where two or more employees have exactly the same first and last name.

See Also

Conventions

DELETE FROM

FIND

INSERT

LIST

UPDATE

Was this article helpful?
0 out of 5 stars
5 Stars 0%
4 Stars 0%
3 Stars 0%
2 Stars 0%
1 Stars 0%
5
How can we improve this article?
Please submit the reason for your vote so that we can improve the article.

Leave a Reply

Your email address will not be published. Required fields are marked *

en_CAEnglish