Importance of Style on Exam?

  • I've noticed that the 70-461 Exam guide contains quite a bit of the authors' opinions on the style issues of query writing that are not enforced by the database engine and not all code writers adhere too.

    For example, the book may use an example like

    SELECT s.St_Id AS 'Student ID', s.FIRST AS 'First Name', s.LAST AS 'Last Name', m.DESCRIPTION AS 'Major'

    FROM STUDENT AS s

    INNER JOIN MAJOR AS m ON s.M_ID = m.M_ID;

    Where I might have written it like

    select s.st_id 'Student ID', s.first 'First Name', s.last 'Last Name'

    from student s inner join major m on m.m_ID = s.m_ID

    There is the argument that some forms are more readable, but people who have been writing queries for years using a different style may disagree.

    Is knowledge of the "preferred" styles of query writing needed on the exam? Or is it just being able to recognize what will and will not produce the desired output?

  • dan-572483 (4/24/2013)


    I've noticed that the 70-461 Exam guide contains quite a bit of the authors' opinions on the style issues of query writing that are not enforced by the database engine and not all code writers adhere too.

    For example, the book may use an example like

    SELECT s.St_Id AS 'Student ID', s.FIRST AS 'First Name', s.LAST AS 'Last Name', m.DESCRIPTION AS 'Major'

    FROM STUDENT AS s

    INNER JOIN MAJOR AS m ON s.M_ID = m.M_ID;

    Where I might have written it like

    select s.st_id 'Student ID', s.first 'First Name', s.last 'Last Name'

    from student s inner join major m on m.m_ID = s.m_ID

    There is the argument that some forms are more readable, but people who have been writing queries for years using a different style may disagree.

    Is knowledge of the "preferred" styles of query writing needed on the exam? Or is it just being able to recognize what will and will not produce the desired output?

    Speaking of style, neither of the above is how I would write that code.

    I would write it like this:

    select

    s.st_id as StudentID,

    s.first as FirstName,

    s.last as LastName

    from

    dbo.student s

    inner join dbo.major m

    on m.m_ID = s.m_ID;

    Also, quite possible, I would leave out the 'as' in the column list as it is optional but adds to readability.

  • You need to know what the query does and not necessarily the style

    Jason...AKA CirqueDeSQLeil
    _______________________________________________
    I have given a name to my pain...MCM SQL Server, MVP
    SQL RNNR
    Posting Performance Based Questions - Gail Shaw[/url]
    Learn Extended Events

  • But you wouldn't miss an exam question because you picked the answer that left out the AS would you?

  • dan-572483 (4/24/2013)


    But you wouldn't miss an exam question because you picked the answer that left out the AS would you?

    No, but AS is preferred for readability.

    The exam does not test style.

    Jason...AKA CirqueDeSQLeil
    _______________________________________________
    I have given a name to my pain...MCM SQL Server, MVP
    SQL RNNR
    Posting Performance Based Questions - Gail Shaw[/url]
    Learn Extended Events

  • dan-572483 (4/24/2013)


    But you wouldn't miss an exam question because you picked the answer that left out the AS would you?

    That I can't answer as I have yet to take any MS certification exams as much as I have wanted to for many years.

    If you have the option between two queries that are identical except for the use os AS, I would probably choose the one using the AS.

Viewing 6 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply