levo

SQL, Big Data and Distributed Systems

Inserting, updating, deleting and joining data

  • 3 things to know
  • Component 2

Overview

Danger of an UPDATE statement written with no WHERE clause and term join in SQL.

What you need to know

Answer each one before you reveal it.

Your recallNot started
Key term

Pupil holds PupilID, Surname and Year in that order. Write SQL to add pupil 214, surname Owen, in year 12.

Key term

Why is it safer to name the columns in an INSERT INTO statement?

Key term

Pupil holds PupilID, Surname and Year. Write SQL that inserts only identifier 300 and surname Rees by naming the columns.

Questions from this subtopic

Each one with the model answer underneath.

  1. 1

    Pupil holds PupilID, Surname and Year in that order. Write SQL to add pupil 214, surname Owen, in year 12.

    Model answer

    INSERT INTO Pupil VALUES (214, 'Owen', 12). The values are listed in the same order as the columns of the table.

  2. 2

    Why is it safer to name the columns in an INSERT INTO statement?

    Model answer

    Named columns let the database system match each value to the right column. A later change to the table layout then cannot silently misplace the data.

  3. 3

    Pupil holds PupilID, Surname and Year. Write SQL that inserts only identifier 300 and surname Rees by naming the columns.

    Model answer

    INSERT INTO Pupil (PupilID, Surname) VALUES (300, 'Rees'). Any column not named is left empty or takes its default value.

  4. 4

    What happens when an INSERT INTO statement omits a value for a NOT NULL column?

    Model answer

    The database system rejects the insertion and reports an error. The row is not added to the table.

  5. 5

    Pupil holds PupilID and Year. Write SQL to move pupil 214 into year 13.

    Model answer

    UPDATE Pupil SET Year = 13 WHERE PupilID = 214. The WHERE clause limits the change to that single row.

  6. 6

    What is the danger of an UPDATE statement written with no WHERE clause?

    Model answer

    An UPDATE with no WHERE clause changes the named column in every row of the table. The original values are lost.

Other ways to work this

The same content, four other ways.

What is inside Levo

Six ways to work the same material.

1Closed book
2Open book
3Closed book

See a huge jump in your memorisation

Answer cold, learn it, then prove it stuck. Levo tracks the jump between your first attempt and your last.

Data Structures: Arrays, Records and Hash Tables
Stacks, Queues, Linked Lists and Trees
Boolean Logic and Simplification
Algorithms, Pseudo-Code and Programming Constructs

Cram a whole paper in one sitting

Sort every topic into what you know and what you do not, then drill only the weak ones.

KDW to HAT.
decryptsencryptscompresses

Blank Blitz consolidates the facts

Rapid timed gap-fills on the terms and numbers you need to recall without thinking.

AThe two are not the same.
BOpen source refers to the availability of the code.
CMuch open source software is free of charge.

Build It trains answer structure

Assemble a full-mark answer from its marking points, in the order an examiner wants them.

Backup means the copy of the data.
TrueFalse

Test It catches misconceptions

Spot the fault in a statement. The traps are the mistakes students actually make.

721941163128510

Brain Breaks between sessions

Short focus games to reset attention, so the next set lands better than the last.

Every question in SQL, Big Data and Distributed Systems, on a schedule.

Attempt a question from memory, write the correct version, then attempt it again. Levo records the jump between your first attempt and your last, and brings each question back on the day you are due to forget it.

Or £46 a year, about £3.83 a month. Cancel anytime.