Hello,
As per your requirement I make below solution.Though it is not good approach.
CREATE TABLE a
(
id int,
brand varchar(20) ,
price int,
color varchar(20),
size int
) ;
INSERT INTO a (id,brand,price,color,size)
VALUES
(1,'addidas', 500 ,'Black', 7),
(2,'Nike', 400 ,'Blue' ,8),
(3,'Reebok', 200 ,'Red' ,6) ;
Query to get the required output is
select AttributeName,AttributeValue from
(select a.id,1 as 'colid','brand' as 'AttributeName', brand as 'AttributeValue' from a
union
select a.id,2 as 'colid','price' , price from a
union
select a.id,3 as 'colid','color',color from a
union
select a.id ,4 as 'colid','size',size from a
)x order by x.id,x.colid
Here colid variable is used to get the attribute value by required order.
Out put is available in This link
Thanks