Terms and Definition Flashcards

1
Q

What does it mean atomic data in the database? (атомарные данные)

A

Atomic data is information that can’t be broken down into smaller parts.

Иными словами, это такие данные, разделение которых на составляющие приводит к потере их смысла с точки зрения решаемой задачи. Например, если атрибут «Цена» содержит значение 15, то попытка разделить его на 1 и 5 приведет к полной бессмыслице.

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

What does it mean normalized db?

A

It’s a db without data duplication.

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

What does it mean the first normal form (1NF)?

A

1) Fields should be atomic

2) The table should include primary_key

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

What is CROSS JOIN?

A

Will create a new table each row with each row.

In SQL, the CROSS JOIN is used to combine each row of the first table with each row of the second table.

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

What is INNER JOIN?

A

The same as CROSS JOIN but with some conditions. It doesn’t take all values from the table but only values for which condition is true.

Inner Join clause in SQL Server creates a new table (not physical) by combining rows that have matching values in two or more tables. This join is based on a logical relationship (or a common field) between the tables and is used to retrieve data that appears in both tables.

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

What is NATURAL JOIN?

A

The same as INNER JOIN but we have to use the same column for 2 tables.

A NATURAL JOIN is a JOIN operation that creates an implicit join clause for you based on the common columns of the two tables that are being joined. Common columns are columns that have the same name in both the tables

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

What is SQL Correlated Subqueries?

A

When queries need data from outer query.

SQL Correlated Subqueries are used to select data from a table referenced in the outer query. The subquery is known as a correlated because the subquery is related to the outer query

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

What is Uncorrelated Sub-query?

A

An uncorrelated sub-query is a type of sub-query where inner query doesn’t depend upon the outer query for its execution. It can complete its execution as a standalone query.

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

What is LEFT OUTER JOIN?

A

The LEFT OUTER JOIN keyword returns all records from the left table (table1), and the matched records from the right table (table2). If there is no match from the right side then return NULL instead of the right value.

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

What is the difference between LEFT JOIN and INNER JOIN?

A

INNER JOIN does not return a row if condition doesn’t pass.

LEFT JOIN returns left row and NULL if the condition doesn’t pass

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

What is RIGHT OUTER JOIN?

A

The RIGHT JOIN keyword returns all records from the right table (table2), and the matched records from the left table (table1). The result is NULL from the left side, when there is no match.

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

What “Relational Database” means?

A

This is a database that stores data in tables ( fields and records).
You retrieve data by using SQL.

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

What is normalization?

A

Normalization is the process of decomposing large tables into smaller ones in order to eliminate redundant data and duplicate data.

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

What is the primary key?

A

Primary key - uniquely identifies records.

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

What is view?

A

A view is a “virtual” table composed of fields from one or more tables in the database; ( JOIN )

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

What is composite primary key?

A

Primary key composed of two or more fields is known as a composite primary key.

17
Q

What is the foreign key?

A

You have 2 tables. The name “foreign key” is derived from the fact that the second table already has a
primary key of its own, and the primary key you are introducing from the first table is “foreign” to the second table.

The values of a foreign key must match existing values of the primary key to which it refers. ( If you remove record with primary key from they first table the record from the second table with foreign key will be broken)

18
Q

What table types do you know ( to store something )?

A
  • data ( to store data or events)
  • linking ( to store association between tables )
  • validation ( to store all countries for example )
19
Q

What multipart field means?

A

A field that contains more than one entity. For example Address ( Belarus, Minsk, Street home )

20
Q

What multivalue field means?

A

Multivalued field can potentially store two or more occurrences of the same value. ( for example category with values - AG, BF, CD - many via coma )

21
Q

What ‘code smells’ can break your database design?

A
  • One table represent characteristic for several subjects ( For example table that contains Company and Employee together )
  • Multipart fields ( For example Address ( Belarus, Minsk, Street home ) )
  • Multivalue fields ( for example category with values - AG, BF, CD - many via coma )
  • Contains calculated or concatenated values
  • It is not unique within the entire database structure (denormalized)
22
Q

What is a candidate key?

A

This is a more common name for primary key. We can create more than one candidate key on the table.

23
Q

What conditions should be present for primary/candidate key?

A
  • It must contain unique values.
  • It cannot contain null values.
  • Its value cannot cause a breach of the organization’s security or privacy rules.
  • It includes a minimum number of fields necessary to define uniqueness.
  • Its value can be modified only in rare or extreme cases.
24
Q

What is artificial ( surrogate) candidate key?

A

When your table doesn’t have any candidate key you can add a new field just for this purpose.

25
Q

What is alternate key?

A

This is a candidate keys that you don’t use as primery key.

26
Q

What characteristic you can set on the field?

A
  • Date type ( String, Integer )
  • Uniqueness ( true/false)
  • Null Support
  • Default
  • Length
  • Indexed
27
Q

What is self-referencing relatinship?

A

When a given record in the table related to other records within the table.

28
Q

What kind of deletion rules you can set on association?

A
  • Deny. Will not delete the record in the parent table, but will instead keep the record and designate it as “inactive.”
  • Cascade. It will delete the record in the parent table, and it will also automatically delete all related records in the child table.”
  • Nullify: The RDBMS will delete the record in the parent table and will then update the foreign key values of related records in the child table to null.
  • Set Default: The RDBMS will delete the record in the parent table and will then update the foreign key values of related records in the child table to the current Default Value
29
Q

What is a validation table?

A

This is a table which just store values for validation ( Contry for example)

30
Q

What kind of data constraint do you know?

A
  • Field specific - ( length, type, valid values)

- Relationship specific ( Number of available association records, destroy rules )

31
Q

What are the differences between postgresql and mysql?

A

Mysql

  • operation alter table can lock the entire table (because it copies the entire table)
  • use statement-based replication by default
  • use :read_committed isolation level

Postgresql

  • operation alter table doesn’t lock the table
  • use WAL replication by default
  • use :repeatable_read as default isolation level
32
Q

What is Data Warehouse?

A

A data warehouse is a large collection of business data used to help an organization make decisions. ( Copy of your database to run requests to get business data values)

33
Q

What is materialized view?

A

Materialized view is a database object that contains the results of a query. For example, it may be a local copy of data located remotely, or may be a subset of the rows and/or columns of a table or join result, or may be a summary using an aggregate function.