Вставка данных о книгах:
Выполните следующие SQL-команды, чтобы вставить примеры данных о книгах в таблицу 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.'
);
Эти команды вставляют пять строк в таблицу book_search
, каждая из которых представляет книгу. Для каждой книги указаны значения title
(название), author
(автор) и content
(содержание). Обратите внимание на экранированную одинарную кавычку в 'The Hitchhiker''s Guide to the Galaxy'
. Одинарные кавычки внутри строки должны быть экранированы путем их удвоения.
Проверка вставки данных:
Чтобы убедиться, что данные добавлены правильно, выполните следующую команду:
SELECT * FROM book_search;
Эта команда извлекает все строки и столбцы из таблицы book_search
. Вы должны увидеть данные, которые вы только что вставили.
Ожидаемый вывод:
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.