.


:




:

































 

 

 

 


ORDER BY




 

, ORDER BY ( ). ORDER BY , , . ORDER BY . , ORDER BY 2 . , , DESC.

select :

 

Select < >

From < >

Where < >

Order by < >

 

:

 

1. , 5000 . 10000 . .

 

Select *

From tOperPart

Where QtyBs BETWEEN 5000 AND 10000

Order by OperDate DESC

 

2. , 5000 . 10000 ., , .

 

Select *

From tOperPart

Where QtyBs BETWEEN 5000 AND 10000

Order by OperDate DESC, QtyBs

 

.

3. , , 5000 , .

 

Select OperDate, sum(QtyBs) as sum

From tOperPart

Where Confirmed = 1

and CharType = 1

Group by OperDate

Having sum(QtyBs) > 5000

Order by 1

 

SQL :

1. , FROM.

2. WHERE, , , TRUE; , FALSE NULL ( NULL), .

3. . .

4. DISTINCT, .

5. GROUP BY .

6. ORDER BY .

 

 

. , , .

, , . 5NT(e) : . DSIDENTIFIER (numeric(15,0)). . , tResource ResourceID.

, . , tOperPart tResource tResource , .

, , < >.< >, , tResource.ResourceID.

 

:

 

1. , 20202840600000000000.

Select tSecurity.Name

From tResource

,tSecurity

Where tResource.Brief='20202840600000000000'

and tSecurity.SecurityID = tResource.FundID

 

2. , 20202840600000000000.

Select tInstitution.Name

From tResource

,tInstitution

Where tResource.Brief='20202840600000000000'

and tInstitution.InstitutionID = tResource.InstitutionID

 

3. , 20202840600000000000.

Select max(tOperPart.OperDate)

From tResource

,tOperPart

Where tResource.Brief='20202840600000000000'

and tOperPart.ResourceID = tResource.ResourceID

 

4. "".

Select tResource.*

From tInstitution

,tResource

Where tInstitution.Name =' ""'

and tResource.InstOwnerID = tInstitution.InstitutionID

 

5. "".

Select tDeal.*

From tDeal

,tInstitution

Where tInstitution.Name =' ""'

and tDeal.InstitutionID = tInstitution.InstitutionID

 

 

- , . , FROM. . . ,

 

FROM tOperPart op1, tOperPart op2, tOperPart op3

 

tOperPart op1, op2 op3. op1.OperationID. , .

 

:

 

1. vic_1.

Select o2.*

From tObjClassifier o1

,tObjClassifier o2

Where o1.Brief = 'vic_1'

and o2.ParentID = o1.ObjClassifierID

 

2. 20202840600000000000.

Select r2.*

From tResource r1

,tResource r2

Where r1.Brief = '20202840600000000000'

and r2.ResourceID = r1.ParentID

 

3. , , 40702810713513513505

 

 

     

 

Select tResource.Brief as , i1.Name as , i2.Name as

From tResource, tInstitution i1, tInstitution i2

Where tResource.Brief = 40702810713513513505

and tResource.InstitutionID=i2.InstitutionID

and tResource.InstOwnerID=i1.InstitutionID

 

4. , ʻ

 

Select i1.Name

From tInstitution i1, tInstitution i2

Where i2.Name= ʻ

And i2.ResBenefID=i1.InstitutionID

 

5. 16.08.2006 :

 

   

 

Select r1.Brief as ,

r2.Brief as

From tResource r1, tResource r2,

tOperPart op1, tOperPart op2

Where op1.OperDate=20060816

and op1.OperationID = op2.OperationID

and op1,ResourceID = r1.ResourceID

and op1.CharType = 1

and op2.ResourceID = r2.ResourceID

and op2.CharType = -1





:


: 2016-11-03; !; : 722 |


:

:

80% - .
==> ...

1739 - | 1590 -


© 2015-2024 lektsii.org - -

: 0.021 .