100% de satisfacción garantizada Inmediatamente disponible después del pago Tanto en línea como en PDF No estas atado a nada 4.2 TrustPilot
logo-home
Resumen

Summary Databases Entire Course

Puntuación
-
Vendido
2
Páginas
12
Subido en
21-03-2022
Escrito en
2021/2022

Everything you need to know for the databases exam!

Institución
Grado









Ups! No podemos cargar tu documento ahora. Inténtalo de nuevo o contacta con soporte.

Escuela, estudio y materia

Institución
Estudio
Grado

Información del documento

Subido en
21 de marzo de 2022
Número de páginas
12
Escrito en
2021/2022
Tipo
Resumen

Temas

Vista previa del contenido

Femke Stokkink Databases Course
2666619
2022-03-21
Summary




1 The Relational Model
Table entries are values that conform to some data type.
Examples of SQL data types: strings, numbers, binary data, date and time


The domain dom(D) of a type D is the set of possible values. (e.g. dom(int), dom(numeric(2,0))


A relation schema s defines a (finite) sequence A1 , ... An of distinct attribute names and it defines for each
attribute Ai a data type or domain Di .
s = (A1 : D1 , ..., D1 : Dn
Example: Exercises(catergory, number, topic, maxPoints)


A relational database schema S defines:

• a finite set of relation names R1 , ..., Rm (e.g. Students, Exercises, Results)
• a relation schema schema(Ri ) for every relation Ri
• a set of integrity constraints C
S = (R1 , ..., Rm , schema, C)


Tuples are used to formalise table rows. A tuple t with respect to the relation schema is a sequence t = (d1 , ..., dn )
of values such that di ∈ dom(Di )
e.g. t.Ai -¿ (’exam’, 1, ’SQL’, 14).topic = ’SQL’


A database state I for database schema S defines for ervery relation name Ri , a finite set of tuples I(Ri ) with
respect to schema(Ri )
Databases state is the set of tables conforming to the schema. Except, there is no order on the tuples (rows)
and tables contain no duplicate tuples.


The relational model allows missing attribute values: table entries may be empty.
Formally, the domain is extended by a new special value null.
Null values are used to model a variety of scenarios:
• No value exists: student might not have an e-mail address.

• The attribute is not applicable for this tuple: example exercise that is not worth any points.
• A value exists but is not known, address of a student might be unknown
• Any value will do

To get the rows with null values, use where A is null.
You can also declare attributes as not null.


Integrity constraints (IC) are conditions which every database state has to satisfy. This restricts the set of
possible database states. The integrity constraints are specified in the database schema.
SQL create table allows the following constraints:
• Not null: no value in the column can be the null value.


1

, • Key constraints: each key value can only appear once.
• Foreign key constraints: values in a column must also appear as key values in another table.

• Check constraints: column values must satisfy a given predicate, like check(price ¿ 0)
A key of a relation R is a set of attributes A1 , ..., An that uniquely identify the tuples in R. Any superset of a
key is itself a key. A key A1 , ..., An is minimal if no proper subset is a key.


A foreign key is used to refer from a relation R to tuples of S: add the primary key attributes of S to the
attributes of R. A foreign key implements a one-to-many relationship.
The foreign key constraint ensures that for every tuple t ∈ Results where t.sid is not null, there exists a tuple
u ∈ Students such that t.sid = u.sid.
Foreign keys are denoted with arrows (→) in the schema: Students(sid, first, last, address)
Exercises(category, number, topic, maxPoints)
Results(sid → Students, (category, number) → Exercises, points)



2 Data Modelling
Entity-Relationship Model has three main ingredients: entity sets, attributes, relationship sets.

• Rectangles represent entity sets
• Ellipses represent attributes (double = multi-value, dashed = derived)
• Diamonds represent relationship sets
• Lines link attributes an relationship sets to entity sets

• Underline indicates primary key attributes
A relationship is an association among several entities. The relationship set connections can be annotated
with role indicators. A relationship set of degree 2 is called binary, a relationship set of degree 3 is called
ternary.

EXAMPLE


Cardinality limits express the number of entities to which another entity can be associated via a relationship
set.
INSERT Every entity a from A is connected to at least N1 and at most N2 entities in B. Every entity b from B is
connected to at least M1 and at most M2 entities in A.


Typical cardinality constraints:
0..1 = zero or one
1..1 = precisely one 0..* = any number 1..* = at least one


Cardinality limits:
• Many-to-Many: A – 0..* – R – 0..* – B every a in A can be linked to an arbitrary number of B’s and every
b in B can be linked to an arbitrary number of A’s

• One-to-One: A – 1..1 – R – 1..1 – B every a in A is connected to precisely one b in B and every b in B is
connected to precisely one a in A
• Zero or One-to-Zero or one: A – 0.1* – R – 0..1 – B every a in A is connected to at most one (=0 or 1) b
in B and every b in B is connected to at most one (=0 or 1) a in A

• One-to-many: A – 1..1 – R – 0..* – B every a in A is related to an arbitrary number of b’s in B and every
B is connected to precisely one a in A



2
$7.78
Accede al documento completo:

100% de satisfacción garantizada
Inmediatamente disponible después del pago
Tanto en línea como en PDF
No estas atado a nada

Conoce al vendedor

Seller avatar
Los indicadores de reputación están sujetos a la cantidad de artículos vendidos por una tarifa y las reseñas que ha recibido por esos documentos. Hay tres niveles: Bronce, Plata y Oro. Cuanto mayor reputación, más podrás confiar en la calidad del trabajo del vendedor.
femkestokkink Vrije Universiteit Amsterdam
Seguir Necesitas iniciar sesión para seguir a otros usuarios o asignaturas
Vendido
42
Miembro desde
4 año
Número de seguidores
40
Documentos
11
Última venta
1 año hace

4.0

3 reseñas

5
1
4
1
3
1
2
0
1
0

Recientemente visto por ti

Por qué los estudiantes eligen Stuvia

Creado por compañeros estudiantes, verificado por reseñas

Calidad en la que puedes confiar: escrito por estudiantes que aprobaron y evaluado por otros que han usado estos resúmenes.

¿No estás satisfecho? Elige otro documento

¡No te preocupes! Puedes elegir directamente otro documento que se ajuste mejor a lo que buscas.

Paga como quieras, empieza a estudiar al instante

Sin suscripción, sin compromisos. Paga como estés acostumbrado con tarjeta de crédito y descarga tu documento PDF inmediatamente.

Student with book image

“Comprado, descargado y aprobado. Así de fácil puede ser.”

Alisha Student

Preguntas frecuentes