Providing results of queries, PL-SQL Programming

Providing Results of Queries

Expressing queries in SQL is the (big) subject. Here I present just a simple example to give you the flavour of things to come in those chapters. Example is a query expressing the question, who is enrolled on course C1?

Example: A query in SQL

SELECT DISTINCT StudentId, Name

 FROM ENROLMENT

WHERE CourseId = CID ('C1')

Note carefully that Example not a command (hence the absence of a semicolon). It is just an expression, denoting a value -in this case, a table. In SQL the result of a query is always another table. Figure shows the result of Example in the usual tabular form.

1718_Providing Results of Queries.png

                                                                   Figure: Result of query in Example

Explanation:

  1. SELECT DISTINCT StudentId, Name specifies that the result of the WHERE invocation is to be projected over StudentId and Name.
  2. FROM ENROLMENT specifies the table operand for the invocation of WHERE
  3. WHERE CourseId = CID ('C1') specifies that just the rows for course C1 are required.
Posted Date: 1/18/2013 1:32:44 AM | Location : United States







Related Discussions:- Providing results of queries, Assignment Help, Ask Question on Providing results of queries, Get Answer, Expert's Help, Providing results of queries Discussions

Write discussion on Providing results of queries
Your posts are moderated
Related Questions
Using SAVEPOINT The SAVEPOINT names and marks the present point in the processing of a transaction. Used with the ROLLBACK TO statement, the savepoints undo parts of a transac

Example of Null operator - NiNo Rule If we wanted to make HIGHER_OF adhere to "NULL in, NULL out"-let's call it the NiNo rule-we would have to write something like what is sho

Many of the reports generated from the system calculate the total dollars in purchases for a shopper. Complete the following steps to create a function named TOT_PURCH_SF that acce

MERGE and TRUNCATE in SQL SQL has two more table update operators, MERGE and TRUNCATE. MERGE, like INSERT, takes a source table s and uses it to update a target table t. Brief

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

Understanding Nested Tables Within the database, the nested tables can be considered as one-column database tables. The Oracle stores the rows of a nested table in no specific o

Initial thought process: Design a script which was simple and user friendly. Integrate procedures/functions to extract data under the hood. I focused on giving the user the opt

Data Types in SQL - Decimal DECIMAL, NUMERIC, REAL, FLOAT and various other terms for various sets of rational numbers. When these key words are specified for the declared typ

Write an anonymous block that contains a PL/SQL procedure. The procedure takes two input parameter: oldZip and newZip, and it updates the zipcodes table by replacing all oldZip wit

Create a view named CustomerAddresses that shows the shipping and billing addresses for each customer in the MyGuitarShop database. This view should return these columns from the