64)ASSIGNMENT III SQL DELETE-DROP-UPDATE AND ALTER COMMANDS
64)ASSIGNMENT III SQL DELETE-DROP-UPDATE AND ALTER COMMANDS
ASSIGNMENT-III
SUBJECT: COMPUTER SCIENCE (083)
TOPIC: SQLDELETE, UPDATE, DROP AND ALTER COMMANDS
CLASS: XII
1 What is the difference between delete and drop command? Explain with examples.
2 Explain Alter command with syntax and examples.
3 Mr Anil wants to remove all records from the table STAFF, but he does not want to remove the
structure of the table. Which SQL statement(query) should he use?
4 How is ALTER command different from UPDATE command? Explain with suitable example.
5 Kunal created the following table with the name ‘FRIENDS’:
Table: FRIENDS
Stud_code Name Hobbies
S101 Amit Swimming
S102 Rahul Reading Books
S103 Abhinav Dancing
Now Kunal wants to delete the column ‘Hobbies’. Write the MySQL query.
6 Consider the table given below:
Table: COMPANY
EMPID DEPARTMENT SALARY
E101 MARKETING 30000
E102 ACCOUNTS 45000
E103 PRODUCTION 32000
E104 ACCOUNTS 28000
E105 MARKETING 54000
E106 ACCOUNTS 40000
Identify the error in the following SQL statements. Rewrite the correct SQL statement.
(i) DELETE EMPID E103 FROM COMPANY;
(ii) UPDATE TABLE COMPANY SALARY = SALARY+1000;
7 Write the SQL commands for the question from (i) to (iv) on the basis of table TEACHER given
below:
TEACHER
TNo Tname Gender Age Department Salary DOJ
101 Ashok Kumar M 28 English 15000 2010-10-13
102 Rakesh Sharma M 32 Mathematics 25000 2008-08-23
103 Richa Saini F 27 Computer 22000 2014-07-15
104 Amit Gupta M 35 Science 17000 NULL
105 Sandeep Goyal M 42 Computer 19000 2005-12-27
106 Sangeeta F 33 English 14000 2008-11-17
107 Jyoti Sharma F 29 Hindi 12000 2012-05-13
108 Manoj Kumar M 40 Science 21000 NULL
109 Rajendra Kapoor M 36 Art 16000 2004-04-25
110 Vinay Kumar M 32 English 18000 2011-03-10
Page 2 of 2