• Wrong document? Swap it for free
  • Written by students who passed
  • Immediately available after payment
  • Read online or as PDF
Sell
Where do you study
Your language
Document preview thumbnail
Preview 1 out of 3 pages
Summary

Databases Exam Topic Summary

Document preview thumbnail
Preview 1 out of 3 pages

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...)

Content preview

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
-

. .

Document information

Study
Uploaded on
May 29, 2021
Number of pages
3
Written in
2020/2021
Type
Summary
$6.35

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
marinamssantos
5.0
(1)
Sold
38
Followers
33
Items
12
Last sold
2 year ago




Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions