Inner Join VS Intersect in SQL Server

Last week I was working on reporting. QA team logged a bug that was not getting reproduced on development environment. First I reviewed the code at development, but was unable to figure the reason of count mismatch with details. Then I got the code reviewed by one of my seniors. He suggested me to replace inner join with intersect in a couple of conditions. I, till that day, used to this consider inner join and intersect as similar. But to my amazement both are completely different. So sharing my findings about difference between inner join and intersect:

Let’s have 2 different tables and we want the distinct rows which are common in both the tables what will we do to get them? Most of us will answer that they will use INNER JOIN to get the common rows of two tables, right? Wrong!!!!!!

This is a big misconception that INNER JOIN will always return all the common rows between two tables. In reality, INNER JOIN treats two NULLS as two different values rather than a same value so if you are joining a row based on a NULLable column there is a chance that if both tables have NULLs in that column then INNER JOIN will ignore those rows because

Two NULLs are not same in TSQL

To correctly retrieve all common rows between two tables, SQL Server 2005 has introduced the INTERSECT keyword. INTERSECT treats two NULLs as a same value and it returns all rows which are common in both the tables.
Additionally INNER JOIN retrieves all the records from the left table and all the records from the right table. Carefully observing we can notice many of the records as duplicate records. When INNER JOIN is used it gives us duplicate records, but that is not in the case of INTERSECT operator.
The duplicate records in UNION can be removed by using DISTINCT clause in SELECT statement. DISTINCT removes the duplicate rows and final result is exactly same in INTERSECT. In this way, INNER JOIN can simulate with INTERSECT when used with DISTINCT.

The results of an UPDATE statement are undefined if the statement includes a FROM clause that is not specified in such a way that only one value is available for each column occurrence that is updated (in other words, if the UPDATE statement is not deterministic). For example, given the UPDATE statement in the following script, both rows in table s meet the qualifications of the FROM clause in the UPDATE statement, but it is undefined which row from s is used to update the row in table t.

There aren’t many articles comparing performance between the two (UNION and INTERSECT) because they’re meant to substitute one for the other. INTERSECT is meant to find the distinct values combining two queries. That’s a very different goal than the INNER JOIN which is not finding distinct values, but values that simply match between two tables, derived or otherwise.

As a matter of fact, it’s worse than that since the INTERSECT operation requires that the values returned by both queries match in data type, so you couldn’t even do a normal INNER JOIN operation between disparate tables using INTERSECT.

But with similar data intersect takes a little less effort

Down with fever(may be chickenpox)……can I drink alcohol?

If you are down with chickenpox and googling to know if you can drink alcohol during chickenpox, then you are at the right page my friend. I have been in your shoes some time ago, my friend. So I am sharing my experience and findings during the time I had chickenpox.

Due to hectic weekend, I felt a bit dizzy on Monday morning. Initially I didn’t took it seriously considering it as Monday blues 🙂 . But by the evening I was quite sure that I am going down with fever. I usually avoid visit to clinics over minor illness, so I took crocin and a good sleep.

Then I realized that one of my roommates had got chickenpox two weeks ago. I decided not to delay the visit to doctor’s clinic. And to my worst thoughts, the doctor told that I have the symptoms of chicken pox I should start the medication for fever. The only nice word he said was that the chicken pox can only confirmed by tomorrow evening as I had not started to have scars as on today. So hoping for the best. But one thing I learned from the thoughts coming to my mind are that although I was afraid that the chickenpox would be quite troublesome.
But somewhere in my mind I was happy that I would be getting good 7-10 days to stay at my hometown. As it has been around 2 years that I have not stayed at my hometown for more than 2-3 days.

Anyways all was Ok until doctor uttered those ******* words  Do u drink or smoke?   I replied  no smoking but I do drink Ok, then don’t drink for next 5 days at least even if its not chickenpox.
Avoiding alcohol was a big issue for me as a couple of my friend were coming over to my place. So I went to the God of our generation , one and only one google.com. I tried to search but gone not get much. Only conclusion I can draw for the posts on google was:

Before drinking alcohol during chickenpox, you should consider the following:
  1. Your body should not be prone to allergies as alcohol can cause allergy.
  2. Alcohol generally lowers your immunity. So consuming alcohol during chickenpox can delay your recovery time.
  3. Doctor will most probably put you on antibiotics. The antibiotics don’t mix well with alcohol.
  4. Under the influence of alcohol, you can try to soothe the itching by rubbing the blisters therefore causing further implications.

So at the end of the day we can conclude that one should avoid drinking alcohol during chickenpox.

How many pages/posts can a WordPress handle?

So you are starting a new blog and just like every new blogger you are damn sure that you are gonna hit 1 million posts quickly. The first question that pops up in your mind is – How many pages/posts can a WordPress handle? Will WordPress be able to handle millions of posts or pages without any impact on page load speed / performance?
And the answer is – Theoretically, the WordPress can hold the forte and won’t slow down even with infinite number of pages/posts. WordPress is a simple and very efficient CMS. The problem could actually lie with the hardware on which you have installed your WordPress blog. WordPress can hold unlimited number of posts/pages provided the hardware supports it with sufficient processing speed and memory allocation.

The other player is this is MySQL. MySQL is designed to handle tons of data. So it never slows down wordpress after just a million posts unless and until MySQL is mis-configured(or the sql queries are not optimized)

The typical hardware recommended for efficient wordpress based blog is :
for smaller/newer WordPress with hundreds of visitors monthly …. shared hosting
for medium sized WordPress with thousands of visitors monthly …. VPS hosting
for large sized WordPress with thousands of visitors daily …. dedicated hosting

So the conclusion is, WordPress is a awesome Content Management System(CMS) and there is no need to doubt it for performance. Just make sure that MySQL is properly configured and hardware components are in line with the WordPress traffic requirements.

How to track HDFC credit card application status?

So you have applied for applied for new credit card and are looking forward to track HDFC Credit card application status. Welcome, you are at the right place.

As per Wikipedia, HDFC Bank is India’s largest private sector lender by assets. It is the largest bank in India by market capitalization as of February 2016. It was ranked 69th in 2016 BrandZ Top 100 Most Valuable Global Brands. As of December 31, 2016, the Bank’s distribution network was at 4,715 branches and 12,260 ATMs across 2,597 cities / towns. HDFC bank provides credit card suitable for every need and every individual. It provides convenience, unmatched benefits and jaw-dropping discounts with their credit cards. You can explore a world of exciting features and benefits with a wide array of credit cards from HDFC Bank. HDFC bank has a credit card that suits everyone.

How much time does HDFC takes to process my credit card application.

Whether you applied online(through their website/netbanking etc) or offline(by filling out forms with pen), it can take some time to process your application.
Typically, it takes around 2-3 weeks for the credit card to reach your registered address after you apply for the HDFC credit card. Even if your application for credit card is instantly approved or pre-approved, even then it takes around 1-2 weeks for your credit card to reach you.

How to track HDFC credit card application status:

The waiting period can make you really impatient, so you can track HDFC credit card application status to keep yourself posted and updated. The process to track HDFC credit card application is really easy. You just need to have any one of the following with you in order to track your credit card application:
a. Application reference number: The application reference number is 16 digits long. It can be found on your application form receipt.
b.Application form number: You can find application form number on the application form you submitted while applying for the HDFC credit card.
c.Date of birth: Please ensure that date of birth is exactly as written on application form. Beware not to swap month and date as it can be confusing sometimes.

Once you have this info, follow these steps to check the status of your credit card application
1. Go to https://www.hdfcbank.com/personal/credit_card/cc_track. Refer this screenshot for details:

Screenshot of track HDFC Credit Card application status

Track HDFC Credit Card application status

2. Fill any of the above items. That is either fill Application reference number or application form number or your date of birth.
3. Now enter the mobile number you filled in the application form while applying for the HDFC bank credit card.
4. Click the Submit button.
5. Now you should be able to see the exact status of your credit card application.

So we saw that the procedure to track the status of the HDFC credit card is quite simple and straightforward. But if you have any difficulty checking the status, you can share your details in the comment section and we will check the status for you.

How to track ICICI credit card application status?

So you have applied for applied for new credit card and are looking forward to track ICICI Credit card application status. Welcome, you are at the right place.

As per Wikipedia, In 2014, it was the second largest bank in India in terms of assets and third in term of market capitalisation. It offers a wide range of banking products and financial services for corporate and retail customers through a variety of delivery channels and specialised subsidiaries in the areas of investment banking, life, non-life insurance, venture capital and asset management. The bank has a network of 4,850 branches and 14,404 ATMs in India, and has a presence in 19 countries including India.

How much time does ICICI takes to process my credit card application.

Whether you applied online(through their website/netbanking etc) or offline(by filling out forms with pen), it can take some time to process your application.
Typically, it takes around 2-3 weeks for the credit card to reach your registered address after you apply for the ICICI credit card. Even if your application for credit card is instantly approved or pre-approved, even then it takes around 1-2 weeks for your credit card to reach you.

How to track ICICI credit card application status:

The waiting period can make you really impatient, so you can track ICICI credit card application status to keep yourself posted and updated. The process to track ICICI credit card application is really easy. You just need to have any one of the following with you in order to track your credit card application:
a. Application Id: The application id can be found on your application form receipt.
b. Mobile number: The mobile number you provided while applying for the ICICI credit card.

Once you have this info, follow these steps to check the status of your credit card application
1. Go to https://loans.icicibank.com/verifyOwnershipForm.html Refer this screenshot for details:

Screenshot of track ICICI Credit Card application status

Track ICICI Credit Card application status

2. Fill in the application id. Application id can be found on your credit card application form.
3. Now enter the mobile number you filled in the application form while applying for the ICICI bank credit card.
4. Click the Submit button.
5. Now you should be able to see the exact status of your credit card application.

So we saw that the procedure to track the status of the ICICI credit card is quite simple and straightforward. But if you have any difficulty checking the status, you can share your details in the comment section and we will check the status for you.