Ïðîãðàììèðîâàíèå >>  Ïîñòðîåíèå çàïðîñîâ sql 

1 ... 93 94 95 [ 96 ] 97 98 99 ... 101


Òàáëèöà À.8 - Äàííûå òàáëèöû PaySumma

PAYFACTCD

ACCOUNTCD

GAZSERVICECD

PAYSUM

PAYDATE

PAYMONTH

PAYYEAR

5488

58,70

08.01.2002

2 001

5488

46,00

06.01.2001

2 000

5488

56,00

06.05.1999

1 999

115705

40,00

10.02.2000

2 000

115705

250,00

03.10.2001

2 001

136160

20,00

13.06.2001

2 001

136160

56,00

12.02.1999

1 999

136169

20,00

22.06.2001

2 001

80047

80,00

26.11.1998

1 998

80047

80,00

21.11.2001

2 001

80270

46,00

03.01.2002

2 001

80613

56,00

19.07.2001

2 001

115705

250,00

06.10.2000

2 000

115705

58,70

04.09.2001

2 001

136169

58,70

01.12.2001

2 001

443069

80,00

03.10.2001

2 001

443069

38,50

13.09.2001

2 001

136160

18,30

05.02.1998

1 998

15527

28,32

03.08.1998

1 998

80047

19,56

02.04.1998

1 998

80613

10,60

03.10.1998

1 998

443069

38,28

04.02.1999

1 998

15527

38,32

07.05.1999

1 999

115705

37,15

04.11.1999

1 999

80613

12,60

20.09.2000

2 000

136169

25,32

03.02.1999

1 999

80270

57,10

05.03.1998

1 998

136159

8,30

10.09.1999

1 999

5488

62,13

03.05.2000

2 000

115705

37,80

12.07.2001

2 001

443690

17,80

10.07.1998

1 998

80047

22,56

25.06.1999

1 999

126112

15,30

08.09.2000

2 000

80047

32,56

18.10.2001

2 001

80613

12,60

22.05.1998

1 998

115705

37,15

23.12.1999

1 999

80270

58,10

07.01.2001

2 000

136169

28,32

08.02.2001

2 001

15527

18,32

18.03.1998

1 998

443690

21,67

10.04.1999

1 999

80613

22,86

04.05.2000

2 000

80270

60,10

07.06.2001

2 001

136169

28,32

05.03.1998

1 998

80047

22,20

10.08.1999

1 999

126112

25,30

10.09.2001

2 001

443069

38,32

09.10.2001

2 001

136159

8,30

14.11.1998

1 998

115705

37,15

10.08.1999

1 999

136160

18,30

07.01.2001

2 000



Ïðèëîæåíèå Á Ñêðèïò äëÿ ñîçäàíèÿ ó÷åáíîé áàçû äàííûõ

SET SQL DIALECT 3;

CREATE DATABASE C:\SQLLAB.FDB USER SYSDBA PASSWORD masterkey

PAGESIZE 4096 DEFAULT CHARACTER SET WIN1251;

/ùßë ùßë ùßë ùßë ùßë ùßë ùßë ùßë ùßë ùßë ùßë ùßë ùßë ùßë ùßë ùßë ùßë ùßë ùßë ùßë ùßë ùßë ùßë ùßë ùßë ùßë ùßë ùßë ùßë ùßë ùßë ùßë ùßë ùßë ùßë ùßë ùßë ùßë ùßë ùßë ùßë ùßë ùßë ùßë ùßë ùßë ùßë ùßë ùßë ùßë ùßë ùßë ùßë ùßë ùßë ùßë ùßë ùßë ùßë ùßë ùßë ùßë ùßë ùßë ùßë I rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 I

/* Domains */

rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 I

CREATE DOMAIN BOOLEAN AS SMALLINT CHECK (VALUE IN (0, 1));

CREATE DOMAIN MONEY AS NUMERIC(15,2); CREATE DOMAIN TMONTH AS SMALLINT CHECK (VALUE BETWEEN 1 AND 12);

CREATE DOMAIN PKFIELD AS INTEGER; CREATE DOMAIN TYEAR AS SMALLINT CHECK (VALUE BETWEEN 1990 AND 2100);

rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 I

/* Exceptions */

CREATE EXCEPTION INSRESTRICT Îãðàíè÷åíèå äîáàâëåíèÿ çàïèñè â äî÷åðíþþ òàáëèöó;

CREATE EXCEPTION DELRESTRICT Îãðàíè÷åíèå óäàëåíèÿ çàïèñè èç ðîäèòåëüñêîé òàáëèöû;

CREATE EXCEPTION UPDRESTRICT Îãðàíè÷åíèå ìîäèôèêàöèè çàïèñè â ðîäèòåëüñêîé òàáëèöå;

rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 I

/* Tables */

rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 rf9 I

CREATE TABLE STREET (

STREETCD PKFIELD NOT NULL PRIMARY KEY, STREETNM VARCHAR(30) );

CREATE TABLE SERVICES (

GAZSERVICECD PKFIELD NOT NULL PRIMARY KEY, GAZSERVICENM VARCHAR(30) );

CREATE TABLE DISREPAIR (

FAILURECD PKFIELD NOT NULL PRIMARY KEY, FAILURENM VARCHAR(50) );

CREATE TABLE EXECUTOR (

EXECUTORCD PKFIELD NOT NULL PRIMARY KEY, FIO VARCHAR(20) );

CREATE TABLE ABONENT (

ACCOUNTCD VARCHAR(6) NOT NULL PRIMARY KEY, STREETCD PKFIELD REFERENCES STREET



ON DELETE SET NULL ON UPDATE CASCADE, HOUSENO SMALLINT,

FLATNO SMALLINT, FIO VARCHAR(20), PHONE VARCHAR(15)); CREATE TABLE NACHISLSUMMA (

NACHISLFACTCD PKFIELD NOT NULL PRIMARY KEY, ACCOUNTCD VARCHAR(6) NOT NULL REFERENCES ABONENT

ON UPDATE CASCADE, GAZSERVICECD PKFIELD NOT NULL REFERENCES SERVICES

ON UPDATE CASCADE, NACHISLSUM MONEY,

NACHISLMONTH TMONTH, NACHISLYEAR TYEAR); CREATE TABLE PAYSUMMA ( PAYFACTCD PKFIELD NOT NULL PRIMARY KEY, ACCOUNTCD VARCHAR(6) NOT NULL REFERENCES ABONENT ON UPDATE CASCADE,

GAZSERVICECD PKFIELD NOT NULL REFERENCES SERVICES

ON UPDATE CASCADE,

PAYSUM MONEY,

PAYDATE DATE, PAYMONTH TMONTH, PAYYEAR TYEAR);

CREATE TABLE REQUEST (

REQUESTCD PKFIELD NOT NULL PRIMARY KEY,

ACCOUNTCD VARCHAR(6) REFERENCES ABONENT

ON DELETE SET NULL ON UPDATE CASCADE, EXECUTORCD PKFIELD REFERENCES EXECUTOR

ON DELETE SET NULL ON UPDATE CASCADE, FAILURECD PKFIELD REFERENCES DISREPAIR

ON DELETE SET NULL ON UPDATE CASCADE, INCOMINGDATE DATE,

EXECUTIONDATE DATE, EXECUTED BOOLEAN);

/i /

/* Insert STREET */

/i /

INSERT INTO STREET (STREETCD, STREETNM) VALUES (3, ÂÎÉÊÎÂ ÏÅÐÅÓËÎÊ);

INSERT INTO STREET (STREETCD, STREETNM) VALUES (7, ÊÓÒÓÇÎÂÀ ÓËÈÖÀ);

INSERT INTO STREET (STREETCD, STREETNM) VALUES (6,

ÌÎÑÊÎÂÑÊÀß ÓËÈÖÀ);



1 ... 93 94 95 [ 96 ] 97 98 99 ... 101

© 2006 - 2024 pmbk.ru. Ãåíåðàöèÿ ñòðàíèöû: 0
Ïðè êîïèðîâàíèè ìàòåðèàëîâ ïðèâåòñòâóþòñÿ ññûëêè.
ßíäåêñ.Ìåòðèêà