在MySQL结果中显示表的别名是什么?

您可以使用AS命令作为别名以在MySQL结果中显示表。

 以下是语法-

SELECT TABLE_NAME AS anyAliasName
FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_SCHEMA = DATABASE();

让我们实现以上语法-

mysql> SELECT TABLE_NAME AS MY_TABLE_NAME
FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_SCHEMA = DATABASE();

这将产生以下输出-

+------------------------------------+
| MY_TABLE_NAME                      |
+------------------------------------+
| a                                  |
| accumulateddemo                    |
| add10minutedemo                    |
| add1toexistingvalue                |
| addanumbertocurrentvaluedemo       |
| addcolumnandindexdemo              |
| addingcurrentyeardemo              |
| addprefixtocolumndemo              |
| addtoexistingvaluedemo             |
| addtotaltimedemo                   |
| addwhereclausedemo                 |
| aggregatefunctiondemo              |
| allfiles                           |
| allownulldefaulnotnulldemo         |
| allrecordsexceptlastone            |
| ampmtimedisplaydemo                |
| auto_incrementdemo                 |
| autoincrementdemo                  |
| autoincrementtabledemo             |
| averagedemo                        |
| averagestring                      |
| avoidinserterrordemo               |
| avoidinsertingduplicaterows        |
| avoidnulldemo                      |
| b                                  |
| backtick_symboldemo                |
| bar                                |
| binarykeyworddemo                  |
| blobsizedemo                       |
| booleandemo                        |
| booleanevaluationdemo              |
| booltotinyintdemo                  |
| bulkchangedemo                     |
| calculateaveragedemo               |
| calculatepercentdemo               |
| calculatevaluedemo                 |
| casefunctiondemo                   |
| caseinsensitivedemo                |
| caseorconditiondemo                |
| castfunctiondemo                   |
| casttypetobigintdemo               |
| changecolumnname                   |
| charlengthdemo                     |
| child_table                        |
| childtable                         |
| client_information                 |
| clientdemo                         |
| clients                            |
| columndoesnotexists                |
| combinetwocolumnsdemo              |
| commadelimitedlist                 |
| comparedayandmonthdemo             |
| comparetwostringdemo               |
| comparingtimestampdemo             |
| concatandlowerdemo                 |
| concatenatingdemo                  |
| contains_capital_letterdemo        |
| convertbooltointdemo               |
| convertnulltozerodemo              |
| convertnumbertominute              |
| correctdatetimedemo                |
| correlationdemo                    |
| countallcharactersdemo             |
| countallrowsdemo                   |
| countbooleanfielddemo              |
| countdifferentdemo                 |
| countingrows                       |
| countrowsdemo                      |
| counttop10demo                     |
| countvaluedemo                     |
| countwithsubquerydemo              |
| coursedemo                         |
| crc32demo                          |
| createindexdemo                    |
| createviewdemo                     |
| currentweekdemo                    |
| datedemo                           |
| datedifferencedemo                 |
| dateformatdemo                     |
| dateortimedemo                     |
| decimal_demo                       |
| decimaldemo                        |
| defaulmyisam                       |
| defaultdemo                        |
| defaultenginedemo                  |
| delete_view                        |
| deleteafterspacedemo               |
| deletedemo                         |
| deletefrombasetabledemo            |
| deleterowdemo                      |
| deleterowsolderthan5demo           |
| enumdemo                           |
| equivalentdemo1                    |
| equivalentdemo2                    |
| errordemo                          |
| eurosymboldemo                     |
| eventdemo                          |
| excludecertaincolumnsdemo          |
| existincommaseparatedlist          |
| extractfilenamedemo                |
| extracttuples                      |
| findandreplacedemo                 |
| findbestmatch                      |
| findcapitallettrsdemo              |
| finddifferencedemo                 |
| findinsetdemo                      |
| findinvalidemailaddressdemo        |
| rownumberdemo                      |
| rowsusinglimit                     |
| scorecountdemo                     |
| searchdateasvarchar                |
| searchingdemo                      |
| searchingdemo2                     |
| second_table                       |
| secondlastdemo                     |
| secondreceivedemo                  |
| secondtable                        |
| seespacesdemo                      |
| select1andlimit1demo               |
| selectalldemo                      |
| selectallentriesdemo               |
| selectbeforeandafterdemo           |
| selectdaterangedemo                |
| selectdatesdemo                    |
| selectdistinctdemo                 |
| selectifdemo                       |
| selectintoequivalentdemo           |
| selectorderdemo                    |
| selectpartoftimestampdemo          |
| selectpermonthdemo                 |
| selectperson                       |
| selectrandomrecord                 |
| selectrecordsdemo                  |
| selectuniquevalue                  |
| selfjoindemo                       |
| set+0demo                          |
| setallvaluesdemo                   |
| setautoincrementdemo               |
| setfirstnameandlastname            |
| setzerodemo                        |
| showsuminlastrowdemo               |
| sleepdemo                          |
| sortcertainvalues                  |
| sortedlistdemo                     |
| specialcharactersdemo              |
| specifiedvaluesdemo                |
| sqlstatementsdemo                  |
| stoproundingdemo                   |
| stoproundingdemo2                  |
| storecsscolordemo                  |
| storedproceduredemo                |
| storedprocedureinsertdemo          |
| storevalue0and1ornulldemo          |
| stringendswithnumber               |
| student_information                |
| student_table_sample               |
| subtotaldemo                       |
| subtractvaluedemo                  |
| sumdemo                            |
| sumofeverydistinct                 |
| sumtimedemo                        |
| sumuntilcertainpoint               |
| syntaxofaltercommanddemo           |
| taxonomytable                      |
| tbl1                               |
| tblupdate                          |
| tematics_field                     |
| ternaryoperationdemo               |
| texttotimestampdemo                |
| timedemo                           |
| timestamp_tabledemo                |
| top2demo                           |
| trimcommasdemo                     |
| uniquebothcolumnvaluesamedemo      |
| uniquecountbyipadress              |
| uniquedemo                         |
| university                         |
| unixtimestampformatdemo            |
| unsigneddemo |
| updatecolumndemo |
| updatecolumnname |
| updatedatedemo |
| updatedemo                         |
| updateifconditiondemo              |
| updatesettypedemo                  |
| updatewithhighestdemo              |
| useofdesccolumnnamedemo            |
| useprocedure                       |
| user_informations                  |
| usercommentsview                   |
| userdemo                           |
| userinformation                    |
| userinformationexpire              |
| userlogindetails                   |
| userlogininformation               |
| userlogintimeinformation           |
| usertabledemo                      |
| utfdemo                            |
| valueascolumn                      |
| view_table_demo                    |
| viewautoincrementdemo              |
| viewtabledemo                      |
| weeklyeventdemo                    |
| whereaftergroupdemo                |
| wheredemo                          |
| wheresetdemo                       |
| wildcarddemo                       |
| yesterdayrecordsdemo               |
| yourtable                          |
+------------------------------------+
408 rows in set (0.02 sec)