For task 2 to 3, please provide the SQL commands for fulfilling the tasks, including creating the database and tables, along with a screenshot of the results that you can pop up from the SQL server after finishes the tasks.

A Guide to SQL
9th Edition
ISBN:9781111527273
Author:Philip J. Pratt
Publisher:Philip J. Pratt
Chapter4: Single-table Queries
Section: Chapter Questions
Problem 15SCG
icon
Related questions
Question
2. Creating the tables with SQL commands:
CREATE TABLE Students (
sid INT PRIMARY KEY,
name VARCHAR(30),
login VARCHAR(30),
age INT,
gpa FLOAT
);
CREATE TABLE Enrolled (
sid INT,
cid VARCHAR(10),
grade CHAR(1),
PRIMARY KEY (sid, cid),
FOREIGN KEY (sid) REFERENCES
Students(sid)
2:
3. Filling the tables:
INSERT INTO Students (sid, name, login, age,
gpa) VALUES
(500132, 'Alice', 'alice@cs', 18, 3.5),
(500133, 'Bob', 'bob@ee', 18, 3.3),
(500134, 'Bob', 'bob@math', 19, 3.6);
INSERT INTO Enrolled (sid, cid, grade) VALUES
(500132, 'CS1011', 'C'),
(500132, 'CS1012', 'B'),
(500134, 'MA1003', 'D'),
(500133, 'EE2004', 'A');
Transcribed Image Text:2. Creating the tables with SQL commands: CREATE TABLE Students ( sid INT PRIMARY KEY, name VARCHAR(30), login VARCHAR(30), age INT, gpa FLOAT ); CREATE TABLE Enrolled ( sid INT, cid VARCHAR(10), grade CHAR(1), PRIMARY KEY (sid, cid), FOREIGN KEY (sid) REFERENCES Students(sid) 2: 3. Filling the tables: INSERT INTO Students (sid, name, login, age, gpa) VALUES (500132, 'Alice', 'alice@cs', 18, 3.5), (500133, 'Bob', 'bob@ee', 18, 3.3), (500134, 'Bob', 'bob@math', 19, 3.6); INSERT INTO Enrolled (sid, cid, grade) VALUES (500132, 'CS1011', 'C'), (500132, 'CS1012', 'B'), (500134, 'MA1003', 'D'), (500133, 'EE2004', 'A');
2. For task 2 to 3, please provide the SQL commands for
fulfilling the tasks, including creating the database and
tables, along with a screenshot of the results that you
can pop up from the SQL server after finishes the
tasks.
Transcribed Image Text:2. For task 2 to 3, please provide the SQL commands for fulfilling the tasks, including creating the database and tables, along with a screenshot of the results that you can pop up from the SQL server after finishes the tasks.
Expert Solution
steps

Step by step

Solved in 5 steps with 4 images

Blurred answer
Knowledge Booster
SQL Functions
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
A Guide to SQL
A Guide to SQL
Computer Science
ISBN:
9781111527273
Author:
Philip J. Pratt
Publisher:
Course Technology Ptr
Oracle 12c: SQL
Oracle 12c: SQL
Computer Science
ISBN:
9781305251038
Author:
Joan Casteel
Publisher:
Cengage Learning