Webocreation

Wednesday, December 2, 2009

Comparison Conditions

Comparison Conditions

=

>

>=

<

<=

<>

BETWEEN…AND…

IN(set)

LIKE

IS NULL

We can display rows based on a range of values using the BETWEEN range condition. The range that we specify contains a lower limit and an upper limit.

To test for values in a specified set of values, use the IN condition. The IN condition is also known as the membership condition.

We may not always know the exact value to search for. We can select rows that match a character pattern by using the LIKE condition. The character pattern-matching operation is referred to as a wildcard search. Two symbols can be used to construct the search string. Ie. %(zero or more characters) and _ (single character).

The NULL conditions include the IS NULL condition and the IS NOT NULL condition. The IS NULL condition tests for nulls. A null value means the value is unavailable, unassigned, unknown, or inapplicable. Therefore, we cannot test with = because a null cannot be equal or unequal to any value.

- select empno, ename,job, deptno from emp where deptno=20;

- select empno, ename, salary from emp where lastname=’Lama’;

- select * from emp where hiredate=’01-JAN-95’ and salary>=5000 and lastname=’Smith’;

- select ename,slary from emp where salary between 2300 and 3500;

- select empno,ename,salary,mgr from emp where deptno in(20,30,40);

- select ename,hiredate from emp where hiredate like ‘%95’;

- select ename from emp where ename like ‘_e%’;

- select ename,mgr from emp where mgr is null;

- select ename,salary,comm. from emp where comm. is null;

- select empno, ename,job,salary from emp where salary>=1000 and job like ‘SYS%’;

- select empno, ename,job,salary from emp where salary>=1000 or job like ‘SYS%’;

- select empno, ename from emp where job in (‘MANAGER’, ‘CLERK’, ‘PEON’);

The order of rows returned in a query result is undefined. The ORDER BY clause can be used to sort the rows. If we use the ORDER BY clause, it must be the last clause of the SQL statement. We can specify an expression, or an alias, or column position as the sort condition. Syntax:

SELECT expression

FROM table

WHERE conditions

ORDER BY columns [ASC|DESC];

If the ORDER BY clause is not used, the sort order is undefined, and the oracle server may not fetch rows in the same order for the same query twice. Use the ORDER BY clause to display the rows in a specific order.

To reverse the order in which rows are displayed, specify the DESC keyword after the column name in the ORDER BY clause.

- select ename, job, depatno, hiredate from emp order by hiredate;

- select ename, job ,deptno, hiredate from emp order by hiredate desc;

- select empno, ename, salary, salry*12 Annsal from emp order by annsal;

- select ename, deptno, salary from emp order by deptno,salary desc;

Primary key constraints

Primary key constraints

This constraint avoids duplication of rows and does not allow NULL values, when enforced in a column or set of columns. A a result it is used to identify a row. A table can have only one primary key. If a primary key constraint is assigned to more than one column(i.e) or combination of columns it is said to be a composite primary key (or simply a composite key), which can contain a maximum of 16 columns. Primary key constraint cannot be defined in an alter table command when the table contains rows having NULL values.

Run and Check your out put

- select * from emp;

- select deptno, dname, loc from dept;

- select empno, ename, salary, hiredate from emp;

- select ename,salary, salary+100 from emp;

- select ename, salary, (salary*12)+100 from emp;

- select ename,slary, (salary*12)+comm. from emp;

- select ename,salary, (salary*12)+nvl(comm,0) from emp;

- select ename “Full Name”, salary*12 “Annual Salary” from emp;

- select ename||job from emp;

- select ename||’ is a ‘||job “Emp Detail” from emp;

- select deptno from emp;

- select distinct deptno from emp;

- select distinct deptno, job from emp;

- In SQL, we can display the structure of a table using the DESCRIBE command. The command shows the column names and data types, as well as whether a column must contain data or not.

- desc emp;

- describe emp;

Tuesday, December 1, 2009





Hello, world!
]]>





Hello, world!
]]>

How to make Diet Coke and Mentos Rocket

What happen when diet coke and mentos get mixed??


It forms boom which get exploid


myths and facts health tips diet management

How to make Diet Coke and Mentos Rocket

What happen when diet coke and mentos get mixed??


It forms boom which get exploid


myths and facts health tips diet management

Monday, November 30, 2009

Nepali comedy


nepali comedy nepali funny and smile nepal funny video in nepali comedy in nepali have fun in nepali what a joke in nepali nepali video