From 8f89a1c35ab948771ca3fd575b7c83ea6cae5e24 Mon Sep 17 00:00:00 2001 From: Maciekxdabu <40292375+Maciekxdabu@users.noreply.github.com> Date: Wed, 7 Dec 2022 12:14:11 +0100 Subject: [PATCH] more data generation --- SQL stuff/generate_lab-4.sql | 47 +++++++++++++++++++++++++++++++++--- 1 file changed, 43 insertions(+), 4 deletions(-) diff --git a/SQL stuff/generate_lab-4.sql b/SQL stuff/generate_lab-4.sql index a9810658..0a316405 100644 --- a/SQL stuff/generate_lab-4.sql +++ b/SQL stuff/generate_lab-4.sql @@ -1,12 +1,51 @@ ---truncate table competition;-- +truncate table stadium;-- +truncate table competition;-- + +--create table countryTable (Cname varchar(20)) +-- +--insert into table countryTable values('Poland') +--insert into table countryTable values('England') +--insert into table countryTable values('USA') +--insert into table countryTable values('Brazil') +--insert into table countryTable values('France') insert into competition select - level +(select max(id) from competition) as id, - DBMS_RANDOM.value(10,100) as prize, + level +(select nvl(max(id),0) from competition) as id, + DBMS_RANDOM.value(0,1000000) as prize, dbms_random.string('A', 6) as country, +-- (select Cname from countryTable order by random() limit 1) as country, DBMS_RANDOM.value(1,5) as reputation --into competionTemp from dual connect by level <=10 ---generate 10 records \ No newline at end of file +--generate 10 records +; + +inster into club + select + level +(select nvl(max(id),0) from competition) as id, + DBMS_RANDOM.value(0,1000000) as prize, + dbms_random.string('A', 6) as country, +-- (select Cname from countryTable order by random() limit 1) as country, + DBMS_RANDOM.value(1,5) as reputation +--into competionTemp +from dual +connect by level <=10 +--generate 10 records +; + +insert into stadium + select + level +(select nvl(max(id),0) from stadium) as id, + DBMS_RANDOM.value(0,40000) as capacity, + DBMS_RANDOM.value(1,5) as reputation, + dbms_random.string('A', 6) as location, + DBMS_RANDOM.value(1900,2100) as build_year, + DBMS_RANDOM.value(0,1000000) as value, + DBMS_RANDOM.value(0,200) as ticket_price, + level +(select nvl(max(id),0) from stadium) as club_id +from dual +connect by level <=10 +--generate 10 records +; \ No newline at end of file