INSERT UPDATE, DELETE & ALTER Table in SQL With Example | SQL Tutorial in Hindi 4
HTML-код
- Опубликовано: 9 июл 2024
- SQL Full Course Playlist 👇
• SQL Tutorial In Hindi
Timestamps:
00:00 Topics
00:04 Insert Into Concept
00:28 Insert Into Example
01:38 Update Table Concept
02:12 Update Table Example
02:55 Delete Values Concept
03:11 Delete Values Example
03:41 Alter Table Concept
04:37 Drop & Truncate Table Concept
05:01 Drop & Truncate Table Example
Like, Share, Subscribe :)
➖➖➖➖➖➖➖➖➖➖➖➖➖
Queries used:
👉 Customer Table
🔖 Create table
CREATE TABLE customer
(
CustID int PRIMARY KEY,
CustName varchar(50) NOT NULL,
Age int NOT NULL,
City char(50),
Salary numeric );
🔖 Insert values in table
INSERT INTO customer (CustID, CustName, Age, City, Salary)
VALUES
(1, 'sam', 26, 'Delhi', 9008),
(2, 'Ram', 19, 'Bangalore', 11000),
(3, 'Pam', 31, 'Mumbai', 6060),
(4, 'Sam', 42, 'Pune', 10000);
🔖 Update values in table
UPDATE customer
SET CustName = 'Xam' , Age = 32
WHERE CustID = 4
👉 Classroom Table
CREATE TABLE classroom (
rollno int8 PRIMARY KEY,
name varchar(50) NOT NULL,
house char(12) NOT NULL,
grade char(1) );
INSERT INTO classroom (rollno, name, house, grade)
VALUES
(1, 'Sam', 'Akash', 'B'),
(2, 'Ram', 'Agni', 'A'),
(3, 'Shyam', 'Jal', 'B'),
(4, 'Sundar', 'Agni', 'A'),
(5, 'Ram', 'Yayu', 'B');
➖➖➖➖➖➖➖➖➖➖➖➖➖
Related Videos
Introduction to SQL - What Is SQL + Database | SQL Tutorial In Hindi - 1
• What Is SQL ? | Databa...
Data Types, Primary-Foreign Keys & Constraints in SQL | SQL Tutorial In Hindi - 2
• Data Types, Primary-Fo...
Create Table In SQL & Create Database | SQL Tutorial In Hindi - 3
• Create Table In SQL & ...
➖➖➖➖➖➖➖➖➖➖➖➖➖
Connect on other Social Media handles:
Instagram: / rishabhnmishra
LinkedIn: / rishabhnmishra
Twitter: / rishabhnmishra
➖➖➖➖➖➖➖➖➖➖➖➖➖
If this is the first ever video you're watching allow me to introduce myself, Hey I'm Rishabh Mishra and currently working as Senior Data Analyst at Bangalore. On this channel I like to guide and help my juniors and data science aspirants regarding Data Science jobs and useful tips for college students.
Have a great day buddy!
Anyone facing issue in INSERT value query, below is updated query:
👉Customer Table
🔖Create table
CREATE TABLE customer
(
CustID int PRIMARY KEY,
CustName varchar(50) NOT NULL,
Age int NOT NULL,
City char(50),
Salary numeric );
🔖Insert values in table
INSERT INTO customer (CustID, CustName, Age, City, Salary)
VALUES
(1, 'sam', 26, 'Delhi', 9008),
(2, 'Ram', 19, 'Bangalore', 11000),
(3, 'Pam', 31, 'Mumbai', 6060),
(4, 'Sam', 42, 'Pune', 10000);
🔖Update values in table
UPDATE customer
SET CustName = 'Xam' , Age = 32
WHERE CustID = 4
sir can you please pin SQL notes pdf, i would be grateful, if you do 😇
Thank u sir...... Mai to udemy zada apka videos dhekta hu.... It's help me a lot.
Mere se to program run hi nhi hora
bhai, how to change existing tables column name . i'm not able to do that . please help bhai.
Which values should be in " " and which are not ??
bohot achhe tadhike ke samjh gaya. Thank You Bhaiya!
great classssss thank u so much
For alter method i noticed some changes may be due to new version .
1. for creating new column :- ALTER TABLE customer ADD COLUMN "NewColumn" char;
2.for changing data type:- -- ALTER TABLE customer ALTER COLUMN "NewColumn" TYPE numeric USING "NewColumn"::numeric;
Please check it Rishabh.
thanks
thank you
Thank You Boss
Bahut badhiya sir thank you sir🙏🙏🙏
The way you replied to 95% of all comments is really appreciable..❤️❤️.
Happy to help ✅️
So Great full for this free course seriously am learning, happy.
In short time you covered many topics❤❤❤
Glad you liked it ✨️
Great sir and teach easily i watch your all vedios and learning mush more from You ..God bless u
Glad it was helpful ✅️
Thanks..!!
Great wounderful ❤❤💗💓💓💓😎
very nice teaching sir,and very helpful information in easy language .thank you so much😊
Glad you liked ✅️
Nice Rishav such a good technic, everybody should be follow this
Glad you liked it ✅️
You are doing a great job. Please upload all the videos ASAP.
Thanks
Hi Raj, I'm glad you liked this course. Now i will try to post the video on daily basis at around 10AM
@@RishabhMishraOfficial Thanks Rishabh, Your efforts are highly appreciated! Keep up the good work 👍
Rishabh I am facing issues while using ALTER COLUMN could you please help me out for the correct syntax
Worthfull video
Thanks
Glad you liked it ✅️
Thanks
Very Nice sir I have all the questions solved 😊😊
Thank you so much ❤️🥰
Great 👍
Too too much great brother ❤❤
🙌
great bhaiya
Glad you liked it 👍
Sir ek question hai , is column field name is case sensitive while writing query ya as it is same style mai column field likhna hoga
Thanks for this tutorial !
Glad it was helpful! ✅️
Sir my all confusion clear in one vedio ❤❤
Glad it was helpful 😌
Nice Video
Very helpful content
Glad it was helpful ✅️
Thanks Sir.
while trying to insert values,I was getting syntax error.
So i had to add double quetes and modfy the codes as shown below.
INSERT INTO customer1
("Custid", "Name", "Age", "City", "Salary")
VALUES
(1, 'Sam', 26, 'Delhi', 9000),
(2, 'Vim', 46, 'keral', 12000),
(3, 'Dam', 21, 'banglor', 8000),
(4, 'Fam', 24, 'katak', 70004);
INSERT INTO public.customer(
"ID", "Name", "Age", city, "Salary")
VALUES (1, 'Sam', 25, 'Nagpur', 25000);
Thanks buddy it helped me as well
Hello, Thanks for your easy explanations. I have a few doubts:
1. Can I use Truncate to delete the values in a particular column? Or is there any particular command for that?
2. How to rearrange columns?
3. Also, is it suggested to write the drop command to delete the table - we can also right click and delete the table from the Tables section. Please suggest
I am facing issue with 1064 error code while using the syntax and i am unable to execute my intsert into command please help me
nice and help full
Glad you liked ✅️
pls make videos on database also good explanation
After using the Alter/drop column, I am unable to add values in the new column which is created using the Alter/ add column. I put 1,1 single values using an update command in the table, how to do it in one go?
Thank you so much ❤️❤️
Glad you liked ✅️
It's very helpful
Glad it helped ✅️
Alter table customer
ALTER COLUMN "CustName" varchar;
I have written this in query. I was trying to alter the column datatype from char to varchar but its not working. Can you help me in that. Although it's not required but i was experimenting with ALTER column. It's showing..
ERROR: syntax error at or near "table"
LINE 2: Alter table customer
^
SQL state: 42601
Character: 3
the same happened in my case, did you get any solution for that ?
lots of helpful videos
Glad you like them! 👍
thanks brother :)
Glad you liked ✅️
You are God!🙏
hi bro the way ur really very nice and ur patience really appreciating ur dedication. bro which ur main topics it is useful to data analytics role. can you tel me it will to useful to my course thank you
Glad you liked it ✅️ all are important
Yeah I have doubt about alter table modify I can't able to change the data type in existing table
@RishabhMishraOfficial DATA TYPE alter me syntax error aarha hai : ALTER TABLE customer ALTER COLUMN city VARCHAR(50) {from char(50) to varchar(50)}
But help hue ..love you bro. But easy ha data base.
Hi i need full SQL course, your teaching skill is Awesome
It's already uploaded on this channel
@@RishabhMishraOfficial Can you please make a complete data science course? You are a great teacher and i am sure that many people are going to buy your course if you build one.
Uske baad tum kahogey ki ek makan kese kharidna hai uska bhi pura course upload kardo😂
No doubts ap ache pdte ho but apko pura details mai playlist bna chahiye SQL deeply
i understand sir
Sir try kro thoda or Details mai Btao kuch steps aap Explain hi nai Krte , please
Very easy way of your teaching Rishabh ji it would be more better if had included alter too....but thank you so much
Glad you liked it ✅️
When you use alter table for add column than you define the data type also in this slide that is not written so that you may got error
While updating the value, updated value (SET CustName = 'Xam' , Age = 32
WHERE CustID = 4) is appearing at the end of the table, instead of appearing after cusID 3.
What to do?
Pls check pinned comment
Hello sir
Sir I have a doubt sir when I punch insert into after filling all query
I got notification that column"id" of relation customer does not exist sir what does it mean
I also Face this issue
sir i am getting problem in changing datatype . i have follow full syntax from video and from w3school . please help me
helpful
Glad you liked it ✅️
I am trying to add data to table but it is showing syntax error but I did exactly as you instructed. Can you help ?
What is the difference between DROP, DELETE and TRUNCATE if they can be used for same operations?
Drop table is used to delete the entire table from data base.
Delete is used to delete the existing record from tables.
Truncate is used to delete the data present in the table but not delete the whole table.
Thanks me later ....🤗
Hi Rishabh please let me know when to use single or double quotes in sql while writing syntax because when I run the query without using quotes it gives error ' badak jata hai mere pay wo 😂 ' but use execute your query without using quotes how ?
Hi
If I need to delete specifically first 10 records or 100 records
Could u plz tell the process
Hi i have seen a lot of your videos today .. Can u make a vid from where we can do free and paid data analyst courses ... And can u please share your first salary as a data analyst for our motivation . Subscribed your channel and will be waiting for your vid. 🥰
hello sir i was working in modify column syntax is creating an error
maine ek database bnaya, uss mein data insert kiya data mein 5 column hai with 10 rows, agr maine 5th row ke data mein city update kar rha hoon toh wo row apni position kyun change kr rhin hai? But agr main last rows main update kr rha hoon to wo same position pe hai. please help kre
Hi Rishabh, while writing the query i always have to mention the column name within quotation marks..why so???
I have Questions i have created new colums name as City in Table, Now I put that City Column Next name how will I do it.
PostgreSQL folds all names of tables to lower case unless they're "double quoted". How is your query running ?
Can we use 'in' operator in update statement instead of where ?
When I write a query for "INSERT INTO", in query 2 I wrote same name as mentioned in a column in a table, instead of that I am not able to run a query it is showing error (id doesn't exist in customer table name). 1:15
Please explain how to do alter table, drop table because it is my first time learning SQL so please help me sir
What is the different between DELETE FROM table_name and TRUNCATE TABLE table_name?
Sir, I was trying to change the datatype of the column using ALTER TABLE ALTER COLUMN command, but its showing me the error, can you please elaborate on this?
ERROR: syntax error at or near "INTO"
LINE 2: INSERT INTO customer.please solve sir
Hii Rishabh,
Appreciate for your efforts and thanks to upload this tutorial.
I have one doubt please clear that:
While I was trying to use ALTER to ADD COLUMN column_name then I was getting error,
I think here have to declare the data type as well after column_name,
Kindly correct me if I am doing wrong
Yess correct 👍
I am still getting error
ALTER TABLE employee
ADD COLUMN 'Notes', char
you effort is appreciated I had done the music library project it was very helpful, as I am taking class from your initial video then in this video I am getting error as follow , while inserting command it is giving error column "custid" of relation "customer" does not exist
SQL state: 42703
Character: 23
kindly guide me
this could be due to spelling error or the column doesn't exit in the table
table m value insert krne k lye new table bana padegi kya sir...
❤❤❤
alter table persons
alter column city char;
previously city has datatype varchar(255)
but i wnat to change the city datatype how i can changed out to this?
how i will used this command.
You can use ALTER Table command, eg:
ALTER TABLE
ALTER COLUMN TYPE new_data_type;
Getting error again and again while using
ALTER TABLE "Customer"
ALTER COLUMN "Email" char(10);
Video is really good. But please explain each line with less Speed. I watched this video by changing the speed
Okayy noted ✅️
hi rishabh, please suggest me if i want to do data science /data analysis course offline then which institute is good with low fees please provide me the name? thank you.
I have installed postgreysql 16 and insert synatx maine use kiya yahi vala but har baare error aa rha hai
Relation customer does not exist
Ye show ho rha hai bas
Aur ha maine pinned comment already padh ke apply kr diya hai
Aur ek to aapne hume video me syntax daalte hue bhi nhi dikaya usse aur confusions create ho rhi. Hai unko jo phli baar sikh rhe hai
KCH HUA KYA , M PICHLE 5 GHNTE SE YHI ATKA HU AAGE NHI BD PA RHA
@@flashkamunna3071bhai dusre channel ki koi ek do video dekh lo smjh aa jayega aaram se
Solve hua ?
while update i am getting errror invalid input ..I tried putting all commas etc still facing issue.. Video is not clear about this
👍
Can u show an example of alter table command ?
I am trying to apply insert into but error showing column dataid of relation Data doesn't exist please solve
Why it shows me duplicate rows after Delete the row no. 3, in result remaining rows are two times.
Hi, While I am trying to insert the values Id, Name. It does not work. My question is why in your customer table showint the value custID and custname. In your previous video you use only Id, name not custId and custName.
Mujhe alter column krne m error aa rha h
hi rishabh is it necessary to assign primary key with out it wont load the table ?
Yes, it's good practice but not compulsory
Good Evening bhai..
INSERT INTO me
ERROR: column "name" of relation "customer" does not exist
LINE 2: (id, Name, Age, City, Income)
^
SQL state: 42703
Character: 27
ye sb show ho raha ha but already exist ha ye sb column.
It will really🙏🙏 helpful if you can clear the doubts.
sir, syntax of postgresql is little diffrent than it
create table bond
(
"id" int8 primary key,
"name" varchar (50) not null,
"age" int not null,
"city" char(50),
"salary" numeric
);
select * from bond
limit 4
insert into bond
("id","name",age,city,salary)
values
(1, 'sam', 26, 'delhi', 9000),
(2, 'ram', 19, 'bangalore', 12000),
(3, 'pam', 31, 'mumbai', 8500),
(4, 'jam', 42, 'pune', 10500);
update bond
set "name" = 'bomb', age = 25
where "id" = 4;
delete from bond
where "id" = 3;
alter table bond
add column navin integer;
alter table bond
alter column salary set data type integer;
alter table bond
drop column navin;
Hello Rishabh Sir, when im inserting values why does it show error when im putting them in double quotes while its working fine with single quotes??
Yess you can use single quotes
Sir delete queery use krke hum table ko delete nhi kr skte drop ke place pr delete nhi use kr skte
What is the difference between numeric and integer please tell
sir hum ne table create kiya hai badme usme or details add kar na hai kya qurey use karte hai
Just use create Table n leave it, it will be a blank table
When i make a table and adding values
Into the table but query is not running . It is showing syntax error at or near VALUES
Pls check pinned comment
Hi Rishab, I am facing an error: column "age " Of relation "customer" Does not exist
Line 2: (custid, custname, age salary)
SQL state: 42307
Character: 37 please clarify this as I am unable to insert values in tables
Pls check pinned comment
Its wrong for adding column- alter table table_name add column_name
For drop - alter table table_name drop column columm_name
How to update values from different row and different column in a single query
hi sir,
I got an error in line 1 customer.
says relation customer does not exist.
how to solve this error!
Pls check pinned comment
Hi Rishabh, i understood the delete command, how do we write command if we have to delete multiple rows?
Use where clause to give condition for multiple rows. Delete function Deletes all the rows for the specified id or primary col value
Bhai agar data excel se lena rahega to kaise lenge? Base data ke liye
1:15
When I insert all the details I get an error
Column "custid" of relation "customer" does not exist
Please help me
Pls check pinned comment
Hi Rishabh,
I am getting below error. Can you please help?
ERROR: column "custid" of relation "customer" does not exist
LINE 2: (CustID, CustName, Age, City, Salary)
^
SQL state: 42703
Character: 23
its sorted thanks
Pls check pinned comment
What is pinteed comment
I'm unable to run modify column command syntax is as it is but error shows in modify word
Share your sql query here
Query:
Alter table customer_table
Alter column address char(255) ;
ERROR: syntax error at or near "char"
Line 2: alter column address char(255) ;
^
SQL state: 42601
Character: 49