*   >> Lese Utdanning Artikler >> science >> programming

A Trigger Eksempel på Sybase SQL Anywhere

t ny tabell ved å skrive og kjøre følgende (sletter alt var i SQL-setninger ruten først): CREATE TABLE Produkter (ProductID SMALLINT DEFAULT AUTOINCREMENT, Product CHAR (40) INDEX, Kategori CHAR (30) INDEX, ANTALL heltall, ReorderLevel heltall, kostpris Numerisk (19,2), SellingPrice Numerisk (19,2), PRIMARY KEY (ProductID ASC)); - Sette inn data i den Products bordet med følgende utsagn: INSERT INTO Products (Product, Kategori, Antall, ReorderLevel, kostpris, SellingPrice) VALUES ('Pen', 'kontor', '150', '20', '0,5', '0,75'); INSERT INTO Products (Product, Kategori, Antall, ReorderLevel, kostpris, SellingPrice) VERDIER ('bøker', 'kontor', '500', '25', '3', '4'); INSERT INTO Products (Product, Kategori, Antall, ReorderLevel, kostpris, SellingPrice) VERDIER ('Bowl', 'husholdning', '175', '30', '2', '3'); Sett inn i Products (Product, Kategori, Antall, ReorderLevel, kostpris, SellingPrice) VERDIER ('Spoon', 'husholdning', '300', '35', '0,2' 'en.

'); INSERT INTO Products (Product, Kategori, Antall, ReorderLevel, kostpris, SellingPrice) VERDIER ('Plate', 'husholdning', '450', '40', '1', '1,25'); Sett inn i Products (Product, Kategori, Antall, ReorderLevel, kostpris, SellingPrice) VERDIER ('TV Set "," Entertainment "," 160 "," 45 "," 25 "," 30'); INSERT INTO Products (Product, Kategori, Antall, ReorderLevel, kostpris, SellingPrice) VERDIER ('VCD', 'Entertainment', '200', '50', '20', '25'); INSERT INTO Products (Product, Kategori, Antall, ReorderLevel, kostpris, SellingPrice) VERDIER ('clothe Box "," husholdning "," 250 "," 55 "," 16 "," 21'); Sett inn i Products (Product, Kategori, Antall, ReorderLevel, kostpris, SellingPrice) VERDIER ('Perfume', 'skjønnhet', '258', '60', '2', '3'); INSERT INTO Products (Product, Kategori, Antall, ReorderLevel, kostpris, SellingPrice) VERDIER ('Banana', 'Fruit "," 205 "," 65 "," 5 "," 7'); INSERT INTO Products (Product, Kategori, Antall, ReorderLevel, kostpris, SellingPrice) VERDIER ('pære', 'Fruit "," 150 "," 70 "," 3 "," 4'); - Nå skriver du følgende for å opprette tabellen manager tabellen (slette noen tidligere skrevet uttalelse): CREATE TABLE Manager (eventid INTEGER DEFAULT AUTOINCREMENT, DateAndTime TIMESTAMP STANDARD TIMESTAMP, Product CHAR (40), EventMessage CHAR (60) STANDARD "har gått under omorganisere nivå ", ReorderLevel heltall, Current heltall, PRIMARY KEY (eventid ASC)); Legg merke til at standard meldings strengen er i enkle anførselstegn.

- Nå, lese og skrive følgende for å opprette en trigger (slette noen tidl

Page   <<  [1] [2] [3] [4] >>
Copyright © 2008 - 2016 Lese Utdanning Artikler,https://utdanning.nmjjxx.com All rights reserved.