Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Given the following SQL commands, please answer the question 1-8. If your answer is no, please give the corresponding reason. 1. USE cs336_test; DROP TABLE

image text in transcribed
image text in transcribed
Given the following SQL commands, please answer the question 1-8. If your answer is no, please give the corresponding reason. 1. USE cs336_test; DROP TABLE IF EXISTS Enrolled; DROP TABLE IF EXISTS Students; CREATE TABLE Students (sid CHAR(20), sname CHAR(20), semail CHAR(50), age INT, GPA REAL, UNIQUE (sname, age), PRIMARY KEY(sid)); INSERT INTO Students (sid, sname, semail, age, GPA) VALUES ('CS336_1', 'Tom A', 'tom@cs.edu', 23, 3.3), ('CS336 2', 'Mike B', 'mikeB@cs.rutgers.edu', 22, 3.45), ('C5336_3', 'Smith C', 'smith@cs.rutgers.edu', 12, 3.5), (CS336_4', 'Smith D', 'smith@cs.rutgers.edu', 27, 4.00), ('CS336_5', 'Madayan', madayanacs.rutgers.edu', 18, 3.25); CREATE TABLE Enrolled (studid CHAR(20), cid CHAR(20), grade CHAR(2), PRIMARY KEY (studid, cid) SET FOREIGN_KEY_CHECKS=0; ALTER TABLE Enrolled ADD FOREIGN KEY(studid) REFERENCES Students(sid) ON UPDATE CASCADE; SET FOREIGN_KEY_CHECKS=1; INSERT INTO Enrolled (studid, cid, grade) VALUES ('CS336_2', 'Carnatic101', 'A'). ('CS336_3', 'Reggae203', 'B'), ('CS336_4', 'Topology112', 'A-'); -- 01: Can we run the following command successfully? Yes or No INSERT INTO Enrolled VALUES ('CS3361', NULL, A); -- Q2: Can we run the following command successfully? Yes or No INSERT INTO Enrolled VALUES ('CS336_1', 'CS226,NULL); -- Q3: Can we run the following command successfully? Yes or No INSERT INTO Enrolled VALUES ('CS336_1', CS336', 'C++); --04: Can we run the following command successfully? Yes or No DELETE FROM Students WHERE sid = 'CS336_2'; -- 05: Can we run the following command successfully? Yes or No UPDATE Students S SET S.sid = 'CS336 10 WHERE S.sid = 'CS336_3'; --06: Can we run the following command successfully? Yes or No DELETE FROM Enrolled WHERE studid = 'CS336_4'; -- 07: Can we run the following command successfully? Yes or No DELETE FROM Enrolled WHERE studid = 'CS336_5'; --08: Can we run the following command successfully? Yes or No UPDATE Enrolled E SET E.studid = 'CS336_4 WHERE E. studid = 'CS336_2

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

$45 is 60% of what amount? 6.

Answered: 1 week ago