This document contains SQL queries that use string functions like LENGTH, LEFT, RIGHT, REPLACE, TRIM, UPPER, LOWER, SUBSTRING on the NameProduct column of a product table. It also contains queries using LIKE, COUNT, AVG, SUM, GROUP BY, HAVING to analyze and retrieve data from the product table based on conditions on the NameProduct and Price columns. Some queries join to a user table and perform string operations on the LastName column.
This document contains SQL queries that use string functions like LENGTH, LEFT, RIGHT, REPLACE, TRIM, UPPER, LOWER, SUBSTRING on the NameProduct column of a product table. It also contains queries using LIKE, COUNT, AVG, SUM, GROUP BY, HAVING to analyze and retrieve data from the product table based on conditions on the NameProduct and Price columns. Some queries join to a user table and perform string operations on the LastName column.
This document contains SQL queries that use string functions like LENGTH, LEFT, RIGHT, REPLACE, TRIM, UPPER, LOWER, SUBSTRING on the NameProduct column of a product table. It also contains queries using LIKE, COUNT, AVG, SUM, GROUP BY, HAVING to analyze and retrieve data from the product table based on conditions on the NameProduct and Price columns. Some queries join to a user table and perform string operations on the LastName column.
SELECT right(NameProduct,5) FROM product p; SELECT replace(NameProduct,'Fritas','cocidas') FROM product p; SELECT trim(NameProduct) FROM product p; SELECT upper(NameProduct) FROM product p; SELECT lower(NameProduct) FROM product p; SELECT substring(NameProduct,1,7) FROM product p;
select * FROM product p where left(NameProduct,1)= 'c';
select count(IdProduct) FROM product p where left(NameProduct,1)= 'c';
select avg(Price) FROM product;
select sum(Price)/count(*) FROM product;
select * FROM product p where TRIM(UPPER(NameProduct)) = 'périco';
select * FROM product p where NameProduct like '%pa%';
select * FROM product p where NameProduct like '%pa'; select * FROM product p where NameProduct like 'pa%';
select replace(LastName,'Molina','Marcano') from user
select Price,count(*) Cantidad FROM product p group by Price having Price>500 and Cantidad >1;