LAB : 3 DDL COMMANDS
1. Write the syntax to create the grad_candidates table and Confirm creation of the table.
create table grad_candidates(
Student_id number(6),
Last_Name varchar2(4),
First_Name varchar2(4),
Credits number (3),
Graduate_Date date
);
desc grad_candidates;
2. In your o_grad_candidates table, enter a new column called “adm_date.” The datatype for the new column should be
VARCHAR2. Set the DEFAULT for this column as SYSDATE.
CREATE TABLE o_grad_candidates AS (
SELECT * FROM grad_candidates
);
ALTER TABLE o_grad_candidates ADD (
Adm_Date varchar2(50) default SYSDATE
);
desc o_grad_candidates;
3. In your o_grad_candidates table, increase the length of last_name column by 10 and remove the credits column.
ALTER TABLE o_grad_candidates
MODIFY last_name VARCHAR2(14);
ALTER TABLE o_grad_candidates
DROP COLUMN credits;
desc o_grad_candidates;
4. Write syntax to change the name of credit column by grad_credit.
ALTER TABLE grad_candidates
RENAME COLUMN credits TO grad_credit;
desc grad_candidates;