How can we return two rows in the result set while only referencing one row?
1Times asked
May 2026Last seen
May 2026First seen
💡 Model Answer
Use the LIMIT clause to restrict the number of rows returned: SELECT FROM table_name LIMIT 2;. If you want to reference only one row in the query logic (e.g., in a subquery or a join), you can use a subquery that selects a single row and then join or union it with another query that returns the second row. For example: SELECT FROM (SELECT FROM table_name WHERE id = 1) AS a UNION ALL SELECT FROM table_name WHERE id = 2;.
This answer was generated by AI for study purposes. Use it as a starting point — personalize it with your own experience.
🎤 Get questions like this answered in real-time
Assisting AI listens to your interview, captures questions live, and gives you instant AI-powered answers — invisible to screen sharing.
Get Assisting AI — Starts at ₹500