Showing posts with label where. Show all posts
Showing posts with label where. Show all posts

Friday, November 27, 2015

SQL -- Aggregate Functions (AVG)



Select the average price of all of the items ordered that were purchased in the month of Dec.



SELECT AVG(price)
FROM items_ordered
WHERE order_date LIKE '%Dec%';







Friday, August 28, 2015

SQL -- conditional selections

In the last example the condition was first should equal 'Eric'. Besides equal here are other conditional clauses used in SQL:



= Equal
> Greater than
< Less than
>= Greater than or equal
<= Less than or equal
<> Not equal to
LIKE pattern matching operator, use "%" as character wild card

Here is an example:



select first,
       last,
       city
  from empinfo
where city <>
  'Payson';



Tuesday, August 25, 2015

SQL -- Selecting Data



select *
                from empinfo
                where first = 'Eric'

The above examples SQL query selects all (*) columns from the empinfo table where the first name is Eric. See result of the query below.