Week 1 Flashcards

1
Q

What are the two types of data?

A

Unstructured, and structured, although much of the data is something in between

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

What is structured data?

A

Data that can be represented as a collection of tables, with each column describing a different attribute of the data.

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

What is the conceptual definition of a database?

A

A database is a collection of information/data that exists over a (very) long period of time

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

What is a DBMS?

A

A Database Management System is a tool for creating an managing large amounts of data

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

Wat is isolation?

A

No unexpected interactions between actions of different users

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

What is atomicity?

A

An action is completed or not, not half completed

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

What are the types of users of a DBMS?

A
  1. Conventional users, ask for data and/or modify it

2. Database administrators, responsible for the structure of the data

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

What is a query compiler?

A

It translates and optimizes the query into something i.e. a set of commands that can be executed

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

What is a transaction manager?

A

It groups queries or other DML actions into a transaction and makes sure the transaction is either:

  1. Completed in full, or not at all
  2. Executed in a way that it would be executed when no other transaction would be executed at the same time
  3. Logged properly, so the effect of the transaction is never lost (durability)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is ACID?

A
A = atomicity
C = consistency
I = isolation
D = durability
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What does the data model consists of?

A
  1. Structure (numbers, strings, arrays, …)
  2. Operations on data: any operations that can be programmed
  3. Constraints on data: e.g. must be positive, must be multiple choice.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What are tuples?

A
  • Can be considered as a row in a table
  • Relations are sets of tuples, as the order of tuples is irrelevant
  • A tuple has one component for each attribute of the relation
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is a domain?

A
  • Each component must be atomic (thus a integer, or a string, cannot be broken up in smaller components)
  • Each attribute has a domain: a particular elementary type (a year is an integer)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What is a Schema?

A
  • Defines name of relation R and its attributes A1, A2, …, An as R(A1, A2, …, An)
    E.g. Movies(title, year, length, genre)
    You can also define a domain:
    Movies(title:string, year:integer, length:integer, genre:string)
  • Attributes form a set, the order is irrelevant
  • However we follow the order of the schema
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What are keys?

A

A key of a relation is a set of attributes of that relation for which no two tuples are allowed to have the same components across all attributes in the key, usually this is an ID

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

What are the 3 different relations in SQL?

A

Table, views, temporary tables

17
Q

How to create a table in SQL?

A
CREATE TABLE TableName (
    string CHAR(10),
    integer INT,
    bool BOOLEAN,
    float FLOAT,
    double DOUBLE,
    date DATE,
    time TIME
);
18
Q

How to delete a table in SQL?

A

DROP TABLE TableName;

19
Q

How to alter a table

A

ALTER TABLE TableName DROP RowToDelete;

ALTER TABLE TableName ADD RowToAdd CHAR(10);

20
Q

How to set default value in SQL?

A

i.e.
CREATE TABLE TableName(
default CHAR(100) DEFAULT ‘default’
);

21
Q

How to declare a key?

A
Add PRIMARY KEY to the end i.e.
name CHAR(30) PRIMARY KEY
or add it at the end
PRIMARY  KEY (name, otherValueIfYouWant)

You can also set a UNQIUE

22
Q

What is the difference between PRIMARY KEY and UNIQUE?

A

Primary key does not allow NULL.