Google+

Wednesday, December 29, 2010

Nth Highest Salary Query in Oracle 9i/10g/11g/11i

Problem: Show the list of all employees from the employee table having second highest Salary or Nth highest salary in the organization.

Solution: Well we can achieve the result by so many ways but in this post I would like to do it by using co-related queries.
Query to get the list of employees getting 2nd highest salary (Set the value of @SalaryPosition to get Nth highest salary):




SELECT * FROM Employee E1  WHERE @SalaryPosition = ( SELECT COUNT(DISTINCT E2.Salary) FROM Employee E2 WHERE E2.Salary >= E1.Salary )



Co-Related Query:  In short, it’s a type of nested sub query where the inner query is referenced to some value of the outer query. And the inner query is executed for each record in the outer query making it slowL.
     In our query, to get the 2nd highest salary, works in the same way too. Let’s dive a little deeper.

Sample data used in employee table:


slNo           empname               salary


101            Ram                      5000
102            Abhishek              7500
101            kumar                   5000
104            prasad                  6570
102            Jumla                    7500
101           Harkesh                12000
101           John                      4000

So we have taken two aliases for the employee table i.e. E1 and E2.(Here N=2)









Corollary: Let’s take the first record in the table E1 where the salary is 5000 and assume it as the second highest salary. But how will you know if it is actually the second highest salary or not. If 5000 is the second highest salary, then the distinct count of all the salaries from table E2 which are greater than or equal to 5000 must be 2.





The first record from E1 (salary = 5000) will be compared to all the records in E2 (salary).


Table E1                                         Table E2                                                  Distinct count where
(considering the first record only)   (distinct salary)                                           salary is >= 5000

5000                                               4000                                                                   4
                                                       5000
                                                       6570
                                                       7500
                                                      12000

Hence 5000 is not the highest salary as we have 4 more salaries greater than equal to 5000. But it is concluded that 5000 is at the fourth position.

     Now let’s take the second salary from table E1 and do the same comparison as in the earlier case.



The second salary is 7500 and as per rule the count of distinct salaries greater than equal to 7500 must be 2.

   Table E1                                         Table E2                                                Distinct count where
(considering the second record only)  (distinct salary)                                       salary is >= 5000


7500                                                  4000                                                                 2
                                                          5000
                                                         6570
                                                         7500
                                                         12000


Here in this case our condition in the where clause of outer query is satisfying.

Note:-Please comment and reply me.

Anwer Of Question : Difference between PDA and Tuning Machine

  1. PDA has a capability to move in a on direction (right) while tuning machine has a capability to move either left or right direction.
  2. PDA contain a stack which stating symbol is represented by # where TU contain a unlimited buffer.



Note:-Please comment and reply me.

Friday, December 24, 2010

Answer of Question : How to call a default constructor inside a default constructor

in below example , we make an object of A using the Constructor of B Class.
First default constructor of class A called then CLR call default constructor of class B ,then make the object of class A .

public class A


{ public A()

{  Console.WriteLine("A"); }

}

public class B:A

{ public B()

{ Console.WriteLine("B"); }

}

class Program

{ static void Main(string[] args)

{

 A ob = new B();

}

}

output
A
B


Note:-Please comment and reply me.

Answer of Question : deadlock, starvation and synchronization problems in multithreaded scenario

Thread is a sub part of a process . Multiple Thread Model involve the existence of multiple threads. Three are main problem in multiple thread model.

  1. Deadlock :- Suppose there are two thread T1 & T2 of a process P and R1 & R2 are two resouces . T1 has R1 and T2 has R2 at intance of time . suppose T1 need a resource R2 that are acquired by the T2 and T2 need a resource R1 that are acquired by the T1 then these type of situation goes in unlimited waiting i.e. these situation called Deadlock Problem.
  2. Stravation :- Suppose thread are processed on the base of Priority (More Priority Processed First),T1 & T2 are two thread .T1 has more priority than T2 than T1 first processed and suppose in mean time another thread T3 come with high priority than T2 , T3 processed before than T2. and so on then t2 has wait for limited of a time while thread has a capability to perform work.This type of situation is called stravation.
  3. Synchronization :-The biggest problem of allowing multiple threads sharing the same data set is that one operation in one thread could collide with another operation in another threads on the same data. When this happens, the result is un-desirable.
          Let's use a bank application program as an example. Assuming that the program has multiple threads   running, with each thread connecting one ATM system, and you have a saving account in the bank with $100.00, now you and your friend are going to two different ATMs at about the same time, and trying to withdraw $50.00 from your account, what do you think it will happen?
If the threads are running independently, the following could happen:

Time     01:01      02:01     03:01     04:01
         +----------+---------+---------+-------
Thread 1            Get       Set
Action   You        Account   Account   You
         Withdraw   Balance   Balance   Receive
         $50.00     $100.00   $50.00    $50.00
Time      01:02      02:02     03:02     04:02
         -+----------+---------+---------+------
Thread 2             Get       Set
Action    Friend     Account   Account   Friend
          Withdraw   Balance   Balance   Receive
          $50.00     $100.00   $50.00    $50.00
Time     01:01      02:01     03:01     04:01
         -----------++--------++--------++------ 
Account  $100.00    $100.00   $50.00    $50.00
Both you and your friend will receive $50.00 each, and your account will still have $50.00. The bank could lose $50.00. The solution to this problem is synchronization.


 Note:-Please comment and reply me.

Algorithmic Trading Technology

Yesterday, I contact to Mr.RK Dhanvada (Business & Recruitment Consultant, D & HR Consultants ,Hyderabad ) and talked him about 10 min and told him that I am B.Tech(C.S) final year Student of Shobhit University, Meerut .I passed OCA and MCTS exam . I looked for an Job. He send me his email id and asked for sending the email with resume and certification.


I send an email to him.In response, I got 10 question of Algorithmic  Trading Technology ,which i want to share you.





1. Explain mechanism and pointers related to virtual functions in C++.

2. How to call a default constructor inside a default constructor?

3. What is Object-Factory design pattern?

4. What is the runtime complexity of STL Set and Map?

5. Implement a red-black tree in C++.

6. Simulate Travelling-Salesman problem in C++.

7. What happens when we cast a huge pointer into a far pointer in C?

8. Explain deadlock, starvation and synchronization problems in multithreaded scenario.

9. Explain complete booting process in a Microsoft® Windows based PC.

10. Differences in PDA and Turing machine.


the answer of these question , are posted now.



Note:-Please comment and reply me.

Monday, November 22, 2010

Installing IIS on Window Vista ,WindowXp , Window Server 2008/2003 Part1

Windows XP and Windows Server 2003



You install IIS through the Add or Remove Programs section, which you can access through the control panel or by choosing Start ➪ Run and then entering appwiz.cpl. When you’re in the Add or Remove Programs dialog box, you need to click the Add/Remove Windows Components button at the left side of the dialog box to bring up the Windows Component Wizard, shown in Figure 18-7.


Figure 18-7




On Windows XP you should see the Internet Information Services (IIS) item directly in the list with components.


For Windows Server 2003, click Application Server first and then click the Details button.


On Windows Server 2003, check the ASP.NET item. For both Windows XP and Windows Server 2003, verify


that Internet Information Services (IIS) is selected and then click the Details button. Check at least the


following items:


❑ Common Files


❑ Internet Information Services Snap-In (called Internet Information Services Manager on


Windows Server 2003)


❑ World Wide Web Service








Note:-Please comment and reply me.

Friday, October 8, 2010

A NOCYCLE sequence

 A NOCYCLE sequence

SQL> -- A NOCYCLE sequence
SQL>
SQL>
SQL> CREATE SEQUENCE StudentNumSeq
  2 INCREMENT BY 50000
  3 START WITH 50000
  4 MAXVALUE 99999
  5 NOCACHE
  6 NOCYCLE;

Sequence created.

A CYCLE sequence

 A CYCLE sequence

SQL> -- A CYCLE sequence
SQL>
SQL>
SQL> CREATE SEQUENCE StudentNumSeq
  2 INCREMENT BY 50000
  3 START WITH 50000
  4 MAXVALUE 99999
  5 NOCACHE
  6 CYCLE;

Sequence created.

SQL>
SQL>
SQL> select studentNumSeq.nextVal from dual;

  NEXTVAL
----------
  50000

SQL> select studentNumSeq.nextVal from dual;

  NEXTVAL
----------
  1

SQL> select studentNumSeq.nextVal from dual;

  NEXTVAL
----------
  50001

SQL>
SQL>
SQL> drop sequence studentNumSeq;



Note:-Please comment and reply me.

Wednesday, September 8, 2010

Merge Statement Example in Orcale



merge [ hints ] into table-name-1 | view-name-1 [ alias-1 ]
using table-name-2 | view-name-2 | subquery [ alias-2 ]
on ( condition )
[ merge-update-clause ] [ merge-insert-clause ] [ error-logging-clause ];

 

 create table table_dest (
  id number primary key,
  txt varchar2(20)
);

insert into table_dest values (1,'one');
insert into table_dest values (3,'three');
insert into table_dest values (5,'five');

commit;

create table table_source (
  id number primary key,
  txt varchar2(20)
);

Monday, September 6, 2010

Modifying a Sequence

Modifying a Sequence

• You must be the owner or have the ALTER privilege for the sequence.

• Only future sequence numbers are affected.

• The sequence must be dropped and re-created to restart the sequence at a different number.

• Some validation is performed.

 
 
Note:-Please comment and reply me.

Saturday, August 14, 2010

NOCYCLE sequence

SQL> -- A NOCYCLE sequence
SQL>
SQL>
SQL> CREATE SEQUENCE StudentNumSeq
  2 INCREMENT BY 50000
  3 START WITH 50000
  4 MAXVALUE 99999
  5 NOCACHE
  6 NOCYCLE;

Sequence created.

SQL>
SQL>
SQL> select studentNumSeq.nextVal from dual;

  NEXTVAL
----------
  50000

SQL> select studentNumSeq.nextVal from dual;
select studentNumSeq.nextVal from dual
  *
ERROR at line 1:
ORA-08004: sequence STUDENTNUMSEQ.NEXTVAL exceeds MAXVALUE and cannot be instantiated


SQL> select studentNumSeq.nextVal from dual;
select studentNumSeq.nextVal from dual
*
ERROR at line 1:
ORA-08004: sequence STUDENTNUMSEQ.NEXTVAL exceeds MAXVALUE and cannot be instantiated


SQL>
SQL>
SQL> drop sequence studentNumSeq;

Sequence dropped.


Note:-Please comment and reply me.

Creating a trigger based on two tables

SQL>
SQL>
SQL> CREATE TABLE myTable1 (a INTEGER, b CHAR(10));

Table created.

SQL>
SQL> CREATE TABLE myTable2 (c CHAR(10), d INTEGER);

Table created.

SQL>
SQL>
SQL> CREATE TRIGGER trig1
  2 AFTER INSERT ON myTable1
  3 REFERENCING NEW AS newRow
  4 FOR EACH ROW
  5 WHEN (newRow.a <= 10)
  6 BEGIN
  7 INSERT INTO myTable2 VALUES(:newRow.b, :newRow.a);
  8 END trig1;
  9

Trigger created.

SQL>
SQL> insert into myTable1 values(1,'a');

1 row created.

SQL> insert into myTable1 values(2,'b');

1 row created.

SQL>
SQL> select * from myTable1;

  A B
---------- ----------
  1 a
  2 b

SQL> select * from myTable2;

C D
---------- ----------
a 1
b 2

SQL>
SQL> drop table myTable1;

Table dropped.

SQL> drop table myTable2;

Table dropped.

Note:-Please comment and reply me.

Sunday, August 8, 2010

Sequence cache option

Sequence cache option 


SQL> -- the cache option specifies how many sequence values will be stored in memory for
faster access
SQL>
SQL>
SQL> CREATE SEQUENCE mySequence
  2 MINVALUE 1
  3 MAXVALUE 999999999999999999999999999
  4 START WITH 1
  5 INCREMENT BY 1
  6 CACHE 20;

Sequence created.

SQL>
SQL> select mySequence.nextval from dual;

  NEXTVAL
----------
  1

SQL> select mySequence.nextval from dual;

  NEXTVAL
----------
  2

SQL> select mySequence.nextval from dual;

  NEXTVAL
----------
  3


Note:-Please comment and reply me.

Alter sequence increment

 Alter sequence increment

SQL> CREATE SEQUENCE mySequence
  2 MINVALUE 1
  3 MAXVALUE 999999999999999999999999999
  4 START WITH 1
  5 INCREMENT BY 1
  6 CACHE 20;

Sequence created.

SQL>
SQL> select mySequence.nextval from dual;

  NEXTVAL
----------
  1

SQL> select mySequence.nextval from dual;

  NEXTVAL
----------
  2

SQL> select mySequence.nextval from dual;

  NEXTVAL
----------
  3

SQL> select mySequence.nextval from dual;

  NEXTVAL
----------
  4

SQL>
SQL> alter sequence mySequence
  2 increment by 124;

Sequence altered.

SQL>
SQL> select mySequence.nextval from dual;

  NEXTVAL
----------
  128

SQL>
SQL> alter sequence mySequence
  2 increment by 1;

Sequence altered.

SQL>
SQL> select mySequence.nextval from dual;

  NEXTVAL
----------
  129

SQL>
SQL>
SQL> drop sequence mySequence;

Sequence dropped.

SQL>
SQL>


Note:-Please comment and reply me.

Friday, August 6, 2010

Sequence Example 3

 Create sequence emps_seq start with 501 increment by 10

SQL>
SQL> create sequence emps_seq
  2 start with 501
  3 increment by 10;

Sequence created.

SQL>
SQL> drop sequence emps_seq;

Sequence dropped.

SQL>
SQL>


Note:-Please comment and reply me.

Sequence Example 1


SQL> CREATE SEQUENCE supplier_seq
  2 MINVALUE 1
  3 MAXVALUE 999999999999999999999999999
  4 START WITH 1
  5 INCREMENT BY 1
  6 CACHE 20;

Sequence created.

SQL>
SQL> select supplier_seq.nextval from dual;

  NEXTVAL
----------
  1

SQL> select supplier_seq.nextval from dual;

  NEXTVAL
----------
  2

SQL> select supplier_seq.nextval from dual;

  NEXTVAL
----------
  3

SQL> select supplier_seq.nextval from dual;

  NEXTVAL
----------
  4

SQL>
SQL> drop sequence supplier_seq;

Sequence dropped.



Note:- Please comment and reply me.

Sequence Example 2


SQL> create sequence deptno_seq
  2 start with 50 increment by 10;

Sequence created.

SQL>
SQL> select deptno_seq.nextval, deptno_seq.currval
  2 from dual;

  NEXTVAL CURRVAL
---------- ----------
  50 50

SQL>
SQL> select deptno_seq.currval
  2 from dual;

  CURRVAL
----------
  50

SQL>
SQL> select deptno_seq.currval, deptno_seq.nextval
  2 from dual;

  CURRVAL NEXTVAL
---------- ----------
  60 60

SQL>
SQL>
SQL> drop sequence deptno_seq;

Sequence dropped.



Note:-Please comment and reply me.

If id is null, use the value from sequence

If id is null, use the value from sequence
 
SQL> create table myTable(
  2 id number primary key,
  3 blob_content blob
  4 )
  5 /

Table created.

SQL>
SQL> create sequence myTable_seq
  2 /

Sequence created.

SQL>
SQL> create or replace trigger biu_myTable
  2 before insert or update on myTable
  3 for each row
  4 begin
  5 if :new.id is null then
  6 select myTable_seq.nextval into :new.id from dual;
  7 end if;
  8 end;
  9 /

Trigger created.

SQL> drop table myTable;

Table dropped.

SQL> drop sequence myTable_seq;

Sequence dropped.




Note:-Please comment and reply me.

Wednesday, August 4, 2010

Hardware CPU Guide Part I: Factors That Affects a CPU’s Performance

 Being the brain of the computer, the CPU plays a very important role in determining the performance of the system. Unfortunately, when it comes to choosing the best CPU, you will probably feel like a lost sheep. With different brands, models, speeds and specifications to choose from, it can really be a difficult task to decide which CPU is the right one for you.
In this three part guide, we will give you a good overview of “the factors that affect a CPU’s performance”, the differences between an Intel and AMD CPU and how you should go about choosing the the CPU that is best suited to your needs.
This is the first part of the CPU guide.

What is a CPU?

The CPU (Central Processing Unit), or sometimes known as processor, is one of the most important component in a computer system. Being the brain of the computer system, its task is to take care of all the data calculation and make sure they are processed in the fastest time possible.
CPU is not something you can see from the outside of the computer. In fact, you won’t be able to see the CPU on a fully-assembled PC. To see it, you have to remove the computer casing, unplug the wire and remove the heatsink (and fan), only then can you see the surface of the CPU. The shape of the CPU is a small square chip with lot of connector pin underneath.
The images below show the back and the top of a CPU.


How CPU works

To keep it simple, the way a CPU works can be illustrated with the following 3 steps:
  1. When you click to execute an application, the raw instruction is first fetched from the hard disk (sometimes from the memory) and sent to the CPU for processing.
  2. When the CPU receives the instruction, it will execute the logic and compute the result.
  3. Once the CPU finishes processing, it will send the result to the respective device to output to the user.
While it may seems easy, all these 3 steps must be completed in split seconds. Delay in any of these steps will result in a lag in the computer.

Factors that affect a CPU performance

It is easy to think that the speed of the CPU is directly link to the performance of the CPU. This is only true to a certain extent. A CPU with fast speed will not be efficient if it has only a limited data to process. To achieve maximum efficiency, the hardware (especially the hard drive and memory) that are linked to the CPU must supply data as fast as the CPU speed. Failure to do this will result in a lagging computer, regardless how fast the CPU is.

1. CPU Clock Speed

The operating frequency of the CPU (also known as the clock speed) determines how fast it can process instruction.

The speed is measured in terms of Hertz, and it is usually lies in the megaHertz (MHz) or gigaHertz (GHz) range. A megaHertz means that the CPU can process one million instruction per second whereas a gigahertz CPU has the capability to process one billion instructions per second. In today technology, all CPUs run in the gigahertz range and you seldom see CPU with speed in the MHz range anymore.
Theoretically, a 500 MHz CPU is six times slower than a 3 GHz CPU and a 3.6 GHz CPU is faster than a 3 GHz or a 3.4 GHz CPU. In general, the higher the frequency of a CPU, the faster the speed of the computer.

2. Cache

Remember we mentioned above that for the CPU to work at its maximum efficiency, the data transfer from the other hardware must be as fast as its speed. The purpose of a cache is to ensure this smooth and fast transition of data transfer from the hardware to the CPU.
To understand the importance of a cache, it is necessary to understand how the whole process works. The main bulk of information comes from the hard drive. When an application is requested, the motherboard will fetch the required information from the hard drive and deliver it to the CPU for processing.
Since the hard drive processing speed is much slower than the CPU, data transfer often takes a long time. To speed thing up, the RAM is used to store temporary information from the hard drive. Instead of heading straight to the hard drive, the motherboard now checks and retrieves the data from the RAM. Only when the required information is not found in the RAM then will the motherboard go to the hard drive.
As CPU speed increased to the point where the RAM is no longer able to catch up, the transferring of information again become a serious problem. To solve this issue, a cache, which was effectively a small and extremely fast memory, was added to the processor to store immediate instruction from the RAM. Since the cache runs at the same speed of the CPU, it can rapidly provide information to the CPU at the shortest time without any lag.
cpu-cache-system
There are different levels of cache. Level 1 (L1) cache is the most basic form of cache and is found on every processor. Level 2 (L2) cache has a bigger memory size and is used to store more immediate instructions. In general, the L1 cache caches the L2 cache which in turn caches the RAM which in turn caches the hard disk data. With the newer multi-core technology, there is even a L3 cache that is bigger in size and is shared among the various cores.
L2/L3 cache plays the greatest part in improving the performance of the processors. The larger the cache size, the faster the data transfer and the better the CPU performance. However, cache is very costly. That is why you don’t find 1GB of cache in your system. The typical cache size is between 512KB to 8MB. The latest Intel Core i7 Extreme Processor comes with a 12MB L3 cache, which also explains its hefty price tag of approx. $1,000.

3. Multi-Core

In the past, if you want to get a faster computer, you have to get a faster CPU. Today, this is only partially true. The reason being, CPU speed can’t increase forever. There is limitation as to how fast the transistors can run. When it reaches a plateau, you won’t be able to increase the speed anymore.
The speed is measured in terms of Hertz, and it is usually lies in the megaHertz (MHz) or gigaHertz (GHz) range. A megaHertz means that the CPU can process one million instruction per second whereas a gigahertz CPU has the capability to process one billion instructions per second. In today technology, all CPUs run in the gigahertz range and you seldom see CPU with speed in the MHz range anymore.
Theoretically, a 500 MHz CPU is six times slower than a 3 GHz CPU and a 3.6 GHz CPU is faster than a 3 GHz or a 3.4 GHz CPU. In general, the higher the frequency of a CPU, the faster the speed of the computer.



Note:- Please comment  and reply me.

Sunday, July 25, 2010

A Complete Guide to Google Special Search – How to Use Google A Lot More Creatively (Part I)



Google is no doubt the most popular search engine till date. Millions of people across the globe use it everyday to search for content, pictures, blogs and everything else. The reason of the huge popularity of Google is because the results are so relevant and match closely with what the user is searching for.

Apart from regular search queries, do you know that you can use the Google search engine in a variety of creative ways? You can use Google to know the sunrise and sunset timings, convert currency amounts, perform local searches, find movie show times and so on. These type of Google search, better known as Google special search requires the user to type a specific query and add an attribute to the query.

A very good example of a special Google search is knowing the time of a particular city. I live in India and want to know what time is it in London, UK. To perform this Google special search, I will have to type the exact query as “What time is it” and supply the parameter as “London”





What’s interesting to note is that these Google searches depend upon your geographic location (in some occasions) and the results are displayed accordingly.

In this article, we look into some special Google searches which can be used in a more creative way to know important things you have always wanted:
Know the Weather of a Any City Using Google

To know the weather conditions of any city, go to Google.com and enter the name of the city in the search box. Then type the state and the country of the city, as shown in the following example:



Not only will Google display the current average temperature of your city, but you can also see the weather pattern for the last week. Additional details like humidity and wind speed are also shown in the same page and you can add the result to your iGoogle home page using the link “Add to iGoogle”.

Know the Time of Any City Using Google

Similarly you can also know the present time of any part of the world using a simple Google search. Just type time in the Google search box followed by the name of the city or country as shown in the following example:




Wednesday, July 14, 2010

Bit Wise in any programming language

Bit wise operator in C,.NET,JAVA,C++

C Bitwise Operators
The bitwise operators perform bitwise-AND (&), bitwise-exclusive-OR (^), and bitwise-inclusive-OR (|) operations.

Syntax:-

AND-expression:
equality-expression

AND-expression & equality-expression

exclusive-OR-expression:
AND-expression

exclusive-OR-expression ^ AND-expression

inclusive-OR-expression:
exclusive-OR-expression

inclusive-OR-expression | exclusive-OR-expression

The operands of bitwise operators must have integral types, but their types can be different. These operators perform the usual arithmetic conversions; the type of the result is the type of the operands after conversion.



Operator Description

  • &

The bitwise-AND operator compares each bit of its first operand to the corresponding bit of its second operand. If both bits are 1, the corresponding result bit is set to 1. Otherwise, the corresponding result bit is set to 0.
  • ^

The bitwise-exclusive-OR operator compares each bit of its first operand to the corresponding bit of its second operand. If one bit is 0 and the other bit is 1, the corresponding result bit is set to 1. Otherwise, the corresponding result bit is set to 0.

  • |

The bitwise-inclusive-OR operator compares each bit of its first operand to the corresponding bit of its second operand. If either bit is 1, the corresponding result bit is set to 1. Otherwise, the corresponding result bit is set to 0.

Examples
These declarations are used for the following three examples:


short i = 0xAB00;
short j = 0xABCD;
short n;

n = i & j;
The result assigned to n in this first example is the same as i (0xAB00 hexadecimal).


n = i | j;

n = i ^ j;
The bitwise-inclusive OR in the second example results in the value 0xABCD (hexadecimal), while the bitwise-exclusive OR in the third example produces 0xCD (hexadecimal).

Microsoft Specific

The results of bitwise operation on signed integers is implementation-defined according to the ANSI C standard. For the Microsoft C compiler, bitwise operations on signed integers work the same as bitwise operations on unsigned integers. For example, -16 & 99 can be expressed in binary as

11111111 11110000
& 00000000 01100011
_________________
00000000 01100000

The result of the bitwise AND is 96 decimal.

Sunday, July 4, 2010

SQL Statements

SQL Statements

Oracle SQL complies with industry-accepted standards. Oracle Corporation ensures future
compliance with evolving standards by actively involving key personnel in SQL standards
committees. Industry-accepted committees are the American National Standards Institute (ANSI)and the International Standards Organization (ISO). Both ANSI and ISO have accepted SQL as the standard language for relational databases.

Statement Description
  • SELECT Retrieves data from the database
  • INSERT,UPDATE,DELETE,MERGE
Enters new rows, changes existing rows, and removes unwanted rows
from tables in the database, respectively. Collectively known as data
manipulation language (DML).
  • CREATE,ALTER,DROP,RENAME,TRUNCATE
Sets up, changes, and removes data structures from tables. Collectively
known as data definition language (DDL).
  • COMMIT,ROLLBACK,SAVEPOINT
Manages the changes made by DML statements. Changes to the data can
be grouped together into logical transactions.
  • GRANT,REVOKE
Gives or removes access rights to both the Oracle database and the
structures within it. Collectively known as data control language
(DCL).

Saturday, July 3, 2010

Pascal Triangle in C


Pascal triangle is a like a simple diagram that contain some rules and logic. It's figure are shown above. 

  • first element of all row is 1.
  • last element of all row is same as starting element.
  • second last element of all row is same as second element and so on.
  • a[2,1]=a[1,0]+a[1,1]; for second row second element.
  • a[3,1]=a[2,0]+a[2,1]; for third row second element,a[3,2]=a[2,1]+a[2,2]; for third row third element and so on.

If you want it's program in any language then reply me.