Insertar datos de libros:
Ejecute los siguientes comandos SQL para insertar datos de muestra de libros en la tabla book_search
:
INSERT INTO book_search (title, author, content) VALUES (
'The Lord of the Rings',
'J.R.R. Tolkien',
'A fantasy epic about hobbits, elves, and the battle against Sauron.'
);
INSERT INTO book_search (title, author, content) VALUES (
'Pride and Prejudice',
'Jane Austen',
'A classic novel about love, class, and society in 19th-century England.'
);
INSERT INTO book_search (title, author, content) VALUES (
'The Hitchhiker''s Guide to the Galaxy',
'Douglas Adams',
'A comedic science fiction series following the misadventures of Arthur Dent.'
);
INSERT INTO book_search (title, author, content) VALUES (
'To Kill a Mockingbird',
'Harper Lee',
'A powerful story about racial injustice in the American South.'
);
INSERT INTO book_search (title, author, content) VALUES (
'1984',
'George Orwell',
'A dystopian novel about totalitarianism and surveillance.'
);
Estos comandos insertan cinco filas en la tabla book_search
, cada una representando un libro. Se proporcionan los valores de title
(título), author
(autor) y content
(contenido) para cada libro. Observe la comilla simple escapada en 'The Hitchhiker''s Guide to the Galaxy'
. Las comillas simples dentro de una cadena deben escaparse duplicándolas.
Verificar la inserción de datos:
Para confirmar que los datos se han agregado correctamente, ejecute el siguiente comando:
SELECT * FROM book_search;
Este comando recupera todas las filas y columnas de la tabla book_search
. Debería ver los datos que acaba de insertar.
Resultado esperado:
The Lord of the Rings|J.R.R. Tolkien|A fantasy epic about hobbits, elves, and the battle against Sauron.
Pride and Prejudice|Jane Austen|A classic novel about love, class, and society in 19th-century England.
The Hitchhiker's Guide to the Galaxy|Douglas Adams|A comedic science fiction series following the misadventures of Arthur Dent.
To Kill a Mockingbird|Harper Lee|A powerful story about racial injustice in the American South.
1984|George Orwell|A dystopian novel about totalitarianism and surveillance.