Photo by DeepMind on Unsplash

SQL Queries and Google BARD. Is Bard better than Chat GPT?

Arun Raj

--

Google Bard is now able to code for you. I tested Bard by asking few questions on Oracle SQL. I wanted to know if Bard is capable of providing accurate answers. I have done a similar exercise with Chat GPT and that was an amazing experience. You can read more about my experiments with Chat GPT here and here.

DDL Statements

Just like I tried with Chat GPT, I decided to try few DDL Statements first. Question 1: Write a SQL query to delete a table called AP_INVOICES

The SQL query is accurate and there is explanation of the query and example of how to delete some of the data from the table. When I tried the same with Chat GPT it reminded me of the “CASCADE” option to delete foreign key constraints and then delete the table.

Next, I asked Bard my 2nd question.
Question 2: Write a sql query to alter the table ap_invoives and add a primary key called ap_invoice_id_pk on column invoice_id

The SQL query was correct. However, the explanation was completely wrong. In the explanation Bard says that the query adds a new column that will become the Primary Key for the table which is not true. The query adds a constraint. And INVOICE_ID column is the primary key.

For the similar question, Chat GPT gave me the correct query and the accurate explanation.

DML Statements

Next, I wanted to try few DML statements.

Question 3: Write a Oracle sql query to convert SYSDATE to MM/DD/YYY format.

The SQL query response is correct. However, I had to specify “Oracle SQL” in the prompt. And I didn’t like the Alias provided for the column!!

--

--

Arun Raj

Mostly write about Oracle Cloud ERP and EPM related Topics. Interested about emerging AI technologies, Python and Low Code Tools