9 Embedded SQL / Online Analytical Processing Flashcards

(51 cards)

1
Q

What are the two main categories of SQL operations?

A

DDL and DML

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

What does DDL stand for?

A

Data Definition Language

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

What is an example of a DDL command to create a table?

A

CREATE TABLE students (id INT, name VARCHAR(50), age INT)

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

What command would you use to add a column to a table in DDL?

A

ALTER TABLE students ADD COLUMN email VARCHAR(100)

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

What does DML stand for?

A

Data Manipulation Language

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

What is the purpose of DML?

A

To manage and manipulate data within database tables

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

Provide an example of a DML command to insert data.

A

INSERT INTO students (id, name, age) VALUES (1, ‘John Doe’, 20)

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

What is Standalone SQL?

A

SQL commands run directly on a database outside of any other programming language

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

What is Static SQL?

A

Queries written in application code before it runs and do not change during execution

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

What is an example of Static SQL in Python?

A

query = ‘SELECT * FROM employees WHERE department = ‘Sales’’

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

Define Dynamic SQL.

A

SQL statements built or modified during the execution of the program

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

What is Embedded SQL?

A

SQL statements incorporated in a high-level programming language

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

List some languages that incorporate Embedded SQL.

A
  • C
  • C++
  • Java
  • Python
  • Haskell
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What is one benefit of using Embedded SQL?

A

Efficiency due to precompiling static SQL queries

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

How does Embedded SQL facilitate error handling?

A

Uses the error handling mechanism of the host language to manage SQL execution errors

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

What is SQL injection?

A

A security vulnerability that allows an attacker to inject malicious SQL code into a query

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

How can SQL injection be prevented?

A

Using parameterized queries or prepared statements

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

What does a parameterized query do?

A

Prevents changes to the query’s structure and handles escaping and sanitizing parameters

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

What is a disadvantage of Embedded SQL?

A

Increased complexity as developers need to know both SQL and the host language

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

What is a limitation regarding portability in Embedded SQL?

A

SQL code embedded in one host language may not be portable to another host language

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

What is required before the actual source code is compiled in languages like C and Java?

A

Precompilation of SQL statements embedded in the code

22
Q

What is OLAP used for?

A

To test ideas or hypotheses and find insights from data using long, complex queries.

23
Q

What type of system is OLAP part of?

A

Analytical information systems.

24
Q

Why is OLAP considered hypothesis-based?

A

Because users start with a question and explore data across dimensions to test it.

25
What is OLTP used for?
Daily transactions like insert, update, delete (e.g., online orders).
26
What are the differences between OLAP and OLTP?
OLAP: for analysis, big data, fewer users, read-only; OLTP: for operations, small data, many users, read/write.
27
What does ROLAP use for storage?
Relational databases like SQL tables.
28
What are ROLAP strengths and weaknesses?
Scales well, uses less space, but slow for complex queries.
29
What does MOLAP use for storage?
Multidimensional cubes with pre-aggregated data.
30
What are MOLAP strengths and weaknesses?
Fast queries, but uses more space and doesn’t scale well.
31
What is HOLAP?
A hybrid of ROLAP and MOLAP—balances speed, scale, and space.
32
What is a data warehouse?
A central storage for cleaned and consistent data used for analysis.
33
What are data warehouse characteristics?
Read-heavy, slower due to large size, integrates data from multiple sources.
34
What is the star schema?
A central fact table connected to dimension tables in a star shape.
35
What is stored in the fact table?
Numerical data (measures) like sales, profits, and foreign keys.
36
What do dimension tables contain?
Descriptive attributes like date, store, product.
37
How is snowflake schema different from star?
Snowflake normalizes dimension tables into smaller ones—slower but uses less space.
38
What is a data cube?
A multidimensional view of fact data across dimensions like time, product, location.
39
What does slicing a cube do?
Picks one value from a dimension to reduce cube to a 2D view.
40
What does dicing a cube do?
Selects a sub-cube by filtering multiple dimensions.
41
What does pivoting do in a cube?
Changes which dimensions appear as rows, columns, or layers (reorients the view).
42
What is drill-down in a data cube?
Zooms in to more detailed data (e.g., year → month → day).
43
What is Approach 1 to building a data cube?
Collect data directly from external systems into the cube.
44
What is Approach 2 to building a data cube?
Use ETL: extract raw data, transform it, and load it into the data warehouse.
45
What is Approach 3 to building a data cube?
Same as Approach 2, but tables are organized as OLAP-friendly (star/snowflake schema).
46
What is the core concept of OLAP per Codd’s rules?
Multidimensional view of data.
47
What does transparency mean in Codd’s rules?
Users don’t need to know internal system workings.
48
What is dynamic sparse matrix handling?
Efficient handling of missing or sparse data.
49
What does FASMI stand for in OLAP?
Fast, Analysis, Shared, Multi-dimensional, Information.
50
What does GROUPING SETS do?
Runs multiple groupings (e.g., by brand, by year, total) in one SQL query.
51
What does GROUP BY CUBE do?
Computes all possible groupings (power set) of columns—like doing every group by combination.