In database language, what is a 'query'?
Options
- A bug that appears inside the database when it is overloaded
- A request to the database to get or change data, like
SELECT(Correct option) - A backup file that is created by the database every night
- A type of table that is used to store temporary rows
Answer
A request written to the database to get or change data, such as SELECT name FROM users
Why
To query means to ask the database a question or give it an instruction.
A read query uses SELECT and returns rows. A write query uses INSERT, UPDATE or DELETE and changes data.
Slow queries are a common cause of slow applications, which is why indexes and EXPLAIN matter later.
Remember
Query = a request to the database.