A continuación, se muestran diferentes ejemplos de como insertar filas en tablas, tanto de forma individual como masiva.
INSERT INTO ventas.tb_client ( client_id, client_name, age, address, city, country, contact_email, phone, created_date ) VALUES ('1', 'Paco', '35','C/ Real 1', 'Soria', 'España', NULL, NULL, NULL), ('2', 'Juan', '25','C/ Real 2', 'Soria', 'España', NULL, NULL, NULL), ('3', 'Paula', '34','C/ Real 3', 'Valladolid', 'España', NULL, NULL, NULL), ('4', 'Julia', '33','C/ Real 4', 'Valladolid', 'España', NULL, NULL, NULL), ('5', 'Hector', '32','C/ Real 5', 'Valladolid', 'España', NULL, NULL, NULL), ('6', 'Natalia','42','C/ Real 6', 'Segovia', 'España', NULL, NULL, NULL), ('7', 'Oscar', '40','C/ Real 7', 'Segovia', 'España', NULL, NULL, NULL), ('8', 'Laura', '15','C/ Real 8', 'Segovia', 'España', NULL, NULL, NULL), ('9', 'Diego', '25','C/ Real 9', 'Soria', 'España', NULL, NULL, NULL), ('10', 'Luis', '33','C/ Mayor 1','Soria', 'España', NULL, NULL, NULL), ('11', 'Miriam', '36','C/ Mayor 1', 'Segovia', 'España', NULL, NULL, NULL), ('12', 'Judit', '28','C/ Mayor 3', 'Segovia', 'España', NULL, NULL, NULL), ('13', 'Alvaro', '35','C/ Mayor 7', 'Valladolid', 'España', NULL, NULL, NULL), ('14', 'Sara', '31','C/ Mayor 2', 'Soria', 'España', NULL, NULL, NULL), ('15', 'Jose', '32','C/ Mayor 4', 'Soria', 'España', NULL, NULL, NULL), ('16', 'Monica','33','C/ Mayor 6', 'Valladolid', 'España', NULL, NULL, NULL), ('17', 'Isabel','36','C/ Mayor 8', 'Valladolid', 'España', NULL, NULL, NULL), ('19', 'Pepe', '38','C/ Gerona 1', 'Segovia', 'España', NULL, NULL, NULL), ('20', 'Raquel','39','C/ Gerona 2', 'Segovia', 'España', NULL, NULL, NULL), ('21', 'Ana', '23','C/ Gerona 6', 'Segovia', 'España', NULL, NULL, NULL), ('22', 'Lorena','24','C/ Gerona 7', 'Segovia', 'España', NULL, NULL, NULL), ('23', 'Irene', '26','C/ Gerona 4', 'Soria', 'España', NULL, NULL, NULL), ('24', 'Rebeca', '28','C/ Gerona 9', 'Soria', 'España', NULL, NULL, NULL), ('25', 'Andres', '30','C/ Gerona 2', 'Valladolid', 'España', NULL, NULL, NULL);
INSERT INTO ventas.tb_category (category_id, category_name) VALUES ('F001', 'Frutas'); INSERT INTO ventas.tb_category (category_id, category_name) VALUES ('B001', 'Bebidas'); INSERT INTO ventas.tb_category (category_id, category_name) VALUES ('L001', 'Lácteos'); INSERT INTO ventas.tb_category (category_id, category_name) VALUES ('C001', 'Congelados'); INSERT INTO ventas.tb_category (category_id, category_name) VALUES ('C002', 'Carnes');
INSERT INTO ventas.tb_product (product_id, category_id, product_name, price) VALUES ('1', 'F001', 'Naranjas España', 1.99); INSERT INTO ventas.tb_product (product_id, category_id, product_name, price) VALUES ('2', 'F001', 'Limones España', 1.79); INSERT INTO ventas.tb_product (product_id, category_id, product_name, price) VALUES ('3', 'F001', 'Pomelos Grecias', 0.98); INSERT INTO ventas.tb_product (product_id, category_id, product_name, price) VALUES ('4', 'F001', 'Manzana Golden', 1.59); INSERT INTO ventas.tb_product (product_id, category_id, product_name, price) VALUES ('5', 'F001', 'Manzana Royal', 1.75); INSERT INTO ventas.tb_product (product_id, category_id, product_name, price) VALUES ('6', 'F001', 'Melón Grecia', 3.39); INSERT INTO ventas.tb_product (product_id, category_id, product_name, price) VALUES ('7', 'B001', 'Bezoya', 0.39); INSERT INTO ventas.tb_product (product_id, category_id, product_name, price) VALUES ('8', 'B001', 'Cabreiroá', 0.59); INSERT INTO ventas.tb_product (product_id, category_id, product_name, price) VALUES ('9', 'B001', 'Agua del grifo', 0.19); INSERT INTO ventas.tb_product (product_id, category_id, product_name, price) VALUES ('10', 'B001', 'Lapitusa', 1.39); INSERT INTO ventas.tb_product (product_id, category_id, product_name, price) VALUES ('11', 'B001', 'El Coto', 3.69); INSERT INTO ventas.tb_product (product_id, category_id, product_name, price) VALUES ('12', 'B001', 'Azpilicueta', 5.89); INSERT INTO ventas.tb_product (product_id, category_id, product_name, price) VALUES ('13', 'C001', 'Pizza Margarita', 2.69); INSERT INTO ventas.tb_product (product_id, category_id, product_name, price) VALUES ('14', 'C001', 'Cuatro Quesos', 2.89); INSERT INTO ventas.tb_product (product_id, category_id, product_name, price) VALUES ('15', 'C001', 'Guisantes', 1.29); INSERT INTO ventas.tb_product (product_id, category_id, product_name, price) VALUES ('16', 'C001', 'Brocoli', 2.29); INSERT INTO ventas.tb_product (product_id, category_id, product_name, price) VALUES ('17', 'L001', 'Yogur Yoplait', 0.39); INSERT INTO ventas.tb_product (product_id, category_id, product_name, price) VALUES ('18', 'L001', 'Leche desnatada', 0.59); INSERT INTO ventas.tb_product (product_id, category_id, product_name, price) VALUES ('19', 'L001', 'Leche entera', 0.79); INSERT INTO ventas.tb_product (product_id, category_id, product_name, price) VALUES ('20', 'L001', 'Leche semi', 0.69); INSERT INTO ventas.tb_product (product_id, category_id, product_name, price) VALUES ('21', 'C002', 'Alitas pollo', 1.39); INSERT INTO ventas.tb_product (product_id, category_id, product_name, price) VALUES ('22', 'C002', 'Pollo entero', 4.39); INSERT INTO ventas.tb_product (product_id, category_id, product_name, price) VALUES ('23', 'C002', 'Pata de ternera', 3.59); INSERT INTO ventas.tb_product (product_id, category_id, product_name, price) VALUES ('24', 'C002', 'Falda de ternera', 2.99); INSERT INTO ventas.tb_product (product_id, category_id, product_name, price) VALUES ('25', 'C002', 'Buey', 2.99);
INSERT INTO ventas.tb_order (order_id, client_id, product_id, quantity) VALUES (1, 1, 1, 19); INSERT INTO ventas.tb_order (order_id, client_id, product_id, quantity) VALUES (2, 2, 2, 14); INSERT INTO ventas.tb_order (order_id, client_id, product_id, quantity) VALUES (3, 3, 3, 19); INSERT INTO ventas.tb_order (order_id, client_id, product_id, quantity) VALUES (4, 1, 1, 1); INSERT INTO ventas.tb_order (order_id, client_id, product_id, quantity) VALUES (5, 5, 2, 20); INSERT INTO ventas.tb_order (order_id, client_id, product_id, quantity) VALUES (6, 2, 4, 2); INSERT INTO ventas.tb_order (order_id, client_id, product_id, quantity) VALUES (7, 3, 8, 13); INSERT INTO ventas.tb_order (order_id, client_id, product_id, quantity) VALUES (8, 4, 9, 17); INSERT INTO ventas.tb_order (order_id, client_id, product_id, quantity) VALUES (9, 1, 9, 16); INSERT INTO ventas.tb_order (order_id, client_id, product_id, quantity) VALUES (10, 2, 12, 1); INSERT INTO ventas.tb_order (order_id, client_id, product_id, quantity) VALUES (11, 3, 11, 1); INSERT INTO ventas.tb_order (order_id, client_id, product_id, quantity) VALUES (12, 4, 16, 4); INSERT INTO ventas.tb_order (order_id, client_id, product_id, quantity) VALUES (13, 1, 15, 3); INSERT INTO ventas.tb_order (order_id, client_id, product_id, quantity) VALUES (14, 2, 17, 1); INSERT INTO ventas.tb_order (order_id, client_id, product_id, quantity) VALUES (15, 5, 15, 1); INSERT INTO ventas.tb_order (order_id, client_id, product_id, quantity) VALUES (16, 1, 15, 1); INSERT INTO ventas.tb_order (order_id, client_id, product_id, quantity) VALUES (17, 2, 16, 9); INSERT INTO ventas.tb_order (order_id, client_id, product_id, quantity) VALUES (18, 3, 15, 9); INSERT INTO ventas.tb_order (order_id, client_id, product_id, quantity) VALUES (19, 4, 21, 7); INSERT INTO ventas.tb_order (order_id, client_id, product_id, quantity) VALUES (20, 1, 21, 7); INSERT INTO ventas.tb_order (order_id, client_id, product_id, quantity) VALUES (21, 2, 22, 5); INSERT INTO ventas.tb_order (order_id, client_id, product_id, quantity) VALUES (22, 1, 16, 3); INSERT INTO ventas.tb_order (order_id, client_id, product_id, quantity) VALUES (23, 2, 5, 5); INSERT INTO ventas.tb_order (order_id, client_id, product_id, quantity) VALUES (24, 1, 8, 6); INSERT INTO ventas.tb_order (order_id, client_id, product_id, quantity) VALUES (25, 2, 12, 1); INSERT INTO ventas.tb_order (order_id, client_id, product_id, quantity) VALUES (26, 5, 13, 2); INSERT INTO ventas.tb_order (order_id, client_id, product_id, quantity) VALUES (27, 4, 11, 4); INSERT INTO ventas.tb_order (order_id, client_id, product_id, quantity) VALUES (28, 1, 11, 1); INSERT INTO ventas.tb_order (order_id, client_id, product_id, quantity) VALUES (29, 2, 19, 5); INSERT INTO ventas.tb_order (order_id, client_id, product_id, quantity) VALUES (30, 3, 13, 10); INSERT INTO ventas.tb_order (order_id, client_id, product_id, quantity) VALUES (31, 5, 3, 3); INSERT INTO ventas.tb_order (order_id, client_id, product_id, quantity) VALUES (32, 2, 1, 12); INSERT INTO ventas.tb_order (order_id, client_id, product_id, quantity) VALUES (33, 1, 1, 7); INSERT INTO ventas.tb_order (order_id, client_id, product_id, quantity) VALUES (34, 1, 2, 10); INSERT INTO ventas.tb_order (order_id, client_id, product_id, quantity) VALUES (35, 2, 6, 17); INSERT INTO ventas.tb_order (order_id, client_id, product_id, quantity) VALUES (36, 2, 5, 20); INSERT INTO ventas.tb_order (order_id, client_id, product_id, quantity) VALUES (37, 1, 5, 14); INSERT INTO ventas.tb_order (order_id, client_id, product_id, quantity) VALUES (38, 5, 8, 20); INSERT INTO ventas.tb_order (order_id, client_id, product_id, quantity) VALUES (39, 3, 9, 19); INSERT INTO ventas.tb_order (order_id, client_id, product_id, quantity) VALUES (40, 1, 14, 14); INSERT INTO ventas.tb_order (order_id, client_id, product_id, quantity) VALUES (41, 2, 17, 14); INSERT INTO ventas.tb_order (order_id, client_id, product_id, quantity) VALUES (42, 3, 12, 5); INSERT INTO ventas.tb_order (order_id, client_id, product_id, quantity) VALUES (43, 4, 22, 1); INSERT INTO ventas.tb_order (order_id, client_id, product_id, quantity) VALUES (44, 5, 20, 14); INSERT INTO ventas.tb_order (order_id, client_id, product_id, quantity) VALUES (45, 1, 20,14);
0 comentarios