Interview Questions Answers.ORG
Interviewer And Interviewee Guide
Interviews
Quizzes
Home
Quizzes
Interviews Databases Programming Interviews:BtrieveClipperData ModelingData StructuresDatabase AdministrationDatabase Administrator (DBA)Database AnalystDatabase DeveloperDB DevelopmentEDI/Data Integration ExpertFirebirdHierarchicalIBM DB2InformixJava DatabaseMariaDBMicrosoft Access DeveloperMongoDBMS SQL ServerMySQL ProgrammingNetworkNoSQLObject RelationalPostgrePostgreSQLProgressRDBMSRelationalSQLSQL AdministratorSQL and PL/SQLSQL Notification ServicesSQL server 2008SSRSStored ProcedureSybaseTeradata
Copyright © 2018. All Rights Reserved
MS SQL Server Interview Question:
How To Name Query Output Columns in MS SQL Server?
Submitted by: AdministratorEach column in the query output has a default name. If you don't like the default name, you can specify a new name for any column in the query output by using the AS clause. The following statement shows you a good example:
SELECT tag AS Category, YEAR(created) AS Year,
COUNT(*) AS Counts FROM ggl_links
GROUP BY tag, YEAR(created) ORDER BY COUNT(*) DESC
GO
<pre>
Category Year Counts
HTML 2003 1
SQL 2004 1
SEO 2005 1
Jobs 2006 1
XML 2006 1
XSL 2007 1
JavaScript 2007 1
</pre>
Submitted by: Administrator
SELECT tag AS Category, YEAR(created) AS Year,
COUNT(*) AS Counts FROM ggl_links
GROUP BY tag, YEAR(created) ORDER BY COUNT(*) DESC
GO
<pre>
Category Year Counts
HTML 2003 1
SQL 2004 1
SEO 2005 1
Jobs 2006 1
XML 2006 1
XSL 2007 1
JavaScript 2007 1
</pre>
Submitted by: Administrator
Copyright 2007-2024 by Interview Questions Answers .ORG All Rights Reserved.
https://InterviewQuestionsAnswers.ORG.
https://InterviewQuestionsAnswers.ORG.