Sobes.tech
Junior

What can you tell about SQL?

sobes.tech AI

Answer from AI

SQL (Structured Query Language) is a declarative query language for working with relational databases.

Main features:

  • DDL (Data Definition Language): Defines the structure of the database.
    • CREATE - creating objects (tables, indexes, views).
    • ALTER - modifying the structure of objects.
    • DROP - deleting objects.
  • DML (Data Manipulation Language): Manages data within tables.
    • SELECT - retrieving data.
    • INSERT - adding new rows.
    • UPDATE - modifying existing rows.
    • DELETE - deleting rows.
  • DCL (Data Control Language): Manages access rights to data.
    • GRANT - granting rights.
    • REVOKE - revoking rights.
  • TCL (Transaction Control Language): Manages transactions.
    • COMMIT - saving changes.
    • ROLLBACK - undoing changes.
    • SAVEPOINT - setting a save point.

Main SELECT operators:

  • WHERE - filtering rows.
  • GROUP BY - grouping rows by one or more columns.
  • HAVING - filtering groups (used after GROUP BY).
  • ORDER BY - sorting the result.
  • JOIN - combining data from multiple tables. Types of JOINs: INNER, LEFT, RIGHT, FULL OUTER, CROSS.

Example query:

SELECT c.name, COUNT(o.order_id) AS total_orders
FROM customers c
JOIN orders o ON c.customer_id = o.customer_id
WHERE c.location = 'New York'
GROUP BY c.name
HAVING COUNT(o.order_id) > 5
ORDER BY total_orders DESC;

SQL is widely used in testing for preparing test data, verifying operation results, and analyzing database state after test scenarios. Knowledge of SQL allows testers to perform integration tests, verify data at the database level, and automate checks by interacting directly with the database.

What can you tell about SQL? — QA / QA Automation - sobes.tech