SQL & RDB Basic Flashcards

1
Q

DBMS

A

program that controls creation, maintenance and use of DB

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

RDBMS

A

store data in collection of tables which is related by common fields between columns

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

SQL

A

structured query language, use to communicate with a database

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

Table

A

set of data organized in columns a rows

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

Field

A

column, single piece of info from a record

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

PK

A

combination of fields which uniquely specify a row, implicit NOT NULL

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

Unique Key

A

uniquely identify each record in database

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

FK

A

a column or group of column that provide link between data in two tables

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

Inner Join

A

matching values in both tables

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

Outer Join

A

union of two tables

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

Natural join

A

columns with the same name of associated table will appear only once (same data type)

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

Right join

A

everything from the right table and everything in both table

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

Left join

A

everything from the left table and everything in both table

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

Full join

A

all row of joined table whether the same or different

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

Self join

A

table joined itself

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

Normalization

A

process of minimizing redundancy and dependency by organizing fields and tables of a database

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

View

A

virtual table consists of subset of data contained in a table

18
Q

Index

A

performance tuning method of allowing faster retrieval of records

19
Q

Unique index

A

indexing does not allow field to have duplicate values if the column is unique indexed (e.g. pk column)

20
Q

Clustered index

A

reorder the physical order of the table and search based on key values

21
Q

Non clustered index

A

does not alter physical order of the table and maintains logical order of data

22
Q

Stored Procedure

A

function consists of many SQL statement to access DB system

23
Q

Trigger

A

code/program that automatically runs with response to event on a table or view

24
Q

SQL vs NoSQL

A

SQL

  • Tables with fixed rows and columns
  • Schemas are Rigid
  • Requires Join between table
  • Requires Object relation mapping
  • used when data validity is super important
  • vertically scalable

NoSQL

  • Document: JSON documents, Key-value: key-value pairs, Wide-column: tables with rows and dynamic columns, Graph: nodes and edges
  • Schemas are flexible
  • Usually dont require join
  • Usually faster than SQL
  • Use when it’s more important to have fast data than correct data
  • Horizontally Scalable
25
Q

Benefit of SQL

A
  • Data integrity
  • Data accuracy
  • An ideal choice for the complex query intensive environment
  • Cross-platform support, Secure and free
26
Q

Benefit of NoSQL

A

Flexible data models
Horizontal scaling
Fast queries
Easy to use, High performance, and Flexible tool

27
Q

Disadvantage of SQL

A

not suitable for hierarchical data storage

28
Q

Disadvantage of NoSQL

A

don’t support ACID (atomicity, consistency, isolation, durability) transactions across multiple documents

29
Q

To remove a table

A

DROP

30
Q

To remove a record

A

DELETE

31
Q

TRUNCATE

A

Delete all rows from a table, cannot rollback, faster than DELETE

32
Q

What is Normalization and what are the advantages of it?

A

the process of organizing data to avoid duplication and redundancy

33
Q

First Normal Form (1NF)

A

No repeating groups within rows

34
Q

Second Normal Form (2NF)

A

Every non-key (supporting) column value is dependent on the whole primary key.

35
Q

Third Normal Form (3NF)

A

Dependent solely on the primary key and no other non-key (supporting) column value. in 2NF and not contain any transitive partial dependency.

36
Q

ACID Property

A

Atomicity, Consistency, Isolation, Durability

37
Q

Atomicity

A

It means if one part of any transaction fails, the entire transaction fails and the database state is left unchanged

38
Q

Consistency

A

Consistency ensures that the data must meet all the validation rules.

39
Q

Isolation

A

The main goal of isolation is concurrency control.

40
Q

Durability

A

Durability means that if a transaction has been committed, it will occur whatever may come in between such as power loss, crash or any sort of error.

41
Q

What is a Database?

A

Database is nothing but an organized form of data for easy access, storing, retrieval and managing of data. This is also known as structured form of data which can be accessed in many ways.