0% found this document useful (0 votes)
4 views10 pages

MIS SQL GSheets Interview Handbook 2

The document is a comprehensive interview handbook covering SQL and Google Sheets questions categorized into easy, medium, and hard levels. It includes various SQL queries, functions, and concepts such as joins, aggregation, and data manipulation, as well as Google Sheets functions and advanced usage scenarios. Each section provides specific questions and answers to help prepare for interviews in these areas.

Uploaded by

kongdiddly86
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views10 pages

MIS SQL GSheets Interview Handbook 2

The document is a comprehensive interview handbook covering SQL and Google Sheets questions categorized into easy, medium, and hard levels. It includes various SQL queries, functions, and concepts such as joins, aggregation, and data manipulation, as well as Google Sheets functions and advanced usage scenarios. Each section provides specific questions and answers to help prepare for interviews in these areas.

Uploaded by

kongdiddly86
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 10

MIS Interview Handbook: SQL & Google

Sheets (Easy, Medium, Hard)


SQL - Easy
 1. Q: What is SQL and what is its primary purpose?

A: SQL is a language used to communicate with databases to perform tasks like


retrieving, updating, and manipulating data.
 2. Q: How do you select all records from a table named `customers`?

A: SELECT * FROM customers;


 3. Q: Write a query to display only the `name` and `email` columns from a table named
`users`.

A: SELECT name, email FROM users;


 4. Q: What does the WHERE clause do in SQL?

A: It filters records that meet specific conditions.


 5. Q: How can you sort results by a column called `created_at` in descending order?

A: SELECT * FROM table_name ORDER BY created_at DESC;


 6. Q: What is a primary key?

A: A column or set of columns that uniquely identify a row in a table.


 7. Q: What does the `COUNT(*)` function do?

A: It returns the total number of rows in a table or query.


 8. Q: How do you retrieve only unique values from a column `department`?

A: SELECT DISTINCT department FROM employees;


 9. Q: What is the purpose of the `LIMIT` clause?

A: It restricts the number of rows returned by a query.


 10. Q: Write a query to find users who live in 'New York'.

A: SELECT * FROM users WHERE city = 'New York';


 11. Q: How do you check for NULL values in SQL?

A: Use `IS NULL` or `IS NOT NULL`.


 12. Q: What is a foreign key?

A: A key used to link two tables together.


 13. Q: Write a query to count how many employees are in the 'HR' department.

A: SELECT COUNT(*) FROM employees WHERE department = 'HR';


 14. Q: What is the difference between `=` and `LIKE` in SQL?

A: `=` matches exact value; `LIKE` matches patterns.


 15. Q: How do you rename a column in the result set?

A: Use an alias: SELECT name AS employee_name FROM employees;


 16. Q: How do you combine first and last name into one column?

A: SELECT CONCAT(first_name, ' ', last_name) AS full_name FROM employees;


 17. Q: How do you calculate the average salary from a table `employees`?

A: SELECT AVG(salary) FROM employees;


 18. Q: What function would you use to find the maximum value in a column?

A: MAX() function.
 19. Q: What does the `GROUP BY` clause do?

A: Groups rows that have the same values into summary rows.
 20. Q: How do you get the current date in SQL?

A: SELECT CURRENT_DATE;

SQL - Medium
 1. Q: Write a query to get the number of employees in each department.

A: SELECT department, COUNT(*) FROM employees GROUP BY department;


 2. Q: How do you find all customers who haven't placed an order?

A: Use LEFT JOIN on customers and orders, filter where order_id IS NULL.
 3. Q: Write a query to get the average salary per department.

A: SELECT department, AVG(salary) FROM employees GROUP BY department;


 4. Q: Explain the difference between `INNER JOIN` and `LEFT JOIN`.

A: `INNER JOIN` returns matched records; `LEFT JOIN` returns all records from the left
table and matched ones from the right.
 5. Q: How do you find the second highest salary?

A: SELECT MAX(salary) FROM employees WHERE salary < (SELECT MAX(salary) FROM
employees);
 6. Q: Write a query to find employees hired after 2022.

A: SELECT * FROM employees WHERE hire_date > '2022-12-31';


 7. Q: How do you get the number of employees hired each year?

A: SELECT YEAR(hire_date), COUNT(*) FROM employees GROUP BY YEAR(hire_date);


 8. Q: What does the `HAVING` clause do?

A: Filters groups after aggregation, like WHERE does for rows.


 9. Q: How do you find the total sales for each region where sales exceeded 10000?

A: SELECT region, SUM(sales) FROM data GROUP BY region HAVING SUM(sales) >
10000;
 10. Q: Write a query to update a user’s email by their ID.

A: UPDATE users SET email = '[email protected]' WHERE id = 1;


 11. Q: How do you delete all records from a table without deleting the table?

A: DELETE FROM table_name;


 12. Q: How do you create an index on a column?

A: CREATE INDEX index_name ON table_name(column_name);


 13. Q: What is normalization in databases?

A: The process of organizing data to reduce redundancy and improve integrity.


 14. Q: How can you join three tables in a single query?

A: Use multiple JOIN clauses.


 15. Q: What is a subquery?

A: A query nested inside another query.


 16. Q: Write a query using a subquery to find employees with above average salary.

A: SELECT * FROM employees WHERE salary > (SELECT AVG(salary) FROM employees);
 17. Q: Explain the difference between `UNION` and `UNION ALL`.

A: `UNION` removes duplicates, `UNION ALL` includes all records.


 18. Q: How do you fetch the top 5 highest paid employees?
A: SELECT * FROM employees ORDER BY salary DESC LIMIT 5;
 19. Q: What are indexes and why are they used?

A: Indexes speed up data retrieval from tables.


 20. Q: How would you change a column's data type?

A: ALTER TABLE table_name MODIFY column_name NEW_DATATYPE;

SQL - Hard
 1. Q: How do you handle duplicate records in SQL?

A: Use GROUP BY, DISTINCT, or DELETE with ROW_NUMBER().


 2. Q: Write a query to remove duplicate emails from a `users` table, keeping the first
entry.

A: Use CTE with ROW_NUMBER and DELETE where row > 1.


 3. Q: What are window functions in SQL?

A: Functions that perform calculations across a set of rows related to the current row.
 4. Q: Write a query using ROW_NUMBER to get top employee in each department.

A: Use PARTITION BY department ORDER BY salary DESC.


 5. Q: How do you pivot a table in SQL?

A: Use CASE statements with aggregation functions.


 6. Q: Explain transaction control commands in SQL.

A: COMMIT, ROLLBACK, and SAVEPOINT manage transactions.


 7. Q: What is a stored procedure?

A: A saved SQL query that can be reused with parameters.


 8. Q: How do you create a temporary table?

A: CREATE TEMPORARY TABLE temp_table (...);


 9. Q: Write a query to get cumulative sales per region.

A: Use SUM(sales) OVER (PARTITION BY region ORDER BY date).


 10. Q: What is the use of the COALESCE function?

A: Returns the first non-null value in a list.


 11. Q: Explain the difference between DELETE, TRUNCATE, and DROP.
A: DELETE = remove rows, TRUNCATE = reset table, DROP = delete structure.
 12. Q: Write a query to list employees hired in the last 6 months.

A: Use CURRENT_DATE and DATE_SUB for comparison.


 13. Q: How do you extract only the domain from an email field?

A: Use SUBSTRING or SPLIT functions depending on DBMS.


 14. Q: What’s the difference between correlated and non-correlated subqueries?

A: Correlated subqueries refer to outer query values; non-correlated do not.


 15. Q: How do you find duplicate rows based on multiple columns?

A: GROUP BY multiple columns HAVING COUNT(*) > 1.


 16. Q: What are the types of joins available in SQL?

A: INNER, LEFT, RIGHT, FULL OUTER, CROSS JOIN.


 17. Q: Write a query that joins employees with their managers.

A: SELF JOIN on employees table using manager_id.


 18. Q: How do you handle NULL values in aggregation?

A: Functions like COUNT, SUM, AVG ignore NULLs by default.


 19. Q: What is the use of EXISTS clause?

A: Checks if a subquery returns any result.


 20. Q: Write a query that ranks employees by salary within their department.

A: Use RANK() OVER (PARTITION BY department ORDER BY salary DESC);

Google Sheets - Easy


 1. Q: What does the SUM function do in Google Sheets?

A: Explains the SUM function.


 2. Q: What does the AVERAGE function do in Google Sheets?

A: Explains the AVERAGE function.


 3. Q: What does the COUNT function do in Google Sheets?

A: Explains the COUNT function.


 4. Q: What does the IF function do in Google Sheets?

A: Explains the IF function.


 5. Q: What does the VLOOKUP function do in Google Sheets?

A: Explains the VLOOKUP function.


 6. Q: What does the HLOOKUP function do in Google Sheets?

A: Explains the HLOOKUP function.


 7. Q: What does the LEN function do in Google Sheets?

A: Explains the LEN function.


 8. Q: What does the CONCATENATE function do in Google Sheets?

A: Explains the CONCATENATE function.


 9. Q: What does the NOW function do in Google Sheets?

A: Explains the NOW function.


 10. Q: What does the TODAY function do in Google Sheets?

A: Explains the TODAY function.


 11. Q: What does the TRIM function do in Google Sheets?

A: Explains the TRIM function.


 12. Q: What does the LOWER function do in Google Sheets?

A: Explains the LOWER function.


 13. Q: What does the UPPER function do in Google Sheets?

A: Explains the UPPER function.


 14. Q: What does the LEFT function do in Google Sheets?

A: Explains the LEFT function.


 15. Q: What does the RIGHT function do in Google Sheets?

A: Explains the RIGHT function.


 16. Q: What does the MID function do in Google Sheets?

A: Explains the MID function.


 17. Q: What does the ROUND function do in Google Sheets?

A: Explains the ROUND function.


 18. Q: What does the ISBLANK function do in Google Sheets?

A: Explains the ISBLANK function.


 19. Q: What does the SORT function do in Google Sheets?

A: Explains the SORT function.


 20. Q: What does the FILTER function do in Google Sheets?

A: Explains the FILTER function.

Google Sheets - Medium


 1. Q: How would you use the QUERY function in a practical reporting scenario?

A: Explanation and usage example for QUERY.


 2. Q: How would you use the ARRAYFORMULA function in a practical reporting
scenario?

A: Explanation and usage example for ARRAYFORMULA.


 3. Q: How would you use the IMPORTRANGE function in a practical reporting scenario?

A: Explanation and usage example for IMPORTRANGE.


 4. Q: How would you use the INDEX function in a practical reporting scenario?

A: Explanation and usage example for INDEX.


 5. Q: How would you use the MATCH function in a practical reporting scenario?

A: Explanation and usage example for MATCH.


 6. Q: How would you use the UNIQUE function in a practical reporting scenario?

A: Explanation and usage example for UNIQUE.


 7. Q: How would you use the SPLIT function in a practical reporting scenario?

A: Explanation and usage example for SPLIT.


 8. Q: How would you use the JOIN function in a practical reporting scenario?

A: Explanation and usage example for JOIN.


 9. Q: How would you use the TEXT function in a practical reporting scenario?

A: Explanation and usage example for TEXT.


 10. Q: How would you use the INDIRECT function in a practical reporting scenario?

A: Explanation and usage example for INDIRECT.


 11. Q: How would you use the OFFSET function in a practical reporting scenario?

A: Explanation and usage example for OFFSET.


 12. Q: How would you use the XLOOKUP function in a practical reporting scenario?

A: Explanation and usage example for XLOOKUP.


 13. Q: How would you use the IFERROR function in a practical reporting scenario?

A: Explanation and usage example for IFERROR.


 14. Q: How would you use the SUBTOTAL function in a practical reporting scenario?

A: Explanation and usage example for SUBTOTAL.


 15. Q: How would you use the NETWORKDAYS function in a practical reporting
scenario?

A: Explanation and usage example for NETWORKDAYS.


 16. Q: How would you use the DAYS function in a practical reporting scenario?

A: Explanation and usage example for DAYS.


 17. Q: How would you use the EOMONTH function in a practical reporting scenario?

A: Explanation and usage example for EOMONTH.


 18. Q: How would you use the WEEKDAY function in a practical reporting scenario?

A: Explanation and usage example for WEEKDAY.


 19. Q: How would you use the CHOOSE function in a practical reporting scenario?

A: Explanation and usage example for CHOOSE.


 20. Q: How would you use the RANDBETWEEN function in a practical reporting
scenario?

A: Explanation and usage example for RANDBETWEEN.

Google Sheets - Hard


 1. Q: Describe a scenario where you would use QUERY with WHERE and LABEL in a
Google Sheets dashboard.

A: Advanced usage of QUERY with WHERE and LABEL.


 2. Q: Describe a scenario where you would use ARRAYFORMULA for entire column
calculations in a Google Sheets dashboard.

A: Advanced usage of ARRAYFORMULA for entire column calculations.


 3. Q: Describe a scenario where you would use IMPORTRANGE for combining data in a
Google Sheets dashboard.
A: Advanced usage of IMPORTRANGE for combining data.
 4. Q: Describe a scenario where you would use SPARKLINE in a Google Sheets
dashboard.

A: Advanced usage of SPARKLINE.


 5. Q: Describe a scenario where you would use GOOGLEFINANCE in a Google Sheets
dashboard.

A: Advanced usage of GOOGLEFINANCE.


 6. Q: Describe a scenario where you would use SCRIPT editor for automation in a Google
Sheets dashboard.

A: Advanced usage of SCRIPT editor for automation.


 7. Q: Describe a scenario where you would use Custom Data Validation in a Google
Sheets dashboard.

A: Advanced usage of Custom Data Validation.


 8. Q: Describe a scenario where you would use Pivot Table in a Google Sheets
dashboard.

A: Advanced usage of Pivot Table.


 9. Q: Describe a scenario where you would use Data Slicer in a Google Sheets dashboard.

A: Advanced usage of Data Slicer.


 10. Q: Describe a scenario where you would use Conditional Formatting with Formula in
a Google Sheets dashboard.

A: Advanced usage of Conditional Formatting with Formula.


 11. Q: Describe a scenario where you would use Dynamic Named Ranges in a Google
Sheets dashboard.

A: Advanced usage of Dynamic Named Ranges.


 12. Q: Describe a scenario where you would use Dashboard Interactivity in a Google
Sheets dashboard.

A: Advanced usage of Dashboard Interactivity.


 13. Q: Describe a scenario where you would use Trigger-based scripts in a Google Sheets
dashboard.

A: Advanced usage of Trigger-based scripts.


 14. Q: Describe a scenario where you would use Auto-email reports in a Google Sheets
dashboard.
A: Advanced usage of Auto-email reports.
 15. Q: Describe a scenario where you would use Combining INDEX/MATCH in a Google
Sheets dashboard.

A: Advanced usage of Combining INDEX/MATCH.


 16. Q: Describe a scenario where you would use Cross-Sheet referencing in a Google
Sheets dashboard.

A: Advanced usage of Cross-Sheet referencing.


 17. Q: Describe a scenario where you would use Heatmaps using conditional formatting
in a Google Sheets dashboard.

A: Advanced usage of Heatmaps using conditional formatting.


 18. Q: Describe a scenario where you would use Data protection and permissioning in a
Google Sheets dashboard.

A: Advanced usage of Data protection and permissioning.


 19. Q: Describe a scenario where you would use Multi-condition QUERY in a Google
Sheets dashboard.

A: Advanced usage of Multi-condition QUERY.


 20. Q: Describe a scenario where you would use Nested IF statements in a Google Sheets
dashboard.

A: Advanced usage of Nested IF statements.

You might also like