Skip to main content

Posts

Showing posts from June 4, 2009
Question: 2. You want to display the titles of books that meet these criteria: 1. Purchased before January 21, 20012. Price is less then $500 or greater than $900 You want to sort the results by their data of purchase, starting with the most recently boughtbook. Which statement should you use? A. SELECT book_title FROM books WHERE price between 500 and 900 AND purchase_date ORDER BY purchase_date; B. SELECT book_titleFROM books WHERE price IN (500,900) AND purchase_date ORDER BY purchase date ASC; C. SELECT book_titleFROM books WHERE price 900 AND purchase_date ORDER BY purchase date DESC; D. SELECT book_titleFROM books WHERE (price 900) AND purchase_date ORDER BY purchase date DESC; Answer: D Explanation: This statement provides required results. Incorrect Answers: A: This query will show books with price in range $500 and $900, not less then $500 or greater than $900. B: This query will show books with prices exactly $500 or $900, not less then $500 or greaterthan $900. C: This or...
Question 1. You need to display the last names of those employees who have the letter "A" as the second character in their names. Which SQL statement displays the required results? A. SELECT last_nameFROM EMPWHERE last_name LIKE '_A%'; B. SELECT last_nameFROM EMPWHERE last name ='*A%' C. SELECT last_nameFROM EMPWHERE last name ='_A%'; D. SELECT last_nameFROM EMPWHERE last name LIKE '*A%' Answer: A Explanation: Statement in this answer will show correct results because usage of operator LIKE and format mask '_A%' extract the last names of those employees who have the letter 'A' as the second character in their names. Symbol '_' in format mask substitute exactly one symbol and cannot be NULL. Incorrect Answers B: This statement will return only names starting from symbol '*'. It cannot be used as substitution symbol. C: Usage of equity operator here is not appropriate in this case: query will look exact for fi...