You are on page 1of 2

DBMS LAB

Course Title: DBMS LAB Course code: CAC07P


1. Execute DDL Commands
Consider the table:STUDENT (regno number, name varchar2, dob date, marks number)
a) Create the above table with suitable constraints.
b) Remove the existing attribute marks from the table.
c) Change the data type of regno from number to varchar2.
d) Add a new attribute phno to the existing table.
e) Insert 5 tuples into the table.
f) Display the tuples in table
a) Create the above table with suitable constraints.
SQL>CREATE TABLE STUDENT(REGNO NUMBER, NAME VARCHAR2(10), DOB DATE,
MARKS NUMBER);
TABLE CREATED.
SQL>DESC STUDENT;

b) Remove the existing attribute marks from the table.


SQL> ALTER TABLE STUDENT DROP COLUMN MARKS;
TABLE ALTERED.
SQL>DESC STUDENT;

c) Change the data type of regno from number to varchar2.


SQL> ALTER TABLE STUDENT MODIFY REGNO VARCHAR2(20);
TABLE ALTERED.
SQL>DESC STUDENT;

d) Add a new attribute phno to the existing table.


SQL>ALTER TABLE STUDENT ADD PHNO NUMBER;
TABLE ALTERED.
SQL>DESC STUDENT;
e) Insert 5 tuples into the table.
SQL>INSERT INTO STUDENT VALUES(‘1001’,’ASHA’,’01-JAN-2001’,912345678);
1 ROW CREATED.
SQL>INSERT INTO STUDENT VALUES(‘1002’,’RANI’,’01-FEB-2002’,952731618);
1 ROW CREATED.
SQL>INSERT INTO STUDENT VALUES(‘1003’,’DEEPA’,’02-MAR-2003’,987654321);
1 ROW CREATED.
SQL>INSERT INTO STUDENT VALUES(‘1004’,’VANI’,’04-APR-2004’,965478123);
1 ROW CREATED.
SQL>INSERT INTO STUDENT VALUES(‘1005’,’DIVYA’,’05-MAY-2005’,987321456);
1 ROW CREATED.

f) Display the tuples in table


SQL>SELECT * FROM STUDENT;

You might also like