Important Database questions for Class 12

 

1. What is database?

Database is a collection of interrelated data.

 

2. What is database system?

A combination of computer based record keeping system and database .

 

3. What is Database Management Systems (DBMS)?

A Database Management System (DBMS) is software designed to store, retrieve, define, and manage data in a database. Examples: Ms-Access, MySQL, Microsoft SQL Server, Oracle etc.

 

4. What is relational data model?

A relational data model involves the use of data tables that collect groups of elements into relations. These models work based on the idea that each table setup will include a primary key or identifier.

 

5. What do you mean by Base Table?

A table having an independent existence , represented in storage by a distinct stored file.

 

6. What is data redundancy?

Duplication of data.

Data redundancy arises when the same data piece is stored in two or more separate places, either by accident or intentionally.

 

7.  What is view in database?

A virtual table derived from one or more underlying base tables.

 

8. What is relation in database?

Data arranged in the form of rows and columns and having certain properties.

 

9. What do you mean by domain in database?

A pool of values from which the actual values appearing in a given column are drawn.

 

10. What is attribute in a relation?

A column of a relation. It may also refer as field.

 

Also Read: Introduction to Database Concept Class 12 Notes

 

11. What is tuple in a relation?

A row of a relation. Also known as record.

 

12.  Define a Key?

A key in DBMS is an attribute or a set of attributes that help to uniquely identify a tuple (or row) in a relation (or table).

 

Database concepts for class 12

 

13. What is Primary Key?

primary key, also called a primary keyword, is a key in a relational database that is unique for each record. It is a unique identifier.

 

14. What is Candidate Key?

A Candidate Key is a set of attributes that uniquely identify tuples in a table that can serve as primary key also.

 

15. What is Alternate Key?

A candidate key, which is not primary key.

 

16. What is Foreign Key?

A Foreign Key is a field (or collection of fields) in one table, that refers to the Primary Key in another table.

The table with the foreign key is called the child table, and the table with the primary key is called the referenced or parent table.

 

17. What is Degree?

Number of attributes (columns) in a table/relation is known as degree of that relation.

 

18. What is Cardinality?

Number of tuples (rows) in a table/relation is known as cardinality of that relation.

 

One word Important Database questions for Class 12

 

19. Name the command/clause which is used to display the records in ascending or descending order.

Order by clause

 

20. Give example of any two DML commands.

Insert, Delete

 

21. What is the purpose of SQL?

SQL is structured query language. It is a standard language of all the RDBMS

 

22. What is primary key?

A field which is unique for each and every record in table is called primary key.

 

23. Which command is used to display a list of already existing tables?

Show tables;

 

24. Which command is used to change the structure of table?

Alter

 

25. Which command is used to change the data of the table?

Update

 

26. Which command is used to delete data of the table?

Delete

 

27. Which command delete the structure of table?

Drop

 

28. Which clause is used with aggregate functions? (Group by/ Where)

Group by

 

29. What do you mean by candidate key?

Those fields which can act as primary key is called candidate key

 

30. Correct the error in the following query.

Select * from RECORD where Rname = %math%;

Correct Query: Select * from RECORD where Rname like %math%;

 

31. What is max () function in SQL?

It returns the largest value from a particular column.

 

32. What do you mean by degree and cardinality of table?

Number of columns in table is called degree. Number of rows in a table is called cardinality.

 

33. Expand DDL and DML

DDL – Data Definition Language

DML – Data Manipulation Language

 

34. Which command is used to increase the salary of workers in table salary? (Update / Alter)

Update

 

35. Name the command used to see the structure of table.

Desc

 

36. Which aggregate function is used to find sum of column in a table?

sum()

 

37. What is the difference between having and where clause?

Having clause can be used with group by clause while where clause can be used without group by clause.

 

38. Name an aggregate function in SQL which return the average of numeric values.

Avg ( )

 

39. What is the use of “like” in SQL?

“Like” operator is used to match a particular pattern in a particular column in SQL.

 

40. Correct the following statement: Delete table data;

Delete from data

 

41. What do you mean by aggregate function?

A function which perform calculation on multiple values and return single value

 

42. Write two wild card characters which are used with like operator?

% and underscore( _ )

 

43. Duplication of record is called ____________

Redundancy

 

44. What is the difference between char and varchar?

Char is fixed length data type and varchar is variable length data type

 

Important Database questions for Class 12

 

45. What is the difference between cardinality and degree?.

Degree – The number of attributes or columns in a relation is called the Degree of the relation.

Cardinality – The number of tuples/ rows in a relation is called the Cardinality of the relation.

 

46. Differentiate between WHERE and HAVING clause.

WHERE clause is used to select particular rows that satisfy a condition, whereas HAVING clause is used in connection with the aggregate function, GROUP BY clause

For ex. – select * from student where marks > 75;

This statement shall display the records for all the students who have scored more than 75 marks.

On the contrary, the statement – select * from student group by stream having marks > 75; shall display the records of all the students grouped together on the basis of stream but only for those students who have scored marks more than 75.

 

47. Define Primary Key of a relation in SQL. Give an Example using a dummy table.

Primary Key- one or more attribute of a relation used to uniquely identify each and every tuple in the relation. For Example : In the below Table Student, RollNo can be the Primary Key

RollNo Name Marks

1 Pratham 75

2 Srishti 80

 

48. Consider the following Python code is written to access the record of CODE passed to function: Complete the missing statements:

def Search(eno):

#Assume basic setup import, connection and cursor is created

query=”select * from emp where empno=________”.format(eno)

mycursor.execute(query)

results = mycursor._________

print(results)

 

 

{ } and fetchone()

 

49. Differentiate between DDL and DML with one Example each.

DDL- Data definition language. Consists of commands used to modify the metadata of a table. For Example- create table, alter table, drop table

DML-Data manipulation language. Consist of commands used to modify the data of a table. For Example- insert, delete, update

 

50. Name the package for connecting Python with MySQL database.

import mysql.connector

 

Also Check:

Computer Networking Question and Answer

Important Question Answer for Term 2 Exam

Solved Computer Science Term 2 Sample Papers 

 

51. What is the purpose of cursor object?

It is the object that helps to execute the SQL queries and facilitate row by row processing of records in the resultset.

 

52. What do you mean by domain of an attribute in DBMS? Explain with an example.

Domain of an attribute is the set of values from which a value may come in a column. E.g. Domain of section field may be (A,B,C,D).

 

53. Differentiate between fetchone() and fetchmany() methods with suitable examples.

fetchone() is used to retrieve one record at a time but fetchmany(n) will fetch n records at a time from the table in the form of a tuple.

 

54. What is Constraint ? Give example of any two constraints.

Constraints are the checking condition which we apply on table to ensure the correctness of data . Example primary key, not null, default, unique etc

 

55. Write the steps to perform an Insert query in database connectivity application.

Table ‘student’ values are rollno, name, age (10,’Ashok’,26)

 

import mysql.connector as mydb

conn= mydb.connect(host=”localhost”, user=”root”, passwd=”1234”)

cur=conn.cursor()

cur.execute(“INSERT INTO student values(10,’Ashok’,26);”)

cur.commit()

 

 

56. Define Candidate Key and Alternate Key with suitable examples from a table containing some meaningful data.

A table may have more than one such attribute/group of attributes that identifies a tuple

uniquely, all such attribute(s) are known as Candidate Keys. All the candidate key except primary key are called Alternate key.

 

Table: Employee (empno, aadhar_no, voter_id, ename, deptno, sal, city)

In the above table Employee, empno,aadhar_no, voter_id all are candidate key If we define empno as primary key then remaining candidate keys will be alternate key.

 

57. Define RDBMS. Name any two RDBMS software.

RDBMS stands for Relational Database Management System. It is a program that offers commands to create, update, and manage the data with multiple tables. Examples of RDBMS are 1. MySQL 2. Oracle 3. Microsoft SQL Server.

 

58. What is the purpose of the ORDER BY clauses in a select statement?

Order By : This clause is used to arrange the records in ascending or descending order. for example Select * from book order by price;

 

59. What is the purpose of the HAVING clauses in a select statement?

HAVING Clause in SQL is used to specify conditions on the rows with GROUP BY clause. for example Select sum(price) from book group by (subject) having price > 100;

 

60. Write any two differences between Single_row functions and Aggregate functions.

Single row Functions Multiple row functions :

It operates on a single row at a time.

It returns one result per row

It can be used in Select, Where, and Order by clause.

Math, String and Date functions are examples of single row functions.

 

Aggregate Functions:

It operates on multiple rows.

It returns one result for multiple rows.

It can be used in the select clause only.

 Max(), Min(), Avg(), Sum(), Count() and Count(*) are examples of multiple row functions.

 

Fill in the blanks

 

61. SQL stands for _______ Query Language.

Structured

 

62. A connectivity package such as _______ must be imported before writing database connectivity Python code.

Mysql.connector

 

63. The SQL keyword_______ is used to specify the table(s) that contains the data to be retrieved.

FROM

 

64. To remove duplicate rows from the result of a query, specify the SQL qualifier________ in select list.

DISTINCT

 

65. To obtain all columns, use a(n) _________ instead of listing all the column names in the select list.

Asterisk (*)

 

66. The SQL _______ clause contains the condition that specifies which rows are to the selected.

WHERE

 

67. To sort the rows of the result table, the _________ ________ clause is specified.

ORDER BY

 

68. Columns can be sorted in descending sequence by using the SQL keyword ____________

DESC

 

69. When two conditions must both be true for the rows to be selected, the conditions are separated by the SQL keyword ________

AND

 

70. To refer to a set of values needed for a condition, we can use the SQL operation __________

IN

 

71. To exclude one or more values (a list of values) using a condition, the SQL keyword ________ ________ should be used.

NOT IN

 

72. The SQL keyword _______ is used in SQL expressions to select based on patterns

LIKE

 

73. The SQL built-in function ________ totals values in numeric columns.

SUM

 

74. The SQL built-in function _________ obtains the largest value in a numeric column.

MAX

 

75. The SQL built-in function _________ obtains the smallest value in a numeric column.

MIN

 

76. The SQL built-in function __________ computes the number of rows in a table.

COUNT

 

77. The SELECT clause _________ is used to collect those rows that have the same value in a specified column.

GROUP BY

 

78. ______________ method returns the result set in the form of tuples containing the records or rows returned by the sql table.

Fetchall()

 

79. A session between the application program and the database is called______________

Connection

 

80. A __________ query is used to check if data has been added to the table or not.

Select

 

81. The ______________ function works with data of multiple rows at a time and returns aggregated value.

Group/row/ aggregation function

 

82. The _____ clause lets you arrange the result set in the order of single column, multiple column and custom sort order too.

ORDER BY

 

83. To specify filtering condition for groups, the _____________ clause is used in MYSQL.

Having

 

84. By default, the ORDER BY clauses sorts the result set in the ________ order.

Ascending

 

85. To sort the result set in descending order, ___________ keyword is used with ORDER BY.

DESC

 

True/False Questions

 

86. The condition in a WHERE clause in a SELECT query can refer to only one value

 False

 

87. SQL provides the AS keyword, which can be used to assign meaningful column names to the results of queries using the SQL built-in functions.

True

 

88. The rows of the result relation produced by a SELECT statement can be sorted but only by one column.

False

 

89. SQL is a programming language.

False

 

90. SELECT DISTINCT is used if a user wishes to see duplicate columns in a query.

False

 

91. The HAVING clause acts like a WHERE clause, but it identifies groups that meet a criterion, rather than rows.

True

 

92. The qualifier DISTINCT must be used in an SQL statement when we want to Eliminate duplicate rows.

True

 

93. DISTINCT and its counterpart, ALL, can be used more than once in a SELECT statement.

False

 

94. DISTINCT and its counterpart, ALL, can be used together on single field in a SELECT statement.

False

 

95. SUM, AVG, MIN and MAX can only be used with numeric columns.

True

 

96. The SQL statement: SELECT salary + Comm AS Total FROM Emp; adds two fields salary and comm from each row together and lists the results in a column named Total.

True

 

97. ORDER BY can be combined with the SELECT statement.

True

 

98. Data manipulation language (DML) commands are used to define a database, including creating, altering, and dropping tables and establishing constraints.

False

 

99. The keyword LIKE can be used in a WHERE clause to refer to a range of values.

False

 

100. The SQL keyword GROUP BY instructs the DBMS to group together those rows that have the same value in a column.

True

 

101. The keyword BETWEEN can be used in a WHERE clause to refer to a range of values.

True

 

102. Read operation on any table means to fetch some useful information from the table.

True

 

103. Use fetchall() method to retrieve only one value from a database table.

False

 

104. Row count is a read-only attribute.

True

 

105. To disconnect database connection, use connect () method.

False

 

106. Update statement is used to insert data into the table.

False

 

107. The ORDER BY clause combines all those records that have identical values in a particular field or a group of fields.

False

 

108. The WHERE clause is used to specify filtering conditions for groups.

False

 

109. DISTINCT option causes a group function to consider only the unique values of the argument expression.

True

 

110. By default, ORDER BY clause sorts the result set in descending order.

False

 

111. COUNT () function ignores duplicate and null values while counting the records.

True

 

112. The return value of MAX () function is a numeric value.

True

 

113. Multiple row function is also known as scalar function

False

 

114. SUM () function is used to count the total number of records in a table.

False

 

115. Argument type of AVG () function can be numeric or string data type.

False

 

 

Also Check:

Computer Networking Question and Answer

Important Question Answer for Term 2 Exam

Solved Computer Science Term 2 Sample Papers 

 

Copywrite © 2020-2024, CBSE Python,
All Rights Reserved
error: Content is protected !!