1. Homepage
  2. Programming
  3. COMPSCI 351 : Fundamentals of Database Systems S1 C – Lab 01: Three-Schema Architecture, DDL and SQL

COMPSCI 351 : Fundamentals of Database Systems S1 C – Lab 01: Three-Schema Architecture, DDL and SQL

Engage in a Conversation
AustraliaUniversity of AucklandCOMPSCI 351Fundamentals of Database SystemsThree-Schema Architecture DDLSQL

Computer Science CourseNana.COM

COMPSCI 351 S1 C Lab 01 CourseNana.COM

15 marks in total = 1.5% of the final grade CourseNana.COM

This lab has an attendance component of [3 marks] CourseNana.COM

1. What are the advantages of using a database solution as compared to the traditional CourseNana.COM

file storage mechanism? What is the role of DBMS to a database system? CourseNana.COM

[2 marks] 2. What is the ‘Three-Schema Architecture’? What is the difference between the ‘Three- CourseNana.COM

Schema Architecture’ and the ‘Three Tier Client-Server Architecture’? CourseNana.COM

[2 marks] CourseNana.COM

3. Using the phpMyAdmin tool, enter the following DDL statements under the ‘SQL’ tab to create the student-course database schema. CourseNana.COM

CREATE TABLE STUDENT (
Name VARCHAR(30) NOT NULL, Student_number INTEGER NOT NULL, Class CHAR NOT NULL,
Major CHAR(4),
PRIMARY KEY (Student_number) );
CourseNana.COM

CREATE TABLE COURSE ( Course_name VARCHAR(30) NOT NULL, Course_number CHAR(8) NOT NULL, Credit_hours INTEGER,
Department CHAR(4),
PRIMARY KEY (Course_number), UNIQUE (Course_name) );
CourseNana.COM

CREATE TABLE PREREQUISITE (
Course_number CHAR(8) NOT NULL,
Prerequisite_number CHAR(8) NOT NULL,
PRIMARY KEY (Course_number, Prerequisite_number),
FOREIGN KEY (Course_number) REFERENCES COURSE (Course_number), FOREIGN KEY (Prerequisite_number) REFERENCES COURSE (Course_number) );
CourseNana.COM

CREATE TABLE SECTION (
Section_identifier INTEGER NOT NULL,
Course_number CHAR(8) NOT NULL,
Semester VARCHAR(6) NOT NULL,
Year CHAR(4) NOT NULL,
Instructor VARCHAR(15),
PRIMARY KEY (Section_identifier),
FOREIGN KEY (Course_number) REFERENCES COURSE (Course_number) );
CourseNana.COM

CREATE TABLE GRADE_REPORT ( Student_number INTEGER NOT NULL, Section_identifier INTEGER NOT NULL, Grade CHAR, CourseNana.COM

PRIMARY KEY (Student_number, Section_identifier),
FOREIGN KEY (Student_number) REFERENCES STUDENT (Student_number), FOREIGN KEY (Section_identifier) REFERENCES SECTION (Section_identifier) );
CourseNana.COM


CourseNana.COM

Populate the above database with the following DML statements under the ‘SQL’ tab. CourseNana.COM

INSERT INTO `STUDENT` (`Name`, `Student_number`, `Class`, `Major`) VALUES ('Smith', 17, '1', 'CS'),
('Brown', 8, '2', 'CS');
CourseNana.COM

INSERT INTO `COURSE` (`Course_name`, `Course_number`, `Credit_hours`, `Department`) VALUES
('Intro to Computer Science', 'CS1310', 4, 'CS'),
('Data Structures', 'CS3320', 4, 'CS'),
CourseNana.COM

('Discrete Mathematics', 'MATH2410', 3, 'MATH'), ('Database', 'CS3380', 3, 'CS'); CourseNana.COM

INSERT INTO `SECTION` (`Section_identifier`, `Course_number`, `Semester`, `Year`, `Instructor`) VALUES
(85, 'MATH2410', 'Fall', '07', 'King'),
(92, 'CS1310', 'Fall', '07', 'Anderson'),
CourseNana.COM

(102, 'CS3320', 'Spring', '08', 'Knuth'), (112, 'MATH2410', 'Fall', '08', 'Chang'), (119, 'CS1310', 'Fall', '08', 'Anderson'), (135, 'CS3380', 'Fall', '08', 'Stone'); CourseNana.COM

INSERT INTO `GRADE_REPORT` (`Student_number`, `Section_identifier`, `Grade`) VALUES
(17, 112, 'B'),
(17, 119, 'C'),
CourseNana.COM

(8, 85, 'A'), (8, 92, 'A'), (8, 102, 'B'), (8, 135, 'A'); CourseNana.COM

INSERT INTO `PREREQUISITE` (`Course_number`, `Prerequisite_number`) VALUES ('CS3380', 'CS3320'),
('CS3380', 'MATH2410'),
('CS3320', 'CS1310');
CourseNana.COM

You can download the “Lab01_Q3_Database.sql” file and execute the table creation and data population statements to obtain the above database state. CourseNana.COM

(a) Show content of the database state (i.e., the screenshot of each table displayed by the PhpMyAdmin tool). CourseNana.COM

The syntax of a basic database DML query statement is as follows. CourseNana.COM

[2 marks] CourseNana.COM


CourseNana.COM


CourseNana.COM

For example, the query statement to retrieve all the course information offered by the Computer Science department is as follows. CourseNana.COM

SELECT Course_name, Course_number, Credit_hours FROM COURSE
WHERE Department='CS'
CourseNana.COM

The query output as the screenshot by the PhpMyAdmin tool is: CourseNana.COM

Based on the query syntax and the example, answer the following questions and show the query output as screenshots similar to the above. CourseNana.COM

  1. (b)  Retrieve all the section information taught by the instructor 'Anderson'.

[2 marks] CourseNana.COM

  1. (c)  Retrieve all the grade and section information of the student with the ID number '8'.

[2 marks] CourseNana.COM

  1. (d)  Retrieve the perquisite course information of the course ‘CS3380’. Please display all the course information, such as the course number, name, credit and offering department.

[2 marks] CourseNana.COM


CourseNana.COM


CourseNana.COM

Get in Touch with Our Experts

WeChat WeChat
Whatsapp WhatsApp
Australia代写,University of Auckland代写,COMPSCI 351代写,Fundamentals of Database Systems代写,Three-Schema Architecture代写, DDL代写,SQL代写,Australia代编,University of Auckland代编,COMPSCI 351代编,Fundamentals of Database Systems代编,Three-Schema Architecture代编, DDL代编,SQL代编,Australia代考,University of Auckland代考,COMPSCI 351代考,Fundamentals of Database Systems代考,Three-Schema Architecture代考, DDL代考,SQL代考,Australiahelp,University of Aucklandhelp,COMPSCI 351help,Fundamentals of Database Systemshelp,Three-Schema Architecturehelp, DDLhelp,SQLhelp,Australia作业代写,University of Auckland作业代写,COMPSCI 351作业代写,Fundamentals of Database Systems作业代写,Three-Schema Architecture作业代写, DDL作业代写,SQL作业代写,Australia编程代写,University of Auckland编程代写,COMPSCI 351编程代写,Fundamentals of Database Systems编程代写,Three-Schema Architecture编程代写, DDL编程代写,SQL编程代写,Australiaprogramming help,University of Aucklandprogramming help,COMPSCI 351programming help,Fundamentals of Database Systemsprogramming help,Three-Schema Architectureprogramming help, DDLprogramming help,SQLprogramming help,Australiaassignment help,University of Aucklandassignment help,COMPSCI 351assignment help,Fundamentals of Database Systemsassignment help,Three-Schema Architectureassignment help, DDLassignment help,SQLassignment help,Australiasolution,University of Aucklandsolution,COMPSCI 351solution,Fundamentals of Database Systemssolution,Three-Schema Architecturesolution, DDLsolution,SQLsolution,