May 2018
Beginner
332 pages
7h 28m
English
Now we will insert some data into our Authors table. We will use insert into query to insert the data. Create the script 7_insert_into_Authors.sh to insert the data:
#!/bin/bash
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');
MY_QUERY
Now save the program and run it as follows:
$ chmod +x mysql_07.sh
$ ./mysql_07.sh
After executing this script, records will have been successfully inserted. To check this you will need to use the command select.