Finance[US] Career Guide Free Tutorials Go to Your University Placement Preparation 
0 like 0 dislike
2.3k views
in RTU/BTU B.Tech (CSE-IV Sem) DBMS Lab by Goeduhub's Expert (7.6k points)
edited by

Perform the following operation for demonstrating the insertion, updation ,deletion  and alter

1 Answer

0 like 0 dislike
by Goeduhub's Expert (7.6k points)
edited by
 
Best answer

Perform the following operation for demonstrating the insertion, updation ,deletion and alter .

INSERTION Query 

Syntax : INSERT INTO table(column1, column2, …) VALUES   (value1, value2, …);

  • Inserting only values

Example : 

Insert into college values(101,"Alia","CSE","B",9876540010)

Insert into college values(102,"Alisha","ME","A",9876541110)

Output : 

ROLL_NO NAME DEPT SEC PHONE
101 Alia CSE B 9876540010
102 Alisha ME A 9876541110
  • Inserting values in only specified columns

Example :

INSERT INTO college(ROLL_NO, NAME, SEC)VALUES(‘104,’Aditya','A');
INSERT INTO college(ROLL_NO, NAME, SEC)VALUES(‘105,’NITYA','B');
INSERT INTO college(ROLL_NO, NAME, SEC)VALUES(‘106,’Anaya','C');
Select * from college;

Output :

 

ROLL_NO NAME DEPT SEC PHONE
101 Alia CSE B 9876540010
102 Alisha ME A 9876541110
104 Aditya NULL A NULL
105 Nitya NULL B NULL
106 Anaya NULL C NULL

UPDATION Query : 

syntax : UPDATE table_name SET column1 = value1, column2 = value2, ...WHERE condition;

  • Updating single column :  
UPDATE college SET NAME = 'Amit ' WHERE ROLL_NO = 104;
Select*from college;

Output : 

ROLL_NO NAME DEPT SEC PHONE
101 Alia CSE B 9876540010
102 Alisha ME A 9876541110
104 Amit NULL A NULL
105 Nitya NULL B NULL
106 Anaya NULL C NULL
  • Updating multiple columns:

Example : 

UPDATE college SET NAME = 'Atulya', DEPT = 'ECE' WHERE ROLL_NO = 105;
Select*from college;

Output :

ROLL_NO NAME DEPT SEC PHONE
101 Alia CSE B 9876540010
102 Alisha ME A 9876541110
104 Amit NULL A NULL
105 Atulya ECE B NULL
106 Anaya NULL C NULL

DELETION Query : 

syntax : DELETE FROM table_name WHERE condition;

  • Deleting single record

Example : 

DELETE FROM college WHERE NAME = 'Ananya'; 
Select*from college;

Output : 

ROLL_NO NAME DEPT SEC PHONE
101 Alia CSE B 9876540010
102 Alisha ME A 9876541110
104 Amit NULL A NULL
105 Atulya ECE B NULL
  • Deleting multiple records:
DELETE FROM college WHERE SEC = 'A';
Select*from college;

Output : 

ROLL_NO NAME DEPT SEC PHONE
101 Alia CSE B 9876540010
105 Atulya ECE B NULL
  • Delete all of the records: 
Delete from college;
         OR
Delete * from college;


ALTER QUERY -CLICK HERE

Learn & Improve In-Demand Data Skills Online in this Summer With  These High Quality Courses[Recommended by GOEDUHUB]:-

Best Data Science Online Courses[Lists] on:-

Claim your 10 Days FREE Trial for Pluralsight.

Best Data Science Courses on Datacamp
Best Data Science Courses on Coursera
Best Data Science Courses on Udemy
Best Data Science Courses on Pluralsight
Best Data Science Courses & Microdegrees on Udacity
Best Artificial Intelligence[AI] Courses on Coursera
Best Machine Learning[ML] Courses on Coursera
Best Python Programming Courses on Coursera
Best Artificial Intelligence[AI] Courses on Udemy
Best Python Programming Courses on Udemy

 Important Lists:

Important Lists, Exams & Cutoffs Exams after Graduation PSUs

 Goeduhub:

About Us | Contact Us || Terms & Conditions | Privacy Policy ||  Youtube Channel || Telegram Channel © goeduhub.com Social::   |  | 

 

Free Online Directory

...