I have the following query:
SELECT product_description.name, product.quantity,product.price,product_option_value_description.name,product_option_value.quantity
FROM product
INNER JOIN product_description
ON product.product_id=product_description.product_id
INNER JOIN product_option_value_description
ON product.product_id=product_option_value_description.product_id
INNER JOIN product_option_value
ON product.product_id=product_option_value.product_id
ORDER BY product_description.name
How could I change the title for product_option_value_description.name
as I would like to name this option.
1. Renaming a column name using the ALTER keyword. Line 2: RENAME COLUMN OldColumnName TO NewColumnName; For Example: Write a query to rename the column name “SID” to “StudentsID”.
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;
Just write product_option_value_description.name AS Name
to create the alias "Name"
for this column.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With