What are the two types of data?
Unstructured, and structured, although much of the data is something in between
What is structured data?
Data that can be represented as a collection of tables, with each column describing a different attribute of the data.
What is the conceptual definition of a database?
A database is a collection of information/data that exists over a (very) long period of time
What is a DBMS?
A Database Management System is a tool for creating an managing large amounts of data
Wat is isolation?
No unexpected interactions between actions of different users
What is atomicity?
An action is completed or not, not half completed
What are the types of users of a DBMS?
2. Database administrators, responsible for the structure of the data
What is a query compiler?
It translates and optimizes the query into something i.e. a set of commands that can be executed
What is a transaction manager?
It groups queries or other DML actions into a transaction and makes sure the transaction is either:
What is ACID?
A = atomicity C = consistency I = isolation D = durability
What does the data model consists of?
What are tuples?
What is a domain?
What is a Schema?
What are keys?
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
What are the 3 different relations in SQL?
Table, views, temporary tables
How to create a table in SQL?
CREATE TABLE TableName (
string CHAR(10),
integer INT,
bool BOOLEAN,
float FLOAT,
double DOUBLE,
date DATE,
time TIME
);How to delete a table in SQL?
DROP TABLE TableName;
How to alter a table
ALTER TABLE TableName DROP RowToDelete;
ALTER TABLE TableName ADD RowToAdd CHAR(10);
How to set default value in SQL?
i.e.
CREATE TABLE TableName(
default CHAR(100) DEFAULT ‘default’
);
How to declare a key?
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
What is the difference between PRIMARY KEY and UNIQUE?
Primary key does not allow NULL.