What is the purpose of a self-join in SQL?
- To combine rows from the same table based on a related column
- To eliminate duplicate rows from a result set
- To join two different tables based on a common column
- To perform complex calculations within a query
A self-join in SQL is used when you want to combine rows from the same table based on a related column. It is commonly used to retrieve hierarchical data or to compare rows within the same table. For example, when you have an employee table where each row contains an employee and their manager, you can use a self-join to retrieve the manager's details for each employee.
Loading...
Related Quiz
- What is the significance of the "test effectiveness index" in test reporting and metrics?
- Which factors should you consider when selecting a test data generation tool for your database testing project?
- Data integrity testing ensures that data remains accurate, consistent, and free from ____________ during storage and retrieval.
- What is the primary purpose of using monitoring and profiling tools in database testing?
- Which of the following is a common compliance standard for database systems?