Sobes.tech
Intern

30. Which of the following theses are true regarding SQL and DBMS? * - Indexes work by creating a separate data structure that contains copies of the indexed columns in sorted order. When executing a query, the DB engine searches the index for rows matching the query conditions, and then retrieves the actual data from the table; - No DBMS can guarantee adherence to the CAP theorem; - A DBMS does not support one-to-many relationships; - A DBMS can operate on behalf of a user with root privileges; 31. What is a subquery in SQL? * - An embedded function of the language for automatic query optimization; - A syntactic construct that allows querying unknown data within the scope of the executing query; - An outdated function of some DBMS; - The ability to search for information not within a single table, but across the entire existing database;

sobes.tech AI

Answer from AI

  • Correct: Indexes indeed create a separate data structure (e.g., B-tree) containing copies of the indexed columns in sorted order. When executing a query, the DBMS first searches for the required records in the index, then retrieves the corresponding data from the table, which speeds up the search.

  • Correct: No DBMS can guarantee the fulfillment of all three properties of the CAP theorem (Consistency, Availability, Partition tolerance) simultaneously. Usually, a compromise is chosen among these properties.

  • Incorrect: DBMSs support one-to-many relationships through foreign keys and other mechanisms.

  • Partially correct: A DBMS can work with user rights that have high privileges (e.g., root), but this depends on the settings and context of use.


A subquery in SQL is a syntactic construct that allows including one query inside another to obtain data used in the main query. It is not an embedded optimization feature and not an outdated capability. Subqueries enable, for example, filtering data based on the results of another query.

Example of a subquery:

SELECT name FROM employees WHERE department_id = (
    SELECT id FROM departments WHERE name = 'Sales'
);