Difference between revisions of "Database Queries"

From rbachwiki
Jump to navigation Jump to search
Line 1: Line 1:
=Select Command=
=Select Command=
; select * from tableName
; SELECT * from tableName
: Select all columns from the table
: SELECT all columns FROM the table
; select column1, column2 from tableName
; SELECT column1, column2 FROM tableName
: Select 2 columns for the tableName table
: SELECT 2 columns FROM the tableName table
; select distinct column form tableName
; SELECT DISTINCT column FROM tableName
: will display only unique results (no duplicates)
: will display only unique results (no duplicates)
; select firstname || ' ' || lastname from tablename
; SELECT firstname || ' ' || lastname FROM tablename
: will concatenate first and last name into one field (the ' ' between the || inserts a space)
: will concatenate first and last name into one field (the ' ' between the || inserts a space)
; select fristname || ' ' || lastname "Customer Name" from table name
; SELECT fristname || ' ' || lastname "Customer Name" FROM table name
: this will add a alias for the column heading called Customer Name
: this will add a alias for the column heading called Customer Name




[[#Select Command|Back To Top]]-[[Main_Page| Home]] - [[Oracle_SQL|Category]]
[[#Select Command|Back To Top]]-[[Main_Page| Home]] - [[Oracle_SQL|Category]]

Revision as of 14:17, 19 September 2017

Select Command

SELECT * from tableName
SELECT all columns FROM the table
SELECT column1, column2 FROM tableName
SELECT 2 columns FROM the tableName table
SELECT DISTINCT column FROM tableName
will display only unique results (no duplicates)
SELECT firstname || ' ' || lastname FROM tablename
will concatenate first and last name into one field (the ' ' between the || inserts a space)
SELECT fristname || ' ' || lastname "Customer Name" FROM table name
this will add a alias for the column heading called Customer Name


Back To Top- Home - Category