Databases, AI & You

 

Databases and Artificial Intelligence are a good pairing.  AI can take the sharp, rusty edges off the database skills many have and be a force multiplier for getting the data you want. What follows is a quick intro.  We will be using SQLite, DBeaver Community Edition, and some simple prompts. 

The DBeaver Community Edition includes SQLite, so you get both with a single download. There will be a later blog post on setting up AI with DBeaver CE, but for now refer to AI Preferences. 


Step 1 - Open DBeaver and create a New Database Connection





Step 2 -Use the wizard and select SQLite








Step 3 -- Select 'Create'









Step 4 - Enter a name for your new database in the 'File name' box. I chose 'davedemo'.








Step 5 -  Select 'Finish' to create your new SQLite database.















Step 6 - DBeaver has now created the database








Step 7 - Open an SQL Console, and ask AI to create a table for you by prefacing your request with @ai. Here we want a table named 'demo01' with three integer columns. 




Step 7 - Yes, you have to 'okay' the AI's use of your new database.


Step 8




Step 8 - Double-check your table is what you want









Step 9 - Using the AI Assistant, I ask for 1000 dummy records. Select the orange right-pointing triangle to execute the query.





















Step 10 - Approve the use of YOUR data.




 


Step 11 - Examine the generated SQL to create the test data. Again, select the orange arrow.


-- This query inserts 1000 dummy records into the demo01 table.

-- It uses a recursive CTE to generate numbers from 1 to 1000.

with recursive numbers as (

select 1 as num

union all

select num + 1

from numbers

where num < 1000

)

insert into demo01 (column1, column2, column3)

select num, num * 2, num * 3

from numbers;


Step 13 - We have data












Conclusion

This blog has shown you a very basic example of using Artificial Intelligence to create a database, populate it with data, and retrieve it.  Note that I did not have to write any Structured Query Language for any of this blog. AI Assistance is a big benefit for those with limited or no database skills.

Later, you will see how it can leverage the skills of more experienced folks to complete complex tasks.

Comments