Chapter 6 Structured Query Language

Chapter 6 Structured Query Language - (SQL Functions...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
Chapter 6 Structured Query Language  (SQL) More Complex Queries and SQL  Functions Ordering a Listing ORDER BY <attributes> SELECT P_CODE, P_DESCRIPT, P_INDATE, P_PRICE FROM PRODUCT ORDER BY P_PRICE; SELECT P_CODE, P_DESCRIPT, P_INDATE, P_PRICE FROM PRODUCT WHERE P_INDATE < '08/21/2002' AND P_PRICE <= 50.00 ORDER BY V_CODE, P_PRICE DESC; Listing Unique Values SELECT DISTINCT V_CODE FROM PRODUCT; SELECT V_CODE FROM PRODUCT; More Complex Queries and SQL Functions Function Output COUNT Number of rows containing the specific attribute MIN Minimum attribute value encountered MAX Maximum attribute value encountered AVG Arithmetic mean of attribute values SUM Sum of attribute values COUNT How many products are there?
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
SELECT COUNT(*) FROM PRODUCT ; How many different vendors are represented in the PRODUCT table? SELECT COUNT(DISTINCT V_CODE) FROM PRODUCT WHERE V_CODE IS NOT NULL ; SUM Calculate inventory value SELECT SUM(P_ONHAND*P_PRICE) FROM PRODUCT; Average AVG What is the average product price
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 10/25/2010 for the course CMPN SEM4 taught by Professor Thakur during the Spring '07 term at University of Mumbai.

Page1 / 5

Chapter 6 Structured Query Language - (SQL Functions...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online