Thursday, November 17, 2011


Queries are dynamic

WHERE CLAUSE
ORDER BY CLAUSE

Design view

SQL View

SELECT Title,  Year, ListPrice, Publisher  FROM BOOKS
Where Publisher="Prentice Hall"

SELECT Title,  Year, ListPrice, Publisher  FROM BOOKS
Where Publisher="Prentice Hall" OR Publisher="Prentice-Hall"

SELECT Title,  Year, ListPrice, Publisher  FROM BOOKS
Where Publisher Like "Prentice?Hall"


SELECT Title,  Year, ListPrice, Publisher  FROM BOOKS
Where Publisher Like "Prentice?Hall"
Order by ListPrice DESC

Using the wizard:
1) what table?
2) what fields?
3) what to name the query?
4) go to design view, what criteria, sorting, etc. OR go to SQL view and add all that


SELECT Books.Title, Books.Year, Books.ListPrice, Books.Publisher
FROM Books
WHERE (((Books.Publisher)="Prentice Hall"));

*
?

Begins with G:
Like "G*"

ends with a y:
Like "*y"

contains the word Excel
*Excel*

WHERE Year >=1995 Or ListPrice>25


Select ProductName, UnitPrice, and UnitsOnOrder From Products Where UnitsOnOrder  = 0 And (UnitPrice>=50 And UnitPrice<=100)

SELECT Products.[ProductName], Products.UnitPrice, Products.UnitsInStock
FROM Products
WHERE (((Products.UnitPrice) Between 50 And 100) AND ((Products.UnitsInStock)=0));

No comments:

Post a Comment