A good entry-level interview question

I think this would make a reasonable question for would-be database developers:

What are the differences between the following statements?

UPDATE mytable SET mycolumn = NULL;
ALTER TABLE mytable MODIFY (mycolumn NULL);

If they can’t answer this correctly, they don’t get to stage two.

11 thoughts on “A good entry-level interview question

  1. I was trying to think of a good background story to this, but I'm just not that creative :)It's just something that popped into my head – I was typing the "ALTER TABLE" today, and thought, "I bet this would confuse someone who didn't know the difference between DML and DDL".So, I'm a bit boring today.

    Like

  2. Today's story – there was I pontificating about array fetch / bulk collect etc etc … when someone asks:"Excuse me, what's that SQL extension you are using at the bottom of the SQL. I've never seen it…"….. (long pause by me….)"Um…That would be the GROUP BY clause"Hmmmmm………

    Like

  3. :)That's another good interview question: "Explain the difference between ORDER BY and GROUP BY."For advanced developers: "Is an ORDER BY required if a statement to be sorted already has a GROUP BY? Why?"

    Like

  4. On a totally separate note….Jeff you need to update your movie list in your profile! It reads 'Geek'. ;-) Being a fellow iced-coffee lover I would hate for folks to associate the two together!

    Like

  5. Hello Anonymous!I haven't checked my profile for ages – but not much has changed, really. Anyway, if I can convert just one iced-coffee-afficionado into a geek, or vice-versa, I will consider my mission to be complete :)

    Like

  6. Another one:

    CREATE TABLE x ( stringid VARCHAR2(10) );
    INSERT INTO x VALUES (‘3’);
    INSERT INTO x VALUES (‘1’);
    INSERT INTO x VALUES (‘2’);

    Q. Given the table above, what is the difference, if any, between the following two queries?

    SELECT stringid FROM x ORDER BY 1;

    SELECT stringid FROM x ORDER BY TO_NUMBER(1);

    Like

  7. INSERT INTO x SELECT * FROM x;

    Q. What will happen if the above statement is executed?

    a) The insert will run successfully.
    b) The insert will not run – an exception will be raised immediately.
    c) The insert will insert many copies of the original rows in x, and will eventually raise an exception when the table space quota is full.

    Like

Comments are closed.