Write an SQL query to find the second highest salary from an Employees table.
Explain how your query
works.
Given a complex SQL query with multiple joins and subqueries, identify possible optimization
techniques.
How does the EXPLAIN statement help in query optimization? Demonstrate with an example.
Define ACID properties. Give an example scenario where one of the properties is violated.
Explain denormalization. When is it useful, and what are the potential trade-offs?
What is a star schema? How does it differ from a snowflake schema?
Explain ETL processes in the context of data warehousing.
Design an OLAP cube for a retail store and describe the dimensions and measures.
How do role-based access control (RBAC) and attribute-based access control (ABAC) differ?
What are SQL injection attacks? How can they be prevented?
Describe the importance of data encryption at rest and in transit in a database.