Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Importance of Style on Exam?


Importance of Style on Exam?

Author
Message
dan-572483
dan-572483
SSChasing Mays
SSChasing Mays (641 reputation)SSChasing Mays (641 reputation)SSChasing Mays (641 reputation)SSChasing Mays (641 reputation)SSChasing Mays (641 reputation)SSChasing Mays (641 reputation)SSChasing Mays (641 reputation)SSChasing Mays (641 reputation)

Group: General Forum Members
Points: 641 Visits: 1958
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?
Lynn Pettis
Lynn Pettis
SSC-Insane
SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)

Group: General Forum Members
Points: 24171 Visits: 37936
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.

Cool
Lynn Pettis

For better assistance in answering your questions, click here
For tips to get better help with Performance Problems, click here
For Running Totals and its variations, click here or when working with partitioned tables
For more about Tally Tables, click here
For more about Cross Tabs and Pivots, click here and here
Managing Transaction Logs

SQL Musings from the Desert Fountain Valley SQL (My Mirror Blog)
SQLRNNR
SQLRNNR
SSC-Insane
SSC-Insane (21K reputation)SSC-Insane (21K reputation)SSC-Insane (21K reputation)SSC-Insane (21K reputation)SSC-Insane (21K reputation)SSC-Insane (21K reputation)SSC-Insane (21K reputation)SSC-Insane (21K reputation)

Group: General Forum Members
Points: 21073 Visits: 18259
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

dan-572483
dan-572483
SSChasing Mays
SSChasing Mays (641 reputation)SSChasing Mays (641 reputation)SSChasing Mays (641 reputation)SSChasing Mays (641 reputation)SSChasing Mays (641 reputation)SSChasing Mays (641 reputation)SSChasing Mays (641 reputation)SSChasing Mays (641 reputation)

Group: General Forum Members
Points: 641 Visits: 1958
But you wouldn't miss an exam question because you picked the answer that left out the AS would you?
SQLRNNR
SQLRNNR
SSC-Insane
SSC-Insane (21K reputation)SSC-Insane (21K reputation)SSC-Insane (21K reputation)SSC-Insane (21K reputation)SSC-Insane (21K reputation)SSC-Insane (21K reputation)SSC-Insane (21K reputation)SSC-Insane (21K reputation)

Group: General Forum Members
Points: 21073 Visits: 18259
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

Lynn Pettis
Lynn Pettis
SSC-Insane
SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)

Group: General Forum Members
Points: 24171 Visits: 37936
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.

Cool
Lynn Pettis

For better assistance in answering your questions, click here
For tips to get better help with Performance Problems, click here
For Running Totals and its variations, click here or when working with partitioned tables
For more about Tally Tables, click here
For more about Cross Tabs and Pivots, click here and here
Managing Transaction Logs

SQL Musings from the Desert Fountain Valley SQL (My Mirror Blog)
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search