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
Query: SELECT * FROM EMPLOYEE1; Select 5 columns and all rows from one table Query: SELECT C_ID, COMPANY, BUILDING, DEPARTMENT, BRANCH FROM CONTRACT;

Example of Shorthand for a row constraint Example: Shorthand for a row constraint ALTER TABLE EXAM_MARK ADD CONSTRAINT Mark_in_range CHECK (Mark BETWEEN 0 AND 100);


Cursors   To execute the multi-row query, the Oracle opens an unnamed work region which stores the processing information. The cursor names the work region, access the informa

Using %TYPE The %TYPE attribute gives the datatype of a variable or the database column. In the example below, the %TYPE gives the datatype of a variable: credit REAL(7,2); debi

Cursor FOR Loops In most cases that need an explicit cursor, you can simplify the coding by using a cursor FOR loop rather of the OPEN, FETCH, and CLOSE statements. A cursor FO

WHILE-LOOP The WHILE-LOOP statement relates a condition with the series of statements enclosed by the keywords LOOP and END LOOP, as shown: WHILE condition LOOP sequence_of_sta

Cursor Attributes   The Cursors and cursor variables have 4 attributes which give you helpful information about the execution of a data manipulation statement. Syntax:

LEVEL You use the LEVEL with the SELECT CONNECT BY statement to categorize rows from a database table into a tree structure. The LEVEL returns the level number of a node in a

Truth Tables: However in propositional logic - here we are restricted to expressing sentences and where the propositions are true or false - so we can check where a particular