Monday, November 18, 2019

Oracle: IN, NOT IN, BETWEEN, NOT BETWEEN, Range Searching Query:

1. SELECT ENAME, SAL FROM EMP
WHERE  SAL  NOT BETWEEN 1000 AND 3500;

2. SELECT ENAME, SAL FROM EMP
WHERE  SAL NOT  IN(1000,3500,1100,1500);

3. SELECT ENAME, SAL FROM EMP
WHERE  SAL NOT  IN(1000,3500,1100,1500)
ORDER BY ENAME, SAL ASC;

4. SELECT ENAME, SAL FROM EMP
WHERE  SAL NOT  IN(1000,3500,1100,1500)
ORDER BY ENAME DESC;

5. SELECT ENAME, SAL FROM EMP
   WHERE  sal  > 3000
   AND  sal  < 4000;

6. SELECT ENAME, SAL FROM EMP
WHERE  sal  > 3000  OR sal  < 4000;

7. SELECT ENAME, SAL FROM EMP
WHERE  SAL BETWEEN 1000 AND 3500;

8. SELECT ENAME, SAL FROM EMP
WHERE  SAL  IN(1000,3500,1100,1500);



Oracle: Pattern Matching: Like Statement

Pattern Matching

1. SELECT ENAME, SAL FROM   EMP
WHERE ename LIKE   '%E%';

2. SELECT ENAME, SAL FROM   EMP
WHERE ename LIKE   'M%';

3. SELECT ENAME, SAL FROM   EMP
WHERE ename LIKE   '%M';

4. SELECT ENAME, SAL FROM   EMP
WHERE ename LIKE   'A%M';

5. SELECT ENAME, SAL FROM   EMP
WHERE ename LIKE   '__A%';


Oracle: Relational Operator

 Relational Operator 
1. SELECT ENAME, SAL FROM EMP
WHERE  sal < 3000;

2. SELECT ENAME, SAL FROM EMP
WHERE  sal > 3000;

3. SELECT ENAME, SAL FROM EMP
WHERE  sal = 3000;

4. SELECT ENAME, SAL FROM EMP
WHERE  sal <> 3000;

5. SELECT ENAME, SAL FROM EMP
WHERE  sal  <= 3000;

6. SELECT ENAME, SAL FROM EMP
WHERE  sal  >= 3000;



Monday, November 11, 2019

C++ "setf" using "basefield"

//5.  Program to print of Hexa Decimal, Octal, Decimal No.
int main()
{
    int x = 65;   
   cout.width(20);
   cout.setf(ios::hex,ios::basefield);
   cout<<"\n Hexa -> "<   cout.setf(ios::oct,ios::basefield);
   cout<<"\n Octal -> "<   cout.setf(ios::dec,ios::basefield);
   cout<<"\n Dec -> "<
}

C++ "setf" Scientific Application "floatfield"


//4.  Program shows the application scientific

int main()

{

   cout<   cout.width(20);

   cout.setf(ios::scientific,ios::floatfield);

   cout.fill('*');

   cout<

}


C++ "setf " Function

//2. Program shows the application of setf function right padding


int main()

{

   cout.width(20);

   cout.setf(ios::right,ios::adjustfield);

   cout.fill('*');

   cout<<"IT";

}


Sunday, November 10, 2019

C ++ "setf" function for left padding

/* This file contains program related to console input and output */


#include 

#include


// 1. Program shows the application of setf function for left padding

int main()

{

   cout.width(20);

   cout.setf(ios::left,ios::adjustfield);

   cout.fill('*');

   cout<<"IT";

}

C++ Multilevel Inheritance

* C++ program to demonstrate example of multilevel inheritance.*/

Ref: Kamthane.

#include

using namespace std;

//Base Class : class A
class A
{
    private:
        int a;
    public:
        void get_a(int val_a)
        { 

           a=val_a; 

         }
       
       void disp_a(void)
        {  

           cout << "Value of a: " << a << endl;  

        }
};


class B: public A
{
    private:
        int b;
    public:
        void get_b(int val_a, int val_b)
        {

              //assign value of a by calling function of class A
            get_a(val_a);     
            b=val_b;
        }


        void disp_b(void)
        {
            //display value of a
            disp_a();
            cout << "Value of b: " << b << endl;
        }
};


//Here class C is derived class and B is Base class


class C: public B
{
    private:
        int c;
    public:
        //assign value of a from here
        void get_c(int val_a, int val_b,int val_c)
        {
            /*** Multilevel Inheritance ***/
            //assign value of a, b by calling function of class B and Class A
            //here Class A is inherited on Class B, and Class B in inherited on Class B
            get_b(val_a,val_b);
            c=val_c;
        }
       
        void disp_c(void)
        {


            disp_b(); //display value of a and b using disp_b()

            cout << "Value of c: " << c << endl;
        }
};

int main()
{
    //create object of final class, which is Class C


    C objC;


    objC.get_c(10,20,30);
    objC.disp_c();


    return 0;
}

C++ Single Level Inheritance

/*C++ program to demonstrate example of private simple inheritance.*/

Ref: Kamthane



#include
using namespace std;


class A
{   

    private:
        int a;
    protected:
        int x;      //can access by the derived class
    public:
        void setVal(int v)

        { 

           x=v; 

        }
};


class B:private A
{
    public:
        void printVal(void)
        {  

           //accessing public member function here //protected data member direct access here
            setVal(10);  

            cout << "value of x: " << x << endl;
        }
};


int main()
{   

       //derived class creation


        B objB; 
        objB.printVal();        return 0;

}

Financial Year Oracle PLSQL Program

 CREATE OR REPLACE function FINANCIAL_YEAR(p_date DATE) return varchar2 IS    v_first     varchar2(4);    v_second    varchar2(4);    v_year...