Subqueries that are scalar or column return a single value or a column of values. A subquery variant known as a row subquery returns a single row, allowing it to provide many column values. Legal comparison operators for rows under queries include: = > < >= <= <> != <=>
For comparison:
SELECT * FROM t1 WHERE ROW(1) = (SELECT column1 FROM t2)
For column of values:
SELECT * FROM
(VALUES ROW(7786,’Scott’,’Analyst’),
ROW(7787,’John’,’Sales’),
ROW(7788,’Mike’,’Marketing’)) AS T
INTO OUTFILE ‘C:/ProgramData/MySQL/MySQL Server 8.0/Uploads/textdata.txt’;;
Result:
7786 | Scott | Analyst |
7787 | John | Sales |
7788 | Mike | Marketing |
Hope you find this article helpful.