🗊Презентация SQL Subqueries

Нажмите для полного просмотра!
SQL Subqueries, слайд №1SQL Subqueries, слайд №2SQL Subqueries, слайд №3SQL Subqueries, слайд №4SQL Subqueries, слайд №5SQL Subqueries, слайд №6SQL Subqueries, слайд №7SQL Subqueries, слайд №8SQL Subqueries, слайд №9SQL Subqueries, слайд №10

Вы можете ознакомиться и скачать презентацию на тему SQL Subqueries. Доклад-сообщение содержит 10 слайдов. Презентации для любого класса можно скачать бесплатно. Если материал и наш сайт презентаций Mypresentation Вам понравились – поделитесь им с друзьями с помощью социальных кнопок и добавьте в закладки в своем браузере.

Слайды и текст этой презентации


Слайд 1





Subqueries
Module 6
Описание слайда:
Subqueries Module 6

Слайд 2





Agenda
What is subquery?
The IN operator
Subquery in the FROM clause
Subquery as field requests
Correlated subquery
Conditions EXISTS, NOT EXISTS
The UNION operator
Описание слайда:
Agenda What is subquery? The IN operator Subquery in the FROM clause Subquery as field requests Correlated subquery Conditions EXISTS, NOT EXISTS The UNION operator

Слайд 3





What is subquery?
A subquery is a query that is nested inside a SELECT, INSERT, UPDATE, or DELETE statement, or inside another subquery. 
A subquery can be used anywhere an expression is allowed.
There are a few rules that subqueries must follow:
Subqueries must be enclosed within parentheses.
A subquery can have only one column in the SELECT clause, unless multiple columns are in the main query for the subquery to compare its selected columns.
An ORDER BY cannot be used in a subquery.
Subqueries that return more than one row can only be used with multiple value operators, such as the IN operator.
The BETWEEN operator cannot be used with a subquery; however, the BETWEEN operator can be used within the subquery.
Описание слайда:
What is subquery? A subquery is a query that is nested inside a SELECT, INSERT, UPDATE, or DELETE statement, or inside another subquery. A subquery can be used anywhere an expression is allowed. There are a few rules that subqueries must follow: Subqueries must be enclosed within parentheses. A subquery can have only one column in the SELECT clause, unless multiple columns are in the main query for the subquery to compare its selected columns. An ORDER BY cannot be used in a subquery. Subqueries that return more than one row can only be used with multiple value operators, such as the IN operator. The BETWEEN operator cannot be used with a subquery; however, the BETWEEN operator can be used within the subquery.

Слайд 4





The IN operator
Subqueries can be used with the following SQL statements along with the comparison operators like 
	=, <, >, >=, <= etc.
Usually, a subquery should return only one record, but sometimes it can also return multiple records when used with operators IN, NOT IN in the where clause. 
The query syntax:
	SELECT <list of fields>
	FROM <table name>
	WHERE <field name> IN (<list of values>)
Описание слайда:
The IN operator Subqueries can be used with the following SQL statements along with the comparison operators like =, <, >, >=, <= etc. Usually, a subquery should return only one record, but sometimes it can also return multiple records when used with operators IN, NOT IN in the where clause. The query syntax: SELECT <list of fields> FROM <table name> WHERE <field name> IN (<list of values>)

Слайд 5





Subquery in the FROM clause
Subqueries are legal in a SELECT statement's FROM clause. 
The syntax for the query:
	SELECT ... 
	FROM (subquery) [AS] name ...
The [AS] name clause is mandatory, because each table in a FROM clause must have a name. 
Any columns in the subquery select list must have unique names.
Описание слайда:
Subquery in the FROM clause Subqueries are legal in a SELECT statement's FROM clause. The syntax for the query: SELECT ... FROM (subquery) [AS] name ... The [AS] name clause is mandatory, because each table in a FROM clause must have a name. Any columns in the subquery select list must have unique names.

Слайд 6





Subquery as field requests
Demonstration
Описание слайда:
Subquery as field requests Demonstration

Слайд 7





Correlated subquery
Correlated subquery is a subquery that uses values from the outer query. 
The subquery is evaluated once for each row processed by the outer query.
For example,
SELECT ID, LASTNAME 
FROM EMPLOYEE AS EMP 
WHERE RATE > ( SELECT AVG(RATE) 
	FROM EMPLOYEE 
	WHERE 
	     ID_DEPARTMENT= EMP.ID_DEPARTMENT);
Описание слайда:
Correlated subquery Correlated subquery is a subquery that uses values from the outer query. The subquery is evaluated once for each row processed by the outer query. For example, SELECT ID, LASTNAME FROM EMPLOYEE AS EMP WHERE RATE > ( SELECT AVG(RATE) FROM EMPLOYEE WHERE ID_DEPARTMENT= EMP.ID_DEPARTMENT);

Слайд 8





Conditions EXISTS, NOT EXISTS
The SQL EXISTS condition is used in combination with a subquery and is considered to be met, if the subquery returns at least one row. 
It can be used in a SELECT, INSERT, UPDATE, or DELETE statement.
The syntax for the EXISTS condition is:
	 WHERE EXISTS ( subquery );
Описание слайда:
Conditions EXISTS, NOT EXISTS The SQL EXISTS condition is used in combination with a subquery and is considered to be met, if the subquery returns at least one row. It can be used in a SELECT, INSERT, UPDATE, or DELETE statement. The syntax for the EXISTS condition is: WHERE EXISTS ( subquery );

Слайд 9





The UNION operator 
The UNION operator is used to combine the result-set of two or more SELECT statements.
SQL UNION Syntax
	SELECT <LIST OF FIELDS> 
	FROM <TABLE 1>
	UNION [ALL]
	SELECT <LIST OF FIELDS> 
	FROM <TABLE 2>
Описание слайда:
The UNION operator The UNION operator is used to combine the result-set of two or more SELECT statements. SQL UNION Syntax SELECT <LIST OF FIELDS> FROM <TABLE 1> UNION [ALL] SELECT <LIST OF FIELDS> FROM <TABLE 2>

Слайд 10





Thank you!
Описание слайда:
Thank you!



Теги SQL Subqueries
Похожие презентации
Mypresentation.ru
Загрузить презентацию