Database Database


Download 466 b.
bet10/19
Sana14.08.2018
Hajmi466 b.
1   ...   6   7   8   9   10   11   12   13   ...   19

Example: Define age categories for the animals.

  • Less than 3 months
  • Between 3 months and 9 months
  • Between 9 months and 1 year
  • Over 1 year


AccountsReceivable

  • AccountsReceivable

  • Categorize by Days Late

    • 30, 90, 120+
  • Three queries?

  • New table for business rules







Create Schema Authorization dbName password

  • Create Schema Authorization dbName password

  • Create Table TableName (Column Type, . . .)

  • Alter Table Table {Add, Column, Constraint, Drop}

  • Drop {Table Table | Index Index On table}

  • Create Index IndexName ON Table (Column {ASC|DESC})















Insert Into target (column1 . . .) VALUES (value1 . . .)

  • Insert Into target (column1 . . .) VALUES (value1 . . .)

  • Insert Into target (column1 . . .) SELECT . . . FROM. . .

  • Delete From table WHERE condition

  • Update table SET Column=Value,. . . Where condition

  • Note the use of the Select and Where conditions.

    • Synatx is the same--only learn it once.
    • You can also use subqueries.






Change the ListPrice of Animals at the PetStore.

  • Change the ListPrice of Animals at the PetStore.

    • For cats, increase the ListPrice by 10%.
    • For dogs, increase the ListPrice by 20%.
  • Typically use two similar UPDATE statements.

  • With the CASE function, the statements can be combined.



Break questions into smaller pieces.

  • Break questions into smaller pieces.

  • Test each query.

    • Check the SQL.
    • Look at the data.
    • Check computations
  • Combine into subqueries.

    • Use cut-and-paste to avoid errors.
    • Check for correlated subqueries.
  • Test sample data.

    • Identify different cases.
    • Check final query and subqueries.
    • Verify calculations.




Integer

  • Integer

    • 2 bytes
    • -32768 32767
  • Long

    • 4 bytes
    • +/- 2,147,483,648
  • Single

    • 4 bytes
    • +/- 3.402823 E 38
    • +/- 1.401298 E-45
  • Global, Const, Static



Scope

  • Scope

  • Lifetime

    • When is the variable created, and when is it destroyed?


Wider scope and lifetime

  • Wider scope and lifetime

    • Created at a higher level
      • Form
      • Public module
    • Accessible to any procedure in that form or module.
    • Declare it Global to make it available to any procedure.


Standard Math

  • Standard Math

    • + - * /
    • \ Integer divide
    • ^ Exponentiation
      • (2^3 = 2*2*2 = 8)
    • Mod
      • (15 Mod 4 = 3) (12 + 3 = 15)


Numeric

  • Numeric

    • Exp, Log
    • Atn, Cos, Sin, Tan
    • Sqr
    • Abs
    • Sgn
    • Int, Fix
    • Rnd, Randomize


Date, Now, Time

  • Date, Now, Time

  • DateAdd, DateDiff



Variant

  • Variant

    • IsDate
    • IsNumeric
    • VarType
    • IsEmpty
    • IsNull


Stop

  • Stop

  • Ctrl-Break

  • F5: Go

  • F8: Step through

  • S-F8: Step over

  • Breakpoints



MsgBox

  • MsgBox

    • Message
    • Type
    • Title
  • Types: Use Constants

    • vbOKOnly vbOKCancel
    • vbAbortRetryIgnore
    • vbYesNoCancel
    • vbYesNo vbRetryCancel


  • Do'stlaringiz bilan baham:
1   ...   6   7   8   9   10   11   12   13   ...   19


Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2017
ma'muriyatiga murojaat qiling