Sobes.tech
Junior — Middle

Can you list the main operators used when writing SQL queries?

sobes.tech AI

Answer from AI

Main operators in SQL queries:

  • SELECT — selecting data from tables.
  • FROM — specifying the table for selection.
  • WHERE — filtering rows based on a condition.
  • JOIN (INNER, LEFT, RIGHT, FULL) — combining tables on keys.
  • GROUP BY — grouping rows by one or more columns.
  • HAVING — filtering grouped data.
  • ORDER BY — sorting the results.
  • INSERT INTO — adding new records.
  • UPDATE — updating existing records.
  • DELETE — deleting records.
  • AND, OR, NOT — logical operators for compound conditions.
  • IN, BETWEEN, LIKE — operators for checking inclusion, range, and pattern.

Example of a simple query:

SELECT name, age
FROM users
WHERE age >= 18 AND city = 'Moscow'
ORDER BY age DESC;