Data Entry in SQL

Written by

Soumya Shaw

Let us fill up some data into tables so that we can put up some operations on them so as to know the actual implications of each.

Example 1:

Let’s jump into the first table named, ‘country’. For this table, we need Serial No as int, State Name as varchar, Capital Name as varchar, Government Name as varchar and Population as int.

INSERT INTO country (
sr_no,state,capital,govt,population)
VALUES (
1,” Andhra Pradesh”,” Hyderabad”,”TDP”, 53612000);
INSERT INTO country (
sr_no,state,capital,govt,population)
VALUES (
2,” Arunachal Pradesh”,” Itanagar”,” BJP”, 1511000);
INSERT INTO country (
sr_no,state,capital,govt,population)
VALUES (
3,” Assam”,” Dispur”,” BJP”, 32652000);

Set of 3 Data that will produce the following output upon insertion.

Here is the Full list ( country )

Example 2:

Our, next table is a store which has the parameters as:
Product Number as int, Product Name as varchar, Price as int, Damage as varchar, quantity as int and the full list is (store)

INSERT INTO store (
product,name,price,mfd,damage,quantity)
VALUES (
2365,”Books”,368,”2016-05-26”,”No”,67);
INSERT INTO store (
product,name,price,mfd,exp,damage,quantity)
VALUES (
3654,”Cereals”,125,” 2018-07-30”,” 2019-03-02”,”No”,49);

And hence the output is…

Example 3:

Railways is the next table coming up… It has Train Number as int, Train Name as varchar, Source Station as varchar, Destination Station as varchar, Average Delay as int and Cost per KM as int. Full list is attached as (railways)

INSERT INTO railways (
Train_no,train_name,source_stn,destination_stn,avg_delay,costperkm)
VALUES (
12961,”Avantika Express”,”MMCT”,”INDB”,2,76);
INSERT INTO railways (
Train_no,train_name,source_stn,destination_stn,avg_delay,costperkm)
VALUES (
12785,”Bangalore Express”,”KCG”,”SBC”,1,76);

The output is shown below:

Example 4:

The next table we will enter is school It has Roll Number as int, DOB as date, Marks as int, Grade as char, Mobile as bigint and State as varchar. (school) is the available full list

INSERT INTO school (
roll,name,dob,marks,grade,mobile,state)
VALUES (
1,”Akash”,”1999-03-19”,68,”C”,9654765126,”Uttar Paradesh”);
INSERT INTO school (
roll,name,dob,marks,grade,mobile,state)
VALUES (
2,”Bagha”,”1999-12-25”,88,”A”,7889456712,”Gujarat”);

It will show a similar output:

Example 5:

Our Next table is air_force and It has Service Number as int, Name as varchar, Rank as varchar, Salary as int, Unit as varchar and Serving Time as int. Full list is available as (air_force)

INSERT INTO air_force (
service_no,name,ranks,salary,unit,serving_time)
VALUES (
604635,”Ashok”,”MWO”,60000,”3BRD”,48);
INSERT INTO air_force (
service_no,name,ranks,salary,unit,serving_time)
VALUES (
703458,”Bishu”,”JWO”, 40000,”SU”,36);

What it will show is…

Hence, our part of Data Entry is over and we are ready to enter the zone where we may play with the data and extract them out the way we want.

Data Entry in SQL