Sql Generator With An Auto Incrementor in Ruby
In this guide you will learn how to create a dynamic number of sql insert commands with an auto incrementor.
Guide Tasks
- Read Tutorial
- Complete the Exercise
Summary
Build a method that can create a dynamic number of sql insert commands with an auto incrementor.
Exercise Description
"Define a method can create a dynamic number of sql insert commands with an auto incrementor."
Example
'final_sql = <<~SQL' -> INSERT INTO users(users_name, users_email) VALUES ('Demo 0', 'test0@test.com'); INSERT INTO users(users_name, users_email) VALUES ('Demo 1', 'test1@test.com'); SQL
Real World Usage
This exercise will teach you how to update a sql database with an auto incrementor for new entries can be a good way to test out your data base connection to your application.