Database Query Using SQL Class 12 MCQ

Share with others

Looking to strengthen your understanding of Database Query Using SQL for Class 12 Computer Science (Code 083)? This collection of multiple choice questions (MCQs) is designed as per the latest CBSE syllabus.

Database Query Using SQL Class 12 MCQ

1. SQL stands for __.
a. Structured Query Language
b. Simple Query language.
c. Simple Query Locator
d. None of the above

Show Answer ⟶
a. Structured Query Language

2. SQLs are helpful for _.
a. Manipulating data in the database
b. Declaring constraints
c. Retrieving data from the database
d. All of the above

Show Answer ⟶
d. All of the above

3. Which of the following points do we have to keep in mind while using SQL:
a. SQL is case insensitive.
b. Always end with a semicolon).
c. To enter multiple lines, we don’t write a semicolon. (;)
d. All of the above

Show Answer ⟶
d. All of the above

4. Which of the following datatypes has reserved space, meaning the datatype has a fixed length?
a. Char(n)
b. Varchar(n)
c. Both a. and b.
d. None of the above

Show Answer ⟶
a. Char(n)

5. Which of the following datatypes does not have a fixed length? It stores only that much length which the input character has.
a. Char(n)
b. Varchar(n)
c. Both a. and b.
d. None of the above

Show Answer ⟶
b. Varchar(n)

6. Integer (INT) datatype value occupies _ bytes of storage.
a. 2 bytes
b. 4 bytes
c. 8 bytes
d. 16 bytes

Show Answer ⟶
b. 4 bytes

7. The Big Integer (BIGINT) datatype value occupies __ bytes of storage.
a. 2 bytes
b. 4 bytes
c. 8 bytes
d. 16 bytes

Show Answer ⟶
c. 8 bytes

8. Which of the following datatypes holds decimal point numbers?
a. INT
b. BIGINT
c. FLOAT
d. CHAR

Show Answer ⟶
c. FLOAT

9. Which of the following constraints helps to identify the missing/unknown/not applicable value?
a. NULL
b. NOT
c. EMPTY
d. PRIMARY KEY

Show Answer ⟶
a. NULL

10. Which of the following constraints ensures that all the values in the column are distinct/unique?
a. PRIMARY KEY
b. UNIQUE
c. KEY DEFAULT
d. NULL

Show Answer ⟶
b. UNIQUE

11. Which of the following constraints is used to specify the column if no value is provided?
a. PRIMARY KEY
b. UNIQUE VALUE
c. DEFAULT
d. NULL

Show Answer ⟶
c. DEFAULT

12. The column which can uniquely identify each row/record in a table is known as _.
a. FOREIGN KEY
b. PRIMARY KEY
c. DELTA KEY
d. All of the above

Show Answer ⟶
b. PRIMARY KEY

13. DDL stands for __.
a. Data Dynamic Language
b. Data Declaring Language
c. Data Definition Language
d. None of the above

Show Answer ⟶
c. Data Definition Language

14. To create a database, we use which of the following SQL statements?
a. Make Database databasename;
b. Create database databasename;
c. Create database name;
d. Make databasename;

Show Answer ⟶
b. Create database databasename;

15. To know the names of existing databases, we use the statement __.
a. Show Database;
b. Show database name;
c. Show database databasename;
d. Show * Database;

Show Answer ⟶
a. Show Database;

16. Which of the following SQL commands is required for creating a table?
a. Create tablename(…)
b. Create table(…)
c. Create table tablename(…)
d. All of the above

Show Answer ⟶
c. Create table tablename(…)

17. Which of the following SQL commands is used to view the structure of an already created table?
a. DES tablename;
b. DESCRIBE tablename;
c. DESCRIBE table tablename;
d. DES table tablename;

Show Answer ⟶
b. DESCRIBE tablename;

18. After creating a table, we may require adding/removing an attribute or modifying the datatype of an existing table. Which of the following SQL commands can be used?
a. MODIFY table tablename;
b. MODIFY tablename;
c. ALTER table tablename;
d. ALTER tablename;

Show Answer ⟶
c. ALTER table tablename;

19. If you want to remove a table from the database, which of the following SQL commands can be used?
a. DROP table tablename;
b. REMOVE table tablename;
c. DEL table tablename;
d. None of the above

Show Answer ⟶
a. DROP table tablename;

20. To insert a new record in the table, which of the SQL commands can be used?
a. INSERT into tablename values();
b. INSERT tablename values();
c. INSERT tablename();
d. None of the above

Show Answer ⟶
a. INSERT into tablename values();

21. _ An SQL command is used to retrieve data from the tables in a database, and the output is also displayed in tabular form.
a. SELECT * from tablename;
b. DISPLAY from tablename;
c. DISPLAY * from tablename;
d. SELECT from tablename;

Show Answer ⟶
a. SELECT * from tablename;

22. Which of the following clauses is used to retrieve data that meet some specified conditions?
a. Select
b. Where
c. Why
d. None of the above

Show Answer ⟶
b. Where

23. Which SQL command can change the degree of an existing relation?

Show Answer ⟶
Alter (or Alter Table)

24. What will be the output of the query?
SELECT * FROM products WHERE product_name LIKE ‘App%’;
a. Details of all products whose names start with ‘App’
b. Details of all products whose names end with ‘App’
c. Names of all products whose names start with ‘App’
d. Names of all products whose names end with ‘App’

Show Answer ⟶
a. Details of all products whose names start with ‘App’

25. In which datatype is the value stored padded with spaces to fit the specified length?
a. DATE
b. VARCHAR
c. FLOAT
d. CHAR

Show Answer ⟶
d. CHAR

26. Which aggregate function can be used to find the cardinality of a table?
a. sum()
b. count()
c. avg()
d. max()

Show Answer ⟶
b. count()

27. Assertion (A): A SELECT command in SQL can have both WHERE and HAVING clauses.
Reasoning (R): WHERE and HAVING clauses are used to check conditions; therefore, these can be used interchangeably.

a. Both A and R are true, and R is the correct explanation for A.
b. Both A and R are true, and R is not the correct explanation for A.
c. A is true, but R is false.
d. A is False, but R is True.

Show Answer ⟶
c. A is true, but R is false.

28. Which of the following statements is FALSE about keys in a relational database?
a. Any candidate key is eligible to become a primary key.
b. A primary key uniquely identifies the tuples in a relation.
c. A candidate key that is not a primary key is a foreign key.
d. A foreign key is an attribute whose value is derived from the primary key of another relation.

Show Answer ⟶
c. A candidate key that is not a primary key is a foreign key.

29. __ command is used to remove the primary key from the table in SQL.
a. update
b. remove
c. alter
d. drop

Show Answer ⟶
c. alter

30. Which of the following commands will delete the table from the MySQL database?
a. DELETE TABLE
b. DROP TABLE
c. REMOVE TABLE
d. ALTER TABLE

Show Answer ⟶
b. DROP TABLE

31. _ is a non-key attribute, whose values are derived from the primary key of some other table.
a. Primary Key
b. Foreign Key
c. Candidate Key
d. Alternate Key

Show Answer ⟶
b. Foreign Key

32. The SELECT statement, when combined with the __ clause, returns records without repetition.
a. DESCRIBE
b. UNIQUE
c. DISTINCT
d. NULL

Show Answer ⟶
c. DISTINCT

33. Which function is used to display the total number of records from a table in a database?
a. sum(*) b. total(*)
c. count(*) d. return(*)

Show Answer ⟶
c. count(*)

34. In SQL, name the clause that is used to display the tuples in ascending order of an attribute.

Show Answer ⟶
ORDER BY

35. In SQL, what is the use of the IS NULL operator?

Show Answer ⟶
To check if the column has a null value / no value

36. Write any one aggregate function used in SQL.

Show Answer ⟶
SUM / AVG / COUNT / MAX / MIN

37. Which of the following is a DDL command?
a. SELECT
b. ALTER
c. INSERT
d. UPDATE

Show Answer ⟶
b. ALTER

38. In SQL, write the query to display the list of tables stored in a database.

Show Answer ⟶
SHOW TABLES

39. Which of the following types of table constraints will prevent the entry of duplicate rows?
a. Unique
b. Distinct
c. Primary Key
d. NULL

Show Answer ⟶
c. Primary Key

40. The primary key is selected from the set of _.
a. composite keys
b. alternate keys
c. candidate keys
d. foreign keys

Show Answer ⟶
c. candidate keys
Explanation: A primary key is chosen from the candidate keys; every primary key is a candidate key, but not all candidate keys are primary keys.

41. In SQL, which command will be used to add a new record in a table ?
a. UPDATE
b. ADD
c. INSERT
d. ALTER TABLE

Show Answer ⟶
c. INSERT

42. Mr Ravi is creating a field that contains alphanumeric values and fixed lengths. Which MySQL data type should he choose for the same?
a. VARCHAR
b. CHAR
c. LONG
d. NUMBER

Show Answer ⟶
b. CHAR

43. The SELECT statement, when combined with the _ clause, returns records without repetition.
a. DISTINCT
b. DESCRIBE
c. UNIQUE
d. NULL

Show Answer ⟶
a. DISTINCT

44. In SQL, the aggregate function which will display the cardinality of the table is
a. sum ()
b. count ()

c. avg ()

d. sum ()

Show Answer ⟶
b. count (*)

45. Which of the following is not a DDL command in SQL?
a. DROP
b. CREATE
c. UPDATE
d. ALTER

Show Answer ⟶
c. UPDATE

46. In a relational model, tables are called _ that store data for different columns.
a. Attributes
b. Degrees
c. Relations
d. Tuples

Show Answer ⟶
c. Relations

47. _ statement of SQL is used to insert new records in a table.
a. ALTER
b. UPDATE
c. INSERT
d. CREATE

Show Answer ⟶
c. INSERT

48. Fill in the blank : a clause is used with a SELECT statement to display data in a sorted form with respect to a specified column.
a. WHERE
b. ORDER BY
c. HAVING
d. DISTINCT

Show Answer ⟶
b. ORDER BY

Computer Science Class 12 MCQs

Disclaimer: We have taken an effort to provide you with the accurate handout of “Database Query Using SQL Class 12 MCQ“. If you feel that there is any error or mistake, please contact me at anuraganand2017@gmail.com. The above CBSE study material present on our websites is for education purpose, not our copyrights. All the above content and Screenshot are taken from Computer Science Class 12 NCERT Textbook, CBSE Sample Paper, CBSE Old Sample Paper, CBSE Board Paper and CBSE Support Material which is present in CBSEACADEMIC website, NCERT websiteThis Textbook and Support Material are legally copyright by Central Board of Secondary Education. We are only providing a medium and helping the students to improve the performances in the examination. 

Images and content shown above are the property of individual organizations and are used here for reference purposes only.

For more information, refer to the official CBSE textbooks available at cbseacademic.nic.in


Share with others

Leave a Comment