Using the four tables I need help anwsering the problems below DROP TABLE Outcomes; DROP TABLE Battles; DROP TABLE Ships; DROP TABLE Classes; CREATE TABLE Classes ( className VARCHAR2(20), typeClass CHAR(2), country VARCHAR2(15), numGuns INTEGER, bore INTEGER, displacement INTEGER); CREATE TABLE Ships ( shipName VARCHAR2(20), shipClass VARCHAR2(20), launchYr INTEGER); CREATE TABLE Battles ( battleName VARCHAR2(20), battleYr INTEGER); CREATE TABLE Outcomes ( ship VARCHAR2(20), battle VARCHAR2(20), outcome VARCHAR2(10)); INSERT INTO Classes VALUES ('Iowa', 'bb', 'USA', 9, 16, 46000); INSERT INTO Ships VALUES ('Missouri', 'Iowa', 1944); INSERT INTO Battles VALUES ('Surigao Strait', 1944); INSERT INTO Outcomes (ship, battle, outcome) VALUES ('Missouri', 'Surigao Strait', 'ok'); COMMIT; Unique SQL statements are needed: 1. You want to specify that we cannot have 2 different outcomes for a ship in a battle. What constraint will you use for this? Write an SQL ALTER TABLE statement to specify this constraint. (Check the following statement gives an error: INSERT INTO Outcomes (ship, battle) VALUES ('Missouri', 'Surigao Strait');). 2. You want to specify that no 2 battles have the same battleName. What constraint will you use for this? Write an SQL ALTER TABLE statement to specify this constraint. (Check the following statement given an error: INSERT INTO Battles (battleName) VALUES ('Surigao Strait');) 3. You want to specify that the only values that are allowed for typeClass in the Classes table are bb and bc. What constraint will you use for this? Write an SQL ALTER TABLE statement to specify this constraint. (check that the following statement gives an error: INSERT INTO Classes(className, typeClass) VALUES ('Kongo', 'aa');) Please explain as well I need to practice

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
icon
Concept explainers
Question

Using the four tables I need help anwsering the problems below

DROP TABLE Outcomes;
DROP TABLE Battles;
DROP TABLE Ships;
DROP TABLE Classes;


CREATE TABLE Classes (
className VARCHAR2(20),
typeClass CHAR(2),
country VARCHAR2(15),
numGuns INTEGER,
bore INTEGER,
displacement INTEGER);


CREATE TABLE Ships (
shipName VARCHAR2(20),
shipClass VARCHAR2(20),
launchYr INTEGER);


CREATE TABLE Battles (
battleName VARCHAR2(20),
battleYr INTEGER);


CREATE TABLE Outcomes (
ship VARCHAR2(20),
battle VARCHAR2(20),
outcome VARCHAR2(10));


INSERT INTO Classes VALUES ('Iowa', 'bb', 'USA', 9, 16, 46000);
INSERT INTO Ships VALUES ('Missouri', 'Iowa', 1944);
INSERT INTO Battles VALUES ('Surigao Strait', 1944);
INSERT INTO Outcomes (ship, battle, outcome) VALUES ('Missouri', 'Surigao Strait',
'ok');
COMMIT;

Unique SQL statements are needed:
1. You want to specify that we cannot have 2 different outcomes for a ship in a battle. What
constraint will you use for this? Write an SQL ALTER TABLE statement to specify this
constraint.
(Check the following statement gives an error: INSERT INTO Outcomes (ship, battle)
VALUES ('Missouri', 'Surigao Strait');).

2. You want to specify that no 2 battles have the same battleName. What constraint will you use
for this? Write an SQL ALTER TABLE statement to specify this constraint.

(Check the following statement given an error: INSERT INTO Battles (battleName)
VALUES ('Surigao Strait');)

3. You want to specify that the only values that are allowed for typeClass in the Classes table
are bb and bc. What constraint will you use for this? Write an SQL ALTER TABLE
statement to specify this constraint.
(check that the following statement gives an error: INSERT INTO Classes(className,
typeClass) VALUES ('Kongo', 'aa');)

Please explain as well I need to practice

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 6 steps

Blurred answer
Knowledge Booster
Concepts in designing Database
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education