9 Embedded SQL / Online Analytical Processing Flashcards
(51 cards)
What are the two main categories of SQL operations?
DDL and DML
What does DDL stand for?
Data Definition Language
What is an example of a DDL command to create a table?
CREATE TABLE students (id INT, name VARCHAR(50), age INT)
What command would you use to add a column to a table in DDL?
ALTER TABLE students ADD COLUMN email VARCHAR(100)
What does DML stand for?
Data Manipulation Language
What is the purpose of DML?
To manage and manipulate data within database tables
Provide an example of a DML command to insert data.
INSERT INTO students (id, name, age) VALUES (1, ‘John Doe’, 20)
What is Standalone SQL?
SQL commands run directly on a database outside of any other programming language
What is Static SQL?
Queries written in application code before it runs and do not change during execution
What is an example of Static SQL in Python?
query = ‘SELECT * FROM employees WHERE department = ‘Sales’’
Define Dynamic SQL.
SQL statements built or modified during the execution of the program
What is Embedded SQL?
SQL statements incorporated in a high-level programming language
List some languages that incorporate Embedded SQL.
- C
- C++
- Java
- Python
- Haskell
What is one benefit of using Embedded SQL?
Efficiency due to precompiling static SQL queries
How does Embedded SQL facilitate error handling?
Uses the error handling mechanism of the host language to manage SQL execution errors
What is SQL injection?
A security vulnerability that allows an attacker to inject malicious SQL code into a query
How can SQL injection be prevented?
Using parameterized queries or prepared statements
What does a parameterized query do?
Prevents changes to the query’s structure and handles escaping and sanitizing parameters
What is a disadvantage of Embedded SQL?
Increased complexity as developers need to know both SQL and the host language
What is a limitation regarding portability in Embedded SQL?
SQL code embedded in one host language may not be portable to another host language
What is required before the actual source code is compiled in languages like C and Java?
Precompilation of SQL statements embedded in the code
What is OLAP used for?
To test ideas or hypotheses and find insights from data using long, complex queries.
What type of system is OLAP part of?
Analytical information systems.
Why is OLAP considered hypothesis-based?
Because users start with a question and explore data across dimensions to test it.