Q.1 Based on the SQL table CAR_SALES, write suitable queries for the following: (6 marks)

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 quater.

iv. SELECT LEFT(SEGMENT,2) FROM CAR_SALES WHERE FUEL= “PETROL”;
v.SELECT (QT2-QT1)/2 “AVG SALE” FROM CAR_SALES WHERE SEGMENT= “SUV”;
vi. SELECT SUM(QT1) “TOT SALE” FROM CAR_SALES WHERE FUEL= “DIESEL”;

Q.2 Preeti manages database in a blockchain start-up. For business purposes, she created a table named BLOCKCHAIN. Assist her by writing the following queries:   (4 marks)

i. Write a query to display the year of oldest transaction.
ii. Write a query to display the month of most recent transaction.
iii. Write a query to display all the transactions done in the month of May.
iv. Write a query to count total number of transactions in the year 2022

Write suitable SQL queries for the following:                              (5 marks)
i. To calculate the exponent for 3 raised to the power of 4.
ii. To display current date and time.
iii. To round off the value -34.4567 to 2 decimal place.
iv. To remove all the probable leading and trailing spaces from the
column userid of the table named user.
v. To display the length of the string ‘FIFA World Cup’

OR

Kabir has created following table named exam: ( 5 marks)

Help him in writing SQL queries to the perform the following task:
i. Insert a new record in the table having following values:
[6,’Khushi’,’CS’,85]
ii. To change the value “IP” to “Informatics Practices” in subject
column.
iii. To remove the records of those students whose marks are less than
30 .
iv. To add a new column Grade of suitable datatype.
v. To display records of “Informatics Practices” subject

Leave a Reply

Your email address will not be published. Required fields are marked *

sign up!

We’ll send you the hottest deals straight to your inbox so you’re always in on the best-kept software secrets.