Buchdaten einfügen:
Führen Sie die folgenden SQL-Befehle aus, um Beispielbuchdaten in die book_search
-Tabelle einzufügen:
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.'
);
Diese Befehle fügen fünf Zeilen in die book_search
-Tabelle ein, die jeweils ein Buch darstellen. Die Werte für title
(Titel), author
(Autor) und content
(Inhalt) werden für jedes Buch angegeben. Beachten Sie das Escape-Zeichen für das einfache Anführungszeichen in 'The Hitchhiker''s Guide to the Galaxy'
. Einfache Anführungszeichen innerhalb einer Zeichenkette müssen durch Verdopplung maskiert werden.
Dateninsertion überprüfen:
Um zu bestätigen, dass die Daten korrekt hinzugefügt wurden, führen Sie den folgenden Befehl aus:
SELECT * FROM book_search;
Dieser Befehl ruft alle Zeilen und Spalten aus der book_search
-Tabelle ab. Sie sollten die Daten sehen, die Sie gerade eingefügt haben.
Erwartete Ausgabe:
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.