Visit:: Join Telegram To Get Instant Updates: Contact: MAIL: Instagram: Instagram
Visit:: Join Telegram To Get Instant Updates: Contact: MAIL: Instagram: Instagram
io
INSTAGRAM: www.instagram.com/hemanthraj_hemu/
INSTAGRAM: www.instagram.com/futurevisionbie/
1|Page https://hemanthrajhemu.github.io
----------------------------------------------------------------------------------------------
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
-------------------------------------------------------------------------------------------------------
(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.
NOW RUN.
NOW RUN.
https://hemanthrajhemu.github.io
5|Page https://hemanthrajhemu.github.io
NOW RUN.
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>);
https://hemanthrajhemu.github.io
10 | P a g e https://hemanthrajhemu.github.io
https://hemanthrajhemu.github.io
11 | P a g e https://hemanthrajhemu.github.io
https://hemanthrajhemu.github.io
12 | P a g e https://hemanthrajhemu.github.io
https://hemanthrajhemu.github.io
13 | P a g e https://hemanthrajhemu.github.io
https://hemanthrajhemu.github.io
14 | P a g e https://hemanthrajhemu.github.io
-------------------------------------------------------------------------------------------------------
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
https://hemanthrajhemu.github.io
22 | P a g e https://hemanthrajhemu.github.io
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
https://hemanthrajhemu.github.io
26 | P a g e https://hemanthrajhemu.github.io
https://hemanthrajhemu.github.io
27 | P a g e https://hemanthrajhemu.github.io
-------------------------------------------------------------------------------------------------------
THE END
-------------------------------------------------------------------------------------------------------
https://hemanthrajhemu.github.io