Krish Naik provides a pragmatic blueprint for enterprise AI by balancing the intuitive power of LLMs with Oracle's robust data governance. This is a rare example of a tutorial that prioritizes production-grade security over mere technical novelty.
Deep Dive
Prerequisite Knowledge
- No data available.
Where to go next
- No data available.
Deep Dive
Building Production Grade Text to SQL Application Using Oracle AI Database - Select AIAdded:
Hello, all. My name is Krish Naik, and welcome to my YouTube channel. So, guys, today in this particular video, we are going to develop an application which will be converting your text to SQL by using Oracle 26 AI database. Okay? And this application is just like like chat with your database with a plain English text, and automatically the execution will happen. You'll be able to get the response, each and everything.
So, for this, one important thing is that you need to understand we are using Oracle 26 AI database. If you have seen already one of my previous video we have spoken about the features of Oracle 26 AI database. But anyhow, in this particular video, I will talk about the agenda, how we are going to develop this application, and how we should basically proceed. So, first of all, let me do one thing. Let me go ahead and probably share you like what all things we are going to develop over here. Okay? So, the first thing that I will be talking about what we are building. We will be building a live retail live retail analytics database, first of all.
database Now, in this specific database, what you will be doing is that you will just be giving some plain English text.
Let's say that you want to go ahead and ask about users or anything, whatever thing you really want. Right? So, it will be a plain English questions. Okay?
And this plain English questions will probably go to your Oracle 26 AI database.
Because here only we will be having our entire data available in different different schema formats, like you'll be having tables, you'll be having multiple tables, and all. This database, what it does is that it will go ahead and generate Okay? After generating, it will basically generate the SQL statements or SQL commands, whatever commands that is basically required. And then, it will go ahead and execute that particular SQL command.
Execute the SQL command, and finally, you will get the response. Okay? The results, right?
And you'll also be seeing that this will also give a detailed explanation about detailed explanation about the SQL command also, right? So, this is what we are specifically going to develop, you know? And here, one amazing thing is that you don't even require any external infrastructure.
Okay? Everything will be any external infrastructure. You will not be required. Everything will be happening inside this Oracle 26 AI database itself. It is also called as Oracle AI database. Okay?
Now, you'll be able to see like I've just drawn a brief architecture over here. So, let's say this is my database schema, okay? And this particular database schema is built in the Oracle 26 AI database.
Here, let's say you have tables like customers, products, orders, orders item.
Okay? And this is my application, which will be having the LLM provider. It can be any kind of LLM models that you want.
Let's say that you want to go ahead with OpenAI or you want to go ahead with Cohere or any kind of LLM models.
So, here what will happen is that this LLM provider, when we are actually developing this particular application, we will be getting the plain English text over here, right?
Plain English text.
Let's say I will be saying uh please tell me about the unique products that has been ordered by the customers, right? So, it goes to the application.
Then here, your SQL query is generated. Okay?
Now, how this SQL query is generated?
Remember, this application, this LLM provider, you know, will be having the access of only the table and the column names. Since this is being completely built inside the Oracle 26 AI database itself, right? So, in short, we are This is my application. We are communicating with the database itself, where this application only has the access of the schema, right? So, here we have the access of the column names, the product name, I mean, the table names, what are the tables that are actually available and all.
The major part about Oracle 26 AI database is that this LLM provider, this LLM will never see the data that is present inside this table. Instead, it only has information about your schema, wherein it has the information of table and column names.
And the SQL runs inside the Oracle, right? So, when this SQL is generated, this is internally running inside the Oracle 26 AI database, right? So, this way, the major important information about the security control, security control, and the governance, right? And the data governance is basically maintained. And that is the major advantages of using Oracle 26 AI database, right? So, this two important point is clearly maintained because here we're just giving the access of the schema, that is the table and column names, not the data that is present inside this. So, what this LLM provider will do is that you'll go ahead and generate the SQL query. And this SQL query is internally executed within this Oracle 26 AI database, and it finally returns us the result, right?
So, um this is what we are going to develop.
Uh we I have told this as a live retail analytics dashboard, but uh I will talk about the agenda, like how we are going to solve this problem, okay? So, the first thing is that we will understand about Oracle, Oracle 26 AI database, okay? Wherein we will do the complete setup.
We will do the setup up this.
Since data governance, all these things have been taken care of, there is a small setup that is specifically required over here. I will be showing you how you can go ahead and create an account, how you can generate a wallet.
You know, we need to create a wallet in the form of a zip file. There are multiple zip files that will be there.
Then how we can go ahead and create our autonomous AI autonomous database AI database. That also we will be talking about. Okay, so everything will be this first step. So this video is specifically divided into two parts. This is the first part. This will be around 15 minutes.
We need to do the specific setup. Then the second thing is that we will start creating this application wherein we focus on text to SQL.
Right? And then we will see that how this SQL queries that is basically generated, how it is executed within the Oracle 26 AI database and how do we get the results. Okay? So these are the two parts that we are going to execute in this particular video. Again, as in as informed, the first part will be all about the setup and second part will be developing the application. Right? And the amazing thing about Oracle 26 AI database is that over here, if you are familiar with SQL, right? Similar kind of commands we will try to execute within the code by using Python. Okay?
And again, you have some dependencies of the libraries that we are going to see as we go ahead. Now let's go ahead and probably do the setup of the first one and then we will go ahead and develop the application part. So let's go ahead and see the setup part. So guys, recently Oracle has unveiled its next generation AI native Oracle database 26 AI.
And in this specific video, we will be talking about the Oracle database 26 AI.
We'll be talking about its AI vector search capabilities and we'll also be talking about its unique properties when we compare to other vector databases that are available in the market. Um step-by-step we will be covering it.
We'll first of all go ahead and I'll try to show you how you can go ahead and log in into the account, create the vector search database over here. And uh further we will also be implementing some things related to code, how we can actually integrate uh the Oracle database uh 26 AI vector source capabilities with code, and also develop some amazing application. So, before I go ahead with respect to this particular video, I really want to thank Oracle for sponsoring this video. And so, let's go step-by-step. So, first of all, what you really need to do is that just go ahead and search for Oracle 26 AI. Here you will be able to see I'll just go ahead and search for login. Once you go ahead and uh and login, you can just go ahead and use the first link. Uh as soon as you click click this, you know, it is completely So, here you can see that uh if you want to get your hands on with Oracle AI database 26 AI absolutely free, here's your chance to explore the powerful database trusted by top business worldwide. This is super important specifically for enterprise data. I'll be talking about why it is very very uh easy probably for it to integrate with any kind of enterprise data also. Right? So, all the information is there. First of all, you need to go ahead and sign in. I have already done the sign in over here. You you can see that after doing the sign in, you'll be able to see something called as autonomous AI database feature. Uh uh over here in this specific demo, we will be using this autonomous AI databases.
First of all, as soon as you log in, you know, uh you'll be getting an option to create this. I've already created this autonomous AI database. It has a lot of amazing functionalities and features, okay, which we will be talking about step-by-step, okay? So, first of all, uh what we will be doing is that we will go ahead and create our first autonomous AI database. But, login functionalities are very simple. You just need to go ahead and sign in over here. It'll ask you for the username and password what you can actually go ahead and set it up. And once you do it, you will be taken to this specific page that looks something like this, right? So, this is the home page out there. Uh over here, you can actually work with different different features. You can track the billing. You can do multiple things over here itself, right? Now, but my main aim is basically to show you how we can actually specifically work with the AI autonomous database. So, I will go ahead and click this AI autonomous database. Let me just reload it quickly.
So, once this is loaded, our next step will be that. So, here you can see, I will go ahead to the vector DB. I will go back. Now, I'll create my first autonomous AI databases. It will first of all ask you for a display name. I will just go ahead and say, "Okay. Uh let's use a name called as Oracle 26 AI demo, okay?" And then I can go ahead and use my DB name, whatever DB name that you really want to use. Let's say I will be using noise noise. Noise is my database name. Okay. And here you can use any database name. Let's say that I will just go ahead and use vectors, okay? Vectors uh demo.
Then uh it'll ask you, see, the workload type is very much important. Whenever you're working with autonomous AI databases, it provides you all the specific features. One is the lakehouse.
This is specifically built for analytics and AI. Fast insights from a single lakehouse for all your data.
Another feature that you have is something called as transaction process, okay? This is built for transactional workloads, high concurrency for short-running queries and transaction.
Then you also have a feature which is called as JSON, built for JSON-centric application development, developer-friendly document APIs and native JSON storage. Whenever you really want to work specifically to JSON, you can use this feature. If you have a databases which has a lots and lots of transaction process that is basically happening. You can use this. Otherwise, you can go ahead with the Apex. It is built for Oracle Apex application development, creation, and deployment of low code application with database included. What I will do, I will just go ahead and use the transaction process, and I really want to use the free feature, so I'll go ahead and select this. It'll tell me to select the database version. I'll go ahead and select it, and I'll select the 26 AI version. Okay. Uh you can also go ahead and set up your password. Uh now in this particular case default password, you can go ahead and set it up. I will set something you can go ahead and set up according to your wish, so that I will be able to use it. I will show you where we will be using this password. Now I have actually set up this particular password. This is good enough. Okay.
Then uh network access it'll ask for securely access from everywhere. I would want to probably go ahead and select this particular option because I want to connect to this database from anywhere else. Okay. And then I will go ahead and click on create, right? So once this is basically getting created, you know, it will take some amount of time. Till then what I will do is that I will just go back, and I will keep on working on the already created autonomous database that I have already done it, right? So let me uh skip the tour. I don't want the tour.
You can also go ahead and uh use these things according to your need. I will go to autonomous database.
Okay. Now this is basically getting created, so Vector DB is one more databases that I have actually created because this is going to take time, so I wanted to show you over here. Okay.
Now once you go ahead and create this, okay, you know your username and password, you know each and everything.
Let's say after you get go ahead and create this, your uh database will look something like this. Okay.
So here you have autonomous AI database information. This is my database name.
This is my OCID database version, database availability, everything. So once this is basically getting created, the first thing that you really need to do is that uh go to the network section, okay?
And just go ahead and click on the access control list, okay? Here, you need to update your system IP, okay? So, this is really important, your system public IP. So, how to go ahead and find out your public IP? I will just go ahead and search for what is my IP address.
So, if you go ahead and search for what is my IP address, the first thing that you'll be getting is that's this particular website, what is my IP address. If I just go ahead and click on this.
So, this is your IP. For everybody's system, you'll be getting different different IP over here. So, I will go ahead and add the specific IP over here.
Okay? So, if you go ahead and see this, I've already added this with 241. So, I think it is 241 itself, right? So, over here, 241 is there. 241/32, okay? So, this is the IP that I've added. This IP is for my other system so that I can access it from my other system also for this particular vector databases. In the IP notation type, you need to select CIDR block, okay? So, this is the configuration that you really need to do. And the main thing is that once you take it to the deployment, let's say you're deploying it in AWS EC2 instance. So, there also you'll be getting a different IP, and that IP you need to update it over here. And any number of IPs you can specifically update it. Uh where your application is also running, you can also go ahead and update it. So, I have already updated this, which is very much good, okay? The next thing that I want, see, one is the network that access control list from where we really want to access it. The second thing that we really require is the database connection, okay? So, if you go ahead and click on this database connection, the first thing that you'll be having is nothing but your instance wallet. Now, this instance wallet has some of the basic configuration details, uh specifically to your application.
Like you can use those configuration details directly in your application.
So, I will go ahead and download this instance wallet. In order to download it, I'll go ahead and click on download.
I will set a password over here. So, let's say that I go ahead and set up a password. I'll say krish@12345 or any password that I want. I will go ahead and set it up, okay? So, here you can go ahead and set up this uh password.
Okay? And you can go ahead and download it. So, once I go ahead and download it, it will give me a zip file, okay? So, let me just show you the zip file because I've already downloaded it.
Or let me use the password that I have actually created it, okay? Because step-by-step I will be showing you each and everything. So, in the dot env, I have used this password, okay? I love olive@1.
So, this is my password that I will be using it.
Okay?
And I will click on download. Okay? So, once I download it, you'll be able to see that I will be getting one wallet {underscore} vector db.zip file.
Now, what is there inside this zip file?
We will go ahead and have a look. So, once you do this, then you can come outside this, okay? And now I'm going to insert all my data inside this vector db database, which is an autonomous AI database, and you know what all features it specifically has.
Now, I will go to my coding environment.
So, this is my coding environment.
I am going to develop two different kind of application. One, I will try to show you what is the Oracle 26 AI unique features.
What all unique features it has.
So, the first thing what you really need to do is that once you go get that zip file of wallet, right? I have created a folder inside this and I have unzipped over here, right? So, here you can see I've unzipped each and every information. These are my unzipped uh information that I have over here. If you go ahead and see inside this, this is nothing but it you're getting basically your entire database configuration details. Those configurations will be specifically used by any kind of application when you're connecting it to the Oracle 26c AI.
So, that I created a folder called as wallet and inside that I have unzipped it. Okay?
Now, uh the first thing is that let's go ahead and start this. Okay? So, here you can see Oracle 26c AI unique features demo.
What makes Oracle 26c AI different from Pinecone or Quadrant? Okay? I hope you have if you're following my channel, I have shown you with Pinecone, I've shown you with Quadrant, I've shown you with different different vector databases.
Okay?
But, now we have to understand what are the unique features.
So, one of the most important feature is that whenever we are working with Oracle uh AI database 26c AI, here we are talking about SQL plus vector hybrid search. So, it supports both SQL plus vector hybrid search, complex query combines vectors with traditional SQL. So, you know how SQL commands are, right? You can basically write any type of complex queries in order to retrieve content from the databases. But, here we are trying to combine both traditional SQL. Along with that, we also have given an option like uh Oracle 26c AI database has also given an option of vector hybrid search.
Then, you have asset transaction on vectors. Now, this is really really amazing, right? Whenever we have this kind of asset transaction, this will guarantee for vectors operation. Right?
Like transactional uh whatever transaction we have. Now, this is a very important property again in SQL, right? Then, we can also join vectors with tables, we can combine vector similar with relational joins, graph plus vector combined, graph traversal with semantics. So, these features are really really unique. We don't have in other vector databases like Pinecone or Quadrant. This has the combination of both SQL plus whatever things we can basically do in a vector hybrid search. Okay? So, guys, now finally we are going to develop our application, which is nothing but natural language to SQL using Oracle AI database 26c AI, and we are going to use this select AI feature. Okay? Now, what is this select AI? Um it's just like a new name for Oracle 23c AI, which is starting late 2025.
And uh it is a simple bridge that allows you to query your database using natural language instead of a complex SQL, you know? So, what happens is that you probably take that particular uh English text, you convert that into SQL, and you actually execute that. So, Oracle actually does that. Okay?
Now, what we are basically going to build, as I've already told, a live read and analytics database where you type English questions, Oracle 26c AI database generates, executes, and explains the SQL.
Zero external infrastructure required.
Nothing is basically required over here.
And uh you'll be able to see that you can also go ahead and start with the cloud free account uh trial account.
I've already shown you how you can go ahead and set up your database, your wallet zip, and all. And I've also configured the OpenAI API key in the.env file, right? So, all you have to do this uh quickly, you can uh anyhow I'll be able to give the entire GitHub link in the description of this particular video.
So, how with respect to the architecture over here, you can see how this select AI feature in Oracle database 26c AI works. Let's say in this particular Jupiter notebook, we have an execution statement. Let's say that I have select AI top five products by revenue. Okay?
Now, what is basically going to happen is that since we we will go ahead and install this Python Oracle DB, this will interact with the Oracle Autonomous Database 26c AI.
And it will specifically use this LLM provider. It will generate the SQL command since it has the references of all this uh uh schema, right? And it will go ahead and execute that SQL. Finally, we get the uh results. So, here you can see DBMS Cloud reads your schema, calls LLMs, runs the SQL, right? This is how things are actually going to go ahead. And this Jupiter notebook we have actually created.
One very important highlight is that the LLM never sees your data, only your schema, table, and column. The SQL runs inside the Oracle, so all data governance and security control remains intact, okay?
Now, first of all, what are all the packages that we specifically required?
So, here you can see that already uh uh if you go ahead and see uh with respect to the uh the project.toml file, right? Anyhow, I will be providing this entire file also. So, here you will be able to see this is my pyproject.toml. So, and I have I've already mentioned all the packages I'll be requiring, and we go ahead and install this, right?
Then, what we do is that So, these are my required package, Oracle DB. This is basically used to basically connect to your Oracle 26c AI database. Then, you have this Faker to create dummy data so that I'll be able to create all the schema databases. Basically, I want to create a database, I want to create all these tables, customers, products, and all. And also create some fake datasets uh and insert it into it, right? And here we are importing all these specific libraries. See, Oracle DB, pandas.va,.env, right? So, we have also imported everything from the.env file because, you know, what all information we actually required, right? Like the wallet URL, the OpenAI API key, and all, right? And then we have initialized all these things. So, I will just go ahead and execute. This is mainly about the packages. That's simple, you know?
Then, uh here you have load_dotenv.
You are requiring the.env file like DB users, DB password, DB DSN, wallet directory, wallet password. This all information is present in our.env file.
I'm just writing a condition that if those environments are missing, then we should basically raise an exception.
Otherwise, we will set up the wallet directory, what is the path, and then if not, all this information is there, right? So, this I've already shown you uh with respect to the setup, right? So, here you have DB user is equal to admin, DB_DSN is equal to Oracle Christian _high, and then you have this wallet, right? Wallet setup like what is the relative path, right? And as you all know that I have the wallet inside this particular wallet folder itself, right? This particular path.
Now, I will be connecting to the Oracle Autonomous Database. For connecting, what we really need to do is that need to go ahead and write os.getenv with respect to DB_user. So, we want the DB user as our user, then this is the password which we have already kept in our.env file. Then I also require this DSN, that is nothing but DB_DSN. This is already set up. The wallet directory, the wallet location, and the wallet password. This is all we have already set up, right? While we were doing the Autonomous Database setup, right?
Then what we are doing is that we are just writing if this particular code is there, that basically means the connection error will be coming up. If this code is there, this kind of error is actually there. Let's say that if the username and password is invalid, this is the code that it returns. If there is some other issues related to TNS names, that time, you know, the Oracle DB database error will come with this particular code, okay?
Then with connection.cursor as cursor, I'm just saying that select object from all the objects where object is equal to DB Cloud and object type just to see whether the connection is running right or not, okay? And this is basically giving all my DB version. So, I will go ahead and execute this, okay? So, here you can see version is 23.this, user admin, DBS Cloud AI available select AI ready, okay?
Now, this is the most important step. See, this all steps that we have discussed is a more about setup, how to do all those things, right? But now starts the main thing. How do we design the schema? The we are going to create four tables and load around 1750 rows of realistic synthetic data. Okay? This is what we are basically going to do over here.
And here you can see that we will be creating tables like customers, products, orders, order item, right? So, in customer will be having 200 rows.
We'll be filtering by age segment and all all these things are there. Products 50, orders 500, right? Time series data we'll try to also insert. And these are like more like a transactional data set, right? And then order items around 1500 orders and revenue calculation and all these things. This all data will be created by that particular library which is called as Faker, okay?
Now, first of all, what I will do, I will use the data definition language that is DDL. So, here is my customer.
Here you can be see that I'm using a SQL command only. And this we will try to execute with the help of Python, right?
Python cursor uh So, here you'll be able to see, right? In beforehand.
We have created uh connection.cursor, right? As car, right? So, this will basically have the access of the database itself, like connection of the database.
Then we are going to create a table of customers. Here I have ID, name, email, city, age, segment. So, again a SQL command.
Very simple to just to understand if you just have some knowledge related to SQL, then here you have primary key, not null, not null, unique, all these things. Then you have products, create table products.
So, here I have ID, name, category.
These all things are there. I'm also putting up which is the primary key and all, right? Then you have the order tables. I'm saying primary key and this is basically ID will be the foreign key over here and it is referencing this particular table. So, that's the reason it is written as not null reference customers ID, okay? Then you have order date, status, total amount. So, all these tables are there. Create table orders and create table order item. Here also two references will be used as a foreign key. One is order ID and one is product ID, right? And this particular ID is the primary key of this order item. So, this is just like a schema that we have specifically created so that we can go ahead and insert some kind of data. Okay?
So, here you can see definition drop underscore table if it exists. So, this particular function will be executed if that particular table exist, it will just go ahead and drop it and create a new one. Okay? With connection dot cursor as cursor, so I'm basically creating this entire table. Before that, we are just dropping it. Okay? Like if that particular table exists, so here you can see I've created the customers, created product, created created the order table, and created the order item.
Now, we will go ahead and generate and insert 200 customers plus 50 products using faker. Okay? Faker again, a good library to create some fake data set.
So, here I've created cities like New York, Los Angeles, Chicago, Austin, Phoenix, Philadelphia, San Antonio, San Diego, Dallas, and San Jose. Right? And segments I've basically used premium, standard, and budget. And I've Basically, I'm saying that, "Okay, realistic segment distribution, 20% is premium, 50% standard, and 30% budget."
Okay? And categories also I've created electronics, clothing, home garden, and all these things are there with some values over here. 80 500 15 120. Minimum to maximum, I guess it is. Okay? And here is my customer name rows, right?
So, this is name it will go ahead and generate in a fake way, email, cities, you know, and random int. Okay? So, any number between 18 to 75. So, these are some values we are putting in the customer rows. And finally, we are also creating this products information that is there. And finally, we insert this, right? By executing this cursor.execute many. So, if you're following my channel, I think I've explained all this. If you can also see my detailed SQL playlist, right? So, insert into customers name, email, city with all the specific values. Uh and then you'll be able to see Here, I put a customer rows, right? Customer rows is over here available.
And similarly over here, we are basically doing it for the products also. And finally, we print how many cities and how many uh customers has got added. So, if I go ahead and execute this, you'll be able to see inserted 200 customers across 10 cities, 50 products across five categories, right?
This is done.
So, my two tables, specifically for customers and products, is basically done. Now, we go to the next one, right?
Here, you can see start date, end date, right?
Uh statuses, and here you can see fetch customer ID and product ID we just inserted, okay?
So, it's just like select ID from customer order by ID, and here you can see select ID. We're just executing some of the things just to see things, right?
Uh so, let's say if you can also see that we are trying to insert various information over here.
We are creating the order table and the order items, right? And here we are generating some fake data again, okay?
So, this is this entire command code is basically used for creating data for orders and order items. So, if you just go ahead and explore this specific code, you should be able to understand it, okay?
Very simple, right? So, with connection.cursor as cur, I'm just taking out the uh reusable variable for returning info, then we are creating this customer ID random number, order date, everything, right?
So, this will take some amount of time because uh we are going to go ahead and uh add lot many records. And this is like 500 records, I guess, okay? So, here you can see inserted 500 orders and 1561 order items, okay? So, this is done.
Now, verify rows and counts checks the data date coverage. So, as you know that we are going to use from specific date frames time. So, if I go ahead and execute this, see.
Uh for T in this customers, products, orders, and order item, select count for this, and we are fetching one information, then again select minimum order date maximum order for where status is equal to completed. We're just trying to explore the data. So, here you can see customers is 200, products is 50, order items is 500, order items orders is 500 and order item is 1561.
You can see order date range, like from what date range to what date range it has been created. We are still in the data preparation stage right now.
And here you can see customer distribution by city in Los Angeles 30, Dallas Dallas 25, Houston 21, New York 20, Chicago 19, Phoenix everything is there. Okay.
Now this is done. Okay. Now the next step is that the application part which we are going to do. We are going to register an LLM provider inside Oracle via DBMS_CLOUD_AI. Okay.
Setup select AI requires two steps and this is where your select AI feature comes into picture. Okay. Step A is that it will store your LLM API key securely inside the Oracle using DBMS_CLOUD.CREATE credential. So in DBMS_CLOUD itself you have this dot credential. Whenever it is storing it is also making sure that it is encrypted. You can never retrieve it after storage. Perfect.
Second step is that profile. Register LLM provider model and the table you want to expose using DBMS_CLOUD_AI.CREATE_PROFILE.
This profile acts as an access controlled contract. Select AI can only query table you explicitly list. Okay.
And the active profile must be set up in this dot set profile. So here you'll be able to see I'm taking this open AI API key. If you have core you can also use that.
And here you'll be able to see use open AI boolean value, provider open AI cred name, cred user, cred cred password, model, profile name, everything is set up, right? Initially if there is any credential we can also go ahead and drop it. Okay. Then we go ahead and set it up. So we say create credential, credential name with the respect to all these particular value and username password, whatever things we require.
So this is the first thing that you really need to do, right? And here you can see credential open AI cred created, provider open AI model GPT everything is away mentioned and we are basically setting it up right.
Now, create the DBMS cloud AI profile.
Okay, so for that we will be getting the admin information from the your like we'll be using this DB user get ENV from the environment variable along with that we will be creating some of the important information like provider credential name DB owner name customers products orders order item and finally you can see we have to if initially we go ahead and drop it and again we go ahead and create a new profile right with the profile names at all. So this is the initial setup guys.
Okay, a very good documentation of open AI is basically given for this particular setup. Okay, so here it is done. And finally you'll be also able to see that we activate the profile for this particular session.
We go ahead and do this. We go ahead and execute it. So this all set up I have actually mentioned in the initial steps so that you will be able to see that whatever is your requirement based on your profile you will be able to select it.
Now we will go ahead and do the live demo. The force select AI models. Okay.
So here we are creating one helper function which is called as run select AI. Okay, it executes a select AI query against the Oracle 26 AI database. Okay, parameter it takes up this particular question. It takes the model and returns you an output. Okay.
pd.data frame So here you can see model name if mod if models and select AI this all SQL command is there. With connection as cursor you'll be able to see that we go ahead and execute this.
Okay. So if I go ahead and execute it you will be able to see this. Okay. So this is just like an helper function which is basically taking a question and a model and it is basically giving an output of pd.data frame. Okay.
Now let's go ahead and ask this this question. What were the top five products by the total revenue from completed orders? And this is my DF1.
This is basically my data frame. Second question is that first is the revenue analysis that I'm actually doing. Second is the customer activity test date arithmetic plus having clauses. And third is like regional breakdown. So this is the plain English that we have given.
What were the top five products by total revenue from completed orders? Which customers have not placed any order in the last 90 days? Show me the total sales amount grouped by city for completed orders in 2026.
I will go ahead and execute it.
So what are the top products? You'll be able to see that now this function is basically getting called, right?
If mode in show SQL narrate and chat, it will just try to you know, probably take this in this particular mode, okay?
And here you'll be able to see. See, what are the top five products? And here is the entire data frame answers that we are basically going. Now what this has basically done is that we have given a plain text. A SQL has got converted SQL uh the text is basically converted into a SQL query.
Because the LLM provider only has the information about the schema and it has actually converted that into a SQL query and finally the execution has happened and you have got a response, right? So then which customers have not placed any order in the last 90 days? So these are all the customers. You can see all the information. Show me the total sales amount grouped by cities. A very good SQL command is basically created and this is how it is executed. Now you may also want to probably go ahead and see the SQL, okay? See the generated SQL. So what we will do uh here you can see that we have given three parameters, right?
See.
Uh if you see inside this running AI, we are saying that there is show SQL, narrate and chat.
If it is a chat, it is directly going to give you the answer. If it is show SQL, we also want to probably go ahead and generate that raw data, okay?
So here you will be able to see that.
Now I'll go ahead and execute it and I've given that particular flag that is nothing but show sequel.
Now you see how detailed, how beautifully the entire sequel command is basically created.
Isn't it just amazing? Here we are just using the LLMs, but Oracle 26ai database is doing an amazing work over here, right? Uh just with the help of schemas and all, you're able to generate this. And finally, the execution will also happen. See? The entire sequel command.
How And this is just not a simple sequel. This is like nested sequel things, right?
There is also one more mode. Uh the first mode uh that we saw, the second mode was about show sequel. The third mode that you'll be able to see is something about narrate. Business insights as plain English, right?
If I want to probably just go ahead and let's see what will happen with respect to this narrate, okay?
Instead of returning a table, narrate returns a human-readable para- paragraph summarizing the data, okay?
So here you can see, generated total sales of this. This response is also quite amazing. And for different business use case users, right? The kind of response will probably get you a lot of things. So if you see the before code that we had written over here, right?
Okay?
See, over here what we had written.
If mode in so and so, right? We get all the raw this results, and then we are printing everything, right?
If not rows, then we are printing like this, right? So here, based on this modes, we are trying to get out more information over here, right?
And this is one type of response that we got. The second response was with respect to the sequel command. The third response, uh business insights as plain English, right? Whatever information I'm asking, summarize total sales by this and this, we are able to get this information.
Electronics generated fossil sales of approximately [snorts] 74937. Just imagine how beautiful this will be if you are actually And just if you connect this into any kind of dashboard, you get all those kind of information right, over there.
Then here also you can see standard customer segment is generating the highest revenue.
Then there is a 93 pending orders. All these things are there, right? One more mode is something called as chat. In chat, you will be able to have a day conversational data exploration. It enables free from multi-turn conversation grounded in your live database. User can ask follow-up question. And this is also available out there. Right? So, let's say with respect to chat. These are all the features that is already provided by the Oracle 26 AI database select AI feature.
See, what can you tell me about the customer database?
I'm sorry, I don't have access. Okay, this is not being able to Which city city has the highest number of premium segment customers? To accurately answer which city has the specific data from a particular industry or company is required. This information is not there. What is the average value for those customers? You'll be able to see that. To calculate the average values, this is all formulas is basically mentioned. Isn't this just amazing?
Right?
So, just go ahead and try it out, guys. This was more about these things. And I've never seen so accurate text-to-SQL application. But after using Oracle to AI 26 database 26 AI, the select AI feature, and as you see, right? If I If you probably just go ahead and explore, why do we specifically use this select AI feature?
Right?
So, here you can see, right? I've written in select AI question. Executes the generated SQL. Returns a data table.
Show SQL.
Select AI show SQL shows the generated SQL without executing it. Narrate is one of the feature that is available.
Returns a plain English business summary. Chat is one of the features.
Select AI chat free form of conversational mode with context retention. Right? So, just try to use this. And I think this is one amazing feature that is available in Oracle 26 database, right? AI database.
So, I hope you like this particular video. This was it from my side. I'll see you in the next video. Thank you.
Have a great day. Bye-bye. Take care.
Related Videos
OpenHuman VS Hermes AI: Who Wins?
JulianGoldieSEO
285 viewsā¢2026-05-29
Long-Running Agents ā Build an Agent That Never Forgets with Google ADK
suryakunju
142 viewsā¢2026-05-30
This computer is made from real human brain cells. And you can buy it.
Talktmsmedia
3K viewsā¢2026-05-28
BREAKING: Microsoftās New Image Generating Model Beat Out GPT 1.5 and Nano Banana 2
aimmediahouse
122 viewsā¢2026-06-03
I Made the Same Anime Fight Scene in Every AI Video Generator
NobleGooseAnime
295 viewsā¢2026-05-30
Nvidia Bets Big On AI PCs | New Chip To Power Windows Laptops | Technology | AI Updates | N18S
cnnnews18
3K viewsā¢2026-06-01
I Tested NEW Opus 4.8 on Four Projects (Updated LLM Leaderboard)
AICodingDaily
298 viewsā¢2026-05-29
3D Platformer Update - NO CAPES
SolarLune
294 viewsā¢2026-05-30











