Practice SQL Questions and Answers
- What is the primary purpose of a `SEQUENCE` in SQL?
- Which of the following statements about SQL `INDEXES` is generally TRUE?
- What is an SQL `VIEW`?
- What is the primary purpose of a `SEQUENCE` in SQL?
- Which of the following statements about SQL `INDEXES` is generally TRUE?
- What is an SQL `VIEW`?
- Which type of index physically reorders the data rows in the table itself based on the index key, meaning the data is stored in the order of the index?
- Which of the following is a key characteristic that distinguishes a PL/SQL `FUNCTION` from a PL/SQL `PROCEDURE`?
- In PL/SQL, what type of parameter allows a procedure to both receive a value from the calling environment and return a modified value back to it?
- Which of the following is a mandatory component of a PL/SQL function's definition?
- What is the primary purpose of a PL/SQL `CURSOR`?
- What is the correct sequence of operations for using an explicit PL/SQL cursor?
- Which PL/SQL cursor attribute returns `TRUE` if the most recent `FETCH` statement returned a row, and `FALSE` otherwise?
- When does an implicit cursor get automatically declared and managed by PL/SQL?
- What is the main function of a PL/SQL `TRIGGER`?
- Which type of index physically reorders the data rows in the table itself based on the index key, meaning the data is stored in the order of the index?
- Which of the following is a key characteristic that distinguishes a PL/SQL `FUNCTION` from a PL/SQL `PROCEDURE`?
- In PL/SQL, what type of parameter allows a procedure to both receive a value from the calling environment and return a modified value back to it?
- A `BEFORE INSERT` trigger fires:
- Which type of trigger fires once for each row affected by the triggering DML statement?
- Which of the following is a common use case for a PL/SQL trigger?
- Which of the following is not a type of SQL JOIN?
- What is the difference between DELETE, TRUNCATE, and DROP commands in SQL?
- In SQL, what is the difference between 'WHERE' and 'HAVING' clauses?
- In database management, which SQL command is used to retrieve only unique (non-duplicate) values from a column?
- What will be the output of the following SQL query? SELECT COUNT(*) FROM Transactions WHERE Amount > 10000 AND Status = 'Completed';
- What is a 'stored procedure' in SQL?
- Which query returns departments whose average salary is greater than 60000?
- Which SQL expression correctly returns employees whose salary is greater than the average salary of all employees?
- Orders(OrderID, CustomerID, Amount) has multiple orders per customer. Which query returns customers whose total order amount exceeds 100000?
- Table T has five rows and X values (10,20,NULL,20,NULL). What does SELECT COUNT(X) FROM T return?
- Given Employee(EmpID, Name, Salary, ManagerID), which query correctly lists employees who earn more than their own manager?
- Table B contains a NULL value in its 'id' column. Consider: SELECT * FROM A WHERE A.id NOT IN (SELECT id FROM B). What happens?
- A table has salaries 90000, 90000, 85000, 80000 (sorted descending). Using RANK() OVER (ORDER BY Salary DESC), what ranks are assigned, and how does this d...
- A table has a B-tree index on the 'Name' column. Which of the following queries is LEAST likely to benefit from this index?
- Transaction T1 runs 'SELECT COUNT(*) FROM Orders WHERE Amount > 1000' twice within the same transaction. Between the two reads, T2 inserts a new qualifying...
- Employees(emp_id, name, salary, mgr_id): (1,'Alice',9000,NULL), (2,'Bob',7000,1), (3,'Carol',9500,1), (4,'Dave',6000,2). What does the following self-join ...
- Customers(cust_id,name): (1,'A'),(2,'B'),(3,'C'). Orders(order_id,cust_id,amount): (1,1,200),(2,2,150),(3,1,300),(4,3,100). What does the following query r...
- Employees and salaries: Alice=9000, Bob=7000, Carol=9500, Dave=7000. What rank does Dave receive from the following query? SELECT name, salary, RANK() OVER...
- Table T(A,B) contains: (1,NULL), (NULL,2), (3,4), (NULL,NULL). How many rows are returned by the following query? SELECT * FROM T WHERE A=3 OR B=4;
More Topics
- Algorithms Questions
- Analog and Digital Communication Questions
- Artificial Intelligence & Machine Language Questions
- Basics of Computers Questions
- Big Data Analytics Questions
- C Programming Questions
- C++ Questions
- Cloud Computing Questions
- Compiler Design Questions
- Computer Architecture and Design Questions
- Cyber Security Questions
- Data Analytics Languages Questions
- Data Structure Questions
- Data Warehousing Questions
- Digital Logic Questions
- Emerging Technologies Questions
- IOT and mobile Computing Questions
- IT DBMS Questions
- IT Networking Questions
- IT Operating System Questions
- Java Language Questions
- Machine Learning Questions
- Memory Management Questions
- Microsoft Office Questions
- Miscellaneous Questions Questions
- Network Layer and IP Protocol Questions
- Numerical and Statistical Computing Questions
- Object Oriented Programming Questions
- OOPS Concepts Questions
- Previous Year Questions Questions
- Programming Concept Questions
- Python Questions
- Shell Scripting Questions
- Software Engineering and Web Technology Questions
- String Manipulation Questions
- TCP IP and OSI Questions