Class 12 – Information Technology [Code 802]
Unit 1 – Database Concepts
Question Bank
Based on the CBSE Sample Question Paper from 2018-2022
800+Questions XII Information Technology Code 802
Buy Chapter wise Question bank Class 12 Information Technology 802
800+Questions XII Information Technology Code 802
Que 1. The number of attributes in a relation is called the ____________of a relation. [CBSE SQP]
a. Tuple b. Table c. Cardinality d. Degree
Answer: Degree
Que 2. In order to restrict the values of an attribute within a range, _________constraint to be used. [CBSE SQP]
a. Check b. NULL c. Default d. NOT NULL
Answer: Check
Que 3. _______________ command is used to eliminate duplicate values of an attribute in the select query. [CBSE SQP]
a. Update b. Unique c. Distinct d. No Duplicate
Answer: Distinct
Que 4. _____________ command is used to delete the structure of the table. [CBSE SQP]
a. Drop Table b. Drop Database c. Delete Table d. Alter Table
Answer: Drop Table
Que 5. Sana has given the following query but she is unable to execute it successfully. Write the correct query after rectifying the error. [CBSE SQP]
Select Name, Marks From student Table Where Name =”P%
Answer: Select Name, Marks from student Where Name like ”P%”;
Que 6. Differentiate between DDL and DML. [CBSE SQP]
Answer: DDL vs DML
- DDL
- (i) DDL is a language which is used to define structure and constraints of data
- (ii) DDL – Create table, Alter table, Drop table
- DML
- (i) DML is used to insert, modify and delete data in a database.
- (ii) DML- Insert, Update Delete
Que 7. Consider the following table Doctor and answer the following Queries in SQL. [CBSE SQP]
ID | Department | OPD_DAYS | Doctor_Name | Fee |
H201 | ENT | MWF | Akaash Arora | 400 |
H308 | Oncology | TTS | Dharma Sharma | 600 |
H907 | Paediatrics | MWF | Sanjay Singh | 500 |
H896 | ENT | TTS | Praveen Sethi | 400 |
H675 | Gynecology | TTS | Kavita Sharma | 450 |
H357 | Haematology | MWF | Dinesh Chaudhry | 600 |
I. To display the name of all Doctors who visit OPD on ‘MWF’
Answer: SELECT DOCTOR_NAME FROM DOCTOR WHERE OPD_DAYS = ”MWF”;
II. To display the all the details of Doctors whose Department ends with ‘y’
Answer: SELECT * FROM DOCTOR WHERE DEPARTMENT LIKE ‘%Y’;
III. To count the Number of Doctors in ENT Department
Answer: SELECT COUNT(*) FROM DOCTOR WHERE DEPARTMENT = ’ENT’;
IV. To display names and the fee of doctors in the descending order of fee
Answer: SELECT DOCTOR_NAME, FEE FROM DOCTOR ORDER BY FEE DESC;
V. To add a new column Phone No to a table Doctor
Answer: ALTER TABLE DOCTOR ADD PHONE_NO CHAR(10);
Que 8. _____________is a collection of raw facts which have not been processed to reveal useful information. [CBSE SQP]
Answer: Data
Que 9. Define Data Redundancy. [CBSE SQP]
Answer: Same information is stored in more than one file which result in wastage of space.
Que 10. _____________ constraint is used to restrict the values of an attribute within a range. [CBSE SQP]
Answer: Check
Que 11. _______________command is used to modify the base table definition. [CBSE SQP]
a. Create Table b. Alter Table c. Update Table d. Modify Table
Answer: Alter Table
Que 12. Illustrate any two DML commands with the help of suitable example. [CBSE SQP]
Answer: Insert command is used to insert/add a tuple in a table.
Example:
INSERT INTO Student VALUES (101,”Ananya”, “Grover”, ‘F’, ‘1984-08-11’, 1);
Delete Command is used to remove the data from a table.
Example:
DELETE FROM Student WHERE admno=101;
Que 13. List any four advantages of DBMS. [CBSE SQP]
Answer: Following are the advantages
1. Reduction in Redundancy
2. Improved Consistency
3. Improved Availability
4. Improved Security
5. User Friendly
Que 14. Explain the concept of Candidate Key with the help of a suitable example. [CBSE SQP]
Answer: A candidate key is a column, or set of columns, in a table that can uniquely identifies a tuple and is not null. Each table may have one or more candidate keys. It is eligible to be a Primary key
For example: In a table PERSON following are the columns
(Aadhar_number, PAN, Voter_ID_cardno, Name, Date_of_birth, Address).
Out of these Aadhar_number, PAN, Voter_ID_cardno are the candidate keys
Que 15. What is the purpose of group by command? How is it different from Order by command? Give example. [CBSE SQP]
Answer: The GROUP BY statement is used with aggregate functions (COUNT, MAX, MIN, SUM, AVG) to group the result-set by one or more columns.
The ORDER BY keyword is used to sort the result-set in ascending or descending order
Example of Group By
SELECT Dept_No, COUNT(*) AS No_of_Teachers
FROM Teacher GROUP BY Dept_No;
Example of Order By
SELECT First_Name, Last_Name
FROM Teacher ORDER BY First_Name;
Que 16. Radha has given the following query, she is unable to run due to errors, rectify the errors and underline the correction made: [CBSE SQP]
(a) Select unique department from employee:
Answer: Select distinct department from employee:
(b) Select * from employee where name =”%a”;
Answer: Select * from employee where name like ”%a”;
(c) Select name, salary from employee where phone = Null;
Answer: Select name, salary from employee where phone IS Null;
Que 17. Consider the following and answer the questions. [CBSE SQP]
(a) Wrtite a query to create a table TravelAgency.
AgentCode | Char(4) | Primary Key |
AgentName | Varchar(20) | Not Null |
Location | Varchar(25) | |
Package | Varchar(30) | |
Charges | Decimal(10,2) |
Answer:
Create table TravelAgency (
AgentCode char(4) primary key,
AgentName varchar(20),
Location Varchar(25),
Package Varchar(30),
Charges decimal(10,2)
);
(b) Wtite a query to add a new row to a table TravelAgency
(“A006”, “John Sharon”, “Sam Ana Travel”, “Domestic”, 45000)
Answer: INSERT INTO TravelAgency VALUES (“A006”, “John Sharon”, “Sam Ana Travel”, “Domestic”, 45000);
(c) Write a query to add a new column EmailId to a table TravelAgency
Answer: ALTER TABLE TravelAgency ADD EmailId VARCHAR(30);
Que 18. ______ command is used to modify the value of attribute of one or more tuple in a table. [CBSE SQP]
a. Update b. Modify c. Alter d. Create
Answer: Update.
Que 19. Keyword used to display the structure of the table. [CBSE SQP]
a. Describe b. Show c. Select d. Display
Answer: Describe
Que 20. ______ constraint is used to restrict the values of an attribute within a range. [CBSE SQP]
Answer: Check
800+Questions XII Information Technology Code 802
Buy Chapter wise Question bank Class 12 Information Technology 802
800+Questions XII Information Technology Code 802
Que 21. SELECT DISTINCT DEPT_NAME FROM DEPARTMENT;
What does the above query do? [CBSE SQP]
a) It gives all the tuples having dept_name
b) It gives the dept_name attribute values of all tuples without repetition
c) It gives all the dept_name attribute of all the tuples
d) It gives all the dept_name attribute of all the tuples
Answer: It gives the dept_name attribute values of all tuples without repetition
Que 22. Define Referential Integrity. [CBSE SQP]
Answer: Referential Integrity is used to check that data entered in one relation is consistent with the data entered in another relation.
Que 23. _________ is use to apply condition with GROUP BY [CBSE SQP]
a. HAVING b. WHERE c. ORDER BY d. APPLY
Answer: a. HAVING
Que 24. _________ is not an aggregate function. [CBSE SQP]
a. Sum() b. Count() c. Round() d. Avg()
Answer: c. Round()
Que 25. ____________ replaces zero or more number of random character, when used with Like keyword. [CBSE SQP]
a. _ b. % c. $ d. @
Answer: b. %
26. __________ command which displays list of databases available on the current server.
[CBSE SQP]
i. Show databases
ii. Show tables
iii. Create tables
iv. Display tables
Answer: Show databases.
Que 27. Define Data Redundancy. [CBSE SQP]
Answer: Same information is stored in more than one file which result in wastage of space.
Que 28. ________is a collection of raw facts which have not been processed to reveal useful information. [CBSE SQP]
Answer: Data
Que 29. Which SQL keyword is used to sort the result? [CBSE SQP]
a) ORDER BY b) SORT c) ORDER d) SORT BY
Answer: Order By
Que 30. ____________ commands deletes the tuples from a Table. [CBSE SQP]
i. Drop ii. Delete iii. Modify iv. None of the above
Answer: Delete
Que 31. Explain Drop table with Cascade command. [CBSE SQP]
Answer: Drop Table will be dropped and with the CASCADE option, i.e. all the constraints that refer this table would also be automatically dropped.
Example
DROP TABLE TEACHER CASCADE;
800+Questions XII Information Technology Code 802
Buy Chapter wise Question bank Class 12 Information Technology 802
800+Questions XII Information Technology Code 802
Que 32. A company is making database of Employees having Personal details and Salary details table. Personal details table have columns Empid, Name, Address, BloodGroup. Suggest Columns for Salary details Table. [CBSE SQP]
Answer: Empid, Basic, Leave, Project_details, Deductions, Allowances
Que 33. Mention at least 2 work areas which uses Database Management Systems. [CBSE SQP]
Answer: School Management, Hotel Management, Railway reservation, Employee management
Que 34. Jatin has given the following query from the table Student but he is unable to execute it successfully. Write the correct query after rectifying the error. [CBSE SQP]
SELECT NAME, MARKS FROM STUDENT TABLE WHERE NAME =”P%”
Answer: SELECT NAME, MARKS FROM STUDENT WHERE NAME LIKE ‘P%’
Que 35. Consider the following table and write SQL statements. [CBSE SQP]
Table – Menu
ID | Item | Description | Price |
P001 | Sambar Vada | South Indian | 40 |
P002 | Dal Maakhani | North Indian | 150 |
P003 | Noodles | Chineese | 100 |
P004 | Idli Sabar | South Indian | 50 |
P006 | Sarson Saag | North Indian | 170 |
P007 | Dosa | South Indian | 120 |
P008 | Pizza | Italian | 200 |
i. To add a new row with the following data “P009”, “Lemon Rice”, “South Indian”, 140
ii. Display details of all Menu items in the descending order of Price
iii. Display Item and Description of those Items whose price is between 100 and 150
iv. Add a new column Rating datatype as int to the table Menu
Answer:
(i) INSERT INTO MENU VALUES (“P009”, “LEMON RICE”, “SOUTH INDIAN”, 140);
(ii) SELECT * FROM MENU ORDER BY PRICE;
(iii) SELECT ITEM, DESCRIPTION FROM MENU WHERE PRICE BETWEEN 100 AND 150;
(iv) Cardinailty – 7 Degree – 4
(v) ALTER TABLE MENU ADD RATING INT;
Que 36. Which SQL keyword is used to display the data based on certain pattern? [CBSE SQP]
a. LIKE b. IN c. BETWEEN d. RANGE
Answer: a. LIKE
Que 37. Sagun is creating a table SALESMAN with fields Salesman number, Name, Total Sales. She doesn’t want the Total Sales column to be remain unfilled i.e. she wants to make entry in this field mandatory. Which constraint she should use at the time of creating SALESMAN table: [CBSE SQP]
a. Check b. Default c. Not null d. Primary key
Answer: c. NOT NULL
Que 38. Ranjana wants to delete the records where name starts with ‘A’ from the table CUSTOMER having fields Name, Amount, Discount. Identify the correct command: [CBSE SQP]
a. Delete CUSTOMER where name like “A%”;
b. Delete from CUSTOMER where name like “A%”;
c. Delete CUSTOMER where name = “A%”;
d. Delete from CUSTOMER where name = “A%”;
Answer: b. Delete from CUSTOMER where name like “A%”;
Que 39. Consider a table STAFF: [CBSE SQP]
Name | City |
Akash | Mumbai |
Ajay | Chennai |
Banit | Delhi |
Fauzia | Mumbai |
Sakal | Chennai |
Select the command which will count the number of people in each city.
a. SELECT COUNT(City) , City FROM STAFF WHERE GROUP BY City;
b. SELECT COUNT(City) , City FROM STAFF GROUP BY City;
c. SELECT COUNT(City) , City FROM STAFF WHERE ORDER BY City;
d. SELECT COUNT(City) , City FROM STAFF ORDER BY City;
Answer: b. SELECT COUNT(City) , City FROM STAFF GROUP BY City;
Que 40. Consider the Table EMPLOYEE given below: [CBSE SQP]
Name | Zone | Age | Dept |
Harit | West | 28 | 10 |
Kritika | Centre | 30 | 10 |
Naveen | East | 40 | 20 |
Uday | North | 38 | 30 |
Nupur | East | 24 | 20 |
Moksh | South | 28 | 10 |
Shelly | North | 24 | 30 |
Choose the correct query/queries that will give the following output:
Name |
Harit |
Kritika |
Moksh |
i. SELECT NAME FROM EMPLOYEE WHERE DEPT IN (10);
ii. SELECT NAME FROM EMPLOYEE WHERE AGE BETWEEN 25 AND 30;
iii. SELECT NAME FROM EMPLOYEE WHERE NAME LIKE “%I%”;
iv. SELECT NAME FROM EMPLOYEE WHERE ZONE IN (“WEST”, “CENTRE”, ”SOUTH”);
Choose the correct option
a. Only (i) b. Both (i) and (ii) c. Both (ii) and (iv) d. All (i), (ii) and (iv)
Answer: d. All (i), (ii) and (iv)
Que 41. The _________ command is used to modify the structure of the table STUDENT in MySQL. [CBSE SQP]
a. MODIFY TABLE STUDENT
b. ALTER TABLE STUDENT
c. ALTER STUDENT
d. MODIFY STUDENT
Answer: b. ALTER TABLE STUDENT
Que 42. Consider a table FACTORY: [CBSE SQP]
YEAR | PRODUCTION |
2008 | 12000 |
2009 | 10000 |
2010 | 10600 |
2011 | 15000 |
2012 | 14500 |
Reema wants to calculate the average production of the years 2008-2012. Help her select the correct SQL command for it: [CBSE SQP]
a. SELECT AVERAGE(PRODUCTION) FROM FACTORY;
b. SELECT AVERAGE(PRODUCTION) FROM FACTORY GROUP BY PRODUCTION;
c. SELECT SUM(PRODUCTION) FROM FACTORY;
d. SELECT AVG(PRODUCTION) FROM FACTORY;
Answer: d. SELECT AVG(PRODUCTION) FROM FACTORY;
Que 43. Garvit wants to change the default value of DISCOUNT in the CUSTOMER table from 10 to 15. Select the most appropriate command to do the same from the following options: [CBSE SQP]
a. ALTER TABLE CUSTOMER ALTER DISCOUNT SET DEFAULT 15;
b. ALTER TABLE CUSTOMER DELETE DISCOUNT SET DEFAULT 15;
c. ALTER TABLE CUSTOMER MODIFY DISCOUNT SET DEFAULT 15;
d. ALTER TABLE CUSTOMER CHANGE DISCOUNT SET DEFAULT 15;
Answer: a. ALTER TABLE CUSTOMER ALTER DISCOUNT SET DEFAULT 15;
Que 44. Consider a table: COACHING having fields CITY_NAME, ENROLMENTS. Shikhar wants to display the data of the above table in ascending order of enrolments. Choose the correct query/queries from the following: [CBSE SQP]
i. Select * from coaching order by enrolments asc;
ii. Select * from coaching order by enrolments desc;
iii. Select * from coaching order by enrolments;
iv. Select * from coaching order by enrolments ascending;
Select the correct option:
a. Only (i) is correct
b. Both (i) and (ii) are correct
c. Both (i) and (iii) are correct
d. Only (iv) is correct
Answer: c. Both (i) and (iii) are correct
Que 45. Geeta wants to know the usage of NULL in MySQL. Help her choose in which of the following case NULL value cannot be assigned to the column Admission_Number: [CBSE SQP]
a. When the Admission_Number is zero
b. When the Admission_Number is not known
c. When the Admission_Number is not available
d. When the Admission_Number is not applicable
Answer: a. When the Admission_Number is zero
Que 46. Which of the following is NOT an advantage of DBMS approach ? [CBSE SQP]
a. All the data is stored at one place. There is no repetition of the same data.
b. There is a single copy of data that is accessed or updated by all the users.
c. The DBA can provide security to the database by controlling users’ database access rights.
d. Designing the database specifications and writing application programs is a time-consuming process.
Answer: d. Designing the database specifications and writing application programs is a time-consuming process.
800+Questions XII Information Technology Code 802
Buy Chapter wise Question bank Class 12 Information Technology 802
800+Questions XII Information Technology Code 802
Que 47. An attribute A of datatype varchar(20) has the value “Keshav”. The attribute B of datatype char(20) has value ”Meenakshi”. How many characters are occupied in attribute A and attribute B? [CBSE SQP]
a. 20, 6
b. 6, 20
c. 9, 6
d. 6, 9
Answer: b. 6,20
Que 48. Consider the table ‘empsal’. [CBSE SQP]
ID | Salary | Dept |
Q101 | 54000 | 10 |
Q103 | 67000 | 20 |
Q105 | 75000 | 20 |
Q109 | NULL | 30 |
Read the following two commands carefully:
i. SELECT COUNT(SALARY) FROM EMPSAL;
ii. SELECT COUNT(*) FROM EMPSAL;
Choose the correct option:
a. Both i and ii will give the same output as 3.
b. The output of i is 3 and the output of ii is 4.
c. Both i and ii will give the same output as 4.
d. The output of i is 4 and the output of ii is 3.
Answer: b. The output of i is 3 and the output of ii is 4.
Que 49. Cardinality of a table is four and degree is three. If two columns and four rows are added to the table what will be the new degree and cardinality of the given table: [CBSE SQP]
a. 5,8
b. 3,4
c. 8,5
d. 4,3
Answer: a. 5,8
50. Consider a table ‘SCORE’: [CBSE SQP]
ROLLNO | NAME | STREAM | OPTIONAL |
1 | Greesha | Science | 10 |
2 | Satish | Commerce | 30 |
3 | Teena | NULL | 20 |
4 | Yasmine | Humanities | 10 |
5 | Yashika | Science | 10 |
5 | Lalit | Humanities | 20 |
Reema wants to display names of those students who have not been assigned any stream. Help her select the correct query:
a. SELECT NAME FROM SCORE WHERE STREAM =NULL;
b. SELECT NAME FROM SCORE WHERE STREAM =NULL;
c. SELECT NAME FROM SCORE WHERE STREAM = “ ”;
d. SELECT NAME FROM SCORE WHERE STREAM IS NULL;
Answer: d. SELECT NAME FROM SCORE WHERE STREAM IS NULL;
Que 51. Consider the table SCORE in Q50. Select the correct query from the options given below to display the names of all streams only once.[CBSE SQP]
a. SELECT DISTINCT STREAM FROM SCORE;
b. SELECT DISTINCT(STREAM) FROM SCORE;
c. SELECT UNIQUE STREAM FROM SCORE;
d. SELECT STREAM FROM SCORE WHERE STREAM = DISTINCT;
Answer: (a) and (b)
Que 52. Consider a Table STORE and OWNER shown below:
Table – STORE
StoreId | StoreName | Location | NoOfEmployee | OpeningYear | OwnerId | |
S101 | Libas | Delhi | 45 | 2007 | A145 | |
S102 | Life Style | Mumbai | 68 | 2000 | B178 | |
S103 | Vogue | Mumbai | 50 | 1999 | B178 | |
S104 | Pantaloon | Chennai | 78 | 2004 | D112 | |
S105 | Max Fashions | Delhi | 80 | 2020 | A145 |
Table – OWNER
OwnerId | OwnerName |
A145 | Divyam Prakash |
B178 | Neha Sultan |
D112 | Gargi Chhabra |
Choose the correct query to display the number of employees present in Delhi and Mumbai. [CBSE SQP]
i. Select SUM(noofemployee), Location from STORE group by location HAVING location in (“Delhi”,”Mumbai”);
ii. Select SUM(noofemployee), Location from STORE group by location WHERE location in (“Delhi”,”Mumbai”);
iii. Select SUM(noofemployee), Location from STORE group by location HAVING location =“Delhi” and location=”Mumbai”;
iv. Select SUM(noofemployee), Location from STORE group by location WHERE location =“Delhi” or location=”Mumbai”;
Choose the correct option:
a. Both i and ii
b. Both ii and iii
c. Both iii and iv
d. Both i and iii
Answer: d. Both I and II
Que 53. Consider the table STORE given in above question (52). Choose the correct query to display Stores names, Location and Date of Opening of stores that were opened before 2015. [CBSE SQP]
a. Select storename, location, OpeningYear from store where OpeningYear <”2015”;
b. Select storename, location, OpeningYear from store where OpeningYear >”2015”;
c. Select storename, location, OpeningYear from store where OpeningYear =2015;
d. Select storename, location, OpeningYear from store where OpeningYear !=2015;
Answer:
a. Select storename, location, OpeningYear from store where OpeningYear <”2015”;
Que 54. Consider the table STORE given in Q52. Radhika wants to add a new column SALE on type integer to the table. Choose the correct query for the same: [CBSE SQP]
a. Add column SALE integer;
b. Alter table add SALE integer;
c. Alter table store add SALE integer;
d. Alter table store modify SALE integer;
Answer: c. Alter table store add SALE integer;
Que 55. Consider the table STORE and OWNER given in Q52. Seema wants to display StoreName and OwnerName of all stores in Mumbai. Help her select the correct query from the options given below: [CBSE SQP]
a. SELECT STORENAME, OWNERNAME FROM STORE, OWNER WHERE STORE.OWNERID=OWNER.OWNERID OR LOCATION=”MUMBAI”;
b. SELECT STORENAME, OWNERNAME FROM STORE, OWNER WHERE STORE.OWNERID=OWNER.OWNERID AND LOCATION=”MUMBAI”;
c. SELECT STORENAME, OWNERNAME FROM STORE, OWNER WHERE LOCATION=”MUMBAI”;
d. SELECT STORENAME, OWNERNAME FROM STORE, OWNER WHERE OWNERID=OWNERID AND LOCATION=”MUMBAI”;
Answer: b. SELECT STORENAME, OWNERNAME FROM STORE, OWNER
WHERE STORE.OWNERID=OWNER.OWNERID AND LOCATION=”MUMBAI”;
Que 56. Consider the table STORE given in Q52. Radhika wants to display the following output: [CBSE SQP]
STOREID | STORENAME | NOOFEMPLOYEE |
S101 | Libas | 45 |
S102 | Life Style | 68 |
Choose the correct command:
i. SELECT STOREID, STORENAME, NOOFEMPLOYEE FROM STORE WHERE STOREID=102 OR STOREID=101;
ii. SELECT STOREID, STORENAME, NOOFEMPLOYEE FROM STORE WHERE STORENAME=”LIBAS” OR STORENAME=”LIFE STYLE”;
iii. SELECT STOREID, STORENAME, NOOFEMPLOYEE FROM STORE WHERE LOCATION=”DELHI” OR LOCATION=”MUMBAI”;
iv. SELECT STOREID, STORENAME, NOOFEMPLOYEE FROM STORE WHERE STORENAME LIKE ”L%”;
Choose the correct option:
a. (i) and (ii) are correct
b. (i), (ii) and (iii) are correct
c. (i), (ii) and (iv) are correct
d. All are correct
Answer: c. (i), (ii) and (iv) are correct
Que 57. Which of the following is true for self-referencing table? [CBSE SQP 2022]
(a) A foreign key constraint can reference columns within the same table.
(b) A primary key constraint can be null.
(c) You cannot delete this table.
(d) You cannot update or delete this table.
Answer: (a) A foreign key constraint can reference columns within the same table.
Que 58. Identify the operator that performs pattern searching in MYSQL. [CBSE SQP 2022]
(a) EXISTS operator
(b) BETWEEN operator
(c) LIKE operator
(d) SEARCH operator
Answer: (c) LIKE operator
Que 59. Name two domains where database management may be used. [CBSE SQP 2022]
Answer: Railway Reservation, Banking System, Store Management, Education System etc.
Que 60. List any two advantages of DBMS. [CBSE SQP 2022]
Answer: Reduction in Redundancy, Improved Consistency, Improved Availability, Sharing of data, Improved Security, User friendly.
Que 61. While entering the data in the table, Seema is not able to leave the column age as blank in the table. What can be the possible reason? [CBSE SQP 2022]
Answer: Because she has set NOT NULL constraint in age column.
Que 62. Which of the following queries will give the same output: [CBSE SQP 2022]
(a) SELECT ROLLNO, NAME FROM STUDENT WHERE SUBJECT IN (‘INFORMATION TECHNOLOGY’,’INFORMATICS PRACTICES’);
(b) SELECT ROLLNO, NAME FROM STUDENT WHERE SUBJECT BETWEEN ‘INFORMATION TECHNOLOGY’ AND ‘INFORMATICS PRACTICES’;
(c) SELECT ROLLNO, NAME FROM STUDENT WHERE SUBJECT =’INFORMATION TECHNOLOGY’ OR SUBJECT =’ INFORMATICS PRACTICES ‘;
(d) SELECT ROLLNO, NAME FROM STUDENT WHERE SUBJECT =’INFORMATION TECHNOLOGY’ AND SUBJECT =’INFORMATICS PRACTICES’;
Answer: (a) and (c)
Que 63. In the table teacher, Riya doesn’t want repeated values in column marks. Rewrite the correct command. [CBSE SQP 2022]
SELECT MARKS FROM TEACHER;
Answer: SELECT DISTINCT MARKS FROM TEACHER;
OR
SELECT DISTINCT(MARKS) FROM TEACHER;
800+Questions XII Information Technology Code 802
Buy Chapter wise Question bank Class 12 Information Technology 802
800+Questions XII Information Technology Code 802
Que 64. Rema wants to input the price of shoes as 999.99. What should be the datatype and size of the column price in the table? [CBSE SQP 2022]
Answer: DECIMAL (5, 2)
Que 65. What is the MYSQL command to list the names of teachers in alphabetical order in the teacher table? [CBSE SQP 2022]
Answer: SELECT NAME FROM TEACHER ORDER BY NAME;
Que 66. Write the command to see the structure of a table? [CBSE SQP 2022]
Answer: DESC OR DESCRIBE
Que 67. The following commands are giving errors. Write the correct MYSQL commands.
[CBSE SQP 2022]
(a) ALTER TABLE STUDENT DELETE MARKS;
(b) SELECT * FROM EMPLOYEE WHERE NAME =‘%S%’;
Answer: (a) ALTER TABLE STUDENT DROP MARKS;
(b) SELECT * FROM EMPLOYEE WHERE NAME LIKE ‘%S%’;
Que 68. Ms Prabha has mistakenly entered ‘‘AMIT’’ instead of ‘‘AMITA’’ in name field of table ‘TEACHER’. Help her to write the correct SQL command to make the desired changes in the table. [CBSE SQP 2022]
Answer: UPDATE TEACHER SET NAME = ‘AMITA’ WHERE NAME=’AMIT’ ;
Que 69. Give any two characteristics of a relational model. [CBSE SQP 2022]
Answer: In relational model,
1. A column is called an Attribute.
2. The value in each tuple is an atomic value.
Que 70. Which aggregate function is used to find the average of all the values for a selected attribute of a table. [CBSE SQP 2022]
Answer: AVG()
Que 71. Write the Mysql commands for the following queries :- [CBSE SQP 2022]
TABLE – TRAIN
TrainID | Station |
0001 | DELHI |
0002 | MUMBAI |
TABLE – COUNTER
TicketID | Date | Cost | TrainNo |
T1 | 12/3/22 | 500 | 0001 |
T2 | 15/5/22 | 450 | 0002 |
T3 | 15/5/22 | 500 | 0001 |
(a) To find all the stations, date for ticket id as T1.
Answer: SELECT , DATE FROM TRAIN, COUNTER
WHERE TRAIN.TrainID = COUNTER.TrainNO and TicketID = “T1”;
(b) To find the total ticket amount collected from each station.
Answer: SELECT SUM(COST), STATION FROM TRAIN, COUNTER
WHERE TRAIN.TrainID = COUNTER.TrainNO GROUP BY STATION;
(c) To displays all the tables created in the current database.
Answer: SHOW TABLES;
(d) To delete table counter along with the information in it.
Answer: DROP TABLE COUNTER;