Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
8 views1 page

dmn6s Justpasteit

The document outlines SQL commands for creating a 'department' and 'student' table with various constraints. It includes primary key, unique, foreign key, and check constraints for the 'student' table, as well as modifications to ensure data integrity. Additionally, it demonstrates enabling and disabling constraints on the 'student' table.

Uploaded by

hzgqxxmx6b
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views1 page

dmn6s Justpasteit

The document outlines SQL commands for creating a 'department' and 'student' table with various constraints. It includes primary key, unique, foreign key, and check constraints for the 'student' table, as well as modifications to ensure data integrity. Additionally, it demonstrates enabling and disabling constraints on the 'student' table.

Uploaded by

hzgqxxmx6b
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Downloaded from: justpaste.

it/dmn6s

table creation:
CREATE TABLE department (
deptid NUMBER(5) PRIMARY KEY,
dept_name VARCHAR(6) CHECK (dept_name in ('CSE', 'EEE', 'BBA', 'Eng', 'Ach')),
budget NUMBER(6) DEFAULT 0);
CREATE TABLE student (
s_id NUMBER,
s_name VARCHAR2(20),
phone NUMBER,
address VARCHAR2(50),
email VARCHAR2(30),
credit_completed NUMBER(3),
course_completed NUMBER(2),
cgpa NUMBER,
deptno NUMBER(5),
gender VARCHAR2(6)
);

4. ALTER TABLE student


ADD CONSTRAINT pk PRIMARY KEY (s_id);
5. ALTER TABLE student
MODIFY s_name VARCHAR2(20) NOT NULL;
6. ALTER TABLE student
ADD CONSTRAINT uk UNIQUE (email);
7. ALTER TABLE student
ADD CONSTRAINT fkd FOREIGN KEY (deptno) REFERENCES department(deptid);
8. ALTER TABLE student
ADD CONSTRAINT chkg CHECK (gender IN ('M', 'F'));
9. ALTER TABLE student
DISABLE CONSTRAINT pkst;
10. ALTER TABLE student
DISABLE CONSTRAINT chkg;
11.
12. ALTER TABLE student
ENABLE CONSTRAINT pkst;

You might also like