Quiz 2 Flashcards

1
Q

Relation (Instance)

A

A set of tuples, also called records, in which each tuple has the same number of fields as the relation schema. MUST satisfy domain constraints in the relation schema. TABLE denotes Relation in SQL.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Relation Schema

A

Specifies the domain of each field or column in the relation instance. Describes the column heads for the table.
Students(sid: string, name: string, login: string, age: integer, gpa: real)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Domain Constraint

A

Essentially the type of the field, in programming language terms, and restricts the values that can appear in the field. The values that appear in a column must be drawn from the domain associated with that column.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

SQL to Define a Relation

A
CREATE TABLE Students 
( 
sid CHAR(20),
name CHAR(30) , 
login CHAR(20) , 
age INTEGER,
gpa REAL
);
// Creates a table (relation) named Students with fields sid, name, login, age, and gpa with their appropriate types.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Integrity Constraints

A

Domain constraints are a type of integrity constraint.
Primary key constraint - a statement that a certain minimal subset of the fields of a relation is a unique identifier for a tuple.
Foreign key constraint - sometimes the information stored in a relation is linked to the information stored in another relation. If one of the relations is modified, the other must be checked, and perhaps modified, to keep the data consistent.
General Constraints - table constraints and assertions that extend domain constraints. i.e. all students must be at least 16 years old.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Referential Integrity

A

How the DBMS enforces integrity constraints. These are conditions that ensure things such as a primary key constraint or a foreign key constraint are not violated either by their domains or by a mismatch between related fields/values in a relation.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

SQL for Relational Database Queries

A

SELECT *
FROM Students S
WHERE S.age < 18
// Queries all students from student table who are younger than 18.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly