Inserting multiple row using single query || Add new column|| update data|| drop||Part-3||PostgreSQL

Published: 19 July 2021
on channel: Ravi's content
72
5

--Create a table
create table classes(id int primary key,
name text not null,
email text not null);


--insert data into table
insert into classes values(1,'Ravi','ravi@gmail.com');
insert into classes values(2,'Raj','raj@gmail.com');
insert into classes values(3,'Rahul','rahul@gmail.com');
insert into classes values(4,'Rohan','rohan@gmail.com');


--multiple insertion in a single line
insert into classes (id,name,email) values (1,'Ravi','ravi@gmail.com'),
(2,'Raj','raj@gmail.com'),
(3,'Rahul','rahul@gmail.com'),
(4,'Rohan','rohan@gmail.com') ;


select * from classes;


--let's add a new column
alter table classes
add column marks float ;


--updating the data
update classes set marks=70 where id=1;
update classes set marks=70 where id=2;


--multiple update
update classes set marks=70 where id=1 or id=2;


--print the data inside the table
select * from classes;


--dropping table
drop table classes;


On this page of the site you can watch the video online Inserting multiple row using single query || Add new column|| update data|| drop||Part-3||PostgreSQL with a duration of hours minute second in good quality, which was uploaded by the user Ravi's content 19 July 2021, share the link with friends and acquaintances, this video has already been watched 72 times on youtube and it was liked by 5 viewers. Enjoy your viewing!