Prepstellar

SQL Fundamentals · Practice set 5 of 7

Relational Model and SQL: 10 practice questions

10 questions · Untimed · Free

10 free SQL Fundamentals practice questions on Relational Model and SQL, with an explanation for every answer. Untimed. The full mock exam and the timed version are in the app.

Set 5 · Relational Model and SQL · 10 questions Read the lesson
  1. Question 1 of 10

    In PostgreSQL terminology, what does the word relation refer to?

    1. AA guaranteed ordering of a table's rows
    2. BA table, the structure that stores the rows
    3. CA grouping of databases on a single server
    4. DA declared link between two tables of a database
    Show the answer

    Relation is the mathematical term the documentation uses for a table, so both words name the same structure; links between tables and orderings of rows are separate ideas built with constraints and with sorting.

    Next → 1 / 10
  2. Question 2 of 10

    Which arrangement is fixed inside a row but left unguaranteed for the rows of a table?

    1. AThe data type of every column
    2. BThe order of the columns
    3. CThe name given to each column
    4. DThe number of columns per row
    Show the answer

    Column order is fixed in each row while row order in a table is never promised, so a display order has to be requested by sorting; type, count, and naming of columns are all fixed properties of the table itself.

    Next → 2 / 10
  3. Question 3 of 10

    Which part of a query states which values the output should contain?

    1. AThe client application
    2. BThe select list
    3. CThe table expression
    4. DThe sort specification
    Show the answer

    The select list is the clause that decides which columns or computed values are produced; where the rows come from and how they are ordered are decided by other clauses of the same statement.

    Next → 3 / 10
  4. Question 4 of 10

    What is true of every row belonging to one given table?

    1. AIt carries whichever columns were supplied when that row was written
    2. BIt carries at least one column whose data type is decided per row
    3. CIt carries the same set of named columns, each with a specific data type
    4. DIt carries a stored position that fixes where it appears in results
    Show the answer

    A table is a named collection of rows in which every row has the same named columns and each column has one declared type, so the shape of a row is a property of the table rather than of the individual row.

    Next → 4 / 10
  5. Question 5 of 10

    A table already carries three separate unique constraints. How many primary keys may it also declare?

    1. AOne for each unique constraint that is also not null
    2. BNone, because the unique constraints already identify rows
    3. CAt most one, whatever the number of unique constraints
    4. DAny number, provided every listed column is not null
    Show the answer

    Unique constraints can be repeated freely, but only one of those candidates can be promoted to primary key, and that promotion is what marks the identity of a row and also forces its columns to be not null.

    Next → 5 / 10
  6. Keep the ones you got wrong

    In the app, every question you miss comes back exactly when you’re about to forget it.

  7. Question 6 of 10

    Which columns can a foreign key constraint legitimately point at?

    1. AColumns carrying any index that speeds up the lookup
    2. BColumns declared not null in the referenced table
    3. CA primary key, a unique constraint, or a non-partial unique index
    4. DColumns whose data types match those of the referencing columns exactly
    Show the answer

    A reference is only meaningful when the target identifies at most one row, so the referenced columns have to be covered by a primary key, a unique constraint, or a unique index without a predicate; matching types and indexing alone do not deliver that guarantee.

    Next → 6 / 10
  8. Question 7 of 10

    What does a SELECT statement written without any table expression do?

    1. AIt reports a syntax error until a source table is supplied in a FROM clause
    2. BIt reads every table the current database contains
    3. CIt returns the previous result the session produced
    4. DIt evaluates the expressions in its select list and returns them
    Show the answer

    Omitting the table expression turns the statement into a calculator over constants and function results, which is why an expression such as a multiplication or a function call can be run on its own; the select list still decides what comes back.

    Next → 7 / 10
  9. Question 8 of 10

    A table has two columns that are each unique and never null. Other tables must be able to reference this table without naming a column list, and client tooling must be able to identify a row from one declared identity. Which design meets both needs?

    1. ADeclare one of the two columns the primary key and leave the other as a unique constraint
    2. BDeclare both columns as primary keys so either can be referenced without a column list
    3. CDeclare the pair of columns together as one primary key covering both columns
    4. DDeclare both columns as unique constraints and let each reference name the column it wants
    Show the answer

    A reference written without a column list resolves to the primary key of the referenced table, so exactly one column has to hold that role; the other identifier stays useful as a unique constraint and can still be referenced explicitly.

    Next → 8 / 10
  10. Question 9 of 10

    A report must show a value computed from two numeric columns of one table, must not change which rows come back, and must expose that value as an output column. Where does the calculation belong?

    1. AIn the table expression, as an extra source combined with the base table
    2. BIn the sort specification, so the value is produced while ordering the rows
    3. CIn the select list, as a computed entry beside the column references
    4. DIn the row qualification, so only rows with the wanted value are produced
    Show the answer

    The select list is the clause that decides which values are produced and can hold calculations rather than plain column references, so it adds an output column without touching the set of rows; the other clauses either change the source, the order, or the rows retained.

    Next → 9 / 10
  11. Question 10 of 10

    An application lists stored records and users report that two runs of the same unsorted query presented the records in different sequences. No data changed between the runs. What accounts for this and what fixes it?

    1. AThe rows were regrouped into another database, so the query has to name it
    2. BColumn order shifted between runs, so the select list has to name its columns
    3. CThe result set is cached per session, so the session has to be reopened
    4. DRow order in a table is not guaranteed, so an explicit sort has to be requested
    Show the answer

    SQL promises nothing about the order of rows within a table, and only an explicit sort makes presentation order dependable; the fixed part of the layout is the order of columns inside each row, which never drifts between runs.

    Next → 10 / 10
  12. You’ve finished this set

    That’s 10 questions on Relational Model and SQL. In the app the ones you miss come back exactly when you’re about to forget them.

The whole course, on your phone

Lessons you can read, audio you can listen to on the way to work, and practice that remembers what you got wrong.