Error ORA-02291: integrity constraint - sql

I keep getting this error when trying to populate my DB tables.
This is the code to create my tables:
CREATE table tbcustomer (
customerid char(4) not null constraint rg_customerid check (customerid between '1000' and '4999') constraint pk_customer primary key,
customername varchar2(40) not null,
customeraddress varchar2(50) null,
customercity varchar2(30) null,
customerstate char(2) null,
customerzip varchar2(10) null,
customercontact varchar2(30) null,
customerphone varchar2(12) null,
customeremail varchar2(50) null);
CREATE table tborder (
orderno number(11,0) not null constraint pk_order primary key,
orderdate date not null,
customerid char(4) not null constraint fk_customerid_tborder references tbcustomer on delete cascade);
CREATE table tbproduct (
productid char(3) not null constraint pk_product primary key constraint rg_productid check (productid between '100' and '999'),
productname varchar2(30) not null,
budgetsales number(4,0));
CREATE table tbvendor (
vendorid char(4) not null constraint pk_vendor primary key constraint rg_vendorid check (vendorid between '5000' and '9999'),
vendorname varchar2(25) not null,
vendoraddress varchar2(50) null,
vendorcity varchar2(30) null,
vendorstate char(2) null,
vendorzip varchar2(10) null);
CREATE table tbitem (
productid char(4) not null,
vendorid char(4) not null,
itemprice number(10,2) null constraint rg_itemprice check (itemprice>=0.00),
qoh number(8,0) not null,
constraint fk_productid_tbitem foreign key (productid) references tbproduct (productid),
constraint fk_vendorid foreign key (vendorid) references tbvendor (vendorid),
constraint pk_item primary key (productid, vendorid));
CREATE table tborderitem (
orderno number(11,0) not null constraint fk_orderno_tbborderitem references tborder (orderno) on delete cascade,
orderitemno char(2) not null,
productid char(3) not null,
vendorid char(4) not null,
quantity number(4,0) not null,
itemprice number(10,2) null,
constraint pk_orderitem primary key (orderno, orderitemno));
constraint fk_productid_vendorid foreign key (productid, vendorid) references tbitem (productid, vendorid) on delete cascade);
And this the code I use to populate my tables:
INSERT into tbcustomer values ('1123','Z Best','123 Main Street','Cambridge','MA','02139','Carol Jenkins','617-555-2222','jenskinssc#abc.com');
INSERT into tbcustomer values ('1234','Pop Shop','2233 Spring Street','Boston','MA','02114','Mandy Peters','617-344-1111','mpeters#def.com');
INSERT into tbcustomer values ('1667','Zoom','4545 Winter Street','Boston','MA','02112','James Hughes','617-433-3333','jhughes#zoomco.com');
INSERT into tbvendor values ('5100','Wesell','233 South Willow Street','Manchester','NH','03102');
INSERT into tbvendor values ('5200','Givin', '33 Harvard Place','Boston','MA','02211');
INSERT into tbvendor values ('5300','Z A List','4500 Summer Street','Quincy','MA','02161');
INSERT into tbproduct values ('100','Microwave','40');
INSERT into tbproduct values ('121','Toaster','30');
INSERT into tbproduct values ('434','Steamer','40');
INSERT into tbproduct values ('677','Coffee Maker','20');
INSERT into tborder values ('1','10-OCT-12','1667');
INSERT into tborder values ('2','12-OCT-12','1234');
INSERT into tborder values ('3','13-OCT-12','1667');
INSERT into tbitem values ('100','5100','55','22');
INSERT into tbitem values ('100','5200','66','20');
INSERT into tbitem values ('100','5300','70','35');
INSERT into tbitem values ('121','5100','12','20');
INSERT into tbitem values ('121','5300','15','15');
INSERT into tbitem values ('434','5100','18','35');
INSERT into tbitem values ('434','5200','25','25');
INSERT into tbitem values ('677','5100','40','20');
INSERT into tbitem values ('677','5200','46','30');
INSERT into tbitem values ('677','5300','48','20');
INSERT into tborderitem values ('1','01','100','5300','5','70');
INSERT into tborderitem values ('1','02','100','5100','5','55');
INSERT into tborderitem values ('1','03','121','5100','5','12');
INSERT into tborderitem values ('2','01','100','5200','10','65');
INSERT into tborderitem values ('2','02','677','5300','5','48');
INSERT into tborderitem values ('3','01','121','5100','5','12');
INSERT into tborderitem values ('3','02','677','5300','3','45');
INSERT into tborderitem values ('3','03','100','5100','2','55');
When I run the script I keep getting this error when inserting values to the tbitem table:
60-SQL>INSERT into tbitem values ('677','5300','48','20');
INSERT into tbitem values ('677','5300','48','20')
*
ERROR at line 1:
ORA-02291: integrity constraint (MQUIJANO.FK_PRODUCTID_TBITEM) violated -parent key not found
I also get the same error when trying to insert values into the tborderitem:
60-SQL>INSERT into tborderitem values ('1','01','100','5300','5','70');
INSERT into tborderitem values ('1','01','100','5300','5','70')
*
ERROR at line 1:
ORA-02291: integrity constraint (MQUIJANO.FK_PRODUCTID_VENDORID) violated -parent key not found
How can I fix this?

The problem may be that you do not have the same field types for your keys in the first example. Notice that in tbproduct you said:
productid char(3)
And in tbitem you said:
productid char(4)
And again in border item you said:
productid char(3)
Try changing the tbitem table to have productid with a length of 3.

Related

Getting duplicate data when using the select statements

I'm getting duplicate data when trying to use the select statements, I have 9 rooms but I'm getting around 50-70 rooms when trying to display them. Help please?
I'm trying to insert data and display it using the select statement.
create table gym (
GymName VARCHAR(200) primary key,
openTime time not null,
closeTime time not null,
Price decimal not null,
);
create table Spa (
spaName VARCHAR(200) primary key,
openTime time not null,
closeTime time not null,
Price decimal not null,
);
create table customer (
CustomerID int primary key,
Firstname varchar(200) not null,
LastName varchar(200) not null,
DOB date not null check (DATEDIFF(year,DOB,getdate ()) > 18) ,
Gender char(4) not null check(Gender ='M' or Gender = 'F'),
Address varchar(200) not null default 'Jordan',
spaName VARCHAR(200) foreign key references Spa(spaName),
GymName VARCHAR(200) foreign key references gym(GymName),
);
Create table CustomerPhoNo (
CustomerID int foreign key references customer(CustomerID),
PhoneNo bigint not null,
);
create table Room (
roomNo int primary key,
Availability char(4) not null,
NoOfBeds int not null,
Rate int not null,
CheckIn date,
CheckOut date,
Price Decimal not null,
Breakfast char(4),
CustomerID int foreign key references customer(CustomerID),
);
create table LocationOfRoom (
roomNo int foreign key references Room(roomNo),
seaview char(4),
Location varchar(20) not null,
);
create table RoomType (
roomNo int foreign key references Room(roomNo),
familyRoom char(4),
doubleRoom char(4),
singleRoom char(4),
);
create table Gservice (
GymName VARCHAR(200) foreign key references gym(GymName),
Service VARCHAR(500) not null,
MachineType VARCHAR(500) not null,
);
create table PaymentCard (
CardID int primary key,
issueDate date not null,
Expirydate date not null,
CustomerID int foreign key references customer(CustomerID),
);
insert into customer values (325,'Mohammad','Alasharan','06-04-1984','M','Amman', 'BeautySpa', 'StrongBody')
insert into customer values (348,'John','Shelby','10-18-1998','M','Birmingham', 'LushLife', 'SilverGym')
insert into customer values (495,'Thomas','Hoffman','04-26-1968','M','Johannesburg', 'RelaxationTherapy', 'SilverGym')
insert into customer values (194,'Anne','Frank','07-22-2001','F','Frankfurt', 'BeautySpa', 'StrongBody')
insert into customer values (628,'Katie','Swan','02-10-1997','F','New South Wales', 'LushLife', 'FitnessHeroes')
insert into customer values (246,'Mahmoud','Alkutaifan','04-21-1994','M','Amman', 'BeautySpa', 'FitnessHeroes')
insert into customer values (864,'Karl-Heinz','Rummenigge','09-25-1955','M','Lippstadt', 'RelaxationTherapy', 'FitnessHeroes')
insert into customer values (824,'Dennis','Law','09-21-1979','M','london', 'RelaxationTherapy', 'FitnessHeroes')
insert into customer values (463,'Carles','Puyol','06-17-1973','M','madrid', 'LushLife', 'FitnessHeroes')
insert into Room values (124,'yes','1','4',null,null,'30','yes',null)
insert into Room values (135,'no','2','5','05-06-2022','05-09-2022','55','yes',495)
insert into Room values (121,'yes','1','3',null,null,'40','yes',null)
insert into Room values (139,'no','3','4','05-10-2022','05-14-2022','110','no',194)
insert into Room values (131,'no','3','3','05-18-2022','05-22-2022','130','yes',348)
insert into Room values (136,'no','4','4','04-14-2022','04-24-2022','120','yes',194)
insert into Room values (179,'yes','4','5',null,null,'95','no',null)
insert into Room values (138,'no','3','3','04-02-2022','04-06-2022','75','no',246)
insert into Room values (146,'no','3','5','05-10-2022','05-14-2022','80','yes',864)
insert into LocationOfRoom values (124,'no','south')
insert into LocationOfRoom values (135,'yes','north')
insert into LocationOfRoom values (121,'yes','south')
insert into LocationOfRoom values (139,'no','north')
insert into LocationOfRoom values (131,'no','East')
insert into LocationOfRoom values (136,'yes','west')
insert into LocationOfRoom values (179,'no','south')
insert into LocationOfRoom values (138,'no','west')
insert into LocationOfRoom values (146,'yes','north')
insert into RoomType values (124,'no','no','yes')
insert into RoomType values (135,'no','yes','no')
insert into RoomType values (121,'yes','no','no')
insert into RoomType values (139,'no','no','yes')
insert into RoomType values (131,'no','no','yes')
insert into RoomType values (136,'no','no','yes')
insert into RoomType values (179,'no','no','yes')
insert into RoomType values (138,'no','yes','no')
insert into RoomType values (146,'no','no','yes')
-- display Total number of customers who booked a single room with sea view option
select count(Firstname)
from LocationOfRoom, customer, RoomType, Room
where seaview='yes' and singleRoom='yes'
Any help would be greatly appreciated, thank you in advance!
Your FROM clause is missing the join condition for each table. In other words you are getting the cartesian product (every combination of rows) of the tables. Even distinct won't help (it will get the wrong answer). Use join conditions to link the keys of each table to each other. I'll leave this an exercise for you to try out, but this should be enough information to help you out.
I believe the solution for your problem is that you need to use DISTINCT:
SELECT COUNT(DISTINCT(Firstname))
FROM LocationOfRoom, customer, RoomType, Room
WHERE seaview='yes' AND singleRoom='yes'
I have tested it and it retrieves 9 Rooms.

ERROR = SQL state: 42703 while trying to insert data into my table

I have a SQL state:
42703 ERROR (ERROR: column "datereq" of relation "eventrequest" does not exist)
while trying to insert data into my table. But I don't see any issue. Can you please help? It is the DATEREQ values that don't seem to match with the DateReq column in the "eventrequest" table.
Below is the code I have written
Table:
CREATE TABLE EventRequest
(EventNo VARCHAR(8) CONSTRAINT EventNoNotNull NOT NULL,
DateHeld DATE CONSTRAINT DateHeldNotNull NOT NULL,
DateReq DATE CONSTRAINT DATEREQNotNull NOT NULL,
CustNo VARCHAR(8) CONSTRAINT CustNoNotNull NOT NULL,
FacNo VARCHAR(8) CONSTRAINT FacNoNotNull NOT NULL,
DateAuth DATE,
Status VARCHAR(10) CONSTRAINT StatusNotNull NOT NULL CHECK (Status IN('pending','Denied','Approved')),
EstCost DECIMAL(12,2) CONSTRAINT EstCostNotNull NOT NULL,
EstAudience INTEGER CONSTRAINT EstAudienceNotNull NOT NULL CHECK (EstAudience>0),
BudNo VARCHAR(10),
CONSTRAINT PK_EVENTREQUEST PRIMARY KEY (EventNo),
CONSTRAINT FK_FACNO FOREIGN KEY (FacNo)
REFERENCES FACILITY (FacNo),
CONSTRAINT FK_CUSTNO FOREIGN KEY (CustNo)
REFERENCES CUSTOMER (CustNo) );
Data input:
Insert into EVENTREQUEST (EVENTNO,DATEHELD,DATEREQ,CUSTNO,FACNO,DATEAUTH,STATUS,ESTCOST,ESTAUDIENCE,BUDNO) values ('E100','2018-10-25','2018-06-06','C100','F100','2018-06-08','Approved',5000,80000,'B1000');
Insert into EVENTREQUEST (EVENTNO,DATEHELD,DATEREQ,CUSTNO,FACNO,DATEAUTH,STATUS,ESTCOST,ESTAUDIENCE,BUDNO) values ('E101','2018-10-26','2018-07-28','C100','F100',NULL,'Pending',5000,80000,'B1000');
Insert into EVENTREQUEST (EVENTNO,DATEHELD,DATEREQ,CUSTNO,FACNO,DATEAUTH,STATUS,ESTCOST,ESTAUDIENCE,BUDNO) values ('E103','2018-09-21','2018-07-28','C100','F100','2018-08-01','Approved',5000,80000,'B1000');
Insert into EVENTREQUEST (EVENTNO,DATEHELD,DATEREQ,CUSTNO,FACNO,DATEAUTH,STATUS,ESTCOST,ESTAUDIENCE,BUDNO) values ('E102','2018-09-14','2018-07-28','C100','F100','2018-07-31','Approved',5000,80000,'B1000');
Insert into EVENTREQUEST (EVENTNO,DATEHELD,DATEREQ,CUSTNO,FACNO,DATEAUTH,STATUS,ESTCOST,ESTAUDIENCE,BUDNO) values ('E104','2018-12-03','2018-07-28','C101','F101','2018-07-31','Approved',2000,12000,'B1000');
Insert into EVENTREQUEST (EVENTNO,DATEHELD,DATEREQ,CUSTNO,FACNO,DATEAUTH,STATUS,ESTCOST,ESTAUDIENCE,BUDNO) values ('E105','2018-12-05','2018-07-28','C101','F101','2018-08-01','Approved',2000,10000,'B1000');
Insert into EVENTREQUEST (EVENTNO,DATEHELD,DATEREQ,CUSTNO,FACNO,DATEAUTH,STATUS,ESTCOST,ESTAUDIENCE,BUDNO) values ('E106','2018-12-12','2018-07-28','C101','F101','2018-07-31','Approved',2000,10000,'B1000');
Insert into EVENTREQUEST (EVENTNO,DATEHELD,DATEREQ,CUSTNO,FACNO,DATEAUTH,STATUS,ESTCOST,ESTAUDIENCE,BUDNO) values ('E107','2018-11-23','2018-07-28','C105','F100','2018-07-31','Denied',10000,5000,null);

Error ORA-02291: Integrity Constraint - 1:1 instead of 1:M?

I see that the parent key isn't found. In my case, both FK_PLAYERTEAM and FK_PLAYERPOSITION. I noticed that everywhere I see this error, it's an order of operations mistake. The values for position, or team id were not entered in before entering or referencing those values in the Player table. It seems in my case, that once there are 14 players entered, the same amount of teams there are, that I can no longer enter any more players.
So do I have a one to one rather than a one a to many relationship here? Please review my work! I'm new, doing this for my summer class project.
/*CITY TABLE*/
DROP TABLE CITY;
CREATE TABLE CITY (
ID int NOT NULL PRIMARY KEY,
NAME varchar2(255) NOT NULL,
STATE varchar2(255) NOT NULL,
COUNTRY varchar2(100) default 'USA'
);
/*SEASON TABLE*/
DROP TABLE SEASON;
CREATE TABLE SEASON (
ID int NOT NULL PRIMARY KEY,
YEAR varchar2(4) NOT NULL
);
/*POSITION TABLE*/
DROP TABLE POSITION;
CREATE TABLE POSITION (
ID int NOT NULL PRIMARY KEY,
NAME varchar2(255) NOT NULL,
NAME_ABR varchar2(3) NOT NULL,
CATEGORY varchar2(255) NOT NULL
);
/*TEAM TABLE*/
DROP TABLE TEAM;
CREATE TABLE TEAM (
ID int NOT NULL PRIMARY KEY,
NAME varchar2(255) DEFAULT 'FREE AGENT',
SHORT_NAME varchar2(3) NOT NULL,
COACH_NAME varchar2(255) NULL,
CITY_ID int NULL,
CONSTRAINT FK_TEAMCITY FOREIGN KEY (ID) REFERENCES CITY(ID)
);
*/PLAYER TABLE*/
DROP TABLE PLAYER;
CREATE TABLE PLAYER (
ID int NOT NULL PRIMARY KEY,
FIRSTNAME varchar2(255) NOT NULL,
LASTNAME varchar2(255) NOT NULL,
DATE_OF_BIRTH varchar2(255) NOT NULL,
PLAYER_NUM int NOT NULL,
COUNTRY varchar2(3) DEFAULT 'USA',
TEAM_ID int NULL,
CONSTRAINT FK_PLAYERTEAM
FOREIGN KEY (ID) REFERENCES TEAM(ID),
POSITION_ID int NULL,
CONSTRAINT FK_PLAYERPOSITION
FOREIGN KEY (ID) REFERENCES POSITION(ID)
);
/*MATCH TABLE*/
DROP TABLE MATCH;
CREATE TABLE MATCH (
ID int NOT NULL PRIMARY KEY,
GAME_DAY date NOT NULL,
GAME_TIME timestamp NOT NULL,
WIN_TEAM int NULL,
CONSTRAINT FK_WIN_TEAM
FOREIGN KEY (WIN_TEAM) REFERENCES TEAM(ID),
HOME_TEAM int NOT NULL,
CONSTRAINT FK_HOME_TEAM
FOREIGN KEY (HOME_TEAM) REFERENCES TEAM(ID),
AWAY_TEAM int NOT NULL,
CONSTRAINT FK_AWAY_TEAM
FOREIGN KEY (AWAY_TEAM) REFERENCES TEAM(ID),
SEASON_ID int NOT NULL,
CONSTRAINT FK_SEASON_ID
FOREIGN KEY (SEASON_ID) REFERENCES SEASON(ID)
);
/*GOALS TABLE*/
DROP TABLE GOALS;
CREATE TABLE GOALS (
ID int NOT NULL,
MINUTE int NOT NULL,
MATCH_ID int NOT NULL,
CONSTRAINT FK_GOALS_MATCH
FOREIGN KEY (MATCH_ID) REFERENCES MATCH(ID),
PLAYER_ID int NOT NULL,
CONSTRAINT FK_GOALS_PLAYER
FOREIGN KEY (PLAYER_ID) REFERENCES PLAYER(ID)
);
As i enter values here is my order.
/*CITY POPULATE*/
INSERT INTO CITY (ID,NAME,STATE,COUNTRY) VALUES ('1','Springfield','MA','USA');
INSERT INTO CITY (ID,NAME,STATE,COUNTRY) VALUES ('2','Toledo','OH','USA');
INSERT INTO CITY (ID,NAME,STATE,COUNTRY) VALUES ('3','New Orleans','LA','USA');
INSERT INTO CITY (ID,NAME,STATE,COUNTRY) VALUES ('4','Erie','PA','USA');
INSERT INTO CITY (ID,NAME,STATE,COUNTRY) VALUES ('5','Dallas','TX','USA');
INSERT INTO CITY (ID,NAME,STATE,COUNTRY) VALUES ('6','Denver','CO','USA');
INSERT INTO CITY (ID,NAME,STATE,COUNTRY) VALUES ('7','Reno','NV','USA');
INSERT INTO CITY (ID,NAME,STATE,COUNTRY) VALUES ('8','Scranton','PA','USA');
INSERT INTO CITY (ID,NAME,STATE,COUNTRY) VALUES ('9','Virginia Beach','VA','USA');
INSERT INTO CITY (ID,NAME,STATE,COUNTRY) VALUES ('10','Green Bay','WI','USA');
INSERT INTO CITY (ID,NAME,STATE,COUNTRY) VALUES ('11','Atlanta','GA','USA');
INSERT INTO CITY (ID,NAME,STATE,COUNTRY) VALUES ('12','Columbus','OH','USA');
INSERT INTO CITY (ID,NAME,STATE,COUNTRY) VALUES ('13','Orlando','FL','USA');
INSERT INTO CITY (ID,NAME,STATE,COUNTRY) VALUES ('14','Austin','TX','USA');
/*SEASON POPULATE*/
INSERT INTO SEASON (ID,YEAR) VALUES (1,2013);
INSERT INTO SEASON (ID,YEAR) VALUES (2,2014);
INSERT INTO SEASON (ID,YEAR) VALUES (3,2015);
INSERT INTO SEASON (ID,YEAR) VALUES (4,2016);
INSERT INTO SEASON (ID,YEAR) VALUES (5,2017);
INSERT INTO SEASON (ID,YEAR) VALUES (6,2018);
/*POSITION POPULATE*/
INSERT INTO POSITION
VALUES ('1','GoalKeeper','GK','GoalKeeper');
INSERT INTO POSITION
VALUES ('2','Sweeper','SW','Defender');
INSERT INTO POSITION
VALUES ('3','Centerback','CB','Defender');
INSERT INTO POSITION
VALUES ('4','Leftback','LB','Defender');
INSERT INTO POSITION
VALUES ('5','Rightback','RB','Defender');
INSERT INTO POSITION
VALUES ('6','Left-Wingback','LWB','Defender');
INSERT INTO POSITION
VALUES ('7','Right-Wingback','RWB','Defender');
INSERT INTO POSITION
VALUES ('8','Defending Midfielder','DM','Midfielder');
INSERT INTO POSITION
VALUES ('9','Central Midfielder','CM','Midfielder');
INSERT INTO POSITION
VALUES ('10','Attacking Midfielder','AM','Midfielder');
INSERT INTO POSITION
VALUES ('11','Left Winger','LW','Midfielder');
INSERT INTO POSITION
VALUES ('12','Right Winger','RW','Midfielder');
INSERT INTO POSITION
VALUES ('13','Center Forward','CF','Forward');
INSERT INTO POSITION
VALUES ('14','Withdrawn Forward','WF','Forward');
INSERT INTO POSITION
VALUES ('15','Striker','S','Forward');
/*TEAM POPULATE*/
INSERT INTO TEAM
VALUES ('1','Springfield FC','SFC','Dolan Mcguire','1');
INSERT INTO TEAM
VALUES ('2','Toleda Stars FC','TS','Wing Warren','2');
INSERT INTO TEAM
VALUES ('3','Louisiana AF','LAF','Zane Valentine','3');
INSERT INTO TEAM
VALUES ('4','Erie FC','EAF','Brenda Rios','4');
INSERT INTO TEAM
VALUES ('5','FC Dallas','FCD','Mark Horne','5');
INSERT INTO TEAM
VALUES ('6','Colorado Rapids','CR','Brian Cameron','6');
INSERT INTO TEAM
VALUES ('7','Reno 1868 FC','RFC','Russel Klabough','7');
INSERT INTO TEAM
VALUES ('8','Scranton Football','SF','Mark York','8');
INSERT INTO TEAM
VALUES ('9','Beach FC','BFC','Zidane Zidan','9');
INSERT INTO TEAM
VALUES ('10','Green Bay Phoenix','GBP','Shad Ramos','10');
INSERT INTO TEAM
VALUES ('11','Atlanta United FC','AFC','Gernado Martino','11');
INSERT INTO TEAM
VALUES ('12','Columbus Crew SC','CCS','Gregg Berhalter','12');
INSERT INTO TEAM
VALUES ('13','Orlando City SC','OSC','Jason Kreis','13');
INSERT INTO TEAM
VALUES ('14','Austin Aztex','AAX','Adrian Health','14');
INSERT INTO PLAYER (ID,FIRSTNAME,LASTNAME,DATE_OF_BIRTH,PLAYER_NUM,COUNTRY,TEAM_ID,POSITION_ID) VALUES (1,'Ashton','Hewitt','05/07/1991',31,'USA',10,13);
INSERT INTO PLAYER (ID,FIRSTNAME,LASTNAME,DATE_OF_BIRTH,PLAYER_NUM,COUNTRY,TEAM_ID,POSITION_ID) VALUES (2,'Fuller','Farrell','08/12/1987',45,'USA',3,2);
INSERT INTO PLAYER (ID,FIRSTNAME,LASTNAME,DATE_OF_BIRTH,PLAYER_NUM,COUNTRY,TEAM_ID,POSITION_ID) VALUES (3,'Allistair','Mccullough','05/20/1993',20,'USA',5,14);
INSERT INTO PLAYER (ID,FIRSTNAME,LASTNAME,DATE_OF_BIRTH,PLAYER_NUM,COUNTRY,TEAM_ID,POSITION_ID) VALUES (4,'Connor','Caldwell','03/28/1996',66,'USA',14,5);
INSERT INTO PLAYER (ID,FIRSTNAME,LASTNAME,DATE_OF_BIRTH,PLAYER_NUM,COUNTRY,TEAM_ID,POSITION_ID) VALUES (5,'Igor','Britt','09/27/1992',45,'USA',12,11);
INSERT INTO PLAYER (ID,FIRSTNAME,LASTNAME,DATE_OF_BIRTH,PLAYER_NUM,COUNTRY,TEAM_ID,POSITION_ID) VALUES (6,'Cyrus','Barron','10/20/1991',41,'USA',7,1);
INSERT INTO PLAYER (ID,FIRSTNAME,LASTNAME,DATE_OF_BIRTH,PLAYER_NUM,COUNTRY,TEAM_ID,POSITION_ID) VALUES (7,'Quamar','Melendez','09/28/1986',20,'USA',7,15);
INSERT INTO PLAYER (ID,FIRSTNAME,LASTNAME,DATE_OF_BIRTH,PLAYER_NUM,COUNTRY,TEAM_ID,POSITION_ID) VALUES (8,'Dustin','Sandoval','07/05/1987',34,'USA',11,9);
INSERT INTO PLAYER (ID,FIRSTNAME,LASTNAME,DATE_OF_BIRTH,PLAYER_NUM,COUNTRY,TEAM_ID,POSITION_ID) VALUES (9,'Addison','Santana','12/07/1994',17,'USA',8,10);
INSERT INTO PLAYER (ID,FIRSTNAME,LASTNAME,DATE_OF_BIRTH,PLAYER_NUM,COUNTRY,TEAM_ID,POSITION_ID) VALUES (10,'Christian','Murphy','11/06/1986',73,'USA',5,15);
INSERT INTO PLAYER (ID,FIRSTNAME,LASTNAME,DATE_OF_BIRTH,PLAYER_NUM,COUNTRY,TEAM_ID,POSITION_ID) VALUES (11,'Isaiah','Reeves','03/23/1990',59,'USA',1,8);
INSERT INTO PLAYER (ID,FIRSTNAME,LASTNAME,DATE_OF_BIRTH,PLAYER_NUM,COUNTRY,TEAM_ID,POSITION_ID) VALUES (12,'Nero','Luna','03/14/1996',31,'USA',10,4);
INSERT INTO PLAYER (ID,FIRSTNAME,LASTNAME,DATE_OF_BIRTH,PLAYER_NUM,COUNTRY,TEAM_ID,POSITION_ID) VALUES (13,'Deacon','Maddox','05/10/1989',54,'USA',4,5);
INSERT INTO PLAYER (ID,FIRSTNAME,LASTNAME,DATE_OF_BIRTH,PLAYER_NUM,COUNTRY,TEAM_ID,POSITION_ID) VALUES (14,'Macaulay','Velez','07/13/1994',33,'USA',7,15);
INSERT INTO PLAYER (ID,FIRSTNAME,LASTNAME,DATE_OF_BIRTH,PLAYER_NUM,COUNTRY,TEAM_ID,POSITION_ID) VALUES (15,'Jamal','Cox','02/03/1990',44,'USA',12,11);
INSERT INTO PLAYER (ID,FIRSTNAME,LASTNAME,DATE_OF_BIRTH,PLAYER_NUM,COUNTRY,TEAM_ID,POSITION_ID) VALUES (16,'Axel','Dominguez','01/13/1996',15,'USA',3,5);
INSERT INTO PLAYER (ID,FIRSTNAME,LASTNAME,DATE_OF_BIRTH,PLAYER_NUM,COUNTRY,TEAM_ID,POSITION_ID) VALUES (17,'Jakeem','Barlow','03/09/1994',61,'USA',12,6);
INSERT INTO PLAYER (ID,FIRSTNAME,LASTNAME,DATE_OF_BIRTH,PLAYER_NUM,COUNTRY,TEAM_ID,POSITION_ID) VALUES (18,'Mufutau','Hodges','09/09/1987',69,'USA',1,9);
But I end up getting after the 14th line:
ORA-02291: integrity constraint (SQL_DFIJAZERMYRXHWLVJVYDVODHP.FK_PLAYERTEAM) violated - parent key not found ORA-06512: at "SYS.DBMS_SQL", line 1721
ORA-02291: integrity constraint (SQL_DFIJAZERMYRXHWLVJVYDVODHP.FK_PLAYERPOSITION) violated - parent key not found ORA-06512: at "SYS.DBMS_SQL", line 1721
ORA-02291: integrity constraint (SQL_DFIJAZERMYRXHWLVJVYDVODHP.FK_PLAYERPOSITION) violated - parent key not found ORA-06512: at "SYS.DBMS_SQL", line 1721
ORA-02291: integrity constraint (SQL_DFIJAZERMYRXHWLVJVYDVODHP.FK_PLAYERPOSITION) violated - parent key not found ORA-06512: at "SYS.DBMS_SQL", line 1721
You are applying an incorrect foreign key constraint, try this:
CREATE TABLE TEAM (
ID int NOT NULL PRIMARY KEY,
NAME varchar2(255) DEFAULT 'FREE AGENT',
SHORT_NAME varchar2(3) NOT NULL,
COACH_NAME varchar2(255) NULL,
CITY_ID int NULL,
CONSTRAINT FK_TEAMCITY FOREIGN KEY (CITY_ID) REFERENCES CITY(ID)
);

Create view oracle sql

I am making a database with tv-shows and users.
These users can follow each other and are saved in the database by an UserID.
Now I wan't to create a view with the names of the users instead of the UserID's.
--Drop all tables.
DROP TABLE Series CASCADE CONSTRAINTS;
DROP TABLE User1 CASCADE CONSTRAINTS;
DROP TABLE FollowingSeries CASCADE CONSTRAINTS;
DROP TABLE FollowingUser CASCADE CONSTRAINTS;
DROP TABLE Episode CASCADE CONSTRAINTS;
DROP TABLE Watched CASCADE CONSTRAINTS;
DROP VIEW Test CASCADE CONSTRAINTS;
--Create all tables.
CREATE TABLE Series
( SeriesID NUMBER(5) primary key,
Name VARCHAR2(100) NOT NULL,
Status VARCHAR2(20),
Premiered DATE,
Genre VARCHAR2(100),
Country VARCHAR2(100),
Network VARCHAR2(100),
Runtime VARCHAR2(25)
);
CREATE TABLE User1(
UserID NUMBER(5) primary key,
Username VARCHAR2(100) NOT NULL,
Country varchar2(100),
Gender VARCHAR2(10),
Birthday VARCHAR2(100),
About_me VARCHAR2(300),
Password VARCHAR2(100) NOT NULL
);
CREATE TABLE FollowingSeries (
UserID NUMBER(5) NOT NULL,
SeriesID NUMBER(5) NOT NULL,
Ignore1 CHAR(1) DEFAULT 0,
constraint FollowingS_pk primary key(UserID, SeriesID),
constraint FollowingS_fk1 foreign key(UserID) REFERENCES User1(UserID),
constraint FollowingS_fk2 foreign key(SeriesID) REFERENCES Series(SeriesID)
);
CREATE TABLE FollowingUser (
UserID1 NUMBER(5) NOT NULL,
UserID2 NUMBER(5) NOT NULL,
constraint FollowingU_pk primary key(UserID1, UserID2),
constraint FollowingU_fk1 foreign key(UserID1) REFERENCES User1(UserID) ON DELETE SET NULL,
constraint FollowingU_fk2 foreign key(UserID2) REFERENCES User1(UserID) ON DELETE SET NULL
);
CREATE TABLE Episode(
SeriesID NUMBER(5) NOT NULL,
Season NUMBER(2) NOT NULL,
Episode NUMBER(2) NOT NULL,
Name varchar2(100) NOT NULL,
Airdate DATE,
Summary varchar2(1500),
constraint episode_pk primary key(SeriesID, Season, Episode),
constraint episode_fk foreign key(SeriesID) REFERENCES Series(SeriesID) ON DELETE SET NULL
);
CREATE TABLE Watched(
UserID NUMBER(5) NOT NULL,
SeriesID NUMBER(5) NOT NULL,
Season NUMBER(2) NOT NULL,
Episode NUMBER(2) NOT NULL,
constraint watched_pk primary key(UserID, SeriesID, Season, Episode),
constraint watched_fk1 foreign key(UserID) REFERENCES User1(UserID),
constraint watched_fk4 foreign key(SeriesID, Season, Episode) REFERENCES Episode(SeriesID, Season, Episode)
);
--Add users.
INSERT INTO User1 VALUES (1, 'StefPhilipsen', 'Netherlands', 'Male', TO_DATE('02-01-1994','DD-MM-YYYY'), 'Ik ben Stef', 'abcd1234');
INSERT INTO User1 VALUES (2, 'Dorothy142', 'America', 'Female', TO_DATE('01-10-1963','DD-MM-YYYY'), 'I love mountainbiking', 'Oow6sai4Ie');
INSERT INTO User1 VALUES (3, 'Rudo12', 'England', 'Male', TO_DATE('05-6-1985','DD-MM-YYYY'), 'I watched Breaking Bad and a lot more', 'Oph9Ge2yai');
INSERT INTO User1 VALUES (4, 'JohnSmith', 'England', 'Male', TO_DATE('27-9-1945','DD-MM-YYYY'), 'I like potatoes.', 'phiShaip0c');
INSERT INTO User1 VALUES (5, 'EulaWGibson', 'America', 'Female', TO_DATE('12-8-1990','DD-MM-YYYY'), 'I''m Eula. I live in massachusetts and I''m happily married with my husband Hank.', 'EiM5wii2am8');
INSERT INTO User1 VALUES (6, 'Pedro', 'Spain', 'Male', TO_DATE('12-10-1945','DD-MM-YYYY'), 'I love watching Arrow.', 'Gith0yaiw');
INSERT INTO User1 VALUES (7, 'TravisC', 'England', 'Male', TO_DATE('12-7-1970','DD-MM-YYYY'), 'My favorite TV-shows are Modern Family and Dexter.', 'gie9aiPh2Ii');
INSERT INTO User1 VALUES (8, 'DonellaScott', 'America', 'Female', TO_DATE('31-1-1996','DD-MM-YYYY'), 'Living the life.', 'Gued1996');
--Who follows which series.
INSERT INTO FollowingSeries(UserID, SeriesID) VALUES (1,1);
INSERT INTO FollowingSeries(UserID, SeriesID) VALUES (1,2);
INSERT INTO FollowingSeries(UserID, SeriesID) VALUES (1,3);
INSERT INTO FollowingSeries VALUES (1,4,1);
--Who follows who.
INSERT INTO FollowingUser VALUES(1,2);
INSERT INTO FollowingUser VALUES (2,3);
INSERT INTO FollowingUser VALUES (3,4);
INSERT INTO FollowingUser VALUES (1,3);
INSERT INTO FollowingUser VALUES (5,8);
INSERT INTO FollowingUser VALUES (5,6);
INSERT INTO FollowingUser VALUES (6,5);
-- Which episodes are watched by whom.
INSERT INTO Watched VALUES(1, 4, 1, 1);
INSERT INTO Watched VALUES(1, 4, 1, 2);
INSERT INTO Watched VALUES(1, 4, 1, 3);
INSERT INTO Watched VALUES(1, 4, 1, 4);
INSERT INTO Watched VALUES(1, 4, 1, 5);
INSERT INTO Watched VALUES(1, 4, 1, 6);
INSERT INTO Watched VALUES(1, 4, 1, 7);
This is what I tried but then I get an error message
--Create view
CREATE VIEW follownaam AS
SELECT followerUser.Username AS Follower, followingUser.Username AS Following
FROM FollowingUser AS fu
INNER JOIN User1 followerUser ON(fu.UserID1 = followerUser.Username)
INNER JOIN User1 followingUser ON(fu.UserID2 = followingUser.Username)
WHERE fu.UserID1 = 1;
[Err] ORA-00911: invalid character
The table I have exists of 2 UserID's. But now I want exactly the same table, but this view must contain the Usernames of these UserID's.
This should work (although i don't understand why You want a view only for user with ID = 1).
CREATE VIEW follownaam AS
SELECT
followerUser.Username AS Follower, followingUser.Username AS Following
FROM FollowingUser fu
INNER JOIN User1 followerUser ON(fu.UserID1 = followerUser.UserID)
INNER JOIN User1 followingUser ON(fu.UserID2 = followingUser.UserID)
WHERE fu.UserID1 = 1;
I changed Username to UserId because it made much more sense.
Edit:
Here's sqlfiddle i created to test it and it works.

difficulty inserting values in database

I have created my tables as shown below (I am using Oracle XE). The problem that occurs is that when I try to insert values into the tables, I get an error because the value of one's foreign key, has not been entered as a primary key of the other. For example, see tables DEPARTMENT and EMPLOYEE. Below, along with table creation code, is also the data inserting part. How to bypass that problem?
CREATE TABLE DEPARTMENT
(
DNAME VARCHAR(10),
DEPTID INTEGER NOT NULL,
MNG_IDNO INTEGER NOT NULL,
PRIMARY KEY (DEPTID)
);
CREATE TABLE EMPLOYEE
(
IDNO INTEGER NOT NULL,
FNAME VARCHAR(10) NOT NULL,
LNAME VARCHAR(10) NOT NULL,
GENDER VARCHAR(6) NOT NULL,
CITY VARCHAR(20),
AREA VARCHAR(20),
STREET VARCHAR(50),
HOUSENO VARCHAR(4),
ZIPCODE INTEGER,
BIRTHDAY DATE,
SALARY INTEGER,
IBAN VARCHAR(34),
DEPT_ID INTEGER NOT NULL,
PRIMARY KEY (IDNO)
);
CREATE TABLE CUSTOMER
(
IDNO INTEGER NOT NULL,
FNAME VARCHAR(10) NOT NULL,
LNAME VARCHAR(10) NOT NULL,
GENDER VARCHAR(6) NOT NULL,
CITY VARCHAR(20),
AREA VARCHAR(20),
STREET VARCHAR(50),
HOUSENO VARCHAR(4),
ZIPCODE INTEGER,
BIRTHDAY DATE,
PRIMARY KEY (IDNO)
);
CREATE TABLE CAR
(
VIN INTEGER NOT NULL,
BRAND VARCHAR(10) NOT NULL,
MODEL VARCHAR(10) NOT NULL,
COLOR VARCHAR(10) NOT NULL,
TRANTYPE VARCHAR(10) NOT NULL,
FUELTYPE VARCHAR(10) NOT NULL,
ENGCC INTEGER NOT NULL,
ENTRYDATE DATE,
PRICE INTEGER NOT NULL,
PAYMENTMETHOD VARCHAR(10) NOT NULL,
DEPT_ID INTEGER NOT NULL,
CUST_IDNO INTEGER NOT NULL,
PRIMARY KEY (VIN)
);
CREATE TABLE CAR_PARTS
(
PARTNUM VARCHAR(25) NOT NULL,
PARTNAME VARCHAR(25) NOT NULL,
COST INTEGER NOT NULL,
PRIMARY KEY (PARTNUM)
);
CREATE TABLE USED_CAR
(
CAR_VIN INTEGER NOT NULL,
MILEAGE INTEGER NOT NULL,
REGDATE DATE NOT NULL,
PRIMARY KEY (CAR_VIN)
);
CREATE TABLE SERVICE
(
DUE_DATE DATE,
ARR_DATE DATE,
COST INTEGER NOT NULL,
SERVICE_NUM INTEGER NOT NULL,
CUST_IDNO INTEGER NOT NULL,
PAYMENTMETHOD VARCHAR(10) NOT NULL,
CAR_VIN INTEGER NOT NULL,
PRIMARY KEY (SERVICE_NUM)
);
CREATE TABLE CUST_PHONUMBER
(
PHONE_NUM INTEGER NOT NULL,
CUST_IDNO INTEGER NOT NULL,
PHONE_TYPE VARCHAR(10),
PRIMARY KEY (CUST_IDNO, PHONE_NUM)
);
CREATE TABLE CAR_DEFECTS
(
DEFECTS VARCHAR(100) NOT NULL,
CAR_VIN VARCHAR(100) NOT NULL,
PRIMARY KEY (DEFECTS, CAR_VIN)
);
CREATE TABLE EMPLOYEE_PHONUMBER
(
PHONENUM INTEGER NOT NULL,
EMPL_IDNO INTEGER NOT NULL,
PRIMARY KEY (PHONENUM, EMPL_IDNO)
);
CREATE TABLE SERVICE_DETAILS
(
SERVICENUM INTEGER NOT NULL,
PROBLEMS VARCHAR(100) NOT NULL,
SOLUTION VARCHAR(100),
PRIMARY KEY (PROBLEMS, SERVICENUM)
);
CREATE TABLE HAS
(
PART_NUM VARCHAR(25) NOT NULL,
CAR_VIN INTEGER NOT NULL,
PRIMARY KEY (PART_NUM, CAR_VIN)
);
CREATE TABLE USES
(
PART_NUM VARCHAR(25) NOT NULL,
SERVICE_NUM INTEGER NOT NULL,
PRIMARY KEY (PART_NUM, SERVICE_NUM)
);
ALTER TABLE DEPARTMENT ADD FOREIGN KEY (MNG_IDNO) REFERENCES EMPLOYEE(IDNO);
ALTER TABLE EMPLOYEE ADD FOREIGN KEY (DEPT_ID) REFERENCES DEPARTMENT(DEPTID);
ALTER TABLE CAR ADD FOREIGN KEY (DEPT_ID) REFERENCES DEPARTMENT(DEPTID);
ALTER TABLE CAR ADD FOREIGN KEY (CUST_IDNO) REFERENCES CUSTOMER(IDNO);
ALTER TABLE SERVICE ADD FOREIGN KEY (CUST_IDNO) REFERENCES CUSTOMER(IDNO);
ALTER TABLE SERVICE ADD FOREIGN KEY (CAR_VIN) REFERENCES CAR(VIN);
ALTER TABLE USED_CAR ADD FOREIGN KEY (CAR_VIN) REFERENCES CAR(VIN);
ALTER TABLE HAS ADD FOREIGN KEY (PART_NUM) REFERENCES CAR_PARTS(PARTNUM);
ALTER TABLE HAS ADD FOREIGN KEY (CAR_VIN) REFERENCES CAR(VIN);
ALTER TABLE USES ADD FOREIGN KEY (PART_NUM) REFERENCES CAR_PARTS(PARTNUM);
ALTER TABLE USES ADD FOREIGN KEY (SERVICE_NUM) REFERENCES SERVICE(SERVICE_NUM);
ALTER TABLE CUSTOMER_PHONUMBER ADD FOREIGN KEY (CUST_IDNO) REFERENCES CUSTOMER(IDNO);
ALTER TABLE EMPLOYEE_PHONUMBER ADD FOREIGN KEY (EMPL_IDNO) REFERENCES EMPLOYEE(IDNO);
ALTER TABLE SERVICE_DETAILS ADD FOREIGN KEY (SERVICENUM) REFERENCES SERVICE(SERVICE_NUM);
Data Insert:
INSERT INTO EMPLOYEE VALUES (1234,'ANTREAS','GEORGIOU','MALE','NICOSIA','STROVOLOS','PANAYIAS','12',2682,TO_DATE('01.01.1989', 'DD.MM.YYYY'),5000,9999999,1);
INSERT INTO EMPLOYEE VALUES (1235,'KOSTAS', 'KOSTA', 'MALE', 'NICOSIA','STROVOLOS','VIZANTIOU','12',2064,TO_DATE('01.02.1980', 'DD.MM.YYYY'),5000,9999998,2);
INSERT INTO EMPLOYEE VALUES (1236,'MARIA', 'ANTREOU', 'FEMALE', 'NICOSIA','EGKOMI','TSAROU','12',2522,TO_DATE('05.05.1988', 'DD.MM.YYYY'),5000,9999995,3);
INSERT INTO EMPLOYEE VALUES (1237,'GEORGIA', 'ANTREOU', 'FEMALE', 'NICOSIA','EGKOMI','TSAROU','13',2522,TO_DATE('05.05.1978', 'DD.MM.YYYY'),5000,9999996,4);
INSERT INTO DEPARTMENT VALUES ('SERVICE',1,1234);
INSERT INTO DEPARTMENT VALUES ('SALES',2,1235);
INSERT INTO DEPARTMENT VALUES ('ACCOUNTING',3,1236);
INSERT INTO DEPARTMENT VALUES ('MANAGEMENT',4,1237);
INSERT INTO CUSTOMER VALUES (4321, 'ANTREAS', 'ANTREOU','MALE','PAFOS','GEROSKIPOU','VIZANTIOU','3',2525,TO_DATE('04.04.1954','DD.MM.YYYY'));
INSERT INTO CUSTOMER VALUES (4322, 'MARIA', 'ANTREOU','FEMALE','PAFOS','GEROSKIPOU','VIZANTIOU','7',2525,TO_DATE('03.03.1953','DD.MM.YYYY'));
INSERT INTO CUSTOMER VALUES (4323, 'KOSTAS', 'ANTREOU','MALE','PAFOS','GEROSKIPOU','VIZANTIOU','3',2525,TO_DATE('04.04.1970','DD.MM.YYYY'));
INSERT INTO CUSTOMER VALUES (4324, 'ELENA', 'ANTREOU','MALE','PAFOS','GEROSKIPOU','VIZANTIOU','3',2252,TO_DATE('04.04.1985','DD.MM.YYYY'));
INSERT INTO CUSTOMER VALUES (4325, 'MARIOS', 'ANTREOU','MALE','PAFOS','GEROSKIPOU','VIZANTIOU','3',2525,TO_DATE('04.04.1987','DD.MM.YYYY'));
INSERT INTO CAR VALUES (1111111111, 'MAZDA', '3', 'BLUE', 'MANUAL', 'PETROL', 1600, TO_DATE('08.01.2013','DD.MM.YYYY'), 5000, 'CASH', 2, 4321);
INSERT INTO CAR VALUES (2222222222, 'TOYOTA', 'COROLLA','BLACK', 'MANUAL','PETROL',1600,TO_DATE('08.01.2013','DD.MM.YYYY'),7000,'FINANCE',2,4322);
INSERT INTO CAR VALUES (3333333333, 'TOYOTA', 'HILUX', 'GRAY', '4X4', 'DIESEL', 2500, TO_DATE('08.01.2013','DD.MM.YYYY'), 10000, 'CASH', 2 , 4325);
INSERT INTO CAR VALUES (4444444444, 'HONDA', 'CIVIC', 'BLACK', 'MANUAL', 'PETROL', 1300, TO_DATE('08.01.2013','DD.MM.YYYY'), 3000,'CASH', 2, 4323);
INSERT INTO CAR VALUES (5555555555, 'HONDA', 'INSIGHT', 'WHITE', 'AUTO', 'PETROL', 1500, TO_DATE('08.01.2013','DD.MM.YYYY'), 20000, 'FINANCE', 2, 4324);
INSERT INTO CAR_PARTS VALUES ('A20005B', 'RIGHT FRONT AXLE', 200);
INSERT INTO CAR_PARTS VALUES ('C15220C', 'AIR FILTER', 50);
INSERT INTO CAR_PARTS VALUES ('V99T', 'ENGINE GASKET', 80);
INSERT INTO CAR_PARTS VALUES ('A20004B', 'LEFT FRONT AXLE', 200);
INSERT INTO CAR_PARTS VALUES ('U9P002', 'INTAKE MANIFOLD', 300);
INSERT INTO USED_CAR VALUES (4444444444, 25000, TO_DATE('02.02.2000','DD.MM.YYYY'));
INSERT INTO USED_CAR VALUES (5555555555, 122000, TO_DATE('05.08.2003','DD.MM.YYYY'));
INSERT INTO SERVICE VALUES (TO_DATE('12.01.2013','DD.MM.YYYY'), TO_DATE('01.01.2013','DD.MM.YYYY'), 300, 0001, 4321, 'CASH', 1111111111);
INSERT INTO CUST_PHONUMBER VALUES (99123456, 4321, 'MOBILE');
INSERT INTO CUST_PHONUMBER VALUES (99849563, 4322, 'MOBILE');
INSERT INTO CUST_PHONUMBER VALUES (22568988, 4323, 'LANDLINE');
INSERT INTO CUST_PHONUMBER VALUES (25698974, 4324, 'LANDLINE');
INSERT INTO CUST_PHONUMBER VALUES (97584692, 4325, 'MOBILE');
INSERT INTO CAR_DEFECTS VALUES ('BROKEN SIDE MIRRORS|OIL LEAKS', 4444444444);
INSERT INTO CAR_DEFECTS VALUES ('RUSTY PAINT|WORN-OUT CLUTCH', 5555555555);
INSERT INTO EMPLOYEE_PHONUMBER VALUES (97989565, 1234);
INSERT INTO EMPLOYEE_PHONUMBER VALUES (97585858, 1235);
INSERT INTO EMPLOYEE_PHONUMBER VALUES (96525263, 1236);
INSERT INTO EMPLOYEE_PHONUMBER VALUES (97484852, 1237);
INSERT INTO SERVICE_DETAILS VALUES (0001, 'BROKEN FRONT RIGHT AXLE', 'REPLACED FRONT RIGHT AXLE');
INSERT INTO HAS VALUES ('A20005B', 1111111111);
INSERT INTO HAS VALUES ('A20004B', 1111111111);
INSERT INTO USES VALUES ('A20005B', 0001);