Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Theory And Application Bio Science And Bio Technology International Conferences DTA And BSBT 2011 Held As Part Of The Future Generation In Computer And Information Science 258

Authors: Tai-hoon Kim ,Hojjat Adeli ,Alfredo Cuzzocrea ,Tughrul Arslan ,Yanchun Zhang ,Jianhua Ma ,Kyo-il Chung ,Siti Mariyam ,Xiaofeng Song

2011th Edition

3642271561, 978-3642271564

More Books

Students also viewed these Databases questions

Question

a file containing related worksheets

Answered: 1 week ago