0% found this document useful (0 votes)
35 views

Visit:: Join Telegram To Get Instant Updates: Contact: MAIL: Instagram: Instagram

The document provides information about the database schema for a College database management system. It includes the tables for Students, Semesters/Sections, Subject enrollment and marks. It also provides the SQL queries to create the tables, insert sample data and describe the tables. Steps are given to connect to the Oracle 10g Express Edition database and execute the SQL commands.

Uploaded by

study material
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)
35 views

Visit:: Join Telegram To Get Instant Updates: Contact: MAIL: Instagram: Instagram

The document provides information about the database schema for a College database management system. It includes the tables for Students, Semesters/Sections, Subject enrollment and marks. It also provides the SQL queries to create the tables, insert sample data and describe the tables. Steps are given to connect to the Oracle 10g Express Edition database and execute the SQL commands.

Uploaded by

study material
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/ 28

Visit : https://hemanthrajhemu.github.

io

Join Telegram to get Instant Updates: https://bit.ly/2GKiHnJ

Contact: MAIL: [email protected]

INSTAGRAM: www.instagram.com/hemanthraj_hemu/

INSTAGRAM: www.instagram.com/futurevisionbie/
1|Page https://hemanthrajhemu.github.io

[As per Choice Based Credit System (CBCS) scheme]


(Effective from the academic year 2017-2018)
SEMESTER – V
Subject Code:17CSL58 IA Marks: 40
Exam Marks: 60 Exam Hours: 03
----------------------------------------------------------------------------------------------

----------------------------------------------------------------------------------------------
Consider the schema for College Database:
STUDENT(USN, SName, Address, Phone, Gender)
SEMSEC(SSID, Sem, Sec)
CLASS(USN, SSID)
SUBJECT(Subcode, Title, Sem, Credits)
IAMARKS(USN, Subcode, SSID, Test1, Test2, Test3, FinalIA)
Write SQL queries to
1. List all the student details studying in fourth semester ‘C’ section.
2. Compute the total number of male and female students in each
semester and in each section.
3. Create a view of Test1 marks of student USN ‘1BI17CS101’ in all
subjects.
4. Calculate the FinalIA (average of best two test marks) and update the
corresponding table for all students.
5. Categorize students based on the following criterion:
If FinalIA = 17 to 20 then CAT = ‘Outstanding’
If FinalIA = 12 to 16 then CAT = ‘Average’
If FinalIA< 12 then CAT = ‘Weak’
Give these details only for 8th semester A, B, and C section students.

https://hemanthrajhemu.github.io
2|Page https://hemanthrajhemu.github.io

----------------------------------------------------------------------------------------------
SCHEMA DIAGRAM:
--------------------------------------------------------------------------------------------------------------------------

https://hemanthrajhemu.github.io
3|Page https://hemanthrajhemu.github.io

-------------------------------------------------------------------------------------------------------

STEPS TO OPEN THE ORACLE DATABASE – 10G


EXPRESS EDITION
-------------------------------------------------------------------------------------------------------
Step 1: Open the Browser (Preferred Chrome).
Step 2: http://127.0.0.1:8080/apex/ Enter the link on the browser.
Step 3: login with your id and password (finding difficulty in login in go to the
link to know in-depth details
https://hemanthrajhemu.github.io/FutureVisionBIE/WP/5CSE/DBMS_LAB_INFO.html

(Note Username is the system by default & Password is the passkey you entered
in the installation)

Step 4: Now click on SQL->SQL Commands. This is the place where we execute
the SQL Commands.

Step 5: you are in SQL Command Now you can Create table, create view, Run
Queries here & lot more.
Or Method -2 using Command Prompt
https://hemanthrajhemu.github.io/FutureVisionBIE/WP/5CSE/DBMS_LAB_M
ETHOD_2.html

https://hemanthrajhemu.github.io
4|Page https://hemanthrajhemu.github.io

-------------------------------------------------------------------------------------------------------
Create Table: (Follow the Schema Diagram in Creating the Data Base)
-------------------------------------------------------------------------------------------------------
1. Create Table for STUDENT
CREATE TABLE STUDENT(
USN VARCHAR(10) PRIMARY KEY,
SNAME VARCHAR(30) NOT NULL,
ADDRESS VARCHAR(50),
PHONE INTEGER,
GENDER VARCHAR(10));

NOW RUN.

2. Create Table for SEMSEC


CREATE TABLE SEMSEC(
SSID VARCHAR(10) PRIMARY KEY,
SEM INTEGER NOT NULL,
SEC VARCHAR(2) NOT NULL);

NOW RUN.

3. Create Table for CLASS1


CREATE TABLE CLASS1(
USN VARCHAR(10) REFERENCES
STUDENT(USN) ON DELETE CASCADE
,SSID VARCHAR(10) REFERENCES
SEMSEC(SSID) ON DELETE CASCADE);

NOW RUN.

https://hemanthrajhemu.github.io
5|Page https://hemanthrajhemu.github.io

4. Create Table for SUBJECT


CREATE TABLE SUBJECT(
SUBCODE VARCHAR(10) PRIMARY KEY,
TITLE VARCHAR(50) NOT NULL,
SEM INTEGER,CREDIT VARCHAR(10));

NOW RUN.

5. Create Table for IAMARKS


CREATE TABLE IAMARKS(
USN VARCHAR(10) REFERENCES
STUDENT(USN) ON DELETE CASCADE,
SUBCODE VARCHAR(10) REFERENCES
SUBJECT(SUBCODE)
ON DELETE CASCADE,
SSID VARCHAR(10) REFERENCES
SEMSEC(SSID) ON DELETE CASCADE,
TEST1 NUMBER(3,2),
TEST2 NUMBER(3,2),
TEST3 NUMBER(3,2),
FINALIA NUMBER(3,2));

NOW RUN.

-------------------------------------------------------------------------------------------------------

https://hemanthrajhemu.github.io
6|Page https://hemanthrajhemu.github.io

-------------------------------------------------------------------------------------------------------
TABLE DESCRIPTION
-------------------------------------------------------------------------------------------------------
1. DESC STUDENT;

2. DESC SEMSEC;

https://hemanthrajhemu.github.io
7|Page https://hemanthrajhemu.github.io

3. DESC CLASS1;

4. DESC SUBJECT;

https://hemanthrajhemu.github.io
8|Page https://hemanthrajhemu.github.io

5. DESC IAMARKS;

https://hemanthrajhemu.github.io
9|Page https://hemanthrajhemu.github.io

-------------------------------------------------------------------------------------------------------
INSERTION OF VALUES TO TABLE
-------------------------------------------------------------------------------------------------------
1. VALUES INTO STUDENT:
INSERT INTO STUDENT(<USN>,<SNAME>,<ADDRESS>,<PHONE>,<GENDER>);

INSERT INTO STUDENT VALUES


('1BY16CS701','PUNITH','BANGLORE',8889659696,'MALE');
INSERT INTO STUDENT('1BY16CS702','ABDUL','BANGLORE',8866352000,'MALE');
INSERT INTO STUDENT('1BY16CS703','NOOR','BANGLORE',8111200320,'FEMALE');
INSERT INTO STUDENT('1BY16CS704','HEMANTH','BANGLORE',9869655510,'MALE');
INSERT INTO STUDENT('1BY16CS704','RAHUL','BANGLORE',9965238410,'MALE');

INSERT INTO STUDENT VALUES


('1BY17CS501','JYOTHI','BANGLORE',8875452200,'FEMALE');
INSERT INTO STUDENT VALUES
('1BY17CS502','SPOORTHI','BANGLORE',9956541203,'FEMALE');
INSERT INTO STUDENT VALUES
('1BY17CS503','SNEHA','BANGLORE',9966552200,'FEMALE');
INSERT INTO STUDENT VALUES
('1BY17CS504','RAJKUMAR','BANGLORE',7799553265,'MALE');
INSERT INTO STUDENT VALUES
('1BY17CS505','HIMANSHU','BANGLORE',7755221025,'FEMALE');

INSERT INTO STUDENT VALUES


('1BY18CS301','RAKSHITHA','BANGLORE',9685774120,'FEMALE');
INSERT INTO STUDENT VALUES
('1BY18CS302','VARSHA','BANGLORE',9933526874,'FEMALE');
INSERT INTO STUDENT VALUES
('1BY18CS303','RAHUL','BANGLORE',9955522210,'MALE');
INSERT INTO STUDENT VALUES
('1BY18CS304','RAAFAY','BANGLORE',9966551100,'MALE');
INSERT INTO STUDENT VALUES
('1BY18CS305','PRANAV','BANGLORE',9975756630,'MALE');

https://hemanthrajhemu.github.io
10 | P a g e https://hemanthrajhemu.github.io

2. VALUES INTO SEMSEC:


INSERT INTO SEMSEC VALUES(<SSID>,<SEM>,<SEC>);
INSERT INTO SEMSEC VALUES('CSE4A',4,'A');
INSERT INTO SEMSEC VALUES('CSE4B',4,'B');
INSERT INTO SEMSEC VALUES('CSE4C',4,'C');
INSERT INTO SEMSEC VALUES('CSE6A',6,'A');
INSERT INTO SEMSEC VALUES('CSE6B',6,'B');
INSERT INTO SEMSEC VALUES('CSE6C',6,'C');
INSERT INTO SEMSEC VALUES('CSE8A',8,'A');
INSERT INTO SEMSEC VALUES('CSE8B',8,'B');
INSERT INTO SEMSEC VALUES('CSE8C',8,'C');

3. VALUES INTO CLASS1:


INSERT INTO CLASS1 VALUES(<USN>,<SSID>);
INSERT INTO CLASS1 VALUES('1BY18CS301','CSE4A');
INSERT INTO CLASS1 VALUES('1BY18CS302','CSE4A');
INSERT INTO CLASS1 VALUES('1BY18CS303','CSE4B');
INSERT INTO CLASS1 VALUES('1BY18CS304','CSE4B');
INSERT INTO CLASS1 VALUES('1BY18CS305','CSE4C');
INSERT INTO CLASS1 VALUES('1BY17CS501','CSE6A');
INSERT INTO CLASS1 VALUES('1BY17CS502','CSE6A');
INSERT INTO CLASS1 VALUES('1BY17CS503','CSE6B');
INSERT INTO CLASS1 VALUES('1BY17CS504','CSE6C');
INSERT INTO CLASS1 VALUES('1BY17CS505','CSE6C');
INSERT INTO CLASS1 VALUES('1BY16CS701','CSE8A');
INSERT INTO CLASS1 VALUES('1BY16CS702','CSE8A');
INSERT INTO CLASS1 VALUES('1BY16CS703','CSE8B');
INSERT INTO CLASS1 VALUES('1BY16CS704','CSE8B');
INSERT INTO CLASS1 VALUES('1BY16CS705','CSE8C');

https://hemanthrajhemu.github.io
11 | P a g e https://hemanthrajhemu.github.io

4. VALUES INTO SUBJECT:


INSERT INTO SUBJECT(<SUBCODE>,<TITLE>,<SEM>,<CREDIT>);
INSERT INTO SUBJECT VALUES ('18CS01','MATHS-4','4','4');
INSERT INTO SUBJECT VALUES ('18CS02','DMS','4','3');
INSERT INTO SUBJECT VALUES ('18CS03','OOC','4','3');
INSERT INTO SUBJECT VALUES ('18CS04','DAA','4','3');
INSERT INTO SUBJECT VALUES ('17CS01','COMPUTER GRAPHICS AND
VISUALIZATION','6','4');
INSERT INTO SUBJECT VALUES ('17CS02','SYSTEM SOFTWARE AND
COMPILER DESIGN','6','4');
INSERT INTO SUBJECT VALUES ('17CS03','OPERATING SYSTEMS','6','4');
INSERT INTO SUBJECT VALUES ('17CS04','DATA MINING AND DATA
WAREHOUSING','6','3');
INSERT INTO SUBJECT VALUES ('16CS03','INTERNET OF THINGS
TECHNOLOGY','8','4');
INSERT INTO SUBJECT VALUES ('16CS03','BIG DATA ANALYTICS','8','4');
INSERT INTO SUBJECT VALUES ('16CS03','HIGH PERFORMANCE
COMPUTING','8','3');
INSERT INTO SUBJECT VALUES ('16CS03','USER INTERFACE DESIGN','8','3');

https://hemanthrajhemu.github.io
12 | P a g e https://hemanthrajhemu.github.io

5. VALUES INTO IAMARKS:


INSERT INTO IAMARKS VALUES(<USN>,
<SUBCODE>,<SSID>,<TEST1>,<TEST2>,<TEST3>,<FINALIA>);
INSERT INTO IAMARKS
VALUES('1BY18CS301','18CS01','CSE4A',22,15,20,NULL);
INSERT INTO IAMARKS
VALUES('1BY18CS302','18CS01','CSE4A',20,12,28,NULL);
INSERT INTO IAMARKS
VALUES('1BY18CS303','18CS01','CSE4B',30,25,30,NULL);
INSERT INTO IAMARKS
VALUES('1BY18CS304','18CS01','CSE4B',10,12,19,NULL);
INSERT INTO IAMARKS
VALUES('1BY18CS305','18CS01','CSE4C',08,15,30,NULL);
INSERT INTO IAMARKS
VALUES('1BY18CS301','18CS02','CSE4A',5,15,30,NULL);
INSERT INTO IAMARKS
VALUES('1BY18CS302','18CS02','CSE4A',20,12,28,NULL);
INSERT INTO IAMARKS
VALUES('1BY18CS303','18CS02','CSE4B',15,05,25,NULL);
INSERT INTO IAMARKS
VALUES('1BY18CS304','18CS02','CSE4B',25,20,19,NULL);
INSERT INTO IAMARKS
VALUES('1BY18CS305','18CS02','CSE4C',8,25,30,NULL);
INSERT INTO IAMARKS
VALUES('1BY18CS301','18CS03','CSE4A',30,10,30,NULL);
INSERT INTO IAMARKS
VALUES('1BY18CS302','18CS03','CSE4A',27,15,10,NULL);
INSERT INTO IAMARKS
VALUES('1BY18CS303','18CS03','CSE4B',15,20,25,NULL);
INSERT INTO IAMARKS
VALUES('1BY18CS304','18CS03','CSE4B',15,20,10,NULL);
INSERT INTO IAMARKS
VALUES('1BY18CS305','18CS03','CSE4C',17,18,19,NULL);
INSERT INTO IAMARKS
VALUES('1BY18CS301','18CS04','CSE4A',30,5,30,NULL);
INSERT INTO IAMARKS
VALUES('1BY18CS302','18CS04','CSE4A',8,16,11,NULL);
INSERT INTO IAMARKS VALUES('1BY18CS303','18CS04','CSE4B',4,7,25,NULL);
INSERT INTO IAMARKS
VALUES('1BY18CS304','18CS04','CSE4B',29,30,29,NULL);
INSERT INTO IAMARKS
VALUES('1BY18CS305','18CS04','CSE4C',30,29,30,NULL);
INSERT INTO IAMARKS
VALUES('1BY17CS501','17CS01','CSE6A',25,10,15,NULL);
INSERT INTO IAMARKS
VALUES('1BY17CS502','17CS01','CSE6A',30,29,30,NULL);

https://hemanthrajhemu.github.io
13 | P a g e https://hemanthrajhemu.github.io

INSERT INTO IAMARKS


VALUES('1BY17CS503','17CS01','CSE6B',8,25,30,NULL);
INSERT INTO IAMARKS
VALUES('1BY17CS504','17CS01','CSE6C',25,10,15,NULL);
INSERT INTO IAMARKS
VALUES('1BY17CS505','17CS01','CSE6C',25,10,15,NULL);
INSERT INTO IAMARKS
VALUES('1BY17CS501','17CS02','CSE6A',25,10,15,NULL);
INSERT INTO IAMARKS
VALUES('1BY17CS502','17CS02','CSE6A',8,25,30,NULL);
INSERT INTO IAMARKS
VALUES('1BY17CS503','17CS02','CSE6B',17,18,19,NULL);
INSERT INTO IAMARKS
VALUES('1BY17CS504','17CS02','CSE6C',30,29,30,NULL);
INSERT INTO IAMARKS
VALUES('1BY17CS505','17CS02','CSE6C',8,25,30,NULL);
INSERT INTO IAMARKS
VALUES('1BY17CS501','17CS03','CSE6A',25,10,15,NULL);
INSERT INTO IAMARKS
VALUES('1BY17CS502','17CS03','CSE6A',17,18,19,NULL);
INSERT INTO IAMARKS
VALUES('1BY17CS503','17CS03','CSE6B',30,29,30,NULL);
INSERT INTO IAMARKS
VALUES('1BY17CS504','17CS03','CSE6C',8,25,30,NULL);
INSERT INTO IAMARKS
VALUES('1BY17CS505','17CS03','CSE6C',14,10,15,NULL);
INSERT INTO IAMARKS
VALUES('1BY17CS501','17CS04','CSE6A',8,25,30,NULL);
INSERT INTO IAMARKS
VALUES('1BY17CS502','17CS04','CSE6A',25,10,15,NULL);
INSERT INTO IAMARKS
VALUES('1BY17CS503','17CS04','CSE6B',8,25,30,NULL);
INSERT INTO IAMARKS
VALUES('1BY17CS504','17CS04','CSE6C',17,18,19,NULL);
INSERT INTO IAMARKS
VALUES('1BY17CS505','17CS04','CSE6C',08,11,15,NULL);
INSERT INTO IAMARKS
VALUES('1BY16CS701','16CS01','CSE8A',25,10,15,NULL);
INSERT INTO IAMARKS
VALUES('1BY16CS702','16CS01','CSE8A',8,25,30,NULL);
INSERT INTO IAMARKS
VALUES('1BY16CS703','16CS01','CSE8B',17,18,19,NULL);
INSERT INTO IAMARKS
VALUES('1BY16CS704','16CS01','CSE8B',25,10,15,NULL);
INSERT INTO IAMARKS
VALUES('1BY16CS705','16CS01','CSE8C',8,25,30,NULL);

https://hemanthrajhemu.github.io
14 | P a g e https://hemanthrajhemu.github.io

INSERT INTO IAMARKS


VALUES('1BY16CS701','16CS02','CSE8A',25,10,15,NULL);
INSERT INTO IAMARKS
VALUES('1BY16CS702','16CS02','CSE8A',8,25,30,NULL);
INSERT INTO IAMARKS
VALUES('1BY16CS703','16CS02','CSE8B',17,18,19,NULL);
INSERT INTO IAMARKS
VALUES('1BY16CS704','16CS02','CSE8B',25,10,15,NULL);
INSERT INTO IAMARKS
VALUES('1BY16CS705','16CS02','CSE8C',5,15,30,NULL);
INSERT INTO IAMARKS
VALUES('1BY16CS701','16CS03','CSE8A',25,10,15,NULL);
INSERT INTO IAMARKS
VALUES('1BY16CS702','16CS03','CSE8A',8,25,30,NULL);
INSERT INTO IAMARKS
VALUES('1BY16CS703','16CS03','CSE8B',15,15,30,NULL);
INSERT INTO IAMARKS VALUES('1BY16CS704','16CS03','CSE8B',4,7,25,NULL);
INSERT INTO IAMARKS
VALUES('1BY16CS705','16CS03','CSE8C',8,25,30,NULL);
INSERT INTO IAMARKS
VALUES('1BY16CS701','16CS04','CSE8A',5,15,30,NULL);
INSERT INTO IAMARKS
VALUES('1BY16CS702','16CS04','CSE8A',8,25,30,NULL);
INSERT INTO IAMARKS VALUES('1BY16CS703','16CS04','CSE8B',4,7,25,NULL);
INSERT INTO IAMARKS
VALUES('1BY16CS704','16CS04','CSE8B',25,10,15,NULL);
INSERT INTO IAMARKS VALUES('1BY16CS705','16CS04','CSE8C',4,7,25,NULL);

-------------------------------------------------------------------------------------------------------

https://hemanthrajhemu.github.io
15 | P a g e https://hemanthrajhemu.github.io

-------------------------------------------------------------------------------------------------------
RETRIEVAL OF INSERTED VALUES
-------------------------------------------------------------------------------------------------------
1. STUDENT
SELECT * FROM STUDENTS;

https://hemanthrajhemu.github.io
16 | P a g e https://hemanthrajhemu.github.io

2. SEMSEC
SELECT * FROM SEMSEC;

https://hemanthrajhemu.github.io
17 | P a g e https://hemanthrajhemu.github.io

3. CLASS1
SELECT * FROM CLASS1;

https://hemanthrajhemu.github.io
18 | P a g e https://hemanthrajhemu.github.io

4. SUBJECT
SELECT * FROM SUBJECT;

5. IAMARKS
SELECT * FROM IAMARKS;

https://hemanthrajhemu.github.io
19 | P a g e https://hemanthrajhemu.github.io

https://hemanthrajhemu.github.io
20 | P a g e https://hemanthrajhemu.github.io

-------------------------------------------------------------------------------------------------------
QUERIES
-------------------------------------------------------------------------------------------------------
1. List all the student details studying in fourth semester ‘C’ section.
SELECT S.USN,S.SNAME,S.ADDRESS,S.PHONE,S.GENDER,SS.SSID
FROM STUDENT S,SEMSEC SS,CLASS1 C
WHERE SS.SSID=C.SSID AND C.USN=S.USN AND SS.SEM=4 AND SS.SEC='C';

https://hemanthrajhemu.github.io
21 | P a g e https://hemanthrajhemu.github.io

2. Compute the total number of male and female students in each


semester and in each section.
SELECT SS.SEM,SS.SEC,S.GENDER,COUNT(S.GENDER) AS COUNT
FROM STUDENT S,SEMSEC SS,CLASS1 C
WHERE S.USN=C.USN AND SS.SSID=C.SSID
GROUP BY SS.SEM,SS.SEC,S.GENDER ORDER BY SEM;

https://hemanthrajhemu.github.io
22 | P a g e https://hemanthrajhemu.github.io

3. Create a view of Test1 marks of student USN ‘1BY17CS501’ in all


subjects.
CREATE VIEW TEST1 AS
SELECT M.USN,M.SUBCODE,M.TEST1
FROM IAMARKS M,SUBJECT S
WHERE S.SUBCODE=M.SUBCODE AND M.USN='1BY17CS501' AND
M.SUBCODE IN
(SELECT SUBJECT.SUBCODE FROM SUBJECT WHERE SEM=6);

SELECT * FROM TEST1;

https://hemanthrajhemu.github.io
23 | P a g e https://hemanthrajhemu.github.io

4. Calculate the FinalIA (average of THREE test marks) and update the
corresponding table for all students.
SELECT * FROM IAMARKS;

https://hemanthrajhemu.github.io
24 | P a g e https://hemanthrajhemu.github.io

UPDATE IAMARKS M
SET FINALIA = (SELECT SUM(TEST1+TEST2+TEST3)/3 FROM IAMARKS M2
WHERE M2.USN=M.USN AND M2.SUBCODE=M.SUBCODE);

https://hemanthrajhemu.github.io
25 | P a g e https://hemanthrajhemu.github.io

SELECT * FROM IAMARKS; (AFTER THE UPDATE COMMAND)

https://hemanthrajhemu.github.io
26 | P a g e https://hemanthrajhemu.github.io

5. Categorize students based on the following criterion:


If FinalIA = 17 to 20 then CAT = ‘Outstanding’
If FinalIA = 12 to 16 then CAT = ‘Average’
If FinalIA< 12 then CAT = ‘Weak’
Give these details only for 8th semester A, B, and C section students.
SELECT S.USN,S.SNAME,IA.FINALIA,IA.SUBCODE,
(CASE
WHEN IA.FINALIA BETWEEN 17 AND 30 THEN 'OUTSTANDING'
WHEN IA.FINALIA BETWEEN 12 AND 17 THEN 'AVERAGE'
WHEN IA.FINALIA < 12 THEN 'WEAK'
ELSE 'NO_DATA'
END) AS RESULTS
FROM STUDENT S, SEMSEC SS, IAMARKS IA, SUBJECT SUB
WHERE S.USN = IA.USN AND
SS.SSID = IA.SSID AND
SUB.SUBCODE = IA.SUBCODE AND
SUB.SEM = 8;

https://hemanthrajhemu.github.io
27 | P a g e https://hemanthrajhemu.github.io

-------------------------------------------------------------------------------------------------------
THE END
-------------------------------------------------------------------------------------------------------

https://hemanthrajhemu.github.io

You might also like