Академический Документы
Профессиональный Документы
Культура Документы
<EMPLOYEE_ID>.COURSE_INFO
COURSE_NAME varchar2 20
COURSE_DESCRIPTION varchar2 25 0
COURSE_START_DATE Date
COURSE_DURATION Number
NO_OF_PARTICIPANTS Number
COURSE_TYPE Char(3)
<EMPLOYEE_ID>.STUDENT_INFO
FIRST_NAME varchar2 20
LAST_NAME varchar2 25
<EMPLOYEE_ID>.STUDENT_COURSES
<EMPLOYEE_ID>. COURSE_FEES
BASE_FEES Number 10
SPECIAL_FEES Number 10
DISCOUNT Number 5
Objective: Associates should use the DDL statements and create the tables, constraints identified. Also
they should use the appropriate DML statements to load the table with student information.
Problem # 1 Creating Tables : Create following tables using Oracle Client and DDLs.
i. Create Student_Info_<employee_id> table This table is used for storing the student
personal information.
a. Reg_Number Primary Key - Varchar
b. Student_Name - Varchar(30) not null
c. Branch Varchar
d. Contact_Number Varchar
e. Date_of_Birth-Date, not null
f. Date_of_Joining-Date Default value system date.
g. Address-Varchar(250)
h. Email_id-Varchar(250)
ii. Create Subject_Master_<employee_id> table This table is used for storing the subjects
information which are delivered in the university.
a. Subject_Code- Primarykey-varchar2(10)
b. Subject_Name- Varchar, not null
c. Weightage- Number(3), not null
Any new subject addition does not need a change in table design all it needs a new subject
code and a new row in this table.
METTL_MYSQL _PRACTICE_LAB
a. Reg_Number-Foreignkey (Student_Info)-Varchar
b. Subject_Code-Foreignkey (Subject_Master)-varchar2(10)
c. Semester-Number(3) not null
d. Marks-Number (3) default value 0
Student_Info Table_<employee_id>:
Reg_Nu Student_Na Branch Contact_Num Date_of Date_of_ Address Email_id
mber me ber _Birth Joining
MC1013 James MCA 9714589787 12-jan- 08-jul- No james.mc
01 1984 2010 10,South a@yahoo.
Block,Nive com
a
BEC111 Manio ECE 8912457875 23-feb- 25-jun- 8/12,Park manioma
402 1983 2011 View,Sieer @gmail.co
a m
BEEI10 Mike EI 8974567897 10-feb- 25-aug- Cross mike.jame
1204 1983 2010 villa,NY s@ymail.c
om
MB1113 Paulson MBA 8547986123 13-dec- 08-aug- Lake paul.son
05 1984 2010 view,NJ @rediffma
il.com
METTL_MYSQL _PRACTICE_LAB
Subject_Master table_<employee_id>: Green ones are semester 1 and blue ones are semester 2
subjects.
Subject_Cod Subject_Name Weightage
e
EE01DCF DCF 30
EC02MUP Microprocessor 40
MC06DIP Digital Image 30
Processing
MB03MAR Marketing 20
Techniques
EI05IP Instrumentation 40
Precision
CPSC02DS Data Structures 40
BEEI10 EE01DCF 1 85
1204
BEEI10 EC02MUP 1 78
1204
BEEI10 MC06DIP 1 80
1204
BEEI10 MB03MAR 2 75
1204
BEEI10 EI05IP 2 65
1204
METTL_MYSQL _PRACTICE_LAB
BEEI10 CPSC02DS 2 75
1204
MB1113 EE01DCF 1 65
05
MB1113 EC02MUP 1 68
05
MB1113 MC06DIP 1 63
05
MB1113 MB03MAR 2 85
05
MB1113 EI05IP 2 74
05
MB1113 CPSC02DS 2 62
05
Student_Results_<employee_id>: The 5 student results needs to be calculated for the semester and
stored. For data per se load the table with some arbitrary GPA.
Reg Number Semester CGPA Is_Eligible_Sc
holarship
MC101301 1 7.5 Y
BEC111402 1 7.1 Y
BEEI101204 1 8.3 Y
BEEI101204 2 6.9 N
MB111305 1 6.5 N
MB111305 2 6.8 N
Objective: Associates would need to retrieve records using DQL statements as mentioned in the
problem statement below.
1. Write a query which fetches and displays all the students who have an email id.
4. Write a query which displays the student name, registration number and their GPA in descending
order of GPA.
5. Write a query which displays the student information in ascending order of the students name.
6. Write a query which displays the information of students in ascending order of their age.
7. Write a query which will retrieve the registration number, student name, subject name , semester
# and the respective marks of the subject.
8. Write a query which displays the students registration number, student name, marks and
semester# for all semesters ordered by registration number and semester#.
9. Write a query to display the student name , registration number , subject code, subject name,
marks and semester # of all the students who have scored more than 50%.
NOTE, the subject code and the subject name should be displayed in this particular format Subject
Code- Subject Name.
10. Write a query to display the registration number and GPA of each student in such a way that the
students who are eligible for scholarship are displayed first.
11. Write a query to display the registration number, student name, semester number and GPA of
students such that students with high GPA are displayed on top.
12. Write a query to display registration number, student name, the marks of the students, and the
weighted marks.
13. Write a query to display all the students whose name starts with M.
14. Writer a query which retrieves student name, registration number and student marks whose
marks is between 60 and 100.
15. Write a query which retrieves student_name, registration number and student marks whose name
does not start with Character J.
METTL_MYSQL _PRACTICE_LAB
16. Write a query which retrieves student name , registration number and marks of those subjects
whose subject code is either EE01DCF or EC02MUP.
17. Write a query which retrieves all the students whose name ends with on.
18. Write a query which retrieves the student name , registration number and their respective marks
in all semesters whose has an email address.
19. Write a query to display student information such as name, branch in capital letters.
21. Write a query to display the student name and branch in the following format, <Student
Name>with <registration number> is studying in Branch <branch>.
22. Write two separate queries to display the registration number date of birth of all the students in
the following formats
2011/07/23
23. Write a query to display age of each student along with name, contact number and email id.
24. Write a query to display the registration number, student name and average marks secured by
students in each semester.
25. Pick the maximum mark from the students_marks and display the student registration number
and name of those students who have secured the maximum mark.
26. Pick the maximum marks secured in the subject EI05IP and display the student name and
registration number of the student who has secured it.
METTL_MYSQL _PRACTICE_LAB
Rule: Use sub query.
27. Write a query to display total number of candidates eligible for scholarship.
28. Write a query to display the details of students who have secured maximum GPA in each
semester. Hint: Use GROUPBY
29. Write a query to display the student name, registration number and GPA who are eligible for
scholarship.
30. Write a query to display the average GPA for each semester. Display the semester number and
the average.
Hint: Average = Total GPA of all students in a semester/total number of students in a semester
31. Create a view STUDENT_GPA_<employee_id> which has the following details student name,
registration number, semester number and GPA.
32. From the view STUDENT_GPA _<employee_id> display student name, registration number,
semester number and GPA, whose GPA is greater than 5.
35. Write a query which will display all the student records , if the student email id is null it should be
displayed as no valid email address.
36. Write a query which will display the student name, branch,registration number , semester number
and result.Display the full name of EEE as well as ECE branch as mentioned below,
Table: employeeDetails
END AS "Status"
from employeeDetails;
OUTPUT:
METTL_MYSQL _PRACTICE_LAB