Cis275, lab week 6, | Computer Science homework help

USE IMDB    — ensures correct database is active

GO

PRINT ‘|—‘ + REPLICATE(‘+—-‘,15) + ‘|’

PRINT ‘Read the questions below and insert your queries where prompted.  When  you are finished,

you should be able to run the file as a script to execute all answers sequentially (without errors!)’ + CHAR(10)

PRINT ‘Queries should be well-formatted.  SQL is not case-sensitive, but it is good form to

capitalize keywords and table names; you should also put each projected column on its own line

and use indentation for neatness.  Example:

   SELECT Name,

          CustomerID

   FROM   CUSTOMER

   WHERE  CustomerID < 106;

All SQL statements should end in a semicolon.  Whatever format you choose for your queries, make

sure that it is readable and consistent.’ + CHAR(10)

PRINT ‘Be sure to remove the double-dash comment indicator when you insert your code!’;

PRINT ‘|—‘ + REPLICATE(‘+—-‘,15) + ‘|’ + CHAR(10) + CHAR(10)

GO

GO

PRINT ‘CIS2275, Lab Week 6, Question 1  [3pts possible]:

Write the query to display the name and year of birth for all people born after 1980, who have

directed at least one show (i.e. those who appear at least once in the title_directors table).

Limit results to those who have died (who have a value in the deathYear column).

Columns to display:    name_basics.primaryName, name_basics.birthYear

Format name_basics.primaryName as 25 characters wide and sort in descending order by birth year.

Correct results will have 50 rows and will look like this:

Name                      birthYear

————————- ———–

Anthony Conti             2000

Amanda Todd               1996

Daniel W. Ridge           1996

Nick Louvel               1981

Seth Gimlan               1981

Shane Ballard             1981

‘ + CHAR(10)

— [Insert your code here]

GO

PRINT ‘CIS2275, Lab Week 6, Question 2  [3pts possible]:

Show every genre of television show which has had at least one title with 200 episodes.

i.e. limit results to the titleType ”tvEpisode” in the title_basics table, and to titles

containing a row in the title_episode table with episodeNumber 200.

Columns to display:    title_genre.genre

Display only genre name sorted 15 characters wide, and eliminate duplicate values.

Correct results will have 26 rows and will look like this:

Genre

—————

Action

Adult

Adventure

Talk-Show

Thriller

War

‘ + CHAR(10)

GO

— [Insert your code here]

GO

PRINT ‘CIS2275, Lab Week 6, Question 3  [3pts possible]:

Write a common table expression to identify the WORST shows: join title_basics against title_ratings

and limit your results to those with an averageRating value equal to 1.  Project the title,

type, and startYear from title_basics; and label your CTE as BADSHOWS.

In the main query, show a breakdown of BADSHOWS grouped by type, along with the total number of

rows for each (i.e. GROUP BY titleType)

Columns to display:    titleType, COUNT(*)

Sort results in descending order by COUNT(*).

Correct results will have 10 rows and will look like this:

titleType    TOTAL_BAD_SHOWS

———— —————

tvEpisode    314

video        74

tvMiniSeries 7

tvShort      2

videoGame    2

‘ + CHAR(10)

GO

— [Insert your code here]

GO

PRINT ‘CIS2275, Lab Week 6, Question 4  [3pts possible]:

Identify the least popular professions.  Show each profession value from the name_profession table,

along with the total number of matching rows (GROUP BY profession).  Use the HAVING clause to limit

your results to professions with less than 1,000 rows.

Columns to display:    name_profession.profession, COUNT(*)

Correct results will have 3 rows formatted nicely:

Profession                     TOTAL_PEOPLE

—————————— ————

electrical_department          1

production_department          1

script_department              1

‘ + CHAR(10)

— [Insert your code here]

GO

GO

PRINT ‘CIS2275, Lab Week 6, Question 5  [3pts possible]:

Use the query from #4 above to display the names of all people belonging to these professions.

Use the previous query as a subquery in the WHERE clause here to limit the results.

Columns to display:    name_basics.primaryName, name_profession.profession

Sort results in descending order by primaryName.

Correct results will have 3 rows formatted nicely:

Name                 Profession

——————– ——————————

Leonardo Aquilini    production_department         

Eddie A. Reid IV     electrical_department         

Andrea Devaux        script_department             

‘ + CHAR(10)

— [Insert your code here]

GO

GO

PRINT ‘CIS2275, Lab Week 6, Question 6  [3pts possible]:

Show the name of every writer, along with the total number of titles they”ve written (i.e. rows in the 

title_writers table).  Limit results to those who have written between 5,000 and 10,000 titles (inclusive).

Columns to display:    name_basics.primaryName, COUNT(*)

Sort results in descending order by primaryName.

Correct results will have 9 rows formatted nicely. You”re on your own to find out which rows they are.

———————————————————————————————-

‘ + CHAR(10)

— [Insert your code here]

GO

GO

PRINT ‘CIS2275, Lab Week 6, Question 7  [3pts possible]:

Show the actor and character names for everyone who has performed the same role in more than one

show with the title ”Battlestar Galactica”.  i.e. identify the combination of (primaryName, characters)

which occurs in the title_principals table more than once for matching titles.

Columns to display:    name_basics.primaryName, title_principals.characters, COUNT(*)

Sort results in ascending order by primaryName.

Correct results will have 4 rows formatted nicely.  Hope you get the same ones I got.

———————————————————————————————-

‘ + CHAR(10)

— [Insert your code here]

GO

GO

PRINT ‘CIS2275, Lab Week 6, Question 8  [3pts possible]:

Identify the names of people who have directed more than five highest-rated shows (i.e. title_ratings.averageRating = 10).

For each of these people, display their names and the total number of shows they have written.

Columns to display:    name_basics.primaryName, COUNT(*)

Sort results in descending order by primaryName.

This time you”re on your own to also see how big the result set is (Hint: it is somewhere between 5 and 25).

———————————————————————————————-

‘ + CHAR(10)

— [Insert your code here]

GO

GO

PRINT ‘CIS2275, Lab Week 6, Question 9  [3pts possible]:

Display the title and running time for all TV specials ( titleType=””tvSpecial” ) from 1982; if the run time is

NULL, substitute zero.

Columns to display:    title_basics.primaryTitle, title_basics.runtimeMinutes

Sort in descending numerical order by the resulting calculated run time value.

———————————————————————————————-

‘ + CHAR(10)

— [Insert your code here]

GO

GO

PRINT ‘CIS2275, Lab Week 6, Question 10  [3pts possible]:

Identify every movie from 1913 (startYear = 1913, titleType=””movie”); limit your results to those with a non-NULL value

in the runtimeMinutescolumn.  For each movie, display the primaryTitle and the averageRating value from the title_ratings table.

Use DENSE_RANK() to display the rank based on averageRating (label this RATINGRANK), and also the rank based on runtimeMinutes

(label this LENGTHRANK).  Both of these should be based on an asecending sort order.

Columns to display:    title_basics.primaryTitle, title_ratings.averageRating,

                       RATINGRANK, LENGTHRANK

Sort results in ascending order by primaryTitle.

———————————————————————————————-

‘ + CHAR(10)

— [Insert your code here]

GO

GO

————————————————————————————-

— This is an anonymous program block. DO NOT CHANGE OR DELETE.

————————————————————————————-

BEGIN

    PRINT ‘|—‘ + REPLICATE(‘+—-‘,15) + ‘|’;

    PRINT ‘ End of CIS275 Lab Week 6’ + REPLICATE(‘ ‘,50) + CONVERT(CHAR(12),GETDATE(),101);

    PRINT ‘|—‘ + REPLICATE(‘+—-‘,15) + ‘|’;

END;

Calculate the price
Make an order in advance and get the best price
Pages (550 words)
$0.00
*Price with a welcome 15% discount applied.
Pro tip: If you want to save more money and pay the lowest price, you need to set a more extended deadline.
We know how difficult it is to be a student these days. That's why our prices are one of the most affordable on the market, and there are no hidden fees.

Instead, we offer bonuses, discounts, and free services to make your experience outstanding.
How it works
Receive a 100% original paper that will pass Turnitin from a top essay writing service
step 1
Upload your instructions
Fill out the order form and provide paper details. You can even attach screenshots or add additional instructions later. If something is not clear or missing, the writer will contact you for clarification.
Pro service tips
How to get the most out of your experience with Australia Assessments
One writer throughout the entire course
If you like the writer, you can hire them again. Just copy & paste their ID on the order form ("Preferred Writer's ID" field). This way, your vocabulary will be uniform, and the writer will be aware of your needs.
The same paper from different writers
You can order essay or any other work from two different writers to choose the best one or give another version to a friend. This can be done through the add-on "Same paper from another writer."
Copy of sources used by the writer
Our college essay writers work with ScienceDirect and other databases. They can send you articles or materials used in PDF or through screenshots. Just tick the "Copy of sources" field on the order form.
Testimonials
See why 20k+ students have chosen us as their sole writing assistance provider
Check out the latest reviews and opinions submitted by real customers worldwide and make an informed decision.
History
Great!
Customer 453413, February 27th, 2020
Other
Thank you for the beautifully written paper and amazing customer service.
Customer 452455, May 26th, 2023
Organization behavior
thank you
Customer 462271, November 30th, 2021
Military
Very good job, thanks.
Customer 456821, December 20th, 2022
English 101
I don’t have any comment it’s very good
Customer 454499, June 17th, 2020
Business and administrative studies
Excellent.
Customer 460073, July 9th, 2022
SEO
A job well done
Customer 463679, May 9th, 2023
Other
Great effort.
Customer 459155, May 4th, 2022
Psychology
Good work.
Customer 462579, June 4th, 2022
Business
Good job
Customer 463245, February 6th, 2023
SEO
Very nice content. I am glad you took the corrections to heart and made the changes. Commendable work.
Customer 463679, February 22nd, 2023
Business and administrative studies
I received a mastery on this assignment!
Customer 463143, August 31st, 2022
11,595
Customer reviews in total
96%
Current satisfaction rate
3 pages
Average paper length
37%
Customers referred by a friend
OUR GIFT TO YOU
15% OFF your first order
Use a coupon FIRST15 and enjoy expert help with any task at the most affordable price.
Claim my 15% OFF Order in Chat