Question
ERROR: Only one expression can be specified in the select list when the subquery is not introduced with EXISTS. HELP. I am trying to insert
ERROR: Only one expression can be specified in the select list when the subquery is not introduced with EXISTS.
HELP. I am trying to insert data into the FavoritePlayer table, but I keep receiving that error. How do I fix this??
CREATE TABLE Player ( PlayerID INT NOT NULL PRIMARY KEY, LeagueID INT NOT NULL, FirstName VARCHAR(64) NOT NULL, LastName VARCHAR(64) NOT NULL, DateOfBirth DATE NOT NULL, CountryID INT NOT NULL, PlayerHeight DECIMAL NOT NULL, PlayerWeight INT NOT NULL, CONSTRAINT FK_LeagueID_Player FOREIGN KEY(LeagueID) REFERENCES ProfessionalAssociation, CONSTRAINT FK_CountryID_Player FOREIGN KEY (CountryID) REFERENCES Country);
CREATE TABLE FavoritePlayer ( FavoritePlayerID INT NOT NULL PRIMARY KEY, PlayerID INT NOT NULL, FavePlayerFirstName VARCHAR(64) NOT NULL, FavePlayerLastName VARCHAR(64) NOT NULL, CONSTRAINT FK_FavePlayerID FOREIGN KEY (FavoritePlayerID) REFERENCES UserAccount, CONSTRAINT FK_PlayerID_FavoritePlayer FOREIGN KEY (PlayerID) REFERENCES Player);
CREATE SEQUENCE FavoritePlayer_seq START WITH 1;
CREATE SEQUENCE Player_seq START WITH 1;
INSERT INTO Player VALUES (NEXT VALUE FOR Player_seq, 1, 'Roger', 'Federer', '1981-08-08', 216, 73, 187), (NEXT VALUE FOR Player_seq, 1, 'Rafael', 'Nadal', '1986-06-03', 209, 73, 187), (NEXT VALUE FOR Player_seq, 1, 'Novak', 'Djokovic', '1987-11-12', 196, 74, 176), (NEXT VALUE FOR Player_seq, 1, 'Daniil', 'Medvedev', '1996-02-11', 182, 78, 183), (NEXT VALUE FOR Player_seq, 1, 'Dominic', 'Thiem', '1993-09-03', 15, 73, 174), (NEXT VALUE FOR Player_seq, 1, 'Juan', 'del Potro', '1988-09-23', 11, 78, 214), (NEXT VALUE FOR Player_seq, 1, 'Andrey', 'Rublev', '1997-10-20', 182, 74, 143), (NEXT VALUE FOR Player_seq, 1, 'Alexander', 'Zverev', '1997-04-20', 83, 78, 198), (NEXT VALUE FOR Player_seq, 1, 'Stefanos', 'Tsitsipas', '1998-08-12', 86, 76, 187), (NEXT VALUE FOR Player_seq, 1, 'Stan', 'Wawrinka', '1985-08-12', 216, 72, 179), (NEXT VALUE FOR Player_seq, 2, 'Serena', 'Williams', '1981-09-26', 236, 69, 155), (NEXT VALUE FOR Player_seq, 2, 'Naomi', 'Osaka', '1997-10-16', 111, 71, 165), (NEXT VALUE FOR Player_seq, 2, 'Ashleigh', 'Barty', '1996-04-24', 14, 65, 137), (NEXT VALUE FOR Player_seq, 2, 'Simona', 'Halep', '1991-09-27', 181, 66, 132), (NEXT VALUE FOR Player_seq, 2, 'Sofia', 'Kenin', '1998-11-14', 236, 67, 126), (NEXT VALUE FOR Player_seq, 2, 'Petra', 'Kvitova', '1990-03-08', 59 , 72, 154), (NEXT VALUE FOR Player_seq, 2, 'Jennifer', 'Brady', '1995-03-08', 236 , 71, 150), (NEXT VALUE FOR Player_seq, 2, 'Elina', 'Svitolina', '1994-09-12', 231, 69, 132), (NEXT VALUE FOR Player_seq, 2, 'Aryna', 'Sabalenka', '1995-04-12', 21, 72, 176), (NEXT VALUE FOR Player_seq, 2, 'Azarenka', 'Victoria', '1995-04-12', 21, 72, 148);
INSERT INTO FavoritePlayer (FavoritePlayerID, PlayerID, FirstName, LastName) VALUES (NEXT VALUE FOR FavoritePlayer_seq, (SELECT PlayerID, FirstName, LastName from Player where PlayerID = 1)), (NEXT VALUE FOR FavoritePlayer_seq, (SELECT PlayerID, FirstName, LastName from Player where PlayerID = 2)), (NEXT VALUE FOR FavoritePlayer_seq, (SELECT PlayerID, FirstName, LastName from Player where PlayerID = 3)), (NEXT VALUE FOR FavoritePlayer_seq, (SELECT PlayerID, FirstName, LastName from Player where PlayerID = 4)), (NEXT VALUE FOR FavoritePlayer_seq, (SELECT PlayerID, FirstName, LastName from Player where PlayerID = 5)), (NEXT VALUE FOR FavoritePlayer_seq, (SELECT PlayerID, FirstName, LastName from Player where PlayerID = 6)), (NEXT VALUE FOR FavoritePlayer_seq, (SELECT PlayerID, FirstName, LastName from Player where PlayerID = 7)), (NEXT VALUE FOR FavoritePlayer_seq, (SELECT PlayerID, FirstName, LastName from Player where PlayerID = 8)), (NEXT VALUE FOR FavoritePlayer_seq, (SELECT PlayerID, FirstName, LastName from Player where PlayerID = 9)), (NEXT VALUE FOR FavoritePlayer_seq, (SELECT PlayerID, FirstName, LastName from Player where PlayerID = 10));
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started