Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create a table called MyMusic with the following attributes. Please pick names for the attributes that are more brief than my descriptions of them and

Create a table called MyMusic with the following attributes. Please pick names for the attributes that are more brief than my descriptions of them and then use comments in the SQL script to make it clear what each refers to and the units (when appropriate):

  • Name of a song: a character field
  • Name of the musician: a character field
  • Length of the song (in seconds): an integer
  • Date of release: a character field, interpreted as a date (using the appropriate format)
  • Whether you like it or not: an integer, interpreted as a Boolean

Insert at least five tuples using the SQL INSERT command five (or more) times. You should insert at least one song you like, at least one song you do not like.

Write a SQL query to return all songs in your table.

Now experiment with a few of SQLite's output formats using the SQL query you wrote for question 4: print the results in comma-separated form print the results in list form, delimited by " | " print the results in column form, and make each column have width 15 for each of the formats above, try printing/not printing the column headers with the results

Modify your SQL query such that it prints "I like it" or "I hate it" for each song you liked or not. Note that you are not allowed to modify the table in memory (So don't just go replace all the 0s with "I hate it"). You should be able to answer this question using only a SELECT statement. A solution that creates and uses an extra table, however, is acceptable.

Write a SQL query that returns all songs that you like, but that were release more than 2 years ago from the time of the query. Look at the features of the date function to make sure it is from the time of the query, regardless of when that query is implemented.

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 Processing

Authors: David M. Kroenke

12th Edition International Edition

1292023422, 978-1292023427

More Books

Students also viewed these Databases questions