Changing a SQL column title via query

前端 未结 4 570
孤独总比滥情好
孤独总比滥情好 2020-12-16 03:39

I have the following query:

SELECT product_description.name, product.quantity,product.price,product_option_value_description.name,product_option_value.quanti         


        
相关标签:
4条回答
  • 2020-12-16 04:19

    Just write product_option_value_description.name AS Name to create the alias "Name" for this column.

    0 讨论(0)
  • 2020-12-16 04:23

    You can use any alias name using the 'AS' keyword. eg. select student_id AS id from student_info

    0 讨论(0)
  • 2020-12-16 04:33

    Use as

    For example:

    SELECT product_description.name as 'ProdName', product.quantity,product.price,product_option_value_description.name as 'ProdDesc',product_option_value.quantity FROM product
    
    0 讨论(0)
  • 2020-12-16 04:43

    Use an alias like so:

    product_option_value_description.name AS `Option`
    

    If you want to change the column's name, not only for this query but in general use ALTER TABLE

    ALTER TABLE product_option_value_description CHANGE name newname DATATYPE;
    
    0 讨论(0)
提交回复
热议问题