Hello friends, today I will show you a demo on how Chart GPT helps in adding a new column to an existing table and calculating the age.
My requirement is divided into three parts. First, I want to create a table named ‘Indian Players’ for those who played the final match against West Indies in 1983. The table should have columns for ID, name, and DOB.
After creating the table, I asked Chart GPT to add another column called ‘Edge’ to the existing Indian Players table and calculate the player’s age. Finally, I created an insert command to insert the records.
To do this, I copied the entire statement and pasted it into the Chart GPT interface. I clicked the submit button, and the table was created with the name ‘Indian Players’ and the required columns. The data was also inserted into the table.
Next, I added the ‘Edge’ column to the table and calculated the age using the ALTER TABLE command. The age was calculated based on the timestamp difference between the player’s DOB and the current date. The updated table displayed the calculated ages.
In this way, we can use Chart GPT to not only create tables but also alter them and update columns. This is just one example of how Chart GPT can be used effectively in SQL.
Thank you for watching the video!