This document contains 4 SQL assignments with multiple parts each. The assignments involve writing SQL queries to retrieve information from tables like schoolbus, GRADUATE, TEACHER, and PRODUCT. Some examples of queries include finding the sum, min, max, avg of columns; filtering rows by conditions; aggregating data by columns; retrieving distinct values; sorting results; and more. The goal of the assignments is to practice common SQL functions and queries on different database tables.
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 ratings0% found this document useful (0 votes)
61 views4 pages
SQL Functions: Assignments Q
This document contains 4 SQL assignments with multiple parts each. The assignments involve writing SQL queries to retrieve information from tables like schoolbus, GRADUATE, TEACHER, and PRODUCT. Some examples of queries include finding the sum, min, max, avg of columns; filtering rows by conditions; aggregating data by columns; retrieving distinct values; sorting results; and more. The goal of the assignments is to practice common SQL functions and queries on different database tables.
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/ 4
SQL FUNCTIONS
ASSIGNMENTS Q.1
a. Give the output of following queries based on schoolbus table:
(i) select sum(distance) from schoolbus where transporter= “Yadav travels”; (ii) select min(noofstudents) from schoolbus; (iii) select avg(charges) from schoolbus where transporter= “Anand travels”; (iv) select distinct transporter from schoolbus; b. Write sql query for following (i) Display area_covered in uppercase along with distance (ii) Display area_covered with largest length(number of characters) (iii) Display area_covered with largest distance (iv) Display the list of schoolbus where rightmost part of transporter is travels (v) Display the total distance covered by ‘Anand travels’ (vi)Display the transporter which charges maximum with regards to all area covered taken together. Q.2
a. Give the output of following sql statement based on table
GRADUATE: (i) Select MIN(AVERAGE) from GRADUATE where SUBJECT=‖PHYSICS‖; (ii) Select SUM(STIPEND) from GRADUATE WHERE div=2; (iii) Select AVG(STIPEND) from GRADUATE where AVERAGE>=65; (iv) Select COUNT(distinct SUBDJECT) from GRADUATE;
b. Write sql query for following
(i) Display the name of the students in lower case (ii) Display the average stipend of COMP.SC. subject (iii) Display the name , stipend of student where subject is either physics or maths (iv) Display the subject with maximum stipend (v) Display the subject with maximum stipend(sum of stipend of all student for each subject) 3.
a. Give the output of the following SQL statements.
i. Select COUNT(distinct department) from TEACHER; ii. Select MAX(Age) from TEACHER where SEX=‘F‘; iii. Select AVG(Salary) from TEACHER where SEX=‘M‘; iv. Select SUM(Salary) from TEACHER where DATOFJOIN<{12/07/96}; b. Write SQL query for following i. Display the teacher name with maximum age ii. Display the teacher name with minimum salary iii. Display the department where maximum salary is being given iv. Display the name of the teacher where year of dateofadm is 98 v. Display the name of the teacher whose day of dateofadm is Monday vi. Display how many males and females are there in teacher table 4.
a. Give the output of following statement.
(i) Select COUNT(distinct company) from PRODUCT. (ii) Select MAX(price)from PRODUCT where WARRANTY<=3 (iii) select avg(price) from PRODUCT (IV) SELECT MAX(STOCK),PNAME FROM PRODUCT
b. Write SQL query for following
i. Display the product with oldest manufacturing date ii. Display the product with maximum warranty iii. Display the recent product iv. Display the costliest TV company v. Display manufacturing year of all products vi. Display the product manufactured in MAR month vii. display the product name with maximum length.