Usage of ROW Keyword in MySQL

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.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s