Showing posts with label Like. Show all posts
Showing posts with label Like. 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%';







Thursday, October 15, 2015

SQL -- Select Statement




1. Select the customerid, order_date, and item values from the items_ordered table for any items in the item column that start with the letter "S".

SELECT customerid, order_date, item, price
FROM items_ordered
WHERE item LIKE 'S%';




Sunday, September 13, 2015

SQL -- More Data Selection

Selecting data from employee table using the LIKE condition. Only first names that end in 'n' are selected.



select * from
myemployees_RDP0680
where firstname LIKE '%n'



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';