0% found this document useful (0 votes)
53 views12 pages

Assignment 2 Data Defination Language: VVP Engineering College

Uploaded by

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

Assignment 2 Data Defination Language: VVP Engineering College

Uploaded by

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

ASSIGNMENT 2

DATA DEFINATION LANGUAGE

VVP
ENGINEERING
COLLEGE
CE DEPARTMENT

SUBMITTED BY: BHANDERI TARANG


G1
200470107024
Assignment 1

ASSIGNMENT 2

1) Create table Student_master having following column


Enrollmentno,rollno, mobileno,current_sem,branch,
name,sem_result,batch
- define enrollment no as primary key
- current_sem must be between 1 to 10
- branch must not null
- name must not null
ANS: create table STUDENT_MASTER
(
ENROLLMENTNO number(12) PRIMARY KEY,
ROLLNO char(7),
MOBILENO number(10),
CURRENT_SEM number(2) check(CURRENT_SEM>=1 and
CURRENT_SEM<=10),
BRANCH char(2) NOT NULL,
NAME varchar2(30) NOT NULL,
SEM_RESULT varchar2(4),
BATCH char(2)
)

<ENROLLMENTNO TOPIC 1
>
Assignment 1

2) create subject_master having following column


subject_code,subject_name,branch,semester,theory,tutorial,pr
actical,credit
- subject_code no as primary key
- semester must be between 1 to 10
<ENROLLMENTNO TOPIC 2
>
Assignment 1

- theory,tutorial must be between 0 to 5


- practical must be between 0 to 20
ANS: create table SUBJECT_MASTER
( SUBJECT_CODE number(7) primary key,
SUBJECT_NAME varchar2(8),
branch char(2),
semester number(2) check(semester>=1 and semester<=10),
THEORY number(1) check(theory>=0 and theory<=5),
tutorial number(1) check(tutorial>=0 and tutorial<=5),
practical number(2) check(practical>=0 and practical<=20),
credit number(1)
)

<ENROLLMENTNO TOPIC 3
>
Assignment 1

3) subject_distribution
subject_distribution_id, enrollmentno,subject_code
- subject_distribution_id must be defined as primary key
- enrollmentno defined as foreign key
- subject_code defined as foreign key
ANS: create table SUBJECT_DISTRIBUTION
(SUBJECT_DISTRIBUTION_ID number(8) primary key,
ENROLLMENTNO number(12) references
STUDENT_MASTER(ENROLLMENTNO),
SUBJECT_CODE number(7) references
SUBJECT_MASTER(SUBJECT_CODE)
)

<ENROLLMENTNO TOPIC 4
>
Assignment 1

4) Perform data insertation as per screenshot


i)Student_master - http://prntscr.com/tkzngb
ans:i)

<ENROLLMENTNO TOPIC 5
>
Assignment 1

ii)Subject_master - http://prntscr.com/tkznsd
ans:ii)

iii)subject_distribution - http://prntscr.com/tkzo1j
ans:iii)

<ENROLLMENTNO TOPIC 6
>
Assignment 1

5) total subject learned by Chris


ANS: select SUBJECT_NAME,SUBJECT_CODE from
STUDENT_MASTER LEFT JOIN SUBJECT_MASTER
on
STUDENT_MASTER.CURRENT_SEM=SUBJECT_MASTER.SEMEST
ER
where NAME='CHRIS' ;

<ENROLLMENTNO TOPIC 7
>
Assignment 1

6) total credit earned by Meet after clearing second sem exam


ANS: select SUM(CREDIT) from SUBJECT_MASTER RIGHT JOIN
STUDENT_MASTER
on
STUDENT_MASTER.CURRENT_SEM=SUBJECT_MASTER.SEMEST
ER
where NAME='MEET' ;

7) update current_sem to 3 for all students who clears the


exam
ANS: UPDATE STUDENT_MASTER SET CURRENT_SEM=3
WHERE SEM_RESULT='PASS'

<ENROLLMENTNO TOPIC 8
>
Assignment 1

8) total theory needs to be attended by 3rd semester students


result should be display like
Name, total_theory_count
ANS: SELECT NAME,SUM(THEORY) TOTAL_THEORY_COUNT
FROM STUDENT_MASTER
INNER JOIN SUBJECT_MASTER ON

STUDENT_MASTER.CURRENT_SEM=SUBJECT_MASTER.SEMEST
ER GROUP BY NAME

<ENROLLMENTNO TOPIC 9
>
Assignment 1

9) total practical needs to be attend by 3rd semester students


result should be display like
Name, total_practical_count
ANS: SELECT NAME,SUM(PRACTICAL)
TOTAL_PRACTICAL_COUNT
FROM STUDENT_MASTER
INNER JOIN SUBJECT_MASTER ON

STUDENT_MASTER.CURRENT_SEM=SUBJECT_MASTER.SEMEST
ER GROUP BY NAME

10) list subjects order by subject_code


ANS: SELECT SUBJECT_CODE,SUBJECT_NAME FROM
SUBJECT_MASTER ORDER BY SUBJECT_CODE

<ENROLLMENTNO TOPIC 10
>
Assignment 1

<ENROLLMENTNO TOPIC 11
>

You might also like