Page 187 - Informatics_Practices_Fliipbook_Class12
P. 187
Assertion Reasoning Based Questions
The following questions are Assertion(A) and Reasoning(R) based questions. Mark the correct choice as
a. Both A and R are true and R is the correct explanation of A
b. Both A and R are true and R is not the correct explanation of A
c. A is true but R is false
d. A is false but R is true
1. Assertion(A): DDL commands are used to describe the structure of a database.
Reasoning(R): The attributes of tables that are already existing can be added, deleted, or modified in a database.
2. Assertion(A): SELECT is a DML command.
Reasoning(R): A DML command is used to retrieve and modify data from a table in a database.
3. Assertion(A): A table will either have a primary key or a composite key.
Reasoning(R): If a table has more than one attribute as the primary key, it is collectively known as a composite key.
Ans. 1. b 2. a 3. b
Case-based Questions
1. Tia is in class 12 and is learning SQL. As the school is about to begin with the Annual Theatre Festival, her teacher has
asked her to create the following table in MySQL that will store the schedule of all plays that will be enacted during the
festival:
Table: THEATRE
TCODE TITLE AUDI LANGUAGE SHOWDATE TICKET PRICE
T001 Akbar The Great Nahi Rahe 2 Hinglish 2023-05-12 150
T002 Mughle-E-Azam 1 Hindi 2023-05-08 200
T003 Romeo and Juliet 2 English 2023-05-09 125
T004 The Lost Love 2 English 2023-05-10 100
T005 Salaam Noni Appa 1 Hindi 2023-05-12 250
(i) Write the command to create the given table with TCODE as primary key. None of the fields should be left blank.
(ii) Write the following SQL queries:
a. To display the names of plays that will be staged in Audi 1.
b. To display the records of those plays that have language as Hindi.
c. To display the names of plays that have ticket price of more than 200.
d. To display the count of plays that will be screened Hindi and English languages.
e. To display the names of plays in alphabetical order.
f. To add an attribute TROUPE to the table. The attribute is of type string OF SIZE 40 and cannot be left blank.
g. To delete the records of those plays that are staged in Audi 1.
Ans. (i) Command to create table:
CREATE TABLE THEATRE
(
TCODE CHAR(5) PRIMARY KEY,
TITLE CHAR(20) NOT NULL,
AUDI INT,
LANGUAGE CHAR(15),
Database Query using SQL 173

