Online Courses
Free Tutorials  Go to Your University  Placement Preparation 
0 like 0 dislike
1.1k 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

Goeduhub's Top Online Courses @Udemy

For Indian Students- INR 360/- || For International Students- $9.99/-

S.No.

Course Name

 Coupon

1.

Tensorflow 2 & Keras:Deep Learning & Artificial Intelligence

Apply Coupon

2.

Natural Language Processing-NLP with Deep Learning in Python Apply Coupon

3.

Computer Vision OpenCV Python | YOLO| Deep Learning in Colab Apply Coupon
    More Courses

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_NONAMEDEPTSECPHONE
101AliaCSEB9876540010
102AlishaMEA9876541110
  • 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_NONAMEDEPTSECPHONE
101AliaCSEB9876540010
102AlishaMEA9876541110
104AdityaNULLANULL
105NityaNULLBNULL
106AnayaNULLCNULL

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_NONAMEDEPTSECPHONE
101AliaCSEB9876540010
102AlishaMEA9876541110
104AmitNULLANULL
105NityaNULLBNULL
106AnayaNULLCNULL
  • Updating multiple columns:

Example : 

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

Output :

ROLL_NONAMEDEPTSECPHONE
101AliaCSEB9876540010
102AlishaMEA9876541110
104AmitNULLANULL
105AtulyaECEBNULL
106AnayaNULLCNULL

DELETION Query : 

syntax : DELETE FROM table_name WHERE condition;

  • Deleting single record

Example : 

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

Output : 

ROLL_NONAMEDEPTSECPHONE
101AliaCSEB9876540010
102AlishaMEA9876541110
104AmitNULLANULL
105AtulyaECEBNULL
  • Deleting multiple records:
DELETE FROM college WHERE SEC = 'A';
Select*from college;

Output : 

ROLL_NONAMEDEPTSECPHONE
101AliaCSEB9876540010
105AtulyaECEBNULL
  • Delete all of the records: 
Delete from college;
         OR
Delete * from college;


ALTER QUERY -CLICK HERE

3.3k questions

7.1k answers

394 comments

4.6k users

 Goeduhub:

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