Northwind. , SQL Server. .
. .
:
select * from [_]
, Employees
select * from Employees
. , . USE [_] (, USE Northwind) SQL Server Management Studio.
SQL-, , :
select EmployeeID, LastName, FirstName, Title, BirthDate
from Employees
AS ( ):
select EmployeeID AS [ ], LastName AS [], FirstName AS [], BirthDate [ ]
from Employees
WHERE. , :
select EmployeeID, LastName, FirstName, BirthDate
from Employees
where City = 'London'
100:
select * from [Order Details]
where Quantity > 100
2,5:
select * from [Order Details]
where UnitPrice < 2.5
, , .
NULL . ( SET) , , , :
select * from employees
where Region = null
, = IS [NOT] NULL:
select * from employees
where Region IS NULL
WHERE :
select *,
EmployeeID, LastName, FirstName, BirthDate
from Employees
where City = 'London' and TitleOfCourtesy = 'Mr.'
IN , , SELECT :
select *
from Employees
where City IN ('London', 'Seattle')
LIKE , . , D:
select *
|
|
from Employees
where LastName LIKE 'D%'
:
- | ||
% | . | WHERE LIKE '%%' , . |
_ () | . | WHERE _ LIKE '_' , (, ..). |
[ ] | , ([a-f]) ([abcdef]). | WHERE _ LIKE '[-]' , ˻ ѻ, , , .. |
[^] | , ([^a-f]) ([^abcdef]). | WHERE _ LIKE '[^]%' , , . |
:
ALL | TRUE, TRUE. |
AND | TRUE, Boolean TRUE. |
ANY | TRUE, TRUE. |
BETWEEN | TRUE, . |
EXISTS | TRUE, . |
IN | TRUE, . |
LIKE | TRUE, . |
NOT | Boolean . |
OR | TRUE, Boolean TRUE. |
SOME | TRUE, TRUE. |
= () | |
> () | |
< () | |
>= ( ) | |
<= ( ) | |
<> ( ) | |
!= ( ) | ( SQL-92) |
!< ( ) | ( SQL-92) |
!> ( ) | ( SQL-92) |
, , 1 1994 . , - :
select * from employees
where HireDate >= '01.01.1994'
.
1. Order Details, (UnitPrice) 15 24 30.
2. , '77'
3. (Orders), 1998 .
4. , 1998 , 5.
5. , 1998 , (ShipCountry).
, , , ..
SELECT , , :
select 5, null, 5*5, 'New'
, , , Order Details:
|
|
select *, UnitPrice*Quantity as [Summa]
from [order details]
.
1. , .
2. , ,