Select From Employee Where Rowid Select Max (Rowid) From Employee
Select From Employee Where Rowid Select Max (Rowid) From Employee
select * from Employee a where rowid = (select max(rowid) from Employee b where
a.Employee_no=b.Employee_no);
What is query to find the record no 15 from database?
Select distinct Salary from Employee e1 where 2=Select count(distinct Salary) from
Employee e2 where e1.salary<=e2.salary;
Query to find duplicate rows in table?(click here for explaination)
Select * from Employee a where row_id != select max(row_id) for Employee b where
a.Employee_num=b.Employee_num;
Using Simple delete statement you can remove the duplicate records from the table.
Answer:
union
select * from (Select * from Employee e order by rowid desc) where rownum <=5;
select distinct salary from employee a where 3 >= (select count(distinct salary) from emp loyee
b where a.salary <= b.salary) order by a.salary desc;
select * from (Select Dense_Rank() over ( order by salary desc) as Rnk,E.* from Employee E)
where Rnk=3;
17.Find Query to get information of Employee where Employee is not assigned to the department.
Select * from Employee where Dept_no Not in(Select Department_no from Employee);
14.How to insert name with single Quote in Employee table?
Answer:
case when name=’Pradnya’ then 0.1*salary end as ‘Pradnya Salary’ from Employee;
The first normal form is the normal form of database where data must not contain repeating
groups.The database is in First normal form If,
Repeating Groups:- Repeating group means a table contains 2 or more values of columns that
are closely related.
2.There should not be any partial dependency of any column on primary key.Means the table have
concatanated primary key and each attribute in table depends on that concatanated primary key.
3.All Non-key attributes are fully functionally dependent on primary key.If primary is is not composite
key then all non key attributes are fully functionally dependent on primary key.
In above table Employee No determines the Salary Slip No.And Salary Slip no Determines
Employee name.Therefore Employee No determines Employee Name.We have transitive functional
d4.BCNF(Boyce-Codd Normal Form)
BCNF Normal form is higher version of third normal form.This form is used to handle analomies
which are not handled in third normal form.BCNF does not allow dependencies between attributes
that belongs to candidate keys.It drops restriction of the non key attributes from third normal form.
Third normal form and BCNF are not same if following conditions are true:
2.At least two of candidate keys are composed of more than 1 attribute
Example:
Address-> {City,Street,Zip}
Key 2->{City,Street}
{City,Street}->{zip}
{Zip}->{City}