SQL SERVER – UNION ALL and ORDER BY – How to Order Table Separately While Using UNION ALL

I often see developers trying following syntax while using ORDER BY.

SELECT Columns
FROM TABLE1
ORDER BY Columns
UNION ALL
SELECT Columns
FROM TABLE2
ORDER BY Columns

However the above query will return following error.

Msg 156, Level 15, State 1, Line 5
Incorrect syntax near the keyword ‘ORDER’.

It is not possible to use two different ORDER BY in the UNION statement. UNION returns single resultsetand as per the Logical Query Processing Phases.

However, if your requirement is such that you want your top and bottom query of the UNION resultset independently sorted but in the same resultset you can add an additional static column and order by that column. Let us re-create the same scenario.

First create two tables and populated with sample data.

USE tempdb
GO
-- Create table
CREATE TABLE t1 (ID INT, Col1 VARCHAR(100));
CREATE TABLE t2 (ID INT, Col1 VARCHAR(100));
GO
-- Sample Data Build
INSERT INTO t1 (ID, Col1)
SELECT 1, 'Col1-t1'
UNION ALL
SELECT 2, 'Col2-t1'
UNION ALL
SELECT 3, 'Col3-t1';
INSERT INTO t2 (ID, Col1)
SELECT 3, 'Col1-t2'
UNION ALL
SELECT 2, 'Col2-t2'
UNION ALL
SELECT 1, 'Col3-t2';
GO

If we SELECT the data from both the table using UNION ALL .

-- SELECT without ORDER BY
SELECT ID, Col1
FROM t1
UNION ALL
SELECT ID, Col1
FROM t2
GO

We will get the data in following order.

unionorderby1 SQL SERVER   UNION ALL and ORDER BY   How to Order Table Separately While Using UNION ALL

However, our requirement is to get data in following order.

unionorderby3 SQL SERVER   UNION ALL and ORDER BY   How to Order Table Separately While Using UNION ALL

If we need data ordered by Column1 we can ORDER the resultset ordered by Column1.

-- SELECT with ORDER BY
SELECT ID, Col1
FROM t1
UNION ALL
SELECT ID, Col1
FROM t2
ORDER BY ID
GO

unionorderby2 SQL SERVER   UNION ALL and ORDER BY   How to Order Table Separately While Using UNION ALL

Now to get the data in independently sorted in UNION ALL let us add additional column OrderKey and use ORDER BY  on that column. I think the description does not do proper justice let us see the example here.

-- SELECT with ORDER BY - with ORDER KEY
SELECT ID, Col1, 'id1' OrderKey
FROM t1
UNION ALL
SELECT ID, Col1, 'id2' OrderKey
FROM t2
ORDER BY OrderKey, ID
GO

The above query will give the desired result.

unionorderby3 SQL SERVER   UNION ALL and ORDER BY   How to Order Table Separately While Using UNION ALL

Now do not forget to clean up the database by running the following script.

-- Clean up
DROP TABLE t1;
DROP TABLE t2;
GO

Here is the complete script used in this example.

USE tempdb
GO
-- Create table
CREATE TABLE t1 (ID INT, Col1 VARCHAR(100));
CREATE TABLE t2 (ID INT, Col1 VARCHAR(100));
GO
-- Sample Data Build
INSERT INTO t1 (ID, Col1)
SELECT 1, 'Col1-t1'
UNION ALL
SELECT 2, 'Col2-t1'
UNION ALL
SELECT 3, 'Col3-t1';
INSERT INTO t2 (ID, Col1)
SELECT 3, 'Col1-t2'
UNION ALL
SELECT 2, 'Col2-t2'
UNION ALL
SELECT 1, 'Col3-t2';
GO
-- SELECT without ORDER BY
SELECT ID, Col1
FROM t1
UNION ALL
SELECT ID, Col1
FROM t2
GO
-- SELECT with ORDER BY
SELECT ID, Col1
FROM t1
UNION ALL
SELECT ID, Col1
FROM t2
ORDER BY ID
GO
-- SELECT with ORDER BY - with ORDER KEY
SELECT ID, Col1, 'id1' OrderKey
FROM t1
UNION ALL
SELECT ID, Col1, 'id2' OrderKey
FROM t2
ORDER BY OrderKey, ID
GO
-- Clean up
DROP TABLE t1;
DROP TABLE t2;
GO

I am sure there are many more ways to achieve this, what method would you use if you have to face the similar situation?

Click to Download Scripts

Reference: Pinal Dave (http://blog.sqlauthority.com)

 

SQLAuthority News – Who I Am And How I Got Here – True Story as Blog Post

Here are few of the sample questions I get every day?

  • “Give me shortcut to become superstar?”
  • “How do I become like you?”
  • “Which book I should read so I know everything?”
  • “Can you share your secret to be successful? I want to know it but do not share with others.”

There is generic answer I always give is to work hard and read good educational material or watch good online videos.

letteri SQLAuthority News   Who I Am And How I Got Here   True Story as Blog PostOne of the emails really caught my attention. It was from a friend and SQL Server Expert John Sansom (Blog | Twitter). He wrote if I would like to share my story with the world about “Who I am and How I got Here”. I was very much intrigued with his suggestion. John is one guy I respect a lot. Every single topic he writes, I read it with dedication. I eagerly wait for his Weekly Summary of Best SQL Links. If you have not read them, you are missing something out.

Writing a guest post for him was like walking in memory lane. I remembered the time when I was beginning my career and I was bit overconfident and bit naive. I had my share of mistakes when I started my career. As time passed by I realize the truth. Well, we all do mistakes. Though, I am proud that as soon as I know my mistakes I corrected them. I never acted on impulse or when I am angry. I think that alone has helped me analysis the situation better and become better human being. During the course, I have lost my ego and it is replaced by passion. I am much more happy and successful in my work.

Quite often people ask me if I am always online and wether I have family or not. Honestly, I am able to work hard because of my family. They support me and they encourage me to be enjoy in what I do. They support everything I do and personally, I do not miss a single occasion to join them in daily chores of fun.

If there was a shortcut to success – I want know. I learnt SQL Server hard way and I am still learning. There are so many things, I have to learn. There is not enough time to learn everything which we want to learn. I am constantly working on it every day. I welcome you to join my journey as well. Please join me with my journey to learn SQL Server – more the merrier.

I have written a story of my life as a guest post. 

Read Here: A Journey to SQL Authority

Special thanks to John Sansom (Blog Twitter) for giving me space to talk my story. Indeed I am honored.

Reference: Pinal Dave (http://blog.sqlauthority.com)

SQLAuthority News – Pluralsight Course Review – Practices for Software Startups – Part 2 of 2

This is the second part of the two part series of Practices for Software Startup Pluralsight Course. Please read the first part of this series over here. The course is written by Stephen Forte (Blog | Twitter). Stephen Forte is the Chief Strategy Officer of the venture backed company, Telerik.

Personal Learning Schedule

After these three sessions it was 6:30 am and time to do my own blog.  But for the rest of the day, I kept thinking about the course, and wanted to go back and finish.  I was wishing that I had woken up at 3 am so I could finish all at one go.  All day long I was digesting what I had learned.  At 10 pm, after my daughter had gone to bed, I sighed on again.  I was not disappointed by the long wait.  As I mentioned before, Stephen has started four to six companies, and all of them are very successful today.

Here is the video I promised yesterday – it discusses the importance of Right Sizing Your Startup.

The Heartbeat of Startup – Technology

technologyglobe SQLAuthority News   Pluralsight Course Review   Practices for Software Startups   Part 2 of 2Stephen has combined all technology knowledge into one 30 minute session.  He discussed  how to start your project, how to deal with opinions, and how to deal with multiple ideas – every start up has multiple directions it can go. He spent a lot of time emphasized deciding which direction to go and how to decide which will be the best for you.  He called it a continuous development cycle.

One of the biggest hazards for a start-up company is one person deciding the direction the company will go, until down the road another team member announces that there is a glitch in their part of the work and that everyone will have to start over.  Even though a team of two or five people can move quickly, often the decision has gone too long and cannot be easily fixed.   Stephen used an example from his own life:  he was biased for one type of technology, and his teammate for another.  In the end they opted for his teammate’s  choice , and in the end it was a good decision, even though he was unfamiliar with that particular program.  He argues that technology should not be a barrier to progress, that you cannot rely on your experience only.  This really spoke to me because I am a big fan of SQL, but I know there is more out there, and I should be more open to it.  I give my thanks to Stephen, I learned something in this module besides startups.

Money, Success and Epic Win!

money SQLAuthority News   Pluralsight Course Review   Practices for Software Startups   Part 2 of 2The longest, but most interesting, the module was funding your start-up.  You need to fund the start-up right at the very beginning, if not done right you will run into trouble.  The good news is that a few years ago start-ups required a lot more money – think millions of dollars – but now start-ups can get off the ground for thousands.  Stephen used an example of a company that years ago would have needed a million dollars, but today could be started for $600.  It is true that things have changed, but you still need money.  For $600 you can start small and add dynamically, as needed.  But the truth is that if you have $600, $6000, or $6 million, it will be spent.  Don’t think of it as trying to save money, think of it as investing in your future.   You will need money, and you will need to (quickly) decide what you do with the money: shares, stakeholders, investing in a team, hiring a CEO.  This is so important because once you have money and start the company, the company IS your money.  It is your biggest currency – having a percentage of ownership in the company.  Investors will want percentages as repayment for their investment, and they will want a say in the business as well.  You will have to decide how far you will dilute your shares, and how the company will be divided, if at all.  If you don’t plan in advance, you will find that after gaining three or four investors, suddenly you are the minority owner in your own dream.  You need to understand funding carefully.  This single module is worth all the money you would have spent on the whole course alone.  I encourage everyone to listen to this single module even if they don’t watch any of the others.    

Press End to Start the Game – Exists!

presstoexit SQLAuthority News   Pluralsight Course Review   Practices for Software Startups   Part 2 of 2The final module is exit strategies.  You did all this work, dealt with all political and legal issues.  What are you going to get out of it? The answer is simple: money.  Maybe you want your company to be bought out, for you talent to bring you a profit.  You can sell the company to someone and still head it.  Many options are available.  You could sell and still work as an employee but no longer own the company.  There are many exit strategies.  This is where all your hard work comes into play.  It is important not to feel fooled at any step.  There are so many good ideas that end up in the garbage because of poor planning, so that if you find yourself successful, you don’t want to blow it at this step!  The exit is important.  I thought that this aspect of the course was completely unique, and I loved Stephen’s point of view.  I was lost deep in thought after this module ended.  I actually took two hours worth of notes on this section alone – and it was only a three hour course.  I am planning on attending this course one more time next week, just to catch up on all the small bits of wisdom I’m sure I missed.

Thank you Stephen for bringing your real world experience with us!  I recommend that everyone attends this course, even if they don’t want to begin their own start-up company.

It was indeed a long day for me. Do not forget to read part 1 of this story and attend course Practices for Software Startup Pluralsight Course.

Reference: Pinal Dave (http://blog.sqlauthority.com)

SQLAuthority News – Pluralsight Course Review – Practices for Software Startups – Part 1 of 2

This is first part of the two part series of Practices for Software Startup Pluralsight Course. The course is written by Stephen Forte (Blog | Twitter). Stephen Forte is the Chief Strategy Officer of the venture backed company, Telerik, a leading vendor of developer and team productivity tools. Stephen is also a Certified Scrum Master, Certified Scrum Professional, PMP, and also speaks regularly at industry conferences around the world. He has written several books on application and database development.  Stephen is also a board member of the Scrum Alliance.

beststartup SQLAuthority News   Pluralsight Course Review   Practices for Software Startups   Part 1 of 2

Startups – Everybodies Dream

Start-up companies are an important topic right now – everyone wants to start their own business.  It is also important to remember that all companies were a start up at one point – from your corner store to the giants like Microsoft and Apple.  Research proves that not every start-up succeeds, in fact, most will fail before their first year.  There are many reasons for this, and this could be due to the fact that there are many stages to a start-up company, and stumbling at any of these stages can lead to failure.  It is important to understand what makes a start-up company succeed at all its hurdles to become successful.  It is even important to define success.  For most start-ups this would mean becoming their own independently functioning company or to be bought out for a hefty profit by a larger company.  The idea of making a hefty profit by living your dream is extremely important, and you can even think of start-ups as the new craze.  That’s why studying them is so important – they are very popular, but things have changed a lot since their inception.

Starting the Startups

Beginning a start-up company used to be difficult, but now facilities and information is widely available, and it is much easier.  But that means it is much easier to fail, also.  Previously to start your own company, everything was planned and organized, resources were ensured and backed up before beginning; even the idea of starting your own business was a big thing.  Now anybody can do it, and the steps are simple and outlines everywhere – you can get online software and easily outsource , cloud source, or crowdsource a lot of your material.  But without the type of planning previously required, things can often go badly.

New Products – New Ideas – New World

startup1 SQLAuthority News   Pluralsight Course Review   Practices for Software Startups   Part 1 of 2There are so many fantastic new products, but they don’t reach success all the time.  I find start-up companies very interesting, and whenever I meet someone who is interested in the subject or already starting their own company, I always ask what they are doing, their plans, goals, market, etc.  I am sorry to say that in most cases, they cannot answer my questions.  It is true that many fantastic ideas fail because of bad decisions.  These bad decisions were not made intentionally, but people were simply unaware of what they should be doing.  This will always lead to failure.  But I am happy to say that all these issues can be gone because Pluralsight is now offering a course all about start-ups by Stephen Forte.  Stephen is a start up leader.  He has successfully started many companies and most are still going strong, or have gone on to even bigger and better things.

Beginning Course on Startup

I have always thought start-ups are a fascinating subject, and decided to take his course, but it is three hours long.  This would be hard to fit into my busy work day all at once, so I decided to do half of his course before my daughter wakes up, and the other half after she goes to sleep.  The course is divided into six modules, so this would be easy to do.  I began the first chapter early in the morning, at 5 am.  Stephen jumped right into the middle of the subject in the very first module – designing your business plan.  The first question you will have to answer to yourself, to others, and to investors is: What is your product and when will we be able to see it?  So a very important concept is a “minimal viable product.”  This means setting goals for yourself and your product.  We all have large dreams, but your minimal viable product doesn’t have to be your final vision at the very first.  For example: Apple is a giant company, but it is still evolving.  Steve Jobs didn’t envision the iPhone 6 at the very beginning.  He had to start at the first iPhone and do his market research, and the idea evolved into the technology you see now.  So for yourself, you should decide a beginning and stop point.  Do your market research.  Determine who you want to reach, what audience you want for your product.  You can have a great idea that simply will not work in the market, do need, bottlenecks, lack of resources, or competition.  There is a lot of research that needs to be done before you even write a business plan, and Stephen covers it in the very first chapter.

The Team – Unique Key to Success

together SQLAuthority News   Pluralsight Course Review   Practices for Software Startups   Part 1 of 2After jumping right into the subject in the very first module, I wondered what Stephen could have in store for me for the rest of the course.  Chapter number two is building a team.  Having a team is important regardless of what your startup is.  You can be a true visionary with endless ideas and energy, but one person can still not do everything.  It is important to decide from the very beginning if you will have cofounders, team leaders, and how many employees you’ll need.  Even more important, you’ll need to decide what kind of team you want – what personalities, skills, and type of energy you want each of your employees to bring.  Do you want to have an A+ team with a B- idea, or do you have a B- idea that needs an A+ team to sell it?  Stephen asks all the hard questions!  I was especially impressed by his insight on developing.  You have to decide if you need developers, how many, and what their skills should be. I found this insight extremely useful for everyday usage, not just for start-up companies.  I would apply this kind of information in management at any position.  An amazing team will build an amazing product – and that doesn’t matter if you’re a start-up company or a small team working for a much larger business.

Customer Development – The Ultimate Obective

Chapter three was about customer development. According to Stephen, there are four different steps to develop a customer base.  The first question to ask yourself is if you are envisioning a large customer base buying a few products each, or a small, dedicated base that buys a lot of your product – quantity vs. Quality.  He also discusses how to earn, retain, and get more customers.  He also says that each customer should be placed in a different role – some will be like investors, who regularly spend with you and invest their money in your business.  It is then your job to take that investment and turn it into a better product in the future.  You need to deal with their money properly – think of it is as theirs as investors, not yours as profit.  At the end of this module I felt that only Stephen could provide this kind of insight, and then he listed all the resources he took his information from.  I have never seen a group of people so passionate about their customers.

It was indeed a long day for me. In tomorrow’s part 2 we will discuss rest of the three module and also will see a quick video of the Practices for Software Startup Pluralsight Course.

Reference: Pinal Dave (http://blog.sqlauthority.com)

SQL SERVER – Identifying guest User using Policy Based Management

If you are following my recent blog posts, you may have noticed that I’ve been writing a lot about Guest User in SQL Server. Here are all the blog posts which I have written on this subject:

One of the requests I received was whether we could create a policy that would prevent users unable guest user in user databases. Well, here is a quick tutorial to answer this. Let us see how quickly we can do it.

Requirements

  1. Check if the guest user is disabled in all the user-created databases.
  2. Exclude master, tempdb and msdb database for guest user validation.

We will create the following conditions based on the above two requirements:

  1. If the name of the user is ‘guest’
  2. If the user has connect (@hasDBAccess) permission in the database
  3. Check in All user databases, except: master, tempDB and msdb

Once we create two conditions, we will create a policy which will validate the conditions.

Condition 1: Is the User Guest?

Expand the Database >> Management >> Policy Management >> Conditions

pbm1 SQL SERVER   Identifying guest User using Policy Based Management

Right click on the Conditions, and click on “New Condition…”. First we will create a condition where we will validate if the user name is ‘guest’, and if it’s so, then we will further validate if it has DB access.

pbm2 SQL SERVER   Identifying guest User using Policy Based Management

Check the image for the necessary configuration for condition:
Facet: User
Expression:
@Name = ‘guest’

Condition 2: Does the User have DBAccess?

Expand the Database >> Management >> Policy Management >> Conditions

Right click on Conditions and click on “New Condition…”. Now we will validate if the user has DB access.

pbm2 2 SQL SERVER   Identifying guest User using Policy Based Management

Check the image for necessary configuration for condition:
Facet: User
Expression:
@hasDBAccess = False

Condition 3: Exclude Databases

Expand the Database >> Management >> Policy Management >> Conditions

Write click on Conditions and click on “New Condition…” Now we will create condition where we will validate if database name is master, tempdb or msdb and if database name is any of them, we will not validate our first one condition with them.

pbm2 3 SQL SERVER   Identifying guest User using Policy Based Management

Check the image for necessary configuration for condition:
Facet: Database
Expression:
@Name != ‘msdb’
AND @Name != ‘tempdb’
AND @Name != ‘master’

The next step will be creating a policy which will enforce these conditions.

Creating a Policy

Right click on Policies and click “New Policy…”

Here, we justify what condition we want to validate against what the target is.

pbm4 SQL SERVER   Identifying guest User using Policy Based Management

Condition: Has User DBAccess
Target Database: Every Database except (master, tempdb and MSDB)
Target User: Every User in Target Database with name ‘guest’

pbm5 SQL SERVER   Identifying guest User using Policy Based Management

Now we have options for two evaluation modes: 1) On Demand and 2) On Schedule

We will select On Demand in this example; however, you can change the mode to On Schedule through the drop down menu, and select the interval of the evaluation of the policy.

Evaluate the Policies

We have selected OnDemand as our policy evaluation mode. We will now evaluate by means of executing Evaluate policy. Click on Evaluate and it will give the following result:

pbm6 SQL SERVER   Identifying guest User using Policy Based Management

The result demonstrates that one of the databases has a policy violation. Username guest is enabled in AdventureWorks database. You can disable the guest user by running the following code in AdventureWorks database.

pbm7 SQL SERVER   Identifying guest User using Policy Based Management

USE AdventureWorks;
REVOKE CONNECT FROM guest;

Once you run above query, you can already evaluate the policy again. Notice that the policy violation is fixed now.

pbm9 SQL SERVER   Identifying guest User using Policy Based Management

You can change the method of the evaluation policy to On Schedule and validate policy on interval. You can check the history of the policy and detect the violation.

pbm10 SQL SERVER   Identifying guest User using Policy Based Management

pbm11 SQL SERVER   Identifying guest User using Policy Based Management

Quiz

I have created three conditions to check if the guest user has database access or not. Now I want to ask you: Is it possible to do the same with 2 conditions? If yes, HOW? If no, WHY NOT?

Reference: Pinal Dave (http://blog.sqlauthority.com)

SQLAuthority News – I am Speaking at SQL Saturday 116 – Bangalore, India on January 7, 2012 – First SQL Saturday in India

sqlsat116 web SQLAuthority News   I am Speaking at SQL Saturday 116   Bangalore, India on January 7, 2012   First SQL Saturday in IndiaSQLSaturday 116 is now only 3 days away. SQL Saturday is FREE event all the attendees and 100% SQL community driven. This is very first SQL Saturday in India and I am very much excited that I will be speaking at this event on my favorite subject of SQL Server Performance Tuning. I have so far delivered 100s of presentation on this subject but this subject never gets old and I never ran out of new tips and tricks.

I suggest you mark your calender right now and present at the hall before time to secure your seat.

Session Details

SQL Server Performance Tips and Tricks

speed1 SQLAuthority News   I am Speaking at SQL Saturday 116   Bangalore, India on January 7, 2012   First SQL Saturday in IndiaIn this session we will go over various SQL Server Performance Tuning Tricks and Tips. Learn about top tips and best SQL Server performance practices related to:

  • Unused Indexes
  • Clustered Indexes
  • Importance of Statistics
  • Index Maintenance Scripts
  • ColumnStore Index
  • A Surprise Secret Tip

January 7, 2012 1:30 PM

I will ask 5 questions during my session and needless to say 5 winners will get copy of my book.

The session will be 100% demo oriented and I will share lots of tips and tricks during this session. Just like every other session of mine, this session will have lots of trivia for you as well it will be extremely interactive. If you prefer to stay quite during the session, this session will a perfect technology opener for you. Once you are in the session – you will be talking and discussion various aspect of performance along with your co-attendees and me.

Additionally, I am personally waiting for the sessions of Rick Morelan who is founder of Joes 2 Pros series. Do not miss any of the sessions of SQL Saturday – here is the complete schedule.

My friend Vinod Kumar has written blog on his sessions, read it here.

Note: Session will be not recorded. There will be no live cast of the session.

Reference: Pinal Dave (http://blog.SQLAuthority.com)

SQL SERVER – Mastering the Basics – Igniting Learning – A Unique Learning Experience

It has been my lifelong dream to be an author, and recently I have seen that goal realized three times.  One of the books I am most proud of is SQL Server Interview Questions and Answers. When I wrote SQL Server Interview Questions and Answers – I had very clear idea what my goals were for the book.

My goals were simple:

  1. Mastering the Basics
  2. Igniting Learning

I am very fortunate that my co-author shares the same love and passion for the SQL Server community. Vinod Kumar always believed in my same two goals. Our combined passion for the subject made writing this book a pleasant, even invigorating experience. We always felt this urge to help community and those who are eager to learn more. Years of learning the basics and practicing advanced technology led us to believe that learning the basics is sometimes the most difficult task of all. Once someone masters the basics, advanced concepts come easy. We have kept this in mind as we wrote this book.

A Book for Everyone

oldbook SQL SERVER   Mastering the Basics   Igniting Learning   A Unique Learning Experience

This book is not just for people who are looking to get their first job in the information technology field.  If you do not have an upcoming interview, if you already work in the field, but have questions about SQL Server or know that there are topics you should brush up on, then this is the book for you.

You don’t have to have a certain level of experience to get a lot from this book, either.  If you are a beginner you will not be totally confused by the topics – in fact, we tried to lay out the book for beginners.  However, experts will also find a lot to learn in these pages. Too.

Philosophy of the Book

We believe that this book will give advanced users a refresher and beginners a good learning point. We believe that after reading this book, our readers would be ignited to learn more. The goal of this book was not to tell you everything but to tell you enough so that you can learn yourself. Here is the hidden philosophy behind the book:

“Give a man a fish and you feed him for a day. Teach a man to fish and you feed him for a lifetime.” – Source Unknown

Our goal in writing this book was to give our readers a SQL Server fishing pole.  They can then learn how to “fish out” the good answers and solutions to their problems.  This book does not list the most common problems (and interview questions) and then give a long list about exactly what to do.  The point of this book was to teach the readers to think for themselves – and feed themselves for a lifetime.

Mastering the Basics

Recently someone asked me if they could pass an interview just by reading this book. The answer is – interviews are a complex process. One’s goal should not be to merely pass the interview. The goal should be to demonstrate your knowledge and find the right appropriate way to apply your learning. Think of it this way, before attempting to pass an interview just by remembering the right answers – ask yourself if you will be able to perform the real world tasks – the answer can be complex. How about this – learn all you can about the real work job before you go to the interview, and master the subject. Now when you go to the interview or to the real world job, you will always demonstrate superior quality and the ability to perform the necessary tasks.

Igniting Learning

Well, our book is exactly the same. It tells you what you should learn in depth, what you should know in the real world, what kind of information you should collect and master before you go on that interview. Do not use this book as a tool to pass the interview – it will not work that way – consider the book as ‘learning path’. Take each topic covered in the book and dwell on it, think about it and digest it slowly and masterfully. The book is designed in such a way that every important topic has enough reference material listed right below it. You can use the references listed there or do your own search on the subject. Just make sure that the learning experience is complete.

Real World Experience

success SQL SERVER   Mastering the Basics   Igniting Learning   A Unique Learning Experience

In a tough job market, it can be easy to look at a job advertisement and think to yourself, “I could do that job.”  You might know just a little bit about a subject, and you think that if you study hard enough you will sound smart enough to get the job, and then later you can learn all you can about the subject.  However, while our book will certainly help with the “sounding smart” part, you will also find that it encourages you to really learn SQL Server before that interview – with lots of real world examples and pointers advanced learning.  We encourage everyone to think about the job they want and love, and go for it.  Don’t look at book as just a way to get a job.

YOU!

We are constantly flooded with numerous emails, positive comments and constructive feedback. We are overwhelmed that almost everybody has understood the philosophy behind the book. SQL Server experts have told us that this book has helped them remember the basics and many have sent us questions to incorporate into the next versions. We believe the success of this concept is the positive energy which we have received from all of YOU!

Here are few blog posts about the book:

1) Review by Nakul VachhrajaniGood, portable book with easy to understand language on SQL Server Interview Questions & Answers

2) Review by Paras DoshiBook Review: SQL server Interview Questions and Answers by Pinal Dave and Vinod Kumar.

 3) Review by Madhivanan SQL Server MVP  – Book Review – SQL Server Interview Questions and Answers

4) Review by Sandeep KalraPinal Dave and Vinod Kumar‘s SQL Server Interview Questions and Answers: Book review

This book is available worldwide, here is the information about book – SQL Server Interview Questions and Answers

Reference: Pinal Dave (http://blog.SQLAuthority.com)

SQL SERVER – Plenty of SQL Community Updates

Every day we learn something new and we come across something which we like to read. I had decided to keep a log of things what I do during whole day. Here are few updates which I think you will find it interesting. This updates are in no specific order.

Comment by David Bridge on SQL SERVER – Effect of SET NOCOUNT on @@ROWCOUNT
David has written comment and clarified the message which I wanted to pass while writing blog post. I wish I had written the statement “NOCOUNT statement only affects the information messages and not the DML statement results ” which he wrote effortlessly in comment. Thanks David.

Blog by Vinod Kumar on SQL Server RC0 Resources
Vinod Kumar compiles the exhausting list of links and resources that might be of some interest to you on SQL Server 2012 RC0.

SQL Saturday 116
SQL Server 116 is here in India. This is going to very first SQL Saturday in India. Here are various links related to SQL Saturday 116.

Excellent Best Practices article by Aaron Bertrand
Aaron has written excellent timeless article on SQL Server Best Practices. If you have not read it earlier, well you read it now.

Just learned from Madhivanan – SSMS Allows you to ask a question in the MSDN forum directly from SSMS
I really loved this simple trick. I did know this earlier and I have now just learned.

SQL Server Interview Questions and Answers on Kindle
Our new book SQL Server Questions and Answers is now available on Kindle at special rate for this month.

Pluralsight SQL Server training courses by Dan Sullivan
I have so far attended every single course created by Dan on Pluralsight and find it very informative.

Well, these are my top 7 updates of yesterday.

Reference: Pinal Dave (http://blog.SQLAuthority.com)

SQL SERVER – Where Can YOU Get My Books – SQL Server Interview Question and Answers

Earlier month I released by third book SQL Server Interview Question and Answers. The focus of this book is ‘master the basics’. If you rate yourself 10 out of 10 in SQL Server – this book is not for you but if you want to learn fundamentals or want to refresh your fundamentals this book is for YOU. Earlier I was overwhelmed by love you all have shown to this book on release date leading our three digit inventory to run out of stock. Read detail blog post about the subject over here A Real Story of Book Getting ‘Out of Stock’ to A 25% Discount Story Available.

Well, we learn the lesson from the experience and have made sure that the inventory does not run out any more. Since then we are now available on multiple outlets. Pretty much anywhere in USA and India the book is available. Additionally, where ever Amazon ships internationally.

I have created dedicated page where I have listed where one can avail this book from Details of SQL Server Interview Question and Answers. Even though I keep on getting common question like – where one can get this book.

You can get this book from:

USA: Amazon

India: Flipkart | IndiaPlaza | Crossword

In India now you can walk into any crossword store and ask this book, if they do not have it, you can ask them get one for you.

Reference: Pinal Dave (http://blog.SQLAuthority.com)

SQLAuthority News – SQL Server Interview Questions And Answers Book Summary

sqlinterview SQLAuthority News   SQL Server Interview Questions And Answers Book SummaryToday we are using computers for various activities, motor vehicles for traveling to places, and mobile phones for conversation. How many of us can claim the invention of micro-processor, a basic wheel, or the telegraph? Similarly, this book was not written overnight. The journey of this book goes many years back with many individuals to be thanked for.

To begin with, we want to thank all those interviewers who reject interviewees by saying they need to know ‘the key things’ regardless of having high grades in class. The whole concept of interview questions and answers revolves around knowing those ‘key things’.

The core concept of this book will continue to evolve over time. I am sure many of you will come along with us on this journey and submit your suggestions to us to make this book a key reference for anybody who wants to start with SQL Server. Today we want to acknowledge the fact that you will help us keep this book alive forever with the latest updates. We want to thank everyone who participates in this journey with us.

Though each of these chapters are geared towards convenience we highly recommend reading each of the sections irrespective of the roles you might be doing since each of the sections have some interesting trivia about working with SQL Server. In the industry the role of accidental DBA’s (especially with SQL Server) is very common. Hence if you have performed the role of DBA for a short stint and want to brush-up your fundamentals then the upcoming sections will be a great review.

Table Of Contents

  • Database Concepts With Sql Server
  • Common Generic Questions & Answers
  • Common Developer Questions
  • Common Tricky Questions
  • Miscellaneous Questions On Sql Server 2008
  • Dba Skills Related Questions
  • Data Warehousing Interview Questions & Answers
  • General Best Practices

[Amazon] | [Flipkart]

Reference: Pinal Dave (http://blog.SQLAuthority.com)