From 2319f68af5ec943e7a7b9bb6d85a905f4a6b2922 Mon Sep 17 00:00:00 2001 From: Imran Imtiaz Date: Fri, 5 Dec 2025 09:39:16 +0400 Subject: [PATCH] Refactor SQL queries and add comments Updated SQL queries for better readability and performance analysis. --- index.sql | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/index.sql b/index.sql index 3a4edf8..c8ebba5 100644 --- a/index.sql +++ b/index.sql @@ -1,10 +1,16 @@ -SELECT * from employees; +-- View all employees +SELECT * +FROM employees; +-- Analyze query performance for a specific employee +EXPLAIN ANALYZE +SELECT * +FROM employees +WHERE emp_no = 10004; -- Removed quotes if emp_no is numeric -EXPLAIN ANALYSE -SELECT * from employees WHERE emp_no = '10004'; - +-- Create an index on last_name for faster searches CREATE INDEX idx_employees_last_name -on employees (last_name); +ON employees (last_name); -SHOW data_directory; \ No newline at end of file +-- Check the data directory of the database +SHOW data_directory;