Exit Chapter 09 · 🛢️ Relational Databases — Quiz

Playing as a guest? to earn XP and track your progress.

Question 1 of 51 0 correct so far

🛢️ Relational Databases Quiz

Q1.

What is the primary difference between a database and a Database Management System (DBMS)?

Explanation

A database is the collection of structured data itself. A DBMS is the software application (like MySQL) that controls creation, retrieval, and management of the database.

Q2.

Which of the following is a key limitation of traditional data storage systems that store files directly on disk without a DBMS?

Explanation

Traditional file systems store duplicate data across different files (redundancy), leading to inconsistency when data is modified.

Q3.

What is 'Data Inconsistency' in database systems?

Explanation

Data inconsistency occurs when redundant copies of the same data are not updated simultaneously, leaving mismatched values in the system.

Q4.

How does a DBMS eliminate data redundancy?

Explanation

Centralization in a DBMS ensures that a specific piece of information is stored in a single table, reducing or eliminating duplicated data.

Q5.

What does 'Data Independence' mean in a DBMS?

Explanation

Data independence means that changes to the physical or logical organization of the database do not require changes to the application programs that use it.

Q6.

In a university database, a teacher can edit marks, but a student can only view them. Which feature of a DBMS does this illustrate?

Explanation

A DBMS supports user-level privilege management, allowing different permissions (read, write, admin) to be granted to different users.

Q7.

Who proposed the Relational Database Model, and in what year?

Explanation

Dr. E. F. Codd proposed the relational model in his landmark 1970 paper while working at IBM.

Q8.

In the Relational Model, what is the formal mathematical term for a Table?

Explanation

A table in a relational database is formally called a Relation.

Q9.

In the Relational Model, what is the formal term for a Row and a Column respectively?

Explanation

A row is formally called a Tuple, and a column is formally called an Attribute.

Q10.

What does the term 'Domain' represent in a relational database table?

Explanation

A domain is the pool of legal values from which an attribute draws its values (e.g., age domain between 0 and 120).

Q11.

Which of the following is a fundamental property of a Relation?

Explanation

In a relation, the order of rows and columns is mathematically irrelevant; they can be stored in any order. Duplicate rows are strictly forbidden.

Q12.

Which rule ensures that cells in a relation are indivisible (contain single, non-composite values)?

Explanation

The atomic value property states that each intersection of a row and a column must contain a single, indivisible (atomic) value.

Q13.

What is the 'Degree' of a relation?

Explanation

The degree of a relation is the number of attributes (columns) it contains.

Q14.

What is the 'Cardinality' of a relation?

Explanation

Cardinality refers to the number of tuples (rows) currently present in a relation.

Q15.

If a table Student has columns RollNo, Name, Age, and Gender, and it contains 45 student records, what are its Degree and Cardinality?

Explanation

Columns = 4 (Degree), Rows = 45 (Cardinality).

Q16.

What is a 'Relation Schema'?

Explanation

A relation schema is the logical definition or blueprint of the table, written as RelationName(Attribute1, Attribute2, ...).

Q17.

What is a 'Relation Instance'?

Explanation

A relation instance is the actual data populated in the relation at any given moment, which changes as rows are added, updated, or deleted.

Q18.

What is a 'Candidate Key' in the Relational Model?

Explanation

A candidate key is a minimal set of attributes that uniquely identifies a row in a relation. A table can have multiple candidate keys.

Q19.

How does a 'Primary Key' differ from a 'Candidate Key'?

Explanation

Out of all candidate keys (which are all eligible to uniquely identify rows), one is selected to be the Primary Key.

Q20.

What is an 'Alternate Key'?

Explanation

Candidate keys that are left over after selecting the primary key are called alternate keys.

Q21.

A table Employee has candidate keys EmpID and AadharNo. If EmpID is chosen as the Primary Key, what is AadharNo?

Explanation

Since AadharNo is a candidate key not chosen as the primary key, it is an alternate key.

Q22.

What is a 'Foreign Key'?

Explanation

A foreign key is a column or set of columns in a table that references the primary key of another table, establishing a link.

Q23.

Which integrity rule states that a foreign key value must either match an existing primary key value in the referenced table, or be NULL?

Explanation

Referential integrity ensures that relationships between tables remain consistent; foreign key values must always point to valid primary keys.

Q24.

Which constraint ensures that the primary key of a table can never contain NULL values?

Explanation

Entity integrity states that no primary key attribute can be NULL, ensuring every row is identifiable.

Q25.

What is a 'View' in database systems?

Explanation

A view is a virtual table derived from base tables. It is defined by a query and recalculated live whenever it is queried.

Q26.

Which of the following is a key advantage of using database Views?

Explanation

Views provide security by exposing only a subset of columns/rows to specific users, and they hide query complexity.

Q27.

What happens to a View when data in its underlying base tables is modified?

Explanation

Because a view is virtual and executes its defining query dynamically, any changes in the base tables reflect in the view immediately.

Q28.

MySQL works on which of the following architectural models?

Explanation

MySQL uses a Client-Server architecture where client applications send SQL statements to a central database server, which processes them.

Q29.

Which of the following is the background daemon/service executable of the MySQL Server?

Explanation

mysqld (MySQL Daemon) is the background service program that runs the MySQL server.

Q30.

What command is used in the command-line interface to connect to a local MySQL server as the default admin user 'root'?

Explanation

mysql -u root -p executes the client, specifying the user (-u) as root and prompting for a password (-p).

Q31.

Why must every SQL command typed at the mysql> prompt end with a semicolon ';'?

Explanation

Semicolon ';' is the default delimiter in MySQL that tells the parser where a statement ends.

Q32.

What is Structured Query Language (SQL)?

Explanation

SQL is the standard language used to define, manipulate, and query data in relational database management systems.

Q33.

Which SQL statement category is used to define, modify, or delete the logical structure of database objects?

Explanation

DDL (Data Definition Language) commands work on schemas/structures (e.g., CREATE, ALTER, DROP).

Q34.

Which of the following is classified as a Data Definition Language (DDL) command?

Explanation

ALTER modifies the structure of a table, making it a DDL command. INSERT, UPDATE, and DELETE are DML.

Q35.

Which SQL statement category handles retrieving, inserting, modifying, and deleting the actual data rows in tables?

Explanation

DML (Data Manipulation Language) commands operate directly on the data rows (records) inside tables.

Q36.

Which of the following is a Data Manipulation Language (DML) command?

Explanation

UPDATE modifies existing records in a table, making it a DML command.

Q37.

Under which category do the SQL commands GRANT and REVOKE fall?

Explanation

DCL (Data Control Language) commands are used to manage privileges and access rights.

Q38.

Which category of SQL statements handles transaction boundaries (making changes permanent or rolling them back)?

Explanation

TCL handles transaction management via commands like COMMIT and ROLLBACK.

Q39.

What does the TCL command COMMIT do?

Explanation

COMMIT writes all transaction changes to disk, making them permanent.

Q40.

What does the TCL command ROLLBACK do?

Explanation

ROLLBACK aborts the current transaction and reverts all modifications since the last commit.

Q41.

What is the difference between DROP and TRUNCATE commands?

Explanation

DROP TABLE deletes the table schema entirely. TRUNCATE TABLE deletes all data rows instantly but leaves the empty table definition intact.

Q42.

How does TRUNCATE differ from DELETE (without a WHERE clause)?

Explanation

TRUNCATE is a DDL operation that drops/recreates the table internally (auto-committed, cannot be rolled back). DELETE is a DML operation that deletes rows sequentially and can be rolled back.

Q43.

Which SQL command is used to permanently delete an entire database schema and all its tables?

Explanation

DROP DATABASE database_name deletes the database and all its contents permanently.

Q44.

Can DDL statements like CREATE, ALTER, or DROP be undone using the ROLLBACK command in standard MySQL?

Explanation

DDL operations in MySQL trigger an implicit commit. They cannot be rolled back.

Q45.

In the SQL statement SELECT * FROM Student WHERE Marks > 90;, under which category does SELECT fall?

Explanation

SELECT retrieves data, making it part of DQL (Data Query Language) or DML.

Q46.

A column SubjectID in the Enrollment table references SubjectID in the Subjects table. What is SubjectID in Enrollment?

Explanation

A column that references another table's primary key is a foreign key.

Q47.

Which property of a relation states that no two tuples (rows) in a relation can be identical?

Explanation

A relation is mathematically a set of tuples. Since sets do not allow duplicates, every tuple in a relation must be unique.

Q48.

What is a 'Composite Primary Key'?

Explanation

A composite primary key is a primary key that consists of more than one column.

Q49.

If a relation has 5 columns and 10 rows, what is its Degree and Cardinality?

Explanation

Degree = columns (5), Cardinality = rows (10).

Q50.

What does the SQL command 'ALTER TABLE' allow you to do?

Explanation

ALTER TABLE is a DDL command used to add, remove, or change columns and constraints in an existing table structure.

Q51.

What is the correct way to delete all records from a table Student but keep its columns and constraints for future data insertion?

Explanation

Both TRUNCATE TABLE Student; and DELETE FROM Student; clear all rows but retain the structure. DROP destroys the structure.