ACCT 484 Lecture Notes - Lecture 15: Switch Statement, Information Retrieval, Result Set
Document Summary
Sql queries: select, from, where, group by, having, order by. Combining statements: to combine select statements, they must have. Columns with compatible (but not necessarily the same) data types. Union (list unique rows) union all (includes duplicate rows) List customer name where spnum = 137, 186, both: create separate tables with details for new york and los angeles customers. Where hqcity = "los angeles": list customer names for new york and los angeles customers. Aggregate functions: avg, count, count_big, max, min, sum, use of group by statement. Examples with aggregate functions: avg, find the average number of units of the different products that salesperson 137 has sold. Group by sales. spnum, spname: sum, find the total number of units of the different products that salesperson 137 has sold. Where sales. spnum = salesperson. spnum and sales. spnum = 137. Group by sales. spnum, spname: max, find the largest number of units of product number 21765 that any salesperson has sold.