0% found this document useful (0 votes)
20 views7 pages

Informatics Practices Term II

Uploaded by

Om Gaikwad
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views7 pages

Informatics Practices Term II

Uploaded by

Om Gaikwad
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 7

Informatics Practices

TERM II
Q1 Create a student table with the student id, name, and marks as attributes where the
student id is the primary key.

Q2 Insert the details of a new student in the above table. (5 records)

Q3 Delete the details of a student in the above table. (Your choice)


Page | 1
Q4 Use the select command to get the details of the students with marks more than 80.

Q5 Find the min, max, sum, and average of the marks in a student marks table.

Q6 Akash writes the following commands for a student table having attributes: roll,
name, age and class.
Command1: select count(*) from student

Page | 2
Command2: select count(age) from student.
He gets the output 10 for the first command but gets an output 8 for the second
command. Explain the reason behind this difference.
 The reason behind this difference is that the count function when applied to
an attribute does not count NULL values. The age attribute must be
containing two NULL values, hence the difference

Q7 Given a number n, write commands in SQL to


(a) compute cube of this number using SQL function.
(b) compute remainder on division of n by another number m using SQL Function.
 (a)- select power(n,3);
 (b)- select mod(n,m);

Q8 A student relation is given below:

(a) Write SQL command to display the class-wise count of students for those classes who
have more than 2 students.

(b) Write an SQL command to find the average marks for class XI and class XII students.

Page | 3
(c) Write an SQL command to display the name and DOB of the youngest Student.

 So The youngest one in the given table is Neha given Birth date 08-12-1995.

Q9 Write the SQL commands which will perform the following operations?
(a) To display the position of a space character in your name (myname).

(b) To display day, month and year from today’s date.

(c) To compute 5 raised to the power remainder on dividing 15 by 4.

Page | 4
(d) To display the leftmost as well as the rightmost character of the string ‘PYTHON’.

Q10 Consider the table Salesman with the given data

Write SQL queries using a function to perform the following operation:


(a) Display maximum sales for each area.

(b) Display the month name from Dojoin of Salesman.

Page | 5
(c) Display those addresses which anywhere contain ‘i’.

(d) Display two characters from Sname starting from the first character for those
salesmen who belong to Delhi.

Q11 Write a Query to display the difference of highest and lowest salary of each
department having maximum salary >4000;
 SELECT MAX(Salary) – MIN(Salary) from dept where salary =>4000;

Q12 Write a Query to display the sum, Average, Highest and Lowest Salary of the
Employees grouped by department number and sub-grouped by job.
 SELECT Deptno,(MAX(Salary) , MIN(Salary), AVG(Salary), SUM(Salary)) from
dept group by Deptno;

Q13 Write a query that counts the number of salespeople registering orders for each
day.(If a salesperson has more than one order on a given day ,he/she should be counted
only once).
Page | 6
 SELECT SalespersonName, COUNT(DISTINCT order_t.SalespersonID) AS
TotalOrderQuantity FROM salesperson.t, order.t WHERE
salesperson.t.SalespersonID = order.t.SalespersonID;

Q14 Which SQL aggregate function is used to count all records of a table?
 The SQL aggregate function used to count all records in a table is COUNT()

Page | 7

You might also like