order by clause can order by
column names or column indices
t/f: with ORDER BY, you can use columns that have not been SELECT-ed
false
column aliases
allows columns to be renamed
- fine-tuned output
- often used to assign name to computed column
concat() operator + example
manipulates output data
select concat(x, y, z) as [new ouput]
MS access uses ___ instead of concat()
&
select distinct
removes duplicate values
aggregate functions are applied to
an attribute or an expression
examples of aggregate functions
min, max, sum, avg, count
t/f: aggregate functions cannot be used directly in a where clause
true
two options for COUNT
COUNT(DISTINCT attribute) is supported in
MySQL, not MS Access
to replicate count(distinct), you can use
a subquery
a normal SELECT pulls data from ______, while SELECT based on a subquery pulls data from _______
DB table (relation), a resultset or compares data to a single SELECTed value
subquery format
select [columns]
from [tablename | (select…) ]
[where [criteria <=> (select…) ] ]
first (select) is table of values, second (select) is single value
group by
used with aggregate functions, combines similar records and into a single record
t/f: you must GROUP BY every SELECT-ed field that is not part of some aggregate function
true
having clause
acts as a filter on the output of a group by clause. allows you to restrict results from aggregate fuctions
action queries
insert, update, delete
insert
insert a single record into a table
insert format
insert into tableName
[ ( [Column1, Column2…] ) ]
values (value1 [, value2,…])
update
change values within one or more rows in a table
update format
update tablename
set column1=value [, column2=value2,…]
[where criteria (is true) ]
delete
delete one or more rows from a table
delete format
delete from table name
[where criteria (is true) ]