1.1.Some syntactic differences between Mysql and Oracle.
2.2.Oracle is not open source mysql is open source database.
3.3.Mysql does not have a language such as PL/SQL, but instead allows.
4.4.Mysql support auto increment function. Oracle does not support auto increment function.
5.5.Oracle support sub queries. Mysql does not support sub queries.
6.6.Mysql does not support views, trigger, indexing, sequence. Store procedure oracle support.
7.7.Oracle is generally use for much larger applications than mysql.
8.8.Oracle requires much more setup and tuning than mysql.
You can change and use it for getting Nth Highest Salary from Employee table as follows:
SELECT TOP 1 salary FROM (SELECT DISTINCT TOP n salary FROM employee ORDER BY salary DESC) aORDER BY salary
The following query uses a self join to return the name of each employee along with the name of the employee's manager. (A WHERE clause is added to shorten the output.)
The join condition for this query uses the aliases e1 and e2 for the sample table employees:e1.manager_id = e2.employee_id
The following example uses a left outer join to return the names of all departments in the sample schema hr, even if no employees have been assigned to the departments:
Users familiar with the traditional Oracle outer joins syntax will recognize the same query in this form:
Oracle Corporation strongly recommends that you use the more flexible Oracle9i FROM clause join syntax shown in the former example.
The left outer join returns all departments, including those without any employees. The same statement with a right outer join returns all employees, including those not yet assigned to a department:
Note: The employee Zeuss was added to the employees table for these examples, and is not part of the sample data.
It is not clear from this result whether employees Grant and Zeuss have department_id NULL, or whether their department_id is not in the departments table.
Re: Table Has C1 And C2 Column If Exits any record in c1 then Update c2 record Otherwise insert new record in the C1 And C2 (Using Procedure)
select * from x;
C1 C2
----- ----------
1
2
3
4
5
6
7
8
9
10
1 create or replace procedure updt_x is
2 cnt number(4);
3 begin
4 select count(1) into cnt from x where c1 is not null;
5 if cnt > 0 then
6 update x
7 set c2=10;
8 else
9 insert into x
10 values(1,2);
11 end if;
12 commit;
13* end;
SQL> execute updt_x;
PL/SQL procedure successfully completed.
SQL> select * from x;
C1 C2
---------- ----------
1 10
2 10
3 10
4 10
5 10
6 10
7 10
8 10
9 10
10 10
10 rows selected.
SQL> delete from x;
10 rows deleted.
SQL> commit;
PL/SQL procedure successfully completed.
SQL> select * from x;
C1 C2
---------- ----------
1 2
0 comments
Post a Comment