Previously learned query syntax: Select field name from table name where condition
In fact, the syntax of the query varies a lot:
1. Select can query an expression, which is an operator + operand.
For example 1 + 1 2 * 3 2-1+5*9 math.random () * 1;
As you can see, in the database, the string + string is not spliced, but the addition is calculated,
Try it and take ' 1 ' + ' A123 '.
Expand, what if you want to make two strings of stitching?
2. Aliases for tables
In fact, the column can also alias:
3. Use of the dual table.
Do we need to write out the name of the table when we query the expression?
No, it looks like this:
Select;
MySQL has a virtual table dual that complements the syntax of the query expression (the most appropriate syntax for those who have OCD!). )
Actually, do not add dual also line! Just for the integrity of the grammar.
When you query an expression, you can query more than one expression at a time.
query expressions, which can be combined with the data in a table.
Similarly:
Excellent Yue Group (Shenzhen) Co., Ltd.
Enjoy Life with technology
: Yojoygroup
Weibo: Http://weibo.com/YOJOYGROUP
Official website:http://www.yojoygroup.com/
Contact & submission: [Email protected]
Advanced queries in MySQL