简体   繁体   中英

Is there any SQL or MySQL query to display all the data in a form of a sentence?

I want to display the data in a sentence like "SMITH HAS HELD THE POSITION OF CLERK IN DEPT 20 FROM 1981". How can i do this in MySQL ?? Where I'll retrieve the name , job , hiredate and dept no. from the table And sorry I'm totally new to stack overflow

You need to use CONCAT() function to create a sentence using different values from a table column. for eg.

SELECT
concat(upper(name)," HAS HELD THE POSITION OF ",upper(job)," IN DEPT ",deptno," FROM ",year(hiredate)) as EmployeeInfo
FROM tbl;

DEMO

you can change the query according to your requirement (as you did not provide any data we are can't provide exact query).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM