C,C++/JAVA/BASH/ASM ARENA

वह प्रदीप जो दीख रहा है झिलमिल दूर नही है थक कर बैठ गये क्या भाई मन्जिल दूर नही है चिन्गारी बन गयी लहू की बून्द गिरी जो पग से चमक रहे पीछे मुड देखो चरण-चिनह जगमग से बाकी होश तभी तक, जब तक जलता तूर नही है थक कर बैठ गये क्या भाई मन्जिल दूर नही है अपनी हड्डी की मशाल से हृदय चीरते तम का, सारी रात चले तुम दुख झेलते कुलिश का। एक खेय है शेष, किसी विध पार उसे कर जाओ; वह देखो, उस पार चमकता है मन्दिर प्रियतम का। आकर इतना पास फिरे, वह सच्चा शूर नहीं है; थककर बैठ गये क्या भाई! मंज़िल दूर नहीं है। दिशा दीप्त हो उठी प्राप्त कर पुण्य-प्रकाश तुम्हारा, लिखा जा चुका अनल-अक्षरों में इतिहास तुम्हारा। जिस मिट्टी ने लहू पिया, वह फूल खिलाएगी ही, अम्बर पर घन बन छाएगा ही उच्छ्वास तुम्हारा। और अधिक ले जाँच, देवता इतन क्रूर नहीं है। थककर बैठ गये क्या भाई! मंज़िल दूर नहीं है।

SQL- Queries August 31, 2009

Filed under: ORACLE-SQL — whoami @ 19:51

// Good queries for EMP,DEPT Default table in Oracle
1.FIND THE EMPLOYEE NAME WHO IS WORKING IN DEPT NO 30
SQL> SELECT ENAME FROM EMP WHERE DEPTNO=30;

2.FIND THE EMPLOYEE NAME,SALARY WHO IS WORKING IN DEPT NO 20
SQL> SELECT ENAME,SAL FROM EMP WHERE DEPTNO=20;

3.FIND THE NAME ,JOB,SALARY OF THE EMPLOYEE WHO IS NOT A MANAGER
SQL> SELECT ENAME,JOB,SAL FROM EMP WHERE JOB!=’MANAGER’;

4.FIND THOSE EMPLOYEES WHO WERE HIRED BETWEEN 1 MAR 1981 AND 1 JUN 1983
SQL> SELECT ENAME FROM EMP WHERE HIREDATE BETWEEN ‘1-MAR-1981’ AND ‘1-JUN-1983’;

5.FIND EMPLOYEE NAME WHO WERE HIRED IN 1981
SQL> SELECT ENAME FROM EMP WHERE HIREDATE LIKE’%81′;

6.FIND EMPLOYEE NAME WHOSE NAME ENDS WITH ‘S’
SQL> SELECT ENAME FROM EMP WHERE ENAME LIKE’%S’;

7.FIND EMPLOYEE NAME WHO ARE WORKING IN DEPT NO 20 & 40
SQL> SELECT ENAME FROM EMP WHERE DEPTNO IN(20,40);

8.FIND ENAME,JOB AND DEPTNO WHO ARE CLERK & SALESMAN
SQL> SELECT ENAME,JOB,DEPTNO FROM EMP WHERE JOB IN(‘CLERK’,’SALESMAN’);

9.FIND ENAME WHO ARE MANAGER AND GETTING SALARY MORE THAN 2000
SQL> SELECT ENAME FROM EMP WHERE JOB=’MANAGER’ AND SAL>2000;

10.FIND ENAME WHO ARE WORKING IN DEPTNO 30 ORDER BY SALARY IN DESC. ORDER
SQL> SELECT ENAME FROM EMP WHERE DEPTNO=30 ORDER BY SAL DESC;

11.FIND OUT THE TOTAL SALARY OF ALL THE EMPLOYEES
SQL> SELECT SUM(SAL) FROM EMP;

12.FIND OUT TOTAL AVG OF ALL THE EMPLOYEES WHO ARE WORKING IN DEPTNO 30
SQL> SELECT AVG(SAL) FROM EMP WHERE DEPTNO=30;

13.FIND OUT THE MINIMUM SALARY OF DEPT NO 20
SQL> SELECT MIN(SAL) FROM EMP WHERE DEPTNO=20;

14.FIND OUT THE MAXIMUM HIREDATE
SQL> SELECT MAX(HIREDATE) FROM EMP;

15.FIND OUT THE TOTAL NUMBER OF EMPLOYEES WHO ARE WORKING IN DEPT NO 10
SQL> SELECT COUNT(ENAME) FROM EMP WHERE DEPTNO=10;

16.FIND OUT DEPTNO,TOTAL SALARY OF THOSE DEPT WHERETHERE IS NO SALESMAN AND  TOTAL SALARY OF DEPT IS MORE THAN 8500
SQL> SELECT DEPTNO,SUM(SAL) FROM EMP WHERE JOB!=’SALESMAN’ GROUP BY DEPTNO HAVING SUM(SAL)>8500;

17.FIND ENAME WHO WAS HIRED FIRST
SQL> SELECT ENAME FROM EMP WHERE HIREDATE IN(SELECT MIN(HIREDATE) FROM EMP);

18.FIND TOTAL SALARY FOR THOSE WHO ARE NOT MANAGER
SQL> SELECT SUM(SAL) FROM EMP WHERE JOB<>’MANAGER’;

19.FIND TOTAL SALARY OF EACH DEPT EXCLUDING THE EMPLOYEE WHO ARE NOT SALESMAN AND DISPLAY ONLY THOSE DEPT WHOSE TOTAL>7000
SQL> SELECT DEPTNO,SUM(SAL) FROM EMP WHERE JOB!=’SALESMAN’ GROUP BY DEPTNO HAVING SUM(SAL)>7000;

20.FIND AVG SALARY FOR ALL THE JOB TYPES WITH MORE THAN 2 EMPLOYEES
SQL> SELECT JOB,AVG(SAL) FROM EMP GROUP BY JOB HAVING COUNT(JOB)>2;

21.DISPLAY EMP. COUNT FOR EACH JOB CATAGORY
SQL> SELECT JOB,DEPTNO,COUNT(ENAME) FROM EMP GROUP BY JOB,DEPTNO;

22.FIND ENAME WHO WAS HIRED FIRST
SQL> SELECT ENAME FROM EMP WHERE HIREDATE IN(SELECT MIN(HIREDATE) FROM EMP);

23.FIND OUT THE ENAME HAVING MAXIMUM SALARY IN EACH DEPT
SQL> SELECT ENAME FROM EMP WHERE SAL IN (SELECT MAX(SAL) FROM EMP GROUP BY DEPTNO);

24.FIND AVG SALARY FOR THOSE EMPLOYEES WHOSE JOB=’CLERK’
SQL> SELECT AVG(SAL) FROM EMP WHERE JOB=’CLERK’;

25.FIND TOTAL SALARY FOR THOSE EMPLOYEES WHO WERE HIRED IN 1981
SQL> SELECT SUM(SAL) FROM EMP WHERE HIREDATE LIKE’%81′;

26.CREATE TABLE EMP10 HAVING EMPNO(PRIMARY KEY),ENAME(NOT NULL),SAL(SAL=4000),HIREADTE,DEPTNO
SQL> CREATE TABLE EMP10(EMPNO NUMBER(4) PRIMARY KEY,
ENAME CHAR(10) NOT NULL,
SAL NUMBER(4) CHECK(4000),
HIREDATE DATE,
DEPTNO NUMBER(2) REFERENCES DEPT10(DEPTNO));

27.CREATE TABLE ABC USING AS COMMAND
SQL> CREATE TABLE ABC AS(SELECT * FROM EMP);

28.INSERT THE VALUE TO ADDRESS COLUMN
SQL> UPDATE ABC SET ADDRESS=’DELHI’;

Advertisements
 

Palindrome August 30, 2009

Filed under: JAVA — whoami @ 15:39
Tags:

import java.io.*;
class palim
{
 public static void main(String args[]) throws IOException
 {
 System.out.println("Enter The Number");
 DataInputStream in=new DataInputStream(System.in);
 int num=Integer.parseInt(in.readLine());
 int n=0,rem=0,old=num;
 while(num>0){
 rem=num%10;
 num=num/10;
 n=n*10+rem;
 }

 if(n==old)
 System.out.println("The Given number is Palindrme");
 else
 System.out.println("Given number is not palindrome");

 }//end of main

}

 

Error- Recompile with -Xlint

Filed under: JAVA — whoami @ 15:18
Tags:

THE reason behind the error message in comipling a java pgm.

The message is telling you that you are using a deprecated API. A deprecated API means an API that you shouldn’t be using because it has been replaced by something else. The code will still work for now but someday a future release may eliminate the deprecated API and then your code will break. It is a good idea to stay away from deprecated APIs. The message is telling you to invoke javac with the -Xlint:deprecation flag and it will tell you exactly what it is complaining about.

 

Finding A leap Year

Filed under: Computers,JAVA — whoami @ 15:09
Tags:

import java.io.*;
class input
{
 int  i,j,k;
 int in() throws IOException
 {
 DataInputStream inp=new DataInputStream(System.in);
 int num=Integer.parseInt(inp.readLine());
 return num;
 }

 void calc(int year)
 {

 if(year%100!=0&&year%4==0)
 System.out.println("Its a Leap Year");
 else if(year%400==0)
 System.out.println("Its a leap year");
 else
 System.out.println("Not a leap Year");
 }

}

class leapm
{

 public static void main(String args[]) throws IOException
 {
 input obj=new input();
 System.out.println("Enter the Year");
 int yr=obj.in();
 obj.calc(yr);
 }

}   

 

Insertion Sort

Filed under: Computers,JAVA — whoami @ 14:43
Tags:

import java.io.*;

class input
{
int i,j;

int in() throws IOException
{
DataInputStream inp=new DataInputStream(System.in);
int num=Integer.parseInt(inp.readLine());
return num;
}

void sort(int arr[],int size)
{

int i, j,key;

for(j=1;j=0&&arr[i]>key)
{
arr[i+1]=arr[i];
i=i-1;
}
arr[i+1]=key;
}
System.out.println(“The sorted List is:-“);
for( i=0;i

 

Bubble Sort

Filed under: JAVA — whoami @ 13:52

import java.io.*;
class input
{
int i,j,k;
int in() throws IOException
{
int num=0;
DataInputStream in=new DataInputStream(System.in);
num=Integer.parseInt(in.readLine());
return num;
}

void bubble(int n[],int size)
{

int temp,i,j;
for(i=0;in[j+1])
{
temp=n[j];
n[j]=n[j+1];
n[j+1]=temp;
}
}
}

System.out.println(“The Sorted array is:”);

for(i=0;i

 

Find all Factors

Filed under: Computers,JAVA — whoami @ 13:38
Tags:

import java.io.*;
class input
{   
int arr[]=new int[100];
int ini()
{
DataInputStream in=new DataInputStream(System.in);
int n=0;
try
{
n=Integer.parseInt(in.readLine());
}catch(Exception e) {ini();}
return n;
}
void factor(int x)
{
int i,j;
for(i=1;i<=x/2;i++) { if(x%i==0) { System.out.println("the factors of the no. are:"); System.out.println(i+" "); } } } } class factors { public static void main(String args[]) { int c; input temp=new input(); System.out.println("enter the no. whose factors are to calculated:"); c=temp.ini(); temp.factor(c); } } [/sourcecode]