Preview

ADDBASE Research Paper

Satisfactory Essays
Open Document
Open Document
570 Words
Grammar
Grammar
Plagiarism
Plagiarism
Writing
Writing
Score
Score
ADDBASE Research Paper
STI College
Sta. Cruz, Laguna

Research about “Subqueries”
Advanced Database Systems

Submitted by
Roberto O. Ubatay Jr.

Submitted to
Mr. Rogimer Urriza
I. SQL Subquery
Subquery or Inner query or Nested query is a query in a query. A subquery is usually added in the WHERE Clause of the sql statement. Most of the time, a subquery is used when you know how to search for a value using a SELECT statement, but do not know the exact value in the database.
Subqueries are an alternate way of returning data from multiple tables.
Subqueries can be used with the following sql statements along with the comparision operators like =, , >=, , ANY (2000, 3000, 4000);

EMPNO SAL
---------- ---------- 7566 2975 7698 2850 7782 2450 7788 3000 7839 5000 7902 3000

-- Transformed to equivalent statement without ANY.
SELECT empno, sal
FROM emp
WHERE sal > 2000 OR sal > 3000 OR sal > 4000;

EMPNO SAL
---------- ---------- 7566 2975 7698 2850 7782 2450 7788 3000 7839 5000 7902 3000
C. Subqueries with ALL
The ALL comparison condition is used to compare a value to a list or subquery. It must be preceded by =, !=, >, ALL (2000, 3000, 4000);

EMPNO SAL
---------- ---------- 7839 5000

-- Transformed to equivalent statement without ALL.
SELECT empno, sal
FROM emp
WHERE sal > 2000 AND sal > 3000 AND sal > 4000;

EMPNO SAL
---------- ---------- 7839 5000

D. Subqueries with EXISTS
When a subquery is introduced with the keyword EXISTS, the subquery functions as an existence test. The WHERE clause of the outer query tests whether the rows that are returned by the subquery exist. The subquery does not actually produce any data; it returns a value of TRUE or FALSE.

For example: If you

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
  • Satisfactory Essays

    Hiredate DATE No No Job VARCHAR2(15) No No Mgrno number(4) no no yes ( to emp.empno) Salary number(8,2) no no Comm number(8,2) no no Deptno number(2) no no yes ( to…

    • 1169 Words
    • 5 Pages
    Satisfactory Essays
  • Satisfactory Essays

    M1 Unit 4 Assignment

    • 438 Words
    • 2 Pages

    2. Update the employee table and provide a salary for each employee using the salary column added in the previous problem. Validate the rows are there using a SELECT clause.…

    • 438 Words
    • 2 Pages
    Satisfactory 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

    CAUA 8

    • 1452 Words
    • 5 Pages

    Q 1: Perform Verify and Count Commands for all three tables and identify any exceptions.…

    • 1452 Words
    • 5 Pages
    Good 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
  • Good Essays

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

    • 636 Words
    • 3 Pages
    Good Essays
  • Satisfactory Essays

    Learning Team Pos/410

    • 434 Words
    • 2 Pages

    The SUBSTRING was used to shorten the length of the Short_Description Field for viewing purposes. The CAST command was used to restrict any account that did not have the number 6 in it. The OR at the end of that statement was used to include an account named 777777. The COMPUTE command computed the average balance of the accounts meeting all the above requirements.…

    • 434 Words
    • 2 Pages
    Satisfactory Essays
  • Satisfactory Essays

    Project Statement Year | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Sales | | 950,000 | 1,500,000 | 1,500,000 | 1,500,000 | 1,500,000 | 1,500,000 | 1,500,000 | 1,500,000 | Direct Cost55% of sales(Sales * 55% = DC) | | 522,500 | 825,000 | 825,000 | 825,000 | 825,000 | 825,000 | 825,000 | 825,000 | Indirect Incremental Costs | | 80,000 | 80,000 | 80,000 | 80,000 | 80,000 | 80,000 | 80,000 | 80,000 |…

    • 474 Words
    • 2 Pages
    Satisfactory Essays
  • Powerful Essays

    Bibl450 research paper 1

    • 2045 Words
    • 9 Pages

    LaHaye, Tim, and Ed Hindson. The Popular Encyclopedia of Bible Prophecy. Eugene: Harvest House, 2004.…

    • 2045 Words
    • 9 Pages
    Powerful Essays
  • Good Essays

    "SQL Sql Database Language Data Standard Query Programming Set." Business, Economy, Market Research, Finance, Income Tax Informations. N.p., n.d. Web. 26 Sept. 2012. <http://www.economicexpert.com/a/SQL:programming:language.htm>.…

    • 701 Words
    • 3 Pages
    Good Essays
  • Better Essays

    SQL or Structured Query Language is a specialized language for updating, deleting, and requesting information form databases. SQL is also an ANSI and ISO standard, and is one of the only database query languages. A plethora of already established database products support SQL. Some of the products that support SQL are Oracle and Microsot SQL Server. It is widely used in both industry and college institutions. Usually for enormous, complex databases. (Base2013).…

    • 769 Words
    • 3 Pages
    Better Essays
  • Good Essays

    Research Database Form

    • 1129 Words
    • 5 Pages

    Type your answers to the following questions using complete sentences and correct grammar, spelling and syntax. Click “Save as” and save the file with your last name and assignment, e.g.,”NR449_Research_Database_Smith” Submit to the Research Database basket in the Dropbox by 11:59 p.m. MT Sunday at the end of Week 5. The guidelines and grading rubric for this assignment may be found in Doc Sharing.…

    • 1129 Words
    • 5 Pages
    Good Essays
  • Satisfactory Essays

    This comprehensive journal article reviews recent HIV testing and prevalence patterns among the U.S. population. The importance of the care continuum for HIV-positive patients is discussed; from prevention and testing, to diagnosis and treatment. Strategies for viral suppression among those infected are also reviewed. The article presents a very thorough overview with an especially useful public health focus on prevention strategies for the future.…

    • 930 Words
    • 4 Pages
    Satisfactory Essays
  • Good Essays

    Database Paper

    • 672 Words
    • 3 Pages

    Whatis.com (2004) defines a database as "a collection of information that is organized so that it can easily be accessed, managed, and updated." In my current job at Wellco Tank Trucks, Inc., we do not use any type of databases in the daily operations of our business. My only job that involved regular use of a database was at Chilcutt Direct Marketing (CDM) in Oklahoma City, Oklahoma. From February 2003 to June 2004, I was an Account Executive of Brokerage at CDM. CDM is a direct marketing company that manages and brokers customer mailing lists for companies across the United States.…

    • 672 Words
    • 3 Pages
    Good Essays

Related Topics