answer the following questions using Publishers database (Hint: The following qu
ID: 3586449 • Letter: A
Question
answer the following questions using Publishers database (Hint: The following questions contain concepts from Chapter 4 and Chapter 8).
1. SELECT a character string composed of the last two digits of the year of a title's pubdate, the pub_id, and the first ten characters of the title.
2. Display in one query output table the “id”, “name”, city, and state of both publishers and stores.
3. Write a SELECT statement that returns these columns from the Titles table: The price column A column that uses the CAST function to return the price column with 1 digit to the right of the decimal point A column that uses the CONVERT function to return the price column as an integer A column that uses the CAST function to return the price column as an integer
4. List all rows of the titles table where title column should contain first twenty characters of the title.
5. Select all the titles published by publisher Algodata Infosystems. Use a join to show the result set.
Explanation / Answer
Hi,
ANS 1-
SELECT SUBSTR(YEAR_OF_PUBDATE,LEN(YEAR_OF_PUBDATE)-2,LEN(YEAR_OF_PUBDATE))||PUB_ID||SUBSTR(TITLE,1,10) FROM PUBLISHER;
ANS 2- SELECT ID,NAME,CITY,STATE FROM PUBLISHERS P JOIN STORES S
ON P.STOREID=S.STOREID
ANS 3-
SELECT CONVERT(DECIMAL(10),PRICE) FROM TITLES;
SELECT CAST(PRICE AS DECIMAL(18,1)) FROM TITLES;
ANS 4-
SELECT * FROM TITLES WHERE LEN(TITLE)=20;
ANS 5-
Need to have table structure to answer this ques.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.