100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached
logo-home
Databases Exam Topic Summary $5.35
Add to cart

Summary

Databases Exam Topic Summary

 40 views  1 purchase
  • Course
  • Institution

Summarizes all of the topics that will be on the exam, including SQL (basic, non-monotonic queries, joins, aggregations...) and Database Normalization (functional dependencies, implications, canonical functional dependencies, transformations...)

Preview 1 out of 3  pages

  • May 29, 2021
  • 3
  • 2020/2021
  • Summary
avatar-seller
SQL summary
1




Basic SQL Joins of multiple tables

retrieve addresses return the table with the name and
of all students of persons

SELECT
SELECT P.name C. kind
address ,




FROM Persons P classes c. Takes classes T
FROM students ,




WHERE P id .
= T person.
-
id AND T .
class - id =
C. id

return all students with first name a

SELECT east

FROM students

self joins
'
'
WHERE first George
-
=



'


return that shows with
a
query all persons b


Non -
monotonic Queries SELECT distinct PI.name

(Not) In FROM Persons P ,
Persons PI ,
Persons P2 , Likes L

id L
WHERE PI person A- id AND P2 id =L person
=
returns the names of people who do not
-
-
.
-




take classes


SELECT distinct P.name returns the name at
of all persons that like l

FROM Persons P Takesclasses .
C SELECT distinct PI.name

WHERE P id .
NOT IN ( SELECT C. person - id FROM FROM Persons P, Persons P1 .
Persons P2 ,
Persons P3

Takesclasses C WHERE C. person -
id =P id .
) WHERE PI id =L person A- id
.
.
AND P2 . id =L -

person B

P1 id .
= LI .
person A- id AND P3 . id =
LI .

person B- id AND

L .
personB- id <>
LI .
personB- id



returns the name of all male persons that pla
returns the name of all persons who SELECT distinct PI . name


do not know who takes classes FROM Persons Pd Persons P2 sport Together S
anyone , ,




SELECT distinct P.name WHERE P1 id .
= 5. person A- id AND P2 id .
= S .

personB-id
" " "

P2
"

FROM Persons P ,
Persons P2 S .
sport
= soccer AND .

gender =
female OR P2 -




PI
"
id
"
"
WHERE P id. NOT IN ( SELECT K -
persona -
AND .

gender =
male AND 5.sport =
soccer
"




FROM Takesclasses T ,
knows K WHERE

( Inner) Join
K . PersonB- id =
T .
person -
id)

SELECT A. name .
B. name

FROM TableA A JOIN Tablets B ON A. id = B. id




( Not ) Exists Left Counter) Join

returns the name all persons that SELECT A. name B. name
of ,




aoe at least as old as everybody else FROM Table A A LEFT JOIN Tablets B ON A. id -_ Bid

SELECT P.name

FROM Persons P Right cover ) joins
SELECT A. name B. name
WHERE NOT EXISTS ( SELECT PS.name ,




Bid
age )
< PI FROM TARKA A RIGHT Tablets B ON A. id
FROM Persons PI WHERE JOIN
=
P .

age .




Full Counter) Joins

returns the name like
SELECT A. name B. name
of all persons that ,




FROM Table A A Tablets B ON A. id Bid
everyone they FULL JOIN -_
know

SELECT distinct P.name

Persons P , Likes L For All All ,
FROM ,
knows K
Any , Som

WHERE NOT EXISTS ( SELECT P id.
FROM Persons return the name of all persons which stud

PI Likes L Knows K K person A- id that are more than 5 older homework
WHERE years
-

. .

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 marinamssantos. Stuvia facilitates payment to the seller.

Will I be stuck with a subscription?

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

Can Stuvia be trusted?

4.6 stars on Google & Trustpilot (+1000 reviews)

53068 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
$5.35  1x  sold
  • (0)
Add to cart
Added