SELECT
The SQL statement that reads data: it names the columns you want in the answer and, with FROM, the tables they come from.
In more detail
A SELECT does not change any data; it returns a result set of rows. Its clauses run in a logical order that differs from the order you write them: FROM and joins first, then WHERE, GROUP BY, HAVING, the select list, and ORDER BY and LIMIT last.
Examples
Detection logic written in SQL is mostly SELECT queries with WHERE conditions and joins.SELECT name, city FROM customers;Related terms
- SQL — The standard language for defining, querying and changing data in a relational database.
- SQL injection — An attack where untrusted input is joined into a database query so that part of it runs as SQL, letting an attacker read or change data.
- FROM clause — The part of a SELECT that names the table, or joined tables, the rows come from.
- WHERE clause — The part of a query that keeps only the rows for which a condition is true.
- ORDER BY — The clause that sorts a query's answer by one or more columns, each ascending or descending.
- projection — Choosing which fields or columns a query returns, or reshaping each result into a different form.
- result set — The table of rows a query returns, which exists only as the answer and is not stored anywhere.
- UNION ALL — An operator that stacks the rows of two queries with the same columns into one result, keeping duplicates.
Taught in
- Thirty Eight Percent More: Billing Models And Tags — CompTIA Cloud+ (CV0-004) Exam Prep
- Static Application Security Testing with Semgrep — Cloud Security & DevSecOps Engineering
- Vendor & Third-Party Risk Management Programs — Cybersecurity Fundamentals, GRC & Cryptography
- Asset Lifecycle Management & Media Sanitization — Cybersecurity Fundamentals, GRC & Cryptography
- Detection as Code: Authoring & Testing Sigma Rules — Security Operations & Threat Hunting (SOC)
- The SELECT Statement And Projection — PostgreSQL, Indexing & Relational Data Modeling