Inserting data into table

Now we will insert some data into our Authors table. We will use insert into query to insert the data. Create the script to insert the data:

mysql -u user1 -pTest623@! <<MY_QUERY 
use testdb; 
Insert into Authors(NAME)values('William Shakespeare'); 
Insert into Authors(NAME)values('Charles Dickens'); 
Insert into Authors(NAME)values('Jane Austen'); 
Insert into Authors(NAME)values('George Orwell'); 
Insert into Authors(NAME)values('Oscan Wilde'); 

Now save the program and run it as follows:

          $ chmod +x
          $ ./

After executing this script, records will have been successfully inserted. To check this you will need to use the command select.

Get Learning Linux Shell Scripting - Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.