Académique Documents
Professionnel Documents
Culture Documents
1.
SELECT LASTNAME, FIRSTNAME
FROM EMP
GROUP BY LASTNAME, FIRSTNAME
We Have 2 ways To Answer This Question
1.Using UNIQUE
2.Using GROUP BY
SELECT
2.
tab.department_name,
3.
MIN(tab.salary) AS Second_Max_Sal
4.
FROM
5.
6.
SELECT
7.
e.first_name,
8.
e.salary,
9.
d.department_name,
10.
11.
12.
rank
FROM
13.
hr.departments d
14.
15.
16.
tab
17.
WHERE
18.
19.
20.
GROUP BY
tab.department_name
1.
2.
3.
4.
(SELECT MAX(Sal)
5.
FROM Emp
6.
7.
GROUP BY e.DeptNo,d.DeptName
sbagai2001
May 26th, 2006
25
41036
Questions by sbagai2001 answers by sbagai2001
SQL
Answer
First
Prev
Next
Last
Hi,
Advantages of views:
1. View the data without storing the data into the object.
2. Restict the view of a table i.e. can hide some of columns in the tables.
3. Join two or more tables and show it as one object to user.
4. Restict the access of a table so that nobody can insert the rows into the table.
Disadvatages:
1. Can not use DML operations on this.
2. When table is dropped view becomes inactive.. it depends on the table objects.
3. It is an object, so it occupies space.
Pls. add , if I miss any of them.
Thanks,
Mohan
truncate is DDL where as Delete is DML. You cannot use where clause in Truncate and cannot retrieve
data once applied. Delete can use where clause and roll back data if Commit is not used. Delete is
preferred as developer have clarity that which data have to delete. Truncate clears all data which may be
needed for others.
Internally Delete statement will not clears row nums even if record is deleted which will cause
performance issue when deleted data is too much. Truncate clears row num too
Delete would leave "log" statements about every deleted thing and truncate wont. Hence truncate would
be faster.
2.
3.
UNION
4.
5.
UNION
6.
7.
8.
UNION
9.
kowmudiswarna
mradul
How to find Nth largest or Nth smallest data from oracle table, for
ex..5th highest salary from employees
To get the nth largest unitprice from products table:
SELECT distinct p1.unitprice
from products p1
where
(select count(*)+1 from products p2 where
p2.unitprice > p1.unitprice) = {n}
order by p1.unitprice desc
To avoid a Cartesian product, always include a valid join condition in a WHERE clause.
2.
3.
ON emp1
4.
5.
6.
BEGIN
7.
IF INSERTING THEN
8.
9.
10.
11.
12.
13.
END IF
14.
END prac_trig_emp1
15.
16.
17.
18.
COUNTRY_NAME
REGION_ID
Then we wil use column names what u need from above list;
Ex:
select * from countries where country_id=91;
END;
/
This function can now be called in a SQL query which will retum 1 if the value passwd is numeric else it
will return 0.
Thanks & Regards,
Krishnakant.
When do you use WHERE clause and when do you use HAVING
clause?
HAVING clause is used when you want to specify a condition for a group function and it is written after
GROUP BY clause. The WHERE clause is used when you want to specify a condition for columns, single
row functions except group functions and it is written before GROUP BY clause if it is used.
What are Pair Wise & Non-Pair Wise Columns?
Vinod Tuteja
2.
3.
4.
5.
6.
7.
8.
FROM employees
WHERE manager_id IN
(SELECT manager_id
FROM employees
AND department_id IN
(SELECT department_id
9.
FROM employees
10.
11.
Vinod Tuteja
2.
3.
4.
5.
6.
7.
FROM employees
WHERE manager_id IN
(SELECT manager_id
FROM employees
AND department_id IN
8.
(SELECT department_id
9.
FROM employees
10.
11.
2.
3.
FROM employees
4.
5.
FROM employees
6.
7.
/
Salary Sal in Words
------- -----------------------------------------------------800 Rs. Eight Hundred only.
1600 Rs. One Thousand Six Hundred only.
1250 Rs. One Thousand Two Hundred Fifty only.
Nazeera Jaffar
Answer:
Code
1.
2.
3.
INSERT ALL
4.
5.