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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!