# Unseen Passage

For Class 4 to Class 12

# Querying and SQL Functions MCQ Class 12 Informatics Practices

Please refer to Chapter 1 Querying and SQL Functions MCQ Class 12 Informatics Practices with answers below. These multiple-choice questions have been prepared based on the latest NCERT book for Class 12 Informatics Practices. Students should refer to MCQ Questions for Class 12 Informatics Practices with Answers to score more marks in Grade 12 Informatics Practices exams. Students should read the chapter Querying and SQL Functions and then attempt the following objective questions.

## MCQ Questions Class 12 Informatics Practices Chapter 1 Querying and SQL Functions

Querying and SQL Functions MCQ Class 12 Informatics Practices provided below covers all important topics given in this chapter. These MCQs will help you to properly prepare for exams.

Question: Which one of the following uniquely identifies the tuples / rows in a relation.
(a) Secondary Key
(b) Primary Key
(c) Composite Key
(d) Foreign Key

B

Question: A ____ is a property of the entire relation, which ensures through its value that each tuple
is unique in a relation.
(a) Rows
(b) Key
(c) Attributes
(d) Fields

B

Question: A relational database can have how many type of keys in a table ?
(a) Candidate Key
(b) Primary Key
(c) Foreign Key
(d) All of these

D

Question: Which of the following is a group of one or more attributes that uniquely identifies a row?
(a) Key
(b) Determinant
(c) Tuple
(d) Relation

A

Question: The Primary key is selected from the set of __________.
(a) Composite Key
(b) Determinants
(c) Candidates Key
(d) Foreign Key

C

Question: An attribute in a relation is a foreign key if it is the ______ key in any other relation.
(a) Candidate
(b) Primary
(c) Super
(d) Sub

B

Question: Which of the following attributes cannot be considered as a choice for Primary Key ?
(a) Id
(c) Dept_Id
(d) Street

D

Question: Which of the following is not a legal sub-language of SQL ?
(a) DDL
(b) QAL
(c) DML
(d) TCL

B

Question: Consider the table with structure as :
Student(ID, name, dept_name, tot_cred)
In the above table, which attribute will form the primary key?
(a) name
(b) dept_name
(c) Total_credits
(d) ID

D

Question: In SQL, which of the following will select only one copy of each set of duplicate rows from a table.
(a) SELECT UNIQUE
(b) SELECT DISTINCT
(c) SELECT DIFFERENT
(d) All of these.

B

Question: Which of the following is a DDL command?
(a) SELECT
(b) ALTER
(c) INSERT
(d) UPDATE

B

Question: Which of the following SQL commands retrives data from table(s) ?
(a) UPDATE
(b) SELECT
(c) Union
(d) All of these

B

Question: The___ clause of SELECT query allows us to select only those rows in the result that satisfy a specified condition.
(a) where
(b) from
(c) having
(d) like

A

Question: Which of the following keywords will you use in the following query to display the unique values of the column dept_name?
SELECT________ dept_name FROM COMPANY;
(a) All
(b) From
(c) Distinct
(d) Name

C

Question: Which operator checks a value against a range of values?
(a) BETWEEN
(b) LIKE
(c) IN
(d) NOT

A

Question: Which operator can take wild card characters for query condition?
(a) BETWEN
(b) LIKE
(c) IN
(d) NOT

B

Question: Which of the following queries contains an error ?
(a) Select * from emp where empid=10003;
(b) Select empid from emp where empid=10006;
(c) Select empid from emp;
(d) Select empid where empid=10009 and lastname= ‘GUPTA’;

D

CASE STUDY BASED QUESTIONS

Furn Fly is a furniture company selling furniture to customers of its store and operates a follows:
• The store does not keep the furniture in stock.
• The company places orders for the furniture required from its suppliers ONLY AFTER a customer places an order at the store.
• When the ordered furniture arrives at the store, the customer is informed via telephone or e-mail that it is ready for delivery.
• Customers often order more than one type of furniture on the same order, for example, a sofa, two puffy chairs and centre table.
Details of the furniture, customers and orders are to be stored in a relational database using the following four relations :
Database Name :FurnFly Furnishers
Furniture (FurnitureID : Char(7), FurnitureName : Varchar(50), Category : Varchar(25), Price : Float, SupplierName : Varchar(100))
CustomerOrder(OrderId : Number(8,0), CustomerID : Char(10), OrderDate:Date)
CustomerOrderLine :(OrderID : Number(8,0), FurnitureID: Char(7), Quantity:
Number(4,0))
Customer :(CustomerID : Char(10), CustomerName:Varchar(100), EmailAddress :
Varchar(30), TelephoneNumber: Number(15,0))

Question: Identify the relation having composite primary key and its primary key.
Answer: Identify the relation having composite primary key and its primary key.

Question: Identify the relationships among tables.
Answer: Identify the relationships among tables.

Question: A fault has been identified with the furnitureID number 6281. The manager needs to known how many orders need to be recalled. Write a SQL query for the same.
Answer: A fault has been identified with the furnitureID number 6281. The manager needs to known how many orders need to be recalled. Write a SQL query for the same.

Question: Write a SQL query to create table customerOrder. It should also define required primary key and foreign key(s)
Answer: Write a SQL query to create table customerOrder. It should also define required primary key and foreign key(s)

Question: A customer with ID number ‘C5104’ wants to change his registered telephone number as 9988776655. Write a SQL query to achieve this.
Answer: A customer with ID number ‘C5104’ wants to change his registered telephone number as 9988776655. Write a SQL query to achieve this.

Fill in the Blanks

Question: A database can be opened with _________ <database> command.

USE

Question: By default, ORDER BY clause lists the records in _______ order.

ASCENDING

Question:_______ _______ command is used to create new relations in a database.

CREATE TABLE

Question: The _________ constraint creates a foreign key.

REFERENCES

Question: To define a column as a primary key, _______ ________ constraint is used in CREATE TABLE.

PRIMARY KEY

Question: A ______ is a condition or check applicable on a field or set of fields.

CONSTRAINT

Question: _______ ________ is used to insert data in an existing table.

INSERT INTO

Question: To increase the size of a column in an existing table, use commond _________.

ALTER TABLE

Question: Rows of a table can be deleted using ________ command.

DELETE

Question: _______ _______ command is used to alter the definition of already created table.

ALTER TABLE

True and False Questions

Question: You can use the INSERT statement only to add one new row and not multiple new rows to an existing table.

False

Question: ORDER BY can be combined with SELECT statement.

True

Question: The HAVING clauses can take any valid SQL function in its condition.

False

Question: Length() is a numeric function.

False

Question: Functions MID() and SUBSTR() do the same thing.

True

Question: INSTR() and SUBSTR() work identically.

False

Question: The HAVING and WHERE clause are interchangeable.

False

Question: Equi Join contains the duplicate columns

True

Question: Natural Join contains the duplicate columns

False

Question: Non- Equi Join is the name of Natural Join