CBSE Class 11 Informatics Practices
Question 35 of 37
Structured Query Language (SQL) — Question 35
Back to all questions 35
Question For the given table, do as directed:
Table:STUDENT
| Column name | Datatype | Size | Constraint |
|---|---|---|---|
| ROLLNO | Integer | 4 | Primary Key |
| SNAME | Varchar | 25 | Not Null |
| GENDER | Char | 1 | Not Null |
| DOB | Date | Not Null | |
| FEES | Integer | 4 | Not Null |
| HOBBY | Varchar | 15 | Null |
(i) Write SQL query to create the table.
(ii) Write SQL query to increase the size of SNAME to hold 30 characters.
(iii) Write SQL query to remove the column HOBBY.
(iv) Write SQL query to insert a row in the table with any values of your choice that can be accommodated there.
(i)
CREATE TABLE STUDENT(
ROLLNO INT(4) PRIMARY KEY,
SNAME VARCHAR(25) NOT NULL,
GENDER CHAR(1) NOT NULL,
DOB DATE NOT NULL,
FEES INT(4) NOT NULL,
HOBBY VARCHAR(15)
);(ii)
ALTER TABLE STUDENT MODIFY SNAME VARCHAR(30);(iii)
ALTER TABLE STUDENT DROP HOBBY;(iv)
INSERT INTO STUDENT(ROLLNO, SNAME, GENDER, DOB, FEES, HOBBY)
VALUES (1, 'ANANYA', 'F', '2000-01-01', 5000, 'COOKING');