12 CS Part 2 Practical KVSC-modified
12 CS Part 2 Practical KVSC-modified
12 CS Part 2 Practical KVSC-modified
6. (a.) Find the total number of students in each section in the table
(b.) Display the Stream, Total and average marks stream wise
(c.) To show the records of students in the ascending order of marks.
(d) To show the records of students in the descending order of marks and then by student id in ascending order.
(e.) Display name, Totalmarks of students in each stream scoring highest marks.
(f.) Display name, Totalmarks of students in each section scoring marks greater than 450.
7. Compute the following:
(a.) To rounded of the value 258.7592 two places after decimal.
(b.) To rounded of the value 258.7362 two places before decimal
(c.) To find the result of 5 raise to the power 4 and square root of 144
(d.) To compute the remainder of division of 635 and 12
8. Write command in SQL to create student table as shown below. The structure of student table should be following:
(e.) Add new column Total marks and store total marks in all subjects.
f.) Make rollno as primary key
9. On the table created above in question no. 8 perform the following queries:
(a.) Write command to extract 5 characters of student’s name from third position as “Middle Name”. The
command should also remove all right-side spaces.
(b.) Display student’s name in upper case and corresponding no. of characters in the name from given table
(c.) Display name and the position of string ‘an’ in name column from the given table.
(d.) Write command to extract 6 characters of student’s name from right side. The command should also remove
all left-side spaces.
(e.) Write command to extract 5 characters of student’s name from 4th position. The command should also
remove leading and trailing spaces.
(f.) Write command to display name and join class and section as class and section
(g.) Write query to create a string from ASCII Code values as
1.) 70,65,67,69
2.) 71,79,79.3,68
(h.) Display name with total marks of all students in the format
<Name> ‘ has scored total marks – ‘ <total marks>
(i.) What will be the result of the given query:
SELECT LENGTH(LTRIM(SUBSTR(name,5)));
10. Queries on Date Function
a) Display current date and time.
b) Display name of month for date of birth column.
c) Display date of birth after increasing 10 days in it.
d) Extract the date from current date and time
e) Display Date , Name of Month and Year from Date of birth as ‘Date’, ‘Monthname’ and ‘Year’ respectively.
f) Display date, day and day name from date of birth column.
11. (a.) Display average marks of all the students till 02 decimal places. The column name should be “Average Marks”.
(b.) Display gender, and their maximum and minimum total marks based on each gender.
(c.) Display class and average marks of class 11 and 12.
(d.) Display Class and no of male and females in each class.
(e.) Display subject and average marks in each subject whose marks is greater than 75.
12. Write the SQL query commands based on following tables :
13. Write a program to Integrate SQL with Python by importing the MySQL
module record of employee and display the record.
OUTPUT
***********