Database Sql

Topics: SQL, Relational model, Relational algebra Pages: 4 (755 words) Published: December 16, 2012
Lecture-13
Structured Query Language (SQL)

Introduction
Commercial database systems use more user friendly language to specify the queries.
SQL is the most influential commercially marketed product language.
Other commercially used languages are QBE, Quel, and Datalog.

Basic Structure
The basic structure of an SQL consists of three clauses: select, from and where.
select: it corresponds to the projection operation of relational algebra. Used to list the attributes desired in the result.
from: corresponds to the Cartesian product operation of relational algebra. Used to list the relations to be scanned in the evaluation of the expression
where: corresponds to the selection predicate of the relational algebra. It consists of a predicate involving attributes of the relations that appear in the from clause.
A typical SQL query has the form:
select A1, A2,…, An
from r1, r2,…, rm
where P
Ai represents an attribute
rj represents a relation
P is a predicate
It is equivalent to following relational algebra expression:
"Π" _("A" _"1" "," "A" _"2" ",…" 〖",A" 〗_"n" ) " (" "σ" _"P" " (" "r" _"1" "× " "r" _"2" " ×…×" "r" _"m" "))"

[Note: The words marked in dark in this text work as keywords in SQL language. For example “select”, “from” and “where” in the above paragraph are shown in bold font to indicate that they are keywords]

Select Clause
Let us see some simple queries and use of select clause to express them in SQL.
Find the names of all branches in the Loan relation
select branch-name
from Loan
By default the select clause includes duplicate values. If we want to force the elimination of duplicates the distinct keyword is used as follows: select distinct branch-name
from Loan
The all key word can be used to specify explicitly that duplicates are not removed. Even if we not use all it means the same so we don’t require all to use in select clause....
Continue Reading

Please join StudyMode to read the full document

You May Also Find These Documents Helpful

  • Oracle Database: SQL Fundamentals Essay
  • Sample Database to Help Users of Nonstop Sql/Mp Essay
  • C++ :Sumita arora solutions for SQL chapter Research Paper
  • Database Development Process Essay
  • database Essay
  • Essay about DATABASE SQL
  • Introduction to Oracle 9i: Sql Chapter 4-10 Essay
  • SQL Server Notes Essay

Become a StudyMode Member

Sign Up - It's Free