SHARE
TWEET

Untitled

a guest Jul 16th, 2019 71 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. CALL insert_libros(NULL,'1','Uno','Richarh bach','planeta','157'),
  2. (NULL,'2','ilusiones','Richarh bacha','planeta','120'),
  3. (NULL,'3','Aprenda PHP','Mario Molina','Nuevo Siglo','500');
  4.  
  5.  
  6.  
  7. USE libreria;
  8.  
  9. CREATE TABLE libros(
  10. id INT AUTO_INCREMENT NOT NULL PRIMARY KEY,
  11. codlibro VARCHAR (10) NOT NULL,
  12. titulo VARCHAR(40) NOT NULL,
  13. autor VARCHAR(30) NOT NULL,
  14. editorial VARCHAR(20) NOT NULL,
  15. precio DECIMAL(6,2)
  16.  
  17.  
  18. );
  19.  
  20. --creando procedimiento para insertar libros
  21. DELIMITER//
  22.  
  23. CREATE PROCEDURE insert_libros(IN idlibro INT, IN codlibro VARCHAR(10),IN titulo VARCHAR(40),
  24. IN autor VARCHAR(30), IN editorial VARCHAR(20), IN precio DECIMAL(6,2))
  25. BEGIN
  26. INSERT INTO libros VALUES
  27. (idlibro,codlibro,titulo,autor,editorial,precio),
  28. (idlibro,codlibro,titulo,autor,editorial,precio),
  29. (idlibro,codlibro,titulo,autor,editorial,precio);
  30.  
  31.  
  32. END//
  33.  
  34. DELIMITER;
  35.  
  36.  CALL insert_libros(NULL,'1','Uno','Richarh bach','planeta','157'),
  37.  (NULL,'2','ilusiones','Richarh bacha','planeta','120'),
  38.  (NULL,'3','Aprenda PHP','Mario Molina','Nuevo Siglo','500');
  39.  
  40.  
  41. --eliminar un procedimiento
  42. DROP PROCEDURE `insert_libros`;
  43.  
  44. SELECT * FROM libros;
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top