Queries About Jardineria - Solutions
Queries About Jardineria - Solutions
Queries About Jardineria - Solutions
1. The office code and the city where there are offices.
SELECT Count(*)
FROM Empleados;
3. How many clients each country has.
orders.
SELECT NombreCliente
FROM Clientes
WHERE LimiteCredito=(SELECT Max(LimiteCredito) FROM Clientes);
7. Get a list with the name of all the customers and the name and surname of their
sales representative.
have a manager.
SELECT Nombre,Apellido1,Apellido2,email,Puesto
FROM Empleados
WHERE CodigoJefe is null;
10. The first name, surname and position of those employees who are not sales
representatives.
1. representantes de ventas.
SELECT Nombre,Apellido1,Apellido2, Puesto
FROM Empleados
WHERE not Puesto='Representante Ventas';
#WHERE Puesto<>'Representante Ventas' #Otra opción
11. The number of customers the company has.
SELECT Count(CodigoCliente)
FROM Clientes;
12. The name of the Spanish customers.
//tres opciones
SELECT NombreCliente FROM Clientes WHERE Pais='España';
SELECT NombreCliente,pais FROM Clientes WHERE Pais='España' OR
pais='SPAIN';
SELECT NombreCliente,pais FROM Clientes WHERE Pais IN ('España' ,
'SPAIN');
13. How many clients each country has.
SELECT Pais,count(*)
FROM Clientes
GROUP BY Pais;
14. How many clients does the city of Madrid have?
SELECT count(*)
FROM Clientes
WHERE ciudad ='Madrid';
15. How many clients does the city beginning with M have?
SELECT Count(*),ciudad
FROM Clientes
WHERE ciudad like 'M%'
GROUP BY ciudad;
16. The employee code and the number of customers served by each sales
representative.
SELECT count(CodigoCliente)
FROM Clientes
18. What was the first and last payment made by any customer.
SELECT Min(FechaPago),Max(FechaPago)
FROM Pagos;
19. The customer code of those customers who made payments in 2008.
SELECT codigoCliente
FROM Pagos
WHERE FechaPago like '2008-%-%';
20. The different statuses an order can go through.
SELECT Count(*),Gama
FROM Productos
GROUP BY Gama;
23. The name of the most expensive product.
SELECT Nombre
FROM Productos
WHERE PrecioVenta = (SELECT Max(PrecioVenta) FROM Productos);
24. The name of the customers and the name of their representatives together with