Introduction to Gemini
Gemini's intro. In the beginning, there was Bard. A powerful language model, crafted by Google AI, it brought forth a new era of communication and understanding. Bard, with its vast knowledge and ability to process information, became a beacon of progress.
But as time unfolded and the needs of the digital world evolved, Google AI embarked on a new creation. From the foundation laid by Bard, a new entity arose: Gemini. Like a twin born from the same source, Gemini embodies the essence of Bard while pushing the boundaries of what a language model can achieve.
In this article, we will explain this new assistant and what new things you can do with it.
What happened with Bard?
Bard after some tests was released in March 2023. Compared with Bard, it was dumber, but it had a lot of potential. It was faster than ChatGPT and it was free. You do not need to pay to get current information (however there is a paid version with more features).
However, as always, the systems need to evolve and Bard was not the exception. Gemini raised and offers more advanced services.
What is new in Gemini?
- It provides a deeper understanding of the instructions. It can understand more effectively our human reasoning and orders.
- Also, it can help to create more complex code. In the past, Bard created simple code with a lot of errors.
- It provides more customized services. It understands your needs and helps you according to them.
- Now Gemini can be integrated with Gmail, Google Docs and Sheets, and YouTube.
Some examples of Gemini improvements
Let's talk about an example in T-SQL to have an idea about the improvements. Let's say that we want to find out all the customers who have an order in the previous month and spent more than 1000 dollars in total. The Bard may create a query like this one:
SELECT * FROM Customers WHERE CustomerName LIKE '%Smith%'
In Gemini, the T-SQL code may be like this one:
In Gemini, the T-SQL code may be like this one: SELECT CustomerID, CustomerName FROM Customers WHERE CustomerName LIKE '%Smith%';
As you can see, the query is enhanced to include only the necessary columns to improve performance.
More details of JOINs
Now, the type of join is specified. This is a Bard's code:
Now, the type of join is specified. This is a Bard's code: SELECT c.CustomerID, c.CustomerName, SUM(o.Amount) AS TotalSpent FROM Customers c INNER JOIN Orders o ON c.CustomerID = o.CustomerID WHERE o.OrderDate >= DATEADD(day, -1, MONTH(GETDATE())) AND SUM(o.Amount) > 1000 GROUP BY c.CustomerID, c.CustomerName;
In Gemini, we would specify the INNER JOIN to improve clarity and readability:
In Gemini, we would specify the INNER JOIN to improve clarity and readability: SELECT c.CustomerID, c.CustomerName, SUM(o.Amount) AS TotalSpent FROM Customers c INNER JOIN Orders o ON c.CustomerID = o.CustomerID WHERE o.OrderDate >= DATEADD(day, -1, MONTH(GETDATE())) AND SUM(o.Amount) > 1000 GROUP BY c.CustomerID, c.CustomerName;
Handling date and time in Gemini
In Bard we usually worked with strings as dates:
SELECT c.CustomerID, c.CustomerName WHERE OrderDate > '2024-05-21'
In Gemini, the dates uses date functions instead. This allows to create more dynamic queries.
SELECT c.CustomerID, c.CustomerName WHERE OrderDate > DATEADD(year, -1, GETDATE())
Improve performance
Gemini also improves the performance of the queries. Let's take a look to an example. Let's say that we have this code in Bard:
SELECT * FROM Users WHERE IsActive = 1 AND LastLoginDate < GETDATE() - 30;
Gemini will try to improve the code with something like this:
Gemini will try to improve the code with something like this: SELECT UserID, Username FROM Users WHERE IsActive = 1 AND LastLoginDate IS NULL OR LastLoginDate < DATEADD(day, -30, GETDATE());
As you can see, the * is removed with the actual and necessary columns. In addition, we are considering NULL values in the LasLoginDate colulumn.
We are also using the DATEADD to clear the way to specify a date range.
Avoid injection with Gemini
The new Gemini tries to avoid injections. For example, let's say that we have the following code:
SELECT * FROM Users WHERE Username = '` + username + `' AND Password = '` + password + '` ;
This code could easily be injected with malicious statements and a malicius user could delete or tables or databases if the account has permissions.
For more information about injections refer to this link:
To avoid this problem, Gemini would use the following code:
DECLARE @username NVARCHAR(50), @password NVARCHAR(50); SET @username = ?; SET @password = ?; SELECT * FROM Users WHERE Username = @username AND Password = @password;
Tailored Code with Gemini
Let's say that we have the following code:
SELECT * FROM Products WHERE ProductName LIKE '%` + keyword + `%';
In Gemini, we will use a varible that includes the Wildcards. This code is easier to understand and read. It will also prevent injections.
In Gemini, we will use a varible that includes the Wildcards. This code is easier to understand and read. It will also prevent injections. DECLARE @keyword NVARCHAR(50); SET @keyword = '%' + ? + '%'; SELECT ProductID, ProductName FROM Products WHERE ProductName LIKE @keyword;
Gemini integration with Google Maps
To use Gemini, you will need a Google account. Go to Gemini register and then you may have a Settings option.
You can integrate your Google tools with Gemini. To do that, you need to go to Settings>Extensions.
You can enable the Extensions that you want.
Working with Google Maps in Gemini
Let’s work with Google Maps first.
Me: I have a meeting with a software company named Digital Harbor in my city. Can you show me where is it?
Google Maps: Sure! I found a Digital Harbor in Cochabamba, Bolivia at Av Salamanca 985. It has a 4.2 star rating on Google Maps. Their hours are Monday-Thursday 8AM-6PM, Friday 8AM-6:30PM, and closed Saturday and Sunday.
Maps
Me:
I have a DBA conference in Santa Cruz. How long will it take me to get there driving and would you recommend a good restaurant on the way?
Google Maps:
I couldn't find directions using Google Maps, but according to a web search it should take approximately 6 hours 10 minutes to get from Bolivia to Santa Cruz by car.
As for restaurants on the way, I can't search along routes yet, but I can recommend some restaurants in Santa Cruz once you get there. How about we find some restaurants in Santa Cruz?
Me: OK, go ahead.
Get restaurants in Gemini
Here are some highly-rated restaurants in Santa Cruz that you might enjoy, depending on what kind of food you're in the mood for:
- El Aljibe Comida Típica: This restaurant is a great place to try traditional Bolivian food. They have a large menu with everything from salteñas (savory pastries) to silpancho (a dish made with beef, rice, and fried eggs). They have very positive reviews online, with a Google rating of 4.6 stars out of over 2300 reviews
Opens in a new windowwww.elaljibecomidatipica.com
El Aljibe Comida Típica Santa Cruz restaurant
- Restaurante El Arriero: If you're looking for a steakhouse, El Arriero is a great option. They serve Bolivian steaks, seafood, and wine in a warm atmosphere. They also have a very high Google rating of 4.6 stars out of over 4000 reviews
Opens in a new windowwww.tripadvisor.com
Restaurante El Arriero Santa Cruz restaurant
- Jardín de Asia: This restaurant serves a variety of Asian dishes, including sushi, Thai curries, and Vietnamese pho. It gets positive reviews for its nice atmosphere and service, though some reviewers say it can be a bit loud at times
Opens in a new windowwww.tripadvisor.es
Jardín de Asia Santa Cruz restaurant
Working with YouTube in Gemini
Me: Can you send me some videos about the new features of SQL Server 2022?
YouTube:
Here are some videos about the new features of SQL Server 2022 on YouTube:
- What's new feature SQL Server 2022 by Vikash DBA (RDMS tutorial)-SQL GUIDE
- SQL Server 2022 New Features || SQL Server 2022 || SQL Server New Features || SQL Server Performance by Tech and Art
- New T-SQL Features of SQL Server 2022 by Ravishanker Muniasamy
- SQL Server 2022 New Features | SQL Server 2022 || SQL Server 2022 Download || SQL Server 2022 add on by Tech and Art
- SQL 2022 Tutorials | New Features of SQL 2022 | What's new in SQL 2022 | sql 2022 new features by Training2SQL MSBI
I hope these videos help you learn more about the new features of SQL Server 2022!
YouTube
New features of SQL Server 2022
What's new feature SQL Server 2022Vikash DBA (RDMS tutorial)-SQL GUIDEOpens in a new window
What's new in SQL Server 2022 (16.x) What's new feature SQL Server 2022 (16.x) T-SQL Enhancements in SQL Server 2022 This ...Opens in a new window
SQL Server 2022 New Features || SQL Server 2022 || SQL Server New Features || SQL Server PerformanceTech and ArtOpens in a new window
QUERY LINK:- https://drive.google.com/drive/folders/1tBZSoBeKOMR5b4uMSKipE8ops0AjxzTN?usp=share_link Hi Mate, ...Opens in a new window
New T-SQL Features of SQL Server 2022Ravishanker MuniasamyOpens in a new window
This video will give you the details of T-SQL Features that are being introduced in SQL Server 2022 New Features are, ...Opens in a new window
SQL Server 2022 New Features | SQL Server 2022 || SQL Server 2022 Download || SQL Server 2022 add onTech and ArtOpens in a new window
QUERY LINK:- https://drive.google.com/drive/folders/1tBZSoBeKOMR5b4uMSKipE8ops0AjxzTN?usp=share_link Hi Mate, ...Opens in a new window
SQL 2022 Tutorials | New Features of SQL 2022 | What's new in SQL 2022 | sql 2022 new featuresTraining2SQL MSBIOpens in a new window
This video talks about New Features of SQL 2022 Whats new in SQL 2022 What's new feature SQL Server 2022 a.Opens in a new window
View related videos on YouTubeOpens in a new window YouTube video views will be stored in your YouTube History, and your data will be stored and used by YouTube according to its Terms of Service
Summarize YouTube videos
Me: Could you summarize this video?
http://www.youtube.com/watch?v=16CMSkO6MUY
Youtube: This video is about new features in SQL Server 2022.
The new features include:
- T-SQL enhancements:
- Temporal functions:
- Date bucket function: This function returns the date time value corresponding to the start of each date/time period.
- Generate series function: This function generates a series of numbers within a given interval.
- First value function: This function returns the first value in an ordered set of values.
- Last value function: This function returns the last value in an ordered set of values.
- Greatest function: This function returns the maximum value from a list of one or more expressions.
- Least function: This function returns the minimum value from a list of one or more expressions.
- String split function: This function splits a string into a row of substrings.
- Temporal functions:
- Pausing and resuming ALTER TABLE statements: This new feature allows you to pause and resume ALTER TABLE statements.
- CREATE STATISTICS with AUTO DROP option: This new feature allows you to create statistics with an option to automatically drop them when they are no longer needed.
- SELECT window clause with FETCH clause: This new feature allows you to specify how many rows to fetch from a window clause.
I hope this is helpful!
Checking Gmail in Gemini
Gemini can also access your emails. Here is a demo:
Me: Can You show me my last email from Steve Jones?
Google Workspace:
The last email from Steve Jones was an automatic reply sent on Friday, March 8, 2024, at 12:07 PM. In the email, Steve says responses may be delayed and to contact the webmaster for urgent issues.
Conclusion
As you can see, Gemini is integrated with Gmail. It is a great copilot competitor. Both will help us as AI assistants. I guess that we will use them both and they will be in permanent evolution.