Querying and SQL Functions Class 12 Informatics Practices Important Questions

Important Questions Class 12

Students can read the important questions given below for Querying and SQL Functions Class 12 Informatics Practices. All Querying and SQL Functions Class 12 Notes and questions with solutions have been prepared based on the latest syllabus and examination guidelines issued by CBSE, NCERT and KVS. You should read all notes provided by us and Class 12 Informatics Practices Important Questions provided for all chapters to get better marks in examinations. Informatics Practices Question Bank Class 12 is available on our website for free download in PDF.

Important Questions of Querying and SQL Functions Class 12

Question: What is a database?
Answer: A database is a collection of interrelated data

Question: What is data redundancy?
Answer: Data Redundancy meAnswer: duplication of data in a database.

Question: What is metadata ?
Answer: Data about data

Question: What do you mean by degree and cardinality of a table?
Answer: Degree:- No. of columns with in a table.
Cardinality:- No. of rows within a table.

Question: What is tuple?
Answer: Rows in a table are called tuple

Question: What is domain?
Answer: Domain is the pool of values from which actual values appearing in a column are taken.

Question: What is the full form of DBMS?
Answer: Database Management System

Question: Full form of DDL.
Answer: Data Definition Language

Question: Full form of DML.
Answer: Data Manipulation Language

Question: How many primary key can be present in a table ?
Answer: one

Question: What is the full form of SQL?
Answer: Structured Query Language

Question: What is the minimum number of column required in MySQL to create table?
Answer: ONE (1)

Question: Which command is used to add new column in existing table?
Answer: ALTER TABLE

Question: Which command is used to remove the table from database?
Answer: DROP TABLE

Question: Which command is used to add new record in table?
Answer: INSERT INTO

Question: In SQL, name the clause that is used to display the tuples in ascending order of an attribute
Answer: ORDER BY

Question: In SQL, what is the use of IS NULL operator?
Answer: IS NULL used to compare NULL values present in any column

Question: Which of the following types of table constraints will prevent the entry of duplicate rows? a)Unique b)Distinct c)Primary Key d)NULL
Answer: c) Primary Key

Question: Which is the subset of SQL commands used to manipulate database structures, including tables?
a.None of these
b.Both Data Definition Language (DDL) and Data Manipulation Language (DML)
c.Data Definition Language (DDL)
d.Data Manipulation Language (DML)
Answer: c.Data Definition Language (DDL)

1.Consider the table STUDENT given below:

Querying and SQL Functions Class 12 Informatics Practices Important Questions

Question: State the command that will give the output as :

Querying and SQL Functions Class 12 Informatics Practices Important Questions

i. select name from student where class=’XI’ and class=’XII’;
ii. select name from student where not class=’XI’ and
class=’XII’;
iii. select name from student where city=”Agra” OR
city=”Mumbai”;
iv. select name from student where city IN(“Agra”, “Mumbai”);
Choose the correct option:
a. Both (i) and (ii).
b. Both (iii) and (iv).
c. Any of the options (i), (ii) and (iv)
d. Only (iii)
Answer: b. Both (iii) and (iv).

Question: What will be the output of the following command?
Select * from student where gender =”F” order by marks;

Querying and SQL Functions Class 12 Informatics Practices Important Questions

(ii)

Querying and SQL Functions Class 12 Informatics Practices Important Questions
Querying and SQL Functions Class 12 Informatics Practices Important Questions

Question: Prachi has given the following command to obtain the highest marks Select max(marks) from student where group by class;
but she is not getting the desired result. Help her by writing the correct command.
a. Select max(marks) from student where group by class;
b. Select class, max(marks) from student group by marks;
c. Select class, max(marks) group by class from student; 
Answer: 
d. Select class, max(marks) from student group by class; 

Question: State the command to display the average marks scored by students of each gender who are in class XI?
i. Select gender, avg(marks) from student where class= “XI” group by gender;
ii Select gender, avg(marks) from student group by gender where class=”XI”;
iii. Select gender, avg(marks) group by gender from student having class=”XI”;
iv. Select gender, avg(marks) from student group by gender having class = “XI”;
Choose the correct option:
a. Both (ii) and (iii)
b. Both (ii) and (iv)
c. Both (i) and (iii)
d. Only (iv)
Answer: d. Only (iv)

Question: From the given table, Answer:wer the following questions:
TableName-House

Question: Write the degree and cardinality of the above table.
Answer: Degree=3 and cardinality=4

Question: Write the domain of House_Captain attribute.
Answer: Yathin, Hari Narayan, Anil Sharma, Felicita

Question: Write a Query to insert House_Name=Tulip, House_Captain= Rajesh and House_Point=278
Answer: Insert into House values (‘Tulip’,’Rajesh’,278)

Question: Any field of above table can be made Primary key
Answer: House_Points

Question: If we want  to add a new column in above table which SQL command we use
Answer: Alter table House
Add <new column> <data type>;

Question: Write the full forms of DDL and DML. Write any two commands of DML in SQL.
Answer: DDL: Data Definition Language, DML: Data Manipulation Language
DML Commands: SELECT, UPDATE

Question: Mr. Mittal is using a table with following columns :
Name, Class, Streamed, Stream_name
He needs to display names of students who have not been assigned any stream or have been
assigned stream_name that ends with “computers
He wrote the following command, which did not give the desired result.
SELECT Name, Class FROM Students
WHERE Stream_name = NULL OR Stream_name = “%computers” ;
Help Mr. Mittal to run the query by removing the error and write correct query
Answer: SELECT Name, Class FROM Students
WHERE Stream_name IS NULL OR Stream_name = “%computers” ;
Question: What do you understand by Degree and Cardinality of a table?
Answer: Degree: Number of attributes and Cardinality is number of tuples in a relation