Sunteți pe pagina 1din 35

OOP Section:

Q#1: What is early and late binding?


Q#2: What is this pointer?
Q#3: Briefly Explain Composition vs Aggregation explain it with an real world examples?

Q#4: What will be the output of the C# .NET code snippet given below?

class A
{
public virtual void Show()
{
Console.WriteLine("A.Show()");
}
}
class B : A
{
public override void Show()
{
Console.WriteLine("B.Show()");
}
}
class Program
{
static void Main(string[] args)
{
A obj = new B();
obj.Show();
}
}

RESULT:
B.Show()


Q#5: What will be the output of the C# .NET code snippet given below?


class Program
{
static void Main(string[] args)
{
C c = new C();
A a = new A();
a = c;
a.Show();
c.Show();

}
}
class A
{
public virtual void Show()
{
Console.WriteLine("A.Show()");
}
}
class B : A
{
public new void Show()
{
Console.WriteLine("B.Show()");
}
}
class C : B
{
public new void Show()
{
Console.WriteLine("C.Show()");
}
}

RESULT:

A.Show();
C.Show();

DB Section:

Q#1: What is the difference between HAVING and WHERE clause?
Q#2: Whats the difference between UNION and UNION ALL?
Q#3: Whats the difference between DELETE and TRUNCATE?
Q# 5: Foreign key vs Primary key?



Analytical Section:

Six reviewersFrank, George, Hilda, Jackie, Karl, and Lenawill review four moviesMystery,
Retreat, Seasonings, and Wolvesaccording to the following conditions:
Each reviewer reviews exactly one movie, and each movie is reviewed by at least one of
the six reviewers.
Hilda reviews the same movie as Frank.
Lena reviews the same movie as exactly one other reviewer.
George reviews Mystery.
Jackie reviews either Mystery or else Wolves.
Hilda does not review Wolves.
1. If Lena reviews Seasonings, which one of the following must be true?
1. Hilda reviews Retreat.
2. Jackie reviews Seasonings.
3. Karl reviews Mystery.
4. Karl reviews Retreat.
5. Karl reviews Wolves.
2. If Karl does not review Seasonings, which one of the following must be true?
1. Lena reviews Mystery.
2. Lena reviews Retreat.
3. Lena reviews Seasonings.
4. Frank and Hilda review Retreat.
5. Frank and Hilda review Seasonings.
3. Which one of the following is a complete and accurate list of the movies each of which could
be the movie that Lena reviews?
1. Mystery, Retreat
2. Retreat, Seasonings
3. Mystery, Seasonings, Wolves
4. Retreat, Seasonings, Wolves
5. Mystery, Retreat, Seasonings, Wolves
4. Which one of the following can be true?
1. Frank and George review Mystery.
2. Frank and Lena review Wolves.
3. George and Jackie review Mystery.
4. Karl reviews Wolves and Lena reviews Mystery.
5. Lena reviews Retreat and Frank reviews Seasonings.
5. Lena can review any of the following EXCEPT
1. Mystery with George
2. Mystery with Karl
3. Retreat with Karl
4. Seasonings with Karl
5. Wolves with Jackie
6. If Karl reviews the same movie as exactly one other reviewer, which one of the following is a
complete and accurate list of the movies any one of which could be the movie that these two
reviewers review?
1. Mystery, Retreat
2. Mystery, Seasonings
3. Retreat, Seasonings
4. Mystery, Seasonings, Wolves
5. Retreat, Seasonings, Wolves
Correct answers: 1) 1; 2) 5; 3) 5; 4) 5; 5) 2; 6) 3

Following are question from my side:

.Net Part
1. What is an application server?
2. How can we do Assembly versioning?
3. Please explain how ASP.NET application life cycle and page life cycle events fire?
4. What is the difference between Service and Component?
5. What is boxing and unboxing ?
6. What does the following C#.NET code snippet will print?
Code:
int i = 0, j = 0;

label:
i++;
j+=i;
if (i < 10)
{
Console.Write(i +" ");
goto label;
}
A Prints 1 to 9
B Prints 0 to 8
C Prints 2 to 8
D Prints 2 to 9
E Compile error at label.
Answer: A


Database
1. What are the advantages of DBMS?
2. What are the disadvantages in File Processing System?
3. Describe the three levels of data abstraction?
4. What is E-R model?
5. What is Domain-Key Normal Form?
6. What is 2NF?
7. Define primary key and foreign key?
8. What is trigger and type of the triggers?
9. What are the benefits of normalization and why De-normalization is required?

Analytical Portion
1.. Find the number of triangles in the given figure.

A 8 B. 10
C. 12 D 14

Answer is: D

2. Find the number of triangles in the given figure.

A 36 B 40
C 44 D 48

Answer is: D

3. Question: For students are sitting on a beach in a classroom. Ali is sitting left side of Waqar. Ahmad is
sitting to the right side of Waqar. Basit is sitting between Waqar and Ahmad. Who is sitting in the second
position from left hand side in the beach?
A. Ali
B. Waqar
C. Basit
D. Ahmad
Answer is: B

4. In the Beijing Olympics, the six nations Football team captains are walking in the following sequence :
The Brazil team captain was to the left of Germany captain and to the right side of France captain .The
Australian captain is on the right side of the Germany captain but was to the left side of the Argentina's
captain .Argentina's captain is to the left of the Italy captain . Find the captains who are in the extreme left
and extreme right ?

France and Germany
Australia and Argentina
Brazil and Italy
France and Italy
Answer is: D

5. In a shop, the items were arranged in a shelf consisting of six rows. Biscuits are arranged above the
tins of chocolates but below the rows of packets of chips, cakes are at the bottom and the bottles of
peppermints are below the chocolates.The topmost row had the display of jam bottles.Which place
exactly are the bottles of peppermints ?

2
nd

3
rd

4th

5
th


Answer is: D



OOP
Q1.Class A inherits B{}
Class B inherits A{}
Will this code run?
Q2.Abstract Class Animal{}
Class Cow inherits Animal{}

Animal obj = new Animal();
What is wrong with the above code?

Q3.Public class Company{
Private Company() {}
}
The above class has a private constructor. Can a class have private constructor? If yes edit the
class in such a way that we can instantiate its object. You are not allowed to make the
constructor public.

Q4.Class Company{
int i = 9;
Public static testFunction(){
this.i = 8;
}

}
Will this code compile and run?

Q5.Class A{
Public virtual methodA(){ print(Hello from A); }
}
Class B{
Public methodA(){ print(Hello from B); }
}

A obj = new B();
Obj.methodA();

What is the output of the following code?
Database
Case 1. Table Name: Even
numbers
2
4
6

Table Name: Whole
numbers
1
2
3
4
Q1.What is the output of this query?
Select * from Whole left join Even on Whole.numbers = Even.numbers where Even.numbers =
Case 2.Table Name : Employee
Employee_id First_name Last_name Salary Joining_date Department
1 John Abraham 1000000 01-JAN-13 Banking
2 Michael Clarke 800000 01-JAN-13 Insurance
3 Roy Thomas 700000 01-FEB-13 Banking
4 Tom Jose 600000 01-FEB-13 Insurance
5 Jerry Pinto 650000 01-FEB-13 Insurance
6 Philip Mathew 750000 01-JAN-13 Services
Table Name : Incentives
Employee_ref_id Incentive_date Incentive_amount
1 01-FEB-13 5000
2 01-FEB-13 3000
3 01-FEB-13 4000
1 01-JAN-13 4500
2 01-JAN-13 3500
Q2. Write the output of the following query.
Select * from EMPLOYEE where FIRST_NAME like J___
Q3. Write the output of the following query.
Select DEPARTMENT,max(SALARY) MaxSalary from employee group by DEPARTMENT
order by MaxSalary asc
Q4. Write the output of the following query.
Select FIRST_NAME, INCENTIVE_AMOUNT from employee a left join incentives B on
A.EMPLOYEE_ID = B.EMPLOYEE_REF_ID
Q5. Write the output of the following query.
Select FIRST_NAME, INCENTIVE_AMOUNT from employee a inner join incentives B
on A.EMPLOYEE_ID = B.EMPLOYEE_REF_ID and INCENTIVE_AMOUNT > 3000
Analytical
Q1. What will be output of following program?
#include<stdio.h>
int main(){
int a = 320;
char *ptr;
ptr =( char *)&a;
printf("%d ",*ptr);
return 0;
}
Q2. You are given 9 stainless steel balls (same size, but only one weighs slightly more than the
other. You have a scale that allows you to balance things on either side. You are only allowed to use
this scale twice. How do you identify which ball weighs more?
Q3. You have a bucket of jelly beans. Some are red, some are blue, and some green. With your eyes
closed, pick out 2 of a like color. How many do you have to grab to be sure you have 2 of the same?
Q4. If you had an infinite supply of water and a 5 liter and 3 liter bucket, how would you measure
exactly 4 liter?
Q5. How would you divide a cake into 8 parts provided you are allowed to make two cuts?


OOP
++++++++++++++++++++++++++++++++++++++++++

1. Define Destructor? what is the difference between a destructor and
a Finalize method in a class?

2. What is Inline function?

3. What is a virtual function?

4. What will be the output of the program?

public class ObjComp
{
public static void main(String [] args )
{
int result = 0;
ObjComp oc = new ObjComp();
Object o = oc;

if (o == oc)
result = 1;
if (o != oc)
result = result + 10;
if (o.equals(oc) )
result = result + 100;
if (oc.equals(o) )
result = result + 1000;

System.out.println("result = " + result);
}
}
Answer: 1101

5. What will be the output of the program?

public class Example
{
public static void main(String [] args)
{
double values[] = {-2.3, -1.0, 0.25, 4};
int cnt = 0;
for (int x=0; x < values.length; x++)
{
if (Math.round(values[x] + .5) == Math.ceil(values[x]))
{
++cnt;
}
}
System.out.println("same results " + cnt + " time(s)");
}
}
ANS:0020same results 2 time(s)

OOP======================================

DB
++++++++++++++++++++++++++++++++++++++++++
1. What are indexes, give Types, drawbacks of Non Clustered index?

2. What is third form of Normalization, give example?

3. what is Execution plan of a query?

4. inline query vs Stored Procedure, which one is better approach,
give 3 reasons?

5. What is RDBMS? Explain its features?
DB========================================

Analytical Questions
++++++++++++++++++++++++++++++++++++++++++
1. One skirt requires 3.75 yards of cloth. How many skirts you can
make from 45 yards?

Answer: 12

2. in a race, a person A surpasses the person B who is at last
position, what is the new position of person A?

Answer: invalid no one can surpass last position

3. There are five friends.They are standing in a row facing South.
Paul is to the immediate right of Bill . Bryan is between Ravi and
Amith .Amith is between Paul and Bryan .Who is second from extreme
left ?
ANSER: Bryan

4. There are five tent in a camp, P is to the right of Q and T is to
the left of R. Q is to the right of S.
Which of the tent is in the middle?
ANSWER: T

5. In a certain code, TIGER is written as RKEGP . In the same code,
LION must be written as ?
ANSWER: In a certain code, TIGER is written as RKEGP . In the same
code, LION must be written as ?

OOP Questions

Answer the question from 1-5 by from the below mentioned code snippet

package P;
class A {
private int f1;
int f2;
protected int f3;
public int f4;
}
public class B extends A {
A a = new A();
public int i = 2 + a.f?;
}
class R {
int i = new A().f?;
}

package Q;
import P.B;
class T {
B b = new B();
int i = 7 + b.f?;
}
public class S extends B {
int i = f?;

private int v(B o) {
i+=3;
return i + o.i;
}
public static void main(String[] args) {
S s = new S();
System.out.println(s.v(new S()));
}


Question 1
Which of the digits 1,2,3 and 4 cannot replace the question mark in class B, and why?


question mark can not be replaced by 1, because the field f1 is private and not accessible
outside class A.


Question 2
Which of the digits 1,2,3 and 4 cannot replace the question mark in class R, and why?


question mark can not be replaced by 1, because the field f1 is private and not accessible
outside class A.
f2,f3 of f4 are accessible from within the same package P.

Question 3
Which of the digits 1,2,3 and 4 cannot replace the question mark in class T, and why?

question mark cannot be replaced by 1,2 and 3 because the field f1 is private and not
accessible outside class
A, the field f2 is default and not accessible outside the package P and the field f3 is protected
and
not accessible from outside the package P in class that do not inherit from A.

Question 4
Which of the digits 1,2,3 and 4 cannot replace the question mark in class S, and why?

question mark cannot be replaced by 1 and 2 because the field f1 is private and not accessible
outside class A,
the field f2 is default and not accessible outside the package P. The field f3 is protected and is
only accessible in classes outside of P that extends A.

Question 5
Regardless of your answers to questions 1-4 the output of the main method in class S
will be the
same. What number is printed? Please explain how you reach this number.

The number printed is 5.
Two objects of type S is created.
The method v is called on the first object references by s, with an anonymous object as
argument.
The i in i+=3 refers to the i declared in S and shadows the i declared in B.
The i in o.i refers to the i declared in B because the type of the argument is B. The type of the
supplied object is S, but the value of i is 2, because of the initialization in B.


Consider the following code snippet.
if (aNumber >= 0)
if (aNumber == 0)
System.out.println("first string");
else System.out.println("second string");
System.out.println("third string");

Q6 What output do you think the code will produce if aNumber is 3?
second string
third string
Q 7 Use braces, { and }, to further clarify the code.
if (aNumber >= 0) {
if (aNumber == 0) {
System.out.println("first string");
} else {
System.out.println("second string");
}
}
System.out.println("third string");
Q8 : How do you write an infinite loop using the while statement
while (true)
{
}

Analytical Questions
Q1 Find the number of triangles in the given figure.

[A]. 12 [B]. 18

[C]. 22 [D]. 26


Answer: Option B

Q2 problem consists of three statements. Based on the first two statements, the third
statement may be true, false, or uncertain

Class A has a higher enrollment than Class B.
Class C has a lower enrollment than Class B.
Class A has a lower enrollment than Class C.
If the first two statements are true, the third statement is
A. true
B. false
C. uncertain


Answer: Option B
Q3Two bus tickets from city A to B and three tickets from city A to C cost Rs. 77 but
three tickets from city A to B and two tickets from city A to C cost Rs. 73. What are the
fares for cities B and C from A ?
A. Rs. 4, Rs. 23
B. Rs. 13, Rs. 17
C. Rs. 15, Rs. 14
D. Rs. 17, Rs. 13

Answer: Option B

Q4 In a family, the father took 1/4 of the cake and he had 3 times as much as each of the
other members had. The total number of family members is
A. 3 B. 7
C. 10 D. 12

Answer: Option C

Q5 In a cricket match, five batsmen A, B, C, D and E scored an average of 36 runs. D
Scored 5 more than E; E scored 8 fewer than A; B scored as many as D and E combined;
and B and C scored 107 between them. How many runs did E score ?
A. 62 B. 45
C. 28 D. 20

Answer: Option D


Database Questions


Table Name : Employee

EMPLOYEE_ID FIRST_NAME LAST_NAME SALARY JOINING_DATE DEPARTMENT
1 John Abraham 1000000 01-JAN-13
12.00.00 AM
Banking
2 Michael Clarke 800000 01-JAN-13
12.00.00 AM
Insurance
3 Roy Thomas 700000 01-FEB-13
12.00.00 AM
Banking
4 Tom Jose 600000 01-FEB-13
12.00.00 AM
Insurance
5 Jerry Pinto 650000 01-FEB-13
12.00.00 AM
Insurance
6 Philip Mathew 750000 01-JAN-13
12.00.00 AM
Services
7 TestName1 123 650000 01-JAN-13
12.00.00 AM
Services
8 TestName2 Lname% 600000 01-FEB-13
12.00.00 AM
Insurance

Table Name : Incentives

EMPLOYEE_REF_ID INCENTIVE_DATE INCENTIVE_AMOUNT
1 01-FEB-13 5000
2 01-FEB-13 3000
3 01-FEB-13 4000
1 01-JAN-13 4500
2 01-JAN-13 3500
1. Get employee details from employee table whose first name contains 'o'

2. Get employee details from employee table whose first name ends with 'n'

3. Get employee details from employee table who joined before January 1st 2013

4. Get difference between JOINING_DATE and INCENTIVE_DATE from employee and
incentives table

5. Select first_name, incentive amount from employee and incentives table for all employes
even if they didn't get incentives

6. Select TOP 2 salary from employee table


Dear All,

Following are the questions from my end.


1. What is the difference between reference types and value types.
give example?

2. what is usage of finally block in try-catch statement in c#?

3. what are the types of state management in ASP dot net?

4. What is the difference between Abstract class and interface?

5.
what will be the out put of following code snippet at point 1 ,2 ,3?

class A
{
public void Change(int []arr)
{
arr[0] = 10;
arr = new int[3] {4,5,6 };
Console.WriteLine(arr[0]); //2. Out Put?
}
}

class Program
{
static void Main(string[] args)
{
A a = new A();
int []arr=new int[3]{1,2,3};

Console.WriteLine(arr[0]); //1. Out Put?

a.Change(arr);

Console.WriteLine(arr[0]); //3. Out Put?
Console.ReadLine();
}
}

ANS:
1
4
10

Database Questions:

1. what is difference between inner join,left join,self join?
2. Write down three advantages of stored procedures over inline
queries?
3. What is a transitive dependency in Normalization?
4. what is the benefit of de-normalization ?
5. what is difference between natural join and inner join


Analytical Questions:

1. A Frog is living at the bottom of 30-ft(Height=30-ft) well. Frog
jumps up for 3 ft once in a day but unfortunately he covers only 1 ft
distance in upward direction and falls down for 2 ft.
how may days the frog will take to come out of that well?

2.Two Cars (A,B),A with speed=100 km/H and B with speed=200 km/H. Car
A moving fron Islamabad to Lahore and Car B is moving from Lahore to
Islamabad.
when these cars will meet which will be near to Islamabad?

3.you have 12 balls , 11 balls have equal weight but 1 is lighter than
other 11.
you have a pan balance(scale) to balance them,in how many minimum
tries you can find the lighter one?

4.There is a new game in which 3 person play each other and only one
wins.
If 81 person participated in the tournament give a quick reply that
how many matches will be played to decide the winner?


Answers
1. 27-Days

2. Both will be at same distance

3. 3 tries

4. 40 Matches

String x = new String("xyz");
String y = "abc";
x = x + y;
How many String objects have been created?
A.2
B.3
C.4
D.5
Answer: Option C
Explanation:
Line 1 creates two, one referred to by x and the lost String "xyz". Line 2 creates one (for a total
of three). Line 3 creates one more (for a total of four), the concatenated String referred to by x
with a value of "xyzabc".

2. What will be the output of the program?
int i = 1, j = 10;
do
{
if(i++ > --j) /* Line 4 */
{
continue;
}
} while (i < 5);
System.out.println("i = " + i + "and j = " + j); /* Line 9 */

A.i = 6 and j = 5
B.i = 5 and j = 5
C.i = 6 and j = 6
D.i = 5 and j = 6

Answer & Explanation
Answer: Option D
Explanation:
This question is not testing your knowledge of the continue statement. It is testing your
knowledge of the order of evaluation of operands. Basically the prefix and postfix unary
operators have a higher order of evaluation than the relational operators. So on line 4 the variable
i is incremented and the variable j is decremented before the greater than comparison is made. As
the loop executes the comparison on line 4 will be:
if(i > j)
if(2 > 9)
if(3 > 8)
if(4 > 7)
if(5 > 6) at this point i is not less than 5, therefore the loop terminates and line 9 outputs the
values of i and j as 5 and 6 respectively.
The continue statement never gets to execute because i never reaches a value that is greater than
j.

3. What will be the output of the program ?
#include<stdio.h>

int main()
{
int a[5] = {5, 1, 15, 20, 25};
int i, j, m;
i = ++a[1];
j = a[1]++;
m = a[i++];
printf("%d, %d, %d", i, j, m);
return 0;
}
A. 2, 1, 15
B. 1, 2, 5
C. 3, 2, 15
D. 2, 3, 20

Answer: Option C
Explanation:
Step 1: int a[5] = {5, 1, 15, 20, 25}; The variable arr is declared as an integer array with a size of
5 and it is initialized to
a[0] = 5, a[1] = 1, a[2] = 15, a[3] = 20, a[4] = 25 .
Step 2: int i, j, m; The variable i,j,m are declared as an integer type.
Step 3: i = ++a[1]; becomes i = ++1; Hence i = 2 and a[1] = 2
Step 4: j = a[1]++; becomes j = 2++; Hence j = 2 and a[1] = 3.
Step 5: m = a[i++]; becomes m = a[2]; Hence m = 15 and i is incremented by 1(i++ means 2++
so i=3)
Step 6: printf("%d, %d, %d", i, j, m); It prints the value of the variables i, j, m
Hence the output of the program is 3, 2, 15


4. What will be the output of the program if the array begins at address 65486?
#include<stdio.h>

int main()
{
int arr[] = {12, 14, 15, 23, 45};
printf("%u, %u\n", arr, &arr);
return 0;
}
A. 65486, 65488
B. 65486, 65486
C. 65486, 65490
D. 65486, 65487

Answer: Option B
Explanation:
Step 1: int arr[] = {12, 14, 15, 23, 45}; The variable arr is declared as an integer array and
initialized.
Step 2: printf("%u, %u\n", arr, &arr); Here,
The base address of the array is 65486.
=> arr, &arr is pointing to the base address of the array arr.
Hence the output of the program is 65486, 65486


5.What will be the output of the program?
#include<stdio.h>
int main()
{
int i = 5;
while(i-- >= 0)
printf("%d,", i);
i = 5;
printf("\n");
while(i-- >= 0)
printf("%i,", i);
while(i-- >= 0)
printf("%d,", i);
return 0;
}
A. 4, 3, 2, 1, 0, -1
4, 3, 2, 1, 0, -1

B. 5, 4, 3, 2, 1, 0
5, 4, 3, 2, 1, 0

C. Error

D. 5, 4, 3, 2, 1, 0
5, 4, 3, 2, 1, 0
5, 4, 3, 2, 1, 0

Answer: Option A
Explanation:
Step 1: Initially the value of variable i is '5'.
Loop 1: while(i-- >= 0) here i = 5, this statement becomes while(5-- >= 0) Hence the while
condition is satisfied and it prints '4'. (variable 'i' is decremented by '1'(one) in previous while
condition)
Loop 2: while(i-- >= 0) here i = 4, this statement becomes while(4-- >= 0) Hence the while
condition is satisfied and it prints '3'. (variable 'i' is decremented by '1'(one) in previous while
condition)
Loop 3: while(i-- >= 0) here i = 3, this statement becomes while(3-- >= 0) Hence the while
condition is satisfied and it prints '2'. (variable 'i' is decremented by '1'(one) in previous while
condition)
Loop 4: while(i-- >= 0) here i = 2, this statement becomes while(2-- >= 0) Hence the while
condition is satisfied and it prints '1'. (variable 'i' is decremented by '1'(one) in previous while
condition)
Loop 5: while(i-- >= 0) here i = 1, this statement becomes while(1-- >= 0) Hence the while
condition is satisfied and it prints '0'. (variable 'i' is decremented by '1'(one) in previous while
condition)
Loop 6: while(i-- >= 0) here i = 0, this statement becomes while(0-- >= 0) Hence the while
condition is satisfied and it prints '-1'. (variable 'i' is decremented by '1'(one) in previous while
condition)
Loop 7: while(i-- >= 0) here i = -1, this statement becomes while(-1-- >= 0) Hence the while
condition is not satisfied and loop exits.
The output of first while loop is 4,3,2,1,0,-1
Step 2: Then the value of variable i is initialized to '5' Then it prints a new line character(\n).
See the above Loop 1 to Loop 7 .
The output of second while loop is 4,3,2,1,0,-1
Step 3: The third while loop, while(i-- >= 0) here i = -1(because the variable 'i' is decremented to
'-1' by previous while loop and it never initialized.). This statement becomes while(-1-- >= 0)
Hence the while condition is not satisfied and loop exits.
Hence the output of the program is
4,3,2,1,0,-1
4,3,2,1,0,-1

Question 1: find all Employee records containing the word "Joe", regardless of whether it was
stored as JOE, Joe, or joe.
Answer : SELECT * from Employees WHERE upper(EmpName) like upper('joe%');
---------------------------------------------------------------------------------------------------------------------
-----
Question 2: SQL Query to find second highest salary of Employee
Answer : There are many ways to find second highest salary of Employee in SQL, you can either
use SQL Join or Subquery to
solve this problem. Here is SQL query using Subquery :
select MAX(Salary) from Employee WHERE Salary NOT IN (select MAX(Salary)
from Employee );
---------------------------------------------------------------------------------------------------------------------
-----
Question 3:
Create table employees:
emp_id | emp_name | emp_manager_id
1 | John | Null
2 | Tom | 1
3 | Smith | 1
4 | Albert | 2
5 | David | 2
6 | Murphy | 5
7 | Petra | 5

Now to get the names of managers from the above single table you can use sub queries or simply
the self join.
Self Join SQL Query to get the names of manager and employees:
Answer:
select e1.emp_name 'manager',e2.emp_name 'employee'
from employees e1 join employees e2
on e1.emp_id=e2.emp_manager_id

Question 4:
Difference b/w Primary and Unique Key. Can there be Null value in Unique Key. If yes then
how many Null values can be stored in Unique Key column.
Question 5:
Why Stored Procedures are better in performance? What is Pre Compilation process?

S-ar putea să vă placă și