Group and having query, PL-SQL Programming

Using a join on 2 tables, select all columns and 10 rows from the 2 tables without the use of a Cartesian product.

Query:

SELECT * FROM EMPLOYEE1 E JOIN STAFF S ON E.EMP_ID=S.EMP_ID WHERE ROWNUM<11;

Use group by & having in a select statement using one or more table(s) (If more than 1 table then, don't use a Cartesian product).

Query:

SELECT BRANCH,COUNT(*) FROM STAFF  GROUP BY BRANCH;

 

 

Posted Date: 3/14/2013 2:02:58 AM | Location : United States







Related Discussions:- Group and having query, Assignment Help, Ask Question on Group and having query, Get Answer, Expert's Help, Group and having query Discussions

Write discussion on Group and having query
Your posts are moderated
Related Questions
DELETE Command - SQL Loosely speaking, DELETE removes some existing rows from its target table. Suppose the university decides that course C3 is to be withdrawn. Example shows

Functions The function is a subprogram which can take parameters and be invoked. Normally, you can use a function to calculate a value. The function has 2 sections: the specifi

ROWID and UROWID Internally, every database table has a ROWID pseudo column that stores binary values known as rowids. Each rowid shows the storage address of a row. A physical

What Is a Package? The package is a schema object that group logically related PL/SQL items, types, and subprograms. The Packages usually have 2 parts, a specification & a bo

Write a pl/sql block that declares and uses cursors with parameters. In a loop, use a cursor to retrieve the department number and the department name from the departments table

Closest Approximation to Relational Union - SQL Actually, just as SQL has several varieties of JOIN, it also has several varieties of UNION, none of which is equivalent to th

BIOCHE M ICA L ORIGIN OF LIFE - It is generally agreed by astronomers, geologists and biologists that the earth is approximately 4500-5000 million years old. It is an

Inserting Objects: You can use the INSERT statement to add objects to an object table. In the illustration below, you insert a Person object into the object table persons:

EXECUTE Privilege To call an invoker-rights routine straightforwardly, the users should have the EXECUTE privilege on that routine. By yielding the privilege, you permit a user

Deleting Objects You can use the DELETE statement to eradicate objects from an object table. To eradicate objects selectively, you use the WHERE clause, as shown below: BEG