开发者

Mysql define variable by AS or direct

开发者 https://www.devze.com 2023-02-26 11:13 出处:网络
What\'s the difference between these 2 开发者_如何转开发queries? select pc.* from payment_coupon pc

What's the difference between these 2 开发者_如何转开发queries?

select pc.* from payment_coupon pc
select pc.* from payment_coupon AS pc


Just one word: Readability.

Using AS is optional, like described here in the manual.


using AS for column name is mandatory , for table name u just write alias with a space

AS is optional for tablename

Eg:

SELECT column1 AS c1 FROM table t // work
SELECT column1 c1 FROM table t // not works
SELECT column1 AS c1 FROM table AS t  //work
SELECT column1 c1 FROM table AS t //  not works
0

精彩评论

暂无评论...
验证码 换一张
取 消