100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached
logo-home
20 / 25  that's 80% RETAKE  20 questions were answered correctly . 4 questions were answered incorrectly . 1 question was skipped . These were marked incorrect. In each milestone, you may want or need to use the databaseand query tool to answer some $11.49   Add to cart

Exam (elaborations)

20 / 25  that's 80% RETAKE  20 questions were answered correctly . 4 questions were answered incorrectly . 1 question was skipped . These were marked incorrect. In each milestone, you may want or need to use the databaseand query tool to answer some

 2 views  0 purchase
  • Course
  • Institution

20 / 25  that's 80% RETAKE  20 questions were answered correctly . 4 questions were answered incorrectly . 1 question was skipped . These were marked incorrect. In each milestone, you may want or need to use the databaseand query tool to answer some of the questions. We sugg...

[Show more]

Preview 4 out of 36  pages

  • October 7, 2023
  • 36
  • 2023/2024
  • Exam (elaborations)
  • Questions & answers
avatar-seller
UNIT 2 — MILESTONE 2

20/25

20/25  that's 80% RETAKE



 20 questions were answered correctly.
4 questions were answered incorrectly.
1 question was skipped. These were marked incorrect.



1 


In each milestone, you may want or need to use the database
and query tool to answer some of the questions. We suggest you
open the tool in another browser tab while you are working on
this assessment.

https://postgres.sophia.org/

Which of the following is true of foreign keys?



Tables could be created first to
avoid having to create foreign
 
keys in order.



A foreign key should always be
linked to a primary key of another
 
table.



A foreign key can be linked to
 any foreign key.

, UNIT 2 — MILESTONE
A foreign 2 if the
key is not needed
 data type is different.
20/25

RATIONALE
In most cases, a foreign key should be linked to a candidate key
that is generally a primary key or a unique key. Foreign keys could
be temporarily disabled to simplify dropping the tables or moving
valid data. Foreign keys could also be added after tables have
been created to avoid having to generate them in the right order.

CONCEPT
 Foreign and Primary Keys

Report an issue with this question




2 


In each milestone, you may want or need to use the database
and query tool to answer some of the questions. We suggest you
open the tool in another browser tab while you are working on
this assessment.

https://postgres.sophia.org/

Which of the following is the valid syntax for creating a VIEW to
view a subset of a table?



CREATE VIEW album_cost
AS track

GROUP BY album_id;

, UNIT 2 — MILESTONE
CREATE 2
VIEW album_cost
AS
SELECT album_id, 20/25

SUM(unit_price)
GROUP BY album_id;



CREATE VIEW album_cost
SELECT album_id,
SUM(unit_price)

FROM track
GROUP BY album_id;



CREATE VIEW album_cost
AS
SELECT album_id,
  SUM(unit_price)
FROM track
GROUP BY album_id;




RATIONALE
Common mistakes include- forgetting the "AS", not doing a select
statement, and not including the FROM clause.

CONCEPT
 VIEW to Provide a Subset

Report an issue with this question




3 


In each milestone, you may want or need to use the database
and query tool to answer some of the questions. We suggest you
open the tool in another browser tab while you are working on
this assessment.

https://postgres.sophia.org/

, Which of the following queries will use a subquery to find all of
theUNIT
rows in2the
—track
MILESTONE
table that has2a unit_price of 0.99 and has
the length of the song in milliseconds that is longer than the
AVG track length of all tracks in the album_id between 5 and 20/25
10?



SELECT *
FROM TRACK
WHERE milliseconds >
SELECT AVG(milliseconds)
 FROM track
WHERE album_id BETWEEN 5
AND 10
AND unit_price = 0.99;



SELECT *
FROM TRACK
WHERE milliseconds >
(SELECT AVG(milliseconds)
  FROM track
WHERE album_id BETWEEN 5
AND 10)
AND unit_price = 0.99;



SELECT AVG(milliseconds)
FROM TRACK
WHERE milliseconds >
(SELECT *
 FROM track
WHERE album_id BETWEEN 5
AND 10)
AND unit_price = 0.99;



SELECT *
FROM TRACK
WHERE milliseconds >

The benefits of buying summaries with Stuvia:

Guaranteed quality through customer reviews

Guaranteed quality through customer reviews

Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.

Quick and easy check-out

Quick and easy check-out

You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.

Focus on what matters

Focus on what matters

Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!

Frequently asked questions

What do I get when I buy this document?

You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.

Satisfaction guarantee: how does it work?

Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.

Who am I buying these notes from?

Stuvia is a marketplace, so you are not buying this document from us, but from seller LectDan. Stuvia facilitates payment to the seller.

Will I be stuck with a subscription?

No, you only buy these notes for $11.49. You're not tied to anything after your purchase.

Can Stuvia be trusted?

4.6 stars on Google & Trustpilot (+1000 reviews)

67096 documents were sold in the last 30 days

Founded in 2010, the go-to place to buy study notes for 14 years now

Start selling
$11.49
  • (0)
  Add to cart