Hey Guys, hope you’re good.
Today, we’ll be talking about INSERT statements in SQL. Its a very simple and easy to grasp concept so no need to worry. Even if you’re confused or you dont get it, you can always comment below.
So, let’s get started without any further delay.
Use Of INSERT In SQL
The INSERT statement in SQL is used to add new rows of data into a table. It is one of the fundamental Data Manipulation Language (DML) operations. Like I said its a very simple concept and I’ll demonstrate it below with our video games dataset.
I added a new game in the table called ‘My Game 1’ and it has been added to the end of my rows aka a new row has been created. So this is how INSERT works. If you need to only add values in a few columns you can use the code below
insert into video_games (column1, column2)
values (value1, value2)
If you want to add multiple rows to the same column here’s how you do it
insert into video_games (column1)
values (value1), (value2), (value3)
This will add 3 more rows to your column1
Thats it for INSERT. This is ofcoure the basic functionality of an INSERT statement, you can also use it in other forms which you can learn with time, no need to rush.
Exercise
Load the Hospital Records Dataset
Add a new patient in the record with full details of the patient.
Its upto you whether you want to comment your output or not since I’ve been asking you guys to comment but I’ve seen no comments so upto you.
I am a BI Engineer working at a Data And AI Firm. I’m trying to help newbies in Data land their first data job and impact as many fellow data professionals as I can. Here’s my contact info:
ajmal7809@gmail.com
bideveloper_ (Discord)