PGDCA topic test

SQL and RDBMS MCQ Test

66 SQL and RDBMS multiple-choice questions with answers, from the PGDCA syllabus. Instant score, full answer review, free and no signup.

Advertisement

Each attempt picks 25 questions at random from the 66 in this topic.

40% off

Score 50% or more? Get a certificate at 40% off

Finish any PGDCA test on this site with a score of 50% or above and you can claim a course certificate from Alien Institute of Computer at a 40% discount. Your score appears on the result screen with a WhatsApp button that carries it across for you.

Ask about the certificate
Advertisement

All 66 SQL and RDBMS questions with answers

1. What does SQL stand for?

  • A. Structured Query Language
  • B. Simple Question Language
  • C. Sequential Query Logic
  • D. System Query Layer

Answer: Structured Query Language

2. What does RDBMS stand for?

  • A. Rapid Database Management System
  • B. Relational Database Management System
  • C. Remote Data Backup Management System
  • D. Recorded Data Batch Management System

Answer: Relational Database Management System

3. In a relational database, what is a table also called?

  • A. Tuple
  • B. Relation
  • C. Attribute
  • D. Domain

Answer: Relation

4. What is a row in a database table also called?

  • A. Attribute
  • B. Tuple
  • C. Domain
  • D. Schema

Answer: Tuple

5. What is a column in a database table also called?

  • A. Tuple
  • B. Attribute
  • C. Record
  • D. Index

Answer: Attribute

6. What is the degree of a relation?

  • A. The number of rows
  • B. The number of columns
  • C. The number of indexes
  • D. The number of keys

Answer: The number of columns

7. What is the cardinality of a relation?

  • A. The number of columns
  • B. The number of rows
  • C. The number of tables
  • D. The number of constraints

Answer: The number of rows

8. Which key uniquely identifies each record in a table?

  • A. Foreign key
  • B. Primary key
  • C. Candidate key
  • D. Composite key

Answer: Primary key

9. Can a primary key column contain NULL values?

  • A. Yes, always
  • B. No, never
  • C. Only one NULL
  • D. Only in MySQL

Answer: No, never

10. What is a foreign key?

  • A. A key from another country
  • B. A column that references the primary key of another table
  • C. A duplicate primary key
  • D. An encrypted key

Answer: A column that references the primary key of another table

11. What is a candidate key?

  • A. Any column with data
  • B. An attribute or set of attributes that could serve as the primary key
  • C. A deleted key
  • D. A key that allows NULLs

Answer: An attribute or set of attributes that could serve as the primary key

12. What is a composite key?

  • A. A key made of two or more columns
  • B. A key that is encrypted
  • C. A key in another table
  • D. An automatically generated key

Answer: A key made of two or more columns

13. Which SQL category includes CREATE, ALTER and DROP?

  • A. DML
  • B. DDL
  • C. DCL
  • D. TCL

Answer: DDL

14. Which SQL category includes SELECT, INSERT, UPDATE and DELETE?

  • A. DDL
  • B. DML
  • C. DCL
  • D. TCL

Answer: DML

15. Which SQL category includes GRANT and REVOKE?

  • A. DDL
  • B. DML
  • C. DCL
  • D. TCL

Answer: DCL

16. Which SQL category includes COMMIT and ROLLBACK?

  • A. DDL
  • B. DML
  • C. DCL
  • D. TCL

Answer: TCL

17. Which SQL command retrieves data from a table?

  • A. GET
  • B. SELECT
  • C. FETCH
  • D. READ

Answer: SELECT

18. Which SQL command adds a new row to a table?

  • A. ADD
  • B. INSERT
  • C. CREATE
  • D. APPEND

Answer: INSERT

19. Which SQL command modifies existing rows?

  • A. MODIFY
  • B. UPDATE
  • C. CHANGE
  • D. ALTER

Answer: UPDATE

20. Which SQL command removes rows from a table but keeps its structure?

  • A. DROP
  • B. DELETE
  • C. REMOVE
  • D. ERASE

Answer: DELETE

21. Which SQL command removes an entire table including its structure?

  • A. DELETE
  • B. DROP
  • C. TRUNCATE
  • D. CLEAR

Answer: DROP

22. What is the key difference between DELETE and TRUNCATE?

  • A. There is none
  • B. TRUNCATE removes all rows quickly and cannot use a WHERE clause
  • C. DELETE is faster
  • D. TRUNCATE deletes the table structure

Answer: TRUNCATE removes all rows quickly and cannot use a WHERE clause

23. Which clause filters rows in a SELECT statement?

  • A. FILTER
  • B. WHERE
  • C. HAVING
  • D. ORDER BY

Answer: WHERE

24. Which clause sorts the result of a query?

  • A. SORT BY
  • B. ORDER BY
  • C. GROUP BY
  • D. ARRANGE

Answer: ORDER BY

25. Which keyword sorts results in descending order?

  • A. DOWN
  • B. DESC
  • C. REVERSE
  • D. BACKWARD

Answer: DESC

26. Which clause groups rows that share a value?

  • A. ORDER BY
  • B. GROUP BY
  • C. PARTITION
  • D. CLUSTER

Answer: GROUP BY

27. Which clause filters groups after GROUP BY?

  • A. WHERE
  • B. HAVING
  • C. FILTER
  • D. WHEN

Answer: HAVING

28. What is the difference between WHERE and HAVING?

  • A. They are identical
  • B. WHERE filters rows before grouping; HAVING filters groups after
  • C. HAVING is faster
  • D. WHERE only works with numbers

Answer: WHERE filters rows before grouping; HAVING filters groups after

29. Which keyword removes duplicate rows from a result?

  • A. UNIQUE
  • B. DISTINCT
  • C. SINGLE
  • D. ONLY

Answer: DISTINCT

30. Which aggregate function returns the number of rows?

  • A. SUM()
  • B. COUNT()
  • C. TOTAL()
  • D. NUM()

Answer: COUNT()

31. Which aggregate function returns the average of a column?

  • A. MEAN()
  • B. AVG()
  • C. AVERAGE()
  • D. MID()

Answer: AVG()

32. Which aggregate function returns the largest value?

  • A. TOP()
  • B. MAX()
  • C. HIGH()
  • D. LARGE()

Answer: MAX()

33. Which operator tests whether a value falls within a range?

  • A. IN
  • B. BETWEEN
  • C. LIKE
  • D. RANGE

Answer: BETWEEN

Advertisement

34. Which operator performs pattern matching on text?

  • A. MATCH
  • B. LIKE
  • C. SIMILAR
  • D. PATTERN

Answer: LIKE

35. In a LIKE pattern, what does the % wildcard match?

  • A. Exactly one character
  • B. Zero or more characters
  • C. Only digits
  • D. Only letters

Answer: Zero or more characters

36. In a LIKE pattern, what does the underscore _ match?

  • A. Zero or more characters
  • B. Exactly one character
  • C. A space
  • D. A number

Answer: Exactly one character

37. Which operator checks whether a value is in a given list?

  • A. BETWEEN
  • B. IN
  • C. LIKE
  • D. EXISTS

Answer: IN

38. How do you test for a NULL value in SQL?

  • A. = NULL
  • B. IS NULL
  • C. == NULL
  • D. EQUALS NULL

Answer: IS NULL

39. Which JOIN returns only rows with matching values in both tables?

  • A. LEFT JOIN
  • B. INNER JOIN
  • C. FULL JOIN
  • D. CROSS JOIN

Answer: INNER JOIN

40. Which JOIN returns all rows from the left table and matches from the right?

  • A. INNER JOIN
  • B. LEFT JOIN
  • C. RIGHT JOIN
  • D. CROSS JOIN

Answer: LEFT JOIN

41. Which JOIN returns the Cartesian product of two tables?

  • A. INNER JOIN
  • B. CROSS JOIN
  • C. SELF JOIN
  • D. NATURAL JOIN

Answer: CROSS JOIN

42. What is a self join?

  • A. A table joined with itself
  • B. A join with no condition
  • C. A join of three tables
  • D. An automatic join

Answer: A table joined with itself

43. What is a view in SQL?

  • A. A physical copy of a table
  • B. A virtual table based on the result of a query
  • C. A backup file
  • D. An index

Answer: A virtual table based on the result of a query

44. What is an index used for in a database?

  • A. Storing backups
  • B. Speeding up data retrieval
  • C. Encrypting data
  • D. Compressing tables

Answer: Speeding up data retrieval

45. What is a stored procedure?

  • A. A saved query result
  • B. A precompiled set of SQL statements stored in the database
  • C. A backup routine
  • D. A table constraint

Answer: A precompiled set of SQL statements stored in the database

46. What is a trigger in a database?

  • A. A manual command
  • B. Code that runs automatically in response to a table event
  • C. A type of index
  • D. A user permission

Answer: Code that runs automatically in response to a table event

47. What does the ACID acronym stand for in transactions?

  • A. Atomicity, Consistency, Isolation, Durability
  • B. Access, Control, Integrity, Data
  • C. Automatic, Correct, Indexed, Distributed
  • D. Aggregate, Compute, Insert, Delete

Answer: Atomicity, Consistency, Isolation, Durability

48. Which ACID property ensures a transaction completes fully or not at all?

  • A. Consistency
  • B. Atomicity
  • C. Isolation
  • D. Durability

Answer: Atomicity

49. Which ACID property ensures committed changes survive a system failure?

  • A. Atomicity
  • B. Durability
  • C. Isolation
  • D. Consistency

Answer: Durability

50. What is normalisation in database design?

  • A. Making all data uppercase
  • B. Organising data to reduce redundancy and improve integrity
  • C. Compressing the database
  • D. Backing up tables

Answer: Organising data to reduce redundancy and improve integrity

51. What does First Normal Form (1NF) require?

  • A. No partial dependencies
  • B. All attribute values must be atomic (indivisible)
  • C. No transitive dependencies
  • D. Every column must be indexed

Answer: All attribute values must be atomic (indivisible)

52. What does Second Normal Form (2NF) eliminate?

  • A. Repeating groups
  • B. Partial dependency on part of a composite key
  • C. Transitive dependency
  • D. Multi-valued dependency

Answer: Partial dependency on part of a composite key

53. What does Third Normal Form (3NF) eliminate?

  • A. Partial dependency
  • B. Transitive dependency
  • C. Atomic values
  • D. Foreign keys

Answer: Transitive dependency

54. What is denormalisation?

  • A. Removing all data
  • B. Deliberately adding redundancy to improve read performance
  • C. Deleting a table
  • D. Encrypting a database

Answer: Deliberately adding redundancy to improve read performance

55. In an ER diagram, what shape usually represents an entity?

  • A. Oval
  • B. Rectangle
  • C. Diamond
  • D. Circle

Answer: Rectangle

56. In an ER diagram, what shape usually represents a relationship?

  • A. Rectangle
  • B. Diamond
  • C. Oval
  • D. Triangle

Answer: Diamond

57. In an ER diagram, what shape usually represents an attribute?

  • A. Rectangle
  • B. Oval
  • C. Diamond
  • D. Square

Answer: Oval

58. Which SQL statement changes the structure of an existing table?

  • A. UPDATE
  • B. ALTER TABLE
  • C. MODIFY
  • D. CHANGE TABLE

Answer: ALTER TABLE

59. Which constraint ensures all values in a column are different?

  • A. NOT NULL
  • B. UNIQUE
  • C. CHECK
  • D. DEFAULT

Answer: UNIQUE

60. Which constraint prevents a column from having empty values?

  • A. UNIQUE
  • B. NOT NULL
  • C. PRIMARY KEY
  • D. CHECK

Answer: NOT NULL

61. Which constraint validates data against a condition?

  • A. CHECK
  • B. UNIQUE
  • C. DEFAULT
  • D. INDEX

Answer: CHECK

62. What is a subquery?

  • A. A query inside another query
  • B. A short query
  • C. A failed query
  • D. A saved query

Answer: A query inside another query

63. Which command undoes changes made in the current transaction?

  • A. COMMIT
  • B. ROLLBACK
  • C. UNDO
  • D. RESTORE

Answer: ROLLBACK

64. Which command permanently saves transaction changes?

  • A. SAVE
  • B. COMMIT
  • C. WRITE
  • D. STORE

Answer: COMMIT

65. Who proposed the relational model of databases?

  • A. Charles Babbage
  • B. E. F. Codd
  • C. Alan Turing
  • D. Larry Ellison

Answer: E. F. Codd

66. What is DBMS software responsible for?

  • A. Designing websites
  • B. Creating, managing and controlling access to databases
  • C. Compiling programs
  • D. Managing printers

Answer: Creating, managing and controlling access to databases

Frequently asked questions

How many SQL and RDBMS questions are in this test?

This page has 66 SQL and RDBMS MCQs with answers. Each attempt picks 25 of them at random.

Is the SQL and RDBMS test free?

Yes — it is free, needs no signup, and you can retake it as many times as you like.

Can I get a certificate for this test?

Score 50% or more and you can claim a certificate from Alien Institute of Computer at 40% off. The WhatsApp button appears on your result screen.

Advertisement
Advertisement