Preview

Database Sql

Good Essays
Open Document
Open Document
755 Words
Grammar
Grammar
Plagiarism
Plagiarism
Writing
Writing
Score
Score
Database Sql
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.

You May Also Find These Documents Helpful

  • Good Essays

    The SELECT statement is the primary means of extracting data from database tables, and allows you to determine exactly which data you want to extract by means of different comparison operators used in the WHERE clause. This includes the use of specific "wild card" characters which allow you to search for character or number patterns within the data. You can also perform mathematical expressions within the SELECT statement to create derived output. The ORDER BY clause allows you to sort the output data in either ascending (the default) or descending order. Lab #5 will explore all of these applications of the SELECT statement.…

    • 1559 Words
    • 7 Pages
    Good Essays
  • Powerful Essays

    Nt1310 Unit 1

    • 4209 Words
    • 17 Pages

    It parses and also executes the statement Displays the execution plan for the select statement automatically…

    • 4209 Words
    • 17 Pages
    Powerful Essays
  • Good Essays

    Kudler Fine Food Week 4

    • 284 Words
    • 2 Pages

    Using the database and tables from Week Three, write queries using the SQL SELECT statement.…

    • 284 Words
    • 2 Pages
    Good Essays
  • Satisfactory Essays

    cis3730_Exam1_Studyguide

    • 512 Words
    • 2 Pages

    Understand the three components of a basic select statement and what do they mean (select, from, where).…

    • 512 Words
    • 2 Pages
    Satisfactory Essays
  • Satisfactory Essays

    Unit 6 True

    • 287 Words
    • 1 Page

    SQL is the programming language used to manipulate data and data objects in a relational database management system. TRUE…

    • 287 Words
    • 1 Page
    Satisfactory Essays
  • Satisfactory Essays

    Structured Query Language (SQL) is a standard database computer language used for querying, modifying and managing data in Relational Database Management Systems (RDBMS). SQL was developed in the 1970's by IBM to initially manipulate and retrieve data in IBM System R. The SQL language was standardized in 1986 by the American National Standards Institute (ANSI); however, later releases were released as International Organization for Standardization (ISO) standards.…

    • 612 Words
    • 3 Pages
    Satisfactory Essays
  • Satisfactory Essays

    unit 6

    • 360 Words
    • 2 Pages

    8) The FROM keyword is used in a SELECT clause to determine which columns are included in the query.…

    • 360 Words
    • 2 Pages
    Satisfactory Essays
  • Good Essays

    List the relational operators and logical operators that can be used to form a validation rule.…

    • 636 Words
    • 3 Pages
    Good Essays
  • Powerful Essays

    A database language must enable the user to perform complex queries designed to transform the raw data into useful information.…

    • 1917 Words
    • 8 Pages
    Powerful Essays
  • Good Essays

    pt2520 assignment 1

    • 466 Words
    • 2 Pages

    Let’s get the definition out the way, the standard meaning if you will SQL or “sequel” to some is a special-purpose programming language designed for managing data held in a relational database management system (RDBMS). Now that we got that out the way, let’s get to the first question.…

    • 466 Words
    • 2 Pages
    Good Essays
  • Powerful Essays

    infs2603

    • 1000 Words
    • 4 Pages

    3. If an association is found to have attributes or operations, describe how these can…

    • 1000 Words
    • 4 Pages
    Powerful Essays
  • Satisfactory Essays

    I Like to 1321

    • 459 Words
    • 2 Pages

    statement. Also included is a for loop (repetition statement). Pay close attention to these as you…

    • 459 Words
    • 2 Pages
    Satisfactory Essays
  • Good Essays

    "SQL - Definition | WordIQ.com." Dictionary, Encyclopedia and Thesaurus - WordIQ Dictionary. N.p., n.d. Web. 26 Sept. 2012. <http://www.wordiq.com/definition/SQL>.…

    • 701 Words
    • 3 Pages
    Good Essays
  • Good Essays

    08

    • 4844 Words
    • 21 Pages

    10) In a correlated subquery, the same table is used in the upper and lower SELECT statements.…

    • 4844 Words
    • 21 Pages
    Good Essays
  • Satisfactory Essays

    Drm Exma Ii

    • 10378 Words
    • 42 Pages

    The SQL command _____ defines a logical table from one or more tables or views.…

    • 10378 Words
    • 42 Pages
    Satisfactory Essays