Timedora
Free Practice Quiz Question List

Relational Algebra and SQL Fundamentals Online Quiz Questions

Use this free practice quiz with 20 questions to review Relational Algebra and SQL Fundamentals, test your knowledge, and prepare for your next test or exam.

20 questions
01
Choose one
1 point

Which relational algebra sequence returns the names of employees in the Sales department from Employee and Department, matching rows by dept_id?

  1. A

    Join Employee and Department on dept_id, select rows where dept_name is Sales, then project name.

  2. B

    Project name from Employee, then take the Cartesian product with Department and select Sales.

  3. C

    Select rows from Employee where dept_name is Sales, then join Department and project name.

  4. D

    Take the union of Employee and Department, then project name.

02
Choose all
1 point

Select all statements that accurately describe SQL table constraints.

  1. A

    PRIMARY KEY requires unique, non-null identifiers.

  2. B

    NOT NULL requires a value.

  3. C

    UNIQUE prevents duplicate values.

  4. D

    CHECK enforces a condition.

  5. E

    A foreign key declared with REFERENCES must always be non-null, even without NOT NULL.

03
True or false
1 point

If related database changes have not yet been committed, ROLLBACK cancels those uncommitted changes.

  1. A

    True

  2. B

    False

04
Written response
1 point

What type of key links rows between relational tables?

05
Fill in the blank
1 point

ORDER BY requests a display order; without it, row order is . SQL generally preserves duplicate rows unless SELECT is specified.

06
Open ended
1 point

You need to update or delete only certain rows in a table. Explain how a WHERE condition controls which rows are affected and how you can check the target rows before making a broad change.

07
Choose one
1 point

Which statement correctly distinguishes a Cartesian product from a join in relational algebra?

  1. A

    A Cartesian product pairs every row of one relation with every row of another; a join combines related rows, usually by matching key columns.

  2. B

    A Cartesian product combines only rows with matching keys; a join pairs every row with every other row.

  3. C

    A Cartesian product keeps specified columns; a join removes duplicate rows.

  4. D

    A Cartesian product filters rows by a condition; a join returns rows found in one relation but not another.

08
Choose all
1 point

Select all statements that accurately describe relational table structure and key roles.

  1. A

    A table consists of rows and columns, and each column has a defined type.

  2. B

    A primary key identifies rows.

  3. C

    A foreign key links rows between tables.

  4. D

    A primary key links rows between tables, while a foreign key identifies each row.

  5. E

    Every column in a table must be a primary key.

09
True or false
1 point

In SQL, WHERE column_name = NULL is the correct way to select rows where column_name is missing.

  1. A

    True

  2. B

    False

10
Written response
1 point

Which SQL transaction command saves the changes in a transaction?

11
Fill in the blank
1 point

In SQL, defines a new table. The constraint requires unique, non-null identifiers.

12
Choose one
1 point

Before running a broad UPDATE or DELETE, what is the recommended way to inspect which rows will be affected?

  1. A

    Run the UPDATE or DELETE without a condition so the database can choose the intended rows.

  2. B

    Run a SELECT with the same condition to inspect the target rows.

  3. C

    Replace the condition with ORDER BY.

  4. D

    Use INSERT to preview the affected rows.

13
True or false
1 point

A primary key identifies rows in a table, while a foreign key links rows between tables.

  1. A

    True

  2. B

    False

14
Written response
1 point

Which SQL transaction command saves the changes in a transaction? Enter the SQL command in uppercase.

15
Choose one
1 point

Which relational algebra plan returns the names of employees in the Sales department, given Employee(emp_id, name, dept_id, salary) and Department(dept_id, dept_name)?

  1. A

    Project dept_name, then take the Cartesian product of Employee and Department.

  2. B

    Select rows where dept_name is Sales from Employee alone, then take the union with Department.

  3. C

    Join Employee and Department on dept_id, select rows where dept_name is Sales, then project name.

  4. D

    Take the difference between Employee and Department, then select name.

16
True or false
1 point

A DELETE statement without a WHERE condition removes only the first row in its target table.

  1. A

    True

  2. B

    False

17
Written response
1 point

Which SQL constraint prevents duplicate values? Enter the constraint keyword in uppercase.

18
Choose one
1 point

Which SQL clause requests a particular display order for query results?

  1. A

    ORDER BY

  2. B

    WHERE

  3. C

    FROM

  4. D

    GROUP BY

19
Written response
1 point

Which SQL constraint keyword enforces a relationship to a key in another table? Enter the keyword in uppercase.

20
Choose one
1 point

Which statement correctly describes the roles of COMMIT and ROLLBACK in a transaction?

  1. A

    ROLLBACK cancels uncommitted changes; COMMIT cancels committed changes.

  2. B

    COMMIT saves changes; ROLLBACK cancels uncommitted changes.

  3. C

    COMMIT and ROLLBACK both save all changes.

  4. D

    ROLLBACK saves changes; COMMIT cancels uncommitted changes.