Question
This is for my SQL class: Complete the Task 2 in answering the following questions using Publishers database (Hint: The following questions contain concepts from
This is for my SQL class:
Complete the Task 2 in answering 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
I attempted the first question but kept getting "Incorrect syntax near 'SUBSTRING'. Here's my code:
SELECT SUBSTRING(YEAR_OF_PUBDATE,LEN(YEAR_OF_PUBDATE)-2,LEN(YEAR_OF_PUBDATE)) PUB_ID SUBSTRING(TITLE,1,10) FROM PUBLISHER;
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started