SQL Basic to Advance Interview Question and Answer 1731934628
SQL Basic to Advance Interview Question and Answer 1731934628
http://www.nityacloudtech.com/ @nityacloudtech
Nitya CloudTech Pvt Ltd.
http://www.nityacloudtech.com/ @nityacloudtech
Nitya CloudTech Pvt Ltd.
http://www.nityacloudtech.com/ @nityacloudtech
Nitya CloudTech Pvt Ltd.
7. Explain ACID properties in SQL.
➢ Answer:
▪ Atomicity: Ensures that all operations within a transaction
independently.
▪ Durability: Ensures completed transactions are saved even
http://www.nityacloudtech.com/ @nityacloudtech
Nitya CloudTech Pvt Ltd.
http://www.nityacloudtech.com/ @nityacloudtech
Nitya CloudTech Pvt Ltd.
11. Explain the OVER clause and give an example of its use.
➢ Answer: The OVER clause defines a window for applying
window functions. For example:
SELECT employee_id, salary,
AVG(salary) OVER (PARTITION BY
department_id) AS avg_dept_salary
FROM employees;
http://www.nityacloudtech.com/ @nityacloudtech
Nitya CloudTech Pvt Ltd.
http://www.nityacloudtech.com/ @nityacloudtech
Nitya CloudTech Pvt Ltd.
13. How can you retrieve the current date and time in SQL?
➢ Answer: Use the CURRENT_TIMESTAMP function or its
variations like GETDATE() (SQL Server) or NOW() (MySQL).
14. How do you calculate the difference between two dates in
SQL?
➢ Answer:
SELECT DATEDIFF(day, start_date, end_date)
AS date_difference;
http://www.nityacloudtech.com/ @nityacloudtech
Nitya CloudTech Pvt Ltd.
arguments.
▪ NULLIF: Returns null if two expressions are equal;
http://www.nityacloudtech.com/ @nityacloudtech
Nitya CloudTech Pvt Ltd.
http://www.nityacloudtech.com/ @nityacloudtech