REG NO:RA221105304006
NAME: E SHIVAPRIYA
ECE-DS ‘B’
DBMS Assignment
1) CREATE A TABLE STUDENT WITH THE FOLLOWING ATTRIBUTES:
1. Student_number
[Link]
3.department_number
ANS:
CREATE TABLE Student( Student_number
int, Name VARCHAR(100),
Department_number int);
2) CREATE A TABLE Supplies WITH THE FOLLOWING ATTRIBUTES
1.supplier_id
2.supplier_name
3.contact_number
ANS:
CREATE TABLE
Supplies( Supplier_id int Primary key,
Supplier_name varchar(100),
Contact_number varchar(15));
3) Command to give the structure of the table student
Ans: desc student;
4) Command to modify the field student_name to stud_name
Ans: ALTER TABLE your_table_name
CHANGE student_name stud_name datatype;
5) Command to view changes in student table
structure Ans: desc student;
6) Command to add a field called marks in the student table
Ans: ALTER TABLE student ADD marks INT;
7) Command to modify the data type of the field student_number if you want to change it to
another data type for example varchar(10)
Ans: ALTER TABLE student
MODIFY COLUMN student_number VARCHAR(10);
8) Command to rename a column for example department_number to dept_number
ALTER TABLE student
RENAME COLUMN department_number TO dept_number;
9) Command to drop table student
Ans:DROP TABLE STUDENT;