When you write an SQL query, how does it reach the database engine to be executed?
Think about how applications connect to databases to send queries.
SQL queries are sent through a database driver or connector (like ODBC, JDBC, or native drivers). This driver parses and transmits the query to the database engine, which then executes it.
Consider the following SQL query sent to a database engine:
SELECT name FROM employees WHERE id = 5;
What does the database engine return after processing this query?
Think about what a SELECT query does and what the WHERE clause filters.
The database engine executes the query and returns a result set with the requested column(s) for rows matching the condition. Here, it returns the name of the employee whose id is 5.
You want to update the salary of an employee with id 10 to 60000. Which SQL command correctly sends this update to the database engine?
Recall the standard SQL command to change existing data in a table.
The correct SQL command to update data is UPDATE. The other options use invalid SQL keywords and will cause syntax errors.
Which of the following methods helps reduce the communication overhead between SQL and the database engine for repeated queries?
Think about how to avoid sending the full query text repeatedly.
Prepared statements allow the database engine to parse and plan the query once, then execute it multiple times with different parameters, reducing communication and processing time.
Given this SQL query sent to the database engine:
SELEC name FROM employees WHERE id = 3;
What error will the database engine return?
Check the spelling of SQL keywords carefully.
The keyword SELECT is misspelled as SELEC, causing a syntax error. The database engine cannot parse the query and returns an error indicating the problem near the misspelled word.