CREATE TABLE Productos (
ProductoID INT PRIMARY KEY AUTO_INCREMENT,
Nombre VARCHAR(50),
PrecioUnitario DECIMAL(10,2),
CostoUnitario DECIMAL(10,2),
StockInicial INT,
UnidadesVendidas INT,
DescuentoPorcentaje DECIMAL(5,2)
);
INSERT INTO Productos (Nombre, PrecioUnitario, CostoUnitario, StockInicial, UnidadesVendidas, DescuentoPorcentaje) VALUES
('Teclado Mecanico', 80.00, 45.00, 100, 35, 10.00),
('Raton Gamer', 50.00, 25.00, 150, 42, 5.00),
('Monitor 24 pulgadas', 200.00, 130.00, 50, 12, 15.00),
('Auriculares', 60.00, 30.00, 80, 21, 0.00),
('Laptop HP', 800.00, 600.00, 30, 10, 10.00),
('Impresora', 150.00, 90.00, 40, 15, 5.00),
('USB 64GB', 15.00, 5.00, 200, 80, 0.00),
('Silla Gamer', 250.00, 180.00, 20, 5, 20.00),
('Webcam HD', 70.00, 40.00, 60, 25, 10.00),
('Disco SSD 500GB', 90.00, 60.00, 70, 30, 5.00),
('Tablet 10p', 300.00, 220.00, 25, 8, 15.00),
('Cargador', 25.00, 12.00, 100, 45, 0.00),
('Bocina Bluetooth', 45.00, 20.00, 90, 35, 10.00),
('Microfono', 110.00, 70.00, 35, 12, 5.00),
('Router WiFi', 85.00, 50.00, 50, 20, 0.00),
('Cable HDMI', 12.00, 4.00, 300, 120, 0.00),
('Power Bank', 35.00, 18.00, 80, 28, 10.00),
('Smartwatch', 180.00, 120.00, 40, 18, 15.00),
('Luz LED', 20.00, 8.00, 150, 60, 5.00);
-- 1.- SUMA: Precio final con envio de $5.00
SELECT Nombre, PrecioUnitario, PrecioUnitario + 5.00 AS PrecioFinalConEnvio FROM Productos;
-- 2.- RESTA: Ganancia por unidad e inventario actual
SELECT Nombre, PrecioUnitario - CostoUnitario AS GananciaPorUnidad, StockInicial - UnidadesVendidas AS InventarioActual FROM Productos;
-- 3.- MULTIPLICACION: Ingreso total y monto descuento
SELECT Nombre, UnidadesVendidas * PrecioUnitario AS IngresoTotal, PrecioUnitario * (DescuentoPorcentaje/100) AS MontoDescuento FROM Productos;
-- 4.- DIVISION: Relacion costo/precio
SELECT Nombre, CostoUnitario / PrecioUnitario AS RelacionCostoPrecio FROM Productos;
-- 5.- RESIDUO: Unidades sueltas al empaquetar de 10 en 10
SELECT Nombre, StockInicial % 10 AS UnidadesSueltas FROM Productos;
-- 6.- REPORTE TOTAL FINANCIERO
SELECT Nombre
PrecioUnitario * (1 - DescuentoPorcentaje/100) AS PrecioConDescuento,
(PrecioUnitario * (1 - DescuentoPorcentaje/100) - CostoUnitario) * UnidadesVendidas AS GananciaTotalNeta,
StockInicial - UnidadesVendidas AS UnidadesPendientes
FROM Productos;
To embed this project on your website, copy the following code and paste it into your website's HTML: