Informatics Practices
What are aggregate functions in SQL? Name any two.
SQL Joins & Grouping
2 Likes
Answer
Aggregate functions in SQL work with data from multiple rows at a time and return a single aggregated value.
Examples of aggregate functions include SUM(), COUNT().
Answered By
2 Likes
Related Questions
Differentiate between the active digital footprint and passive digital footprints.
Complete the given Python code to get the required output as: Rajasthan
import ............... as pd di = { 'Corbett' : 'Uttarakhand', 'Sariska ' : 'Rajasthan', 'Kanha' : 'Madhya Pradesh', 'Gir' : 'Gujarat ' } NP = ............... . Series( ............... ) print(NP[ ............... ])Based on the SQL table CAR_SALES, write suitable queries for the following :
NUMBER SEGMENT FUEL QT1 QT2 1 Compact HatchBack Petrol 56000 70000 2 Compact HatchBack Diesel 34000 40000 3 MUV Petrol 33000 35000 4 MUV Diesel 14000 15000 5 SUV Petrol 27000 54000 6 SUV Diesel 18000 30000 7 Sedan Petrol 8000 10000 8 Sedan Diesel 1000 5000 (i) Display fuel wise average sales in the first quarter.
(ii) Display segment wise highest sales in the second quarter.
(iii) Display the records in the descending order of sales in the second quarter.
Predict the output of the following queries based on the table CAR_SALES given below :
NUMBER SEGMENT FUEL QT1 QT2 1 Compact HatchBack Petrol 56000 70000 2 Compact HatchBack Diesel 34000 40000 3 MUV Petrol 33000 35000 4 MUV Diesel 14000 15000 5 SUV Petrol 27000 54000 6 SUV Diesel 18000 30000 7 Sedan Petrol 8000 10000 8 Sedan Diesel 1000 5000 (i) SELECT LEFT(SEGMENT, 2) FROM CAR_SALES WHERE FUEL= "PETROL";
(ii) SELECT (QT2-QT1)/2 "AVG SALE" FROM CAR_SALES WHERE SEGMENT= "SUV";
(iii) SELECT SUM(QT1) "TOT SALE" FROM CAR_SALES WHERE FUEL= "DIESEL";