Prepstellar

SQL Fundamentals · Practice set 4 of 5

What You Will Learn in This SQL Course: 10 practice questions

10 questions · Untimed · Free

10 free SQL Fundamentals practice questions on What You Will Learn in This SQL Course, with an explanation for every answer. Untimed. The full mock exam and the timed version are in the app.

Set 4 · What You Will Learn in This SQL Course · 10 questions Read the lesson
  1. Question 1 of 10

    A lesson of this course has just opened. In which order do its parts arrive?

    1. ASlides and quick checks, then ten questions, then practice where there is one
    2. BOne long page of text, with the questions replacing the example tables
    3. CA six-step practice on its own, with no slides and no result tables
    4. DTen questions first, then the slides, and no hands-on practice at all
    Show the answer

    A lesson opens with short slides that use small tables, queries and results, with a quick check between them. Ten questions on the same material follow, and the concepts that carry a practice add its six steps after them.

    Next → 1 / 10
  2. Question 2 of 10

    Only the tracks table is in play. Which job does block one already cover?

    1. AShowing each track next to the name of the artist who recorded it
    2. BSaving the query under a name so that it can be read like a table
    3. CFiltering its rows by a condition and sorting them by name
    4. DReplacing the whole table with one line holding the average price
    Show the answer

    Block one works inside one table. It gives you the relational model, how a statement is written, values and types, and then filtering, sorting and changing the rows.

    Next → 2 / 10
  3. Question 3 of 10

    Which data do the lessons, the questions and the practice of this course work on?

    1. AOne store for the slides and another one for the practice
    2. BA new set of tables invented for each block
    3. CA store that the learner must supply before starting
    4. DThe same small music store, in every lesson of the course
    Show the answer

    A single small music store, with artists, albums, tracks, customers and invoices, runs through the whole course, so the rows stay familiar and your attention stays on the SQL.

    Next → 3 / 10
  4. Question 4 of 10

    Album titles are kept in `albums` and artist names in `artists`. A query has to return the two rows `For Those About To Rock` and `Let There Be Rock` for the artist AC/DC. Which block supplies that skill?

    1. ABlock three, because counting the albums returns the titles
    2. BBlock one, because one table can be filtered and sorted
    3. CBlock six, because the two reads belong to one transaction
    4. DBlock two, which joins the two tables on the shared artist number
    Show the answer

    The title and the artist name live in two separate tables, so the answer needs a join. Block two teaches table expressions and aliases, inner and outer joins, and set operations.

    Next → 4 / 10
  5. Question 5 of 10

    Six album rows go into a query and the result holds four rows: `AC/DC 2`, `Accept 2`, `Aerosmith 1`, `Alanis Morissette 1`. Which block explains why six rows became four?

    1. ABlock three, where rows are grouped and counted
    2. BBlock seven, where a view is read like a table
    3. CBlock four, where a query is placed inside another
    4. DBlock one, where rows are filtered one by one
    Show the answer

    Grouping puts the albums of one artist together and the count replaces them with a single row, so the six album rows come back as four summary rows.

    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.

    Opens in your browser. Nothing to install.

    Start studying

    On your phone, with the same account

    Get it on Google Play Download on the App Store
  7. Question 6 of 10

    In `SELECT name FROM artists WHERE NOT EXISTS (SELECT 1 FROM albums WHERE albums.artist_id = artists.artist_id)`, the inner query runs once for each artist. What does the outer query do with its answer?

    1. AIt sorts the artists before the inner query runs
    2. BIt counts the albums and returns a total per artist
    3. CIt replaces the artists table with the albums table
    4. DIt keeps the artists for which no album was found
    Show the answer

    The existence test asks only whether a matching album row is there. The outer query keeps the artist when the answer is no, which is why Alice In Chains comes back alone.

    Next → 6 / 10
  8. Question 7 of 10

    A table is created with `CREATE TABLE label_notes (artist_id INTEGER PRIMARY KEY, note VARCHAR(40) NOT NULL, active INTEGER DEFAULT 1)`. The statement `INSERT INTO label_notes (artist_id, note) VALUES (1, 'back catalogue')` names two columns, and the stored row shows `active` as 1. Which rule filled it?

    1. AThe database copied the value from another table
    2. BThe value was calculated from the primary key column
    3. CThe insert ran twice and the two rows were merged
    4. DThe third column was given a default value
    Show the answer

    A default supplies the value when an insert leaves the column out, so the row is complete without the statement naming that column. Here the definition of `active` carries that default. Defaults are part of block five.

    Next → 7 / 10
  9. Question 8 of 10

    A transaction raises the price of track 8, sets `SAVEPOINT s1`, raises the price of track 9, and then runs `ROLLBACK TO SAVEPOINT s1` and `COMMIT`. Which price changes are stored at the end?

    1. AOnly the first change, because the second was undone
    2. BBoth changes, because both updates ran without an error
    3. COnly the second change, because the later update wins
    4. DNeither change, because the rollback cancelled the group
    Show the answer

    A savepoint is a marker inside the transaction. Returning to it undoes the work done after it and keeps the work done before it, and the commit then stores what is left.

    Next → 8 / 10
  10. Question 9 of 10

    A learner of this course can already filter and sort one table. Which topics do blocks two and three teach next, in that order?

    1. AGrouping and counting, and only then joining the tables
    2. BCreating a table, and then reading it through a view
    3. CJoining the tables, and then grouping and counting them
    4. DOpening a transaction, and then setting a savepoint
    Show the answer

    Block two brings the artist name next to the album, and block three turns joined rows into one counted row per artist. Each block is built on what the one before it gave you.

    Next → 9 / 10
  11. Question 10 of 10

    A long query over `tracks` is saved with `CREATE VIEW standard_tracks AS`, and an index is added to the same table. What changes for the person who later reads that view?

    1. ANothing changes, because a view has to be written out again each time
    2. BThe rows returned change, because the index filters them
    3. CThe name is shorter, and a suitable index may speed up the search
    4. DThe column names change, because the view renames the table
    Show the answer

    The view is read under its short name as if it were a table. An index is a structure kept beside the table that the database can follow instead of reading every row, when it judges that cheaper. The rows that come back stay the same either way.

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

    That’s 10 questions on What You Will Learn in This SQL Course. In the app the ones you miss come back exactly when you’re about to forget them.

    Back to the course Next lesson: Relational Model and SQL

    Opens in your browser. Nothing to install.

    Start studying

    On your phone, with the same account

    Get it on Google Play Download on the App Store

The whole course, on your computer and your phone

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

Opens in your browser. Nothing to install.

Start studying

On your phone, with the same account

Get it on Google Play Download on the App Store

“This app is the ‘One Lake’ for preparing the certification exams. Really worth it.”

Abdelhak Y. Google Play review