- MySQL queries in script: We are going to write a script called mysql_version.sh to get the latest version of MySQL:
#!/bin/bashmysql -u root -pTraining2@^ <<MY_QUERYSELECT VERSION();MY_QUERY
Now, we are going to create a script called create_database.sh to create the database:
#!/bin/bashmysql -u root -pTraining2@^ <<MY_QUERYcreate database testdb;MY_QUERY
- SQLite queries in script: Now, we are going to create a sqlite database. You can create the sqlite database by simply writing sqlite3 and a name for the database. For example:
$ sqlite3 testdb
Now, we are going to create a table in the sqlite console. Enter sqlite3 testdb and press Enter—you will see the sqlite3 console. Now, write the create table command to create ...