0% found this document useful (0 votes)
27 views

Midterm Cheat Sheet - Sheet1

The document discusses concepts related to functional dependencies, relational algebra, SQL, and entity relationship modeling. It provides definitions and examples of Armstrong's axioms, relational algebra operations, SQL commands, entity types, keys, and participation constraints.

Uploaded by

tadpolily
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views

Midterm Cheat Sheet - Sheet1

The document discusses concepts related to functional dependencies, relational algebra, SQL, and entity relationship modeling. It provides definitions and examples of Armstrong's axioms, relational algebra operations, SQL commands, entity types, keys, and participation constraints.

Uploaded by

tadpolily
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Functional Dependencies Operations Relational Algebra MYSQL

Armstrong Axiom select σp(r)

If Y ⊆ X then X → Y (reflexivity) project ∏A1, A2, An (r) SELECT (DISTINCT)

If X → Y then X Z → Y Z for any Z (augment) union rUs WHERE cannot use aggregate function (Must use HAVING)
*must have same num of
of attributes
*must be compatible
If X → Y and Y → Z , then X → Z (trans) set difference r−s NOT IN
*must have same # attr
If X → Y Z then X → Y and X → Z (decomp) cartesian product r Χ s = { q t | q ∈ r and t ∈ s} IN

If X → Y and A → B then X A → Y B (comp) rename ρ x (E)

If X → Y and X → Z then X → Y Z (union) intersection rns

If X → Y and Y Z → W then X Z → W (pseu) Natural Join r (natural join) s

Canonical Cover removes extraneous Division r (division sign) s

ER MODEL ORDER BY col_name ASC|DESC

Entity (Nouns) SUM G SUM SUM(x)

Attribute (Adjectives) Max G Max MAX(col_name)

Relationships (Verbs) MIN G MIN MIN(col_name)

Keys COUNT G Count x COUNT(x)

Superkey ex set AVERAGE G Average x AVG(x)

Candidate Key minimal superkeys GROUP BY (grouped_by) G SELECT COUNT(*)


FROM table_name
GROUP BY column_name;
Primary Key ex ssn Create Table table_name( colmn1 datatype, colmn2
datatype...);
total participation = INSERT INTO
table_name (column_1, column_2, column_3)
VALUES (value_1, 'value_2', value_3);
Problems SQL Relational Algebra Relational Calculus Tuple
"For All" having count(disitinct x)
"Every" = select(count( ÷
"In All" disitnct x)) from T A|B ÷ B = A* ∀
"Never"
"Without" - - ¬
Tabel T1 x Table T2
Pairs T1.attr < T2.attr
Without Agr
Highest - T1.attr > T2.attr (T1 join T2)
CategoryGmax x
Most x by Category CategoryGsumx
Who is __ to Who
is ___ to Who is w w2 w3 ...
Where X NOT IN
NO (Select ...)
SELECT A.activity_name,
count(P.stuid) as
studentnumber
FROM Activity as A,
Participates_in as P
WHERE A.actid = P.actid
GROUP BY A.
activity_name
HAVING count(P.stuid) >=
3
ORDER BY
studentnumber DESC, A.
At least activity_name

You might also like