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
Effects of NULL for Multiple Assignments - SQL If the row expression given as the source for a multiple assignment evaluates to NULL, then NULL is assigned to each target. If

Pl/sql Conditional Control: IF statements Frequently, it is necessary to take the alternative actions depending on the circumstances. The IF statement execute a series of statem

Projection and Existential Quantification - SQL Intuitively it might seem that projection in SQL is simply a matter of specifying the required columns in the SELECT clause, a

SQL Operators The PL/SQL uses all the SQL set, comparison, and row operators in the SQL statements. This part briefly describes some of these operators.  1. Comparison Opera

OPEN-FOR Statement The OPEN-FOR statements execute the multi-row query related with a cursor variable. It also allocates the resources used by the Oracle to process the query a

Assignment of Variable - Updating a Variable Syntax: SET SN = SID ('S2'); This can obviously be read as "set the variable SN to be equal in value to SID ( 'S2' )".

Parameter Default Values As the illustration below shows, you can initialize the IN parameters to the default values. In that way, you can pass various numbers of actual par

Albeit simple method : These all the truth tables give us our first as albeit simple method for proving a theorem: where check whether it can be written in propositional logic

Extension and AND in SQL The theory book gives the following simple example of relational extension in Tutorial D: EXTEND IS_CALLED ADD ( FirstLetter ( Name ) AS Initial )

Example of WHEN or THEN Constraints A concrete example showing how SQL supports WHEN/THEN constraints CREATE TABLE SAL_HISTORY (EmpNo CHAR (6), Salary INTEGER NOT NULL,