8
2/22/2015 GROUP BY : SQL INTERVIEW QUERIES QUESTIONS AND ANSWERS WITH EXAMPLE FOR EXPERIENCED SET-5 ~ INTERVIEW QUES… http://www.interviewquestionspdf.com/2014/07/group-by-sql-interview-queries.html 1/8 INTERVIEW QUESTIONS PDF GROUP BY : SQL INTERVIEW QUERIES QUESTIONS AND ANSWERS WITH EXAMPLE FOR EXPERIENCED SET-5 HOME FREE PDF SQL GROUP BY & HAVING INTERVIEW QUERIES This is 5th post related to sql interview queries with examples. In this post we will discuss most importent sql server queries, which is related to "Group by" keyword. Group by related queries is most frequently asked in all interview. This post contains questions for both fresher and experienced developers. About GROUP BY:- The GROUP BY statement is used in conjunction with the aggregate functions to group the result-set by one or more columns. Related Table: 3 Share

GROUP BY _ SQL INTERVIEW QUERIES QUESTIONS AND ANSWERS WITH EXAMPLE FOR EXPERIENCED SET-5 ~ INTERVIEW QUESTIONS PDF

  • Upload
    ravi90

  • View
    41

  • Download
    0

Embed Size (px)

DESCRIPTION

dcfgf

Citation preview

  • 2/22/2015 GROUP BY : SQL INTERVIEW QUERIES QUESTIONS AND ANSWERS WITH EXAMPLE FOR EXPERIENCED SET-5 ~ INTERVIEW QUES

    http://www.interviewquestionspdf.com/2014/07/group-by-sql-interview-queries.html 1/8

    INTERVIEWQUESTIONS

    PDF

    GROUP BY : SQL INTERVIEW QUERIESQUESTIONS AND ANSWERS WITH EXAMPLEFOR EXPERIENCED SET-5

    HOME FREE PDF

    SQL GROUP BY & HAVING INTERVIEW QUERIESThis is 5th post related to sql interview queries withexamples. In this post we will discuss most importentsql server queries, which is related to "Group by"keyword. Group by related queries is most frequentlyasked in all interview. This post contains questions for

    both fresher and experienced developers.About GROUP BY:-The GROUP BY statement is used in conjunction with theaggregate functions to group the result-set by one or morecolumns.

    Related Table:

    3

    Share

  • 2/22/2015 GROUP BY : SQL INTERVIEW QUERIES QUESTIONS AND ANSWERS WITH EXAMPLE FOR EXPERIENCED SET-5 ~ INTERVIEW QUES

    http://www.interviewquestionspdf.com/2014/07/group-by-sql-interview-queries.html 2/8

    *******************GROUP BY RELATED SQL(MS SQL SERVER) INTERVIEWQUERIES*********

    --42. Write the query to get the department and department wisetotal(sum) salary from "EmployeeDetail" table.--ANS:

    SELECT Department, SUM(Salary) AS [Total Salary] FROM[EmployeeDetail]GROUP BY Department

    --43. Write the query to get the department and department wisetotal(sum) salary, display it in ascending order according to salary.--ANS:

    SELECT Department, SUM(Salary) AS [Total Salary] FROM[EmployeeDetail]GROUP BY Department ORDER BY SUM(Salary) ASC

    --44. Write the query to get the department and department wisetotal(sum) salary, display it in descending order according to salary.--ANS:

    SELECT Department, SUM(Salary) AS [Total Salary] FROM[EmployeeDetail]GROUP BY Department ORDER BY SUM(Salary) DESC

    --45. Write the query to get the department, total no. of departments,total(sum) salary with respect to department from "EmployeeDetail"table.--ANS:

    SELECT Department, COUNT(*) AS [Dept Counts], SUM(Salary) AS [TotalSalary] FROM [EmployeeDetail]GROUP BY Department

    --46. Get department wise average salary from "EmployeeDetail" tableorder by salary ascending--ANS:

  • 2/22/2015 GROUP BY : SQL INTERVIEW QUERIES QUESTIONS AND ANSWERS WITH EXAMPLE FOR EXPERIENCED SET-5 ~ INTERVIEW QUES

    http://www.interviewquestionspdf.com/2014/07/group-by-sql-interview-queries.html 3/8

    SELECT Department, AVG(Salary) AS [Average Salary] FROM[EmployeeDetail]GROUP BY Department ORDER BY AVG(Salary) ASC

    --47. Get department wise maximum salary from "EmployeeDetail" tableorder by salary ascending--ANS:

    SELECT Department, MAX(Salary) AS [Average Salary] FROM[EmployeeDetail]GROUP BY Department ORDER BY MAX(Salary) ASC

    --48. Get department wise minimum salary from "EmployeeDetail" tableorder by salary ascending--ANS:

    SELECT Department, MIN(Salary) AS [Average Salary] FROM[EmployeeDetail]GROUP BY Department ORDER BY MIN(Salary) ASC

    --USE OF HAVING

    --49. Write down the query to fetch Project name

    assign to more than one Employee

    --ANS:

    Select ProjectName,Count(*) [NoofEmp] from

    [ProjectDetail] GROUP BY ProjectName HAVING

    COUNT(*)>1

    Click on the following link for NEXT SET OF QUESTIONS:CLICK HERE FOR NEST SET (MORE THAN 100 QUERIES)Sponsored Ads

    Questions and Answers Windows SQL Server SQL Interview Questions

    3

    Share

  • 2/22/2015 GROUP BY : SQL INTERVIEW QUERIES QUESTIONS AND ANSWERS WITH EXAMPLE FOR EXPERIENCED SET-5 ~ INTERVIEW QUES

    http://www.interviewquestionspdf.com/2014/07/group-by-sql-interview-queries.html 4/8

    Newer Post Older Post

    Related Posts:

    MS SQL QUERIES INTERVIEW QUESTIONSANSWERS EXAMPLES 4 FRESHER ANDEXPERIENCED PDFTRICKY MS SQL SERVER QUERIES INTERVIEW QUESTIONSANSWERS 4 FRESHER AND EXPERIENCED WITH EXAMPLES PDF

    Hey there are more than 100 sql(ms sql serve Read More

    SQL SERVER QUERY INTERVIEW QUESTIONS -ANSWERS WITH EXAMPLE FOR FRESHER :SET-1 SOLUTIONSQL SERVER INTERVIEW QUERY SET : 1 WITHANSWERS/SOLUTION Here I come with more than 100 SQL

    Server queries for Database/.NET/SQL Server develope Read More

    MS SQL SERVER TRICKY/COMPLEXINTERVIEW QUERIES QUESTIONS ANSWERS :PDF SET-10MOST COMPLEX/TRICKY MS SQL SERVER (2005-08-12)QUERIES INTERVIEW QUESTIONS SET-10 This set contains most

    Tricky/complex MS SQL Server queries in Read More

    COMPLEX JOINS : SQL SERVER JOINSQUERIES INTERVIEW QUESTIONS ANDANSWERS EXAMPLES FOR EXPERIENCED SET-7

    SET-7 COMPLEX JOINS : MS SQL SERVER JOINS QUERIES INTERVIEW QUESTIONSAND ANSWERS FOR EXPERIENCED WITH EXAMPLES(MORE THAN 3 YEARS) This setcon Read More

    HOW PRINT A TRIANGLE OF STARS USINGPL/SQL IN SQL SERVER/ INTERVIEW QUERIESOne of the most complex PL/SQL interview queries is "How youwill print a triangle of stars in sql server using?" HOW PRINT ATRIANGLE OF STARS USIN Read More

    Home

    Share This: Facebook Twitter Google+ Stumble Digg

    08:34 INTERVIEW QUESTIONS, SQL INTERVIEW QUERY, SQL SERVER 1 COMMENT

    Recommend this on Google

  • 2/22/2015 GROUP BY : SQL INTERVIEW QUERIES QUESTIONS AND ANSWERS WITH EXAMPLE FOR EXPERIENCED SET-5 ~ INTERVIEW QUES

    http://www.interviewquestionspdf.com/2014/07/group-by-sql-interview-queries.html 5/8

    1 comment:

    Enter your comment...

    Comment as: Google Account

    Publish Preview

    Ankur Sachdev 15 January 2015 at 00:48

    good practice

    Reply

    Search SEARCH

    SQL Queries SQL Query Examples Interview Answers

    Find us on Facebook

    Interviewquestionspdf.com

    40 people like Interviewquestionspdf.com.

    Facebook social plugin

    Like

    MUST READ

  • 2/22/2015 GROUP BY : SQL INTERVIEW QUERIES QUESTIONS AND ANSWERS WITH EXAMPLE FOR EXPERIENCED SET-5 ~ INTERVIEW QUES

    http://www.interviewquestionspdf.com/2014/07/group-by-sql-interview-queries.html 6/8

    WHAT IS AN INTERVIEW? :)

    CHETAN BHAGAT BOOK/NOVEL HALFGIRLFRIEND FREE DOWNLOAD PDFHINDI/GUJARATI

    FREE DOWNLOAD HALF GIRLFRIEND CHETANBHAGAT NEW BOOK/NOVEL 2014 PDF

    CHETAN BHAGAT'S HALF GIRLFRIEND HINDIONLINE READ EBOOK PDF

    MS SQL QUERIES INTERVIEW QUESTIONS ANSWERSEXAMPLES 4 FRESHER AND EXPERIENCED PDF

    SQL SERVER QUERY INTERVIEW QUESTIONS -ANSWERS WITH EXAMPLE FOR FRESHER : SET-1SOLUTION

    COMPLEX JOINS : SQL SERVER JOINS QUERIESINTERVIEW QUESTIONS AND ANSWERSEXAMPLES FOR EXPERIENCED SET-7

    CHETAN BHAGAT HALF GIRLFRIEND FREEDOWNLOAD +FLIPKART +PDF

    Your Dreams are Mine Now PDF FREEDOWNLOAD? NOW GET HARD COPY FREE!! YES!!

    ASP.NET MVC INTERVIEW QUESTION PDF BOOKFREE BY Shailendra Chauhan

    Popular Posts

    Follow us on Facebook

    Blog links

    Powered by Blogger.

  • 2/22/2015 GROUP BY : SQL INTERVIEW QUERIES QUESTIONS AND ANSWERS WITH EXAMPLE FOR EXPERIENCED SET-5 ~ INTERVIEW QUES

    http://www.interviewquestionspdf.com/2014/07/group-by-sql-interview-queries.html 7/8

    2015 (48)

    2014 (138)

    December (10)

    November (9)

    October (5)

    September (38)

    August (11)

    July (19)

    Big Data FREE webinar on career opportunities in B...

    10000startups.com google initiatives India

    CWG 2014 RESULT APPS ANDROID | ITUNES |WINDOWS

    GLASGOW CWG 2014 MEDAL TALLY | HARYANA &PUNJAB

    HARYANA AND PUNJAB AT CWG 2014 GLASGOW

    Schedule of Indian players at the CWG Glasgow 2014...

    FREE PDF DOWNLOAD : ANKIT FADIA SOCIAL 50WAYS TO ...

    SELECT QUERIES: Small Tricky SQL SERVER QueriesIn...

    MS SQL QUERIES INTERVIEW QUESTIONS ANSWERSEXAMPLE...

    DDL : MS SQL SERVER QUERIES INTERVIEWQUESTIONS FO...

    COMPLEX JOINS : SQL SERVER JOINS QUERIESINTERVIEW...

    JOIN : SQL JOIN QUERIES INTERVIEW QUESTIONSAND AN...

    Free Download PDF: ASP.Net, C#.Net, ADO.Net, MS SQ...

    GROUP BY : SQL INTERVIEW QUERIES QUESTIONSAND ANS...

    Blog Archive

  • 2/22/2015 GROUP BY : SQL INTERVIEW QUERIES QUESTIONS AND ANSWERS WITH EXAMPLE FOR EXPERIENCED SET-5 ~ INTERVIEW QUES

    http://www.interviewquestionspdf.com/2014/07/group-by-sql-interview-queries.html 8/8

    Copyright 2015 INTERVIEW QUESTIONS PDFDistributed By My Blogger Themes | Blogger Theme By PremiumBloggerTemplates

    SALARY : SQL INTERVIEW QUERIES EXAMPLES FORFRESHE...

    DATETIME : SQL SERVER QUERIES INTERVIEW FOREXPER...

    SQL SERVER INTERVIEW QUERY WITH EXAMPLE 4FRESHER ...

    SQL SERVER QUERY INTERVIEW QUESTIONS -ANSWERS WIT...

    Import Data from Multiple Excel Files\Folders usin...

    June (7)

    May (19)

    April (19)

    February (1)

    Enter your email address:

    SUBSCRIBE

    Delivered by FeedBurner

    Get FREE EBOOK in UR mail-box

    Live Traffic Feed

    Real-time view Get Feedjit

    A visitor from India viewed ManoramaYearbook 2015 PDF/EBOOK FREE DO...21 secs agoA visitor from India viewed CHETAN