How does mysql know the data type of each field of a query result

for example, I now have a sql query
for example

   

but I also want to know what the data type of apply_date is
what to do?

Mar.03,2021

use views? But I don't know if it's necessary to create a view
create a view
mysql > create view t (id,score) as select id,score from grade;
Query OK, 0 rows affected (0.02 sec)
View the types of fields in the view

< table > < thead > < tr > < th > mysql > desc t; < / th > < / tr > < / thead > < tbody > < tr > < td > Field < / td > < td > Type < / td > < td > Null < / td > < td > Key < / td > < td > Default < / td > < td > Extra < / td > < / tr > < tr > < td > id < / td > < td > int (10) < / td > < td > NO < / td > < td > < / td > < td > 0 < / td > < td > < / td > < / tr > < tr > < td > score < / td > < td > double (5pm 2) < / td > < td > YES < / td > < td > < / td > < td > NULL < / td > < td > < / td > < / tr > < / tbody > < / table >

2 rows in set (0.00 sec)


if you use java jdbc, you can get the field type through metadata

ResultSet rs = stmt.executeQuery("SELECT a, b, c FROM TABLE2");//, 
ResultSetMetaData rsmd = rs.getMetaData(); 
int numberOfColumns = rsmd.getColumnCount(); //  

structure in ResultSetMetaData:

om.mysql.jdbc.ResultSetMetaData@132e13d - Field level information: 
com.mysql.jdbc.Field@1617189[catalog=test,tableName=MyBean,originalTableName=mybean,columnName=id,originalColumnName=id,mysqlType=3(FIELD_TYPE_LONG),flags= PRIMARY_KEY, charsetIndex=63, charsetName=US-ASCII]
com.mysql.jdbc.Field@64f6cd[catalog=test,tableName=MyBean,originalTableName=mybean,columnName=name,originalColumnName=name,mysqlType=253(FIELD_TYPE_VAR_STRING),flags=, charsetIndex=8, charsetName=Cp1252]
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b389c4-2ae6f.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b389c4-2ae6f.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?