You are on page 1of 8

S RENUGA DEVI 21BAI1546

BCSE302P – Database Management Systems

Ex. 1 DDL Commands


1. i) Create a table STUDENT with the following fields.
Register No.
Name
Age
Gender
Department
Sem
Year

Syntax:
create table STUDENT(Reg_No varchar(9), Name varchar(30), Age number(2), Gender
varchar(6), Department varchar(5), Sem varchar(6), Year number(1));

2. Create a table DEPT with the following fields


DName
Dean
Programmes offered
No. of Faculties

Syntax:
create table DEPT(DName varchar(30), Dean varchar(30), Progs_Offered varchar(50),
No_Faculties number(10));
S RENUGA DEVI 21BAI1546

3. Alter STUDENT table i) varying size of Name field


ii) adding a new field CGPA

Syntax:
i) alter table STUDENT modify(Name varchar(40));
ii) alter table STUDENT add(CGPA number(3,2));
S RENUGA DEVI 21BAI1546

4. Modify DEPT table adding a new field Students_strength

Syntax:
alter table DEPT add(Students_strength number(10));

5. Insert 5 records into STUDENT and DEPT

Syntax:
insert into STUDENT values('RegNo', 'Name', Age, Gender, 'Dept', 'Sem', Year, CGPA);
insert into DEPT values('DName', 'Dean', 'ProgsOffered', NoFaculties, StudentsStrength);
S RENUGA DEVI 21BAI1546
S RENUGA DEVI 21BAI1546
S RENUGA DEVI 21BAI1546

6. Rename the column name as Student_name in the relation STUDENT

Syntax:
alter table STUDENTxxxx rename column Name to Student Name;

7. Drop the column CGPA from STUDENT

Syntax:
alter table STUDENTdrop CGPA;
S RENUGA DEVI 21BAI1546

8. Rename the table DEPT as SCHOOL

Syntax:
rename DEPT to SCHOOL;

9. Truncate the table DEPT

Syntax:
truncate table DEPT;
S RENUGA DEVI 21BAI1546

10. Delete the table DEPT.

Syntax:
Drop table DEPT;

You might also like