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
Initializing Objects: Till you initialize an object by calling the constructor for its object type, the object is automatically null. That is, the object itself is null, not me

UNION without CORRESPONDING - SQL The use of UNION without CORRESPONDING. Example is merely by omitting CORRESPONDING, but only because the operands have identical SELECT clau

SQL Database: So, an SQL database is one whose symbols are organized into a collection of tables. Now, shows an SQL table as the current value of an SQL variable, ENROLMENT, b

Parameter and Keyword Description: package_name: This construct identifies the package. AUTHID Clause: This determine whether all the packaged subprograms impleme

Manipulating Objects: You can use an object type in the CREATE TABLE statement to indicate the datatype of a column. When the table is created once, you can use the SQL statem

Order of Evaluation When you do not use the parentheses to specify the order of evaluation, the operator precedence determine the order. Now compare the expressions below: NOT

I want someone to write a TSQL function that returns the name of the ODBC DSN. I will use the queries below, to get information about the connection, but none of these return th

Exception handling In the PL/SQL, a warning or error condition is known as an exception. The Exceptions can be internally defined (by the run-time system) or user defined. The

User-Defined Exceptions The PL/SQL defines the exceptions of your own. Dissimilar to the predefined exceptions, the user-defined exceptions should be declared and should be rai

Accessing Attributes: You can refer to an attribute only by its name not by its position in the object type. To access or modify the value of an attribute, you can use the dot