Sunday, 1 December 2013

Every Devloper Should Know these Questions

1.Difference between JOIN and UNION?
SQL JOIN allows us to “lookup” records on other table based on the given conditions between two tables. For example, if we have the department ID of each employee, then we can use this department ID of the employee table to join with the department ID of department table to lookup department names.
UNION operation allows us to add 2 similar data sets to create resulting data set that contains all the data from the source data sets. Union does not require any condition for joining. For example, if you have 2 employee tables with same structure, you can UNION them to create one result set that will contain all the employees from both of the tables.
2.WHERE clause and HAVING clause?
WHERE and HAVING both filters out records based on one or more conditions. The difference is, WHERE clause can only be applied on a static non-aggregated column whereas we will need to use HAVING for aggregated columns.
To understand this, consider this example.
Suppose we want to see only those departments where department ID is greater than 3. There is no aggregation operation and the condition needs to be applied on a static field. We will use WHERE clause

3.UNION, MINUS and INTERSECT?
UNION combines the results from 2 tables and eliminates duplicate records from the result set.
MINUS operator when used between 2 tables, gives us all the rows from the first table except the rows which are present in the second table.
INTERSECT operator returns us only the matching or common rows between 2 result sets.
To understand these operators, let's see some examples. We will use two different queries to extract data from our emp table and then we will perform UNION, MINUS and INTERSECT operations on these two sets of data. 

UNION

SELECT * FROM EMPLOYEEMASTER WHERE ID = 1
UNION
SELECT * FROM EMPLOYEEMASTER WHERE ID = 2
IDCompID
NAMESAL
12
Gautam30000
22
Puja20000

MINUS

SELECT * FROM EMPLOYEEMASTER 
MINUS
SELECT * FROM EMPLOYEEMASTER WHERE ID > 2
IDCompID
NAMESAL
1

Gautam30000
21
Puja20000

INTERSECT

SELECT * FROM EMPLOYEEMASTER WHERE ID IN (2, 3, 5)
INTERSECT
SELECT * FROM EMPLOYEEMASTER WHERE ID IN (1, 2, 4, 5)
IDCompID
NAMESAL
52
Gautam30000
21
Puja20000

4.Generate row number in SQL Without ROWNUM
SELECT name, sal, (SELECT COUNT(*)  FROM EMPLOYEEMASTER i WHERE o.name >= i.name) row_num
FROM EMPLOYEEMASTER o
order by row_num
NAMESALROW_NUM
Gautam300001
Puja200002
Kiran180003

5.Display All Tables,Columns,Views,Stored Procedure In a Database
SELECT * FROM SYS.OBJECTS WHERE TYPE IN ('U')
SELECT * FROM SYS.columns
SELECT * FROM SYS.views WHERE TYPE IN ('V')
SELECT * FROM SYS.OBJECTS WHERE TYPE IN ('P')

Top 10 Google Products

10. Blogger

Blogger is one of those products of the Google which has enabled the millions of users to polish their skills of writing and manage their position in the market. Blogger basically enables the great number of writers to self-publish which proves to be very helpful for them particularly at very start of their career. The blogger is currently available in almost 20 different languages, thus enabling great number of people to express their ideas and thoughts. Blogger is a free service and a number of writers have their blogs on Blogger.

9. Google Docs

Google docs has earned great popularity in very short time because of the distinguishing services it provides. It has brought out the new ideas by taking the productivity tools online. It largely helps the user to back up their works online and is not constrained to the problems which people usually had to face before the introduction of this product. One of the most distinguishing features of Google docs which greatly puts it different to the products of other brands is the price tag: free.

8. Google Translate

Google translate is very helpful particularly for those who have their interests in the different languages. Now people do not need to rely over the translators as Google is providing them a great online service of Google translate which can help you translate not only the words or sentences but also the heavy documents. The Google translate has the ability to translate anything into 64 different languages.

7. Advertising

Advertising has always been one of the peculiar features of the Google. The Google advertising is a great tool to promote your brand. Since millions of people visit Google every day, therefore it provides you the traffic of millions of customers who can see your advertisements. The Google advertising is greatly benefiting not only the producers but also the buyers who find themselves in good position to have a good choice.

6. Android

In response to Apple’s iPhone and mobile operating system, Google launched its Android ith different features. This software enables the users to use their mobile phones in different ways. Android is based on the Linux software and is regarded as one of the best competitors to the Apple’s products.

5. Google Chrome

Google Chrome is now one of the most widely used internet browsers of the world. It was launched in 2008 and has earned great popularity and fame in last five years. Google chrome is not only simple and speedy, but it also enables you to stay signed in to your Google account. According to the report of Stat count, Google chrome is most widely used web browser all over the world.

4. Google Map

Google Map has revolutionized the meaning of maps. This product was introduced in year 2005 and has become highly popular among the millions of people all over the world. Google map enables the user not to get lost anywhere in the world. Moreover, it also provides the easy tracking to one’s own home and thus is a great source of entertainment as well.

3. Youtube

Youtube is often regarded as the best product of Google bought in recent years. It is also regarded as the best video search engine which enables the user to access the billions of videos at one platform. Youtube also holds the distinction of streaming 4 billion online videos every day.

2. Gmail

Gmail has simply changed the trends of seeing and sending emails. Till the past year, i.e. 2013, Gmail was reported to have 350 million active users and it speaks volumes of the success of this great product of Google. Although it was released in 2004, yet it became available to general people in 2007. The stats show that there has been a very tough competition between Yahoo Mail (YMail) and Google Mail (Gmail).

1. Google Search

Here comes the mother product of Google for which it is largely known and appreciated because it is a free service. It is regarded as world’s best search engine as it provides you access to the all internet users’ daily routines and updates. Google search enables the users to have unlimited amount of information right at their fingertips. Without Google search the life would have been really difficult because it gives most relevant information whenever any term is searched.

Asp.net GridView example using C#

Below is a sample code snippet for Asp.net GridView example using C#. The code snippet shows how to populate the GridView with a List of Employees.

Asp.net GridView example using C#

ASP.NET WebForms

"GridView1" runat="server">

protected void Page_Load(object sender, EventArgs e)

{

List employees = new List();

employees.Add(new Employee { Name = "Test1", Designtaion = "Software Engineer" });

employees.Add(new Employee { Name = "Test2", Designtaion = "Architect" });

employees.Add(new Employee { Name = "Test3", Designtaion = "Vice President" });

GridView1.DataSource = employees;

GridView1.DataBind();

}