DEV Community

pooyaalamdari
pooyaalamdari

Posted on

insert data to table

INSERT INTO Books 

(column_one, column_two, column_three, column_four)
VALUES (value1, value2, value3, value4); 
Enter fullscreen mode Exit fullscreen mode

Certainly! Here's how you can insert practical and real-world data into the Books table using the correct column names and corresponding values:

INSERT INTO Books (BookID, Title, Author, ISBN, Price, InStock)
VALUES (1, '1984', 'George Orwell', '9780451524935', 8.99, TRUE),
       (2, 'To Kill a Mockingbird', 'Harper Lee', '9780060935467', 7.99, TRUE),
       (3, 'The Great Gatsby', 'F. Scott Fitzgerald', '9780743273565', 9.99, FALSE),
       (4, 'Pride and Prejudice', 'Jane Austen', '9781986431484', 6.99, TRUE),
       (5, 'The Catcher in the Rye', 'J.D. Salinger', '9780316769488', 10.99, TRUE);
Enter fullscreen mode Exit fullscreen mode

This SQL command inserts five rows into the Books table, each representing a book with a unique BookID, and includes the Title, Author, ISBN, Price, and InStock status for each book. The InStock column is a boolean, where TRUE indicates that the book is available and FALSE indicates it is not.

Top comments (0)