Home  >  Article  >  Database  >  How can we use MySQL EXPORT_SET() function with columns of a table?

How can we use MySQL EXPORT_SET() function with columns of a table?

王林
王林forward
2023-08-24 09:17:08800browse

我们如何将 MySQL EXPORT_SET() 函数与表的列一起使用?

#We can use the EXPORT_SET() function with columns of a table by providing an integer type column as the first parameter of the function. The following example will demonstrate it -

Example

mysql> SELECT Id, EXPORT_SET(id,'1','0',' ',5)AS 'ID in bits' from student;

+------+------------+
| Id   | ID in bits |
+------+------------+
| 1    | 1 0 0 0 0  |
| 2    | 0 1 0 0 0  |
| 15   | 1 1 1 1 0  |
| 20   | 0 0 1 0 1  |
| 21   | 1 0 1 0 1  |
+------+------------+

5 rows in set (0.00 sec)

Here we are using the "Id" column of the "Student" table as the parameter of the EXPORT_SET() function.

The above is the detailed content of How can we use MySQL EXPORT_SET() function with columns of a table?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:tutorialspoint.com. If there is any infringement, please contact admin@php.cn delete